Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: rgb: leds-mt6370-rgb: Improve definition of some struct linear_range

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>
Link: https://lore.kernel.org/r/1ce4245107e0a51dce502a007a69899bda018d5f.1746197460.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Christophe JAILLET and committed by
Lee Jones
f1c86ab9 cfa40f29

+8 -8
+8 -8
drivers/leds/rgb/leds-mt6370-rgb.c
··· 199 199 200 200 /* Current unit: microamp, time unit: millisecond */ 201 201 static const struct linear_range common_led_ranges[R_MAX_RANGES] = { 202 - [R_LED123_CURR] = { 4000, 1, 6, 4000 }, 203 - [R_LED4_CURR] = { 2000, 1, 3, 2000 }, 204 - [R_LED_TRFON] = { 125, 0, 15, 200 }, 205 - [R_LED_TOFF] = { 250, 0, 15, 400 }, 202 + [R_LED123_CURR] = LINEAR_RANGE(4000, 1, 6, 4000), 203 + [R_LED4_CURR] = LINEAR_RANGE(2000, 1, 3, 2000), 204 + [R_LED_TRFON] = LINEAR_RANGE(125, 0, 15, 200), 205 + [R_LED_TOFF] = LINEAR_RANGE(250, 0, 15, 400), 206 206 }; 207 207 208 208 static const struct linear_range mt6372_led_ranges[R_MAX_RANGES] = { 209 - [R_LED123_CURR] = { 2000, 1, 14, 2000 }, 210 - [R_LED4_CURR] = { 2000, 1, 14, 2000 }, 211 - [R_LED_TRFON] = { 125, 0, 15, 250 }, 212 - [R_LED_TOFF] = { 250, 0, 15, 500 }, 209 + [R_LED123_CURR] = LINEAR_RANGE(2000, 1, 14, 2000), 210 + [R_LED4_CURR] = LINEAR_RANGE(2000, 1, 14, 2000), 211 + [R_LED_TRFON] = LINEAR_RANGE(125, 0, 15, 250), 212 + [R_LED_TOFF] = LINEAR_RANGE(250, 0, 15, 500), 213 213 }; 214 214 215 215 static const unsigned int common_tfreqs[] = {