Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751057AbdL3QIJ (ORCPT ); Sat, 30 Dec 2017 11:08:09 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:35430 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750806AbdL3QII (ORCPT ); Sat, 30 Dec 2017 11:08:08 -0500 X-Google-Smtp-Source: ACJfBotFeTQi4Oe0DJuGbMX2BcceaxN7gkAubtrqy0+s7Ic3Q4mcxc40QjMXlGnKCgtyes9dMyuPlg== Subject: Re: [PATCH v2 2/8] watchdog: jz4740: Use devm_* functions To: Paul Cercueil , Ralf Baechle , Rob Herring , Mark Rutland , Wim Van Sebroeck Cc: devicetree@vger.kernel.org, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org References: <20171228162939.3928-2-paul@crapouillou.net> <20171230135108.6834-1-paul@crapouillou.net> <20171230135108.6834-2-paul@crapouillou.net> From: Guenter Roeck Message-ID: Date: Sat, 30 Dec 2017 08:08:04 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171230135108.6834-2-paul@crapouillou.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2029 Lines: 68 On 12/30/2017 05:51 AM, Paul Cercueil wrote: > - Use devm_clk_get instead of clk_get > - Use devm_watchdog_register_device instead of watchdog_register_device > > Signed-off-by: Paul Cercueil Reviewed-by: Guenter Roeck > --- > drivers/watchdog/jz4740_wdt.c | 27 ++++++++------------------- > 1 file changed, 8 insertions(+), 19 deletions(-) > > v2: No change > > diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c > index 6955deb100ef..92d6ca8ceb49 100644 > --- a/drivers/watchdog/jz4740_wdt.c > +++ b/drivers/watchdog/jz4740_wdt.c > @@ -178,40 +178,29 @@ static int jz4740_wdt_probe(struct platform_device *pdev) > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > drvdata->base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(drvdata->base)) { > - ret = PTR_ERR(drvdata->base); > - goto err_out; > - } > + if (IS_ERR(drvdata->base)) > + return PTR_ERR(drvdata->base); > > - drvdata->rtc_clk = clk_get(&pdev->dev, "rtc"); > + drvdata->rtc_clk = devm_clk_get(&pdev->dev, "rtc"); > if (IS_ERR(drvdata->rtc_clk)) { > dev_err(&pdev->dev, "cannot find RTC clock\n"); > - ret = PTR_ERR(drvdata->rtc_clk); > - goto err_out; > + return PTR_ERR(drvdata->rtc_clk); > } > > - ret = watchdog_register_device(&drvdata->wdt); > + ret = devm_watchdog_register_device(&pdev->dev, &drvdata->wdt); > if (ret < 0) > - goto err_disable_clk; > + return ret; > > platform_set_drvdata(pdev, drvdata); > - return 0; > > -err_disable_clk: > - clk_put(drvdata->rtc_clk); > -err_out: > - return ret; > + return 0; > } > > static int jz4740_wdt_remove(struct platform_device *pdev) > { > struct jz4740_wdt_drvdata *drvdata = platform_get_drvdata(pdev); > > - jz4740_wdt_stop(&drvdata->wdt); > - watchdog_unregister_device(&drvdata->wdt); > - clk_put(drvdata->rtc_clk); > - > - return 0; > + return jz4740_wdt_stop(&drvdata->wdt); > } > > static struct platform_driver jz4740_wdt_driver = { >