9
0
Fork 0
barebox/drivers/mtd
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
..
devices driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
nand driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
nor driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
spi-nor driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
ubi Merge branch 'for-next/blspec' 2015-07-06 12:43:29 +02:00
Kconfig mtd: Add mtd concat support 2015-06-23 16:59:54 +02:00
Makefile mtd: Add mtd concat support 2015-06-23 16:59:54 +02:00
core.c mtd: core: initialize *retlen in mtd_write() 2015-11-23 10:36:13 +01:00
mtd.h mtd: Make devname argument to add_mtd_device const 2015-06-29 07:04:55 +02:00
mtdconcat.c Introduce include/linux/wait.h 2016-02-03 07:57:36 +01:00
mtdoob.c mtd: Make devname argument to add_mtd_device const 2015-06-29 07:04:55 +02:00
mtdraw.c mtd: Make devname argument to add_mtd_device const 2015-06-29 07:04:55 +02:00
partition.c mtd: partition: implement write_oob 2015-06-12 08:28:04 +02:00