From: Jonathan Cameron <jic23@kernel.org>
To: ahaslam@baylibre.com
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, nuno.sa@analog.com,
dlechner@baylibre.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] iio: dac: ad5791: Use devm_iio_device_register
Date: Mon, 28 Oct 2024 20:25:23 +0000 [thread overview]
Message-ID: <20241028202523.5c876f99@jic23-huawei> (raw)
In-Reply-To: <20241028071118.699951-7-ahaslam@baylibre.com>
On Mon, 28 Oct 2024 08:11:18 +0100
ahaslam@baylibre.com wrote:
> From: Axel Haslam <ahaslam@baylibre.com>
>
> Use devm_iio_device_register to automatically free the iio device.
> since this is the last remaining resource that was not automatically
> freed, we can drop the ".remove" callback.
>
> Suggested-by: David Lechner <dlechner@baylibre.com>
> Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Hi Axel,
The bot did a much better review job than me this time.
Other than the obvious solutions to the things it pointed out,
this series looks fine to me.
Jonathan
> ---
> drivers/iio/dac/ad5791.c | 15 +--------------
> 1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
> index cf3d41a10c20..21332c9aca5d 100644
> --- a/drivers/iio/dac/ad5791.c
> +++ b/drivers/iio/dac/ad5791.c
> @@ -405,24 +405,12 @@ static int ad5791_probe(struct spi_device *spi)
> if (ret)
> return dev_err_probe(&spi->dev, ret, "fail to write ctrl register\n");
>
> - spi_set_drvdata(spi, indio_dev);
> indio_dev->info = &ad5791_info;
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->channels = &st->chip_info->channel;
> indio_dev->num_channels = 1;
> indio_dev->name = st->chip_info->name;
> - ret = iio_device_register(indio_dev);
> - if (ret)
> - return dev_err_probe(&spi->dev, ret, "unable to register iio device\n");
> -
> - return 0;
> -}
> -
> -static void ad5791_remove(struct spi_device *spi)
> -{
> - struct iio_dev *indio_dev = spi_get_drvdata(spi);
> -
> - iio_device_unregister(indio_dev);
> + return devm_iio_device_register(&spi->dev, indio_dev);
> }
>
> static const struct of_device_id ad5791_of_match[] = {
> @@ -451,7 +439,6 @@ static struct spi_driver ad5791_driver = {
> .of_match_table = ad5791_of_match,
> },
> .probe = ad5791_probe,
> - .remove = ad5791_remove,
> .id_table = ad5791_id,
> };
> module_spi_driver(ad5791_driver);
next prev parent reply other threads:[~2024-10-28 20:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 7:11 [PATCH 0/6] Improvements and Enhancements for AD5791 DAC Driver ahaslam
2024-10-28 7:11 ` [PATCH 1/6] dt-bindings: iio: dac: ad5791: Add optional reset, clr and ldac gpios ahaslam
2024-10-28 7:42 ` Krzysztof Kozlowski
2024-10-28 7:11 ` [PATCH 2/6] dt-bindings: iio: dac: ad5791: Add required voltage supplies ahaslam
2024-10-28 8:06 ` Krzysztof Kozlowski
2024-10-28 23:07 ` Axel Haslam
2024-10-29 6:27 ` Krzysztof Kozlowski
2024-10-28 7:11 ` [PATCH 3/6] iio: dac: ad5791: Include chip_info in device match tables ahaslam
2024-10-28 16:38 ` kernel test robot
2024-10-28 20:22 ` Jonathan Cameron
2024-10-28 7:11 ` [PATCH 4/6] iio: dac: ad5791: Add reset, clr and ldac gpios ahaslam
2024-10-28 18:46 ` kernel test robot
2024-10-28 7:11 ` [PATCH 5/6] iio: dac: ad5791: Use devm_regulator_get_enable_read_voltage ahaslam
2024-10-28 18:32 ` kernel test robot
2024-10-28 7:11 ` [PATCH 6/6] iio: dac: ad5791: Use devm_iio_device_register ahaslam
2024-10-28 20:25 ` Jonathan Cameron [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-29 7:38 [PATCH 0/6] Improvements and Enhancements for AD5791 DAC Driver ahaslam
2024-10-29 7:38 ` [PATCH 6/6] iio: dac: ad5791: Use devm_iio_device_register ahaslam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241028202523.5c876f99@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=ahaslam@baylibre.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).