lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 2 Nov 2018 20:12:44 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Ayman Bagabas <ayman.bagabas@...il.com>
Cc:     Darren Hart <dvhart@...radead.org>,
        Andy Shevchenko <andy@...radead.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, kailang@...ltek.com,
        Hui Wang <hui.wang@...onical.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        ALSA Development Mailing List <alsa-devel@...a-project.org>
Subject: Re: [PATCH v2 3/3] ALSA: hda: add support for Huawei WMI MicMute LED

On Fri, Nov 2, 2018 at 6:12 AM Ayman Bagabas <ayman.bagabas@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ