Skip to contentSkip to conversation

ACPI / bus: Remove checks in acpi_get_match_data()

PATCH Superseded Andy Shevchenko 1 participant 1 message Feb 1, 2018

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/6 ACPI / bus: Remove checks in acpi_get_match_data()

Quoted 27 lines · Andy Shevchenko

As well as its sibling of_device_get_match_data() has no such checks, no need to do it in acpi_get_match_data().

First of all, we are not supposed to call fwnode API like this without driver attached.

Second, since __acpi_match_device() does check input parameter there is
no need to duplicate it outside.

Fixes 80212a162329 ("ACPI / bus: Introduce acpi_get_match_data()

function")

Cc Sinan Kaya <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Vinod Koul <[email protected]>

---
v2: rebase on top of new patches, rephrase commit message

 drivers/acpi/bus.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/acpi/bus.c +0 -0
index f3a7c29e9190..413e4b1cb1be 100644
@@ -791,12 +791,6 @@ void *acpi_get_match_data(const struct device
 *dev)

drivers/acpi/bus.c void *acpi_get_match_data(const struct device · line 801

Quoted 10 lines
drivers/acpi/bus.c +0 -6
 {
 	const struct acpi_device_id *match;
 
-	if (!dev->driver)
-		return NULL;
-
 
-	if (!dev->driver->acpi_match_table)
-		return NULL;
-

Perhaps I have to add that this conditional prevents device_get_match_data() to work on PRP0001 devices AFAIU.

Quoted 4 lines
drivers/acpi/bus.c +0 -0
 	match = acpi_match_device(dev->driver->acpi_match_table,

dev);

drivers/acpi/bus.c +0 -0
 	if (!match)
 		return NULL;