linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource()
@ 2013-02-01 10:07 Sachin Kamat
  2013-02-01 10:07 ` [PATCH v2 2/2] serial: tegra: " Sachin Kamat
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sachin Kamat @ 2013-02-01 10:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, thierry.reding, sachin.kamat, Dmitry Torokhov, linux-input

Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() 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: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
---
 Patch based & compile tested on linux-next tree (20130128).
 Changes since v1:
 * Dropped the error message as it is now handled by devm_ioremap_resource()
 itself.
---
 drivers/input/keyboard/tegra-kbc.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index 46e8ad2..fc43806 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -31,6 +31,7 @@
 #include <linux/slab.h>
 #include <linux/input/tegra_kbc.h>
 #include <linux/clk/tegra.h>
+#include <linux/err.h>
 
 #define KBC_MAX_DEBOUNCE_CNT	0x3ffu
 
@@ -615,11 +616,9 @@ static int tegra_kbc_probe(struct platform_device *pdev)
 	spin_lock_init(&kbc->lock);
 	setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
 
-	kbc->mmio = devm_request_and_ioremap(&pdev->dev, res);
-	if (!kbc->mmio) {
-		dev_err(&pdev->dev, "Cannot request memregion/iomap address\n");
-		return -EBUSY;
-	}
+	kbc->mmio = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(kbc->mmio))
+		return PTR_ERR(kbc->mmio);
 
 	kbc->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(kbc->clk)) {
-- 
1.7.4.1


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

* [PATCH v2 2/2] serial: tegra: Convert to devm_ioremap_resource()
  2013-02-01 10:07 [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource() Sachin Kamat
@ 2013-02-01 10:07 ` Sachin Kamat
  2013-02-01 11:24   ` Thierry Reding
  2013-02-01 11:24 ` [PATCH v2 1/2] Input: tegra-kbc- " Thierry Reding
  2013-02-04  5:16 ` Sachin Kamat
  2 siblings, 1 reply; 5+ messages in thread
From: Sachin Kamat @ 2013-02-01 10:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: gregkh, thierry.reding, sachin.kamat, Laxman Dewangan, linux-serial

Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() 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: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: linux-serial@vger.kernel.org
---
Patch based & compile tested on linux-next tree (20130128).
Changes since v1:
* Dropped the error message as it is now handled by devm_ioremap_resource()
itself.
---
 drivers/tty/serial/serial-tegra.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 4f5e629..24ced23 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -26,6 +26,7 @@
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
+#include <linux/err.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/module.h>
@@ -1302,11 +1303,9 @@ static int tegra_uart_probe(struct platform_device *pdev)
 	}
 
 	u->mapbase = resource->start;
-	u->membase = devm_request_and_ioremap(&pdev->dev, resource);
-	if (!u->membase) {
-		dev_err(&pdev->dev, "memregion/iomap address req failed\n");
-		return -EADDRNOTAVAIL;
-	}
+	u->membase = devm_ioremap_resource(&pdev->dev, resource);
+	if (IS_ERR(u->membase))
+		return PTR_ERR(u->membase);
 
 	tup->uart_clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(tup->uart_clk)) {
-- 
1.7.4.1


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

* Re: [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource()
  2013-02-01 10:07 [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource() Sachin Kamat
  2013-02-01 10:07 ` [PATCH v2 2/2] serial: tegra: " Sachin Kamat
@ 2013-02-01 11:24 ` Thierry Reding
  2013-02-04  5:16 ` Sachin Kamat
  2 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2013-02-01 11:24 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, gregkh, Dmitry Torokhov, linux-input

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

On Fri, Feb 01, 2013 at 03:37:56PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() 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: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> ---
>  Patch based & compile tested on linux-next tree (20130128).
>  Changes since v1:
>  * Dropped the error message as it is now handled by devm_ioremap_resource()
>  itself.
> ---
>  drivers/input/keyboard/tegra-kbc.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
> index 46e8ad2..fc43806 100644
> --- a/drivers/input/keyboard/tegra-kbc.c
> +++ b/drivers/input/keyboard/tegra-kbc.c
> @@ -31,6 +31,7 @@
>  #include <linux/slab.h>
>  #include <linux/input/tegra_kbc.h>
>  #include <linux/clk/tegra.h>
> +#include <linux/err.h>
>  
>  #define KBC_MAX_DEBOUNCE_CNT	0x3ffu
>  
> @@ -615,11 +616,9 @@ static int tegra_kbc_probe(struct platform_device *pdev)
>  	spin_lock_init(&kbc->lock);
>  	setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc);
>  
> -	kbc->mmio = devm_request_and_ioremap(&pdev->dev, res);
> -	if (!kbc->mmio) {
> -		dev_err(&pdev->dev, "Cannot request memregion/iomap address\n");
> -		return -EBUSY;
> -	}
> +	kbc->mmio = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(kbc->mmio))
> +		return PTR_ERR(kbc->mmio);
>  
>  	kbc->clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(kbc->clk)) {

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>

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

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

* Re: [PATCH v2 2/2] serial: tegra: Convert to devm_ioremap_resource()
  2013-02-01 10:07 ` [PATCH v2 2/2] serial: tegra: " Sachin Kamat
@ 2013-02-01 11:24   ` Thierry Reding
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2013-02-01 11:24 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-kernel, gregkh, Laxman Dewangan, linux-serial

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

On Fri, Feb 01, 2013 at 03:37:57PM +0530, Sachin Kamat wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() 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: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Cc: linux-serial@vger.kernel.org
> ---
> Patch based & compile tested on linux-next tree (20130128).
> Changes since v1:
> * Dropped the error message as it is now handled by devm_ioremap_resource()
> itself.
> ---
>  drivers/tty/serial/serial-tegra.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
> index 4f5e629..24ced23 100644
> --- a/drivers/tty/serial/serial-tegra.c
> +++ b/drivers/tty/serial/serial-tegra.c
> @@ -26,6 +26,7 @@
>  #include <linux/dmaengine.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/dmapool.h>
> +#include <linux/err.h>
>  #include <linux/io.h>
>  #include <linux/irq.h>
>  #include <linux/module.h>
> @@ -1302,11 +1303,9 @@ static int tegra_uart_probe(struct platform_device *pdev)
>  	}
>  
>  	u->mapbase = resource->start;
> -	u->membase = devm_request_and_ioremap(&pdev->dev, resource);
> -	if (!u->membase) {
> -		dev_err(&pdev->dev, "memregion/iomap address req failed\n");
> -		return -EADDRNOTAVAIL;
> -	}
> +	u->membase = devm_ioremap_resource(&pdev->dev, resource);
> +	if (IS_ERR(u->membase))
> +		return PTR_ERR(u->membase);
>  
>  	tup->uart_clk = devm_clk_get(&pdev->dev, NULL);
>  	if (IS_ERR(tup->uart_clk)) {

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>

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

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

* Re: [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource()
  2013-02-01 10:07 [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource() Sachin Kamat
  2013-02-01 10:07 ` [PATCH v2 2/2] serial: tegra: " Sachin Kamat
  2013-02-01 11:24 ` [PATCH v2 1/2] Input: tegra-kbc- " Thierry Reding
@ 2013-02-04  5:16 ` Sachin Kamat
  2 siblings, 0 replies; 5+ messages in thread
From: Sachin Kamat @ 2013-02-04  5:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Thierry Reding

Hi Greg,

On 1 February 2013 15:37, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> Use the newly introduced devm_ioremap_resource() instead of
> devm_request_and_ioremap() 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: Sachin Kamat <sachin.kamat@linaro.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> ---
>  Patch based & compile tested on linux-next tree (20130128).
>  Changes since v1:
>  * Dropped the error message as it is now handled by devm_ioremap_resource()
>  itself.
> ---

Just realized that most of these patches (converting to
devm_ioremap_resource) which were based on linux-next tree do not
apply on the driver-core tree due to missing dependent patches in it.
I will re-send them once 3.9-rc1 is out. For now, please ignore them.

- -
With warm regards,
Sachin

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-01 10:07 [PATCH v2 1/2] Input: tegra-kbc- Convert to devm_ioremap_resource() Sachin Kamat
2013-02-01 10:07 ` [PATCH v2 2/2] serial: tegra: " Sachin Kamat
2013-02-01 11:24   ` Thierry Reding
2013-02-01 11:24 ` [PATCH v2 1/2] Input: tegra-kbc- " Thierry Reding
2013-02-04  5:16 ` Sachin Kamat

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