[U-Boot] [PATCH 1/3] i2c: add i2c_core and prepare for new multibus support

Mike Frysinger vapier at gentoo.org
Wed Jan 18 21:41:41 CET 2012


On Wednesday 18 January 2012 15:11:56 Tabi Timur-B04825 wrote:
> On Tue, Jan 17, 2012 at 1:12 AM, Simon Glass wrote:
> > --- a/arch/arm/include/asm/global_data.h
> > +++ b/arch/arm/include/asm/global_data.h
> > @@ -87,6 +87,9 @@ typedef       struct  global_data {
> >        unsigned long   post_log_res; /* success of POST test */
> >        unsigned long   post_init_f_time; /* When post_init_f started */
> >  #endif
> > +#if defined(CONFIG_SYS_I2C)
> > +       void            *cur_adap;      /* current used i2c adapter */
> > +#endif
> 
> I was really hoping we could get rid of the concept of a "current" i2c
> adapter, and just force all drivers to specify the I2C adapter they
> want to use for a given I2C operation.  That's how Linux operates, and
> it will prevent stuff like this:
> 
> void *old;
> void *new;
> 
> old = get_current_i2c_adapter();
> set_i2c_adapter(new);
> // do I2C stuff
> set_i2c_adapter(old);

that's only needed if you expect the pointer to stay valid across calls.  i 
don't think it does for most (all?) drivers.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120118/75ccaa78/attachment.pgp>


More information about the U-Boot mailing list