Message ID | e5ef576b-70ee-4781-88e3-e728c1e7cb9c@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | leds: trigger: Improve handling of led_trigger_event() and simplify mute audio trigger | expand |
On Tue, Feb 13, 2024 at 08:33:24AM +0100, Heiner Kallweit wrote: > In a follow-up patch handling of the LED audio trigger will be changed, > including removal of config symbol LEDS_AUDIO_TRIGGER. Therefore set > the default trigger unconditionally to "audio-mute". It does no harm > if a default trigger doesn't exist. > > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> > --- > drivers/input/input-leds.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c > index b16fc8194..176f1da7f 100644 > --- a/drivers/input/input-leds.c > +++ b/drivers/input/input-leds.c > @@ -18,12 +18,6 @@ > #define VT_TRIGGER(_name) .trigger = NULL > #endif > > -#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO) Should it be simply changed to CONFIG_SND_CTL_LED? > -#define AUDIO_TRIGGER(_name) .trigger = _name > -#else > -#define AUDIO_TRIGGER(_name) .trigger = NULL > -#endif > - > static const struct { > const char *name; > const char *trigger; > @@ -35,7 +29,7 @@ static const struct { > [LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") }, > [LED_SLEEP] = { "sleep" } , > [LED_SUSPEND] = { "suspend" }, > - [LED_MUTE] = { "mute", AUDIO_TRIGGER("audio-mute") }, > + [LED_MUTE] = { "mute", "audio-mute" }, > [LED_MISC] = { "misc" }, > [LED_MAIL] = { "mail" }, > [LED_CHARGING] = { "charging" }, > -- > 2.43.1 > > Thanks.
On 24.02.2024 00:23, Dmitry Torokhov wrote: > On Tue, Feb 13, 2024 at 08:33:24AM +0100, Heiner Kallweit wrote: >> In a follow-up patch handling of the LED audio trigger will be changed, >> including removal of config symbol LEDS_AUDIO_TRIGGER. Therefore set >> the default trigger unconditionally to "audio-mute". It does no harm >> if a default trigger doesn't exist. >> >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> >> --- >> drivers/input/input-leds.c | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c >> index b16fc8194..176f1da7f 100644 >> --- a/drivers/input/input-leds.c >> +++ b/drivers/input/input-leds.c >> @@ -18,12 +18,6 @@ >> #define VT_TRIGGER(_name) .trigger = NULL >> #endif >> >> -#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO) > > Should it be simply changed to CONFIG_SND_CTL_LED? > This would be another option. What is better IMO is a matter of personal taste. Setting the default trigger unconditionally may cause a negligible runtime overhead when the LED is instantiated, on the other hand it results in less code to be maintained. Do you have a preference? >> -#define AUDIO_TRIGGER(_name) .trigger = _name >> -#else >> -#define AUDIO_TRIGGER(_name) .trigger = NULL >> -#endif >> - >> static const struct { >> const char *name; >> const char *trigger; >> @@ -35,7 +29,7 @@ static const struct { >> [LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") }, >> [LED_SLEEP] = { "sleep" } , >> [LED_SUSPEND] = { "suspend" }, >> - [LED_MUTE] = { "mute", AUDIO_TRIGGER("audio-mute") }, >> + [LED_MUTE] = { "mute", "audio-mute" }, >> [LED_MISC] = { "misc" }, >> [LED_MAIL] = { "mail" }, >> [LED_CHARGING] = { "charging" }, >> -- >> 2.43.1 >> >> > > Thanks. >
On Sat, Feb 24, 2024 at 10:31:17AM +0100, Heiner Kallweit wrote: > On 24.02.2024 00:23, Dmitry Torokhov wrote: > > On Tue, Feb 13, 2024 at 08:33:24AM +0100, Heiner Kallweit wrote: > >> In a follow-up patch handling of the LED audio trigger will be changed, > >> including removal of config symbol LEDS_AUDIO_TRIGGER. Therefore set > >> the default trigger unconditionally to "audio-mute". It does no harm > >> if a default trigger doesn't exist. > >> > >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> > >> --- > >> drivers/input/input-leds.c | 8 +------- > >> 1 file changed, 1 insertion(+), 7 deletions(-) > >> > >> diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c > >> index b16fc8194..176f1da7f 100644 > >> --- a/drivers/input/input-leds.c > >> +++ b/drivers/input/input-leds.c > >> @@ -18,12 +18,6 @@ > >> #define VT_TRIGGER(_name) .trigger = NULL > >> #endif > >> > >> -#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO) > > > > Should it be simply changed to CONFIG_SND_CTL_LED? > > > This would be another option. What is better IMO is a matter of > personal taste. Setting the default trigger unconditionally may > cause a negligible runtime overhead when the LED is instantiated, > on the other hand it results in less code to be maintained. > Do you have a preference? I am less concerned about overhead than setting a non-existent default trigger if the functionality is disabled. I would prefer having the #ifdef. Thanks.
diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c index b16fc8194..176f1da7f 100644 --- a/drivers/input/input-leds.c +++ b/drivers/input/input-leds.c @@ -18,12 +18,6 @@ #define VT_TRIGGER(_name) .trigger = NULL #endif -#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO) -#define AUDIO_TRIGGER(_name) .trigger = _name -#else -#define AUDIO_TRIGGER(_name) .trigger = NULL -#endif - static const struct { const char *name; const char *trigger; @@ -35,7 +29,7 @@ static const struct { [LED_KANA] = { "kana", VT_TRIGGER("kbd-kanalock") }, [LED_SLEEP] = { "sleep" } , [LED_SUSPEND] = { "suspend" }, - [LED_MUTE] = { "mute", AUDIO_TRIGGER("audio-mute") }, + [LED_MUTE] = { "mute", "audio-mute" }, [LED_MISC] = { "misc" }, [LED_MAIL] = { "mail" }, [LED_CHARGING] = { "charging" },
In a follow-up patch handling of the LED audio trigger will be changed, including removal of config symbol LEDS_AUDIO_TRIGGER. Therefore set the default trigger unconditionally to "audio-mute". It does no harm if a default trigger doesn't exist. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> --- drivers/input/input-leds.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)