Re: [RESEND PATCH] iio: adc: ad7124: Add direct reg access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/29/20 6:14 AM, Mircea Caprioru wrote:
From: Mircea <mircea.caprioru@xxxxxxxxxx>

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@xxxxxxxxxx>
[...]
+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.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux