Re: [RFC PATCH 1/3] usb: convert port_owners type from void * to struct dev_state *

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

 



On Tue, 19 Jun 2012, Lan Tianyu wrote:

> This patch is to convert ort_owners type from void * to struct dev_state *

s/ort/port/

> in order to make code more readable.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> ---
>  drivers/usb/core/devio.c |   17 -----------------
>  drivers/usb/core/hub.c   |   21 ++++++++++++---------
>  drivers/usb/core/usb.h   |   24 +++++++++++++++++++++---
>  3 files changed, 33 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index e0f1079..678ba37 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -59,23 +59,6 @@
>  /* Mutual exclusion for removal, open, and release */
>  DEFINE_MUTEX(usbfs_mutex);
>  
> -struct dev_state {
> -	struct list_head list;      /* state list */
> -	struct usb_device *dev;
> -	struct file *file;
> -	spinlock_t lock;            /* protects the async urb lists */
> -	struct list_head async_pending;
> -	struct list_head async_completed;
> -	wait_queue_head_t wait;     /* wake up if a request completed */
> -	unsigned int discsignr;
> -	struct pid *disc_pid;
> -	const struct cred *cred;
> -	void __user *disccontext;
> -	unsigned long ifclaimed;
> -	u32 secid;
> -	u32 disabled_bulk_eps;
> -};

Please don't move the definition of this structure.  It is private to 
devio.c.

> -
>  struct async {
>  	struct list_head asynclist;
>  	struct dev_state *ps;
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 04fb834..0d68dcc 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -81,7 +81,7 @@ struct usb_hub {
>  	u8			indicator[USB_MAXCHILDREN];
>  	struct delayed_work	leds;
>  	struct delayed_work	init_work;
> -	void			**port_owners;
> +	struct dev_state	**port_owners;
>  };
>  
>  static inline int hub_is_superspeed(struct usb_device *hdev)
> @@ -1271,7 +1271,8 @@ static int hub_configure(struct usb_hub *hub,
>  
>  	hdev->children = kzalloc(hdev->maxchild *
>  				sizeof(struct usb_device *), GFP_KERNEL);
> -	hub->port_owners = kzalloc(hdev->maxchild * sizeof(void *), GFP_KERNEL);
> +	hub->port_owners = kzalloc(hdev->maxchild * sizeof(struct dev_state *),
> +				GFP_KERNEL);
>  	if (!hdev->children || !hub->port_owners) {
>  		ret = -ENOMEM;
>  		goto fail;
> @@ -1649,7 +1650,7 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data)
>   * to one of these "claimed" ports, the program will "own" the device.
>   */
>  static int find_port_owner(struct usb_device *hdev, unsigned port1,
> -		void ***ppowner)
> +			   struct dev_state ***ppowner)

Don't change the indentation.  The convention used in this file is that 
continuation lines are indented 2 tab stops more than the original 
line.

Alan Stern

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