2023-02-06 15:47:35

by Daniel Lezcano

[permalink] [raw]
Subject: [PATCH] thermal: Remove core header inclusion from drivers

As the name states "thermal_core.h" is the header file for the core
components of the thermal framework.

Too many drivers are including it. Hopefully the recent cleanups
helped to self encapsulate the code a bit more and prevented the
drivers to need this header.

Remove this inclusion in every place where it is possible.

Some other drivers did a confusion with the core header and the one
exported in linux/thermal.h. They include the former instead of the
latter. The changes also fix this.

The tegra/soctherm driver still remains as it uses an internal
function which need to be replaced.

The Intel HFI driver uses the netlink internal framework core and
should be changed to prevent to deal with the internals.

No functional changes

[ Applies to thermal/linux-next or linux-pm/linux-next ]

Signed-off-by: Daniel Lezcano <[email protected]>
---
drivers/thermal/amlogic_thermal.c | 1 -
drivers/thermal/armada_thermal.c | 2 --
drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
drivers/thermal/hisi_thermal.c | 3 +--
drivers/thermal/imx8mm_thermal.c | 1 -
drivers/thermal/imx_sc_thermal.c | 1 -
drivers/thermal/intel/intel_hfi.c | 3 ++-
drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 1 -
drivers/thermal/qoriq_thermal.c | 1 -
drivers/thermal/rcar_gen3_thermal.c | 1 -
drivers/thermal/samsung/exynos_tmu.c | 3 +--
drivers/thermal/st/stm_thermal.c | 1 -
drivers/thermal/tegra/tegra30-tsensor.c | 1 -
drivers/thermal/uniphier_thermal.c | 2 --
14 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
index d30cb791e63c..9235fda4ec1e 100644
--- a/drivers/thermal/amlogic_thermal.c
+++ b/drivers/thermal/amlogic_thermal.c
@@ -28,7 +28,6 @@
#include <linux/regmap.h>
#include <linux/thermal.h>

-#include "thermal_core.h"
#include "thermal_hwmon.h"

#define TSENSOR_CFG_REG1 0x4
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 83a4080bffc7..36653f692c80 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -19,8 +19,6 @@
#include <linux/regmap.h>
#include <linux/interrupt.h>

-#include "thermal_core.h"
-
/* Thermal Manager Control and Status Register */
#define PMU_TDC0_SW_RST_MASK (0x1 << 1)
#define PMU_TM_DISABLE_OFFS 0
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index 3d0710c6e004..23918bb76ae6 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -18,7 +18,6 @@
#include <linux/platform_device.h>
#include <linux/thermal.h>

-#include "../thermal_core.h"
#include "../thermal_hwmon.h"

#define BCM2835_TS_TSENSCTL 0x00
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 45226cab466e..62c67942293e 100644
--- a/drivers/thermal/hisi_thermal.c
+++ b/drivers/thermal/hisi_thermal.c
@@ -16,8 +16,7 @@
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/of_device.h>
-
-#include "thermal_core.h"
+#include <linux/thermal.h>

#define HI6220_TEMP0_LAG (0x0)
#define HI6220_TEMP0_TH (0x4)
diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index d247b48696cb..72b5d6f319c1 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -17,7 +17,6 @@
#include <linux/slab.h>
#include <linux/thermal.h>

-#include "thermal_core.h"
#include "thermal_hwmon.h"

#define TER 0x0 /* TMU enable */
diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
index 378f574607f7..f32e59e74623 100644
--- a/drivers/thermal/imx_sc_thermal.c
+++ b/drivers/thermal/imx_sc_thermal.c
@@ -13,7 +13,6 @@
#include <linux/slab.h>
#include <linux/thermal.h>

-#include "thermal_core.h"
#include "thermal_hwmon.h"

#define IMX_SC_MISC_FUNC_GET_TEMP 13
diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
index 6e604bda2b93..c69db6c90869 100644
--- a/drivers/thermal/intel/intel_hfi.c
+++ b/drivers/thermal/intel/intel_hfi.c
@@ -40,10 +40,11 @@

#include <asm/msr.h>

-#include "../thermal_core.h"
#include "intel_hfi.h"
#include "thermal_interrupt.h"

+#include "../thermal_netlink.h"
+
/* Hardware Feedback Interface MSR configuration bits */
#define HW_FEEDBACK_PTR_VALID_BIT BIT(0)
#define HW_FEEDBACK_CONFIG_HFI_ENABLE_BIT BIT(0)
diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
index e2429676d0d2..101c75d0e13f 100644
--- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
+++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
@@ -15,7 +15,6 @@
#include <linux/regmap.h>
#include <linux/thermal.h>

-#include "../thermal_core.h"
#include "../thermal_hwmon.h"

#define QPNP_TM_REG_DIG_MAJOR 0x01
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index d111e218f362..431c29c0898a 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -13,7 +13,6 @@
#include <linux/thermal.h>
#include <linux/units.h>

-#include "thermal_core.h"
#include "thermal_hwmon.h"

#define SITES_MAX 16
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index 4ef927437842..0fd2fd077638 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -17,7 +17,6 @@
#include <linux/sys_soc.h>
#include <linux/thermal.h>

-#include "thermal_core.h"
#include "thermal_hwmon.h"

/* Register offsets */
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 37465af59262..527d1eb0663a 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -20,11 +20,10 @@
#include <linux/of_irq.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
+#include <linux/thermal.h>

#include <dt-bindings/thermal/thermal_exynos.h>

-#include "../thermal_core.h"
-
/* Exynos generic registers */
#define EXYNOS_TMU_REG_TRIMINFO 0x0
#define EXYNOS_TMU_REG_CONTROL 0x20
diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index e7834ccc7976..735401958f01 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -19,7 +19,6 @@
#include <linux/platform_device.h>
#include <linux/thermal.h>

-#include "../thermal_core.h"
#include "../thermal_hwmon.h"

/* DTS register offsets */
diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c
index 0ffe37ce7df7..b3218b71b6d9 100644
--- a/drivers/thermal/tegra/tegra30-tsensor.c
+++ b/drivers/thermal/tegra/tegra30-tsensor.c
@@ -28,7 +28,6 @@

#include <soc/tegra/fuse.h>

-#include "../thermal_core.h"
#include "../thermal_hwmon.h"

#define TSENSOR_SENSOR0_CONFIG0 0x0
diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
index f8ab2ca76184..47801841b3f5 100644
--- a/drivers/thermal/uniphier_thermal.c
+++ b/drivers/thermal/uniphier_thermal.c
@@ -17,8 +17,6 @@
#include <linux/regmap.h>
#include <linux/thermal.h>

-#include "thermal_core.h"
-
/*
* block registers
* addresses are the offset from .block_base
--
2.34.1



2023-02-06 15:53:45

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

Hi Daniel,

[email protected] wrote on Mon, 6 Feb 2023 16:34:29 +0100:

> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---
> drivers/thermal/amlogic_thermal.c | 1 -
> drivers/thermal/armada_thermal.c | 2 --

For armada_thermal.c:

Reviewed-by: Miquel Raynal <[email protected]>

> drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
> drivers/thermal/hisi_thermal.c | 3 +--
> drivers/thermal/imx8mm_thermal.c | 1 -
> drivers/thermal/imx_sc_thermal.c | 1 -
> drivers/thermal/intel/intel_hfi.c | 3 ++-
> drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 1 -
> drivers/thermal/qoriq_thermal.c | 1 -
> drivers/thermal/rcar_gen3_thermal.c | 1 -
> drivers/thermal/samsung/exynos_tmu.c | 3 +--
> drivers/thermal/st/stm_thermal.c | 1 -
> drivers/thermal/tegra/tegra30-tsensor.c | 1 -
> drivers/thermal/uniphier_thermal.c | 2 --
> 14 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
> index d30cb791e63c..9235fda4ec1e 100644
> --- a/drivers/thermal/amlogic_thermal.c
> +++ b/drivers/thermal/amlogic_thermal.c
> @@ -28,7 +28,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define TSENSOR_CFG_REG1 0x4

Thanks,
Miquèl

2023-02-06 17:01:34

by Niklas Söderlund

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

Hi Daniel,

Thanks for your work.

On 2023-02-06 16:34:29 +0100, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---
> drivers/thermal/amlogic_thermal.c | 1 -
> drivers/thermal/armada_thermal.c | 2 --
> drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
> drivers/thermal/hisi_thermal.c | 3 +--
> drivers/thermal/imx8mm_thermal.c | 1 -
> drivers/thermal/imx_sc_thermal.c | 1 -
> drivers/thermal/intel/intel_hfi.c | 3 ++-
> drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 1 -
> drivers/thermal/qoriq_thermal.c | 1 -
> drivers/thermal/rcar_gen3_thermal.c | 1 -

For R-Car,

Reviewed-by: Niklas S?derlund <[email protected]>

> drivers/thermal/samsung/exynos_tmu.c | 3 +--
> drivers/thermal/st/stm_thermal.c | 1 -
> drivers/thermal/tegra/tegra30-tsensor.c | 1 -
> drivers/thermal/uniphier_thermal.c | 2 --
> 14 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
> index d30cb791e63c..9235fda4ec1e 100644
> --- a/drivers/thermal/amlogic_thermal.c
> +++ b/drivers/thermal/amlogic_thermal.c
> @@ -28,7 +28,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define TSENSOR_CFG_REG1 0x4
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 83a4080bffc7..36653f692c80 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -19,8 +19,6 @@
> #include <linux/regmap.h>
> #include <linux/interrupt.h>
>
> -#include "thermal_core.h"
> -
> /* Thermal Manager Control and Status Register */
> #define PMU_TDC0_SW_RST_MASK (0x1 << 1)
> #define PMU_TM_DISABLE_OFFS 0
> diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
> index 3d0710c6e004..23918bb76ae6 100644
> --- a/drivers/thermal/broadcom/bcm2835_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2835_thermal.c
> @@ -18,7 +18,6 @@
> #include <linux/platform_device.h>
> #include <linux/thermal.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> #define BCM2835_TS_TSENSCTL 0x00
> diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
> index 45226cab466e..62c67942293e 100644
> --- a/drivers/thermal/hisi_thermal.c
> +++ b/drivers/thermal/hisi_thermal.c
> @@ -16,8 +16,7 @@
> #include <linux/platform_device.h>
> #include <linux/io.h>
> #include <linux/of_device.h>
> -
> -#include "thermal_core.h"
> +#include <linux/thermal.h>
>
> #define HI6220_TEMP0_LAG (0x0)
> #define HI6220_TEMP0_TH (0x4)
> diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
> index d247b48696cb..72b5d6f319c1 100644
> --- a/drivers/thermal/imx8mm_thermal.c
> +++ b/drivers/thermal/imx8mm_thermal.c
> @@ -17,7 +17,6 @@
> #include <linux/slab.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define TER 0x0 /* TMU enable */
> diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
> index 378f574607f7..f32e59e74623 100644
> --- a/drivers/thermal/imx_sc_thermal.c
> +++ b/drivers/thermal/imx_sc_thermal.c
> @@ -13,7 +13,6 @@
> #include <linux/slab.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define IMX_SC_MISC_FUNC_GET_TEMP 13
> diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
> index 6e604bda2b93..c69db6c90869 100644
> --- a/drivers/thermal/intel/intel_hfi.c
> +++ b/drivers/thermal/intel/intel_hfi.c
> @@ -40,10 +40,11 @@
>
> #include <asm/msr.h>
>
> -#include "../thermal_core.h"
> #include "intel_hfi.h"
> #include "thermal_interrupt.h"
>
> +#include "../thermal_netlink.h"
> +
> /* Hardware Feedback Interface MSR configuration bits */
> #define HW_FEEDBACK_PTR_VALID_BIT BIT(0)
> #define HW_FEEDBACK_CONFIG_HFI_ENABLE_BIT BIT(0)
> diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> index e2429676d0d2..101c75d0e13f 100644
> --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> @@ -15,7 +15,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> #define QPNP_TM_REG_DIG_MAJOR 0x01
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index d111e218f362..431c29c0898a 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -13,7 +13,6 @@
> #include <linux/thermal.h>
> #include <linux/units.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define SITES_MAX 16
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index 4ef927437842..0fd2fd077638 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -17,7 +17,6 @@
> #include <linux/sys_soc.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> /* Register offsets */
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 37465af59262..527d1eb0663a 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -20,11 +20,10 @@
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/thermal.h>
>
> #include <dt-bindings/thermal/thermal_exynos.h>
>
> -#include "../thermal_core.h"
> -
> /* Exynos generic registers */
> #define EXYNOS_TMU_REG_TRIMINFO 0x0
> #define EXYNOS_TMU_REG_CONTROL 0x20
> diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
> index e7834ccc7976..735401958f01 100644
> --- a/drivers/thermal/st/stm_thermal.c
> +++ b/drivers/thermal/st/stm_thermal.c
> @@ -19,7 +19,6 @@
> #include <linux/platform_device.h>
> #include <linux/thermal.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> /* DTS register offsets */
> diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c
> index 0ffe37ce7df7..b3218b71b6d9 100644
> --- a/drivers/thermal/tegra/tegra30-tsensor.c
> +++ b/drivers/thermal/tegra/tegra30-tsensor.c
> @@ -28,7 +28,6 @@
>
> #include <soc/tegra/fuse.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> #define TSENSOR_SENSOR0_CONFIG0 0x0
> diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
> index f8ab2ca76184..47801841b3f5 100644
> --- a/drivers/thermal/uniphier_thermal.c
> +++ b/drivers/thermal/uniphier_thermal.c
> @@ -17,8 +17,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> -
> /*
> * block registers
> * addresses are the offset from .block_base
> --
> 2.34.1
>

--
Kind Regards,
Niklas S?derlund

2023-02-06 22:35:54

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On 2/6/23 07:34, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---

> drivers/thermal/broadcom/bcm2835_thermal.c | 1 -

Acked-by: Florian Fainelli <[email protected]> # bcm2835_thermal.c
--
Florian


2023-02-07 11:39:07

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---
> drivers/thermal/amlogic_thermal.c | 1 -
> drivers/thermal/armada_thermal.c | 2 --
> drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
> drivers/thermal/hisi_thermal.c | 3 +--
> drivers/thermal/imx8mm_thermal.c | 1 -
> drivers/thermal/imx_sc_thermal.c | 1 -
> drivers/thermal/intel/intel_hfi.c | 3 ++-
> drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 1 -
> drivers/thermal/qoriq_thermal.c | 1 -
> drivers/thermal/rcar_gen3_thermal.c | 1 -
> drivers/thermal/samsung/exynos_tmu.c | 3 +--
> drivers/thermal/st/stm_thermal.c | 1 -
> drivers/thermal/tegra/tegra30-tsensor.c | 1 -
> drivers/thermal/uniphier_thermal.c | 2 --
> 14 files changed, 4 insertions(+), 18 deletions(-)

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (1.79 kB)
signature.asc (833.00 B)
Download all attachments

2023-02-07 13:33:38

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On 06/02/2023 16:34, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---
> drivers/thermal/amlogic_thermal.c | 1 -
> drivers/thermal/armada_thermal.c | 2 --
> drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
> drivers/thermal/hisi_thermal.c | 3 +--
> drivers/thermal/imx8mm_thermal.c | 1 -
> drivers/thermal/imx_sc_thermal.c | 1 -
> drivers/thermal/intel/intel_hfi.c | 3 ++-
> drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 1 -
> drivers/thermal/qoriq_thermal.c | 1 -
> drivers/thermal/rcar_gen3_thermal.c | 1 -
> drivers/thermal/samsung/exynos_tmu.c | 3 +--
> drivers/thermal/st/stm_thermal.c | 1 -
> drivers/thermal/tegra/tegra30-tsensor.c | 1 -
> drivers/thermal/uniphier_thermal.c | 2 --
> 14 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
> index d30cb791e63c..9235fda4ec1e 100644
> --- a/drivers/thermal/amlogic_thermal.c
> +++ b/drivers/thermal/amlogic_thermal.c
> @@ -28,7 +28,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define TSENSOR_CFG_REG1 0x4

For Amlogic:

Reviewed-by: Neil Armstrong <[email protected]>

<snip>


2023-02-08 09:49:41

by Kunihiko Hayashi

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

Hi Daniel,

On 2023/02/07 0:34, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---

> drivers/thermal/uniphier_thermal.c | 2 --

For UniPhier:

Reviewed-by: Kunihiko Hayashi <[email protected]>

Thank you,

---
Best Regards
Kunihiko Hayashi

2023-02-10 09:41:10

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

Hi Rafael,

On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes

Are you ok if I take this patch ?

Thanks

-- Daniel


--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2023-02-11 02:00:43

by Ricardo Neri

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.

I don't see any of the thermal netlink functionality exposed. Is
there any work in progress?

FWIW, Acked-by: Ricardo Neri <[email protected]>

2023-02-11 07:53:30

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On 11/02/2023 03:10, Ricardo Neri wrote:
> On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
>> As the name states "thermal_core.h" is the header file for the core
>> components of the thermal framework.
>>
>> Too many drivers are including it. Hopefully the recent cleanups
>> helped to self encapsulate the code a bit more and prevented the
>> drivers to need this header.
>>
>> Remove this inclusion in every place where it is possible.
>>
>> Some other drivers did a confusion with the core header and the one
>> exported in linux/thermal.h. They include the former instead of the
>> latter. The changes also fix this.
>>
>> The tegra/soctherm driver still remains as it uses an internal
>> function which need to be replaced.
>>
>> The Intel HFI driver uses the netlink internal framework core and
>> should be changed to prevent to deal with the internals.
>
> I don't see any of the thermal netlink functionality exposed. Is
> there any work in progress?

commit bd30cdfd9bd73b68e4977ce7c5540aa7b14c25cd
Author: Srinivas Pandruvada <[email protected]>

thermal: intel: hfi: Notify user space for HFI events


> FWIW, Acked-by: Ricardo Neri <[email protected]>

Thanks!

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


2023-02-11 16:33:15

by srinivas pandruvada

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On Sat, 2023-02-11 at 08:53 +0100, Daniel Lezcano wrote:
> On 11/02/2023 03:10, Ricardo Neri wrote:
> > On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
> > > As the name states "thermal_core.h" is the header file for the
> > > core
> > > components of the thermal framework.
> > >
> > > Too many drivers are including it. Hopefully the recent cleanups
> > > helped to self encapsulate the code a bit more and prevented the
> > > drivers to need this header.
> > >
> > > Remove this inclusion in every place where it is possible.
> > >
> > > Some other drivers did a confusion with the core header and the
> > > one
> > > exported in linux/thermal.h. They include the former instead of
> > > the
> > > latter. The changes also fix this.
> > >
> > > The tegra/soctherm driver still remains as it uses an internal
> > > function which need to be replaced.
> > >
> > > The Intel HFI driver uses the netlink internal framework core and
> > > should be changed to prevent to deal with the internals.
> >
> > I don't see any of the thermal netlink functionality exposed. Is
> > there any work in progress?
>
> commit bd30cdfd9bd73b68e4977ce7c5540aa7b14c25cd
> Author: Srinivas Pandruvada <[email protected]>
>
>      thermal: intel: hfi: Notify user space for HFI events
>
This is already exposed and we use it in user space.
thermal_genl_cpu_capability_event() is called from intel_hfi driver to
send the cpu capabilities.

Not sure what do you mean by "don't see netlink functionality
exposed"?

thermal_genl_cpu_caps struct and thermal_genl_cpu_capability_event()
are defined in drivers/thermal/thermal_netlink.h.


Thanks,
Srinivas


>
> > FWIW, Acked-by: Ricardo Neri
> > <[email protected]>
>
> Thanks!
>


2023-02-12 03:14:03

by Ricardo Neri

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On Sat, Feb 11, 2023 at 08:32:48AM -0800, srinivas pandruvada wrote:
> On Sat, 2023-02-11 at 08:53 +0100, Daniel Lezcano wrote:
> > On 11/02/2023 03:10, Ricardo Neri wrote:
> > > On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
> > > > As the name states "thermal_core.h" is the header file for the
> > > > core
> > > > components of the thermal framework.
> > > >
> > > > Too many drivers are including it. Hopefully the recent cleanups
> > > > helped to self encapsulate the code a bit more and prevented the
> > > > drivers to need this header.
> > > >
> > > > Remove this inclusion in every place where it is possible.
> > > >
> > > > Some other drivers did a confusion with the core header and the
> > > > one
> > > > exported in linux/thermal.h. They include the former instead of
> > > > the
> > > > latter. The changes also fix this.
> > > >
> > > > The tegra/soctherm driver still remains as it uses an internal
> > > > function which need to be replaced.
> > > >
> > > > The Intel HFI driver uses the netlink internal framework core and
> > > > should be changed to prevent to deal with the internals.
> > >
> > > I don't see any of the thermal netlink functionality exposed. Is
> > > there any work in progress?
> >
> > commit bd30cdfd9bd73b68e4977ce7c5540aa7b14c25cd
> > Author: Srinivas Pandruvada <[email protected]>
> >
> > ???? thermal: intel: hfi: Notify user space for HFI events
> >
> This is already exposed and we use it in user space.
> thermal_genl_cpu_capability_event() is called from intel_hfi driver to
> send the cpu capabilities.
>
> Not sure what do you mean by "don't see netlink functionality
> exposed"?
>
> thermal_genl_cpu_caps struct and thermal_genl_cpu_capability_event()
> are defined in drivers/thermal/thermal_netlink.h.

Yes, I mean exactly this. The HFI code uses this functionality, but it is
declared in "../thermal_netlink.h". I just wondered if that is OK or also
needs to be declared somewhere in include/linux/

Thanks and BR,
Ricardo

2023-02-13 12:46:48

by Peng Fan (OSS)

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers



On 2/6/2023 11:34 PM, Daniel Lezcano wrote:
> As the name states "thermal_core.h" is the header file for the core
> components of the thermal framework.
>
> Too many drivers are including it. Hopefully the recent cleanups
> helped to self encapsulate the code a bit more and prevented the
> drivers to need this header.
>
> Remove this inclusion in every place where it is possible.
>
> Some other drivers did a confusion with the core header and the one
> exported in linux/thermal.h. They include the former instead of the
> latter. The changes also fix this.
>
> The tegra/soctherm driver still remains as it uses an internal
> function which need to be replaced.
>
> The Intel HFI driver uses the netlink internal framework core and
> should be changed to prevent to deal with the internals.
>
> No functional changes
>
> [ Applies to thermal/linux-next or linux-pm/linux-next ]
>
> Signed-off-by: Daniel Lezcano <[email protected]>

Reviewed-by: Peng Fan <[email protected]> for i.MX

> ---
> drivers/thermal/amlogic_thermal.c | 1 -
> drivers/thermal/armada_thermal.c | 2 --
> drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
> drivers/thermal/hisi_thermal.c | 3 +--
> drivers/thermal/imx8mm_thermal.c | 1 -
> drivers/thermal/imx_sc_thermal.c | 1 -
> drivers/thermal/intel/intel_hfi.c | 3 ++-
> drivers/thermal/qcom/qcom-spmi-temp-alarm.c | 1 -
> drivers/thermal/qoriq_thermal.c | 1 -
> drivers/thermal/rcar_gen3_thermal.c | 1 -
> drivers/thermal/samsung/exynos_tmu.c | 3 +--
> drivers/thermal/st/stm_thermal.c | 1 -
> drivers/thermal/tegra/tegra30-tsensor.c | 1 -
> drivers/thermal/uniphier_thermal.c | 2 --
> 14 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/thermal/amlogic_thermal.c b/drivers/thermal/amlogic_thermal.c
> index d30cb791e63c..9235fda4ec1e 100644
> --- a/drivers/thermal/amlogic_thermal.c
> +++ b/drivers/thermal/amlogic_thermal.c
> @@ -28,7 +28,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define TSENSOR_CFG_REG1 0x4
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 83a4080bffc7..36653f692c80 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -19,8 +19,6 @@
> #include <linux/regmap.h>
> #include <linux/interrupt.h>
>
> -#include "thermal_core.h"
> -
> /* Thermal Manager Control and Status Register */
> #define PMU_TDC0_SW_RST_MASK (0x1 << 1)
> #define PMU_TM_DISABLE_OFFS 0
> diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
> index 3d0710c6e004..23918bb76ae6 100644
> --- a/drivers/thermal/broadcom/bcm2835_thermal.c
> +++ b/drivers/thermal/broadcom/bcm2835_thermal.c
> @@ -18,7 +18,6 @@
> #include <linux/platform_device.h>
> #include <linux/thermal.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> #define BCM2835_TS_TSENSCTL 0x00
> diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
> index 45226cab466e..62c67942293e 100644
> --- a/drivers/thermal/hisi_thermal.c
> +++ b/drivers/thermal/hisi_thermal.c
> @@ -16,8 +16,7 @@
> #include <linux/platform_device.h>
> #include <linux/io.h>
> #include <linux/of_device.h>
> -
> -#include "thermal_core.h"
> +#include <linux/thermal.h>
>
> #define HI6220_TEMP0_LAG (0x0)
> #define HI6220_TEMP0_TH (0x4)
> diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
> index d247b48696cb..72b5d6f319c1 100644
> --- a/drivers/thermal/imx8mm_thermal.c
> +++ b/drivers/thermal/imx8mm_thermal.c
> @@ -17,7 +17,6 @@
> #include <linux/slab.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define TER 0x0 /* TMU enable */
> diff --git a/drivers/thermal/imx_sc_thermal.c b/drivers/thermal/imx_sc_thermal.c
> index 378f574607f7..f32e59e74623 100644
> --- a/drivers/thermal/imx_sc_thermal.c
> +++ b/drivers/thermal/imx_sc_thermal.c
> @@ -13,7 +13,6 @@
> #include <linux/slab.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define IMX_SC_MISC_FUNC_GET_TEMP 13
> diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
> index 6e604bda2b93..c69db6c90869 100644
> --- a/drivers/thermal/intel/intel_hfi.c
> +++ b/drivers/thermal/intel/intel_hfi.c
> @@ -40,10 +40,11 @@
>
> #include <asm/msr.h>
>
> -#include "../thermal_core.h"
> #include "intel_hfi.h"
> #include "thermal_interrupt.h"
>
> +#include "../thermal_netlink.h"
> +
> /* Hardware Feedback Interface MSR configuration bits */
> #define HW_FEEDBACK_PTR_VALID_BIT BIT(0)
> #define HW_FEEDBACK_CONFIG_HFI_ENABLE_BIT BIT(0)
> diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> index e2429676d0d2..101c75d0e13f 100644
> --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> @@ -15,7 +15,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> #define QPNP_TM_REG_DIG_MAJOR 0x01
> diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
> index d111e218f362..431c29c0898a 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -13,7 +13,6 @@
> #include <linux/thermal.h>
> #include <linux/units.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> #define SITES_MAX 16
> diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
> index 4ef927437842..0fd2fd077638 100644
> --- a/drivers/thermal/rcar_gen3_thermal.c
> +++ b/drivers/thermal/rcar_gen3_thermal.c
> @@ -17,7 +17,6 @@
> #include <linux/sys_soc.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> #include "thermal_hwmon.h"
>
> /* Register offsets */
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 37465af59262..527d1eb0663a 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -20,11 +20,10 @@
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
> #include <linux/regulator/consumer.h>
> +#include <linux/thermal.h>
>
> #include <dt-bindings/thermal/thermal_exynos.h>
>
> -#include "../thermal_core.h"
> -
> /* Exynos generic registers */
> #define EXYNOS_TMU_REG_TRIMINFO 0x0
> #define EXYNOS_TMU_REG_CONTROL 0x20
> diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
> index e7834ccc7976..735401958f01 100644
> --- a/drivers/thermal/st/stm_thermal.c
> +++ b/drivers/thermal/st/stm_thermal.c
> @@ -19,7 +19,6 @@
> #include <linux/platform_device.h>
> #include <linux/thermal.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> /* DTS register offsets */
> diff --git a/drivers/thermal/tegra/tegra30-tsensor.c b/drivers/thermal/tegra/tegra30-tsensor.c
> index 0ffe37ce7df7..b3218b71b6d9 100644
> --- a/drivers/thermal/tegra/tegra30-tsensor.c
> +++ b/drivers/thermal/tegra/tegra30-tsensor.c
> @@ -28,7 +28,6 @@
>
> #include <soc/tegra/fuse.h>
>
> -#include "../thermal_core.h"
> #include "../thermal_hwmon.h"
>
> #define TSENSOR_SENSOR0_CONFIG0 0x0
> diff --git a/drivers/thermal/uniphier_thermal.c b/drivers/thermal/uniphier_thermal.c
> index f8ab2ca76184..47801841b3f5 100644
> --- a/drivers/thermal/uniphier_thermal.c
> +++ b/drivers/thermal/uniphier_thermal.c
> @@ -17,8 +17,6 @@
> #include <linux/regmap.h>
> #include <linux/thermal.h>
>
> -#include "thermal_core.h"
> -
> /*
> * block registers
> * addresses are the offset from .block_base

2023-02-13 15:38:38

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] thermal: Remove core header inclusion from drivers

On Fri, Feb 10, 2023 at 10:41 AM Daniel Lezcano
<[email protected]> wrote:
>
> Hi Rafael,
>
> On Mon, Feb 06, 2023 at 04:34:29PM +0100, Daniel Lezcano wrote:
> > As the name states "thermal_core.h" is the header file for the core
> > components of the thermal framework.
> >
> > Too many drivers are including it. Hopefully the recent cleanups
> > helped to self encapsulate the code a bit more and prevented the
> > drivers to need this header.
> >
> > Remove this inclusion in every place where it is possible.
> >
> > Some other drivers did a confusion with the core header and the one
> > exported in linux/thermal.h. They include the former instead of the
> > latter. The changes also fix this.
> >
> > The tegra/soctherm driver still remains as it uses an internal
> > function which need to be replaced.
> >
> > The Intel HFI driver uses the netlink internal framework core and
> > should be changed to prevent to deal with the internals.
> >
> > No functional changes
>
> Are you ok if I take this patch ?

Well, you've already done that.