From patchwork Thu Aug 4 05:15:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9262905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CE5860754 for ; Thu, 4 Aug 2016 08:08:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DF9C27F8D for ; Thu, 4 Aug 2016 08:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2260228336; Thu, 4 Aug 2016 08:08:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 035D427F8D for ; Thu, 4 Aug 2016 08:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750736AbcHDIIT (ORCPT ); Thu, 4 Aug 2016 04:08:19 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:35434 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751549AbcHDIIC (ORCPT ); Thu, 4 Aug 2016 04:08:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=KKQjRM9UROQcW1QzBzm4w1gEkWomWqSAEzlxLIAZKQA=; b=JevVi+1L/QwjNNMuumCBlLMNPQ ODK7/XR5tzyeKvhFeA4U/Q8cVQJLJfyyrKX3i6OacuARZN9GE0S9z2bQ6jnOlnWskny0ikS/dMq/F nRr9RBZvTt2KsuHSJ6KAkjr+6pvwr1y8DX4f5cWU4mxe27IQXea0x0ErJNlX/k43e3+N3NjPCwB1s Hdp+nwh2qnQxuDrOXKz9fM1KoXvwCXN2cUg/PiHmODNCazKWbb7ExGgT2ODeGBlsUUfXAL7Cm6/wO NLqlZjH7r/DLJ8RTRYqOjEIqhJBQLVCFYu3DF+MxmXpajF6MJIyp9VstTKoxlBd5OZNqt/oc6TDzn 1KeltN1A==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:50240 helo=localhost) by bh-25.webhostbox.net with esmtpa (Exim 4.86_1) (envelope-from ) id 1bVB0M-002rT2-Vp; Thu, 04 Aug 2016 05:15:39 +0000 From: Guenter Roeck To: Hardware Monitoring Cc: Jean Delvare , Guenter Roeck Subject: [PATCH] hwmon: (nct6775) Do not accept force_id unless chip is found Date: Wed, 3 Aug 2016 22:15:37 -0700 Message-Id: <1470287737-1212-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Guenter Roeck Reviewed-by: Jean Delvare --- 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;