Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5120645yba; Wed, 10 Apr 2019 11:47:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzd+85A1dNpoQmtt2yX29vnuERh56xMXamDULenWyiEMD0bfdxZgjiv36Gc98FCqCN4FOpd X-Received: by 2002:a62:571b:: with SMTP id l27mr45258919pfb.195.1554922046849; Wed, 10 Apr 2019 11:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554922046; cv=none; d=google.com; s=arc-20160816; b=Qjo/wP5sHH1LGvzdefzrTTmpH8erybl+/SL0KTAxO1+fxYWLClEHAXRSwvLvHKeMpp AN8wg8HqUA8OrM2T33JiiSPcHW5CBErby4nE1JuU6+KPvyJQeTyQjiFvCgaSQvPa/d43 pmZh6dfK/lfC+rcoOcu6QlsiwGsGpdWKz+c5WCO8VjpAtv3eU8WWRXe5/SHGn28fkCAP BL0PkxHLmRDwmQYix+UHo9EKHjZflL4NQS/47rRcMuNmfZ+BU0khUE5GKr9Jg9+4QghC LRmeJjc8+X1XwaN3Y4WkGW0W+NcuYkj9FEF2C674FOv1jn5YADhcYZVBmoWbhgsmhS4U 917A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=A8S7XSTI64ZGz7QExfklYyYSF03nx6KnqMOGBDym5s0=; b=mZsNBHaIiD9Hes5iVfnEZNXLDTs2+ZVdDr1n8SOaXGOMtWUJjR7zyPpNi4FJu8a+4T hFR8DMF9bZ1PYXLT9YnJ6CWTEv3mYGpV4i1vEkzhGbwsvs1D+HE+BHvzyvj7gb2loORd LcBtZ+zBN5leCdWyaoYJxxC3IVqMNrq253wkQ30iTKf+6652VpSnPVuHLQQHNhZP3AI/ P6Ae2BX+ODubu/BRxyZ9+XnqsIvYgKnVE0NFNNeL567lC9tm/hD64SfWsXS5VJNprN9k mK/2oiJ9213iJxtrT4pqMmH9h0VsB0vhhRGj+4uiGLU1QxuEhHoEheAzkr+adNbAY3jS gW8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JMQnMd0j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si32123207pfa.129.2019.04.10.11.47.10; Wed, 10 Apr 2019 11:47:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JMQnMd0j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732553AbfDJQ3l (ORCPT + 99 others); Wed, 10 Apr 2019 12:29:41 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42694 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387862AbfDJQ2Y (ORCPT ); Wed, 10 Apr 2019 12:28:24 -0400 Received: by mail-pl1-f194.google.com with SMTP id cv12so1733478plb.9; Wed, 10 Apr 2019 09:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=A8S7XSTI64ZGz7QExfklYyYSF03nx6KnqMOGBDym5s0=; b=JMQnMd0jgU/sfz3TH4kN8lc9efu1s4ojoJzK+hZapgzO2uNoLa5R5REyfo4/pbWIqo 3Bg98SiLvffA66jqYCDMEU5aLqPfWWYqgEQ2uiIzXVk0LDYLG08dm0L9arn3fGFtrnlb jIxov/WJdunwemW/Vh17ayT8aXISK7Ama6IzcmKK0Jz8J7Y4009uFj7/5xm/5C+EBAr3 5xf2o9fhpMbVlEbIwZxP0WM+fh0kIlC7m0EClSDHEqSOk6RJSqOmWZ0/syjq2gNPrmsD uay8TT93oUnfBH6xccDFckp/yDHZAS8qT1DMEfvwRBu6YSvlRC9HZ7gxxI+BVKmyb6IS GUYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=A8S7XSTI64ZGz7QExfklYyYSF03nx6KnqMOGBDym5s0=; b=CJzMOYwRK6pnr7+5UDvUbMEbROY+1rq/5oBNvVaw71ewamMcoX6okaqtwmkjiolQ2N x/QG17FZOPC156PS6gPnIbQEU5XbqoIKOul5czgFXOMAtIrGmTVNuZ7k/Iq3Jmdx7qXp lgCwHT7Xm31CiKSyGjbLKQK6T7yamH3Uj/dBcRlUsylz1NYzwjw4x/vi2jeUyfO2f0Zx feyIEpEsBWZPch+qfxPDqrQZSW7mEP9bOEnWrnbq7yldb8lXi8OKWu6LYz1SlReKzxWI K2DKTTc/g6qdhPuqWMg2tj+00FClnqzA7RD4DBWvTRlsVt3Wlvvh6YhfQrQshE3On1x3 Ef9g== X-Gm-Message-State: APjAAAWUKRAabe9crOMZDETJo9p6FPyybNRDz96gfIE+ztRG8T2Fgvha sDTWrBHQXYi29ePGvTZAsoY= X-Received: by 2002:a17:902:da4:: with SMTP id 33mr13142734plv.20.1554913703373; Wed, 10 Apr 2019 09:28:23 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id f71sm51876276pfc.109.2019.04.10.09.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 09:28:22 -0700 (PDT) From: Guenter Roeck To: Wim Van Sebroeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH 11/22] watchdog: sbsa_gwdt: Convert to use device managed functions and other improvements Date: Wed, 10 Apr 2019 09:27:52 -0700 Message-Id: <1554913683-25454-12-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554913683-25454-1-git-send-email-linux@roeck-us.net> References: <1554913683-25454-1-git-send-email-linux@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use device managed functions to simplify error handling, reduce source code size, improve readability, and reduce the likelyhood of bugs. Other improvements as listed below. The conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches - Drop assignments to otherwise unused variables - Drop empty remove function - Use local variable 'struct device *dev' consistently - Use devm_watchdog_register_driver() to register watchdog device - Replace shutdown function with call to watchdog_stop_on_reboot() Signed-off-by: Guenter Roeck --- drivers/watchdog/sbsa_gwdt.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c index 68aff828bf7e..e17af8939c93 100644 --- a/drivers/watchdog/sbsa_gwdt.c +++ b/drivers/watchdog/sbsa_gwdt.c @@ -310,7 +310,8 @@ static int sbsa_gwdt_probe(struct platform_device *pdev) */ sbsa_gwdt_set_timeout(wdd, wdd->timeout); - ret = watchdog_register_device(wdd); + watchdog_stop_on_reboot(wdd); + ret = devm_watchdog_register_device(dev, wdd); if (ret) return ret; @@ -321,22 +322,6 @@ static int sbsa_gwdt_probe(struct platform_device *pdev) return 0; } -static void sbsa_gwdt_shutdown(struct platform_device *pdev) -{ - struct sbsa_gwdt *gwdt = platform_get_drvdata(pdev); - - sbsa_gwdt_stop(&gwdt->wdd); -} - -static int sbsa_gwdt_remove(struct platform_device *pdev) -{ - struct sbsa_gwdt *gwdt = platform_get_drvdata(pdev); - - watchdog_unregister_device(&gwdt->wdd); - - return 0; -} - /* Disable watchdog if it is active during suspend */ static int __maybe_unused sbsa_gwdt_suspend(struct device *dev) { @@ -382,8 +367,6 @@ static struct platform_driver sbsa_gwdt_driver = { .of_match_table = sbsa_gwdt_of_match, }, .probe = sbsa_gwdt_probe, - .remove = sbsa_gwdt_remove, - .shutdown = sbsa_gwdt_shutdown, .id_table = sbsa_gwdt_pdev_match, }; -- 2.7.4