From patchwork Mon Mar 11 19:30:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laxman Dewangan X-Patchwork-Id: 226661 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-vb0-x23f.google.com (mail-vb0-x23f.google.com [IPv6:2607:f8b0:400c:c02::23f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 4715C2C03D3 for ; Tue, 12 Mar 2013 06:32:51 +1100 (EST) Received: by mail-vb0-f63.google.com with SMTP id l22sf1571531vbn.28 for ; Mon, 11 Mar 2013 12:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-received:x-beenthere:x-received:received-spf:x-pgp-universal:from :to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-google-group-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=cFY27sF69ScatZ5W+D3qeM8XK51OfcGqLp2Zlf8GgN4=; b=svWAjf4VQZ6E3SdNMOuC6H2ijt0PX0EVH7c/wiVFDFA8hzdLqwDr2GWmCwU1NnPmlP 7LRwmzoJsDaTZ7uFGRooWrPUozSSKqK0YzLxJzu1NjDBcaL9vFhPhP51BAyLHHWnQ5Ho WhC8KkWzVX61dffudfYJGl9SceWvT4nxMGLtQtjHTlu09Jfurgwi8YTxU8XB1O+yyTHT DX5qvDxMQgeX311BZ3DLKrdEWcq7kjkbVFVXRHMHTUU/Cx47oi13ZIYbWHaiZx/Dzw2t oTdP7wDIRr1ojoFcHyNJRCyItSwpyMxoWKadPDqOLtTMaFzBt1HXr9esxdSGzJVxe3Fr HgGQ== X-Received: by 10.49.120.105 with SMTP id lb9mr329386qeb.17.1363030368468; Mon, 11 Mar 2013 12:32:48 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.49.86.36 with SMTP id m4ls1122966qez.41.gmail; Mon, 11 Mar 2013 12:32:48 -0700 (PDT) X-Received: by 10.58.6.196 with SMTP id d4mr3513942vea.8.1363030368029; Mon, 11 Mar 2013 12:32:48 -0700 (PDT) Received: from hqemgate03.nvidia.com (hqemgate03.nvidia.com. [216.228.121.140]) by gmr-mx.google.com with ESMTPS id bl2si1088040vdb.3.2013.03.11.12.32.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 Mar 2013 12:32:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of ldewangan@nvidia.com designates 216.228.121.140 as permitted sender) client-ip=216.228.121.140; Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate03.nvidia.com id ; Mon, 11 Mar 2013 12:37:24 -0700 Received: from hqemhub03.nvidia.com ([172.17.108.22]) by hqnvupgp07.nvidia.com (PGP Universal service); Mon, 11 Mar 2013 12:32:13 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 11 Mar 2013 12:32:13 -0700 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQEMHUB03.nvidia.com (172.20.150.15) with Microsoft SMTP Server id 8.3.298.1; Mon, 11 Mar 2013 12:32:13 -0700 Received: from daphne.nvidia.com (Not Verified[172.16.212.96]) by hqnvemgw01.nvidia.com with MailMarshal (v7,1,2,5326) id ; Mon, 11 Mar 2013 12:32:13 -0700 Received: from ldewangan-ubuntu.nvidia.com ([10.19.65.30]) by daphne.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id r2BJVsML017824; Mon, 11 Mar 2013 12:32:10 -0700 (PDT) From: Laxman Dewangan To: , CC: , , , , , Laxman Dewangan Subject: [rtc-linux] [PATCH V3 5/5] rtc: tegra: use managed rtc_device_register Date: Tue, 12 Mar 2013 01:00:01 +0530 Message-ID: <1363030201-14717-6-git-send-email-ldewangan@nvidia.com> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: <1363030201-14717-1-git-send-email-ldewangan@nvidia.com> References: <1363030201-14717-1-git-send-email-ldewangan@nvidia.com> MIME-Version: 1.0 X-Original-Sender: ldewangan@nvidia.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of ldewangan@nvidia.com designates 216.228.121.140 as permitted sender) smtp.mail=ldewangan@nvidia.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Use devm_rtc_device_register for registering RTC device. This will reduce the code for unregistering RTC device in cleanup path and remove the implementation of remove callback of platform driver. Signed-off-by: Laxman Dewangan Reviewed-by: Thierry Reding Reviewed-by: Stephen Warren --- Changes from V1: - Formatting the code. - Add Thierry's reviewed by. Changes from V2: - Add Stephen's reviewed by. - No change in code. drivers/rtc/rtc-tegra.c | 27 ++++----------------------- 1 files changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index e9f0d53..7cb3da0 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c @@ -349,13 +349,11 @@ static int __init tegra_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); - info->rtc_dev = rtc_device_register( - pdev->name, &pdev->dev, &tegra_rtc_ops, THIS_MODULE); + info->rtc_dev = devm_rtc_device_register(dev_name(&pdev->dev), + &pdev->dev, &tegra_rtc_ops, THIS_MODULE); if (IS_ERR(info->rtc_dev)) { ret = PTR_ERR(info->rtc_dev); - info->rtc_dev = NULL; - dev_err(&pdev->dev, - "Unable to register device (err=%d).\n", + dev_err(&pdev->dev, "Unable to register device (err=%d).\n", ret); return ret; } @@ -367,28 +365,12 @@ static int __init tegra_rtc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Unable to request interrupt for device (err=%d).\n", ret); - goto err_dev_unreg; + return ret; } dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n"); return 0; - -err_dev_unreg: - rtc_device_unregister(info->rtc_dev); - - return ret; -} - -static int __exit tegra_rtc_remove(struct platform_device *pdev) -{ - struct tegra_rtc_info *info = platform_get_drvdata(pdev); - - rtc_device_unregister(info->rtc_dev); - - platform_set_drvdata(pdev, NULL); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -440,7 +422,6 @@ static void tegra_rtc_shutdown(struct platform_device *pdev) MODULE_ALIAS("platform:tegra_rtc"); static struct platform_driver tegra_rtc_driver = { - .remove = __exit_p(tegra_rtc_remove), .shutdown = tegra_rtc_shutdown, .driver = { .name = "tegra_rtc",