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] [day] [month] [year] [list]
Message-ID: <1575624927.1631.7.camel@mtksdccf07>
Date:   Fri, 6 Dec 2019 17:35:27 +0800
From:   Michael Kao <michael.kao@...iatek.com>
To:     Hsin-Yi Wang <hsinyi@...omium.org>
CC:     Zhang Rui <rui.zhang@...el.com>,
        Eduardo Valentin <edubezval@...il.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        "Matthias Brugger" <matthias.bgg@...il.com>,
        <linux-pm@...r.kernel.org>,
        Devicetree List <devicetree@...r.kernel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH v2 7/8] thermal: mediatek: add another get_temp ops for
 thermal sensors

On Thu, 2019-11-21 at 15:00 +0800, Hsin-Yi Wang wrote:
> On Fri, May 10, 2019 at 9:27 PM michael.kao <michael.kao@...iatek.com> wrote:
> 
> > -       tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, mt,
> > -                                                    &mtk_thermal_ops);
> > -       if (IS_ERR(tzdev)) {
> > -               ret = PTR_ERR(tzdev);
> > -               goto err_disable_clk_peri_therm;
> > +       for (i = 0; i < mt->conf->num_sensors + 1; i++) {
> > +               tz = kmalloc(sizeof(*tz), GFP_KERNEL);
> > +               if (!tz)
> > +                       return -ENOMEM;
> > +
> > +               tz->mt = mt;
> > +               tz->id = i;
> > +
> > +               tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, i,
> > +                               tz, (i == 0) ?
> > +                               &mtk_thermal_ops : &mtk_thermal_sensor_ops);
> > +
> > +               if (IS_ERR(tzdev)) {
> > +                       if (IS_ERR(tzdev) != -EACCES) {
>                                 PTR_ERR(tzdev)
> 
> > +                               ret = PTR_ERR(tzdev);
> > +                               goto err_disable_clk_peri_therm;
> > +                       }
> > +               }
> 
> This for loop adding thermal zone sensors will not work for mt8173. It
> assumes that thermal-zones in dts have subnodes (eg. cpu_thermal,
> tzts..) amount equal to num_sensors+1. Otherwise tzdev would be
> -ENODEV and thermal failed to be probed.
> In mt8183 this is fine, since each thermal zone only has one sensor,
> but in mt8173, some sensor appears in multiple thermal zones.
> 
> In order to let the change also works for 8173, I think if the error
> is -ENODEV, and the id is not 0 (0 is cpu_thermal), prompt a warning
> instead of failing. Eg.
> 
>                 if (IS_ERR(tzdev)) {
> +                       if (i > 0 && PTR_ERR(tzdev) == -ENODEV) {
> +                               dev_warn(&pdev->dev, "can't find
> thermal sensor %d\n", i);
> +                               continue;
> +                       }
>                         if (PTR_ERR(tzdev) != -EACCES) {

OK, I will update this patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ