Commit 434a438a authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-hotplug', 'acpi-sysfs' and 'acpi-sleep'

* acpi-hotplug:
  ACPI / hotplug: Fix conflicted PCI bridge notify handlers

* acpi-sysfs:
  ACPI / sysfs: Fix incorrect ACPI tables walk in acpi_tables_sysfs_init()
  ACPI / sysfs: Set file size for each exposed ACPI table

* acpi-sleep:
  ACPI / sleep: clean up compiler warning about uninitialized field
...@@ -65,6 +65,9 @@ static struct acpi_scan_handler pci_root_handler = { ...@@ -65,6 +65,9 @@ static struct acpi_scan_handler pci_root_handler = {
.ids = root_device_ids, .ids = root_device_ids,
.attach = acpi_pci_root_add, .attach = acpi_pci_root_add,
.detach = acpi_pci_root_remove, .detach = acpi_pci_root_remove,
.hotplug = {
.ignore = true,
},
}; };
static DEFINE_MUTEX(osc_lock); static DEFINE_MUTEX(osc_lock);
......
...@@ -1772,7 +1772,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type) ...@@ -1772,7 +1772,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
*/ */
list_for_each_entry(hwid, &pnp.ids, list) { list_for_each_entry(hwid, &pnp.ids, list) {
handler = acpi_scan_match_handler(hwid->id, NULL); handler = acpi_scan_match_handler(hwid->id, NULL);
if (handler) { if (handler && !handler->hotplug.ignore) {
acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
acpi_hotplug_notify_cb, handler); acpi_hotplug_notify_cb, handler);
break; break;
......
...@@ -525,7 +525,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) ...@@ -525,7 +525,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
* generate wakeup events. * generate wakeup events.
*/ */
if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) { if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) {
acpi_event_status pwr_btn_status; acpi_event_status pwr_btn_status = ACPI_EVENT_FLAG_DISABLED;
acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status); acpi_get_event_status(ACPI_EVENT_POWER_BUTTON, &pwr_btn_status);
......
...@@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, ...@@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
table_attr->instance); table_attr->instance);
table_attr->attr.size = 0; table_attr->attr.size = table_header->length;
table_attr->attr.read = acpi_table_show; table_attr->attr.read = acpi_table_show;
table_attr->attr.attr.name = table_attr->name; table_attr->attr.attr.name = table_attr->name;
table_attr->attr.attr.mode = 0400; table_attr->attr.attr.mode = 0400;
...@@ -354,8 +354,9 @@ static int acpi_tables_sysfs_init(void) ...@@ -354,8 +354,9 @@ static int acpi_tables_sysfs_init(void)
{ {
struct acpi_table_attr *table_attr; struct acpi_table_attr *table_attr;
struct acpi_table_header *table_header = NULL; struct acpi_table_header *table_header = NULL;
int table_index = 0; int table_index;
int result; acpi_status status;
int ret;
tables_kobj = kobject_create_and_add("tables", acpi_kobj); tables_kobj = kobject_create_and_add("tables", acpi_kobj);
if (!tables_kobj) if (!tables_kobj)
...@@ -365,33 +366,34 @@ static int acpi_tables_sysfs_init(void) ...@@ -365,33 +366,34 @@ static int acpi_tables_sysfs_init(void)
if (!dynamic_tables_kobj) if (!dynamic_tables_kobj)
goto err_dynamic_tables; goto err_dynamic_tables;
do { for (table_index = 0;; table_index++) {
result = acpi_get_table_by_index(table_index, &table_header); status = acpi_get_table_by_index(table_index, &table_header);
if (!result) {
table_index++; if (status == AE_BAD_PARAMETER)
break;
if (ACPI_FAILURE(status))
continue;
table_attr = NULL; table_attr = NULL;
table_attr = table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
if (!table_attr) if (!table_attr)
return -ENOMEM; return -ENOMEM;
acpi_table_attr_init(table_attr, table_header); acpi_table_attr_init(table_attr, table_header);
result = ret = sysfs_create_bin_file(tables_kobj, &table_attr->attr);
sysfs_create_bin_file(tables_kobj, if (ret) {
&table_attr->attr);
if (result) {
kfree(table_attr); kfree(table_attr);
return result; return ret;
} else }
list_add_tail(&table_attr->node, list_add_tail(&table_attr->node, &acpi_table_attr_list);
&acpi_table_attr_list);
} }
} while (!result);
kobject_uevent(tables_kobj, KOBJ_ADD); kobject_uevent(tables_kobj, KOBJ_ADD);
kobject_uevent(dynamic_tables_kobj, KOBJ_ADD); kobject_uevent(dynamic_tables_kobj, KOBJ_ADD);
result = acpi_install_table_handler(acpi_sysfs_table_handler, NULL); status = acpi_install_table_handler(acpi_sysfs_table_handler, NULL);
return result == AE_OK ? 0 : -EINVAL; return ACPI_FAILURE(status) ? -EINVAL : 0;
err_dynamic_tables: err_dynamic_tables:
kobject_put(tables_kobj); kobject_put(tables_kobj);
err: err:
......
...@@ -100,6 +100,7 @@ enum acpi_hotplug_mode { ...@@ -100,6 +100,7 @@ enum acpi_hotplug_mode {
struct acpi_hotplug_profile { struct acpi_hotplug_profile {
struct kobject kobj; struct kobject kobj;
bool enabled:1; bool enabled:1;
bool ignore:1;
enum acpi_hotplug_mode mode; enum acpi_hotplug_mode mode;
}; };
......
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