diff options
author | Armin Wolf <W_Armin@gmx.de> | 2022-09-27 23:45:20 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2022-11-16 10:48:18 +0300 |
commit | 878a82c23469d6626b27b44ade4d8f9438de51ab (patch) | |
tree | e52d1ee76a9bb179bcc0f1734559274c25c398d5 /drivers/platform/x86/huawei-wmi.c | |
parent | 19c8b5241425948daeb0f91fe7a07cf1a4b76239 (diff) | |
download | linux-878a82c23469d6626b27b44ade4d8f9438de51ab.tar.xz |
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/huawei-wmi.c')
-rw-r--r-- | drivers/platform/x86/huawei-wmi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c index 5873c2663a65..415ccb3a95de 100644 --- a/drivers/platform/x86/huawei-wmi.c +++ b/drivers/platform/x86/huawei-wmi.c @@ -468,7 +468,7 @@ static DEVICE_ATTR_RW(charge_control_start_threshold); static DEVICE_ATTR_RW(charge_control_end_threshold); static DEVICE_ATTR_RW(charge_control_thresholds); -static int huawei_wmi_battery_add(struct power_supply *battery) +static int huawei_wmi_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook) { int err = 0; @@ -483,7 +483,7 @@ static int huawei_wmi_battery_add(struct power_supply *battery) return err; } -static int huawei_wmi_battery_remove(struct power_supply *battery) +static int huawei_wmi_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook) { device_remove_file(&battery->dev, &dev_attr_charge_control_start_threshold); device_remove_file(&battery->dev, &dev_attr_charge_control_end_threshold); |