Skip to content

Commit

Permalink
Merge branches 'acpi-hotplug', 'acpi-sysfs' and 'acpi-sleep'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Rafael J. Wysocki committed Nov 25, 2013
4 parents 6ce4eac + ca499fc + de03bee + 51468a9 commit 434a438
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 28 deletions.
3 changes: 3 additions & 0 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ static struct acpi_scan_handler pci_root_handler = {
.ids = root_device_ids,
.attach = acpi_pci_root_add,
.detach = acpi_pci_root_remove,
.hotplug = {
.ignore = true,
},
};

static DEFINE_MUTEX(osc_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ static void acpi_scan_init_hotplug(acpi_handle handle, int type)
*/
list_for_each_entry(hwid, &pnp.ids, list) {
handler = acpi_scan_match_handler(hwid->id, NULL);
if (handler) {
if (handler && !handler->hotplug.ignore) {
acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
acpi_hotplug_notify_cb, handler);
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
* generate wakeup events.
*/
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);

Expand Down
54 changes: 28 additions & 26 deletions drivers/acpi/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
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.attr.name = table_attr->name;
table_attr->attr.attr.mode = 0400;
Expand Down Expand Up @@ -354,8 +354,9 @@ static int acpi_tables_sysfs_init(void)
{
struct acpi_table_attr *table_attr;
struct acpi_table_header *table_header = NULL;
int table_index = 0;
int result;
int table_index;
acpi_status status;
int ret;

tables_kobj = kobject_create_and_add("tables", acpi_kobj);
if (!tables_kobj)
Expand All @@ -365,33 +366,34 @@ static int acpi_tables_sysfs_init(void)
if (!dynamic_tables_kobj)
goto err_dynamic_tables;

do {
result = acpi_get_table_by_index(table_index, &table_header);
if (!result) {
table_index++;
table_attr = NULL;
table_attr =
kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL);
if (!table_attr)
return -ENOMEM;

acpi_table_attr_init(table_attr, table_header);
result =
sysfs_create_bin_file(tables_kobj,
&table_attr->attr);
if (result) {
kfree(table_attr);
return result;
} else
list_add_tail(&table_attr->node,
&acpi_table_attr_list);
for (table_index = 0;; table_index++) {
status = acpi_get_table_by_index(table_index, &table_header);

if (status == AE_BAD_PARAMETER)
break;

if (ACPI_FAILURE(status))
continue;

table_attr = NULL;
table_attr = kzalloc(sizeof(*table_attr), GFP_KERNEL);
if (!table_attr)
return -ENOMEM;

acpi_table_attr_init(table_attr, table_header);
ret = sysfs_create_bin_file(tables_kobj, &table_attr->attr);
if (ret) {
kfree(table_attr);
return ret;
}
} while (!result);
list_add_tail(&table_attr->node, &acpi_table_attr_list);
}

kobject_uevent(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:
kobject_put(tables_kobj);
err:
Expand Down
1 change: 1 addition & 0 deletions include/acpi/acpi_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ enum acpi_hotplug_mode {
struct acpi_hotplug_profile {
struct kobject kobj;
bool enabled:1;
bool ignore:1;
enum acpi_hotplug_mode mode;
};

Expand Down

0 comments on commit 434a438

Please sign in to comment.