Skip to content

Commit e1043b6

Browse files
committed
Merge tag 'acpi-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki: "These fix up the ACPI IRQ override quirk list and add two new entries to it, add a new quirk to the ACPI backlight (video) driver, and fix the ACPI battery driver. Specifics: - Add a quirk for Dell OptiPlex 5480 AIO to the ACPI backlight (video) driver (Hans de Goede) - Prevent the ACPI battery driver from crashing when unregistering a battery hook and simplify battery hook locking in it (Armin Wolf) - Fix up the ACPI IRQ override quirk list and add quirks for Asus Vivobook X1704VAP and Asus ExpertBook B2502CVA to it (Hans de Goede)" * tag 'acpi-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: battery: Fix possible crash when unregistering a battery hook ACPI: battery: Simplify battery hook locking ACPI: video: Add backlight=native quirk for Dell OptiPlex 5480 AIO ACPI: resource: Add Asus ExpertBook B2502CVA to irq1_level_low_skip_override[] ACPI: resource: Add Asus Vivobook X1704VAP to irq1_level_low_skip_override[] ACPI: resource: Loosen the Asus E1404GAB DMI match to also cover the E1404GA ACPI: resource: Remove duplicate Asus E1504GAB IRQ override
2 parents 5d18081 + 3be5c17 commit e1043b6

File tree

3 files changed

+39
-17
lines changed

3 files changed

+39
-17
lines changed

drivers/acpi/battery.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -703,28 +703,35 @@ static LIST_HEAD(acpi_battery_list);
703703
static LIST_HEAD(battery_hook_list);
704704
static DEFINE_MUTEX(hook_mutex);
705705

706-
static void __battery_hook_unregister(struct acpi_battery_hook *hook, int lock)
706+
static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
707707
{
708708
struct acpi_battery *battery;
709+
709710
/*
710711
* In order to remove a hook, we first need to
711712
* de-register all the batteries that are registered.
712713
*/
713-
if (lock)
714-
mutex_lock(&hook_mutex);
715714
list_for_each_entry(battery, &acpi_battery_list, list) {
716715
if (!hook->remove_battery(battery->bat, hook))
717716
power_supply_changed(battery->bat);
718717
}
719-
list_del(&hook->list);
720-
if (lock)
721-
mutex_unlock(&hook_mutex);
718+
list_del_init(&hook->list);
719+
722720
pr_info("extension unregistered: %s\n", hook->name);
723721
}
724722

725723
void battery_hook_unregister(struct acpi_battery_hook *hook)
726724
{
727-
__battery_hook_unregister(hook, 1);
725+
mutex_lock(&hook_mutex);
726+
/*
727+
* Ignore already unregistered battery hooks. This might happen
728+
* if a battery hook was previously unloaded due to an error when
729+
* adding a new battery.
730+
*/
731+
if (!list_empty(&hook->list))
732+
battery_hook_unregister_unlocked(hook);
733+
734+
mutex_unlock(&hook_mutex);
728735
}
729736
EXPORT_SYMBOL_GPL(battery_hook_unregister);
730737

@@ -733,7 +740,6 @@ void battery_hook_register(struct acpi_battery_hook *hook)
733740
struct acpi_battery *battery;
734741

735742
mutex_lock(&hook_mutex);
736-
INIT_LIST_HEAD(&hook->list);
737743
list_add(&hook->list, &battery_hook_list);
738744
/*
739745
* Now that the driver is registered, we need
@@ -750,7 +756,7 @@ void battery_hook_register(struct acpi_battery_hook *hook)
750756
* hooks.
751757
*/
752758
pr_err("extension failed to load: %s", hook->name);
753-
__battery_hook_unregister(hook, 0);
759+
battery_hook_unregister_unlocked(hook);
754760
goto end;
755761
}
756762

@@ -804,7 +810,7 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
804810
*/
805811
pr_err("error in extension, unloading: %s",
806812
hook_node->name);
807-
__battery_hook_unregister(hook_node, 0);
813+
battery_hook_unregister_unlocked(hook_node);
808814
}
809815
}
810816
mutex_unlock(&hook_mutex);
@@ -837,7 +843,7 @@ static void __exit battery_hook_exit(void)
837843
* need to remove the hooks.
838844
*/
839845
list_for_each_entry_safe(hook, ptr, &battery_hook_list, list) {
840-
__battery_hook_unregister(hook, 1);
846+
battery_hook_unregister(hook);
841847
}
842848
mutex_destroy(&hook_mutex);
843849
}

drivers/acpi/resource.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,13 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
440440
DMI_MATCH(DMI_BOARD_NAME, "S5602ZA"),
441441
},
442442
},
443+
{
444+
/* Asus Vivobook X1704VAP */
445+
.matches = {
446+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
447+
DMI_MATCH(DMI_BOARD_NAME, "X1704VAP"),
448+
},
449+
},
443450
{
444451
/* Asus ExpertBook B1402CBA */
445452
.matches = {
@@ -504,24 +511,24 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = {
504511
},
505512
},
506513
{
507-
/* Asus Vivobook Go E1404GAB */
514+
/* Asus ExpertBook B2502CVA */
508515
.matches = {
509516
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
510-
DMI_MATCH(DMI_BOARD_NAME, "E1404GAB"),
517+
DMI_MATCH(DMI_BOARD_NAME, "B2502CVA"),
511518
},
512519
},
513520
{
514-
/* Asus Vivobook E1504GA */
521+
/* Asus Vivobook Go E1404GA* */
515522
.matches = {
516523
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
517-
DMI_MATCH(DMI_BOARD_NAME, "E1504GA"),
524+
DMI_MATCH(DMI_BOARD_NAME, "E1404GA"),
518525
},
519526
},
520527
{
521-
/* Asus Vivobook E1504GAB */
528+
/* Asus Vivobook E1504GA* */
522529
.matches = {
523530
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
524-
DMI_MATCH(DMI_BOARD_NAME, "E1504GAB"),
531+
DMI_MATCH(DMI_BOARD_NAME, "E1504GA"),
525532
},
526533
},
527534
{

drivers/acpi/video_detect.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,15 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
844844
* controller board in their ACPI tables (and may even have one), but
845845
* which need native backlight control nevertheless.
846846
*/
847+
{
848+
/* https://github.com/zabbly/linux/issues/26 */
849+
.callback = video_detect_force_native,
850+
/* Dell OptiPlex 5480 AIO */
851+
.matches = {
852+
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
853+
DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 5480 AIO"),
854+
},
855+
},
847856
{
848857
/* https://bugzilla.redhat.com/show_bug.cgi?id=2303936 */
849858
.callback = video_detect_force_native,

0 commit comments

Comments
 (0)