Commit b6237f61 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'acpi-misc'

* acpi-misc:
  ACPI: dock: fix some coding style issues
  ACPI: sysfs: fix some coding style issues
  ACPI: PM: add a missed blank line after declarations
  ACPI: custom_method: fix a coding style issue
  ACPI: CPPC: fix some coding style issues
  ACPI: button: fix some coding style issues
  ACPI: battery: fix some coding style issues
  ACPI: acpi_pad: add a missed blank line after declarations
  ACPI: LPSS: add a missed blank line after declarations
  ACPI: ipmi: remove useless return statement for void function
  ACPI: processor: fix some coding style issues
  ACPI: APD: fix a block comment align issue
  ACPI: AC: fix some coding style issues
  ACPI: fix various typos in comments
parents aad659e4 6ee4bdc2
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
/* /*
* acpi_ac.c - ACPI AC Adapter Driver ($Revision: 27 $) * acpi_ac.c - ACPI AC Adapter Driver (Revision: 27)
* *
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
...@@ -78,17 +78,14 @@ static struct acpi_driver acpi_ac_driver = { ...@@ -78,17 +78,14 @@ static struct acpi_driver acpi_ac_driver = {
struct acpi_ac { struct acpi_ac {
struct power_supply *charger; struct power_supply *charger;
struct power_supply_desc charger_desc; struct power_supply_desc charger_desc;
struct acpi_device * device; struct acpi_device *device;
unsigned long long state; unsigned long long state;
struct notifier_block battery_nb; struct notifier_block battery_nb;
}; };
#define to_acpi_ac(x) power_supply_get_drvdata(x) #define to_acpi_ac(x) power_supply_get_drvdata(x)
/* -------------------------------------------------------------------------- /* AC Adapter Management */
AC Adapter Management
-------------------------------------------------------------------------- */
static int acpi_ac_get_state(struct acpi_ac *ac) static int acpi_ac_get_state(struct acpi_ac *ac)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
...@@ -109,9 +106,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) ...@@ -109,9 +106,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
return 0; return 0;
} }
/* -------------------------------------------------------------------------- /* sysfs I/F */
sysfs I/F
-------------------------------------------------------------------------- */
static int get_ac_property(struct power_supply *psy, static int get_ac_property(struct power_supply *psy,
enum power_supply_property psp, enum power_supply_property psp,
union power_supply_propval *val) union power_supply_propval *val)
...@@ -138,10 +133,7 @@ static enum power_supply_property ac_props[] = { ...@@ -138,10 +133,7 @@ static enum power_supply_property ac_props[] = {
POWER_SUPPLY_PROP_ONLINE, POWER_SUPPLY_PROP_ONLINE,
}; };
/* -------------------------------------------------------------------------- /* Driver Model */
Driver Model
-------------------------------------------------------------------------- */
static void acpi_ac_notify(struct acpi_device *device, u32 event) static void acpi_ac_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_ac *ac = acpi_driver_data(device); struct acpi_ac *ac = acpi_driver_data(device);
...@@ -174,8 +166,6 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event) ...@@ -174,8 +166,6 @@ static void acpi_ac_notify(struct acpi_device *device, u32 event)
acpi_notifier_call_chain(device, event, (u32) ac->state); acpi_notifier_call_chain(device, event, (u32) ac->state);
kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE); kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
} }
return;
} }
static int acpi_ac_battery_notify(struct notifier_block *nb, static int acpi_ac_battery_notify(struct notifier_block *nb,
...@@ -187,7 +177,7 @@ static int acpi_ac_battery_notify(struct notifier_block *nb, ...@@ -187,7 +177,7 @@ static int acpi_ac_battery_notify(struct notifier_block *nb,
/* /*
* On HP Pavilion dv6-6179er AC status notifications aren't triggered * On HP Pavilion dv6-6179er AC status notifications aren't triggered
* when adapter is plugged/unplugged. However, battery status * when adapter is plugged/unplugged. However, battery status
* notifcations are triggered when battery starts charging or * notifications are triggered when battery starts charging or
* discharging. Re-reading AC status triggers lost AC notifications, * discharging. Re-reading AC status triggers lost AC notifications,
* if AC status has changed. * if AC status has changed.
*/ */
...@@ -282,9 +272,8 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -282,9 +272,8 @@ static int acpi_ac_add(struct acpi_device *device)
ac->battery_nb.notifier_call = acpi_ac_battery_notify; ac->battery_nb.notifier_call = acpi_ac_battery_notify;
register_acpi_notifier(&ac->battery_nb); register_acpi_notifier(&ac->battery_nb);
end: end:
if (result) { if (result)
kfree(ac); kfree(ac);
}
return result; return result;
} }
...@@ -293,7 +282,7 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -293,7 +282,7 @@ static int acpi_ac_add(struct acpi_device *device)
static int acpi_ac_resume(struct device *dev) static int acpi_ac_resume(struct device *dev)
{ {
struct acpi_ac *ac; struct acpi_ac *ac;
unsigned old_state; unsigned int old_state;
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
...@@ -352,9 +341,8 @@ static int __init acpi_ac_init(void) ...@@ -352,9 +341,8 @@ static int __init acpi_ac_init(void)
} }
result = acpi_bus_register_driver(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) { if (result < 0)
return -ENODEV; return -ENODEV;
}
return 0; return 0;
} }
......
...@@ -176,10 +176,10 @@ static const struct apd_device_desc hip08_spi_desc = { ...@@ -176,10 +176,10 @@ static const struct apd_device_desc hip08_spi_desc = {
#endif #endif
/** /*
* Create platform device during acpi scan attach handle. * Create platform device during acpi scan attach handle.
* Return value > 0 on success of creating device. * Return value > 0 on success of creating device.
*/ */
static int acpi_apd_create_device(struct acpi_device *adev, static int acpi_apd_create_device(struct acpi_device *adev,
const struct acpi_device_id *id) const struct acpi_device_id *id)
{ {
......
...@@ -478,7 +478,6 @@ static void ipmi_register_bmc(int iface, struct device *dev) ...@@ -478,7 +478,6 @@ static void ipmi_register_bmc(int iface, struct device *dev)
ipmi_dev_release(ipmi_device); ipmi_dev_release(ipmi_device);
err_ref: err_ref:
put_device(smi_data.dev); put_device(smi_data.dev);
return;
} }
static void ipmi_bmc_gone(int iface) static void ipmi_bmc_gone(int iface)
......
...@@ -377,6 +377,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = { ...@@ -377,6 +377,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
static int is_memory(struct acpi_resource *res, void *not_used) static int is_memory(struct acpi_resource *res, void *not_used)
{ {
struct resource r; struct resource r;
return !acpi_dev_resource_memory(res, &r); return !acpi_dev_resource_memory(res, &r);
} }
...@@ -1200,6 +1201,7 @@ static int acpi_lpss_poweroff_noirq(struct device *dev) ...@@ -1200,6 +1201,7 @@ static int acpi_lpss_poweroff_noirq(struct device *dev)
if (pdata->dev_desc->resume_from_noirq) { if (pdata->dev_desc->resume_from_noirq) {
/* This is analogous to the acpi_lpss_suspend_noirq() case. */ /* This is analogous to the acpi_lpss_suspend_noirq() case. */
int ret = acpi_lpss_do_poweroff_late(dev); int ret = acpi_lpss_do_poweroff_late(dev);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -128,6 +128,7 @@ static void round_robin_cpu(unsigned int tsk_index) ...@@ -128,6 +128,7 @@ static void round_robin_cpu(unsigned int tsk_index)
static void exit_round_robin(unsigned int tsk_index) static void exit_round_robin(unsigned int tsk_index)
{ {
struct cpumask *pad_busy_cpus = to_cpumask(pad_busy_cpus_bits); struct cpumask *pad_busy_cpus = to_cpumask(pad_busy_cpus_bits);
cpumask_clear_cpu(tsk_in_cpu[tsk_index], pad_busy_cpus); cpumask_clear_cpu(tsk_in_cpu[tsk_index], pad_busy_cpus);
tsk_in_cpu[tsk_index] = -1; tsk_in_cpu[tsk_index] = -1;
} }
...@@ -265,6 +266,7 @@ static ssize_t rrtime_store(struct device *dev, ...@@ -265,6 +266,7 @@ static ssize_t rrtime_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
unsigned long num; unsigned long num;
if (kstrtoul(buf, 0, &num)) if (kstrtoul(buf, 0, &num))
return -EINVAL; return -EINVAL;
if (num < 1 || num >= 100) if (num < 1 || num >= 100)
...@@ -286,6 +288,7 @@ static ssize_t idlepct_store(struct device *dev, ...@@ -286,6 +288,7 @@ static ssize_t idlepct_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
unsigned long num; unsigned long num;
if (kstrtoul(buf, 0, &num)) if (kstrtoul(buf, 0, &num))
return -EINVAL; return -EINVAL;
if (num < 1 || num >= 100) if (num < 1 || num >= 100)
...@@ -307,6 +310,7 @@ static ssize_t idlecpus_store(struct device *dev, ...@@ -307,6 +310,7 @@ static ssize_t idlecpus_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
unsigned long num; unsigned long num;
if (kstrtoul(buf, 0, &num)) if (kstrtoul(buf, 0, &num))
return -EINVAL; return -EINVAL;
mutex_lock(&isolated_cpus_lock); mutex_lock(&isolated_cpus_lock);
......
...@@ -25,10 +25,7 @@ ...@@ -25,10 +25,7 @@
DEFINE_PER_CPU(struct acpi_processor *, processors); DEFINE_PER_CPU(struct acpi_processor *, processors);
EXPORT_PER_CPU_SYMBOL(processors); EXPORT_PER_CPU_SYMBOL(processors);
/* -------------------------------------------------------------------------- /* Errata Handling */
Errata Handling
-------------------------------------------------------------------------- */
struct acpi_processor_errata errata __read_mostly; struct acpi_processor_errata errata __read_mostly;
EXPORT_SYMBOL_GPL(errata); EXPORT_SYMBOL_GPL(errata);
...@@ -151,10 +148,7 @@ static int acpi_processor_errata(void) ...@@ -151,10 +148,7 @@ static int acpi_processor_errata(void)
return result; return result;
} }
/* -------------------------------------------------------------------------- /* Initialization */
Initialization
-------------------------------------------------------------------------- */
#ifdef CONFIG_ACPI_HOTPLUG_CPU #ifdef CONFIG_ACPI_HOTPLUG_CPU
int __weak acpi_map_cpu(acpi_handle handle, int __weak acpi_map_cpu(acpi_handle handle,
phys_cpuid_t physid, u32 acpi_id, int *pcpu) phys_cpuid_t physid, u32 acpi_id, int *pcpu)
...@@ -306,6 +300,7 @@ static int acpi_processor_get_info(struct acpi_device *device) ...@@ -306,6 +300,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
*/ */
if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) { if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) {
int ret = acpi_processor_hotadd_init(pr); int ret = acpi_processor_hotadd_init(pr);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -431,10 +426,7 @@ static int acpi_processor_add(struct acpi_device *device, ...@@ -431,10 +426,7 @@ static int acpi_processor_add(struct acpi_device *device,
} }
#ifdef CONFIG_ACPI_HOTPLUG_CPU #ifdef CONFIG_ACPI_HOTPLUG_CPU
/* -------------------------------------------------------------------------- /* Removal */
Removal
-------------------------------------------------------------------------- */
static void acpi_processor_remove(struct acpi_device *device) static void acpi_processor_remove(struct acpi_device *device)
{ {
struct acpi_processor *pr; struct acpi_processor *pr;
...@@ -892,7 +884,7 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu, ...@@ -892,7 +884,7 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
info->count = last_index; info->count = last_index;
end: end:
kfree(buffer.pointer); kfree(buffer.pointer);
return ret; return ret;
......
...@@ -1392,7 +1392,7 @@ acpi_video_get_next_level(struct acpi_video_device *device, ...@@ -1392,7 +1392,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
break; break;
} }
} }
/* Ajust level_current to closest available level */ /* Adjust level_current to closest available level */
level_current += delta; level_current += delta;
for (i = ACPI_VIDEO_FIRST_LEVEL; i < device->brightness->count; i++) { for (i = ACPI_VIDEO_FIRST_LEVEL; i < device->brightness->count; i++) {
l = device->brightness->levels[i]; l = device->brightness->levels[i];
...@@ -1555,7 +1555,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, ...@@ -1555,7 +1555,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video,
/* /*
* Win8 requires setting bit2 of _DOS to let firmware know it shouldn't * Win8 requires setting bit2 of _DOS to let firmware know it shouldn't
* preform any automatic brightness change on receiving a notification. * perform any automatic brightness change on receiving a notification.
*/ */
static int acpi_video_bus_start_devices(struct acpi_video_bus *video) static int acpi_video_bus_start_devices(struct acpi_video_bus *video)
{ {
......
...@@ -54,7 +54,7 @@ EXPORT_SYMBOL_GPL(erst_disable); ...@@ -54,7 +54,7 @@ EXPORT_SYMBOL_GPL(erst_disable);
static struct acpi_table_erst *erst_tab; static struct acpi_table_erst *erst_tab;
/* ERST Error Log Address Range atrributes */ /* ERST Error Log Address Range attributes */
#define ERST_RANGE_RESERVED 0x0001 #define ERST_RANGE_RESERVED 0x0001
#define ERST_RANGE_NVRAM 0x0002 #define ERST_RANGE_NVRAM 0x0002
#define ERST_RANGE_SLOW 0x0004 #define ERST_RANGE_SLOW 0x0004
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* APEI Hardware Error Souce Table support * APEI Hardware Error Source Table support
* *
* HEST describes error sources in detail; communicates operational * HEST describes error sources in detail; communicates operational
* parameters (i.e. severity levels, masking bits, and threshold * parameters (i.e. severity levels, masking bits, and threshold
......
...@@ -74,16 +74,17 @@ enum { ...@@ -74,16 +74,17 @@ enum {
ACPI_BATTERY_XINFO_PRESENT, ACPI_BATTERY_XINFO_PRESENT,
ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY,
/* On Lenovo Thinkpad models from 2010 and 2011, the power unit /* On Lenovo Thinkpad models from 2010 and 2011, the power unit
switches between mWh and mAh depending on whether the system * switches between mWh and mAh depending on whether the system
is running on battery or not. When mAh is the unit, most * is running on battery or not. When mAh is the unit, most
reported values are incorrect and need to be adjusted by * reported values are incorrect and need to be adjusted by
10000/design_voltage. Verified on x201, t410, t410s, and x220. * 10000/design_voltage. Verified on x201, t410, t410s, and x220.
Pre-2010 and 2012 models appear to always report in mWh and * Pre-2010 and 2012 models appear to always report in mWh and
are thus unaffected (tested with t42, t61, t500, x200, x300, * are thus unaffected (tested with t42, t61, t500, x200, x300,
and x230). Also, in mid-2012 Lenovo issued a BIOS update for * and x230). Also, in mid-2012 Lenovo issued a BIOS update for
the 2011 models that fixes the issue (tested on x220 with a * the 2011 models that fixes the issue (tested on x220 with a
post-1.29 BIOS), but as of Nov. 2012, no such update is * post-1.29 BIOS), but as of Nov. 2012, no such update is
available for the 2010 models. */ * available for the 2010 models.
*/
ACPI_BATTERY_QUIRK_THINKPAD_MAH, ACPI_BATTERY_QUIRK_THINKPAD_MAH,
/* for batteries reporting current capacity with design capacity /* for batteries reporting current capacity with design capacity
* on a full charge, but showing degradation in full charge cap. * on a full charge, but showing degradation in full charge cap.
...@@ -371,9 +372,7 @@ static enum power_supply_property energy_battery_full_cap_broken_props[] = { ...@@ -371,9 +372,7 @@ static enum power_supply_property energy_battery_full_cap_broken_props[] = {
POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_SERIAL_NUMBER,
}; };
/* -------------------------------------------------------------------------- /* Battery Management */
Battery Management
-------------------------------------------------------------------------- */
struct acpi_offsets { struct acpi_offsets {
size_t offset; /* offset inside struct acpi_sbs_battery */ size_t offset; /* offset inside struct acpi_sbs_battery */
u8 mode; /* int or string? */ u8 mode; /* int or string? */
...@@ -431,6 +430,7 @@ static int extract_package(struct acpi_battery *battery, ...@@ -431,6 +430,7 @@ static int extract_package(struct acpi_battery *battery,
{ {
int i; int i;
union acpi_object *element; union acpi_object *element;
if (package->type != ACPI_TYPE_PACKAGE) if (package->type != ACPI_TYPE_PACKAGE)
return -EFAULT; return -EFAULT;
for (i = 0; i < num; ++i) { for (i = 0; i < num; ++i) {
...@@ -439,6 +439,7 @@ static int extract_package(struct acpi_battery *battery, ...@@ -439,6 +439,7 @@ static int extract_package(struct acpi_battery *battery,
element = &package->package.elements[i]; element = &package->package.elements[i];
if (offsets[i].mode) { if (offsets[i].mode) {
u8 *ptr = (u8 *)battery + offsets[i].offset; u8 *ptr = (u8 *)battery + offsets[i].offset;
if (element->type == ACPI_TYPE_STRING || if (element->type == ACPI_TYPE_STRING ||
element->type == ACPI_TYPE_BUFFER) element->type == ACPI_TYPE_BUFFER)
strncpy(ptr, element->string.pointer, 32); strncpy(ptr, element->string.pointer, 32);
...@@ -497,10 +498,12 @@ static int extract_battery_info(const int use_bix, ...@@ -497,10 +498,12 @@ static int extract_battery_info(const int use_bix,
battery->design_capacity_warning * battery->design_capacity_warning *
10000 / battery->design_voltage; 10000 / battery->design_voltage;
/* Curiously, design_capacity_low, unlike the rest of them, /* Curiously, design_capacity_low, unlike the rest of them,
is correct. */ * is correct.
*/
/* capacity_granularity_* equal 1 on the systems tested, so /* capacity_granularity_* equal 1 on the systems tested, so
it's impossible to tell if they would need an adjustment * it's impossible to tell if they would need an adjustment
or not if their values were higher. */ * or not if their values were higher.
*/
} }
if (test_bit(ACPI_BATTERY_QUIRK_DEGRADED_FULL_CHARGE, &battery->flags) && if (test_bit(ACPI_BATTERY_QUIRK_DEGRADED_FULL_CHARGE, &battery->flags) &&
battery->capacity_now > battery->full_charge_capacity) battery->capacity_now > battery->full_charge_capacity)
...@@ -532,7 +535,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery) ...@@ -532,7 +535,7 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_handle_info(battery->device->handle, acpi_handle_info(battery->device->handle,
"%s evaluation failed: %s\n", "%s evaluation failed: %s\n",
use_bix ?"_BIX":"_BIF", use_bix ? "_BIX":"_BIF",
acpi_format_exception(status)); acpi_format_exception(status));
} else { } else {
result = extract_battery_info(use_bix, result = extract_battery_info(use_bix,
...@@ -648,6 +651,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev, ...@@ -648,6 +651,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev,
char *buf) char *buf)
{ {
struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
return sprintf(buf, "%d\n", battery->alarm * 1000); return sprintf(buf, "%d\n", battery->alarm * 1000);
} }
...@@ -657,6 +661,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev, ...@@ -657,6 +661,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
{ {
unsigned long x; unsigned long x;
struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
if (sscanf(buf, "%lu\n", &x) == 1) if (sscanf(buf, "%lu\n", &x) == 1)
battery->alarm = x/1000; battery->alarm = x/1000;
if (acpi_battery_present(battery)) if (acpi_battery_present(battery))
...@@ -743,7 +748,7 @@ EXPORT_SYMBOL_GPL(battery_hook_register); ...@@ -743,7 +748,7 @@ EXPORT_SYMBOL_GPL(battery_hook_register);
* This function gets called right after the battery sysfs * This function gets called right after the battery sysfs
* attributes have been added, so that the drivers that * attributes have been added, so that the drivers that
* define custom sysfs attributes can add their own. * define custom sysfs attributes can add their own.
*/ */
static void battery_hook_add_battery(struct acpi_battery *battery) static void battery_hook_add_battery(struct acpi_battery *battery)
{ {
struct acpi_battery_hook *hook_node, *tmp; struct acpi_battery_hook *hook_node, *tmp;
...@@ -872,10 +877,12 @@ static void find_battery(const struct dmi_header *dm, void *private) ...@@ -872,10 +877,12 @@ static void find_battery(const struct dmi_header *dm, void *private)
{ {
struct acpi_battery *battery = (struct acpi_battery *)private; struct acpi_battery *battery = (struct acpi_battery *)private;
/* Note: the hardcoded offsets below have been extracted from /* Note: the hardcoded offsets below have been extracted from
the source code of dmidecode. */ * the source code of dmidecode.
*/
if (dm->type == DMI_ENTRY_PORTABLE_BATTERY && dm->length >= 8) { if (dm->type == DMI_ENTRY_PORTABLE_BATTERY && dm->length >= 8) {
const u8 *dmi_data = (const u8 *)(dm + 1); const u8 *dmi_data = (const u8 *)(dm + 1);
int dmi_capacity = get_unaligned((const u16 *)(dmi_data + 6)); int dmi_capacity = get_unaligned((const u16 *)(dmi_data + 6));
if (dm->length >= 18) if (dm->length >= 18)
dmi_capacity *= dmi_data[17]; dmi_capacity *= dmi_data[17];
if (battery->design_capacity * battery->design_voltage / 1000 if (battery->design_capacity * battery->design_voltage / 1000
...@@ -917,6 +924,7 @@ static void acpi_battery_quirks(struct acpi_battery *battery) ...@@ -917,6 +924,7 @@ static void acpi_battery_quirks(struct acpi_battery *battery)
if (battery->power_unit && dmi_name_in_vendors("LENOVO")) { if (battery->power_unit && dmi_name_in_vendors("LENOVO")) {
const char *s; const char *s;
s = dmi_get_system_info(DMI_PRODUCT_VERSION); s = dmi_get_system_info(DMI_PRODUCT_VERSION);
if (s && !strncasecmp(s, "ThinkPad", 8)) { if (s && !strncasecmp(s, "ThinkPad", 8)) {
dmi_walk(find_battery, battery); dmi_walk(find_battery, battery);
...@@ -1013,10 +1021,7 @@ static void acpi_battery_refresh(struct acpi_battery *battery) ...@@ -1013,10 +1021,7 @@ static void acpi_battery_refresh(struct acpi_battery *battery)
sysfs_add_battery(battery); sysfs_add_battery(battery);
} }
/* -------------------------------------------------------------------------- /* Driver Interface */
Driver Interface
-------------------------------------------------------------------------- */
static void acpi_battery_notify(struct acpi_device *device, u32 event) static void acpi_battery_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_battery *battery = acpi_driver_data(device); struct acpi_battery *battery = acpi_driver_data(device);
......
...@@ -156,10 +156,7 @@ static unsigned long lid_report_interval __read_mostly = 500; ...@@ -156,10 +156,7 @@ static unsigned long lid_report_interval __read_mostly = 500;
module_param(lid_report_interval, ulong, 0644); module_param(lid_report_interval, ulong, 0644);
MODULE_PARM_DESC(lid_report_interval, "Interval (ms) between lid key events"); MODULE_PARM_DESC(lid_report_interval, "Interval (ms) between lid key events");
/* -------------------------------------------------------------------------- /* FS Interface (/proc) */
FS Interface (/proc)
-------------------------------------------------------------------------- */
static struct proc_dir_entry *acpi_button_dir; static struct proc_dir_entry *acpi_button_dir;
static struct proc_dir_entry *acpi_lid_dir; static struct proc_dir_entry *acpi_lid_dir;
...@@ -348,9 +345,7 @@ static int acpi_button_remove_fs(struct acpi_device *device) ...@@ -348,9 +345,7 @@ static int acpi_button_remove_fs(struct acpi_device *device)
return 0; return 0;
} }
/* -------------------------------------------------------------------------- /* Driver Interface */
Driver Interface
-------------------------------------------------------------------------- */
int acpi_lid_open(void) int acpi_lid_open(void)
{ {
if (!lid_device) if (!lid_device)
......
...@@ -100,14 +100,14 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); ...@@ -100,14 +100,14 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
(cpc)->cpc_entry.reg.space_id == \ (cpc)->cpc_entry.reg.space_id == \
ACPI_ADR_SPACE_PLATFORM_COMM) ACPI_ADR_SPACE_PLATFORM_COMM)
/* Evalutes to True if reg is a NULL register descriptor */ /* Evaluates to True if reg is a NULL register descriptor */
#define IS_NULL_REG(reg) ((reg)->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY && \ #define IS_NULL_REG(reg) ((reg)->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY && \
(reg)->address == 0 && \ (reg)->address == 0 && \
(reg)->bit_width == 0 && \ (reg)->bit_width == 0 && \
(reg)->bit_offset == 0 && \ (reg)->bit_offset == 0 && \
(reg)->access_width == 0) (reg)->access_width == 0)
/* Evalutes to True if an optional cpc field is supported */ /* Evaluates to True if an optional cpc field is supported */
#define CPC_SUPPORTED(cpc) ((cpc)->type == ACPI_TYPE_INTEGER ? \ #define CPC_SUPPORTED(cpc) ((cpc)->type == ACPI_TYPE_INTEGER ? \
!!(cpc)->cpc_entry.int_value : \ !!(cpc)->cpc_entry.int_value : \
!IS_NULL_REG(&(cpc)->cpc_entry.reg)) !IS_NULL_REG(&(cpc)->cpc_entry.reg))
...@@ -318,6 +318,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd) ...@@ -318,6 +318,7 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
if (unlikely(ret)) { if (unlikely(ret)) {
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
struct cpc_desc *desc = per_cpu(cpc_desc_ptr, i); struct cpc_desc *desc = per_cpu(cpc_desc_ptr, i);
if (!desc) if (!desc)
continue; continue;
...@@ -769,7 +770,7 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) ...@@ -769,7 +770,7 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
cpc_ptr->cpc_regs[i-2].type = ACPI_TYPE_BUFFER; cpc_ptr->cpc_regs[i-2].type = ACPI_TYPE_BUFFER;
memcpy(&cpc_ptr->cpc_regs[i-2].cpc_entry.reg, gas_t, sizeof(*gas_t)); memcpy(&cpc_ptr->cpc_regs[i-2].cpc_entry.reg, gas_t, sizeof(*gas_t));
} else { } else {
pr_debug("Err in entry:%d in CPC table of CPU:%d \n", i, pr->id); pr_debug("Err in entry:%d in CPC table of CPU:%d\n", i, pr->id);
goto out_free; goto out_free;
} }
} }
...@@ -859,7 +860,7 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr) ...@@ -859,7 +860,7 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
void __iomem *addr; void __iomem *addr;
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, pr->id); int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, pr->id);
if (pcc_ss_id >=0 && pcc_data[pcc_ss_id]) { if (pcc_ss_id >= 0 && pcc_data[pcc_ss_id]) {
if (pcc_data[pcc_ss_id]->pcc_channel_acquired) { if (pcc_data[pcc_ss_id]->pcc_channel_acquired) {
pcc_data[pcc_ss_id]->refcount--; pcc_data[pcc_ss_id]->refcount--;
if (!pcc_data[pcc_ss_id]->refcount) { if (!pcc_data[pcc_ss_id]->refcount) {
...@@ -1321,7 +1322,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) ...@@ -1321,7 +1322,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
* is still with OSPM. * is still with OSPM.
* pending_pcc_write_cmd can also be cleared by a different CPU, if * pending_pcc_write_cmd can also be cleared by a different CPU, if
* there was a pcc CMD_READ waiting on down_write and it steals the lock * there was a pcc CMD_READ waiting on down_write and it steals the lock
* before the pcc CMD_WRITE is completed. pcc_send_cmd checks for this * before the pcc CMD_WRITE is completed. send_pcc_cmd checks for this
* case during a CMD_READ and if there are pending writes it delivers * case during a CMD_READ and if there are pending writes it delivers
* the write command before servicing the read command * the write command before servicing the read command
*/ */
...@@ -1346,8 +1347,8 @@ EXPORT_SYMBOL_GPL(cppc_set_perf); ...@@ -1346,8 +1347,8 @@ EXPORT_SYMBOL_GPL(cppc_set_perf);
/** /**
* cppc_get_transition_latency - returns frequency transition latency in ns * cppc_get_transition_latency - returns frequency transition latency in ns
* *
* ACPI CPPC does not explicitly specifiy how a platform can specify the * ACPI CPPC does not explicitly specify how a platform can specify the
* transition latency for perfromance change requests. The closest we have * transition latency for performance change requests. The closest we have
* is the timing information from the PCCT tables which provides the info * is the timing information from the PCCT tables which provides the info
* on the number and frequency of PCC commands the platform can handle. * on the number and frequency of PCC commands the platform can handle.
*/ */
......
...@@ -19,7 +19,7 @@ static struct dentry *cm_dentry; ...@@ -19,7 +19,7 @@ static struct dentry *cm_dentry;
/* /sys/kernel/debug/acpi/custom_method */ /* /sys/kernel/debug/acpi/custom_method */
static ssize_t cm_write(struct file *file, const char __user * user_buf, static ssize_t cm_write(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
static char *buf; static char *buf;
......
...@@ -966,6 +966,7 @@ EXPORT_SYMBOL_GPL(acpi_dev_resume); ...@@ -966,6 +966,7 @@ EXPORT_SYMBOL_GPL(acpi_dev_resume);
int acpi_subsys_runtime_suspend(struct device *dev) int acpi_subsys_runtime_suspend(struct device *dev)
{ {
int ret = pm_generic_runtime_suspend(dev); int ret = pm_generic_runtime_suspend(dev);
return ret ? ret : acpi_dev_suspend(dev, true); return ret ? ret : acpi_dev_suspend(dev, true);
} }
EXPORT_SYMBOL_GPL(acpi_subsys_runtime_suspend); EXPORT_SYMBOL_GPL(acpi_subsys_runtime_suspend);
...@@ -980,6 +981,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_runtime_suspend); ...@@ -980,6 +981,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_runtime_suspend);
int acpi_subsys_runtime_resume(struct device *dev) int acpi_subsys_runtime_resume(struct device *dev)
{ {
int ret = acpi_dev_resume(dev); int ret = acpi_dev_resume(dev);
return ret ? ret : pm_generic_runtime_resume(dev); return ret ? ret : pm_generic_runtime_resume(dev);
} }
EXPORT_SYMBOL_GPL(acpi_subsys_runtime_resume); EXPORT_SYMBOL_GPL(acpi_subsys_runtime_resume);
...@@ -1171,6 +1173,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_freeze); ...@@ -1171,6 +1173,7 @@ EXPORT_SYMBOL_GPL(acpi_subsys_freeze);
int acpi_subsys_restore_early(struct device *dev) int acpi_subsys_restore_early(struct device *dev)
{ {
int ret = acpi_dev_resume(dev); int ret = acpi_dev_resume(dev);
return ret ? ret : pm_generic_restore_early(dev); return ret ? ret : pm_generic_restore_early(dev);
} }
EXPORT_SYMBOL_GPL(acpi_subsys_restore_early); EXPORT_SYMBOL_GPL(acpi_subsys_restore_early);
......
...@@ -73,6 +73,7 @@ static const struct sysfs_ops acpi_data_node_sysfs_ops = { ...@@ -73,6 +73,7 @@ static const struct sysfs_ops acpi_data_node_sysfs_ops = {
static void acpi_data_node_release(struct kobject *kobj) static void acpi_data_node_release(struct kobject *kobj)
{ {
struct acpi_data_node *dn = to_data_node(kobj); struct acpi_data_node *dn = to_data_node(kobj);
complete(&dn->kobj_done); complete(&dn->kobj_done);
} }
...@@ -130,7 +131,7 @@ static void acpi_hide_nondev_subnodes(struct acpi_device_data *data) ...@@ -130,7 +131,7 @@ static void acpi_hide_nondev_subnodes(struct acpi_device_data *data)
* Return: 0: no _HID and no _CID * Return: 0: no _HID and no _CID
* -EINVAL: output error * -EINVAL: output error
* -ENOMEM: output is truncated * -ENOMEM: output is truncated
*/ */
static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
int size) int size)
{ {
...@@ -431,7 +432,8 @@ static DEVICE_ATTR_RO(path); ...@@ -431,7 +432,8 @@ static DEVICE_ATTR_RO(path);
/* sysfs file that shows description text from the ACPI _STR method */ /* sysfs file that shows description text from the ACPI _STR method */
static ssize_t description_show(struct device *dev, static ssize_t description_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) { char *buf)
{
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
int result; int result;
...@@ -456,7 +458,8 @@ static DEVICE_ATTR_RO(description); ...@@ -456,7 +458,8 @@ static DEVICE_ATTR_RO(description);
static ssize_t static ssize_t
sun_show(struct device *dev, struct device_attribute *attr, sun_show(struct device *dev, struct device_attribute *attr,
char *buf) { char *buf)
{
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
acpi_status status; acpi_status status;
unsigned long long sun; unsigned long long sun;
...@@ -471,7 +474,8 @@ static DEVICE_ATTR_RO(sun); ...@@ -471,7 +474,8 @@ static DEVICE_ATTR_RO(sun);
static ssize_t static ssize_t
hrv_show(struct device *dev, struct device_attribute *attr, hrv_show(struct device *dev, struct device_attribute *attr,
char *buf) { char *buf)
{
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
acpi_status status; acpi_status status;
unsigned long long hrv; unsigned long long hrv;
...@@ -485,7 +489,8 @@ hrv_show(struct device *dev, struct device_attribute *attr, ...@@ -485,7 +489,8 @@ hrv_show(struct device *dev, struct device_attribute *attr,
static DEVICE_ATTR_RO(hrv); static DEVICE_ATTR_RO(hrv);
static ssize_t status_show(struct device *dev, struct device_attribute *attr, static ssize_t status_show(struct device *dev, struct device_attribute *attr,
char *buf) { char *buf)
{
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
acpi_status status; acpi_status status;
unsigned long long sta; unsigned long long sta;
......
...@@ -271,6 +271,7 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event) ...@@ -271,6 +271,7 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
if (!acpi_device_enumerated(adev)) { if (!acpi_device_enumerated(adev)) {
int ret = acpi_bus_scan(adev->handle); int ret = acpi_bus_scan(adev->handle);
if (ret) if (ret)
dev_dbg(&adev->dev, "scan error %d\n", -ret); dev_dbg(&adev->dev, "scan error %d\n", -ret);
} }
...@@ -502,6 +503,7 @@ static ssize_t flags_show(struct device *dev, ...@@ -502,6 +503,7 @@ static ssize_t flags_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags); return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags);
} }
...@@ -523,7 +525,7 @@ static ssize_t undock_store(struct device *dev, struct device_attribute *attr, ...@@ -523,7 +525,7 @@ static ssize_t undock_store(struct device *dev, struct device_attribute *attr,
begin_undock(dock_station); begin_undock(dock_station);
ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST);
acpi_scan_lock_release(); acpi_scan_lock_release();
return ret ? ret: count; return ret ? ret : count;
} }
static DEVICE_ATTR_WO(undock); static DEVICE_ATTR_WO(undock);
...@@ -535,6 +537,7 @@ static ssize_t uid_show(struct device *dev, ...@@ -535,6 +537,7 @@ static ssize_t uid_show(struct device *dev,
{ {
unsigned long long lbuf; unsigned long long lbuf;
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
acpi_status status = acpi_evaluate_integer(dock_station->handle, acpi_status status = acpi_evaluate_integer(dock_station->handle,
"_UID", NULL, &lbuf); "_UID", NULL, &lbuf);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
......
...@@ -722,7 +722,7 @@ static void hmat_register_target(struct memory_target *target) ...@@ -722,7 +722,7 @@ static void hmat_register_target(struct memory_target *target)
/* /*
* Skip offline nodes. This can happen when memory * Skip offline nodes. This can happen when memory
* marked EFI_MEMORY_SP, "specific purpose", is applied * marked EFI_MEMORY_SP, "specific purpose", is applied
* to all the memory in a promixity domain leading to * to all the memory in a proximity domain leading to
* the node being marked offline / unplugged, or if * the node being marked offline / unplugged, or if
* memory-only "hotplug" node is offline. * memory-only "hotplug" node is offline.
*/ */
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* /*
* We have no docs for the CHT Crystal Cove PMIC. The Asus Zenfone-2 kernel * We have no docs for the CHT Crystal Cove PMIC. The Asus Zenfone-2 kernel
* code has 2 Crystal Cove regulator drivers, one calls the PMIC a "Crystal * code has 2 Crystal Cove regulator drivers, one calls the PMIC a "Crystal
* Cove Plus" PMIC and talks about Cherry Trail, so presuambly that one * Cove Plus" PMIC and talks about Cherry Trail, so presumably that one
* could be used to get register info for the regulators if we need to * could be used to get register info for the regulators if we need to
* implement regulator support in the future. * implement regulator support in the future.
* *
......
...@@ -934,7 +934,7 @@ int acpi_add_power_resource(acpi_handle handle) ...@@ -934,7 +934,7 @@ int acpi_add_power_resource(acpi_handle handle)
strcpy(acpi_device_class(device), ACPI_POWER_CLASS); strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
device->power.state = ACPI_STATE_UNKNOWN; device->power.state = ACPI_STATE_UNKNOWN;
/* Evalute the object to get the system level and resource order. */ /* Evaluate the object to get the system level and resource order. */
status = acpi_evaluate_object(handle, NULL, NULL, &buffer); status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
goto err; goto err;
......
...@@ -96,7 +96,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) ...@@ -96,7 +96,7 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
* acpi_processor_ppc_ost: Notify firmware the _PPC evaluation status * acpi_processor_ppc_ost: Notify firmware the _PPC evaluation status
* @handle: ACPI processor handle * @handle: ACPI processor handle
* @status: the status code of _PPC evaluation * @status: the status code of _PPC evaluation
* 0: success. OSPM is now using the performance state specificed. * 0: success. OSPM is now using the performance state specified.
* 1: failure. OSPM has not changed the number of P-states in use * 1: failure. OSPM has not changed the number of P-states in use
*/ */
static void acpi_processor_ppc_ost(acpi_handle handle, int status) static void acpi_processor_ppc_ost(acpi_handle handle, int status)
......
...@@ -596,7 +596,7 @@ static int __acpi_dev_get_resources(struct acpi_device *adev, ...@@ -596,7 +596,7 @@ static int __acpi_dev_get_resources(struct acpi_device *adev,
* @preproc_data: Pointer passed to the caller's preprocessing routine. * @preproc_data: Pointer passed to the caller's preprocessing routine.
* *
* Evaluate the _CRS method for the given device node and process its output by * Evaluate the _CRS method for the given device node and process its output by
* (1) executing the @preproc() rountine provided by the caller, passing the * (1) executing the @preproc() routine provided by the caller, passing the
* resource pointer and @preproc_data to it as arguments, for each ACPI resource * resource pointer and @preproc_data to it as arguments, for each ACPI resource
* returned and (2) converting all of the returned ACPI resources into struct * returned and (2) converting all of the returned ACPI resources into struct
* resource objects if possible. If the return value of @preproc() in step (1) * resource objects if possible. If the return value of @preproc() in step (1)
......
...@@ -560,7 +560,7 @@ static void acpi_scan_drop_device(acpi_handle handle, void *context) ...@@ -560,7 +560,7 @@ static void acpi_scan_drop_device(acpi_handle handle, void *context)
* prevents attempts to register device objects identical to those being * prevents attempts to register device objects identical to those being
* deleted from happening concurrently (such attempts result from * deleted from happening concurrently (such attempts result from
* hotplug events handled via the ACPI hotplug workqueue). It also will * hotplug events handled via the ACPI hotplug workqueue). It also will
* run after all of the work items submitted previosuly, which helps * run after all of the work items submitted previously, which helps
* those work items to ensure that they are not accessing stale device * those work items to ensure that they are not accessing stale device
* objects. * objects.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment