Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp183410imu; Fri, 25 Jan 2019 00:04:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN5j5mUrnvhNbN3MWNQ1lGD4rsKtUFhZHYrPgZSXvHf6ihH6jntosN+SC2+K7gBJhzWLKWrN X-Received: by 2002:a62:4e83:: with SMTP id c125mr10063590pfb.101.1548403497284; Fri, 25 Jan 2019 00:04:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548403497; cv=none; d=google.com; s=arc-20160816; b=HP9b6vNeMu7ahg2q+u8AoIvK2afqQzhaw2pDhbTLIWgAs4jWQXw6ElbV8uic04jHyb 56RwO9iEN1t1nACyfK2cpGHBvrx1ExWYueXE8KvjICohaz9OEldPTT77Ipi39dpXiDla U2IDhVULHQ9mW1d8JtZMJf5ndJxKtOg0qEbMPa61CPhtgo522bV2SmgzDaVzsQWwtCbY B5Cqjd7IVzkuf5OooQsoQNXPP1LNl0RsQm9jdymzJGVZbxy+xxpm//3AKVth+aTuY2SE 5jY1M/o1O8ReyxKuaT1aT8nE/rdLSoRxv4wnh4d5E048M21iUheP4jiKaa5MyXo6xEcd bf0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=OGEFOw2yL2kgWYOCZc4tobG/RbEgTa2Gvcucx/p5Aiw=; b=Qk3d8FJjs0za5vWyq/r6LIHB4wXh/juQ4dpyKp+ZvHPHvXVFzD5dwvnzrGZht+Posn wtKq8Mg/fc3RVZbhiumcxMl52twUrI/ncvRatiyUIaP8/9EDE6OBlmPMftkEI3b1kQsP eJZkaLp6Mv0vCQ1k/aqcHqlsR/I1CmL1JeXCFHaiurulbknjsUARFGgpCd/AwFGz3J5d iXR3lhHzjMKzMdrynhW29TEbOJLYfGL0nDuu2tc3BZFVE1bOgEtrgcye1TanfVPCUNMO /pbEoGindgFORIGs8YDwRNrmJKUYAXTxx+t0feV5ytE6Y8stsNQjOyOqsknuL7gAW5eA dBMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=UgRwnpLc; 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 u129si23677441pfu.117.2019.01.25.00.04.42; Fri, 25 Jan 2019 00:04:57 -0800 (PST) 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=UgRwnpLc; 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 S1726926AbfAYIEa (ORCPT + 99 others); Fri, 25 Jan 2019 03:04:30 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41890 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbfAYIE3 (ORCPT ); Fri, 25 Jan 2019 03:04:29 -0500 Received: by mail-pf1-f193.google.com with SMTP id b7so4382153pfi.8; Fri, 25 Jan 2019 00:04:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OGEFOw2yL2kgWYOCZc4tobG/RbEgTa2Gvcucx/p5Aiw=; b=UgRwnpLcVdpL26gAfu5IP3OhhtCMiuEmDDHtVL2wVPJruXOHMjea2j7FU2coRoSuLA A6inDwMjns6StM5ff/J7r8iTIql+J+71WrTi+Dj62bKPl9s8pQd3Tv5jJ4/zb202Hg78 17kESxDeuzmOGXH0JDNecBU5rdDtvgi81fskjo9+lRMB7YjtxO/g8zooPpA7eYoi6s2H 6a3S+eNDZZZrZivqbJJcIbQ1eHQYIWwMyZFqj7PpO0izuROs1U+oH8L2XHdc/X1BlMLM iwhLBa7/q5hqTkRgjPn1rxD5+ZKrJSKL+XBvEJg7rqiXzNboExSFE+ematFrrefwftQc Q7qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OGEFOw2yL2kgWYOCZc4tobG/RbEgTa2Gvcucx/p5Aiw=; b=Ezr5NZXspYnzxAUZbvpw2sK8VM7TpmZUkM+LEAq9k8RnW1uEGKrQ7vlXUIe+qrBuAV +fS5jsNronKDTVLpmPjV5ERxvMa/pQ9MEk0aJqclEC1ssTWgoIY/aUENAput1UkAr1Xo TGkJJSWNzznwyr1Pdpa67ngPIyC3cWd6B1AhqkIiSDm+6Z+RSjWuKexDTZOMUt5Sb9XM lUnPrLgbw8QqgDG/OBLD3a4BsbBdlX/pIxBYFfXnBTxwpyiwH7omR+DhunP3AXPWeT56 ayr4Bhx8h8ddT0EJ7LxgZw0tJcgm1NPgU4wuXoZAqMkcbFKTgtmXFOgwS37c6g5jz/oX NoIg== X-Gm-Message-State: AJcUukc3OX8IGTFJ0/HZkAyjPnQSwWQOrpmR8QJ/0mkVAXt6hzZeC4Zt K3GqMhv0tAiO3sapp7BmkdDYepIu X-Received: by 2002:a63:4384:: with SMTP id q126mr8955512pga.160.1548403468624; Fri, 25 Jan 2019 00:04:28 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id s2sm46694651pfa.167.2019.01.25.00.04.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Jan 2019 00:04:27 -0800 (PST) Subject: Re: [PATCH] watchdog: dw: use devm_watchdog_register_device() To: Jisheng Zhang , Wim Van Sebroeck Cc: "linux-watchdog@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20190125154604.66801c6a@xhacker.debian> From: Guenter Roeck Message-ID: Date: Fri, 25 Jan 2019 00:04:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190125154604.66801c6a@xhacker.debian> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 1/24/19 11:52 PM, Jisheng Zhang wrote: > Use devm_watchdog_register_device() to simplify the code. > > Signed-off-by: Jisheng Zhang > --- > drivers/watchdog/dw_wdt.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c > index 501aebb5b81f..c053c2de5c2f 100644 > --- a/drivers/watchdog/dw_wdt.c > +++ b/drivers/watchdog/dw_wdt.c > @@ -303,7 +303,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) > > watchdog_set_restart_priority(wdd, 128); > > - ret = watchdog_register_device(wdd); > + ret = devm_watchdog_register_device(wdd); > if (ret) > goto out_disable_clk; > > @@ -318,7 +318,6 @@ static int dw_wdt_drv_remove(struct platform_device *pdev) > { > struct dw_wdt *dw_wdt = platform_get_drvdata(pdev); > > - watchdog_unregister_device(&dw_wdt->wdd); > reset_control_assert(dw_wdt->rst); > clk_disable_unprepare(dw_wdt->clk); > > Unfortunately it isn't that easy. The other two calls have to be executed after unregistering the watchdog, meaning you would have to add devm_add_action() in the probe function to call them. Guenter