Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3679675lfo; Mon, 23 May 2022 11:12:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/62sebePYTUp9JJxi1h9O7Ju7JWkAGqyWr6IpxDlr+jPi+fWWnBXb4LtwQnQ3+O/8g9IX X-Received: by 2002:a17:90a:7041:b0:1df:cc3a:10e2 with SMTP id f59-20020a17090a704100b001dfcc3a10e2mr279904pjk.48.1653329542749; Mon, 23 May 2022 11:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653329542; cv=none; d=google.com; s=arc-20160816; b=pKYPsKNtTkZft8KkavXH1ETEOjRV0TMwIGuOOeorTmji+3VhMHN22hui2HzU5V+hVh E7E5PshCw3k9M7M1Dspj4hI86AzFqIFR980TFfofK+FQ9lLuRXbKP1QdX2SujAT+LTm5 S5U0q8nPTQ9dzGcwNlD8t/bKQjeTxpO9fsrIGm0/VFCCWkwViaeRIVWt657zVtJK/5xG uYzJWnsGPpeGE002i5WzfFMAMy8NlDf4ssBS9GEKvxZRNctA7JCU87uxc6vRfHV5d1Kt emyyWyjCyQY8FmX+WytMf/7Tkm9P1VcTPSbq2gWxebY/HLUKiYbz/v7K078Jb4WhJGA2 48Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AqyvsSlC23k+pELcUKo/9rQ27751U2zakHv9C+i0S0E=; b=hsbGy2mAkcvTdWzvAjehgMw2RZkMYlSfEukBQZa177KpG4jSkdhIe8ZScm5oU4MlzM OyJxjI8m2mznPl71V+TL/EJU9B3cv0JwCgeNI3uD1Gn7zoH/yjBZ7x3EEgijpgQRJROy r2L/aMjuCdbui3mChHkUgaXaOtQcJKY+ONXCb4m7r0qhOuZiuPFjUWacIQZ5rrDOvN/w enVHkhl8AAx1gdisfJ+TOO3aUUzeONb5XdZHF37vZiZYAEK/1wQKHAH6gRIM9Dtb7UvE Rui0Lz54jS73mTXu92tIDtTuuolkti+D+TCFScSrglBoLaH7vy9p2419TNRw0UVur1hi bC+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRnqyKuu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bm28-20020a656e9c000000b003990b9576f5si10237366pgb.425.2022.05.23.11.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HRnqyKuu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 47CB466221; Mon, 23 May 2022 11:10:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245636AbiEWSIG (ORCPT + 99 others); Mon, 23 May 2022 14:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243722AbiEWRiZ (ORCPT ); Mon, 23 May 2022 13:38:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11F4294183; Mon, 23 May 2022 10:32:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 95DEC611E3; Mon, 23 May 2022 17:32:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9561DC385AA; Mon, 23 May 2022 17:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653327131; bh=y1xog3J27YTwN0A9xZLgHTReF4/FxWbtCjlVdhy8QJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HRnqyKuurbJcvW1RXd5CTC+xtuukQNksB9OzP5ii0PvbyniI+msq8GzEYWp1wXMCO BMz1WzAvVEhZxc3++VlChmWXU0vOUFS/qdBOBQpK4V6fMwHhact82sfB+BCAG5N244 Me47EMjLNhvg/HVX1Bn0yBHFSh7jsvbB5YmtWcRk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mark Pearson , Hans de Goede , Sasha Levin Subject: [PATCH 5.17 141/158] platform/x86: thinkpad_acpi: Convert btusb DMI list to quirks Date: Mon, 23 May 2022 19:04:58 +0200 Message-Id: <20220523165853.667469365@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165830.581652127@linuxfoundation.org> References: <20220523165830.581652127@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mario Limonciello [ Upstream commit c25d7f32e3e209462cd82e6e93e66b72dbb2308f ] DMI matching in thinkpad_acpi happens local to a function meaning quirks can only match that function. Future changes to thinkpad_acpi may need to quirk other code, so change this to use a quirk infrastructure. Signed-off-by: Mario Limonciello Tested-by: Mark Pearson Link: https://lore.kernel.org/r/20220429030501.1909-2-mario.limonciello@amd.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin --- drivers/platform/x86/thinkpad_acpi.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3fb8cda31eb9..c43586f1cb4b 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -309,6 +309,15 @@ struct ibm_init_struct { struct ibm_struct *data; }; +/* DMI Quirks */ +struct quirk_entry { + bool btusb_bug; +}; + +static struct quirk_entry quirk_btusb_bug = { + .btusb_bug = true, +}; + static struct { u32 bluetooth:1; u32 hotkey:1; @@ -338,6 +347,7 @@ static struct { u32 hotkey_poll_active:1; u32 has_adaptive_kbd:1; u32 kbd_lang:1; + struct quirk_entry *quirks; } tp_features; static struct { @@ -4361,9 +4371,10 @@ static void bluetooth_exit(void) bluetooth_shutdown(); } -static const struct dmi_system_id bt_fwbug_list[] __initconst = { +static const struct dmi_system_id fwbug_list[] __initconst = { { .ident = "ThinkPad E485", + .driver_data = &quirk_btusb_bug, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_BOARD_NAME, "20KU"), @@ -4371,6 +4382,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { }, { .ident = "ThinkPad E585", + .driver_data = &quirk_btusb_bug, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_BOARD_NAME, "20KV"), @@ -4378,6 +4390,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { }, { .ident = "ThinkPad A285 - 20MW", + .driver_data = &quirk_btusb_bug, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_BOARD_NAME, "20MW"), @@ -4385,6 +4398,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { }, { .ident = "ThinkPad A285 - 20MX", + .driver_data = &quirk_btusb_bug, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_BOARD_NAME, "20MX"), @@ -4392,6 +4406,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { }, { .ident = "ThinkPad A485 - 20MU", + .driver_data = &quirk_btusb_bug, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_BOARD_NAME, "20MU"), @@ -4399,6 +4414,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { }, { .ident = "ThinkPad A485 - 20MV", + .driver_data = &quirk_btusb_bug, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_BOARD_NAME, "20MV"), @@ -4421,7 +4437,8 @@ static int __init have_bt_fwbug(void) * Some AMD based ThinkPads have a firmware bug that calling * "GBDC" will cause bluetooth on Intel wireless cards blocked */ - if (dmi_check_system(bt_fwbug_list) && pci_dev_present(fwbug_cards_ids)) { + if (tp_features.quirks && tp_features.quirks->btusb_bug && + pci_dev_present(fwbug_cards_ids)) { vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, FW_BUG "disable bluetooth subdriver for Intel cards\n"); return 1; @@ -11438,6 +11455,7 @@ static void thinkpad_acpi_module_exit(void) static int __init thinkpad_acpi_module_init(void) { + const struct dmi_system_id *dmi_id; int ret, i; tpacpi_lifecycle = TPACPI_LIFE_INIT; @@ -11477,6 +11495,10 @@ static int __init thinkpad_acpi_module_init(void) return -ENODEV; } + dmi_id = dmi_first_match(fwbug_list); + if (dmi_id) + tp_features.quirks = dmi_id->driver_data; + /* Device initialization */ tpacpi_pdev = platform_device_register_simple(TPACPI_DRVR_NAME, -1, NULL, 0); -- 2.35.1