All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/33] Sanitize devm_request_and_ioremap()
@ 2013-01-21 10:08 Thierry Reding
  2013-01-21 10:08 ` [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource() Thierry Reding
                   ` (33 more replies)
  0 siblings, 34 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

Recent discussions about the lack of a meaningful error code returned by
devm_request_and_ioremap() have triggered this patch series. One common
issue is that the function returns NULL in all failure cases, making it
impossible to determine what went wrong exactly. Another problem is that
people can't seem to agree on what error code to return in case where
the function fails. Both of these problems lead to inconsistent usage.

This series attempts to fix this by providing a replacement function,
devm_ioremap_resource(), which returns a pointer to the remapped memory
region on success and an ERR_PTR()-encoded error code on failure. Users
can check for failure using the IS_ERR() macro and determine the exact
cause by extracting the error code using PTR_ERR().

Patch 1 adds the new devm_ioremap_resource() function, which is really
just a renamed version of devm_request_and_ioremap() that returns
ERR_PTR()-encoded error codes on failure and makes the old function a
wrapper around it, returning NULL in case of devm_ioremap_resource()
failure. Furthermore the patch marks devm_request_and_ioremap() as a
deprecated function to make it clear that it should no longer be used.
A semantic patch is included that was used to convert the bulk of the
existing calls to devm_request_and_ioremap() to the new API. The patch
is far from perfect and a few occurrences had to be converted or fixed
up manually.

The remaining patches convert each subsystem separately to use the new
API.

Thierry

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>

Thierry Reding (33):
  lib: devres: Introduce devm_ioremap_resource()
  ARM: Convert to devm_ioremap_resource()
  MIPS: Convert to devm_ioremap_resource()
  amba: Convert to devm_ioremap_resource()
  ata: Convert to devm_ioremap_resource()
  char: Convert to devm_ioremap_resource()
  dma: Convert to devm_ioremap_resource()
  gpio: Convert to devm_ioremap_resource()
  drm: Convert to devm_ioremap_resource()
  i2c: Convert to devm_ioremap_resource()
  iio: Convert to devm_ioremap_resource()
  Input: Convert to devm_ioremap_resource()
  iommu: Convert to devm_ioremap_resource()
  media: Convert to devm_ioremap_resource()
  memory: Convert to devm_ioremap_resource()
  mfd: Convert to devm_ioremap_resource()
  misc: Convert to devm_ioremap_resource()
  mmc: Convert to devm_ioremap_resource()
  mtd: Convert to devm_ioremap_resource()
  net: Convert to devm_ioremap_resource()
  pinctrl: Convert to devm_ioremap_resource()
  power: Convert to devm_ioremap_resource()
  pwm: Convert to devm_ioremap_resource()
  rtc: Convert to devm_ioremap_resource()
  spi: Convert to devm_ioremap_resource()
  staging: Convert to devm_ioremap_resource()
  thermal: Convert to devm_ioremap_resource()
  serial: Convert to devm_ioremap_resource()
  usb: Convert to devm_ioremap_resource()
  video: Convert to devm_ioremap_resource()
  w1: Convert to devm_ioremap_resource()
  watchdog: Convert to devm_ioremap_resource()
  ASoC: Convert to devm_ioremap_resource()

 Documentation/driver-model/devres.txt              |  3 +-
 arch/arm/mach-omap2/gpmc.c                         |  8 +-
 arch/arm/mach-tegra/tegra2_emc.c                   |  8 +-
 arch/arm/plat-omap/dmtimer.c                       |  8 +-
 arch/arm/plat-samsung/adc.c                        |  8 +-
 arch/mips/lantiq/xway/dma.c                        |  5 +-
 arch/mips/lantiq/xway/gptu.c                       |  8 +-
 arch/mips/pci/pci-lantiq.c                         | 12 +--
 drivers/amba/tegra-ahb.c                           |  7 +-
 drivers/ata/pata_ep93xx.c                          |  7 +-
 drivers/char/hw_random/exynos-rng.c                |  9 ++-
 drivers/char/hw_random/omap-rng.c                  |  6 +-
 drivers/char/hw_random/tx4939-rng.c                |  7 +-
 drivers/dma/dw_dmac.c                              |  7 +-
 drivers/dma/imx-dma.c                              |  7 +-
 drivers/dma/mmp_pdma.c                             |  7 +-
 drivers/dma/mmp_tdma.c                             |  7 +-
 drivers/dma/tegra20-apb-dma.c                      | 10 +--
 drivers/gpio/gpio-mvebu.c                          | 16 ++--
 drivers/gpio/gpio-mxs.c                            |  9 ++-
 drivers/gpio/gpio-spear-spics.c                    |  8 +-
 drivers/gpio/gpio-stp-xway.c                       |  9 +--
 drivers/gpio/gpio-tegra.c                          |  9 +--
 drivers/gpu/drm/exynos/exynos_drm_fimc.c           |  8 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c           |  8 +-
 drivers/gpu/drm/exynos/exynos_drm_g2d.c            |  7 +-
 drivers/gpu/drm/exynos/exynos_drm_gsc.c            |  8 +-
 drivers/gpu/drm/exynos/exynos_drm_rotator.c        |  8 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c               |  8 +-
 drivers/gpu/drm/tegra/dc.c                         |  8 +-
 drivers/gpu/drm/tegra/hdmi.c                       |  6 +-
 drivers/gpu/drm/tegra/host1x.c                     |  6 +-
 drivers/i2c/busses/i2c-at91.c                      |  6 +-
 drivers/i2c/busses/i2c-imx.c                       |  6 +-
 drivers/i2c/busses/i2c-ocores.c                    |  7 +-
 drivers/i2c/busses/i2c-omap.c                      |  8 +-
 drivers/i2c/busses/i2c-rcar.c                      |  8 +-
 drivers/i2c/busses/i2c-s3c2410.c                   |  7 +-
 drivers/i2c/busses/i2c-sirf.c                      |  7 +-
 drivers/i2c/busses/i2c-stu300.c                    |  6 +-
 drivers/i2c/busses/i2c-tegra.c                     |  8 +-
 drivers/i2c/busses/i2c-xlr.c                       |  9 +--
 drivers/iio/adc/at91_adc.c                         |  6 +-
 drivers/input/keyboard/spear-keyboard.c            |  8 +-
 drivers/input/serio/arc_ps2.c                      |  7 +-
 drivers/iommu/tegra-smmu.c                         |  7 +-
 drivers/media/platform/exynos-gsc/gsc-core.c       |  8 +-
 drivers/media/platform/mx2_emmaprp.c               |  6 +-
 drivers/media/platform/s3c-camif/camif-core.c      |  8 +-
 drivers/media/platform/s5p-fimc/fimc-core.c        |  8 +-
 drivers/media/platform/s5p-fimc/fimc-lite.c        |  8 +-
 drivers/media/platform/s5p-fimc/mipi-csis.c        |  8 +-
 drivers/media/platform/s5p-g2d/g2d.c               |  8 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.c        |  8 +-
 drivers/media/platform/s5p-mfc/s5p_mfc.c           |  8 +-
 drivers/media/platform/soc_camera/mx2_camera.c     | 12 +--
 drivers/memory/emif.c                              |  8 +-
 drivers/memory/tegra20-mc.c                        |  7 +-
 drivers/memory/tegra30-mc.c                        |  7 +-
 drivers/mfd/intel_msic.c                           |  9 +--
 drivers/misc/atmel-ssc.c                           |  8 +-
 drivers/mmc/host/dw_mmc-pltfm.c                    |  7 +-
 drivers/mmc/host/mxs-mmc.c                         |  6 +-
 drivers/mmc/host/sdhci-s3c.c                       |  7 +-
 drivers/mtd/devices/spear_smi.c                    |  7 +-
 drivers/mtd/maps/autcpu12-nvram.c                  |  9 +--
 drivers/mtd/maps/lantiq-flash.c                    |  8 +-
 drivers/mtd/nand/fsmc_nand.c                       | 33 ++++----
 drivers/mtd/nand/lpc32xx_mlc.c                     |  9 +--
 drivers/mtd/nand/lpc32xx_slc.c                     |  8 +-
 drivers/mtd/nand/mxc_nand.c                        | 12 +--
 drivers/mtd/nand/s3c2410.c                         |  7 +-
 drivers/mtd/nand/txx9ndfmc.c                       |  7 +-
 drivers/net/can/grcan.c                            |  8 +-
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  9 +--
 drivers/pinctrl/pinctrl-at91.c                     |  7 +-
 drivers/pinctrl/pinctrl-bcm2835.c                  |  6 +-
 drivers/pinctrl/pinctrl-coh901.c                   |  8 +-
 drivers/pinctrl/pinctrl-exynos5440.c               |  8 +-
 drivers/pinctrl/pinctrl-falcon.c                   | 13 ++--
 drivers/pinctrl/pinctrl-imx.c                      |  6 +-
 drivers/pinctrl/pinctrl-nomadik.c                  |  6 +-
 drivers/pinctrl/pinctrl-pxa3xx.c                   |  7 +-
 drivers/pinctrl/pinctrl-samsung.c                  |  8 +-
 drivers/pinctrl/pinctrl-u300.c                     |  6 +-
 drivers/pinctrl/pinctrl-xway.c                     |  9 +--
 drivers/pinctrl/spear/pinctrl-plgpio.c             |  8 +-
 drivers/power/jz4740-battery.c                     |  7 +-
 drivers/pwm/pwm-imx.c                              |  6 +-
 drivers/pwm/pwm-lpc32xx.c                          |  6 +-
 drivers/pwm/pwm-mxs.c                              |  6 +-
 drivers/pwm/pwm-puv3.c                             |  6 +-
 drivers/pwm/pwm-pxa.c                              |  6 +-
 drivers/pwm/pwm-spear.c                            |  6 +-
 drivers/pwm/pwm-tegra.c                            |  6 +-
 drivers/pwm/pwm-tiecap.c                           |  6 +-
 drivers/pwm/pwm-tiehrpwm.c                         |  6 +-
 drivers/pwm/pwm-tipwmss.c                          |  6 +-
 drivers/pwm/pwm-vt8500.c                           |  6 +-
 drivers/rtc/rtc-s3c.c                              |  8 +-
 drivers/rtc/rtc-snvs.c                             |  6 +-
 drivers/rtc/rtc-spear.c                            |  8 +-
 drivers/rtc/rtc-tegra.c                            |  8 +-
 drivers/spi/spi-ep93xx.c                           |  7 +-
 drivers/spi/spi-mxs.c                              |  6 +-
 drivers/spi/spi-omap2-mcspi.c                      |  7 +-
 drivers/spi/spi-s3c64xx.c                          |  7 +-
 drivers/spi/spi-sirf.c                             |  7 +-
 drivers/spi/spi-tegra20-sflash.c                   |  8 +-
 drivers/spi/spi-tegra20-slink.c                    |  8 +-
 drivers/staging/iio/adc/mxs-lradc.c                |  7 +-
 drivers/staging/nvec/nvec.c                        |  8 +-
 drivers/staging/omap-thermal/omap-bandgap.c        | 11 +--
 drivers/thermal/exynos_thermal.c                   |  8 +-
 drivers/tty/serial/sccnxp.c                        |  8 +-
 drivers/usb/chipidea/usbmisc_imx6q.c               |  6 +-
 drivers/usb/gadget/bcm63xx_udc.c                   | 13 ++--
 drivers/usb/gadget/s3c-hsotg.c                     |  7 +-
 drivers/usb/gadget/s3c-hsudc.c                     |  7 +-
 drivers/usb/host/ehci-atmel.c                      |  7 +-
 drivers/usb/host/ehci-grlib.c                      |  9 +--
 drivers/usb/host/ehci-mxc.c                        |  7 +-
 drivers/usb/host/ehci-platform.c                   |  7 +-
 drivers/usb/host/ehci-ppc-of.c                     |  8 +-
 drivers/usb/host/ehci-sead3.c                      |  8 +-
 drivers/usb/host/ehci-sh.c                         |  7 +-
 drivers/usb/host/ehci-vt8500.c                     |  8 +-
 drivers/usb/host/ehci-xilinx-of.c                  |  8 +-
 drivers/usb/host/ohci-nxp.c                        |  7 +-
 drivers/usb/host/ohci-platform.c                   |  7 +-
 drivers/usb/host/ohci-s3c2410.c                    |  7 +-
 drivers/usb/musb/musb_dsps.c                       |  7 +-
 drivers/usb/musb/omap2430.c                        |  4 +-
 drivers/usb/otg/mxs-phy.c                          |  6 +-
 drivers/usb/phy/mv_u3d_phy.c                       |  8 +-
 drivers/usb/phy/omap-usb2.c                        |  8 +-
 drivers/usb/renesas_usbhs/common.c                 |  9 +--
 drivers/video/exynos/exynos_dp_core.c              |  8 +-
 drivers/video/jz4740_fb.c                          |  6 +-
 drivers/video/omap2/dss/hdmi.c                     |  8 +-
 drivers/video/omap2/vrfb.c                         |  9 +--
 drivers/video/s3c-fb.c                             |  7 +-
 drivers/w1/masters/omap_hdq.c                      |  8 +-
 drivers/watchdog/ar7_wdt.c                         |  8 +-
 drivers/watchdog/dw_wdt.c                          |  6 +-
 drivers/watchdog/imx2_wdt.c                        |  8 +-
 drivers/watchdog/jz4740_wdt.c                      |  6 +-
 drivers/watchdog/lantiq_wdt.c                      |  8 +-
 drivers/watchdog/max63xx_wdt.c                     |  7 +-
 drivers/watchdog/pnx4008_wdt.c                     |  6 +-
 drivers/watchdog/txx9wdt.c                         |  6 +-
 include/linux/device.h                             |  3 +-
 lib/devres.c                                       | 57 ++++++++++----
 scripts/coccinelle/api/devm_ioremap_resource.cocci | 90 ++++++++++++++++++++++
 sound/soc/cirrus/ep93xx-ac97.c                     |  7 +-
 sound/soc/cirrus/ep93xx-i2s.c                      |  6 +-
 sound/soc/codecs/jz4740.c                          |  6 +-
 sound/soc/fsl/imx-audmux.c                         |  6 +-
 sound/soc/fsl/imx-ssi.c                            |  7 +-
 sound/soc/kirkwood/kirkwood-i2s.c                  |  8 +-
 sound/soc/mxs/mxs-saif.c                           |  8 +-
 sound/soc/pxa/mmp-sspa.c                           |  6 +-
 162 files changed, 686 insertions(+), 681 deletions(-)
 create mode 100644 scripts/coccinelle/api/devm_ioremap_resource.cocci

-- 
1.8.1


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

* [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
@ 2013-01-21 10:08 ` Thierry Reding
  2013-01-21 10:26   ` Dmitry Torokhov
  2013-01-22 17:40   ` Greg Kroah-Hartman
  2013-01-21 10:08   ` Thierry Reding
                   ` (32 subsequent siblings)
  33 siblings, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

The devm_request_and_ioremap() function is very useful and helps avoid a
whole lot of boilerplate. However, one issue that keeps popping up is
its lack of a specific error code to determine which of the steps that
it performs failed. Furthermore, while the function gives an example and
suggests what error code to return on failure, a wide variety of error
codes are used throughout the tree.

In an attempt to fix these problems, this patch adds a new function that
drivers can transition to. The devm_ioremap_resource() returns a pointer
to the remapped I/O memory on success or an ERR_PTR() encoded error code
on failure. Callers can check for failure using IS_ERR() and determine
its cause by extracting the error code using PTR_ERR().

devm_request_and_ioremap() is implemented as a wrapper around the new
API and return NULL on failure as before. This ensures that backwards
compatibility is maintained until all users have been converted to the
new API, at which point the old devm_request_and_ioremap() function
should be removed. To help prevent new users from being added in the
meantime, devm_request_and_ioremap() is marked __deprecated.

A semantic patch is included which can be used to convert from the old
devm_request_and_ioremap() API to the new devm_ioremap_resource() API.
Some non-trivial cases may require manual intervention, though.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/driver-model/devres.txt              |  3 +-
 include/linux/device.h                             |  3 +-
 lib/devres.c                                       | 57 ++++++++++----
 scripts/coccinelle/api/devm_ioremap_resource.cocci | 90 ++++++++++++++++++++++
 4 files changed, 138 insertions(+), 15 deletions(-)
 create mode 100644 scripts/coccinelle/api/devm_ioremap_resource.cocci

diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index 43cff70..25240fc 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -266,7 +266,8 @@ IOMAP
   devm_ioremap()
   devm_ioremap_nocache()
   devm_iounmap()
-  devm_request_and_ioremap() : checks resource, requests region, ioremaps
+  devm_ioremap_resource() : checks resource, requests memory region, ioremaps
+  devm_request_and_ioremap() : obsoleted by devm_ioremap_resource()
   pcim_iomap()
   pcim_iounmap()
   pcim_iomap_table()	: array of mapped addresses indexed by BAR
diff --git a/include/linux/device.h b/include/linux/device.h
index 43dcda9..558c405 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -573,8 +573,9 @@ extern int devres_release_group(struct device *dev, void *id);
 extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
 extern void devm_kfree(struct device *dev, void *p);
 
+void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
 void __iomem *devm_request_and_ioremap(struct device *dev,
-			struct resource *res);
+			struct resource *res) __deprecated;
 
 struct device_dma_parameters {
 	/*
diff --git a/lib/devres.c b/lib/devres.c
index 80b9c76..9c76b3a 100644
--- a/lib/devres.c
+++ b/lib/devres.c
@@ -86,22 +86,24 @@ void devm_iounmap(struct device *dev, void __iomem *addr)
 EXPORT_SYMBOL(devm_iounmap);
 
 /**
- * devm_request_and_ioremap() - Check, request region, and ioremap resource
- * @dev: Generic device to handle the resource for
+ * devm_ioremap_resource() - check, request region, and ioremap resource
+ * @dev: generic device to handle the resource for
  * @res: resource to be handled
  *
- * Takes all necessary steps to ioremap a mem resource. Uses managed device, so
- * everything is undone on driver detach. Checks arguments, so you can feed
- * it the result from e.g. platform_get_resource() directly. Returns the
- * remapped pointer or NULL on error. Usage example:
+ * Checks that a resource is a valid memory region, requests the memory region
+ * and ioremaps it either as cacheable or as non-cacheable memory depending on
+ * the resource's flags. All operations are managed and will be undone on
+ * driver detach.
+ *
+ * Returns a pointer to the remapped memory or an ERR_PTR() encoded error code
+ * on failure. Usage example:
  *
  *	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- *	base = devm_request_and_ioremap(&pdev->dev, res);
- *	if (!base)
- *		return -EADDRNOTAVAIL;
+ *	base = devm_ioremap_resource(&pdev->dev, res);
+ *	if (IS_ERR(base))
+ *		return PTR_ERR(base);
  */
-void __iomem *devm_request_and_ioremap(struct device *dev,
-			struct resource *res)
+void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
 {
 	resource_size_t size;
 	const char *name;
@@ -111,7 +113,7 @@ void __iomem *devm_request_and_ioremap(struct device *dev,
 
 	if (!res || resource_type(res) != IORESOURCE_MEM) {
 		dev_err(dev, "invalid resource\n");
-		return NULL;
+		return ERR_PTR(-EINVAL);
 	}
 
 	size = resource_size(res);
@@ -119,7 +121,7 @@ void __iomem *devm_request_and_ioremap(struct device *dev,
 
 	if (!devm_request_mem_region(dev, res->start, size, name)) {
 		dev_err(dev, "can't request region for resource %pR\n", res);
-		return NULL;
+		return ERR_PTR(-EBUSY);
 	}
 
 	if (res->flags & IORESOURCE_CACHEABLE)
@@ -130,10 +132,39 @@ void __iomem *devm_request_and_ioremap(struct device *dev,
 	if (!dest_ptr) {
 		dev_err(dev, "ioremap failed for resource %pR\n", res);
 		devm_release_mem_region(dev, res->start, size);
+		dest_ptr = ERR_PTR(-ENOMEM);
 	}
 
 	return dest_ptr;
 }
+EXPORT_SYMBOL(devm_ioremap_resource);
+
+/**
+ * devm_request_and_ioremap() - Check, request region, and ioremap resource
+ * @dev: Generic device to handle the resource for
+ * @res: resource to be handled
+ *
+ * Takes all necessary steps to ioremap a mem resource. Uses managed device, so
+ * everything is undone on driver detach. Checks arguments, so you can feed
+ * it the result from e.g. platform_get_resource() directly. Returns the
+ * remapped pointer or NULL on error. Usage example:
+ *
+ *	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ *	base = devm_request_and_ioremap(&pdev->dev, res);
+ *	if (!base)
+ *		return -EADDRNOTAVAIL;
+ */
+void __iomem *devm_request_and_ioremap(struct device *device,
+				       struct resource *res)
+{
+	void __iomem *dest_ptr;
+
+	dest_ptr = devm_ioremap_resource(device, res);
+	if (IS_ERR(dest_ptr))
+		return NULL;
+
+	return dest_ptr;
+}
 EXPORT_SYMBOL(devm_request_and_ioremap);
 
 #ifdef CONFIG_HAS_IOPORT
diff --git a/scripts/coccinelle/api/devm_ioremap_resource.cocci b/scripts/coccinelle/api/devm_ioremap_resource.cocci
new file mode 100644
index 0000000..495daa3
--- /dev/null
+++ b/scripts/coccinelle/api/devm_ioremap_resource.cocci
@@ -0,0 +1,90 @@
+virtual patch
+virtual report
+
+@depends on patch@
+expression base, dev, res;
+@@
+
+-base = devm_request_and_ioremap(dev, res);
++base = devm_ioremap_resource(dev, res);
+ ...
+ if (
+-base == NULL
++IS_ERR(base)
+ || ...) {
+<...
+-	return ...;
++	return PTR_ERR(base);
+...>
+ }
+
+@depends on patch@
+expression e, E, ret;
+identifier l;
+@@
+
+ e = devm_ioremap_resource(...);
+ ...
+ if (IS_ERR(e) || ...) {
+ 	... when any
+-	ret = E;
++	ret = PTR_ERR(e);
+ 	...
+(
+ 	return ret;
+|
+ 	goto l;
+)
+ }
+
+@depends on patch@
+expression e;
+@@
+
+ e = devm_ioremap_resource(...);
+ ...
+ if (IS_ERR(e) || ...) {
+ 	...
+-	\(dev_dbg\|dev_err\|pr_debug\|pr_err\|DRM_ERROR\)(...);
+ 	...
+ }
+
+@depends on patch@
+expression e;
+identifier l;
+@@
+
+ e = devm_ioremap_resource(...);
+ ...
+ if (IS_ERR(e) || ...)
+-{
+(
+ 	return ...;
+|
+ 	goto l;
+)
+-}
+
+@r depends on report@
+expression e;
+identifier l;
+position p1;
+@@
+
+*e = devm_request_and_ioremap@p1(...);
+ ...
+ if (e == NULL || ...) {
+ 	...
+(
+ 	return ...;
+|
+ 	goto l;
+)
+ }
+
+@script:python depends on r@
+p1 << r.p1;
+@@
+
+msg = "ERROR: deprecated devm_request_and_ioremap() API used on line %s" % (p1[0].line)
+coccilib.report.print_report(p1[0], msg)
-- 
1.8.1.1


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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
@ 2013-01-21 10:08   ` Thierry Reding
  2013-01-21 10:08   ` Thierry Reding
                     ` (32 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Russell King, linux-arm-kernel

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/mach-omap2/gpmc.c       | 8 +++-----
 arch/arm/mach-tegra/tegra2_emc.c | 8 +++-----
 arch/arm/plat-omap/dmtimer.c     | 8 +++-----
 arch/arm/plat-samsung/adc.c      | 8 +++-----
 4 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 8033cb7..64bac53 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1134,11 +1134,9 @@ static int gpmc_probe(struct platform_device *pdev)
 	phys_base = res->start;
 	mem_size = resource_size(res);
 
-	gpmc_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!gpmc_base) {
-		dev_err(&pdev->dev, "error: request memory / ioremap\n");
-		return -EADDRNOTAVAIL;
-	}
+	gpmc_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(gpmc_base))
+		return PTR_ERR(gpmc_base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res == NULL)
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index e18aa2f..ce7ce42 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -312,11 +312,9 @@ static int tegra_emc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	emc_regbase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!emc_regbase) {
-		dev_err(&pdev->dev, "failed to remap registers\n");
-		return -ENOMEM;
-	}
+	emc_regbase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(emc_regbase))
+		return PTR_ERR(emc_regbase);
 
 	pdata = pdev->dev.platform_data;
 
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 7b433f3..a0daa2f 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -808,11 +808,9 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return  -ENOMEM;
 	}
 
-	timer->io_base = devm_request_and_ioremap(dev, mem);
-	if (!timer->io_base) {
-		dev_err(dev, "%s: region already claimed.\n", __func__);
-		return -ENOMEM;
-	}
+	timer->io_base = devm_ioremap_resource(dev, mem);
+	if (IS_ERR(timer->io_base))
+		return PTR_ERR(timer->io_base);
 
 	if (dev->of_node) {
 		if (of_find_property(dev->of_node, "ti,timer-alwon", NULL))
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 2d676ab..ca07cb1 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -386,11 +386,9 @@ static int s3c_adc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	adc->regs = devm_request_and_ioremap(dev, regs);
-	if (!adc->regs) {
-		dev_err(dev, "failed to map registers\n");
-		return -ENXIO;
-	}
+	adc->regs = devm_ioremap_resource(dev, regs);
+	if (IS_ERR(adc->regs))
+		return PTR_ERR(adc->regs);
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
-- 
1.8.1.1


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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
@ 2013-01-21 10:08   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-omap2/gpmc.c       | 8 +++-----
 arch/arm/mach-tegra/tegra2_emc.c | 8 +++-----
 arch/arm/plat-omap/dmtimer.c     | 8 +++-----
 arch/arm/plat-samsung/adc.c      | 8 +++-----
 4 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 8033cb7..64bac53 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1134,11 +1134,9 @@ static int gpmc_probe(struct platform_device *pdev)
 	phys_base = res->start;
 	mem_size = resource_size(res);
 
-	gpmc_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!gpmc_base) {
-		dev_err(&pdev->dev, "error: request memory / ioremap\n");
-		return -EADDRNOTAVAIL;
-	}
+	gpmc_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(gpmc_base))
+		return PTR_ERR(gpmc_base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res == NULL)
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index e18aa2f..ce7ce42 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -312,11 +312,9 @@ static int tegra_emc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	emc_regbase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!emc_regbase) {
-		dev_err(&pdev->dev, "failed to remap registers\n");
-		return -ENOMEM;
-	}
+	emc_regbase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(emc_regbase))
+		return PTR_ERR(emc_regbase);
 
 	pdata = pdev->dev.platform_data;
 
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 7b433f3..a0daa2f 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -808,11 +808,9 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 		return  -ENOMEM;
 	}
 
-	timer->io_base = devm_request_and_ioremap(dev, mem);
-	if (!timer->io_base) {
-		dev_err(dev, "%s: region already claimed.\n", __func__);
-		return -ENOMEM;
-	}
+	timer->io_base = devm_ioremap_resource(dev, mem);
+	if (IS_ERR(timer->io_base))
+		return PTR_ERR(timer->io_base);
 
 	if (dev->of_node) {
 		if (of_find_property(dev->of_node, "ti,timer-alwon", NULL))
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 2d676ab..ca07cb1 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -386,11 +386,9 @@ static int s3c_adc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	adc->regs = devm_request_and_ioremap(dev, regs);
-	if (!adc->regs) {
-		dev_err(dev, "failed to map registers\n");
-		return -ENXIO;
-	}
+	adc->regs = devm_ioremap_resource(dev, regs);
+	if (IS_ERR(adc->regs))
+		return PTR_ERR(adc->regs);
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
-- 
1.8.1.1

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

* [PATCH 03/33] MIPS: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
  2013-01-21 10:08 ` [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource() Thierry Reding
  2013-01-21 10:08   ` Thierry Reding
@ 2013-01-21 10:08 ` Thierry Reding
  2013-01-21 10:08 ` [PATCH 04/33] amba: " Thierry Reding
                   ` (30 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Ralf Baechle, linux-mips

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/lantiq/xway/dma.c  |  5 +++--
 arch/mips/lantiq/xway/gptu.c |  8 +++-----
 arch/mips/pci/pci-lantiq.c   | 12 ++++++------
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
index e44a186..08f7ebd 100644
--- a/arch/mips/lantiq/xway/dma.c
+++ b/arch/mips/lantiq/xway/dma.c
@@ -21,6 +21,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 #include <lantiq_soc.h>
 #include <xway_dma.h>
@@ -223,8 +224,8 @@ ltq_dma_init(struct platform_device *pdev)
 		panic("Failed to get dma resource");
 
 	/* remap dma register range */
-	ltq_dma_membase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ltq_dma_membase)
+	ltq_dma_membase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ltq_dma_membase))
 		panic("Failed to remap dma resource");
 
 	/* power up and reset the dma engine */
diff --git a/arch/mips/lantiq/xway/gptu.c b/arch/mips/lantiq/xway/gptu.c
index e30b1ed..9861c86 100644
--- a/arch/mips/lantiq/xway/gptu.c
+++ b/arch/mips/lantiq/xway/gptu.c
@@ -150,11 +150,9 @@ static int gptu_probe(struct platform_device *pdev)
 	}
 
 	/* remap gptu register range */
-	gptu_membase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!gptu_membase) {
-		dev_err(&pdev->dev, "Failed to remap resource\n");
-		return -ENOMEM;
-	}
+	gptu_membase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(gptu_membase))
+		return PTR_ERR(gptu_membase);
 
 	/* enable our clock */
 	clk = clk_get(&pdev->dev, NULL);
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 9568178..910fb4c 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -214,13 +214,13 @@ static int ltq_pci_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	ltq_pci_membase = devm_request_and_ioremap(&pdev->dev, res_bridge);
-	ltq_pci_mapped_cfg = devm_request_and_ioremap(&pdev->dev, res_cfg);
+	ltq_pci_membase = devm_ioremap_resource(&pdev->dev, res_bridge);
+	if (IS_ERR(ltq_pci_membase))
+		return PTR_ERR(ltq_pci_membase);
 
-	if (!ltq_pci_membase || !ltq_pci_mapped_cfg) {
-		dev_err(&pdev->dev, "failed to remap resources\n");
-		return -ENOMEM;
-	}
+	ltq_pci_mapped_cfg = devm_ioremap_resource(&pdev->dev, res_cfg);
+	if (IS_ERR(ltq_pci_mapped_cfg))
+		return PTR_ERR(ltq_pci_mapped_cfg);
 
 	ltq_pci_startup(pdev);
 
-- 
1.8.1.1


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

* [PATCH 04/33] amba: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (2 preceding siblings ...)
  2013-01-21 10:08 ` [PATCH 03/33] MIPS: " Thierry Reding
@ 2013-01-21 10:08 ` Thierry Reding
  2013-01-21 10:08 ` [PATCH 05/33] ata: " Thierry Reding
                   ` (29 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Russell King

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Russell King <linux@arm.linux.org.uk>
---
 drivers/amba/tegra-ahb.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
index 536c166..ab92785 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -20,6 +20,7 @@
  *
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -257,9 +258,9 @@ static int tegra_ahb_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENODEV;
-	ahb->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ahb->regs)
-		return -EBUSY;
+	ahb->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ahb->regs))
+		return PTR_ERR(ahb->regs);
 
 	ahb->dev = &pdev->dev;
 	platform_set_drvdata(pdev, ahb);
-- 
1.8.1.1


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

* [PATCH 05/33] ata: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (3 preceding siblings ...)
  2013-01-21 10:08 ` [PATCH 04/33] amba: " Thierry Reding
@ 2013-01-21 10:08 ` Thierry Reding
  2013-01-21 10:08 ` [PATCH 06/33] char: " Thierry Reding
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Jeff Garzik, linux-ide

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org
---
 drivers/ata/pata_ep93xx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c
index 556222f..c1bfaf4 100644
--- a/drivers/ata/pata_ep93xx.c
+++ b/drivers/ata/pata_ep93xx.c
@@ -31,6 +31,7 @@
  *   Copyright (C) 2006 Tower Technologies
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -937,9 +938,9 @@ static int ep93xx_pata_probe(struct platform_device *pdev)
 		goto err_rel_gpio;
 	}
 
-	ide_base = devm_request_and_ioremap(&pdev->dev, mem_res);
-	if (!ide_base) {
-		err = -ENXIO;
+	ide_base = devm_ioremap_resource(&pdev->dev, mem_res);
+	if (IS_ERR(ide_base)) {
+		err = PTR_ERR(ide_base);
 		goto err_rel_gpio;
 	}
 
-- 
1.8.1.1


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

* [PATCH 06/33] char: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (4 preceding siblings ...)
  2013-01-21 10:08 ` [PATCH 05/33] ata: " Thierry Reding
@ 2013-01-21 10:08 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 07/33] dma: " Thierry Reding
                   ` (27 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/hw_random/exynos-rng.c | 9 +++++----
 drivers/char/hw_random/omap-rng.c   | 6 +++---
 drivers/char/hw_random/tx4939-rng.c | 7 ++++---
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c
index 48bbfec..4673fc4 100644
--- a/drivers/char/hw_random/exynos-rng.c
+++ b/drivers/char/hw_random/exynos-rng.c
@@ -104,6 +104,7 @@ static int exynos_read(struct hwrng *rng, void *buf,
 static int exynos_rng_probe(struct platform_device *pdev)
 {
 	struct exynos_rng *exynos_rng;
+	struct resource *res;
 
 	exynos_rng = devm_kzalloc(&pdev->dev, sizeof(struct exynos_rng),
 					GFP_KERNEL);
@@ -120,10 +121,10 @@ static int exynos_rng_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	exynos_rng->mem = devm_request_and_ioremap(&pdev->dev,
-			platform_get_resource(pdev, IORESOURCE_MEM, 0));
-	if (!exynos_rng->mem)
-		return -EBUSY;
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	exynos_rng->mem = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(exynos_rng->mem))
+		return PTR_ERR(exynos_rng->mem);
 
 	platform_set_drvdata(pdev, exynos_rng);
 
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index d8c54e2..749dc16 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -124,9 +124,9 @@ static int omap_rng_probe(struct platform_device *pdev)
 		goto err_ioremap;
 	}
 
-	priv->base = devm_request_and_ioremap(&pdev->dev, priv->mem_res);
-	if (!priv->base) {
-		ret = -ENOMEM;
+	priv->base = devm_ioremap_resource(&pdev->dev, priv->mem_res);
+	if (IS_ERR(priv->base)) {
+		ret = PTR_ERR(priv->base);
 		goto err_ioremap;
 	}
 	dev_set_drvdata(&pdev->dev, priv);
diff --git a/drivers/char/hw_random/tx4939-rng.c b/drivers/char/hw_random/tx4939-rng.c
index de473ef..3099198 100644
--- a/drivers/char/hw_random/tx4939-rng.c
+++ b/drivers/char/hw_random/tx4939-rng.c
@@ -7,6 +7,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  */
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -115,9 +116,9 @@ static int __init tx4939_rng_probe(struct platform_device *dev)
 	rngdev = devm_kzalloc(&dev->dev, sizeof(*rngdev), GFP_KERNEL);
 	if (!rngdev)
 		return -ENOMEM;
-	rngdev->base = devm_request_and_ioremap(&dev->dev, r);
-	if (!rngdev->base)
-		return -EBUSY;
+	rngdev->base = devm_ioremap_resource(&dev->dev, r);
+	if (IS_ERR(rngdev->base))
+		return PTR_ERR(rngdev->base);
 
 	rngdev->rng.name = dev_name(&dev->dev);
 	rngdev->rng.data_present = tx4939_rng_data_present;
-- 
1.8.1.1


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

* [PATCH 07/33] dma: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (5 preceding siblings ...)
  2013-01-21 10:08 ` [PATCH 06/33] char: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-28 16:00   ` Vinod Koul
  2013-01-29 13:11   ` Andy Shevchenko
  2013-01-21 10:09 ` [PATCH 08/33] gpio: " Thierry Reding
                   ` (26 subsequent siblings)
  33 siblings, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Vinod Koul

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Vinod Koul <vinod.koul@intel.com>
---
 drivers/dma/dw_dmac.c         |  7 ++++---
 drivers/dma/imx-dma.c         |  7 ++++---
 drivers/dma/mmp_pdma.c        |  7 ++++---
 drivers/dma/mmp_tdma.c        |  7 ++++---
 drivers/dma/tegra20-apb-dma.c | 10 ++++------
 5 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 3e8ba02..b33d1f6 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -14,6 +14,7 @@
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	regs = devm_request_and_ioremap(&pdev->dev, io);
-	if (!regs)
-		return -EBUSY;
+	regs = devm_ioremap_resource(&pdev->dev, io);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
 	dw_params = dma_read_byaddr(regs, DW_PARAMS);
 	autocfg = dw_params >> DW_PARAMS_EN & 0x1;
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index dbf0e6f..84ae491 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -14,6 +14,7 @@
  * http://www.opensource.org/licenses/gpl-license.html
  * http://www.gnu.org/copyleft/gpl.html
  */
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/mm.h>
@@ -1011,9 +1012,9 @@ static int __init imxdma_probe(struct platform_device *pdev)
 	imxdma->devtype = pdev->id_entry->driver_data;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	imxdma->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!imxdma->base)
-		return -EADDRNOTAVAIL;
+	imxdma->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(imxdma->base))
+		return PTR_ERR(imxdma->base);
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index c6d98c0..dc74665 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -5,6 +5,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -782,9 +783,9 @@ static int mmp_pdma_probe(struct platform_device *op)
 	if (!iores)
 		return -EINVAL;
 
-	pdev->base = devm_request_and_ioremap(pdev->dev, iores);
-	if (!pdev->base)
-		return -EADDRNOTAVAIL;
+	pdev->base = devm_ioremap_resource(pdev->dev, iores);
+	if (IS_ERR(pdev->base))
+		return PTR_ERR(pdev->base);
 
 	of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev);
 	if (of_id)
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index a9f1cd5..43d5a6c 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -9,6 +9,7 @@
  *
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
@@ -547,9 +548,9 @@ static int mmp_tdma_probe(struct platform_device *pdev)
 	if (!iores)
 		return -EINVAL;
 
-	tdev->base = devm_request_and_ioremap(&pdev->dev, iores);
-	if (!tdev->base)
-		return -EADDRNOTAVAIL;
+	tdev->base = devm_ioremap_resource(&pdev->dev, iores);
+	if (IS_ERR(tdev->base))
+		return PTR_ERR(tdev->base);
 
 	INIT_LIST_HEAD(&tdev->device.channels);
 
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index c39e61b..7d6d8b4 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -21,6 +21,7 @@
 #include <linux/delay.h>
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -1236,12 +1237,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	tdma->base_addr = devm_request_and_ioremap(&pdev->dev, res);
-	if (!tdma->base_addr) {
-		dev_err(&pdev->dev,
-			"Cannot request memregion/iomap dma address\n");
-		return -EADDRNOTAVAIL;
-	}
+	tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(tdma->base_addr))
+		return PTR_ERR(tdma->base_addr);
 
 	tdma->dma_clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(tdma->dma_clk)) {
-- 
1.8.1.1


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

* [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (6 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 07/33] dma: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:52   ` Viresh Kumar
  2013-01-22 10:15   ` Linus Walleij
  2013-01-21 10:09   ` Thierry Reding
                   ` (25 subsequent siblings)
  33 siblings, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Grant Likely, Linus Walleij

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-mvebu.c       | 16 ++++++++--------
 drivers/gpio/gpio-mxs.c         |  9 ++++++---
 drivers/gpio/gpio-spear-spics.c |  8 +++-----
 drivers/gpio/gpio-stp-xway.c    |  9 ++++-----
 drivers/gpio/gpio-tegra.c       |  9 ++++-----
 5 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 7d9bd94..bf6c7c9 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -33,6 +33,7 @@
  *   interrupts.
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/gpio.h>
 #include <linux/irq.h>
@@ -544,11 +545,10 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
 	mvchip->chip.of_node = np;
 
 	spin_lock_init(&mvchip->lock);
-	mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
-	if (! mvchip->membase) {
-		dev_err(&pdev->dev, "Cannot ioremap\n");
+	mvchip->membase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mvchip->membase)) {
 		kfree(mvchip->chip.label);
-		return -ENOMEM;
+		return PTR_ERR(mvchip->membase);
 	}
 
 	/* The Armada XP has a second range of registers for the
@@ -561,11 +561,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
 			return -ENODEV;
 		}
 
-		mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res);
-		if (! mvchip->percpu_membase) {
-			dev_err(&pdev->dev, "Cannot ioremap\n");
+		mvchip->percpu_membase = devm_ioremap_resource(&pdev->dev,
+							       res);
+		if (IS_ERR(mvchip->percpu_membase)) {
 			kfree(mvchip->chip.label);
-			return -ENOMEM;
+			return PTR_ERR(mvchip->percpu_membase);
 		}
 	}
 
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index fa2a63c..45d97c4 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -20,6 +20,7 @@
  * MA  02110-1301, USA.
  */
 
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -253,12 +254,14 @@ static int mxs_gpio_probe(struct platform_device *pdev)
 			parent = of_get_parent(np);
 			base = of_iomap(parent, 0);
 			of_node_put(parent);
+			if (!base)
+				return -EADDRNOTAVAIL;
 		} else {
 			iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-			base = devm_request_and_ioremap(&pdev->dev, iores);
+			base = devm_ioremap_resource(&pdev->dev, iores);
+			if (IS_ERR(base))
+				return PTR_ERR(base);
 		}
-		if (!base)
-			return -EADDRNOTAVAIL;
 	}
 	port->base = base;
 
diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
index 5f45fc4..7a4bf7c 100644
--- a/drivers/gpio/gpio-spear-spics.c
+++ b/drivers/gpio/gpio-spear-spics.c
@@ -140,11 +140,9 @@ static int spics_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	spics->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!spics->base) {
-		dev_err(&pdev->dev, "request and ioremap fail\n");
-		return -ENOMEM;
-	}
+	spics->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(spics->base))
+		return PTR_ERR(spics->base);
 
 	if (of_property_read_u32(np, "st-spics,peripcfg-reg",
 				&spics->perip_cfg))
diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 85841ee7..c20e051 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -214,11 +214,10 @@ static int xway_stp_probe(struct platform_device *pdev)
 	if (!chip)
 		return -ENOMEM;
 
-	chip->virt = devm_request_and_ioremap(&pdev->dev, res);
-	if (!chip->virt) {
-		dev_err(&pdev->dev, "failed to remap STP memory\n");
-		return -ENOMEM;
-	}
+	chip->virt = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(chip->virt))
+		return PTR_ERR(chip->virt);
+	
 	chip->gc.dev = &pdev->dev;
 	chip->gc.label = "stp-xway";
 	chip->gc.direction_output = xway_stp_dir_out;
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 63cb643..414ad91 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
@@ -450,11 +451,9 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!regs) {
-		dev_err(&pdev->dev, "Couldn't ioremap regs\n");
-		return -ENODEV;
-	}
+	regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
 	for (i = 0; i < tegra_gpio_bank_count; i++) {
 		for (j = 0; j < 4; j++) {
-- 
1.8.1.1


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

* [PATCH 09/33] drm: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
@ 2013-01-21 10:09   ` Thierry Reding
  2013-01-21 10:08   ` Thierry Reding
                     ` (32 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	David Airlie, dri-devel

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c    | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_fimd.c    | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_g2d.c     | 7 +++----
 drivers/gpu/drm/exynos/exynos_drm_gsc.c     | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_rotator.c | 8 +++-----
 drivers/gpu/drm/exynos/exynos_hdmi.c        | 8 +++-----
 drivers/gpu/drm/tegra/dc.c                  | 8 +++-----
 drivers/gpu/drm/tegra/hdmi.c                | 6 +++---
 drivers/gpu/drm/tegra/host1x.c              | 6 +++---
 9 files changed, 27 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 67a83e6..411f69b7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -1785,11 +1785,9 @@ static int fimc_probe(struct platform_device *pdev)
 
 	/* resource memory */
 	ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
-	if (!ctx->regs) {
-		dev_err(dev, "failed to map registers.\n");
-		return -ENXIO;
-	}
+	ctx->regs = devm_ioremap_resource(dev, ctx->regs_res);
+	if (IS_ERR(ctx->regs))
+		return PTR_ERR(ctx->regs);
 
 	/* resource irq */
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..36493ce 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -913,11 +913,9 @@ static int fimd_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ctx->regs) {
-		dev_err(dev, "failed to map registers\n");
-		return -ENXIO;
-	}
+	ctx->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ctx->regs))
+		return PTR_ERR(ctx->regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 36c3905..7329abd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1136,10 +1136,9 @@ static int g2d_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	g2d->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!g2d->regs) {
-		dev_err(dev, "failed to remap I/O memory\n");
-		ret = -ENXIO;
+	g2d->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(g2d->regs)) {
+		ret = PTR_ERR(g2d->regs);
 		goto err_put_clk;
 	}
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 8140753..7841c3b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -1692,11 +1692,9 @@ static int gsc_probe(struct platform_device *pdev)
 
 	/* resource memory */
 	ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
-	if (!ctx->regs) {
-		dev_err(dev, "failed to map registers.\n");
-		return -ENXIO;
-	}
+	ctx->regs = devm_ioremap_resource(dev, ctx->regs_res);
+	if (IS_ERR(ctx->regs))
+		return PTR_ERR(ctx->regs);
 
 	/* resource irq */
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index e9e83ef..a6da774 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -656,11 +656,9 @@ static int rotator_probe(struct platform_device *pdev)
 				platform_get_device_id(pdev)->driver_data;
 
 	rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	rot->regs = devm_request_and_ioremap(dev, rot->regs_res);
-	if (!rot->regs) {
-		dev_err(dev, "failed to map register\n");
-		return -ENXIO;
-	}
+	rot->regs = devm_ioremap_resource(dev, rot->regs_res);
+	if (IS_ERR(rot->regs))
+		return PTR_ERR(rot->regs);
 
 	rot->irq = platform_get_irq(pdev, 0);
 	if (rot->irq < 0) {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 41ff79d..d4c3f3d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2526,11 +2526,9 @@ static int hdmi_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hdata->regs) {
-		DRM_ERROR("failed to map registers\n");
-		return -ENXIO;
-	}
+	hdata->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hdata->regs))
+		return PTR_ERR(hdata->regs);
 
 	ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
 	if (ret) {
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 656b2e3..d365c6d 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -764,11 +764,9 @@ static int tegra_dc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	dc->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!dc->regs) {
-		dev_err(&pdev->dev, "failed to remap registers\n");
-		return -ENXIO;
-	}
+	dc->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(dc->regs))
+		return PTR_ERR(dc->regs);
 
 	dc->irq = platform_get_irq(pdev, 0);
 	if (dc->irq < 0) {
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index e060c7e..266af78 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1259,9 +1259,9 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
 	if (!regs)
 		return -ENXIO;
 
-	hdmi->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!hdmi->regs)
-		return -EADDRNOTAVAIL;
+	hdmi->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(hdmi->regs))
+		return PTR_ERR(hdmi->regs);
 
 	err = platform_get_irq(pdev, 0);
 	if (err < 0)
diff --git a/drivers/gpu/drm/tegra/host1x.c b/drivers/gpu/drm/tegra/host1x.c
index 5d17b11..92e25a7 100644
--- a/drivers/gpu/drm/tegra/host1x.c
+++ b/drivers/gpu/drm/tegra/host1x.c
@@ -139,9 +139,9 @@ static int tegra_host1x_probe(struct platform_device *pdev)
 
 	host1x->irq = err;
 
-	host1x->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!host1x->regs) {
-		err = -EADDRNOTAVAIL;
+	host1x->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(host1x->regs)) {
+		err = PTR_ERR(host1x->regs);
 		goto err;
 	}
 
-- 
1.8.1.1


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

* [PATCH 09/33] drm: Convert to devm_ioremap_resource()
@ 2013-01-21 10:09   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Dmitry Torokhov, Wolfram Sang,
	dri-devel

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c    | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_fimd.c    | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_g2d.c     | 7 +++----
 drivers/gpu/drm/exynos/exynos_drm_gsc.c     | 8 +++-----
 drivers/gpu/drm/exynos/exynos_drm_rotator.c | 8 +++-----
 drivers/gpu/drm/exynos/exynos_hdmi.c        | 8 +++-----
 drivers/gpu/drm/tegra/dc.c                  | 8 +++-----
 drivers/gpu/drm/tegra/hdmi.c                | 6 +++---
 drivers/gpu/drm/tegra/host1x.c              | 6 +++---
 9 files changed, 27 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 67a83e6..411f69b7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -1785,11 +1785,9 @@ static int fimc_probe(struct platform_device *pdev)
 
 	/* resource memory */
 	ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
-	if (!ctx->regs) {
-		dev_err(dev, "failed to map registers.\n");
-		return -ENXIO;
-	}
+	ctx->regs = devm_ioremap_resource(dev, ctx->regs_res);
+	if (IS_ERR(ctx->regs))
+		return PTR_ERR(ctx->regs);
 
 	/* resource irq */
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..36493ce 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -913,11 +913,9 @@ static int fimd_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ctx->regs) {
-		dev_err(dev, "failed to map registers\n");
-		return -ENXIO;
-	}
+	ctx->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ctx->regs))
+		return PTR_ERR(ctx->regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 36c3905..7329abd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1136,10 +1136,9 @@ static int g2d_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	g2d->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!g2d->regs) {
-		dev_err(dev, "failed to remap I/O memory\n");
-		ret = -ENXIO;
+	g2d->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(g2d->regs)) {
+		ret = PTR_ERR(g2d->regs);
 		goto err_put_clk;
 	}
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 8140753..7841c3b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -1692,11 +1692,9 @@ static int gsc_probe(struct platform_device *pdev)
 
 	/* resource memory */
 	ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
-	if (!ctx->regs) {
-		dev_err(dev, "failed to map registers.\n");
-		return -ENXIO;
-	}
+	ctx->regs = devm_ioremap_resource(dev, ctx->regs_res);
+	if (IS_ERR(ctx->regs))
+		return PTR_ERR(ctx->regs);
 
 	/* resource irq */
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index e9e83ef..a6da774 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -656,11 +656,9 @@ static int rotator_probe(struct platform_device *pdev)
 				platform_get_device_id(pdev)->driver_data;
 
 	rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	rot->regs = devm_request_and_ioremap(dev, rot->regs_res);
-	if (!rot->regs) {
-		dev_err(dev, "failed to map register\n");
-		return -ENXIO;
-	}
+	rot->regs = devm_ioremap_resource(dev, rot->regs_res);
+	if (IS_ERR(rot->regs))
+		return PTR_ERR(rot->regs);
 
 	rot->irq = platform_get_irq(pdev, 0);
 	if (rot->irq < 0) {
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 41ff79d..d4c3f3d 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2526,11 +2526,9 @@ static int hdmi_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hdata->regs) {
-		DRM_ERROR("failed to map registers\n");
-		return -ENXIO;
-	}
+	hdata->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hdata->regs))
+		return PTR_ERR(hdata->regs);
 
 	ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
 	if (ret) {
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 656b2e3..d365c6d 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -764,11 +764,9 @@ static int tegra_dc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	dc->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!dc->regs) {
-		dev_err(&pdev->dev, "failed to remap registers\n");
-		return -ENXIO;
-	}
+	dc->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(dc->regs))
+		return PTR_ERR(dc->regs);
 
 	dc->irq = platform_get_irq(pdev, 0);
 	if (dc->irq < 0) {
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index e060c7e..266af78 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1259,9 +1259,9 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
 	if (!regs)
 		return -ENXIO;
 
-	hdmi->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!hdmi->regs)
-		return -EADDRNOTAVAIL;
+	hdmi->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(hdmi->regs))
+		return PTR_ERR(hdmi->regs);
 
 	err = platform_get_irq(pdev, 0);
 	if (err < 0)
diff --git a/drivers/gpu/drm/tegra/host1x.c b/drivers/gpu/drm/tegra/host1x.c
index 5d17b11..92e25a7 100644
--- a/drivers/gpu/drm/tegra/host1x.c
+++ b/drivers/gpu/drm/tegra/host1x.c
@@ -139,9 +139,9 @@ static int tegra_host1x_probe(struct platform_device *pdev)
 
 	host1x->irq = err;
 
-	host1x->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!host1x->regs) {
-		err = -EADDRNOTAVAIL;
+	host1x->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(host1x->regs)) {
+		err = PTR_ERR(host1x->regs);
 		goto err;
 	}
 
-- 
1.8.1.1

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

* [PATCH 10/33] i2c: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (8 preceding siblings ...)
  2013-01-21 10:09   ` Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-22 22:30     ` Wolfram Sang
  2013-01-21 10:09 ` [PATCH 11/33] iio: " Thierry Reding
                   ` (23 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Ben Dooks, linux-i2c

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: linux-i2c@vger.kernel.org
---
 drivers/i2c/busses/i2c-at91.c    | 6 +++---
 drivers/i2c/busses/i2c-imx.c     | 6 +++---
 drivers/i2c/busses/i2c-ocores.c  | 7 ++++---
 drivers/i2c/busses/i2c-omap.c    | 8 +++-----
 drivers/i2c/busses/i2c-rcar.c    | 8 +++-----
 drivers/i2c/busses/i2c-s3c2410.c | 7 +++----
 drivers/i2c/busses/i2c-sirf.c    | 7 +++----
 drivers/i2c/busses/i2c-stu300.c  | 6 +++---
 drivers/i2c/busses/i2c-tegra.c   | 8 +++-----
 drivers/i2c/busses/i2c-xlr.c     | 9 ++++-----
 10 files changed, 32 insertions(+), 40 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 2bfc04d..ebc2241 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -723,9 +723,9 @@ static int at91_twi_probe(struct platform_device *pdev)
 	if (!dev->pdata)
 		return -ENODEV;
 
-	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!dev->base)
-		return -EBUSY;
+	dev->base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(dev->base))
+		return PTR_ERR(dev->base);
 
 	dev->irq = platform_get_irq(pdev, 0);
 	if (dev->irq < 0)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index b973474..a71ece6 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -511,9 +511,9 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!base)
-		return -EBUSY;
+	base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	i2c_imx = devm_kzalloc(&pdev->dev, sizeof(struct imx_i2c_struct),
 				GFP_KERNEL);
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index a873d0a..a337d08 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -12,6 +12,7 @@
  * kind, whether express or implied.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -364,9 +365,9 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 	if (!i2c)
 		return -ENOMEM;
 
-	i2c->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!i2c->base)
-		return -EADDRNOTAVAIL;
+	i2c->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(i2c->base))
+		return PTR_ERR(i2c->base);
 
 	pdata = pdev->dev.platform_data;
 	if (pdata) {
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 20d41bf..a9bf4ca 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1103,11 +1103,9 @@ omap_i2c_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	dev->base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!dev->base) {
-		dev_err(&pdev->dev, "I2C region already claimed\n");
-		return -ENOMEM;
-	}
+	dev->base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(dev->base))
+		return PTR_ERR(dev->base);
 
 	match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev);
 	if (match) {
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 9bd4d73..4ba4a95 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -642,11 +642,9 @@ static int rcar_i2c_probe(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
-	priv->io = devm_request_and_ioremap(dev, res);
-	if (!priv->io) {
-		dev_err(dev, "cannot ioremap\n");
-		return -ENODEV;
-	}
+	priv->io = devm_ioremap_resource(dev, res);
+	if (IS_ERR(priv->io))
+		return PTR_ERR(priv->io);
 
 	priv->irq = platform_get_irq(pdev, 0);
 	init_waitqueue_head(&priv->wait);
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index a290d08..c807a6d 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1042,11 +1042,10 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 		goto err_clk;
 	}
 
-	i2c->regs = devm_request_and_ioremap(&pdev->dev, res);
+	i2c->regs = devm_ioremap_resource(&pdev->dev, res);
 
-	if (i2c->regs == NULL) {
-		dev_err(&pdev->dev, "cannot map IO\n");
-		ret = -ENXIO;
+	if (IS_ERR(i2c->regs)) {
+		ret = PTR_ERR(i2c->regs);
 		goto err_clk;
 	}
 
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 3f1818b..183cf05 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -308,10 +308,9 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
 		goto out;
 	}
 
-	siic->base = devm_request_and_ioremap(&pdev->dev, mem_res);
-	if (siic->base == NULL) {
-		dev_err(&pdev->dev, "IO remap failed!\n");
-		err = -ENOMEM;
+	siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
+	if (IS_ERR(siic->base)) {
+		err = PTR_ERR(siic->base);
 		goto out;
 	}
 
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 580a0c0..60195b5 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -888,11 +888,11 @@ stu300_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENOENT;
 
-	dev->virtbase = devm_request_and_ioremap(&pdev->dev, res);
+	dev->virtbase = devm_ioremap_resource(&pdev->dev, res);
 	dev_dbg(&pdev->dev, "initialize bus device I2C%d on virtual "
 		"base %p\n", bus_nr, dev->virtbase);
-	if (!dev->virtbase)
-		return -ENOMEM;
+	if (IS_ERR(dev->virtbase))
+		return PTR_ERR(dev->virtbase);
 
 	dev->irq = platform_get_irq(pdev, 0);
 	ret = devm_request_irq(&pdev->dev, dev->irq, stu300_irh, 0, NAME, dev);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 7b38877..1fb3009 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -669,11 +669,9 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!base) {
-		dev_err(&pdev->dev, "Cannot request/ioremap I2C registers\n");
-		return -EADDRNOTAVAIL;
-	}
+	base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index a005265..93f029e 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -7,6 +7,7 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -225,11 +226,9 @@ static int xlr_i2c_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->iobase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!priv->iobase) {
-		dev_err(&pdev->dev, "devm_request_and_ioremap failed\n");
-		return -EBUSY;
-	}
+	priv->iobase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(priv->iobase))
+		return PTR_ERR(priv->iobase);
 
 	priv->adap.dev.parent = &pdev->dev;
 	priv->adap.owner	= THIS_MODULE;
-- 
1.8.1.1


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

* [PATCH 11/33] iio: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (9 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 10/33] i2c: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-22 12:12   ` Jonathan Cameron
  2013-01-21 10:09 ` [PATCH 12/33] Input: " Thierry Reding
                   ` (22 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Jonathan Cameron, linux-iio

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org
---
 drivers/iio/adc/at91_adc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index a526c0e..83c836b 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -557,9 +557,9 @@ static int at91_adc_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	st->reg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!st->reg_base) {
-		ret = -ENOMEM;
+	st->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(st->reg_base)) {
+		ret = PTR_ERR(st->reg_base);
 		goto error_free_device;
 	}
 
-- 
1.8.1.1


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

* [PATCH 12/33] Input: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (10 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 11/33] iio: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:27   ` Dmitry Torokhov
  2013-01-21 10:45   ` Viresh Kumar
  2013-01-21 10:09   ` Thierry Reding
                   ` (21 subsequent siblings)
  33 siblings, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	linux-input

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
---
 drivers/input/keyboard/spear-keyboard.c | 8 +++-----
 drivers/input/serio/arc_ps2.c           | 7 ++++---
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 695d237..cb1e8f6 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -228,11 +228,9 @@ static int spear_kbd_probe(struct platform_device *pdev)
 		kbd->suspended_rate = pdata->suspended_rate;
 	}
 
-	kbd->io_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!kbd->io_base) {
-		dev_err(&pdev->dev, "request-ioremap failed for kbd_region\n");
-		return -ENOMEM;
-	}
+	kbd->io_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(kbd->io_base))
+		return PTR_ERR(kbd->io_base);
 
 	kbd->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(kbd->clk))
diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c
index b571eb3..c52e3e5 100644
--- a/drivers/input/serio/arc_ps2.c
+++ b/drivers/input/serio/arc_ps2.c
@@ -8,6 +8,7 @@
  * Driver is originally developed by Pavel Sokolov <psokolov@synopsys.com>
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
@@ -206,9 +207,9 @@ static int arc_ps2_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	arc_ps2->addr = devm_request_and_ioremap(&pdev->dev, res);
-	if (!arc_ps2->addr)
-		return -EBUSY;
+	arc_ps2->addr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(arc_ps2->addr))
+		return PTR_ERR(arc_ps2->addr);
 
 	dev_info(&pdev->dev, "irq = %d, address = 0x%p, ports = %i\n",
 		 irq, arc_ps2->addr, ARC_PS2_PORTS);
-- 
1.8.1.1


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

* [PATCH 13/33] iommu: Convert to devm_ioremap_resource()
@ 2013-01-21 10:09   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Joerg Roedel, iommu

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
---
 drivers/iommu/tegra-smmu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index fc17889..f08dbcd 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -19,6 +19,7 @@
 
 #define pr_fmt(fmt)	"%s(): " fmt, __func__
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
@@ -1176,9 +1177,9 @@ static int tegra_smmu_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		if (!res)
 			return -ENODEV;
-		smmu->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
-		if (!smmu->regs[i])
-			return -EBUSY;
+		smmu->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(smmu->regs[i]))
+			return PTR_ERR(smmu->regs[i]);
 	}
 
 	err = of_get_dma_window(dev->of_node, NULL, 0, NULL, &base, &size);
-- 
1.8.1.1


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

* [PATCH 13/33] iommu: Convert to devm_ioremap_resource()
@ 2013-01-21 10:09   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Dmitry Torokhov, Wolfram Sang,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
---
 drivers/iommu/tegra-smmu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index fc17889..f08dbcd 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -19,6 +19,7 @@
 
 #define pr_fmt(fmt)	"%s(): " fmt, __func__
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
@@ -1176,9 +1177,9 @@ static int tegra_smmu_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		if (!res)
 			return -ENODEV;
-		smmu->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
-		if (!smmu->regs[i])
-			return -EBUSY;
+		smmu->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(smmu->regs[i]))
+			return PTR_ERR(smmu->regs[i]);
 	}
 
 	err = of_get_dma_window(dev->of_node, NULL, 0, NULL, &base, &size);
-- 
1.8.1.1

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

* [PATCH 14/33] media: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (12 preceding siblings ...)
  2013-01-21 10:09   ` Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-22 11:04   ` Sylwester Nawrocki
  2013-01-21 10:09 ` [PATCH 15/33] memory: " Thierry Reding
                   ` (19 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Mauro Carvalho Chehab, linux-media

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
---
 drivers/media/platform/exynos-gsc/gsc-core.c   |  8 +++-----
 drivers/media/platform/mx2_emmaprp.c           |  6 +++---
 drivers/media/platform/s3c-camif/camif-core.c  |  8 +++-----
 drivers/media/platform/s5p-fimc/fimc-core.c    |  8 +++-----
 drivers/media/platform/s5p-fimc/fimc-lite.c    |  8 +++-----
 drivers/media/platform/s5p-fimc/mipi-csis.c    |  8 +++-----
 drivers/media/platform/s5p-g2d/g2d.c           |  8 +++-----
 drivers/media/platform/s5p-jpeg/jpeg-core.c    |  8 +++-----
 drivers/media/platform/s5p-mfc/s5p_mfc.c       |  8 +++-----
 drivers/media/platform/soc_camera/mx2_camera.c | 12 ++++++------
 10 files changed, 33 insertions(+), 49 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index 2b1b9f3..c1a0713 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1098,11 +1098,9 @@ static int gsc_probe(struct platform_device *pdev)
 	mutex_init(&gsc->lock);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gsc->regs = devm_request_and_ioremap(dev, res);
-	if (!gsc->regs) {
-		dev_err(dev, "failed to map registers\n");
-		return -ENOENT;
-	}
+	gsc->regs = devm_ioremap_resource(dev, res);
+	if (IS_ERR(gsc->regs))
+		return PTR_ERR(gsc->regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
index 6b155d7..4b9e0a2 100644
--- a/drivers/media/platform/mx2_emmaprp.c
+++ b/drivers/media/platform/mx2_emmaprp.c
@@ -941,9 +941,9 @@ static int emmaprp_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pcdev);
 
-	pcdev->base_emma = devm_request_and_ioremap(&pdev->dev, res_emma);
-	if (!pcdev->base_emma) {
-		ret = -ENXIO;
+	pcdev->base_emma = devm_ioremap_resource(&pdev->dev, res_emma);
+	if (IS_ERR(pcdev->base_emma)) {
+		ret = PTR_ERR(pcdev->base_emma);
 		goto rel_vdev;
 	}
 
diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
index e2716c3..09a8c9c 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -433,11 +433,9 @@ static int s3c_camif_probe(struct platform_device *pdev)
 
 	mres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	camif->io_base = devm_request_and_ioremap(dev, mres);
-	if (!camif->io_base) {
-		dev_err(dev, "failed to obtain I/O memory\n");
-		return -ENOENT;
-	}
+	camif->io_base = devm_ioremap_resource(dev, mres);
+	if (IS_ERR(camif->io_base))
+		return PTR_ERR(camif->io_base);
 
 	ret = camif_request_irqs(pdev, camif);
 	if (ret < 0)
diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c
index 545b46a..acc0f84 100644
--- a/drivers/media/platform/s5p-fimc/fimc-core.c
+++ b/drivers/media/platform/s5p-fimc/fimc-core.c
@@ -909,11 +909,9 @@ static int fimc_probe(struct platform_device *pdev)
 	mutex_init(&fimc->lock);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	fimc->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (fimc->regs == NULL) {
-		dev_err(&pdev->dev, "Failed to obtain io memory\n");
-		return -ENOENT;
-	}
+	fimc->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(fimc->regs))
+		return PTR_ERR(fimc->regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res == NULL) {
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index ed67220..67db9f8 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -1426,11 +1426,9 @@ static int fimc_lite_probe(struct platform_device *pdev)
 	mutex_init(&fimc->lock);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	fimc->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (fimc->regs == NULL) {
-		dev_err(&pdev->dev, "Failed to obtain io memory\n");
-		return -ENOENT;
-	}
+	fimc->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(fimc->regs))
+		return PTR_ERR(fimc->regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res == NULL) {
diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c
index ec3fa7d..7abae01 100644
--- a/drivers/media/platform/s5p-fimc/mipi-csis.c
+++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
@@ -686,11 +686,9 @@ static int s5pcsis_probe(struct platform_device *pdev)
 	}
 
 	mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	state->regs = devm_request_and_ioremap(&pdev->dev, mem_res);
-	if (state->regs == NULL) {
-		dev_err(&pdev->dev, "Failed to request and remap io memory\n");
-		return -ENXIO;
-	}
+	state->regs = devm_ioremap_resource(&pdev->dev, mem_res);
+	if (IS_ERR(state->regs))
+		return PTR_ERR(state->regs);
 
 	state->irq = platform_get_irq(pdev, 0);
 	if (state->irq < 0) {
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c
index 1bfbc32..6ed259f 100644
--- a/drivers/media/platform/s5p-g2d/g2d.c
+++ b/drivers/media/platform/s5p-g2d/g2d.c
@@ -708,11 +708,9 @@ static int g2d_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	dev->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (dev->regs == NULL) {
-			dev_err(&pdev->dev, "Failed to obtain io memory\n");
-			return -ENOENT;
-	}
+	dev->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dev->regs))
+		return PTR_ERR(dev->regs);
 
 	dev->clk = clk_get(&pdev->dev, "sclk_fimg2d");
 	if (IS_ERR_OR_NULL(dev->clk)) {
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 17983c4..3b02375 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1325,11 +1325,9 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
 	/* memory-mapped registers */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	jpeg->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (jpeg->regs == NULL) {
-		dev_err(&pdev->dev, "Failed to obtain io memory\n");
-		return -ENOENT;
-	}
+	jpeg->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(jpeg->regs))
+		return PTR_ERR(jpeg->regs);
 
 	/* interrupt service routine registration */
 	jpeg->irq = ret = platform_get_irq(pdev, 0);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 379f574..b2e9e1a 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1061,11 +1061,9 @@ static int s5p_mfc_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	dev->regs_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (dev->regs_base == NULL) {
-		dev_err(&pdev->dev, "Failed to obtain io memory\n");
-		return -ENOENT;
-	}
+	dev->regs_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dev->regs_base))
+		return PTR_ERR(dev->regs_base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res == NULL) {
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c
index 8bda2c9..1abdc7d 100644
--- a/drivers/media/platform/soc_camera/mx2_camera.c
+++ b/drivers/media/platform/soc_camera/mx2_camera.c
@@ -1707,9 +1707,9 @@ static int mx27_camera_emma_init(struct platform_device *pdev)
 		goto out;
 	}
 
-	pcdev->base_emma = devm_request_and_ioremap(pcdev->dev, res_emma);
-	if (!pcdev->base_emma) {
-		err = -EADDRNOTAVAIL;
+	pcdev->base_emma = devm_ioremap_resource(pcdev->dev, res_emma);
+	if (IS_ERR(pcdev->base_emma)) {
+		err = PTR_ERR(pcdev->base_emma);
 		goto out;
 	}
 
@@ -1824,9 +1824,9 @@ static int mx2_camera_probe(struct platform_device *pdev)
 	INIT_LIST_HEAD(&pcdev->discard);
 	spin_lock_init(&pcdev->lock);
 
-	pcdev->base_csi = devm_request_and_ioremap(&pdev->dev, res_csi);
-	if (!pcdev->base_csi) {
-		err = -EADDRNOTAVAIL;
+	pcdev->base_csi = devm_ioremap_resource(&pdev->dev, res_csi);
+	if (IS_ERR(pcdev->base_csi)) {
+		err = PTR_ERR(pcdev->base_csi);
 		goto exit;
 	}
 
-- 
1.8.1.1


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

* [PATCH 15/33] memory: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (13 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 14/33] media: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 16/33] mfd: " Thierry Reding
                   ` (18 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/memory/emif.c       | 8 +++-----
 drivers/memory/tegra20-mc.c | 7 ++++---
 drivers/memory/tegra30-mc.c | 7 ++++---
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 06d31c9..df08736 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -10,6 +10,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/reboot.h>
 #include <linux/platform_data/emif_plat.h>
@@ -1468,12 +1469,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev)
 		goto error;
 	}
 
-	emif->base = devm_request_and_ioremap(emif->dev, res);
-	if (!emif->base) {
-		dev_err(emif->dev, "%s: devm_request_and_ioremap() failed\n",
-			__func__);
+	emif->base = devm_ioremap_resource(emif->dev, res);
+	if (IS_ERR(emif->base))
 		goto error;
-	}
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index 186f27d..2ca5f28 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -17,6 +17,7 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ratelimit.h>
@@ -216,9 +217,9 @@ static int tegra20_mc_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		if (!res)
 			return -ENODEV;
-		mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
-		if (!mc->regs[i])
-			return -EBUSY;
+		mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(mc->regs[i]))
+			return PTR_ERR(mc->regs[i]);
 	}
 
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index 0b7ab93..0b97598 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -17,6 +17,7 @@
  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ratelimit.h>
@@ -336,9 +337,9 @@ static int tegra30_mc_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		if (!res)
 			return -ENODEV;
-		mc->regs[i] = devm_request_and_ioremap(&pdev->dev, res);
-		if (!mc->regs[i])
-			return -EBUSY;
+		mc->regs[i] = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(mc->regs[i]))
+			return PTR_ERR(mc->regs[i]);
 	}
 
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-- 
1.8.1.1


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

* [PATCH 16/33] mfd: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (14 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 15/33] memory: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-02-03 17:22   ` Samuel Ortiz
  2013-01-21 10:09 ` [PATCH 17/33] misc: " Thierry Reding
                   ` (17 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Samuel Ortiz

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Samuel Ortiz <sameo@linux.intel.com>
---
 drivers/mfd/intel_msic.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c
index ab8d0b2..1804331 100644
--- a/drivers/mfd/intel_msic.c
+++ b/drivers/mfd/intel_msic.c
@@ -9,6 +9,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
 #include <linux/module.h>
@@ -424,11 +425,9 @@ static int intel_msic_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	msic->irq_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!msic->irq_base) {
-		dev_err(&pdev->dev, "failed to map SRAM memory\n");
-		return -ENOMEM;
-	}
+	msic->irq_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(msic->irq_base))
+		return PTR_ERR(msic->irq_base);
 
 	platform_set_drvdata(pdev, msic);
 
-- 
1.8.1.1


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

* [PATCH 17/33] misc: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (15 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 16/33] mfd: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 18/33] mmc: " Thierry Reding
                   ` (16 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 drivers/misc/atmel-ssc.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 3c09cbb..c208238 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -159,11 +159,9 @@ static int ssc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	ssc->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!ssc->regs) {
-		dev_dbg(&pdev->dev, "ioremap failed\n");
-		return -EINVAL;
-	}
+	ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(ssc->regs))
+		return PTR_ERR(ssc->regs);
 
 	ssc->phybase = regs->start;
 
-- 
1.8.1.1


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

* [PATCH 18/33] mmc: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (16 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 17/33] misc: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09   ` Thierry Reding
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Chris Ball, Ben Dooks, linux-mmc

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Chris Ball <cjb@laptop.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/host/dw_mmc-pltfm.c | 7 ++++---
 drivers/mmc/host/mxs-mmc.c      | 6 +++---
 drivers/mmc/host/sdhci-s3c.c    | 7 +++----
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 5e1fb1d..41c27b7 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -10,6 +10,7 @@
  * (at your option) any later version.
  */
 
+#include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/io.h>
@@ -46,9 +47,9 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
 	host->dev = &pdev->dev;
 	host->irq_flags = 0;
 	host->pdata = pdev->dev.platform_data;
-	host->regs = devm_request_and_ioremap(&pdev->dev, regs);
-	if (!host->regs)
-		return -ENOMEM;
+	host->regs = devm_ioremap_resource(&pdev->dev, regs);
+	if (IS_ERR(host->regs))
+		return PTR_ERR(host->regs);
 
 	if (drv_data && drv_data->init) {
 		ret = drv_data->init(host);
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 206fe49..5b66555 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -614,9 +614,9 @@ static int mxs_mmc_probe(struct platform_device *pdev)
 	host = mmc_priv(mmc);
 	ssp = &host->ssp;
 	ssp->dev = &pdev->dev;
-	ssp->base = devm_request_and_ioremap(&pdev->dev, iores);
-	if (!ssp->base) {
-		ret = -EADDRNOTAVAIL;
+	ssp->base = devm_ioremap_resource(&pdev->dev, iores);
+	if (IS_ERR(ssp->base)) {
+		ret = PTR_ERR(ssp->base);
 		goto out_mmc_free;
 	}
 
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 82a8de1..a0c6214 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -651,10 +651,9 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
 #endif
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->ioaddr) {
-		dev_err(dev, "failed to map registers\n");
-		ret = -ENXIO;
+	host->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->ioaddr)) {
+		ret = PTR_ERR(host->ioaddr);
 		goto err_req_regs;
 	}
 
-- 
1.8.1.1


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

* [PATCH 19/33] mtd: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
@ 2013-01-21 10:09   ` Thierry Reding
  2013-01-21 10:08   ` Thierry Reding
                     ` (32 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	David Woodhouse, linux-mtd

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/devices/spear_smi.c   |  7 +++----
 drivers/mtd/maps/autcpu12-nvram.c |  9 ++++-----
 drivers/mtd/maps/lantiq-flash.c   |  8 ++++----
 drivers/mtd/nand/fsmc_nand.c      | 33 +++++++++++++--------------------
 drivers/mtd/nand/lpc32xx_mlc.c    |  9 ++++-----
 drivers/mtd/nand/lpc32xx_slc.c    |  8 +++-----
 drivers/mtd/nand/mxc_nand.c       | 12 ++++++------
 drivers/mtd/nand/s3c2410.c        |  7 +++----
 drivers/mtd/nand/txx9ndfmc.c      |  7 ++++---
 9 files changed, 44 insertions(+), 56 deletions(-)

diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index 2aabd96..8a82b8b 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -949,10 +949,9 @@ static int spear_smi_probe(struct platform_device *pdev)
 
 	smi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	dev->io_base = devm_request_and_ioremap(&pdev->dev, smi_base);
-	if (!dev->io_base) {
-		ret = -EIO;
-		dev_err(&pdev->dev, "devm_request_and_ioremap fail\n");
+	dev->io_base = devm_ioremap_resource(&pdev->dev, smi_base);
+	if (IS_ERR(dev->io_base)) {
+		ret = PTR_ERR(dev->io_base);
 		goto err;
 	}
 
diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c
index a2dc2ae..c3525d2 100644
--- a/drivers/mtd/maps/autcpu12-nvram.c
+++ b/drivers/mtd/maps/autcpu12-nvram.c
@@ -16,6 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include <linux/err.h>
 #include <linux/sizes.h>
 
 #include <linux/types.h>
@@ -55,12 +56,10 @@ static int autcpu12_nvram_probe(struct platform_device *pdev)
 	priv->map.bankwidth	= 4;
 	priv->map.phys		= res->start;
 	priv->map.size		= resource_size(res);
-	priv->map.virt		= devm_request_and_ioremap(&pdev->dev, res);
+	priv->map.virt = devm_ioremap_resource(&pdev->dev, res);
 	strcpy((char *)priv->map.name, res->name);
-	if (!priv->map.virt) {
-		dev_err(&pdev->dev, "failed to remap mem resource\n");
-		return -EBUSY;
-	}
+	if (IS_ERR(priv->map.virt))
+		return PTR_ERR(priv->map.virt);
 
 	simple_map_init(&priv->map);
 
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index 3c3c791..d1da6ed 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -7,6 +7,7 @@
  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -136,10 +137,9 @@ ltq_mtd_probe(struct platform_device *pdev)
 	ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL);
 	ltq_mtd->map->phys = ltq_mtd->res->start;
 	ltq_mtd->map->size = resource_size(ltq_mtd->res);
-	ltq_mtd->map->virt = devm_request_and_ioremap(&pdev->dev, ltq_mtd->res);
-	if (!ltq_mtd->map->virt) {
-		dev_err(&pdev->dev, "failed to remap mem resource\n");
-		err = -EBUSY;
+	ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res);
+	if (IS_ERR(ltq_mtd->map->virt)) {
+		err = PTR_ERR(ltq_mtd->map->virt);
 		goto err_out;
 	}
 
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 67e62d3..c543cc0 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -937,42 +937,35 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	host->data_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->data_va) {
-		dev_err(&pdev->dev, "data ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->data_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->data_va))
+		return PTR_ERR(host->data_va);
+	
 	host->data_pa = (dma_addr_t)res->start;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_addr");
 	if (!res)
 		return -EINVAL;
 
-	host->addr_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->addr_va) {
-		dev_err(&pdev->dev, "ale ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->addr_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->addr_va))
+		return PTR_ERR(host->addr_va);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_cmd");
 	if (!res)
 		return -EINVAL;
 
-	host->cmd_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->cmd_va) {
-		dev_err(&pdev->dev, "ale ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->cmd_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->cmd_va))
+		return PTR_ERR(host->cmd_va);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fsmc_regs");
 	if (!res)
 		return -EINVAL;
 
-	host->regs_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->regs_va) {
-		dev_err(&pdev->dev, "regs ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->regs_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->regs_va))
+		return PTR_ERR(host->regs_va);
 
 	host->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(host->clk)) {
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index f182bef..0ca22ae 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -677,11 +677,10 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	host->io_base = devm_request_and_ioremap(&pdev->dev, rc);
-	if (host->io_base == NULL) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -EIO;
-	}
+	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
+	if (IS_ERR(host->io_base))
+		return PTR_ERR(host->io_base);
+	
 	host->io_base_phy = rc->start;
 
 	mtd = &host->mtd;
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 030b78c..be94ed5 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -778,11 +778,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 	}
 	host->io_base_dma = rc->start;
 
-	host->io_base = devm_request_and_ioremap(&pdev->dev, rc);
-	if (host->io_base == NULL) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
+	if (IS_ERR(host->io_base))
+		return PTR_ERR(host->io_base);
 
 	if (pdev->dev.of_node)
 		host->ncfg = lpc32xx_parse_dt(&pdev->dev);
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 45204e4..60ac5b9 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1437,9 +1437,9 @@ static int mxcnd_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		if (!res)
 			return -ENODEV;
-		host->regs_ip = devm_request_and_ioremap(&pdev->dev, res);
-		if (!host->regs_ip)
-			return -ENOMEM;
+		host->regs_ip = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(host->regs_ip))
+			return PTR_ERR(host->regs_ip);
 
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	} else {
@@ -1449,9 +1449,9 @@ static int mxcnd_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	host->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->base)
-		return -ENOMEM;
+	host->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->base))
+		return PTR_ERR(host->base);
 
 	host->main_area0 = host->base;
 
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index df954b4..d65afd2 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -952,10 +952,9 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 	info->platform	= plat;
 	info->cpu_type	= cpu_type;
 
-	info->regs	= devm_request_and_ioremap(&pdev->dev, res);
-	if (info->regs == NULL) {
-		dev_err(&pdev->dev, "cannot reserve register region\n");
-		err = -EIO;
+	info->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->regs)) {
+		err = PTR_ERR(info->regs);
 		goto exit_error;
 	}
 
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index e3d7266..e1e8748 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -9,6 +9,7 @@
  * (C) Copyright TOSHIBA CORPORATION 2004-2007
  * All Rights Reserved.
  */
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
@@ -286,9 +287,9 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
 	drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL);
 	if (!drvdata)
 		return -ENOMEM;
-	drvdata->base = devm_request_and_ioremap(&dev->dev, res);
-	if (!drvdata->base)
-		return -EBUSY;
+	drvdata->base = devm_ioremap_resource(&dev->dev, res);
+	if (IS_ERR(drvdata->base))
+		return PTR_ERR(drvdata->base);
 
 	hold = plat->hold ?: 20; /* tDH */
 	spw = plat->spw ?: 90; /* max(tREADID, tWP, tRP) */
-- 
1.8.1.1


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

* [PATCH 19/33] mtd: Convert to devm_ioremap_resource()
@ 2013-01-21 10:09   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Dmitry Torokhov, Wolfram Sang,
	linux-mtd, David Woodhouse

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/devices/spear_smi.c   |  7 +++----
 drivers/mtd/maps/autcpu12-nvram.c |  9 ++++-----
 drivers/mtd/maps/lantiq-flash.c   |  8 ++++----
 drivers/mtd/nand/fsmc_nand.c      | 33 +++++++++++++--------------------
 drivers/mtd/nand/lpc32xx_mlc.c    |  9 ++++-----
 drivers/mtd/nand/lpc32xx_slc.c    |  8 +++-----
 drivers/mtd/nand/mxc_nand.c       | 12 ++++++------
 drivers/mtd/nand/s3c2410.c        |  7 +++----
 drivers/mtd/nand/txx9ndfmc.c      |  7 ++++---
 9 files changed, 44 insertions(+), 56 deletions(-)

diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index 2aabd96..8a82b8b 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -949,10 +949,9 @@ static int spear_smi_probe(struct platform_device *pdev)
 
 	smi_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	dev->io_base = devm_request_and_ioremap(&pdev->dev, smi_base);
-	if (!dev->io_base) {
-		ret = -EIO;
-		dev_err(&pdev->dev, "devm_request_and_ioremap fail\n");
+	dev->io_base = devm_ioremap_resource(&pdev->dev, smi_base);
+	if (IS_ERR(dev->io_base)) {
+		ret = PTR_ERR(dev->io_base);
 		goto err;
 	}
 
diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c
index a2dc2ae..c3525d2 100644
--- a/drivers/mtd/maps/autcpu12-nvram.c
+++ b/drivers/mtd/maps/autcpu12-nvram.c
@@ -16,6 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+#include <linux/err.h>
 #include <linux/sizes.h>
 
 #include <linux/types.h>
@@ -55,12 +56,10 @@ static int autcpu12_nvram_probe(struct platform_device *pdev)
 	priv->map.bankwidth	= 4;
 	priv->map.phys		= res->start;
 	priv->map.size		= resource_size(res);
-	priv->map.virt		= devm_request_and_ioremap(&pdev->dev, res);
+	priv->map.virt = devm_ioremap_resource(&pdev->dev, res);
 	strcpy((char *)priv->map.name, res->name);
-	if (!priv->map.virt) {
-		dev_err(&pdev->dev, "failed to remap mem resource\n");
-		return -EBUSY;
-	}
+	if (IS_ERR(priv->map.virt))
+		return PTR_ERR(priv->map.virt);
 
 	simple_map_init(&priv->map);
 
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index 3c3c791..d1da6ed 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -7,6 +7,7 @@
  *  Copyright (C) 2010 John Crispin <blogic@openwrt.org>
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -136,10 +137,9 @@ ltq_mtd_probe(struct platform_device *pdev)
 	ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL);
 	ltq_mtd->map->phys = ltq_mtd->res->start;
 	ltq_mtd->map->size = resource_size(ltq_mtd->res);
-	ltq_mtd->map->virt = devm_request_and_ioremap(&pdev->dev, ltq_mtd->res);
-	if (!ltq_mtd->map->virt) {
-		dev_err(&pdev->dev, "failed to remap mem resource\n");
-		err = -EBUSY;
+	ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res);
+	if (IS_ERR(ltq_mtd->map->virt)) {
+		err = PTR_ERR(ltq_mtd->map->virt);
 		goto err_out;
 	}
 
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 67e62d3..c543cc0 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -937,42 +937,35 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	host->data_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->data_va) {
-		dev_err(&pdev->dev, "data ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->data_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->data_va))
+		return PTR_ERR(host->data_va);
+	
 	host->data_pa = (dma_addr_t)res->start;
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_addr");
 	if (!res)
 		return -EINVAL;
 
-	host->addr_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->addr_va) {
-		dev_err(&pdev->dev, "ale ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->addr_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->addr_va))
+		return PTR_ERR(host->addr_va);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_cmd");
 	if (!res)
 		return -EINVAL;
 
-	host->cmd_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->cmd_va) {
-		dev_err(&pdev->dev, "ale ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->cmd_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->cmd_va))
+		return PTR_ERR(host->cmd_va);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fsmc_regs");
 	if (!res)
 		return -EINVAL;
 
-	host->regs_va = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->regs_va) {
-		dev_err(&pdev->dev, "regs ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->regs_va = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->regs_va))
+		return PTR_ERR(host->regs_va);
 
 	host->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(host->clk)) {
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index f182bef..0ca22ae 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -677,11 +677,10 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	host->io_base = devm_request_and_ioremap(&pdev->dev, rc);
-	if (host->io_base == NULL) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -EIO;
-	}
+	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
+	if (IS_ERR(host->io_base))
+		return PTR_ERR(host->io_base);
+	
 	host->io_base_phy = rc->start;
 
 	mtd = &host->mtd;
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c
index 030b78c..be94ed5 100644
--- a/drivers/mtd/nand/lpc32xx_slc.c
+++ b/drivers/mtd/nand/lpc32xx_slc.c
@@ -778,11 +778,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 	}
 	host->io_base_dma = rc->start;
 
-	host->io_base = devm_request_and_ioremap(&pdev->dev, rc);
-	if (host->io_base == NULL) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -ENOMEM;
-	}
+	host->io_base = devm_ioremap_resource(&pdev->dev, rc);
+	if (IS_ERR(host->io_base))
+		return PTR_ERR(host->io_base);
 
 	if (pdev->dev.of_node)
 		host->ncfg = lpc32xx_parse_dt(&pdev->dev);
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 45204e4..60ac5b9 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1437,9 +1437,9 @@ static int mxcnd_probe(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 		if (!res)
 			return -ENODEV;
-		host->regs_ip = devm_request_and_ioremap(&pdev->dev, res);
-		if (!host->regs_ip)
-			return -ENOMEM;
+		host->regs_ip = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(host->regs_ip))
+			return PTR_ERR(host->regs_ip);
 
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	} else {
@@ -1449,9 +1449,9 @@ static int mxcnd_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	host->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!host->base)
-		return -ENOMEM;
+	host->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(host->base))
+		return PTR_ERR(host->base);
 
 	host->main_area0 = host->base;
 
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index df954b4..d65afd2 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -952,10 +952,9 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
 	info->platform	= plat;
 	info->cpu_type	= cpu_type;
 
-	info->regs	= devm_request_and_ioremap(&pdev->dev, res);
-	if (info->regs == NULL) {
-		dev_err(&pdev->dev, "cannot reserve register region\n");
-		err = -EIO;
+	info->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->regs)) {
+		err = PTR_ERR(info->regs);
 		goto exit_error;
 	}
 
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index e3d7266..e1e8748 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -9,6 +9,7 @@
  * (C) Copyright TOSHIBA CORPORATION 2004-2007
  * All Rights Reserved.
  */
+#include <linux/err.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
@@ -286,9 +287,9 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
 	drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL);
 	if (!drvdata)
 		return -ENOMEM;
-	drvdata->base = devm_request_and_ioremap(&dev->dev, res);
-	if (!drvdata->base)
-		return -EBUSY;
+	drvdata->base = devm_ioremap_resource(&dev->dev, res);
+	if (IS_ERR(drvdata->base))
+		return PTR_ERR(drvdata->base);
 
 	hold = plat->hold ?: 20; /* tDH */
 	spw = plat->spw ?: 90; /* max(tREADID, tWP, tRP) */
-- 
1.8.1.1

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

* [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (18 preceding siblings ...)
  2013-01-21 10:09   ` Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 20:29   ` David Miller
  2013-01-21 10:09 ` [PATCH 21/33] pinctrl: " Thierry Reding
                   ` (13 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	David S. Miller, netdev

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
 drivers/net/can/grcan.c                               | 8 ++++----
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 ++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index 17fbc7a..4c3a7dd 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -26,6 +26,7 @@
  * Contributors: Andreas Larsson <andreas@gaisler.com>
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -1683,10 +1684,9 @@ static int grcan_probe(struct platform_device *ofdev)
 	}
 
 	res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-	base = devm_request_and_ioremap(&ofdev->dev, res);
-	if (!base) {
-		dev_err(&ofdev->dev, "couldn't map IO resource\n");
-		err = -EADDRNOTAVAIL;
+	base = devm_ioremap_resource(&ofdev->dev, res);
+	if (IS_ERR(base)) {
+		err = PTR_ERR(base);
 		goto exit_error;
 	}
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index b43d68b..a3431aa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -22,6 +22,7 @@
   Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
 *******************************************************************************/
 
+#include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/of.h>
@@ -88,11 +89,9 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	addr = devm_request_and_ioremap(dev, res);
-	if (!addr) {
-		pr_err("%s: ERROR: memory mapping failed", __func__);
-		return -ENOMEM;
-	}
+	addr = devm_ioremap_resource(dev, res);
+	if (IS_ERR(addr))
+		return PTR_ERR(addr);
 
 	if (pdev->dev.of_node) {
 		plat_dat = devm_kzalloc(&pdev->dev,
-- 
1.8.1.1


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

* [PATCH 21/33] pinctrl: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (19 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 20/33] net: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:50   ` Viresh Kumar
  2013-01-21 10:09 ` [PATCH 22/33] power: " Thierry Reding
                   ` (12 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Linus Walleij

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/pinctrl/pinctrl-at91.c         |  7 +++----
 drivers/pinctrl/pinctrl-bcm2835.c      |  6 +++---
 drivers/pinctrl/pinctrl-coh901.c       |  8 +++-----
 drivers/pinctrl/pinctrl-exynos5440.c   |  8 +++-----
 drivers/pinctrl/pinctrl-falcon.c       | 13 +++++--------
 drivers/pinctrl/pinctrl-imx.c          |  6 +++---
 drivers/pinctrl/pinctrl-nomadik.c      |  6 +++---
 drivers/pinctrl/pinctrl-pxa3xx.c       |  7 ++++---
 drivers/pinctrl/pinctrl-samsung.c      |  8 +++-----
 drivers/pinctrl/pinctrl-u300.c         |  6 +++---
 drivers/pinctrl/pinctrl-xway.c         |  9 ++++-----
 drivers/pinctrl/spear/pinctrl-plgpio.c |  8 +++-----
 12 files changed, 40 insertions(+), 52 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 471c71f..75933a6 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1503,10 +1503,9 @@ static int at91_gpio_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	at91_chip->regbase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!at91_chip->regbase) {
-		dev_err(&pdev->dev, "failed to map registers, ignoring.\n");
-		ret = -EBUSY;
+	at91_chip->regbase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(at91_chip->regbase)) {
+		ret = PTR_ERR(at91_chip->regbase);
 		goto err;
 	}
 
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index d347b9f..4eb6d2c 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -959,9 +959,9 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	pc->base = devm_request_and_ioremap(dev, &iomem);
-	if (!pc->base)
-		return -EADDRNOTAVAIL;
+	pc->base = devm_ioremap_resource(dev, &iomem);
+	if (IS_ERR(pc->base))
+		return PTR_ERR(pc->base);
 
 	pc->gpio_chip = bcm2835_gpio_chip;
 	pc->gpio_chip.dev = dev;
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index fbb3715..8b7e7bc 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -715,11 +715,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	gpio->base = devm_request_and_ioremap(&pdev->dev, memres);
-	if (!gpio->base) {
-		dev_err(gpio->dev, "could not get remap memory\n");
-		return -ENOMEM;
-	}
+	gpio->base = devm_ioremap_resource(&pdev->dev, memres);
+	if (IS_ERR(gpio->base))
+		return PTR_ERR(gpio->base);
 
 	gpio->clk = devm_clk_get(gpio->dev, NULL);
 	if (IS_ERR(gpio->clk)) {
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c
index de05b64..5e77242 100644
--- a/drivers/pinctrl/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/pinctrl-exynos5440.c
@@ -866,11 +866,9 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	priv->reg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!priv->reg_base) {
-		dev_err(dev, "ioremap failed\n");
-		return -ENODEV;
-	}
+	priv->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(priv->reg_base))
+		return PTR_ERR(priv->reg_base);
 
 	ret = exynos5440_gpiolib_register(pdev, priv);
 	if (ret)
diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
index 8ed20e8..a5d9d56 100644
--- a/drivers/pinctrl/pinctrl-falcon.c
+++ b/drivers/pinctrl/pinctrl-falcon.c
@@ -411,14 +411,11 @@ static int pinctrl_falcon_probe(struct platform_device *pdev)
 			dev_err(&ppdev->dev, "failed to get clock\n");
 			return PTR_ERR(falcon_info.clk[*bank]);
 		}
-		falcon_info.membase[*bank] =
-				devm_request_and_ioremap(&pdev->dev, &res);
-		if (!falcon_info.membase[*bank]) {
-			dev_err(&pdev->dev,
-				"Failed to remap memory for bank %d\n",
-				*bank);
-			return -ENOMEM;
-		}
+		falcon_info.membase[*bank] = devm_ioremap_resource(&pdev->dev,
+								   &res);
+		if (IS_ERR(falcon_info.membase[*bank]))
+			return PTR_ERR(falcon_info.membase[*bank]);
+		
 		avail = pad_r32(falcon_info.membase[*bank],
 					LTQ_PADC_AVAIL);
 		pins = fls(avail);
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 43a6f1f..4cebb9c 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -584,9 +584,9 @@ int imx_pinctrl_probe(struct platform_device *pdev,
 	if (!res)
 		return -ENOENT;
 
-	ipctl->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ipctl->base)
-		return -EBUSY;
+	ipctl->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ipctl->base))
+		return PTR_ERR(ipctl->base);
 
 	imx_pinctrl_desc.name = dev_name(&pdev->dev);
 	imx_pinctrl_desc.pins = info->pins;
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 1bb16ff..96e7cfb 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -1367,9 +1367,9 @@ static int nmk_gpio_probe(struct platform_device *dev)
 		goto out;
 	}
 
-	base = devm_request_and_ioremap(&dev->dev, res);
-	if (!base) {
-		ret = -ENOMEM;
+	base = devm_ioremap_resource(&dev->dev, res);
+	if (IS_ERR(base)) {
+		ret = PTR_ERR(base);
 		goto out;
 	}
 
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
index 51f8a38..1f49bb0 100644
--- a/drivers/pinctrl/pinctrl-pxa3xx.c
+++ b/drivers/pinctrl/pinctrl-pxa3xx.c
@@ -11,6 +11,7 @@
  *
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/io.h>
@@ -187,9 +188,9 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev,
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
 		return -ENOENT;
-	info->virt_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!info->virt_base)
-		return -ENOMEM;
+	info->virt_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->virt_base))
+		return PTR_ERR(info->virt_base);
 	info->pctrl = pinctrl_register(desc, &pdev->dev, info);
 	if (!info->pctrl) {
 		dev_err(&pdev->dev, "failed to register PXA pinmux driver\n");
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index fd7b24c..7e6669c 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -917,11 +917,9 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	drvdata->virt_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!drvdata->virt_base) {
-		dev_err(dev, "ioremap failed\n");
-		return -ENODEV;
-	}
+	drvdata->virt_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(drvdata->virt_base))
+		return PTR_ERR(drvdata->virt_base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res)
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index 718ec57..2b57725 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -1078,9 +1078,9 @@ static int u300_pmx_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENOENT;
 
-	upmx->virtbase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!upmx->virtbase)
-		return -ENOMEM;
+	upmx->virtbase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(upmx->virtbase))
+		return PTR_ERR(upmx->virtbase);
 
 	upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx);
 	if (!upmx->pctl) {
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index 5f0eb04..ae8f3a0 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -9,6 +9,7 @@
  *  Copyright (C) 2012 John Crispin <blogic@openwrt.org>
  */
 
+#include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
@@ -687,11 +688,9 @@ static int pinmux_xway_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Failed to get resource\n");
 		return -ENOENT;
 	}
-	xway_info.membase[0] = devm_request_and_ioremap(&pdev->dev, res);
-	if (!xway_info.membase[0]) {
-		dev_err(&pdev->dev, "Failed to remap resource\n");
-		return -ENOMEM;
-	}
+	xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(xway_info.membase[0]))
+		return PTR_ERR(xway_info.membase[0]);
 
 	match = of_match_device(xway_match, &pdev->dev);
 	if (match)
diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 3cf4ecd..295b349 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -540,11 +540,9 @@ static int plgpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	plgpio->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!plgpio->base) {
-		dev_err(&pdev->dev, "request and ioremap fail\n");
-		return -ENOMEM;
-	}
+	plgpio->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(plgpio->base))
+		return PTR_ERR(plgpio->base);
 
 	ret = plgpio_probe_dt(pdev, plgpio);
 	if (ret) {
-- 
1.8.1.1


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

* [PATCH 22/33] power: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (20 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 21/33] pinctrl: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 23/33] pwm: " Thierry Reding
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Anton Vorontsov, David Woodhouse

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
---
 drivers/power/jz4740-battery.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c
index bf91489..c675553 100644
--- a/drivers/power/jz4740-battery.c
+++ b/drivers/power/jz4740-battery.c
@@ -22,6 +22,7 @@
 #include <linux/io.h>
 
 #include <linux/delay.h>
+#include <linux/err.h>
 #include <linux/gpio.h>
 #include <linux/mfd/core.h>
 #include <linux/power_supply.h>
@@ -266,9 +267,9 @@ static int jz_battery_probe(struct platform_device *pdev)
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	jz_battery->base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!jz_battery->base)
-		return -EBUSY;
+	jz_battery->base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(jz_battery->base))
+		return PTR_ERR(jz_battery->base);
 
 	battery = &jz_battery->battery;
 	battery->name = pdata->info.name;
-- 
1.8.1.1


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

* [PATCH 23/33] pwm: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (21 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 22/33] power: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:49   ` Viresh Kumar
  2013-01-21 10:09 ` [PATCH 24/33] rtc: " Thierry Reding
                   ` (10 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Thierry Reding <thierry.reding@avionic-design.de>
---
 drivers/pwm/pwm-imx.c      | 6 +++---
 drivers/pwm/pwm-lpc32xx.c  | 6 +++---
 drivers/pwm/pwm-mxs.c      | 6 +++---
 drivers/pwm/pwm-puv3.c     | 6 +++---
 drivers/pwm/pwm-pxa.c      | 6 +++---
 drivers/pwm/pwm-spear.c    | 6 +++---
 drivers/pwm/pwm-tegra.c    | 6 +++---
 drivers/pwm/pwm-tiecap.c   | 6 +++---
 drivers/pwm/pwm-tiehrpwm.c | 6 +++---
 drivers/pwm/pwm-tipwmss.c  | 6 +++---
 drivers/pwm/pwm-vt8500.c   | 6 +++---
 11 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index 65a86bd..3f5677b 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -274,9 +274,9 @@ static int imx_pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	imx->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (imx->mmio_base == NULL)
-		return -EADDRNOTAVAIL;
+	imx->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(imx->mmio_base))
+		return PTR_ERR(imx->mmio_base);
 
 	data = of_id->data;
 	imx->config = data->config;
diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
index 1410644..b3f0d0d 100644
--- a/drivers/pwm/pwm-lpc32xx.c
+++ b/drivers/pwm/pwm-lpc32xx.c
@@ -110,9 +110,9 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
 	if (!res)
 		return -EINVAL;
 
-	lpc32xx->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!lpc32xx->base)
-		return -EADDRNOTAVAIL;
+	lpc32xx->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(lpc32xx->base))
+		return PTR_ERR(lpc32xx->base);
 
 	lpc32xx->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(lpc32xx->clk))
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 7ec345f..a53d309 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -139,9 +139,9 @@ static int mxs_pwm_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mxs->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!mxs->base)
-		return -EADDRNOTAVAIL;
+	mxs->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(mxs->base))
+		return PTR_ERR(mxs->base);
 
 	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
 	if (IS_ERR(pinctrl))
diff --git a/drivers/pwm/pwm-puv3.c b/drivers/pwm/pwm-puv3.c
index b882f60..db964e6e 100644
--- a/drivers/pwm/pwm-puv3.c
+++ b/drivers/pwm/pwm-puv3.c
@@ -123,9 +123,9 @@ static int pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	puv3->base = devm_request_and_ioremap(&pdev->dev, r);
-	if (puv3->base == NULL)
-		return -EADDRNOTAVAIL;
+	puv3->base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(puv3->base))
+		return PTR_ERR(puv3->base);
 
 	puv3->chip.dev = &pdev->dev;
 	puv3->chip.ops = &puv3_pwm_ops;
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index f32fc4e..20370e6 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -165,9 +165,9 @@ static int pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	pwm->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (pwm->mmio_base == NULL)
-		return -EADDRNOTAVAIL;
+	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(pwm->mmio_base))
+		return PTR_ERR(pwm->mmio_base);
 
 	ret = pwmchip_add(&pwm->chip);
 	if (ret < 0) {
diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
index 83b21d9..69a2d9e 100644
--- a/drivers/pwm/pwm-spear.c
+++ b/drivers/pwm/pwm-spear.c
@@ -192,9 +192,9 @@ static int spear_pwm_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pc->mmio_base)
-		return -EADDRNOTAVAIL;
+	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(pc->mmio_base))
+		return PTR_ERR(pc->mmio_base);
 
 	pc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pc->clk))
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c
index 30c0e2b..71900e8 100644
--- a/drivers/pwm/pwm-tegra.c
+++ b/drivers/pwm/pwm-tegra.c
@@ -186,9 +186,9 @@ static int tegra_pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	pwm->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pwm->mmio_base)
-		return -EADDRNOTAVAIL;
+	pwm->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(pwm->mmio_base))
+		return PTR_ERR(pwm->mmio_base);
 
 	platform_set_drvdata(pdev, pwm);
 
diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index 5cf016d..27a67d6 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -238,9 +238,9 @@ static int ecap_pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pc->mmio_base)
-		return -EADDRNOTAVAIL;
+	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(pc->mmio_base))
+		return PTR_ERR(pc->mmio_base);
 
 	ret = pwmchip_add(&pc->chip);
 	if (ret < 0) {
diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 72a6dd4..5a13995 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -453,9 +453,9 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!pc->mmio_base)
-		return  -EADDRNOTAVAIL;
+	pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(pc->mmio_base))
+		return PTR_ERR(pc->mmio_base);
 
 	/* Acquire tbclk for Time Base EHRPWM submodule */
 	pc->tbclk = devm_clk_get(&pdev->dev, "tbclk");
diff --git a/drivers/pwm/pwm-tipwmss.c b/drivers/pwm/pwm-tipwmss.c
index 3448a1c..17cbc59 100644
--- a/drivers/pwm/pwm-tipwmss.c
+++ b/drivers/pwm/pwm-tipwmss.c
@@ -75,9 +75,9 @@ static int pwmss_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	info->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!info->mmio_base)
-		return -EADDRNOTAVAIL;
+	info->mmio_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(info->mmio_base))
+		return PTR_ERR(info->mmio_base);
 
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_get_sync(&pdev->dev);
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index b0ba2d4..f9de9b2 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -178,9 +178,9 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	chip->base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!chip->base)
-		return -EADDRNOTAVAIL;
+	chip->base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(chip->base))
+		return PTR_ERR(chip->base);
 
 	ret = clk_prepare(chip->clk);
 	if (ret < 0) {
-- 
1.8.1.1


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

* [PATCH 24/33] rtc: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (22 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 23/33] pwm: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:50   ` Viresh Kumar
  2013-01-21 10:09 ` [PATCH 25/33] spi: " Thierry Reding
                   ` (9 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Alessandro Zummo, rtc-linux

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: rtc-linux@googlegroups.com
---
 drivers/rtc/rtc-s3c.c   | 8 +++-----
 drivers/rtc/rtc-snvs.c  | 6 +++---
 drivers/rtc/rtc-spear.c | 8 +++-----
 drivers/rtc/rtc-tegra.c | 8 +++-----
 4 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4046514..0c397ac 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -486,11 +486,9 @@ static int s3c_rtc_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	s3c_rtc_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (s3c_rtc_base == NULL) {
-		dev_err(&pdev->dev, "failed to ioremap memory region\n");
-		return -EINVAL;
-	}
+	s3c_rtc_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(s3c_rtc_base))
+		return PTR_ERR(s3c_rtc_base);
 
 	rtc_clk = devm_clk_get(&pdev->dev, "rtc");
 	if (IS_ERR(rtc_clk)) {
diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index d5ec785..40662e9 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -252,9 +252,9 @@ static int snvs_rtc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
-	if (!data->ioaddr)
-		return -EADDRNOTAVAIL;
+	data->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(data->ioaddr))
+		return PTR_ERR(data->ioaddr);
 
 	data->irq = platform_get_irq(pdev, 0);
 	if (data->irq < 0)
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index c2121b5..a18c319 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -385,11 +385,9 @@ static int spear_rtc_probe(struct platform_device *pdev)
 		return status;
 	}
 
-	config->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
-	if (!config->ioaddr) {
-		dev_err(&pdev->dev, "request-ioremap fail\n");
-		return -ENOMEM;
-	}
+	config->ioaddr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(config->ioaddr))
+		return PTR_ERR(config->ioaddr);
 
 	config->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(config->clk))
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index c84ea66..7c03375 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -327,11 +327,9 @@ static int tegra_rtc_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	info->rtc_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!info->rtc_base) {
-		dev_err(&pdev->dev, "Unable to request mem region and grab IOs for device.\n");
-		return -EBUSY;
-	}
+	info->rtc_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->rtc_base))
+		return PTR_ERR(info->rtc_base);
 
 	info->tegra_rtc_irq = platform_get_irq(pdev, 0);
 	if (info->tegra_rtc_irq <= 0)
-- 
1.8.1.1


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

* [PATCH 25/33] spi: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (23 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 24/33] rtc: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-02-05 14:20     ` Grant Likely
  2013-01-21 10:09 ` [PATCH 26/33] staging: " Thierry Reding
                   ` (8 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Grant Likely, spi-devel-general

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: spi-devel-general@lists.sourceforge.net
---
 drivers/spi/spi-ep93xx.c         | 7 +++----
 drivers/spi/spi-mxs.c            | 6 +++---
 drivers/spi/spi-omap2-mcspi.c    | 7 +++----
 drivers/spi/spi-s3c64xx.c        | 7 +++----
 drivers/spi/spi-sirf.c           | 7 +++----
 drivers/spi/spi-tegra20-sflash.c | 8 +++-----
 drivers/spi/spi-tegra20-slink.c  | 8 +++-----
 7 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index acb1e19..2e31f32 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -1085,10 +1085,9 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
 
 	espi->sspdr_phys = res->start + SSPDR;
 
-	espi->regs_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!espi->regs_base) {
-		dev_err(&pdev->dev, "failed to map resources\n");
-		error = -ENODEV;
+	espi->regs_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(espi->regs_base)) {
+		error = PTR_ERR(espi->regs_base);
 		goto fail_put_clock;
 	}
 
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index a3ede24..b735988 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -538,9 +538,9 @@ static int mxs_spi_probe(struct platform_device *pdev)
 	if (!iores || irq_err < 0 || irq_dma < 0)
 		return -EINVAL;
 
-	base = devm_request_and_ioremap(&pdev->dev, iores);
-	if (!base)
-		return -EADDRNOTAVAIL;
+	base = devm_ioremap_resource(&pdev->dev, iores);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
 	if (IS_ERR(pinctrl))
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index b610f52..71a9482 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1204,10 +1204,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
 	r->end += regs_offset;
 	mcspi->phys = r->start;
 
-	mcspi->base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!mcspi->base) {
-		dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
-		status = -ENOMEM;
+	mcspi->base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(mcspi->base)) {
+		status = PTR_ERR(mcspi->base);
 		goto free_master;
 	}
 
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index ad93231..3d4a7c4 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1276,10 +1276,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
 	/* the spi->mode bits understood by this driver: */
 	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
 
-	sdd->regs = devm_request_and_ioremap(&pdev->dev, mem_res);
-	if (sdd->regs == NULL) {
-		dev_err(&pdev->dev, "Unable to remap IO\n");
-		ret = -ENXIO;
+	sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res);
+	if (IS_ERR(sdd->regs)) {
+		ret = PTR_ERR(sdd->regs);
 		goto err1;
 	}
 
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index e0f43a5..78c8842 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -535,10 +535,9 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
 		}
 	}
 
-	sspi->base = devm_request_and_ioremap(&pdev->dev, mem_res);
-	if (!sspi->base) {
-		dev_err(&pdev->dev, "IO remap failed!\n");
-		ret = -ENOMEM;
+	sspi->base = devm_ioremap_resource(&pdev->dev, mem_res);
+	if (IS_ERR(sspi->base)) {
+		ret = PTR_ERR(sspi->base);
 		goto free_master;
 	}
 
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index 448a8cc..69c9d23 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -508,11 +508,9 @@ static int tegra_sflash_probe(struct platform_device *pdev)
 		ret = -ENODEV;
 		goto exit_free_master;
 	}
-	tsd->base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!tsd->base) {
-		dev_err(&pdev->dev,
-			"Cannot request memregion/iomap dma address\n");
-		ret = -EADDRNOTAVAIL;
+	tsd->base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(tsd->base)) {
+		ret = PTR_ERR(tsd->base);
 		goto exit_free_master;
 	}
 
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 651167f..96bd6c2 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1172,11 +1172,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
 		goto exit_free_master;
 	}
 	tspi->phys = r->start;
-	tspi->base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!tspi->base) {
-		dev_err(&pdev->dev,
-			"Cannot request memregion/iomap dma address\n");
-		ret = -EADDRNOTAVAIL;
+	tspi->base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(tspi->base)) {
+		ret = PTR_ERR(tspi->base);
 		goto exit_free_master;
 	}
 
-- 
1.8.1.1


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

* [PATCH 26/33] staging: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (24 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 25/33] spi: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 27/33] thermal: " Thierry Reding
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang, devel

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
---
 drivers/staging/iio/adc/mxs-lradc.c         |  7 ++++---
 drivers/staging/nvec/nvec.c                 |  8 +++-----
 drivers/staging/omap-thermal/omap-bandgap.c | 11 ++++-------
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index c5ceb9d..3d562da 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -15,6 +15,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/err.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
@@ -487,9 +488,9 @@ static int mxs_lradc_probe(struct platform_device *pdev)
 	/* Grab the memory area */
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	lradc->dev = &pdev->dev;
-	lradc->base = devm_request_and_ioremap(dev, iores);
-	if (!lradc->base) {
-		ret = -EADDRNOTAVAIL;
+	lradc->base = devm_ioremap_resource(dev, iores);
+	if (IS_ERR(lradc->base)) {
+		ret = PTR_ERR(lradc->base);
 		goto err_addr;
 	}
 
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 2830946..492e0b6 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -759,11 +759,9 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!base) {
-		dev_err(&pdev->dev, "Can't ioremap I2C region\n");
-		return -ENOMEM;
-	}
+	base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (!res) {
diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c
index 8346e345..21fd91b 100644
--- a/drivers/staging/omap-thermal/omap-bandgap.c
+++ b/drivers/staging/omap-thermal/omap-bandgap.c
@@ -820,15 +820,12 @@ static struct omap_bandgap *omap_bandgap_build(struct platform_device *pdev)
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		if (!res)
 			break;
-		chunk = devm_request_and_ioremap(&pdev->dev, res);
+		chunk = devm_ioremap_resource(&pdev->dev, res);
 		if (i == 0)
 			bg_ptr->base = chunk;
-		if (!chunk) {
-			dev_err(&pdev->dev,
-				"failed to request the IO (%d:%pR).\n",
-				i, res);
-			return ERR_PTR(-EADDRNOTAVAIL);
-		}
+		if (IS_ERR(chunk))
+			return ERR_CAST(chunk);
+		
 		i++;
 	} while (res);
 
-- 
1.8.1.1


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

* [PATCH 27/33] thermal: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (25 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 26/33] staging: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 28/33] serial: " Thierry Reding
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Zhang Rui, linux-pm

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
---
 drivers/thermal/exynos_thermal.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index 224751e..bada130 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -866,11 +866,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	data->base = devm_request_and_ioremap(&pdev->dev, data->mem);
-	if (!data->base) {
-		dev_err(&pdev->dev, "Failed to ioremap memory\n");
-		return -ENODEV;
-	}
+	data->base = devm_ioremap_resource(&pdev->dev, data->mem);
+	if (IS_ERR(data->base))
+		return PTR_ERR(data->base);
 
 	ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq,
 		IRQF_TRIGGER_RISING, "exynos-tmu", data);
-- 
1.8.1.1


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

* [PATCH 28/33] serial: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (26 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 27/33] thermal: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09 ` [PATCH 29/33] usb: " Thierry Reding
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Alan Cox, linux-serial

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Cc: linux-serial@vger.kernel.org
---
 drivers/tty/serial/sccnxp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index 418b495..e869eab 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -15,6 +15,7 @@
 #define SUPPORT_SYSRQ
 #endif
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/console.h>
@@ -875,10 +876,9 @@ static int sccnxp_probe(struct platform_device *pdev)
 		goto err_out;
 	}
 
-	membase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!membase) {
-		dev_err(&pdev->dev, "Failed to ioremap\n");
-		ret = -EIO;
+	membase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(membase)) {
+		ret = PTR_ERR(membase);
 		goto err_out;
 	}
 
-- 
1.8.1.1


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

* [PATCH 29/33] usb: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (27 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 28/33] serial: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 17:16   ` Alan Stern
  2013-01-21 18:50   ` Felipe Balbi
  2013-01-21 10:09   ` Thierry Reding
                   ` (4 subsequent siblings)
  33 siblings, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Alan Stern, Felipe Balbi, linux-usb

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@ti.com>
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/chipidea/usbmisc_imx6q.c |  6 +++---
 drivers/usb/gadget/bcm63xx_udc.c     | 13 +++++++------
 drivers/usb/gadget/s3c-hsotg.c       |  7 +++----
 drivers/usb/gadget/s3c-hsudc.c       |  7 +++----
 drivers/usb/host/ehci-atmel.c        |  7 +++----
 drivers/usb/host/ehci-grlib.c        |  9 ++++-----
 drivers/usb/host/ehci-mxc.c          |  7 +++----
 drivers/usb/host/ehci-platform.c     |  7 ++++---
 drivers/usb/host/ehci-ppc-of.c       |  8 ++++----
 drivers/usb/host/ehci-sead3.c        |  8 ++++----
 drivers/usb/host/ehci-sh.c           |  7 +++----
 drivers/usb/host/ehci-vt8500.c       |  8 ++++----
 drivers/usb/host/ehci-xilinx-of.c    |  8 ++++----
 drivers/usb/host/ohci-nxp.c          |  7 +++----
 drivers/usb/host/ohci-platform.c     |  7 ++++---
 drivers/usb/host/ohci-s3c2410.c      |  7 +++----
 drivers/usb/musb/musb_dsps.c         |  7 +++----
 drivers/usb/musb/omap2430.c          |  4 +---
 drivers/usb/otg/mxs-phy.c            |  6 +++---
 drivers/usb/phy/mv_u3d_phy.c         |  8 +++-----
 drivers/usb/phy/omap-usb2.c          |  8 +++-----
 drivers/usb/renesas_usbhs/common.c   |  9 ++++-----
 22 files changed, 76 insertions(+), 89 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c b/drivers/usb/chipidea/usbmisc_imx6q.c
index 845efe2..a1bce39 100644
--- a/drivers/usb/chipidea/usbmisc_imx6q.c
+++ b/drivers/usb/chipidea/usbmisc_imx6q.c
@@ -98,9 +98,9 @@ static int usbmisc_imx6q_probe(struct platform_device *pdev)
 	spin_lock_init(&data->lock);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!data->base)
-		return -EADDRNOTAVAIL;
+	data->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(data->base))
+		return PTR_ERR(data->base);
 
 	data->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(data->clk)) {
diff --git a/drivers/usb/gadget/bcm63xx_udc.c b/drivers/usb/gadget/bcm63xx_udc.c
index 47a4993..8cc8253 100644
--- a/drivers/usb/gadget/bcm63xx_udc.c
+++ b/drivers/usb/gadget/bcm63xx_udc.c
@@ -2351,19 +2351,20 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 		dev_err(dev, "error finding USBD resource\n");
 		return -ENXIO;
 	}
-	udc->usbd_regs = devm_request_and_ioremap(dev, res);
+
+	udc->usbd_regs = devm_ioremap_resource(dev, res);
+	if (IS_ERR(udc->usbd_regs))
+		return PTR_ERR(udc->usbd_regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 	if (!res) {
 		dev_err(dev, "error finding IUDMA resource\n");
 		return -ENXIO;
 	}
-	udc->iudma_regs = devm_request_and_ioremap(dev, res);
 
-	if (!udc->usbd_regs || !udc->iudma_regs) {
-		dev_err(dev, "error requesting resources\n");
-		return -ENXIO;
-	}
+	udc->iudma_regs = devm_ioremap_resource(dev, res);
+	if (IS_ERR(udc->iudma_regs))
+		return PTR_ERR(udc->iudma_regs);
 
 	spin_lock_init(&udc->lock);
 	INIT_WORK(&udc->ep0_wq, bcm63xx_ep0_process);
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 439c3f9..de80fa6 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -3525,10 +3525,9 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	hsotg->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hsotg->regs) {
-		dev_err(dev, "cannot map registers\n");
-		ret = -ENXIO;
+	hsotg->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hsotg->regs)) {
+		ret = PTR_ERR(hsotg->regs);
 		goto err_clk;
 	}
 
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
index 52379b1..94ca33b 100644
--- a/drivers/usb/gadget/s3c-hsudc.c
+++ b/drivers/usb/gadget/s3c-hsudc.c
@@ -1295,10 +1295,9 @@ static int s3c_hsudc_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	hsudc->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hsudc->regs) {
-		dev_err(dev, "error mapping device register area\n");
-		ret = -EBUSY;
+	hsudc->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hsudc->regs)) {
+		ret = PTR_ERR(hsudc->regs);
 		goto err_res;
 	}
 
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 27639487..f3beac4 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -143,10 +143,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
 
-	hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (hcd->regs == NULL) {
-		dev_dbg(&pdev->dev, "error mapping memory\n");
-		retval = -EFAULT;
+	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hcd->regs)) {
+		retval = PTR_ERR(hcd->regs);
 		goto fail_request_resource;
 	}
 
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c
index 1fc8929..5d75de9 100644
--- a/drivers/usb/host/ehci-grlib.c
+++ b/drivers/usb/host/ehci-grlib.c
@@ -25,7 +25,7 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-
+#include <linux/err.h>
 #include <linux/signal.h>
 
 #include <linux/of_irq.h>
@@ -118,10 +118,9 @@ static int ehci_hcd_grlib_probe(struct platform_device *op)
 		goto err_irq;
 	}
 
-	hcd->regs = devm_request_and_ioremap(&op->dev, &res);
-	if (!hcd->regs) {
-		pr_err("%s: devm_request_and_ioremap failed\n", __FILE__);
-		rv = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&op->dev, &res);
+	if (IS_ERR(hcd->regs)) {
+		rv = PTR_ERR(hcd->regs);
 		goto err_ioremap;
 	}
 
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index ec7f5d2..4f506af 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -128,10 +128,9 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
 
-	hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hcd->regs) {
-		dev_err(dev, "error mapping memory\n");
-		ret = -EFAULT;
+	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hcd->regs)) {
+		ret = PTR_ERR(hcd->regs);
 		goto err_alloc;
 	}
 
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 58fa0c9..ca75063 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -18,6 +18,7 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/hrtimer.h>
 #include <linux/io.h>
@@ -104,9 +105,9 @@ static int ehci_platform_probe(struct platform_device *dev)
 	hcd->rsrc_start = res_mem->start;
 	hcd->rsrc_len = resource_size(res_mem);
 
-	hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem);
-	if (!hcd->regs) {
-		err = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
+	if (IS_ERR(hcd->regs)) {
+		err = PTR_ERR(hcd->regs);
 		goto err_put_hcd;
 	}
 	err = usb_add_hcd(hcd, irq, IRQF_SHARED);
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 45aceef..56dc732 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -12,6 +12,7 @@
  * This file is licenced under the GPL.
  */
 
+#include <linux/err.h>
 #include <linux/signal.h>
 
 #include <linux/of.h>
@@ -121,10 +122,9 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
 		goto err_irq;
 	}
 
-	hcd->regs = devm_request_and_ioremap(&op->dev, &res);
-	if (!hcd->regs) {
-		pr_err("%s: devm_request_and_ioremap failed\n", __FILE__);
-		rv = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&op->dev, &res);
+	if (IS_ERR(hcd->regs)) {
+		rv = PTR_ERR(hcd->regs);
 		goto err_ioremap;
 	}
 
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index efad02d..f55477c 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -19,6 +19,7 @@
  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/err.h>
 #include <linux/platform_device.h>
 
 static int ehci_sead3_setup(struct usb_hcd *hcd)
@@ -112,10 +113,9 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev)
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
 
-	hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hcd->regs) {
-		pr_debug("ioremap failed");
-		ret = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hcd->regs)) {
+		ret = PTR_ERR(hcd->regs);
 		goto err1;
 	}
 
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
index 0c90a24..3565a30 100644
--- a/drivers/usb/host/ehci-sh.c
+++ b/drivers/usb/host/ehci-sh.c
@@ -118,10 +118,9 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
 
-	hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (hcd->regs == NULL) {
-		dev_dbg(&pdev->dev, "error mapping memory\n");
-		ret = -ENXIO;
+	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hcd->regs)) {
+		ret = PTR_ERR(hcd->regs);
 		goto fail_request_resource;
 	}
 
diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c
index 11695d5..7ecf709 100644
--- a/drivers/usb/host/ehci-vt8500.c
+++ b/drivers/usb/host/ehci-vt8500.c
@@ -16,6 +16,7 @@
  *
  */
 
+#include <linux/err.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
@@ -96,10 +97,9 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev)
 	hcd->rsrc_start = res->start;
 	hcd->rsrc_len = resource_size(res);
 
-	hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hcd->regs) {
-		pr_debug("ioremap failed");
-		ret = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hcd->regs)) {
+		ret = PTR_ERR(hcd->regs);
 		goto err1;
 	}
 
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c
index 4f285e8..d845e3b 100644
--- a/drivers/usb/host/ehci-xilinx-of.c
+++ b/drivers/usb/host/ehci-xilinx-of.c
@@ -25,6 +25,7 @@
  *
  */
 
+#include <linux/err.h>
 #include <linux/signal.h>
 
 #include <linux/of.h>
@@ -159,10 +160,9 @@ static int ehci_hcd_xilinx_of_probe(struct platform_device *op)
 		goto err_irq;
 	}
 
-	hcd->regs = devm_request_and_ioremap(&op->dev, &res);
-	if (!hcd->regs) {
-		pr_err("%s: devm_request_and_ioremap failed\n", __FILE__);
-		rv = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&op->dev, &res);
+	if (IS_ERR(hcd->regs)) {
+		rv = PTR_ERR(hcd->regs);
 		goto err_irq;
 	}
 
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index 2344040..f4988fb 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -306,10 +306,9 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
 		goto out8;
 	}
 
-	hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hcd->regs) {
-		dev_err(&pdev->dev, "Failed to devm_request_and_ioremap\n");
-		ret =  -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hcd->regs)) {
+		ret = PTR_ERR(hcd->regs);
 		goto out8;
 	}
 	hcd->rsrc_start = res->start;
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 084503b..c3e7287 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -13,6 +13,7 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+#include <linux/err.h>
 #include <linux/platform_device.h>
 #include <linux/usb/ohci_pdriver.h>
 
@@ -127,9 +128,9 @@ static int ohci_platform_probe(struct platform_device *dev)
 	hcd->rsrc_start = res_mem->start;
 	hcd->rsrc_len = resource_size(res_mem);
 
-	hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem);
-	if (!hcd->regs) {
-		err = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
+	if (IS_ERR(hcd->regs)) {
+		err = PTR_ERR(hcd->regs);
 		goto err_put_hcd;
 	}
 	err = usb_add_hcd(hcd, irq, IRQF_SHARED);
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index ad0f552..e125770 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -351,10 +351,9 @@ static int usb_hcd_s3c2410_probe(const struct hc_driver *driver,
 	hcd->rsrc_start = dev->resource[0].start;
 	hcd->rsrc_len	= resource_size(&dev->resource[0]);
 
-	hcd->regs = devm_request_and_ioremap(&dev->dev, &dev->resource[0]);
-	if (!hcd->regs) {
-		dev_err(&dev->dev, "devm_request_and_ioremap failed\n");
-		retval = -ENOMEM;
+	hcd->regs = devm_ioremap_resource(&dev->dev, &dev->resource[0]);
+	if (IS_ERR(hcd->regs)) {
+		retval = PTR_ERR(hcd->regs);
 		goto err_put;
 	}
 
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index f7d764d..99f470d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -500,10 +500,9 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
 	resources[0].end = resources[0].start + SZ_4 - 1;
 	resources[0].flags = IORESOURCE_MEM;
 
-	glue->usb_ctrl[id] = devm_request_and_ioremap(&pdev->dev, resources);
-	if (glue->usb_ctrl[id] == NULL) {
-		dev_err(dev, "Failed to obtain usb_ctrl%d memory\n", id);
-		ret = -ENODEV;
+	glue->usb_ctrl[id] = devm_ioremap_resource(&pdev->dev, resources);
+	if (IS_ERR(glue->usb_ctrl[id])) {
+		ret = PTR_ERR(glue->usb_ctrl[id]);
 		goto err0;
 	}
 
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index da00af4..acd5f9d 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -523,9 +523,7 @@ static int omap2430_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 
-	glue->control_otghs = devm_request_and_ioremap(&pdev->dev, res);
-	if (glue->control_otghs == NULL)
-		dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
+	glue->control_otghs = devm_ioremap_resource(&pdev->dev, res);
 
 	if (np) {
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index 7630272..60df28a 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -115,9 +115,9 @@ static int mxs_phy_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!base)
-		return -EBUSY;
+	base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
diff --git a/drivers/usb/phy/mv_u3d_phy.c b/drivers/usb/phy/mv_u3d_phy.c
index eaddbe3..9d85991 100644
--- a/drivers/usb/phy/mv_u3d_phy.c
+++ b/drivers/usb/phy/mv_u3d_phy.c
@@ -283,11 +283,9 @@ static int mv_u3d_phy_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	phy_base = devm_request_and_ioremap(dev, res);
-	if (!phy_base) {
-		dev_err(dev, "%s: register mapping failed\n", __func__);
-		return -ENXIO;
-	}
+	phy_base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(phy_base))
+		return PTR_ERR(phy_base);
 
 	mv_u3d_phy = devm_kzalloc(dev, sizeof(*mv_u3d_phy), GFP_KERNEL);
 	if (!mv_u3d_phy)
diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
index 26ae8f4..2fdb8ed 100644
--- a/drivers/usb/phy/omap-usb2.c
+++ b/drivers/usb/phy/omap-usb2.c
@@ -168,11 +168,9 @@ static int omap_usb2_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 
-	phy->control_dev = devm_request_and_ioremap(&pdev->dev, res);
-	if (phy->control_dev == NULL) {
-		dev_err(&pdev->dev, "Failed to obtain io memory\n");
-		return -ENXIO;
-	}
+	phy->control_dev = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(phy->control_dev))
+		return PTR_ERR(phy->control_dev);
 
 	phy->is_suspended	= 1;
 	omap_usb_phy_power(phy, 0);
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 38bce04..cfd2050 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -14,6 +14,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+#include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
@@ -443,11 +444,9 @@ static int usbhs_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	priv->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!priv->base) {
-		dev_err(&pdev->dev, "ioremap error.\n");
-		return -ENOMEM;
-	}
+	priv->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(priv->base))
+		return PTR_ERR(priv->base);
 
 	/*
 	 * care platform info
-- 
1.8.1.1


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

* [PATCH 30/33] video: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
@ 2013-01-21 10:09   ` Thierry Reding
  2013-01-21 10:08   ` Thierry Reding
                     ` (32 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Florian Tobias Schandinat, linux-fbdev

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/exynos/exynos_dp_core.c | 8 +++-----
 drivers/video/jz4740_fb.c             | 6 +++---
 drivers/video/omap2/dss/hdmi.c        | 8 +++-----
 drivers/video/omap2/vrfb.c            | 9 ++++-----
 drivers/video/s3c-fb.c                | 7 +++----
 5 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
index 4ef18e2..7aae0bf 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -1076,11 +1076,9 @@ static int exynos_dp_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	dp->reg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!dp->reg_base) {
-		dev_err(&pdev->dev, "failed to ioremap\n");
-		return -ENOMEM;
-	}
+	dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dp->reg_base))
+		return PTR_ERR(dp->reg_base);
 
 	dp->irq = platform_get_irq(pdev, 0);
 	if (dp->irq == -ENXIO) {
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
index d999bb5..36979b4 100644
--- a/drivers/video/jz4740_fb.c
+++ b/drivers/video/jz4740_fb.c
@@ -660,9 +660,9 @@ static int jzfb_probe(struct platform_device *pdev)
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	jzfb->base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!jzfb->base) {
-		ret = -EBUSY;
+	jzfb->base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(jzfb->base)) {
+		ret = PTR_ERR(jzfb->base);
 		goto err_framebuffer_release;
 	}
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 769d082..7292364 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -1080,11 +1080,9 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 	}
 
 	/* Base address taken from platform */
-	hdmi.ip_data.base_wp = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hdmi.ip_data.base_wp) {
-		DSSERR("can't ioremap WP\n");
-		return -ENOMEM;
-	}
+	hdmi.ip_data.base_wp = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hdmi.ip_data.base_wp))
+		return PTR_ERR(hdmi.ip_data.base_wp);
 
 	r = hdmi_get_clocks(pdev);
 	if (r) {
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c
index 5d8fdac..10560ef 100644
--- a/drivers/video/omap2/vrfb.c
+++ b/drivers/video/omap2/vrfb.c
@@ -20,6 +20,7 @@
 
 /*#define DEBUG*/
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
@@ -357,11 +358,9 @@ static int __init vrfb_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	vrfb_base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!vrfb_base) {
-		dev_err(&pdev->dev, "can't ioremap vrfb memory\n");
-		return -ENOMEM;
-	}
+	vrfb_base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(vrfb_base))
+		return PTR_ERR(vrfb_base);
 
 	num_ctxs = pdev->num_resources - 1;
 
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 9b57a23..968a625 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1421,10 +1421,9 @@ static int s3c_fb_probe(struct platform_device *pdev)
 	pm_runtime_enable(sfb->dev);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	sfb->regs = devm_request_and_ioremap(dev, res);
-	if (!sfb->regs) {
-		dev_err(dev, "failed to map registers\n");
-		ret = -ENXIO;
+	sfb->regs = devm_ioremap_resource(dev, res);
+	if (IS_ERR(sfb->regs)) {
+		ret = PTR_ERR(sfb->regs);
 		goto err_lcd_clk;
 	}
 
-- 
1.8.1.1


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

* [PATCH 30/33] video: Convert to devm_ioremap_resource()
@ 2013-01-21 10:09   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Florian Tobias Schandinat, linux-fbdev

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: linux-fbdev@vger.kernel.org
---
 drivers/video/exynos/exynos_dp_core.c | 8 +++-----
 drivers/video/jz4740_fb.c             | 6 +++---
 drivers/video/omap2/dss/hdmi.c        | 8 +++-----
 drivers/video/omap2/vrfb.c            | 9 ++++-----
 drivers/video/s3c-fb.c                | 7 +++----
 5 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
index 4ef18e2..7aae0bf 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -1076,11 +1076,9 @@ static int exynos_dp_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	dp->reg_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!dp->reg_base) {
-		dev_err(&pdev->dev, "failed to ioremap\n");
-		return -ENOMEM;
-	}
+	dp->reg_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(dp->reg_base))
+		return PTR_ERR(dp->reg_base);
 
 	dp->irq = platform_get_irq(pdev, 0);
 	if (dp->irq = -ENXIO) {
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
index d999bb5..36979b4 100644
--- a/drivers/video/jz4740_fb.c
+++ b/drivers/video/jz4740_fb.c
@@ -660,9 +660,9 @@ static int jzfb_probe(struct platform_device *pdev)
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	jzfb->base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!jzfb->base) {
-		ret = -EBUSY;
+	jzfb->base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(jzfb->base)) {
+		ret = PTR_ERR(jzfb->base);
 		goto err_framebuffer_release;
 	}
 
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 769d082..7292364 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -1080,11 +1080,9 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 	}
 
 	/* Base address taken from platform */
-	hdmi.ip_data.base_wp = devm_request_and_ioremap(&pdev->dev, res);
-	if (!hdmi.ip_data.base_wp) {
-		DSSERR("can't ioremap WP\n");
-		return -ENOMEM;
-	}
+	hdmi.ip_data.base_wp = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(hdmi.ip_data.base_wp))
+		return PTR_ERR(hdmi.ip_data.base_wp);
 
 	r = hdmi_get_clocks(pdev);
 	if (r) {
diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c
index 5d8fdac..10560ef 100644
--- a/drivers/video/omap2/vrfb.c
+++ b/drivers/video/omap2/vrfb.c
@@ -20,6 +20,7 @@
 
 /*#define DEBUG*/
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
@@ -357,11 +358,9 @@ static int __init vrfb_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	vrfb_base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!vrfb_base) {
-		dev_err(&pdev->dev, "can't ioremap vrfb memory\n");
-		return -ENOMEM;
-	}
+	vrfb_base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(vrfb_base))
+		return PTR_ERR(vrfb_base);
 
 	num_ctxs = pdev->num_resources - 1;
 
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 9b57a23..968a625 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1421,10 +1421,9 @@ static int s3c_fb_probe(struct platform_device *pdev)
 	pm_runtime_enable(sfb->dev);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	sfb->regs = devm_request_and_ioremap(dev, res);
-	if (!sfb->regs) {
-		dev_err(dev, "failed to map registers\n");
-		ret = -ENXIO;
+	sfb->regs = devm_ioremap_resource(dev, res);
+	if (IS_ERR(sfb->regs)) {
+		ret = PTR_ERR(sfb->regs);
 		goto err_lcd_clk;
 	}
 
-- 
1.8.1.1


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

* [PATCH 31/33] w1: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (29 preceding siblings ...)
  2013-01-21 10:09   ` Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:27   ` Evgeniy Polyakov
  2013-01-21 10:09 ` [PATCH 32/33] watchdog: " Thierry Reding
                   ` (2 subsequent siblings)
  33 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Evgeniy Polyakov

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
---
 drivers/w1/masters/omap_hdq.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 184dbce..db2390a 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -560,11 +560,9 @@ static int omap_hdq_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	hdq_data->hdq_base = devm_request_and_ioremap(dev, res);
-	if (!hdq_data->hdq_base) {
-		dev_dbg(&pdev->dev, "ioremap failed\n");
-		return -ENOMEM;
-	}
+	hdq_data->hdq_base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(hdq_data->hdq_base))
+		return PTR_ERR(hdq_data->hdq_base);
 
 	hdq_data->hdq_usecount = 0;
 	mutex_init(&hdq_data->hdq_mutex);
-- 
1.8.1.1


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

* [PATCH 32/33] watchdog: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (30 preceding siblings ...)
  2013-01-21 10:09 ` [PATCH 31/33] w1: " Thierry Reding
@ 2013-01-21 10:09 ` Thierry Reding
  2013-01-21 10:09   ` Thierry Reding
  2013-02-09 13:58 ` [PATCH 00/33] Sanitize devm_request_and_ioremap() Grant Likely
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Wim Van Sebroeck, linux-watchdog

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
---
 drivers/watchdog/ar7_wdt.c     | 8 +++-----
 drivers/watchdog/dw_wdt.c      | 6 +++---
 drivers/watchdog/imx2_wdt.c    | 8 +++-----
 drivers/watchdog/jz4740_wdt.c  | 6 +++---
 drivers/watchdog/lantiq_wdt.c  | 8 +++-----
 drivers/watchdog/max63xx_wdt.c | 7 ++++---
 drivers/watchdog/pnx4008_wdt.c | 6 +++---
 drivers/watchdog/txx9wdt.c     | 6 +++---
 8 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
index 3003e2a..2f3cc8f 100644
--- a/drivers/watchdog/ar7_wdt.c
+++ b/drivers/watchdog/ar7_wdt.c
@@ -285,11 +285,9 @@ static int ar7_wdt_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	ar7_wdt = devm_request_and_ioremap(&pdev->dev, ar7_regs_wdt);
-	if (!ar7_wdt) {
-		pr_err("could not ioremap registers\n");
-		return -ENXIO;
-	}
+	ar7_wdt = devm_ioremap_resource(&pdev->dev, ar7_regs_wdt);
+	if (IS_ERR(ar7_wdt))
+		return PTR_ERR(ar7_wdt);
 
 	vbus_clk = clk_get(NULL, "vbus");
 	if (IS_ERR(vbus_clk)) {
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index a0eba3c..2037669 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -301,9 +301,9 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
 	if (!mem)
 		return -EINVAL;
 
-	dw_wdt.regs = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!dw_wdt.regs)
-		return -ENOMEM;
+	dw_wdt.regs = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(dw_wdt.regs))
+		return PTR_ERR(dw_wdt.regs);
 
 	dw_wdt.clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(dw_wdt.clk))
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 9a45d029..7f023e2 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -262,11 +262,9 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	imx2_wdt.base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!imx2_wdt.base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -ENOMEM;
-	}
+	imx2_wdt.base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(imx2_wdt.base))
+		return PTR_ERR(imx2_wdt.base);
 
 	imx2_wdt.clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(imx2_wdt.clk)) {
diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c
index a61408f..1cb25f6 100644
--- a/drivers/watchdog/jz4740_wdt.c
+++ b/drivers/watchdog/jz4740_wdt.c
@@ -171,9 +171,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
 	watchdog_set_drvdata(jz4740_wdt, drvdata);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	drvdata->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (drvdata->base == NULL) {
-		ret = -EBUSY;
+	drvdata->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(drvdata->base)) {
+		ret = PTR_ERR(drvdata->base);
 		goto err_out;
 	}
 
diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c
index 79fe01b..088fd0c 100644
--- a/drivers/watchdog/lantiq_wdt.c
+++ b/drivers/watchdog/lantiq_wdt.c
@@ -197,11 +197,9 @@ ltq_wdt_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	ltq_wdt_membase = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ltq_wdt_membase) {
-		dev_err(&pdev->dev, "cannot remap I/O memory region\n");
-		return -ENOMEM;
-	}
+	ltq_wdt_membase = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ltq_wdt_membase))
+		return PTR_ERR(ltq_wdt_membase);
 
 	/* we do not need to enable the clock as it is always running */
 	clk = clk_get_io();
diff --git a/drivers/watchdog/max63xx_wdt.c b/drivers/watchdog/max63xx_wdt.c
index 773c661..cc9d328 100644
--- a/drivers/watchdog/max63xx_wdt.c
+++ b/drivers/watchdog/max63xx_wdt.c
@@ -14,6 +14,7 @@
  * another interface, some abstraction will have to be introduced.
  */
 
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/types.h>
@@ -198,9 +199,9 @@ static int max63xx_wdt_probe(struct platform_device *pdev)
 	heartbeat = current_timeout->twd;
 
 	wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	wdt_base = devm_request_and_ioremap(&pdev->dev, wdt_mem);
-	if (!wdt_base)
-		return -ENOMEM;
+	wdt_base = devm_ioremap_resource(&pdev->dev, wdt_mem);
+	if (IS_ERR(wdt_base))
+		return PTR_ERR(wdt_base);
 
 	max63xx_wdt_dev.timeout = heartbeat;
 	watchdog_set_nowayout(&max63xx_wdt_dev, nowayout);
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index dcba5da..de1f3fa 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -155,9 +155,9 @@ static int pnx4008_wdt_probe(struct platform_device *pdev)
 		heartbeat = DEFAULT_HEARTBEAT;
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	wdt_base = devm_request_and_ioremap(&pdev->dev, r);
-	if (!wdt_base)
-		return -EADDRINUSE;
+	wdt_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(wdt_base))
+		return PTR_ERR(wdt_base);
 
 	wdt_clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(wdt_clk))
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c
index 98e1637..626dc0b 100644
--- a/drivers/watchdog/txx9wdt.c
+++ b/drivers/watchdog/txx9wdt.c
@@ -121,9 +121,9 @@ static int __init txx9wdt_probe(struct platform_device *dev)
 	}
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-	txx9wdt_reg = devm_request_and_ioremap(&dev->dev, res);
-	if (!txx9wdt_reg) {
-		ret = -EBUSY;
+	txx9wdt_reg = devm_ioremap_resource(&dev->dev, res);
+	if (IS_ERR(txx9wdt_reg)) {
+		ret = PTR_ERR(txx9wdt_reg);
 		goto exit;
 	}
 
-- 
1.8.1.1


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

* [PATCH 33/33] ASoC: Convert to devm_ioremap_resource()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
@ 2013-01-21 10:09   ` Thierry Reding
  2013-01-21 10:08   ` Thierry Reding
                     ` (32 subsequent siblings)
  33 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Mark Brown, Liam Girdwood, alsa-devel

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: alsa-devel@alsa-project.org
---
 sound/soc/cirrus/ep93xx-ac97.c    | 7 ++++---
 sound/soc/cirrus/ep93xx-i2s.c     | 6 +++---
 sound/soc/codecs/jz4740.c         | 6 +++---
 sound/soc/fsl/imx-audmux.c        | 6 +++---
 sound/soc/fsl/imx-ssi.c           | 7 +++----
 sound/soc/kirkwood/kirkwood-i2s.c | 8 +++-----
 sound/soc/mxs/mxs-saif.c          | 8 +++-----
 sound/soc/pxa/mmp-sspa.c          | 6 +++---
 8 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
index f3f50e6..1738d28 100644
--- a/sound/soc/cirrus/ep93xx-ac97.c
+++ b/sound/soc/cirrus/ep93xx-ac97.c
@@ -11,6 +11,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/err.h>
 #include <linux/io.h>
 #include <linux/init.h>
 #include <linux/module.h>
@@ -367,9 +368,9 @@ static int ep93xx_ac97_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	info->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!info->regs)
-		return -ENXIO;
+	info->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->regs))
+		return PTR_ERR(info->regs);
 
 	irq = platform_get_irq(pdev, 0);
 	if (!irq)
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 3365d4e..323ed69 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -380,9 +380,9 @@ static int ep93xx_i2s_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	info->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!info->regs)
-		return -ENXIO;
+	info->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->regs))
+		return PTR_ERR(info->regs);
 
 	info->mclk = clk_get(&pdev->dev, "mclk");
 	if (IS_ERR(info->mclk)) {
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c
index d991529..5f607b3 100644
--- a/sound/soc/codecs/jz4740.c
+++ b/sound/soc/codecs/jz4740.c
@@ -361,9 +361,9 @@ static int jz4740_codec_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!base)
-		return -EBUSY;
+	base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	jz4740_codec->regmap = devm_regmap_init_mmio(&pdev->dev, base,
 					    &jz4740_codec_regmap_config);
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index 251f4d9..c21ac9c 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -252,9 +252,9 @@ static int imx_audmux_probe(struct platform_device *pdev)
 			of_match_device(imx_audmux_dt_ids, &pdev->dev);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	audmux_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!audmux_base)
-		return -EADDRNOTAVAIL;
+	audmux_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(audmux_base))
+		return PTR_ERR(audmux_base);
 
 	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
 	if (IS_ERR(pinctrl)) {
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 3b48042..55464a5 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -550,10 +550,9 @@ static int imx_ssi_probe(struct platform_device *pdev)
 		goto failed_get_resource;
 	}
 
-	ssi->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ssi->base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -ENODEV;
+	ssi->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ssi->base)) {
+		ret = PTR_ERR(ssi->base);
 		goto failed_register;
 	}
 
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 282d8b1..c74c890 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -472,11 +472,9 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	priv->io = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!priv->io) {
-		dev_err(&pdev->dev, "devm_request_and_ioremap failed\n");
-		return -ENOMEM;
-	}
+	priv->io = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(priv->io))
+		return PTR_ERR(priv->io);
 
 	priv->irq = platform_get_irq(pdev, 0);
 	if (priv->irq <= 0) {
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 365d9d2..b327709 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -724,11 +724,9 @@ static int mxs_saif_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	saif->base = devm_request_and_ioremap(&pdev->dev, iores);
-	if (!saif->base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -ENODEV;
-	}
+	saif->base = devm_ioremap_resource(&pdev->dev, iores);
+	if (IS_ERR(saif->base))
+		return PTR_ERR(saif->base);
 
 	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	if (!dmares) {
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index 41c3a09..9140c4a 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -429,9 +429,9 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
 	if (res == NULL)
 		return -ENOMEM;
 
-	priv->sspa->mmio_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (priv->sspa->mmio_base == NULL)
-		return -ENODEV;
+	priv->sspa->mmio_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(priv->sspa->mmio_base))
+		return PTR_ERR(priv->sspa->mmio_base);
 
 	priv->sspa->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->sspa->clk))
-- 
1.8.1.1


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

* [PATCH 33/33] ASoC: Convert to devm_ioremap_resource()
@ 2013-01-21 10:09   ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: alsa-devel, Mark Brown, Arnd Bergmann, Greg Kroah-Hartman,
	Dmitry Torokhov, Wolfram Sang, Liam Girdwood

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: alsa-devel@alsa-project.org
---
 sound/soc/cirrus/ep93xx-ac97.c    | 7 ++++---
 sound/soc/cirrus/ep93xx-i2s.c     | 6 +++---
 sound/soc/codecs/jz4740.c         | 6 +++---
 sound/soc/fsl/imx-audmux.c        | 6 +++---
 sound/soc/fsl/imx-ssi.c           | 7 +++----
 sound/soc/kirkwood/kirkwood-i2s.c | 8 +++-----
 sound/soc/mxs/mxs-saif.c          | 8 +++-----
 sound/soc/pxa/mmp-sspa.c          | 6 +++---
 8 files changed, 25 insertions(+), 29 deletions(-)

diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
index f3f50e6..1738d28 100644
--- a/sound/soc/cirrus/ep93xx-ac97.c
+++ b/sound/soc/cirrus/ep93xx-ac97.c
@@ -11,6 +11,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/err.h>
 #include <linux/io.h>
 #include <linux/init.h>
 #include <linux/module.h>
@@ -367,9 +368,9 @@ static int ep93xx_ac97_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	info->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!info->regs)
-		return -ENXIO;
+	info->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->regs))
+		return PTR_ERR(info->regs);
 
 	irq = platform_get_irq(pdev, 0);
 	if (!irq)
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index 3365d4e..323ed69 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -380,9 +380,9 @@ static int ep93xx_i2s_probe(struct platform_device *pdev)
 	if (!res)
 		return -ENODEV;
 
-	info->regs = devm_request_and_ioremap(&pdev->dev, res);
-	if (!info->regs)
-		return -ENXIO;
+	info->regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(info->regs))
+		return PTR_ERR(info->regs);
 
 	info->mclk = clk_get(&pdev->dev, "mclk");
 	if (IS_ERR(info->mclk)) {
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c
index d991529..5f607b3 100644
--- a/sound/soc/codecs/jz4740.c
+++ b/sound/soc/codecs/jz4740.c
@@ -361,9 +361,9 @@ static int jz4740_codec_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!base)
-		return -EBUSY;
+	base = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
 
 	jz4740_codec->regmap = devm_regmap_init_mmio(&pdev->dev, base,
 					    &jz4740_codec_regmap_config);
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index 251f4d9..c21ac9c 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -252,9 +252,9 @@ static int imx_audmux_probe(struct platform_device *pdev)
 			of_match_device(imx_audmux_dt_ids, &pdev->dev);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	audmux_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!audmux_base)
-		return -EADDRNOTAVAIL;
+	audmux_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(audmux_base))
+		return PTR_ERR(audmux_base);
 
 	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
 	if (IS_ERR(pinctrl)) {
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 3b48042..55464a5 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -550,10 +550,9 @@ static int imx_ssi_probe(struct platform_device *pdev)
 		goto failed_get_resource;
 	}
 
-	ssi->base = devm_request_and_ioremap(&pdev->dev, res);
-	if (!ssi->base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		ret = -ENODEV;
+	ssi->base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(ssi->base)) {
+		ret = PTR_ERR(ssi->base);
 		goto failed_register;
 	}
 
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 282d8b1..c74c890 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -472,11 +472,9 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	priv->io = devm_request_and_ioremap(&pdev->dev, mem);
-	if (!priv->io) {
-		dev_err(&pdev->dev, "devm_request_and_ioremap failed\n");
-		return -ENOMEM;
-	}
+	priv->io = devm_ioremap_resource(&pdev->dev, mem);
+	if (IS_ERR(priv->io))
+		return PTR_ERR(priv->io);
 
 	priv->irq = platform_get_irq(pdev, 0);
 	if (priv->irq <= 0) {
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 365d9d2..b327709 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -724,11 +724,9 @@ static int mxs_saif_probe(struct platform_device *pdev)
 
 	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-	saif->base = devm_request_and_ioremap(&pdev->dev, iores);
-	if (!saif->base) {
-		dev_err(&pdev->dev, "ioremap failed\n");
-		return -ENODEV;
-	}
+	saif->base = devm_ioremap_resource(&pdev->dev, iores);
+	if (IS_ERR(saif->base))
+		return PTR_ERR(saif->base);
 
 	dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	if (!dmares) {
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index 41c3a09..9140c4a 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -429,9 +429,9 @@ static int asoc_mmp_sspa_probe(struct platform_device *pdev)
 	if (res == NULL)
 		return -ENOMEM;
 
-	priv->sspa->mmio_base = devm_request_and_ioremap(&pdev->dev, res);
-	if (priv->sspa->mmio_base == NULL)
-		return -ENODEV;
+	priv->sspa->mmio_base = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(priv->sspa->mmio_base))
+		return PTR_ERR(priv->sspa->mmio_base);
 
 	priv->sspa->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(priv->sspa->clk))
-- 
1.8.1.1

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

* Re: [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource()
  2013-01-21 10:08 ` [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource() Thierry Reding
@ 2013-01-21 10:26   ` Dmitry Torokhov
  2013-01-22 17:40   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 100+ messages in thread
From: Dmitry Torokhov @ 2013-01-21 10:26 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Arnd Bergmann, Wolfram Sang

On Mon, Jan 21, 2013 at 11:08:54AM +0100, Thierry Reding wrote:
> The devm_request_and_ioremap() function is very useful and helps avoid a
> whole lot of boilerplate. However, one issue that keeps popping up is
> its lack of a specific error code to determine which of the steps that
> it performs failed. Furthermore, while the function gives an example and
> suggests what error code to return on failure, a wide variety of error
> codes are used throughout the tree.
> 
> In an attempt to fix these problems, this patch adds a new function that
> drivers can transition to. The devm_ioremap_resource() returns a pointer
> to the remapped I/O memory on success or an ERR_PTR() encoded error code
> on failure. Callers can check for failure using IS_ERR() and determine
> its cause by extracting the error code using PTR_ERR().
> 
> devm_request_and_ioremap() is implemented as a wrapper around the new
> API and return NULL on failure as before. This ensures that backwards
> compatibility is maintained until all users have been converted to the
> new API, at which point the old devm_request_and_ioremap() function
> should be removed. To help prevent new users from being added in the
> meantime, devm_request_and_ioremap() is marked __deprecated.
> 
> A semantic patch is included which can be used to convert from the old
> devm_request_and_ioremap() API to the new devm_ioremap_resource() API.
> Some non-trivial cases may require manual intervention, though.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>

This looks good to me.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
>  Documentation/driver-model/devres.txt              |  3 +-
>  include/linux/device.h                             |  3 +-
>  lib/devres.c                                       | 57 ++++++++++----
>  scripts/coccinelle/api/devm_ioremap_resource.cocci | 90 ++++++++++++++++++++++
>  4 files changed, 138 insertions(+), 15 deletions(-)
>  create mode 100644 scripts/coccinelle/api/devm_ioremap_resource.cocci
> 
> diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
> index 43cff70..25240fc 100644
> --- a/Documentation/driver-model/devres.txt
> +++ b/Documentation/driver-model/devres.txt
> @@ -266,7 +266,8 @@ IOMAP
>    devm_ioremap()
>    devm_ioremap_nocache()
>    devm_iounmap()
> -  devm_request_and_ioremap() : checks resource, requests region, ioremaps
> +  devm_ioremap_resource() : checks resource, requests memory region, ioremaps
> +  devm_request_and_ioremap() : obsoleted by devm_ioremap_resource()
>    pcim_iomap()
>    pcim_iounmap()
>    pcim_iomap_table()	: array of mapped addresses indexed by BAR
> diff --git a/include/linux/device.h b/include/linux/device.h
> index 43dcda9..558c405 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -573,8 +573,9 @@ extern int devres_release_group(struct device *dev, void *id);
>  extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
>  extern void devm_kfree(struct device *dev, void *p);
>  
> +void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
>  void __iomem *devm_request_and_ioremap(struct device *dev,
> -			struct resource *res);
> +			struct resource *res) __deprecated;
>  
>  struct device_dma_parameters {
>  	/*
> diff --git a/lib/devres.c b/lib/devres.c
> index 80b9c76..9c76b3a 100644
> --- a/lib/devres.c
> +++ b/lib/devres.c
> @@ -86,22 +86,24 @@ void devm_iounmap(struct device *dev, void __iomem *addr)
>  EXPORT_SYMBOL(devm_iounmap);
>  
>  /**
> - * devm_request_and_ioremap() - Check, request region, and ioremap resource
> - * @dev: Generic device to handle the resource for
> + * devm_ioremap_resource() - check, request region, and ioremap resource
> + * @dev: generic device to handle the resource for
>   * @res: resource to be handled
>   *
> - * Takes all necessary steps to ioremap a mem resource. Uses managed device, so
> - * everything is undone on driver detach. Checks arguments, so you can feed
> - * it the result from e.g. platform_get_resource() directly. Returns the
> - * remapped pointer or NULL on error. Usage example:
> + * Checks that a resource is a valid memory region, requests the memory region
> + * and ioremaps it either as cacheable or as non-cacheable memory depending on
> + * the resource's flags. All operations are managed and will be undone on
> + * driver detach.
> + *
> + * Returns a pointer to the remapped memory or an ERR_PTR() encoded error code
> + * on failure. Usage example:
>   *
>   *	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - *	base = devm_request_and_ioremap(&pdev->dev, res);
> - *	if (!base)
> - *		return -EADDRNOTAVAIL;
> + *	base = devm_ioremap_resource(&pdev->dev, res);
> + *	if (IS_ERR(base))
> + *		return PTR_ERR(base);
>   */
> -void __iomem *devm_request_and_ioremap(struct device *dev,
> -			struct resource *res)
> +void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
>  {
>  	resource_size_t size;
>  	const char *name;
> @@ -111,7 +113,7 @@ void __iomem *devm_request_and_ioremap(struct device *dev,
>  
>  	if (!res || resource_type(res) != IORESOURCE_MEM) {
>  		dev_err(dev, "invalid resource\n");
> -		return NULL;
> +		return ERR_PTR(-EINVAL);
>  	}
>  
>  	size = resource_size(res);
> @@ -119,7 +121,7 @@ void __iomem *devm_request_and_ioremap(struct device *dev,
>  
>  	if (!devm_request_mem_region(dev, res->start, size, name)) {
>  		dev_err(dev, "can't request region for resource %pR\n", res);
> -		return NULL;
> +		return ERR_PTR(-EBUSY);
>  	}
>  
>  	if (res->flags & IORESOURCE_CACHEABLE)
> @@ -130,10 +132,39 @@ void __iomem *devm_request_and_ioremap(struct device *dev,
>  	if (!dest_ptr) {
>  		dev_err(dev, "ioremap failed for resource %pR\n", res);
>  		devm_release_mem_region(dev, res->start, size);
> +		dest_ptr = ERR_PTR(-ENOMEM);
>  	}
>  
>  	return dest_ptr;
>  }
> +EXPORT_SYMBOL(devm_ioremap_resource);
> +
> +/**
> + * devm_request_and_ioremap() - Check, request region, and ioremap resource
> + * @dev: Generic device to handle the resource for
> + * @res: resource to be handled
> + *
> + * Takes all necessary steps to ioremap a mem resource. Uses managed device, so
> + * everything is undone on driver detach. Checks arguments, so you can feed
> + * it the result from e.g. platform_get_resource() directly. Returns the
> + * remapped pointer or NULL on error. Usage example:
> + *
> + *	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + *	base = devm_request_and_ioremap(&pdev->dev, res);
> + *	if (!base)
> + *		return -EADDRNOTAVAIL;
> + */
> +void __iomem *devm_request_and_ioremap(struct device *device,
> +				       struct resource *res)
> +{
> +	void __iomem *dest_ptr;
> +
> +	dest_ptr = devm_ioremap_resource(device, res);
> +	if (IS_ERR(dest_ptr))
> +		return NULL;
> +
> +	return dest_ptr;
> +}
>  EXPORT_SYMBOL(devm_request_and_ioremap);
>  
>  #ifdef CONFIG_HAS_IOPORT
> diff --git a/scripts/coccinelle/api/devm_ioremap_resource.cocci b/scripts/coccinelle/api/devm_ioremap_resource.cocci
> new file mode 100644
> index 0000000..495daa3
> --- /dev/null
> +++ b/scripts/coccinelle/api/devm_ioremap_resource.cocci
> @@ -0,0 +1,90 @@
> +virtual patch
> +virtual report
> +
> +@depends on patch@
> +expression base, dev, res;
> +@@
> +
> +-base = devm_request_and_ioremap(dev, res);
> ++base = devm_ioremap_resource(dev, res);
> + ...
> + if (
> +-base == NULL
> ++IS_ERR(base)
> + || ...) {
> +<...
> +-	return ...;
> ++	return PTR_ERR(base);
> +...>
> + }
> +
> +@depends on patch@
> +expression e, E, ret;
> +identifier l;
> +@@
> +
> + e = devm_ioremap_resource(...);
> + ...
> + if (IS_ERR(e) || ...) {
> + 	... when any
> +-	ret = E;
> ++	ret = PTR_ERR(e);
> + 	...
> +(
> + 	return ret;
> +|
> + 	goto l;
> +)
> + }
> +
> +@depends on patch@
> +expression e;
> +@@
> +
> + e = devm_ioremap_resource(...);
> + ...
> + if (IS_ERR(e) || ...) {
> + 	...
> +-	\(dev_dbg\|dev_err\|pr_debug\|pr_err\|DRM_ERROR\)(...);
> + 	...
> + }
> +
> +@depends on patch@
> +expression e;
> +identifier l;
> +@@
> +
> + e = devm_ioremap_resource(...);
> + ...
> + if (IS_ERR(e) || ...)
> +-{
> +(
> + 	return ...;
> +|
> + 	goto l;
> +)
> +-}
> +
> +@r depends on report@
> +expression e;
> +identifier l;
> +position p1;
> +@@
> +
> +*e = devm_request_and_ioremap@p1(...);
> + ...
> + if (e == NULL || ...) {
> + 	...
> +(
> + 	return ...;
> +|
> + 	goto l;
> +)
> + }
> +
> +@script:python depends on r@
> +p1 << r.p1;
> +@@
> +
> +msg = "ERROR: deprecated devm_request_and_ioremap() API used on line %s" % (p1[0].line)
> +coccilib.report.print_report(p1[0], msg)
> -- 
> 1.8.1.1
> 

-- 
Dmitry

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

* Re: [PATCH 12/33] Input: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 12/33] Input: " Thierry Reding
@ 2013-01-21 10:27   ` Dmitry Torokhov
  2013-01-21 10:45   ` Viresh Kumar
  1 sibling, 0 replies; 100+ messages in thread
From: Dmitry Torokhov @ 2013-01-21 10:27 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Arnd Bergmann, Wolfram Sang,
	linux-input

On Mon, Jan 21, 2013 at 11:09:05AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> Cc: linux-input@vger.kernel.org
> ---
>  drivers/input/keyboard/spear-keyboard.c | 8 +++-----
>  drivers/input/serio/arc_ps2.c           | 7 ++++---
>  2 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
> index 695d237..cb1e8f6 100644
> --- a/drivers/input/keyboard/spear-keyboard.c
> +++ b/drivers/input/keyboard/spear-keyboard.c
> @@ -228,11 +228,9 @@ static int spear_kbd_probe(struct platform_device *pdev)
>  		kbd->suspended_rate = pdata->suspended_rate;
>  	}
>  
> -	kbd->io_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!kbd->io_base) {
> -		dev_err(&pdev->dev, "request-ioremap failed for kbd_region\n");
> -		return -ENOMEM;
> -	}
> +	kbd->io_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(kbd->io_base))
> +		return PTR_ERR(kbd->io_base);
>  
>  	kbd->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(kbd->clk))
> diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c
> index b571eb3..c52e3e5 100644
> --- a/drivers/input/serio/arc_ps2.c
> +++ b/drivers/input/serio/arc_ps2.c
> @@ -8,6 +8,7 @@
>   * Driver is originally developed by Pavel Sokolov <psokolov@synopsys.com>
>   */
>  
> +#include <linux/err.h>
>  #include <linux/module.h>
>  #include <linux/interrupt.h>
>  #include <linux/input.h>
> @@ -206,9 +207,9 @@ static int arc_ps2_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	}
>  
> -	arc_ps2->addr = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!arc_ps2->addr)
> -		return -EBUSY;
> +	arc_ps2->addr = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(arc_ps2->addr))
> +		return PTR_ERR(arc_ps2->addr);
>  
>  	dev_info(&pdev->dev, "irq = %d, address = 0x%p, ports = %i\n",
>  		 irq, arc_ps2->addr, ARC_PS2_PORTS);
> -- 
> 1.8.1.1
> 

-- 
Dmitry

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

* Re: [PATCH 31/33] w1: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 31/33] w1: " Thierry Reding
@ 2013-01-21 10:27   ` Evgeniy Polyakov
  0 siblings, 0 replies; 100+ messages in thread
From: Evgeniy Polyakov @ 2013-01-21 10:27 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang

Hi

On Mon, Jan 21, 2013 at 11:09:24AM +0100, Thierry Reding (thierry.reding@avionic-design.de) wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Evgeniy Polyakov <zbr@ioremap.net>

Looks good to me
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

-- 
	Evgeniy Polyakov

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

* Re: [PATCH 12/33] Input: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 12/33] Input: " Thierry Reding
  2013-01-21 10:27   ` Dmitry Torokhov
@ 2013-01-21 10:45   ` Viresh Kumar
  2013-01-21 10:49     ` Thierry Reding
  1 sibling, 1 reply; 100+ messages in thread
From: Viresh Kumar @ 2013-01-21 10:45 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-input

On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
> @@ -228,11 +228,9 @@ static int spear_kbd_probe(struct platform_device *pdev)
>                 kbd->suspended_rate = pdata->suspended_rate;
>         }
>
> -       kbd->io_base = devm_request_and_ioremap(&pdev->dev, res);
> -       if (!kbd->io_base) {
> -               dev_err(&pdev->dev, "request-ioremap failed for kbd_region\n");

I would like to keep this error message as is.

> -               return -ENOMEM;
> -       }
> +       kbd->io_base = devm_ioremap_resource(&pdev->dev, res);
> +       if (IS_ERR(kbd->io_base))
> +               return PTR_ERR(kbd->io_base);

apart from that, for SPEAr

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 12/33] Input: Convert to devm_ioremap_resource()
  2013-01-21 10:45   ` Viresh Kumar
@ 2013-01-21 10:49     ` Thierry Reding
  2013-01-21 10:57       ` Viresh Kumar
  0 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 10:49 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-input

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

On Mon, Jan 21, 2013 at 04:15:35PM +0530, Viresh Kumar wrote:
> On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> > diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
> > @@ -228,11 +228,9 @@ static int spear_kbd_probe(struct platform_device *pdev)
> >                 kbd->suspended_rate = pdata->suspended_rate;
> >         }
> >
> > -       kbd->io_base = devm_request_and_ioremap(&pdev->dev, res);
> > -       if (!kbd->io_base) {
> > -               dev_err(&pdev->dev, "request-ioremap failed for kbd_region\n");
> 
> I would like to keep this error message as is.

Can you specify why? devm_request_and_ioremap() and the new
devm_ioremap_resource() both already output an error message if they
can't request or ioremap the memory region, so all this does is output a
duplicate error message.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 23/33] pwm: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 23/33] pwm: " Thierry Reding
@ 2013-01-21 10:49   ` Viresh Kumar
  0 siblings, 0 replies; 100+ messages in thread
From: Viresh Kumar @ 2013-01-21 10:49 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang

On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c
> index 83b21d9..69a2d9e 100644
> --- a/drivers/pwm/pwm-spear.c
> +++ b/drivers/pwm/pwm-spear.c
> @@ -192,9 +192,9 @@ static int spear_pwm_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>         }
>
> -       pc->mmio_base = devm_request_and_ioremap(&pdev->dev, r);
> -       if (!pc->mmio_base)
> -               return -EADDRNOTAVAIL;
> +       pc->mmio_base = devm_ioremap_resource(&pdev->dev, r);
> +       if (IS_ERR(pc->mmio_base))
> +               return PTR_ERR(pc->mmio_base);
>
>         pc->clk = devm_clk_get(&pdev->dev, NULL);
>         if (IS_ERR(pc->clk))

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 24/33] rtc: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 24/33] rtc: " Thierry Reding
@ 2013-01-21 10:50   ` Viresh Kumar
  0 siblings, 0 replies; 100+ messages in thread
From: Viresh Kumar @ 2013-01-21 10:50 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Alessandro Zummo, rtc-linux

On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
> index c2121b5..a18c319 100644
> --- a/drivers/rtc/rtc-spear.c
> +++ b/drivers/rtc/rtc-spear.c
> @@ -385,11 +385,9 @@ static int spear_rtc_probe(struct platform_device *pdev)
>                 return status;
>         }
>
> -       config->ioaddr = devm_request_and_ioremap(&pdev->dev, res);
> -       if (!config->ioaddr) {
> -               dev_err(&pdev->dev, "request-ioremap fail\n");

can we keep it as is?

> -               return -ENOMEM;
> -       }
> +       config->ioaddr = devm_ioremap_resource(&pdev->dev, res);
> +       if (IS_ERR(config->ioaddr))
> +               return PTR_ERR(config->ioaddr);
>

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 21/33] pinctrl: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 21/33] pinctrl: " Thierry Reding
@ 2013-01-21 10:50   ` Viresh Kumar
  0 siblings, 0 replies; 100+ messages in thread
From: Viresh Kumar @ 2013-01-21 10:50 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Linus Walleij

On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
> index 3cf4ecd..295b349 100644
> --- a/drivers/pinctrl/spear/pinctrl-plgpio.c
> +++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
> @@ -540,11 +540,9 @@ static int plgpio_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>         }
>
> -       plgpio->base = devm_request_and_ioremap(&pdev->dev, res);
> -       if (!plgpio->base) {
> -               dev_err(&pdev->dev, "request and ioremap fail\n");

can we keep this as is?

> -               return -ENOMEM;
> -       }
> +       plgpio->base = devm_ioremap_resource(&pdev->dev, res);
> +       if (IS_ERR(plgpio->base))
> +               return PTR_ERR(plgpio->base);
>

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 08/33] gpio: " Thierry Reding
@ 2013-01-21 10:52   ` Viresh Kumar
  2013-02-09 13:52     ` Grant Likely
  2013-01-22 10:15   ` Linus Walleij
  1 sibling, 1 reply; 100+ messages in thread
From: Viresh Kumar @ 2013-01-21 10:52 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Grant Likely, Linus Walleij

On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
> index 5f45fc4..7a4bf7c 100644
> --- a/drivers/gpio/gpio-spear-spics.c
> +++ b/drivers/gpio/gpio-spear-spics.c
> @@ -140,11 +140,9 @@ static int spics_gpio_probe(struct platform_device *pdev)
>                 return -ENOMEM;
>         }
>
> -       spics->base = devm_request_and_ioremap(&pdev->dev, res);
> -       if (!spics->base) {
> -               dev_err(&pdev->dev, "request and ioremap fail\n");

can we keep it as is?

> -               return -ENOMEM;
> -       }
> +       spics->base = devm_ioremap_resource(&pdev->dev, res);
> +       if (IS_ERR(spics->base))
> +               return PTR_ERR(spics->base);
>


Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 12/33] Input: Convert to devm_ioremap_resource()
  2013-01-21 10:49     ` Thierry Reding
@ 2013-01-21 10:57       ` Viresh Kumar
  2013-01-21 11:00         ` Thierry Reding
  0 siblings, 1 reply; 100+ messages in thread
From: Viresh Kumar @ 2013-01-21 10:57 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-input

On 21 January 2013 16:19, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> Can you specify why? devm_request_and_ioremap() and the new
> devm_ioremap_resource() both already output an error message if they
> can't request or ioremap the memory region, so all this does is output a
> duplicate error message.

because i missed implementations of these routines.. Ignore this comment
wherever i gave it :)

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

* Re: [PATCH 12/33] Input: Convert to devm_ioremap_resource()
  2013-01-21 10:57       ` Viresh Kumar
@ 2013-01-21 11:00         ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 11:00 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-input

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

On Mon, Jan 21, 2013 at 04:27:03PM +0530, Viresh Kumar wrote:
> On 21 January 2013 16:19, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> > Can you specify why? devm_request_and_ioremap() and the new
> > devm_ioremap_resource() both already output an error message if they
> > can't request or ioremap the memory region, so all this does is output a
> > duplicate error message.
> 
> because i missed implementations of these routines.. Ignore this comment
> wherever i gave it :)

Done. =)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
  2013-01-21 10:08   ` Thierry Reding
@ 2013-01-21 15:58     ` Russell King - ARM Linux
  -1 siblings, 0 replies; 100+ messages in thread
From: Russell King - ARM Linux @ 2013-01-21 15:58 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-arm-kernel

On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.

Does this include the resource part of the handling too?

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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
@ 2013-01-21 15:58     ` Russell King - ARM Linux
  0 siblings, 0 replies; 100+ messages in thread
From: Russell King - ARM Linux @ 2013-01-21 15:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.

Does this include the resource part of the handling too?

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

* Re: [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
  2013-01-21 15:58     ` Russell King - ARM Linux
@ 2013-01-21 16:05       ` Thierry Reding
  -1 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 16:05 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> 
> Does this include the resource part of the handling too?

I'm not sure I understand your question. devm_ioremap_resource() does a
devm_request_mem_region() internally if that's what you were asking.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
@ 2013-01-21 16:05       ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-21 16:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> 
> Does this include the resource part of the handling too?

I'm not sure I understand your question. devm_ioremap_resource() does a
devm_request_mem_region() internally if that's what you were asking.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130121/b1ffe047/attachment.sig>

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

* Re: [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
  2013-01-21 16:05       ` Thierry Reding
@ 2013-01-21 16:16         ` Russell King - ARM Linux
  -1 siblings, 0 replies; 100+ messages in thread
From: Russell King - ARM Linux @ 2013-01-21 16:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-arm-kernel

On Mon, Jan 21, 2013 at 05:05:47PM +0100, Thierry Reding wrote:
> On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> > On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > devm_ioremap_resource() which provides more consistent error handling.
> > 
> > Does this include the resource part of the handling too?
> 
> I'm not sure I understand your question. devm_ioremap_resource() does a
> devm_request_mem_region() internally if that's what you were asking.

Ah, that's fine then.  The function name is a little misleading, and as
it doesn't exist in mainline at present, it is not something I know about.

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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
@ 2013-01-21 16:16         ` Russell King - ARM Linux
  0 siblings, 0 replies; 100+ messages in thread
From: Russell King - ARM Linux @ 2013-01-21 16:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 21, 2013 at 05:05:47PM +0100, Thierry Reding wrote:
> On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> > On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > devm_ioremap_resource() which provides more consistent error handling.
> > 
> > Does this include the resource part of the handling too?
> 
> I'm not sure I understand your question. devm_ioremap_resource() does a
> devm_request_mem_region() internally if that's what you were asking.

Ah, that's fine then.  The function name is a little misleading, and as
it doesn't exist in mainline at present, it is not something I know about.

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

* Re: [PATCH 29/33] usb: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 29/33] usb: " Thierry Reding
@ 2013-01-21 17:16   ` Alan Stern
  2013-01-21 18:50   ` Felipe Balbi
  1 sibling, 0 replies; 100+ messages in thread
From: Alan Stern @ 2013-01-21 17:16 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Felipe Balbi, linux-usb

On Mon, 21 Jan 2013, Thierry Reding wrote:

> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: linux-usb@vger.kernel.org

For the EHCI and OHCI changes:

Acked-by: Alan Stern <stern@rowland.harvard.edu>


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

* Re: [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
  2013-01-21 16:16         ` Russell King - ARM Linux
@ 2013-01-21 17:23           ` Arnd Bergmann
  -1 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2013-01-21 17:23 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Thierry Reding, linux-kernel, Greg Kroah-Hartman,
	Dmitry Torokhov, Wolfram Sang, linux-arm-kernel

On Monday 21 January 2013, Russell King - ARM Linux wrote:
> On Mon, Jan 21, 2013 at 05:05:47PM +0100, Thierry Reding wrote:
> > On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> > > On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > > devm_ioremap_resource() which provides more consistent error handling.
> > > 
> > > Does this include the resource part of the handling too?
> > 
> > I'm not sure I understand your question. devm_ioremap_resource() does a
> > devm_request_mem_region() internally if that's what you were asking.
> 
> Ah, that's fine then.  The function name is a little misleading, and as
> it doesn't exist in mainline at present, it is not something I know about.

The usual problem with long patch series like this: The introductory mail
PATCH 0/xx explains this nicely, but it's not possible to put everyone
on Cc because then it gets rejected by vger for overly long mail headers.

We had a discussion about the function name earlier, but could not come
up with one that isn't too bulky but still carries the same meaning
as devm_request_and_ioremap() with a different symbol.

	Arnd

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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
@ 2013-01-21 17:23           ` Arnd Bergmann
  0 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2013-01-21 17:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 21 January 2013, Russell King - ARM Linux wrote:
> On Mon, Jan 21, 2013 at 05:05:47PM +0100, Thierry Reding wrote:
> > On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> > > On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > > devm_ioremap_resource() which provides more consistent error handling.
> > > 
> > > Does this include the resource part of the handling too?
> > 
> > I'm not sure I understand your question. devm_ioremap_resource() does a
> > devm_request_mem_region() internally if that's what you were asking.
> 
> Ah, that's fine then.  The function name is a little misleading, and as
> it doesn't exist in mainline at present, it is not something I know about.

The usual problem with long patch series like this: The introductory mail
PATCH 0/xx explains this nicely, but it's not possible to put everyone
on Cc because then it gets rejected by vger for overly long mail headers.

We had a discussion about the function name earlier, but could not come
up with one that isn't too bulky but still carries the same meaning
as devm_request_and_ioremap() with a different symbol.

	Arnd

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

* Re: [PATCH 29/33] usb: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 29/33] usb: " Thierry Reding
  2013-01-21 17:16   ` Alan Stern
@ 2013-01-21 18:50   ` Felipe Balbi
  1 sibling, 0 replies; 100+ messages in thread
From: Felipe Balbi @ 2013-01-21 18:50 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Alan Stern, Felipe Balbi, linux-usb

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

On Mon, Jan 21, 2013 at 11:09:22AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: linux-usb@vger.kernel.org

For drivers/usb/renenas, drivers/usb/otg, drivers/usb/phy,
drivers/usb/musb and drivers/usb/gadget:

Acked-by: Felipe Balbi <balbi@ti.com>

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 20/33] net: " Thierry Reding
@ 2013-01-21 20:29   ` David Miller
  2013-01-22  6:56     ` Thierry Reding
  0 siblings, 1 reply; 100+ messages in thread
From: David Miller @ 2013-01-21 20:29 UTC (permalink / raw)
  To: thierry.reding
  Cc: linux-kernel, gregkh, dmitry.torokhov, arnd, w.sang, netdev

From: Thierry Reding <thierry.reding@avionic-design.de>
Date: Mon, 21 Jan 2013 11:09:13 +0100

> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>

This won't compile if I apply it.

You really have to be clear when you submit patches like this.

Since you only CC:'d the networking developers for this one
patch, there is _ZERO_ context for us to work with to understand
what's going on.

You have to also CC: us on the other relevant changes and your
"[PATCH 00/33]" posting that explains what is happening.

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

* Re: [PATCH 30/33] video: Convert to devm_ioremap_resource()
  2013-01-21 10:09   ` Thierry Reding
@ 2013-01-22  4:17     ` Jingoo Han
  -1 siblings, 0 replies; 100+ messages in thread
From: Jingoo Han @ 2013-01-22  4:17 UTC (permalink / raw)
  To: 'Thierry Reding', linux-kernel
  Cc: 'Greg Kroah-Hartman', 'Dmitry Torokhov',
	'Arnd Bergmann', 'Wolfram Sang',
	'Florian Tobias Schandinat',
	linux-fbdev, 'Jingoo Han'

On Monday, January 21, 2013 7:09 PM, Thierry wrote
> 
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
> Cc: linux-fbdev@vger.kernel.org
> ---
>  drivers/video/exynos/exynos_dp_core.c | 8 +++-----
>  drivers/video/jz4740_fb.c             | 6 +++---
>  drivers/video/omap2/dss/hdmi.c        | 8 +++-----
>  drivers/video/omap2/vrfb.c            | 9 ++++-----
>  drivers/video/s3c-fb.c                | 7 +++----
>  5 files changed, 16 insertions(+), 22 deletions(-)
> 

For drivers/video/s3c-fb.c, drivers/video/exynos/exynos_dp_core.c

Acked-by: Jingoo Han <jg1.han@samsung.com>


Best regards,
Jingoo Han



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

* Re: [PATCH 30/33] video: Convert to devm_ioremap_resource()
@ 2013-01-22  4:17     ` Jingoo Han
  0 siblings, 0 replies; 100+ messages in thread
From: Jingoo Han @ 2013-01-22  4:17 UTC (permalink / raw)
  To: 'Thierry Reding', linux-kernel
  Cc: 'Greg Kroah-Hartman', 'Dmitry Torokhov',
	'Arnd Bergmann', 'Wolfram Sang',
	'Florian Tobias Schandinat',
	linux-fbdev, 'Jingoo Han'

On Monday, January 21, 2013 7:09 PM, Thierry wrote
> 
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
> Cc: linux-fbdev@vger.kernel.org
> ---
>  drivers/video/exynos/exynos_dp_core.c | 8 +++-----
>  drivers/video/jz4740_fb.c             | 6 +++---
>  drivers/video/omap2/dss/hdmi.c        | 8 +++-----
>  drivers/video/omap2/vrfb.c            | 9 ++++-----
>  drivers/video/s3c-fb.c                | 7 +++----
>  5 files changed, 16 insertions(+), 22 deletions(-)
> 

For drivers/video/s3c-fb.c, drivers/video/exynos/exynos_dp_core.c

Acked-by: Jingoo Han <jg1.han@samsung.com>


Best regards,
Jingoo Han



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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-21 20:29   ` David Miller
@ 2013-01-22  6:56     ` Thierry Reding
  2013-01-22 13:03       ` Arnd Bergmann
  2013-01-22 18:58       ` David Miller
  0 siblings, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-22  6:56 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, gregkh, dmitry.torokhov, arnd, w.sang, netdev

[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]

On Mon, Jan 21, 2013 at 03:29:13PM -0500, David Miller wrote:
> From: Thierry Reding <thierry.reding@avionic-design.de>
> Date: Mon, 21 Jan 2013 11:09:13 +0100
> 
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> > 
> > devm_ioremap_resource() provides its own error messages so all explicit
> > error messages can be removed from the failure code paths.
> > 
> > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> 
> This won't compile if I apply it.
> 
> You really have to be clear when you submit patches like this.
> 
> Since you only CC:'d the networking developers for this one
> patch, there is _ZERO_ context for us to work with to understand
> what's going on.
> 
> You have to also CC: us on the other relevant changes and your
> "[PATCH 00/33]" posting that explains what is happening.

I planned to do so initially, but that yielded a Cc list of 156 people
and mailing lists, which I thought wasn't going to go down so well
either. In general I like Cc'ing everyone concerned on all patches of
the series, specifically for reasons of context. Some people have been
annoyed when I did so. Still, for small series where only a few dozen
people are concerned that seems to me to be the best way. But 156 email
addresses is a different story.

Either you add to many people or you don't add enough. Where do we draw
the line?

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 33/33] ASoC: Convert to devm_ioremap_resource()
  2013-01-21 10:09   ` Thierry Reding
  (?)
@ 2013-01-22  7:48   ` Mark Brown
  2013-01-22  7:55     ` Thierry Reding
  -1 siblings, 1 reply; 100+ messages in thread
From: Mark Brown @ 2013-01-22  7:48 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Liam Girdwood, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

On Mon, Jan 21, 2013 at 11:09:26AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 33/33] ASoC: Convert to devm_ioremap_resource()
  2013-01-22  7:48   ` Mark Brown
@ 2013-01-22  7:55     ` Thierry Reding
  2013-01-22  8:01       ` Mark Brown
  0 siblings, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-22  7:55 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Liam Girdwood, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

On Tue, Jan 22, 2013 at 04:48:26PM +0900, Mark Brown wrote:
> On Mon, Jan 21, 2013 at 11:09:26AM +0100, Thierry Reding wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> 
> Applied, thanks.

It's probably too early to apply this yet since the first patch in the
series, which introduces the new function, hasn't been merged yet. I
seem to have handled this poorly, as David Miller already pointed out,
by not Cc'ing everyone involved on the first patch.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 33/33] ASoC: Convert to devm_ioremap_resource()
  2013-01-22  7:55     ` Thierry Reding
@ 2013-01-22  8:01       ` Mark Brown
  0 siblings, 0 replies; 100+ messages in thread
From: Mark Brown @ 2013-01-22  8:01 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Liam Girdwood, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

On Tue, Jan 22, 2013 at 08:55:52AM +0100, Thierry Reding wrote:

> It's probably too early to apply this yet since the first patch in the
> series, which introduces the new function, hasn't been merged yet. I
> seem to have handled this poorly, as David Miller already pointed out,
> by not Cc'ing everyone involved on the first patch.

Oh, well.  Dropped then.  Acked-by instead.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 08/33] gpio: " Thierry Reding
  2013-01-21 10:52   ` Viresh Kumar
@ 2013-01-22 10:15   ` Linus Walleij
  2013-01-22 10:25     ` Thierry Reding
  2013-01-22 11:39     ` Gregory CLEMENT
  1 sibling, 2 replies; 100+ messages in thread
From: Linus Walleij @ 2013-01-22 10:15 UTC (permalink / raw)
  To: Thierry Reding, Stephen Warren, Gregory CLEMENT
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Grant Likely

On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:

> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
>
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
>
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Linus Walleij <linus.walleij@linaro.org>

Is the interface already in-kernel so I should apply this or is it
added as part of this series so you're searching an ACK?

Yours,
Linus Walleij

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-22 10:15   ` Linus Walleij
@ 2013-01-22 10:25     ` Thierry Reding
  2013-01-22 16:08       ` Greg Kroah-Hartman
  2013-01-23  8:36       ` Linus Walleij
  2013-01-22 11:39     ` Gregory CLEMENT
  1 sibling, 2 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-22 10:25 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Stephen Warren, Gregory CLEMENT, linux-kernel,
	Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Grant Likely

[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]

On Tue, Jan 22, 2013 at 11:15:11AM +0100, Linus Walleij wrote:
> On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> 
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> >
> > devm_ioremap_resource() provides its own error messages so all explicit
> > error messages can be removed from the failure code paths.
> >
> > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> > Cc: Grant Likely <grant.likely@secretlab.ca>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> 
> Is the interface already in-kernel so I should apply this or is it
> added as part of this series so you're searching an ACK?

It is part of this series, so your Acked-by would be great. Other
maintainers have done the same. Initially I had thought that it might be
easier if the patches went in through individual trees, but since the
first patch is a dependency, maybe it'd be better to take them all
through a single tree.

Greg, any comments? Would you be willing to take the series through your
driver-core tree once all Acked-bys are there? Alternatively I guess we
could take the first patch into linux-next, at which point maintainers
could take this through the individual trees.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 14/33] media: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 14/33] media: " Thierry Reding
@ 2013-01-22 11:04   ` Sylwester Nawrocki
  0 siblings, 0 replies; 100+ messages in thread
From: Sylwester Nawrocki @ 2013-01-22 11:04 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Mauro Carvalho Chehab, linux-media

Hi,

On 01/21/2013 11:09 AM, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> ---
>  drivers/media/platform/exynos-gsc/gsc-core.c   |  8 +++-----
>  drivers/media/platform/mx2_emmaprp.c           |  6 +++---
>  drivers/media/platform/s3c-camif/camif-core.c  |  8 +++-----
>  drivers/media/platform/s5p-fimc/fimc-core.c    |  8 +++-----
>  drivers/media/platform/s5p-fimc/fimc-lite.c    |  8 +++-----
>  drivers/media/platform/s5p-fimc/mipi-csis.c    |  8 +++-----
>  drivers/media/platform/s5p-g2d/g2d.c           |  8 +++-----
>  drivers/media/platform/s5p-jpeg/jpeg-core.c    |  8 +++-----
>  drivers/media/platform/s5p-mfc/s5p_mfc.c       |  8 +++-----
>  drivers/media/platform/soc_camera/mx2_camera.c | 12 ++++++------
>  10 files changed, 33 insertions(+), 49 deletions(-)

That's a nice cleanup. For exynos-gsc, s3c-camif, s5p-* drivers

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

--

Thanks,
Sylwester

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-22 10:15   ` Linus Walleij
  2013-01-22 10:25     ` Thierry Reding
@ 2013-01-22 11:39     ` Gregory CLEMENT
  2013-01-22 11:49       ` Thierry Reding
  1 sibling, 1 reply; 100+ messages in thread
From: Gregory CLEMENT @ 2013-01-22 11:39 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Thierry Reding, Stephen Warren, linux-kernel, Greg Kroah-Hartman,
	Dmitry Torokhov, Arnd Bergmann, Wolfram Sang, Grant Likely

On 01/22/2013 11:15 AM, Linus Walleij wrote:
> On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> 
>> Convert all uses of devm_request_and_ioremap() to the newly introduced
>> devm_ioremap_resource() which provides more consistent error handling.
>>
>> devm_ioremap_resource() provides its own error messages so all explicit
>> error messages can be removed from the failure code paths.
>>
>> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
>> Cc: Grant Likely <grant.likely@secretlab.ca>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
> 
> Is the interface already in-kernel so I should apply this or is it
> added as part of this series so you're searching an ACK?

I don't know if I was really the one you were looking for (either
you wanted to send it to an other Greg(ory) or to Thomas Petazzoni who
wrote the gpio-mvebu.c driver). However, that's fortunate because
Thomas is currently in on vacations, so I apply this patch and the
first of the series, I built, compiled and tested it on an Aramda XP DB
board. Everything is OK for me.

So for sure you can have my
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

and as the code looks good, so for what it's worth, you can even get my
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-22 11:39     ` Gregory CLEMENT
@ 2013-01-22 11:49       ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-22 11:49 UTC (permalink / raw)
  To: Gregory CLEMENT
  Cc: Linus Walleij, Stephen Warren, linux-kernel, Greg Kroah-Hartman,
	Dmitry Torokhov, Arnd Bergmann, Wolfram Sang, Grant Likely

[-- Attachment #1: Type: text/plain, Size: 1527 bytes --]

On Tue, Jan 22, 2013 at 12:39:03PM +0100, Gregory CLEMENT wrote:
> On 01/22/2013 11:15 AM, Linus Walleij wrote:
> > On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
> > <thierry.reding@avionic-design.de> wrote:
> > 
> >> Convert all uses of devm_request_and_ioremap() to the newly introduced
> >> devm_ioremap_resource() which provides more consistent error handling.
> >>
> >> devm_ioremap_resource() provides its own error messages so all explicit
> >> error messages can be removed from the failure code paths.
> >>
> >> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> >> Cc: Grant Likely <grant.likely@secretlab.ca>
> >> Cc: Linus Walleij <linus.walleij@linaro.org>
> > 
> > Is the interface already in-kernel so I should apply this or is it
> > added as part of this series so you're searching an ACK?
> 
> I don't know if I was really the one you were looking for (either
> you wanted to send it to an other Greg(ory) or to Thomas Petazzoni who
> wrote the gpio-mvebu.c driver). However, that's fortunate because
> Thomas is currently in on vacations, so I apply this patch and the
> first of the series, I built, compiled and tested it on an Aramda XP DB
> board. Everything is OK for me.
> 
> So for sure you can have my
> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
> 
> and as the code looks good, so for what it's worth, you can even get my
> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Great! Thanks for testing!

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 11/33] iio: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 11/33] iio: " Thierry Reding
@ 2013-01-22 12:12   ` Jonathan Cameron
  0 siblings, 0 replies; 100+ messages in thread
From: Jonathan Cameron @ 2013-01-22 12:12 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Jonathan Cameron, linux-iio

On 01/21/2013 10:09 AM, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Jonathan Cameron <jic23@cam.ac.uk>
> Cc: linux-iio@vger.kernel.org
Looks fine to me.

Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
>  drivers/iio/adc/at91_adc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index a526c0e..83c836b 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -557,9 +557,9 @@ static int at91_adc_probe(struct platform_device *pdev)
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  
> -	st->reg_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!st->reg_base) {
> -		ret = -ENOMEM;
> +	st->reg_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(st->reg_base)) {
> +		ret = PTR_ERR(st->reg_base);
>  		goto error_free_device;
>  	}
>  
> 

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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-22  6:56     ` Thierry Reding
@ 2013-01-22 13:03       ` Arnd Bergmann
  2013-01-22 13:09         ` Thierry Reding
  2013-01-22 19:08         ` David Miller
  2013-01-22 18:58       ` David Miller
  1 sibling, 2 replies; 100+ messages in thread
From: Arnd Bergmann @ 2013-01-22 13:03 UTC (permalink / raw)
  To: Thierry Reding
  Cc: David Miller, linux-kernel, gregkh, dmitry.torokhov, w.sang, netdev

On Tuesday 22 January 2013, Thierry Reding wrote:
> I planned to do so initially, but that yielded a Cc list of 156 people
> and mailing lists, which I thought wasn't going to go down so well
> either. In general I like Cc'ing everyone concerned on all patches of
> the series, specifically for reasons of context. Some people have been
> annoyed when I did so. Still, for small series where only a few dozen
> people are concerned that seems to me to be the best way. But 156 email
> addresses is a different story.
> 
> Either you add to many people or you don't add enough. Where do we draw
> the line?

I've had the same problem a couple of times. The best compromise seems
to be to Cc only the top-level subsystem maintainers and mailing lists
on the first email.

	Arnd

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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-22 13:03       ` Arnd Bergmann
@ 2013-01-22 13:09         ` Thierry Reding
  2013-01-22 13:17           ` Arnd Bergmann
  2013-01-22 19:08         ` David Miller
  1 sibling, 1 reply; 100+ messages in thread
From: Thierry Reding @ 2013-01-22 13:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Miller, linux-kernel, gregkh, dmitry.torokhov, w.sang, netdev

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

On Tue, Jan 22, 2013 at 01:03:06PM +0000, Arnd Bergmann wrote:
> On Tuesday 22 January 2013, Thierry Reding wrote:
> > I planned to do so initially, but that yielded a Cc list of 156 people
> > and mailing lists, which I thought wasn't going to go down so well
> > either. In general I like Cc'ing everyone concerned on all patches of
> > the series, specifically for reasons of context. Some people have been
> > annoyed when I did so. Still, for small series where only a few dozen
> > people are concerned that seems to me to be the best way. But 156 email
> > addresses is a different story.
> > 
> > Either you add to many people or you don't add enough. Where do we draw
> > the line?
> 
> I've had the same problem a couple of times. The best compromise seems
> to be to Cc only the top-level subsystem maintainers and mailing lists
> on the first email.

Even that would have been about 50 addresses IIRC. But perhaps that's
still the best compromise to avoid any confusion.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-22 13:09         ` Thierry Reding
@ 2013-01-22 13:17           ` Arnd Bergmann
  0 siblings, 0 replies; 100+ messages in thread
From: Arnd Bergmann @ 2013-01-22 13:17 UTC (permalink / raw)
  To: Thierry Reding
  Cc: David Miller, linux-kernel, gregkh, dmitry.torokhov, w.sang, netdev

On Tuesday 22 January 2013, Thierry Reding wrote:
> > I've had the same problem a couple of times. The best compromise seems
> > to be to Cc only the top-level subsystem maintainers and mailing lists
> > on the first email.
> 
> Even that would have been about 50 addresses IIRC. But perhaps that's
> still the best compromise to avoid any confusion.

Be careful though that the Cc list must not exceed 1024 characters or
it will get rejected by some of the mailing list servers.

	Arnd

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-22 10:25     ` Thierry Reding
@ 2013-01-22 16:08       ` Greg Kroah-Hartman
  2013-01-22 16:15         ` Thierry Reding
  2013-01-23  8:36       ` Linus Walleij
  1 sibling, 1 reply; 100+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-22 16:08 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Linus Walleij, Stephen Warren, Gregory CLEMENT, linux-kernel,
	Dmitry Torokhov, Arnd Bergmann, Wolfram Sang, Grant Likely

On Tue, Jan 22, 2013 at 11:25:59AM +0100, Thierry Reding wrote:
> On Tue, Jan 22, 2013 at 11:15:11AM +0100, Linus Walleij wrote:
> > On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
> > <thierry.reding@avionic-design.de> wrote:
> > 
> > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > devm_ioremap_resource() which provides more consistent error handling.
> > >
> > > devm_ioremap_resource() provides its own error messages so all explicit
> > > error messages can be removed from the failure code paths.
> > >
> > > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> > > Cc: Grant Likely <grant.likely@secretlab.ca>
> > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > 
> > Is the interface already in-kernel so I should apply this or is it
> > added as part of this series so you're searching an ACK?
> 
> It is part of this series, so your Acked-by would be great. Other
> maintainers have done the same. Initially I had thought that it might be
> easier if the patches went in through individual trees, but since the
> first patch is a dependency, maybe it'd be better to take them all
> through a single tree.
> 
> Greg, any comments? Would you be willing to take the series through your
> driver-core tree once all Acked-bys are there? Alternatively I guess we
> could take the first patch into linux-next, at which point maintainers
> could take this through the individual trees.

Yes, I'll take the first patch through my driver-core tree, and add all
of the patches that the subsystem maintainers have acked as well.

As subsystem trees can't depend on linux-next, it makes it easier that
way.

thanks,

greg k-h

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-22 16:08       ` Greg Kroah-Hartman
@ 2013-01-22 16:15         ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-22 16:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Linus Walleij, Stephen Warren, Gregory CLEMENT, linux-kernel,
	Dmitry Torokhov, Arnd Bergmann, Wolfram Sang, Grant Likely

[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]

On Tue, Jan 22, 2013 at 08:08:09AM -0800, Greg Kroah-Hartman wrote:
> On Tue, Jan 22, 2013 at 11:25:59AM +0100, Thierry Reding wrote:
> > On Tue, Jan 22, 2013 at 11:15:11AM +0100, Linus Walleij wrote:
> > > On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
> > > <thierry.reding@avionic-design.de> wrote:
> > > 
> > > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > > devm_ioremap_resource() which provides more consistent error handling.
> > > >
> > > > devm_ioremap_resource() provides its own error messages so all explicit
> > > > error messages can be removed from the failure code paths.
> > > >
> > > > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> > > > Cc: Grant Likely <grant.likely@secretlab.ca>
> > > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > 
> > > Is the interface already in-kernel so I should apply this or is it
> > > added as part of this series so you're searching an ACK?
> > 
> > It is part of this series, so your Acked-by would be great. Other
> > maintainers have done the same. Initially I had thought that it might be
> > easier if the patches went in through individual trees, but since the
> > first patch is a dependency, maybe it'd be better to take them all
> > through a single tree.
> > 
> > Greg, any comments? Would you be willing to take the series through your
> > driver-core tree once all Acked-bys are there? Alternatively I guess we
> > could take the first patch into linux-next, at which point maintainers
> > could take this through the individual trees.
> 
> Yes, I'll take the first patch through my driver-core tree, and add all
> of the patches that the subsystem maintainers have acked as well.
> 
> As subsystem trees can't depend on linux-next, it makes it easier that
> way.

Most excellent. Thanks!

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
  2013-01-21 16:16         ` Russell King - ARM Linux
@ 2013-01-22 17:37           ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 100+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-22 17:37 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Thierry Reding, linux-kernel, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, linux-arm-kernel

On Mon, Jan 21, 2013 at 04:16:11PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 21, 2013 at 05:05:47PM +0100, Thierry Reding wrote:
> > On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> > > On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > > devm_ioremap_resource() which provides more consistent error handling.
> > > 
> > > Does this include the resource part of the handling too?
> > 
> > I'm not sure I understand your question. devm_ioremap_resource() does a
> > devm_request_mem_region() internally if that's what you were asking.
> 
> Ah, that's fine then.  The function name is a little misleading, and as
> it doesn't exist in mainline at present, it is not something I know about.

Can I assume this is an Acked-by: from you for this patch so that I can
take this through my driver-core tree?

thanks,

greg k-h

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

* [PATCH 02/33] ARM: Convert to devm_ioremap_resource()
@ 2013-01-22 17:37           ` Greg Kroah-Hartman
  0 siblings, 0 replies; 100+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-22 17:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jan 21, 2013 at 04:16:11PM +0000, Russell King - ARM Linux wrote:
> On Mon, Jan 21, 2013 at 05:05:47PM +0100, Thierry Reding wrote:
> > On Mon, Jan 21, 2013 at 03:58:46PM +0000, Russell King - ARM Linux wrote:
> > > On Mon, Jan 21, 2013 at 11:08:55AM +0100, Thierry Reding wrote:
> > > > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > > > devm_ioremap_resource() which provides more consistent error handling.
> > > 
> > > Does this include the resource part of the handling too?
> > 
> > I'm not sure I understand your question. devm_ioremap_resource() does a
> > devm_request_mem_region() internally if that's what you were asking.
> 
> Ah, that's fine then.  The function name is a little misleading, and as
> it doesn't exist in mainline at present, it is not something I know about.

Can I assume this is an Acked-by: from you for this patch so that I can
take this through my driver-core tree?

thanks,

greg k-h

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

* Re: [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource()
  2013-01-21 10:08 ` [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource() Thierry Reding
  2013-01-21 10:26   ` Dmitry Torokhov
@ 2013-01-22 17:40   ` Greg Kroah-Hartman
  2013-01-22 21:00     ` Thierry Reding
  1 sibling, 1 reply; 100+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-22 17:40 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-kernel, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

On Mon, Jan 21, 2013 at 11:08:54AM +0100, Thierry Reding wrote:
> The devm_request_and_ioremap() function is very useful and helps avoid a
> whole lot of boilerplate. However, one issue that keeps popping up is
> its lack of a specific error code to determine which of the steps that
> it performs failed. Furthermore, while the function gives an example and
> suggests what error code to return on failure, a wide variety of error
> codes are used throughout the tree.
> 
> In an attempt to fix these problems, this patch adds a new function that
> drivers can transition to. The devm_ioremap_resource() returns a pointer
> to the remapped I/O memory on success or an ERR_PTR() encoded error code
> on failure. Callers can check for failure using IS_ERR() and determine
> its cause by extracting the error code using PTR_ERR().
> 
> devm_request_and_ioremap() is implemented as a wrapper around the new
> API and return NULL on failure as before. This ensures that backwards
> compatibility is maintained until all users have been converted to the
> new API, at which point the old devm_request_and_ioremap() function
> should be removed. To help prevent new users from being added in the
> meantime, devm_request_and_ioremap() is marked __deprecated.

I've edited the patch and removed the __depreciated line as that's just
going to cause a whole lot of noise in the kernel.  I'd recommend just
watching to ensure that we catch all users of the current function and
convert them to the new one, and then we can drop it, no need to use
__deprecated at all.

thanks,

greg k-h

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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-22  6:56     ` Thierry Reding
  2013-01-22 13:03       ` Arnd Bergmann
@ 2013-01-22 18:58       ` David Miller
  1 sibling, 0 replies; 100+ messages in thread
From: David Miller @ 2013-01-22 18:58 UTC (permalink / raw)
  To: thierry.reding
  Cc: linux-kernel, gregkh, dmitry.torokhov, arnd, w.sang, netdev

From: Thierry Reding <thierry.reding@avionic-design.de>
Date: Tue, 22 Jan 2013 07:56:29 +0100

> I planned to do so initially, but that yielded a Cc list of 156 people
> and mailing lists,

Just use mailing lists, the individuals are subscribed to the subsystem
lists that cover what they maintain.

Yes, CC:'ing 156 "people" is stupid.

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

* Re: [PATCH 20/33] net: Convert to devm_ioremap_resource()
  2013-01-22 13:03       ` Arnd Bergmann
  2013-01-22 13:09         ` Thierry Reding
@ 2013-01-22 19:08         ` David Miller
  1 sibling, 0 replies; 100+ messages in thread
From: David Miller @ 2013-01-22 19:08 UTC (permalink / raw)
  To: arnd
  Cc: thierry.reding, linux-kernel, gregkh, dmitry.torokhov, w.sang, netdev

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 22 Jan 2013 13:03:06 +0000

> On Tuesday 22 January 2013, Thierry Reding wrote:
>> I planned to do so initially, but that yielded a Cc list of 156 people
>> and mailing lists, which I thought wasn't going to go down so well
>> either. In general I like Cc'ing everyone concerned on all patches of
>> the series, specifically for reasons of context. Some people have been
>> annoyed when I did so. Still, for small series where only a few dozen
>> people are concerned that seems to me to be the best way. But 156 email
>> addresses is a different story.
>> 
>> Either you add to many people or you don't add enough. Where do we draw
>> the line?
> 
> I've had the same problem a couple of times. The best compromise seems
> to be to Cc only the top-level subsystem maintainers and mailing lists
> on the first email.

CC:'ing individuals is pointless, CC: only the subsystem lists in
question, the maintainers had better be reading those lists.

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

* Re: [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource()
  2013-01-22 17:40   ` Greg Kroah-Hartman
@ 2013-01-22 21:00     ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-22 21:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

[-- Attachment #1: Type: text/plain, Size: 1820 bytes --]

On Tue, Jan 22, 2013 at 09:40:43AM -0800, Greg Kroah-Hartman wrote:
> On Mon, Jan 21, 2013 at 11:08:54AM +0100, Thierry Reding wrote:
> > The devm_request_and_ioremap() function is very useful and helps avoid a
> > whole lot of boilerplate. However, one issue that keeps popping up is
> > its lack of a specific error code to determine which of the steps that
> > it performs failed. Furthermore, while the function gives an example and
> > suggests what error code to return on failure, a wide variety of error
> > codes are used throughout the tree.
> > 
> > In an attempt to fix these problems, this patch adds a new function that
> > drivers can transition to. The devm_ioremap_resource() returns a pointer
> > to the remapped I/O memory on success or an ERR_PTR() encoded error code
> > on failure. Callers can check for failure using IS_ERR() and determine
> > its cause by extracting the error code using PTR_ERR().
> > 
> > devm_request_and_ioremap() is implemented as a wrapper around the new
> > API and return NULL on failure as before. This ensures that backwards
> > compatibility is maintained until all users have been converted to the
> > new API, at which point the old devm_request_and_ioremap() function
> > should be removed. To help prevent new users from being added in the
> > meantime, devm_request_and_ioremap() is marked __deprecated.
> 
> I've edited the patch and removed the __depreciated line as that's just
> going to cause a whole lot of noise in the kernel.  I'd recommend just
> watching to ensure that we catch all users of the current function and
> convert them to the new one, and then we can drop it, no need to use
> __deprecated at all.

Okay, works for me. Both grep and the semantic patch can easily find
users of the current function.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 10/33] i2c: Convert to devm_ioremap_resource()
@ 2013-01-22 22:30     ` Wolfram Sang
  0 siblings, 0 replies; 100+ messages in thread
From: Wolfram Sang @ 2013-01-22 22:30 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Ben Dooks, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

On Mon, Jan 21, 2013 at 11:09:03AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Wolfram Sang <w.sang@pengutronix.de>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: linux-i2c@vger.kernel.org

I still have the concerns I mentioned in the previous discussion but the
series seems to have enough momentum that we could also just try it.

So, for I2C:

Acked-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 10/33] i2c: Convert to devm_ioremap_resource()
@ 2013-01-22 22:30     ` Wolfram Sang
  0 siblings, 0 replies; 100+ messages in thread
From: Wolfram Sang @ 2013-01-22 22:30 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	Dmitry Torokhov, Arnd Bergmann, Ben Dooks,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

On Mon, Jan 21, 2013 at 11:09:03AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
> Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
> Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

I still have the concerns I mentioned in the previous discussion but the
series seems to have enough momentum that we could also just try it.

So, for I2C:

Acked-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-22 10:25     ` Thierry Reding
  2013-01-22 16:08       ` Greg Kroah-Hartman
@ 2013-01-23  8:36       ` Linus Walleij
  1 sibling, 0 replies; 100+ messages in thread
From: Linus Walleij @ 2013-01-23  8:36 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Stephen Warren, Gregory CLEMENT, linux-kernel,
	Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Grant Likely

On Tue, Jan 22, 2013 at 11:25 AM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> On Tue, Jan 22, 2013 at 11:15:11AM +0100, Linus Walleij wrote:
>> On Mon, Jan 21, 2013 at 11:09 AM, Thierry Reding
>> <thierry.reding@avionic-design.de> wrote:
>>
>> > Convert all uses of devm_request_and_ioremap() to the newly introduced
>> > devm_ioremap_resource() which provides more consistent error handling.
>> >
>> > devm_ioremap_resource() provides its own error messages so all explicit
>> > error messages can be removed from the failure code paths.
>> >
>> > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
>> > Cc: Grant Likely <grant.likely@secretlab.ca>
>> > Cc: Linus Walleij <linus.walleij@linaro.org>
>>
>> Is the interface already in-kernel so I should apply this or is it
>> added as part of this series so you're searching an ACK?
>
> It is part of this series, so your Acked-by would be great.

Fair enough,
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 07/33] dma: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 07/33] dma: " Thierry Reding
@ 2013-01-28 16:00   ` Vinod Koul
  2013-01-28 17:20     ` Thierry Reding
  2013-01-29 13:11   ` Andy Shevchenko
  1 sibling, 1 reply; 100+ messages in thread
From: Vinod Koul @ 2013-01-28 16:00 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang

On Mon, Jan 21, 2013 at 11:09:00AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
Where is this symbol, applying this results in build failures for me?

> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Vinod Koul <vinod.koul@intel.com>
> ---
>  drivers/dma/dw_dmac.c         |  7 ++++---
>  drivers/dma/imx-dma.c         |  7 ++++---
>  drivers/dma/mmp_pdma.c        |  7 ++++---
>  drivers/dma/mmp_tdma.c        |  7 ++++---
>  drivers/dma/tegra20-apb-dma.c | 10 ++++------
>  5 files changed, 20 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 3e8ba02..b33d1f6 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -14,6 +14,7 @@
>  #include <linux/delay.h>
>  #include <linux/dmaengine.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/err.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> @@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev)
>  	if (irq < 0)
>  		return irq;
>  
> -	regs = devm_request_and_ioremap(&pdev->dev, io);
> -	if (!regs)
> -		return -EBUSY;
> +	regs = devm_ioremap_resource(&pdev->dev, io);
> +	if (IS_ERR(regs))
> +		return PTR_ERR(regs);
>  
>  	dw_params = dma_read_byaddr(regs, DW_PARAMS);
>  	autocfg = dw_params >> DW_PARAMS_EN & 0x1;
> diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
> index dbf0e6f..84ae491 100644
> --- a/drivers/dma/imx-dma.c
> +++ b/drivers/dma/imx-dma.c
> @@ -14,6 +14,7 @@
>   * http://www.opensource.org/licenses/gpl-license.html
>   * http://www.gnu.org/copyleft/gpl.html
>   */
> +#include <linux/err.h>
>  #include <linux/init.h>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> @@ -1011,9 +1012,9 @@ static int __init imxdma_probe(struct platform_device *pdev)
>  	imxdma->devtype = pdev->id_entry->driver_data;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	imxdma->base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!imxdma->base)
> -		return -EADDRNOTAVAIL;
> +	imxdma->base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(imxdma->base))
> +		return PTR_ERR(imxdma->base);
>  
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
> diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
> index c6d98c0..dc74665 100644
> --- a/drivers/dma/mmp_pdma.c
> +++ b/drivers/dma/mmp_pdma.c
> @@ -5,6 +5,7 @@
>   * it under the terms of the GNU General Public License version 2 as
>   * published by the Free Software Foundation.
>   */
> +#include <linux/err.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/types.h>
> @@ -782,9 +783,9 @@ static int mmp_pdma_probe(struct platform_device *op)
>  	if (!iores)
>  		return -EINVAL;
>  
> -	pdev->base = devm_request_and_ioremap(pdev->dev, iores);
> -	if (!pdev->base)
> -		return -EADDRNOTAVAIL;
> +	pdev->base = devm_ioremap_resource(pdev->dev, iores);
> +	if (IS_ERR(pdev->base))
> +		return PTR_ERR(pdev->base);
>  
>  	of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev);
>  	if (of_id)
> diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
> index a9f1cd5..43d5a6c 100644
> --- a/drivers/dma/mmp_tdma.c
> +++ b/drivers/dma/mmp_tdma.c
> @@ -9,6 +9,7 @@
>   *
>   */
>  
> +#include <linux/err.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/types.h>
> @@ -547,9 +548,9 @@ static int mmp_tdma_probe(struct platform_device *pdev)
>  	if (!iores)
>  		return -EINVAL;
>  
> -	tdev->base = devm_request_and_ioremap(&pdev->dev, iores);
> -	if (!tdev->base)
> -		return -EADDRNOTAVAIL;
> +	tdev->base = devm_ioremap_resource(&pdev->dev, iores);
> +	if (IS_ERR(tdev->base))
> +		return PTR_ERR(tdev->base);
>  
>  	INIT_LIST_HEAD(&tdev->device.channels);
>  
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> index c39e61b..7d6d8b4 100644
> --- a/drivers/dma/tegra20-apb-dma.c
> +++ b/drivers/dma/tegra20-apb-dma.c
> @@ -21,6 +21,7 @@
>  #include <linux/delay.h>
>  #include <linux/dmaengine.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/err.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> @@ -1236,12 +1237,9 @@ static int tegra_dma_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	tdma->base_addr = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!tdma->base_addr) {
> -		dev_err(&pdev->dev,
> -			"Cannot request memregion/iomap dma address\n");
> -		return -EADDRNOTAVAIL;
> -	}
> +	tdma->base_addr = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(tdma->base_addr))
> +		return PTR_ERR(tdma->base_addr);
>  
>  	tdma->dma_clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(tdma->dma_clk)) {
> -- 
> 1.8.1.1
> 

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

* Re: [PATCH 07/33] dma: Convert to devm_ioremap_resource()
  2013-01-28 16:00   ` Vinod Koul
@ 2013-01-28 17:20     ` Thierry Reding
  0 siblings, 0 replies; 100+ messages in thread
From: Thierry Reding @ 2013-01-28 17:20 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

On Mon, Jan 28, 2013 at 08:00:20AM -0800, Vinod Koul wrote:
> On Mon, Jan 21, 2013 at 11:09:00AM +0100, Thierry Reding wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> > 
> > devm_ioremap_resource() provides its own error messages so all explicit
> > error messages can be removed from the failure code paths.
> Where is this symbol, applying this results in build failures for me?

I was introduced in the first patch of this series, which I failed to
send to everyone concerned. Greg agreed to take this series through the
driver-core tree given the dependency on the first patch. AFAICT he's
already applied this patch to the driver-core-next branch.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 07/33] dma: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 07/33] dma: " Thierry Reding
  2013-01-28 16:00   ` Vinod Koul
@ 2013-01-29 13:11   ` Andy Shevchenko
  2013-01-29 13:21     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 100+ messages in thread
From: Andy Shevchenko @ 2013-01-29 13:11 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Vinod Koul

On Mon, Jan 21, 2013 at 12:09 PM, Thierry Reding
<thierry.reding@avionic-design.de> wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
>
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
>
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Vinod Koul <vinod.koul@intel.com>
> ---
>  drivers/dma/dw_dmac.c         |  7 ++++---
>  drivers/dma/imx-dma.c         |  7 ++++---
>  drivers/dma/mmp_pdma.c        |  7 ++++---
>  drivers/dma/mmp_tdma.c        |  7 ++++---
>  drivers/dma/tegra20-apb-dma.c | 10 ++++------
>  5 files changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 3e8ba02..b33d1f6 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -14,6 +14,7 @@
>  #include <linux/delay.h>
>  #include <linux/dmaengine.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/err.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> @@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev)
>         if (irq < 0)
>                 return irq;
>
> -       regs = devm_request_and_ioremap(&pdev->dev, io);
> -       if (!regs)
> -               return -EBUSY;
> +       regs = devm_ioremap_resource(&pdev->dev, io);
> +       if (IS_ERR(regs))
> +               return PTR_ERR(regs);

Do you concern that change makes sparse crazy?

drivers/dma/dw_dmac.c:1690:20: warning: incorrect type in argument 1
(different address spaces)
drivers/dma/dw_dmac.c:1690:20:    expected void const *ptr
drivers/dma/dw_dmac.c:1690:20:    got void [noderef] <asn:2>*[assigned] regs
drivers/dma/dw_dmac.c:1691:32: warning: incorrect type in argument 1
(different address spaces)
drivers/dma/dw_dmac.c:1691:32:    expected void const *ptr
drivers/dma/dw_dmac.c:1691:32:    got void [noderef] <asn:2>*[assigned] regs


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 07/33] dma: Convert to devm_ioremap_resource()
  2013-01-29 13:11   ` Andy Shevchenko
@ 2013-01-29 13:21     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 100+ messages in thread
From: Greg Kroah-Hartman @ 2013-01-29 13:21 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Thierry Reding, linux-kernel, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Vinod Koul

On Tue, Jan 29, 2013 at 03:11:05PM +0200, Andy Shevchenko wrote:
> On Mon, Jan 21, 2013 at 12:09 PM, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> >
> > devm_ioremap_resource() provides its own error messages so all explicit
> > error messages can be removed from the failure code paths.
> >
> > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> > Cc: Vinod Koul <vinod.koul@intel.com>
> > ---
> >  drivers/dma/dw_dmac.c         |  7 ++++---
> >  drivers/dma/imx-dma.c         |  7 ++++---
> >  drivers/dma/mmp_pdma.c        |  7 ++++---
> >  drivers/dma/mmp_tdma.c        |  7 ++++---
> >  drivers/dma/tegra20-apb-dma.c | 10 ++++------
> >  5 files changed, 20 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> > index 3e8ba02..b33d1f6 100644
> > --- a/drivers/dma/dw_dmac.c
> > +++ b/drivers/dma/dw_dmac.c
> > @@ -14,6 +14,7 @@
> >  #include <linux/delay.h>
> >  #include <linux/dmaengine.h>
> >  #include <linux/dma-mapping.h>
> > +#include <linux/err.h>
> >  #include <linux/init.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/io.h>
> > @@ -1489,9 +1490,9 @@ static int dw_probe(struct platform_device *pdev)
> >         if (irq < 0)
> >                 return irq;
> >
> > -       regs = devm_request_and_ioremap(&pdev->dev, io);
> > -       if (!regs)
> > -               return -EBUSY;
> > +       regs = devm_ioremap_resource(&pdev->dev, io);
> > +       if (IS_ERR(regs))
> > +               return PTR_ERR(regs);
> 
> Do you concern that change makes sparse crazy?
> 
> drivers/dma/dw_dmac.c:1690:20: warning: incorrect type in argument 1
> (different address spaces)
> drivers/dma/dw_dmac.c:1690:20:    expected void const *ptr
> drivers/dma/dw_dmac.c:1690:20:    got void [noderef] <asn:2>*[assigned] regs
> drivers/dma/dw_dmac.c:1691:32: warning: incorrect type in argument 1
> (different address spaces)
> drivers/dma/dw_dmac.c:1691:32:    expected void const *ptr
> drivers/dma/dw_dmac.c:1691:32:    got void [noderef] <asn:2>*[assigned] regs

Yeah, Thierry has been emailing me about this and it's a false-positive
that I don't know how we are going to make sparse handle properly.

greg k-h

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

* Re: [PATCH 16/33] mfd: Convert to devm_ioremap_resource()
  2013-01-21 10:09 ` [PATCH 16/33] mfd: " Thierry Reding
@ 2013-02-03 17:22   ` Samuel Ortiz
  2013-02-03 22:32     ` Samuel Ortiz
  0 siblings, 1 reply; 100+ messages in thread
From: Samuel Ortiz @ 2013-02-03 17:22 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang

Hi Thierry,

On Mon, Jan 21, 2013 at 11:09:09AM +0100, Thierry Reding wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> ---
>  drivers/mfd/intel_msic.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
Applied, thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH 16/33] mfd: Convert to devm_ioremap_resource()
  2013-02-03 17:22   ` Samuel Ortiz
@ 2013-02-03 22:32     ` Samuel Ortiz
  0 siblings, 0 replies; 100+ messages in thread
From: Samuel Ortiz @ 2013-02-03 22:32 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang

On Sun, Feb 03, 2013 at 06:22:27PM +0100, Samuel Ortiz wrote:
> Hi Thierry,
> 
> On Mon, Jan 21, 2013 at 11:09:09AM +0100, Thierry Reding wrote:
> > Convert all uses of devm_request_and_ioremap() to the newly introduced
> > devm_ioremap_resource() which provides more consistent error handling.
> > 
> > devm_ioremap_resource() provides its own error messages so all explicit
> > error messages can be removed from the failure code paths.
> > 
> > Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > ---
> >  drivers/mfd/intel_msic.c | 9 ++++-----
> >  1 file changed, 4 insertions(+), 5 deletions(-)
> Applied, thanks.
I just realized that this one will go through Greg's driver-core tree as it
has a build dependency on it. So dropped from my tree...

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH 25/33] spi: Convert to devm_ioremap_resource()
@ 2013-02-05 14:20     ` Grant Likely
  0 siblings, 0 replies; 100+ messages in thread
From: Grant Likely @ 2013-02-05 14:20 UTC (permalink / raw)
  To: Thierry Reding, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	spi-devel-general

On Mon, 21 Jan 2013 11:09:18 +0100, Thierry Reding <thierry.reding@avionic-design.de> wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: spi-devel-general@lists.sourceforge.net

Looks fine by me. Go ahead and merge with the rest of the series.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
>  drivers/spi/spi-ep93xx.c         | 7 +++----
>  drivers/spi/spi-mxs.c            | 6 +++---
>  drivers/spi/spi-omap2-mcspi.c    | 7 +++----
>  drivers/spi/spi-s3c64xx.c        | 7 +++----
>  drivers/spi/spi-sirf.c           | 7 +++----
>  drivers/spi/spi-tegra20-sflash.c | 8 +++-----
>  drivers/spi/spi-tegra20-slink.c  | 8 +++-----
>  7 files changed, 21 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index acb1e19..2e31f32 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -1085,10 +1085,9 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
>  
>  	espi->sspdr_phys = res->start + SSPDR;
>  
> -	espi->regs_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!espi->regs_base) {
> -		dev_err(&pdev->dev, "failed to map resources\n");
> -		error = -ENODEV;
> +	espi->regs_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(espi->regs_base)) {
> +		error = PTR_ERR(espi->regs_base);
>  		goto fail_put_clock;
>  	}
>  
> diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
> index a3ede24..b735988 100644
> --- a/drivers/spi/spi-mxs.c
> +++ b/drivers/spi/spi-mxs.c
> @@ -538,9 +538,9 @@ static int mxs_spi_probe(struct platform_device *pdev)
>  	if (!iores || irq_err < 0 || irq_dma < 0)
>  		return -EINVAL;
>  
> -	base = devm_request_and_ioremap(&pdev->dev, iores);
> -	if (!base)
> -		return -EADDRNOTAVAIL;
> +	base = devm_ioremap_resource(&pdev->dev, iores);
> +	if (IS_ERR(base))
> +		return PTR_ERR(base);
>  
>  	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
>  	if (IS_ERR(pinctrl))
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index b610f52..71a9482 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1204,10 +1204,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
>  	r->end += regs_offset;
>  	mcspi->phys = r->start;
>  
> -	mcspi->base = devm_request_and_ioremap(&pdev->dev, r);
> -	if (!mcspi->base) {
> -		dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
> -		status = -ENOMEM;
> +	mcspi->base = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(mcspi->base)) {
> +		status = PTR_ERR(mcspi->base);
>  		goto free_master;
>  	}
>  
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index ad93231..3d4a7c4 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -1276,10 +1276,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
>  	/* the spi->mode bits understood by this driver: */
>  	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
>  
> -	sdd->regs = devm_request_and_ioremap(&pdev->dev, mem_res);
> -	if (sdd->regs == NULL) {
> -		dev_err(&pdev->dev, "Unable to remap IO\n");
> -		ret = -ENXIO;
> +	sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res);
> +	if (IS_ERR(sdd->regs)) {
> +		ret = PTR_ERR(sdd->regs);
>  		goto err1;
>  	}
>  
> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
> index e0f43a5..78c8842 100644
> --- a/drivers/spi/spi-sirf.c
> +++ b/drivers/spi/spi-sirf.c
> @@ -535,10 +535,9 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	sspi->base = devm_request_and_ioremap(&pdev->dev, mem_res);
> -	if (!sspi->base) {
> -		dev_err(&pdev->dev, "IO remap failed!\n");
> -		ret = -ENOMEM;
> +	sspi->base = devm_ioremap_resource(&pdev->dev, mem_res);
> +	if (IS_ERR(sspi->base)) {
> +		ret = PTR_ERR(sspi->base);
>  		goto free_master;
>  	}
>  
> diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
> index 448a8cc..69c9d23 100644
> --- a/drivers/spi/spi-tegra20-sflash.c
> +++ b/drivers/spi/spi-tegra20-sflash.c
> @@ -508,11 +508,9 @@ static int tegra_sflash_probe(struct platform_device *pdev)
>  		ret = -ENODEV;
>  		goto exit_free_master;
>  	}
> -	tsd->base = devm_request_and_ioremap(&pdev->dev, r);
> -	if (!tsd->base) {
> -		dev_err(&pdev->dev,
> -			"Cannot request memregion/iomap dma address\n");
> -		ret = -EADDRNOTAVAIL;
> +	tsd->base = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(tsd->base)) {
> +		ret = PTR_ERR(tsd->base);
>  		goto exit_free_master;
>  	}
>  
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> index 651167f..96bd6c2 100644
> --- a/drivers/spi/spi-tegra20-slink.c
> +++ b/drivers/spi/spi-tegra20-slink.c
> @@ -1172,11 +1172,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
>  		goto exit_free_master;
>  	}
>  	tspi->phys = r->start;
> -	tspi->base = devm_request_and_ioremap(&pdev->dev, r);
> -	if (!tspi->base) {
> -		dev_err(&pdev->dev,
> -			"Cannot request memregion/iomap dma address\n");
> -		ret = -EADDRNOTAVAIL;
> +	tspi->base = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(tspi->base)) {
> +		ret = PTR_ERR(tspi->base);
>  		goto exit_free_master;
>  	}
>  
> -- 
> 1.8.1.1
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

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

* Re: [PATCH 25/33] spi: Convert to devm_ioremap_resource()
@ 2013-02-05 14:20     ` Grant Likely
  0 siblings, 0 replies; 100+ messages in thread
From: Grant Likely @ 2013-02-05 14:20 UTC (permalink / raw)
  To: Thierry Reding, linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Wolfram Sang, Arnd Bergmann,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, 21 Jan 2013 11:09:18 +0100, Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org> wrote:
> Convert all uses of devm_request_and_ioremap() to the newly introduced
> devm_ioremap_resource() which provides more consistent error handling.
> 
> devm_ioremap_resource() provides its own error messages so all explicit
> error messages can be removed from the failure code paths.
> 
> Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
> Cc: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

Looks fine by me. Go ahead and merge with the rest of the series.

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  drivers/spi/spi-ep93xx.c         | 7 +++----
>  drivers/spi/spi-mxs.c            | 6 +++---
>  drivers/spi/spi-omap2-mcspi.c    | 7 +++----
>  drivers/spi/spi-s3c64xx.c        | 7 +++----
>  drivers/spi/spi-sirf.c           | 7 +++----
>  drivers/spi/spi-tegra20-sflash.c | 8 +++-----
>  drivers/spi/spi-tegra20-slink.c  | 8 +++-----
>  7 files changed, 21 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index acb1e19..2e31f32 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -1085,10 +1085,9 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
>  
>  	espi->sspdr_phys = res->start + SSPDR;
>  
> -	espi->regs_base = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!espi->regs_base) {
> -		dev_err(&pdev->dev, "failed to map resources\n");
> -		error = -ENODEV;
> +	espi->regs_base = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(espi->regs_base)) {
> +		error = PTR_ERR(espi->regs_base);
>  		goto fail_put_clock;
>  	}
>  
> diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
> index a3ede24..b735988 100644
> --- a/drivers/spi/spi-mxs.c
> +++ b/drivers/spi/spi-mxs.c
> @@ -538,9 +538,9 @@ static int mxs_spi_probe(struct platform_device *pdev)
>  	if (!iores || irq_err < 0 || irq_dma < 0)
>  		return -EINVAL;
>  
> -	base = devm_request_and_ioremap(&pdev->dev, iores);
> -	if (!base)
> -		return -EADDRNOTAVAIL;
> +	base = devm_ioremap_resource(&pdev->dev, iores);
> +	if (IS_ERR(base))
> +		return PTR_ERR(base);
>  
>  	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
>  	if (IS_ERR(pinctrl))
> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
> index b610f52..71a9482 100644
> --- a/drivers/spi/spi-omap2-mcspi.c
> +++ b/drivers/spi/spi-omap2-mcspi.c
> @@ -1204,10 +1204,9 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
>  	r->end += regs_offset;
>  	mcspi->phys = r->start;
>  
> -	mcspi->base = devm_request_and_ioremap(&pdev->dev, r);
> -	if (!mcspi->base) {
> -		dev_dbg(&pdev->dev, "can't ioremap MCSPI\n");
> -		status = -ENOMEM;
> +	mcspi->base = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(mcspi->base)) {
> +		status = PTR_ERR(mcspi->base);
>  		goto free_master;
>  	}
>  
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index ad93231..3d4a7c4 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -1276,10 +1276,9 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
>  	/* the spi->mode bits understood by this driver: */
>  	master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
>  
> -	sdd->regs = devm_request_and_ioremap(&pdev->dev, mem_res);
> -	if (sdd->regs == NULL) {
> -		dev_err(&pdev->dev, "Unable to remap IO\n");
> -		ret = -ENXIO;
> +	sdd->regs = devm_ioremap_resource(&pdev->dev, mem_res);
> +	if (IS_ERR(sdd->regs)) {
> +		ret = PTR_ERR(sdd->regs);
>  		goto err1;
>  	}
>  
> diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
> index e0f43a5..78c8842 100644
> --- a/drivers/spi/spi-sirf.c
> +++ b/drivers/spi/spi-sirf.c
> @@ -535,10 +535,9 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	sspi->base = devm_request_and_ioremap(&pdev->dev, mem_res);
> -	if (!sspi->base) {
> -		dev_err(&pdev->dev, "IO remap failed!\n");
> -		ret = -ENOMEM;
> +	sspi->base = devm_ioremap_resource(&pdev->dev, mem_res);
> +	if (IS_ERR(sspi->base)) {
> +		ret = PTR_ERR(sspi->base);
>  		goto free_master;
>  	}
>  
> diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
> index 448a8cc..69c9d23 100644
> --- a/drivers/spi/spi-tegra20-sflash.c
> +++ b/drivers/spi/spi-tegra20-sflash.c
> @@ -508,11 +508,9 @@ static int tegra_sflash_probe(struct platform_device *pdev)
>  		ret = -ENODEV;
>  		goto exit_free_master;
>  	}
> -	tsd->base = devm_request_and_ioremap(&pdev->dev, r);
> -	if (!tsd->base) {
> -		dev_err(&pdev->dev,
> -			"Cannot request memregion/iomap dma address\n");
> -		ret = -EADDRNOTAVAIL;
> +	tsd->base = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(tsd->base)) {
> +		ret = PTR_ERR(tsd->base);
>  		goto exit_free_master;
>  	}
>  
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> index 651167f..96bd6c2 100644
> --- a/drivers/spi/spi-tegra20-slink.c
> +++ b/drivers/spi/spi-tegra20-slink.c
> @@ -1172,11 +1172,9 @@ static int tegra_slink_probe(struct platform_device *pdev)
>  		goto exit_free_master;
>  	}
>  	tspi->phys = r->start;
> -	tspi->base = devm_request_and_ioremap(&pdev->dev, r);
> -	if (!tspi->base) {
> -		dev_err(&pdev->dev,
> -			"Cannot request memregion/iomap dma address\n");
> -		ret = -EADDRNOTAVAIL;
> +	tspi->base = devm_ioremap_resource(&pdev->dev, r);
> +	if (IS_ERR(tspi->base)) {
> +		ret = PTR_ERR(tspi->base);
>  		goto exit_free_master;
>  	}
>  
> -- 
> 1.8.1.1
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-01-21 10:52   ` Viresh Kumar
@ 2013-02-09 13:52     ` Grant Likely
  2013-02-11 13:53       ` Linus Walleij
  0 siblings, 1 reply; 100+ messages in thread
From: Grant Likely @ 2013-02-09 13:52 UTC (permalink / raw)
  To: Viresh Kumar, Thierry Reding
  Cc: linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann,
	Wolfram Sang, Linus Walleij

On Mon, 21 Jan 2013 16:22:21 +0530, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On Mon, Jan 21, 2013 at 3:39 PM, Thierry Reding
> <thierry.reding@avionic-design.de> wrote:
> > diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
> > index 5f45fc4..7a4bf7c 100644
> > --- a/drivers/gpio/gpio-spear-spics.c
> > +++ b/drivers/gpio/gpio-spear-spics.c
> > @@ -140,11 +140,9 @@ static int spics_gpio_probe(struct platform_device *pdev)
> >                 return -ENOMEM;
> >         }
> >
> > -       spics->base = devm_request_and_ioremap(&pdev->dev, res);
> > -       if (!spics->base) {
> > -               dev_err(&pdev->dev, "request and ioremap fail\n");
> 
> can we keep it as is?

And this is why I dislike the ERR_PTR pattern so much. It goes against
every instinct about what is and is not a valid pointer.

I know people want error codes, but I think hoping that all users will
remember to do 'if (IS_ERR(ptr))' instead of 'if (!ptr)' makes things
worse not better.

g.


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

* Re: [PATCH 00/33] Sanitize devm_request_and_ioremap()
  2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
                   ` (32 preceding siblings ...)
  2013-01-21 10:09   ` Thierry Reding
@ 2013-02-09 13:58 ` Grant Likely
  33 siblings, 0 replies; 100+ messages in thread
From: Grant Likely @ 2013-02-09 13:58 UTC (permalink / raw)
  To: Thierry Reding, linux-kernel
  Cc: Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

On Mon, 21 Jan 2013 11:08:53 +0100, Thierry Reding <thierry.reding@avionic-design.de> wrote:
> Recent discussions about the lack of a meaningful error code returned by
> devm_request_and_ioremap() have triggered this patch series. One common
> issue is that the function returns NULL in all failure cases, making it
> impossible to determine what went wrong exactly. Another problem is that
> people can't seem to agree on what error code to return in case where
> the function fails. Both of these problems lead to inconsistent usage.
> 
> This series attempts to fix this by providing a replacement function,
> devm_ioremap_resource(), which returns a pointer to the remapped memory
> region on success and an ERR_PTR()-encoded error code on failure. Users
> can check for failure using the IS_ERR() macro and determine the exact
> cause by extracting the error code using PTR_ERR().
> 
> Patch 1 adds the new devm_ioremap_resource() function, which is really
> just a renamed version of devm_request_and_ioremap() that returns
> ERR_PTR()-encoded error codes on failure and makes the old function a
> wrapper around it, returning NULL in case of devm_ioremap_resource()
> failure. Furthermore the patch marks devm_request_and_ioremap() as a
> deprecated function to make it clear that it should no longer be used.
> A semantic patch is included that was used to convert the bulk of the
> existing calls to devm_request_and_ioremap() to the new API. The patch
> is far from perfect and a few occurrences had to be converted or fixed
> up manually.
> 
> The remaining patches convert each subsystem separately to use the new
> API.
> 
> Thierry

I know that this series has wide support and will probably be merged,
but I'm reply to this for the record. I do not think the ERR_PTR pattern
is a good idea because it goes against expectations of what is and is
not a valid pointer.

Nacked-by: Grant Likely <grant.likely@secretlab.ca>

Greg, if you're merging this series then don't let my objection inhibit
spi & gpio changes. I may not be happy, but I won't be an ass about it.

g.

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-02-09 13:52     ` Grant Likely
@ 2013-02-11 13:53       ` Linus Walleij
  2013-02-11 15:07         ` Russell King - ARM Linux
  0 siblings, 1 reply; 100+ messages in thread
From: Linus Walleij @ 2013-02-11 13:53 UTC (permalink / raw)
  To: Grant Likely
  Cc: Viresh Kumar, Thierry Reding, linux-kernel, Greg Kroah-Hartman,
	Dmitry Torokhov, Arnd Bergmann, Wolfram Sang,
	Russell King - ARM Linux

On Sat, Feb 9, 2013 at 2:52 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Mon, 21 Jan 2013 16:22:21 +0530, Viresh Kumar <viresh.kumar@linaro.org> wrote:

>> > -       spics->base = devm_request_and_ioremap(&pdev->dev, res);
>> > -       if (!spics->base) {
>> > -               dev_err(&pdev->dev, "request and ioremap fail\n");
>>
>> can we keep it as is?
>
> And this is why I dislike the ERR_PTR pattern so much. It goes against
> every instinct about what is and is not a valid pointer.
>
> I know people want error codes, but I think hoping that all users will
> remember to do 'if (IS_ERR(ptr))' instead of 'if (!ptr)' makes things
> worse not better.

NB: among the error codes people want to propagate from
consumer interfaces such as say, clk_get(), regulator_get()
and pinctrl_get() is -EPROBE_DEFER. So just "something
failed" (return NULL) isn't enough.

We then obviously need to return an int as error code instead
and pass the pointer as argument, so do you mean we should
refactor all the *_get() things from e.g.:

struct clk *clk_get(struct device *dev, const char *id);

into something like:

int clk_get(struct clk **clk, struct device *dev, const char *id);

across the entire kernel?

Yours,
Linus Walleij

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

* Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
  2013-02-11 13:53       ` Linus Walleij
@ 2013-02-11 15:07         ` Russell King - ARM Linux
  0 siblings, 0 replies; 100+ messages in thread
From: Russell King - ARM Linux @ 2013-02-11 15:07 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Grant Likely, Viresh Kumar, Thierry Reding, linux-kernel,
	Greg Kroah-Hartman, Dmitry Torokhov, Arnd Bergmann, Wolfram Sang

On Mon, Feb 11, 2013 at 02:53:47PM +0100, Linus Walleij wrote:
> NB: among the error codes people want to propagate from
> consumer interfaces such as say, clk_get(), regulator_get()
> and pinctrl_get() is -EPROBE_DEFER. So just "something
> failed" (return NULL) isn't enough.
> 
> We then obviously need to return an int as error code instead
> and pass the pointer as argument, so do you mean we should
> refactor all the *_get() things from e.g.:
> 
> struct clk *clk_get(struct device *dev, const char *id);
> 
> into something like:
> 
> int clk_get(struct clk **clk, struct device *dev, const char *id);
> 
> across the entire kernel?

I really don't want to do that.  What we have today I think is far
better than having to munge things like that - you just get a different
set of problems through doing that, such as what happens if people
ignore the returned error code, etc.

We _should_ really be able to get Sparse to deal with this.  Sparse
really should be taught about a pointer attribute that says "this is
fine to dereference, but it should also have the magic IS_ERR() check
done on it too."  As IS_ERR() is a function, we can surely mark the
passed pointer in some way to tell sparse "this has been appropraitely
checked".

Practically, we don't end up with that many problems though with people
failing to check the returned pointer (I've seen relatively few of these
in the bigger scheme of things).  What I have seen through is repeated
confusion between IS_ERR() and IS_ERR_OR_NULL() since the second one was
introduced - which then leads people into coding their error paths such
that they return zero should NULL be returned.

I've said before - almost every usage of IS_ERR_OR_NULL() appears to be
a bug... and I've been mooting its removal.  I have acks against a patch
which deprecates it - but we can't deprecate it until we've removed most
of the existing users of it (otherwise akpm will hunt down those who
added the deprecated marker.)

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

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

Thread overview: 100+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-21 10:08 [PATCH 00/33] Sanitize devm_request_and_ioremap() Thierry Reding
2013-01-21 10:08 ` [PATCH 01/33] lib: devres: Introduce devm_ioremap_resource() Thierry Reding
2013-01-21 10:26   ` Dmitry Torokhov
2013-01-22 17:40   ` Greg Kroah-Hartman
2013-01-22 21:00     ` Thierry Reding
2013-01-21 10:08 ` [PATCH 02/33] ARM: Convert to devm_ioremap_resource() Thierry Reding
2013-01-21 10:08   ` Thierry Reding
2013-01-21 15:58   ` Russell King - ARM Linux
2013-01-21 15:58     ` Russell King - ARM Linux
2013-01-21 16:05     ` Thierry Reding
2013-01-21 16:05       ` Thierry Reding
2013-01-21 16:16       ` Russell King - ARM Linux
2013-01-21 16:16         ` Russell King - ARM Linux
2013-01-21 17:23         ` Arnd Bergmann
2013-01-21 17:23           ` Arnd Bergmann
2013-01-22 17:37         ` Greg Kroah-Hartman
2013-01-22 17:37           ` Greg Kroah-Hartman
2013-01-21 10:08 ` [PATCH 03/33] MIPS: " Thierry Reding
2013-01-21 10:08 ` [PATCH 04/33] amba: " Thierry Reding
2013-01-21 10:08 ` [PATCH 05/33] ata: " Thierry Reding
2013-01-21 10:08 ` [PATCH 06/33] char: " Thierry Reding
2013-01-21 10:09 ` [PATCH 07/33] dma: " Thierry Reding
2013-01-28 16:00   ` Vinod Koul
2013-01-28 17:20     ` Thierry Reding
2013-01-29 13:11   ` Andy Shevchenko
2013-01-29 13:21     ` Greg Kroah-Hartman
2013-01-21 10:09 ` [PATCH 08/33] gpio: " Thierry Reding
2013-01-21 10:52   ` Viresh Kumar
2013-02-09 13:52     ` Grant Likely
2013-02-11 13:53       ` Linus Walleij
2013-02-11 15:07         ` Russell King - ARM Linux
2013-01-22 10:15   ` Linus Walleij
2013-01-22 10:25     ` Thierry Reding
2013-01-22 16:08       ` Greg Kroah-Hartman
2013-01-22 16:15         ` Thierry Reding
2013-01-23  8:36       ` Linus Walleij
2013-01-22 11:39     ` Gregory CLEMENT
2013-01-22 11:49       ` Thierry Reding
2013-01-21 10:09 ` [PATCH 09/33] drm: " Thierry Reding
2013-01-21 10:09   ` Thierry Reding
2013-01-21 10:09 ` [PATCH 10/33] i2c: " Thierry Reding
2013-01-22 22:30   ` Wolfram Sang
2013-01-22 22:30     ` Wolfram Sang
2013-01-21 10:09 ` [PATCH 11/33] iio: " Thierry Reding
2013-01-22 12:12   ` Jonathan Cameron
2013-01-21 10:09 ` [PATCH 12/33] Input: " Thierry Reding
2013-01-21 10:27   ` Dmitry Torokhov
2013-01-21 10:45   ` Viresh Kumar
2013-01-21 10:49     ` Thierry Reding
2013-01-21 10:57       ` Viresh Kumar
2013-01-21 11:00         ` Thierry Reding
2013-01-21 10:09 ` [PATCH 13/33] iommu: " Thierry Reding
2013-01-21 10:09   ` Thierry Reding
2013-01-21 10:09 ` [PATCH 14/33] media: " Thierry Reding
2013-01-22 11:04   ` Sylwester Nawrocki
2013-01-21 10:09 ` [PATCH 15/33] memory: " Thierry Reding
2013-01-21 10:09 ` [PATCH 16/33] mfd: " Thierry Reding
2013-02-03 17:22   ` Samuel Ortiz
2013-02-03 22:32     ` Samuel Ortiz
2013-01-21 10:09 ` [PATCH 17/33] misc: " Thierry Reding
2013-01-21 10:09 ` [PATCH 18/33] mmc: " Thierry Reding
2013-01-21 10:09 ` [PATCH 19/33] mtd: " Thierry Reding
2013-01-21 10:09   ` Thierry Reding
2013-01-21 10:09 ` [PATCH 20/33] net: " Thierry Reding
2013-01-21 20:29   ` David Miller
2013-01-22  6:56     ` Thierry Reding
2013-01-22 13:03       ` Arnd Bergmann
2013-01-22 13:09         ` Thierry Reding
2013-01-22 13:17           ` Arnd Bergmann
2013-01-22 19:08         ` David Miller
2013-01-22 18:58       ` David Miller
2013-01-21 10:09 ` [PATCH 21/33] pinctrl: " Thierry Reding
2013-01-21 10:50   ` Viresh Kumar
2013-01-21 10:09 ` [PATCH 22/33] power: " Thierry Reding
2013-01-21 10:09 ` [PATCH 23/33] pwm: " Thierry Reding
2013-01-21 10:49   ` Viresh Kumar
2013-01-21 10:09 ` [PATCH 24/33] rtc: " Thierry Reding
2013-01-21 10:50   ` Viresh Kumar
2013-01-21 10:09 ` [PATCH 25/33] spi: " Thierry Reding
2013-02-05 14:20   ` Grant Likely
2013-02-05 14:20     ` Grant Likely
2013-01-21 10:09 ` [PATCH 26/33] staging: " Thierry Reding
2013-01-21 10:09 ` [PATCH 27/33] thermal: " Thierry Reding
2013-01-21 10:09 ` [PATCH 28/33] serial: " Thierry Reding
2013-01-21 10:09 ` [PATCH 29/33] usb: " Thierry Reding
2013-01-21 17:16   ` Alan Stern
2013-01-21 18:50   ` Felipe Balbi
2013-01-21 10:09 ` [PATCH 30/33] video: " Thierry Reding
2013-01-21 10:09   ` Thierry Reding
2013-01-22  4:17   ` Jingoo Han
2013-01-22  4:17     ` Jingoo Han
2013-01-21 10:09 ` [PATCH 31/33] w1: " Thierry Reding
2013-01-21 10:27   ` Evgeniy Polyakov
2013-01-21 10:09 ` [PATCH 32/33] watchdog: " Thierry Reding
2013-01-21 10:09 ` [PATCH 33/33] ASoC: " Thierry Reding
2013-01-21 10:09   ` Thierry Reding
2013-01-22  7:48   ` Mark Brown
2013-01-22  7:55     ` Thierry Reding
2013-01-22  8:01       ` Mark Brown
2013-02-09 13:58 ` [PATCH 00/33] Sanitize devm_request_and_ioremap() Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.