lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 29 Aug 2020 17:51:04 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Nishant Malpani <nish.malpani25@...il.com>
Cc:     robh+dt@...nel.org, dragos.bogdan@...log.com,
        darius.berghe@...log.com, linux-kernel@...r.kernel.org,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 3/3] iio: gyro: adxrs290: Add debugfs register access
 support

On Tue, 25 Aug 2020 18:17:11 +0530
Nishant Malpani <nish.malpani25@...il.com> wrote:

> Extend support to read/write byte data from/to the device using
> debugfs iio interface.
> 
> Signed-off-by: Nishant Malpani <nish.malpani25@...il.com>
Hi Nishant,

I'm always a bit unsure on whether I want drivers to provide this
interface, as it isn't something that should be of much use once
initial driver debugging is done.

However, the patch is good so if you want to add it fair enough.
I'll pick it up once patches 1 and 2 are ready.

Thanks,

Jonathan

> ---
>  drivers/iio/gyro/adxrs290.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/iio/gyro/adxrs290.c b/drivers/iio/gyro/adxrs290.c
> index 25046590761e..b0050cdd2b90 100644
> --- a/drivers/iio/gyro/adxrs290.c
> +++ b/drivers/iio/gyro/adxrs290.c
> @@ -435,6 +435,24 @@ static int adxrs290_read_avail(struct iio_dev *indio_dev,
>  	}
>  }
>  
> +static int adxrs290_reg_access(struct iio_dev *indio_dev, unsigned int reg,
> +			       unsigned int writeval, unsigned int *readval)
> +{
> +	struct adxrs290_state *st = iio_priv(indio_dev);
> +	int ret;
> +
> +	if (!readval)
> +		return adxrs290_spi_write_reg(st->spi, reg, writeval);
> +
> +	ret = spi_w8r8(st->spi, ADXRS290_READ_REG(reg));
> +	if (ret < 0)
> +		return ret;
> +
> +	*readval = ret;
> +
> +	return 0;
> +}
> +
>  static int adxrs290_data_rdy_trigger_set_state(struct iio_trigger *trig, bool state)
>  {
>  	struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
> @@ -547,6 +565,7 @@ static const struct iio_info adxrs290_info = {
>  	.read_raw = &adxrs290_read_raw,
>  	.write_raw = &adxrs290_write_raw,
>  	.read_avail = &adxrs290_read_avail,
> +	.debugfs_reg_access = &adxrs290_reg_access,
>  };
>  
>  static int adxrs290_probe_trigger(struct iio_dev *indio_dev)

Powered by blists - more mailing lists