Skip to contentSkip to conversation

usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

PATCH New Derald D. Woods 3 participants 13 messages May 28, 2019 – Jul 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
  ret = musb_register(&platdata->plat,
      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/musb-new/omap2430.c +6 -2
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
 	struct musb_host_data *host = dev_get_priv(dev);
+#else
+	struct musb *musbp;
 #endif
 	struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
 	struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
 	struct omap_musb_board_data *otg_board_data;
-	int ret;
+	int ret = 0;
 	void *base = dev_read_addr_ptr(dev);
 
 	priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
 	ret = musb_lowlevel_init(host);
 #else
-	ret = musb_register(&platdata->plat,
+	musbp = musb_register(&platdata->plat,
 			  (struct device *)otg_board_data,
 			  platdata->base);
+	if (IS_ERR_OR_NULL(musbp))
+		return -EINVAL;
 #endif
 	return ret;
 }
Signature · 1 line
2.21.0
#1 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 42 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
  ret = musb_register(&platdata->plat,
      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/musb-new/omap2430.c +3 -1
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
 	struct musb_host_data *host = dev_get_priv(dev);
+#else
+	struct musb *musbp;
 #endif
 	struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
 	struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
 	struct omap_musb_board_data *otg_board_data;
-	int ret;
+	int ret = 0;
 	void *base = dev_read_addr_ptr(dev);
 
 	priv->desc_before_addr = true;

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 9 lines
drivers/usb/musb-new/omap2430.c +3 -1
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
 	ret = musb_lowlevel_init(host);
 #else
-	ret = musb_register(&platdata->plat,
+	musbp = musb_register(&platdata->plat,
 			  (struct device *)otg_board_data,
 			  platdata->base);
+	if (IS_ERR_OR_NULL(musbp))
+		return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

Quoted 4 lines
drivers/usb/musb-new/omap2430.c +0 -0
 #endif
 	return ret;
 }
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 45 lines · Marek Vasut
Quoted 43 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
  ret = musb_register(&platdata->plat,
      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/musb-new/omap2430.c +3 -1
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;
 #endif
      struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
Quoted 12 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 8 lines
drivers/usb/musb-new/omap2430.c +3 -1
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

This was just a non-structural change to eliminate a compiler warning. I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

Derald

Quoted 9 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 248

Quoted 4 lines
drivers/usb/musb-new/omap2430.c +0 -0
 #endif
      return ret;
 }

--
Best regards,
Marek Vasut

#3 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 5 lines · Derald Woods
Quoted 4 lines · Marek Vasut
Quoted 2 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
Quoted 8 lines
Quoted 8 lines

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
ret = musb_register(&platdata->plat,

      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

Skip to the end first

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 10 lines
Quoted 10 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 219

Quoted 10 lines
drivers/usb/musb-new/omap2430.c +2 -0
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;

Drop this hunk

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/usb/musb-new/omap2430.c +1 -1
 #endif
      struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
Quoted 7 lines
Quoted 7 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 241

Quoted 7 lines
drivers/usb/musb-new/omap2430.c +1 -1
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,

Replace musbp with host->host

Quoted 3 lines
Quoted 3 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 244

Quoted 3 lines
drivers/usb/musb-new/omap2430.c +1 -0
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))

here too

Quoted 10 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 1 line
drivers/usb/musb-new/omap2430.c +1 -0
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

This was just a non-structural change to eliminate a compiler warning. I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

See above, I believe that should fix the problem _and_ not crash in the .remove() .

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 72 lines · Marek Vasut
Quoted 5 lines · Derald Woods
Quoted 4 lines · Marek Vasut
Quoted 2 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
Quoted 8 lines
Quoted 8 lines

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
ret = musb_register(&platdata->plat,

      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

Skip to the end first

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 10 lines
Quoted 10 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 219

Quoted 10 lines
drivers/usb/musb-new/omap2430.c +2 -0
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;

Drop this hunk

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/usb/musb-new/omap2430.c +1 -1
 #endif
      struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
Quoted 7 lines
Quoted 7 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 241

Quoted 7 lines
drivers/usb/musb-new/omap2430.c +1 -1
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,

Replace musbp with host->host

Quoted 3 lines
Quoted 3 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 244

Quoted 3 lines
drivers/usb/musb-new/omap2430.c +1 -0
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))

here too

Quoted 6 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 1 line
drivers/usb/musb-new/omap2430.c +1 -0
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

Quoted 8 lines
Quoted 4 lines

This was just a non-structural change to eliminate a compiler warning. I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

See above, I believe that should fix the problem _and_ not crash in the .remove() .

As with 'ti-musb', there needs to be a clear distinction between 'host' and 'peripheral'/'gadget'. The issues here are much more broad than the compile warning that I was trying to address. The required refactoring, for USB Gadgets, deserves a proper series for older OMAP3 devices.

I would rather _DROP_ this patch than apply something that could result in a series of kludges.

Thanks for the feedback.

Derald

Quoted 3 lines

--
Best regards,
Marek Vasut

#5 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 82 lines · Derald Woods
Quoted 72 lines · Marek Vasut
Quoted 5 lines · Derald Woods
Quoted 4 lines · Marek Vasut
Quoted 2 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
Quoted 8 lines
Quoted 8 lines

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
ret = musb_register(&platdata->plat,

      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

Skip to the end first

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 10 lines
Quoted 10 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 219

Quoted 10 lines
drivers/usb/musb-new/omap2430.c +2 -0
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;

Drop this hunk

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/usb/musb-new/omap2430.c +1 -1
 #endif
      struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
Quoted 7 lines
Quoted 7 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 241

Quoted 7 lines
drivers/usb/musb-new/omap2430.c +1 -1
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,

Replace musbp with host->host

Quoted 3 lines
Quoted 3 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 244

Quoted 3 lines
drivers/usb/musb-new/omap2430.c +1 -0
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))

here too

Quoted 6 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 1 line
drivers/usb/musb-new/omap2430.c +1 -0
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

Quoted 8 lines
Quoted 4 lines

This was just a non-structural change to eliminate a compiler warning. I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

See above, I believe that should fix the problem _and_ not crash in the .remove() .

Quoted 8 lines

As with 'ti-musb', there needs to be a clear distinction between 'host' and 'peripheral'/'gadget'. The issues here are much more broad than the compile warning that I was trying to address. The required refactoring, for USB Gadgets, deserves a proper series for older OMAP3 devices.

I would rather _DROP_ this patch than apply something that could result in a series of kludges.

Does the following patch work for you ?

(quoted diff) +0 -0

b/drivers/usb/musb-new/omap2430.c
index 32743aa72c..bffcb61eaf 100644

drivers/usb/musb-new/omap2430.c +4 -1
@@ -236,9 +236,12 @@ static int omap2430_musb_probe(struct udevice *dev)
 
        ret = musb_lowlevel_init(host);
 #else
-       ret = musb_register(&platdata->plat,
+       host->host = musb_register(&platdata->plat,
                          (struct device *)otg_board_data,
                          platdata->base);
+
+       if (!host->host)
+               return -EIO;
 #endif
        return ret;
 }
Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 90 lines · Marek Vasut
Quoted 88 lines · Derald Woods
Quoted 72 lines · Marek Vasut
Quoted 5 lines · Derald Woods
Quoted 4 lines · Marek Vasut
Quoted 2 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
Quoted 8 lines
Quoted 8 lines

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
ret = musb_register(&platdata->plat,

      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

Skip to the end first

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 10 lines
Quoted 10 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 219

Quoted 10 lines
drivers/usb/musb-new/omap2430.c +2 -0
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;

Drop this hunk

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/usb/musb-new/omap2430.c +1 -1
 #endif
      struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
Quoted 7 lines
Quoted 7 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 241

Quoted 7 lines
drivers/usb/musb-new/omap2430.c +1 -1
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,

Replace musbp with host->host

Quoted 3 lines
Quoted 3 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev)

Quoted 3 lines
drivers/usb/musb-new/omap2430.c +1 -0
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))

here too

Quoted 6 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 1 line
drivers/usb/musb-new/omap2430.c +1 -0
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

Quoted 8 lines
Quoted 4 lines

This was just a non-structural change to eliminate a compiler warning. I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

See above, I believe that should fix the problem _and_ not crash in the .remove() .

As with 'ti-musb', there needs to be a clear distinction between 'host' and 'peripheral'/'gadget'. The issues here are much more broad than the compile warning that I was trying to address. The required refactoring, for USB Gadgets, deserves a proper series for older OMAP3 devices.

Quoted 5 lines
Quoted 2 lines

I would rather _DROP_ this patch than apply something that could result in a series of kludges.

Does the following patch work for you ?

My use case does _not_ enable 'CONFIG_USB_MUSB_HOST'. The C preprocessor directives prevent 'host->host' from being included in compilation in that case.

Derald

Quoted 23 lines
drivers/usb/musb-new/omap2430.c +4 -2
index 32743aa72c..bffcb61eaf 100644
@@ -236,9 +236,12 @@ static int omap2430_musb_probe(struct udevice *dev)
 
        ret = musb_lowlevel_init(host);
 #else
-       ret = musb_register(&platdata->plat,
+       host->host = musb_register(&platdata->plat,
                          (struct device *)otg_board_data,
                          platdata->base);
+
+       if (!host->host)
+               return -EIO;
 #endif
        return ret;
 }
 
--

Best regards,
Marek Vasut

#7 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 94 lines · Derald Woods
Quoted 93 lines · Marek Vasut
Quoted 90 lines · Derald Woods
Quoted 72 lines · Marek Vasut
Quoted 5 lines · Derald Woods
Quoted 4 lines · Marek Vasut
Quoted 2 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
Quoted 8 lines
Quoted 8 lines

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
ret = musb_register(&platdata->plat,

      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

Skip to the end first

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Quoted 10 lines
Quoted 10 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 219

Quoted 10 lines
drivers/usb/musb-new/omap2430.c +2 -0
index 32743aa72c..cca1653f1e 100644
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct udevice *dev)
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;

Drop this hunk

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/usb/musb-new/omap2430.c +1 -1
 #endif
      struct omap2430_musb_platdata *platdata = dev_get_platdata(dev);
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
Quoted 7 lines
Quoted 7 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 241

Quoted 7 lines
drivers/usb/musb-new/omap2430.c +1 -1
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice *dev)
 
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,

Replace musbp with host->host

Quoted 3 lines
Quoted 3 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev)

Quoted 3 lines
drivers/usb/musb-new/omap2430.c +1 -0
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))

here too

Quoted 6 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev) · line 245

Quoted 1 line
drivers/usb/musb-new/omap2430.c +1 -0
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private data , so it can call musb_stop() in .remove callback . Can you do the same?

Quoted 8 lines
Quoted 4 lines

This was just a non-structural change to eliminate a compiler warning. I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

See above, I believe that should fix the problem _and_ not crash in the .remove() .

As with 'ti-musb', there needs to be a clear distinction between 'host' and 'peripheral'/'gadget'. The issues here are much more broad than the compile warning that I was trying to address. The required refactoring, for USB Gadgets, deserves a proper series for older OMAP3 devices.

I would rather _DROP_ this patch than apply something that could result in a series of kludges.

Quoted 6 lines
Quoted 2 lines

Does the following patch work for you ?

My use case does _not_ enable 'CONFIG_USB_MUSB_HOST'. The C preprocessor directives prevent 'host->host' from being included in compilation in that case.

drivers/usb/musb-new/musb_uboot.h doesn't have any special stuff to remove the struct musb_host_data { struct musb *musb ... } field . What am I missing ?

The patch compiles fine for omap3_beagle_defconfig too, which doesn't enable the MUSB_HOST.

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 115 lines · On Wed, 29 May 2019, 05:07 Marek Vasut, <[email protected]> wrote:
Quoted 1 line · Derald Woods

On Tue, May 28, 2019 at 7:49 PM Marek Vasut <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines · Derald Woods
Quoted 1 line

On Tue, May 28, 2019 at 6:27 PM Marek Vasut <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Derald Woods
Quoted 1 line

On Tue, May 28, 2019 at 4:16 PM Marek Vasut <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Derald D. Woods
Quoted 1 line

This commit addresses the following warning, when _NOT_

USB_MUSB_HOST:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6:
warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

ret = musb_register(&platdata->plat,

      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Skip to the end first

Quoted 6 lines
Quoted 6 lines

Review

Quoted 6 lines
---
 drivers/usb/musb-new/omap2430.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/musb-new/omap2430.c

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct

Quoted 4 lines

index 32743aa72c..cca1653f1e 100644

drivers/usb/musb-new/omap2430.c +0 -0
@@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct

udevice *dev)

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct · line 219

Quoted 5 lines
drivers/usb/musb-new/omap2430.c +2 -0
 {
 #ifdef CONFIG_USB_MUSB_HOST
      struct musb_host_data *host = dev_get_priv(dev);
+#else
+     struct musb *musbp;

Drop this hunk

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/usb/musb-new/omap2430.c +0 -0
 #endif
      struct omap2430_musb_platdata *platdata =

dev_get_platdata(dev);

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice

Quoted 8 lines
drivers/usb/musb-new/omap2430.c +1 -1
      struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
      struct omap_musb_board_data *otg_board_data;
-     int ret;
+     int ret = 0;
      void *base = dev_read_addr_ptr(dev);
 
      priv->desc_before_addr = true;
@@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct udevice

*dev)

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
Quoted 5 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice *dev)

Quoted 5 lines
drivers/usb/musb-new/omap2430.c +1 -1
      ret = musb_lowlevel_init(host);
 #else
-     ret = musb_register(&platdata->plat,
+     musbp = musb_register(&platdata->plat,

Replace musbp with host->host

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/usb/musb-new/omap2430.c +1 -0
                        (struct device *)otg_board_data,
                        platdata->base);
+     if (IS_ERR_OR_NULL(musbp))
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

here too

Quoted 3 lines
Quoted 3 lines

drivers/usb/musb-new/omap2430.c static int omap2430_musb_probe(struct udevice · line 244

Quoted 1 line
drivers/usb/musb-new/omap2430.c +1 -0
+             return -EINVAL;

For example the pic32 glue code holds the musb_host_data in private

data

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

, so it can call musb_stop() in .remove callback . Can you do the

same?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

This was just a non-structural change to eliminate a compiler

warning.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

I agree that other things can/should be done with this driver. That work would be outside of what I was trying to accomplsh here, at the moment.

See above, I believe that should fix the problem _and_ not crash in

the

Quoted 15 lines
Quoted 14 lines
Quoted 11 lines
Quoted 2 lines

.remove() .

As with 'ti-musb', there needs to be a clear distinction between 'host' and 'peripheral'/'gadget'. The issues here are much more broad than the compile warning that I was trying to address. The required refactoring, for USB Gadgets, deserves a proper series for older OMAP3 devices.

I would rather _DROP_ this patch than apply something that could result in a series of kludges.

Does the following patch work for you ?

Quoted 8 lines
Quoted 3 lines

My use case does _not_ enable 'CONFIG_USB_MUSB_HOST'. The C preprocessor directives prevent 'host->host' from being included in compilation in that case.

drivers/usb/musb-new/musb_uboot.h doesn't have any special stuff to remove the struct musb_host_data { struct musb *musb ... } field . What am I missing ?

The code is guarded by CPP directives. You are speaking of a more extensive refactoring/changing of the driver. There is a set of patches on the mailing list, by Adam Ford, that does just that. Or at least makes the proper start. I will look at those as a start. I am dropping my effort on this single compilation fix patch. So I will be looking at a different path.

Thanks again.

Derald

Quoted 7 lines

The patch compiles fine for omap3_beagle_defconfig too, which doesn't enable the MUSB_HOST.

--
Best regards,
Marek Vasut

#9 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 134 lines · Derald Woods

On Wed, 29 May 2019, 05:07 Marek Vasut, <[email protected] <mailto:[email protected]>> wrote:

    On 5/29/19 3:34 AM, Derald Woods wrote:
    > On Tue, May 28, 2019 at 7:49 PM Marek Vasut <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> On 5/29/19 2:00 AM, Derald Woods wrote:
    >>> On Tue, May 28, 2019 at 6:27 PM Marek Vasut
    <marek.vasut at gmail.com <mailto:[email protected]>> wrote:
    >>>>
    >>>> On 5/29/19 1:16 AM, Derald Woods wrote:
    >>>>> On Tue, May 28, 2019 at 4:16 PM Marek Vasut
    <marek.vasut at gmail.com <mailto:[email protected]>> wrote:
    >>>>>>
    >>>>>> On 5/28/19 4:22 AM, Derald D. Woods wrote:
    >>>>>>> This commit addresses the following warning, when _NOT_
    USB_MUSB_HOST:
    >>>>>>>
    >>>>>>> [...]
    >>>>>>>   CC      drivers/usb/gadget/f_mass_storage.o
    >>>>>>>   CC      drivers/usb/musb-new/omap2430.o
    >>>>>>>   CC      drivers/usb/gadget/f_fastboot.o
    >>>>>>>   CC      env/common.o
    >>>>>>>   CC      env/env.o
    >>>>>>>
    /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:
    In function ‘omap2430_musb_probe’:
    >>>>>>>
    /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6:
    warning: assignment to ‘int’ from ‘struct musb *’ makes integer from
    pointer without a cast [-Wint-conversion]
    >>>>>>>   ret = musb_register(&platdata->plat,
    >>>>>>>       ^
    >>>>>>>   LD      drivers/usb/host/built-in.o
    >>>>>>>   CC      drivers/usb/gadget/f_sdp.o
    >>>>>>>   CC      fs/ext4/ext4fs.o
    >>>>>>> [...]
    >>>>
    >>>> Skip to the end first
    >>>>
    >>>>>>> Signed-off-by: Derald D. Woods <[email protected]
    <mailto:[email protected]>>
    >>>>>>> ---
    >>>>>>>  drivers/usb/musb-new/omap2430.c | 8 ++++++--
    >>>>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
    >>>>>>>
    >>>>>>> diff --git a/drivers/usb/musb-new/omap2430.c
    b/drivers/usb/musb-new/omap2430.c
    >>>>>>> index 32743aa72c..cca1653f1e 100644
    >>>>>>> --- a/drivers/usb/musb-new/omap2430.c
    >>>>>>> +++ b/drivers/usb/musb-new/omap2430.c
    >>>>>>> @@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct
    udevice *dev)
    >>>>>>>  {
    >>>>>>>  #ifdef CONFIG_USB_MUSB_HOST
    >>>>>>>       struct musb_host_data *host = dev_get_priv(dev);
    >>>>>>> +#else
    >>>>>>> +     struct musb *musbp;
    >>>>
    >>>> Drop this hunk
    >>>>
    >>>>>>>  #endif
    >>>>>>>       struct omap2430_musb_platdata *platdata =
    dev_get_platdata(dev);
    >>>>>>>       struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
    >>>>>>>       struct omap_musb_board_data *otg_board_data;
    >>>>>>> -     int ret;
    >>>>>>> +     int ret = 0;
    >>>>>>>       void *base = dev_read_addr_ptr(dev);
    >>>>>>>
    >>>>>>>       priv->desc_before_addr = true;
    >>>>>>> @@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct
    udevice *dev)
    >>>>>>>
    >>>>>>>       ret = musb_lowlevel_init(host);
    >>>>>>>  #else
    >>>>>>> -     ret = musb_register(&platdata->plat,
    >>>>>>> +     musbp = musb_register(&platdata->plat,
    >>>>
    >>>> Replace musbp with host->host
    >>>>
    >>>>>>>                         (struct device *)otg_board_data,
    >>>>>>>                         platdata->base);
    >>>>>>> +     if (IS_ERR_OR_NULL(musbp))
    >>>>
    >>>> here too
    >>>>
    >>>>>>> +             return -EINVAL;
    >>>>>>
    >>>>>> For example the pic32 glue code holds the musb_host_data in
    private data
    >>>>>> , so it can call musb_stop() in .remove callback . Can you do
    the same?
    >>>>>>
    >>>>>
    >>>>> This was just a non-structural change to eliminate a compiler
    warning.
    >>>>> I agree that other things can/should be done with this driver.
    That
    >>>>> work would be outside of what I was trying to accomplsh here,
    at the
    >>>>> moment.
    >>>>
    >>>> See above, I believe that should fix the problem _and_ not
    crash in the
    >>>> .remove() .
    >>>>
    >>>
    >>> As with 'ti-musb', there needs to be a clear distinction between
    >>> 'host' and 'peripheral'/'gadget'. The issues here are much more
    broad
    >>> than the compile warning that I was trying to address. The required
    >>> refactoring, for USB Gadgets, deserves a proper series for older
    OMAP3
    >>> devices.
    >>>
    >>> I would rather _DROP_ this patch than apply something that could
    >>> result in a series of kludges.
    >>
    >> Does the following patch work for you ?
    >>
    >
    > My use case does _not_ enable 'CONFIG_USB_MUSB_HOST'. The C
    > preprocessor directives prevent 'host->host' from being included in
    > compilation in that case.

    drivers/usb/musb-new/musb_uboot.h doesn't have any special stuff to
    remove the struct musb_host_data { struct musb *musb ... } field .
    What am I missing ?
Quoted 1 line

The code is guarded by CPP directives.

Can you point out the code you're talking about ? Which CPP directive do you have in mind exactly?

Quoted 2 lines

You are speaking of a more
extensive refactoring/changing of the driver.

I am speaking of that diff I posted a few hours ago, nothing else. This should fix this problem _and_ not fail in the remove path. There is no refactoring necessary for that to work.

Quoted 5 lines

There is a set of patches
on the mailing list, by Adam Ford, that does just that. Or at least makes the proper start. I will look at those as a start. I am dropping my effort on this single compilation fix patch. So I will be looking at a different path.

OK

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 135 lines · Marek Vasut
Quoted 134 lines · Derald Woods

On Wed, 29 May 2019, 05:07 Marek Vasut, <[email protected] <mailto:[email protected]>> wrote:

    On 5/29/19 3:34 AM, Derald Woods wrote:
    > On Tue, May 28, 2019 at 7:49 PM Marek Vasut <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> On 5/29/19 2:00 AM, Derald Woods wrote:
    >>> On Tue, May 28, 2019 at 6:27 PM Marek Vasut
    <marek.vasut at gmail.com <mailto:[email protected]>> wrote:
    >>>>
    >>>> On 5/29/19 1:16 AM, Derald Woods wrote:
    >>>>> On Tue, May 28, 2019 at 4:16 PM Marek Vasut
    <marek.vasut at gmail.com <mailto:[email protected]>> wrote:
    >>>>>>
    >>>>>> On 5/28/19 4:22 AM, Derald D. Woods wrote:
    >>>>>>> This commit addresses the following warning, when _NOT_
    USB_MUSB_HOST:
    >>>>>>>
    >>>>>>> [...]
    >>>>>>>   CC      drivers/usb/gadget/f_mass_storage.o
    >>>>>>>   CC      drivers/usb/musb-new/omap2430.o
    >>>>>>>   CC      drivers/usb/gadget/f_fastboot.o
    >>>>>>>   CC      env/common.o
    >>>>>>>   CC      env/env.o
    >>>>>>>
    /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:
    In function ‘omap2430_musb_probe’:
    >>>>>>>
    /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6:
    warning: assignment to ‘int’ from ‘struct musb *’ makes integer from
    pointer without a cast [-Wint-conversion]
    >>>>>>>   ret = musb_register(&platdata->plat,
    >>>>>>>       ^
    >>>>>>>   LD      drivers/usb/host/built-in.o
    >>>>>>>   CC      drivers/usb/gadget/f_sdp.o
    >>>>>>>   CC      fs/ext4/ext4fs.o
    >>>>>>> [...]
    >>>>
    >>>> Skip to the end first
    >>>>
    >>>>>>> Signed-off-by: Derald D. Woods <[email protected]
    <mailto:[email protected]>>
    >>>>>>> ---
    >>>>>>>  drivers/usb/musb-new/omap2430.c | 8 ++++++--
    >>>>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
    >>>>>>>
    >>>>>>> diff --git a/drivers/usb/musb-new/omap2430.c
    b/drivers/usb/musb-new/omap2430.c
    >>>>>>> index 32743aa72c..cca1653f1e 100644
    >>>>>>> --- a/drivers/usb/musb-new/omap2430.c
    >>>>>>> +++ b/drivers/usb/musb-new/omap2430.c
    >>>>>>> @@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct
    udevice *dev)
    >>>>>>>  {
    >>>>>>>  #ifdef CONFIG_USB_MUSB_HOST
    >>>>>>>       struct musb_host_data *host = dev_get_priv(dev);
    >>>>>>> +#else
    >>>>>>> +     struct musb *musbp;
    >>>>
    >>>> Drop this hunk
    >>>>
    >>>>>>>  #endif
    >>>>>>>       struct omap2430_musb_platdata *platdata =
    dev_get_platdata(dev);
    >>>>>>>       struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
    >>>>>>>       struct omap_musb_board_data *otg_board_data;
    >>>>>>> -     int ret;
    >>>>>>> +     int ret = 0;
    >>>>>>>       void *base = dev_read_addr_ptr(dev);
    >>>>>>>
    >>>>>>>       priv->desc_before_addr = true;
    >>>>>>> @@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct
    udevice *dev)
    >>>>>>>
    >>>>>>>       ret = musb_lowlevel_init(host);
    >>>>>>>  #else
    >>>>>>> -     ret = musb_register(&platdata->plat,
    >>>>>>> +     musbp = musb_register(&platdata->plat,
    >>>>
    >>>> Replace musbp with host->host
    >>>>
    >>>>>>>                         (struct device *)otg_board_data,
    >>>>>>>                         platdata->base);
    >>>>>>> +     if (IS_ERR_OR_NULL(musbp))
    >>>>
    >>>> here too
    >>>>
    >>>>>>> +             return -EINVAL;
    >>>>>>
    >>>>>> For example the pic32 glue code holds the musb_host_data in
    private data
    >>>>>> , so it can call musb_stop() in .remove callback . Can you do
    the same?
    >>>>>>
    >>>>>
    >>>>> This was just a non-structural change to eliminate a compiler
    warning.
    >>>>> I agree that other things can/should be done with this driver.
    That
    >>>>> work would be outside of what I was trying to accomplsh here,
    at the
    >>>>> moment.
    >>>>
    >>>> See above, I believe that should fix the problem _and_ not
    crash in the
    >>>> .remove() .
    >>>>
    >>>
    >>> As with 'ti-musb', there needs to be a clear distinction between
    >>> 'host' and 'peripheral'/'gadget'. The issues here are much more
    broad
    >>> than the compile warning that I was trying to address. The required
    >>> refactoring, for USB Gadgets, deserves a proper series for older
    OMAP3
    >>> devices.
    >>>
    >>> I would rather _DROP_ this patch than apply something that could
    >>> result in a series of kludges.
    >>
    >> Does the following patch work for you ?
    >>
    >
    > My use case does _not_ enable 'CONFIG_USB_MUSB_HOST'. The C
    > preprocessor directives prevent 'host->host' from being included in
    > compilation in that case.

    drivers/usb/musb-new/musb_uboot.h doesn't have any special stuff to
    remove the struct musb_host_data { struct musb *musb ... } field .
    What am I missing ?
Quoted 5 lines
Quoted 1 line

The code is guarded by CPP directives.

Can you point out the code you're talking about ? Which CPP directive do you have in mind exactly?

omap2430.c lines 216 and 229. 'host' is only used in that context.

Quoted 17 lines
Quoted 2 lines

You are speaking of a more
extensive refactoring/changing of the driver.

I am speaking of that diff I posted a few hours ago, nothing else. This should fix this problem _and_ not fail in the remove path. There is no refactoring necessary for that to work.

Quoted 5 lines

There is a set of patches
on the mailing list, by Adam Ford, that does just that. Or at least makes the proper start. I will look at those as a start. I am dropping my effort on this single compilation fix patch. So I will be looking at a different path.

OK

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

Quoted 136 lines · Derald D. Woods
Quoted 135 lines · Marek Vasut
Quoted 134 lines · Derald Woods

On Wed, 29 May 2019, 05:07 Marek Vasut, <[email protected] <mailto:[email protected]>> wrote:

    On 5/29/19 3:34 AM, Derald Woods wrote:
    > On Tue, May 28, 2019 at 7:49 PM Marek Vasut <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> On 5/29/19 2:00 AM, Derald Woods wrote:
    >>> On Tue, May 28, 2019 at 6:27 PM Marek Vasut
    <marek.vasut at gmail.com <mailto:[email protected]>> wrote:
    >>>>
    >>>> On 5/29/19 1:16 AM, Derald Woods wrote:
    >>>>> On Tue, May 28, 2019 at 4:16 PM Marek Vasut
    <marek.vasut at gmail.com <mailto:[email protected]>> wrote:
    >>>>>>
    >>>>>> On 5/28/19 4:22 AM, Derald D. Woods wrote:
    >>>>>>> This commit addresses the following warning, when _NOT_
    USB_MUSB_HOST:
    >>>>>>>
    >>>>>>> [...]
    >>>>>>>   CC      drivers/usb/gadget/f_mass_storage.o
    >>>>>>>   CC      drivers/usb/musb-new/omap2430.o
    >>>>>>>   CC      drivers/usb/gadget/f_fastboot.o
    >>>>>>>   CC      env/common.o
    >>>>>>>   CC      env/env.o
    >>>>>>>
    /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:
    In function ‘omap2430_musb_probe’:
    >>>>>>>
    /src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6:
    warning: assignment to ‘int’ from ‘struct musb *’ makes integer from
    pointer without a cast [-Wint-conversion]
    >>>>>>>   ret = musb_register(&platdata->plat,
    >>>>>>>       ^
    >>>>>>>   LD      drivers/usb/host/built-in.o
    >>>>>>>   CC      drivers/usb/gadget/f_sdp.o
    >>>>>>>   CC      fs/ext4/ext4fs.o
    >>>>>>> [...]
    >>>>
    >>>> Skip to the end first
    >>>>
    >>>>>>> Signed-off-by: Derald D. Woods <[email protected]
    <mailto:[email protected]>>
    >>>>>>> ---
    >>>>>>>  drivers/usb/musb-new/omap2430.c | 8 ++++++--
    >>>>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
    >>>>>>>
    >>>>>>> diff --git a/drivers/usb/musb-new/omap2430.c
    b/drivers/usb/musb-new/omap2430.c
    >>>>>>> index 32743aa72c..cca1653f1e 100644
    >>>>>>> --- a/drivers/usb/musb-new/omap2430.c
    >>>>>>> +++ b/drivers/usb/musb-new/omap2430.c
    >>>>>>> @@ -215,11 +215,13 @@ static int omap2430_musb_probe(struct
    udevice *dev)
    >>>>>>>  {
    >>>>>>>  #ifdef CONFIG_USB_MUSB_HOST
    >>>>>>>       struct musb_host_data *host = dev_get_priv(dev);
    >>>>>>> +#else
    >>>>>>> +     struct musb *musbp;
    >>>>
    >>>> Drop this hunk
    >>>>
    >>>>>>>  #endif
    >>>>>>>       struct omap2430_musb_platdata *platdata =
    dev_get_platdata(dev);
    >>>>>>>       struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
    >>>>>>>       struct omap_musb_board_data *otg_board_data;
    >>>>>>> -     int ret;
    >>>>>>> +     int ret = 0;
    >>>>>>>       void *base = dev_read_addr_ptr(dev);
    >>>>>>>
    >>>>>>>       priv->desc_before_addr = true;
    >>>>>>> @@ -236,9 +238,11 @@ static int omap2430_musb_probe(struct
    udevice *dev)
    >>>>>>>
    >>>>>>>       ret = musb_lowlevel_init(host);
    >>>>>>>  #else
    >>>>>>> -     ret = musb_register(&platdata->plat,
    >>>>>>> +     musbp = musb_register(&platdata->plat,
    >>>>
    >>>> Replace musbp with host->host
    >>>>
    >>>>>>>                         (struct device *)otg_board_data,
    >>>>>>>                         platdata->base);
    >>>>>>> +     if (IS_ERR_OR_NULL(musbp))
    >>>>
    >>>> here too
    >>>>
    >>>>>>> +             return -EINVAL;
    >>>>>>
    >>>>>> For example the pic32 glue code holds the musb_host_data in
    private data
    >>>>>> , so it can call musb_stop() in .remove callback . Can you do
    the same?
    >>>>>>
    >>>>>
    >>>>> This was just a non-structural change to eliminate a compiler
    warning.
    >>>>> I agree that other things can/should be done with this driver.
    That
    >>>>> work would be outside of what I was trying to accomplsh here,
    at the
    >>>>> moment.
    >>>>
    >>>> See above, I believe that should fix the problem _and_ not
    crash in the
    >>>> .remove() .
    >>>>
    >>>
    >>> As with 'ti-musb', there needs to be a clear distinction between
    >>> 'host' and 'peripheral'/'gadget'. The issues here are much more
    broad
    >>> than the compile warning that I was trying to address. The required
    >>> refactoring, for USB Gadgets, deserves a proper series for older
    OMAP3
    >>> devices.
    >>>
    >>> I would rather _DROP_ this patch than apply something that could
    >>> result in a series of kludges.
    >>
    >> Does the following patch work for you ?
    >>
    >
    > My use case does _not_ enable 'CONFIG_USB_MUSB_HOST'. The C
    > preprocessor directives prevent 'host->host' from being included in
    > compilation in that case.

    drivers/usb/musb-new/musb_uboot.h doesn't have any special stuff to
    remove the struct musb_host_data { struct musb *musb ... } field .
    What am I missing ?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

The code is guarded by CPP directives.

Can you point out the code you're talking about ? Which CPP directive do you have in mind exactly?

omap2430.c lines 216 and 229. 'host' is only used in that context.

Remove the ifdef on line 216 , better ?

Also see the remove callback .

Signature · 2 lines
Best regards,
Marek Vasut
#12 lore raw

PATCH 3/3 usb: musb-new: omap2430: Fix compilation warning with USB_MUSB_GADGET

In reply to Derald D. Woods
Quoted 15 lines · Derald D. Woods

This commit addresses the following warning, when _NOT_ USB_MUSB_HOST:

[...]

  CC      drivers/usb/gadget/f_mass_storage.o
  CC      drivers/usb/musb-new/omap2430.o
  CC      drivers/usb/gadget/f_fastboot.o
  CC      env/common.o
  CC      env/env.o
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c: In function ‘omap2430_musb_probe’:
/src/etinker/software/u-boot-master/drivers/usb/musb-new/omap2430.c:239:6: warning: assignment to ‘int’ from ‘struct musb *’ makes integer from pointer without a cast [-Wint-conversion]
  ret = musb_register(&platdata->plat,
      ^
  LD      drivers/usb/host/built-in.o
  CC      drivers/usb/gadget/f_sdp.o
  CC      fs/ext4/ext4fs.o
Quoted 3 lines

[...]

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190714/55d59fe1/attachment.sig>