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 2012年06月19日 23:43, Alan Stern wrote:

-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.
But the struct dev_state will be used in the hub.c. Is there
other ways to do that without moving the definition of struct
dev_state to a head file?

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


Alan Stern


--
Best Regards
Tianyu Lan
linux kernel enabling team
--
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