> -----Original Message----- > From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb- > owner@xxxxxxxxxxxxxxx] On Behalf Of Felipe Balbi > Sent: Thursday, July 10, 2014 3:39 PM > To: Andrzej Pietrasiewicz > Cc: linux-usb@xxxxxxxxxxxxxxx; Felipe Balbi; Greg Kroah-Hartman; > Sebastian Andrzej Siewior; Marek Szyprowski > Subject: Re: [PATCHv2] usb: gadget: composite: Provide a list of > available functions (...) > > +static ssize_t gadget_func_list_show(struct class *c, > > + struct class_attribute *a, char *buf) > { > > + return usb_function_list_functions(buf, PAGE_SIZE); } > > + > > +static struct class_attribute usb_gadget_attrs[] = { > > + __ATTR(func_list, S_IRUGO, gadget_func_list_show, NULL), > > + __ATTR_NULL, > > +}; > > + > > +static struct class usb_gadget_class = { > > another class ? Please don't, we already have the udc class, we > could find a way to just use that instead. > Using udc clas is not a good idea. This may cause failures in userspace. How would you like to tell that this is not really a udc? Only type of file will be different than for the udcs (udcs are symlink and this would be normal file or directory). But who knows how much scripts or soft depends on assumption that /sys/class/udc contains only names of udc available in system? Libusbg is good example. When you pass NULL as udc name to usbg_enable_gadget() method, it scandir() the /sys/class/udc and take the first entry of this directory. If we add something what is not an udc this library and potentially many other userspace apps behavior will be changed and they may suddenly fail. I know that this solution has some disadvantages but I don't see any better one which wont destroy the userspace. Maybe you have some idea? Please share it with us:) Please let me also recall v1 version of this patch which has been changed because it fails when libcomposite is built into kernel (it hasn't own directory in /sys/module so adding an attribute causes NULL pointer dereference) -- BR's Krzysztof Opasiak -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html