From: Hans de Goede <hdegoede@redhat.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon
Date: Sun, 13 Mar 2011 15:12:08 +0000 [thread overview]
Message-ID: <4D7CDEC8.5060308@redhat.com> (raw)
In-Reply-To: <1299871683-3945-1-git-send-email-hdegoede@redhat.com>
Hi,
On 03/13/2011 03:00 PM, Jean Delvare wrote:
> Hi Hans,
>
> On Sun, 13 Mar 2011 13:39:34 +0100, Hans de Goede wrote:
>> Hi,
>>
>> On 03/12/2011 12:09 PM, Jean Delvare wrote:
>>
>> Thanks for the review! I've prepared a new version of the
>> patch addressing all your comments, below are some remarks
>> from me wrt those comments which warrant a reply.
>
> Thanks for the quick update. Below are my comments to some of your
> comments:
>
>>>> +static int sch5627_read_virtual_reg12(struct sch5627_data *data, u16 msb_reg,
>>>> + u16 lsn_reg, int high_nibble)
>>>> +{
>>>> + int msb, lsn = -1;
>>>
>>> Useless initialization, unless I'm blind.
>>>
>>>> +
>>>> + /* Read MSB first, this will cause the matching LSN to be latched */
>>>
>>> I.e. reverse from 16-bit values? How weird :(
>>
>> Yep, this also means we cannot read the lsn register once for 2 12 bit reads,
>> I had code for that (which the useless initialization you spotted was a left
>> over of).
>
> Why not? Can't you read MSB1, MSB2 and then LSN? If latching is done
> per-nibble, that should work.
>
True, that will likely work, but would lead to really ugly / convoluted code.
Given that quite a few of the lsn's live in their own register anyways (iow
we will only save a few reads by combining lsn reads) I don't think this is
worth the trouble.
>>>> +static int reg_to_rpm(u16 reg)
>>>> +{
>>>> + if (reg = 0)
>>>> + reg = 1;
>>>
>>> This arbitrary decision is discussable. I presume that reg = 0 means an
>>> error condition, either an internal one or a problem with the fan. This
>>> would rather be reported to user-space as 0 (0 RPM) or a negative error
>>> code (libsensors does handle -EIO gracefully) rather than an impossible
>>> sped of 5400540 RPM.
>>>
>>
>> Agreed, since the app note says 0xFFFF is the fan fault value, we should
>> really never see 0, so I've changed the code to return -EIO in this case.
>
> And value 0xFFFF should probably be reported as 0 RPM, rather than 82
> RPM as your driver does today.
Agreed, I'm actually seeing the 82 value on my test machine (as fanX_min
value), so this is definitely worth fixing.
I'll do a v4 of the patch with this fixed tonight.
Regards,
Hans
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2011-03-13 15:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 19:28 [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon (v2) Hans de Goede
2011-03-11 20:33 ` [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon Guenter Roeck
2011-03-12 7:48 ` Hans de Goede
2011-03-12 11:09 ` Jean Delvare
2011-03-12 12:24 ` Jean Delvare
2011-03-13 12:39 ` Hans de Goede
2011-03-13 12:43 ` [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon (v3) Hans de Goede
2011-03-13 14:00 ` [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon Jean Delvare
2011-03-13 15:12 ` Hans de Goede [this message]
2011-03-13 15:27 ` Jean Delvare
2011-03-14 8:35 ` [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon (v4) Hans de Goede
2011-03-14 8:37 ` [lm-sensors] [PATCH] hwmon: New driver for SMSC SCH5627 hwmon Hans de Goede
2011-03-14 8:55 ` 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=4D7CDEC8.5060308@redhat.com \
--to=hdegoede@redhat.com \
--cc=lm-sensors@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.