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:   Fri, 29 Mar 2019 16:38:28 -0700
From:   Guenter Roeck <groeck@...gle.com>
To:     Gwendal Grignou <gwendal@...omium.org>
Cc:     Enric Balletbo i Serra <enric.balletbo@...labora.com>,
        Benson Leung <bleung@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        Lee Jones <lee.jones@...aro.org>,
        Jonathan Cameron <jic23@...nel.org>, linux-iio@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5] iio: cros_ec: Add lid angle driver

On Fri, Mar 29, 2019 at 3:37 PM Gwendal Grignou <gwendal@...omium.org> wrote:
>
> On Fri, Mar 29, 2019 at 1:17 PM Guenter Roeck <groeck@...gle.com> wrote:
> >
> > On Fri, Mar 29, 2019 at 1:08 PM Gwendal Grignou <gwendal@...omium.org> wrote:
> > >
> > > Add a IIO driver that reports the angle between the lid and the base for
> > > ChromeOS convertible device.
> ...
> > > --- a/drivers/mfd/cros_ec_dev.c
> > > +++ b/drivers/mfd/cros_ec_dev.c
> > > @@ -297,13 +297,15 @@ static void cros_ec_sensors_register(struct
> > > cros_ec_dev *ec)
> > >
> > >         resp = (struct ec_response_motion_sense *)msg->data;
> > >         sensor_num = resp->dump.sensor_count;
> > > -       /* Allocate 1 extra sensors in FIFO are needed */
> > > -       sensor_cells = kcalloc(sensor_num + 1, sizeof(struct mfd_cell),
> > > +       /*
> > > +        * Allocate 2 extra sensors if lid angle sensor and/or FIFO are needed.
> > > +        */
> > > +       sensor_cells = kcalloc(sensor_num + 2, sizeof(struct mfd_cell),
> > >                                GFP_KERNEL);
> > >         if (sensor_cells == NULL)
> > >                 goto error;
> > >
> > > -       sensor_platforms = kcalloc(sensor_num + 1,
> > > +       sensor_platforms = kcalloc(sensor_num,
> >
> > I still don't understand why the "+ 1" is no longer needed. It seems
> > to me that it would have to change to "+ 2".
> "+1" was never needed to begin with FIFO device will never use a
> struct cros_ec_sensor_platform. I mentioned it earlier:
> https://www.spinics.net/lists/linux-iio/msg43157.html
>
Ah yes, now I see. Thanks, and sorry for the noise.

Guenter

> Gwendal.
> >
> > Guenter
> >
> > >                                    sizeof(struct cros_ec_sensor_platform),
> > >                                    GFP_KERNEL);
> > >         if (sensor_platforms == NULL)
> > > @@ -363,6 +365,11 @@ static void cros_ec_sensors_register(struct
> > > cros_ec_dev *ec)
> > >                 sensor_cells[id].name = "cros-ec-ring";
> > >                 id++;
> > >         }
> > > +       if (cros_ec_check_features(ec,
> > > +                               EC_FEATURE_REFINED_TABLET_MODE_HYSTERESIS)) {
> > > +               sensor_cells[id].name = "cros-ec-lid-angle";
> > > +               id++;
> > > +       }
> > >
> > >         ret = mfd_add_devices(ec->dev, 0, sensor_cells, id,
> > >                               NULL, 0, NULL);
> > > --
> > > 2.21.0.360.g471c308f928-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ