LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Ayman Bagabas <ayman.bagabas@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	kailang@realtek.com, Hui Wang <hui.wang@canonical.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>
Subject: Re: [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED
Date: Fri, 2 Nov 2018 20:12:44 +0200	[thread overview]
Message-ID: <CAHp75VcA5M4XNVr94OALo3=AW3LbWU+Pz-KTRgodBtSP_K9-wA@mail.gmail.com> (raw)
In-Reply-To: <20181102041120.7603-4-ayman.bagabas@gmail.com>

On Fri, Nov 2, 2018 at 6:12 AM Ayman Bagabas <ayman.bagabas@gmail.com> wrote:
>
> Some of Huawei laptops come with a LED in the mic mute key. This patch
> enables and disable this LED accordingly.

> --- a/drivers/platform/x86/huawei_wmi.c
> +++ b/drivers/platform/x86/huawei_wmi.c
> @@ -26,6 +26,7 @@
>  #include <linux/input/sparse-keymap.h>
>  #include <linux/acpi.h>
>  #include <linux/wmi.h>
> +#include <linux/huawei_wmi.h>

Keep it in order and put under
include/linux/platform_data/x86/
folder.

> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __HUAWEI_WMI_H__
> +#define __HUAWEI_WMI_H__
> +
> +int huawei_wmi_micmute_led_set(bool on);
> +
> +#endif

This has to cover !HUAWEI_LAPTOP case.

> +/* Helper functions for Huawei WMI Mic Mute LED;
> + * to be included from codec driver
> + */

Comment style.

> +#if IS_ENABLED(CONFIG_HUAWEI_LAPTOP)

See above

> +static int (*huawei_wmi_micmute_led_set_func)(bool);

Why is that?

> +       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.

> +/* for alc_fixup_huawei_micmute_led */
> +#include "huawei_wmi_helper.c"

Ditto.

Include *.c?! Huh?

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-11-02 18:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02  4:11 [PATCH v2 0/3] Huawei laptops WMI & sound fixes Ayman Bagabas
2018-11-02  4:11 ` [PATCH v2 1/3] x86: add support for Huawei WMI hotkeys Ayman Bagabas
2018-11-02 18:20   ` Andy Shevchenko
2018-11-02 23:10     ` ayman.bagabas
2018-11-05 11:05       ` Takashi Iwai
2018-11-02  4:11 ` [PATCH v2 2/3] ALSA: hda: fix front speakers on Huawei MBXP Ayman Bagabas
2018-11-02 18:07   ` Andy Shevchenko
2018-11-02  4:11 ` [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED Ayman Bagabas
2018-11-02 18:12   ` Andy Shevchenko [this message]
2018-11-02 18:30     ` Takashi Iwai
2018-11-02 18:33       ` Andy Shevchenko
2018-11-02 23:21     ` ayman.bagabas
2018-11-05 14:46       ` Andy Shevchenko
2018-11-02 18:05 ` [PATCH v2 0/3] Huawei laptops WMI & sound fixes Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75VcA5M4XNVr94OALo3=AW3LbWU+Pz-KTRgodBtSP_K9-wA@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andy@infradead.org \
    --cc=ayman.bagabas@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=hui.wang@canonical.com \
    --cc=kailang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tiwai@suse.com \
    --subject='Re: [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).