linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <groeck@google.com>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Lee Jones <lee.jones@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5] iio: cros_ec: Add lid angle driver
Date: Fri, 29 Mar 2019 16:38:28 -0700	[thread overview]
Message-ID: <CABXOdTfyj7Fi6HxEbsTSRjymhB73=_UNkHeKS2a-GhGHa7PvcQ@mail.gmail.com> (raw)
In-Reply-To: <CAPUE2ut3vNioD-CbmZUqF5Pa3Y8KhBYu+N_SVEEJ5tOsJL6BLA@mail.gmail.com>

On Fri, Mar 29, 2019 at 3:37 PM Gwendal Grignou <gwendal@chromium.org> wrote:
>
> On Fri, Mar 29, 2019 at 1:17 PM Guenter Roeck <groeck@google.com> wrote:
> >
> > On Fri, Mar 29, 2019 at 1:08 PM Gwendal Grignou <gwendal@chromium.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

  reply	other threads:[~2019-03-29 23:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190311082405.GB4731@dell>
2019-03-29  8:41 ` [PATCH v4 2/2] iio: cros_ec: Add lid angle driver Gwendal Grignou
2019-03-29 13:44   ` Guenter Roeck
2019-03-29 17:40     ` Gwendal Grignou
2019-03-29 20:08       ` [PATCH v5] " Gwendal Grignou
2019-03-29 20:17         ` Guenter Roeck
2019-03-29 22:37           ` Gwendal Grignou
2019-03-29 23:38             ` Guenter Roeck [this message]
2019-03-31 10:28         ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABXOdTfyj7Fi6HxEbsTSRjymhB73=_UNkHeKS2a-GhGHa7PvcQ@mail.gmail.com' \
    --to=groeck@google.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).