2015-08-24 05:23:41

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 00/17] staging: sm750fb: coding style fixes

Hi,

These patches are fixing coding style issues in ddk750_*i2c* files of the
sm750fb driver

Mike Rapoport (17):
staging: sm750fb: rename hwI2CInit to sm750_hw_i2c_init
staging: sm750fb: rename hwI2CClose to sm750_hw_i2c_close
staging: sm750fb: rename hwI2CReadReg to sm750_hw_i2c_read_reg
staging: sm750fb: rename hwI2CWriteReg to sm750_hw_i2c_write_reg
staging: sm750fb: ddk750_hwi2c: rename CamelCase static functions
staging: sm750fb: rename swI2CInit to sm750_sw_i2c_init
staging: sm750fb: rename swI2CReadReg to sm750_sw_i2c_read_reg
staging: sm750fb: rename swI2CWriteReg to sm750_sw_i2c_write_reg
staging: sm750fb: ddk750_swi2c: staticize swI2C{SCL,SDA}
staging: sm750fb: ddk750_swi2c: rename CamelCase static functions
staging: sm750fb: ddk750_hw_i2c: rename busSpeedMode
staging: sm750fb: hw_i2c_{read,write}: rename CamelCase variables
staging: sm750fb: ddk750_hwi2c: reduce amount of CamelCase
staging: sm750fb: ddk750_swi2c: rename CamelCase static variables
staging: sm750fb: ddk750_swi2c: further reduce CamelCase
staging: sm750fb: ddk750_*i2c: remove multiple blank lines
staging: sm750fb: ddk750_*i2c: shorten lines to under 80 characters

drivers/staging/sm750fb/ddk750_hwi2c.c | 109 ++++++------
drivers/staging/sm750fb/ddk750_hwi2c.h | 9 +-
drivers/staging/sm750fb/ddk750_sii164.c | 8 +-
drivers/staging/sm750fb/ddk750_swi2c.c | 291 ++++++++++++++++----------------
drivers/staging/sm750fb/ddk750_swi2c.h | 47 ++----
drivers/staging/sm750fb/sm750_hw.c | 10 +-
6 files changed, 228 insertions(+), 246 deletions(-)

--
2.1.0


2015-08-24 05:24:11

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 01/17] staging: sm750fb: rename hwI2CInit to sm750_hw_i2c_init

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_hwi2c.h | 2 +-
drivers/staging/sm750fb/ddk750_sii164.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 5ddac43..7eb122e 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -9,7 +9,7 @@
#define HWI2C_WAIT_TIMEOUT 0xF0000


-int hwI2CInit(
+int sm750_hw_i2c_init(
unsigned char busSpeedMode
)
{
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 0b830ba6..11381eb 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -2,7 +2,7 @@
#define DDK750_HWI2C_H__

/* hwi2c functions */
-int hwI2CInit(unsigned char busSpeedMode);
+int sm750_hw_i2c_init(unsigned char busSpeedMode);
void hwI2CClose(void);

unsigned char hwI2CReadReg(unsigned char deviceAddress, unsigned char registerIndex);
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index 0bdf3db..1803b74 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -130,7 +130,7 @@ long sii164InitChip(
/* Initialize the i2c bus */
#ifdef USE_HW_I2C
/* Use fast mode. */
- hwI2CInit(1);
+ sm750_hw_i2c_init(1);
#else
swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA);
#endif
--
2.1.0

2015-08-24 05:24:13

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 02/17] staging: sm750fb: rename hwI2CClose to sm750_hw_i2c_close

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_hwi2c.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 7eb122e..8aa83ab 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -40,7 +40,7 @@ unsigned char busSpeedMode
}


-void hwI2CClose(void)
+void sm750_hw_i2c_close(void)
{
unsigned int value;

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 11381eb..a8d23d2 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -3,7 +3,7 @@

/* hwi2c functions */
int sm750_hw_i2c_init(unsigned char busSpeedMode);
-void hwI2CClose(void);
+void sm750_hw_i2c_close(void);

unsigned char hwI2CReadReg(unsigned char deviceAddress, unsigned char registerIndex);
int hwI2CWriteReg(unsigned char deviceAddress, unsigned char registerIndex, unsigned char data);
--
2.1.0

2015-08-24 05:24:15

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 03/17] staging: sm750fb: rename hwI2CReadReg to sm750_hw_i2c_read_reg

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_hwi2c.h | 2 +-
drivers/staging/sm750fb/ddk750_sii164.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 8aa83ab..03da0a7 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -219,7 +219,7 @@ static unsigned int hwI2CReadData(
* Return Value:
* Register value
*/
-unsigned char hwI2CReadReg(
+unsigned char sm750_hw_i2c_read_reg(
unsigned char deviceAddress,
unsigned char registerIndex
)
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index a8d23d2..70a6007 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -5,6 +5,6 @@
int sm750_hw_i2c_init(unsigned char busSpeedMode);
void sm750_hw_i2c_close(void);

-unsigned char hwI2CReadReg(unsigned char deviceAddress, unsigned char registerIndex);
+unsigned char sm750_hw_i2c_read_reg(unsigned char deviceAddress, unsigned char registerIndex);
int hwI2CWriteReg(unsigned char deviceAddress, unsigned char registerIndex, unsigned char data);
#endif
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index 1803b74..20dbc05 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -12,7 +12,7 @@

#ifdef USE_HW_I2C
#define i2cWriteReg hwI2CWriteReg
- #define i2cReadReg hwI2CReadReg
+ #define i2cReadReg sm750_hw_i2c_read_reg
#else
#define i2cWriteReg swI2CWriteReg
#define i2cReadReg swI2CReadReg
--
2.1.0

2015-08-24 05:24:19

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 04/17] staging: sm750fb: rename hwI2CWriteReg to sm750_hw_i2c_write_reg

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_hwi2c.h | 2 +-
drivers/staging/sm750fb/ddk750_sii164.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 03da0a7..e6d31db 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -249,7 +249,7 @@ unsigned char sm750_hw_i2c_read_reg(
* 0 - Success
* -1 - Fail
*/
-int hwI2CWriteReg(
+int sm750_hw_i2c_write_reg(
unsigned char deviceAddress,
unsigned char registerIndex,
unsigned char data
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 70a6007..29ce48d 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -6,5 +6,5 @@ int sm750_hw_i2c_init(unsigned char busSpeedMode);
void sm750_hw_i2c_close(void);

unsigned char sm750_hw_i2c_read_reg(unsigned char deviceAddress, unsigned char registerIndex);
-int hwI2CWriteReg(unsigned char deviceAddress, unsigned char registerIndex, unsigned char data);
+int sm750_hw_i2c_write_reg(unsigned char deviceAddress, unsigned char registerIndex, unsigned char data);
#endif
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index 20dbc05..3d129aa 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -11,7 +11,7 @@
#define USE_HW_I2C

#ifdef USE_HW_I2C
- #define i2cWriteReg hwI2CWriteReg
+ #define i2cWriteReg sm750_hw_i2c_write_reg
#define i2cReadReg sm750_hw_i2c_read_reg
#else
#define i2cWriteReg swI2CWriteReg
--
2.1.0

2015-08-24 05:28:23

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 05/17] staging: sm750fb: ddk750_hwi2c: rename CamelCase static functions

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index e6d31db..0677ff0 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -60,7 +60,7 @@ void sm750_hw_i2c_close(void)
}


-static long hwI2CWaitTXDone(void)
+static long sm750_hw_i2c_wait_tx_done(void)
{
unsigned int timeout;

@@ -90,7 +90,7 @@ static long hwI2CWaitTXDone(void)
* Return Value:
* Total number of bytes those are actually written.
*/
-static unsigned int hwI2CWriteData(
+static unsigned int sm750_hw_i2c_write_data(
unsigned char deviceAddress,
unsigned int length,
unsigned char *pBuffer
@@ -125,7 +125,7 @@ static unsigned int hwI2CWriteData(
POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));

/* Wait until the transfer is completed. */
- if (hwI2CWaitTXDone() != 0)
+ if (sm750_hw_i2c_wait_tx_done() != 0)
break;

/* Substract length */
@@ -156,7 +156,7 @@ static unsigned int hwI2CWriteData(
* Return Value:
* Total number of actual bytes read from the slave device
*/
-static unsigned int hwI2CReadData(
+static unsigned int sm750_hw_i2c_read_data(
unsigned char deviceAddress,
unsigned int length,
unsigned char *pBuffer
@@ -187,7 +187,7 @@ static unsigned int hwI2CReadData(
POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));

/* Wait until transaction done. */
- if (hwI2CWaitTXDone() != 0)
+ if (sm750_hw_i2c_wait_tx_done() != 0)
break;

/* Save the data to the given buffer */
@@ -226,8 +226,8 @@ unsigned char sm750_hw_i2c_read_reg(
{
unsigned char value = (0xFF);

- if (hwI2CWriteData(deviceAddress, 1, &registerIndex) == 1)
- hwI2CReadData(deviceAddress, 1, &value);
+ if (sm750_hw_i2c_write_data(deviceAddress, 1, &registerIndex) == 1)
+ sm750_hw_i2c_read_data(deviceAddress, 1, &value);

return value;
}
@@ -259,7 +259,7 @@ int sm750_hw_i2c_write_reg(

value[0] = registerIndex;
value[1] = data;
- if (hwI2CWriteData(deviceAddress, 2, value) == 2)
+ if (sm750_hw_i2c_write_data(deviceAddress, 2, value) == 2)
return 0;

return (-1);
--
2.1.0

2015-08-24 05:27:44

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 06/17] staging: sm750fb: rename swI2CInit to sm750_sw_i2c_init

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_sii164.c | 2 +-
drivers/staging/sm750fb/ddk750_swi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_swi2c.h | 2 +-
drivers/staging/sm750fb/sm750_hw.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index 3d129aa..241b77b 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -132,7 +132,7 @@ long sii164InitChip(
/* Use fast mode. */
sm750_hw_i2c_init(1);
#else
- swI2CInit(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA);
+ sm750_sw_i2c_init(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA);
#endif

/* Check if SII164 Chip exists */
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 5133bcc..ecfd300 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -386,7 +386,7 @@ static long swI2CInit_SM750LE(unsigned char i2cClkGPIO,
* -1 - Fail to initialize the i2c
* 0 - Success
*/
-long swI2CInit(
+long sm750_sw_i2c_init(
unsigned char i2cClkGPIO,
unsigned char i2cDataGPIO
)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h
index 4af2b7a..1e18b80 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.h
+++ b/drivers/staging/sm750fb/ddk750_swi2c.h
@@ -28,7 +28,7 @@
* -1 - Fail to initialize the i2c
* 0 - Success
*/
-long swI2CInit(
+long sm750_sw_i2c_init(
unsigned char i2cClkGPIO,
unsigned char i2cDataGPIO
);
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 7317ba9..522736e 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -169,7 +169,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev)
/* Set up GPIO for software I2C to program DVI chip in the
Xilinx SP605 board, in order to have video signal.
*/
- swI2CInit(0, 1);
+ sm750_sw_i2c_init(0, 1);


/* Customer may NOT use CH7301 DVI chip, which has to be
--
2.1.0

2015-08-24 05:27:13

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 07/17] staging: sm750fb: rename swI2CReadReg to sm750_sw_i2c_read_reg

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_swi2c.h | 2 +-
drivers/staging/sm750fb/sm750_hw.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index ecfd300..765edd6 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -443,7 +443,7 @@ long sm750_sw_i2c_init(
* Return Value:
* Register value
*/
-unsigned char swI2CReadReg(
+unsigned char sm750_sw_i2c_read_reg(
unsigned char deviceAddress,
unsigned char registerIndex
)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h
index 1e18b80..2e87a63 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.h
+++ b/drivers/staging/sm750fb/ddk750_swi2c.h
@@ -44,7 +44,7 @@ long sm750_sw_i2c_init(
* Return Value:
* Register value
*/
-unsigned char swI2CReadReg(
+unsigned char sm750_sw_i2c_read_reg(
unsigned char deviceAddress,
unsigned char registerIndex
);
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 522736e..b8b5e00 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -175,7 +175,7 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev)
/* Customer may NOT use CH7301 DVI chip, which has to be
initialized differently.
*/
- if (swI2CReadReg(0xec, 0x4a) == 0x95) {
+ if (sm750_sw_i2c_read_reg(0xec, 0x4a) == 0x95) {
/* The following register values for CH7301 are from
Chrontel app note and our experiment.
*/
--
2.1.0

2015-08-24 05:24:24

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 08/17] staging: sm750fb: rename swI2CWriteReg to sm750_sw_i2c_write_reg

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 2 +-
drivers/staging/sm750fb/ddk750_swi2c.h | 2 +-
drivers/staging/sm750fb/sm750_hw.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 765edd6..e3f60eb 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -483,7 +483,7 @@ unsigned char sm750_sw_i2c_read_reg(
* 0 - Success
* -1 - Fail
*/
-long swI2CWriteReg(
+long sm750_sw_i2c_write_reg(
unsigned char deviceAddress,
unsigned char registerIndex,
unsigned char data
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h
index 2e87a63..37335dd 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.h
+++ b/drivers/staging/sm750fb/ddk750_swi2c.h
@@ -62,7 +62,7 @@ unsigned char sm750_sw_i2c_read_reg(
* 0 - Success
* -1 - Fail
*/
-long swI2CWriteReg(
+long sm750_sw_i2c_write_reg(
unsigned char deviceAddress,
unsigned char registerIndex,
unsigned char data
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index b8b5e00..de30429 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -180,9 +180,9 @@ int hw_sm750_inithw(struct lynx_share *share, struct pci_dev *pdev)
Chrontel app note and our experiment.
*/
pr_info("yes,CH7301 DVI chip found\n");
- swI2CWriteReg(0xec, 0x1d, 0x16);
- swI2CWriteReg(0xec, 0x21, 0x9);
- swI2CWriteReg(0xec, 0x49, 0xC0);
+ sm750_sw_i2c_write_reg(0xec, 0x1d, 0x16);
+ sm750_sw_i2c_write_reg(0xec, 0x21, 0x9);
+ sm750_sw_i2c_write_reg(0xec, 0x49, 0xC0);
pr_info("okay,CH7301 DVI chip setup done\n");
}
}
--
2.1.0

2015-08-24 05:24:29

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 09/17] staging: sm750fb: ddk750_swi2c: staticize swI2C{SCL,SDA}

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 4 ++--
drivers/staging/sm750fb/ddk750_swi2c.h | 21 ---------------------
2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index e3f60eb..6a10ae3 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -119,7 +119,7 @@ static void swI2CWait(void)
* signal because the i2c will fail when other device try to drive the
* signal due to SM50x will drive the signal to always high.
*/
-void swI2CSCL(unsigned char value)
+static void swI2CSCL(unsigned char value)
{
unsigned long ulGPIOData;
unsigned long ulGPIODirection;
@@ -153,7 +153,7 @@ void swI2CSCL(unsigned char value)
* signal because the i2c will fail when other device try to drive the
* signal due to SM50x will drive the signal to always high.
*/
-void swI2CSDA(unsigned char value)
+static void swI2CSDA(unsigned char value)
{
unsigned long ulGPIOData;
unsigned long ulGPIODirection;
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h
index 37335dd..27a04f3a 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.h
+++ b/drivers/staging/sm750fb/ddk750_swi2c.h
@@ -68,25 +68,4 @@ long sm750_sw_i2c_write_reg(
unsigned char data
);

-/*
- * These two functions toggle the data on the SCL and SDA I2C lines.
- * The use of these two functions is not recommended unless it is necessary.
- */
-
-/*
- * This function set/reset the SCL GPIO pin
- *
- * Parameters:
- * value - Bit value to set to the SCL or SDA (0 = low, 1 = high)
- */
-void swI2CSCL(unsigned char value);
-
-/*
- * This function set/reset the SDA GPIO pin
- *
- * Parameters:
- * value - Bit value to set to the SCL or SDA (0 = low, 1 = high)
- */
-void swI2CSDA(unsigned char value);
-
#endif /* _SWI2C_H_ */
--
2.1.0

2015-08-24 05:26:43

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 10/17] staging: sm750fb: ddk750_swi2c: rename CamelCase static functions

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 116 ++++++++++++++++-----------------
1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 6a10ae3..b3f64c4 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -82,7 +82,7 @@ static unsigned long g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION;
/*
* This function puts a delay between command
*/
-static void swI2CWait(void)
+static void sm750_sw_i2c_wait(void)
{
/* find a bug:
* peekIO method works well before suspend/resume
@@ -119,7 +119,7 @@ static void swI2CWait(void)
* signal because the i2c will fail when other device try to drive the
* signal due to SM50x will drive the signal to always high.
*/
-static void swI2CSCL(unsigned char value)
+static void sm750_sw_i2c_scl(unsigned char value)
{
unsigned long ulGPIOData;
unsigned long ulGPIODirection;
@@ -153,7 +153,7 @@ static void swI2CSCL(unsigned char value)
* signal because the i2c will fail when other device try to drive the
* signal due to SM50x will drive the signal to always high.
*/
-static void swI2CSDA(unsigned char value)
+static void sm750_sw_i2c_sda(unsigned char value)
{
unsigned long ulGPIOData;
unsigned long ulGPIODirection;
@@ -181,7 +181,7 @@ static void swI2CSDA(unsigned char value)
* Return Value:
* The SDA data bit sent by the Slave
*/
-static unsigned char swI2CReadSDA(void)
+static unsigned char sm750_sw_i2c_read_sda(void)
{
unsigned long ulGPIODirection;
unsigned long ulGPIOData;
@@ -204,7 +204,7 @@ static unsigned char swI2CReadSDA(void)
/*
* This function sends ACK signal
*/
-static void swI2CAck(void)
+static void sm750_sw_i2c_ack(void)
{
return; /* Single byte read is ok without it. */
}
@@ -212,23 +212,23 @@ static void swI2CAck(void)
/*
* This function sends the start command to the slave device
*/
-static void swI2CStart(void)
+static void sm750_sw_i2c_start(void)
{
/* Start I2C */
- swI2CSDA(1);
- swI2CSCL(1);
- swI2CSDA(0);
+ sm750_sw_i2c_sda(1);
+ sm750_sw_i2c_scl(1);
+ sm750_sw_i2c_sda(0);
}

/*
* This function sends the stop command to the slave device
*/
-static void swI2CStop(void)
+static void sm750_sw_i2c_stop(void)
{
/* Stop the I2C */
- swI2CSCL(1);
- swI2CSDA(0);
- swI2CSDA(1);
+ sm750_sw_i2c_scl(1);
+ sm750_sw_i2c_sda(0);
+ sm750_sw_i2c_sda(1);
}

/*
@@ -241,7 +241,7 @@ static void swI2CStop(void)
* 0 - Success
* -1 - Fail to write byte
*/
-static long swI2CWriteByte(unsigned char data)
+static long sm750_sw_i2c_write_byte(unsigned char data)
{
unsigned char value = data;
int i;
@@ -249,47 +249,47 @@ static long swI2CWriteByte(unsigned char data)
/* Sending the data bit by bit */
for (i = 0; i < 8; i++) {
/* Set SCL to low */
- swI2CSCL(0);
+ sm750_sw_i2c_scl(0);

/* Send data bit */
if ((value & 0x80) != 0)
- swI2CSDA(1);
+ sm750_sw_i2c_sda(1);
else
- swI2CSDA(0);
+ sm750_sw_i2c_sda(0);

- swI2CWait();
+ sm750_sw_i2c_wait();

/* Toggle clk line to one */
- swI2CSCL(1);
- swI2CWait();
+ sm750_sw_i2c_scl(1);
+ sm750_sw_i2c_wait();

/* Shift byte to be sent */
value = value << 1;
}

/* Set the SCL Low and SDA High (prepare to get input) */
- swI2CSCL(0);
- swI2CSDA(1);
+ sm750_sw_i2c_scl(0);
+ sm750_sw_i2c_sda(1);

/* Set the SCL High for ack */
- swI2CWait();
- swI2CSCL(1);
- swI2CWait();
+ sm750_sw_i2c_wait();
+ sm750_sw_i2c_scl(1);
+ sm750_sw_i2c_wait();

/* Read SDA, until SDA==0 */
for (i = 0; i < 0xff; i++) {
- if (!swI2CReadSDA())
+ if (!sm750_sw_i2c_read_sda())
break;

- swI2CSCL(0);
- swI2CWait();
- swI2CSCL(1);
- swI2CWait();
+ sm750_sw_i2c_scl(0);
+ sm750_sw_i2c_wait();
+ sm750_sw_i2c_scl(1);
+ sm750_sw_i2c_wait();
}

/* Set the SCL Low and SDA High */
- swI2CSCL(0);
- swI2CSDA(1);
+ sm750_sw_i2c_scl(0);
+ sm750_sw_i2c_sda(1);

if (i < 0xff)
return 0;
@@ -307,31 +307,31 @@ static long swI2CWriteByte(unsigned char data)
* Return Value:
* One byte data read from the Slave device
*/
-static unsigned char swI2CReadByte(unsigned char ack)
+static unsigned char sm750_sw_i2c_read_byte(unsigned char ack)
{
int i;
unsigned char data = 0;

for (i = 7; i >= 0; i--) {
/* Set the SCL to Low and SDA to High (Input) */
- swI2CSCL(0);
- swI2CSDA(1);
- swI2CWait();
+ sm750_sw_i2c_scl(0);
+ sm750_sw_i2c_sda(1);
+ sm750_sw_i2c_wait();

/* Set the SCL High */
- swI2CSCL(1);
- swI2CWait();
+ sm750_sw_i2c_scl(1);
+ sm750_sw_i2c_wait();

/* Read data bits from SDA */
- data |= (swI2CReadSDA() << i);
+ data |= (sm750_sw_i2c_read_sda() << i);
}

if (ack)
- swI2CAck();
+ sm750_sw_i2c_ack();

/* Set the SCL Low and SDA High */
- swI2CSCL(0);
- swI2CSDA(1);
+ sm750_sw_i2c_scl(0);
+ sm750_sw_i2c_sda(1);

return data;
}
@@ -347,7 +347,7 @@ static unsigned char swI2CReadByte(unsigned char ack)
* -1 - Fail to initialize the i2c
* 0 - Success
*/
-static long swI2CInit_SM750LE(unsigned char i2cClkGPIO,
+static long sm750le_i2c_init(unsigned char i2cClkGPIO,
unsigned char i2cDataGPIO)
{
int i;
@@ -370,7 +370,7 @@ static long swI2CInit_SM750LE(unsigned char i2cClkGPIO,

/* Clear the i2c lines. */
for (i = 0; i < 9; i++)
- swI2CStop();
+ sm750_sw_i2c_stop();

return 0;
}
@@ -398,7 +398,7 @@ long sm750_sw_i2c_init(
return -1;

if (getChipType() == SM750LE)
- return swI2CInit_SM750LE(i2cClkGPIO, i2cDataGPIO);
+ return sm750le_i2c_init(i2cClkGPIO, i2cDataGPIO);

/* Initialize the GPIO pin for the i2c Clock Register */
g_i2cClkGPIOMuxReg = GPIO_MUX;
@@ -427,7 +427,7 @@ long sm750_sw_i2c_init(

/* Clear the i2c lines. */
for (i = 0; i < 9; i++)
- swI2CStop();
+ sm750_sw_i2c_stop();

return 0;
}
@@ -451,21 +451,21 @@ unsigned char sm750_sw_i2c_read_reg(
unsigned char data;

/* Send the Start signal */
- swI2CStart();
+ sm750_sw_i2c_start();

/* Send the device address */
- swI2CWriteByte(deviceAddress);
+ sm750_sw_i2c_write_byte(deviceAddress);

/* Send the register index */
- swI2CWriteByte(registerIndex);
+ sm750_sw_i2c_write_byte(registerIndex);

/* Get the bus again and get the data from the device read address */
- swI2CStart();
- swI2CWriteByte(deviceAddress + 1);
- data = swI2CReadByte(1);
+ sm750_sw_i2c_start();
+ sm750_sw_i2c_write_byte(deviceAddress + 1);
+ data = sm750_sw_i2c_read_byte(1);

/* Stop swI2C and release the bus */
- swI2CStop();
+ sm750_sw_i2c_stop();

return data;
}
@@ -492,19 +492,19 @@ long sm750_sw_i2c_write_reg(
long returnValue = 0;

/* Send the Start signal */
- swI2CStart();
+ sm750_sw_i2c_start();

/* Send the device address and read the data. All should return success
in order for the writing processed to be successful
*/
- if ((swI2CWriteByte(deviceAddress) != 0) ||
- (swI2CWriteByte(registerIndex) != 0) ||
- (swI2CWriteByte(data) != 0)) {
+ if ((sm750_sw_i2c_write_byte(deviceAddress) != 0) ||
+ (sm750_sw_i2c_write_byte(registerIndex) != 0) ||
+ (sm750_sw_i2c_write_byte(data) != 0)) {
returnValue = -1;
}

/* Stop i2c and release the bus */
- swI2CStop();
+ sm750_sw_i2c_stop();

return returnValue;
}
--
2.1.0

2015-08-24 05:24:36

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 11/17] staging: sm750fb: ddk750_hw_i2c: rename busSpeedMode

rename CamelCase parameter in sm750_hw_i2c_init()

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 4 ++--
drivers/staging/sm750fb/ddk750_hwi2c.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 0677ff0..c4c2dad 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -10,7 +10,7 @@


int sm750_hw_i2c_init(
-unsigned char busSpeedMode
+unsigned char bus_speed_mode
)
{
unsigned int value;
@@ -29,7 +29,7 @@ unsigned char busSpeedMode

/* Enable the I2C Controller and set the bus speed mode */
value = PEEK32(I2C_CTRL);
- if (busSpeedMode == 0)
+ if (bus_speed_mode == 0)
value = FIELD_SET(value, I2C_CTRL, MODE, STANDARD);
else
value = FIELD_SET(value, I2C_CTRL, MODE, FAST);
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 29ce48d..5872f9c 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -2,7 +2,7 @@
#define DDK750_HWI2C_H__

/* hwi2c functions */
-int sm750_hw_i2c_init(unsigned char busSpeedMode);
+int sm750_hw_i2c_init(unsigned char bus_speed_mode);
void sm750_hw_i2c_close(void);

unsigned char sm750_hw_i2c_read_reg(unsigned char deviceAddress, unsigned char registerIndex);
--
2.1.0

2015-08-24 05:26:22

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 12/17] staging: sm750fb: hw_i2c_{read,write}: rename CamelCase variables

Rename longCamelCase variables deviceAddress and registerIndex to
shorter addr and reg

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 16 ++++++++--------
drivers/staging/sm750fb/ddk750_hwi2c.h | 4 ++--
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index c4c2dad..616c42f 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -220,14 +220,14 @@ static unsigned int sm750_hw_i2c_read_data(
* Register value
*/
unsigned char sm750_hw_i2c_read_reg(
- unsigned char deviceAddress,
- unsigned char registerIndex
+ unsigned char addr,
+ unsigned char reg
)
{
unsigned char value = (0xFF);

- if (sm750_hw_i2c_write_data(deviceAddress, 1, &registerIndex) == 1)
- sm750_hw_i2c_read_data(deviceAddress, 1, &value);
+ if (sm750_hw_i2c_write_data(addr, 1, &reg) == 1)
+ sm750_hw_i2c_read_data(addr, 1, &value);

return value;
}
@@ -250,16 +250,16 @@ unsigned char sm750_hw_i2c_read_reg(
* -1 - Fail
*/
int sm750_hw_i2c_write_reg(
- unsigned char deviceAddress,
- unsigned char registerIndex,
+ unsigned char addr,
+ unsigned char reg,
unsigned char data
)
{
unsigned char value[2];

- value[0] = registerIndex;
+ value[0] = reg;
value[1] = data;
- if (sm750_hw_i2c_write_data(deviceAddress, 2, value) == 2)
+ if (sm750_hw_i2c_write_data(addr, 2, value) == 2)
return 0;

return (-1);
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 5872f9c..2827865 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -5,6 +5,6 @@
int sm750_hw_i2c_init(unsigned char bus_speed_mode);
void sm750_hw_i2c_close(void);

-unsigned char sm750_hw_i2c_read_reg(unsigned char deviceAddress, unsigned char registerIndex);
-int sm750_hw_i2c_write_reg(unsigned char deviceAddress, unsigned char registerIndex, unsigned char data);
+unsigned char sm750_hw_i2c_read_reg(unsigned char addr, unsigned char reg);
+int sm750_hw_i2c_write_reg(unsigned char addr, unsigned char reg, unsigned char data);
#endif
--
2.1.0

2015-08-24 05:24:41

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 13/17] staging: sm750fb: ddk750_hwi2c: reduce amount of CamelCase

Rename camel case variables deviceAddress, pBuffer and totalBytes to
addr, buf and total_bytes respectively in sm750_hw_i2c_{read,write}_data
functions.

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 36 +++++++++++++++++-----------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 616c42f..fa1a4d4 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -82,25 +82,25 @@ static long sm750_hw_i2c_wait_tx_done(void)
* This function writes data to the i2c slave device registers.
*
* Parameters:
- * deviceAddress - i2c Slave device address
+ * addr - i2c Slave device address
* length - Total number of bytes to be written to the device
- * pBuffer - The buffer that contains the data to be written to the
+ * buf - The buffer that contains the data to be written to the
* i2c device.
*
* Return Value:
* Total number of bytes those are actually written.
*/
static unsigned int sm750_hw_i2c_write_data(
- unsigned char deviceAddress,
+ unsigned char addr,
unsigned int length,
- unsigned char *pBuffer
+ unsigned char *buf
)
{
unsigned char count, i;
- unsigned int totalBytes = 0;
+ unsigned int total_bytes = 0;

/* Set the Device Address */
- POKE32(I2C_SLAVE_ADDRESS, deviceAddress & ~0x01);
+ POKE32(I2C_SLAVE_ADDRESS, addr & ~0x01);

/* Write data.
* Note:
@@ -119,7 +119,7 @@ static unsigned int sm750_hw_i2c_write_data(

/* Move the data to the I2C data register */
for (i = 0; i <= count; i++)
- POKE32(I2C_DATA0 + i, *pBuffer++);
+ POKE32(I2C_DATA0 + i, *buf++);

/* Start the I2C */
POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));
@@ -132,11 +132,11 @@ static unsigned int sm750_hw_i2c_write_data(
length -= (count + 1);

/* Total byte written */
- totalBytes += (count + 1);
+ total_bytes += (count + 1);

} while (length > 0);

- return totalBytes;
+ return total_bytes;
}


@@ -147,9 +147,9 @@ static unsigned int sm750_hw_i2c_write_data(
* in the given buffer
*
* Parameters:
- * deviceAddress - i2c Slave device address
+ * addr - i2c Slave device address
* length - Total number of bytes to be read
- * pBuffer - Pointer to a buffer to be filled with the data read
+ * buf - Pointer to a buffer to be filled with the data read
* from the slave device. It has to be the same size as the
* length to make sure that it can keep all the data read.
*
@@ -157,16 +157,16 @@ static unsigned int sm750_hw_i2c_write_data(
* Total number of actual bytes read from the slave device
*/
static unsigned int sm750_hw_i2c_read_data(
- unsigned char deviceAddress,
+ unsigned char addr,
unsigned int length,
- unsigned char *pBuffer
+ unsigned char *buf
)
{
unsigned char count, i;
- unsigned int totalBytes = 0;
+ unsigned int total_bytes = 0;

/* Set the Device Address */
- POKE32(I2C_SLAVE_ADDRESS, deviceAddress | 0x01);
+ POKE32(I2C_SLAVE_ADDRESS, addr | 0x01);

/* Read data and save them to the buffer.
* Note:
@@ -192,17 +192,17 @@ static unsigned int sm750_hw_i2c_read_data(

/* Save the data to the given buffer */
for (i = 0; i <= count; i++)
- *pBuffer++ = PEEK32(I2C_DATA0 + i);
+ *buf++ = PEEK32(I2C_DATA0 + i);

/* Substract length by 16 */
length -= (count + 1);

/* Number of bytes read. */
- totalBytes += (count + 1);
+ total_bytes += (count + 1);

} while (length > 0);

- return totalBytes;
+ return total_bytes;
}


--
2.1.0

2015-08-24 05:24:46

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 14/17] staging: sm750fb: ddk750_swi2c: rename CamelCase static variables

Rename static variables defining I2C GPIO pins and their control registers from
CamelCase.

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 96 +++++++++++++++++-----------------
1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index b3f64c4..94f4c46 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -55,8 +55,8 @@
******************************************************************/

/* GPIO pins used for this I2C. It ranges from 0 to 63. */
-static unsigned char g_i2cClockGPIO = DEFAULT_I2C_SCL;
-static unsigned char g_i2cDataGPIO = DEFAULT_I2C_SDA;
+static unsigned char sw_i2c_clk_gpio = DEFAULT_I2C_SCL;
+static unsigned char sw_i2c_data_gpio = DEFAULT_I2C_SDA;

/*
* Below is the variable declaration for the GPIO pin register usage
@@ -70,14 +70,14 @@ static unsigned char g_i2cDataGPIO = DEFAULT_I2C_SDA;
*/

/* i2c Clock GPIO Register usage */
-static unsigned long g_i2cClkGPIOMuxReg = GPIO_MUX;
-static unsigned long g_i2cClkGPIODataReg = GPIO_DATA;
-static unsigned long g_i2cClkGPIODataDirReg = GPIO_DATA_DIRECTION;
+static unsigned long sw_i2c_clk_gpio_mux_reg = GPIO_MUX;
+static unsigned long sw_i2c_clk_gpio_data_reg = GPIO_DATA;
+static unsigned long sw_i2c_clk_gpio_data_dir_reg = GPIO_DATA_DIRECTION;

/* i2c Data GPIO Register usage */
-static unsigned long g_i2cDataGPIOMuxReg = GPIO_MUX;
-static unsigned long g_i2cDataGPIODataReg = GPIO_DATA;
-static unsigned long g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION;
+static unsigned long sw_i2c_data_gpio_mux_reg = GPIO_MUX;
+static unsigned long sw_i2c_data_gpio_data_reg = GPIO_DATA;
+static unsigned long sw_i2c_data_gpio_data_dir_reg = GPIO_DATA_DIRECTION;

/*
* This function puts a delay between command
@@ -124,20 +124,20 @@ static void sm750_sw_i2c_scl(unsigned char value)
unsigned long ulGPIOData;
unsigned long ulGPIODirection;

- ulGPIODirection = PEEK32(g_i2cClkGPIODataDirReg);
+ ulGPIODirection = PEEK32(sw_i2c_clk_gpio_data_dir_reg);
if (value) { /* High */
/* Set direction as input. This will automatically pull the signal up. */
- ulGPIODirection &= ~(1 << g_i2cClockGPIO);
- POKE32(g_i2cClkGPIODataDirReg, ulGPIODirection);
+ ulGPIODirection &= ~(1 << sw_i2c_clk_gpio);
+ POKE32(sw_i2c_clk_gpio_data_dir_reg, ulGPIODirection);
} else { /* Low */
/* Set the signal down */
- ulGPIOData = PEEK32(g_i2cClkGPIODataReg);
- ulGPIOData &= ~(1 << g_i2cClockGPIO);
- POKE32(g_i2cClkGPIODataReg, ulGPIOData);
+ ulGPIOData = PEEK32(sw_i2c_clk_gpio_data_reg);
+ ulGPIOData &= ~(1 << sw_i2c_clk_gpio);
+ POKE32(sw_i2c_clk_gpio_data_reg, ulGPIOData);

/* Set direction as output */
- ulGPIODirection |= (1 << g_i2cClockGPIO);
- POKE32(g_i2cClkGPIODataDirReg, ulGPIODirection);
+ ulGPIODirection |= (1 << sw_i2c_clk_gpio);
+ POKE32(sw_i2c_clk_gpio_data_dir_reg, ulGPIODirection);
}
}

@@ -158,20 +158,20 @@ static void sm750_sw_i2c_sda(unsigned char value)
unsigned long ulGPIOData;
unsigned long ulGPIODirection;

- ulGPIODirection = PEEK32(g_i2cDataGPIODataDirReg);
+ ulGPIODirection = PEEK32(sw_i2c_data_gpio_data_dir_reg);
if (value) { /* High */
/* Set direction as input. This will automatically pull the signal up. */
- ulGPIODirection &= ~(1 << g_i2cDataGPIO);
- POKE32(g_i2cDataGPIODataDirReg, ulGPIODirection);
+ ulGPIODirection &= ~(1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_dir_reg, ulGPIODirection);
} else { /* Low */
/* Set the signal down */
- ulGPIOData = PEEK32(g_i2cDataGPIODataReg);
- ulGPIOData &= ~(1 << g_i2cDataGPIO);
- POKE32(g_i2cDataGPIODataReg, ulGPIOData);
+ ulGPIOData = PEEK32(sw_i2c_data_gpio_data_reg);
+ ulGPIOData &= ~(1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_reg, ulGPIOData);

/* Set direction as output */
- ulGPIODirection |= (1 << g_i2cDataGPIO);
- POKE32(g_i2cDataGPIODataDirReg, ulGPIODirection);
+ ulGPIODirection |= (1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_dir_reg, ulGPIODirection);
}
}

@@ -187,15 +187,15 @@ static unsigned char sm750_sw_i2c_read_sda(void)
unsigned long ulGPIOData;

/* Make sure that the direction is input (High) */
- ulGPIODirection = PEEK32(g_i2cDataGPIODataDirReg);
- if ((ulGPIODirection & (1 << g_i2cDataGPIO)) != (~(1 << g_i2cDataGPIO))) {
- ulGPIODirection &= ~(1 << g_i2cDataGPIO);
- POKE32(g_i2cDataGPIODataDirReg, ulGPIODirection);
+ ulGPIODirection = PEEK32(sw_i2c_data_gpio_data_dir_reg);
+ if ((ulGPIODirection & (1 << sw_i2c_data_gpio)) != (~(1 << sw_i2c_data_gpio))) {
+ ulGPIODirection &= ~(1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_dir_reg, ulGPIODirection);
}

/* Now read the SDA line */
- ulGPIOData = PEEK32(g_i2cDataGPIODataReg);
- if (ulGPIOData & (1 << g_i2cDataGPIO))
+ ulGPIOData = PEEK32(sw_i2c_data_gpio_data_reg);
+ if (ulGPIOData & (1 << sw_i2c_data_gpio))
return 1;
else
return 0;
@@ -353,18 +353,18 @@ static long sm750le_i2c_init(unsigned char i2cClkGPIO,
int i;

/* Initialize the GPIO pin for the i2c Clock Register */
- g_i2cClkGPIODataReg = GPIO_DATA_SM750LE;
- g_i2cClkGPIODataDirReg = GPIO_DATA_DIRECTION_SM750LE;
+ sw_i2c_clk_gpio_data_reg = GPIO_DATA_SM750LE;
+ sw_i2c_clk_gpio_data_dir_reg = GPIO_DATA_DIRECTION_SM750LE;

/* Initialize the Clock GPIO Offset */
- g_i2cClockGPIO = i2cClkGPIO;
+ sw_i2c_clk_gpio = i2cClkGPIO;

/* Initialize the GPIO pin for the i2c Data Register */
- g_i2cDataGPIODataReg = GPIO_DATA_SM750LE;
- g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION_SM750LE;
+ sw_i2c_data_gpio_data_reg = GPIO_DATA_SM750LE;
+ sw_i2c_data_gpio_data_dir_reg = GPIO_DATA_DIRECTION_SM750LE;

/* Initialize the Data GPIO Offset */
- g_i2cDataGPIO = i2cDataGPIO;
+ sw_i2c_data_gpio = i2cDataGPIO;

/* Note that SM750LE don't have GPIO MUX and power is always on */

@@ -401,26 +401,26 @@ long sm750_sw_i2c_init(
return sm750le_i2c_init(i2cClkGPIO, i2cDataGPIO);

/* Initialize the GPIO pin for the i2c Clock Register */
- g_i2cClkGPIOMuxReg = GPIO_MUX;
- g_i2cClkGPIODataReg = GPIO_DATA;
- g_i2cClkGPIODataDirReg = GPIO_DATA_DIRECTION;
+ sw_i2c_clk_gpio_mux_reg = GPIO_MUX;
+ sw_i2c_clk_gpio_data_reg = GPIO_DATA;
+ sw_i2c_clk_gpio_data_dir_reg = GPIO_DATA_DIRECTION;

/* Initialize the Clock GPIO Offset */
- g_i2cClockGPIO = i2cClkGPIO;
+ sw_i2c_clk_gpio = i2cClkGPIO;

/* Initialize the GPIO pin for the i2c Data Register */
- g_i2cDataGPIOMuxReg = GPIO_MUX;
- g_i2cDataGPIODataReg = GPIO_DATA;
- g_i2cDataGPIODataDirReg = GPIO_DATA_DIRECTION;
+ sw_i2c_data_gpio_mux_reg = GPIO_MUX;
+ sw_i2c_data_gpio_data_reg = GPIO_DATA;
+ sw_i2c_data_gpio_data_dir_reg = GPIO_DATA_DIRECTION;

/* Initialize the Data GPIO Offset */
- g_i2cDataGPIO = i2cDataGPIO;
+ sw_i2c_data_gpio = i2cDataGPIO;

/* Enable the GPIO pins for the i2c Clock and Data (GPIO MUX) */
- POKE32(g_i2cClkGPIOMuxReg,
- PEEK32(g_i2cClkGPIOMuxReg) & ~(1 << g_i2cClockGPIO));
- POKE32(g_i2cDataGPIOMuxReg,
- PEEK32(g_i2cDataGPIOMuxReg) & ~(1 << g_i2cDataGPIO));
+ POKE32(sw_i2c_clk_gpio_mux_reg,
+ PEEK32(sw_i2c_clk_gpio_mux_reg) & ~(1 << sw_i2c_clk_gpio));
+ POKE32(sw_i2c_data_gpio_mux_reg,
+ PEEK32(sw_i2c_data_gpio_mux_reg) & ~(1 << sw_i2c_data_gpio));

/* Enable GPIO power */
enableGPIO(1);
--
2.1.0

2015-08-24 05:24:49

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 15/17] staging: sm750fb: ddk750_swi2c: further reduce CamelCase

Rename remaining CamelCase variables

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 122 ++++++++++++++++-----------------
drivers/staging/sm750fb/ddk750_swi2c.h | 20 +++---
2 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index 94f4c46..ed14277 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -98,11 +98,11 @@ static void sm750_sw_i2c_wait(void)
*/
while (peekIO(0x3ce, 0x61) & 0x10);
#else
- int i, Temp;
+ int i, tmp;

for (i = 0; i < 600; i++) {
- Temp = i;
- Temp += i;
+ tmp = i;
+ tmp += i;
}
#endif
}
@@ -121,23 +121,23 @@ static void sm750_sw_i2c_wait(void)
*/
static void sm750_sw_i2c_scl(unsigned char value)
{
- unsigned long ulGPIOData;
- unsigned long ulGPIODirection;
+ unsigned long gpio_data;
+ unsigned long gpio_dir;

- ulGPIODirection = PEEK32(sw_i2c_clk_gpio_data_dir_reg);
+ gpio_dir = PEEK32(sw_i2c_clk_gpio_data_dir_reg);
if (value) { /* High */
/* Set direction as input. This will automatically pull the signal up. */
- ulGPIODirection &= ~(1 << sw_i2c_clk_gpio);
- POKE32(sw_i2c_clk_gpio_data_dir_reg, ulGPIODirection);
+ gpio_dir &= ~(1 << sw_i2c_clk_gpio);
+ POKE32(sw_i2c_clk_gpio_data_dir_reg, gpio_dir);
} else { /* Low */
/* Set the signal down */
- ulGPIOData = PEEK32(sw_i2c_clk_gpio_data_reg);
- ulGPIOData &= ~(1 << sw_i2c_clk_gpio);
- POKE32(sw_i2c_clk_gpio_data_reg, ulGPIOData);
+ gpio_data = PEEK32(sw_i2c_clk_gpio_data_reg);
+ gpio_data &= ~(1 << sw_i2c_clk_gpio);
+ POKE32(sw_i2c_clk_gpio_data_reg, gpio_data);

/* Set direction as output */
- ulGPIODirection |= (1 << sw_i2c_clk_gpio);
- POKE32(sw_i2c_clk_gpio_data_dir_reg, ulGPIODirection);
+ gpio_dir |= (1 << sw_i2c_clk_gpio);
+ POKE32(sw_i2c_clk_gpio_data_dir_reg, gpio_dir);
}
}

@@ -155,23 +155,23 @@ static void sm750_sw_i2c_scl(unsigned char value)
*/
static void sm750_sw_i2c_sda(unsigned char value)
{
- unsigned long ulGPIOData;
- unsigned long ulGPIODirection;
+ unsigned long gpio_data;
+ unsigned long gpio_dir;

- ulGPIODirection = PEEK32(sw_i2c_data_gpio_data_dir_reg);
+ gpio_dir = PEEK32(sw_i2c_data_gpio_data_dir_reg);
if (value) { /* High */
/* Set direction as input. This will automatically pull the signal up. */
- ulGPIODirection &= ~(1 << sw_i2c_data_gpio);
- POKE32(sw_i2c_data_gpio_data_dir_reg, ulGPIODirection);
+ gpio_dir &= ~(1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_dir_reg, gpio_dir);
} else { /* Low */
/* Set the signal down */
- ulGPIOData = PEEK32(sw_i2c_data_gpio_data_reg);
- ulGPIOData &= ~(1 << sw_i2c_data_gpio);
- POKE32(sw_i2c_data_gpio_data_reg, ulGPIOData);
+ gpio_data = PEEK32(sw_i2c_data_gpio_data_reg);
+ gpio_data &= ~(1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_reg, gpio_data);

/* Set direction as output */
- ulGPIODirection |= (1 << sw_i2c_data_gpio);
- POKE32(sw_i2c_data_gpio_data_dir_reg, ulGPIODirection);
+ gpio_dir |= (1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_dir_reg, gpio_dir);
}
}

@@ -183,19 +183,19 @@ static void sm750_sw_i2c_sda(unsigned char value)
*/
static unsigned char sm750_sw_i2c_read_sda(void)
{
- unsigned long ulGPIODirection;
- unsigned long ulGPIOData;
+ unsigned long gpio_dir;
+ unsigned long gpio_data;

/* Make sure that the direction is input (High) */
- ulGPIODirection = PEEK32(sw_i2c_data_gpio_data_dir_reg);
- if ((ulGPIODirection & (1 << sw_i2c_data_gpio)) != (~(1 << sw_i2c_data_gpio))) {
- ulGPIODirection &= ~(1 << sw_i2c_data_gpio);
- POKE32(sw_i2c_data_gpio_data_dir_reg, ulGPIODirection);
+ gpio_dir = PEEK32(sw_i2c_data_gpio_data_dir_reg);
+ if ((gpio_dir & (1 << sw_i2c_data_gpio)) != (~(1 << sw_i2c_data_gpio))) {
+ gpio_dir &= ~(1 << sw_i2c_data_gpio);
+ POKE32(sw_i2c_data_gpio_data_dir_reg, gpio_dir);
}

/* Now read the SDA line */
- ulGPIOData = PEEK32(sw_i2c_data_gpio_data_reg);
- if (ulGPIOData & (1 << sw_i2c_data_gpio))
+ gpio_data = PEEK32(sw_i2c_data_gpio_data_reg);
+ if (gpio_data & (1 << sw_i2c_data_gpio))
return 1;
else
return 0;
@@ -340,15 +340,15 @@ static unsigned char sm750_sw_i2c_read_byte(unsigned char ack)
* This function initializes GPIO port for SW I2C communication.
*
* Parameters:
- * i2cClkGPIO - The GPIO pin to be used as i2c SCL
- * i2cDataGPIO - The GPIO pin to be used as i2c SDA
+ * clk_gpio - The GPIO pin to be used as i2c SCL
+ * data_gpio - The GPIO pin to be used as i2c SDA
*
* Return Value:
* -1 - Fail to initialize the i2c
* 0 - Success
*/
-static long sm750le_i2c_init(unsigned char i2cClkGPIO,
- unsigned char i2cDataGPIO)
+static long sm750le_i2c_init(unsigned char clk_gpio,
+ unsigned char data_gpio)
{
int i;

@@ -357,14 +357,14 @@ static long sm750le_i2c_init(unsigned char i2cClkGPIO,
sw_i2c_clk_gpio_data_dir_reg = GPIO_DATA_DIRECTION_SM750LE;

/* Initialize the Clock GPIO Offset */
- sw_i2c_clk_gpio = i2cClkGPIO;
+ sw_i2c_clk_gpio = clk_gpio;

/* Initialize the GPIO pin for the i2c Data Register */
sw_i2c_data_gpio_data_reg = GPIO_DATA_SM750LE;
sw_i2c_data_gpio_data_dir_reg = GPIO_DATA_DIRECTION_SM750LE;

/* Initialize the Data GPIO Offset */
- sw_i2c_data_gpio = i2cDataGPIO;
+ sw_i2c_data_gpio = data_gpio;

/* Note that SM750LE don't have GPIO MUX and power is always on */

@@ -379,26 +379,26 @@ static long sm750le_i2c_init(unsigned char i2cClkGPIO,
* This function initializes the i2c attributes and bus
*
* Parameters:
- * i2cClkGPIO - The GPIO pin to be used as i2c SCL
- * i2cDataGPIO - The GPIO pin to be used as i2c SDA
+ * clk_gpio - The GPIO pin to be used as i2c SCL
+ * data_gpio - The GPIO pin to be used as i2c SDA
*
* Return Value:
* -1 - Fail to initialize the i2c
* 0 - Success
*/
long sm750_sw_i2c_init(
- unsigned char i2cClkGPIO,
- unsigned char i2cDataGPIO
+ unsigned char clk_gpio,
+ unsigned char data_gpio
)
{
int i;

/* Return 0 if the GPIO pins to be used is out of range. The range is only from [0..63] */
- if ((i2cClkGPIO > 31) || (i2cDataGPIO > 31))
+ if ((clk_gpio > 31) || (data_gpio > 31))
return -1;

if (getChipType() == SM750LE)
- return sm750le_i2c_init(i2cClkGPIO, i2cDataGPIO);
+ return sm750le_i2c_init(clk_gpio, data_gpio);

/* Initialize the GPIO pin for the i2c Clock Register */
sw_i2c_clk_gpio_mux_reg = GPIO_MUX;
@@ -406,7 +406,7 @@ long sm750_sw_i2c_init(
sw_i2c_clk_gpio_data_dir_reg = GPIO_DATA_DIRECTION;

/* Initialize the Clock GPIO Offset */
- sw_i2c_clk_gpio = i2cClkGPIO;
+ sw_i2c_clk_gpio = clk_gpio;

/* Initialize the GPIO pin for the i2c Data Register */
sw_i2c_data_gpio_mux_reg = GPIO_MUX;
@@ -414,7 +414,7 @@ long sm750_sw_i2c_init(
sw_i2c_data_gpio_data_dir_reg = GPIO_DATA_DIRECTION;

/* Initialize the Data GPIO Offset */
- sw_i2c_data_gpio = i2cDataGPIO;
+ sw_i2c_data_gpio = data_gpio;

/* Enable the GPIO pins for the i2c Clock and Data (GPIO MUX) */
POKE32(sw_i2c_clk_gpio_mux_reg,
@@ -436,16 +436,16 @@ long sm750_sw_i2c_init(
* This function reads the slave device's register
*
* Parameters:
- * deviceAddress - i2c Slave device address which register
+ * addr - i2c Slave device address which register
* to be read from
- * registerIndex - Slave device's register to be read
+ * reg - Slave device's register to be read
*
* Return Value:
* Register value
*/
unsigned char sm750_sw_i2c_read_reg(
- unsigned char deviceAddress,
- unsigned char registerIndex
+ unsigned char addr,
+ unsigned char reg
)
{
unsigned char data;
@@ -454,14 +454,14 @@ unsigned char sm750_sw_i2c_read_reg(
sm750_sw_i2c_start();

/* Send the device address */
- sm750_sw_i2c_write_byte(deviceAddress);
+ sm750_sw_i2c_write_byte(addr);

/* Send the register index */
- sm750_sw_i2c_write_byte(registerIndex);
+ sm750_sw_i2c_write_byte(reg);

/* Get the bus again and get the data from the device read address */
sm750_sw_i2c_start();
- sm750_sw_i2c_write_byte(deviceAddress + 1);
+ sm750_sw_i2c_write_byte(addr + 1);
data = sm750_sw_i2c_read_byte(1);

/* Stop swI2C and release the bus */
@@ -474,9 +474,9 @@ unsigned char sm750_sw_i2c_read_reg(
* This function writes a value to the slave device's register
*
* Parameters:
- * deviceAddress - i2c Slave device address which register
+ * addr - i2c Slave device address which register
* to be written
- * registerIndex - Slave device's register to be written
+ * reg - Slave device's register to be written
* data - Data to be written to the register
*
* Result:
@@ -484,12 +484,12 @@ unsigned char sm750_sw_i2c_read_reg(
* -1 - Fail
*/
long sm750_sw_i2c_write_reg(
- unsigned char deviceAddress,
- unsigned char registerIndex,
+ unsigned char addr,
+ unsigned char reg,
unsigned char data
)
{
- long returnValue = 0;
+ long ret = 0;

/* Send the Start signal */
sm750_sw_i2c_start();
@@ -497,14 +497,14 @@ long sm750_sw_i2c_write_reg(
/* Send the device address and read the data. All should return success
in order for the writing processed to be successful
*/
- if ((sm750_sw_i2c_write_byte(deviceAddress) != 0) ||
- (sm750_sw_i2c_write_byte(registerIndex) != 0) ||
+ if ((sm750_sw_i2c_write_byte(addr) != 0) ||
+ (sm750_sw_i2c_write_byte(reg) != 0) ||
(sm750_sw_i2c_write_byte(data) != 0)) {
- returnValue = -1;
+ ret = -1;
}

/* Stop i2c and release the bus */
sm750_sw_i2c_stop();

- return returnValue;
+ return ret;
}
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.h b/drivers/staging/sm750fb/ddk750_swi2c.h
index 27a04f3a..b53629c 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.h
+++ b/drivers/staging/sm750fb/ddk750_swi2c.h
@@ -29,33 +29,33 @@
* 0 - Success
*/
long sm750_sw_i2c_init(
- unsigned char i2cClkGPIO,
- unsigned char i2cDataGPIO
+ unsigned char clk_gpio,
+ unsigned char data_gpio
);

/*
* This function reads the slave device's register
*
* Parameters:
- * deviceAddress - i2c Slave device address which register
+ * addr - i2c Slave device address which register
* to be read from
- * registerIndex - Slave device's register to be read
+ * reg - Slave device's register to be read
*
* Return Value:
* Register value
*/
unsigned char sm750_sw_i2c_read_reg(
- unsigned char deviceAddress,
- unsigned char registerIndex
+ unsigned char addr,
+ unsigned char reg
);

/*
* This function writes a value to the slave device's register
*
* Parameters:
- * deviceAddress - i2c Slave device address which register
+ * addr - i2c Slave device address which register
* to be written
- * registerIndex - Slave device's register to be written
+ * reg - Slave device's register to be written
* data - Data to be written to the register
*
* Result:
@@ -63,8 +63,8 @@ unsigned char sm750_sw_i2c_read_reg(
* -1 - Fail
*/
long sm750_sw_i2c_write_reg(
- unsigned char deviceAddress,
- unsigned char registerIndex,
+ unsigned char addr,
+ unsigned char reg,
unsigned char data
);

--
2.1.0

2015-08-24 05:24:51

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 16/17] staging: sm750fb: ddk750_*i2c: remove multiple blank lines

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 16 ----------------
drivers/staging/sm750fb/ddk750_swi2c.c | 1 -
2 files changed, 17 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index fa1a4d4..a07aca4 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -8,7 +8,6 @@
#define MAX_HWI2C_FIFO 16
#define HWI2C_WAIT_TIMEOUT 0xF0000

-
int sm750_hw_i2c_init(
unsigned char bus_speed_mode
)
@@ -39,7 +38,6 @@ unsigned char bus_speed_mode
return 0;
}

-
void sm750_hw_i2c_close(void)
{
unsigned int value;
@@ -59,7 +57,6 @@ void sm750_hw_i2c_close(void)
POKE32(GPIO_MUX, value);
}

-
static long sm750_hw_i2c_wait_tx_done(void)
{
unsigned int timeout;
@@ -76,8 +73,6 @@ static long sm750_hw_i2c_wait_tx_done(void)
return 0;
}

-
-
/*
* This function writes data to the i2c slave device registers.
*
@@ -139,9 +134,6 @@ static unsigned int sm750_hw_i2c_write_data(
return total_bytes;
}

-
-
-
/*
* This function reads data from the slave device and stores them
* in the given buffer
@@ -205,9 +197,6 @@ static unsigned int sm750_hw_i2c_read_data(
return total_bytes;
}

-
-
-
/*
* This function reads the slave device's register
*
@@ -232,10 +221,6 @@ unsigned char sm750_hw_i2c_read_reg(
return value;
}

-
-
-
-
/*
* This function writes a value to the slave device's register
*
@@ -265,5 +250,4 @@ int sm750_hw_i2c_write_reg(
return (-1);
}

-
#endif
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index ed14277..d5f01d3 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -15,7 +15,6 @@
#include "ddk750_swi2c.h"
#include "ddk750_power.h"

-
/*******************************************************************
* I2C Software Master Driver:
* ===========================
--
2.1.0

2015-08-24 05:24:55

by Mike Rapoport

[permalink] [raw]
Subject: [PATCH 17/17] staging: sm750fb: ddk750_*i2c: shorten lines to under 80 characters

Signed-off-by: Mike Rapoport <[email protected]>
---
drivers/staging/sm750fb/ddk750_hwi2c.c | 19 ++++++++++++++-----
drivers/staging/sm750fb/ddk750_hwi2c.h | 3 ++-
drivers/staging/sm750fb/ddk750_swi2c.c | 22 ++++++++++++++++------
3 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index a07aca4..949e03a 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -63,7 +63,8 @@ static long sm750_hw_i2c_wait_tx_done(void)

/* Wait until the transfer is completed. */
timeout = HWI2C_WAIT_TIMEOUT;
- while ((FIELD_GET(PEEK32(I2C_STATUS), I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) &&
+ while ((FIELD_GET(PEEK32(I2C_STATUS),
+ I2C_STATUS, TX) != I2C_STATUS_TX_COMPLETED) &&
(timeout != 0))
timeout--;

@@ -102,7 +103,10 @@ static unsigned int sm750_hw_i2c_write_data(
* Only 16 byte can be accessed per i2c start instruction.
*/
do {
- /* Reset I2C by writing 0 to I2C_RESET register to clear the previous status. */
+ /*
+ * Reset I2C by writing 0 to I2C_RESET register to
+ * clear the previous status.
+ */
POKE32(I2C_RESET, 0);

/* Set the number of bytes to be written */
@@ -117,7 +121,8 @@ static unsigned int sm750_hw_i2c_write_data(
POKE32(I2C_DATA0 + i, *buf++);

/* Start the I2C */
- POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));
+ POKE32(I2C_CTRL,
+ FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));

/* Wait until the transfer is completed. */
if (sm750_hw_i2c_wait_tx_done() != 0)
@@ -165,7 +170,10 @@ static unsigned int sm750_hw_i2c_read_data(
* Only 16 byte can be accessed per i2c start instruction.
*/
do {
- /* Reset I2C by writing 0 to I2C_RESET register to clear all the status. */
+ /*
+ * Reset I2C by writing 0 to I2C_RESET register to
+ * clear all the status.
+ */
POKE32(I2C_RESET, 0);

/* Set the number of bytes to be read */
@@ -176,7 +184,8 @@ static unsigned int sm750_hw_i2c_read_data(
POKE32(I2C_BYTE_COUNT, count);

/* Start the I2C */
- POKE32(I2C_CTRL, FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));
+ POKE32(I2C_CTRL,
+ FIELD_SET(PEEK32(I2C_CTRL), I2C_CTRL, CTRL, START));

/* Wait until transaction done. */
if (sm750_hw_i2c_wait_tx_done() != 0)
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.h b/drivers/staging/sm750fb/ddk750_hwi2c.h
index 2827865..46e22dc 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.h
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.h
@@ -6,5 +6,6 @@ int sm750_hw_i2c_init(unsigned char bus_speed_mode);
void sm750_hw_i2c_close(void);

unsigned char sm750_hw_i2c_read_reg(unsigned char addr, unsigned char reg);
-int sm750_hw_i2c_write_reg(unsigned char addr, unsigned char reg, unsigned char data);
+int sm750_hw_i2c_write_reg(unsigned char addr, unsigned char reg,
+ unsigned char data);
#endif
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index d5f01d3..b154568 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -125,7 +125,10 @@ static void sm750_sw_i2c_scl(unsigned char value)

gpio_dir = PEEK32(sw_i2c_clk_gpio_data_dir_reg);
if (value) { /* High */
- /* Set direction as input. This will automatically pull the signal up. */
+ /*
+ * Set direction as input. This will automatically
+ * pull the signal up.
+ */
gpio_dir &= ~(1 << sw_i2c_clk_gpio);
POKE32(sw_i2c_clk_gpio_data_dir_reg, gpio_dir);
} else { /* Low */
@@ -159,7 +162,10 @@ static void sm750_sw_i2c_sda(unsigned char value)

gpio_dir = PEEK32(sw_i2c_data_gpio_data_dir_reg);
if (value) { /* High */
- /* Set direction as input. This will automatically pull the signal up. */
+ /*
+ * Set direction as input. This will automatically
+ * pull the signal up.
+ */
gpio_dir &= ~(1 << sw_i2c_data_gpio);
POKE32(sw_i2c_data_gpio_data_dir_reg, gpio_dir);
} else { /* Low */
@@ -184,10 +190,11 @@ static unsigned char sm750_sw_i2c_read_sda(void)
{
unsigned long gpio_dir;
unsigned long gpio_data;
+ unsigned long dir_mask = 1 << sw_i2c_data_gpio;

/* Make sure that the direction is input (High) */
gpio_dir = PEEK32(sw_i2c_data_gpio_data_dir_reg);
- if ((gpio_dir & (1 << sw_i2c_data_gpio)) != (~(1 << sw_i2c_data_gpio))) {
+ if ((gpio_dir & dir_mask) != ~dir_mask) {
gpio_dir &= ~(1 << sw_i2c_data_gpio);
POKE32(sw_i2c_data_gpio_data_dir_reg, gpio_dir);
}
@@ -392,7 +399,10 @@ long sm750_sw_i2c_init(
{
int i;

- /* Return 0 if the GPIO pins to be used is out of range. The range is only from [0..63] */
+ /*
+ * Return 0 if the GPIO pins to be used is out of range. The
+ * range is only from [0..63]
+ */
if ((clk_gpio > 31) || (data_gpio > 31))
return -1;

@@ -417,9 +427,9 @@ long sm750_sw_i2c_init(

/* Enable the GPIO pins for the i2c Clock and Data (GPIO MUX) */
POKE32(sw_i2c_clk_gpio_mux_reg,
- PEEK32(sw_i2c_clk_gpio_mux_reg) & ~(1 << sw_i2c_clk_gpio));
+ PEEK32(sw_i2c_clk_gpio_mux_reg) & ~(1 << sw_i2c_clk_gpio));
POKE32(sw_i2c_data_gpio_mux_reg,
- PEEK32(sw_i2c_data_gpio_mux_reg) & ~(1 << sw_i2c_data_gpio));
+ PEEK32(sw_i2c_data_gpio_mux_reg) & ~(1 << sw_i2c_data_gpio));

/* Enable GPIO power */
enableGPIO(1);
--
2.1.0