mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] USB: gadget: prevent unnecessary warning message
@ 2018-10-26 10:04 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2018-10-26 10:04 UTC (permalink / raw)
  To: Barebox List

The USB gadget autostart code issues a warning when no otg device
exists:

Cannot set parameter otg.mode: No such device

This is unnecessary since there may be no otg device at all, but only a
gadget device. Drop that warning by checking if there is a otg device
first.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/gadget/autostart.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/autostart.c b/drivers/usb/gadget/autostart.c
index f640a9667d..272b0ea8fa 100644
--- a/drivers/usb/gadget/autostart.c
+++ b/drivers/usb/gadget/autostart.c
@@ -35,6 +35,7 @@ static int fastboot_bbu;
 static int usbgadget_autostart(void)
 {
 	struct f_multi_opts *opts;
+	struct device_d *dev;
 	int ret;
 
 	if (!autostart)
@@ -61,7 +62,9 @@ static int usbgadget_autostart(void)
 		return 0;
 	}
 
-	setenv("otg.mode", "peripheral");
+	dev = get_device_by_name("otg");
+	if (dev)
+		dev_set_param(dev, "mode", "peripheral");
 
 	ret = usb_multi_register(opts);
 	if (ret)
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-26 10:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 10:04 [PATCH] USB: gadget: prevent unnecessary warning message Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox