[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d5d1eb35-fb5f-07d6-e678-3c54709ea75f@metafoo.de>
Date: Wed, 29 Jan 2020 08:18:08 +0100
From: Lars-Peter Clausen <lars@...afoo.de>
To: Mircea Caprioru <mircea.caprioru@...log.com>, jic23@...nel.org
Cc: Michael.Hennerich@...log.com, alexandru.ardelean@...log.com,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: Re: [RESEND PATCH] iio: adc: ad7124: Add direct reg access
On 1/29/20 6:14 AM, Mircea Caprioru wrote:
> From: Mircea <mircea.caprioru@...log.com>
>
> This patch adds the posibility do read and write registers from userspace
> using the kernel debug direct register access option.
Typo: possibility
>
> Signed-off-by: Mircea Caprioru <mircea.caprioru@...log.com>
[...]
>
> +static int ad7124_reg_access(struct iio_dev *indio_dev,
> + unsigned int reg,
> + unsigned int writeval,
> + unsigned int *readval)
> +{
> + struct ad7124_state *st = iio_priv(indio_dev);
> + int ret;
> +
> +
> + if (readval)
> + ret = ad_sd_read_reg(&st->sd, reg, ad7124_reg_size[reg],
> + readval);
> + else
> + ret = ad_sd_write_reg(&st->sd, reg, ad7124_reg_size[reg],
> + writeval);
Needs a bounds check to make sure that reg is less then the number of
entries in ad7124_reg_size.
Powered by blists - more mailing lists