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:	Tue, 6 Jan 2009 14:35:05 +0100
From:	BARRE Sebastien <sbarre@...lcc.com>
To:	Ed Swierk <eswierk@...stanetworks.com>
CC:	"i2c@...sensors.org" <i2c@...sensors.org>,
	David Brownell <david-b@...bell.net>,
	Alessandro Zummo <a.zummo@...ertech.it>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: RE: [PATCH] rtc-ds1307: True SMBus compatibility

Hello,

> -----Original Message-----
> From: Ed Swierk [mailto:eswierk@...stanetworks.com]
> Sent: Monday, January 05, 2009 6:36 PM
> To: i2c@...sensors.org; David Brownell; Alessandro Zummo; linux-
> kernel@...r.kernel.org; Andrew Morton; BARRE Sebastien
> Subject: [PATCH] rtc-ds1307: True SMBus compatibility
>
> Following up to Sebastien Barre's recent patch, here I go one step
> further, replacing i2c block transfers with SMBus byte transfers.
> Sticking to pure SMBus makes the driver work on our board, which has an
> nVidia SMBus controller driving a DS1339; nforce2 controllers
> unfortunately don't support any flavor of i2c block transfer.
>
> Reading or writing registers repeatedly until they stick is rather
> nauseating but I'm aiming for correctness if not elegance.  I would
> appreciate any suggestions for improvement.
>
> Signed-off-by: Ed Swierk <eswierk@...stanetworks.com>

I've read your patch quicly, I will test it on my board as soon as possible.

> +static s32 ds1307_write_block_data(struct i2c_client *client, u8 command,
> +                                u8 length, const u8 *values)
> +{
> +     u8 currvalues[I2C_SMBUS_BLOCK_MAX];
> +     s32 ret;
> +     pr_debug("ds1307_write_block_data (length=%d)\n", length);

You can delete the next 3 lines, they are not useful:

> +     ret = ds1307_read_block_data_once(client, command, length, currvalues);
> +     if (ret < 0)
> +             return ret;

> +     do {
> +             s32 i, ret;
> +             for (i = 0; i < length; i++) {
> +                     ret = i2c_smbus_write_byte_data(client, command + i,
> +                                                     *(values + i));
> +                     if (ret < 0)
> +                             return ret;
> +             }
> +             ret = ds1307_read_block_data_once(client, command, length, currvalues);
> +             if (ret < 0)
> +                     return ret;
> +     } while (memcmp(currvalues, values, length));
> +     return length;
> +}

--
Sébastien Barré
Bureau d'étude - Développement
SDEL Contrôle Commande
D2A - Rue Nungesser et Coli
44860 Saint Aignan de Grand Lieu
FRANCE
Tél : +33(0)2 40 84 50 88
Fax : +33(0)2 40 84 51 10

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ