Skip to contentSkip to conversation

dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

PATCH New Marek Vasut 2 participants 15 messages Feb 18, 2015 – Mar 5, 2015

lore
Share & tools
lore
#0 lore raw

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)
include/dm/device-internal.h +4 -0
index f0cc794..e2418fe 100644
@@ -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);
Signature · 1 line
2.1.3
#1 lore raw

PATCH 2/2 arm: socfpga: Enable DM for Cadence and DW SPI

Enable DM in case these two drivers are enabled, since these two drivers depend on DM.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/configs/socfpga_common.h | 4 ++++
 1 file changed, 4 insertions(+)
include/configs/socfpga_common.h +4 -0
index 6d93472..28fcbf3 100644
@@ -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
 
 /*
Signature · 1 line
2.1.3
#2 lore raw

PATCH 2/2 arm: socfpga: Enable DM for Cadence and DW SPI

Hi Marek,

Quoted 10 lines · Marek Vasut

Enable DM in case these two drivers are enabled, since these two drivers depend on DM.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/configs/socfpga_common.h | 4 ++++
 1 file changed, 4 insertions(+)

This should use Kconfig now.

Quoted 24 lines
include/configs/socfpga_common.h +4 -1
index 6d93472..28fcbf3 100644
@@ -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
 
 /*
--
Quoted 2 lines

2.1.3

Regards,
Simon

#3 lore raw

PATCH 2/2 arm: socfpga: Enable DM for Cadence and DW SPI

Quoted 12 lines · Simon Glass

Hi Marek,

Quoted 9 lines · Marek Vasut

Enable DM in case these two drivers are enabled, since these two drivers depend on DM.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 4 lines
Quoted 2 lines
 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

#4 lore raw

PATCH 2/2 arm: socfpga: Enable DM for Cadence and DW SPI

Hi Marek,

Quoted 16 lines · Marek Vasut
Quoted 15 lines · Simon Glass

Hi Marek,

Quoted 11 lines · Marek Vasut

Enable DM in case these two drivers are enabled, since these two drivers depend on DM.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

 include/configs/socfpga_common.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 6 lines
Quoted 1 line

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

#5 lore raw

PATCH 2/2 arm: socfpga: Enable DM for Cadence and DW SPI

Quoted 1 line · Simon Glass

Hi Marek,

Hi Simon,

Quoted 17 lines · Marek Vasut
Quoted 16 lines · Simon Glass
Quoted 15 lines

Hi Marek,

Quoted 11 lines · Marek Vasut

Enable DM in case these two drivers are enabled, since these two drivers depend on DM.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

 include/configs/socfpga_common.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

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

#6 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

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.

Quoted 7 lines
Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)
#7 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Quoted 12 lines · Simon Glass
Quoted 11 lines · Marek Vasut

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 4 lines
Quoted 2 lines
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

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

#8 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Hi Marek,

Quoted 13 lines · Marek Vasut
Quoted 12 lines · Simon Glass
Quoted 11 lines · Marek Vasut

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

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

#9 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Quoted 1 line · Simon Glass

Hi Marek,

Hi Simon,

Quoted 17 lines · Marek Vasut
Quoted 16 lines · Simon Glass
Quoted 15 lines · Marek Vasut
Quoted 13 lines

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 8 lines
Quoted 4 lines
Quoted 1 line

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

#10 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Hi Marek,

Quoted 29 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi Simon,

Quoted 24 lines · Marek Vasut
Quoted 13 lines · Simon Glass
Quoted 12 lines · Marek Vasut
Quoted 11 lines

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

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.

Quoted 7 lines
Quoted 1 line

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

#11 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Quoted 1 line · Simon Glass

Hi Marek,

Hi Simon,

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Simon Glass
Quoted 1 line

Hi Marek,

Hi Simon,

Quoted 25 lines · Marek Vasut
Quoted 13 lines · Simon Glass
Quoted 12 lines · Marek Vasut
Quoted 11 lines

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

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?

Quoted 7 lines
Quoted 5 lines

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

#12 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Hi Marek,

Quoted 45 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi Simon,

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Simon Glass
Quoted 1 line

Hi Marek,

Hi Simon,

Quoted 25 lines · Marek Vasut
Quoted 13 lines · Simon Glass
Quoted 12 lines · Marek Vasut
Quoted 11 lines

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.

Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

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?

Quoted 7 lines
Quoted 5 lines

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.

Quoted 8 lines

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.

Quoted 4 lines

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

#13 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

Quoted 1 line · Simon Glass

Hi Marek,

Hi Simon,

things are starting to settle down a bit finally.

[...]

Quoted 5 lines
Quoted 4 lines

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 ?

Quoted 8 lines

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

Quoted 3 lines

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

#14 lore raw

PATCH 1/2 dm: Protect device_unbind() with CONFIG_DM_DEVICE_REMOVE

In reply to Simon Glass
Quoted 15 lines · Simon Glass
Quoted 6 lines · Marek Vasut

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.

Quoted 7 lines
Cc Simon Glass <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/dm/device-internal.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 1 line

Applied to u-boot-dm, thanks!