public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jean Delvare <jdelvare@suse.de>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH] hwmon: (nct6775) Do not accept force_id unless chip is found
Date: Thu, 4 Aug 2016 06:24:11 -0700	[thread overview]
Message-ID: <57A341FB.2090308@roeck-us.net> (raw)
In-Reply-To: <20160804130048.5a33f1fb@endymion>

On 08/04/2016 04:00 AM, Jean Delvare wrote:
> Hi Guenter,
>
> On Wed,  3 Aug 2016 22:15:37 -0700, Guenter Roeck wrote:
>> Since commit 698a7c24a544 ("hwmon: (nct6775) Support two SuperIO chips
>> in the same system"), the driver supports two Super-IO chips. This has
>> the undesirable side effect that force_id always detects a second chip
>> at address 0xfff8, even if no chip exists at that address.
>>
>> nct6775: Found NCT6793D or compatible chip at 0x4e:0xfff8
>>
>> If no chip at all is found at a given SIO address, it does not make sense
>> to instantiate it. Limit force_id to only work if some chip is found,
>> that is if the chip ID returns a value other than 0xffff.
>
> Agreed, good catch.
>
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/hwmon/nct6775.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
>> index d087a8e00cf5..7859a30ce31e 100644
>> --- a/drivers/hwmon/nct6775.c
>> +++ b/drivers/hwmon/nct6775.c
>> @@ -4232,11 +4232,11 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data)
>>   	if (err)
>>   		return err;
>>
>> -	if (force_id)
>> +	val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8) |
>> +		superio_inb(sioaddr, SIO_REG_DEVID + 1);
>> +	if (force_id && val != 0xffff)
>>   		val = force_id;
>> -	else
>> -		val = (superio_inb(sioaddr, SIO_REG_DEVID) << 8)
>> -		    | superio_inb(sioaddr, SIO_REG_DEVID + 1);
>> +
>>   	switch (val & SIO_ID_MASK) {
>>   	case SIO_NCT6106_ID:
>>   		sio_data->kind = nct6106;
>
> Reviewed-by: Jean Delvare <jdelvare@suse.de>
>
Thanks!

Guenter


      reply	other threads:[~2016-08-04 13:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04  5:15 [PATCH] hwmon: (nct6775) Do not accept force_id unless chip is found Guenter Roeck
2016-08-04 11:00 ` Jean Delvare
2016-08-04 13:24   ` Guenter Roeck [this message]

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=57A341FB.2090308@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.de \
    --cc=linux-hwmon@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox