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 Dec 2014 11:07:29 +0100
From:	Sebastian Reichel <sre@...nel.org>
To:	Guenter Roeck <linux@...ck-us.net>
Cc:	Pavel Machek <pavel@....cz>, Pali Rohar <pali.rohar@...il.com>,
	Jean Delvare <jdelvare@...e.de>,
	Tony Lindgren <tony@...mide.com>,
	BenoƮt Cousson <bcousson@...libre.com>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-omap@...r.kernel.org, lm-sensors@...sensors.org,
	devicetree@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>
Subject: Re: [PATCH 2/3] hwmon: Driver for OMAP3 temperature sensor

On Sun, Dec 28, 2014 at 12:24:47AM -0800, Guenter Roeck wrote:
> On Sat, Dec 27, 2014 at 11:35:16PM +0100, Pavel Machek wrote:
> > On Sat 2014-12-27 20:58:25, Pavel Machek wrote:
> > > On Fri 2014-12-26 13:34:53, Sebastian Reichel wrote:
> > > > OMAP34xx and OMAP36xx processors contain a register in the syscon area,
> > > > which can be used to determine the SoCs temperature. This patch provides
> > > > a DT based driver for the temperature sensor based on an older driver
> > > > written by Peter De Schrijver for the Nokia N900 and N9.
> > > > 
> > > > Signed-off-by: Sebastian Reichel <sre@...nel.org>
> > > > ---
> > > >  drivers/hwmon/Kconfig      |   8 ++
> > > >  drivers/hwmon/Makefile     |   1 +
> > > >  drivers/hwmon/omap3-temp.c | 307 +++++++++++++++++++++++++++++++++++++++++++++
> > > >  3 files changed, 316 insertions(+)
> > > >  create mode 100644 drivers/hwmon/omap3-temp.c
> > > 
> > > When it hangs, it loops here:
> > > 
> > > do {
> > > regmap_read(data->syscon, SYSCON_TEMP_REG,&temp_sensor_reg);
> > > if ((temp_sensor_reg & eocz_mask) == level)
> > >    return true;
> > > printk("=");
> > > }
> > > while (ktime_us_delta(expire, ktime_get()) > 0);
> > 
> > And this fixes the hang, and makes level handling more readable.
> > 
> > Fix the timeout code, now it actually works. Driver still fails after
> > a while.
> > 
> > Signed-off-by: Pavel Machek <pavel@....cz>
> > 
> > diff --git a/drivers/hwmon/omap3-temp.c b/drivers/hwmon/omap3-temp.c
> > index 8a69604..1b8c768 100644
> > --- a/drivers/hwmon/omap3-temp.c
> > +++ b/drivers/hwmon/omap3-temp.c
> > @@ -130,9 +130,7 @@ static inline bool wait_for_eocz(struct omap3_temp_data *data,
> >  	ktime_t timeout, expire;
> >  	u32 temp_sensor_reg, eocz_mask;
> >  
> >  	eocz_mask = BIT(data->hwdata->eocz_bit);
> > -	level &= 1;
> > -	level *= eocz_mask;
> >  
> >  	expire = ktime_add_ns(ktime_get(), max_delay);
> >  	timeout = ktime_set(0, min_delay);
> > @@ -140,9 +141,9 @@ static inline bool wait_for_eocz(struct omap3_temp_data *data,
> >  	schedule_hrtimeout(&timeout, HRTIMER_MODE_REL);
> >  	do {
> >  		regmap_read(data->syscon, SYSCON_TEMP_REG, &temp_sensor_reg);
> > -		if ((temp_sensor_reg & eocz_mask) == level)
> > +		if (!!(temp_sensor_reg & eocz_mask) == level)
> >  			return true;
> > -	} while (ktime_us_delta(expire, ktime_get()) > 0);
> > +	} while (ktime_after(expire, ktime_get()));
> >  
> Does this have to be a hard loop, without sleep ? I am a bit concerned that it
> may loop for more than a ms.
> 
> Other than that, I assume we'll see an updated version with the coding style
> issues and hang-up problems fixed.

I will send a v2 patchset with Pavels change requests. It may take a
few days though, since I'm currently at a conference (31C3).

-- Sebastian

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ