[alsa-devel] [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED

Takashi Iwai tiwai at suse.de
Fri Nov 2 19:30:41 CET 2018


On Fri, 02 Nov 2018 19:12:44 +0100,
Andy Shevchenko wrote:
> 
> > +       if (action == HDA_FIXUP_ACT_PROBE) {
> > +               if (!huawei_wmi_micmute_led_set_func)
> > +                       huawei_wmi_micmute_led_set_func = symbol_request(huawei_wmi_micmute_led_set);
> > +               if (!huawei_wmi_micmute_led_set_func) {
> > +                       codec_warn(codec, "Failed to find huawei_wmi symbol huawei_wmi_micmute_led_set\n");
> > +                       return;
> > +               }
> > +               removefunc = (huawei_wmi_micmute_led_set_func(false) < 0)
> > +                       || (snd_hda_gen_add_micmute_led(codec, update_huawei_wmi_micmute_led) < 0);
> > +
> > +       }
> > +
> > +       if (huawei_wmi_micmute_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
> > +               symbol_put(huawei_wmi_micmute_led_set);
> > +               huawei_wmi_micmute_led_set_func = NULL;
> > +       }
> > +}
> 
> Takashi, is it a way how the rest sound drivers are written? B/c this
> symbol_request(s) look to me a bit ugly.

It's a workaround for not having a hard dependency.  The HD-audio
codec driver is generic, and we don't want to load the multiple WMI
drivers always for using a Realtek codec.

Ugly, yes, but simple enough.


thanks,

Takashi


More information about the Alsa-devel mailing list