diff options
author | Lan Tianyu <tianyu.lan@intel.com> | 2012-07-06 02:13:52 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-06 14:09:28 -0400 |
commit | 336c5c310e8f0d5baba7973765339eaf5d989fe1 (patch) | |
tree | 74350a57c77560a460feb5ede8978fb9e1246e9c /drivers/usb/core | |
parent | 77c4400f2f0fd8384ab5cbe41d81ccc664896b2d (diff) |
usb: convert port_owners type from void * to struct dev_state *
This patch is to convert port_owners type from void * to struct dev_state *
in order to make code more readable.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/hub.c | 21 | ||||
-rw-r--r-- | drivers/usb/core/usb.h | 9 |
2 files changed, 18 insertions, 12 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 25a7422ee65..4cc8dc96940 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -81,7 +81,7 @@ struct usb_hub { | |||
81 | u8 indicator[USB_MAXCHILDREN]; | 81 | u8 indicator[USB_MAXCHILDREN]; |
82 | struct delayed_work leds; | 82 | struct delayed_work leds; |
83 | struct delayed_work init_work; | 83 | struct delayed_work init_work; |
84 | void **port_owners; | 84 | struct dev_state **port_owners; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | static inline int hub_is_superspeed(struct usb_device *hdev) | 87 | static inline int hub_is_superspeed(struct usb_device *hdev) |
@@ -1271,7 +1271,8 @@ static int hub_configure(struct usb_hub *hub, | |||
1271 | 1271 | ||
1272 | hdev->children = kzalloc(hdev->maxchild * | 1272 | hdev->children = kzalloc(hdev->maxchild * |
1273 | sizeof(struct usb_device *), GFP_KERNEL); | 1273 | sizeof(struct usb_device *), GFP_KERNEL); |
1274 | hub->port_owners = kzalloc(hdev->maxchild * sizeof(void *), GFP_KERNEL); | 1274 | hub->port_owners = kzalloc(hdev->maxchild * sizeof(struct dev_state *), |
1275 | GFP_KERNEL); | ||
1275 | if (!hdev->children || !hub->port_owners) { | 1276 | if (!hdev->children || !hub->port_owners) { |
1276 | ret = -ENOMEM; | 1277 | ret = -ENOMEM; |
1277 | goto fail; | 1278 | goto fail; |
@@ -1649,7 +1650,7 @@ hub_ioctl(struct usb_interface *intf, unsigned int code, void *user_data) | |||
1649 | * to one of these "claimed" ports, the program will "own" the device. | 1650 | * to one of these "claimed" ports, the program will "own" the device. |
1650 | */ | 1651 | */ |
1651 | static int find_port_owner(struct usb_device *hdev, unsigned port1, | 1652 | static int find_port_owner(struct usb_device *hdev, unsigned port1, |
1652 | void ***ppowner) | 1653 | struct dev_state ***ppowner) |
1653 | { | 1654 | { |
1654 | if (hdev->state == USB_STATE_NOTATTACHED) | 1655 | if (hdev->state == USB_STATE_NOTATTACHED) |
1655 | return -ENODEV; | 1656 | return -ENODEV; |
@@ -1664,10 +1665,11 @@ static int find_port_owner(struct usb_device *hdev, unsigned port1, | |||
1664 | } | 1665 | } |
1665 | 1666 | ||
1666 | /* In the following three functions, the caller must hold hdev's lock */ | 1667 | /* In the following three functions, the caller must hold hdev's lock */ |
1667 | int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, void *owner) | 1668 | int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, |
1669 | struct dev_state *owner) | ||
1668 | { | 1670 | { |
1669 | int rc; | 1671 | int rc; |
1670 | void **powner; | 1672 | struct dev_state **powner; |
1671 | 1673 | ||
1672 | rc = find_port_owner(hdev, port1, &powner); | 1674 | rc = find_port_owner(hdev, port1, &powner); |
1673 | if (rc) | 1675 | if (rc) |
@@ -1678,10 +1680,11 @@ int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, void *owner) | |||
1678 | return rc; | 1680 | return rc; |
1679 | } | 1681 | } |
1680 | 1682 | ||
1681 | int usb_hub_release_port(struct usb_device *hdev, unsigned port1, void *owner) | 1683 | int usb_hub_release_port(struct usb_device *hdev, unsigned port1, |
1684 | struct dev_state *owner) | ||
1682 | { | 1685 | { |
1683 | int rc; | 1686 | int rc; |
1684 | void **powner; | 1687 | struct dev_state **powner; |
1685 | 1688 | ||
1686 | rc = find_port_owner(hdev, port1, &powner); | 1689 | rc = find_port_owner(hdev, port1, &powner); |
1687 | if (rc) | 1690 | if (rc) |
@@ -1692,10 +1695,10 @@ int usb_hub_release_port(struct usb_device *hdev, unsigned port1, void *owner) | |||
1692 | return rc; | 1695 | return rc; |
1693 | } | 1696 | } |
1694 | 1697 | ||
1695 | void usb_hub_release_all_ports(struct usb_device *hdev, void *owner) | 1698 | void usb_hub_release_all_ports(struct usb_device *hdev, struct dev_state *owner) |
1696 | { | 1699 | { |
1697 | int n; | 1700 | int n; |
1698 | void **powner; | 1701 | struct dev_state **powner; |
1699 | 1702 | ||
1700 | n = find_port_owner(hdev, 1, &powner); | 1703 | n = find_port_owner(hdev, 1, &powner); |
1701 | if (n == 0) { | 1704 | if (n == 0) { |
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 5c5c538ea73..67875a89cfa 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h | |||
@@ -1,5 +1,7 @@ | |||
1 | #include <linux/pm.h> | 1 | #include <linux/pm.h> |
2 | 2 | ||
3 | struct dev_state; | ||
4 | |||
3 | /* Functions local to drivers/usb/core/ */ | 5 | /* Functions local to drivers/usb/core/ */ |
4 | 6 | ||
5 | extern int usb_create_sysfs_dev_files(struct usb_device *dev); | 7 | extern int usb_create_sysfs_dev_files(struct usb_device *dev); |
@@ -41,10 +43,11 @@ extern void usb_forced_unbind_intf(struct usb_interface *intf); | |||
41 | extern void usb_rebind_intf(struct usb_interface *intf); | 43 | extern void usb_rebind_intf(struct usb_interface *intf); |
42 | 44 | ||
43 | extern int usb_hub_claim_port(struct usb_device *hdev, unsigned port, | 45 | extern int usb_hub_claim_port(struct usb_device *hdev, unsigned port, |
44 | void *owner); | 46 | struct dev_state *owner); |
45 | extern int usb_hub_release_port(struct usb_device *hdev, unsigned port, | 47 | extern int usb_hub_release_port(struct usb_device *hdev, unsigned port, |
46 | void *owner); | 48 | struct dev_state *owner); |
47 | extern void usb_hub_release_all_ports(struct usb_device *hdev, void *owner); | 49 | extern void usb_hub_release_all_ports(struct usb_device *hdev, |
50 | struct dev_state *owner); | ||
48 | extern bool usb_device_is_owned(struct usb_device *udev); | 51 | extern bool usb_device_is_owned(struct usb_device *udev); |
49 | 52 | ||
50 | extern int usb_hub_init(void); | 53 | extern int usb_hub_init(void); |