9
0
Fork 0
barebox/drivers/clk/mvebu
Sascha Hauer 3bd69ad077 driver: replace dev_request_mem_region with dev_request_mem_resource
dev_request_mem_region doesn't work properly one some SoCs on which
PTR_ERR() values clash with valid return values from dev_request_mem_region.
Replace them with dev_request_mem_resource where possible.

This patch has been generated with the following semantic patch:

// <smpl>
@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
-if (IS_ERR(io)) {
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores)) {
...
-	return PTR_ERR(io);
-}
+	return PTR_ERR(iores);
+}
+io = IOMEM(iores->start);
...+>
}

@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
-if (IS_ERR(io)) {
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores))
-	return PTR_ERR(io);
-}
+	return PTR_ERR(iores);
+io = IOMEM(iores->start);
...+>
}

@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
-if (IS_ERR(io)) {
-	ret = PTR_ERR(io);
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores)) {
+	ret = PTR_ERR(iores);
...
}
+io = IOMEM(iores->start);
...+>
}

@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores))
+	return PTR_ERR(iores);
+io = IOMEM(iores->start);
...+>
}

@@
identifier func;
@@
func(...) {
<+...
struct resource *iores;
-struct resource *iores;
...+>
}
// </smpl>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-03-07 08:57:56 +01:00
..
Makefile clk: mvebu: Add corediv clock driver for Armada 370/XP 2015-10-12 08:14:11 +02:00
armada-370.c clk: mvebu: fix Armada 370 TCLK frequencies 2014-06-24 08:25:03 +02:00
armada-xp.c clk: mvebu: add OF clock providers for Marvell MVEBU SoCs 2013-08-16 08:45:33 +02:00
common.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
common.h clk: mvebu: add OF clock providers for Marvell MVEBU SoCs 2013-08-16 08:45:33 +02:00
corediv.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
dove.c clk: mvebu: add OF clock providers for Marvell MVEBU SoCs 2013-08-16 08:45:33 +02:00
kirkwood.c clk: mvebu: add OF clock providers for Marvell MVEBU SoCs 2013-08-16 08:45:33 +02:00