ACPI: SBS: Fix retval warning
drivers/acpi/sbs.c: In function acpi_battery_add: drivers/acpi/sbs.c:811: warning: ignoring return value of device_create_file, declared with attribute warn_unused_result Additional cleanups: * use struct acpi_battery in acpi_battery_remove() to clean up function calls, just like acpi_battery_add() already does. * put braces around unregister call, as it depends on dev being not NULL. * remove unneeded braces Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
4c41d3ad65
commit
037cbc63fd
1 changed files with 17 additions and 8 deletions
|
@ -113,6 +113,7 @@ struct acpi_battery {
|
||||||
u16 spec;
|
u16 spec;
|
||||||
u8 id;
|
u8 id;
|
||||||
u8 present:1;
|
u8 present:1;
|
||||||
|
u8 have_sysfs_alarm:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
|
#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
|
||||||
|
@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
|
||||||
}
|
}
|
||||||
battery->bat.get_property = acpi_sbs_battery_get_property;
|
battery->bat.get_property = acpi_sbs_battery_get_property;
|
||||||
result = power_supply_register(&sbs->device->dev, &battery->bat);
|
result = power_supply_register(&sbs->device->dev, &battery->bat);
|
||||||
device_create_file(battery->bat.dev, &alarm_attr);
|
if (result)
|
||||||
|
goto end;
|
||||||
|
result = device_create_file(battery->bat.dev, &alarm_attr);
|
||||||
|
if (result)
|
||||||
|
goto end;
|
||||||
|
battery->have_sysfs_alarm = 1;
|
||||||
|
end:
|
||||||
printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
|
printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
|
||||||
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
|
ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
|
||||||
battery->name, sbs->battery->present ? "present" : "absent");
|
battery->name, sbs->battery->present ? "present" : "absent");
|
||||||
|
@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
|
||||||
|
|
||||||
static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
|
static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
|
||||||
{
|
{
|
||||||
if (sbs->battery[id].bat.dev)
|
struct acpi_battery *battery = &sbs->battery[id];
|
||||||
device_remove_file(sbs->battery[id].bat.dev, &alarm_attr);
|
|
||||||
power_supply_unregister(&sbs->battery[id].bat);
|
if (battery->bat.dev) {
|
||||||
#ifdef CONFIG_ACPI_PROCFS
|
if (battery->have_sysfs_alarm)
|
||||||
if (sbs->battery[id].proc_entry) {
|
device_remove_file(battery->bat.dev, &alarm_attr);
|
||||||
acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry),
|
power_supply_unregister(&battery->bat);
|
||||||
acpi_battery_dir);
|
|
||||||
}
|
}
|
||||||
|
#ifdef CONFIG_ACPI_PROCFS
|
||||||
|
if (battery->proc_entry)
|
||||||
|
acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue