Skip to content

Commit caf2cd6

Browse files
sudeep-hollawilldeacon
authored andcommitted
firmware: arm_sdei: Drop check for /firmware/ node and always register driver
As with most of the drivers, let us register this driver unconditionally by dropping the checks for presence of firmware nodes(DT) or entries(ACPI). Further, as mentioned in the commit acafce4 ("firmware: arm_sdei: Fix DT platform device creation"), the core takes care of creation of platform device when the appropriate device node is found and probe is called accordingly. Let us check only for the presence of ACPI firmware entry before creating the platform device and flag warning if we fail. Signed-off-by: Sudeep Holla <[email protected]> Reviewed-by: James Morse <[email protected]> Cc: James Morse <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 6a8b55e commit caf2cd6

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

drivers/firmware/arm_sdei.c

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,26 +1079,9 @@ static struct platform_driver sdei_driver = {
10791079
.probe = sdei_probe,
10801080
};
10811081

1082-
static bool __init sdei_present_dt(void)
1083-
{
1084-
struct device_node *np, *fw_np;
1085-
1086-
fw_np = of_find_node_by_name(NULL, "firmware");
1087-
if (!fw_np)
1088-
return false;
1089-
1090-
np = of_find_matching_node(fw_np, sdei_of_match);
1091-
if (!np)
1092-
return false;
1093-
of_node_put(np);
1094-
1095-
return true;
1096-
}
1097-
10981082
static bool __init sdei_present_acpi(void)
10991083
{
11001084
acpi_status status;
1101-
struct platform_device *pdev;
11021085
struct acpi_table_header *sdei_table_header;
11031086

11041087
if (acpi_disabled)
@@ -1113,20 +1096,24 @@ static bool __init sdei_present_acpi(void)
11131096
if (ACPI_FAILURE(status))
11141097
return false;
11151098

1116-
pdev = platform_device_register_simple(sdei_driver.driver.name, 0, NULL,
1117-
0);
1118-
if (IS_ERR(pdev))
1119-
return false;
1120-
11211099
return true;
11221100
}
11231101

11241102
static int __init sdei_init(void)
11251103
{
1126-
if (sdei_present_dt() || sdei_present_acpi())
1127-
platform_driver_register(&sdei_driver);
1104+
int ret = platform_driver_register(&sdei_driver);
11281105

1129-
return 0;
1106+
if (!ret && sdei_present_acpi()) {
1107+
struct platform_device *pdev;
1108+
1109+
pdev = platform_device_register_simple(sdei_driver.driver.name,
1110+
0, NULL, 0);
1111+
if (IS_ERR(pdev))
1112+
pr_info("Failed to register ACPI:SDEI platform device %ld\n",
1113+
PTR_ERR(pdev));
1114+
}
1115+
1116+
return ret;
11301117
}
11311118

11321119
/*

0 commit comments

Comments
 (0)