diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index ec12d970d78d..518aae461a00 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1662,24 +1662,22 @@ bool acpi_bay_match(acpi_handle handle) | |||
1662 | return acpi_ata_match(phandle); | 1662 | return acpi_ata_match(phandle); |
1663 | } | 1663 | } |
1664 | 1664 | ||
1665 | bool acpi_device_is_battery(acpi_handle handle) | 1665 | bool acpi_device_is_battery(struct acpi_device *adev) |
1666 | { | 1666 | { |
1667 | struct acpi_device_info *info; | 1667 | struct acpi_hardware_id *hwid; |
1668 | bool ret = false; | ||
1669 | |||
1670 | if (!ACPI_SUCCESS(acpi_get_object_info(handle, &info))) | ||
1671 | return false; | ||
1672 | 1668 | ||
1673 | if (info->valid & ACPI_VALID_HID) | 1669 | list_for_each_entry(hwid, &adev->pnp.ids, list) |
1674 | ret = !strcmp("PNP0C0A", info->hardware_id.string); | 1670 | if (!strcmp("PNP0C0A", hwid->id)) |
1671 | return true; | ||
1675 | 1672 | ||
1676 | kfree(info); | 1673 | return false; |
1677 | return ret; | ||
1678 | } | 1674 | } |
1679 | 1675 | ||
1680 | static bool is_ejectable_bay(acpi_handle handle) | 1676 | static bool is_ejectable_bay(struct acpi_device *adev) |
1681 | { | 1677 | { |
1682 | if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(handle)) | 1678 | acpi_handle handle = adev->handle; |
1679 | |||
1680 | if (acpi_has_method(handle, "_EJ0") && acpi_device_is_battery(adev)) | ||
1683 | return true; | 1681 | return true; |
1684 | 1682 | ||
1685 | return acpi_bay_match(handle); | 1683 | return acpi_bay_match(handle); |
@@ -1989,7 +1987,7 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev) | |||
1989 | { | 1987 | { |
1990 | struct acpi_hardware_id *hwid; | 1988 | struct acpi_hardware_id *hwid; |
1991 | 1989 | ||
1992 | if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev->handle)) { | 1990 | if (acpi_dock_match(adev->handle) || is_ejectable_bay(adev)) { |
1993 | acpi_dock_add(adev); | 1991 | acpi_dock_add(adev); |
1994 | return; | 1992 | return; |
1995 | } | 1993 | } |