diff mbox series

[1/6] usb: gadget: Inline usb_add_gadget_udc_release

Message ID 20240826143851.8020-1-marek.vasut+renesas@mailbox.org
State Accepted
Delegated to: Mattijs Korpershoek
Headers show
Series [1/6] usb: gadget: Inline usb_add_gadget_udc_release | expand

Commit Message

Marek Vasut Aug. 26, 2024, 2:38 p.m. UTC
The release parameter of usb_add_gadget_udc_release() is never used.
The function is never called from anywhere except from a wrapper in
udc-core.c . Inline the function into the wrapper.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: Zixun LI <admin@hifiphile.com>
---
 drivers/usb/gadget/udc/udc-core.c | 20 ++------------------
 include/linux/usb/gadget.h        |  2 --
 2 files changed, 2 insertions(+), 20 deletions(-)

Comments

Miquel Raynal Aug. 26, 2024, 3:47 p.m. UTC | #1
Hi Marek,

marek.vasut+renesas@mailbox.org wrote on Mon, 26 Aug 2024 16:38:36
+0200:

> The release parameter of usb_add_gadget_udc_release() is never used.
> The function is never called from anywhere except from a wrapper in
> udc-core.c . Inline the function into the wrapper.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Zixun LI <admin@hifiphile.com>

LGTM, thanks for the cleanup! Just a minor comment, I would really
appreciate a very succinct cover letter with your overall goal. Would
also be easier for the maintainers to pick-up the tags, like this one.

For the series:

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks!
Miquèl
Mattijs Korpershoek Aug. 29, 2024, 7:08 a.m. UTC | #2
Hi Marek,

Thank you for the patch.

On lun., août 26, 2024 at 16:38, Marek Vasut <marek.vasut+renesas@mailbox.org> wrote:

> The release parameter of usb_add_gadget_udc_release() is never used.
> The function is never called from anywhere except from a wrapper in
> udc-core.c . Inline the function into the wrapper.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Lukasz Majewski <lukma@denx.de>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Neil Armstrong <neil.armstrong@linaro.org>
> Cc: Nishanth Menon <nm@ti.com>
> Cc: Zixun LI <admin@hifiphile.com>
> ---
>  drivers/usb/gadget/udc/udc-core.c | 20 ++------------------
>  include/linux/usb/gadget.h        |  2 --
>  2 files changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
> index 6bb419ae2ab..37c0ee43c52 100644
> --- a/drivers/usb/gadget/udc/udc-core.c
> +++ b/drivers/usb/gadget/udc/udc-core.c
> @@ -166,16 +166,14 @@ static void usb_udc_release(struct device *dev)
>  }
>  
>  /**
> - * usb_add_gadget_udc_release - adds a new gadget to the udc class driver list
> + * usb_add_gadget_udc - adds a new gadget to the udc class driver list
>   * @parent: the parent device to this udc. Usually the controller driver's
>   * device.
>   * @gadget: the gadget to be added to the list.
> - * @release: a gadget release function.
>   *
>   * Returns zero on success, negative errno otherwise.
>   */
> -int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
> -		void (*release)(struct device *dev))
> +int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget)
>  {
>  	struct usb_udc		*udc;
>  	int			ret = -ENOMEM;
> @@ -205,20 +203,6 @@ int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
>  err1:
>  	return ret;
>  }
> -EXPORT_SYMBOL_GPL(usb_add_gadget_udc_release);
> -
> -/**
> - * usb_add_gadget_udc - adds a new gadget to the udc class driver list
> - * @parent: the parent device to this udc. Usually the controller
> - * driver's device.
> - * @gadget: the gadget to be added to the list
> - *
> - * Returns zero on success, negative errno otherwise.
> - */
> -int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget)
> -{
> -	return usb_add_gadget_udc_release(parent, gadget, NULL);
> -}
>  EXPORT_SYMBOL_GPL(usb_add_gadget_udc);
>  
>  static void usb_gadget_remove_driver(struct usb_udc *udc)
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index c7927df15aa..d62fba0ca02 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -890,8 +890,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver);
>   */
>  int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
>  
> -int usb_add_gadget_udc_release(struct device *parent,
> -		struct usb_gadget *gadget, void (*release)(struct device *dev));
>  int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
>  void usb_del_gadget_udc(struct usb_gadget *gadget);
>  /*-------------------------------------------------------------------------*/
> -- 
> 2.45.2
Mattijs Korpershoek Sept. 10, 2024, 8:27 a.m. UTC | #3
Hi,

On Mon, 26 Aug 2024 16:38:36 +0200, Marek Vasut wrote:
> The release parameter of usb_add_gadget_udc_release() is never used.
> The function is never called from anywhere except from a wrapper in
> udc-core.c . Inline the function into the wrapper.
> 
> 

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu-next)

[1/6] usb: gadget: Inline usb_add_gadget_udc_release
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/188b26ea92f86b527f39ab66b38771a13fd67c7a
[2/6] usb: gadget: Drop usb_udc_release()
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/1ef703d73dbb5cf524045bdb34226a86b4ab0680
[3/6] usb: gadget: Track driver data as part of struct usb_gadget
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/534a3e8c1a067daf31f290acfbafdd0c407d28ad
[4/6] usb: gadget: Drop dev_to_usb_gadget()
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/1d030ba01de4ed7c2ae08301a00453c937df3cce
[5/6] usb: gadget: dwc2: Drop get/set_udc_gadget_private_data()
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/a765f5d6b4982202a42905db27f609365a47852e
[6/6] usb: gadget: Pass struct udevice to usb_add_gadget_udc()
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/75c142c73242d91b0ea9670d3b7b891216351749

--
Mattijs
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index 6bb419ae2ab..37c0ee43c52 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -166,16 +166,14 @@  static void usb_udc_release(struct device *dev)
 }
 
 /**
- * usb_add_gadget_udc_release - adds a new gadget to the udc class driver list
+ * usb_add_gadget_udc - adds a new gadget to the udc class driver list
  * @parent: the parent device to this udc. Usually the controller driver's
  * device.
  * @gadget: the gadget to be added to the list.
- * @release: a gadget release function.
  *
  * Returns zero on success, negative errno otherwise.
  */
-int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
-		void (*release)(struct device *dev))
+int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget)
 {
 	struct usb_udc		*udc;
 	int			ret = -ENOMEM;
@@ -205,20 +203,6 @@  int usb_add_gadget_udc_release(struct device *parent, struct usb_gadget *gadget,
 err1:
 	return ret;
 }
-EXPORT_SYMBOL_GPL(usb_add_gadget_udc_release);
-
-/**
- * usb_add_gadget_udc - adds a new gadget to the udc class driver list
- * @parent: the parent device to this udc. Usually the controller
- * driver's device.
- * @gadget: the gadget to be added to the list
- *
- * Returns zero on success, negative errno otherwise.
- */
-int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget)
-{
-	return usb_add_gadget_udc_release(parent, gadget, NULL);
-}
 EXPORT_SYMBOL_GPL(usb_add_gadget_udc);
 
 static void usb_gadget_remove_driver(struct usb_udc *udc)
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c7927df15aa..d62fba0ca02 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -890,8 +890,6 @@  int usb_gadget_register_driver(struct usb_gadget_driver *driver);
  */
 int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
 
-int usb_add_gadget_udc_release(struct device *parent,
-		struct usb_gadget *gadget, void (*release)(struct device *dev));
 int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
 void usb_del_gadget_udc(struct usb_gadget *gadget);
 /*-------------------------------------------------------------------------*/