diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-04-16 12:00:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-24 16:05:32 -0400 |
commit | 42b59eba718a145e991ae02437f38d8aa8efe207 (patch) | |
tree | 44618e85fbeee1b3aaf84d6b4148535866bc6071 /drivers | |
parent | 0021a75a475b6c1e500ae4bdcc1ff19f7794aa95 (diff) |
USB: OHCI: Export the OHCI hub control and status_data functions
Platform drivers sometimes need to perform specific handling of hub
control requests and status data. Make this possible by exporting the
ohci_hub_control() and ohci_hub_status_data() functions which can then
be called from custom hub operations in the default case.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 11 | ||||
-rw-r--r-- | drivers/usb/host/ohci-hub.c | 8 | ||||
-rw-r--r-- | drivers/usb/host/ohci-s3c2410.c | 13 | ||||
-rw-r--r-- | drivers/usb/host/ohci.h | 3 |
4 files changed, 12 insertions, 23 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 091ae4905cfc..e49eb4f90f5d 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -46,9 +46,6 @@ static const char hcd_name[] = "ohci-atmel"; | |||
46 | 46 | ||
47 | static struct hc_driver __read_mostly ohci_at91_hc_driver; | 47 | static struct hc_driver __read_mostly ohci_at91_hc_driver; |
48 | static int clocked; | 48 | static int clocked; |
49 | static int (*orig_ohci_hub_control)(struct usb_hcd *hcd, u16 typeReq, | ||
50 | u16 wValue, u16 wIndex, char *buf, u16 wLength); | ||
51 | static int (*orig_ohci_hub_status_data)(struct usb_hcd *hcd, char *buf); | ||
52 | 49 | ||
53 | extern int usb_disabled(void); | 50 | extern int usb_disabled(void); |
54 | 51 | ||
@@ -262,7 +259,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | |||
262 | static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf) | 259 | static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf) |
263 | { | 260 | { |
264 | struct at91_usbh_data *pdata = hcd->self.controller->platform_data; | 261 | struct at91_usbh_data *pdata = hcd->self.controller->platform_data; |
265 | int length = orig_ohci_hub_status_data(hcd, buf); | 262 | int length = ohci_hub_status_data(hcd, buf); |
266 | int port; | 263 | int port; |
267 | 264 | ||
268 | at91_for_each_port(port) { | 265 | at91_for_each_port(port) { |
@@ -340,8 +337,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
340 | break; | 337 | break; |
341 | } | 338 | } |
342 | 339 | ||
343 | ret = orig_ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, | 340 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength); |
344 | buf, wLength); | ||
345 | if (ret) | 341 | if (ret) |
346 | goto out; | 342 | goto out; |
347 | 343 | ||
@@ -690,9 +686,6 @@ static int __init ohci_at91_init(void) | |||
690 | * too easy. | 686 | * too easy. |
691 | */ | 687 | */ |
692 | 688 | ||
693 | orig_ohci_hub_control = ohci_at91_hc_driver.hub_control; | ||
694 | orig_ohci_hub_status_data = ohci_at91_hc_driver.hub_status_data; | ||
695 | |||
696 | ohci_at91_hc_driver.hub_status_data = ohci_at91_hub_status_data; | 689 | ohci_at91_hc_driver.hub_status_data = ohci_at91_hub_status_data; |
697 | ohci_at91_hc_driver.hub_control = ohci_at91_hub_control; | 690 | ohci_at91_hc_driver.hub_control = ohci_at91_hub_control; |
698 | 691 | ||
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index c81c8721cc5a..3d53208278b3 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
@@ -438,8 +438,7 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, | |||
438 | 438 | ||
439 | /* build "status change" packet (one or two bytes) from HC registers */ | 439 | /* build "status change" packet (one or two bytes) from HC registers */ |
440 | 440 | ||
441 | static int | 441 | int ohci_hub_status_data(struct usb_hcd *hcd, char *buf) |
442 | ohci_hub_status_data (struct usb_hcd *hcd, char *buf) | ||
443 | { | 442 | { |
444 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | 443 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); |
445 | int i, changed = 0, length = 1; | 444 | int i, changed = 0, length = 1; |
@@ -504,6 +503,7 @@ done: | |||
504 | 503 | ||
505 | return changed ? length : 0; | 504 | return changed ? length : 0; |
506 | } | 505 | } |
506 | EXPORT_SYMBOL_GPL(ohci_hub_status_data); | ||
507 | 507 | ||
508 | /*-------------------------------------------------------------------------*/ | 508 | /*-------------------------------------------------------------------------*/ |
509 | 509 | ||
@@ -646,7 +646,7 @@ static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) | |||
646 | return 0; | 646 | return 0; |
647 | } | 647 | } |
648 | 648 | ||
649 | static int ohci_hub_control ( | 649 | int ohci_hub_control( |
650 | struct usb_hcd *hcd, | 650 | struct usb_hcd *hcd, |
651 | u16 typeReq, | 651 | u16 typeReq, |
652 | u16 wValue, | 652 | u16 wValue, |
@@ -772,4 +772,4 @@ error: | |||
772 | } | 772 | } |
773 | return retval; | 773 | return retval; |
774 | } | 774 | } |
775 | 775 | EXPORT_SYMBOL_GPL(ohci_hub_control); | |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index ff7c8f1c48fb..3d753a9d3141 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -45,10 +45,6 @@ static struct clk *usb_clk; | |||
45 | 45 | ||
46 | /* forward definitions */ | 46 | /* forward definitions */ |
47 | 47 | ||
48 | static int (*orig_ohci_hub_control)(struct usb_hcd *hcd, u16 typeReq, | ||
49 | u16 wValue, u16 wIndex, char *buf, u16 wLength); | ||
50 | static int (*orig_ohci_hub_status_data)(struct usb_hcd *hcd, char *buf); | ||
51 | |||
52 | static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); | 48 | static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); |
53 | 49 | ||
54 | /* conversion functions */ | 50 | /* conversion functions */ |
@@ -110,7 +106,7 @@ ohci_s3c2410_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
110 | int orig; | 106 | int orig; |
111 | int portno; | 107 | int portno; |
112 | 108 | ||
113 | orig = orig_ohci_hub_status_data(hcd, buf); | 109 | orig = ohci_hub_status_data(hcd, buf); |
114 | 110 | ||
115 | if (info == NULL) | 111 | if (info == NULL) |
116 | return orig; | 112 | return orig; |
@@ -181,7 +177,7 @@ static int ohci_s3c2410_hub_control( | |||
181 | * process the request straight away and exit */ | 177 | * process the request straight away and exit */ |
182 | 178 | ||
183 | if (info == NULL) { | 179 | if (info == NULL) { |
184 | ret = orig_ohci_hub_control(hcd, typeReq, wValue, | 180 | ret = ohci_hub_control(hcd, typeReq, wValue, |
185 | wIndex, buf, wLength); | 181 | wIndex, buf, wLength); |
186 | goto out; | 182 | goto out; |
187 | } | 183 | } |
@@ -231,7 +227,7 @@ static int ohci_s3c2410_hub_control( | |||
231 | break; | 227 | break; |
232 | } | 228 | } |
233 | 229 | ||
234 | ret = orig_ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | 230 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); |
235 | if (ret) | 231 | if (ret) |
236 | goto out; | 232 | goto out; |
237 | 233 | ||
@@ -489,9 +485,6 @@ static int __init ohci_s3c2410_init(void) | |||
489 | * override these functions by making it too easy. | 485 | * override these functions by making it too easy. |
490 | */ | 486 | */ |
491 | 487 | ||
492 | orig_ohci_hub_control = ohci_s3c2410_hc_driver.hub_control; | ||
493 | orig_ohci_hub_status_data = ohci_s3c2410_hc_driver.hub_status_data; | ||
494 | |||
495 | ohci_s3c2410_hc_driver.hub_status_data = ohci_s3c2410_hub_status_data; | 488 | ohci_s3c2410_hc_driver.hub_status_data = ohci_s3c2410_hub_status_data; |
496 | ohci_s3c2410_hc_driver.hub_control = ohci_s3c2410_hub_control; | 489 | ohci_s3c2410_hc_driver.hub_control = ohci_s3c2410_hub_control; |
497 | 490 | ||
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 9250cada13f0..a11658373209 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -727,3 +727,6 @@ extern int ohci_setup(struct usb_hcd *hcd); | |||
727 | extern int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup); | 727 | extern int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup); |
728 | extern int ohci_resume(struct usb_hcd *hcd, bool hibernated); | 728 | extern int ohci_resume(struct usb_hcd *hcd, bool hibernated); |
729 | #endif | 729 | #endif |
730 | extern int ohci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | ||
731 | u16 wIndex, char *buf, u16 wLength); | ||
732 | extern int ohci_hub_status_data(struct usb_hcd *hcd, char *buf); | ||