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

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(+)
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);

Enable DM in case these two drivers are enabled, since these two drivers depend on DM.
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/configs/socfpga_common.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 6d93472..28fcbf3 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -190,6 +190,8 @@ unsigned int cm_get_l4_sp_clk_hz(void); */ #ifdef CONFIG_OF_CONTROL /* QSPI is controlled via DT */ #define CONFIG_CADENCE_QSPI +#define CONFIG_DM +#define CONFIG_DM_SPI /* Enable multiple SPI NOR flash manufacturers */ #define CONFIG_SPI_FLASH /* SPI flash subsystem */ #define CONFIG_SPI_FLASH_STMICRO /* Micron/Numonyx flash */ @@ -207,6 +209,8 @@ unsigned int cm_get_qspi_controller_clk_hz(void); #ifdef CONFIG_OF_CONTROL /* DW SPI is controlled via DT */ #define CONFIG_DESIGNWARE_SPI #define CONFIG_CMD_SPI +#define CONFIG_DM +#define CONFIG_DM_SPI #endif
/*

Hi Marek,
On 18 February 2015 at 14:36, Marek Vasut marex@denx.de wrote:
Enable DM in case these two drivers are enabled, since these two drivers depend on DM.
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/configs/socfpga_common.h | 4 ++++ 1 file changed, 4 insertions(+)
This should use Kconfig now.
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 6d93472..28fcbf3 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -190,6 +190,8 @@ unsigned int cm_get_l4_sp_clk_hz(void); */ #ifdef CONFIG_OF_CONTROL /* QSPI is controlled via DT */ #define CONFIG_CADENCE_QSPI +#define CONFIG_DM +#define CONFIG_DM_SPI /* Enable multiple SPI NOR flash manufacturers */ #define CONFIG_SPI_FLASH /* SPI flash subsystem */ #define CONFIG_SPI_FLASH_STMICRO /* Micron/Numonyx flash */ @@ -207,6 +209,8 @@ unsigned int cm_get_qspi_controller_clk_hz(void); #ifdef CONFIG_OF_CONTROL /* DW SPI is controlled via DT */ #define CONFIG_DESIGNWARE_SPI #define CONFIG_CMD_SPI +#define CONFIG_DM +#define CONFIG_DM_SPI #endif
/*
2.1.3
Regards, Simon

On Thursday, February 19, 2015 at 02:07:13 AM, Simon Glass wrote:
Hi Marek,
On 18 February 2015 at 14:36, Marek Vasut marex@denx.de wrote:
Enable DM in case these two drivers are enabled, since these two drivers depend on DM.
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/configs/socfpga_common.h | 4 ++++ 1 file changed, 4 insertions(+)
This should use Kconfig now.
Hi,
there's still no Cadence SPI nor DW SPI controller entry in drivers/spi/Kconfig, shall I add those then ?
Best regards, Marek Vasut

Hi Marek,
On 19 February 2015 at 02:44, Marek Vasut marex@denx.de wrote:
On Thursday, February 19, 2015 at 02:07:13 AM, Simon Glass wrote:
Hi Marek,
On 18 February 2015 at 14:36, Marek Vasut marex@denx.de wrote:
Enable DM in case these two drivers are enabled, since these two drivers depend on DM.
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/configs/socfpga_common.h | 4 ++++ 1 file changed, 4 insertions(+)
This should use Kconfig now.
Hi,
there's still no Cadence SPI nor DW SPI controller entry in drivers/spi/Kconfig, shall I add those then ?
Yes, more Kconfig is good.
Regards, Simon

On Thursday, February 19, 2015 at 07:28:00 PM, Simon Glass wrote:
Hi Marek,
Hi Simon,
On 19 February 2015 at 02:44, Marek Vasut marex@denx.de wrote:
On Thursday, February 19, 2015 at 02:07:13 AM, Simon Glass wrote:
Hi Marek,
On 18 February 2015 at 14:36, Marek Vasut marex@denx.de wrote:
Enable DM in case these two drivers are enabled, since these two drivers depend on DM.
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/configs/socfpga_common.h | 4 ++++ 1 file changed, 4 insertions(+)
This should use Kconfig now.
Hi,
there's still no Cadence SPI nor DW SPI controller entry in drivers/spi/Kconfig, shall I add those then ?
Yes, more Kconfig is good.
Yep :)
Best regards, Marek Vasut

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

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

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

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

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

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

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

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

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!
participants (2)
-
Marek Vasut
-
Simon Glass