Skip to content

Commit 86bfd21

Browse files
committed
ACPI: battery: Drop redundant locking
All of the evaluations of objects in the ACPI namespace are carried out under the namespace lock and interpreter lock in ACPICA, so it is not necessary to put any additional locks around them for synchronization. However, the ACPI battery driver does just that, so remove the redundant locking around ACPI object evaluation from it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/2344462.iZASKD2KPV@rafael.j.wysocki
1 parent dcb6fa3 commit 86bfd21

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

drivers/acpi/battery.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ enum {
9191
};
9292

9393
struct acpi_battery {
94-
struct mutex lock;
9594
struct mutex update_lock;
9695
struct power_supply *bat;
9796
struct power_supply_desc bat_desc;
@@ -535,11 +534,9 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
535534
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
536535
acpi_status status = AE_ERROR;
537536

538-
mutex_lock(&battery->lock);
539537
status = acpi_evaluate_object(battery->device->handle,
540538
use_bix ? "_BIX":"_BIF",
541539
NULL, &buffer);
542-
mutex_unlock(&battery->lock);
543540

544541
if (ACPI_FAILURE(status)) {
545542
acpi_handle_info(battery->device->handle,
@@ -576,11 +573,8 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
576573
msecs_to_jiffies(cache_time)))
577574
return 0;
578575

579-
mutex_lock(&battery->lock);
580576
status = acpi_evaluate_object(battery->device->handle, "_BST",
581577
NULL, &buffer);
582-
mutex_unlock(&battery->lock);
583-
584578
if (ACPI_FAILURE(status)) {
585579
acpi_handle_info(battery->device->handle,
586580
"_BST evaluation failed: %s",
@@ -628,11 +622,8 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery)
628622
!test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags))
629623
return -ENODEV;
630624

631-
mutex_lock(&battery->lock);
632625
status = acpi_execute_simple_method(battery->device->handle, "_BTP",
633626
battery->alarm);
634-
mutex_unlock(&battery->lock);
635-
636627
if (ACPI_FAILURE(status))
637628
return -ENODEV;
638629

@@ -1235,9 +1226,6 @@ static int acpi_battery_add(struct acpi_device *device)
12351226
strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
12361227
strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
12371228
device->driver_data = battery;
1238-
result = devm_mutex_init(&device->dev, &battery->lock);
1239-
if (result)
1240-
return result;
12411229

12421230
result = devm_mutex_init(&device->dev, &battery->update_lock);
12431231
if (result)

0 commit comments

Comments
 (0)