[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241123154544.110eff2c@jic23-huawei>
Date: Sat, 23 Nov 2024 15:45:44 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Michael Hennerich <Michael.Hennerich@...log.com>, Liam Girdwood
<lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, Antoniu Miclaus
<antoniu.miclaus@...log.com>, Nuno Sá <nuno.sa@...log.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/11] iio: dac: ad5686: drop driver remove function
On Wed, 20 Nov 2024 15:33:27 -0600
David Lechner <dlechner@...libre.com> wrote:
> Remove driver remove callback for ad5686 SPI and I2C drivers.
>
> By making use of devm_iio_device_register(), we no longer need a driver
> remove callback. Also since this was the last user of dev_get_drvdata(),
> we can drop the call to dev_set_drvdata().
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
Applied 1-4
> ---
> drivers/iio/dac/ad5686-spi.c | 6 ------
> drivers/iio/dac/ad5686.c | 11 +----------
> drivers/iio/dac/ad5686.h | 2 --
> drivers/iio/dac/ad5696-i2c.c | 6 ------
> 4 files changed, 1 insertion(+), 24 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5686-spi.c b/drivers/iio/dac/ad5686-spi.c
> index 8ba2ea70451a..79cfae7a1048 100644
> --- a/drivers/iio/dac/ad5686-spi.c
> +++ b/drivers/iio/dac/ad5686-spi.c
> @@ -95,11 +95,6 @@ static int ad5686_spi_probe(struct spi_device *spi)
> ad5686_spi_write, ad5686_spi_read);
> }
>
> -static void ad5686_spi_remove(struct spi_device *spi)
> -{
> - ad5686_remove(&spi->dev);
> -}
> -
> static const struct spi_device_id ad5686_spi_id[] = {
> {"ad5310r", ID_AD5310R},
> {"ad5672r", ID_AD5672R},
> @@ -126,7 +121,6 @@ static struct spi_driver ad5686_spi_driver = {
> .name = "ad5686",
> },
> .probe = ad5686_spi_probe,
> - .remove = ad5686_spi_remove,
> .id_table = ad5686_spi_id,
> };
>
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index a8a38879fc40..b848b076851c 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
> @@ -464,7 +464,6 @@ int ad5686_probe(struct device *dev,
> return -ENOMEM;
>
> st = iio_priv(indio_dev);
> - dev_set_drvdata(dev, indio_dev);
>
> st->dev = dev;
> st->write = write;
> @@ -521,18 +520,10 @@ int ad5686_probe(struct device *dev,
> if (ret)
> return ret;
>
> - return iio_device_register(indio_dev);
> + return devm_iio_device_register(dev, indio_dev);
> }
> EXPORT_SYMBOL_NS_GPL(ad5686_probe, IIO_AD5686);
>
> -void ad5686_remove(struct device *dev)
> -{
> - struct iio_dev *indio_dev = dev_get_drvdata(dev);
> -
> - iio_device_unregister(indio_dev);
> -}
> -EXPORT_SYMBOL_NS_GPL(ad5686_remove, IIO_AD5686);
> -
> MODULE_AUTHOR("Michael Hennerich <michael.hennerich@...log.com>");
> MODULE_DESCRIPTION("Analog Devices AD5686/85/84 DAC");
> MODULE_LICENSE("GPL v2");
> diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
> index 62eb309711af..e7d36bae3e59 100644
> --- a/drivers/iio/dac/ad5686.h
> +++ b/drivers/iio/dac/ad5686.h
> @@ -155,7 +155,5 @@ int ad5686_probe(struct device *dev,
> const char *name, ad5686_write_func write,
> ad5686_read_func read);
>
> -void ad5686_remove(struct device *dev);
> -
>
> #endif /* __DRIVERS_IIO_DAC_AD5686_H__ */
> diff --git a/drivers/iio/dac/ad5696-i2c.c b/drivers/iio/dac/ad5696-i2c.c
> index 81541f755a3e..a56a7a410111 100644
> --- a/drivers/iio/dac/ad5696-i2c.c
> +++ b/drivers/iio/dac/ad5696-i2c.c
> @@ -65,11 +65,6 @@ static int ad5686_i2c_probe(struct i2c_client *i2c)
> ad5686_i2c_write, ad5686_i2c_read);
> }
>
> -static void ad5686_i2c_remove(struct i2c_client *i2c)
> -{
> - ad5686_remove(&i2c->dev);
> -}
> -
> static const struct i2c_device_id ad5686_i2c_id[] = {
> {"ad5311r", ID_AD5311R},
> {"ad5337r", ID_AD5337R},
> @@ -116,7 +111,6 @@ static struct i2c_driver ad5686_i2c_driver = {
> .of_match_table = ad5686_of_match,
> },
> .probe = ad5686_i2c_probe,
> - .remove = ad5686_i2c_remove,
> .id_table = ad5686_i2c_id,
> };
>
>
Powered by blists - more mailing lists