Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752157AbaBJAcQ (ORCPT ); Sun, 9 Feb 2014 19:32:16 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:11229 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751732AbaBJAcO (ORCPT ); Sun, 9 Feb 2014 19:32:14 -0500 X-AuditID: cbfee68e-b7f566d000002344-e3-52f81e0ba72c From: Jingoo Han To: "'Andrew Morton'" Cc: linux-kernel@vger.kernel.org, "'Alessandro Zummo'" , rtc-linux@googlegroups.com, "'Lars-Peter Clausen'" , "'Jingoo Han'" Subject: [PATCH V2] rtc: rtc-jz4740: Use devm_ioremap_resource() Date: Mon, 10 Feb 2014 09:32:10 +0900 Message-id: <003801cf25f7$89791f40$9c6b5dc0$%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: Ac8l94lZ1rkmbBedSjWad9HnMLoirw== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFIsWRmVeSWpSXmKPExsVy+t8zI11uuR9BBktmSVosuXiV3WLO+jVs FpcXXmK1WDJ5PqvF5V1z2Cz2d3YwOrB57Jl4ks3jxIzfLB5L3hxi9ejbsorRY/q8n0wenzfJ BbBFcdmkpOZklqUW6dslcGXcWPuFtaBRsOLuxXVsDYxdfF2MnBwSAiYSp5pPsEPYYhIX7q1n 62Lk4hASWMYo8bUFxIEomnO6ixUiMZ1R4vfii1DOL0aJu3vuMYJUsQmoSXz5chhoFAeHiIC+ RFuLBkgNs8B2RomG7kdMIDXCAg4SZ24fYwWxWQRUJf7O/w4W5xWwlfjz+ws7hC0o8WPyPRYQ m1lAS2L9zuNMELa8xOY1b5lB5ksIqEs8+qsLEhYR0JN4/KKFGaJERGLfi3eMIHslBK6xS6xb NocRYpeAxLfJh1ggemUlNh1ghnhMUuLgihssExjFZi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ktTs1NSC1CKYLUwcnFINjJ4f mQ+16C3i8G1+IW3yzvA/Z/+TrfPKCz+LSk5k8A9XOR0u6z6lUUjs4bl18xLsclQz5S6Hr9nl uMLBzFfjkLE/R0raN11F2/2uuj+PzNAW1vn69EGhx1QhARNnxUM6d3RWXJ1yMabds3DzT/X4 zeF3s87FWTjLlzCc2cx9+3RD08YPUww5lViKMxINtZiLihMB3vijnjoDAAA= 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 *mem' from 'struct jz4740_rtc' to jz4740_rtc_probe() because the 'mem' variable is used only in jz4740_rtc_probe(). Also the redundant return value check of platform_get_resource() is removed, because the value is checked by devm_ioremap_resource(). Signed-off-by: Jingoo Han --- Changes since v1 - Removed unnecessary resource flag setting, per Lars-Peter Clausen - Removed unnecessary the return value check of platform_get_resource() drivers/rtc/rtc-jz4740.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c index 1b126d2..08f5160 100644 --- a/drivers/rtc/rtc-jz4740.c +++ b/drivers/rtc/rtc-jz4740.c @@ -38,7 +38,6 @@ #define JZ_RTC_CTRL_ENABLE BIT(0) struct jz4740_rtc { - struct resource *mem; void __iomem *base; struct rtc_device *rtc; @@ -216,6 +215,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev) int ret; struct jz4740_rtc *rtc; uint32_t scratchpad; + struct resource *mem; rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); if (!rtc) @@ -227,25 +227,10 @@ static int jz4740_rtc_probe(struct platform_device *pdev) return -ENOENT; } - rtc->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!rtc->mem) { - dev_err(&pdev->dev, "Failed to get platform mmio memory\n"); - return -ENOENT; - } - - rtc->mem = devm_request_mem_region(&pdev->dev, rtc->mem->start, - resource_size(rtc->mem), pdev->name); - if (!rtc->mem) { - dev_err(&pdev->dev, "Failed to request mmio memory region\n"); - return -EBUSY; - } - - rtc->base = devm_ioremap_nocache(&pdev->dev, rtc->mem->start, - resource_size(rtc->mem)); - if (!rtc->base) { - dev_err(&pdev->dev, "Failed to ioremap mmio memory\n"); - return -EBUSY; - } + mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + rtc->base = devm_ioremap_resource(&pdev->dev, mem); + if (IS_ERR(rtc->base)) + return PTR_ERR(rtc->base); spin_lock_init(&rtc->lock); -- 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/