drivers/platform/x86/amd/pmf/tee-if.c | 3 --- 1 file changed, 3 deletions(-)
The 'input_dev' is a managed resource allocated with
devm_input_allocate_device(), so there is no need to call
input_unregister_device() explicitly. It will be called automatically
when the driver is removed.
Fixes: 4c92d448e3e6 ("platform/x86/amd/pmf: Use existing input event codes to update system states")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
I'm not 100% confident with this change. The error handling scheme is not
a clear to me as what I usually see. For example, the last calls from
amd_pmf_probe() don't handle error at all. So the probe just succeeds in
these cases.
So, because of it, it is maybe fine to call input_unregister_device() in
amd_pmf_deinit_smart_pc(), even if it looks strange to me.
Review with care!
---
drivers/platform/x86/amd/pmf/tee-if.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
index e246367aacee..cc721fbc3e0b 100644
--- a/drivers/platform/x86/amd/pmf/tee-if.c
+++ b/drivers/platform/x86/amd/pmf/tee-if.c
@@ -515,9 +515,6 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev)
{
- if (dev->pmf_idev)
- input_unregister_device(dev->pmf_idev);
-
if (pb_side_load && dev->esbin)
amd_pmf_remove_pb(dev);
--
2.45.2
Le 25/07/2024 à 23:13, Christophe JAILLET a écrit :
> The 'input_dev' is a managed resource allocated with
> devm_input_allocate_device(), so there is no need to call
> input_unregister_device() explicitly. It will be called automatically
> when the driver is removed.
>
> Fixes: 4c92d448e3e6 ("platform/x86/amd/pmf: Use existing input event codes to update system states")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested-only
>
> I'm not 100% confident with this change. The error handling scheme is not
> a clear to me as what I usually see. For example, the last calls from
> amd_pmf_probe() don't handle error at all. So the probe just succeeds in
> these cases.
>
> So, because of it, it is maybe fine to call input_unregister_device() in
> amd_pmf_deinit_smart_pc(), even if it looks strange to me.
>
> Review with care!
NACK.
Things have been explained to me in another similar patch proposal.
Sorry for the noise.
CJ
> ---
> drivers/platform/x86/amd/pmf/tee-if.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
> index e246367aacee..cc721fbc3e0b 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -515,9 +515,6 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
>
> void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev)
> {
> - if (dev->pmf_idev)
> - input_unregister_device(dev->pmf_idev);
> -
> if (pb_side_load && dev->esbin)
> amd_pmf_remove_pb(dev);
>
© 2016 - 2026 Red Hat, Inc.