* [PATCH] leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range
@ 2025-05-02 14:51 Christophe JAILLET
2025-05-08 14:32 ` (subset) " Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-05-02 14:51 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-leds,
linux-arm-kernel, linux-mediatek
Use LINEAR_RANGE() instead of hand-writing it. It is more robust, should
the layout of the structure change one day.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/leds/rgb/leds-mt6370-rgb.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/leds/rgb/leds-mt6370-rgb.c b/drivers/leds/rgb/leds-mt6370-rgb.c
index ebd3ba878dd5..c5927d0eb830 100644
--- a/drivers/leds/rgb/leds-mt6370-rgb.c
+++ b/drivers/leds/rgb/leds-mt6370-rgb.c
@@ -199,17 +199,17 @@ static const struct reg_field mt6372_reg_fields[F_MAX_FIELDS] = {
/* Current unit: microamp, time unit: millisecond */
static const struct linear_range common_led_ranges[R_MAX_RANGES] = {
- [R_LED123_CURR] = { 4000, 1, 6, 4000 },
- [R_LED4_CURR] = { 2000, 1, 3, 2000 },
- [R_LED_TRFON] = { 125, 0, 15, 200 },
- [R_LED_TOFF] = { 250, 0, 15, 400 },
+ [R_LED123_CURR] = LINEAR_RANGE(4000, 1, 6, 4000),
+ [R_LED4_CURR] = LINEAR_RANGE(2000, 1, 3, 2000),
+ [R_LED_TRFON] = LINEAR_RANGE(125, 0, 15, 200),
+ [R_LED_TOFF] = LINEAR_RANGE(250, 0, 15, 400),
};
static const struct linear_range mt6372_led_ranges[R_MAX_RANGES] = {
- [R_LED123_CURR] = { 2000, 1, 14, 2000 },
- [R_LED4_CURR] = { 2000, 1, 14, 2000 },
- [R_LED_TRFON] = { 125, 0, 15, 250 },
- [R_LED_TOFF] = { 250, 0, 15, 500 },
+ [R_LED123_CURR] = LINEAR_RANGE(2000, 1, 14, 2000),
+ [R_LED4_CURR] = LINEAR_RANGE(2000, 1, 14, 2000),
+ [R_LED_TRFON] = LINEAR_RANGE(125, 0, 15, 250),
+ [R_LED_TOFF] = LINEAR_RANGE(250, 0, 15, 500),
};
static const unsigned int common_tfreqs[] = {
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: (subset) [PATCH] leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range
2025-05-02 14:51 [PATCH] leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range Christophe JAILLET
@ 2025-05-08 14:32 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2025-05-08 14:32 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Matthias Brugger,
AngeloGioacchino Del Regno, Christophe JAILLET
Cc: linux-kernel, kernel-janitors, linux-leds, linux-arm-kernel,
linux-mediatek
On Fri, 02 May 2025 16:51:22 +0200, Christophe JAILLET wrote:
> Use LINEAR_RANGE() instead of hand-writing it. It is more robust, should
> the layout of the structure change one day.
>
>
Applied, thanks!
[1/1] leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range
commit: 4e055c846de470cb4a9bf4be0811c7d624785abc
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-08 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 14:51 [PATCH] leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range Christophe JAILLET
2025-05-08 14:32 ` (subset) " Lee Jones
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).