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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED 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 639A4C43441 for ; Wed, 28 Nov 2018 08:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35A6A20832 for ; Wed, 28 Nov 2018 08:44:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35A6A20832 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 S1728024AbeK1Tp0 (ORCPT ); Wed, 28 Nov 2018 14:45:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:43514 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727413AbeK1Tp0 (ORCPT ); Wed, 28 Nov 2018 14:45:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0AF69AC1F; Wed, 28 Nov 2018 08:44:34 +0000 (UTC) Date: Wed, 28 Nov 2018 09:44:32 +0100 Message-ID: From: Takashi Iwai To: ayman.bagabas@gmail.com Cc: Andy Shevchenko , ALSA Development Mailing List , Hui Wang , Andy Shevchenko , Darren Hart , Jaroslav Kysela , Kailang Yang , Linux Kernel Mailing List , Platform Driver Subject: Re: [PATCH v7 2/3] x86: add support for Huawei WMI hotkeys. In-Reply-To: <789965489e73fd543f0552090063fdff69363497.camel@gmail.com> References: <20181127025752.6459-1-ayman.bagabas@gmail.com> <20181127025752.6459-3-ayman.bagabas@gmail.com> <789965489e73fd543f0552090063fdff69363497.camel@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 Wed, 28 Nov 2018 01:49:48 +0100, ayman.bagabas@gmail.com wrote: > > On Tue, 2018-11-27 at 17:52 +0200, Andy Shevchenko wrote: > > On Tue, Nov 27, 2018 at 1:02 PM Takashi Iwai wrote: > > > On Tue, 27 Nov 2018 03:57:48 +0100, > > > Ayman Bagabas wrote: > > > > + handle = ACPI_HANDLE(&inputdev->dev); > > > > + args[0].type = args[1].type = args[2].type = > > > > ACPI_TYPE_INTEGER; > > > > + args[1].integer.value = 0x04; > > > > + > > > > + if (acpi_has_method(handle, method = > > > > "\\_SB.PCI0.LPCB.EC0.SPIN")) { > > > > > > This looks ugly... And checkpatch also complains. > > > > Good point. > > Actually another question is what handle do we get here? Can we check > > method name by relative path, i.e. "SPIN" / "WPIN" instead? > > The handle is a NULL handle at "\". Should I use acpi_get_handle(NULL, > "\\_SB.PCI0.LPCB.EC0", &handle)? EC0 is a acpi device HID:PNP0C09. Then passing NULL explicitly avoid confusion, IMO. > > > > + args[0].integer.value = 0; > > > > + args[2].integer.value = on ? 1 : 0; > > > > + } else if (acpi_has_method(handle, method = > > > > "\\_SB.PCI0.LPCB.EC0.WPIN")) { > > > > + args[0].integer.value = 1; > > > > + args[2].integer.value = on ? 0 : 1; > > > > + } else { > > > > + dev_err(&inputdev->dev, "Unable to find ACPI > > > > method\n"); > > > > + return -ENOSYS; > > > > + } > > > > > > Can these checks be done at initialization phase? It doesn't seem > > > needed to be executed at each call. > > > > Agree. > > > > Even if it was done in init phase, we still need to check what acpi > method should be used and based on that and micmute status we set the > arguments args[0] and args[2], args[1] is the pin value. We could check > these using event_guid, but that would assume the methods exist for > each guid. > For example, if event_guid == MBX_EVENT_GUID, then method SPIN should > be used. Hmm, I can't read it from your patch... Where is event_guid checked in huawei_wmi_mucmute_led_set()? I thought it checks only acpi_has_method(). thanks, Takashi