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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 28 Mar 2020 17:45:34 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Rohit Sarkar <rohitsarkar5398@...il.com>,
        linux-iio@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Jean-Baptiste Maneyrol <jmaneyrol@...ensense.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] iio: imu: inv_mpu6050: add debugfs register r/w
 interface

On Fri, 27 Mar 2020 15:19:01 +0200
Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:

> On Fri, Mar 27, 2020 at 06:40:23PM +0530, Rohit Sarkar wrote:
> > The debugfs interface provides direct access to read and write device
> > registers if debugfs is enabled.
> > 
> > Signed-off-by: Rohit Sarkar <rohitsarkar5398@...il.com>
> > ---
> > Changelog v1->v2
> > * grab a lock to protect driver state
> > * add a comma at the end of structure member initialisation
> > 
> >  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> > 
> > diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > index 7cb9ff3d3e94..381a3fb09858 100644
> > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> > @@ -1248,12 +1248,31 @@ static const struct attribute_group inv_attribute_group = {
> >  	.attrs = inv_attributes
> >  };
> >  
> > +static int inv_mpu6050_reg_access(struct iio_dev *indio_dev,
> > +				  unsigned int reg,
> > +				  unsigned int writeval,
> > +				  unsigned int *readval)
> > +{
> > +	struct inv_mpu6050_state *st = iio_priv(indio_dev);  
> 
> > +	int ret = 0;  
> 
> Assignment is redundant, but I think maintainers may update this when applying.

Fixed up and applied to the togreg branch of iio.git and pushed
out as testing for the autobuilders to play with it.

Jonathan

> 
> > +
> > +	mutex_lock(&st->lock);
> > +	if (readval)
> > +		ret = regmap_read(st->map, reg, readval);
> > +	else
> > +		ret = regmap_write(st->map, reg, writeval);
> > +	mutex_unlock(&st->lock);
> > +
> > +	return ret;
> > +}
> > +
> >  static const struct iio_info mpu_info = {
> >  	.read_raw = &inv_mpu6050_read_raw,
> >  	.write_raw = &inv_mpu6050_write_raw,
> >  	.write_raw_get_fmt = &inv_write_raw_get_fmt,
> >  	.attrs = &inv_attribute_group,
> >  	.validate_trigger = inv_mpu6050_validate_trigger,
> > +	.debugfs_reg_access = &inv_mpu6050_reg_access,
> >  };
> >  
> >  /**
> > -- 
> > 2.23.0.385.gbc12974a89
> >   
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ