diff mbox series

[83/97] usb: xhci-plat: Convert to platform remove callback returning void

Message ID 20230517230239.187727-84-u.kleine-koenig@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series usb: Convert to platform remove callback returning void | expand

Commit Message

Uwe Kleine-König May 17, 2023, 11:02 p.m. UTC
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart from
emitting a warning) and this typically results in resource leaks. To improve
here there is a quest to make the remove callback return void. In the first
step of this quest all drivers are converted to .remove_new() which already
returns void. Eventually after all drivers are converted, .remove_new() is
renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/usb/host/xhci-plat.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Yoshihiro Shimoda May 18, 2023, 2:28 a.m. UTC | #1
Hi Uwe,

> From: Uwe Kleine-König, Sent: Thursday, May 18, 2023 8:02 AM
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart from
> emitting a warning) and this typically results in resource leaks. To improve
> here there is a quest to make the remove callback return void. In the first
> step of this quest all drivers are converted to .remove_new() which already
> returns void. Eventually after all drivers are converted, .remove_new() is
> renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/usb/host/xhci-plat.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index b0c8e8efc43b..523e3843db5e 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -399,7 +399,7 @@ static int xhci_generic_plat_probe(struct platform_device *pdev)
>  	return xhci_plat_probe(pdev, sysdev, priv_match);
>  }
> 
> -int xhci_plat_remove(struct platform_device *dev)
> +void xhci_plat_remove(struct platform_device *dev)

We should change the prototype in the xhci-plat.h. Otherwise
the following build error happens:
---
drivers/usb/host/xhci-plat.c:398:6: error: conflicting types for 'xhci_plat_remove'; have 'void(struct platform_device *)'
  398 | void xhci_plat_remove(struct platform_device *dev)
      |      ^~~~~~~~~~~~~~~~
In file included from drivers/usb/host/xhci-plat.c:25:
drivers/usb/host/xhci-plat.h:28:5: note: previous declaration of 'xhci_plat_remove' with type 'int(struct platform_device *)'
   28 | int xhci_plat_remove(struct platform_device *dev);
      |     ^~~~~~~~~~~~~~~~
In file included from ./include/linux/linkage.h:7,
                 from ./include/linux/kernel.h:17,
                 from ./include/linux/clk.h:13,
                 from drivers/usb/host/xhci-plat.c:11:
drivers/usb/host/xhci-plat.c:430:19: error: conflicting types for 'xhci_plat_remove'; have 'void(struct platform_device *)'
---

Since the xhci-rcar.c uses xhci_plat_remove(), we should change
the xhci-rcar.c in this patch too, I think.

Best regards,
Yoshihiro Shimoda

>  {
>  	struct usb_hcd	*hcd = platform_get_drvdata(dev);
>  	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
> @@ -430,8 +430,6 @@ int xhci_plat_remove(struct platform_device *dev)
>  	pm_runtime_disable(&dev->dev);
>  	pm_runtime_put_noidle(&dev->dev);
>  	pm_runtime_set_suspended(&dev->dev);
> -
> -	return 0;
>  }
>  EXPORT_SYMBOL_GPL(xhci_plat_remove);
> 
> @@ -530,7 +528,7 @@ MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
> 
>  static struct platform_driver usb_generic_xhci_driver = {
>  	.probe	= xhci_generic_plat_probe,
> -	.remove	= xhci_plat_remove,
> +	.remove_new = xhci_plat_remove,
>  	.shutdown = usb_hcd_platform_shutdown,
>  	.driver	= {
>  		.name = "xhci-hcd",
> --
> 2.39.2
kernel test robot May 18, 2023, 10:36 a.m. UTC | #2
Hi Uwe,

kernel test robot noticed the following build errors:

[auto build test ERROR on ac9a78681b921877518763ba0e89202254349d1b]

url:    https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/usb-c67x00-drv-Convert-to-platform-remove-callback-returning-void/20230518-070939
base:   ac9a78681b921877518763ba0e89202254349d1b
patch link:    https://lore.kernel.org/r/20230517230239.187727-84-u.kleine-koenig%40pengutronix.de
patch subject: [PATCH 83/97] usb: xhci-plat: Convert to platform remove callback returning void
config: arm-buildonly-randconfig-r004-20230517
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/a15d372314b8d59dad452c251a3a72b9fc2d7cf8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Uwe-Kleine-K-nig/usb-c67x00-drv-Convert-to-platform-remove-callback-returning-void/20230518-070939
        git checkout a15d372314b8d59dad452c251a3a72b9fc2d7cf8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/usb/host/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305181842.waSxU819-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/usb/host/xhci-plat.c:402:6: error: conflicting types for 'xhci_plat_remove'
   void xhci_plat_remove(struct platform_device *dev)
        ^
   drivers/usb/host/xhci-plat.h:28:5: note: previous declaration is here
   int xhci_plat_remove(struct platform_device *dev);
       ^
>> drivers/usb/host/xhci-plat.c:531:16: error: incompatible function pointer types initializing 'void (*)(struct platform_device *)' with an expression of type 'int (struct platform_device *)' [-Wincompatible-function-pointer-types]
           .remove_new = xhci_plat_remove,
                         ^~~~~~~~~~~~~~~~
   2 errors generated.


vim +/xhci_plat_remove +402 drivers/usb/host/xhci-plat.c

   401	
 > 402	void xhci_plat_remove(struct platform_device *dev)
   403	{
   404		struct usb_hcd	*hcd = platform_get_drvdata(dev);
   405		struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
   406		struct clk *clk = xhci->clk;
   407		struct clk *reg_clk = xhci->reg_clk;
   408		struct usb_hcd *shared_hcd = xhci->shared_hcd;
   409	
   410		pm_runtime_get_sync(&dev->dev);
   411		xhci->xhc_state |= XHCI_STATE_REMOVING;
   412	
   413		if (shared_hcd) {
   414			usb_remove_hcd(shared_hcd);
   415			xhci->shared_hcd = NULL;
   416		}
   417	
   418		usb_phy_shutdown(hcd->usb_phy);
   419	
   420		usb_remove_hcd(hcd);
   421	
   422		if (shared_hcd)
   423			usb_put_hcd(shared_hcd);
   424	
   425		clk_disable_unprepare(clk);
   426		clk_disable_unprepare(reg_clk);
   427		reset_control_assert(xhci->reset);
   428		usb_put_hcd(hcd);
   429	
   430		pm_runtime_disable(&dev->dev);
   431		pm_runtime_put_noidle(&dev->dev);
   432		pm_runtime_set_suspended(&dev->dev);
   433	}
   434	EXPORT_SYMBOL_GPL(xhci_plat_remove);
   435	
   436	static int __maybe_unused xhci_plat_suspend(struct device *dev)
   437	{
   438		struct usb_hcd	*hcd = dev_get_drvdata(dev);
   439		struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
   440		int ret;
   441	
   442		if (pm_runtime_suspended(dev))
   443			pm_runtime_resume(dev);
   444	
   445		ret = xhci_priv_suspend_quirk(hcd);
   446		if (ret)
   447			return ret;
   448		/*
   449		 * xhci_suspend() needs `do_wakeup` to know whether host is allowed
   450		 * to do wakeup during suspend.
   451		 */
   452		ret = xhci_suspend(xhci, device_may_wakeup(dev));
   453		if (ret)
   454			return ret;
   455	
   456		if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) {
   457			clk_disable_unprepare(xhci->clk);
   458			clk_disable_unprepare(xhci->reg_clk);
   459		}
   460	
   461		return 0;
   462	}
   463	
   464	static int __maybe_unused xhci_plat_resume(struct device *dev)
   465	{
   466		struct usb_hcd	*hcd = dev_get_drvdata(dev);
   467		struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
   468		int ret;
   469	
   470		if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) {
   471			clk_prepare_enable(xhci->clk);
   472			clk_prepare_enable(xhci->reg_clk);
   473		}
   474	
   475		ret = xhci_priv_resume_quirk(hcd);
   476		if (ret)
   477			return ret;
   478	
   479		ret = xhci_resume(xhci, 0);
   480		if (ret)
   481			return ret;
   482	
   483		pm_runtime_disable(dev);
   484		pm_runtime_set_active(dev);
   485		pm_runtime_enable(dev);
   486	
   487		return 0;
   488	}
   489	
   490	static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev)
   491	{
   492		struct usb_hcd  *hcd = dev_get_drvdata(dev);
   493		struct xhci_hcd *xhci = hcd_to_xhci(hcd);
   494		int ret;
   495	
   496		ret = xhci_priv_suspend_quirk(hcd);
   497		if (ret)
   498			return ret;
   499	
   500		return xhci_suspend(xhci, true);
   501	}
   502	
   503	static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
   504	{
   505		struct usb_hcd  *hcd = dev_get_drvdata(dev);
   506		struct xhci_hcd *xhci = hcd_to_xhci(hcd);
   507	
   508		return xhci_resume(xhci, 0);
   509	}
   510	
   511	const struct dev_pm_ops xhci_plat_pm_ops = {
   512		SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
   513	
   514		SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend,
   515				   xhci_plat_runtime_resume,
   516				   NULL)
   517	};
   518	EXPORT_SYMBOL_GPL(xhci_plat_pm_ops);
   519	
   520	#ifdef CONFIG_ACPI
   521	static const struct acpi_device_id usb_xhci_acpi_match[] = {
   522		/* XHCI-compliant USB Controller */
   523		{ "PNP0D10", },
   524		{ }
   525	};
   526	MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
   527	#endif
   528	
   529	static struct platform_driver usb_generic_xhci_driver = {
   530		.probe	= xhci_generic_plat_probe,
 > 531		.remove_new = xhci_plat_remove,
   532		.shutdown = usb_hcd_platform_shutdown,
   533		.driver	= {
   534			.name = "xhci-hcd",
   535			.pm = &xhci_plat_pm_ops,
   536			.of_match_table = of_match_ptr(usb_xhci_of_match),
   537			.acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
   538		},
   539	};
   540	MODULE_ALIAS("platform:xhci-hcd");
   541
kernel test robot May 18, 2023, 11:23 a.m. UTC | #3
Hi Uwe,

kernel test robot noticed the following build errors:

[auto build test ERROR on ac9a78681b921877518763ba0e89202254349d1b]

url:    https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/usb-c67x00-drv-Convert-to-platform-remove-callback-returning-void/20230518-070939
base:   ac9a78681b921877518763ba0e89202254349d1b
patch link:    https://lore.kernel.org/r/20230517230239.187727-84-u.kleine-koenig%40pengutronix.de
patch subject: [PATCH 83/97] usb: xhci-plat: Convert to platform remove callback returning void
config: x86_64-randconfig-x062
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/a15d372314b8d59dad452c251a3a72b9fc2d7cf8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Uwe-Kleine-K-nig/usb-c67x00-drv-Convert-to-platform-remove-callback-returning-void/20230518-070939
        git checkout a15d372314b8d59dad452c251a3a72b9fc2d7cf8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/usb/host/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305181906.Vau9RKnr-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/usb/host/xhci-plat.c:402:6: error: conflicting types for 'xhci_plat_remove'
   void xhci_plat_remove(struct platform_device *dev)
        ^
   drivers/usb/host/xhci-plat.h:28:5: note: previous declaration is here
   int xhci_plat_remove(struct platform_device *dev);
       ^
>> drivers/usb/host/xhci-plat.c:531:16: error: incompatible function pointer types initializing 'void (*)(struct platform_device *)' with an expression of type 'int (struct platform_device *)' [-Werror,-Wincompatible-function-pointer-types]
           .remove_new = xhci_plat_remove,
                         ^~~~~~~~~~~~~~~~
   2 errors generated.


vim +/xhci_plat_remove +402 drivers/usb/host/xhci-plat.c

   401	
 > 402	void xhci_plat_remove(struct platform_device *dev)
   403	{
   404		struct usb_hcd	*hcd = platform_get_drvdata(dev);
   405		struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
   406		struct clk *clk = xhci->clk;
   407		struct clk *reg_clk = xhci->reg_clk;
   408		struct usb_hcd *shared_hcd = xhci->shared_hcd;
   409	
   410		pm_runtime_get_sync(&dev->dev);
   411		xhci->xhc_state |= XHCI_STATE_REMOVING;
   412	
   413		if (shared_hcd) {
   414			usb_remove_hcd(shared_hcd);
   415			xhci->shared_hcd = NULL;
   416		}
   417	
   418		usb_phy_shutdown(hcd->usb_phy);
   419	
   420		usb_remove_hcd(hcd);
   421	
   422		if (shared_hcd)
   423			usb_put_hcd(shared_hcd);
   424	
   425		clk_disable_unprepare(clk);
   426		clk_disable_unprepare(reg_clk);
   427		reset_control_assert(xhci->reset);
   428		usb_put_hcd(hcd);
   429	
   430		pm_runtime_disable(&dev->dev);
   431		pm_runtime_put_noidle(&dev->dev);
   432		pm_runtime_set_suspended(&dev->dev);
   433	}
   434	EXPORT_SYMBOL_GPL(xhci_plat_remove);
   435	
   436	static int __maybe_unused xhci_plat_suspend(struct device *dev)
   437	{
   438		struct usb_hcd	*hcd = dev_get_drvdata(dev);
   439		struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
   440		int ret;
   441	
   442		if (pm_runtime_suspended(dev))
   443			pm_runtime_resume(dev);
   444	
   445		ret = xhci_priv_suspend_quirk(hcd);
   446		if (ret)
   447			return ret;
   448		/*
   449		 * xhci_suspend() needs `do_wakeup` to know whether host is allowed
   450		 * to do wakeup during suspend.
   451		 */
   452		ret = xhci_suspend(xhci, device_may_wakeup(dev));
   453		if (ret)
   454			return ret;
   455	
   456		if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) {
   457			clk_disable_unprepare(xhci->clk);
   458			clk_disable_unprepare(xhci->reg_clk);
   459		}
   460	
   461		return 0;
   462	}
   463	
   464	static int __maybe_unused xhci_plat_resume(struct device *dev)
   465	{
   466		struct usb_hcd	*hcd = dev_get_drvdata(dev);
   467		struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
   468		int ret;
   469	
   470		if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) {
   471			clk_prepare_enable(xhci->clk);
   472			clk_prepare_enable(xhci->reg_clk);
   473		}
   474	
   475		ret = xhci_priv_resume_quirk(hcd);
   476		if (ret)
   477			return ret;
   478	
   479		ret = xhci_resume(xhci, 0);
   480		if (ret)
   481			return ret;
   482	
   483		pm_runtime_disable(dev);
   484		pm_runtime_set_active(dev);
   485		pm_runtime_enable(dev);
   486	
   487		return 0;
   488	}
   489	
   490	static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev)
   491	{
   492		struct usb_hcd  *hcd = dev_get_drvdata(dev);
   493		struct xhci_hcd *xhci = hcd_to_xhci(hcd);
   494		int ret;
   495	
   496		ret = xhci_priv_suspend_quirk(hcd);
   497		if (ret)
   498			return ret;
   499	
   500		return xhci_suspend(xhci, true);
   501	}
   502	
   503	static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
   504	{
   505		struct usb_hcd  *hcd = dev_get_drvdata(dev);
   506		struct xhci_hcd *xhci = hcd_to_xhci(hcd);
   507	
   508		return xhci_resume(xhci, 0);
   509	}
   510	
   511	const struct dev_pm_ops xhci_plat_pm_ops = {
   512		SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
   513	
   514		SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend,
   515				   xhci_plat_runtime_resume,
   516				   NULL)
   517	};
   518	EXPORT_SYMBOL_GPL(xhci_plat_pm_ops);
   519	
   520	#ifdef CONFIG_ACPI
   521	static const struct acpi_device_id usb_xhci_acpi_match[] = {
   522		/* XHCI-compliant USB Controller */
   523		{ "PNP0D10", },
   524		{ }
   525	};
   526	MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
   527	#endif
   528	
   529	static struct platform_driver usb_generic_xhci_driver = {
   530		.probe	= xhci_generic_plat_probe,
 > 531		.remove_new = xhci_plat_remove,
   532		.shutdown = usb_hcd_platform_shutdown,
   533		.driver	= {
   534			.name = "xhci-hcd",
   535			.pm = &xhci_plat_pm_ops,
   536			.of_match_table = of_match_ptr(usb_xhci_of_match),
   537			.acpi_match_table = ACPI_PTR(usb_xhci_acpi_match),
   538		},
   539	};
   540	MODULE_ALIAS("platform:xhci-hcd");
   541
Uwe Kleine-König May 18, 2023, 3:08 p.m. UTC | #4
Hello,

On Thu, May 18, 2023 at 02:28:44AM +0000, Yoshihiro Shimoda wrote:
> > From: Uwe Kleine-König, Sent: Thursday, May 18, 2023 8:02 AM
> > 
> > The .remove() callback for a platform driver returns an int which makes
> > many driver authors wrongly assume it's possible to do error handling by
> > returning an error code. However the value returned is ignored (apart from
> > emitting a warning) and this typically results in resource leaks. To improve
> > here there is a quest to make the remove callback return void. In the first
> > step of this quest all drivers are converted to .remove_new() which already
> > returns void. Eventually after all drivers are converted, .remove_new() is
> > renamed to .remove().
> > 
> > Trivially convert this driver from always returning zero in the remove
> > callback to the void returning variant.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/usb/host/xhci-plat.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> > index b0c8e8efc43b..523e3843db5e 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -399,7 +399,7 @@ static int xhci_generic_plat_probe(struct platform_device *pdev)
> >  	return xhci_plat_probe(pdev, sysdev, priv_match);
> >  }
> > 
> > -int xhci_plat_remove(struct platform_device *dev)
> > +void xhci_plat_remove(struct platform_device *dev)
> 
> We should change the prototype in the xhci-plat.h. Otherwise
> the following build error happens:
> ---
> drivers/usb/host/xhci-plat.c:398:6: error: conflicting types for 'xhci_plat_remove'; have 'void(struct platform_device *)'
>   398 | void xhci_plat_remove(struct platform_device *dev)
>       |      ^~~~~~~~~~~~~~~~
> In file included from drivers/usb/host/xhci-plat.c:25:
> drivers/usb/host/xhci-plat.h:28:5: note: previous declaration of 'xhci_plat_remove' with type 'int(struct platform_device *)'
>    28 | int xhci_plat_remove(struct platform_device *dev);
>       |     ^~~~~~~~~~~~~~~~
> In file included from ./include/linux/linkage.h:7,
>                  from ./include/linux/kernel.h:17,
>                  from ./include/linux/clk.h:13,
>                  from drivers/usb/host/xhci-plat.c:11:
> drivers/usb/host/xhci-plat.c:430:19: error: conflicting types for 'xhci_plat_remove'; have 'void(struct platform_device *)'
> ---
> 
> Since the xhci-rcar.c uses xhci_plat_remove(), we should change
> the xhci-rcar.c in this patch too, I think.

indeed, I squashed the following change into this patch in my tree:


diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 83b5b5aa9f8e..2d15386f2c50 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -25,7 +25,7 @@ struct xhci_plat_priv {
 int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev,
 		    const struct xhci_plat_priv *priv_match);
 
-int xhci_plat_remove(struct platform_device *dev);
+void xhci_plat_remove(struct platform_device *dev);
 extern const struct dev_pm_ops xhci_plat_pm_ops;
 
 #endif	/* _XHCI_PLAT_H */
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index ad966b797b89..bf5261fed32c 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -276,10 +276,10 @@ static int xhci_renesas_probe(struct platform_device *pdev)
 }
 
 static struct platform_driver usb_xhci_renesas_driver = {
-	.probe	= xhci_renesas_probe,
-	.remove	= xhci_plat_remove,
+	.probe = xhci_renesas_probe,
+	.remove_new = xhci_plat_remove,
 	.shutdown = usb_hcd_platform_shutdown,
-	.driver	= {
+	.driver = {
 		.name = "xhci-renesas-hcd",
 		.pm = &xhci_plat_pm_ops,
 		.of_match_table = usb_xhci_of_match,

(which also "fixes" the alignments of =).

@Greg: Assuming it will be you who picks up this series, I suggest you
skip this patch for now and I address this together with the other
changes that need still be done for drivers/usb before we switch back to
.remove() with the fixed prototype. (There are a few drivers[1] that
might return an error code in .remove(), didn't look into those yet.)

Best regards
Uwe

[1] drivers/usb/gadget/udc/aspeed_udc.c
    drivers/usb/gadget/udc/at91_udc.c
    drivers/usb/gadget/udc/fsl_udc_core.c
    drivers/usb/gadget/udc/gr_udc.c
    drivers/usb/gadget/udc/lpc32xx_udc.c
    drivers/usb/gadget/udc/pxa25x_udc.c
    drivers/usb/misc/onboard_usb_hub.c
    drivers/usb/mtu3/mtu3_plat.c
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index b0c8e8efc43b..523e3843db5e 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -399,7 +399,7 @@  static int xhci_generic_plat_probe(struct platform_device *pdev)
 	return xhci_plat_probe(pdev, sysdev, priv_match);
 }
 
-int xhci_plat_remove(struct platform_device *dev)
+void xhci_plat_remove(struct platform_device *dev)
 {
 	struct usb_hcd	*hcd = platform_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
@@ -430,8 +430,6 @@  int xhci_plat_remove(struct platform_device *dev)
 	pm_runtime_disable(&dev->dev);
 	pm_runtime_put_noidle(&dev->dev);
 	pm_runtime_set_suspended(&dev->dev);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(xhci_plat_remove);
 
@@ -530,7 +528,7 @@  MODULE_DEVICE_TABLE(acpi, usb_xhci_acpi_match);
 
 static struct platform_driver usb_generic_xhci_driver = {
 	.probe	= xhci_generic_plat_probe,
-	.remove	= xhci_plat_remove,
+	.remove_new = xhci_plat_remove,
 	.shutdown = usb_hcd_platform_shutdown,
 	.driver	= {
 		.name = "xhci-hcd",