From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFB85C32789 for ; Fri, 2 Nov 2018 18:30:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4AFE2081B for ; Fri, 2 Nov 2018 18:30:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A4AFE2081B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728173AbeKCDix (ORCPT ); Fri, 2 Nov 2018 23:38:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:44240 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726849AbeKCDiw (ORCPT ); Fri, 2 Nov 2018 23:38:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 70E4EAECD; Fri, 2 Nov 2018 18:30:42 +0000 (UTC) Date: Fri, 02 Nov 2018 19:30:41 +0100 Message-ID: From: Takashi Iwai To: "Andy Shevchenko" Cc: "Ayman Bagabas" , "ALSA Development Mailing List" , "Hui Wang" , "Andy Shevchenko" , "Darren Hart" , "Jaroslav Kysela" , , "Linux Kernel Mailing List" , "Platform Driver" Subject: Re: [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED In-Reply-To: References: <20181102041120.7603-1-ayman.bagabas@gmail.com> <20181102041120.7603-4-ayman.bagabas@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/26 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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