Re: [PATCH v2] usb: gadget: Add uevent to notify userspace
From: Baolin Wang
Date: Thu Sep 22 2016 - 22:17:13 EST
Hi,
On 22 September 2016 at 20:53, Felipe Balbi <balbi@xxxxxxxxxx> wrote:
>
>
> Hi,
>
> Baolin Wang <baolin.wang@xxxxxxxxxx> writes:
>>>> static const struct usb_gadget_driver configfs_driver_template = {
>>>> .bind = configfs_composite_bind,
>>>> .unbind = configfs_composite_unbind,
>>>>
>>>> +#ifdef CONFIG_USB_CONFIGFS_UEVENT
>>>> + .setup = configfs_setup,
>>>> + .reset = configfs_disconnect,
>>>> + .disconnect = configfs_disconnect,
>>>> +#else
>>>> .setup = composite_setup,
>>>> .reset = composite_disconnect,
>>>> .disconnect = composite_disconnect,
>>>> +#endif
>
> nope, this is quite wrong.
>
>>>> @@ -1453,6 +1556,10 @@ static struct config_group *gadgets_make(
>>>> gi->composite.gadget_driver.function = kstrdup(name, GFP_KERNEL);
>>>> gi->composite.name = gi->composite.gadget_driver.function;
>>>>
>>>> +#ifdef CONFIG_USB_CONFIGFS_UEVENT
>>>> + INIT_WORK(&gi->work, configfs_work);
>>>> +#endif
>>>
>>> This is just way too ugly, please make it so there are no #ifdefs in the
>>> .c files.
>>>
>>> Or, as others said, why is this a build option at all, why would you not
>>> always want this enabled if you are relying on it all of the time?
>>
>> Sometimes userspace does not need the notification, it is not all the
>> time. Anyway I will remove the macro if you still insist on that.
>
> what's wrong with the sysfs we already have for this?
If Android system userspace can support udc-core's uevents like Badhri
said, I am fine with that.
--
Baolin.wang
Best Regards