Commit 2b396d30 authored by Yasuaki Ishimatsu's avatar Yasuaki Ishimatsu Committed by David S. Miller

fjes: Do not load fjes driver if extended socket device is not power on.

The extended device socket cannot turn on/off while system is running.
So when system boots up and the device is not power on, the fjes driver
does not need be loaded.

To check the status of the device, the patch adds ACPI _STA method check.
Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
CC: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac23d3ca
...@@ -144,6 +144,24 @@ static bool is_extended_socket_device(struct acpi_device *device) ...@@ -144,6 +144,24 @@ static bool is_extended_socket_device(struct acpi_device *device)
return true; return true;
} }
static int acpi_check_extended_socket_status(struct acpi_device *device)
{
unsigned long long sta;
acpi_status status;
status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status))
return -ENODEV;
if (!((sta & ACPI_STA_DEVICE_PRESENT) &&
(sta & ACPI_STA_DEVICE_ENABLED) &&
(sta & ACPI_STA_DEVICE_UI) &&
(sta & ACPI_STA_DEVICE_FUNCTIONING)))
return -ENODEV;
return 0;
}
static int fjes_acpi_add(struct acpi_device *device) static int fjes_acpi_add(struct acpi_device *device)
{ {
struct platform_device *plat_dev; struct platform_device *plat_dev;
...@@ -152,6 +170,9 @@ static int fjes_acpi_add(struct acpi_device *device) ...@@ -152,6 +170,9 @@ static int fjes_acpi_add(struct acpi_device *device)
if (!is_extended_socket_device(device)) if (!is_extended_socket_device(device))
return -ENODEV; return -ENODEV;
if (acpi_check_extended_socket_status(device))
return -ENODEV;
status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
fjes_get_acpi_resource, fjes_resource); fjes_get_acpi_resource, fjes_resource);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
...@@ -1503,6 +1524,9 @@ acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level, ...@@ -1503,6 +1524,9 @@ acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level,
if (!is_extended_socket_device(device)) if (!is_extended_socket_device(device))
return AE_OK; return AE_OK;
if (acpi_check_extended_socket_status(device))
return AE_OK;
*found = true; *found = true;
return AE_CTRL_TERMINATE; return AE_CTRL_TERMINATE;
} }
......
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