On Thu, Oct 23, 2008 at 1:49 AM, Wolfgang Denk <[EMAIL PROTECTED]> wrote:

> That would mean to add even more #ifdef'ery to more common files -  I
> don;t think that this is a good odea.

I don't like #ifdefs in common code, either, but I think in this case
it's still an improvement.  What do you think about this:

static inline u8 i2c_reg_read(u8 addr, u8 reg)
{
        u8 buf;

#ifdef CONFIG_8xx
        /* MPC8xx needs this.  Maybe one day we can get rid of it. */
        i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif

#ifdef DEBUG
        printf("%s: addr=0x%02x, reg=0x%02x\n", __func__, addr, reg);
#endif

#ifdef CONFIG_BLACKFIN
        /* This ifdef will become unneccessary in a future version of the
         * blackfin I2C driver.
         */
        i2c_read(addr, reg, 0, &buf, 1);
#else
        i2c_read(addr, reg, 1, &buf, 1);
#endif

        return buf;
}

-- 
Timur Tabi
Linux kernel developer at Freescale

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to