Skip to content

Commit faef278

Browse files
Cezar ChiruAndi Shyti
authored andcommitted
i2c: pcf8584: Remove debug macros from i2c-algo-pcf.c
Remove debug macros and printk and dev_dbg function calls from file as no change was done for long time. Remove i2c_debug module parameter also as its implementation, the debug macros, has been removed. Signed-off-by: Cezar Chiru <chiru.cezar.89@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20251018091258.5266-2-chiru.cezar.89@gmail.com
1 parent e308a27 commit faef278

1 file changed

Lines changed: 0 additions & 59 deletions

File tree

drivers/i2c/algos/i2c-algo-pcf.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,8 @@
2323
#include "i2c-algo-pcf.h"
2424

2525

26-
#define DEB2(x) if (i2c_debug >= 2) x
27-
#define DEB3(x) if (i2c_debug >= 3) x /* print several statistical values */
28-
#define DEBPROTO(x) if (i2c_debug >= 9) x;
29-
/* debug the protocol by showing transferred bits */
3026
#define DEF_TIMEOUT 16
3127

32-
/*
33-
* module parameters:
34-
*/
35-
static int i2c_debug;
36-
3728
/* setting states on the bus with the right timing: */
3829

3930
#define set_pcf(adap, ctl, val) adap->setpcf(adap->data, ctl, val)
@@ -47,27 +38,21 @@ static int i2c_debug;
4738

4839
static void i2c_start(struct i2c_algo_pcf_data *adap)
4940
{
50-
DEBPROTO(printk(KERN_DEBUG "S "));
5141
set_pcf(adap, 1, I2C_PCF_START);
5242
}
5343

5444
static void i2c_repstart(struct i2c_algo_pcf_data *adap)
5545
{
56-
DEBPROTO(printk(" Sr "));
5746
set_pcf(adap, 1, I2C_PCF_REPSTART);
5847
}
5948

6049
static void i2c_stop(struct i2c_algo_pcf_data *adap)
6150
{
62-
DEBPROTO(printk("P\n"));
6351
set_pcf(adap, 1, I2C_PCF_STOP);
6452
}
6553

6654
static void handle_lab(struct i2c_algo_pcf_data *adap, const int *status)
6755
{
68-
DEB2(printk(KERN_INFO
69-
"i2c-algo-pcf.o: lost arbitration (CSR 0x%02x)\n",
70-
*status));
7156
/*
7257
* Cleanup from LAB -- reset and enable ESO.
7358
* This resets the PCF8584; since we've lost the bus, no
@@ -88,9 +73,6 @@ static void handle_lab(struct i2c_algo_pcf_data *adap, const int *status)
8873
if (adap->lab_mdelay)
8974
mdelay(adap->lab_mdelay);
9075

91-
DEB2(printk(KERN_INFO
92-
"i2c-algo-pcf.o: reset LAB condition (CSR 0x%02x)\n",
93-
get_pcf(adap, 1)));
9476
}
9577

9678
static int wait_for_bb(struct i2c_algo_pcf_data *adap)
@@ -151,41 +133,34 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *adap)
151133
{
152134
unsigned char temp;
153135

154-
DEB3(printk(KERN_DEBUG "i2c-algo-pcf.o: PCF state 0x%02x\n",
155-
get_pcf(adap, 1)));
156-
157136
/* S1=0x80: S0 selected, serial interface off */
158137
set_pcf(adap, 1, I2C_PCF_PIN);
159138
/*
160139
* check to see S1 now used as R/W ctrl -
161140
* PCF8584 does that when ESO is zero
162141
*/
163142
if (((temp = get_pcf(adap, 1)) & 0x7f) != (0)) {
164-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S0 (0x%02x).\n", temp));
165143
return -ENXIO; /* definitely not PCF8584 */
166144
}
167145

168146
/* load own address in S0, effective address is (own << 1) */
169147
i2c_outb(adap, get_own(adap));
170148
/* check it's really written */
171149
if ((temp = i2c_inb(adap)) != get_own(adap)) {
172-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set S0 (0x%02x).\n", temp));
173150
return -ENXIO;
174151
}
175152

176153
/* S1=0xA0, next byte in S2 */
177154
set_pcf(adap, 1, I2C_PCF_PIN | I2C_PCF_ES1);
178155
/* check to see S2 now selected */
179156
if (((temp = get_pcf(adap, 1)) & 0x7f) != I2C_PCF_ES1) {
180-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S2 (0x%02x).\n", temp));
181157
return -ENXIO;
182158
}
183159

184160
/* load clock register S2 */
185161
i2c_outb(adap, get_clock(adap));
186162
/* check it's really written, the only 5 lowest bits does matter */
187163
if (((temp = i2c_inb(adap)) & 0x1f) != get_clock(adap)) {
188-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't set S2 (0x%02x).\n", temp));
189164
return -ENXIO;
190165
}
191166

@@ -194,7 +169,6 @@ static int pcf_init_8584 (struct i2c_algo_pcf_data *adap)
194169

195170
/* check to see PCF is really idled and we can access status register */
196171
if ((temp = get_pcf(adap, 1)) != (I2C_PCF_PIN | I2C_PCF_BB)) {
197-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: PCF detection failed -- can't select S1` (0x%02x).\n", temp));
198172
return -ENXIO;
199173
}
200174

@@ -210,8 +184,6 @@ static int pcf_sendbytes(struct i2c_adapter *i2c_adap, const char *buf,
210184
int wrcount, status, timeout;
211185

212186
for (wrcount=0; wrcount<count; ++wrcount) {
213-
DEB2(dev_dbg(&i2c_adap->dev, "i2c_write: writing %2.2X\n",
214-
buf[wrcount] & 0xff));
215187
i2c_outb(adap, buf[wrcount]);
216188
timeout = wait_for_pin(adap, &status);
217189
if (timeout) {
@@ -307,19 +279,13 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
307279
/* Check for bus busy */
308280
timeout = wait_for_bb(adap);
309281
if (timeout) {
310-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: "
311-
"Timeout waiting for BB in pcf_xfer\n");)
312282
i = -EIO;
313283
goto out;
314284
}
315285

316286
for (i = 0;ret >= 0 && i < num; i++) {
317287
pmsg = &msgs[i];
318288

319-
DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: Doing %s %d bytes to 0x%02x - %d of %d messages\n",
320-
str_read_write(pmsg->flags & I2C_M_RD),
321-
pmsg->len, pmsg->addr, i + 1, num);)
322-
323289
ret = pcf_doAddress(adap, pmsg);
324290

325291
/* Send START */
@@ -335,43 +301,24 @@ static int pcf_xfer(struct i2c_adapter *i2c_adap,
335301
goto out;
336302
}
337303
i2c_stop(adap);
338-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: Timeout waiting "
339-
"for PIN(1) in pcf_xfer\n");)
340304
i = -EREMOTEIO;
341305
goto out;
342306
}
343307

344308
/* Check LRB (last rcvd bit - slave ack) */
345309
if (status & I2C_PCF_LRB) {
346310
i2c_stop(adap);
347-
DEB2(printk(KERN_ERR "i2c-algo-pcf.o: No LRB(1) in pcf_xfer\n");)
348311
i = -EREMOTEIO;
349312
goto out;
350313
}
351314

352-
DEB3(printk(KERN_DEBUG "i2c-algo-pcf.o: Msg %d, addr=0x%x, flags=0x%x, len=%d\n",
353-
i, msgs[i].addr, msgs[i].flags, msgs[i].len);)
354315

355316
if (pmsg->flags & I2C_M_RD) {
356317
ret = pcf_readbytes(i2c_adap, pmsg->buf, pmsg->len,
357318
(i + 1 == num));
358-
359-
if (ret != pmsg->len) {
360-
DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: fail: "
361-
"only read %d bytes.\n",ret));
362-
} else {
363-
DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: read %d bytes.\n",ret));
364-
}
365319
} else {
366320
ret = pcf_sendbytes(i2c_adap, pmsg->buf, pmsg->len,
367321
(i + 1 == num));
368-
369-
if (ret != pmsg->len) {
370-
DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: fail: "
371-
"only wrote %d bytes.\n",ret));
372-
} else {
373-
DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: wrote %d bytes.\n",ret));
374-
}
375322
}
376323
}
377324

@@ -401,8 +348,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
401348
struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;
402349
int rval;
403350

404-
DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));
405-
406351
/* register new adapter to i2c module... */
407352
adap->algo = &pcf_algo;
408353

@@ -418,7 +363,3 @@ EXPORT_SYMBOL(i2c_pcf_add_bus);
418363
MODULE_AUTHOR("Hans Berglund <hb@spacetec.no>");
419364
MODULE_DESCRIPTION("I2C-Bus PCF8584 algorithm");
420365
MODULE_LICENSE("GPL");
421-
422-
module_param(i2c_debug, int, S_IRUGO | S_IWUSR);
423-
MODULE_PARM_DESC(i2c_debug,
424-
"debug level - 0 off; 1 normal; 2,3 more verbose; 9 pcf-protocol");

0 commit comments

Comments
 (0)