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]
Date:   Wed, 31 Aug 2022 15:08:46 +0300
From:   Andy Shevchenko <andriy.shevchenko@...el.com>
To:     Eliav Farber <farbere@...zon.com>
Cc:     jdelvare@...e.com, linux@...ck-us.net, robh+dt@...nel.org,
        p.zabel@...gutronix.de, rtanwar@...linear.com,
        linux-hwmon@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, talel@...zon.com, hhhawa@...zon.com,
        jonnyc@...zon.com, hanochu@...zon.com, ronenk@...zon.com,
        itamark@...zon.com, shellykz@...zon.com, shorer@...zon.com,
        amitlavi@...zon.com, almogbs@...zon.com, dkl@...zon.com,
        rahul.tanwar@...ux.intel.com
Subject: Re: [PATCH v3 15/19] hwmon: (mr75203) add support for series 6
 temperature equation

On Tue, Aug 30, 2022 at 07:22:08PM +0000, Eliav Farber wrote:
> The current equation used in code is aligned to series 5:
> T = G + H * (n / cal5 - 0.5) + J * F
> Where:
> G = 60, H = 200, cal5 = 4094, J = -0.1, F = frequency clock in MHz
> 
> Series 6 has a slightly different equation:
> T = G + H * (n / cal5 - 0.5)
> and a different set of coefficients:
> G = 57.4, H = 249.4, cal5 = 4096
> 
> This change supports equation and coefficients for both series.
> (for series 6, J is set to 0).
> 
> The series is determined according to “ts-series” property in device
> tree.
> If absent, series 5 is assumed to be the default.

...

> -#define PVT_H_CONST		200000
> -#define PVT_G_CONST		60000
> -#define PVT_J_CONST		-100
> -#define PVT_CAL5_CONST		4094

You just introduced them patch before. Please, avoid ping-pong style in
the same series.

...

> +	ret = of_property_read_u32(np, "moortec,ts-series", &series);

of_ ?!

Be consistent. Either you use OF everywhere, or device property APIs.

...

> +	if (ret)
> +		series = TEMPERATURE_SENSOR_SERIES_5;
> +
> +	if (series == TEMPERATURE_SENSOR_SERIES_5) {
> +		ts_coeff->h = PVT_SERIES5_H_CONST;
> +		ts_coeff->g = PVT_SERIES5_G_CONST;
> +		ts_coeff->j = PVT_SERIES5_J_CONST;
> +		ts_coeff->cal5 = PVT_SERIES5_CAL5_CONST;
> +	} else if (series == TEMPERATURE_SENSOR_SERIES_6) {
> +		ts_coeff->h = PVT_SERIES6_H_CONST;
> +		ts_coeff->g = PVT_SERIES6_G_CONST;
> +		ts_coeff->j = PVT_SERIES6_J_CONST;
> +		ts_coeff->cal5 = PVT_SERIES6_CAL5_CONST;
> +	} else {
> +		dev_err(dev, "invalid temperature sensor series (%u)\n",
> +			series);
> +		return -EINVAL;
> +	}

switch-case?

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ