From patchwork Mon Mar 6 09:09:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 64523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1736364wrd; Mon, 6 Mar 2023 01:13:11 -0800 (PST) X-Google-Smtp-Source: AK7set/nsBQx+TO8F1vNuC0RiIZBqK6KaJdVmvl5EqoW2TDexCjB9F8wFmZ/VbCLpcPrNBR1QkZg X-Received: by 2002:a05:6402:2cf:b0:4af:70a5:43ff with SMTP id b15-20020a05640202cf00b004af70a543ffmr8709978edx.26.1678093991113; Mon, 06 Mar 2023 01:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678093991; cv=none; d=google.com; s=arc-20160816; b=GKxnT+EXksnnYWfLEFdlKelUJ+WqhK1q3WFyxuziPzIyNZwLu3UWwwbkUDAMA+3mTf VjmVYyZFFxViF+4pI0rZtx0BmTJGt6xF0zgQ1PaMrV8vMPMevgus9Z6mGi5jtWTWU0Va omuQOaIqT4QuOnHAkUAGYB7x7XFhOSd+5PJ9lVXMQ8CXTuKbjqdQL5P+WglUPjiSBbht xHjYAjSvvNrMkdUOGEEx2Etf9NuR6nEk+NF5EKnKJ+ib7bo/nQ6c13ljmasLPBQKTIV7 u0QoE4G2zXG5H+cdRE0is4hhsC+u003FB+RtO5dV8N3b2ZmI+iMlldp6q6W1EGI6nEWi JQ3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vVczFrQ/bmSmmVh8y+fzYA4z5v1WzklI3BUiNpTIUBo=; b=x+uJrH/knUS/GHN0x69h23c4guorH/zZA0Si9fIJJrdHg9NBy19XqdrzHhFgudfJxF E71F/QWaF88YNalG1MH4IU24dQNTTGn5Y+LK4Cno0matWWCfFZohpK+CA++m2vs/Sgad uIR/SFeL7/sRqmWNzFpobGDhe0IjIZkHqecreaRxU7vjVCsQI7blCijfDnh6aO6JSWn/ Gskm9sb/3fATzDWZ4hQLrv6JC1yMgMlfvRCLZAEeXKYrUOH/WurXve9gBOp+Jud0g0vF a2QvBiCNfC04JtAF/+SRAvctX92+a4QFR+x3Yag4sEBEnIdjt9EKFjVZhbBQYJvCe4Kg crrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dy22-20020a05640231f600b004c40c7e12f4si10786677edb.125.2023.03.06.01.12.48; Mon, 06 Mar 2023 01:13:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbjCFJJy (ORCPT + 99 others); Mon, 6 Mar 2023 04:09:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjCFJJo (ORCPT ); Mon, 6 Mar 2023 04:09:44 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A0230D3 for ; Mon, 6 Mar 2023 01:09:43 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZ6qV-0006Z1-Aj; Mon, 06 Mar 2023 10:09:27 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pZ6qS-002D7b-5J; Mon, 06 Mar 2023 10:09:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pZ6qR-002coJ-DJ; Mon, 06 Mar 2023 10:09:23 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski , Guenter Roeck Cc: Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org, Christophe JAILLET , Wim Van Sebroeck , linux-watchdog@vger.kernel.org Subject: [PATCH 1/3] watchdog: s3c2410_wdt: Fold s3c2410_get_wdt_drv_data() into only caller Date: Mon, 6 Mar 2023 10:09:17 +0100 Message-Id: <20230306090919.2206871-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306090919.2206871-1-u.kleine-koenig@pengutronix.de> References: <891023d7-9510-445e-9053-ad5c0398d350@roeck-us.net> <20230306090919.2206871-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3200; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=lj5t3wNRO7XsqzB4cma/lRTjY8uSN/9hStGd2iSEk5E=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkBa2zmOGaDQVvRj/gbuA7yEV3QfmYNkBZ3uhry t2L2XShaWeJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZAWtswAKCRDB/BR4rcrs CYmIB/4+5Zobt6Otp1mApAi4z3QQ48GLlCPbQZ+LH6otu4XjU37ivPUZFR//S+wUML8rgJDCirM bPjEZOr9hIvHAotaj7JfGrt90tfoYsQ1AhxdJ97aeqw8JdtWuC8vVtanxF9JwDHvP9hbp4BUV5j RHdA+RhwvxAjbIyM+3h9+L54b4gPV2QOAcniiQjQT3hNY9xNooC5Au9PIYx1gumJ9SfcEouo5Am pkdn8ceEOZMZmNuJCclRILy1Em5uj12UjgzurQ0sNve4+FyYvZgExYf716Vf8GVaOMiID/1RSub pAhPMmLP1Sd4XWjoKB4sRcVtVJHD3mj+YcAJUggY4pu1PWth X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759609085022777001?= X-GMAIL-MSGID: =?utf-8?q?1759609085022777001?= s3c2410_get_wdt_drv_data() is only called by s3c2410wdt_probe(), so the implementation of the former can move to the latter. scripts/bloat-o-meter reports for this change (on an ARCH=arm allmodconfig build): add/remove: 1/1 grow/shrink: 0/2 up/down: 4/-129 (-125) Signed-off-by: Uwe Kleine-König --- drivers/watchdog/s3c2410_wdt.c | 70 +++++++++++++++------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 58b262ca4e88..7382bf038161 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -579,11 +579,27 @@ static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt) return 0; } -static inline const struct s3c2410_wdt_variant * -s3c2410_get_wdt_drv_data(struct platform_device *pdev) +static void s3c2410wdt_wdt_disable_action(void *data) +{ + s3c2410wdt_enable(data, false); +} + +static int s3c2410wdt_probe(struct platform_device *pdev) { - const struct s3c2410_wdt_variant *variant; struct device *dev = &pdev->dev; + const struct s3c2410_wdt_variant *variant; + struct s3c2410_wdt *wdt; + unsigned int wtcon; + int wdt_irq; + int ret; + + wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); + if (!wdt) + return -ENOMEM; + + wdt->dev = dev; + spin_lock_init(&wdt->lock); + wdt->wdt_device = s3c2410_wdd; variant = of_device_get_match_data(dev); if (!variant) { @@ -597,56 +613,30 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev) if (variant == &drv_data_exynos850_cl0 || variant == &drv_data_exynosautov9_cl0) { u32 index; - int err; - err = of_property_read_u32(dev->of_node, + ret = of_property_read_u32(dev->of_node, "samsung,cluster-index", &index); - if (err) { + if (ret) { dev_err(dev, "failed to get cluster index\n"); - return NULL; + return -EINVAL; } switch (index) { case 0: - return variant; + break; case 1: - return (variant == &drv_data_exynos850_cl0) ? - &drv_data_exynos850_cl1 : - &drv_data_exynosautov9_cl1; + if (variant == &drv_data_exynos850_cl0) + variant = &drv_data_exynos850_cl1; + else + variant = &drv_data_exynosautov9_cl1; + break; default: dev_err(dev, "wrong cluster index: %u\n", index); - return NULL; + return -EINVAL; } } #endif - - return variant; -} - -static void s3c2410wdt_wdt_disable_action(void *data) -{ - s3c2410wdt_enable(data, false); -} - -static int s3c2410wdt_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct s3c2410_wdt *wdt; - unsigned int wtcon; - int wdt_irq; - int ret; - - wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); - if (!wdt) - return -ENOMEM; - - wdt->dev = dev; - spin_lock_init(&wdt->lock); - wdt->wdt_device = s3c2410_wdd; - - wdt->drv_data = s3c2410_get_wdt_drv_data(pdev); - if (!wdt->drv_data) - return -EINVAL; + wdt->drv_data = variant; if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) { wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, From patchwork Mon Mar 6 09:09:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 64524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1738233wrd; Mon, 6 Mar 2023 01:17:55 -0800 (PST) X-Google-Smtp-Source: AK7set9swZpD2NAT5nm40fchGzdQULq8FWls9npn+KjAdMILftLb+PCKW/mow/GLkLcmVcDofunE X-Received: by 2002:a17:907:868b:b0:907:9bda:93b9 with SMTP id qa11-20020a170907868b00b009079bda93b9mr14212453ejc.17.1678094275021; Mon, 06 Mar 2023 01:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678094275; cv=none; d=google.com; s=arc-20160816; b=YGDh14jH7cTJQipT0FeIHtxT0/UA0XQEVBlCnjAJPfKi70NSL3/1cH+ePitKaRxMcq gghwGmE6hCkbYn4KQSKeaVT27D+9WMvVwETmSC/Zs6LGMslQmRKhCgcZpMqKbVefW/Bg 4JV/R0BaknqDlgqT69W7gZb5B1d0cfhHnTTbmuKEgN6PuIKNGnyBHTSeejY9dW5FbBrR vM7y+Jvij52X1fkcsqnMPbJ6pj44f6HyDaXvtOhbRdfLICtbngzO3OWuqBAq4sigGOhL CiQNlijcbO0AJKbWtXBpnz8mM483+vPSejJrTbFB0GnIg5ZQ3MDY7cR2/2ZouIV4v3D6 ix7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lUJOHsj4PiOd3l/SeO2AAyrKLOtgpEvMw7TtwElgb8I=; b=O8BqWee7yOsxXctI2Dt6tIzLgojDsu9ulYR/QmZJowB4pPIi7F6FNOcS9w52zd3C2J mxgSJJ0yI58LMajRH6FPxrTfWx6jnSyHwehQ/rvtxRlpo6gMHuMalwxMt4ahzNrwHxsa Fo65MpI9ODuuvlzev/2+QkasuGaa0OydKMJCg3UcETSst1YD4nPOs9EdrqRnapKksJX7 G0BevR5IwJkMVcUVMHUqF6zpF3QvNOc/KhchyGsoDRg5BE3o/yBRmkxSuma26Y6JlVqz LvBElg5KpMrXYm9mWwm2msRUYLSsjtXSZlouDY62++BWXDcCztE7ISbLbISj26uEh2YQ 64aQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3-20020aa7d0c3000000b004ab250bcee6si10490927edo.648.2023.03.06.01.17.31; Mon, 06 Mar 2023 01:17:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229822AbjCFJJ5 (ORCPT + 99 others); Mon, 6 Mar 2023 04:09:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjCFJJo (ORCPT ); Mon, 6 Mar 2023 04:09:44 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E67E1985 for ; Mon, 6 Mar 2023 01:09:43 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZ6qV-0006Z4-Aj; Mon, 06 Mar 2023 10:09:27 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pZ6qS-002D7h-JA; Mon, 06 Mar 2023 10:09:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pZ6qR-002coM-Jt; Mon, 06 Mar 2023 10:09:23 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski , Guenter Roeck Cc: Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org, Christophe JAILLET , Wim Van Sebroeck , linux-watchdog@vger.kernel.org Subject: [PATCH 2/3] watchdog: s3c2410_wdt: Unify error logging format in probe function Date: Mon, 6 Mar 2023 10:09:18 +0100 Message-Id: <20230306090919.2206871-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306090919.2206871-1-u.kleine-koenig@pengutronix.de> References: <891023d7-9510-445e-9053-ad5c0398d350@roeck-us.net> <20230306090919.2206871-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2391; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=0wy6Dy0bHuq9AT7DkIaobmqRGVHmG+KhTNYskb2dtn8=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkBa22JhVhmITJILO59i+so650I69rUMjT4609C q72jCkU8EWJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZAWttgAKCRDB/BR4rcrs CT6CB/oCAJExWw3gqAoAPs4ZmIvkNXaaagqyh+IRMVZZ4hEGJY/VpRTigM6WcMQOLOPlnFMTG83 hPuUzTeccJl04LrUVaUuhtlLeicjaaRyPGsUCdft3UKkofojSpG5sEYU/c89kqcBH8h2Ln0yps2 ZZWLuS9YgoOuME/4z9h7XS5wXqpRITBiI+C93y7lL0KK4LDCjtvA1acBW2yD6l7aK8HdFi556bs HJ7ahmZlgA/SwTyNzibVG1KgsanPUcq5GyYtXZTSHk2Xw6x3xZNeC6tPPb0pwcujuAVcPmpSh5T JlyqZyjPl2sxq9ztB3VRRBYVafF31SVP4XXSNP503EeUC7ig X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759609382116077273?= X-GMAIL-MSGID: =?utf-8?q?1759609382116077273?= In the probe function a mixture of dev_err() and dev_err_probe() is used. Align the format of the error messages when dev_err() is used to that of dev_err_probe() for consistency. Apart from consistency this also mentions the human readable error code. Signed-off-by: Uwe Kleine-König --- drivers/watchdog/s3c2410_wdt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 7382bf038161..93df6ee331a0 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -617,7 +617,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ret = of_property_read_u32(dev->of_node, "samsung,cluster-index", &index); if (ret) { - dev_err(dev, "failed to get cluster index\n"); + dev_err(dev, "error %pe: failed to get cluster index\n", ERR_PTR(-EINVAL)); return -EINVAL; } @@ -631,7 +631,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) variant = &drv_data_exynosautov9_cl1; break; default: - dev_err(dev, "wrong cluster index: %u\n", index); + dev_err(dev, "error %pe: wrong cluster index: %u\n", ERR_PTR(-EINVAL), index); return -EINVAL; } } @@ -642,7 +642,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, "samsung,syscon-phandle"); if (IS_ERR(wdt->pmureg)) { - dev_err(dev, "syscon regmap lookup failed.\n"); + dev_err(dev, "error %pe: syscon regmap lookup failed.\n", wdt->pmureg); return PTR_ERR(wdt->pmureg); } } @@ -686,7 +686,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) dev_warn(dev, "tmr_margin value out of range, default %d used\n", S3C2410_WATCHDOG_DEFAULT_TIME); } else { - dev_err(dev, "failed to use default timeout\n"); + dev_err(dev, "error: %pe: failed to use default timeout\n", ERR_PTR(ret)); return ret; } } @@ -694,7 +694,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0, pdev->name, pdev); if (ret != 0) { - dev_err(dev, "failed to install irq (%d)\n", ret); + dev_err(dev, "error: %pe: failed to install irq\n", ERR_PTR(ret)); return ret; } From patchwork Mon Mar 6 09:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 64522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1736339wrd; Mon, 6 Mar 2023 01:13:02 -0800 (PST) X-Google-Smtp-Source: AK7set+LX8qrxPMNqJ76IFQdHCHHfFus4AJRYRlwGg1xWHWLU7g0RuD4koJlWK11RMF7cOyc758F X-Received: by 2002:a17:907:80e:b0:90b:53f6:fd8b with SMTP id wv14-20020a170907080e00b0090b53f6fd8bmr12830489ejb.31.1678093982592; Mon, 06 Mar 2023 01:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678093982; cv=none; d=google.com; s=arc-20160816; b=m3f0ll1Ta6o8o1ONuTCVLERQM84ytkgLaJIUt2an1ocjzLwgc7q6aDnnyv8vXEPSOO g+w7tEj53ocqXUgHZrd/5XZXBk2igPNhGSFhVwFMWSxPWw685rYBZSrRo/D8wkPGJD4v scYnLfsy31AmKOTjlNXLAEVwtzOAQddfEiMiTxq7AU4ppkDnGXXvsLQ7wCXu+MIPBuJR 9B5wZu8NRiSflUcVzj5PhfNC1+IpUipq5F7BYi8RPdrSUZITAg6UItkSiZrK7Kw6iAcr pBDvpYgkBp1ciO9EuZ3/3L/JAM0JBrtEiBxImziFXTT424saNv22nqPVsjLPmnuKtTGJ /n7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XTU4f7qHABBcJXYpnvuaUm90/ViDSwkGUvI3PCCKY8U=; b=Ry6qIydRGe/dUvLUbjqlShNk+HU2IEJLgtPhHRDd0+1B3Uj+s0dGdql0BZuHAPHWGW CEtCP87ABoKkxx1EarFIjMIIXgBNpPk1aE6Ws3bjZ85+sXQQfEUh/HZ3qMt+TQE7eIIy hMpR1GgGL3KUtqniZj7WJTYYmpApSRqJB2IsX2RbNswb0B3VL5Yn/WKAJ8Rdrjkv4Hcb 7QA3AmIbR8Gm9muWEUBGQFJSFon+6vlPhBsJirUM1SH+Kkfh7yLL9rWEIFXKOGodBlWS K+1fKbzvEL4A/vToG6aMhmkahqUruDvJrfbIbxbohCwjYy3nRripGXz6Yfbnpn7Q7A50 vytA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa5-20020a170906fd8500b008e1cbdcd3ccsi152448ejb.27.2023.03.06.01.12.39; Mon, 06 Mar 2023 01:13:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbjCFJJw (ORCPT + 99 others); Mon, 6 Mar 2023 04:09:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbjCFJJo (ORCPT ); Mon, 6 Mar 2023 04:09:44 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79012D4A for ; Mon, 6 Mar 2023 01:09:42 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZ6qV-0006Z3-Ai; Mon, 06 Mar 2023 10:09:27 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pZ6qS-002D7e-Gd; Mon, 06 Mar 2023 10:09:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pZ6qR-002coP-R6; Mon, 06 Mar 2023 10:09:23 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski , Guenter Roeck Cc: Alim Akhtar , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org, Christophe JAILLET , Wim Van Sebroeck , linux-watchdog@vger.kernel.org Subject: [PATCH 3/3] watchdog: s3c2410_wdt: Simplify using dev_err_probe() Date: Mon, 6 Mar 2023 10:09:19 +0100 Message-Id: <20230306090919.2206871-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306090919.2206871-1-u.kleine-koenig@pengutronix.de> References: <891023d7-9510-445e-9053-ad5c0398d350@roeck-us.net> <20230306090919.2206871-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3168; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=X99umvAVl7VrA7sYL0/YZrxlrH/9RZb/gUEAyYgz4uU=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkBa2651XONejSdHIex1gpZ2WT2RCV+XEY+Xe+J T1AhkqiZr+JATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZAWtugAKCRDB/BR4rcrs CZwTCACEC/Xx8sMzeOS/919McZTmtZCMZTSQZJF8VXu/vJkfazCTqqaJ0cRrzUpgs6oemPxQVTH 3hPG3At3UPxAOGThxdkGKE0uBit4WDpMcYJ1KyGOY6pZBTrdotzHTMj/RBjVIIVM+evpCgdj6/A t5Y7awPlj1F90mJSUUGO8Tk1LfSX+QSV8gSjFDWE0i79jGJRxohsJw214MJroqnATLvgCgsddY1 R17AsqrKGE4oq6B1aXWOiUeaVoztxtoeoEfBrMsF1vW2LXcaJD44Q30ynT0EjbO6pP+CmQQSM8C IJc0ms4m1EndJ+sn5KxC4fc9TSjb7rL22lW9H5k0KtuDvYmu X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759609075922982680?= X-GMAIL-MSGID: =?utf-8?q?1759609075922982680?= Make use of dev_err_probe() also for error paths that don't have to handle -EPROBE_DEFER. While the code handing -EPROBE_DEFER isn't used for these error paths, it still simpler as it cares for pretty printing the error code and usually needs on line less to use as it combines message emitting and error returning. Apart from the reduction of line count, scripts/bloat-o-meter reports for this change (on an ARCH=arm allmodconfig build): add/remove: 1/1 grow/shrink: 1/2 up/down: 32/-144 (-112) Signed-off-by: Uwe Kleine-König --- drivers/watchdog/s3c2410_wdt.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 93df6ee331a0..c3b50266deab 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -616,10 +616,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev) ret = of_property_read_u32(dev->of_node, "samsung,cluster-index", &index); - if (ret) { - dev_err(dev, "error %pe: failed to get cluster index\n", ERR_PTR(-EINVAL)); - return -EINVAL; - } + if (ret) + return dev_err_probe(dev, -EINVAL, "failed to get cluster index\n"); switch (index) { case 0: @@ -631,8 +629,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev) variant = &drv_data_exynosautov9_cl1; break; default: - dev_err(dev, "error %pe: wrong cluster index: %u\n", ERR_PTR(-EINVAL), index); - return -EINVAL; + return dev_err_probe(dev, -EINVAL, "wrong cluster index: %u\n", index); } } #endif @@ -641,10 +638,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev) if (wdt->drv_data->quirks & QUIRKS_HAVE_PMUREG) { wdt->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, "samsung,syscon-phandle"); - if (IS_ERR(wdt->pmureg)) { - dev_err(dev, "error %pe: syscon regmap lookup failed.\n", wdt->pmureg); - return PTR_ERR(wdt->pmureg); - } + if (IS_ERR(wdt->pmureg)) + return dev_err_probe(dev, PTR_ERR(wdt->pmureg), "syscon regmap lookup failed.\n"); } wdt_irq = platform_get_irq(pdev, 0); @@ -682,21 +677,17 @@ static int s3c2410wdt_probe(struct platform_device *pdev) if (ret) { ret = s3c2410wdt_set_heartbeat(&wdt->wdt_device, S3C2410_WATCHDOG_DEFAULT_TIME); - if (ret == 0) { + if (ret == 0) dev_warn(dev, "tmr_margin value out of range, default %d used\n", S3C2410_WATCHDOG_DEFAULT_TIME); - } else { - dev_err(dev, "error: %pe: failed to use default timeout\n", ERR_PTR(ret)); - return ret; - } + else + return dev_err_probe(dev, ret, "failed to use default timeout\n"); } ret = devm_request_irq(dev, wdt_irq, s3c2410wdt_irq, 0, pdev->name, pdev); - if (ret != 0) { - dev_err(dev, "error: %pe: failed to install irq\n", ERR_PTR(ret)); - return ret; - } + if (ret != 0) + return dev_err_probe(dev, ret, "failed to install irq\n"); watchdog_set_nowayout(&wdt->wdt_device, nowayout); watchdog_set_restart_priority(&wdt->wdt_device, 128);