mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] USB: gadget: prevent unnecessary warning message
Date: Fri, 26 Oct 2018 12:04:32 +0200	[thread overview]
Message-ID: <20181026100432.27621-1-s.hauer@pengutronix.de> (raw)

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

                 reply	other threads:[~2018-10-26 10:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181026100432.27621-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox