From patchwork Thu Mar 18 15:54:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 404524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45090C433DB for ; Thu, 18 Mar 2021 15:55:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 175B964F18 for ; Thu, 18 Mar 2021 15:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbhCRPy2 (ORCPT ); Thu, 18 Mar 2021 11:54:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:55372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232006AbhCRPx7 (ORCPT ); Thu, 18 Mar 2021 11:53:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39B3E64F18; Thu, 18 Mar 2021 15:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616082838; bh=BBrcHhfGE3iBCVKNTfQNX2XldJgZEPsT9zYlvgZfU00=; h=From:To:Cc:Subject:Date:From; b=iP/UVGFC73InLFx4efZkmlo12J8RlaVD48Fx5M8+2D46+2C2yNZBymLdMF7IwhbPN bwZaSqbrY3NMVuZ7OSaQyPeyGMa3rVc74uLWpzmCyDfoxCFv4g5ax6Ps7xOpRFEJz3 H5j1zOJuwX0aYwRorauR6MNRM/O7yqw5nkOqA88biKUCYWHGTiI/ogws0WrTeh7GyF oZEJS710wXtiPH696fkqmJD9uUC9LBoGBHygMdygMYI6kX1rEuAWUk5Zk8nAAiTCsy 1DQ3Sf32HH/LNVzxv9YV3pIgcH1MGXra6zU5dkXArnuWx4nAxH2RwBJsas6WrkCQbO 5ulGOj4X2cDMw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lMuyW-0005q3-Nw; Thu, 18 Mar 2021 16:54:16 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/2] USB: core: drop outdated interface-binding comment Date: Thu, 18 Mar 2021 16:54:05 +0100 Message-Id: <20210318155406.22399-1-johan@kernel.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It's been almost twenty years since USB drivers returned a data pointer from their probe routines in order to bind to an interface. Time to update the documentation for usb_driver_claim_interface(). Signed-off-by: Johan Hovold --- drivers/usb/core/driver.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 4dfa44d6cc3c..a1013d9da08d 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -526,10 +526,6 @@ static int usb_unbind_interface(struct device *dev) * No device driver should directly modify internal usb_interface or * usb_device structure members. * - * Few drivers should need to use this routine, since the most natural - * way to bind to an interface is to return the private data from - * the driver's probe() method. - * * Callers must own the device lock, so driver probe() entries don't need * extra locking, but other call contexts may need to explicitly claim that * lock. From patchwork Thu Mar 18 15:54:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 405228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66B9DC433E9 for ; Thu, 18 Mar 2021 15:55:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B07264F53 for ; Thu, 18 Mar 2021 15:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232039AbhCRPy3 (ORCPT ); Thu, 18 Mar 2021 11:54:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:55378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232016AbhCRPx7 (ORCPT ); Thu, 18 Mar 2021 11:53:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C3F564F2B; Thu, 18 Mar 2021 15:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616082838; bh=vnHWsTImY4WVKdFD4iKMbkqENlHuov9x76e2FXq1Qhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyVTF3TnpwjD+6LfzbBMuE8qQDRvjovNDG/MfrZYI0L0Z6ikdazRj/Sr9Wj+yjKep vIeJHZxsA2NHpEBTjUe9brneCOOURI6oEoArTMgLgs+0A97f/FBVpZtkT9nYUVoiEg 5mYo5YBd9F+jGWUG/J+nCa5fO046PvgXgw0SOfNrf68IPPEFvsrrXNKZ2l/O2MuR6D OrsOnsvYweNtMxSxPQLRQmomkXCTBrF02sHemGbZiLdWzlwjyL49qX0+iye4vB5nJh R2mWGe1KiGHty1JUZGgGnsT5tN3V3DGBe0bdbzWPCK+vBJ+HTBLqvCN3kIYD+wGTNd PECMyFqxdZ3tw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lMuyW-0005q5-Re; Thu, 18 Mar 2021 16:54:16 +0100 From: Johan Hovold To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/2] USB: core: rename usb_driver_claim_interface() data parameter Date: Thu, 18 Mar 2021 16:54:06 +0100 Message-Id: <20210318155406.22399-2-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210318155406.22399-1-johan@kernel.org> References: <20210318155406.22399-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It's been almost twenty years since the interface "private data" pointer was removed in favour of using the driver-data pointer of struct device. Let's rename the driver-data parameter of usb_driver_claim_interface() so that it better reflects how it's used. Signed-off-by: Johan Hovold --- drivers/usb/core/driver.c | 6 +++--- include/linux/usb.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index a1013d9da08d..072968c40ade 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -519,7 +519,7 @@ static int usb_unbind_interface(struct device *dev) * @driver: the driver to be bound * @iface: the interface to which it will be bound; must be in the * usb device's active configuration - * @priv: driver data associated with that interface + * @data: driver data associated with that interface * * This is used by usb device drivers that need to claim more than one * interface on a device when probing (audio and acm are current examples). @@ -533,7 +533,7 @@ static int usb_unbind_interface(struct device *dev) * Return: 0 on success. */ int usb_driver_claim_interface(struct usb_driver *driver, - struct usb_interface *iface, void *priv) + struct usb_interface *iface, void *data) { struct device *dev; int retval = 0; @@ -550,7 +550,7 @@ int usb_driver_claim_interface(struct usb_driver *driver, return -ENODEV; dev->driver = &driver->drvwrap.driver; - usb_set_intfdata(iface, priv); + usb_set_intfdata(iface, data); iface->needs_binding = 0; iface->condition = USB_INTERFACE_BOUND; diff --git a/include/linux/usb.h b/include/linux/usb.h index d6a41841b93e..08c672e7ece2 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -841,7 +841,7 @@ extern int usb_free_streams(struct usb_interface *interface, /* used these for multi-interface device registration */ extern int usb_driver_claim_interface(struct usb_driver *driver, - struct usb_interface *iface, void *priv); + struct usb_interface *iface, void *data); /** * usb_interface_claimed - returns true iff an interface is claimed