All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
@ 2022-01-17 22:00 Uwe Kleine-König
  2022-01-18 11:59 ` Lucas tanure
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2022-01-17 22:00 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Lucas Tanure
  Cc: patches, alsa-devel, Takashi Iwai, kernel

Up to now cs35l41_hda_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 sound/pci/hda/cs35l41_hda.c     | 4 +---
 sound/pci/hda/cs35l41_hda.h     | 2 +-
 sound/pci/hda/cs35l41_hda_i2c.c | 4 +++-
 sound/pci/hda/cs35l41_hda_spi.c | 4 +++-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index 30b40d865863..ce3782826830 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -508,7 +508,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
 }
 EXPORT_SYMBOL_GPL(cs35l41_hda_probe);
 
-int cs35l41_hda_remove(struct device *dev)
+void cs35l41_hda_remove(struct device *dev)
 {
 	struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
 
@@ -517,8 +517,6 @@ int cs35l41_hda_remove(struct device *dev)
 	if (!cs35l41->vspk_always_on)
 		gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
 	gpiod_put(cs35l41->reset_gpio);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(cs35l41_hda_remove);
 
diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h
index 76c69a8a22f6..8ecaddf5f132 100644
--- a/sound/pci/hda/cs35l41_hda.h
+++ b/sound/pci/hda/cs35l41_hda.h
@@ -64,6 +64,6 @@ struct cs35l41_hda {
 
 int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
 		      struct regmap *regmap);
-int cs35l41_hda_remove(struct device *dev);
+void cs35l41_hda_remove(struct device *dev);
 
 #endif /*__CS35L41_HDA_H__*/
diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
index 4a9462fb5c14..d4240b8ded10 100644
--- a/sound/pci/hda/cs35l41_hda_i2c.c
+++ b/sound/pci/hda/cs35l41_hda_i2c.c
@@ -32,7 +32,9 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device
 
 static int cs35l41_hda_i2c_remove(struct i2c_client *clt)
 {
-	return cs35l41_hda_remove(&clt->dev);
+	cs35l41_hda_remove(&clt->dev);
+
+	return 0;
 }
 
 static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c
index 77426e96c58f..d63c487bc3a9 100644
--- a/sound/pci/hda/cs35l41_hda_spi.c
+++ b/sound/pci/hda/cs35l41_hda_spi.c
@@ -30,7 +30,9 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi)
 
 static int cs35l41_hda_spi_remove(struct spi_device *spi)
 {
-	return cs35l41_hda_remove(&spi->dev);
+	cs35l41_hda_remove(&spi->dev);
+
+	return 0;
 }
 
 static const struct spi_device_id cs35l41_hda_spi_id[] = {

base-commit: 0c947b893d69231a9add855939da7c66237ab44f
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
  2022-01-17 22:00 [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void Uwe Kleine-König
@ 2022-01-18 11:59 ` Lucas tanure
  2022-01-18 12:15   ` Uwe Kleine-König
  2022-01-18 13:01 ` Lucas tanure
  2022-01-18 13:09 ` Takashi Iwai
  2 siblings, 1 reply; 5+ messages in thread
From: Lucas tanure @ 2022-01-18 11:59 UTC (permalink / raw)
  To: Uwe Kleine-König, James Schulman, David Rhodes
  Cc: patches, alsa-devel, Takashi Iwai, kernel

On 1/17/22 22:00, Uwe Kleine-König wrote:
> Up to now cs35l41_hda_remove() returns zero unconditionally. Make it
> return void instead which makes it easier to see in the callers that
> there is no error to handle.
> 
> Also the return value of i2c and spi remove callbacks is ignored anyway.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   sound/pci/hda/cs35l41_hda.c     | 4 +---
>   sound/pci/hda/cs35l41_hda.h     | 2 +-
>   sound/pci/hda/cs35l41_hda_i2c.c | 4 +++-
>   sound/pci/hda/cs35l41_hda_spi.c | 4 +++-
>   4 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
> index 30b40d865863..ce3782826830 100644
> --- a/sound/pci/hda/cs35l41_hda.c
> +++ b/sound/pci/hda/cs35l41_hda.c
> @@ -508,7 +508,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
>   }
>   EXPORT_SYMBOL_GPL(cs35l41_hda_probe);
>   
> -int cs35l41_hda_remove(struct device *dev)
> +void cs35l41_hda_remove(struct device *dev)
>   {
>   	struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
>   
> @@ -517,8 +517,6 @@ int cs35l41_hda_remove(struct device *dev)
>   	if (!cs35l41->vspk_always_on)
>   		gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
>   	gpiod_put(cs35l41->reset_gpio);
> -
> -	return 0;
>   }
>   EXPORT_SYMBOL_GPL(cs35l41_hda_remove);
>   
> diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h
> index 76c69a8a22f6..8ecaddf5f132 100644
> --- a/sound/pci/hda/cs35l41_hda.h
> +++ b/sound/pci/hda/cs35l41_hda.h
> @@ -64,6 +64,6 @@ struct cs35l41_hda {
>   
>   int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
>   		      struct regmap *regmap);
> -int cs35l41_hda_remove(struct device *dev);
> +void cs35l41_hda_remove(struct device *dev);
>   
>   #endif /*__CS35L41_HDA_H__*/
> diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
> index 4a9462fb5c14..d4240b8ded10 100644
> --- a/sound/pci/hda/cs35l41_hda_i2c.c
> +++ b/sound/pci/hda/cs35l41_hda_i2c.c
> @@ -32,7 +32,9 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device
>   
>   static int cs35l41_hda_i2c_remove(struct i2c_client *clt)
>   {
> -	return cs35l41_hda_remove(&clt->dev);
> +	cs35l41_hda_remove(&clt->dev);
> +
> +	return 0;
>   }
>   
>   static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
> diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c
> index 77426e96c58f..d63c487bc3a9 100644
> --- a/sound/pci/hda/cs35l41_hda_spi.c
> +++ b/sound/pci/hda/cs35l41_hda_spi.c
> @@ -30,7 +30,9 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi)
>   
>   static int cs35l41_hda_spi_remove(struct spi_device *spi)
>   {
> -	return cs35l41_hda_remove(&spi->dev);
> +	cs35l41_hda_remove(&spi->dev);
> +
> +	return 0;
>   }
>   
>   static const struct spi_device_id cs35l41_hda_spi_id[] = {
> 
> base-commit: 0c947b893d69231a9add855939da7c66237ab44f
I don't see much point in this patch. The idea of the core driver is to 
concentrate as much as code as possible can, so the I2C and SPI driver 
are minimal.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
  2022-01-18 11:59 ` Lucas tanure
@ 2022-01-18 12:15   ` Uwe Kleine-König
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2022-01-18 12:15 UTC (permalink / raw)
  To: Lucas tanure
  Cc: alsa-devel, patches, Takashi Iwai, David Rhodes, kernel, James Schulman

[-- Attachment #1: Type: text/plain, Size: 4882 bytes --]

On Tue, Jan 18, 2022 at 11:59:15AM +0000, Lucas tanure wrote:
> On 1/17/22 22:00, Uwe Kleine-König wrote:
> > Up to now cs35l41_hda_remove() returns zero unconditionally. Make it
> > return void instead which makes it easier to see in the callers that
> > there is no error to handle.
> > 
> > Also the return value of i2c and spi remove callbacks is ignored anyway.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >   sound/pci/hda/cs35l41_hda.c     | 4 +---
> >   sound/pci/hda/cs35l41_hda.h     | 2 +-
> >   sound/pci/hda/cs35l41_hda_i2c.c | 4 +++-
> >   sound/pci/hda/cs35l41_hda_spi.c | 4 +++-
> >   4 files changed, 8 insertions(+), 6 deletions(-)
> > 
> > diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
> > index 30b40d865863..ce3782826830 100644
> > --- a/sound/pci/hda/cs35l41_hda.c
> > +++ b/sound/pci/hda/cs35l41_hda.c
> > @@ -508,7 +508,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
> >   }
> >   EXPORT_SYMBOL_GPL(cs35l41_hda_probe);
> > -int cs35l41_hda_remove(struct device *dev)
> > +void cs35l41_hda_remove(struct device *dev)
> >   {
> >   	struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
> > @@ -517,8 +517,6 @@ int cs35l41_hda_remove(struct device *dev)
> >   	if (!cs35l41->vspk_always_on)
> >   		gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
> >   	gpiod_put(cs35l41->reset_gpio);
> > -
> > -	return 0;
> >   }
> >   EXPORT_SYMBOL_GPL(cs35l41_hda_remove);
> > diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h
> > index 76c69a8a22f6..8ecaddf5f132 100644
> > --- a/sound/pci/hda/cs35l41_hda.h
> > +++ b/sound/pci/hda/cs35l41_hda.h
> > @@ -64,6 +64,6 @@ struct cs35l41_hda {
> >   int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
> >   		      struct regmap *regmap);
> > -int cs35l41_hda_remove(struct device *dev);
> > +void cs35l41_hda_remove(struct device *dev);
> >   #endif /*__CS35L41_HDA_H__*/
> > diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
> > index 4a9462fb5c14..d4240b8ded10 100644
> > --- a/sound/pci/hda/cs35l41_hda_i2c.c
> > +++ b/sound/pci/hda/cs35l41_hda_i2c.c
> > @@ -32,7 +32,9 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device
> >   static int cs35l41_hda_i2c_remove(struct i2c_client *clt)
> >   {
> > -	return cs35l41_hda_remove(&clt->dev);
> > +	cs35l41_hda_remove(&clt->dev);
> > +
> > +	return 0;
> >   }
> >   static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
> > diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c
> > index 77426e96c58f..d63c487bc3a9 100644
> > --- a/sound/pci/hda/cs35l41_hda_spi.c
> > +++ b/sound/pci/hda/cs35l41_hda_spi.c
> > @@ -30,7 +30,9 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi)
> >   static int cs35l41_hda_spi_remove(struct spi_device *spi)
> >   {
> > -	return cs35l41_hda_remove(&spi->dev);
> > +	cs35l41_hda_remove(&spi->dev);
> > +
> > +	return 0;
> >   }
> >   static const struct spi_device_id cs35l41_hda_spi_id[] = {
> > 
> > base-commit: 0c947b893d69231a9add855939da7c66237ab44f
> 
> I don't see much point in this patch. The idea of the core driver is to
> concentrate as much as code as possible can, so the I2C and SPI driver are
> minimal.

How is the spi (or i2c) driver any bigger here? For now the core driver
has a feature (returning an error code, but always 0) that isn't used at
all. How is that any good?

The motivation for this patch is that I want to do this in the near
future:

	diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
	--- a/include/linux/spi/spi.h
	+++ b/include/linux/spi/spi.h
	@@ -280,7 +280,7 @@ struct spi_message;
	 struct spi_driver {
		const struct spi_device_id *id_table;
		int			(*probe)(struct spi_device *spi);
	-	int			(*remove)(struct spi_device *spi);
	+	void			(*remove)(struct spi_device *spi);
		void			(*shutdown)(struct spi_device *spi);
		struct device_driver	driver;
	 };

And as this has to touch all spi drivers in the same commit, I prefer
having only hunks like:

	-static int cs35l41_hda_spi_remove(struct spi_device *spi)
	+static void cs35l41_hda_spi_remove(struct spi_device *spi)
	 {
		cs35l41_hda_remove(&spi->dev);
	-
	-	return 0;
	 }
 
which are obviously correct compared to

	-static int cs35l41_hda_spi_remove(struct spi_device *spi)
	+static void cs35l41_hda_spi_remove(struct spi_device *spi)
	 {
	- 	return cs35l41_hda_remove(&spi->dev);
	+	cs35l41_hda_remove(&spi->dev);
	 }

BTW, the long term plan is to do the same for i2c. 

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
  2022-01-17 22:00 [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void Uwe Kleine-König
  2022-01-18 11:59 ` Lucas tanure
@ 2022-01-18 13:01 ` Lucas tanure
  2022-01-18 13:09 ` Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: Lucas tanure @ 2022-01-18 13:01 UTC (permalink / raw)
  To: Uwe Kleine-König, James Schulman, David Rhodes
  Cc: patches, alsa-devel, Takashi Iwai, kernel

On 1/17/22 22:00, Uwe Kleine-König wrote:
> Up to now cs35l41_hda_remove() returns zero unconditionally. Make it
> return void instead which makes it easier to see in the callers that
> there is no error to handle.
> 
> Also the return value of i2c and spi remove callbacks is ignored anyway.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   sound/pci/hda/cs35l41_hda.c     | 4 +---
>   sound/pci/hda/cs35l41_hda.h     | 2 +-
>   sound/pci/hda/cs35l41_hda_i2c.c | 4 +++-
>   sound/pci/hda/cs35l41_hda_spi.c | 4 +++-
>   4 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
> index 30b40d865863..ce3782826830 100644
> --- a/sound/pci/hda/cs35l41_hda.c
> +++ b/sound/pci/hda/cs35l41_hda.c
> @@ -508,7 +508,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
>   }
>   EXPORT_SYMBOL_GPL(cs35l41_hda_probe);
>   
> -int cs35l41_hda_remove(struct device *dev)
> +void cs35l41_hda_remove(struct device *dev)
>   {
>   	struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
>   
> @@ -517,8 +517,6 @@ int cs35l41_hda_remove(struct device *dev)
>   	if (!cs35l41->vspk_always_on)
>   		gpiod_set_value_cansleep(cs35l41->reset_gpio, 0);
>   	gpiod_put(cs35l41->reset_gpio);
> -
> -	return 0;
>   }
>   EXPORT_SYMBOL_GPL(cs35l41_hda_remove);
>   
> diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h
> index 76c69a8a22f6..8ecaddf5f132 100644
> --- a/sound/pci/hda/cs35l41_hda.h
> +++ b/sound/pci/hda/cs35l41_hda.h
> @@ -64,6 +64,6 @@ struct cs35l41_hda {
>   
>   int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
>   		      struct regmap *regmap);
> -int cs35l41_hda_remove(struct device *dev);
> +void cs35l41_hda_remove(struct device *dev);
>   
>   #endif /*__CS35L41_HDA_H__*/
> diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
> index 4a9462fb5c14..d4240b8ded10 100644
> --- a/sound/pci/hda/cs35l41_hda_i2c.c
> +++ b/sound/pci/hda/cs35l41_hda_i2c.c
> @@ -32,7 +32,9 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt, const struct i2c_device
>   
>   static int cs35l41_hda_i2c_remove(struct i2c_client *clt)
>   {
> -	return cs35l41_hda_remove(&clt->dev);
> +	cs35l41_hda_remove(&clt->dev);
> +
> +	return 0;
>   }
>   
>   static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
> diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c
> index 77426e96c58f..d63c487bc3a9 100644
> --- a/sound/pci/hda/cs35l41_hda_spi.c
> +++ b/sound/pci/hda/cs35l41_hda_spi.c
> @@ -30,7 +30,9 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi)
>   
>   static int cs35l41_hda_spi_remove(struct spi_device *spi)
>   {
> -	return cs35l41_hda_remove(&spi->dev);
> +	cs35l41_hda_remove(&spi->dev);
> +
> +	return 0;
>   }
>   
>   static const struct spi_device_id cs35l41_hda_spi_id[] = {
> 
> base-commit: 0c947b893d69231a9add855939da7c66237ab44f
Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void
  2022-01-17 22:00 [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void Uwe Kleine-König
  2022-01-18 11:59 ` Lucas tanure
  2022-01-18 13:01 ` Lucas tanure
@ 2022-01-18 13:09 ` Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2022-01-18 13:09 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: alsa-devel, Lucas Tanure, patches, Takashi Iwai, kernel,
	James Schulman, David Rhodes

On Mon, 17 Jan 2022 23:00:55 +0100,
Uwe Kleine-König wrote:
> 
> Up to now cs35l41_hda_remove() returns zero unconditionally. Make it
> return void instead which makes it easier to see in the callers that
> there is no error to handle.
> 
> Also the return value of i2c and spi remove callbacks is ignored anyway.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-18 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 22:00 [PATCH] ALSA: hda: cs35l41: Make cs35l41_hda_remove() return void Uwe Kleine-König
2022-01-18 11:59 ` Lucas tanure
2022-01-18 12:15   ` Uwe Kleine-König
2022-01-18 13:01 ` Lucas tanure
2022-01-18 13:09 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.