Re: [PATCH v5 07/15] usb/gadget: f_mass_storage: create fsg_common_set_cdev for use in fsg_common_init

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

 



On Thu, Oct 03 2013, Andrzej Pietrasiewicz wrote:
> fsg_common_init is a lengthy function. Factor a portion of it out.
>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
> Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>

Acked-by: Michal Nazarewicz <mina86@xxxxxxxxxx>

> ---
>  drivers/usb/gadget/f_mass_storage.c |   52 +++++++++++++++++++++--------------
>  drivers/usb/gadget/f_mass_storage.h |    3 ++
>  2 files changed, 34 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
> index 39f7f1f..61952b6 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -2800,6 +2800,35 @@ void fsg_common_set_private_data(struct fsg_common *common, void *priv)
>  	common->private_data = priv;
>  }
>  
> +int fsg_common_set_cdev(struct fsg_common *common,
> +			 struct usb_composite_dev *cdev, bool can_stall)
> +{
> +	struct usb_string *us;
> +	int rc;

Drop rc variable.

> +
> +	common->gadget = cdev->gadget;
> +	common->ep0 = cdev->gadget->ep0;
> +	common->ep0req = cdev->req;
> +	common->cdev = cdev;
> +
> +	us = usb_gstrings_attach(cdev, fsg_strings_array,
> +				 ARRAY_SIZE(fsg_strings));
> +	if (IS_ERR(us)) {
> +		rc = PTR_ERR(us);
> +		return rc;

		return PTR_ERR(us);

> +	}
> +	fsg_intf_desc.iInterface = us[FSG_STRING_INTERFACE].id;
> +
> +	/*
> +	 * Some peripheral controllers are known not to be able to
> +	 * halt bulk endpoints correctly.  If one of them is present,
> +	 * disable stalls.
> +	 */
> +	common->can_stall = can_stall && !(gadget_is_at91(common->gadget));
> +
> +	return 0;
> +}
> +
>  #define MAX_LUN_NAME_LEN 80
>  
>  struct fsg_common *fsg_common_init(struct fsg_common *common,

-- 
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