mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Andrew Morton'" <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	"'Alessandro Zummo'" <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, "'Jingoo Han'" <jg1.han@samsung.com>,
	"'Linus Walleij'" <linus.walleij@linaro.org>
Subject: [PATCH 1/4] rtc: rtc-coh901331: Use devm_ioremap_resource()
Date: Fri, 07 Feb 2014 16:55:15 +0900	[thread overview]
Message-ID: <000501cf23d9$f0057a80$d0106f80$%han@samsung.com> (raw)
In-Reply-To: <000401cf23d9$d1df6e30$759e4a90$%han@samsung.com>

Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/rtc/rtc-coh901331.c |   18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/rtc-coh901331.c b/drivers/rtc/rtc-coh901331.c
index 73f1575..869cae2 100644
--- a/drivers/rtc/rtc-coh901331.c
+++ b/drivers/rtc/rtc-coh901331.c
@@ -43,8 +43,6 @@
 struct coh901331_port {
 	struct rtc_device *rtc;
 	struct clk *clk;
-	u32 phybase;
-	u32 physize;
 	void __iomem *virtbase;
 	int irq;
 #ifdef CONFIG_PM_SLEEP
@@ -173,19 +171,9 @@ static int __init coh901331_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENOENT;
-
-	rtap->phybase = res->start;
-	rtap->physize = resource_size(res);
-
-	if (devm_request_mem_region(&pdev->dev, rtap->phybase, rtap->physize,
-				    "rtc-coh901331") == NULL)
-		return -EBUSY;
-
-	rtap->virtbase = devm_ioremap(&pdev->dev, rtap->phybase, rtap->physize);
-	if (!rtap->virtbase)
-		return -ENOMEM;
+	rtap->virtbase  = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(rtap->virtbase))
+		return PTR_ERR(rtap->virtbase);
 
 	rtap->irq = platform_get_irq(pdev, 0);
 	if (devm_request_irq(&pdev->dev, rtap->irq, coh901331_interrupt, 0,
-- 
1.7.10.4



  reply	other threads:[~2014-02-07  7:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  7:54 [PATCH 0/4] rtc: " Jingoo Han
2014-02-07  7:55 ` Jingoo Han [this message]
2014-02-10  9:26   ` [rtc-linux] [PATCH 1/4] rtc: rtc-coh901331: " Linus Walleij
2014-02-07  7:57 ` [PATCH 2/4] rtc: rtc-davinci: " Jingoo Han
2014-02-07  7:58 ` [PATCH 3/4] rtc: rtc-jz4740: " Jingoo Han
2014-02-07  8:13   ` Lars-Peter Clausen
2014-02-07  8:31     ` Jingoo Han
2014-02-07  8:49       ` Lars-Peter Clausen
2014-02-07  7:59 ` [PATCH 4/4] rtc: rtc-vt8500: " Jingoo Han

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000501cf23d9$f0057a80$d0106f80$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®