aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorFarid Hammane <farid.hammane@gmail.com>2010-05-21 12:41:00 -0400
committerJean Delvare <khali@linux-fr.org>2010-05-21 12:41:00 -0400
commit2086ca482f89950410527425913ca48d948e9622 (patch)
tree61e306c13147481ef86c1a0115974fed45fec16a /drivers/i2c
parentae5624fc36f7b9113df56c2e9b3069fefbb7117e (diff)
i2c-algo-pca: Fix coding style issues
Fix up some coding style issues. i2c-algo-pca.c has been built successfully after applying this patch and the binary object is still exactly the same. Other issues found by checkpatch.pl were voluntarily not fixed, either to keep readability, or because of false positive errors. Signed-off-by: Farid Hammane <farid.hammane@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index dcdaf8e675b..2b9a8f54bb2 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -109,13 +109,13 @@ static void pca_stop(struct i2c_algo_pca_data *adap)
109 * returns after the address has been sent 109 * returns after the address has been sent
110 */ 110 */
111static int pca_address(struct i2c_algo_pca_data *adap, 111static int pca_address(struct i2c_algo_pca_data *adap,
112 struct i2c_msg *msg) 112 struct i2c_msg *msg)
113{ 113{
114 int sta = pca_get_con(adap); 114 int sta = pca_get_con(adap);
115 int addr; 115 int addr;
116 116
117 addr = ( (0x7f & msg->addr) << 1 ); 117 addr = ((0x7f & msg->addr) << 1);
118 if (msg->flags & I2C_M_RD ) 118 if (msg->flags & I2C_M_RD)
119 addr |= 1; 119 addr |= 1;
120 DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n", 120 DEB2("=== SLAVE ADDRESS %#04x+%c=%#04x\n",
121 msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr); 121 msg->addr, msg->flags & I2C_M_RD ? 'R' : 'W', addr);
@@ -134,7 +134,7 @@ static int pca_address(struct i2c_algo_pca_data *adap,
134 * Returns after the byte has been transmitted 134 * Returns after the byte has been transmitted
135 */ 135 */
136static int pca_tx_byte(struct i2c_algo_pca_data *adap, 136static int pca_tx_byte(struct i2c_algo_pca_data *adap,
137 __u8 b) 137 __u8 b)
138{ 138{
139 int sta = pca_get_con(adap); 139 int sta = pca_get_con(adap);
140 DEB2("=== WRITE %#04x\n", b); 140 DEB2("=== WRITE %#04x\n", b);
@@ -164,13 +164,13 @@ static void pca_rx_byte(struct i2c_algo_pca_data *adap,
164 * Returns after next byte has arrived. 164 * Returns after next byte has arrived.
165 */ 165 */
166static int pca_rx_ack(struct i2c_algo_pca_data *adap, 166static int pca_rx_ack(struct i2c_algo_pca_data *adap,
167 int ack) 167 int ack)
168{ 168{
169 int sta = pca_get_con(adap); 169 int sta = pca_get_con(adap);
170 170
171 sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI|I2C_PCA_CON_AA); 171 sta &= ~(I2C_PCA_CON_STO|I2C_PCA_CON_STA|I2C_PCA_CON_SI|I2C_PCA_CON_AA);
172 172
173 if ( ack ) 173 if (ack)
174 sta |= I2C_PCA_CON_AA; 174 sta |= I2C_PCA_CON_AA;
175 175
176 pca_set_con(adap, sta); 176 pca_set_con(adap, sta);
@@ -178,12 +178,12 @@ static int pca_rx_ack(struct i2c_algo_pca_data *adap,
178} 178}
179 179
180static int pca_xfer(struct i2c_adapter *i2c_adap, 180static int pca_xfer(struct i2c_adapter *i2c_adap,
181 struct i2c_msg *msgs, 181 struct i2c_msg *msgs,
182 int num) 182 int num)
183{ 183{
184 struct i2c_algo_pca_data *adap = i2c_adap->algo_data; 184 struct i2c_algo_pca_data *adap = i2c_adap->algo_data;
185 struct i2c_msg *msg = NULL; 185 struct i2c_msg *msg = NULL;
186 int curmsg; 186 int curmsg;
187 int numbytes = 0; 187 int numbytes = 0;
188 int state; 188 int state;
189 int ret; 189 int ret;
@@ -202,21 +202,21 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
202 202
203 DEB1("{{{ XFER %d messages\n", num); 203 DEB1("{{{ XFER %d messages\n", num);
204 204
205 if (i2c_debug>=2) { 205 if (i2c_debug >= 2) {
206 for (curmsg = 0; curmsg < num; curmsg++) { 206 for (curmsg = 0; curmsg < num; curmsg++) {
207 int addr, i; 207 int addr, i;
208 msg = &msgs[curmsg]; 208 msg = &msgs[curmsg];
209 209
210 addr = (0x7f & msg->addr) ; 210 addr = (0x7f & msg->addr) ;
211 211
212 if (msg->flags & I2C_M_RD ) 212 if (msg->flags & I2C_M_RD)
213 printk(KERN_INFO " [%02d] RD %d bytes from %#02x [%#02x, ...]\n", 213 printk(KERN_INFO " [%02d] RD %d bytes from %#02x [%#02x, ...]\n",
214 curmsg, msg->len, addr, (addr<<1) | 1); 214 curmsg, msg->len, addr, (addr << 1) | 1);
215 else { 215 else {
216 printk(KERN_INFO " [%02d] WR %d bytes to %#02x [%#02x%s", 216 printk(KERN_INFO " [%02d] WR %d bytes to %#02x [%#02x%s",
217 curmsg, msg->len, addr, addr<<1, 217 curmsg, msg->len, addr, addr << 1,
218 msg->len == 0 ? "" : ", "); 218 msg->len == 0 ? "" : ", ");
219 for(i=0; i < msg->len; i++) 219 for (i = 0; i < msg->len; i++)
220 printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", "); 220 printk("%#04x%s", msg->buf[i], i == msg->len - 1 ? "" : ", ");
221 printk("]\n"); 221 printk("]\n");
222 } 222 }
@@ -305,7 +305,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
305 goto out; 305 goto out;
306 306
307 case 0x58: /* Data byte has been received; NOT ACK has been returned */ 307 case 0x58: /* Data byte has been received; NOT ACK has been returned */
308 if ( numbytes == msg->len - 1 ) { 308 if (numbytes == msg->len - 1) {
309 pca_rx_byte(adap, &msg->buf[numbytes], 0); 309 pca_rx_byte(adap, &msg->buf[numbytes], 0);
310 curmsg++; numbytes = 0; 310 curmsg++; numbytes = 0;
311 if (curmsg == num) 311 if (curmsg == num)
@@ -352,7 +352,7 @@ static int pca_xfer(struct i2c_adapter *i2c_adap,
352 352
353static u32 pca_func(struct i2c_adapter *adap) 353static u32 pca_func(struct i2c_adapter *adap)
354{ 354{
355 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 355 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
356} 356}
357 357
358static const struct i2c_algorithm pca_algo = { 358static const struct i2c_algorithm pca_algo = {