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:	Mon, 18 May 2009 16:44:40 +0200
From:	Jean Delvare <khali@...ux-fr.org>
To:	Linus Walleij <linus.ml.walleij@...il.com>
Cc:	Mike Rapoport <mike@...pulab.co.il>, linux-kernel@...r.kernel.org,
	sameo@...ux.intel.com, linux-i2c@...r.kernel.org,
	Linus Walleij <linus.walleij@...ricsson.com>
Subject: Re: [PATCH] MFD: Add U300 AB3100 core support v1

Hi Linus,

On Mon, 18 May 2009 16:22:36 +0200, Linus Walleij wrote:
> Here we have a problem. See above:
> msgs[0].addr = ab3100_i2c_client->addr + 1;
> 
> So this chip actually has two addresses. A "special" address
> to deal with test registers, one address up. The I2C framework
> assume all devices have one and one address only (which is
> of course mostly true).

No, the I2C framework doesn't assume this. All the I2C framework
assumes is that only one device can use a given address on any one I2C
segment (which seems reasonable.)

> Here is a special case. When the first device has registered,
> you know that the other address is available as well.
> 
> You could think of several ugly solutions:
> 
> * Keep using i2c_transfer() directly as we do now.
> 
> * Make a raw copy of the i2c_device with something like
>   memcpy(mock_client, i2c_client, sizeof(i2c_client);
>   mock_client->addr++;
>   then use i2c_master_send()
> 
> * Register a new i2c_device in board_info for the other
>   address while strictly speaking it is the same device, and
>   this will yield a lot of probing and synchronization code,
>   because writing the test registers is used when probing the
>   first device, so we have to wait for that device to be probed
>   before we can probe the other one etc.
> 
> Right now I lean toward the first alternative.

Neither is correct. Simply use i2c_new_dummy() on the second I2C
address, and keep a pointer to the instantiated i2c_client for future
use. Don't forget to call i2c_unregister_device() in your .remove()
method.

-- 
Jean Delvare
--
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