Commit 3b319ee2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'acpi-5.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki:
 "These fix a couple of issues and do some cleanups on top of the
  previous ACPI changes for 5.1-rc1.

  Specifics:

   - Fix a crash caused by unloading an SSDT overlay (Andy Shevchenko)

   - Prevent user space from getting confusing error values on failing
     ACPI sysfs accesses (Rafael Wysocki)

   - Simplify leaf node detection in the PPTT parsing code by using a
     new flag defined in ACPI 6.3 (Jeremy Linton)

   - Add missing "static" in some places in the ACPI configfs code (Andy
     Shevchenko)

   - Fix acpidbg tool path in the ACPI documentation (Flavio Suligoi)"

* tag 'acpi-5.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: sysfs: Prevent get_status() from returning acpi_status
  ACPI / device_sysfs: Avoid OF modalias creation for removed device
  ACPI / configfs: Mark local data structures static
  ACPI / configfs: Mark local functions static
  ACPI: tables: Simplify PPTT leaf node detection
  ACPI: Documentation: Fix path for acpidbg tool
parents 9352ca58 b6e88119
...@@ -23,7 +23,7 @@ kernel. ...@@ -23,7 +23,7 @@ kernel.
The resultant userspace tool binary is then located at: The resultant userspace tool binary is then located at:
tools/acpi/power/acpi/acpidbg/acpidbg tools/power/acpi/acpidbg
It can be installed to system directories by running "make install" (as a It can be installed to system directories by running "make install" (as a
sufficiently privileged user). sufficiently privileged user).
...@@ -35,7 +35,7 @@ kernel. ...@@ -35,7 +35,7 @@ kernel.
# mount -t debugfs none /sys/kernel/debug # mount -t debugfs none /sys/kernel/debug
# modprobe acpi_dbg # modprobe acpi_dbg
# tools/acpi/power/acpi/acpidbg/acpidbg # tools/power/acpi/acpidbg
That spawns the interactive AML debugger environment where you can execute That spawns the interactive AML debugger environment where you can execute
debugger commands. debugger commands.
......
...@@ -97,12 +97,12 @@ static ssize_t acpi_table_aml_read(struct config_item *cfg, ...@@ -97,12 +97,12 @@ static ssize_t acpi_table_aml_read(struct config_item *cfg,
CONFIGFS_BIN_ATTR(acpi_table_, aml, NULL, MAX_ACPI_TABLE_SIZE); CONFIGFS_BIN_ATTR(acpi_table_, aml, NULL, MAX_ACPI_TABLE_SIZE);
struct configfs_bin_attribute *acpi_table_bin_attrs[] = { static struct configfs_bin_attribute *acpi_table_bin_attrs[] = {
&acpi_table_attr_aml, &acpi_table_attr_aml,
NULL, NULL,
}; };
ssize_t acpi_table_signature_show(struct config_item *cfg, char *str) static ssize_t acpi_table_signature_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -112,7 +112,7 @@ ssize_t acpi_table_signature_show(struct config_item *cfg, char *str) ...@@ -112,7 +112,7 @@ ssize_t acpi_table_signature_show(struct config_item *cfg, char *str)
return sprintf(str, "%.*s\n", ACPI_NAME_SIZE, h->signature); return sprintf(str, "%.*s\n", ACPI_NAME_SIZE, h->signature);
} }
ssize_t acpi_table_length_show(struct config_item *cfg, char *str) static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -122,7 +122,7 @@ ssize_t acpi_table_length_show(struct config_item *cfg, char *str) ...@@ -122,7 +122,7 @@ ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
return sprintf(str, "%d\n", h->length); return sprintf(str, "%d\n", h->length);
} }
ssize_t acpi_table_revision_show(struct config_item *cfg, char *str) static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -132,7 +132,7 @@ ssize_t acpi_table_revision_show(struct config_item *cfg, char *str) ...@@ -132,7 +132,7 @@ ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
return sprintf(str, "%d\n", h->revision); return sprintf(str, "%d\n", h->revision);
} }
ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str) static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -142,7 +142,7 @@ ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str) ...@@ -142,7 +142,7 @@ ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
return sprintf(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id); return sprintf(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id);
} }
ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str) static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -152,7 +152,7 @@ ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str) ...@@ -152,7 +152,7 @@ ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
return sprintf(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id); return sprintf(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id);
} }
ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str) static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -162,7 +162,8 @@ ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str) ...@@ -162,7 +162,8 @@ ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
return sprintf(str, "%d\n", h->oem_revision); return sprintf(str, "%d\n", h->oem_revision);
} }
ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg, char *str) static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -172,8 +173,8 @@ ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg, char *str) ...@@ -172,8 +173,8 @@ ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg, char *str)
return sprintf(str, "%.*s\n", ACPI_NAME_SIZE, h->asl_compiler_id); return sprintf(str, "%.*s\n", ACPI_NAME_SIZE, h->asl_compiler_id);
} }
ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg, static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
char *str) char *str)
{ {
struct acpi_table_header *h = get_header(cfg); struct acpi_table_header *h = get_header(cfg);
...@@ -192,7 +193,7 @@ CONFIGFS_ATTR_RO(acpi_table_, oem_revision); ...@@ -192,7 +193,7 @@ CONFIGFS_ATTR_RO(acpi_table_, oem_revision);
CONFIGFS_ATTR_RO(acpi_table_, asl_compiler_id); CONFIGFS_ATTR_RO(acpi_table_, asl_compiler_id);
CONFIGFS_ATTR_RO(acpi_table_, asl_compiler_revision); CONFIGFS_ATTR_RO(acpi_table_, asl_compiler_revision);
struct configfs_attribute *acpi_table_attrs[] = { static struct configfs_attribute *acpi_table_attrs[] = {
&acpi_table_attr_signature, &acpi_table_attr_signature,
&acpi_table_attr_length, &acpi_table_attr_length,
&acpi_table_attr_revision, &acpi_table_attr_revision,
...@@ -232,7 +233,7 @@ static void acpi_table_drop_item(struct config_group *group, ...@@ -232,7 +233,7 @@ static void acpi_table_drop_item(struct config_group *group,
acpi_tb_unload_table(table->index); acpi_tb_unload_table(table->index);
} }
struct configfs_group_operations acpi_table_group_ops = { static struct configfs_group_operations acpi_table_group_ops = {
.make_item = acpi_table_make_item, .make_item = acpi_table_make_item,
.drop_item = acpi_table_drop_item, .drop_item = acpi_table_drop_item,
}; };
......
...@@ -202,11 +202,15 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias, ...@@ -202,11 +202,15 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,
{ {
struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
const union acpi_object *of_compatible, *obj; const union acpi_object *of_compatible, *obj;
acpi_status status;
int len, count; int len, count;
int i, nval; int i, nval;
char *c; char *c;
acpi_get_name(acpi_dev->handle, ACPI_SINGLE_NAME, &buf); status = acpi_get_name(acpi_dev->handle, ACPI_SINGLE_NAME, &buf);
if (ACPI_FAILURE(status))
return -ENODEV;
/* DT strings are all in lower case */ /* DT strings are all in lower case */
for (c = buf.pointer; *c != '\0'; c++) for (c = buf.pointer; *c != '\0'; c++)
*c = tolower(*c); *c = tolower(*c);
......
...@@ -209,6 +209,9 @@ static int acpi_pptt_leaf_node(struct acpi_table_header *table_hdr, ...@@ -209,6 +209,9 @@ static int acpi_pptt_leaf_node(struct acpi_table_header *table_hdr,
struct acpi_pptt_processor *cpu_node; struct acpi_pptt_processor *cpu_node;
u32 proc_sz; u32 proc_sz;
if (table_hdr->revision > 1)
return (node->flags & ACPI_PPTT_ACPI_LEAF_NODE);
table_end = (unsigned long)table_hdr + table_hdr->length; table_end = (unsigned long)table_hdr + table_hdr->length;
node_entry = ACPI_PTR_DIFF(node, table_hdr); node_entry = ACPI_PTR_DIFF(node, table_hdr);
entry = ACPI_ADD_PTR(struct acpi_subtable_header, table_hdr, entry = ACPI_ADD_PTR(struct acpi_subtable_header, table_hdr,
......
...@@ -648,26 +648,29 @@ static void acpi_global_event_handler(u32 event_type, acpi_handle device, ...@@ -648,26 +648,29 @@ static void acpi_global_event_handler(u32 event_type, acpi_handle device,
} }
} }
static int get_status(u32 index, acpi_event_status *status, static int get_status(u32 index, acpi_event_status *ret,
acpi_handle *handle) acpi_handle *handle)
{ {
int result; acpi_status status;
if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS)
return -EINVAL; return -EINVAL;
if (index < num_gpes) { if (index < num_gpes) {
result = acpi_get_gpe_device(index, handle); status = acpi_get_gpe_device(index, handle);
if (result) { if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND,
"Invalid GPE 0x%x", index)); "Invalid GPE 0x%x", index));
return result; return -ENXIO;
} }
result = acpi_get_gpe_status(*handle, index, status); status = acpi_get_gpe_status(*handle, index, ret);
} else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) } else {
result = acpi_get_event_status(index - num_gpes, status); status = acpi_get_event_status(index - num_gpes, ret);
}
if (ACPI_FAILURE(status))
return -EIO;
return result; return 0;
} }
static ssize_t counter_show(struct kobject *kobj, static ssize_t counter_show(struct kobject *kobj,
......
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