9
0
Fork 0
barebox/drivers/watchdog
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
..
Kconfig driver: watchdog: Add support for omap_wdt 2015-11-23 08:24:56 +01:00
Makefile driver: watchdog: Add support for omap_wdt 2015-11-23 08:24:56 +01:00
davinci_wdt.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
im28wd.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
imxwd.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
jz4740.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
omap_wdt.c driver: replace dev_request_mem_region with dev_request_mem_resource 2016-03-07 08:57:56 +01:00
wd_core.c watchdog: Give watchdogs a name 2015-08-27 21:37:07 +02:00