Skip to contentSkip to conversation

driver core: make bus_find_device_by_acpi_dev() stub prototype aligned

PATCH In review Andy Shevchenko 2 participants 2 messages Dec 29, 2025 – Jan 10 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: make bus_find_device_by_acpi_dev() stub prototype aligned

Currently the bus_find_device_by_acpi_dev() stub for !CONFIG_ACPI case takes a const void * parameter instead of const struct acpi_device *. As long as it's a pointer, we may named it as we want to with a help of a forward declaration. Hence move the declaration out of ifdeffery and use the same prototype in both cases. This adds a bit of an additional type checking at a compilation time.

---
 include/linux/device/bus.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/device/bus.h +2 -2
index 5c1aca0d48c8..763eea81cfb6 100644
@@ -216,9 +216,9 @@ bus_find_next_device(const struct bus_type *bus,struct device *cur)
 	return bus_find_device(bus, cur, NULL, device_match_any);
 }
 
-#ifdef CONFIG_ACPI
 struct acpi_device;
 
+#ifdef CONFIG_ACPI
 /**
  * bus_find_device_by_acpi_dev : device iterator for locating a particular device
  * matching the ACPI COMPANION device.
@@ -232,7 +232,7 @@ bus_find_device_by_acpi_dev(const struct bus_type *bus, const struct acpi_device
 }
 #else
 static inline struct device *
-bus_find_device_by_acpi_dev(const struct bus_type *bus, const void *adev)
+bus_find_device_by_acpi_dev(const struct bus_type *bus, const struct acpi_device *adev)
 {
 	return NULL;
 }
Signature · 1 line
2.50.1
maintainer
#1 lore raw
Quoted 8 lines · Andy Shevchenko

Currently the bus_find_device_by_acpi_dev() stub for !CONFIG_ACPI case takes a const void * parameter instead of const struct acpi_device *. As long as it's a pointer, we may named it as we want to with a help of a forward declaration. Hence move the declaration out of ifdeffery and use the same prototype in both cases. This adds a bit of an additional type checking at a compilation time.

Applied to driver-core-testing, thanks!