On Thu, Jan 18, 2024 at 01:18:16PM +0100, Peter Korsgaard wrote: > When a USB gadget is configured through configfs with 1 or more f_fs > functions, then the logic setting up the gadget configuration has to wait > until the user space code (typically separate applications) responsible for > those functions have written their descriptors before the gadget can be > activated. > > The f_fs instance already knows if this has been done, so expose it through > a "ready" attribute in configfs for easier synchronization. > > Signed-off-by: Peter Korsgaard <peter@xxxxxxxxxxxxx> > --- > drivers/usb/gadget/function/f_fs.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > index fdd0fc7b8f25..ae44dd5f3a94 100644 > --- a/drivers/usb/gadget/function/f_fs.c > +++ b/drivers/usb/gadget/function/f_fs.c > @@ -3446,6 +3446,20 @@ static inline struct f_fs_opts *to_ffs_opts(struct config_item *item) > func_inst.group); > } > > +static ssize_t f_fs_opts_ready_show(struct config_item *item, char *page) > +{ > + struct f_fs_opts *opts = to_ffs_opts(item); > + > + return sprintf(page, "%d\n", opts->dev->desc_ready); > +} > + > +CONFIGFS_ATTR_RO(f_fs_opts_, ready); > + > +static struct configfs_attribute *ffs_attrs[] = { > + &f_fs_opts_attr_ready, > + NULL, > +}; No documentation entry for this new attribute? thanks, greg k-h