Merge branches 'acpi-misc', 'acpi-cppc', 'acpi-docs', 'acpi-config' and 'acpi-apei'

* acpi-misc:
  ACPI: Test for ACPI_SUCCESS rather than !ACPI_FAILURE
  ACPI: Use DEVICE_ATTR_<RW|RO|WO> macros

* acpi-cppc:
  ACPI: CPPC: initialise vaddr pointers to NULL
  ACPI: CPPC: add __iomem annotation to generic_comm_base pointer
  ACPI: CPPC: remove __iomem annotation for cpc_reg's address

* acpi-docs:
  Documentation: ACPI: add new rule for gpio-line-names

* acpi-config:
  ACPI: configfs: add missing check after configfs_register_default_group()

* acpi-apei:
  ACPI: APEI: ERST: remove unneeded semicolon
  ACPI: APEI: Add is_generic_error() to identify GHES sources
This commit is contained in:
Rafael J. Wysocki 2021-02-15 17:04:40 +01:00
18 changed files with 99 additions and 94 deletions

View File

@ -146,6 +146,7 @@ following rules (see also the examples):
other words, it is not mandatory to fill all the GPIO lines other words, it is not mandatory to fill all the GPIO lines
- empty names are allowed (two quotation marks ``""`` correspond to an empty - empty names are allowed (two quotation marks ``""`` correspond to an empty
name) name)
- names inside one GPIO controller/expander must be unique
Example of a GPIO controller of 16 lines, with an incomplete list with two Example of a GPIO controller of 16 lines, with an incomplete list with two
empty names:: empty names::

View File

@ -268,7 +268,12 @@ static int __init acpi_configfs_init(void)
acpi_table_group = configfs_register_default_group(root, "table", acpi_table_group = configfs_register_default_group(root, "table",
&acpi_tables_type); &acpi_tables_type);
return PTR_ERR_OR_ZERO(acpi_table_group); if (IS_ERR(acpi_table_group)) {
configfs_unregister_subsystem(&acpi_configfs);
return PTR_ERR(acpi_table_group);
}
return 0;
} }
module_init(acpi_configfs_init); module_init(acpi_configfs_init);

View File

@ -261,7 +261,7 @@ static uint32_t acpi_pad_idle_cpus_num(void)
return ps_tsk_num; return ps_tsk_num;
} }
static ssize_t acpi_pad_rrtime_store(struct device *dev, 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;
@ -275,16 +275,14 @@ static ssize_t acpi_pad_rrtime_store(struct device *dev,
return count; return count;
} }
static ssize_t acpi_pad_rrtime_show(struct device *dev, static ssize_t rrtime_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time); return scnprintf(buf, PAGE_SIZE, "%d\n", round_robin_time);
} }
static DEVICE_ATTR(rrtime, S_IRUGO|S_IWUSR, static DEVICE_ATTR_RW(rrtime);
acpi_pad_rrtime_show,
acpi_pad_rrtime_store);
static ssize_t acpi_pad_idlepct_store(struct device *dev, 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;
@ -298,16 +296,14 @@ static ssize_t acpi_pad_idlepct_store(struct device *dev,
return count; return count;
} }
static ssize_t acpi_pad_idlepct_show(struct device *dev, static ssize_t idlepct_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct); return scnprintf(buf, PAGE_SIZE, "%d\n", idle_pct);
} }
static DEVICE_ATTR(idlepct, S_IRUGO|S_IWUSR, static DEVICE_ATTR_RW(idlepct);
acpi_pad_idlepct_show,
acpi_pad_idlepct_store);
static ssize_t acpi_pad_idlecpus_store(struct device *dev, 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;
@ -319,16 +315,14 @@ static ssize_t acpi_pad_idlecpus_store(struct device *dev,
return count; return count;
} }
static ssize_t acpi_pad_idlecpus_show(struct device *dev, static ssize_t idlecpus_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return cpumap_print_to_pagebuf(false, buf, return cpumap_print_to_pagebuf(false, buf,
to_cpumask(pad_busy_cpus_bits)); to_cpumask(pad_busy_cpus_bits));
} }
static DEVICE_ATTR(idlecpus, S_IRUGO|S_IWUSR, static DEVICE_ATTR_RW(idlecpus);
acpi_pad_idlecpus_show,
acpi_pad_idlecpus_store);
static int acpi_pad_add_sysfs(struct acpi_device *device) static int acpi_pad_add_sysfs(struct acpi_device *device)
{ {

View File

@ -237,7 +237,7 @@ static ssize_t time_show(struct device *dev, struct device_attribute *attr,
rt.tz, rt.daylight); rt.tz, rt.daylight);
} }
static DEVICE_ATTR(time, S_IRUSR | S_IWUSR, time_show, time_store); static DEVICE_ATTR_RW(time);
static struct attribute *acpi_tad_time_attrs[] = { static struct attribute *acpi_tad_time_attrs[] = {
&dev_attr_time.attr, &dev_attr_time.attr,
@ -446,7 +446,7 @@ static ssize_t ac_alarm_show(struct device *dev, struct device_attribute *attr,
return acpi_tad_alarm_read(dev, buf, ACPI_TAD_AC_TIMER); return acpi_tad_alarm_read(dev, buf, ACPI_TAD_AC_TIMER);
} }
static DEVICE_ATTR(ac_alarm, S_IRUSR | S_IWUSR, ac_alarm_show, ac_alarm_store); static DEVICE_ATTR_RW(ac_alarm);
static ssize_t ac_policy_store(struct device *dev, struct device_attribute *attr, static ssize_t ac_policy_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
@ -462,7 +462,7 @@ static ssize_t ac_policy_show(struct device *dev, struct device_attribute *attr,
return acpi_tad_policy_read(dev, buf, ACPI_TAD_AC_TIMER); return acpi_tad_policy_read(dev, buf, ACPI_TAD_AC_TIMER);
} }
static DEVICE_ATTR(ac_policy, S_IRUSR | S_IWUSR, ac_policy_show, ac_policy_store); static DEVICE_ATTR_RW(ac_policy);
static ssize_t ac_status_store(struct device *dev, struct device_attribute *attr, static ssize_t ac_status_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
@ -478,7 +478,7 @@ static ssize_t ac_status_show(struct device *dev, struct device_attribute *attr,
return acpi_tad_status_read(dev, buf, ACPI_TAD_AC_TIMER); return acpi_tad_status_read(dev, buf, ACPI_TAD_AC_TIMER);
} }
static DEVICE_ATTR(ac_status, S_IRUSR | S_IWUSR, ac_status_show, ac_status_store); static DEVICE_ATTR_RW(ac_status);
static struct attribute *acpi_tad_attrs[] = { static struct attribute *acpi_tad_attrs[] = {
&dev_attr_caps.attr, &dev_attr_caps.attr,
@ -505,7 +505,7 @@ static ssize_t dc_alarm_show(struct device *dev, struct device_attribute *attr,
return acpi_tad_alarm_read(dev, buf, ACPI_TAD_DC_TIMER); return acpi_tad_alarm_read(dev, buf, ACPI_TAD_DC_TIMER);
} }
static DEVICE_ATTR(dc_alarm, S_IRUSR | S_IWUSR, dc_alarm_show, dc_alarm_store); static DEVICE_ATTR_RW(dc_alarm);
static ssize_t dc_policy_store(struct device *dev, struct device_attribute *attr, static ssize_t dc_policy_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
@ -521,7 +521,7 @@ static ssize_t dc_policy_show(struct device *dev, struct device_attribute *attr,
return acpi_tad_policy_read(dev, buf, ACPI_TAD_DC_TIMER); return acpi_tad_policy_read(dev, buf, ACPI_TAD_DC_TIMER);
} }
static DEVICE_ATTR(dc_policy, S_IRUSR | S_IWUSR, dc_policy_show, dc_policy_store); static DEVICE_ATTR_RW(dc_policy);
static ssize_t dc_status_store(struct device *dev, struct device_attribute *attr, static ssize_t dc_status_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
@ -537,7 +537,7 @@ static ssize_t dc_status_show(struct device *dev, struct device_attribute *attr,
return acpi_tad_status_read(dev, buf, ACPI_TAD_DC_TIMER); return acpi_tad_status_read(dev, buf, ACPI_TAD_DC_TIMER);
} }
static DEVICE_ATTR(dc_status, S_IRUSR | S_IWUSR, dc_status_show, dc_status_store); static DEVICE_ATTR_RW(dc_status);
static struct attribute *acpi_tad_dc_attrs[] = { static struct attribute *acpi_tad_dc_attrs[] = {
&dev_attr_dc_alarm.attr, &dev_attr_dc_alarm.attr,

View File

@ -688,7 +688,7 @@ static int __erst_read_from_storage(u64 record_id, u64 offset)
break; break;
if (erst_timedout(&timeout, SPIN_UNIT)) if (erst_timedout(&timeout, SPIN_UNIT))
return -EIO; return -EIO;
}; }
rc = apei_exec_run(&ctx, ACPI_ERST_GET_COMMAND_STATUS); rc = apei_exec_run(&ctx, ACPI_ERST_GET_COMMAND_STATUS);
if (rc) if (rc)
return rc; return rc;

View File

@ -49,6 +49,12 @@ static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
[ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1, [ACPI_HEST_TYPE_IA32_DEFERRED_CHECK] = -1,
}; };
static inline bool is_generic_error(struct acpi_hest_header *hest_hdr)
{
return hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR ||
hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2;
}
static int hest_esrc_len(struct acpi_hest_header *hest_hdr) static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
{ {
u16 hest_type = hest_hdr->type; u16 hest_type = hest_hdr->type;
@ -141,8 +147,7 @@ static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void
{ {
int *count = data; int *count = data;
if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR || if (is_generic_error(hest_hdr))
hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR_V2)
(*count)++; (*count)++;
return 0; return 0;
} }
@ -153,8 +158,7 @@ static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
struct ghes_arr *ghes_arr = data; struct ghes_arr *ghes_arr = data;
int rc, i; int rc, i;
if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR && if (!is_generic_error(hest_hdr))
hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR_V2)
return 0; return 0;
if (!((struct acpi_hest_generic *)hest_hdr)->enabled) if (!((struct acpi_hest_generic *)hest_hdr)->enabled)

View File

@ -15,40 +15,40 @@
static void *bgrt_image; static void *bgrt_image;
static struct kobject *bgrt_kobj; static struct kobject *bgrt_kobj;
static ssize_t show_version(struct device *dev, static ssize_t version_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version); return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version);
} }
static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); static DEVICE_ATTR_RO(version);
static ssize_t show_status(struct device *dev, static ssize_t status_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status); return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status);
} }
static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); static DEVICE_ATTR_RO(status);
static ssize_t show_type(struct device *dev, static ssize_t type_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type); return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type);
} }
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); static DEVICE_ATTR_RO(type);
static ssize_t show_xoffset(struct device *dev, static ssize_t xoffset_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x); return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x);
} }
static DEVICE_ATTR(xoffset, S_IRUGO, show_xoffset, NULL); static DEVICE_ATTR_RO(xoffset);
static ssize_t show_yoffset(struct device *dev, static ssize_t yoffset_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y); return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y);
} }
static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL); static DEVICE_ATTR_RO(yoffset);
static ssize_t image_read(struct file *file, struct kobject *kobj, static ssize_t image_read(struct file *file, struct kobject *kobj,
struct bin_attribute *attr, char *buf, loff_t off, size_t count) struct bin_attribute *attr, char *buf, loff_t off, size_t count)

View File

@ -233,8 +233,8 @@ static int send_pcc_cmd(int pcc_ss_id, u16 cmd)
{ {
int ret = -EIO, i; int ret = -EIO, i;
struct cppc_pcc_data *pcc_ss_data = pcc_data[pcc_ss_id]; struct cppc_pcc_data *pcc_ss_data = pcc_data[pcc_ss_id];
struct acpi_pcct_shared_memory *generic_comm_base = struct acpi_pcct_shared_memory __iomem *generic_comm_base =
(struct acpi_pcct_shared_memory *)pcc_ss_data->pcc_comm_addr; pcc_ss_data->pcc_comm_addr;
unsigned int time_delta; unsigned int time_delta;
/* /*
@ -934,7 +934,7 @@ int __weak cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
{ {
int ret_val = 0; int ret_val = 0;
void __iomem *vaddr = 0; void __iomem *vaddr = NULL;
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
struct cpc_reg *reg = &reg_res->cpc_entry.reg; struct cpc_reg *reg = &reg_res->cpc_entry.reg;
@ -979,7 +979,7 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val) static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)
{ {
int ret_val = 0; int ret_val = 0;
void __iomem *vaddr = 0; void __iomem *vaddr = NULL;
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
struct cpc_reg *reg = &reg_res->cpc_entry.reg; struct cpc_reg *reg = &reg_res->cpc_entry.reg;

View File

@ -325,11 +325,11 @@ int acpi_device_modalias(struct device *dev, char *buf, int size)
EXPORT_SYMBOL_GPL(acpi_device_modalias); EXPORT_SYMBOL_GPL(acpi_device_modalias);
static ssize_t static ssize_t
acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf) modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
{ {
return __acpi_device_modalias(to_acpi_device(dev), buf, 1024); return __acpi_device_modalias(to_acpi_device(dev), buf, 1024);
} }
static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); static DEVICE_ATTR_RO(modalias);
static ssize_t real_power_state_show(struct device *dev, static ssize_t real_power_state_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
@ -358,8 +358,8 @@ static ssize_t power_state_show(struct device *dev,
static DEVICE_ATTR_RO(power_state); static DEVICE_ATTR_RO(power_state);
static ssize_t static ssize_t
acpi_eject_store(struct device *d, struct device_attribute *attr, eject_store(struct device *d, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct acpi_device *acpi_device = to_acpi_device(d); struct acpi_device *acpi_device = to_acpi_device(d);
acpi_object_type not_used; acpi_object_type not_used;
@ -387,28 +387,28 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN; return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
} }
static DEVICE_ATTR(eject, 0200, NULL, acpi_eject_store); static DEVICE_ATTR_WO(eject);
static ssize_t static ssize_t
acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *buf) hid_show(struct device *dev, struct device_attribute *attr, char *buf)
{ {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev)); return sprintf(buf, "%s\n", acpi_device_hid(acpi_dev));
} }
static DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL); static DEVICE_ATTR_RO(hid);
static ssize_t acpi_device_uid_show(struct device *dev, static ssize_t uid_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id); return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id);
} }
static DEVICE_ATTR(uid, 0444, acpi_device_uid_show, NULL); static DEVICE_ATTR_RO(uid);
static ssize_t acpi_device_adr_show(struct device *dev, static ssize_t adr_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
@ -417,16 +417,16 @@ static ssize_t acpi_device_adr_show(struct device *dev,
else else
return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address); return sprintf(buf, "0x%08llx\n", acpi_dev->pnp.bus_address);
} }
static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL); static DEVICE_ATTR_RO(adr);
static ssize_t acpi_device_path_show(struct device *dev, static ssize_t path_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct acpi_device *acpi_dev = to_acpi_device(dev); struct acpi_device *acpi_dev = to_acpi_device(dev);
return acpi_object_path(acpi_dev->handle, buf); return acpi_object_path(acpi_dev->handle, buf);
} }
static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); 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,
@ -455,8 +455,8 @@ static ssize_t description_show(struct device *dev,
static DEVICE_ATTR_RO(description); static DEVICE_ATTR_RO(description);
static ssize_t static ssize_t
acpi_device_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;
@ -467,11 +467,11 @@ acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%llu\n", sun); return sprintf(buf, "%llu\n", sun);
} }
static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); static DEVICE_ATTR_RO(sun);
static ssize_t static ssize_t
acpi_device_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;
@ -482,7 +482,7 @@ acpi_device_hrv_show(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%llu\n", hrv); return sprintf(buf, "%llu\n", hrv);
} }
static DEVICE_ATTR(hrv, 0444, acpi_device_hrv_show, NULL); 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) {

View File

@ -484,7 +484,7 @@ int dock_notify(struct acpi_device *adev, u32 event)
/* /*
* show_docked - read method for "docked" file in sysfs * show_docked - read method for "docked" file in sysfs
*/ */
static ssize_t show_docked(struct device *dev, static ssize_t docked_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;
@ -493,25 +493,25 @@ static ssize_t show_docked(struct device *dev,
acpi_bus_get_device(dock_station->handle, &adev); acpi_bus_get_device(dock_station->handle, &adev);
return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
} }
static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); static DEVICE_ATTR_RO(docked);
/* /*
* show_flags - read method for flags file in sysfs * show_flags - read method for flags file in sysfs
*/ */
static ssize_t show_flags(struct device *dev, 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);
} }
static DEVICE_ATTR(flags, S_IRUGO, show_flags, NULL); static DEVICE_ATTR_RO(flags);
/* /*
* write_undock - write method for "undock" file in sysfs * write_undock - write method for "undock" file in sysfs
*/ */
static ssize_t write_undock(struct device *dev, struct device_attribute *attr, static ssize_t undock_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int ret; int ret;
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
@ -525,13 +525,13 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
acpi_scan_lock_release(); acpi_scan_lock_release();
return ret ? ret: count; return ret ? ret: count;
} }
static DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock); static DEVICE_ATTR_WO(undock);
/* /*
* show_dock_uid - read method for "uid" file in sysfs * show_dock_uid - read method for "uid" file in sysfs
*/ */
static ssize_t show_dock_uid(struct device *dev, static ssize_t uid_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
unsigned long long lbuf; unsigned long long lbuf;
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
@ -542,10 +542,10 @@ static ssize_t show_dock_uid(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf); return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf);
} }
static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL); static DEVICE_ATTR_RO(uid);
static ssize_t show_dock_type(struct device *dev, static ssize_t type_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;
char *type; char *type;
@ -561,7 +561,7 @@ static ssize_t show_dock_type(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%s\n", type); return snprintf(buf, PAGE_SIZE, "%s\n", type);
} }
static DEVICE_ATTR(type, S_IRUGO, show_dock_type, NULL); static DEVICE_ATTR_RO(type);
static struct attribute *dock_attributes[] = { static struct attribute *dock_attributes[] = {
&dev_attr_docked.attr, &dev_attr_docked.attr,

View File

@ -886,15 +886,16 @@ static void acpi_release_power_resource(struct device *dev)
kfree(resource); kfree(resource);
} }
static ssize_t acpi_power_in_use_show(struct device *dev, static ssize_t resource_in_use_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) { char *buf)
{
struct acpi_power_resource *resource; struct acpi_power_resource *resource;
resource = to_power_resource(to_acpi_device(dev)); resource = to_power_resource(to_acpi_device(dev));
return sprintf(buf, "%u\n", !!resource->ref_count); return sprintf(buf, "%u\n", !!resource->ref_count);
} }
static DEVICE_ATTR(resource_in_use, 0444, acpi_power_in_use_show, NULL); static DEVICE_ATTR_RO(resource_in_use);
static void acpi_power_sysfs_remove(struct acpi_device *device) static void acpi_power_sysfs_remove(struct acpi_device *device)
{ {

View File

@ -291,7 +291,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
continue; continue;
status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
found = true; found = true;
break; break;
} }
@ -304,7 +304,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
continue; continue;
status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
found = true; found = true;
break; break;
} }

View File

@ -205,7 +205,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
continue; continue;
status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
found = true; found = true;
break; break;
} }
@ -218,7 +218,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
continue; continue;
status = acpi_get_handle(dhandle, "ATRM", &atrm_handle); status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
found = true; found = true;
break; break;
} }

View File

@ -161,7 +161,7 @@ static ssize_t set_avg_interval(struct device *dev,
mutex_lock(&resource->lock); mutex_lock(&resource->lock);
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PAI", status = acpi_evaluate_integer(resource->acpi_dev->handle, "_PAI",
&args, &data); &args, &data);
if (!ACPI_FAILURE(status)) if (ACPI_SUCCESS(status))
resource->avg_interval = temp; resource->avg_interval = temp;
mutex_unlock(&resource->lock); mutex_unlock(&resource->lock);
@ -232,7 +232,7 @@ static ssize_t set_cap(struct device *dev, struct device_attribute *devattr,
mutex_lock(&resource->lock); mutex_lock(&resource->lock);
status = acpi_evaluate_integer(resource->acpi_dev->handle, "_SHL", status = acpi_evaluate_integer(resource->acpi_dev->handle, "_SHL",
&args, &data); &args, &data);
if (!ACPI_FAILURE(status)) if (ACPI_SUCCESS(status))
resource->cap = temp; resource->cap = temp;
mutex_unlock(&resource->lock); mutex_unlock(&resource->lock);

View File

@ -861,7 +861,7 @@ static ssize_t infos_show(struct device *dev, struct device_attribute *attr,
* The significance of others is yet to be found. * The significance of others is yet to be found.
*/ */
rv = acpi_evaluate_integer(asus->handle, "SFUN", NULL, &temp); rv = acpi_evaluate_integer(asus->handle, "SFUN", NULL, &temp);
if (!ACPI_FAILURE(rv)) if (ACPI_SUCCESS(rv))
len += sprintf(page + len, "SFUN value : %#x\n", len += sprintf(page + len, "SFUN value : %#x\n",
(uint) temp); (uint) temp);
/* /*
@ -873,7 +873,7 @@ static ssize_t infos_show(struct device *dev, struct device_attribute *attr,
* takes several seconds to run on some systems. * takes several seconds to run on some systems.
*/ */
rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp); rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp);
if (!ACPI_FAILURE(rv)) if (ACPI_SUCCESS(rv))
len += sprintf(page + len, "HWRS value : %#x\n", len += sprintf(page + len, "HWRS value : %#x\n",
(uint) temp); (uint) temp);
/* /*
@ -884,7 +884,7 @@ static ssize_t infos_show(struct device *dev, struct device_attribute *attr,
* silently ignored. * silently ignored.
*/ */
rv = acpi_evaluate_integer(asus->handle, "ASYM", NULL, &temp); rv = acpi_evaluate_integer(asus->handle, "ASYM", NULL, &temp);
if (!ACPI_FAILURE(rv)) if (ACPI_SUCCESS(rv))
len += sprintf(page + len, "ASYM value : %#x\n", len += sprintf(page + len, "ASYM value : %#x\n",
(uint) temp); (uint) temp);
if (asus->dsdt_info) { if (asus->dsdt_info) {

View File

@ -2210,7 +2210,7 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
return AE_OK; return AE_OK;
if (!lookup.max_speed_hz && if (!lookup.max_speed_hz &&
!ACPI_FAILURE(acpi_get_parent(adev->handle, &parent_handle)) && ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) &&
ACPI_HANDLE(ctlr->dev.parent) == parent_handle) { ACPI_HANDLE(ctlr->dev.parent) == parent_handle) {
/* Apple does not use _CRS but nested devices for SPI slaves */ /* Apple does not use _CRS but nested devices for SPI slaves */
acpi_spi_parse_apple_properties(adev, &lookup); acpi_spi_parse_apple_properties(adev, &lookup);

View File

@ -39,7 +39,7 @@ struct cpc_reg {
u8 bit_width; u8 bit_width;
u8 bit_offset; u8 bit_offset;
u8 access_width; u8 access_width;
u64 __iomem address; u64 address;
} __packed; } __packed;
/* /*

View File

@ -1444,7 +1444,7 @@ static bool atpx_present(void)
dhandle = ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (dhandle) { if (dhandle) {
status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
pci_dev_put(pdev); pci_dev_put(pdev);
return true; return true;
} }
@ -1454,7 +1454,7 @@ static bool atpx_present(void)
dhandle = ACPI_HANDLE(&pdev->dev); dhandle = ACPI_HANDLE(&pdev->dev);
if (dhandle) { if (dhandle) {
status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
if (!ACPI_FAILURE(status)) { if (ACPI_SUCCESS(status)) {
pci_dev_put(pdev); pci_dev_put(pdev);
return true; return true;
} }