All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: samsung-keypad - Simplify resource management
@ 2022-01-30  8:14 Christophe JAILLET
  2022-01-31 16:14 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-01-30  8:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Sachin Kamat
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-input

Since the commit in the Fixes tag below, 'keypad->input_dev' is a managed
resource that doesn't need to be explicitly unregistered or freed (see
devm_input_allocate_device() documentation)

So, remove some unless line of code to slightly simplify it.

Fixes: a57da3479545 ("Input: samsung-keypad - switch to using managed resources")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/input/keyboard/samsung-keypad.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
index df0258dcf89e..b6c3c6399b2e 100644
--- a/drivers/input/keyboard/samsung-keypad.c
+++ b/drivers/input/keyboard/samsung-keypad.c
@@ -451,8 +451,6 @@ static int samsung_keypad_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 
-	input_unregister_device(keypad->input_dev);
-
 	clk_unprepare(keypad->clk);
 
 	return 0;
-- 
2.32.0


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

* Re: [PATCH] Input: samsung-keypad - Simplify resource management
  2022-01-30  8:14 [PATCH] Input: samsung-keypad - Simplify resource management Christophe JAILLET
@ 2022-01-31 16:14 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-01-31 16:14 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Sachin Kamat, linux-kernel, kernel-janitors, linux-input

Hi Christophe,

On Sun, Jan 30, 2022 at 09:14:08AM +0100, Christophe JAILLET wrote:
> Since the commit in the Fixes tag below, 'keypad->input_dev' is a managed
> resource that doesn't need to be explicitly unregistered or freed (see
> devm_input_allocate_device() documentation)
> 
> So, remove some unless line of code to slightly simplify it.
> 
> Fixes: a57da3479545 ("Input: samsung-keypad - switch to using managed resources")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
>  drivers/input/keyboard/samsung-keypad.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
> index df0258dcf89e..b6c3c6399b2e 100644
> --- a/drivers/input/keyboard/samsung-keypad.c
> +++ b/drivers/input/keyboard/samsung-keypad.c
> @@ -451,8 +451,6 @@ static int samsung_keypad_remove(struct platform_device *pdev)
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> -	input_unregister_device(keypad->input_dev);
> -

This is wrong; the order of operations is important and you do not want
to call clk_enable/disable on an unprepared clock.

If you want to do this you need to also replace clk_prepare/unprepare
with devm_ variant.

>  	clk_unprepare(keypad->clk);
>  
>  	return 0;
> -- 
> 2.32.0
> 

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2022-01-31 16:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30  8:14 [PATCH] Input: samsung-keypad - Simplify resource management Christophe JAILLET
2022-01-31 16:14 ` 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.