Re: [PATCH] usb: gadget: f_acm: make bInterfaceProtocol configurable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg,

On Wed Jul 31, 2024 at 10:32 AM CEST, Greg Kroah-Hartman wrote:
> On Tue, Jul 30, 2024 at 09:43:37PM +0200, Michael Walle wrote:
> >  struct f_serial_opts {
> >  	struct usb_function_instance func_inst;
> >  	u8 port_num;
> > +	u8 protocol;
> > +
> > +	struct mutex lock;
> > +	int refcnt;
>
> Attempting to "roll your own" reference count is almost never a good
> idea.  If you really need one, please use the proper in-kernel apis for
> this.  But you need to justify it as well, I didn't see why this was
> needed at all.

Honestly, I couldn't grok all that usb gadget magic, so I've looked
at similar gadgets and took that from there:
  grep refcnt drivers/usb/gadget/function/ -r

They are all doing the same, so maybe that code is old or didn't use
the proper APIs back then.

The refcnt will prevent changing the options (the protocol here)
while a gadget is still in use/bound.

-michael

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux