Subject: linux-next: build failure after merge of the pm tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 3 Apr 2023 20:18:01 +1000

Hi all,

After merging the pm tree, today's linux-next build (powerpc allyesconfig)
failed like this:

In file included from drivers/char/tpm/tpm_atmel.c:18:
drivers/char/tpm/tpm_atmel.h: In function 'atmel_get_base_addr':
drivers/char/tpm/tpm_atmel.h:50:14: error: implicit declaration of function 'of_find_node_by_name'; did you mean 'bus_find_device_by_name'? [-Werror=implicit-function-declaration]
   50 |         dn = of_find_node_by_name(NULL, "tpm");
      |              ^~~~~~~~~~~~~~~~~~~~
      |              bus_find_device_by_name
drivers/char/tpm/tpm_atmel.h:50:12: error: assignment to 'struct device_node *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
   50 |         dn = of_find_node_by_name(NULL, "tpm");
      |            ^
drivers/char/tpm/tpm_atmel.h:55:14: error: implicit declaration of function 'of_device_is_compatible'; did you mean 'fwnode_device_is_compatible'? [-Werror=implicit-function-declaration]
   55 |         if (!of_device_is_compatible(dn, "AT97SC3201")) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~
      |              fwnode_device_is_compatible
drivers/char/tpm/tpm_atmel.h:56:17: error: implicit declaration of function 'of_node_put' [-Werror=implicit-function-declaration]
   56 |                 of_node_put(dn);
      |                 ^~~~~~~~~~~
drivers/char/tpm/tpm_atmel.h:60:15: error: implicit declaration of function 'of_get_property' [-Werror=implicit-function-declaration]
   60 |         reg = of_get_property(dn, "reg", &reglen);
      |               ^~~~~~~~~~~~~~~
drivers/char/tpm/tpm_atmel.h:60:13: error: assignment to 'const unsigned int *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
   60 |         reg = of_get_property(dn, "reg", &reglen);
      |             ^
drivers/char/tpm/tpm_atmel.h:61:18: error: implicit declaration of function 'of_n_addr_cells' [-Werror=implicit-function-declaration]
   61 |         naddrc = of_n_addr_cells(dn);
      |                  ^~~~~~~~~~~~~~~
drivers/char/tpm/tpm_atmel.h:62:18: error: implicit declaration of function 'of_n_size_cells' [-Werror=implicit-function-declaration]
   62 |         nsizec = of_n_size_cells(dn);
      |                  ^~~~~~~~~~~~~~~
drivers/perf/arm_dmc620_pmu.c:710:36: error: array type has incomplete element type 'struct acpi_device_id'
  710 | static const struct acpi_device_id dmc620_acpi_match[] = {
      |                                    ^~~~~~~~~~~~~~~~~
drivers/perf/arm_dmc620_pmu.c:710:36: error: 'dmc620_acpi_match' defined but not used [-Werror=unused-variable]
drivers/perf/alibaba_uncore_drw_pmu.c:757:36: error: array type has incomplete element type 'struct acpi_device_id'
  757 | static const struct acpi_device_id ali_drw_acpi_match[] = {
      |                                    ^~~~~~~~~~~~~~~~~~
drivers/perf/alibaba_uncore_drw_pmu.c:757:36: error: 'ali_drw_acpi_match' defined but not used [-Werror=unused-variable]

Caused by commit

  054e68aae050 ("ACPI: Replace irqdomain.h include with struct declarations")

I have applied the following fixup patch:

From: Stephen Rothwell <[email-masked]>
Date: Mon, 3 Apr 2023 19:58:19 +1000
Subject: [PATCH] more fixups for "ACPI: Replace irqdomain.h include with
 struct declarations"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/char/tpm/tpm_atmel.h          | 2 ++
 drivers/perf/alibaba_uncore_drw_pmu.c | 1 +
 drivers/perf/arm_dmc620_pmu.c         | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h
index ba37e77e8af3..0129d76a4fa3 100644
--- a/drivers/char/tpm/tpm_atmel.h
+++ b/drivers/char/tpm/tpm_atmel.h
@@ -26,6 +26,8 @@ struct tpm_atmel_priv {
 
 #ifdef CONFIG_PPC64
 
+#include <linux/of.h>
+
 #include <asm/prom.h>
 
 #define atmel_getb(priv, offset) readb(priv->iobase + offset)
diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c
index 5c5be9fc1b15..208b1fe1d247 100644
--- a/drivers/perf/alibaba_uncore_drw_pmu.c
+++ b/drivers/perf/alibaba_uncore_drw_pmu.c
@@ -28,6 +28,7 @@
 #include <linux/printk.h>
 #include <linux/rculist.h>
 #include <linux/refcount.h>
+#include <linux/mod_devicetable.h>

 #define ALI_DRW_PMU_COMMON_MAX_COUNTERS			16
diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
index 5de06f9a4dd3..3a006b34b515 100644
--- a/drivers/perf/arm_dmc620_pmu.c
+++ b/drivers/perf/arm_dmc620_pmu.c
@@ -27,6 +27,7 @@
 #include <linux/printk.h>
 #include <linux/rculist.h>
 #include <linux/refcount.h>
+#include <linux/mod_devicetable.h>
 
 #define DMC620_PA_SHIFT					12
 #define DMC620_CNT_INIT					0x80000000
-- 
2.39.2

-- 
Cheers,
Stephen Rothwell