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: Sun, 28 Apr 2024 14:46:39 -0400
From: Andrew Hepp <andrew.hepp@...pp.dev>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Dimitri Fedrau <dima.fedrau@...il.com>,
 Marcelo Schmitt <marcelo.schmitt1@...il.com>,
 Lars-Peter Clausen <lars@...afoo.de>,
 linux-iio@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: temperature: mcp9600: Fix temperature reading for
 negative values

Hi all,

On Apr 28, 2024, at 9:46 AM, Jonathan Cameron <jic23@...nel.org> wrote:

> Agreed - by my reading the original patch is correct. Maybe it would act
> as cleaner 'documentation' to have the sign_extend32() for the cold junction be
> from bit 12 rather than 15, but I'm not sure it's worth the effort.
> 
> Andrew, would be great if you can review this fix in case we are all missing
> something!

I also agree that Dimitri’s original patch appears correct per the data sheet.

I think of the cold junction register as a 16 bit 2s complement signed integer, 
despite the limited range. I like sign extending it from bit 15 rather than from 12.

I applied Dimitri’s patch and stuck a dev board in my icebox.

Before patch:
    # cat /sys/bus/iio/devices/iio:device0/in_temp_raw 
    65222
    # cat /sys/bus/iio/devices/iio:device0/in_temp_ambient_raw
    65256

After patch:
    # cat /sys/bus/iio/devices/iio:device0/in_temp_raw
    -260
    # cat /sys/bus/iio/devices/iio:device0/in_temp_ambient_raw
    -212

Looks good to me! Thanks for the patch Dimitri, and thanks to all for the review!

Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ