diff options
author | Oliver Endriss <o.endriss@gmx.de> | 2011-07-03 13:02:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:55:44 -0400 |
commit | 9daf9bccb3f82a61edfc62515297f1b2b876a591 (patch) | |
tree | b2dcd32118f86014516dad1e759b5e735b398771 /drivers/staging | |
parent | 6eb94193fa9a54aab0e1dae8311297682634c3bd (diff) |
[media] cxd2099: Codingstyle fixes
Codingstyle fixes.
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/cxd2099/cxd2099.c | 75 | ||||
-rw-r--r-- | drivers/staging/cxd2099/cxd2099.h | 6 |
2 files changed, 40 insertions, 41 deletions
diff --git a/drivers/staging/cxd2099/cxd2099.c b/drivers/staging/cxd2099/cxd2099.c index 803a592b3507..6ec30c1fd4cb 100644 --- a/drivers/staging/cxd2099/cxd2099.c +++ b/drivers/staging/cxd2099/cxd2099.c | |||
@@ -64,7 +64,7 @@ static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr, | |||
64 | u8 reg, u8 data) | 64 | u8 reg, u8 data) |
65 | { | 65 | { |
66 | u8 m[2] = {reg, data}; | 66 | u8 m[2] = {reg, data}; |
67 | struct i2c_msg msg = {.addr=adr, .flags=0, .buf=m, .len=2}; | 67 | struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2}; |
68 | 68 | ||
69 | if (i2c_transfer(adapter, &msg, 1) != 1) { | 69 | if (i2c_transfer(adapter, &msg, 1) != 1) { |
70 | printk(KERN_ERR "Failed to write to I2C register %02x@%02x!\n", | 70 | printk(KERN_ERR "Failed to write to I2C register %02x@%02x!\n", |
@@ -77,7 +77,7 @@ static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr, | |||
77 | static int i2c_write(struct i2c_adapter *adapter, u8 adr, | 77 | static int i2c_write(struct i2c_adapter *adapter, u8 adr, |
78 | u8 *data, u8 len) | 78 | u8 *data, u8 len) |
79 | { | 79 | { |
80 | struct i2c_msg msg = {.addr=adr, .flags=0, .buf=data, .len=len}; | 80 | struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len}; |
81 | 81 | ||
82 | if (i2c_transfer(adapter, &msg, 1) != 1) { | 82 | if (i2c_transfer(adapter, &msg, 1) != 1) { |
83 | printk(KERN_ERR "Failed to write to I2C!\n"); | 83 | printk(KERN_ERR "Failed to write to I2C!\n"); |
@@ -92,7 +92,7 @@ static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, | |||
92 | struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, | 92 | struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, |
93 | .buf = ®, .len = 1}, | 93 | .buf = ®, .len = 1}, |
94 | {.addr = adr, .flags = I2C_M_RD, | 94 | {.addr = adr, .flags = I2C_M_RD, |
95 | .buf = val, .len = 1}}; | 95 | .buf = val, .len = 1} }; |
96 | 96 | ||
97 | if (i2c_transfer(adapter, msgs, 2) != 2) { | 97 | if (i2c_transfer(adapter, msgs, 2) != 2) { |
98 | printk(KERN_ERR "error in i2c_read_reg\n"); | 98 | printk(KERN_ERR "error in i2c_read_reg\n"); |
@@ -107,7 +107,7 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, | |||
107 | struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, | 107 | struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0, |
108 | .buf = ®, .len = 1}, | 108 | .buf = ®, .len = 1}, |
109 | {.addr = adr, .flags = I2C_M_RD, | 109 | {.addr = adr, .flags = I2C_M_RD, |
110 | .buf = data, .len = n}}; | 110 | .buf = data, .len = n} }; |
111 | 111 | ||
112 | if (i2c_transfer(adapter, msgs, 2) != 2) { | 112 | if (i2c_transfer(adapter, msgs, 2) != 2) { |
113 | printk(KERN_ERR "error in i2c_read\n"); | 113 | printk(KERN_ERR "error in i2c_read\n"); |
@@ -139,7 +139,7 @@ static int read_pccard(struct cxd *ci, u16 address, u8 *data, u8 n) | |||
139 | int status; | 139 | int status; |
140 | u8 addr[3] = {2, address & 0xff, address >> 8}; | 140 | u8 addr[3] = {2, address & 0xff, address >> 8}; |
141 | 141 | ||
142 | status=i2c_write(ci->i2c, ci->cfg.adr, addr, 3); | 142 | status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3); |
143 | if (!status) | 143 | if (!status) |
144 | status = i2c_read(ci->i2c, ci->cfg.adr, 3, data, n); | 144 | status = i2c_read(ci->i2c, ci->cfg.adr, 3, data, n); |
145 | return status; | 145 | return status; |
@@ -150,7 +150,7 @@ static int write_pccard(struct cxd *ci, u16 address, u8 *data, u8 n) | |||
150 | int status; | 150 | int status; |
151 | u8 addr[3] = {2, address & 0xff, address >> 8}; | 151 | u8 addr[3] = {2, address & 0xff, address >> 8}; |
152 | 152 | ||
153 | status=i2c_write(ci->i2c, ci->cfg.adr, addr, 3); | 153 | status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3); |
154 | if (!status) { | 154 | if (!status) { |
155 | u8 buf[256] = {3}; | 155 | u8 buf[256] = {3}; |
156 | memcpy(buf+1, data, n); | 156 | memcpy(buf+1, data, n); |
@@ -213,8 +213,8 @@ static int write_regm(struct cxd *ci, u8 reg, u8 val, u8 mask) | |||
213 | { | 213 | { |
214 | int status; | 214 | int status; |
215 | 215 | ||
216 | status=i2c_write_reg(ci->i2c, ci->cfg.adr, 0, reg); | 216 | status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, reg); |
217 | if (!status && reg >= 6 && reg <=8 && mask != 0xff) | 217 | if (!status && reg >= 6 && reg <= 8 && mask != 0xff) |
218 | status = i2c_read_reg(ci->i2c, ci->cfg.adr, 1, &ci->regs[reg]); | 218 | status = i2c_read_reg(ci->i2c, ci->cfg.adr, 1, &ci->regs[reg]); |
219 | ci->regs[reg] = (ci->regs[reg] & (~mask)) | val; | 219 | ci->regs[reg] = (ci->regs[reg] & (~mask)) | val; |
220 | if (!status) { | 220 | if (!status) { |
@@ -294,14 +294,14 @@ static void cam_mode(struct cxd *ci, int mode) | |||
294 | 294 | ||
295 | 295 | ||
296 | 296 | ||
297 | #define CHK_ERROR(s) if( (status = s) ) break | 297 | #define CHK_ERROR(s) if ((status = s)) break |
298 | 298 | ||
299 | static int init(struct cxd *ci) | 299 | static int init(struct cxd *ci) |
300 | { | 300 | { |
301 | int status; | 301 | int status; |
302 | 302 | ||
303 | mutex_lock(&ci->lock); | 303 | mutex_lock(&ci->lock); |
304 | ci->mode=-1; | 304 | ci->mode = -1; |
305 | do { | 305 | do { |
306 | CHK_ERROR(write_reg(ci, 0x00, 0x00)); | 306 | CHK_ERROR(write_reg(ci, 0x00, 0x00)); |
307 | CHK_ERROR(write_reg(ci, 0x01, 0x00)); | 307 | CHK_ERROR(write_reg(ci, 0x01, 0x00)); |
@@ -322,7 +322,7 @@ static int init(struct cxd *ci) | |||
322 | CHK_ERROR(write_regm(ci, 0x14, 0x00, 0x0F)); | 322 | CHK_ERROR(write_regm(ci, 0x14, 0x00, 0x0F)); |
323 | CHK_ERROR(write_reg(ci, 0x15, ci->clk_reg_b)); | 323 | CHK_ERROR(write_reg(ci, 0x15, ci->clk_reg_b)); |
324 | CHK_ERROR(write_regm(ci, 0x16, 0x00, 0x0F)); | 324 | CHK_ERROR(write_regm(ci, 0x16, 0x00, 0x0F)); |
325 | CHK_ERROR(write_reg(ci, 0x17,ci->clk_reg_f)); | 325 | CHK_ERROR(write_reg(ci, 0x17, ci->clk_reg_f)); |
326 | 326 | ||
327 | if (ci->cfg.clock_mode) { | 327 | if (ci->cfg.clock_mode) { |
328 | if (ci->cfg.polarity) { | 328 | if (ci->cfg.polarity) { |
@@ -352,9 +352,9 @@ static int init(struct cxd *ci) | |||
352 | 352 | ||
353 | /* Put TS in bypass */ | 353 | /* Put TS in bypass */ |
354 | CHK_ERROR(write_regm(ci, 0x09, 0x08, 0x08)); | 354 | CHK_ERROR(write_regm(ci, 0x09, 0x08, 0x08)); |
355 | ci->cammode=-1; | 355 | ci->cammode = -1; |
356 | cam_mode(ci, 0); | 356 | cam_mode(ci, 0); |
357 | } while(0); | 357 | } while (0); |
358 | mutex_unlock(&ci->lock); | 358 | mutex_unlock(&ci->lock); |
359 | 359 | ||
360 | return 0; | 360 | return 0; |
@@ -366,7 +366,7 @@ static int read_attribute_mem(struct dvb_ca_en50221 *ca, | |||
366 | struct cxd *ci = ca->data; | 366 | struct cxd *ci = ca->data; |
367 | #if 0 | 367 | #if 0 |
368 | if (ci->amem_read) { | 368 | if (ci->amem_read) { |
369 | if (address <=0 || address>1024) | 369 | if (address <= 0 || address > 1024) |
370 | return -EIO; | 370 | return -EIO; |
371 | return ci->amem[address]; | 371 | return ci->amem[address]; |
372 | } | 372 | } |
@@ -386,7 +386,7 @@ static int read_attribute_mem(struct dvb_ca_en50221 *ca, | |||
386 | set_mode(ci, 1); | 386 | set_mode(ci, 1); |
387 | read_pccard(ci, address, &val, 1); | 387 | read_pccard(ci, address, &val, 1); |
388 | mutex_unlock(&ci->lock); | 388 | mutex_unlock(&ci->lock); |
389 | //printk("%02x:%02x\n", address,val); | 389 | /* printk(KERN_INFO "%02x:%02x\n", address,val); */ |
390 | return val; | 390 | return val; |
391 | #endif | 391 | #endif |
392 | } | 392 | } |
@@ -448,19 +448,19 @@ static int slot_reset(struct dvb_ca_en50221 *ca, int slot) | |||
448 | write_reg(ci, 0x00, 0x31); | 448 | write_reg(ci, 0x00, 0x31); |
449 | write_regm(ci, 0x20, 0x80, 0x80); | 449 | write_regm(ci, 0x20, 0x80, 0x80); |
450 | write_reg(ci, 0x03, 0x02); | 450 | write_reg(ci, 0x03, 0x02); |
451 | ci->ready=0; | 451 | ci->ready = 0; |
452 | #endif | 452 | #endif |
453 | #endif | 453 | #endif |
454 | ci->mode=-1; | 454 | ci->mode = -1; |
455 | { | 455 | { |
456 | int i; | 456 | int i; |
457 | #if 0 | 457 | #if 0 |
458 | u8 val; | 458 | u8 val; |
459 | #endif | 459 | #endif |
460 | for (i=0; i<100;i++) { | 460 | for (i = 0; i < 100; i++) { |
461 | msleep(10); | 461 | msleep(10); |
462 | #if 0 | 462 | #if 0 |
463 | read_reg(ci, 0x06,&val); | 463 | read_reg(ci, 0x06, &val); |
464 | printk(KERN_INFO "%d:%02x\n", i, val); | 464 | printk(KERN_INFO "%d:%02x\n", i, val); |
465 | if (!(val&0x10)) | 465 | if (!(val&0x10)) |
466 | break; | 466 | break; |
@@ -514,7 +514,7 @@ static int campoll(struct cxd *ci) | |||
514 | write_reg(ci, 0x05, istat); | 514 | write_reg(ci, 0x05, istat); |
515 | 515 | ||
516 | if (istat&0x40) { | 516 | if (istat&0x40) { |
517 | ci->dr=1; | 517 | ci->dr = 1; |
518 | printk(KERN_INFO "DR\n"); | 518 | printk(KERN_INFO "DR\n"); |
519 | } | 519 | } |
520 | if (istat&0x20) | 520 | if (istat&0x20) |
@@ -526,21 +526,21 @@ static int campoll(struct cxd *ci) | |||
526 | read_reg(ci, 0x01, &slotstat); | 526 | read_reg(ci, 0x01, &slotstat); |
527 | if (!(2&slotstat)) { | 527 | if (!(2&slotstat)) { |
528 | if (!ci->slot_stat) { | 528 | if (!ci->slot_stat) { |
529 | ci->slot_stat|=DVB_CA_EN50221_POLL_CAM_PRESENT; | 529 | ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_PRESENT; |
530 | write_regm(ci, 0x03, 0x08, 0x08); | 530 | write_regm(ci, 0x03, 0x08, 0x08); |
531 | } | 531 | } |
532 | 532 | ||
533 | } else { | 533 | } else { |
534 | if (ci->slot_stat) { | 534 | if (ci->slot_stat) { |
535 | ci->slot_stat=0; | 535 | ci->slot_stat = 0; |
536 | write_regm(ci, 0x03, 0x00, 0x08); | 536 | write_regm(ci, 0x03, 0x00, 0x08); |
537 | printk(KERN_INFO "NO CAM\n"); | 537 | printk(KERN_INFO "NO CAM\n"); |
538 | ci->ready=0; | 538 | ci->ready = 0; |
539 | } | 539 | } |
540 | } | 540 | } |
541 | if (istat&8 && ci->slot_stat==DVB_CA_EN50221_POLL_CAM_PRESENT) { | 541 | if (istat&8 && ci->slot_stat == DVB_CA_EN50221_POLL_CAM_PRESENT) { |
542 | ci->ready=1; | 542 | ci->ready = 1; |
543 | ci->slot_stat|=DVB_CA_EN50221_POLL_CAM_READY; | 543 | ci->slot_stat |= DVB_CA_EN50221_POLL_CAM_READY; |
544 | } | 544 | } |
545 | } | 545 | } |
546 | return 0; | 546 | return 0; |
@@ -561,7 +561,7 @@ static int poll_slot_status(struct dvb_ca_en50221 *ca, int slot, int open) | |||
561 | } | 561 | } |
562 | 562 | ||
563 | #ifdef BUFFER_MODE | 563 | #ifdef BUFFER_MODE |
564 | static int read_data(struct dvb_ca_en50221* ca, int slot, u8 *ebuf, int ecount) | 564 | static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) |
565 | { | 565 | { |
566 | struct cxd *ci = ca->data; | 566 | struct cxd *ci = ca->data; |
567 | u8 msb, lsb; | 567 | u8 msb, lsb; |
@@ -578,20 +578,20 @@ static int read_data(struct dvb_ca_en50221* ca, int slot, u8 *ebuf, int ecount) | |||
578 | mutex_lock(&ci->lock); | 578 | mutex_lock(&ci->lock); |
579 | read_reg(ci, 0x0f, &msb); | 579 | read_reg(ci, 0x0f, &msb); |
580 | read_reg(ci, 0x10, &lsb); | 580 | read_reg(ci, 0x10, &lsb); |
581 | len=(msb<<8)|lsb; | 581 | len = (msb<<8)|lsb; |
582 | read_block(ci, 0x12, ebuf, len); | 582 | read_block(ci, 0x12, ebuf, len); |
583 | ci->dr=0; | 583 | ci->dr = 0; |
584 | mutex_unlock(&ci->lock); | 584 | mutex_unlock(&ci->lock); |
585 | 585 | ||
586 | return len; | 586 | return len; |
587 | } | 587 | } |
588 | 588 | ||
589 | static int write_data(struct dvb_ca_en50221* ca, int slot, u8 * ebuf, int ecount) | 589 | static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) |
590 | { | 590 | { |
591 | struct cxd *ci = ca->data; | 591 | struct cxd *ci = ca->data; |
592 | 592 | ||
593 | mutex_lock(&ci->lock); | 593 | mutex_lock(&ci->lock); |
594 | printk("write_data %d\n", ecount); | 594 | printk(kern_INFO "write_data %d\n", ecount); |
595 | write_reg(ci, 0x0d, ecount>>8); | 595 | write_reg(ci, 0x0d, ecount>>8); |
596 | write_reg(ci, 0x0e, ecount&0xff); | 596 | write_reg(ci, 0x0e, ecount&0xff); |
597 | write_block(ci, 0x11, ebuf, ecount); | 597 | write_block(ci, 0x11, ebuf, ecount); |
@@ -623,8 +623,8 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, | |||
623 | struct cxd *ci = 0; | 623 | struct cxd *ci = 0; |
624 | u8 val; | 624 | u8 val; |
625 | 625 | ||
626 | if (i2c_read_reg(i2c, cfg->adr, 0, &val)<0) { | 626 | if (i2c_read_reg(i2c, cfg->adr, 0, &val) < 0) { |
627 | printk("No CXD2099 detected at %02x\n", cfg->adr); | 627 | printk(KERN_INFO "No CXD2099 detected at %02x\n", cfg->adr); |
628 | return 0; | 628 | return 0; |
629 | } | 629 | } |
630 | 630 | ||
@@ -636,17 +636,16 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, | |||
636 | mutex_init(&ci->lock); | 636 | mutex_init(&ci->lock); |
637 | memcpy(&ci->cfg, cfg, sizeof(struct cxd2099_cfg)); | 637 | memcpy(&ci->cfg, cfg, sizeof(struct cxd2099_cfg)); |
638 | ci->i2c = i2c; | 638 | ci->i2c = i2c; |
639 | ci->lastaddress=0xff; | 639 | ci->lastaddress = 0xff; |
640 | ci->clk_reg_b=0x4a; | 640 | ci->clk_reg_b = 0x4a; |
641 | ci->clk_reg_f=0x1b; | 641 | ci->clk_reg_f = 0x1b; |
642 | 642 | ||
643 | memcpy(&ci->en, &en_templ, sizeof(en_templ)); | 643 | memcpy(&ci->en, &en_templ, sizeof(en_templ)); |
644 | ci->en.data=ci; | 644 | ci->en.data = ci; |
645 | init(ci); | 645 | init(ci); |
646 | printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->cfg.adr); | 646 | printk(KERN_INFO "Attached CXD2099AR at %02x\n", ci->cfg.adr); |
647 | return &ci->en; | 647 | return &ci->en; |
648 | } | 648 | } |
649 | |||
650 | EXPORT_SYMBOL(cxd2099_attach); | 649 | EXPORT_SYMBOL(cxd2099_attach); |
651 | 650 | ||
652 | MODULE_DESCRIPTION("cxd2099"); | 651 | MODULE_DESCRIPTION("cxd2099"); |
diff --git a/drivers/staging/cxd2099/cxd2099.h b/drivers/staging/cxd2099/cxd2099.h index cf26c93de096..75459d41afc1 100644 --- a/drivers/staging/cxd2099/cxd2099.h +++ b/drivers/staging/cxd2099/cxd2099.h | |||
@@ -30,12 +30,12 @@ | |||
30 | struct cxd2099_cfg { | 30 | struct cxd2099_cfg { |
31 | u32 bitrate; | 31 | u32 bitrate; |
32 | u8 adr; | 32 | u8 adr; |
33 | u8 polarity : 1; | 33 | u8 polarity:1; |
34 | u8 clock_mode : 1; | 34 | u8 clock_mode:1; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | #if defined(CONFIG_DVB_CXD2099) || \ | 37 | #if defined(CONFIG_DVB_CXD2099) || \ |
38 | (defined(CONFIG_DVB_CXD2099_MODULE) && defined(MODULE)) | 38 | (defined(CONFIG_DVB_CXD2099_MODULE) && defined(MODULE)) |
39 | struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, | 39 | struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, |
40 | void *priv, struct i2c_adapter *i2c); | 40 | void *priv, struct i2c_adapter *i2c); |
41 | #else | 41 | #else |