public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Lamparter <chunkeey@googlemail.com>
To: Guenter Roeck <linux@roeck-us.net>, Jean Delvare <jdelvare@suse.com>
Cc: linux-hwmon@vger.kernel.org, Wei Ni <wni@nvidia.com>
Subject: Re: [PATCH 2/2] hwmon: lm90: integration of channel map in dt-bindings
Date: Fri, 10 Feb 2017 21:44:53 +0100	[thread overview]
Message-ID: <1500345.XcJ59yDJ4W@debian64> (raw)
In-Reply-To: <20170210172106.GA13576@roeck-us.net>

On Friday, February 10, 2017 9:21:06 AM CET Guenter Roeck wrote:
> On Fri, Feb 10, 2017 at 05:12:30PM +0100, Christian Lamparter wrote:
> > This patch integrates the LOCAL, REMOTE and REMOTE2
> > channel definitions into the lm90.c driver.
> > 
> > Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
> > ---
> > This is an optional patch to showcase how the channel definition
> > in the dt-bindings are mapped into the driver.
> > In theory, this makes it possible to easily remap the channel
> > indices. However, it does make the driver harder to read.
> 
> It also makes the driver dependent on external defines which are not controlled
> by the driver. If anyone changes those defines to be non-sequential or to not
> start with 0, we would be in trouble. Sure, that might and likely would result
> in compile errors, but still ...
Yes, gcc will complain with "array out of bounds errors" if any
of the LM90_SENSORS_ defines are less than 0 or higher than 2.
This is because of: static const u8 lm90_temp_index[3] and 
lm90_temp_min_index, ...

The BUILD_BUG_ON(LOCAL == REMOTE || ... || REMOTE2 == LOCAL) will
prevent duplicated values so LOCAL, REMOTE, REMOTE2 have to be
different.

> Besides, it is not complete. Anyone changing channel index values would
> (at least) mess up alarm bit association.
Yes, that's true. I missed lm90_is_tripped. But...

> If we want to do that kind of thing, it might make more sense to add some code
> to provide the desired mapping to the hwmon core, and to let the hwmon core
> handle it. No idea if that is even possible, though.
> 
> Is that really worth it ?
No, it's not worth it ;-). But thank you for your in-depth
analysis. So, let's leave it with just the first patch for
4.12-ish.

Regards,
Christian

  reply	other threads:[~2017-02-10 20:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-05 21:03 [RFC 1/2] devicetree: add lm90 thermal_zone sensor support Christian Lamparter
2017-02-05 21:03 ` [RFC 2/2] hwmon: lm90: add thermal_zone temperature " Christian Lamparter
2017-02-06  3:10   ` Guenter Roeck
2017-02-06 16:01     ` Christian Lamparter
2017-02-06 19:37       ` Guenter Roeck
2017-02-08 22:30 ` [RFC 1/2] devicetree: add lm90 thermal_zone " Rob Herring
2017-02-08 23:01   ` Christian Lamparter
2017-02-10 16:12     ` [PATCH " Christian Lamparter
2017-02-10 16:12       ` [PATCH 2/2] hwmon: lm90: integration of channel map in dt-bindings Christian Lamparter
2017-02-10 17:21         ` Guenter Roeck
2017-02-10 20:44           ` Christian Lamparter [this message]
2017-02-10 23:51       ` [PATCH 1/2] devicetree: add lm90 thermal_zone sensor support Guenter Roeck

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=1500345.XcJ59yDJ4W@debian64 \
    --to=chunkeey@googlemail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wni@nvidia.com \
    /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