RE: Why there is a refcnt check when we change configfs property

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

 



 
> 
> Peter Chen <peter.chen@xxxxxxx> writes:
> > Hi Felipe,
> >
> > Do you know why? In that case, I can't change property, eg changing
> > qmult at NCM like below:
> >
> > mkdir functions/ncm.0
> > ln -s functions/ncm.0 configs/c.1
> > echo 10 > functions/ncm.0/qmult
> >
> > The code:
> > drivers/usb/gadget/function/u_ether_configfs.h
> >
> >   static ssize_t _f_##_opts_qmult_store(struct config_item *item, \
> >                                               const char *page, size_t len)\
> >         {                                                               \
> >                 struct f_##_f_##_opts *opts = to_f_##_f_##_opts(item);  \
> >                 u8 val;                                                 \
> >                 int ret;                                                \
> >                                                                         \
> >                 mutex_lock(&opts->lock);                                \
> >                 if (opts->refcnt) {                                     \
> >                         ret = -EBUSY;                                   \
> >                         goto out;                                       \
> >                 }                                                       \
> 
> That check looks wrong to me. I think, we should prevent changes after cable is
> already plugged, but if gadget state is NOTATTACHED, we should be able to
> change qmult, mac address, etc.
 
Add Andrzej.

Andrzej, would you tell us why you introduce refcnt for driver's configfs opts? And why
it is needed to judge for "store" operation?

Peter




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

  Powered by Linux