From patchwork Mon Jan 31 19:31:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731058 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93056C433FE for ; Mon, 31 Jan 2022 19:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376703AbiAaTcJ (ORCPT ); Mon, 31 Jan 2022 14:32:09 -0500 Received: from mout.gmx.net ([212.227.15.15]:55337 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376662AbiAaTcI (ORCPT ); Mon, 31 Jan 2022 14:32:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643657511; bh=Z7EB/LO5aExgD4RlbbUSXw41BmiPeYS74GXPrPCXZdk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fpy1oEHFlgrP8Cm0syztqSUiScjWDhafl0LU+FeViCZ6eaClD5mkDXrWjMJ/DWn2H tJ1qW7zDkpajvwzNLIB9ndusGRcV2+62kcv5dZ8Co6M01zvFpNs07wjst5JF/OvLph vOrNDMR/dK9MCPw8W8RtYdkfj6IZ8pJN9unNg79Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Ma20k-1mkwSp31AS-00W02k; Mon, 31 Jan 2022 20:31:51 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] hwmon: (sch56xx) Autoload modules on platform device creation Date: Mon, 31 Jan 2022 20:31:34 +0100 Message-Id: <20220131193137.3684-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131193137.3684-1-W_Armin@gmx.de> References: <20220131193137.3684-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:jDNLt0CQuW8Yg6hSE70HVsvkH8FZpqZujeSA9sI7h11QHQsWySG wlXQ7lFnXRfeF8GxJhYkbdebXGq+u+bAztPbH3anB9PrMMBMi9C6Nljfceo0CxdIztg3UJo cI71vm7U/kIbb+fOeOKD1Vd8bpIdeqiDF/taLRZrBV6W0wEtanlQXL+qa52FpnFq4p1oGGe mARygq9tdQGPNDlX6/crw== X-UI-Out-Filterresults: notjunk:1;V03:K0:SyUJb3vmce8=:xgQXxjevgPPU33MadHnhC7 ja547I/UYPkNh+pdW2kvdXm0PDi7ZpaQ95eoxSrNQ0HdaQY8Re7VmYiB6RB3ZC+rT/l4PkP/t rjZsUa9B2GmxLn79eSd0Dy3fb6vhFgE+cJvN07jZcPDA3hwXA62Uzjx4vBspFQUCdEaalnc9l mlnxtnnQYHIHzlCokWMJNcfVwSYxdlPYI0gcmF8DJc0SysjSDGNksZP7ZnWSy8AnZ6rDFMEOz CntMS2AojgJ0dSKb9fddl6AR3/V3scRlgPbBaaPZaIuBonFusWvxjwI1HwZD39nury7/FWwHa Oa+ltna3uObh2s6x0kgvdoQr7p3i7t0a6bzfQ3UnKNuhHgeXxYU6Kp8LY4lGUqkRcbZzlZjzc 7gsoR5uG4Yx0XddUVV38oh+j1yAuK8/abfC7D3RDYE0mkCtjK7Ze+sbg/5RLb2+T07jClbtpk VAz+lKCNfL353ZG0MWg9aeNmoBz7IV2pIAt2/gL5TN8ITvbJf6GT9jI1GxAT/vDxoJRZgfzDu xy984CEzmxW+pTtKzzjTbmFzR2jTNfUJNCQ0i3RpLlCjWarX00dHYxcxfVBYHY0EAhWhMeKCk qaHgWhjr6NEW41zGcKRHKbISkszZUiiSKMKp/83cxxhSXDEYM6bzbjw5QVKOmRvwqyYZrqADt zwqwqa6irXYFOZvp6ecp9+u4e0+ka9vaNEC0WOWfexw6/KkoS+hUdvm9TQA0DulHVVbaRoRVF kYrKyE6lQsWYupp4YNK7gXUFfRoeioO4i2y0bompd3vCie1HVUQ1QYdQZ3+FIsXx2c+f1xNw8 AfuxYx6sAJH6b809IJ47C6M4+2GIFNQQCA1L1cN2QJZl6xRKYVYIdciU6c7XvpQHrX9s6l4Y/ M5W4lmDq/rgJ6+GvBtsZlrFmvitkjhM+UIqm3o6dktR5/1E1zc3fwYx1qRmF+0MKmMTNW0Op8 tV8LHI+DzFnu4e56nO55DAsm6L6YLwvoAlyroMf/EIDpLQNI59RNoosqB1SQwJAeZR698eRFP NTKR5IovYrVXapBSvVSOnYt9ai3WNwOzy4NAgMc50g0xTwCw1uY70oJSLwTz/oztJx8Hpdi8a PnGOCZFJi/5Mjo= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Right now, when sch56xx-common has detected a SCH5627/SCH5636 superio chip, the corresponding module is not automatically loaded. Fix that by adding the necessary device tables to both modules. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf --- drivers/hwmon/sch5627.c | 10 ++++++++++ drivers/hwmon/sch5636.c | 10 ++++++++++ 2 files changed, 20 insertions(+) -- 2.30.2 diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 8f1b569c69e7..72c3f6757e34 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -456,11 +457,20 @@ static int sch5627_probe(struct platform_device *pdev) return 0; } +static const struct platform_device_id sch5627_device_id[] = { + { + .name = "sch5627", + }, + { } +}; +MODULE_DEVICE_TABLE(platform, sch5627_device_id); + static struct platform_driver sch5627_driver = { .driver = { .name = DRVNAME, }, .probe = sch5627_probe, + .id_table = sch5627_device_id, }; module_platform_driver(sch5627_driver); diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 39ff1c9b1df5..269757bc3a9e 100644 --- a/drivers/hwmon/sch5636.c +++ b/drivers/hwmon/sch5636.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -501,12 +502,21 @@ static int sch5636_probe(struct platform_device *pdev) return err; } +static const struct platform_device_id sch5636_device_id[] = { + { + .name = "sch5636", + }, + { } +}; +MODULE_DEVICE_TABLE(platform, sch5636_device_id); + static struct platform_driver sch5636_driver = { .driver = { .name = DRVNAME, }, .probe = sch5636_probe, .remove = sch5636_remove, + .id_table = sch5636_device_id, }; module_platform_driver(sch5636_driver); From patchwork Mon Jan 31 19:31:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A4A4C433FE for ; Mon, 31 Jan 2022 19:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376803AbiAaTcN (ORCPT ); Mon, 31 Jan 2022 14:32:13 -0500 Received: from mout.gmx.net ([212.227.15.19]:59703 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376749AbiAaTcL (ORCPT ); Mon, 31 Jan 2022 14:32:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643657514; bh=q1ugW5vj4OYyvuTgfzR5w8vCHi9Ca6RP1hz9efhCLfY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BfJ2dMQAyc8PQ/RinKT7i5+lIvt2nqNYtzCOrj2wwCvnSf5SWRtAEti7wcKwQ23LY Y4nFm9UTN6HO6HWGSxsfmpl9DwbjBRwG4Rv1mqk6T5wtdziYu2jWCIkUNTj1/BFVA5 xCYvYQbrsqhwzMBnsnZVbl0nF2zUcKVBoa3KDeVQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MsHs0-1mMN9f3VIA-00tnRB; Mon, 31 Jan 2022 20:31:53 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] hwmon: (sch56xx-common) Add automatic module loading on supported devices Date: Mon, 31 Jan 2022 20:31:35 +0100 Message-Id: <20220131193137.3684-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131193137.3684-1-W_Armin@gmx.de> References: <20220131193137.3684-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:V6opI1FXWRrdoEYgQTXVumJBPzXghJbMSiAqn7m4qDmObX7oilD /I+PDD82Mt8f4ih4RCx36jdLR7yxnBvrhDWn09w2GEr4hj9BQJDqASxsj4nyB3B78VLJiHC VJJGBDFO7A9PDUUuEI5XG/rvUmB811RfB2O6iYZOVaJ0hgXfNyyakBkiy1YotJKOyhDS20Y L9+vt6JHaVVcXKqjNoamQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:/rrepjD6Q3M=:ufdmnS5xcGIdZOlprNS+yG UWzc5xPr26Ji+6HrKCQyijAGPc9Lj2//+vNKaerACfUBrePabAklp9DUmnfLnKK7017zPgy0l 83PuPH/GVAw5iYtI90GXeuY4sgwd11iNWGKnib5wnVbE54YmU1Prp8Nj7TxP2pIHkRgq0ga7h lVH8+TIl/l0xjB6ewGDdsxmHQpdnlWq5Jxd3iqv0eaUE2yyLql9MjgXE7OQ7c9lLbH/gd0ntv NWVI22+fcus+eIFqbeLBGtocdu5HDM5tFvmwO9wCCb7LbQzE0mcykKsCKj5GuxmbX/qiuguj8 I92z8XygTMi68qckEQLbBOw5tb+eFow/fCewiFe52/ArrSqyszTleBr5aPeO7bhW0xrQq9GdO DN5aGc6faJsPtRWAEsnD2WDajrQFJd7p0V9BWMDBmy7pZhuTuOd+afPIZAl8Trg/+fL7FINAy T/ekeh1X/nJQifFGxmm2xZY7v5CPMEmZwZVcS5be6sAprCGoGWkeWAaTApfQhhDKddBcI8JSm r5ve/6QzH/2nmkcYXJ7WJ68GaTypw0mi2iChWkdV3tjnaTkil+mwqcwNlWFCSwCzqV1f1aUha lAuGptToBAz8AQJLaLoyRIcjFDiSdFRtMaVoe3OgAmtg+LNSdFd2ppn3Qu1svN/HuW6cQ/buW VCdBXU984Dn3CEY+Ns8ah8vVUAoabyTcWLdLqRKiXMZaT2G4sy1St3+uhS6D+DNcym/Lq1Ex9 dkMP2DhsVgvQxGJa1XlWjMOh4YPxlRmryQNIpkTEvXWaP6aTsljaEcHv+dyng8LhrusFgGjB1 j+n3BB6q5SxhKNT/NHdD7P+AompbYImiPIzbcR7/fWmIQJ5EoN+4kXxrvLwLw6Kwv1Aqg2lRu hF3peo9GUrn6ikvl2K3hl+VT76ifQmAijyzqnj3SRwexcptP/PTbZJHhUvuCYlRoNgoJnWdRs aVIV01E8VpszNkCCEs4gZMrwp3lmN7/luZJ69jNcZV20YzOG2iTg1Wa2cVO540o/jDfloFSRn GnEnNFIQrfMkzYJ8+gKwZ3m4YHlzoGcb7D0Mx71XDZY2WDtDuc+klOTZeeZ/cxqCehd/38F8R 5YNiQdVtELshTo= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org This patch enables the sch56xx-common module to get automatically loaded on supported machines. If a machine supports Fujitsu's SCH56XX-based hardware monitoring solutions, it contains a "Antiope"/" Antiope" dmi onboard device in case of the sch5627 or a "Theseus"/" Theseus" dmi onboard device in case of the sch5636. Since some machines like the Esprimo C700 have a seemingly faulty DMI table containing both onboard devices, the driver still needs to probe for the individual superio chip, which in presence of at least one DMI onboard device however can be considered safe. Also add a module parameter allowing for bypassing the DMI check. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 40 ++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 40cdadad35e5..0172aa16dc0c 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -7,8 +7,10 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include +#include #include #include #include @@ -19,7 +21,10 @@ #include #include "sch56xx-common.h" -/* Insmod parameters */ +static bool ignore_dmi; +module_param(ignore_dmi, bool, 0); +MODULE_PARM_DESC(ignore_dmi, "Omit DMI check for supported devices (default=0)"); + static bool nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, bool, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" @@ -518,11 +523,42 @@ static int __init sch56xx_device_add(int address, const char *name) return PTR_ERR_OR_ZERO(sch56xx_pdev); } +/* For autoloading only */ +static const struct dmi_system_id sch56xx_dmi_table[] __initconst = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + }, + }, + { } +}; +MODULE_DEVICE_TABLE(dmi, sch56xx_dmi_table); + static int __init sch56xx_init(void) { - int address; const char *name = NULL; + int address; + if (!ignore_dmi) { + if (!dmi_check_system(sch56xx_dmi_table)) + return -ENODEV; + + /* + * Some machines like the Esprimo P720 and Esprimo C700 have + * onboard devices named " Antiope"/" Theseus" instead of + * "Antiope"/"Theseus", so we need to check for both. + */ + if (!dmi_find_device(DMI_DEV_TYPE_OTHER, "Antiope", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, " Antiope", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, "Theseus", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, " Theseus", NULL)) + return -ENODEV; + } + + /* + * Some devices like the Esprimo C700 have both onboard devices, + * so we still have to check manually + */ address = sch56xx_find(0x4e, &name); if (address < 0) address = sch56xx_find(0x2e, &name); From patchwork Mon Jan 31 19:31:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731060 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DE1AC433EF for ; Mon, 31 Jan 2022 19:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376771AbiAaTcN (ORCPT ); Mon, 31 Jan 2022 14:32:13 -0500 Received: from mout.gmx.net ([212.227.15.15]:45995 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376730AbiAaTcL (ORCPT ); Mon, 31 Jan 2022 14:32:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643657515; bh=mJxsPYb64pkiiR8ddTh3vIBADHaclB5tW+tmgCYuZ4E=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=lXWI0pCjpj3Qs4A8V8fHHPqclFPzCVDuKh/4Yrbu6Bh7iroyFPyRFzKR3hLuUR1dq 7qBV1nCgByOjN3imnV/EmnvebzM+Al75xC5N+15lh8np0Tyw901L1qWUzyFQdtUSfk SdpC6fZrqe14deMYjsQe/k9BNozSV85cU/qDRgpg= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MmlXA-1mYNgr0jf4-00jqdT; Mon, 31 Jan 2022 20:31:55 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] hwmon: (sch56xx-common) Replace msleep() with usleep_range() Date: Mon, 31 Jan 2022 20:31:36 +0100 Message-Id: <20220131193137.3684-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131193137.3684-1-W_Armin@gmx.de> References: <20220131193137.3684-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:9G+QQoT8RrwqS+i/j4j4JFVKX/Z2VG+dboyDoCr9nNHW2DYgPSX Bny4oKqRq/W50sZbkfD1Lm+JPCPLBow4iMnbLZw3M6Os2FvRUChKwfio5dKFgXrsVaxSB9E SBjD/08xQl8b72qAqdGj4W6UMWor0fs478zQoCQ7uHEB1oNv/fpywVkn9VAvnn18kW8wCKf d4zr931FgSpiYEA0wQvcw== X-UI-Out-Filterresults: notjunk:1;V03:K0:VM/N2hPwimw=:TDLn1RP9wce1q2iypMf/xC +XIOLkRq3pt0uw5aSER/jYX7sMGogoUaXXZYHFSg1TJD4Kgp+aUePaXb9Wk87pftYBocvB/Ov wcaH6OMYazE4WTam/fPQdE/7SJqnUP/jz11I1TE3QiT1Os1k9c3nwjuDUy8bQzCH27PgNwszM VcKRPGVIDEnVu4SkPUdlBA4smOupVqlIhyu3jZCDIDxH5S3GQumjFBwdMhiywNiWnimWDCUvv XvqavZcMuBkmf5TThX05EeR8UC7p2h2pzYrGOuUEMMn+Hf/D3eAl5Z7QvHHVFxGYYLJfSVc8G 7mp40W5TN1IjS6Jb3MYkwdkHFcibzYMMq4xkI+7WeRKa7EmX8ao7gQxaNo/wyuGb1382YpPjD mOkdCOXhCnbb045tAp17fe6QqZoTGzM3ANpn2nTsn3lszMqoameUOIUl0qqUT8MKzjFtE855N s5q6LW5kKLwlpQxVs/Q3wARtWjytqyR8X6Dx1mf2bA55pZaeuo9cpI9MopIOt+cKO+nAAicJT we5dg1mi3z8MqYjDIhqhTe5mj9F1+qcFJ6Xo50liJPWpaVz6sb6xAnQDmvdDFJf06FVJ6Edu0 tR3TmIh1J2v+leFhxs5r+vBJzM26ZyU7GlZnOxzLB/uLdgWey58Nxj6XYUatvLW+ZaSqS5s5l lbSCEo8tLmkLBy02rPlfB3ti8GdoqF20dEOJfg1RWM4hLBkg9x/WvnUZnyT4+EZFgIc/BOvMW qh/jtly42Lz8u2UvHkPVP3bRh2T+M11D+P0Nj46UcAaIM2DAlHFs1Kzg9OeAqQ85eBtTHH2GV 03GHXt8zlHqwGJtxcpvcH5qDERjc3xX3uLuesr5h3Nyu78jKI4L8xqUx6B9bjbBB/bPyEo949 o0Kzsy0P0t6F8dWmGPQA8H6xXol5qkSzGz1FmoXFvvnd+qrAbP6vglCte0sYgId47ky3oN+rs S0xBBqu109lz4uif7wV5h105ruVnxLZNj4n602G6cxNnsw1dqNhDLVuMv6axVy+EvFAxYZM+l EJIMZikB5S54vYeoF0Pg4+DsOfbKzcy7+xDwaxdxsaoPYAYJmNYS8lg0fzyZMflV2QIO/K8V+ QbnJb8PbN9HXVQ= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org msleep(1) will often sleep more than 20ms, slowing down sensor and watchdog reads/writes. Use usleep_range() as recommended in timers-howto.rst to fix that. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 0172aa16dc0c..f66e1ed4b1aa 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -139,7 +139,7 @@ static int sch56xx_send_cmd(u16 addr, u8 cmd, u16 reg, u8 v) /* EM Interface Polling "Algorithm" */ for (i = 0; i < max_busy_polls + max_lazy_polls; i++) { if (i >= max_busy_polls) - msleep(1); + usleep_range(1, 2); /* Read Interrupt source Register */ val = inb(addr + 8); /* Write Clear the interrupt source bits */ From patchwork Mon Jan 31 19:31:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A46A5C4332F for ; Mon, 31 Jan 2022 19:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376730AbiAaTcP (ORCPT ); Mon, 31 Jan 2022 14:32:15 -0500 Received: from mout.gmx.net ([212.227.15.18]:34937 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376841AbiAaTcO (ORCPT ); Mon, 31 Jan 2022 14:32:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643657517; bh=M8VxZrM69T8fzVT7HtYVnghJWaulQqQeYn5dd1DXrAA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=bF86srVel9qMm4UJ+cyEqgH/yBbxUdgo0HwK7MVyXWou73CBq43PL8hUgHCEb+BAk 55bzcMFeKSrVRJlmsEJpOl7couN7p4YG/rr53tu++P690IB1DKy5rM3TofBQQVGdT4 fGNuw4ge1EibMvS3hRMF5Q8/J+3XDrZYa6RLE8Go= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M5wLZ-1n8oqc2lh5-007UBB; Mon, 31 Jan 2022 20:31:57 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] hwmon: (sch56xx-common) Replace WDOG_ACTIVE with WDOG_HW_RUNNING Date: Mon, 31 Jan 2022 20:31:37 +0100 Message-Id: <20220131193137.3684-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131193137.3684-1-W_Armin@gmx.de> References: <20220131193137.3684-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:EVlEM/o2j4ih3tYP1AEJiMC8rIk32vvZTCzjpa4NBx1+hZB4vtx JJTBBoW3yuerS1F5Deib520NoWkps9QX9scjB3TEkU6xAfgCER8L7EHtcfsICirVLYi7wJx OEluf1hYsFD3ifbSgSlqxpSd9Pk6/OYpRpYoGA0EKVb8rQYKpgekWHPUpVW8czorIMYlOzX 8RuPS5rHY6Nj5ci6+vnXw== X-UI-Out-Filterresults: notjunk:1;V03:K0:gJ61MFJziLA=:kP4t8y1BzCOAu5fBJHUWF/ YEcsVMbkXuSeEd1yIuc3ehKVFnYhiuP8oDeSkrm9rKPlAFHYOboSZGN1h+aZtg237Rw8mCKO0 BUNw7AmS2cPks/3kCwJeXtKJ5I1tmPPTr9VYm5foeNg4o2Rb4PDAkLfQTfqtKaPH0Y5iIS300 lACUQc3CiPMVldyhDvnlc8ElKMsnp36cf/5o9NUY2VMWvoWlgrlY+8RTIwJylQ8fbjCyuJUDA a3tMHLMkNhQZKDFooYBZtPvB/plJiA5iyTMMjmBac0sVNSjp8xwBKzUQd+eGYcJs9JwldBuxd c8tsl3X9YXpc9/rK/0YF2fS6aPZTeHSHwPie8Q66PUGZmX+0anNZx+c4dROAxepNqAparRIUc jO9HqzcpxIqwOi9PsNAvdjMagldkX2QysKKXIFoY6Hhpfcqzg1WddGmPsDr4zBzctsHf/ZWeO IhWj5jxaYGWAw23PmpWBew1tzqBsMAG4cmlaxwbUpV374DmE7arffL7PvBL9f5MUstjbGDg0R nC2RYoEJM2ollX8pvuCsMEPYlIxT7IHw0vWKer5dNUlO7BSZ3QBxS4H7YMZGHW2NxPP1PSL4E Ls3RiMNQntyYWHOglrRCJIoTGx4thm1aH9P3V6zxzDUAA0BJvBUlb2ihiTPQPZ9Zs0avfV5d4 BU6Sv0WjOvmKjUYGUsMUjzHUvK3wCR3WdxIjM8kS/07vVgpeJ9FNna+yfMXuz1La7/Mi4Quj+ cBdnu6aBRdP9cTwvM6+QQLJp2/lwu7ng6Hp/F8DKs36aNEKVoqrjoVEWg2YnfC05Nvn+Zidkr kdG2T+Q7I/Ts0sR68/em3UtOwPhouwOXLrPHTaUGbyV/8PF+Rd+i8N7wcKsrDV0kr++IVclAQ 1Gbhu593ZO4j3FkaXrXanr5osAZTnHxXxCGTsdKD8iXyF6Hv/IqbM5VoGZJefgD2IzaUgMQoq hEHGSz8rVZLYULsAvKxpSBykWMvggLgEtNwgbXkgXVYcXUjqnAhG5ZTnVYsVRF3mzBur31UJL zxzZUh8l/9Eg+Glp4vJBb0bXfdY4KVeEicVv1az7+Jq59OiDn3mDfPRexW5+W+051X7XL9eSq iRGPdIJboreXpY= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org If the watchdog was already enabled by the BIOS after booting, the watchdog infrastructure needs to regularly send keepalives to prevent a unexpected reset. WDOG_ACTIVE only serves as an status indicator for userspace, we want to use WDOG_HW_RUNNING instead. Since my Fujitsu Esprimo P720 does not support the watchdog, this change is compile-tested only. Suggested-by: Guenter Roeck Fixes: fb551405c0f8 (watchdog: sch56xx: Use watchdog core) Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index f66e1ed4b1aa..2cd146fd0562 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -427,7 +427,7 @@ void sch56xx_watchdog_register(struct device *parent, u16 addr, u32 revision, data->wddev.max_timeout = 255 * 60; watchdog_set_nowayout(&data->wddev, nowayout); if (output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) - set_bit(WDOG_ACTIVE, &data->wddev.status); + set_bit(WDOG_HW_RUNNING, &data->wddev.status); /* Since the watchdog uses a downcounter there is no register to read the BIOS set timeout from (if any was set at all) ->