Re: [PATCH v2 1/2] usb: gadget: legacy: Add udc module param to all legacy gadgets

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

 




On 07/08/2016 08:56 AM, Peter Chen wrote:
> On Thu, Jul 07, 2016 at 02:17:57PM +0200, Krzysztof Opasiak wrote:
>> Add new module parameter called "udc" to all legacy gadgets.
>> By using this parameter user can choose a controller towhich
>> this gadget should be bound.
>>
>> This may be useful esp. when having multiple controllers
>> or multiple gadget builtin.
>>
>> When value for this param is not provided then old behaviour
>> (binding to first free UDC) remains unchanged.
>>
>> Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
>> ---

(...)

> 
> Tested-by: Peter Chen <peter.chen@xxxxxxx>
> 
> One suggestion, you can move this udc name module parameter to 
> USB_GADGET_COMPOSITE_OPTIONS().	
> 

It was exactly my first though when I suggested this change.

Unfortunately it turned out to be a little to messy when I implemented this.

Currently USB_GADGET_COMPOSITE_OPTIONS() declares inside an additional
variable (coverwrite) which is used inside gadget's bind() function.
Unfortunately gadget's bind() is called *after* binding to some UDC so
it's too late to read udc_name param. C also doesn't allows us to do sth
like this:

char *udc_name;

(...)

struct whatever w = {
	.udc_name = udc_name;
};

So just like in the new macro we would have to add a parameter and move
all macro calls below gadget member or declare a gadget before calling
this macro. This will make this change bigger and in my humble opinion
it hurts readability as part of macro is filling a variable declared
inside macro and other part is filling structure passed as a param.
That's why I decided to keep this separated in two macros called
independently (one before gadget structure and second one after).

Best regards,
-- 
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
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



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

  Powered by Linux