From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.de>,
linux-hwmon@vger.kernel.org,
Joshua Scott <joshua.scott@alliedtelesis.co.nz>,
Axel Lin <axel.lin@ingics.com>
Subject: Re: Questions about adt7470 driver
Date: Wed, 27 May 2020 16:33:34 -0700 [thread overview]
Message-ID: <20200527233334.GL252930@magnolia> (raw)
In-Reply-To: <20200527224252.GB89212@roeck-us.net>
On Wed, May 27, 2020 at 03:42:52PM -0700, Guenter Roeck wrote:
> On Tue, May 26, 2020 at 11:22:59AM +0200, Jean Delvare wrote:
> > Hi all,
> >
> > In the context of bug #207771, I got to look into the adt7470 driver.
> > I'm slowing understanding the logic of the background temperature
> > registers update thread, still there are 2 things I do not understand:
> >
> > 1* Function adt7470_read_temperatures() sets data->num_temp_sensors,
> > however this value seems to be only used to limit the wait time of
> > future calls to the same function. In the general update function we
> > still read ALL temperature sensors regardless of its value:
> >
> > for (i = 0; i < ADT7470_TEMP_COUNT; i++)
> > data->temp[i] = i2c_smbus_read_byte_data(client,
> > ADT7470_TEMP_REG(i));
> >
> > Shouldn't this loop be bounded with data->num_temp_sensors instead of
> > ADT7470_TEMP_COUNT?
> >
> Guess so.
>
> > 2* Function adt7470_read_temperatures() also sets
> > data->temperatures_probed to 1, and this boolean is then used to skip
> > further calls to that function. But do we really need a separate
> > variable for this, given that num_temp_sensors >= 0 matches the same
> > condition as far as I can see?
> >
> Agreed. On the other side, those are optimizations. I am not really sure
> if that driver is worth spending time on, given the age of the chip.
I /think/ the answer to both questions is yes, but I don't have the
hardware anymore so I have no way to QA that... :/
--D
> Guenter
next prev parent reply other threads:[~2020-05-27 23:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 9:22 Questions about adt7470 driver Jean Delvare
2020-05-27 22:42 ` Guenter Roeck
2020-05-27 23:33 ` Darrick J. Wong [this message]
2020-05-28 10:02 ` Jean Delvare
2020-05-28 13:52 ` Guenter Roeck
2020-05-29 0:18 ` Darrick J. Wong
2020-05-29 13:41 ` Jean Delvare
2020-06-02 18:36 ` Darrick J. Wong
2020-05-29 13:29 ` Jean Delvare
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=20200527233334.GL252930@magnolia \
--to=darrick.wong@oracle.com \
--cc=axel.lin@ingics.com \
--cc=jdelvare@suse.de \
--cc=joshua.scott@alliedtelesis.co.nz \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/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).