From patchwork Thu Dec 8 15:40:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe PLAGNIOL-VILLARD X-Patchwork-Id: 130189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ww0-f56.google.com (mail-ww0-f56.google.com [74.125.82.56]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 2F0E41007D1 for ; Fri, 9 Dec 2011 02:44:30 +1100 (EST) Received: by wgbdr12 with SMTP id dr12sf8494149wgb.11 for ; Thu, 08 Dec 2011 07:44:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:x-ovh-mailout :subject:date:message-id:x-mailer:x-ovh-tracer-id:x-ovh-remote :x-ovh-local:x-ovh-spamstate:x-ovh-spamscore:x-ovh-spamcause :x-spam-check:x-vr-spamstate:x-vr-spamscore:x-vr-spamcause :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=tqYErzBH4V8F1fsGITgOWj2A4wxKVuMac0b8xpaj/Tg=; b=2mlEEVpUwU6UP1rghowAia25Vzw6XobSLwdpf8GPqIEAC+vzjJpQqdoSeqNyZnv2xx Gj7lYQIr6X1VTe50OZEyTwnO81uWLxhW9SDjm1K/dS2mP9cePX6uS7dCwCqUd5qu1Zkj qmAtkk86p1IGMdjmCHHftZcQy3PX9WD597opI= Received: by 10.180.83.134 with SMTP id q6mr1162417wiy.4.1323359065146; Thu, 08 Dec 2011 07:44:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.108.199 with SMTP id hm7ls5065923wib.4.gmail; Thu, 08 Dec 2011 07:44:24 -0800 (PST) Received: by 10.227.199.129 with SMTP id es1mr346951wbb.1.1323359064295; Thu, 08 Dec 2011 07:44:24 -0800 (PST) Received: by 10.227.199.129 with SMTP id es1mr346950wbb.1.1323359064274; Thu, 08 Dec 2011 07:44:24 -0800 (PST) Received: from mo4.mail-out.ovh.net (18.mo4.mail-out.ovh.net. [188.165.54.143]) by gmr-mx.google.com with ESMTP id fc1si7062346wbb.2.2011.12.08.07.44.24; Thu, 08 Dec 2011 07:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of plagnioj@jcrosoft.com designates 188.165.54.143 as permitted sender) client-ip=188.165.54.143; Received: from mail192.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo4.mail-out.ovh.net (Postfix) with SMTP id 56B6B104E230 for ; Thu, 8 Dec 2011 16:44:36 +0100 (CET) Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 8 Dec 2011 17:44:23 +0200 Received: from ns32433.ovh.net (HELO localhost) (plagnioj%jcrosoft.com@213.251.161.87) by ns0.ovh.net with SMTP; 8 Dec 2011 17:44:21 +0200 From: Jean-Christophe PLAGNIOL-VILLARD To: rtc-linux@googlegroups.com Cc: Jean-Christophe PLAGNIOL-VILLARD , Nicolas Ferre , Andrew Morton X-Ovh-Mailout: 178.32.228.4 (mo4.mail-out.ovh.net) Subject: [rtc-linux] [PATCH] rtc/at91sam9: use ioremap and iounmap Date: Thu, 8 Dec 2011 16:40:29 +0100 Message-Id: <1323358829-22132-1-git-send-email-plagnioj@jcrosoft.com> X-Mailer: git-send-email 1.7.2.3 X-Ovh-Tracer-Id: 15804538467933662129 X-Ovh-Remote: 213.251.161.87 (ns32433.ovh.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-OVH-SPAMSTATE: OK X-OVH-SPAMSCORE: -100 X-OVH-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeefjedrudeiucetggdotefuucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffosedttdertdertddtnecuhfhrohhmpeflvggrnhdqvehhrhhishhtohhphhgvucfrnfetiffpkffqnfdqggfknffnteftffcuoehplhgrghhnihhojhesjhgtrhhoshhofhhtrdgtohhmqeenucffohhmrghinhepne X-Spam-Check: DONE|U 0.5/N X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeefjedruddvucetggdotefuucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffosedttdertdertddtnecuhfhrohhmpeflvggrnhdqvehhrhhishhtohhphhgvucfrnfetiffpkffqnfdqggfknffnteftffcuoehplhgrghhnihhojhesjhgtrhhoshhofhhtrdgtohhmqeenucffohhmrghinhepne X-Original-Sender: plagnioj@jcrosoft.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of plagnioj@jcrosoft.com designates 188.165.54.143 as permitted sender) smtp.mail=plagnioj@jcrosoft.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: , Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Andrew Morton --- drivers/rtc/rtc-at91sam9.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index a3ad957..ee3c122 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -307,8 +307,12 @@ static int __init at91_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); platform_set_drvdata(pdev, rtc); - rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); - rtc->rtt += r->start; + rtc->rtt = ioremap(r->start, resource_size(r)); + if (!rtc->rtt) { + dev_err(&pdev->dev, "failed to map registers, aborting.\n"); + ret = -ENOMEM; + goto fail; + } mr = rtt_readl(rtc, MR); @@ -326,7 +330,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) &at91_rtc_ops, THIS_MODULE); if (IS_ERR(rtc->rtcdev)) { ret = PTR_ERR(rtc->rtcdev); - goto fail; + goto fail_register; } /* register irq handler after we know what name we'll use */ @@ -351,6 +355,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev) return 0; +fail_register: + iounmap(rtc->rtt); fail: platform_set_drvdata(pdev, NULL); kfree(rtc); @@ -371,6 +377,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) rtc_device_unregister(rtc->rtcdev); + iounmap(rtc->rtt); platform_set_drvdata(pdev, NULL); kfree(rtc); return 0;