Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751907AbaBGH7V (ORCPT ); Fri, 7 Feb 2014 02:59:21 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:34259 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbaBGH7T (ORCPT ); Fri, 7 Feb 2014 02:59:19 -0500 X-AuditID: cbfee68e-b7f566d000002344-5b-52f49256bc33 From: Jingoo Han To: "'Andrew Morton'" Cc: linux-kernel@vger.kernel.org, "'Alessandro Zummo'" , rtc-linux@googlegroups.com, "'Jingoo Han'" , "'Tony Prisk'" References: <000401cf23d9$d1df6e30$759e4a90$%han@samsung.com> In-reply-to: <000401cf23d9$d1df6e30$759e4a90$%han@samsung.com> Subject: [PATCH 4/4] rtc: rtc-vt8500: Use devm_ioremap_resource() Date: Fri, 07 Feb 2014 16:59:18 +0900 Message-id: <000801cf23da$808dc0d0$81a94270$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac8j2dGo+e7pmAi4QKyN7t2QoeNN8wAAJHNw Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsVy+t8zI92wSV+CDO6vULRYcvEqu8Wc9WvY LC4vvMRqcXnXHDaLlssrmC32d3YwOrB57Jl4ks3jxIzfLB7n/7ewe/RtWcXoMX3eTyaPz5vk AtiiuGxSUnMyy1KL9O0SuDJ6zy5kLdgkVLGp5ypjA+MU/i5GTg4JAROJ9Y2z2CBsMYkL99YD 2VwcQgLLGCUmT5zADFP0v+8YE0RiOqPE/43TWSCcX4wSTafuMYJUsQmoSXz5cpi9i5GDQ0RA X6KtRQOkhllgK6PEowtH2EFqhARsJRa+7ASbyilgJ9G/p48VxBYWcJTYdmY22BwWAVWJGXsv gdXwAtVvvd/OAmELSvyYfA/MZhbQkli/8zgThC0v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IxKPLwnln4OEmJNLCuuzD3EKMHBrCTC+7PhS5AQb0pi ZVVqUX58UWlOavEhxmSgRycyS4km5wMTV15JvKGxiZmRpZGZhZGJuTlpwkrivAdarQOFBNIT S1KzU1MLUotgtjBxcEo1MBa8ELzxeuGKrg/b4vrsbq/MtJ+0TejPxi3r0749901cpnn04Fzm EF7FG8rrlU/OCTly6N0sufTdHvrr1JSX3eydJ6z8Yv3tHROsTA03edp/Tp8vv99F6P2yblu5 PUFvvp97vUHs3RnuDVz7JA9aPly6yo0ppvvhDH1F2X+XVecHZyzXzZ06f+0uJZbijERDLeai 4kQAAYCQflIDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_ioremap_resource() in order to make the code simpler, and move 'struct resource *res' from 'struct vt8500_rtc' to vt8500_rtc_probe() because the 'res' variable is used only in vt8500_rtc_probe(). Signed-off-by: Jingoo Han --- drivers/rtc/rtc-vt8500.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index df2ef3e..051da96 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c @@ -79,7 +79,6 @@ struct vt8500_rtc { void __iomem *regbase; - struct resource *res; int irq_alarm; struct rtc_device *rtc; spinlock_t lock; /* Protects this structure */ @@ -209,6 +208,7 @@ static const struct rtc_class_ops vt8500_rtc_ops = { static int vt8500_rtc_probe(struct platform_device *pdev) { struct vt8500_rtc *vt8500_rtc; + struct resource *res; int ret; vt8500_rtc = devm_kzalloc(&pdev->dev, @@ -219,34 +219,16 @@ static int vt8500_rtc_probe(struct platform_device *pdev) spin_lock_init(&vt8500_rtc->lock); platform_set_drvdata(pdev, vt8500_rtc); - vt8500_rtc->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!vt8500_rtc->res) { - dev_err(&pdev->dev, "No I/O memory resource defined\n"); - return -ENXIO; - } - vt8500_rtc->irq_alarm = platform_get_irq(pdev, 0); if (vt8500_rtc->irq_alarm < 0) { dev_err(&pdev->dev, "No alarm IRQ resource defined\n"); return vt8500_rtc->irq_alarm; } - vt8500_rtc->res = devm_request_mem_region(&pdev->dev, - vt8500_rtc->res->start, - resource_size(vt8500_rtc->res), - "vt8500-rtc"); - if (vt8500_rtc->res == NULL) { - dev_err(&pdev->dev, "failed to request I/O memory\n"); - return -EBUSY; - } - - vt8500_rtc->regbase = devm_ioremap(&pdev->dev, vt8500_rtc->res->start, - resource_size(vt8500_rtc->res)); - if (!vt8500_rtc->regbase) { - dev_err(&pdev->dev, "Unable to map RTC I/O memory\n"); - ret = -EBUSY; - goto err_return; - } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + vt8500_rtc->regbase = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(vt8500_rtc->regbase)) + return PTR_ERR(vt8500_rtc->regbase); /* Enable RTC and set it to 24-hour mode */ writel(VT8500_RTC_CR_ENABLE, -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/