diff options
author | Douglas Schilling Landgraf <dougsland@gmail.com> | 2008-04-17 20:41:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:09:41 -0400 |
commit | 6ea54d938b6f81baa0952a8b15d3e67e6c268b8f (patch) | |
tree | 3cda23563cf6f6f05927b7f7c61eaa6605a0e10d /drivers/media/video/em28xx/em28xx-i2c.c | |
parent | e6a353b0dc2686ae04805919e7a22430d2f1e29e (diff) |
V4L/DVB (7607): CodingStyle fixes
Signed-off-by: Douglas Schilling Landgraf <dougsland@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-i2c.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-i2c.c | 156 |
1 files changed, 86 insertions, 70 deletions
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 6e1b7b4e7668..6a78fd294cab 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
@@ -41,11 +41,21 @@ static unsigned int i2c_debug; | |||
41 | module_param(i2c_debug, int, 0644); | 41 | module_param(i2c_debug, int, 0644); |
42 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); | 42 | MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); |
43 | 43 | ||
44 | #define dprintk1(lvl,fmt, args...) if (i2c_debug>=lvl) do {\ | 44 | |
45 | printk(fmt, ##args); } while (0) | 45 | #define dprintk1(lvl, fmt, args...) \ |
46 | #define dprintk2(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ | 46 | do { \ |
47 | printk(KERN_DEBUG "%s at %s: " fmt, \ | 47 | if (i2c_debug >= lvl) { \ |
48 | dev->name, __func__ , ##args); } while (0) | 48 | printk(fmt, ##args); \ |
49 | } \ | ||
50 | } while (0) | ||
51 | |||
52 | #define dprintk2(lvl, fmt, args...) \ | ||
53 | do { \ | ||
54 | if (i2c_debug >= lvl) { \ | ||
55 | printk(KERN_DEBUG "%s at %s: " fmt, \ | ||
56 | dev->name, __func__ , ##args); \ | ||
57 | } \ | ||
58 | } while (0) | ||
49 | 59 | ||
50 | /* | 60 | /* |
51 | * em2800_i2c_send_max4() | 61 | * em2800_i2c_send_max4() |
@@ -235,16 +245,16 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
235 | return 0; | 245 | return 0; |
236 | for (i = 0; i < num; i++) { | 246 | for (i = 0; i < num; i++) { |
237 | addr = msgs[i].addr << 1; | 247 | addr = msgs[i].addr << 1; |
238 | dprintk2(2,"%s %s addr=%x len=%d:", | 248 | dprintk2(2, "%s %s addr=%x len=%d:", |
239 | (msgs[i].flags & I2C_M_RD) ? "read" : "write", | 249 | (msgs[i].flags & I2C_M_RD) ? "read" : "write", |
240 | i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); | 250 | i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); |
241 | if (!msgs[i].len) { /* no len: check only for device presence */ | 251 | if (!msgs[i].len) { /* no len: check only for device presence */ |
242 | if (dev->is_em2800) | 252 | if (dev->is_em2800) |
243 | rc = em2800_i2c_check_for_device(dev, addr); | 253 | rc = em2800_i2c_check_for_device(dev, addr); |
244 | else | 254 | else |
245 | rc = em28xx_i2c_check_for_device(dev, addr); | 255 | rc = em28xx_i2c_check_for_device(dev, addr); |
246 | if (rc < 0) { | 256 | if (rc < 0) { |
247 | dprintk2(2," no device\n"); | 257 | dprintk2(2, " no device\n"); |
248 | return rc; | 258 | return rc; |
249 | } | 259 | } |
250 | 260 | ||
@@ -258,14 +268,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
258 | rc = em28xx_i2c_recv_bytes(dev, addr, | 268 | rc = em28xx_i2c_recv_bytes(dev, addr, |
259 | msgs[i].buf, | 269 | msgs[i].buf, |
260 | msgs[i].len); | 270 | msgs[i].len); |
261 | if (i2c_debug>=2) { | 271 | if (i2c_debug >= 2) { |
262 | for (byte = 0; byte < msgs[i].len; byte++) { | 272 | for (byte = 0; byte < msgs[i].len; byte++) |
263 | printk(" %02x", msgs[i].buf[byte]); | 273 | printk(" %02x", msgs[i].buf[byte]); |
264 | } | ||
265 | } | 274 | } |
266 | } else { | 275 | } else { |
267 | /* write bytes */ | 276 | /* write bytes */ |
268 | if (i2c_debug>=2) { | 277 | if (i2c_debug >= 2) { |
269 | for (byte = 0; byte < msgs[i].len; byte++) | 278 | for (byte = 0; byte < msgs[i].len; byte++) |
270 | printk(" %02x", msgs[i].buf[byte]); | 279 | printk(" %02x", msgs[i].buf[byte]); |
271 | } | 280 | } |
@@ -281,13 +290,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
281 | } | 290 | } |
282 | if (rc < 0) | 291 | if (rc < 0) |
283 | goto err; | 292 | goto err; |
284 | if (i2c_debug>=2) | 293 | if (i2c_debug >= 2) |
285 | printk("\n"); | 294 | printk("\n"); |
286 | } | 295 | } |
287 | 296 | ||
288 | return num; | 297 | return num; |
289 | err: | 298 | err: |
290 | dprintk2(2," ERROR: %i\n", rc); | 299 | dprintk2(2, " ERROR: %i\n", rc); |
291 | return rc; | 300 | return rc; |
292 | } | 301 | } |
293 | 302 | ||
@@ -330,7 +339,9 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) | |||
330 | return -1; | 339 | return -1; |
331 | 340 | ||
332 | buf = 0; | 341 | buf = 0; |
333 | if (1 != (err = i2c_master_send(&dev->i2c_client, &buf, 1))) { | 342 | |
343 | err = i2c_master_send(&dev->i2c_client, &buf, 1); | ||
344 | if (err != 1) { | ||
334 | printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", | 345 | printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", |
335 | dev->name, err); | 346 | dev->name, err); |
336 | return -1; | 347 | return -1; |
@@ -403,8 +414,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) | |||
403 | break; | 414 | break; |
404 | } | 415 | } |
405 | printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n", | 416 | printk(KERN_INFO "Table at 0x%02x, strings=0x%04x, 0x%04x, 0x%04x\n", |
406 | em_eeprom->string_idx_table,em_eeprom->string1, | 417 | em_eeprom->string_idx_table, |
407 | em_eeprom->string2,em_eeprom->string3); | 418 | em_eeprom->string1, |
419 | em_eeprom->string2, | ||
420 | em_eeprom->string3); | ||
408 | 421 | ||
409 | return 0; | 422 | return 0; |
410 | } | 423 | } |
@@ -430,58 +443,61 @@ static int attach_inform(struct i2c_client *client) | |||
430 | struct em28xx *dev = client->adapter->algo_data; | 443 | struct em28xx *dev = client->adapter->algo_data; |
431 | 444 | ||
432 | switch (client->addr << 1) { | 445 | switch (client->addr << 1) { |
433 | case 0x86: | 446 | case 0x86: |
434 | case 0x84: | 447 | case 0x84: |
435 | case 0x96: | 448 | case 0x96: |
436 | case 0x94: | 449 | case 0x94: |
437 | { | 450 | { |
438 | struct v4l2_priv_tun_config tda9887_cfg; | 451 | struct v4l2_priv_tun_config tda9887_cfg; |
439 | 452 | ||
440 | struct tuner_setup tun_setup; | 453 | struct tuner_setup tun_setup; |
441 | 454 | ||
442 | tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; | 455 | tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; |
443 | tun_setup.type = TUNER_TDA9887; | 456 | tun_setup.type = TUNER_TDA9887; |
444 | tun_setup.addr = client->addr; | 457 | tun_setup.addr = client->addr; |
445 | 458 | ||
446 | em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, &tun_setup); | 459 | em28xx_i2c_call_clients(dev, TUNER_SET_TYPE_ADDR, |
447 | 460 | &tun_setup); | |
448 | tda9887_cfg.tuner = TUNER_TDA9887; | 461 | |
449 | tda9887_cfg.priv = &dev->tda9887_conf; | 462 | tda9887_cfg.tuner = TUNER_TDA9887; |
450 | em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, | 463 | tda9887_cfg.priv = &dev->tda9887_conf; |
451 | &tda9887_cfg); | 464 | em28xx_i2c_call_clients(dev, TUNER_SET_CONFIG, |
452 | break; | 465 | &tda9887_cfg); |
453 | } | 466 | break; |
454 | case 0x42: | 467 | } |
455 | dprintk1(1,"attach_inform: saa7114 detected.\n"); | 468 | case 0x42: |
456 | break; | 469 | dprintk1(1, "attach_inform: saa7114 detected.\n"); |
457 | case 0x4a: | 470 | break; |
458 | dprintk1(1,"attach_inform: saa7113 detected.\n"); | 471 | case 0x4a: |
459 | break; | 472 | dprintk1(1, "attach_inform: saa7113 detected.\n"); |
460 | case 0xa0: | 473 | break; |
461 | dprintk1(1,"attach_inform: eeprom detected.\n"); | 474 | case 0xa0: |
462 | break; | 475 | dprintk1(1, "attach_inform: eeprom detected.\n"); |
463 | case 0x60: | 476 | break; |
464 | case 0x8e: | 477 | case 0x60: |
465 | { | 478 | case 0x8e: |
466 | struct IR_i2c *ir = i2c_get_clientdata(client); | 479 | { |
467 | dprintk1(1,"attach_inform: IR detected (%s).\n",ir->phys); | 480 | struct IR_i2c *ir = i2c_get_clientdata(client); |
468 | em28xx_set_ir(dev,ir); | 481 | dprintk1(1, "attach_inform: IR detected (%s).\n", |
469 | break; | 482 | ir->phys); |
470 | } | 483 | em28xx_set_ir(dev, ir); |
471 | case 0x80: | 484 | break; |
472 | case 0x88: | 485 | } |
473 | dprintk1(1,"attach_inform: msp34xx detected.\n"); | 486 | case 0x80: |
474 | break; | 487 | case 0x88: |
475 | case 0xb8: | 488 | dprintk1(1, "attach_inform: msp34xx detected.\n"); |
476 | case 0xba: | 489 | break; |
477 | dprintk1(1,"attach_inform: tvp5150 detected.\n"); | 490 | case 0xb8: |
478 | break; | 491 | case 0xba: |
479 | 492 | dprintk1(1, "attach_inform: tvp5150 detected.\n"); | |
480 | default: | 493 | break; |
481 | if (!dev->tuner_addr) | 494 | |
482 | dev->tuner_addr = client->addr; | 495 | default: |
483 | 496 | if (!dev->tuner_addr) | |
484 | dprintk1(1,"attach inform: detected I2C address %x\n", client->addr << 1); | 497 | dev->tuner_addr = client->addr; |
498 | |||
499 | dprintk1(1, "attach inform: detected I2C address %x\n", | ||
500 | client->addr << 1); | ||
485 | 501 | ||
486 | } | 502 | } |
487 | 503 | ||