Received: by 10.192.165.148 with SMTP id m20csp1509375imm; Thu, 10 May 2018 11:50:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqvURkVLn1nK56RqvjpVwajACZGcwAAwsKQr9+TAkam8A1DMADnZILPBeJOHUwWa+Q5yJeG X-Received: by 2002:a63:31d8:: with SMTP id x207-v6mr1964661pgx.411.1525978225954; Thu, 10 May 2018 11:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525978225; cv=none; d=google.com; s=arc-20160816; b=OBw9o8pNIcHnxW+Ff6FCExW8CscapqxTU5nQFfFZ+a4+IWBtab5MO/5MFrtYX/+lE4 u1w8o1+RrRsVrzBpO3Hu/0lgmCZyvtPCMdf7b2Nwrfxgc27Rz6jLFqVk+4PlR1StahRd tzSaqKvi1vSdLGYqo0GmOxnymyAebNnMrmk3vKqSgp9PhpPHAxF+viE6877FZZRLkj+/ 7pCm5XN1v8dnluj9HP42bu+UNgOkgyM/TPeA0smfC9lcqoftKv+jgaSoDIh4rk9sy80Z bGI8VLwxxL+iYjSzBG3d/Q4Uv8YjG4LYFFRa+i49H0Iy2Wc398xzElcuSbHawXD3Yg3F /+CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=8xXCaiRNDP+P3/CZyI9c4njG3fKiPV+IwArAm1cAa9Q=; b=FZYKZFP+B96iIdFwwNkXRySJ0UvsnEma/+VZsD3+NZfG12VeQtz6piHDXvoemYOaCN Mc31JoKQmNAqXmcDRW4ZNlsyady8CAbxDfCc3Ybf8xCl4mR45FBPf29I5p+G74cEfwif y4JrPUcqNgSZ/L6EEQl4BzPx5Udm0fV4Wopj0smPWoqKO5icur9bFTKoGmp63u0NM1se x5kvzmtQZsv/1q6U8sydcwBORmo4QxBrXwkIVwK+O/OCcJQzA/AEAxRRNN++avyweqmm Zd0PFf9YdfS/7IGWSy6uFWmlg/a3jnsIXQthzk3PaIHDTrKgYD6jbXYNgmPvrOailW2t ZHaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=aF9Y4yrB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o67-v6si1120344pga.149.2018.05.10.11.50.11; Thu, 10 May 2018 11:50:25 -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=pass header.i=@crapouillou.net header.s=mail header.b=aF9Y4yrB; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751903AbeEJSsU (ORCPT + 99 others); Thu, 10 May 2018 14:48:20 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:55294 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbeEJSsR (ORCPT ); Thu, 10 May 2018 14:48:17 -0400 From: Paul Cercueil To: Guenter Roeck , Rob Herring , Mark Rutland , Ralf Baechle , James Hogan Cc: Wim Van Sebroeck , Mathieu Malaterre , linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Paul Cercueil Subject: [PATCH v3 2/8] watchdog: jz4740: Use devm_* functions Date: Thu, 10 May 2018 20:47:45 +0200 Message-Id: <20180510184751.13416-2-paul@crapouillou.net> In-Reply-To: <20180510184751.13416-1-paul@crapouillou.net> References: <20180510184751.13416-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1525978095; bh=8xXCaiRNDP+P3/CZyI9c4njG3fKiPV+IwArAm1cAa9Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=aF9Y4yrBrIaNsFKZp5fqULF9ccWYnVvaxE/MpjerIbp1CVExR/0b2t0bt0yrR8vImkAXM9vIsBibJ0CIUSlVXJonP7DoPbBDifRHauUhh2vXAjzf4kDLXodL6oClT1IJEVkAuyVib9lVKMRVRDFNm561YkTALeeb9697wPRSHUk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - 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 v3: No change diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index 55c9a1f26498..22136e3522b9 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c @@ -179,40 +179,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 = { -- 2.11.0