mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] usb: gadget: ums: add support for optional partition flag
Date: Mon, 15 Apr 2024 07:34:30 +0200	[thread overview]
Message-ID: <20240415053430.370061-1-a.fatoum@pengutronix.de> (raw)

File lists for fastboot support a 'o' flag to silently skip files that
don't exist at bind time. Add support for the same for USB mass storage
gadgets as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/usb/gadget/function/f_mass_storage.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index 2c934c621a18..e099123cea2b 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2474,14 +2474,17 @@ static int fsg_common_init(struct fsg_common *common,
 		struct stat st;
 		int fd;
 
-		if (fentry->flags) {
-			pr_err("flags not supported\n");
-			rc = -ENOSYS;
-			goto close;
-		}
+		if (fentry->flags & ~FILE_LIST_FLAG_OPTIONAL)
+			pr_warn("some flags will be ignored\n");
 
 		fd = open(fentry->filename, flags);
 		if (fd < 0) {
+			if (fentry->flags & FILE_LIST_FLAG_OPTIONAL) {
+				pr_info("skipping unavailable optional partition %s\n",
+					fentry->filename);
+				continue;
+			}
+
 			pr_err("open('%s') failed: %pe\n",
 			       fentry->filename, ERR_PTR(fd));
 			rc = fd;
-- 
2.39.2




             reply	other threads:[~2024-04-15  5:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  5:34 Ahmad Fatoum [this message]
2024-05-13  9:30 ` Sascha Hauer

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=20240415053430.370061-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@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