Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH 2/6] hwmon: (lm95234) Use find_closest to find matching update interval
Date: Fri, 19 Jul 2024 00:52:37 +0000	[thread overview]
Message-ID: <Zpm41WyZ_i5PhHK_@google.com> (raw)
In-Reply-To: <1242332a-b979-4284-9af4-1b76c9fb41ef@roeck-us.net>

On Thu, Jul 18, 2024 at 10:53:19AM -0700, Guenter Roeck wrote:
> On 7/18/24 10:48, Guenter Roeck wrote:
> > On 7/18/24 09:39, Tzung-Bi Shih wrote:
> > > On Wed, Jul 17, 2024 at 08:39:31PM -0700, Guenter Roeck wrote:
> > > > @@ -471,10 +472,7 @@ static ssize_t update_interval_store(struct device *dev,
> > > >       if (ret < 0)
> > > >           return ret;
> > > > -    for (regval = 0; regval < 3; regval++) {
> > > > -        if (val <= update_intervals[regval])
> > > > -            break;
> > > > -    }
> > > > +    regval = find_closest(val, update_intervals, ARRAY_SIZE(update_intervals));
> > > 
> > > The behavior changed.
> > > 
> > > static u16 update_intervals[] = { 143, 364, 1000, 2500 };
> > > 
> > > If val = 144,
> > > * Originally, regval = 1.
> > > * After applying the patch, regval = 0.
> > > 
> > 
> > 
> > Yes, find_closest() rounds the value instead of using the lower match.
> > That was intentional. I'll add an explicit note to the commit message.
> > 
> 
> I added this to the commit message:
> 
>     Since find_closest() uses rounding to find the best match, the resulting
>     update interval will now reflect the update interval that is closest to
>     the requested value, not the value that is lower or equal to the requested
>     value.

With that,
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>

  reply	other threads:[~2024-07-19  0:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18  3:39 [PATCH 0/6] hwmon: (lm9534) Various improvements Guenter Roeck
2024-07-18  3:39 ` [PATCH 1/6] hwmon: (lm95234) Reorder include files to be in alphabetic order Guenter Roeck
2024-07-18 16:39   ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 2/6] hwmon: (lm95234) Use find_closest to find matching update interval Guenter Roeck
2024-07-18 16:39   ` Tzung-Bi Shih
2024-07-18 17:48     ` Guenter Roeck
2024-07-18 17:53       ` Guenter Roeck
2024-07-19  0:52         ` Tzung-Bi Shih [this message]
2024-07-18  3:39 ` [PATCH 3/6] hwmon: (lm95234) Convert to use regmap Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 4/6] hwmon: (lm95234) Convert to with_info hwmon API Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih
2024-07-18 17:47     ` Guenter Roeck
2024-07-19  0:52       ` Tzung-Bi Shih
2024-07-19  1:55         ` Guenter Roeck
2024-07-18  3:39 ` [PATCH 5/6] hwmon: (lm95234) Add support for tempX_enable attribute Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih
2024-07-18  3:39 ` [PATCH 6/6] hwmon: (lm95234) Use multi-byte regmap operations Guenter Roeck
2024-07-18 16:40   ` Tzung-Bi Shih

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=Zpm41WyZ_i5PhHK_@google.com \
    --to=tzungbi@kernel.org \
    --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