[PATCH] Input: spear-keyboard - Simplify resource management

Christophe JAILLET posted 1 patch 4 years, 5 months ago
drivers/input/keyboard/spear-keyboard.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] Input: spear-keyboard - Simplify resource management
Posted by Christophe JAILLET 4 years, 5 months ago
Since the commit in the Fixes tag below, 'kbd->input' is a managed resource
that doesn't need to be explicitly unregistered or freed (see
devm_input_allocate_device() documentation)

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

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

diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 9838c79cb288..c36836159fb3 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -278,7 +278,6 @@ static int spear_kbd_remove(struct platform_device *pdev)
 {
 	struct spear_kbd *kbd = platform_get_drvdata(pdev);
 
-	input_unregister_device(kbd->input);
 	clk_unprepare(kbd->clk);
 
 	return 0;
-- 
2.32.0

Re: [PATCH] Input: spear-keyboard - Simplify resource management
Posted by Dmitry Torokhov 4 years, 4 months ago
On Sun, Jan 30, 2022 at 09:20:44AM +0100, Christophe JAILLET wrote:
> Since the commit in the Fixes tag below, 'kbd->input' is a managed resource
> that doesn't need to be explicitly unregistered or freed (see
> devm_input_allocate_device() documentation)
> 
> So, remove a unless line of code to slightly simplify it.
> 
> Fixes: 6102752eb354 ("Input: spear-keyboard - switch to using managed resources")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
>  drivers/input/keyboard/spear-keyboard.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
> index 9838c79cb288..c36836159fb3 100644
> --- a/drivers/input/keyboard/spear-keyboard.c
> +++ b/drivers/input/keyboard/spear-keyboard.c
> @@ -278,7 +278,6 @@ static int spear_kbd_remove(struct platform_device *pdev)
>  {
>  	struct spear_kbd *kbd = platform_get_drvdata(pdev);
>  
> -	input_unregister_device(kbd->input);
>  	clk_unprepare(kbd->clk);

This is wrong for the same reason as the other patch: it changes the
order of operations.

>  
>  	return 0;
> -- 
> 2.32.0
> 

Thanks.

-- 
Dmitry