Message ID | 20230306170901.2232323-4-u.kleine-koenig@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1968938wrd; Mon, 6 Mar 2023 09:23:28 -0800 (PST) X-Google-Smtp-Source: AK7set9q0eORFb7oYkyNl93rD3WzHCs0C+Quh75eYGx2rUpIPpKV4hkjjJAQ8Tsl2rsKMIlCJug0 X-Received: by 2002:a17:902:ce91:b0:19d:1dfe:eac8 with SMTP id f17-20020a170902ce9100b0019d1dfeeac8mr16601136plg.26.1678123408417; Mon, 06 Mar 2023 09:23:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678123408; cv=none; d=google.com; s=arc-20160816; b=dkmGR/2M6GY3ypMzjLgXKD25yCA6GmRr+ubXHM7J9i521Nrtq5DzfLt21k7Uivplic B34qDHt9RB4AgKDtlECPW8VOxlTwZ7XYO1AzNXBbpVfRKxW8dTd/RqXEMTNB7ZiRRIsJ naKnKykMs19vqTM682ZkitYfr35yTLirzyg3i+OANwX39VhG0xdXXT6JNpfnXEqWZw2Y iyAfmJlsGVorSfDqV5cbI/Z/sFHQ6C/GzXDTeAibStQGaciKXmdt58pAX1eHPKMxjH7K B3W76EStEigSB2xKG4TmaPMBLqlbN1Mytb704A9TkVxbUcPbfNNNmVbp9Ep/Zdr3nT4W pgLw== 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=tWm1MZSFNzjwPJEebdPuMhLYXka6DfEhnCSA8C6q/+U=; b=xhWXduWsyNNYLDGqolzx1b02nSCE05Ua5kgTQT/xV4fv/DEl3TpF7a85xrN2XMd7/0 6NzRF4QHLkO6e+ir/afB/JjXLmCTCuONDhkPdACGVO7sZO/Wbt1rl07Tp9AiF73Fge7r nSTk87COs1zN29tKoG+SOkuf2bCSe2axpYLvj4naKNw/Y/gPePFmBHjDAZn1oHbWSdR9 X+AXgAJdRMQ6jM32NvYi+MU1+QEN0n9YkUMB8AMVq16zKTigo9XX33pQTVY7vuEqGAwA pbEG1UOCwwoHpn2zxdcLB9lcr5Vj00oOxQ7Y89g9HKIbTReQUuuhIFafMLQGJL9VE6uT 3BZQ== 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 s18-20020a17090302d200b0019aba699d56si10651635plk.608.2023.03.06.09.23.13; Mon, 06 Mar 2023 09:23:28 -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 S229996AbjCFRKv (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Mon, 6 Mar 2023 12:10:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjCFRKl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 6 Mar 2023 12:10:41 -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 8E53C410BA for <linux-kernel@vger.kernel.org>; Mon, 6 Mar 2023 09:10:01 -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 <ukl@pengutronix.de>) id 1pZEKi-0004gr-Cu; Mon, 06 Mar 2023 18:09:08 +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 <ukl@pengutronix.de>) id 1pZEKh-002Ifd-Oe; Mon, 06 Mar 2023 18:09:07 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from <ukl@pengutronix.de>) id 1pZEKg-002l03-KK; Mon, 06 Mar 2023 18:09:06 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> To: Wim Van Sebroeck <wim@linux-watchdog.org>, Guenter Roeck <linux@roeck-us.net> Cc: patches@opensource.cirrus.com, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 3/3] watchdog: wm8350: Simplify using devm_watchdog_register_device() Date: Mon, 6 Mar 2023 18:09:01 +0100 Message-Id: <20230306170901.2232323-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230306170901.2232323-1-u.kleine-koenig@pengutronix.de> References: <20230306170901.2232323-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1112; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=eKbSbgyM6iAAADJRyccERsxfhL/Xxs4zw+WOxJ+10fo=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkBh4nWsFYVrBiPkosnDl6xkGrWr/JqNqSvfocp dlwibEG0iOJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZAYeJwAKCRDB/BR4rcrs CVhHCACHQhP0vt3MEa1XkSByGKFVe9hQ7w8a1xgKHQIvYp4Zbaq0qPwWSu/xd5aUGZ0jpKAey3O CFUR3rcQ6MDlCM8AbyXa+iNtxScjzIdiigono4GKYkmZmnQqt0YJOdrDMv+TSVYituJEzxT+rZL q7hYdLPtsEuAXHdbueH35QYZpGzXhWalHRNt3PeuvJS1Oj8jDuTMNxykliSwUeqGPfuYW5czzWx EhVHBBgQjuyPU8q/wgjrB+/lJ8vks54vZbXPj0k6bjWGNMWCJrx0bYo5Bjq3sg+9yveQhgBzSuB Gi0IoKbFD5ZQJdWN2MShy2NnaZxZErerPUeEGBnEWhaj0P53 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759639931142196758?= X-GMAIL-MSGID: =?utf-8?q?1759639931142196758?= |
Series |
watchdog: Simplify using devm_watchdog_register_device()
|
|
Commit Message
Uwe Kleine-König
March 6, 2023, 5:09 p.m. UTC
This allows to drop the .remove() function as it only exists to
unregister the watchdog device which is now done in a callback
registered by devm_watchdog_register_device().
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/watchdog/wm8350_wdt.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
Comments
On Mon, Mar 06, 2023 at 06:09:01PM +0100, Uwe Kleine-König wrote: > This allows to drop the .remove() function as it only exists to > unregister the watchdog device which is now done in a callback > registered by devm_watchdog_register_device(). > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/watchdog/wm8350_wdt.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c > index 33c62d51f00a..911ad64460a6 100644 > --- a/drivers/watchdog/wm8350_wdt.c > +++ b/drivers/watchdog/wm8350_wdt.c > @@ -153,18 +153,11 @@ static int wm8350_wdt_probe(struct platform_device *pdev) > /* Default to 4s timeout */ > wm8350_wdt_set_timeout(&wm8350_wdt, 4); > > - return watchdog_register_device(&wm8350_wdt); > -} > - > -static int wm8350_wdt_remove(struct platform_device *pdev) > -{ > - watchdog_unregister_device(&wm8350_wdt); > - return 0; > + return devm_watchdog_register_device(&wm8350_wdt); > } > > static struct platform_driver wm8350_wdt_driver = { > .probe = wm8350_wdt_probe, > - .remove = wm8350_wdt_remove, > .driver = { > .name = "wm8350-wdt", > }, > -- > 2.39.1 >
Hi Uwe, I love your patch! Yet something to improve: [auto build test ERROR on fe15c26ee26efa11741a7b632e9f23b01aca4cc6] url: https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/watchdog-bcm47xx-Simplify-using-devm_watchdog_register_device/20230307-011628 base: fe15c26ee26efa11741a7b632e9f23b01aca4cc6 patch link: https://lore.kernel.org/r/20230306170901.2232323-4-u.kleine-koenig%40pengutronix.de patch subject: [PATCH 3/3] watchdog: wm8350: Simplify using devm_watchdog_register_device() config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20230307/202303070325.74bkgnG6-lkp@intel.com/config) compiler: ia64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/94594fa75b3515d5dbff3ec2d1db1cf5627900b1 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Uwe-Kleine-K-nig/watchdog-bcm47xx-Simplify-using-devm_watchdog_register_device/20230307-011628 git checkout 94594fa75b3515d5dbff3ec2d1db1cf5627900b1 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303070325.74bkgnG6-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/watchdog/wm8350_wdt.c: In function 'wm8350_wdt_probe': >> drivers/watchdog/wm8350_wdt.c:156:46: error: passing argument 1 of 'devm_watchdog_register_device' from incompatible pointer type [-Werror=incompatible-pointer-types] 156 | return devm_watchdog_register_device(&wm8350_wdt); | ^~~~~~~~~~~ | | | struct watchdog_device * In file included from drivers/watchdog/wm8350_wdt.c:15: include/linux/watchdog.h:226:50: note: expected 'struct device *' but argument is of type 'struct watchdog_device *' 226 | int devm_watchdog_register_device(struct device *dev, struct watchdog_device *); | ~~~~~~~~~~~~~~~^~~ >> drivers/watchdog/wm8350_wdt.c:156:16: error: too few arguments to function 'devm_watchdog_register_device' 156 | return devm_watchdog_register_device(&wm8350_wdt); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/watchdog.h:226:5: note: declared here 226 | int devm_watchdog_register_device(struct device *dev, struct watchdog_device *); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/watchdog/wm8350_wdt.c:157:1: error: control reaches end of non-void function [-Werror=return-type] 157 | } | ^ cc1: some warnings being treated as errors vim +/devm_watchdog_register_device +156 drivers/watchdog/wm8350_wdt.c 139 140 static int wm8350_wdt_probe(struct platform_device *pdev) 141 { 142 struct wm8350 *wm8350 = platform_get_drvdata(pdev); 143 144 if (!wm8350) { 145 pr_err("No driver data supplied\n"); 146 return -ENODEV; 147 } 148 149 watchdog_set_nowayout(&wm8350_wdt, nowayout); 150 watchdog_set_drvdata(&wm8350_wdt, wm8350); 151 wm8350_wdt.parent = &pdev->dev; 152 153 /* Default to 4s timeout */ 154 wm8350_wdt_set_timeout(&wm8350_wdt, 4); 155 > 156 return devm_watchdog_register_device(&wm8350_wdt); 157 } 158
diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c index 33c62d51f00a..911ad64460a6 100644 --- a/drivers/watchdog/wm8350_wdt.c +++ b/drivers/watchdog/wm8350_wdt.c @@ -153,18 +153,11 @@ static int wm8350_wdt_probe(struct platform_device *pdev) /* Default to 4s timeout */ wm8350_wdt_set_timeout(&wm8350_wdt, 4); - return watchdog_register_device(&wm8350_wdt); -} - -static int wm8350_wdt_remove(struct platform_device *pdev) -{ - watchdog_unregister_device(&wm8350_wdt); - return 0; + return devm_watchdog_register_device(&wm8350_wdt); } static struct platform_driver wm8350_wdt_driver = { .probe = wm8350_wdt_probe, - .remove = wm8350_wdt_remove, .driver = { .name = "wm8350-wdt", },