Skip to content

Commit c25d7f3

Browse files
superm1jwrdegoede
authored andcommitted
platform/x86: thinkpad_acpi: Convert btusb DMI list to quirks
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 <mario.limonciello@amd.com> Tested-by: Mark Pearson <markpearson@lenvo.com> Link: https://lore.kernel.org/r/20220429030501.1909-2-mario.limonciello@amd.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent eb2fd9b commit c25d7f3

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,15 @@ struct ibm_init_struct {
309309
struct ibm_struct *data;
310310
};
311311

312+
/* DMI Quirks */
313+
struct quirk_entry {
314+
bool btusb_bug;
315+
};
316+
317+
static struct quirk_entry quirk_btusb_bug = {
318+
.btusb_bug = true,
319+
};
320+
312321
static struct {
313322
u32 bluetooth:1;
314323
u32 hotkey:1;
@@ -338,6 +347,7 @@ static struct {
338347
u32 hotkey_poll_active:1;
339348
u32 has_adaptive_kbd:1;
340349
u32 kbd_lang:1;
350+
struct quirk_entry *quirks;
341351
} tp_features;
342352

343353
static struct {
@@ -4359,44 +4369,50 @@ static void bluetooth_exit(void)
43594369
bluetooth_shutdown();
43604370
}
43614371

4362-
static const struct dmi_system_id bt_fwbug_list[] __initconst = {
4372+
static const struct dmi_system_id fwbug_list[] __initconst = {
43634373
{
43644374
.ident = "ThinkPad E485",
4375+
.driver_data = &quirk_btusb_bug,
43654376
.matches = {
43664377
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
43674378
DMI_MATCH(DMI_BOARD_NAME, "20KU"),
43684379
},
43694380
},
43704381
{
43714382
.ident = "ThinkPad E585",
4383+
.driver_data = &quirk_btusb_bug,
43724384
.matches = {
43734385
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
43744386
DMI_MATCH(DMI_BOARD_NAME, "20KV"),
43754387
},
43764388
},
43774389
{
43784390
.ident = "ThinkPad A285 - 20MW",
4391+
.driver_data = &quirk_btusb_bug,
43794392
.matches = {
43804393
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
43814394
DMI_MATCH(DMI_BOARD_NAME, "20MW"),
43824395
},
43834396
},
43844397
{
43854398
.ident = "ThinkPad A285 - 20MX",
4399+
.driver_data = &quirk_btusb_bug,
43864400
.matches = {
43874401
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
43884402
DMI_MATCH(DMI_BOARD_NAME, "20MX"),
43894403
},
43904404
},
43914405
{
43924406
.ident = "ThinkPad A485 - 20MU",
4407+
.driver_data = &quirk_btusb_bug,
43934408
.matches = {
43944409
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
43954410
DMI_MATCH(DMI_BOARD_NAME, "20MU"),
43964411
},
43974412
},
43984413
{
43994414
.ident = "ThinkPad A485 - 20MV",
4415+
.driver_data = &quirk_btusb_bug,
44004416
.matches = {
44014417
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
44024418
DMI_MATCH(DMI_BOARD_NAME, "20MV"),
@@ -4419,7 +4435,8 @@ static int __init have_bt_fwbug(void)
44194435
* Some AMD based ThinkPads have a firmware bug that calling
44204436
* "GBDC" will cause bluetooth on Intel wireless cards blocked
44214437
*/
4422-
if (dmi_check_system(bt_fwbug_list) && pci_dev_present(fwbug_cards_ids)) {
4438+
if (tp_features.quirks && tp_features.quirks->btusb_bug &&
4439+
pci_dev_present(fwbug_cards_ids)) {
44234440
vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,
44244441
FW_BUG "disable bluetooth subdriver for Intel cards\n");
44254442
return 1;
@@ -11496,6 +11513,7 @@ static void thinkpad_acpi_module_exit(void)
1149611513

1149711514
static int __init thinkpad_acpi_module_init(void)
1149811515
{
11516+
const struct dmi_system_id *dmi_id;
1149911517
int ret, i;
1150011518

1150111519
tpacpi_lifecycle = TPACPI_LIFE_INIT;
@@ -11535,6 +11553,10 @@ static int __init thinkpad_acpi_module_init(void)
1153511553
return -ENODEV;
1153611554
}
1153711555

11556+
dmi_id = dmi_first_match(fwbug_list);
11557+
if (dmi_id)
11558+
tp_features.quirks = dmi_id->driver_data;
11559+
1153811560
/* Device initialization */
1153911561
tpacpi_pdev = platform_device_register_simple(TPACPI_DRVR_NAME, -1,
1154011562
NULL, 0);

0 commit comments

Comments
 (0)