backlight: mp3309c: Drop pwm_apply_args()
cover backlight: mp3309c: Drop pwm_apply_args()
Hello,
the first patch of this series is what I really care about: There are hardly any drivers left that use pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.
The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit 7ee6478d5aa9 ("backlight: mp3309c: Fully initialize backlight_properties during probe").
Best regards
Uwe
Uwe Kleine-König (2):
backlight: mp3309c: Drop pwm_apply_args()
backlight: mp3309c: Initialize backlight properties without memset
drivers/video/backlight/mp3309c.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
base-commit: 1343433ed38923a21425c602e92120a1f1db5f7a
Signature · 1 line
2.49.0
PATCH 1/2 backlight: mp3309c: Drop pwm_apply_args()
pwm_apply_args() sole purpose is to initialize all parameters specified in the device tree for consumers that rely on pwm_config() and pwm_enable(). The mp3309c backlight driver uses pwm_apply_might_sleep() which gets passed the full configuration and so doesn't rely on the default being explicitly applied.
--- drivers/video/backlight/mp3309c.c | 1 - 1 file changed, 1 deletion(-)
drivers/video/backlight/mp3309c.c +0 -1
@@ -222,7 +222,6 @@ static int mp3309c_parse_fwnode(struct mp3309c_chip *chip,if (IS_ERR (chip->pwmd))return dev_err_probe (dev,PTR_ERR (chip->pwmd),"error getting pwm data\n" ); pdata->dimming_mode =DIMMING_PWM ; -pwm_apply_args (chip->pwmd); }/*
Signature · 1 line
2.49.0
RE: EXTERNAL: [PATCH 1/2] backlight: mp3309c: Drop pwm_apply_args()
Hi Uwe,
I've tested your patch on my board, all ok.
Quoted 14 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: martedì 1 luglio 2025 11:23
To: FLAVIO SULIGOI <[email protected]>; Lee Jones <[email protected]>; Daniel Thompson <[email protected]>; Jingoo Han <[email protected]>; Helge Deller <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: EXTERNAL: [PATCH 1/2] backlight: mp3309c: Droppwm_apply_args()[Use caution with links & attachments]
Quoted 7 lines
pwm_apply_args()sole purpose is to initialize all parameters specified in the device tree for consumers that rely onpwm_config()andpwm_enable(). The mp3309c backlight driver usespwm_apply_might_sleep()which gets passed the full configuration and so doesn't rely on the default being explicitly applied.Signed-off-by Uwe Kleine-König <[email protected]>
Quoted 7 lines · Uwe Kleine-König
pwm_apply_args()sole purpose is to initialize all parameters specified in the device tree for consumers that rely onpwm_config()andpwm_enable(). The mp3309c backlight driver usespwm_apply_might_sleep()which gets passed the full configuration and so doesn't rely on the default being explicitly applied.Signed-off-by Uwe Kleine-König <[email protected]>
Sorry for the delay. I lost track of the review on this one so Lee didn't hoover it up!
Daniel.
PATCH 2/2 backlight: mp3309c: Initialize backlight properties without memset
In reply to Uwe Kleine-KönigAssigning values to a struct using a compound literal (since C99) also guarantees that all unspecified struct members are empty-initialized, so it properly replaces the memset to zero.
The code looks a bit nicer and more idiomatic (though that might be subjective?). The resulting binary is a bit smaller. On ARCH=arm with an allnoconfig + minimal changes to enable the mp3309c driver the difference is 12 bytes.
--- drivers/video/backlight/mp3309c.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/video/backlight/mp3309c.c +7 -6
@@ -352,12 +352,13 @@ static int mp3309c_probe(struct i2c_client *client) chip->pdata = pdata;/* Backlight properties */ -memset (&props,0 ,sizeof (struct backlight_properties )); - props.brightness = pdata->default_brightness; - props.max_brightness = pdata->max_brightness; - props.scale =BACKLIGHT_SCALE_LINEAR ; - props.type =BACKLIGHT_RAW ; - props.power =BACKLIGHT_POWER_ON ; + props = (typeof (props )){ + .brightness = pdata->default_brightness, + .max_brightness = pdata->max_brightness, + .scale =BACKLIGHT_SCALE_LINEAR , + .type =BACKLIGHT_RAW , + .power =BACKLIGHT_POWER_ON , + }; chip->bl =devm_backlight_device_register (dev,"mp3309c" , dev, chip, &mp3309c_bl_ops, &props);if (IS_ERR (chip->bl))
Signature · 1 line
2.49.0
RE: EXTERNAL: [PATCH 2/2] backlight: mp3309c: Initialize backlight properties without memset
Hi Uwe,
I've tested your patch on my board, all ok.
Quoted 19 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: martedì 1 luglio 2025 11:23
To: FLAVIO SULIGOI <[email protected]>; Lee Jones <[email protected]>; Daniel Thompson <[email protected]>; Jingoo Han <[email protected]>; Helge Deller <[email protected]>
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: EXTERNAL: [PATCH 2/2] backlight: mp3309c: Initialize backlight properties without memset[Use caution with links & attachments]
Assigning values to a struct using a compound literal (since C99) also guarantees that all unspecified struct members are empty-initialized, so it properly replaces the memset to zero.
Quoted 6 lines
The code looks a bit nicer and more idiomatic (though that might be subjective?). The resulting binary is a bit smaller. On ARCH=arm with an allnoconfig + minimal changes to enable the mp3309c driver the difference is 12 bytes.
Signed-off-by Uwe Kleine-König <[email protected]>
Re: [PATCH 2/2] backlight: mp3309c: Initialize backlight properties without memset
In reply to Uwe Kleine-KönigQuoted 10 lines · Uwe Kleine-König
Assigning values to a struct using a compound literal (since C99) also guarantees that all unspecified struct members are empty-initialized, so it properly replaces the memset to zero.
The code looks a bit nicer and more idiomatic (though that might be subjective?). The resulting binary is a bit smaller. On ARCH=arm with an allnoconfig + minimal changes to enable the mp3309c driver the difference is 12 bytes.
Signed-off-by Uwe Kleine-König <[email protected]>
Daniel.
Lee Jones
maintainerRe: [PATCH 2/2] backlight: mp3309c: Initialize backlight properties without memset
Quoted 5 lines · Daniel Thompson
Quoted 4 lines · Uwe Kleine-König
Assigning values to a struct using a compound literal (since C99) also guarantees that all unspecified struct members are empty-initialized, so it properly replaces the memset to zero.
Quoted 8 lines
Quoted 6 lines
The code looks a bit nicer and more idiomatic (though that might be subjective?). The resulting binary is a bit smaller. On ARCH=arm with an allnoconfig + minimal changes to enable the mp3309c driver the difference is 12 bytes.
Signed-off-by Uwe Kleine-König <[email protected]>Reviewed-by Daniel Thompson (RISCstar) <[email protected]>
Looks like you cannot send tags from non-related email accounts:
NOTE: some trailers ignored due to from/email mismatches:
! Trailer: Reviewed-by: "Daniel Thompson (RISCstar)" <[email protected]>
Msg From: Daniel Thompson <[email protected]>
I'll add the tags manually this time.
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH 2/2] backlight: mp3309c: Initialize backlight properties without memset
Quoted 16 lines · Lee Jones
Quoted 5 lines · Daniel Thompson
Quoted 4 lines · Uwe Kleine-König
Assigning values to a struct using a compound literal (since C99) also guarantees that all unspecified struct members are empty-initialized, so it properly replaces the memset to zero.
Quoted 8 lines
Quoted 6 lines
The code looks a bit nicer and more idiomatic (though that might be subjective?). The resulting binary is a bit smaller. On ARCH=arm with an allnoconfig + minimal changes to enable the mp3309c driver the difference is 12 bytes.
Signed-off-by Uwe Kleine-König <[email protected]>Reviewed-by Daniel Thompson (RISCstar) <[email protected]>
Quoted 7 lines
Looks like you cannot send tags from non-related email accounts:
NOTE: some trailers ignored due to from/email mismatches:
! Trailer: Reviewed-by: "Daniel Thompson (RISCstar)" <[email protected]>
Msg From: Daniel Thompson <[email protected]>I'll add the tags manually this time.
FTR: The email address *or* the real name has to match the From: line to make b4 happy.
Best regards
Uwe
FLAVIO SULIGOI
maintainerRE: EXTERNAL: [PATCH 0/2] backlight: mp3309c: Drop pwm_apply_args()
In reply to Uwe Kleine-KönigHi Uwe,
Quoted 21 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: martedì 1 luglio 2025 11:23
To: FLAVIO SULIGOI <[email protected]>; Lee Jones <[email protected]>; Daniel Thompson <[email protected]>; Jingoo Han <[email protected]>; Helge Deller <[email protected]>
Cc: Daniel Thompson <[email protected]>; dri- [email protected]; [email protected]; linux- [email protected]
Subject: EXTERNAL: [PATCH 0/2] backlight: mp3309c: Droppwm_apply_args()[Use caution with links & attachments]
Hello,
the first patch of this series is what I really care about: There are hardly any drivers left that use
pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.
Quoted 5 lines
The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit
7ee6478d5aa9("backlight: mp3309c: Fully initializebacklight_propertiesduring probe").
I've tested your patches on my board and all is ok. Thanks!
Quoted 8 lines
Best regards
UweUwe Kleine-König (2):
backlight: mp3309c: Droppwm_apply_args()
backlight: mp3309c: Initialize backlight properties without memset
Quoted 7 lines
drivers/video/backlight/mp3309c.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)base-commit:
1343433ed38923a21425c602e92120a1f1db5f7a--
2.49.0
Flavio
Re: EXTERNAL: [PATCH 0/2] backlight: mp3309c: Drop pwm_apply_args()
[Updating Daniel's email address as the linaro one stopped working]
Hello,
Quoted 11 lines · FLAVIO SULIGOI
Quoted 9 lines
the first patch of this series is what I really care about: There are hardly any drivers left that use
pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit
7ee6478d5aa9("backlight: mp3309c: Fully initializebacklight_propertiesduring probe").I've tested your patches on my board and all is ok.
@Flavio:
A Tested-by in this reply to the cover letter is understood by b4 (which is the tool most maintainers use to apply patches from the mailing list). So there wouldn't have been a need to reply to each mail individually.
@backlight maintainers:
This patch didn't make it into next yet, I guess it's too late for 6.17-rc1 now?
Best regards
Uwe
Re: EXTERNAL: [PATCH 0/2] backlight: mp3309c: Drop pwm_apply_args()
Hello,
Quoted 23 lines · Uwe Kleine-König
[Updating Daniel's email address as the linaro one stopped working]
Hello,
Quoted 11 lines · FLAVIO SULIGOI
Quoted 9 lines
the first patch of this series is what I really care about: There are hardly any drivers left that use
pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit
7ee6478d5aa9("backlight: mp3309c: Fully initializebacklight_propertiesduring probe").I've tested your patches on my board and all is ok.
@Flavio:
A Tested-by in this reply to the cover letter is understood by b4 (which is the tool most maintainers use to apply patches from the mailing list). So there wouldn't have been a need to reply to each mail individually.
Quoted 3 lines
@backlight maintainers:
This patch didn't make it into next yet, I guess it's too late for 6.17-rc1 now?
Confirmed, it didn't make it into 6.17-rc1. In next (and also v6.17-rc1) we have:
$ git grep pwm_apply_args next/master next/master:drivers/video/backlight/mp3309c.c: pwm_apply_args(chip->pwmd); next/master:include/linux/pwm.h:static inline void pwm_apply_args(struct pwm_device *pwm) next/master:include/linux/pwm.h: * PWM users calling pwm_apply_args() expect to have a fresh config next/master:include/linux/pwm.h: * pwm_apply_args().
so this patch series is the single stopper before I can remove pwm_apply_args().
Can we please get this into next for 6.18-rc1?
Looking at
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git I see that the branches merged regularily into next (for-backlight-next + for-backlight-fixes) still points to 6.16-rc1 and 6.10-rc1 respectively. If that means I should better take this series (or at least the first patch) through my tree, please tell me.
Best regards
Uwe
Quoted 11 lines · Uwe Kleine-König
the first patch of this series is what I really care about: There are hardly any drivers left that use
pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit
7ee6478d5aa9("backlight: mp3309c: Fully initializebacklight_propertiesduring probe").[...]
Applied, thanks!
[1/2] backlight: mp3309c: Drop pwm_apply_args()
commit: d22caa15de3a11b503157aec079cad4bf305ff47
[2/2] backlight: mp3309c: Initialize backlight properties without memset
commit: 71ca0594c11b4030c6dece9ba9b080d652a82473--
Lee Jones [李琼斯]
Hello Lee,
Quoted 11 lines · Lee Jones
Quoted 10 lines · Uwe Kleine-König
the first patch of this series is what I really care about: There are hardly any drivers left that use
pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit
7ee6478d5aa9("backlight: mp3309c: Fully initializebacklight_propertiesduring probe").
Quoted 8 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] backlight: mp3309c: Drop
pwm_apply_args()commit: d22caa15de3a11b503157aec079cad4bf305ff47 [2/2] backlight: mp3309c: Initialize backlight properties without memset commit: 71ca0594c11b4030c6dece9ba9b080d652a82473
I would expect to see these commits in your repo at
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git, but the exact commits don't exist there and if the patches are included under a different commit-id it's not obvious to me in which branch. Did you forget to push?
Best regards
Uwe
Lee Jones
maintainerQuoted 23 lines · Uwe Kleine-König
Hello Lee,
Quoted 11 lines · Lee Jones
Quoted 10 lines · Uwe Kleine-König
the first patch of this series is what I really care about: There are hardly any drivers left that use
pwm_apply_args(). When all of them are converted to not use it any more, I intend to drop that function.The 2nd patch is just a change that I noticed while editing the driver that is IMHO nice. If you don't agree and only apply the first patch, I won't argue. It's an alternative approach to what Daniel Thompson did in commit
7ee6478d5aa9("backlight: mp3309c: Fully initializebacklight_propertiesduring probe").Quoted 8 lines
Quoted 1 line
[...]
Applied, thanks!
[1/2] backlight: mp3309c: Drop
pwm_apply_args()commit: d22caa15de3a11b503157aec079cad4bf305ff47 [2/2] backlight: mp3309c: Initialize backlight properties without memset commit: 71ca0594c11b4030c6dece9ba9b080d652a82473
Quoted 5 lines
I would expect to see these commits in your repo at
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git, but the exact commits don't exist there and if the patches are included under a different commit-id it's not obvious to me in which branch. Did you forget to push?
Yes. Now pushed. Sorry for the delay.
Signature · 1 line
Lee Jones [李琼斯]