Re: [PATCH 1/2] thermal/drivers/qcom/lmh: Use driver data as flags instead of bool

From: Bjorn Andersson
Date: Wed Jan 18 2023 - 22:05:34 EST


On Fri, Jan 13, 2023 at 04:14:00AM +0100, Konrad Dybcio wrote:
> Currently the OF driver data is used to determine whether to manually
> enable the LMH algorithms through secure calls. In preparation for
> introducing support for SoCs with a configuration that differs from
> both SDM845 and SM8150, convert this to a set of bitflags for more
> flexibility.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>
> ---
> drivers/thermal/qcom/lmh.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c
> index 4122a51e9874..5e8ff196c9a6 100644
> --- a/drivers/thermal/qcom/lmh.c
> +++ b/drivers/thermal/qcom/lmh.c
> @@ -28,7 +28,7 @@
>
> #define LMH_REG_DCVS_INTR_CLR 0x8
>
> -#define LMH_ENABLE_ALGOS 1
> +#define LMH_ENABLE_ALGOS BIT(0)

Looks perfectly fine, but please include a patch in the same series that
adds another bit. And don't forget to update the .data in the
of_match_id listing.

Regards,
Bjorn

>
> struct lmh_hw_data {
> void __iomem *base;
> @@ -92,9 +92,11 @@ static int lmh_probe(struct platform_device *pdev)
> struct device_node *cpu_node;
> struct lmh_hw_data *lmh_data;
> int temp_low, temp_high, temp_arm, cpu_id, ret;
> - unsigned int enable_alg;
> + unsigned int flags;
> u32 node_id;
>
> + flags = (uintptr_t)of_device_get_match_data(dev);
> +
> lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL);
> if (!lmh_data)
> return -ENOMEM;
> @@ -144,9 +146,7 @@ static int lmh_probe(struct platform_device *pdev)
> if (!qcom_scm_lmh_dcvsh_available())
> return -EINVAL;
>
> - enable_alg = (uintptr_t)of_device_get_match_data(dev);
> -
> - if (enable_alg) {
> + if (flags & LMH_ENABLE_ALGOS) {
> ret = qcom_scm_lmh_dcvsh(LMH_SUB_FN_CRNT, LMH_ALGO_MODE_ENABLE, 1,
> LMH_NODE_DCVS, node_id, 0);
> if (ret)
> --
> 2.39.0
>