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_HELO_NONE,SPF_PASS autolearn=no 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 69785C49ED7 for ; Fri, 20 Sep 2019 07:29:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A38E208C0 for ; Fri, 20 Sep 2019 07:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395033AbfITH3N (ORCPT ); Fri, 20 Sep 2019 03:29:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:48034 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390633AbfITH3N (ORCPT ); Fri, 20 Sep 2019 03:29:13 -0400 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 DEAC0AFB7; Fri, 20 Sep 2019 07:29:09 +0000 (UTC) Date: Fri, 20 Sep 2019 09:29:06 +0200 Message-ID: From: Takashi Iwai To: Hans de Goede Cc: Greg Kroah-Hartman , Ayman Bagabas , Darren Hart , Andy Shevchenko , Mauro Carvalho Chehab , Sinan Kaya , "Rafael J. Wysocki" , Stuart Hayes , Matan Ziv-Av , "Enrico Weigelt, metux IT consult" , Peng Hao , Krzysztof Kozlowski , Mattias Jacobsson <2pi@mok.nu>, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/6] platform/x86: huawei-wmi: Add quirks and module parameters In-Reply-To: <30a363e5-5691-e008-e1e5-55936fa3cd92@redhat.com> References: <20190920003938.21617-1-ayman.bagabas@gmail.com> <20190920003938.21617-3-ayman.bagabas@gmail.com> <20190920060812.GB473898@kroah.com> <30a363e5-5691-e008-e1e5-55936fa3cd92@redhat.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/25.3 (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, 20 Sep 2019 09:24:08 +0200, Hans de Goede wrote: > > Hi, > > On 20-09-2019 08:08, Greg Kroah-Hartman wrote: > > On Thu, Sep 19, 2019 at 08:39:07PM -0400, Ayman Bagabas wrote: > >> Introduce quirks and module parameters. 3 quirks are added: > >> 1. Fixes reporting brightness keys twice since it's already handled by > >> acpi-video. > >> 2. Some models need a short delay when setting battery thresholds to > >> prevent a race condition when two processes read/write. (will be used later) > >> 3. Matebook X (2017) handles micmute led through the "legacy" interface > >> which is not currently implemented. Use ACPI EC method to control > >> this led. (will be used later) > >> > >> 2 module parameters are added to enable this short delay and/or report > >> brightness keys through this driver. > > > > module parameters are a pain to manage and handle over time. Is there > > any way you can "automatically" figure this out, or use a sysfs file > > instead? > > The patch also adds dmi matches to set the quirks, so the module params > are there to override those and/or to easily test which are the right options > with new modules. The normal / expected use-case for everything to be set > automatically based on the DMI table. > > With that said, the module-params should really always override the dmi values, > so I would like to suggest to make the module-params int-s instead of bool-s > and to do something like this: > > static int battery_reset = -1; > static int report_brightness = -1; > > quirks = &quirk_unknown; > dmi_check_system(huawei_quirks); > /* If set the module options override the vale from the DMI table */ > if (battery_reset != -1) > quirks->battery_reset = battery_reset; > if (report_brightness != -1) > quirks->report_brightness = report_brightness; ... and use "bint" for module_param() type. thanks, Takashi