From: Rafael J. Wysocki Date: Thu, 6 Jul 2023 17:24:06 +0000 (+0200) Subject: Merge branches 'acpi-bus' and 'acpi-scan' X-Git-Tag: v6.5-rc1~29^2 X-Git-Url: https://repo.jachan.dev/linux.git/commitdiff_plain/2e178ee13b02d95c7380f6a21149de535ccdfc7f?hp=-c Merge branches 'acpi-bus' and 'acpi-scan' Merge additional ACPI device enumeration code changes for 6.5-rc1. - Make acpi_companion_match() return a const pointer and update its callers accordingly (Andy Shevchenko). - Move the extern declaration of the acpi_root variable to a header file so as to address a compiler warning (Andy Shevchenko). - Address compiler warnings in the ACPI device enumeration code by adding a missing header file include to it (Ben Dooks). - Refine the SMB0001 quirk in the ACPI device enumeration code so as to address an i2c-scmi driver regression (Andy Shevchenko). - Clean up two pieces of the ACPI device enumeration code (Andy Shevchenko). * acpi-bus: ACPI: bus: Constify acpi_companion_match() returned value * acpi-scan: ACPI: scan: Use the acpi_match_acpi_device() helper ACPI: platform: Move SMB0001 HID to the header and reuse ACPI: platform: Ignore SMB0001 only when it has resources ACPI: bus: Introduce acpi_match_acpi_device() helper ACPI: scan: fix undeclared variable warnings by including sleep.h ACPI: scan: Move acpi_root to internal header --- 2e178ee13b02d95c7380f6a21149de535ccdfc7f diff --combined drivers/acpi/bus.c index e3e0bd0c5a50,20cdfb37da79,8c086c87cbb6..2fc2b43a4ed3 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@@@ -682,7 -682,7 -682,7 +682,7 @@@@ bool acpi_device_is_first_physical_node * resources available from it but they will be matched normally using functions * provided by their bus types (and analogously for their modalias). */ - -struct acpi_device *acpi_companion_match(const struct device *dev) + +const struct acpi_device *acpi_companion_match(const struct device *dev) { struct acpi_device *adev; @@@@ -706,7 -706,7 -706,7 +706,7 @@@@ * identifiers and a _DSD object with the "compatible" property, use that * property to match against the given list of identifiers. */ - -static bool acpi_of_match_device(struct acpi_device *adev, + +static bool acpi_of_match_device(const struct acpi_device *adev, const struct of_device_id *of_match_table, const struct of_device_id **of_id) { @@@@ -808,7 -808,7 -808,7 +808,7 @@@@ static bool __acpi_match_device_cls(con return true; } - -static bool __acpi_match_device(struct acpi_device *device, + +static bool __acpi_match_device(const struct acpi_device *device, const struct acpi_device_id *acpi_ids, const struct of_device_id *of_ids, const struct acpi_device_id **acpi_id, @@@@ -850,6 -850,6 -850,26 +850,26 @@@@ out_acpi_match return true; } ++ /** ++ * acpi_match_acpi_device - Match an ACPI device against a given list of ACPI IDs ++ * @ids: Array of struct acpi_device_id objects to match against. ++ * @adev: The ACPI device pointer to match. ++ * ++ * Match the ACPI device @adev against a given list of ACPI IDs @ids. ++ * ++ * Return: ++ * a pointer to the first matching ACPI ID on success or %NULL on failure. ++ */ ++ const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_id *ids, ++ const struct acpi_device *adev) ++ { ++ const struct acpi_device_id *id = NULL; ++ ++ __acpi_match_device(adev, ids, NULL, &id, NULL); ++ return id; ++ } ++ EXPORT_SYMBOL_GPL(acpi_match_acpi_device); ++ /** * acpi_match_device - Match a struct device against a given list of ACPI IDs * @ids: Array of struct acpi_device_id object to match against. @@@@ -864,10 -864,10 -884,7 +884,7 @@@@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev) { -- const struct acpi_device_id *id = NULL; -- -- __acpi_match_device(acpi_companion_match(dev), ids, NULL, &id, NULL); -- return id; ++ return acpi_match_acpi_device(ids, acpi_companion_match(dev)); } EXPORT_SYMBOL_GPL(acpi_match_device); diff --combined drivers/acpi/internal.h index 06ad497067ac,95501a148591,50dcb35c9965..f4148dc50b9c --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@@@ -11,6 -11,6 -11,8 +11,8 @@@@ #include ++ extern struct acpi_device *acpi_root; ++ int early_acpi_osi_init(void); int acpi_osi_init(void); acpi_status acpi_os_initialize1(void); @@@@ -119,7 -119,7 -121,7 +121,7 @@@@ int acpi_bus_register_early_device(int /* -------------------------------------------------------------------------- Device Matching and Notification -------------------------------------------------------------------------- */ - -struct acpi_device *acpi_companion_match(const struct device *dev); + +const struct acpi_device *acpi_companion_match(const struct device *dev); int __acpi_device_uevent_modalias(const struct acpi_device *adev, struct kobj_uevent_env *env);