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:	Fri, 18 Jun 2010 13:56:53 -0700
From:	Guenter Roeck <guenter.roeck@...csson.com>
To:	Jonathan Cameron <kernel@...23.retrosnub.co.uk>
CC:	Jean Delvare <khali@...ux-fr.org>,
	Hans de Goede <hdegoede@...hat.com>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"lm-sensors@...sensors.org" <lm-sensors@...sensors.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] hwmon: Driver for SMM665 Six-Channel Active DC
 Output Controller/Monitor

[...]
> > +             /*
> > +              * Algorithm for reading ADC, per SMM665 datasheet
> > +              *
> > +              *  {[S][addr][W][Ack]} {[offset][Ack]} {[S][addr][R][Nack]}
> > +              * [wait 70 uS]
> > +              *  {[S][addr][R][Ack]} {[datahi][Ack]} {[datalo][Ack][P]}
> > +              *
> > +              * To implement the first part of this exchange,
> > +              * do a full read transaction and expect a failure/Nack.
> > +              * This sets up the address pointer on the SMM665
> > +              * and starts the ADC conversion.
> > +              * Then do a two-byte read transaction.
> > +              */
> Is there no better way of handling this? There are protocol mangling hacks
> to tell the i2c core to ignore a NAKs under some circumstances.
> 
> > +             rv = i2c_smbus_read_byte_data(client, adc << 3);
> > +             if (rv >= 0) {
> > +                     /* No error, something is wrong. Retry. */
> > +                     rv = -1;
> > +                     continue;
> > +             }

I looked through the core i2c code, but did not find anything I can
use. 

Problem is that per smm665 specification, the first NACK is expected. So
we do not just want to ignore this NACK, we want to actively check if
the command "failed" as expected, and report an error if it did _not_
fail.

Guenter


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ