[v2] ALSA: ac97: make remove callback of ac97 driver void returned

Message ID TYCP286MB2323A5AB1B2578EF4FA15DA7CAFB9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
State New
Headers
Series [v2] ALSA: ac97: make remove callback of ac97 driver void returned |

Commit Message

Dawei Li Jan. 6, 2023, 3:13 p.m. UTC
  Since commit fc7a6209d571 ("bus: Make remove callback return void")
forces bus_type::remove be void-returned, it doesn't make much sense
for any bus based driver implementing remove callbalk to return
non-void to its caller.

As such, change the remove function for ac97 based drivers to return
void.

Signed-off-by: Dawei Li <set_pte_at@outlook.com>
---
v1 -> v2
- Update commit message.
- Rebased to latest sound/for-next.

v1
- https://lore.kernel.org/all/TYCP286MB2323207367F2D39D0D725828CA189@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM/
---
 drivers/mfd/wm97xx-core.c  | 4 +---
 include/sound/ac97/codec.h | 2 +-
 sound/ac97/bus.c           | 5 ++---
 3 files changed, 4 insertions(+), 7 deletions(-)
  

Comments

Dawei Li Jan. 24, 2023, 3:16 p.m. UTC | #1
On Fri, Jan 06, 2023 at 11:13:49PM +0800, Dawei Li wrote:
> Since commit fc7a6209d571 ("bus: Make remove callback return void")
> forces bus_type::remove be void-returned, it doesn't make much sense
> for any bus based driver implementing remove callbalk to return
> non-void to its caller.
> 
> As such, change the remove function for ac97 based drivers to return
> void.
> 
> Signed-off-by: Dawei Li <set_pte_at@outlook.com>

Gentle ping...

> ---
> v1 -> v2
> - Update commit message.
> - Rebased to latest sound/for-next.
> 
> v1
> - https://lore.kernel.org/all/TYCP286MB2323207367F2D39D0D725828CA189@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM/
> ---
>  drivers/mfd/wm97xx-core.c  | 4 +---
>  include/sound/ac97/codec.h | 2 +-
>  sound/ac97/bus.c           | 5 ++---
>  3 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c
> index 9a2331eb1bfa..663acbb1854c 100644
> --- a/drivers/mfd/wm97xx-core.c
> +++ b/drivers/mfd/wm97xx-core.c
> @@ -319,13 +319,11 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
>  	return ret;
>  }
>  
> -static int wm97xx_ac97_remove(struct ac97_codec_device *adev)
> +static void wm97xx_ac97_remove(struct ac97_codec_device *adev)
>  {
>  	struct wm97xx_priv *wm97xx = ac97_get_drvdata(adev);
>  
>  	snd_ac97_compat_release(wm97xx->ac97);
> -
> -	return 0;
>  }
>  
>  static const struct ac97_id wm97xx_ac97_ids[] = {
> diff --git a/include/sound/ac97/codec.h b/include/sound/ac97/codec.h
> index 9792d25fa369..2fc641cb1982 100644
> --- a/include/sound/ac97/codec.h
> +++ b/include/sound/ac97/codec.h
> @@ -63,7 +63,7 @@ struct ac97_codec_device {
>  struct ac97_codec_driver {
>  	struct device_driver	driver;
>  	int			(*probe)(struct ac97_codec_device *);
> -	int			(*remove)(struct ac97_codec_device *);
> +	void			(*remove)(struct ac97_codec_device *dev);
>  	void			(*shutdown)(struct ac97_codec_device *);
>  	const struct ac97_id	*id_table;
>  };
> diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
> index 045330883a96..6067c04ce4c0 100644
> --- a/sound/ac97/bus.c
> +++ b/sound/ac97/bus.c
> @@ -524,10 +524,9 @@ static void ac97_bus_remove(struct device *dev)
>  	if (ret < 0)
>  		return;
>  
> -	ret = adrv->remove(adev);
> +	adrv->remove(adev);
>  	pm_runtime_put_noidle(dev);
> -	if (ret == 0)
> -		ac97_put_disable_clk(adev);
> +	ac97_put_disable_clk(adev);
>  
>  	pm_runtime_disable(dev);
>  }
> -- 
> 2.25.1
>
  
Takashi Iwai Jan. 25, 2023, 8:34 a.m. UTC | #2
On Fri, 06 Jan 2023 16:13:49 +0100,
Dawei Li wrote:
> 
> Since commit fc7a6209d571 ("bus: Make remove callback return void")
> forces bus_type::remove be void-returned, it doesn't make much sense
> for any bus based driver implementing remove callbalk to return
> non-void to its caller.
> 
> As such, change the remove function for ac97 based drivers to return
> void.
> 
> Signed-off-by: Dawei Li <set_pte_at@outlook.com>

Applied now, thanks.


Takashi
  

Patch

diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c
index 9a2331eb1bfa..663acbb1854c 100644
--- a/drivers/mfd/wm97xx-core.c
+++ b/drivers/mfd/wm97xx-core.c
@@ -319,13 +319,11 @@  static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
 	return ret;
 }
 
-static int wm97xx_ac97_remove(struct ac97_codec_device *adev)
+static void wm97xx_ac97_remove(struct ac97_codec_device *adev)
 {
 	struct wm97xx_priv *wm97xx = ac97_get_drvdata(adev);
 
 	snd_ac97_compat_release(wm97xx->ac97);
-
-	return 0;
 }
 
 static const struct ac97_id wm97xx_ac97_ids[] = {
diff --git a/include/sound/ac97/codec.h b/include/sound/ac97/codec.h
index 9792d25fa369..2fc641cb1982 100644
--- a/include/sound/ac97/codec.h
+++ b/include/sound/ac97/codec.h
@@ -63,7 +63,7 @@  struct ac97_codec_device {
 struct ac97_codec_driver {
 	struct device_driver	driver;
 	int			(*probe)(struct ac97_codec_device *);
-	int			(*remove)(struct ac97_codec_device *);
+	void			(*remove)(struct ac97_codec_device *dev);
 	void			(*shutdown)(struct ac97_codec_device *);
 	const struct ac97_id	*id_table;
 };
diff --git a/sound/ac97/bus.c b/sound/ac97/bus.c
index 045330883a96..6067c04ce4c0 100644
--- a/sound/ac97/bus.c
+++ b/sound/ac97/bus.c
@@ -524,10 +524,9 @@  static void ac97_bus_remove(struct device *dev)
 	if (ret < 0)
 		return;
 
-	ret = adrv->remove(adev);
+	adrv->remove(adev);
 	pm_runtime_put_noidle(dev);
-	if (ret == 0)
-		ac97_put_disable_clk(adev);
+	ac97_put_disable_clk(adev);
 
 	pm_runtime_disable(dev);
 }