* [PATCH] usb: gadget: ums: add support for optional partition flag
@ 2024-04-15 5:34 Ahmad Fatoum
2024-05-13 9:30 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-04-15 5:34 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-13 9:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 5:34 [PATCH] usb: gadget: ums: add support for optional partition flag Ahmad Fatoum
2024-05-13 9:30 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox