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:   Sun, 8 Aug 2021 15:51:49 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Lucas Stankus <lucas.p.stankus@...il.com>
Cc:     Andy Shevchenko <andy.shevchenko@...il.com>,
        "lars@...afoo.de" <lars@...afoo.de>,
        "Michael.Hennerich@...log.com" <Michael.Hennerich@...log.com>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "Dragos.Bogdan@...log.com" <Dragos.Bogdan@...log.com>,
        "Darius.Berghe@...log.com" <Darius.Berghe@...log.com>,
        "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: accel: Add driver support for ADXL313

On Fri, 6 Aug 2021 21:22:46 -0300
Lucas Stankus <lucas.p.stankus@...il.com> wrote:

> On Fri, Aug 6, 2021 at 9:35 AM Andy Shevchenko
> <andy.shevchenko@...il.com> wrote:
> >
> >
> >
> > On Thursday, August 5, 2021, Lucas Stankus <lucas.p.stankus@...il.com> wrote:  
> >>
> >> ADXL313 is a small, thin, low power, 3-axis accelerometer with high
> >> resolution measurement up to +/-4g. It includes an integrated 32-level
> >> FIFO and has activity and inactivity sensing capabilities.
> >>
> >> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL313.pdf
> >> Signed-off-by: Lucas Stankus <lucas.p.stankus@...il.com>
> >> ---
> >>  MAINTAINERS                      |   9 +
> >>  drivers/iio/accel/Kconfig        |  29 +++
> >>  drivers/iio/accel/Makefile       |   3 +
> >>  drivers/iio/accel/adxl313.h      |  63 ++++++
> >>  drivers/iio/accel/adxl313_core.c | 321 +++++++++++++++++++++++++++++++
> >>  drivers/iio/accel/adxl313_i2c.c  |  65 +++++++
> >>  drivers/iio/accel/adxl313_spi.c  |  85 ++++++++
> >>  7 files changed, 575 insertions(+)
> >>  create mode 100644 drivers/iio/accel/adxl313.h
> >>  create mode 100644 drivers/iio/accel/adxl313_core.c
> >>  create mode 100644 drivers/iio/accel/adxl313_i2c.c
> >>  create mode 100644 drivers/iio/accel/adxl313_spi.c
> >>
> >> diff --git a/MAINTAINERS b/MAINTAINERS
> >> index a61f4f3b78a9..566055450b6b 100644
> >> --- a/MAINTAINERS
> >> +++ b/MAINTAINERS
> >> @@ -585,6 +585,15 @@ L: platform-driver-x86@...r.kernel.org
> >>  S:     Maintained
> >>  F:     drivers/platform/x86/adv_swbutton.c
> >>
> >> +ADXL313 THREE-AXIS DIGITAL ACCELEROMETER DRIVER
> >> +M:     Lucas Stankus <lucas.p.stankus@...il.com>
> >> +S:     Supported
> >> +F:     Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml
> >> +F:     drivers/iio/accel/adxl313.h
> >> +F:     drivers/iio/accel/adxl313_core.c
> >> +F:     drivers/iio/accel/adxl313_i2c.c
> >> +F:     drivers/iio/accel/adxl313_spi.c  
> >
> >
> >
> > adxl313*?
> >  
> 
> Didn't know this would work, but I think I prefer the way it is now.
> Are you proposing this as a suggestion or more of a change request?

It's a bit neater and very unlikely we'll get a clash on that wild card
in the long run, so I'd 'slightly' prefer this as well.


...

>> +/*
> >> + * Scale for any g range is given in datasheet as
> >> + * 1024 LSB/g = 0.0009765625 * 9.80665 = 0.009576806640625 m/s^2
> >> + */
> >> +#define ADXL313_NSCALE 9576806  
> >
> >
> >
> > Is it in nanonewtons? Perhaps add a suffix _nN?
> >  
> 
> It's actually in meters per second squared, so I couldn't come up with
> a good suffix. Do you have any suggestions?

Easy. Don't have a #define :)

In all seriousness it isn't a 'magic' number, it's an actual real world
value, so move the comment down to where it's used and put the number
directly were it is needed.


Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ