All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: Make use of the helper function devm_platform_ioremap_resource()
@ 2022-04-18  1:50 cgel.zte
  2022-04-18  7:02 ` Alexander Sverdlin
  2022-04-20 21:48 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-18  1:50 UTC (permalink / raw)
  To: dmitry.torokhov, alexander.sverdlin
  Cc: lv.ruyi, linux-input, linux-kernel, Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource() and devm_ioremap_resource() separately.Make the
code simpler without functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/input/keyboard/ep93xx_keypad.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index 272a4f1c6e81..7a3b0664ab4f 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -231,7 +231,6 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
 	struct ep93xx_keypad *keypad;
 	const struct matrix_keymap_data *keymap_data;
 	struct input_dev *input_dev;
-	struct resource *res;
 	int err;
 
 	keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL);
@@ -250,11 +249,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
 	if (keypad->irq < 0)
 		return keypad->irq;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENXIO;
-
-	keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
+	keypad->mmio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(keypad->mmio_base))
 		return PTR_ERR(keypad->mmio_base);
 
-- 
2.25.1


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

* Re: [PATCH] input: Make use of the helper function devm_platform_ioremap_resource()
  2022-04-18  1:50 [PATCH] input: Make use of the helper function devm_platform_ioremap_resource() cgel.zte
@ 2022-04-18  7:02 ` Alexander Sverdlin
  2022-04-20 21:48 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Sverdlin @ 2022-04-18  7:02 UTC (permalink / raw)
  To: cgel.zte, dmitry.torokhov; +Cc: lv.ruyi, linux-input, linux-kernel, Zeal Robot

Hello Lv!

On Mon, 2022-04-18 at 01:50 +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> Use the devm_platform_ioremap_resource() helper instead of calling
> platform_get_resource() and devm_ioremap_resource() separately.Make the
> code simpler without functional changes.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>

> ---
>  drivers/input/keyboard/ep93xx_keypad.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
> index 272a4f1c6e81..7a3b0664ab4f 100644
> --- a/drivers/input/keyboard/ep93xx_keypad.c
> +++ b/drivers/input/keyboard/ep93xx_keypad.c
> @@ -231,7 +231,6 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
>         struct ep93xx_keypad *keypad;
>         const struct matrix_keymap_data *keymap_data;
>         struct input_dev *input_dev;
> -       struct resource *res;
>         int err;
>  
>         keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL);
> @@ -250,11 +249,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
>         if (keypad->irq < 0)
>                 return keypad->irq;
>  
> -       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res)
> -               return -ENXIO;
> -
> -       keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
> +       keypad->mmio_base = devm_platform_ioremap_resource(pdev, 0);
>         if (IS_ERR(keypad->mmio_base))
>                 return PTR_ERR(keypad->mmio_base);
>  

-- 
Alexander Sverdlin.


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

* Re: [PATCH] input: Make use of the helper function devm_platform_ioremap_resource()
  2022-04-18  1:50 [PATCH] input: Make use of the helper function devm_platform_ioremap_resource() cgel.zte
  2022-04-18  7:02 ` Alexander Sverdlin
@ 2022-04-20 21:48 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2022-04-20 21:48 UTC (permalink / raw)
  To: cgel.zte
  Cc: alexander.sverdlin, lv.ruyi, linux-input, linux-kernel, Zeal Robot

On Mon, Apr 18, 2022 at 01:50:36AM +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> Use the devm_platform_ioremap_resource() helper instead of calling
> platform_get_resource() and devm_ioremap_resource() separately.Make the
> code simpler without functional changes.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>

Applied, thank you.

-- 
Dmitry

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

end of thread, other threads:[~2022-04-20 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  1:50 [PATCH] input: Make use of the helper function devm_platform_ioremap_resource() cgel.zte
2022-04-18  7:02 ` Alexander Sverdlin
2022-04-20 21:48 ` Dmitry Torokhov

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.