[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250406102008.0ebcbf9e@jic23-huawei>
Date: Sun, 6 Apr 2025 10:20:08 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Angelo Dureghello <adureghello@...libre.com>
Cc: Nuno Sá <nuno.sa@...log.com>, Lars-Peter Clausen
<lars@...afoo.de>, Jonathan Corbet <corbet@....net>, Olivier Moysan
<olivier.moysan@...s.st.com>, Michael Hennerich
<Michael.Hennerich@...log.com>, linux-iio@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/5] iio: dac: ad3552r-hs: add support for internal
ramp
On Mon, 31 Mar 2025 21:02:48 +0200
Angelo Dureghello <adureghello@...libre.com> wrote:
> From: Angelo Dureghello <adureghello@...libre.com>
>
> The ad3552r can be feeded from the HDL controller by an internally
> generated 16bit ramp, useful for debug pourposes. Add debugfs a file
> to enable or disable it.
>
> Signed-off-by: Angelo Dureghello <adureghello@...libre.com>
A couple of really minor things inline.
> ---
> drivers/iio/dac/ad3552r-hs.c | 122 ++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 116 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c
> index 37397e188f225a8099745ec03f7c604da76960b1..d4f50b33565f99b90859e30571dc59038d01361c 100644
> --- a/drivers/iio/dac/ad3552r-hs.c
> +++ b/drivers/iio/dac/ad3552r-hs.c
> @@ -7,6 +7,7 @@
> */
>
> #include <linux/bitfield.h>
> +#include <linux/debugfs.h>
> #include <linux/delay.h>
> #include <linux/gpio/consumer.h>
> #include <linux/iio/backend.h>
> @@ -54,8 +55,12 @@ struct ad3552r_hs_state {
> struct ad3552r_hs_platform_data *data;
> /* INTERFACE_CONFIG_D register cache, in DDR we cannot read values. */
> u32 config_d;
> + struct mutex lock;
Minor thing but all locks need comments. What data is this lock protecting?
> };
...
> static int ad3552r_hs_probe(struct platform_device *pdev)
> {
> struct ad3552r_hs_state *st;
> @@ -705,7 +806,16 @@ static int ad3552r_hs_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - return devm_iio_device_register(&pdev->dev, indio_dev);
> + ret = devm_iio_device_register(&pdev->dev, indio_dev);
> + if (ret)
> + return ret;
> +
> + mutex_init(&st->lock);
For new code, I'd prefer
ret = devm_mutex_init(&st->lock);
if (ret)
return ret;
Brings only a small advantage, but give the complexity cost is also small
we might as well use it!
> +
> + ad3552r_hs_debugfs_init(indio_dev);
> +
> + return ret;
> +
> }
>
> static const struct of_device_id ad3552r_hs_of_id[] = {
>
Powered by blists - more mailing lists