Re: [PATCH v2 3/4] usb: gadget: move common storage gadget structure to header file

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

 



On Mon, Jun 08 2015, Sanjay Singh Rawat wrote:
> struct fsg_common is used in multiple files, moving it to header
> file from the source file.

Isn’t this patch a prerequisit for the previous patch?  Just merge them
together.

> Signed-off-by: Sanjay Singh Rawat <snjsrwt@xxxxxxxxx>
> ---
>  drivers/usb/gadget/function/f_mass_storage.c | 70 ----------------------------
>  drivers/usb/gadget/function/f_mass_storage.h | 68 ++++++++++++++++++++++++++-
>  2 files changed, 67 insertions(+), 71 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
> index a996f3f..560e73d 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.c
> +++ b/drivers/usb/gadget/function/f_mass_storage.c
> @@ -251,76 +251,6 @@ static struct usb_gadget_strings *fsg_strings_array[] = {
>  
>  /*-------------------------------------------------------------------------*/
>  
> -struct fsg_dev;
> -struct fsg_common;
> -
> -/* Data shared by all the FSG instances. */
> -struct fsg_common {
> -	struct usb_gadget	*gadget;
> -	struct usb_composite_dev *cdev;
> -	struct fsg_dev		*fsg, *new_fsg;
> -	wait_queue_head_t	fsg_wait;
> -
> -	/* filesem protects: backing files in use */
> -	struct rw_semaphore	filesem;
> -
> -	/* lock protects: state, all the req_busy's */
> -	spinlock_t		lock;
> -
> -	struct usb_ep		*ep0;		/* Copy of gadget->ep0 */
> -	struct usb_request	*ep0req;	/* Copy of cdev->req */
> -	unsigned int		ep0_req_tag;
> -
> -	struct fsg_buffhd	*next_buffhd_to_fill;
> -	struct fsg_buffhd	*next_buffhd_to_drain;
> -	struct fsg_buffhd	*buffhds;
> -	unsigned int		fsg_num_buffers;
> -
> -	int			cmnd_size;
> -	u8			cmnd[MAX_COMMAND_SIZE];
> -
> -	unsigned int		nluns;
> -	unsigned int		lun;
> -	struct fsg_lun		**luns;
> -	struct fsg_lun		*curlun;
> -
> -	unsigned int		bulk_out_maxpacket;
> -	enum fsg_state		state;		/* For exception handling */
> -	unsigned int		exception_req_tag;
> -
> -	enum data_direction	data_dir;
> -	u32			data_size;
> -	u32			data_size_from_cmnd;
> -	u32			tag;
> -	u32			residue;
> -	u32			usb_amount_left;
> -
> -	unsigned int		can_stall:1;
> -	unsigned int		free_storage_on_release:1;
> -	unsigned int		phase_error:1;
> -	unsigned int		short_packet_received:1;
> -	unsigned int		bad_lun_okay:1;
> -	unsigned int		running:1;
> -	unsigned int		sysfs:1;
> -
> -	int			thread_wakeup_needed;
> -	struct completion	thread_notifier;
> -	struct task_struct	*thread_task;
> -
> -	/* Callback functions. */
> -	const struct fsg_operations	*ops;
> -	/* Gadget's private data. */
> -	void			*private_data;
> -
> -	/*
> -	 * Vendor (8 chars), product (16 chars), release (4
> -	 * hexadecimal digits) and NUL byte
> -	 */
> -	char inquiry_string[8 + 16 + 4 + 1];
> -
> -	struct kref		ref;
> -};
> -
>  struct fsg_dev {
>  	struct usb_function	function;
>  	struct usb_gadget	*gadget;	/* Copy of cdev->gadget */
> diff --git a/drivers/usb/gadget/function/f_mass_storage.h b/drivers/usb/gadget/function/f_mass_storage.h
> index b4866fc..c05fe16 100644
> --- a/drivers/usb/gadget/function/f_mass_storage.h
> +++ b/drivers/usb/gadget/function/f_mass_storage.h
> @@ -57,7 +57,73 @@ struct fsg_module_parameters {
>  
>  #endif
>  
> -struct fsg_common;
> +/* Data shared by all the FSG instances. */
> +struct fsg_common {
> +	struct usb_gadget       *gadget;
> +	struct usb_composite_dev *cdev;
> +	struct fsg_dev          *fsg, *new_fsg;
> +	wait_queue_head_t       fsg_wait;
> +
> +	/* filesem protects: backing files in use */
> +	struct rw_semaphore     filesem;
> +
> +	/* lock protects: state, all the req_busy's */
> +	spinlock_t              lock;
> +
> +	struct usb_ep           *ep0;           /* Copy of gadget->ep0 */
> +	struct usb_request      *ep0req;        /* Copy of cdev->req */
> +	unsigned int            ep0_req_tag;
> +
> +	struct fsg_buffhd       *next_buffhd_to_fill;
> +	struct fsg_buffhd       *next_buffhd_to_drain;
> +	struct fsg_buffhd       *buffhds;
> +	unsigned int            fsg_num_buffers;
> +
> +	int                     cmnd_size;
> +	u8                      cmnd[MAX_COMMAND_SIZE];
> +
> +	unsigned int            nluns;
> +	unsigned int            lun;
> +	struct fsg_lun          **luns;
> +	struct fsg_lun          *curlun;
> +
> +	unsigned int            bulk_out_maxpacket;
> +	enum fsg_state          state;          /* For exception handling */
> +	unsigned int            exception_req_tag;
> +
> +	enum data_direction     data_dir;
> +
> +	u32                     data_size;
> +	u32                     data_size_from_cmnd;
> +	u32                     tag;
> +	u32                     residue;
> +	u32                     usb_amount_left;
> +
> +	unsigned int            can_stall:1;
> +	unsigned int            free_storage_on_release:1;
> +	unsigned int            phase_error:1;
> +	unsigned int            short_packet_received:1;
> +	unsigned int            bad_lun_okay:1;
> +	unsigned int            running:1;
> +	unsigned int            sysfs:1;
> +
> +	int                     thread_wakeup_needed;
> +	struct completion       thread_notifier;
> +	struct task_struct      *thread_task;
> +
> +	/* Callback functions. */
> +	const struct fsg_operations     *ops;
> +	/* Gadget's private data. */
> +	void                    *private_data;
> +
> +	/*
> +	* Vendor (8 chars), product (16 chars), release (4
> +	* hexadecimal digits) and NUL byte
> +	*/
> +	char inquiry_string[8 + 16 + 4 + 1];
> +
> +	struct kref             ref;
> +};
>  
>  /* FSF callback functions */
>  struct fsg_operations {
> -- 
> 1.8.3.2
>

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