From 7d5ff54fde6a22c36e4b7e0a039971b279bf21c6 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Thu, 17 Nov 2011 07:57:20 +0100 Subject: [PATCH] i2c: Codingstyle cleanup for i2c evb64260 board driver There are some magic constants in this drivers, which I cannot fixup ... Eran, can you help here? Signed-off-by: Heiko Schocher Cc: Eran Man --- board/evb64260/i2c.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/board/evb64260/i2c.c b/board/evb64260/i2c.c index 3eae3d903f..8119fced48 100644 --- a/board/evb64260/i2c.c +++ b/board/evb64260/i2c.c @@ -20,25 +20,25 @@ static void i2c_init(int speed, int slaveaddr) { unsigned int n, m, freq, margin, power; - unsigned int actualN = 0, actualM = 0; + unsigned int actualn = 0, actualm = 0; unsigned int control, status; - unsigned int minMargin = 0xffffffff; + unsigned int minmargin = 0xffffffff; unsigned int tclk = 125000000; DP(puts("i2c_init\n")); for (n = 0 ; n < 8 ; n++) { for (m = 0 ; m < 16 ; m++) { - power = 2< freq) margin = speed - freq; else margin = freq - speed; - if (margin < minMargin) { - minMargin = margin; - actualN = n; - actualM = m; + if (margin < minmargin) { + minmargin = margin; + actualn = n; + actualm = m; } } } @@ -55,7 +55,7 @@ i2c_init(int speed, int slaveaddr) DP(puts("set baudrate\n")); - GT_REG_WRITE(I2C_STATUS_BAUDE_RATE, (actualM << 3) | actualN); + GT_REG_WRITE(I2C_STATUS_BAUDE_RATE, (actualm << 3) | actualn); GT_REG_WRITE(I2C_CONTROL, (0x1 << 2) | (0x1 << 6)); udelay(I2C_DELAY * 10); @@ -257,11 +257,11 @@ i2c_read(uchar dev_addr, unsigned int offset, int len, uchar *data, int ten_bit) { uchar status = 0; - unsigned int i2cFreq = 400000; + unsigned int i2cfreq = 400000; DP(puts("i2c_read\n")); - i2c_init(i2cFreq, 0); + i2c_init(i2cfreq, 0); status = i2c_start(); @@ -280,7 +280,7 @@ i2c_read(uchar dev_addr, unsigned int offset, int len, uchar *data, return status; } - i2c_init(i2cFreq, 0); + i2c_init(i2cfreq, 0); status = i2c_start(); if (status) { -- 2.25.1