Skip to content

Commit 482116b

Browse files
g0hl1nWolfram Sang
authored andcommitted
i2c: ali1563: fix checkpatch.pl issues
Fixed most checkpatch.pl issues Signed-off-by: Richard Leitner <[email protected]> Reviewed-by: Jean Delvare <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 9219982 commit 482116b

File tree

1 file changed

+45
-37
lines changed

1 file changed

+45
-37
lines changed

drivers/i2c/busses/i2c-ali1563.c

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
static struct pci_driver ali1563_pci_driver;
6464
static unsigned short ali1563_smba;
6565

66-
static int ali1563_transaction(struct i2c_adapter * a, int size)
66+
static int ali1563_transaction(struct i2c_adapter *a, int size)
6767
{
6868
u32 data;
6969
int timeout;
@@ -78,7 +78,7 @@ static int ali1563_transaction(struct i2c_adapter * a, int size)
7878
data = inb_p(SMB_HST_STS);
7979
if (data & HST_STS_BAD) {
8080
dev_err(&a->dev, "ali1563: Trying to reset busy device\n");
81-
outb_p(data | HST_STS_BAD,SMB_HST_STS);
81+
outb_p(data | HST_STS_BAD, SMB_HST_STS);
8282
data = inb_p(SMB_HST_STS);
8383
if (data & HST_STS_BAD)
8484
return -EBUSY;
@@ -102,10 +102,10 @@ static int ali1563_transaction(struct i2c_adapter * a, int size)
102102
if (!timeout) {
103103
dev_err(&a->dev, "Timeout - Trying to KILL transaction!\n");
104104
/* Issue 'kill' to host controller */
105-
outb_p(HST_CNTL2_KILL,SMB_HST_CNTL2);
105+
outb_p(HST_CNTL2_KILL, SMB_HST_CNTL2);
106106
data = inb_p(SMB_HST_STS);
107107
status = -ETIMEDOUT;
108-
}
108+
}
109109

110110
/* device error - no response, ignore the autodetection case */
111111
if (data & HST_STS_DEVERR) {
@@ -117,18 +117,18 @@ static int ali1563_transaction(struct i2c_adapter * a, int size)
117117
if (data & HST_STS_BUSERR) {
118118
dev_err(&a->dev, "Bus collision!\n");
119119
/* Issue timeout, hoping it helps */
120-
outb_p(HST_CNTL1_TIMEOUT,SMB_HST_CNTL1);
120+
outb_p(HST_CNTL1_TIMEOUT, SMB_HST_CNTL1);
121121
}
122122

123123
if (data & HST_STS_FAIL) {
124124
dev_err(&a->dev, "Cleaning fail after KILL!\n");
125-
outb_p(0x0,SMB_HST_CNTL2);
125+
outb_p(0x0, SMB_HST_CNTL2);
126126
}
127127

128128
return status;
129129
}
130130

131-
static int ali1563_block_start(struct i2c_adapter * a)
131+
static int ali1563_block_start(struct i2c_adapter *a)
132132
{
133133
u32 data;
134134
int timeout;
@@ -142,8 +142,8 @@ static int ali1563_block_start(struct i2c_adapter * a)
142142

143143
data = inb_p(SMB_HST_STS);
144144
if (data & HST_STS_BAD) {
145-
dev_warn(&a->dev,"ali1563: Trying to reset busy device\n");
146-
outb_p(data | HST_STS_BAD,SMB_HST_STS);
145+
dev_warn(&a->dev, "ali1563: Trying to reset busy device\n");
146+
outb_p(data | HST_STS_BAD, SMB_HST_STS);
147147
data = inb_p(SMB_HST_STS);
148148
if (data & HST_STS_BAD)
149149
return -EBUSY;
@@ -184,22 +184,23 @@ static int ali1563_block_start(struct i2c_adapter * a)
184184
return status;
185185
}
186186

187-
static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8 rw)
187+
static int ali1563_block(struct i2c_adapter *a,
188+
union i2c_smbus_data *data, u8 rw)
188189
{
189190
int i, len;
190191
int error = 0;
191192

192193
/* Do we need this? */
193-
outb_p(HST_CNTL1_LAST,SMB_HST_CNTL1);
194+
outb_p(HST_CNTL1_LAST, SMB_HST_CNTL1);
194195

195196
if (rw == I2C_SMBUS_WRITE) {
196197
len = data->block[0];
197198
if (len < 1)
198199
len = 1;
199200
else if (len > 32)
200201
len = 32;
201-
outb_p(len,SMB_HST_DAT0);
202-
outb_p(data->block[1],SMB_BLK_DAT);
202+
outb_p(len, SMB_HST_DAT0);
203+
outb_p(data->block[1], SMB_BLK_DAT);
203204
} else
204205
len = 32;
205206

@@ -208,10 +209,12 @@ static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8
208209
for (i = 0; i < len; i++) {
209210
if (rw == I2C_SMBUS_WRITE) {
210211
outb_p(data->block[i + 1], SMB_BLK_DAT);
211-
if ((error = ali1563_block_start(a)))
212+
error = ali1563_block_start(a);
213+
if (error)
212214
break;
213215
} else {
214-
if ((error = ali1563_block_start(a)))
216+
error = ali1563_block_start(a);
217+
if (error)
215218
break;
216219
if (i == 0) {
217220
len = inb_p(SMB_HST_DAT0);
@@ -224,25 +227,26 @@ static int ali1563_block(struct i2c_adapter * a, union i2c_smbus_data * data, u8
224227
}
225228
}
226229
/* Do we need this? */
227-
outb_p(HST_CNTL1_LAST,SMB_HST_CNTL1);
230+
outb_p(HST_CNTL1_LAST, SMB_HST_CNTL1);
228231
return error;
229232
}
230233

231-
static s32 ali1563_access(struct i2c_adapter * a, u16 addr,
234+
static s32 ali1563_access(struct i2c_adapter *a, u16 addr,
232235
unsigned short flags, char rw, u8 cmd,
233-
int size, union i2c_smbus_data * data)
236+
int size, union i2c_smbus_data *data)
234237
{
235238
int error = 0;
236239
int timeout;
237240
u32 reg;
238241

239242
for (timeout = ALI1563_MAX_TIMEOUT; timeout; timeout--) {
240-
if (!(reg = inb_p(SMB_HST_STS) & HST_STS_BUSY))
243+
reg = inb_p(SMB_HST_STS);
244+
if (!(reg & HST_STS_BUSY))
241245
break;
242246
}
243247
if (!timeout)
244-
dev_warn(&a->dev,"SMBus not idle. HST_STS = %02x\n",reg);
245-
outb_p(0xff,SMB_HST_STS);
248+
dev_warn(&a->dev, "SMBus not idle. HST_STS = %02x\n", reg);
249+
outb_p(0xff, SMB_HST_STS);
246250

247251
/* Map the size to what the chip understands */
248252
switch (size) {
@@ -268,13 +272,14 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr,
268272
}
269273

270274
outb_p(((addr & 0x7f) << 1) | (rw & 0x01), SMB_HST_ADD);
271-
outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) | (size << 3), SMB_HST_CNTL2);
275+
outb_p((inb_p(SMB_HST_CNTL2) & ~HST_CNTL2_SIZEMASK) |
276+
(size << 3), SMB_HST_CNTL2);
272277

273278
/* Write the command register */
274279

275-
switch(size) {
280+
switch (size) {
276281
case HST_CNTL2_BYTE:
277-
if (rw== I2C_SMBUS_WRITE)
282+
if (rw == I2C_SMBUS_WRITE)
278283
/* Beware it uses DAT0 register and not CMD! */
279284
outb_p(cmd, SMB_HST_DAT0);
280285
break;
@@ -292,11 +297,12 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr,
292297
break;
293298
case HST_CNTL2_BLOCK:
294299
outb_p(cmd, SMB_HST_CMD);
295-
error = ali1563_block(a,data,rw);
300+
error = ali1563_block(a, data, rw);
296301
goto Done;
297302
}
298303

299-
if ((error = ali1563_transaction(a, size)))
304+
error = ali1563_transaction(a, size);
305+
if (error)
300306
goto Done;
301307

302308
if ((rw == I2C_SMBUS_WRITE) || (size == HST_CNTL2_QUICK))
@@ -317,7 +323,7 @@ static s32 ali1563_access(struct i2c_adapter * a, u16 addr,
317323
return error;
318324
}
319325

320-
static u32 ali1563_func(struct i2c_adapter * a)
326+
static u32 ali1563_func(struct i2c_adapter *a)
321327
{
322328
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
323329
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
@@ -329,13 +335,13 @@ static int ali1563_setup(struct pci_dev *dev)
329335
{
330336
u16 ctrl;
331337

332-
pci_read_config_word(dev,ALI1563_SMBBA,&ctrl);
338+
pci_read_config_word(dev, ALI1563_SMBBA, &ctrl);
333339

334340
/* SMB I/O Base in high 12 bits and must be aligned with the
335341
* size of the I/O space. */
336342
ali1563_smba = ctrl & ~(ALI1563_SMB_IOSIZE - 1);
337343
if (!ali1563_smba) {
338-
dev_warn(&dev->dev,"ali1563_smba Uninitialized\n");
344+
dev_warn(&dev->dev, "ali1563_smba Uninitialized\n");
339345
goto Err;
340346
}
341347

@@ -350,8 +356,8 @@ static int ali1563_setup(struct pci_dev *dev)
350356
ctrl | ALI1563_SMB_IOEN);
351357
pci_read_config_word(dev, ALI1563_SMBBA, &ctrl);
352358
if (!(ctrl & ALI1563_SMB_IOEN)) {
353-
dev_err(&dev->dev, "I/O space still not enabled, "
354-
"giving up\n");
359+
dev_err(&dev->dev,
360+
"I/O space still not enabled, giving up\n");
355361
goto Err;
356362
}
357363
}
@@ -375,7 +381,7 @@ static int ali1563_setup(struct pci_dev *dev)
375381

376382
static void ali1563_shutdown(struct pci_dev *dev)
377383
{
378-
release_region(ali1563_smba,ALI1563_SMB_IOSIZE);
384+
release_region(ali1563_smba, ALI1563_SMB_IOSIZE);
379385
}
380386

381387
static const struct i2c_algorithm ali1563_algorithm = {
@@ -394,12 +400,14 @@ static int ali1563_probe(struct pci_dev *dev,
394400
{
395401
int error;
396402

397-
if ((error = ali1563_setup(dev)))
403+
error = ali1563_setup(dev);
404+
if (error)
398405
goto exit;
399406
ali1563_adapter.dev.parent = &dev->dev;
400407
snprintf(ali1563_adapter.name, sizeof(ali1563_adapter.name),
401408
"SMBus ALi 1563 Adapter @ %04x", ali1563_smba);
402-
if ((error = i2c_add_adapter(&ali1563_adapter)))
409+
error = i2c_add_adapter(&ali1563_adapter);
410+
if (error)
403411
goto exit_shutdown;
404412
return 0;
405413

@@ -421,12 +429,12 @@ static const struct pci_device_id ali1563_id_table[] = {
421429
{},
422430
};
423431

424-
MODULE_DEVICE_TABLE (pci, ali1563_id_table);
432+
MODULE_DEVICE_TABLE(pci, ali1563_id_table);
425433

426434
static struct pci_driver ali1563_pci_driver = {
427-
.name = "ali1563_smbus",
435+
.name = "ali1563_smbus",
428436
.id_table = ali1563_id_table,
429-
.probe = ali1563_probe,
437+
.probe = ali1563_probe,
430438
.remove = ali1563_remove,
431439
};
432440

0 commit comments

Comments
 (0)