From patchwork Wed Apr 16 13:16:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 4001221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B0B29F38C for ; Wed, 16 Apr 2014 13:19:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2D74202B8 for ; Wed, 16 Apr 2014 13:19:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E9CF2025B for ; Wed, 16 Apr 2014 13:19:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaPiV-00053e-E4; Wed, 16 Apr 2014 13:17:31 +0000 Received: from perceval.ideasonboard.com ([95.142.166.194]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WaPiL-0004fV-AJ for linux-arm-kernel@lists.infradead.org; Wed, 16 Apr 2014 13:17:22 +0000 Received: from avalon.ideasonboard.com (unknown [91.178.167.41]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9AC6C359FB; Wed, 16 Apr 2014 15:14:52 +0200 (CEST) From: Laurent Pinchart To: linux-usb@vger.kernel.org Subject: [PATCH v3 1/4] USB: OHCI: Export the OHCI hub control and status_data functions Date: Wed, 16 Apr 2014 15:16:52 +0200 Message-Id: <1397654215-23699-2-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1397654215-23699-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1397654215-23699-1-git-send-email-laurent.pinchart@ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140416_061721_711891_DA48290B X-CRM114-Status: GOOD ( 12.84 ) X-Spam-Score: -0.7 (/) Cc: Kukjin Kim , Stephen Warren , Greg Kroah-Hartman , Daniel Mack , Thierry Reding , Alan Stern , Ben Dooks , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/usb/host/ohci-at91.c | 11 ++--------- drivers/usb/host/ohci-hub.c | 8 ++++---- drivers/usb/host/ohci-s3c2410.c | 13 +++---------- 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 091ae49..e49eb4f 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"; static struct hc_driver __read_mostly ohci_at91_hc_driver; static int clocked; -static int (*orig_ohci_hub_control)(struct usb_hcd *hcd, u16 typeReq, - u16 wValue, u16 wIndex, char *buf, u16 wLength); -static int (*orig_ohci_hub_status_data)(struct usb_hcd *hcd, char *buf); extern int usb_disabled(void); @@ -262,7 +259,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf) { struct at91_usbh_data *pdata = hcd->self.controller->platform_data; - int length = orig_ohci_hub_status_data(hcd, buf); + int length = ohci_hub_status_data(hcd, buf); int port; at91_for_each_port(port) { @@ -340,8 +337,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, break; } - ret = orig_ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, - buf, wLength); + ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength); if (ret) goto out; @@ -690,9 +686,6 @@ static int __init ohci_at91_init(void) * too easy. */ - orig_ohci_hub_control = ohci_at91_hc_driver.hub_control; - orig_ohci_hub_status_data = ohci_at91_hc_driver.hub_status_data; - ohci_at91_hc_driver.hub_status_data = ohci_at91_hub_status_data; ohci_at91_hc_driver.hub_control = ohci_at91_hub_control; diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index c81c872..3d53208 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, /* build "status change" packet (one or two bytes) from HC registers */ -static int -ohci_hub_status_data (struct usb_hcd *hcd, char *buf) +int ohci_hub_status_data(struct usb_hcd *hcd, char *buf) { struct ohci_hcd *ohci = hcd_to_ohci (hcd); int i, changed = 0, length = 1; @@ -504,6 +503,7 @@ done: return changed ? length : 0; } +EXPORT_SYMBOL_GPL(ohci_hub_status_data); /*-------------------------------------------------------------------------*/ @@ -646,7 +646,7 @@ static inline int root_port_reset (struct ohci_hcd *ohci, unsigned port) return 0; } -static int ohci_hub_control ( +int ohci_hub_control( struct usb_hcd *hcd, u16 typeReq, u16 wValue, @@ -772,4 +772,4 @@ error: } return retval; } - +EXPORT_SYMBOL_GPL(ohci_hub_control); diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index ff7c8f1..3d753a9 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -45,10 +45,6 @@ static struct clk *usb_clk; /* forward definitions */ -static int (*orig_ohci_hub_control)(struct usb_hcd *hcd, u16 typeReq, - u16 wValue, u16 wIndex, char *buf, u16 wLength); -static int (*orig_ohci_hub_status_data)(struct usb_hcd *hcd, char *buf); - static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); /* conversion functions */ @@ -110,7 +106,7 @@ ohci_s3c2410_hub_status_data(struct usb_hcd *hcd, char *buf) int orig; int portno; - orig = orig_ohci_hub_status_data(hcd, buf); + orig = ohci_hub_status_data(hcd, buf); if (info == NULL) return orig; @@ -181,7 +177,7 @@ static int ohci_s3c2410_hub_control( * process the request straight away and exit */ if (info == NULL) { - ret = orig_ohci_hub_control(hcd, typeReq, wValue, + ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); goto out; } @@ -231,7 +227,7 @@ static int ohci_s3c2410_hub_control( break; } - ret = orig_ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); + ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); if (ret) goto out; @@ -489,9 +485,6 @@ static int __init ohci_s3c2410_init(void) * override these functions by making it too easy. */ - orig_ohci_hub_control = ohci_s3c2410_hc_driver.hub_control; - orig_ohci_hub_status_data = ohci_s3c2410_hc_driver.hub_status_data; - ohci_s3c2410_hc_driver.hub_status_data = ohci_s3c2410_hub_status_data; ohci_s3c2410_hc_driver.hub_control = ohci_s3c2410_hub_control; diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 9250cad..a116583 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); extern int ohci_suspend(struct usb_hcd *hcd, bool do_wakeup); extern int ohci_resume(struct usb_hcd *hcd, bool hibernated); #endif +extern int ohci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, + u16 wIndex, char *buf, u16 wLength); +extern int ohci_hub_status_data(struct usb_hcd *hcd, char *buf);