When a device is matched via PRP0001, the driver's OF (DT) match table must be used to obtain the device match data. If a driver provides both an acpi_match_table and an of_match_table, the current acpi_device_get_match_data() path consults the driver's acpi_match_table and returns NULL (no ACPI ID matches).
Explicitly detect PRP0001 and fetch match data from the driver's of_match_table via acpi_of_device_get_match_data().
Fixes: 886ca88be6b3 ("ACPI / bus: Respect PRP0001 when retrieving device match data") Cc: stable@vger.kernel.org Signed-off-by: Kartik Rajput kkartik@nvidia.com --- drivers/acpi/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5e110badac7b..4cd425fffa97 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1031,8 +1031,9 @@ const void *acpi_device_get_match_data(const struct device *dev) { const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; const struct acpi_device_id *match; + struct acpi_device = ACPI_COMPANION(dev);
- if (!acpi_ids) + if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) return acpi_of_device_get_match_data(dev);
match = acpi_match_device(acpi_ids, dev);
Hi Kartik,
On Wed, Jan 07, 2026 at 11:54:52AM +0530, Kartik Rajput wrote:
When a device is matched via PRP0001, the driver's OF (DT) match table must be used to obtain the device match data. If a driver provides both an acpi_match_table and an of_match_table, the current acpi_device_get_match_data() path consults the driver's acpi_match_table and returns NULL (no ACPI ID matches).
Explicitly detect PRP0001 and fetch match data from the driver's of_match_table via acpi_of_device_get_match_data().
Fixes: 886ca88be6b3 ("ACPI / bus: Respect PRP0001 when retrieving device match data") Cc: stable@vger.kernel.org Signed-off-by: Kartik Rajput kkartik@nvidia.com
drivers/acpi/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5e110badac7b..4cd425fffa97 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1031,8 +1031,9 @@ const void *acpi_device_get_match_data(const struct device *dev) { const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; const struct acpi_device_id *match;
- struct acpi_device = ACPI_COMPANION(dev);
Oops!
- if (!acpi_ids)
- if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) return acpi_of_device_get_match_data(dev);
match = acpi_match_device(acpi_ids, dev);
On 07/01/26 17:12, Sakari Ailus wrote:
External email: Use caution opening links or attachments
Hi Kartik,
On Wed, Jan 07, 2026 at 11:54:52AM +0530, Kartik Rajput wrote:
When a device is matched via PRP0001, the driver's OF (DT) match table must be used to obtain the device match data. If a driver provides both an acpi_match_table and an of_match_table, the current acpi_device_get_match_data() path consults the driver's acpi_match_table and returns NULL (no ACPI ID matches).
Explicitly detect PRP0001 and fetch match data from the driver's of_match_table via acpi_of_device_get_match_data().
Fixes: 886ca88be6b3 ("ACPI / bus: Respect PRP0001 when retrieving device match data") Cc: stable@vger.kernel.org Signed-off-by: Kartik Rajput kkartik@nvidia.com
drivers/acpi/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5e110badac7b..4cd425fffa97 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1031,8 +1031,9 @@ const void *acpi_device_get_match_data(const struct device *dev) { const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; const struct acpi_device_id *match;
struct acpi_device = ACPI_COMPANION(dev);Oops!
Apologies for this. Should've been "struct acpi_device *adev = ACPI_COMPANION(dev);"
I have posted the updated patch for review.
Thanks, Kartik
Hi Kartik,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on rafael-pm/bleeding-edge westeri-thunderbolt/next linus/master v6.16-rc1 next-20260107] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kartik-Rajput/ACPI-bus-Use-OF... base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260107062453.10893-1-kkartik%40nvidia.com patch subject: [PATCH] ACPI: bus: Use OF match data for PRP0001 matched devices config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260107/202601072231.MPkHMWgN-lkp@i...) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260107/202601072231.MPkHMWgN-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202601072231.MPkHMWgN-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/acpi/bus.c:1034:21: error: expected identifier or '('
1034 | struct acpi_device = ACPI_COMPANION(dev); | ^
drivers/acpi/bus.c:1036:53: error: use of undeclared identifier 'adev'; did you mean 'dev'?
1036 | if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) | ^~~~ | dev drivers/acpi/bus.c:1030:61: note: 'dev' declared here 1030 | const void *acpi_device_get_match_data(const struct device *dev) | ^
drivers/acpi/bus.c:1037:3: error: expected ')'
1037 | return acpi_of_device_get_match_data(dev); | ^ drivers/acpi/bus.c:1036:5: note: to match this '(' 1036 | if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) | ^ 3 errors generated.
vim +1034 drivers/acpi/bus.c
1029 1030 const void *acpi_device_get_match_data(const struct device *dev) 1031 { 1032 const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; 1033 const struct acpi_device_id *match;
1034 struct acpi_device = ACPI_COMPANION(dev);
1035
1036 if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) 1037 return acpi_of_device_get_match_data(dev);
1038 1039 match = acpi_match_device(acpi_ids, dev); 1040 if (!match) 1041 return NULL; 1042 1043 return (const void *)match->driver_data; 1044 } 1045 EXPORT_SYMBOL_GPL(acpi_device_get_match_data); 1046
Hi Kartik,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on rafael-pm/bleeding-edge westeri-thunderbolt/next linus/master v6.19-rc4 next-20260107] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kartik-Rajput/ACPI-bus-Use-OF... base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20260107062453.10893-1-kkartik%40nvidia.com patch subject: [PATCH] ACPI: bus: Use OF match data for PRP0001 matched devices config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20260107/202601072317.QNoPkgyy-lkp@i...) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260107/202601072317.QNoPkgyy-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202601072317.QNoPkgyy-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/acpi/bus.c: In function 'acpi_device_get_match_data':
drivers/acpi/bus.c:1034:28: error: expected identifier or '(' before '=' token
1034 | struct acpi_device = ACPI_COMPANION(dev); | ^ In file included from include/linux/acpi.h:38, from drivers/acpi/bus.c:19:
include/acpi/acpi_bus.h:531:10: error: expected statement before ')' token
531 | }) | ^ include/linux/acpi.h:58:41: note: in expansion of macro 'to_acpi_device_node' 58 | #define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode) | ^~~~~~~~~~~~~~~~~~~ drivers/acpi/bus.c:1034:30: note: in expansion of macro 'ACPI_COMPANION' 1034 | struct acpi_device = ACPI_COMPANION(dev); | ^~~~~~~~~~~~~~
drivers/acpi/bus.c:1036:60: error: 'adev' undeclared (first use in this function); did you mean 'dev'?
1036 | if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) | ^~~~ | dev drivers/acpi/bus.c:1036:60: note: each undeclared identifier is reported only once for each function it appears in
drivers/acpi/bus.c:1036:66: error: expected ')' before 'return'
1036 | if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev)) | ~ ^ | ) 1037 | return acpi_of_device_get_match_data(dev); | ~~~~~~
drivers/acpi/bus.c:1044:1: error: expected expression before '}' token
1044 | } | ^
drivers/acpi/bus.c:1033:38: warning: unused variable 'match' [-Wunused-variable]
1033 | const struct acpi_device_id *match; | ^~~~~
drivers/acpi/bus.c:1032:38: warning: unused variable 'acpi_ids' [-Wunused-variable]
1032 | const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; | ^~~~~~~~
drivers/acpi/bus.c:1044:1: warning: control reaches end of non-void function [-Wreturn-type]
1044 | } | ^ drivers/acpi/bus.c: At top level:
drivers/acpi/bus.c:1019:20: warning: 'acpi_of_device_get_match_data' defined but not used [-Wunused-function]
1019 | static const void *acpi_of_device_get_match_data(const struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1034 drivers/acpi/bus.c
1018
1019 static const void *acpi_of_device_get_match_data(const struct device *dev)
1020 { 1021 struct acpi_device *adev = ACPI_COMPANION(dev); 1022 const struct of_device_id *match = NULL; 1023 1024 if (!acpi_of_match_device(adev, dev->driver->of_match_table, &match)) 1025 return NULL; 1026 1027 return match->data; 1028 } 1029 1030 const void *acpi_device_get_match_data(const struct device *dev) 1031 {
1032 const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table; 1033 const struct acpi_device_id *match; 1034 struct acpi_device = ACPI_COMPANION(dev);
1035
1036 if (!strcmp(ACPI_DT_NAMESPACE_HID, acpi_device_hid(adev))
1037 return acpi_of_device_get_match_data(dev); 1038 1039 match = acpi_match_device(acpi_ids, dev); 1040 if (!match) 1041 return NULL; 1042 1043 return (const void *)match->driver_data;
1044 }
1045 EXPORT_SYMBOL_GPL(acpi_device_get_match_data); 1046
linux-stable-mirror@lists.linaro.org