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:   Tue, 13 Aug 2019 10:27:37 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     Max Staudt <max@...as.org>, Linux I2C <linux-i2c@...r.kernel.org>,
        linux-hwmon@...r.kernel.org,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Jean Delvare <jdelvare@...e.com>,
        "Linux/m68k" <linux-m68k@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Subject: Re: [PATCH v2 3/4] hwmon/ltc2990: Add platform_data support

Hi Günter,

On Tue, Aug 13, 2019 at 10:02 AM Guenter Roeck <linux@...ck-us.net> wrote:
> On Tue, Aug 13, 2019 at 01:52:36AM +0200, Max Staudt wrote:
> > This allows code using i2c_new_device() to specify a measurement mode.
> >
> > Signed-off-by: Max Staudt <max@...as.org>
> > Reviewed-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> > ---
> >  drivers/hwmon/ltc2990.c               |  9 +++++++++
> >  include/linux/platform_data/ltc2990.h | 11 +++++++++++
> >  2 files changed, 20 insertions(+)
> >  create mode 100644 include/linux/platform_data/ltc2990.h
> >
> > diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
> > index f9431ad43..f19b9c50c 100644
> > --- a/drivers/hwmon/ltc2990.c
> > +++ b/drivers/hwmon/ltc2990.c
> > @@ -14,6 +14,7 @@
> >  #include <linux/kernel.h>
> >  #include <linux/module.h>
> >  #include <linux/of.h>
> > +#include <linux/platform_data/ltc2990.h>
> >
> >  #define LTC2990_STATUS       0x00
> >  #define LTC2990_CONTROL      0x01
> > @@ -206,6 +207,7 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
> >       int ret;
> >       struct device *hwmon_dev;
> >       struct ltc2990_data *data;
> > +     struct ltc2990_platform_data *pdata = dev_get_platdata(&i2c->dev);
> >       struct device_node *of_node = i2c->dev.of_node;
> >
> >       if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
> > @@ -227,6 +229,13 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
> >               if (data->mode[0] & ~LTC2990_MODE0_MASK ||
> >                   data->mode[1] & ~LTC2990_MODE1_MASK)
> >                       return -EINVAL;
> > +     } else if (pdata) {
> > +             data->mode[0] = pdata->meas_mode[0];
> > +             data->mode[1] = pdata->meas_mode[1];
> > +
> > +             if (data->mode[0] & ~LTC2990_MODE0_MASK ||
> > +                 data->mode[1] & ~LTC2990_MODE1_MASK)
> > +                     return -EINVAL;
>
> I would prefer if the driver was modified to accept device
> properties, and if those were set using the appropriate
> fwnode function. Any reason for not doing that ?

That was my first thought as well, but isn't that limited to DT and ACPI
properties (for now)?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ