From patchwork Wed Oct 9 13:43:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Nocera X-Patchwork-Id: 11181233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13E2F13BD for ; Wed, 9 Oct 2019 13:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EECEF218AC for ; Wed, 9 Oct 2019 13:43:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731300AbfJINnr (ORCPT ); Wed, 9 Oct 2019 09:43:47 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:54835 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731072AbfJINnr (ORCPT ); Wed, 9 Oct 2019 09:43:47 -0400 X-Originating-IP: 83.155.44.161 Received: from localhost.localdomain (mon69-7-83-155-44-161.fbx.proxad.net [83.155.44.161]) (Authenticated sender: hadess@hadess.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 7F1021BF217; Wed, 9 Oct 2019 13:43:44 +0000 (UTC) From: Bastien Nocera To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Benjamin Tissoires Subject: [PATCH 1/5] USB: Export generic USB device driver functions Date: Wed, 9 Oct 2019 15:43:38 +0200 Message-Id: <20191009134342.6476-2-hadess@hadess.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191009134342.6476-1-hadess@hadess.net> References: <20191009134342.6476-1-hadess@hadess.net> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This will make it possible to implement device drivers which extend the generic driver without needing to reimplement it. Signed-off-by: Bastien Nocera --- drivers/usb/core/generic.c | 20 ++++++++++++-------- drivers/usb/core/usb.h | 4 ++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index 38f8b3e31762..7454c74d43ee 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c @@ -195,7 +195,7 @@ int usb_choose_configuration(struct usb_device *udev) } EXPORT_SYMBOL_GPL(usb_choose_configuration); -static int generic_probe(struct usb_device *udev) +int usb_generic_driver_probe(struct usb_device *udev) { int err, c; @@ -221,8 +221,9 @@ static int generic_probe(struct usb_device *udev) return 0; } +EXPORT_SYMBOL_GPL(usb_generic_driver_probe); -static void generic_disconnect(struct usb_device *udev) +void usb_generic_driver_disconnect(struct usb_device *udev) { usb_notify_remove_device(udev); @@ -231,10 +232,11 @@ static void generic_disconnect(struct usb_device *udev) if (udev->actconfig) usb_set_configuration(udev, -1); } +EXPORT_SYMBOL_GPL(usb_generic_driver_disconnect); #ifdef CONFIG_PM -static int generic_suspend(struct usb_device *udev, pm_message_t msg) +int usb_generic_driver_suspend(struct usb_device *udev, pm_message_t msg) { int rc; @@ -261,8 +263,9 @@ static int generic_suspend(struct usb_device *udev, pm_message_t msg) usbfs_notify_suspend(udev); return rc; } +EXPORT_SYMBOL_GPL(usb_generic_driver_suspend); -static int generic_resume(struct usb_device *udev, pm_message_t msg) +int usb_generic_driver_resume(struct usb_device *udev, pm_message_t msg) { int rc; @@ -280,16 +283,17 @@ static int generic_resume(struct usb_device *udev, pm_message_t msg) usbfs_notify_resume(udev); return rc; } +EXPORT_SYMBOL_GPL(usb_generic_driver_resume); #endif /* CONFIG_PM */ struct usb_device_driver usb_generic_driver = { .name = "usb", - .probe = generic_probe, - .disconnect = generic_disconnect, + .probe = usb_generic_driver_probe, + .disconnect = usb_generic_driver_disconnect, #ifdef CONFIG_PM - .suspend = generic_suspend, - .resume = generic_resume, + .suspend = usb_generic_driver_suspend, + .resume = usb_generic_driver_resume, #endif .supports_autosuspend = 1, }; diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index cf4783cf661a..7423c4c5700f 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -47,6 +47,10 @@ extern void usb_release_bos_descriptor(struct usb_device *dev); extern char *usb_cache_string(struct usb_device *udev, int index); extern int usb_set_configuration(struct usb_device *dev, int configuration); extern int usb_choose_configuration(struct usb_device *udev); +extern int usb_generic_driver_probe(struct usb_device *udev); +extern void usb_generic_driver_disconnect(struct usb_device *udev); +extern int usb_generic_driver_suspend(struct usb_device *udev, pm_message_t msg); +extern int usb_generic_driver_resume(struct usb_device *udev, pm_message_t msg); static inline unsigned usb_get_max_power(struct usb_device *udev, struct usb_host_config *c)