All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sa, Nuno" <Nuno.Sa@analog.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	"Ardelean, Alexandru" <alexandru.Ardelean@analog.com>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>
Subject: RE: [PATCH v4 5/6] iio: imu: Add support for adis16475
Date: Tue, 7 Apr 2020 10:38:05 +0000	[thread overview]
Message-ID: <BN6PR03MB3347A09B7760F6F34086303899C30@BN6PR03MB3347.namprd03.prod.outlook.com> (raw)
In-Reply-To: <CAHp75VeAOKXNU+FEYsXBZ65sM1AWxB2zA+LJ2diAxyiJPk60mQ@mail.gmail.com>

> From: linux-iio-owner@vger.kernel.org <linux-iio-owner@vger.kernel.org>
> On Behalf Of Andy Shevchenko
> Sent: Dienstag, 7. April 2020 11:55
> To: Sa, Nuno <Nuno.Sa@analog.com>
> Cc: linux-iio <linux-iio@vger.kernel.org>; devicetree
> <devicetree@vger.kernel.org>; Jonathan Cameron <jic23@kernel.org>;
> Hartmut Knaack <knaack.h@gmx.de>; Lars-Peter Clausen
> <lars@metafoo.de>; Peter Meerwald-Stadler <pmeerw@pmeerw.net>; Rob
> Herring <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>;
> Ardelean, Alexandru <alexandru.Ardelean@analog.com>; Hennerich,
> Michael <Michael.Hennerich@analog.com>
> Subject: Re: [PATCH v4 5/6] iio: imu: Add support for adis16475
> 
> On Tue, Apr 7, 2020 at 12:26 PM Sa, Nuno <Nuno.Sa@analog.com> wrote:
> >
> > > From: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > Sent: Dienstag, 7. April 2020 11:19
> > > To: Sa, Nuno <Nuno.Sa@analog.com>
> > > Cc: linux-iio <linux-iio@vger.kernel.org>; devicetree
> > > <devicetree@vger.kernel.org>; Jonathan Cameron <jic23@kernel.org>;
> > > Hartmut Knaack <knaack.h@gmx.de>; Lars-Peter Clausen
> > > <lars@metafoo.de>; Peter Meerwald-Stadler <pmeerw@pmeerw.net>;
> Rob
> > > Herring <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>;
> > > Ardelean, Alexandru <alexandru.Ardelean@analog.com>; Hennerich,
> > > Michael <Michael.Hennerich@analog.com>
> > > Subject: Re: [PATCH v4 5/6] iio: imu: Add support for adis16475
> 
> ...
> 
> > > > > > +       for_each_set_bit(bit, indio_dev->active_scan_mask,
> > > > > > +                        indio_dev->masklength) {
> > > > >
> > > > > One line?
> > > > >
> > > >
> > > > It goes beyond 80 col limit... I know I could initialize these to some local
> > > const but...
> > >
> > > That's why question mark is there.
> > > Nonetheless, if it ~2-3 characters more, I would leave it on one line
> anyway.
> > >
> > > JFYI: readability has a priority over 80 limit.
> > >
> >
> > Thanks! I would say it also depends on the maintainer (not sure)? Some are
> more
> > strict about checkpatch...
> > Btw, the line will have 84 if one liner...
> 
> Let's leave it to maintainer then.
> 
> > > > > > +       }
> 
> ...
> 
> > > > > > +       irq_type = irqd_get_trigger_type(desc);
> > > > > > +       if (irq_type == IRQF_TRIGGER_RISING) {
> > >
> > > > > > +               polarity = 1;
> > >
> > > For the sake of consistency I would assign irq_flag here as well.
> > >
> >
> > The library will do it by default, But that's me using "inside" info... or maybe
> if
> > I document that in patch 2 (the struct kernel docs) we would not really
> need to
> > assign it here?
> 
> I see now. From my point of view the library here does an ill turn
> because it hides some details which driver needs to do anyway.
> I prefer explicit over implicit at least here.
> 

Let's explicitly assign the irq_flag then...

> I would say okay, if there is no such code (like below) would be
> present in the driver.

Now that I think about, this is actually code that, probably, could go inside the
library since this is pretty standard for this kind of devices. Anyways, that's
another story...

- Nuno Sá
> > > > > > +       } else if (irq_type == IRQF_TRIGGER_FALLING) {
> > > > > > +               polarity = 0;
> > > > > > +               st->adis.irq_flag = IRQF_TRIGGER_FALLING;
> > > > > > +       } else {
> > > > > > +               dev_err(&spi->dev, "Invalid interrupt type 0x%x
> specified\n",
> > > > > > +                       irq_type);
> > > > > > +               return -EINVAL;
> > > > > > +       }
> > > > >
> > > > > Here is the problem. You got type, but you compare it to flags. It's
> > > > > not correct.
> > > > > Although values are the same, the meaning is different.
> > > > >
> > > >
> > > > Hmm, thanks! Honestly, this was copy paste from adis16480 and I never
> > > realized this. I will
> > > > use IRQ_TYPE_EDGE_RISING and IRQ_TYPE_EDGE_FALLING.
> 
> --
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2020-04-07 10:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 15:08 [PATCH v4 0/6] Support ADIS16475 and similar IMUs Nuno Sá
2020-04-06 15:08 ` [PATCH v4 1/6] iio: imu: adis: Add Managed device functions Nuno Sá
2020-04-06 15:08 ` [PATCH v4 2/6] iio: imu: adis: Add irq mask variable Nuno Sá
2020-04-06 15:08 ` [PATCH v4 3/6] iio: adis: Add adis_update_bits() APIs Nuno Sá
2020-04-06 15:08 ` [PATCH v4 4/6] iio: adis: Support different burst sizes Nuno Sá
2020-04-06 15:08 ` [PATCH v4 5/6] iio: imu: Add support for adis16475 Nuno Sá
2020-04-06 16:19   ` Andy Shevchenko
2020-04-07  7:26     ` Sa, Nuno
2020-04-07  9:19       ` Andy Shevchenko
2020-04-07  9:26         ` Sa, Nuno
2020-04-07  9:54           ` Andy Shevchenko
2020-04-07 10:38             ` Sa, Nuno [this message]
2020-04-07 10:42               ` Andy Shevchenko
2020-04-12 11:49             ` Jonathan Cameron
2020-04-12 11:48         ` Jonathan Cameron
2020-04-06 15:08 ` [PATCH v4 6/6] dt-bindings: iio: Add adis16475 documentation Nuno Sá

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=BN6PR03MB3347A09B7760F6F34086303899C30@BN6PR03MB3347.namprd03.prod.outlook.com \
    --to=nuno.sa@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandru.Ardelean@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@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.