All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Gwendal Grignou <gwendal@chromium.org>,
	Gabriele Mazzotta <gabriele.mzt@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v5 3/3] iio: acpi_als: Add trigger support
Date: Tue, 29 Dec 2020 17:52:02 +0000	[thread overview]
Message-ID: <20201229175202.76682fcc@archlinux> (raw)
In-Reply-To: <CAHp75VdQF7truiuWshYbvCAan2Qc0TomTesLwv2dDFhF5qkxqg@mail.gmail.com>

On Tue, 29 Dec 2020 19:33:39 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Tue, Dec 29, 2020 at 7:24 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Thu, 17 Dec 2020 00:38:06 +0200
> > Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> >  
> > > On Wed, Dec 16, 2020 at 11:41 PM Gwendal Grignou <gwendal@chromium.org> wrote:  
> > > >
> > > > As some firmware does not notify on illuminance changes, add a
> > > > trigger to be able to query light via software (sysfs-trigger or
> > > > hrtrigger).
> > > > Add a hardware trigger set as the default trigger to maintain backward
> > > > compatibility.
> > > >
> > > > Check iio_info reports the sensor as buffer capable:
> > > >   iio:device0: acpi-als (buffer capable)
> > > >
> > > > To test, check we can get data on demand on an Intel based chromebook:
> > > >
> > > >   IIO_DEV="iio:device0"
> > > >   echo 1 > iio_sysfs_trigger/add_trigger
> > > >   cat trigger2/name > ${IIO_DEV}/trigger/current_trigger
> > > >   for i in ${IIO_DEV}/scan_elements/*_en ${IIO_DEV}/buffer/enable ; do
> > > >     echo 1 > $i
> > > >   done
> > > >   od -x /dev/${IIO_DEV} &
> > > >   echo 1 > trigger2/trigger_now  
> > >
> > > Few nitpicks below. After addressing, take my
> > > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > assuming that backward compatibility has been tested as well.  
> 
> ...
> 
> > > > +       if (!iio_buffer_enabled(indio_dev) ||
> > > > +           !iio_trigger_using_own(indio_dev))  
> > >
> > > I guess it can be located on one line.
> > >
> > > I hope those functions have no side effects. In that case you may
> > > invert logic (save 2 characters)
> > >
> > >        if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev))  
> >
> > You can but at cost of indenting the whole following block on level further.
> > I'm not that fussed, but in general that doesn't seem like a good idea to
> > save two characters here.  
> 
> I didn't get it. The proposed change, in case of no side effect, is an
> equivalent to the existing one, just 2 characters less.
> How does it affect code block indentation?

It's not the same. As stated it's the inverse condition.  Could add some brackets
and a ! or, flip the logic of the whole if condition and not return early.


Jonathan


> 


  reply	other threads:[~2020-12-29 17:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 21:41 [PATCH v5 0/3] iio: acpi_als: Add sotfware trigger support Gwendal Grignou
2020-12-16 21:41 ` [PATCH v5 1/3] iio: acpi_als: Add timestamp channel Gwendal Grignou
2020-12-16 22:39   ` Andy Shevchenko
2020-12-16 21:41 ` [PATCH v5 2/3] iio: acpi_als: Add local variable dev in probe Gwendal Grignou
2020-12-16 22:40   ` Andy Shevchenko
2020-12-16 21:41 ` [PATCH v5 3/3] iio: acpi_als: Add trigger support Gwendal Grignou
2020-12-16 22:38   ` Andy Shevchenko
2020-12-29 17:24     ` Jonathan Cameron
2020-12-29 17:33       ` Andy Shevchenko
2020-12-29 17:52         ` Jonathan Cameron [this message]
2020-12-29 18:13           ` Andy Shevchenko

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=20201229175202.76682fcc@archlinux \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=gabriele.mzt@gmail.com \
    --cc=gwendal@chromium.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.