From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED Date: Fri, 02 Nov 2018 19:30:41 +0100 Message-ID: References: <20181102041120.7603-1-ayman.bagabas@gmail.com> <20181102041120.7603-4-ayman.bagabas@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Andy Shevchenko Cc: Ayman Bagabas , ALSA Development Mailing List , Hui Wang , Andy Shevchenko , Darren Hart , Jaroslav Kysela , kailang@realtek.com, Linux Kernel Mailing List , Platform Driver List-Id: platform-driver-x86.vger.kernel.org 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