lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHLCerN9zQEJK4WoV6BY6hga2BxwzMsyScWnTdYcLgEk0Bjg4w@mail.gmail.com>
Date:   Mon, 14 May 2018 17:45:56 +0300
From:   Amit Kucheria <amit.kucheria@...aro.org>
To:     Bjorn Andersson <bjorn.andersson@...aro.org>
Cc:     Zhang Rui <rui.zhang@...el.com>,
        Eduardo Valentin <edubezval@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Rajendra Nayak <rnayak@...eaurora.org>,
        Linux PM list <linux-pm@...r.kernel.org>,
        devicetree@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH] thermal: qcom: tsens: Allow number of sensors to come
 from DT

On Tue, May 8, 2018 at 2:53 AM, Bjorn Andersson
<bjorn.andersson@...aro.org> wrote:
> For platforms that has multiple copies of the TSENS hardware block it's
> necessary to be able to specify the number of sensors per block in DeviceTree.

I assume you want to replace the hardcoded num_sensors values in the
tsens-xxxx.c files with values in device tree atleast on platforms
that use devicetree?

> Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> ---
>  .../devicetree/bindings/thermal/qcom-tsens.txt       |  1 +
>  drivers/thermal/qcom/tsens.c                         | 12 +++++++++---
>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> index 292ed89d900b..06195e8f35e2 100644
> --- a/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> +++ b/Documentation/devicetree/bindings/thermal/qcom-tsens.txt
> @@ -8,6 +8,7 @@ Required properties:
>
>  - reg: Address range of the thermal registers
>  - #thermal-sensor-cells : Should be 1. See ./thermal.txt for a description.
> +- #qcom,sensors: Number of sensors in tsens block
>  - Refer to Documentation/devicetree/bindings/nvmem/nvmem.txt to know how to specify
>  nvmem cells
>
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 3f9fe6aa51cc..20f3b87d7667 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -116,6 +116,7 @@ static int tsens_probe(struct platform_device *pdev)
>         struct tsens_device *tmdev;
>         const struct tsens_data *data;
>         const struct of_device_id *id;
> +       u32 num_sensors;
>
>         if (pdev->dev.of_node)
>                 dev = &pdev->dev;
> @@ -130,18 +131,23 @@ static int tsens_probe(struct platform_device *pdev)
>         else
>                 data = &data_8960;
>
> -       if (data->num_sensors <= 0) {
> +       num_sensors = data->num_sensors;
> +
> +       if (np)
> +               of_property_read_u32(np, "#qcom,sensors", &num_sensors);
> +
> +       if (num_sensors <= 0) {
>                 dev_err(dev, "invalid number of sensors\n");
>                 return -EINVAL;
>         }
>
>         tmdev = devm_kzalloc(dev, sizeof(*tmdev) +
> -                            data->num_sensors * sizeof(*s), GFP_KERNEL);
> +                            num_sensors * sizeof(*s), GFP_KERNEL);
>         if (!tmdev)
>                 return -ENOMEM;
>
>         tmdev->dev = dev;
> -       tmdev->num_sensors = data->num_sensors;
> +       tmdev->num_sensors = num_sensors;
>         tmdev->ops = data->ops;
>         for (i = 0;  i < tmdev->num_sensors; i++) {
>                 if (data->hw_ids)
> --
> 2.17.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ