Re: [RFC 4/9] usb: gadget: f_rndis: OS descriptors support

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

 



On Thu, Apr 24 2014, Andrzej Pietrasiewicz wrote:
> In order for usb functions to expose OS descriptors they
> need to be made aware of OS descriptors. This involves
> extending the "options" structure and setting up
> appropriate associations.
>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
> ---
>  drivers/usb/gadget/f_rndis.c | 24 +++++++++++++++++++++---
>  drivers/usb/gadget/u_rndis.h |  3 +++
>  2 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
> index c11761c..b781a59 100644
> --- a/drivers/usb/gadget/f_rndis.c
> +++ b/drivers/usb/gadget/f_rndis.c
> @@ -682,6 +682,15 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
>  
>  	rndis_opts = container_of(f->fi, struct f_rndis_opts, func_inst);
>  
> +	if (cdev->use_os_string) {
> +		f->os_desc_table = kcalloc(1, sizeof(*f->os_desc_table),
> +					   GFP_KERNEL);

Uh?  It's a bit strange to always allocate 1 element table.  Perhaps
just use kzalloc?

> +		if (!f->os_desc_table)
> +			return PTR_ERR(f->os_desc_table);

			return -ENOMEM;

> +		f->os_desc_n = 1;
> +		f->os_desc_table[0].os_desc = &rndis_opts->rndis_os_desc;
> +	}
> +
>  	/*
>  	 * in drivers/usb/gadget/configfs.c:configfs_composite_bind()
>  	 * configurations are bound in sequence with list_for_each_entry,

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@xxxxxxxxxx>--<xmpp:mina86@xxxxxxxxxx>--ooO--(_)--Ooo--

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