mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
To: lars@metafoo.de, cbou@mail.ru, dwmw2@infradead.org
Cc: linux-kernel@vger.kernel.org,
	Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Subject: [PATCH 2/2 v2] drivers: power: jz4740_battery: Use devm_request_and_ioremap
Date: Sun, 21 Oct 2012 23:13:45 -0200	[thread overview]
Message-ID: <1350868425-26852-3-git-send-email-marcos.souza.org@gmail.com> (raw)
In-Reply-To: <1350868425-26852-1-git-send-email-marcos.souza.org@gmail.com>

And remove all checks abvout request_mem_region and ioremap.
This is just a cleanup. Not functional changes here.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
---
 drivers/power/jz4740-battery.c |   23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c
index 59900c6..1df7be8 100644
--- a/drivers/power/jz4740-battery.c
+++ b/drivers/power/jz4740-battery.c
@@ -272,19 +272,12 @@ static int __devinit jz_battery_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	jz_battery->mem = request_mem_region(jz_battery->mem->start,
-				resource_size(jz_battery->mem),	pdev->name);
-	if (!jz_battery->mem) {
-		dev_err(&pdev->dev, "Failed to request mmio memory region\n");
-		return -EBUSY;
-	}
+	jz_battery->base = devm_request_and_ioremap(&pdev->dev
+							, jz_battery->mem);
 
-	jz_battery->base = ioremap_nocache(jz_battery->mem->start,
-				resource_size(jz_battery->mem));
 	if (!jz_battery->base) {
-		ret = -EBUSY;
 		dev_err(&pdev->dev, "Failed to ioremap mmio memory\n");
-		goto err_release_mem_region;
+		return -EBUSY;
 	}
 
 	battery = &jz_battery->battery;
@@ -308,7 +301,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev)
 			jz_battery);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request irq %d\n", ret);
-		goto err_iounmap;
+		goto err_irq;
 	}
 	disable_irq(jz_battery->irq);
 
@@ -365,11 +358,8 @@ err_free_gpio:
 		gpio_free(jz_battery->pdata->gpio_charge);
 err_free_irq:
 	free_irq(jz_battery->irq, jz_battery);
-err_iounmap:
+err_irq:
 	platform_set_drvdata(pdev, NULL);
-	iounmap(jz_battery->base);
-err_release_mem_region:
-	release_mem_region(jz_battery->mem->start, resource_size(jz_battery->mem));
 	return ret;
 }
 
@@ -389,9 +379,6 @@ static int __devexit jz_battery_remove(struct platform_device *pdev)
 
 	free_irq(jz_battery->irq, jz_battery);
 
-	iounmap(jz_battery->base);
-	release_mem_region(jz_battery->mem->start, resource_size(jz_battery->mem));
-
 	return 0;
 }
 
-- 
1.7.9.5


  parent reply	other threads:[~2012-10-22  1:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22  1:13 [PATCH 0/2 v2] Cleanup battery driver for jz4740 Marcos Paulo de Souza
2012-10-22  1:13 ` [PATCH 1/2 v2] drivers: power: jz4740-battery: Use devm_kzalloc instead of kzalloc/kfree Marcos Paulo de Souza
2012-10-22  1:13 ` Marcos Paulo de Souza [this message]
2012-10-22  7:00   ` [PATCH 2/2 v2] drivers: power: jz4740_battery: Use devm_request_and_ioremap Lars-Peter Clausen

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=1350868425-26852-3-git-send-email-marcos.souza.org@gmail.com \
    --to=marcos.souza.org@gmail.com \
    --cc=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome