From patchwork Fri May 7 21:24:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12245211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C34C5C433B4 for ; Fri, 7 May 2021 21:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0F79613ED for ; Fri, 7 May 2021 21:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229524AbhEGVZp (ORCPT ); Fri, 7 May 2021 17:25:45 -0400 Received: from mout.gmx.net ([212.227.15.15]:51555 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbhEGVZo (ORCPT ); Fri, 7 May 2021 17:25:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620422668; bh=xmw9bIz0JbaGMXrW/IkaUwlZOQ+UcFUuEu0ihxDOGlI=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Nh2/mAxeTsnfnUFpOMSnQDoEL8WEm9kqogNYjjQ1VEgi5G0bCtsiNkregAYSlNLjL k3ao0sLaLU1iOH2xF89nRMlIoWn7M+AkljaRKKIOXmn6bkpXlOGJbrLO4OgEorId/m 2XLVgwSTRC2A2uorqvb+8mhbV8+SF8vKHgNaH5is= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([84.154.209.175]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MwQXH-1lM5hm3hLR-00sPDv; Fri, 07 May 2021 23:24:27 +0200 From: W_Armin@gmx.de To: hdegoede@redhat.com Cc: linux-hwmon@vger.kernel.org, linux@roeck-us.net, jdelvare@suse.com Subject: [PATCH 1/4] hwmon: (sch56xx) Use devres functions for watchdog Date: Fri, 7 May 2021 23:24:01 +0200 Message-Id: <20210507212404.6781-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210507212404.6781-1-W_Armin@gmx.de> References: <20210507212404.6781-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:5a6CBi48auSOmACJ667NTQ6gbdNMykXPgXkN7P222zbiSoKxj8w nl8nWfLGTYoHwzDV0tObFZebSoZtzDA1klZMsZ3x5Jg6vr32ty4o43oRVqGr8A0pxRb4TIl 38zq8D/j/KT8IYhMsf0ZdWDV0mbC0OpR7z3RdaGgnkeZKmG+aIgFsOVkdqtTGTistatsDEQ /rf/+IkPh6CM+bonHY+4g== X-UI-Out-Filterresults: notjunk:1;V03:K0:bXqqEAsK4qY=:1WVx5tgGb/uMB/ucUSXxxO 7B1GwvgYPl6hpAE+LLmp0Qk5GXn8E6aT03J8ML7pfSyS1NbFmd3UyfMtNEUp8MNzpTfTN3fmI RUkJ9r9m1Bhb8fcYCEQmHKv0cckACh7KG9hMNjH/L/ez1GV8DDs1LuzrkPRRNl3f2GPUQ7Zvu iJ3/jWg8ScdCrVr/gCcWiWQJotfb8h1MoYkaAt2fJsgTIMzbbZsiqjI68FXE7fqjIvgFssoDV ZeDk3VDPVQvmOq5gpMqr44YWVyghES0YHMEA+u7aVAxERXMyitAe0Q2kbX7J7dOboPRmro4HC qf3ASMuSu3oRs+RqiLJyh9Vo/Bs84BnFaV+3QjMTfkNQ+xafQYkRy3bIeLkXiqGTexf6SdHDd X4D9L1JBXGQschx3+/VHqs24A53DKaTRxiLTUwzFPxsok3vuRwBZNm5FesmKOfEUKCmIRTn2b 5bXKs5PpCnxz5KMyH5jAn4sbEt6izsCMCF/12GtrmovgDuN/cNs6k02iB0K6qmcJAkbygZndl zec3DenGCfCAQOJ3qVjw1OOHhs4Y1QPnjZp74B3KRTIvMsX+dcDBcZ32IdwDeoTyNVFsjQSCi JpvviVfna+tBhcDj90FR4Xl2yD/NtttLlS5WCdKpTiD4fJhCdZWLFdbzQkk1sNy0m+TP3Cb94 1kAQIuyuQK+ABQXFZhOXNbuKrCCFDnarOvieR8uPVYSEDM+IT+xGTtpRsAKiBYdumg0ksY78d J4ZwZALNmRuNbkcStJjSLpKaZDE3DqDx20afwXt0Qwiua0DTNlfRxLv5RK9qd8tmlS/QtXSbD b4x0A9N6zRz8vEjLrHoVVHCUNEMuR7+bUAPFICNDDhe/wOchjPEtMq4WHo2jiQYuvB42VPHR4 gvBmuXYMSfaJwXjc3jwJurgua7L/9t7QPU606jS9GBPEU7r0ExsBPHJ2gezNaz2wMGWGsSIJm 4e4OyLUFdBYKlS3Wp7Bdq15WcIi2VAs4kxZ9NEsecHPCeyaVwhXLfvB5Awn9IYYTbA8bvARFr 6vgC7aOwkX0qGXkbH/PyRHLp+9+DcVRU+2KIptGzATb9PPTYScpbiVFSVSz+WiMsrfDFgx5Rb M3foX8OCA+B9vMyqUQIzp5beYApCTpmefZeJ2YzTOn34wqb4GlEf1DfRJgteVlj+cwLa7BSQ3 hTEb7FIy9h3P+HCsFHEtkLy/4R1Fmi8zn9b/vYu5patILemPd7ITghLMKGHunh+xxvJug= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Use devm_kzalloc()/devm_watchdog_register() for watchdog registration since it allows us to remove the sch56xx_watchdog_data struct from the drivers own data structs. Remove sch56xx_watchdog_unregister since devres takes care of that now. Signed-off-by: Armin Wolf --- drivers/hwmon/sch5627.c | 12 +++--------- drivers/hwmon/sch5636.c | 9 ++------- drivers/hwmon/sch56xx-common.c | 13 +++---------- 3 files changed, 8 insertions(+), 26 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 4324a5dbc968..8a71fba33ea0 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c @@ -64,7 +64,6 @@ static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = { struct sch5627_data { unsigned short addr; - struct sch56xx_watchdog_data *watchdog; u8 control; u8 temp_max[SCH5627_NO_TEMPS]; u8 temp_crit[SCH5627_NO_TEMPS]; @@ -359,11 +358,6 @@ static const struct hwmon_chip_info sch5627_chip_info = { static int sch5627_remove(struct platform_device *pdev) { - struct sch5627_data *data = platform_get_drvdata(pdev); - - if (data->watchdog) - sch56xx_watchdog_unregister(data->watchdog); - return 0; } @@ -460,9 +454,9 @@ static int sch5627_probe(struct platform_device *pdev) return PTR_ERR(hwmon_dev); /* Note failing to register the watchdog is not a fatal error */ - data->watchdog = sch56xx_watchdog_register(&pdev->dev, data->addr, - (build_code << 24) | (build_id << 8) | hwmon_rev, - &data->update_lock, 1); + sch56xx_watchdog_register(&pdev->dev, data->addr, + (build_code << 24) | (build_id << 8) | hwmon_rev, + &data->update_lock, 1); return 0; } diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 5683a38740f6..a5cd4de36575 100644 --- a/drivers/hwmon/sch5636.c +++ b/drivers/hwmon/sch5636.c @@ -54,7 +54,6 @@ static const u16 SCH5636_REG_FAN_VAL[SCH5636_NO_FANS] = { struct sch5636_data { unsigned short addr; struct device *hwmon_dev; - struct sch56xx_watchdog_data *watchdog; struct mutex update_lock; char valid; /* !=0 if following fields are valid */ @@ -372,9 +371,6 @@ static int sch5636_remove(struct platform_device *pdev) struct sch5636_data *data = platform_get_drvdata(pdev); int i; - if (data->watchdog) - sch56xx_watchdog_unregister(data->watchdog); - if (data->hwmon_dev) hwmon_device_unregister(data->hwmon_dev); @@ -495,9 +491,8 @@ static int sch5636_probe(struct platform_device *pdev) } /* Note failing to register the watchdog is not a fatal error */ - data->watchdog = sch56xx_watchdog_register(&pdev->dev, data->addr, - (revision[0] << 8) | revision[1], - &data->update_lock, 0); + sch56xx_watchdog_register(&pdev->dev, data->addr, (revision[0] << 8) | revision[1], + &data->update_lock, 0); return 0; diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 6c84780e358e..9c884fd0beb2 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -401,7 +401,7 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, return NULL; } - data = kzalloc(sizeof(struct sch56xx_watchdog_data), GFP_KERNEL); + data = devm_kzalloc(parent, sizeof(struct sch56xx_watchdog_data), GFP_KERNEL); if (!data) return NULL; @@ -438,10 +438,10 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, data->watchdog_output_enable = output_enable; watchdog_set_drvdata(&data->wddev, data); - err = watchdog_register_device(&data->wddev); + err = devm_watchdog_register_device(parent, &data->wddev); if (err) { pr_err("Registering watchdog chardev: %d\n", err); - kfree(data); + devm_kfree(parent, data); return NULL; } @@ -449,13 +449,6 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, } EXPORT_SYMBOL(sch56xx_watchdog_register); -void sch56xx_watchdog_unregister(struct sch56xx_watchdog_data *data) -{ - watchdog_unregister_device(&data->wddev); - kfree(data); -} -EXPORT_SYMBOL(sch56xx_watchdog_unregister); - /* * platform dev find, add and remove functions */ From patchwork Fri May 7 21:24:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12245213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3727DC43460 for ; Fri, 7 May 2021 21:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EEBB613ED for ; Fri, 7 May 2021 21:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229482AbhEGVZp (ORCPT ); Fri, 7 May 2021 17:25:45 -0400 Received: from mout.gmx.net ([212.227.15.18]:43551 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbhEGVZp (ORCPT ); Fri, 7 May 2021 17:25:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620422669; bh=YJ8cNBerAjDCcGPEFV4x35/XKy0GtDDhKMbVKjU4Sdg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Liu+9iafeC3EyEyfTjoIDHU44TNhbh4admo6akDH/oQVm/dvo8V11Jx/rpkzVdyUQ qOJbR422KDMJJA4vN5GrWlZtumhKpkI+gRlShdh4jBpwZShleLojSfKc6u1+JXDKNU Iq/vx4kKOy3jY9EzX14+7F3NArcUpCz0n8G6Got4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([84.154.209.175]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mlw7V-1lEptm1Vbv-00j1bH; Fri, 07 May 2021 23:24:29 +0200 From: W_Armin@gmx.de To: hdegoede@redhat.com Cc: linux-hwmon@vger.kernel.org, linux@roeck-us.net, jdelvare@suse.com Subject: [PATCH 2/4] hwmon: (sch56xx-common) Use strscpy Date: Fri, 7 May 2021 23:24:02 +0200 Message-Id: <20210507212404.6781-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210507212404.6781-1-W_Armin@gmx.de> References: <20210507212404.6781-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:WLQk0VeuNWd9kknB2Dgx4QXxRrk7+LtKA5w2Jwfbx0yvPbeqgLy qBbDhIIzdo0VmtJSQ2E/lbO4fVAk2SNz1EG1/qUYWGAIH3utofPn0sOPjIGtr7SiBQNK+uA t4mXsV7t8aHVt/I1OsmFtTcdHPcBJhQ2FW3Fv1qjraQRfvWvmqOyX7vTLuP0wbQs1X9hVB5 yvVuX9ERA9i7OeeEEWXZA== X-UI-Out-Filterresults: notjunk:1;V03:K0:xDjfMRsDwPc=:Yl4+Ya14DwoKMkyBwnxnAh sT7+j1uW+u4O6e/sTbqNAjwqKMFXHX+tU2CiDbm0wacl8aIdhi1gZVGj98U2z4iR8R7N12T69 h2y+eQ7CkuA95AOA1km73FGoFp97HN884D1qYVL2MSMLV5Z36X1zNfdV1jC9sjuAJLHrjt6Ye QNZBMZaJdCx5zUuwmOMvQMuvs5on+WKPTfoFNBLl51VfC7xSp3EDZ0Pvo+JgOXgPSPoq+IySW a6ifMdlIVNz+vc/9sJu5bvxH7c9bDKJF9zS6aNJcoj2yV596uVcMMuen93dEADYA3YpVRJjja kzhj1g/QippleaG3GdBucH1dq454Dyfw1DxBw83o7eFAvVkSjumcW7P2SXOZu3xoyLccGSmaK +mVt2909lUA92Do1qwMyNAObGjewJG7RpXkIFgP/VAMa+bwVKay9m0d/7sMPnb+pMdOmyRmnA F6Ojkl2ImCjLpbvj+aKe/4439rbmRHR70BJVB7YO1RH9Yhg5joYCiU8ubwj4xY7Mb/GoTvOX5 kmUrv3KOBXNhC5f+IEuU/+WtOZfQCtcDyNYEX6SiG3Z+tfD5NxWo5a+/8J57F/sffTmFL7a5B qTd37+7lwrl+jbiI8GSnNssUezJslmLao544oUb4zJxRfsKmV5womD9utgLxi9d+NS0FXdCaE DajBgsi8DMbeNt1/tnyXwOwypEIZVL2BgLfvlb66F+bAawjGks8ahf9G5qTGCH3D1YNMoUaBR n0EFpDiOs8QKCTP894VhW4uW6XxJ6uG9pvckFEwNQTiZo3ks4Lz/Yqx1WHQjIZotJtz6H8OfP dAIzKkllKO25326S66HflM0pX8BRXQHo0iXZlWu1mjXfQJcOBqtjwwM0yzPTCR0hhsi+GH1+2 x4llkmw40VRZAZLZZ6+vZ+PzW3uR3DDhtpSKIrwH7ZJjc0XcFq0njuleOyYTTZHmjDUZAiSBG StaW3wFYRZT1SxNm7gQPgb5si02x5GhP1ySB79PxVL1OY6a6U5abW8iQkNcCH4K1VUY/N93Bs YJC7PpN2A3ioufGWZCFZEXqXy/wyHnv6H3TLcvyhFAp5Tt89MKANTwwHwb0bXPOrql+RejUvs MWUL8B2KHdb9922apc62qsO+LC4g0Z2C0NGbB+q71Nj0oe+GHqT1xUEF/J4DlYHBysdk13NLT Q7/3gZo3p/CsYl8YGcgkJIEFOW4boA+I4LrkSbNFdYXzHDrHgC2AeSb6Nt/cL8LPplV7o= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf strlcpy is considered deprecated. Replace it with strscpy. Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 9c884fd0beb2..2d7bf017b2df 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -408,8 +408,7 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, data->addr = addr; data->io_lock = io_lock; - strlcpy(data->wdinfo.identity, "sch56xx watchdog", - sizeof(data->wdinfo.identity)); + strscpy(data->wdinfo.identity, "sch56xx watchdog", sizeof(data->wdinfo.identity)); data->wdinfo.firmware_version = revision; data->wdinfo.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT; if (!nowayout) From patchwork Fri May 7 21:24:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12245215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97A35C433B4 for ; Fri, 7 May 2021 21:24:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72675613ED for ; Fri, 7 May 2021 21:24:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbhEGVZs (ORCPT ); Fri, 7 May 2021 17:25:48 -0400 Received: from mout.gmx.net ([212.227.15.18]:52353 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbhEGVZr (ORCPT ); Fri, 7 May 2021 17:25:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620422671; bh=s/e+/0/neoS4yPRhwnYOVLWsTREaXhubwJPzHDve9K8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fbD+70abqxrPG+ZC9mGGoiJ+756by2wCcYSxGrzvPf1MQx6jbpLLnLebbAeQBCsY3 +0RY1xE1BoBOM0RMLbmco2lACuxDcCPSGlO7jWOebu3CwpvYUBCjKaPaq+7qlceivE nHxelwZBdr5Awgy0Xk6WZZjKNfbK6uDYJcIoACJ4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([84.154.209.175]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N33Ed-1lX44I17aX-013MWk; Fri, 07 May 2021 23:24:31 +0200 From: W_Armin@gmx.de To: hdegoede@redhat.com Cc: linux-hwmon@vger.kernel.org, linux@roeck-us.net, jdelvare@suse.com Subject: [PATCH 3/4] hwmon: (sch56xx-common) Use helper function Date: Fri, 7 May 2021 23:24:03 +0200 Message-Id: <20210507212404.6781-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210507212404.6781-1-W_Armin@gmx.de> References: <20210507212404.6781-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ZOnIqvfqD/+xhi8Dl+ndbDyOG6wXMl5kjWN82gqA/Ys8f2QLFXS QEYWoUCiN1FwxAvVX4RDHO05m6xnqz6AP4PmJUC07ZrF/hpWthsnpiAD5EqX9kHqSH1CIMS gOdCqb9Imf3J42QUNjTYWDZ4sCucc7GM7y3kPKegFsLgcy1kee1APwlrhCwPYAdanjasfAA hj+y8srm7cpEUn/9+kNIA== X-UI-Out-Filterresults: notjunk:1;V03:K0:tuxNSZvYQiI=:ze/r0hlz7fhcGU6K2BSvqI eP+rFbuR8O4myy32PnJhAZ4kxqLbiOVRMxqHE/P+AU8W9n3qcwtNvDUXXJSWx4woab8ZpROR+ RasyKwMUixoCgX/CRNfDu8TCQk0OI61i894w15syXh2RCyuQt1p5eVv7h+W+8cwdU75ydURr/ u6bhRK0NySDCWFncH2a2EstybJdgni3pkkKluFcOTfTY0RjGqNfH+2Mm7KJ2acxeTvmsVGd0b pVxnLks6+rWFTAMchHtiNDxn3lxAwqk9uGe4AlDqNs0SOUJrP7mvTQJPXQWtvN22xqmavnGbl D3ep8wPNZZDgcbbVsqf09RGPfQ1VPjd4kpUmGXm22YvAhGNQHlntMkmaoFKDXu8zufej5A23h wAkO/qGW64dbQsS0rItDcrpB+gH1ipp73Cr00eTT6pEmFtNorvtu3vh5BBs/c66Oj2O/RFmnQ YyXAOh/JGv/Oh6rNVKe8qE3nRQ6nrcreZfV1QDsU4HOpAb6tmW7/YU6ghn+Mk9o8qLGIY+fce b3N6myTLB9UVNyizILeRc7DPiFo1LtZIBKNRbZ1C3B+C3nYey66sZVgsWgcmAvymhrLjyvJ82 SCylwXSyZOdacFVAuB4SWbEKstjp9oBOetvf0fNs1NMDS29DMyABLuGi9rpfXDk3bRCO5TKaa tiy3joob2jzxbrPCNqPVNnam2Koxhw65ByWab6+/9NaFdFBK7C/jTDUykapBYmr33snuN8zzS Cb6E0nOjvkY2ae1avu9fWOLRZVxd6QaSxN0BfOGVWECRTTUAKeje385k6lHRrsYmWseCTVz0O kt0F10Ee5JFTJBdVb8jbOh4fsFq4i7AEFSydm0yF6RCMjLB2SJrZ1tqgwyQsIqGsYXk0/wR3i aS16mBxDDvSXFBzztVAjLbuKFIJuTucIe3i4hp9NeDPu7qckzgQ6Hr9m+IT+r9aenmzTUWVMs eGuNVp6pXkQoGJuXLVdwLlatB5SiIVJVaiLeNgdFbbaSdxOYtAqnw8f00VmaIOXxekUl4LMWi 5VhE8fGdGWIhcukYezN7KY2QkLk8f08z+t6jDjY1FpgtGCwRZfs1wmdntZc7rBCfrQLVhEi3d sPFddew6me3bBwISPn5wbGpLHi/fYppSptvTZCW8mjDCZzOB/6E0aswsuU7r6QrQYuvw6mpZV tIaF6EZWc3h1KnQ4c3HVlDNXAH+dVx6QLMgZako6I9cDr5+lKMP9LDhPjJcbQBKF4F82c= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Use watchdog_set_nowayout() to process param setting and change param type to bool. Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 2d7bf017b2df..2273943960bf 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -20,8 +20,8 @@ #include "sch56xx-common.h" /* Insmod parameters */ -static int nowayout = WATCHDOG_NOWAYOUT; -module_param(nowayout, int, 0); +static bool nowayout = WATCHDOG_NOWAYOUT; +module_param(nowayout, bool, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); @@ -420,8 +420,7 @@ struct sch56xx_watchdog_data *sch56xx_watchdog_register(struct device *parent, data->wddev.timeout = 60; data->wddev.min_timeout = 1; data->wddev.max_timeout = 255 * 60; - if (nowayout) - set_bit(WDOG_NO_WAY_OUT, &data->wddev.status); + watchdog_set_nowayout(&data->wddev, nowayout); if (output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) set_bit(WDOG_ACTIVE, &data->wddev.status); From patchwork Fri May 7 21:24:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12245217 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4846C433ED for ; Fri, 7 May 2021 21:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B864A613ED for ; Fri, 7 May 2021 21:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbhEGVZt (ORCPT ); Fri, 7 May 2021 17:25:49 -0400 Received: from mout.gmx.net ([212.227.15.15]:53673 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbhEGVZt (ORCPT ); Fri, 7 May 2021 17:25:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620422673; bh=rZbA9snmy9tcYXauCD8jRq04JE8JeE2m7t+lGHFhjtc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=iM1B6nkAD2t6/nH4pcaur5Iv+Nu8yJlM28qJ90lnbH/0qWbvZhjlYbkZYByAMeckQ zBAaZbxsEO+0tnrWC6MqbSJqu0Nu9/efWOLbT9nFErXln7WLs8qyKapQPljHfuR2Ip f7Lq7zosPeszS7L/dTp6kZ1Oi6NHJsPH+LCHjXko= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([84.154.209.175]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9FnZ-1lZtQd3Oz9-006L4B; Fri, 07 May 2021 23:24:32 +0200 From: W_Armin@gmx.de To: hdegoede@redhat.com Cc: linux-hwmon@vger.kernel.org, linux@roeck-us.net, jdelvare@suse.com Subject: [PATCH 4/4] hwmon: (sch56xx-common) Simplify sch56xx_device_add Date: Fri, 7 May 2021 23:24:04 +0200 Message-Id: <20210507212404.6781-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210507212404.6781-1-W_Armin@gmx.de> References: <20210507212404.6781-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:w6piSZDzD1vInUIjG/mwAQAr0WOTqmDbOjjtjpK8GK3EHdIIUTD SXcCflpQsFJ7V7a7f9vhPOeJUen781Zuu+z9YI08aMaRHxrPUKZaZ+mewWfjmCCRp0vmBFz BPDf7AvEgqCH69sWmrKNGQgozfMgKbQy8Gapds+pNG4Jiznx+9sPtvOxEqrgh+x+xVtC6sY Hzzu1SWI/Mfp16xsj4kbQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:wtA7gpx779M=:IVPOcUj42dBzLjDQoNAuQQ 9KtKSUwvZimY8ur9TLbS7yfUbFpG1y8FrqhnrbdrjJ6NrXVvdH8H5owdflcJ7XwD2CoeAM7W1 hk1aC5zydYuC53JWvtKFJnl8N5slYu5GaUaWg383cZRO/Qn+RQGLrCrTOORypXv6PIQxnmmXA +JE+GjP70c0DDezLJfTwoELhEsQHsgFxU9MFKeg7n2qD7WOYxa84ZV6TlcQeHZMf2w8XXh1GD KlDkwUwek1q+1zKtQ0ip5Sw61gYlGxJZ2ZdulRzF5KlzneWaIIOfessA6owbjT8IzYbq426jD thsk7UO/i8L0eZ7Nrc0GWTjH/Ag6xMVpZl+4yCz/rC5dbiG72NLNBXp/t9OU8VekzEdwo1o0f +TAqVpxuzBHu9wSzZ1r0wOvTfssQ9VOFzNZshseAJuB5sU9rG2Bw5i3pHKuh7fnBo1MyMl5ee 5h2ZOAxzy+x/Ykl+7hvgieAs9UTpbRzbSzEv9ccpmv54lZjjTQjcZSewo0xSziVbL0HznuvoY zn4iU2Z+3fkkOSTRmNR8z0Axwl2b5EUpAS6DW84caOyrTqmqpUFxsMzifwQiF3kZMyG7f+Y1h f7jkIq2jApnXlLJnw8zCW4rMF8pvN2Ik75zqXeRC2bcXK7sa/Ro7dLjqOkXjCR3MYUMHfhx34 TTj5REmxIzUunak5JVMrhmQZSiU8iF0l/lYV42qvBSF5IBKOvEI82s6ivSL0rSecRfH1VgwKM y7/lz7i+f07T/cFH8KxwoDAGfvOgGRVAjDnmyzxCnb0eSKSAp3oE7DRB2PdyFR80z+jDrEf6J ghRjby3DL0BeMay9yv6UaZegXx2M5W09dbxLDeGzcpUxTzu41K6ySLrBA7xBuXhxpM0Zly/Ct 5TC/pe457k3NZx78csFdyHa+SEqvMsBX3nCtDG/633Nyebq87zsyXAjQcHb7v5UW/uB/atM6X GhzyL5Sh6LturUqVB8G+3DvIcxGTOePK/8ZJrLV+eeb2igIdIHOAcu58isyo3zTw0bxeKDYVI 5xFK0xCLDtP+22tACEFr9VXEyiAgld4ybsC41gKMc42L+I6+LMZs0t10x49q9LD58656Rmh3y PR9QUbBQTciooA5yfZfoB5CH66DksN5VNJQNvdoQ6dlgTzWDKaBwh6W/1/NOFBqGYQ5iDM0L4 qWUnLDeb0vGeXzlWWAII6DUWQlP4Op590IpH8VrCL4UJKPZHAVMBXkvZtAEKTK4J9HQYo= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Use platform_device_register_simple() instead of manually calling platform_device_alloc()/platform_device_add(). Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 2273943960bf..b731c108ec56 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -507,37 +507,18 @@ static int __init sch56xx_device_add(int address, const char *name) struct resource res = { .start = address, .end = address + REGION_LENGTH - 1, + .name = name, .flags = IORESOURCE_IO, }; int err; - sch56xx_pdev = platform_device_alloc(name, address); - if (!sch56xx_pdev) - return -ENOMEM; - - res.name = sch56xx_pdev->name; err = acpi_check_resource_conflict(&res); if (err) - goto exit_device_put; - - err = platform_device_add_resources(sch56xx_pdev, &res, 1); - if (err) { - pr_err("Device resource addition failed\n"); - goto exit_device_put; - } - - err = platform_device_add(sch56xx_pdev); - if (err) { - pr_err("Device addition failed\n"); - goto exit_device_put; - } - - return 0; + return err; -exit_device_put: - platform_device_put(sch56xx_pdev); + sch56xx_pdev = platform_device_register_simple(name, -1, &res, 1); - return err; + return PTR_ERR_OR_ZERO(sch56xx_pdev); } static int __init sch56xx_init(void)