timestamp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] hte: tegra-194: Convert to platform remove callback returning void
@ 2024-03-08  8:51 Uwe Kleine-König
  2024-03-11 16:04 ` Thierry Reding
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-08  8:51 UTC (permalink / raw)
  To: Dipen Patel
  Cc: Thierry Reding, Jonathan Hunter, timestamp, linux-tegra, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/hte/hte-tegra194-test.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra194-test.c
index ab2edff018eb..8ee038ccf601 100644
--- a/drivers/hte/hte-tegra194-test.c
+++ b/drivers/hte/hte-tegra194-test.c
@@ -214,7 +214,7 @@ static int tegra_hte_test_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int tegra_hte_test_remove(struct platform_device *pdev)
+static void tegra_hte_test_remove(struct platform_device *pdev)
 {
 	(void)pdev;
 
@@ -222,13 +222,11 @@ static int tegra_hte_test_remove(struct platform_device *pdev)
 	gpiod_put(hte.gpio_in);
 	gpiod_put(hte.gpio_out);
 	del_timer_sync(&hte.timer);
-
-	return 0;
 }
 
 static struct platform_driver tegra_hte_test_driver = {
 	.probe = tegra_hte_test_probe,
-	.remove = tegra_hte_test_remove,
+	.remove_new = tegra_hte_test_remove,
 	.driver = {
 		.name = "tegra_hte_test",
 		.of_match_table = tegra_hte_test_of_match,

base-commit: 8ffc8b1bbd505e27e2c8439d326b6059c906c9dd
-- 
2.43.0


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

* Re: [PATCH] hte: tegra-194: Convert to platform remove callback returning void
  2024-03-08  8:51 [PATCH] hte: tegra-194: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-03-11 16:04 ` Thierry Reding
  2024-03-11 17:13   ` Dipen Patel
  0 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2024-03-11 16:04 UTC (permalink / raw)
  To: Uwe Kleine-König, Dipen Patel
  Cc: Jonathan Hunter, timestamp, linux-tegra, kernel

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

On Fri Mar 8, 2024 at 9:51 AM CET, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
>
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/hte/hte-tegra194-test.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Acked-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] hte: tegra-194: Convert to platform remove callback returning void
  2024-03-11 16:04 ` Thierry Reding
@ 2024-03-11 17:13   ` Dipen Patel
  2024-03-11 20:36     ` Uwe Kleine-König
  0 siblings, 1 reply; 6+ messages in thread
From: Dipen Patel @ 2024-03-11 17:13 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König
  Cc: Jonathan Hunter, timestamp, linux-tegra, kernel

On 3/11/24 9:04 AM, Thierry Reding wrote:
> On Fri Mar 8, 2024 at 9:51 AM CET, Uwe Kleine-König wrote:
>> The .remove() callback for a platform driver returns an int which makes
>> many driver authors wrongly assume it's possible to do error handling by
>> returning an error code. However the value returned is ignored (apart
>> from emitting a warning) and this typically results in resource leaks.
>>
>> To improve here there is a quest to make the remove callback return
>> void. In the first step of this quest all drivers are converted to
>> .remove_new(), which already returns void. Eventually after all drivers
>> are converted, .remove_new() will be renamed to .remove().
>>
>> Trivially convert this driver from always returning zero in the remove
>> callback to the void returning variant.
>>
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> ---
>>  drivers/hte/hte-tegra194-test.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> Acked-by: Thierry Reding <treding@nvidia.com>
Do you want me to take this patch or want to add in your patch series
for the drivers with similar changes?

Acked-by: Dipen Patel <dipenp@nvidia.com>

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

* Re: [PATCH] hte: tegra-194: Convert to platform remove callback returning void
  2024-03-11 17:13   ` Dipen Patel
@ 2024-03-11 20:36     ` Uwe Kleine-König
  2024-04-12 12:35       ` Uwe Kleine-König
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-11 20:36 UTC (permalink / raw)
  To: Dipen Patel
  Cc: Thierry Reding, linux-tegra, timestamp, kernel, Jonathan Hunter

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

Hello Dipen,

On Mon, Mar 11, 2024 at 10:13:15AM -0700, Dipen Patel wrote:
> On 3/11/24 9:04 AM, Thierry Reding wrote:
> > On Fri Mar 8, 2024 at 9:51 AM CET, Uwe Kleine-König wrote:
> >> The .remove() callback for a platform driver returns an int which makes
> >> many driver authors wrongly assume it's possible to do error handling by
> >> returning an error code. However the value returned is ignored (apart
> >> from emitting a warning) and this typically results in resource leaks.
> >>
> >> To improve here there is a quest to make the remove callback return
> >> void. In the first step of this quest all drivers are converted to
> >> .remove_new(), which already returns void. Eventually after all drivers
> >> are converted, .remove_new() will be renamed to .remove().
> >>
> >> Trivially convert this driver from always returning zero in the remove
> >> callback to the void returning variant.
> >>
> >> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> >> ---
> >>  drivers/hte/hte-tegra194-test.c | 6 ++----
> >>  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > Acked-by: Thierry Reding <treding@nvidia.com>
> Do you want me to take this patch or want to add in your patch series
> for the drivers with similar changes?
> 
> Acked-by: Dipen Patel <dipenp@nvidia.com>

I don't plan (yet) to care for applying these changes myself. So if you
could pick it up that would be great.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] hte: tegra-194: Convert to platform remove callback returning void
  2024-03-11 20:36     ` Uwe Kleine-König
@ 2024-04-12 12:35       ` Uwe Kleine-König
  2024-04-12 17:49         ` Dipen Patel
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-04-12 12:35 UTC (permalink / raw)
  To: Dipen Patel
  Cc: linux-tegra, timestamp, Thierry Reding, kernel, Jonathan Hunter

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

Hello Dipen,

On Mon, Mar 11, 2024 at 09:36:06PM +0100, Uwe Kleine-König wrote:
> On Mon, Mar 11, 2024 at 10:13:15AM -0700, Dipen Patel wrote:
> > On 3/11/24 9:04 AM, Thierry Reding wrote:
> > > On Fri Mar 8, 2024 at 9:51 AM CET, Uwe Kleine-König wrote:
> > >> The .remove() callback for a platform driver returns an int which makes
> > >> many driver authors wrongly assume it's possible to do error handling by
> > >> returning an error code. However the value returned is ignored (apart
> > >> from emitting a warning) and this typically results in resource leaks.
> > >>
> > >> To improve here there is a quest to make the remove callback return
> > >> void. In the first step of this quest all drivers are converted to
> > >> .remove_new(), which already returns void. Eventually after all drivers
> > >> are converted, .remove_new() will be renamed to .remove().
> > >>
> > >> Trivially convert this driver from always returning zero in the remove
> > >> callback to the void returning variant.
> > >>
> > >> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > >> ---
> > >>  drivers/hte/hte-tegra194-test.c | 6 ++----
> > >>  1 file changed, 2 insertions(+), 4 deletions(-)
> > > 
> > > Acked-by: Thierry Reding <treding@nvidia.com>
> > Do you want me to take this patch or want to add in your patch series
> > for the drivers with similar changes?
> > 
> > Acked-by: Dipen Patel <dipenp@nvidia.com>
> 
> I don't plan (yet) to care for applying these changes myself. So if you
> could pick it up that would be great.

Either you didn't pick it up or your tree isn't included in next. Both
options are not optimal in my eyes.

Given that I want to change struct platform_driver::remove in the merge
window after v6.10, it would be great if this patch made it into
v6.10-rc1.

Thanks for considering
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] hte: tegra-194: Convert to platform remove callback returning void
  2024-04-12 12:35       ` Uwe Kleine-König
@ 2024-04-12 17:49         ` Dipen Patel
  0 siblings, 0 replies; 6+ messages in thread
From: Dipen Patel @ 2024-04-12 17:49 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-tegra, timestamp, Thierry Reding, kernel, Jonathan Hunter

On 4/12/24 5:35 AM, Uwe Kleine-König wrote:
> Hello Dipen,
> 
> On Mon, Mar 11, 2024 at 09:36:06PM +0100, Uwe Kleine-König wrote:
>> On Mon, Mar 11, 2024 at 10:13:15AM -0700, Dipen Patel wrote:
>>> On 3/11/24 9:04 AM, Thierry Reding wrote:
>>>> On Fri Mar 8, 2024 at 9:51 AM CET, Uwe Kleine-König wrote:
>>>>> The .remove() callback for a platform driver returns an int which makes
>>>>> many driver authors wrongly assume it's possible to do error handling by
>>>>> returning an error code. However the value returned is ignored (apart
>>>>> from emitting a warning) and this typically results in resource leaks.
>>>>>
>>>>> To improve here there is a quest to make the remove callback return
>>>>> void. In the first step of this quest all drivers are converted to
>>>>> .remove_new(), which already returns void. Eventually after all drivers
>>>>> are converted, .remove_new() will be renamed to .remove().
>>>>>
>>>>> Trivially convert this driver from always returning zero in the remove
>>>>> callback to the void returning variant.
>>>>>
>>>>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>>>>> ---
>>>>>  drivers/hte/hte-tegra194-test.c | 6 ++----
>>>>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>>>
>>>> Acked-by: Thierry Reding <treding@nvidia.com>
>>> Do you want me to take this patch or want to add in your patch series
>>> for the drivers with similar changes?
>>>
>>> Acked-by: Dipen Patel <dipenp@nvidia.com>
>>
>> I don't plan (yet) to care for applying these changes myself. So if you
>> could pick it up that would be great.
> 
> Either you didn't pick it up or your tree isn't included in next. Both
> options are not optimal in my eyes.
> 
> Given that I want to change struct platform_driver::remove in the merge
> window after v6.10, it would be great if this patch made it into
> v6.10-rc1.
> 
> Thanks for considering
> Uwe
> 
Sorry for the miss, I will pick it up for 6.10.

Best Regards,
Dipen Patel

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

end of thread, other threads:[~2024-04-12 17:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08  8:51 [PATCH] hte: tegra-194: Convert to platform remove callback returning void Uwe Kleine-König
2024-03-11 16:04 ` Thierry Reding
2024-03-11 17:13   ` Dipen Patel
2024-03-11 20:36     ` Uwe Kleine-König
2024-04-12 12:35       ` Uwe Kleine-König
2024-04-12 17:49         ` Dipen Patel

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).