diff mbox

[U-Boot,1/2] dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Message ID 1424295379-14689-1-git-send-email-marex@denx.de
State Accepted
Headers show

Commit Message

Marek Vasut Feb. 18, 2015, 9:36 p.m. UTC
Since device_unbind() is also defined in device-remove.c,
which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
is defined, protect the device_unbind() prototype with the
same CONFIG_DM_DEVICE_REMOVE check.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@ti.com>
---
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass Feb. 19, 2015, 1:06 a.m. UTC | #1
On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
>
> Since device_unbind() is also defined in device-remove.c,
> which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
> is defined, protect the device_unbind() prototype with the
> same CONFIG_DM_DEVICE_REMOVE check.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Tom Rini <trini@ti.com>
> ---
>  include/dm/device-internal.h | 4 ++++
>  1 file changed, 4 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>
Marek Vasut Feb. 19, 2015, 8:50 a.m. UTC | #2
On Thursday, February 19, 2015 at 02:06:38 AM, Simon Glass wrote:
> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
> > Since device_unbind() is also defined in device-remove.c,
> > which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
> > is defined, protect the device_unbind() prototype with the
> > same CONFIG_DM_DEVICE_REMOVE check.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Simon Glass <sjg@chromium.org>
> > Cc: Stefan Roese <sr@denx.de>
> > Cc: Tom Rini <trini@ti.com>
> > ---
> > 
> >  include/dm/device-internal.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> 
> Acked-by: Simon Glass <sjg@chromium.org>

Tom, can you please pick this one, I need it to repair the socfpga,
so I'd like to have it in before I submit new PR for that.

Thanks!

Best regards,
Marek Vasut
Simon Glass Feb. 19, 2015, 2:29 p.m. UTC | #3
Hi Marek,

On 19 February 2015 at 01:50, Marek Vasut <marex@denx.de> wrote:
> On Thursday, February 19, 2015 at 02:06:38 AM, Simon Glass wrote:
>> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
>> > Since device_unbind() is also defined in device-remove.c,
>> > which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
>> > is defined, protect the device_unbind() prototype with the
>> > same CONFIG_DM_DEVICE_REMOVE check.
>> >
>> > Signed-off-by: Marek Vasut <marex@denx.de>
>> > Cc: Simon Glass <sjg@chromium.org>
>> > Cc: Stefan Roese <sr@denx.de>
>> > Cc: Tom Rini <trini@ti.com>
>> > ---
>> >
>> >  include/dm/device-internal.h | 4 ++++
>> >  1 file changed, 4 insertions(+)
>>
>> Acked-by: Simon Glass <sjg@chromium.org>
>
> Tom, can you please pick this one, I need it to repair the socfpga,
> so I'd like to have it in before I submit new PR for that.

I'll bring it into u-boot-dm in any case.

I didn't see a build error though? What is broken at present?

Regards,
Simon
Marek Vasut Feb. 19, 2015, 2:34 p.m. UTC | #4
On Thursday, February 19, 2015 at 03:29:52 PM, Simon Glass wrote:
> Hi Marek,

Hi Simon,

> On 19 February 2015 at 01:50, Marek Vasut <marex@denx.de> wrote:
> > On Thursday, February 19, 2015 at 02:06:38 AM, Simon Glass wrote:
> >> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
> >> > Since device_unbind() is also defined in device-remove.c,
> >> > which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
> >> > is defined, protect the device_unbind() prototype with the
> >> > same CONFIG_DM_DEVICE_REMOVE check.
> >> > 
> >> > Signed-off-by: Marek Vasut <marex@denx.de>
> >> > Cc: Simon Glass <sjg@chromium.org>
> >> > Cc: Stefan Roese <sr@denx.de>
> >> > Cc: Tom Rini <trini@ti.com>
> >> > ---
> >> > 
> >> >  include/dm/device-internal.h | 4 ++++
> >> >  1 file changed, 4 insertions(+)
> >> 
> >> Acked-by: Simon Glass <sjg@chromium.org>
> > 
> > Tom, can you please pick this one, I need it to repair the socfpga,
> > so I'd like to have it in before I submit new PR for that.
> 
> I'll bring it into u-boot-dm in any case.
> 
> I didn't see a build error though? What is broken at present?

Try building u-boot-socfpga/master . The patches there enable DT 
(CONFIG_OF_CONTROL) on SoCFPGA always. And in case this is enabled,
the Cadence SPI and DW SPI drivers are compiled in. But those two
drivers require CONFIG_DM and CONFIG_DM_SPI ... and spi-uclass.c
contains calls to device_unbind() .

Best regards,
Marek Vasut
Simon Glass Feb. 19, 2015, 3:24 p.m. UTC | #5
Hi Marek,

On 19 February 2015 at 07:34, Marek Vasut <marex@denx.de> wrote:
> On Thursday, February 19, 2015 at 03:29:52 PM, Simon Glass wrote:
>> Hi Marek,
>
> Hi Simon,
>
>> On 19 February 2015 at 01:50, Marek Vasut <marex@denx.de> wrote:
>> > On Thursday, February 19, 2015 at 02:06:38 AM, Simon Glass wrote:
>> >> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
>> >> > Since device_unbind() is also defined in device-remove.c,
>> >> > which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
>> >> > is defined, protect the device_unbind() prototype with the
>> >> > same CONFIG_DM_DEVICE_REMOVE check.
>> >> >
>> >> > Signed-off-by: Marek Vasut <marex@denx.de>
>> >> > Cc: Simon Glass <sjg@chromium.org>
>> >> > Cc: Stefan Roese <sr@denx.de>
>> >> > Cc: Tom Rini <trini@ti.com>
>> >> > ---
>> >> >
>> >> >  include/dm/device-internal.h | 4 ++++
>> >> >  1 file changed, 4 insertions(+)
>> >>
>> >> Acked-by: Simon Glass <sjg@chromium.org>
>> >
>> > Tom, can you please pick this one, I need it to repair the socfpga,
>> > so I'd like to have it in before I submit new PR for that.
>>
>> I'll bring it into u-boot-dm in any case.
>>
>> I didn't see a build error though? What is broken at present?
>
> Try building u-boot-socfpga/master . The patches there enable DT
> (CONFIG_OF_CONTROL) on SoCFPGA always. And in case this is enabled,
> the Cadence SPI and DW SPI drivers are compiled in. But those two
> drivers require CONFIG_DM and CONFIG_DM_SPI ... and spi-uclass.c
> contains calls to device_unbind() .

Ah OK, so this a problem you have seen in new patches, not in mainline.

Regards,
Simon
Marek Vasut Feb. 19, 2015, 6:19 p.m. UTC | #6
On Thursday, February 19, 2015 at 04:24:02 PM, Simon Glass wrote:
> Hi Marek,

Hi Simon,

> On 19 February 2015 at 07:34, Marek Vasut <marex@denx.de> wrote:
> > On Thursday, February 19, 2015 at 03:29:52 PM, Simon Glass wrote:
> >> Hi Marek,
> > 
> > Hi Simon,
> > 
> >> On 19 February 2015 at 01:50, Marek Vasut <marex@denx.de> wrote:
> >> > On Thursday, February 19, 2015 at 02:06:38 AM, Simon Glass wrote:
> >> >> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
> >> >> > Since device_unbind() is also defined in device-remove.c,
> >> >> > which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
> >> >> > is defined, protect the device_unbind() prototype with the
> >> >> > same CONFIG_DM_DEVICE_REMOVE check.
> >> >> > 
> >> >> > Signed-off-by: Marek Vasut <marex@denx.de>
> >> >> > Cc: Simon Glass <sjg@chromium.org>
> >> >> > Cc: Stefan Roese <sr@denx.de>
> >> >> > Cc: Tom Rini <trini@ti.com>
> >> >> > ---
> >> >> > 
> >> >> >  include/dm/device-internal.h | 4 ++++
> >> >> >  1 file changed, 4 insertions(+)
> >> >> 
> >> >> Acked-by: Simon Glass <sjg@chromium.org>
> >> > 
> >> > Tom, can you please pick this one, I need it to repair the socfpga,
> >> > so I'd like to have it in before I submit new PR for that.
> >> 
> >> I'll bring it into u-boot-dm in any case.
> >> 
> >> I didn't see a build error though? What is broken at present?
> > 
> > Try building u-boot-socfpga/master . The patches there enable DT
> > (CONFIG_OF_CONTROL) on SoCFPGA always. And in case this is enabled,
> > the Cadence SPI and DW SPI drivers are compiled in. But those two
> > drivers require CONFIG_DM and CONFIG_DM_SPI ... and spi-uclass.c
> > contains calls to device_unbind() .
> 
> Ah OK, so this a problem you have seen in new patches, not in mainline.

It's only triggered by the new code, it is not introduced by this new code.
In case you enable either of those drivers as well as CONFIG_OF_CONTROL,
you will trigger this bug. 

In case I base those patches on v2015.04-rc1 , I don't see this error, but
in case I base those patches on top of v2015.04-rc2, I do see it. Do you
have any hint which changes between these two points can cause this breakage
please ?

Also, about the Kconfig, shall I introduce the entries for those two drivers
or what is the plan here ? I would like to get these patches into the current
release.

Best regards,
Marek Vasut
Simon Glass Feb. 19, 2015, 6:27 p.m. UTC | #7
On 18 February 2015 at 18:06, Simon Glass <sjg@chromium.org> wrote:
> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
>>
>> Since device_unbind() is also defined in device-remove.c,
>> which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
>> is defined, protect the device_unbind() prototype with the
>> same CONFIG_DM_DEVICE_REMOVE check.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Simon Glass <sjg@chromium.org>
>> Cc: Stefan Roese <sr@denx.de>
>> Cc: Tom Rini <trini@ti.com>
>> ---
>>  include/dm/device-internal.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
Simon Glass Feb. 20, 2015, 7:31 p.m. UTC | #8
Hi Marek,

On 19 February 2015 at 11:19, Marek Vasut <marex@denx.de> wrote:
> On Thursday, February 19, 2015 at 04:24:02 PM, Simon Glass wrote:
>> Hi Marek,
>
> Hi Simon,
>
>> On 19 February 2015 at 07:34, Marek Vasut <marex@denx.de> wrote:
>> > On Thursday, February 19, 2015 at 03:29:52 PM, Simon Glass wrote:
>> >> Hi Marek,
>> >
>> > Hi Simon,
>> >
>> >> On 19 February 2015 at 01:50, Marek Vasut <marex@denx.de> wrote:
>> >> > On Thursday, February 19, 2015 at 02:06:38 AM, Simon Glass wrote:
>> >> >> On 18 February 2015 at 14:36, Marek Vasut <marex@denx.de> wrote:
>> >> >> > Since device_unbind() is also defined in device-remove.c,
>> >> >> > which is compiled in only in case CONFIG_DM_DEVICE_REMOVE
>> >> >> > is defined, protect the device_unbind() prototype with the
>> >> >> > same CONFIG_DM_DEVICE_REMOVE check.
>> >> >> >
>> >> >> > Signed-off-by: Marek Vasut <marex@denx.de>
>> >> >> > Cc: Simon Glass <sjg@chromium.org>
>> >> >> > Cc: Stefan Roese <sr@denx.de>
>> >> >> > Cc: Tom Rini <trini@ti.com>
>> >> >> > ---
>> >> >> >
>> >> >> >  include/dm/device-internal.h | 4 ++++
>> >> >> >  1 file changed, 4 insertions(+)
>> >> >>
>> >> >> Acked-by: Simon Glass <sjg@chromium.org>
>> >> >
>> >> > Tom, can you please pick this one, I need it to repair the socfpga,
>> >> > so I'd like to have it in before I submit new PR for that.
>> >>
>> >> I'll bring it into u-boot-dm in any case.
>> >>
>> >> I didn't see a build error though? What is broken at present?
>> >
>> > Try building u-boot-socfpga/master . The patches there enable DT
>> > (CONFIG_OF_CONTROL) on SoCFPGA always. And in case this is enabled,
>> > the Cadence SPI and DW SPI drivers are compiled in. But those two
>> > drivers require CONFIG_DM and CONFIG_DM_SPI ... and spi-uclass.c
>> > contains calls to device_unbind() .
>>
>> Ah OK, so this a problem you have seen in new patches, not in mainline.
>
> It's only triggered by the new code, it is not introduced by this new code.
> In case you enable either of those drivers as well as CONFIG_OF_CONTROL,
> you will trigger this bug.
>
> In case I base those patches on v2015.04-rc1 , I don't see this error, but
> in case I base those patches on top of v2015.04-rc2, I do see it. Do you
> have any hint which changes between these two points can cause this breakage
> please ?

It is probably the Kconfig conversion - now there will be extra options enabled.

>
> Also, about the Kconfig, shall I introduce the entries for those two drivers
> or what is the plan here ? I would like to get these patches into the current
> release.

Yes please.

Regards,
Simon
Marek Vasut March 5, 2015, 9 p.m. UTC | #9
On Friday, February 20, 2015 at 08:31:20 PM, Simon Glass wrote:
> Hi Marek,

Hi Simon,

things are starting to settle down a bit finally.

[...]

> > In case I base those patches on v2015.04-rc1 , I don't see this error,
> > but in case I base those patches on top of v2015.04-rc2, I do see it. Do
> > you have any hint which changes between these two points can cause this
> > breakage please ?
> 
> It is probably the Kconfig conversion - now there will be extra options
> enabled.
> 
> > Also, about the Kconfig, shall I introduce the entries for those two
> > drivers or what is the plan here ? I would like to get these patches
> > into the current release.
> 
> Yes please.

Should be all taken care of now :)

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index f0cc794..e2418fe 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -101,7 +101,11 @@  static inline int device_remove(struct udevice *dev) { return 0; }
  * @dev: Pointer to device to unbind
  * @return 0 if OK, -ve on error
  */
+#ifdef CONFIG_DM_DEVICE_REMOVE
 int device_unbind(struct udevice *dev);
+#else
+static inline int device_unbind(struct udevice *dev) { return 0; }
+#endif
 
 #ifdef CONFIG_DM_DEVICE_REMOVE
 void device_free(struct udevice *dev);