Skip to content

Commit e527a61

Browse files
Wer-Wolfjwrdegoede
authored andcommitted
platform/x86: toshiba_acpi: Fix quickstart quirk handling
The global hci_hotkey_quickstart quirk flag is tested in toshiba_acpi_enable_hotkeys() before the quirk flag is properly initialized based on SMBIOS data. This causes the quirk to be applied to all models, some of which behave erratically as a result. Fix this by initializing the global quirk flags during module initialization before registering the ACPI driver. This also allows us to mark toshiba_dmi_quirks[] as __initconst. Fixes: 23f1d8b ("platform/x86: toshiba_acpi: Add quirk for buttons on Z830") Reported-by: kemal <[email protected]> Closes: https://lore.kernel.org/platform-driver-x86/[email protected]/ Tested-by: kemal <[email protected]> Cc: [email protected] Signed-off-by: Armin Wolf <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 7add1ee commit e527a61

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

drivers/platform/x86/toshiba_acpi.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3271,7 +3271,7 @@ static const char *find_hci_method(acpi_handle handle)
32713271
*/
32723272
#define QUIRK_HCI_HOTKEY_QUICKSTART BIT(1)
32733273

3274-
static const struct dmi_system_id toshiba_dmi_quirks[] = {
3274+
static const struct dmi_system_id toshiba_dmi_quirks[] __initconst = {
32753275
{
32763276
/* Toshiba Portégé R700 */
32773277
/* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */
@@ -3306,8 +3306,6 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
33063306
struct toshiba_acpi_dev *dev;
33073307
const char *hci_method;
33083308
u32 dummy;
3309-
const struct dmi_system_id *dmi_id;
3310-
long quirks = 0;
33113309
int ret = 0;
33123310

33133311
if (toshiba_acpi)
@@ -3460,16 +3458,6 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
34603458
}
34613459
#endif
34623460

3463-
dmi_id = dmi_first_match(toshiba_dmi_quirks);
3464-
if (dmi_id)
3465-
quirks = (long)dmi_id->driver_data;
3466-
3467-
if (turn_on_panel_on_resume == -1)
3468-
turn_on_panel_on_resume = !!(quirks & QUIRK_TURN_ON_PANEL_ON_RESUME);
3469-
3470-
if (hci_hotkey_quickstart == -1)
3471-
hci_hotkey_quickstart = !!(quirks & QUIRK_HCI_HOTKEY_QUICKSTART);
3472-
34733461
toshiba_wwan_available(dev);
34743462
if (dev->wwan_supported)
34753463
toshiba_acpi_setup_wwan_rfkill(dev);
@@ -3618,10 +3606,27 @@ static struct acpi_driver toshiba_acpi_driver = {
36183606
.drv.pm = &toshiba_acpi_pm,
36193607
};
36203608

3609+
static void __init toshiba_dmi_init(void)
3610+
{
3611+
const struct dmi_system_id *dmi_id;
3612+
long quirks = 0;
3613+
3614+
dmi_id = dmi_first_match(toshiba_dmi_quirks);
3615+
if (dmi_id)
3616+
quirks = (long)dmi_id->driver_data;
3617+
3618+
if (turn_on_panel_on_resume == -1)
3619+
turn_on_panel_on_resume = !!(quirks & QUIRK_TURN_ON_PANEL_ON_RESUME);
3620+
3621+
if (hci_hotkey_quickstart == -1)
3622+
hci_hotkey_quickstart = !!(quirks & QUIRK_HCI_HOTKEY_QUICKSTART);
3623+
}
3624+
36213625
static int __init toshiba_acpi_init(void)
36223626
{
36233627
int ret;
36243628

3629+
toshiba_dmi_init();
36253630
toshiba_proc_dir = proc_mkdir(PROC_TOSHIBA, acpi_root_dir);
36263631
if (!toshiba_proc_dir) {
36273632
pr_err("Unable to create proc dir " PROC_TOSHIBA "\n");

0 commit comments

Comments
 (0)