linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c/i2c-mxs: use devm_request_and_ioremap
@ 2013-02-03  0:14 Peter Huewe
  2013-02-15 19:04 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Huewe @ 2013-02-03  0:14 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: ben-linux, linux-i2c, linux-kernel, Peter Huewe

Replace a call to devm_request_mem_region followed by a call to
dev_ioremap_nocache with devm_request_and_ioremap which does the same.
And since res_size isn't needed anymore we can remove it as well.

Found with coccicheck and this semantic patch:
 scripts/coccinelle/api/devm_request_and_ioremap.cocci.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/i2c/busses/i2c-mxs.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index d6abaf2..4ca92b6 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -439,7 +439,6 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	struct i2c_adapter *adap;
 	struct pinctrl *pinctrl;
 	struct resource *res;
-	resource_size_t res_size;
 	int err, irq, dmairq;
 	dma_cap_mask_t mask;
 
@@ -458,11 +457,7 @@ static int mxs_i2c_probe(struct platform_device *pdev)
 	if (!res || irq < 0 || dmairq < 0)
 		return -ENOENT;
 
-	res_size = resource_size(res);
-	if (!devm_request_mem_region(dev, res->start, res_size, res->name))
-		return -EBUSY;
-
-	i2c->regs = devm_ioremap_nocache(dev, res->start, res_size);
+	i2c->regs = devm_request_and_ioremap(dev, res);
 	if (!i2c->regs)
 		return -EBUSY;
 
-- 
1.7.8.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: i2c/i2c-mxs: use devm_request_and_ioremap
  2013-02-03  0:14 [PATCH] i2c/i2c-mxs: use devm_request_and_ioremap Peter Huewe
@ 2013-02-15 19:04 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2013-02-15 19:04 UTC (permalink / raw)
  To: Peter Huewe; +Cc: ben-linux, linux-i2c, linux-kernel, Peter Huewe

On Sat, Feb 02, 2013 at 02:14:57PM -0000, =?utf-8?q?Peter_H=C3=BCwe_=3CPeterHuewe=40gmx=2Ede=3E?= wrote:

> Replace a call to devm_request_mem_region followed by a call to
> dev_ioremap_nocache with devm_request_and_ioremap which does the same.
> And since res_size isn't needed anymore we can remove it as well.

Since this is the only change, we better wait for devm_ioremap_resource
in 3.9.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-15 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-03  0:14 [PATCH] i2c/i2c-mxs: use devm_request_and_ioremap Peter Huewe
2013-02-15 19:04 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).