diff options
author | Armin Wolf <W_Armin@gmx.de> | 2022-09-27 22:45:20 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2022-11-16 08:48:18 +0100 |
commit | 878a82c23469d6626b27b44ade4d8f9438de51ab (patch) | |
tree | e52d1ee76a9bb179bcc0f1734559274c25c398d5 /drivers/platform/x86/asus-wmi.c | |
parent | platform/x86/amd/pmf: pass the struct by reference (diff) | |
download | linux-878a82c23469d6626b27b44ade4d8f9438de51ab.tar.xz linux-878a82c23469d6626b27b44ade4d8f9438de51ab.zip |
ACPI: battery: Pass battery hook pointer to hook callbacks
Right now, is impossible for battery hook callbacks
to access instance-specific data, forcing most drivers
to provide some sort of global state. This however is
difficult for drivers which can be instantiated multiple
times and/or are hotplug-capable.
Pass a pointer to the battery hook to those callbacks
for usage with container_of().
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20220927204521.601887-2-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 872efc1d5b36..6f81b2844dcb 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -883,7 +883,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device, static DEVICE_ATTR_RW(charge_control_end_threshold); -static int asus_wmi_battery_add(struct power_supply *battery) +static int asus_wmi_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook) { /* The WMI method does not provide a way to specific a battery, so we * just assume it is the first battery. @@ -910,7 +910,7 @@ static int asus_wmi_battery_add(struct power_supply *battery) return 0; } -static int asus_wmi_battery_remove(struct power_supply *battery) +static int asus_wmi_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook) { device_remove_file(&battery->dev, &dev_attr_charge_control_end_threshold); |