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] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 4 Mar 2017 13:52:50 +0800
From:   Eva Rachel Retuya <eraretuya@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>, linux-iio@...r.kernel.org,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald <pmeerw@...erw.net>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Michael Hennerich <michael.hennerich@...log.com>,
        Daniel Baluta <daniel.baluta@...il.com>,
        Alison Schofield <amsfield22@...il.com>,
        Florian Vaussard <florian.vaussard@...g-vd.ch>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH v5 2/4] iio: accel: adxl345: Use I2C regmap instead of
 direct I2C access

On Fri, Mar 03, 2017 at 06:44:27PM +0200, Andy Shevchenko wrote:
> On Tue, Feb 28, 2017 at 4:37 AM, Eva Rachel Retuya <eraretuya@...il.com> wrote:
> > Convert the driver to use regmap instead of I2C-specific functions. This
> > is done in preparation for splitting this driver into core and
> > I2C-specific code as well as introduction of SPI driver.
> >
> > Signed-off-by: Eva Rachel Retuya <eraretuya@...il.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>
> 
> Okay, my another set of comments.
> > @@ -70,6 +76,7 @@ static int adxl345_read_raw(struct iio_dev *indio_dev,
> >  {
> >         struct adxl345_data *data = iio_priv(indio_dev);
> 
> >         int ret;
> > +       __le16 regval;
> 
> Reverse tree order, please.
> 
>      __le16 regval;
>      int ret;
> 

Ack.

> > @@ -104,37 +112,50 @@ static int adxl345_probe(struct i2c_client *client,
> >  {
> >         struct adxl345_data *data;
> >         struct iio_dev *indio_dev;
> > +       struct device *dev;
> > +       struct regmap *regmap;
> 
> >         int ret;
> > +       u32 regval;
> 
> Ditto.
> 
> > +
> > +       regmap = devm_regmap_init_i2c(client, &adxl345_regmap_config);
> > +       if (IS_ERR(regmap)) {
> > +               dev_err(&client->dev, "Error initializing regmap: %d\n",
> > +                       (int)PTR_ERR(regmap));
> 
> I don't like explicit casting in such cases at all. Why not to use
> %ld? Same for the similar places in the series.
> 

OK. Will do that instead.

> > -       if (ret != ADXL345_DEVID) {
> > -               dev_err(&client->dev, "Invalid device ID: %d\n", ret);
> > +       if (regval != ADXL345_DEVID) {
> > +               dev_err(dev, "Invalid device ID: %x, expected %x\n",
> > +                       regval, ADXL345_DEVID);
> 
> So, originally it was in decimal form. Does hex looks better or what
> is behind the change?

Yes it looks better. I made the change to make it easily seen what it
read in hex compared to the known DEVID.

Thanks,
Eva

> 
> -- 
> With Best Regards,
> Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ