Skip to content

Commit 2b396d3

Browse files
yishimatsudavem330
authored andcommitted
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: Yasuaki Ishimatsu <[email protected]> CC: Taku Izumi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ac23d3c commit 2b396d3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/net/fjes/fjes_main.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,24 @@ static bool is_extended_socket_device(struct acpi_device *device)
144144
return true;
145145
}
146146

147+
static int acpi_check_extended_socket_status(struct acpi_device *device)
148+
{
149+
unsigned long long sta;
150+
acpi_status status;
151+
152+
status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
153+
if (ACPI_FAILURE(status))
154+
return -ENODEV;
155+
156+
if (!((sta & ACPI_STA_DEVICE_PRESENT) &&
157+
(sta & ACPI_STA_DEVICE_ENABLED) &&
158+
(sta & ACPI_STA_DEVICE_UI) &&
159+
(sta & ACPI_STA_DEVICE_FUNCTIONING)))
160+
return -ENODEV;
161+
162+
return 0;
163+
}
164+
147165
static int fjes_acpi_add(struct acpi_device *device)
148166
{
149167
struct platform_device *plat_dev;
@@ -152,6 +170,9 @@ static int fjes_acpi_add(struct acpi_device *device)
152170
if (!is_extended_socket_device(device))
153171
return -ENODEV;
154172

173+
if (acpi_check_extended_socket_status(device))
174+
return -ENODEV;
175+
155176
status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
156177
fjes_get_acpi_resource, fjes_resource);
157178
if (ACPI_FAILURE(status))
@@ -1503,6 +1524,9 @@ acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level,
15031524
if (!is_extended_socket_device(device))
15041525
return AE_OK;
15051526

1527+
if (acpi_check_extended_socket_status(device))
1528+
return AE_OK;
1529+
15061530
*found = true;
15071531
return AE_CTRL_TERMINATE;
15081532
}

0 commit comments

Comments
 (0)