From patchwork Sat Mar 9 18:13:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laxman Dewangan X-Patchwork-Id: 226362 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ob0-x23f.google.com (mail-ob0-x23f.google.com [IPv6:2607:f8b0:4003:c01::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 8D1242C033D for ; Sun, 10 Mar 2013 05:15:54 +1100 (EST) Received: by mail-ob0-f191.google.com with SMTP id dn14sf771486obc.18 for ; Sat, 09 Mar 2013 10:15:51 -0800 (PST) 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: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=r1wVQClOORQTChUZ/BjSBtkX0kA/OUqsp1X5sFuSbDA=; b=WsRABXeEkQP0ZVT3CGxPzHyuVlihz6xdcrp0SUrdNHksnr04P0gVHzw7mjFzSG2ARQ bvPHSsXZ5UWD0qrcc65UAtnrOUroxvOIvmqSjRtoB5JOaDl7VBaISl6ZjkZ6RpzZqRhV De6Q41UzbORxLqTqQvtqq1Vj94tI4Km1W2PQO/5grKJ/ycmAvQ630LE1rmYkWXa5kAmx G5oon59XPrzKRdfvBTOcKXEPDiInTb8pidw31p/ST7Df+g7vKJzYiDEMxHR+uix1mAPc Z/0P41ziDqBCs53I6NbuLswgq+8xZdBbdAOqjBfNxaJfCyGONnt88CcHwqHmcsyW1D3A rfGQ== X-Received: by 10.50.5.244 with SMTP id v20mr361983igv.13.1362852951711; Sat, 09 Mar 2013 10:15:51 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.95.198 with SMTP id dm6ls448649igb.16.canary; Sat, 09 Mar 2013 10:15:51 -0800 (PST) X-Received: by 10.68.242.193 with SMTP id ws1mr3280595pbc.0.1362852951047; Sat, 09 Mar 2013 10:15:51 -0800 (PST) Received: from hqemgate04.nvidia.com (hqemgate04.nvidia.com. [216.228.121.35]) by gmr-mx.google.com with ESMTPS id ka10si2874015pbb.2.2013.03.09.10.15.50 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 09 Mar 2013 10:15:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of ldewangan@nvidia.com designates 216.228.121.35 as permitted sender) client-ip=216.228.121.35; Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Sat, 09 Mar 2013 10:15:17 -0800 Received: from hqemhub03.nvidia.com ([172.17.108.22]) by hqnvupgp08.nvidia.com (PGP Universal service); Sat, 09 Mar 2013 10:09:04 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Sat, 09 Mar 2013 10:09:04 -0800 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; Sat, 9 Mar 2013 10:15:21 -0800 Received: from thelma.nvidia.com (Not Verified[172.16.212.77]) by hqnvemgw01.nvidia.com with MailMarshal (v7,1,2,5326) id ; Sat, 09 Mar 2013 10:15:22 -0800 Received: from ldewangan-ubuntu.nvidia.com ([10.19.65.30]) by thelma.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id r29IFJW9024724; Sat, 9 Mar 2013 10:15:19 -0800 (PST) From: Laxman Dewangan To: , CC: , , , , Laxman Dewangan Subject: [rtc-linux] [PATCH 5/5] rtc: tegra: use managed rtc_device_register Date: Sat, 9 Mar 2013 23:43:36 +0530 Message-ID: <1362852816-13460-1-git-send-email-ldewangan@nvidia.com> X-Mailer: git-send-email 1.7.1.1 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.35 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 --- 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 8186405..1ac8199 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c @@ -348,13 +348,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; } @@ -366,28 +364,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 @@ -441,7 +423,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",