From patchwork Sun Mar 12 14:26:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 9619407 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 A6E9D60417 for ; Sun, 12 Mar 2017 14:26:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8478D2848B for ; Sun, 12 Mar 2017 14:26:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 666462848E; Sun, 12 Mar 2017 14:26:39 +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 F33C42848B for ; Sun, 12 Mar 2017 14:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933406AbdCLO0i (ORCPT ); Sun, 12 Mar 2017 10:26:38 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:57293 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933174AbdCLO0i (ORCPT ); Sun, 12 Mar 2017 10:26:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=In-Reply-To:Content-Type:MIME-Version:References :Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding :Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IlBfoFt6eyg7r96ELuI0QwqWuHO9955UTNGoLG3zcRY=; b=YsVSZ6DOslYXhKIRQ5lhi5IoRD Fw3/IK/YdSQ58ZQe38vpjRjLFGN2+B85j4omUjlRPSIC/SGi/7kGmvAWEGkiBGtjSF+k5MRnOflAB L/HHW7cWrQo2lZwzmtPfMgBdcjD8A/lqwsYxpaL9KpnDo2EPCzbxAbabPx4OQAm4rUdOZfcFLuj/h TcYO6+3XAArqb+Z/18Rv/0ehWbc+iaSD7oKzcihcbPIa398IBQjFo2/wm7AqW35e4wrCH6rKlnUMv n7JQyc6KGI+H/hYpodVVL+pNyNUdh79EXROXwom6Jyl97iwHAhIz3pcFQQRpLdJ7laonerKFVvuiP DPegF/2w==; Received: from 108-223-40-66.lightspeed.sntcca.sbcglobal.net ([108.223.40.66]:43030 helo=localhost) by bh-25.webhostbox.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1cn4SD-0032rU-NY; Sun, 12 Mar 2017 14:26:38 +0000 Date: Sun, 12 Mar 2017 07:26:34 -0700 From: Guenter Roeck To: Russell King - ARM Linux Cc: Jean Delvare , linux-hwmon@vger.kernel.org Subject: Re: it87 causes VIA hardware to lockup Message-ID: <20170312142634.GA1917@roeck-us.net> References: <20170312103413.GJ21222@n2100.armlinux.org.uk> <20170312132544.GA17687@roeck-us.net> <20170312141522.GL21222@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170312141522.GL21222@n2100.armlinux.org.uk> User-Agent: Mutt/1.5.24 (2015-08-30) 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 On Sun, Mar 12, 2017 at 02:15:22PM +0000, Russell King - ARM Linux wrote: > On Sun, Mar 12, 2017 at 06:25:44AM -0700, Guenter Roeck wrote: > > I found some reference suggesting that The IT8705F may respond on > > both SIO addresses. Can you try the following patch ? > > Thanks for the patch - it'll take about a week or so for me to test, > as I can only risk testing it when I'm physically at the machine. > My pleasure. Sorry for the trouble. I attached a more comprehensive version of the patch. Thanks, Guenter --- From 5b3f92a9e0df49a111a96f43130d2cee370e4c7a Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sun, 12 Mar 2017 06:18:58 -0700 Subject: [PATCH] hwmon: (it87) Avoid registering the same chip on both SIO addresses IT8705F is known to respond on both SIO addresses. Other chips may have the same behavior. Add checks to avoid registering the same chip twice. Fixes: e84bd9535e2b ("hwmon: (it87) Add support for second Super-IO chip") Signed-off-by: Guenter Roeck --- drivers/hwmon/it87.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 3e57a6120551..7053968fe0d3 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -3197,7 +3197,7 @@ static int __init sm_it87_init(void) { int sioaddr[2] = { REG_2E, REG_4E }; struct it87_sio_data sio_data; - unsigned short isa_address; + unsigned short isa_address[2]; bool found = false; int i, err; @@ -3207,15 +3207,29 @@ static int __init sm_it87_init(void) for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { memset(&sio_data, 0, sizeof(struct it87_sio_data)); - isa_address = 0; - err = it87_find(sioaddr[i], &isa_address, &sio_data); - if (err || isa_address == 0) + isa_address[i] = 0; + err = it87_find(sioaddr[i], &isa_address[i], &sio_data); + if (err || isa_address[i] == 0) continue; + /* + * Don't register second chip if its ISA address matches + * the first chip's ISA address. + */ + if (i && isa_address[i] == isa_address[0]) + break; - err = it87_device_add(i, isa_address, &sio_data); + err = it87_device_add(i, isa_address[i], &sio_data); if (err) goto exit_dev_unregister; + found = true; + + /* + * IT8705F may respond on both SIO addresses. + * Stop probing after finding one. + */ + if (sio_data.type == it87) + break; } if (!found) {