Skip to content

Commit 6f47466

Browse files
fabiobaltierikartben
authored andcommitted
led: drop a bunch of on/off wrappers
These are now handled at API level, drop them from the drivers. Signed-off-by: Fabio Baltieri <[email protected]>
1 parent 2f0d141 commit 6f47466

File tree

9 files changed

+0
-122
lines changed

9 files changed

+0
-122
lines changed

drivers/led/is31fl3194.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,6 @@ static int is31fl3194_set_brightness(const struct device *dev, uint32_t led, uin
166166
return ret;
167167
}
168168

169-
static inline int is31fl3194_led_on(const struct device *dev, uint32_t led)
170-
{
171-
return is31fl3194_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
172-
}
173-
174-
static inline int is31fl3194_led_off(const struct device *dev, uint32_t led)
175-
{
176-
return is31fl3194_set_brightness(dev, led, 0);
177-
}
178-
179169
/*
180170
* Counts red, green, blue channels; returns true if color_id is valid
181171
* and no more than one channel maps to the same color
@@ -315,8 +305,6 @@ static int is31fl3194_init(const struct device *dev)
315305

316306
static DEVICE_API(led, is31fl3194_led_api) = {
317307
.set_brightness = is31fl3194_set_brightness,
318-
.on = is31fl3194_led_on,
319-
.off = is31fl3194_led_off,
320308
.get_info = is31fl3194_get_info,
321309
.set_color = is31fl3194_set_color,
322310
};

drivers/led/is31fl3216a.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,6 @@ static int is31fl3216a_led_set_brightness(const struct device *dev,
124124
return is31fl3216a_update_pwm(&config->i2c);
125125
}
126126

127-
static int is31fl3216a_led_on(const struct device *dev, uint32_t led)
128-
{
129-
return is31fl3216a_led_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
130-
}
131-
132-
static int is31fl3216a_led_off(const struct device *dev, uint32_t led)
133-
{
134-
return is31fl3216a_led_set_brightness(dev, led, 0);
135-
}
136-
137127
static int is31fl3216a_init_registers(const struct i2c_dt_spec *i2c)
138128
{
139129
int i;
@@ -224,8 +214,6 @@ static int is31fl3216a_init(const struct device *dev)
224214

225215
static DEVICE_API(led, is31fl3216a_led_api) = {
226216
.set_brightness = is31fl3216a_led_set_brightness,
227-
.on = is31fl3216a_led_on,
228-
.off = is31fl3216a_led_off,
229217
.write_channels = is31fl3216a_led_write_channels
230218
};
231219

drivers/led/is31fl3733.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,6 @@ static int is31fl3733_led_set_brightness(const struct device *dev, uint32_t led,
111111
return i2c_reg_write_byte_dt(&config->bus, led, led_brightness);
112112
}
113113

114-
static int is31fl3733_led_on(const struct device *dev, uint32_t led)
115-
{
116-
return is31fl3733_led_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
117-
}
118-
119-
static int is31fl3733_led_off(const struct device *dev, uint32_t led)
120-
{
121-
return is31fl3733_led_set_brightness(dev, led, 0);
122-
}
123-
124114
static int is31fl3733_led_write_channels(const struct device *dev, uint32_t start_channel,
125115
uint32_t num_channels, const uint8_t *buf)
126116
{
@@ -274,8 +264,6 @@ int is31fl3733_current_limit(const struct device *dev, uint8_t limit)
274264
}
275265

276266
static DEVICE_API(led, is31fl3733_api) = {
277-
.on = is31fl3733_led_on,
278-
.off = is31fl3733_led_off,
279267
.set_brightness = is31fl3733_led_set_brightness,
280268
.write_channels = is31fl3733_led_write_channels,
281269
};

drivers/led/led_dac.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,7 @@ static int led_dac_set_brightness(const struct device *dev, uint32_t led, uint8_
4949
return led_dac_set_raw(dev, led, value);
5050
}
5151

52-
static inline int led_dac_on(const struct device *dev, uint32_t led)
53-
{
54-
const struct led_dac_config *config = dev->config;
55-
56-
if (led >= config->num_leds) {
57-
return -EINVAL;
58-
}
59-
60-
return led_dac_set_raw(dev, led, config->leds[led].dac_max_brightness);
61-
}
62-
63-
static inline int led_dac_off(const struct device *dev, uint32_t led)
64-
{
65-
const struct led_dac_config *config = dev->config;
66-
67-
if (led >= config->num_leds) {
68-
return -EINVAL;
69-
}
70-
71-
return led_dac_set_raw(dev, led, 0);
72-
}
73-
7452
static DEVICE_API(led, led_dac_api) = {
75-
.on = led_dac_on,
76-
.off = led_dac_off,
7753
.set_brightness = led_dac_set_brightness,
7854
};
7955

drivers/led/led_gpio.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ static int led_gpio_set_brightness(const struct device *dev, uint32_t led, uint8
3939
return gpio_pin_set_dt(led_gpio, value > 0);
4040
}
4141

42-
static int led_gpio_on(const struct device *dev, uint32_t led)
43-
{
44-
return led_gpio_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
45-
}
46-
47-
static int led_gpio_off(const struct device *dev, uint32_t led)
48-
{
49-
return led_gpio_set_brightness(dev, led, 0);
50-
}
51-
5242
static int led_gpio_init(const struct device *dev)
5343
{
5444
const struct led_gpio_config *config = dev->config;
@@ -78,8 +68,6 @@ static int led_gpio_init(const struct device *dev)
7868
}
7969

8070
static DEVICE_API(led, led_gpio_api) = {
81-
.on = led_gpio_on,
82-
.off = led_gpio_off,
8371
.set_brightness = led_gpio_set_brightness,
8472
};
8573

drivers/led/led_pwm.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,6 @@ static int led_pwm_set_brightness(const struct device *dev,
6868
(uint32_t) ((uint64_t) dt_led->period * value / LED_BRIGTHNESS_MAX));
6969
}
7070

71-
static int led_pwm_on(const struct device *dev, uint32_t led)
72-
{
73-
return led_pwm_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
74-
}
75-
76-
static int led_pwm_off(const struct device *dev, uint32_t led)
77-
{
78-
return led_pwm_set_brightness(dev, led, 0);
79-
}
80-
8171
static int led_pwm_init(const struct device *dev)
8272
{
8373
const struct led_pwm_config *config = dev->config;
@@ -125,8 +115,6 @@ static int led_pwm_pm_action(const struct device *dev,
125115
#endif /* CONFIG_PM_DEVICE */
126116

127117
static DEVICE_API(led, led_pwm_api) = {
128-
.on = led_pwm_on,
129-
.off = led_pwm_off,
130118
.blink = led_pwm_blink,
131119
.set_brightness = led_pwm_set_brightness,
132120
};

drivers/led/lp50xx.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,6 @@ static int lp50xx_set_brightness(const struct device *dev,
136136
return i2c_write_dt(&config->bus, buf, sizeof(buf));
137137
}
138138

139-
static int lp50xx_on(const struct device *dev, uint32_t led)
140-
{
141-
return lp50xx_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
142-
}
143-
144-
static int lp50xx_off(const struct device *dev, uint32_t led)
145-
{
146-
return lp50xx_set_brightness(dev, led, 0);
147-
}
148-
149139
static int lp50xx_set_color(const struct device *dev, uint32_t led,
150140
uint8_t num_colors, const uint8_t *color)
151141
{
@@ -350,8 +340,6 @@ static int lp50xx_pm_action(const struct device *dev,
350340
#endif /* CONFIG_PM_DEVICE */
351341

352342
static DEVICE_API(led, lp50xx_led_api) = {
353-
.on = lp50xx_on,
354-
.off = lp50xx_off,
355343
.get_info = lp50xx_get_info,
356344
.set_brightness = lp50xx_set_brightness,
357345
.set_color = lp50xx_set_color,

drivers/led/lp5569.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,6 @@ static int lp5569_led_set_brightness(const struct device *dev, uint32_t led, uin
6565
return 0;
6666
}
6767

68-
static inline int lp5569_led_on(const struct device *dev, uint32_t led)
69-
{
70-
/* Set LED brightness to 100 % */
71-
return lp5569_led_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
72-
}
73-
74-
static inline int lp5569_led_off(const struct device *dev, uint32_t led)
75-
{
76-
/* Set LED brightness to 0 % */
77-
return lp5569_led_set_brightness(dev, led, 0);
78-
}
79-
8068
static int lp5569_write_channels(const struct device *dev, uint32_t start_channel,
8169
uint32_t num_channels, const uint8_t *buf)
8270
{
@@ -185,8 +173,6 @@ static int lp5569_pm_action(const struct device *dev, enum pm_device_action acti
185173

186174
static DEVICE_API(led, lp5569_led_api) = {
187175
.set_brightness = lp5569_led_set_brightness,
188-
.on = lp5569_led_on,
189-
.off = lp5569_led_off,
190176
.write_channels = lp5569_write_channels,
191177
};
192178

drivers/led/ncp5623.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,6 @@ static int ncp5623_set_brightness(const struct device *dev, uint32_t led, uint8_
120120
return ret;
121121
}
122122

123-
static inline int ncp5623_led_on(const struct device *dev, uint32_t led)
124-
{
125-
return ncp5623_set_brightness(dev, led, LED_BRIGTHNESS_MAX);
126-
}
127-
128-
static inline int ncp5623_led_off(const struct device *dev, uint32_t led)
129-
{
130-
return ncp5623_set_brightness(dev, led, 0);
131-
}
132-
133123
static int ncp5623_led_init(const struct device *dev)
134124
{
135125
const struct ncp5623_config *config = dev->config;
@@ -186,8 +176,6 @@ static int ncp5623_led_init(const struct device *dev)
186176

187177
static DEVICE_API(led, ncp5623_led_api) = {
188178
.set_brightness = ncp5623_set_brightness,
189-
.on = ncp5623_led_on,
190-
.off = ncp5623_led_off,
191179
.get_info = ncp5623_get_info,
192180
.set_color = ncp5623_set_color,
193181
};

0 commit comments

Comments
 (0)