diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-12-05 12:53:39 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:22:53 -0500 |
commit | f35db23c1b1c4da0642e932a7035b5c577377974 (patch) | |
tree | 1fcf636808e86e0b7aff71511438ffe17dc3e754 /drivers/media | |
parent | 79a54cbd73afe05d807b2128fa41a92cb4acd637 (diff) |
V4L/DVB (4949): Cxusb: codingstyle cleanups
Trivial whitespace / 80-column limit cleanups
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 110 |
1 files changed, 60 insertions, 50 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index ee39ebea9975..15d12fce34df 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -17,9 +17,9 @@ | |||
17 | * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org) | 17 | * Copyright (C) 2006 Michael Krufky (mkrufky@linuxtv.org) |
18 | * Copyright (C) 2006 Chris Pascoe (c.pascoe@itee.uq.edu.au) | 18 | * Copyright (C) 2006 Chris Pascoe (c.pascoe@itee.uq.edu.au) |
19 | * | 19 | * |
20 | * This program is free software; you can redistribute it and/or modify it | 20 | * This program is free software; you can redistribute it and/or modify it |
21 | * under the terms of the GNU General Public License as published by the Free | 21 | * under the terms of the GNU General Public License as published by the Free |
22 | * Software Foundation, version 2. | 22 | * Software Foundation, version 2. |
23 | * | 23 | * |
24 | * see Documentation/dvb/README.dvb-usb for more information | 24 | * see Documentation/dvb/README.dvb-usb for more information |
25 | */ | 25 | */ |
@@ -34,22 +34,22 @@ | |||
34 | 34 | ||
35 | /* debug */ | 35 | /* debug */ |
36 | int dvb_usb_cxusb_debug; | 36 | int dvb_usb_cxusb_debug; |
37 | module_param_named(debug,dvb_usb_cxusb_debug, int, 0644); | 37 | module_param_named(debug, dvb_usb_cxusb_debug, int, 0644); |
38 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); | 38 | MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); |
39 | 39 | ||
40 | static int cxusb_ctrl_msg(struct dvb_usb_device *d, | 40 | static int cxusb_ctrl_msg(struct dvb_usb_device *d, |
41 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) | 41 | u8 cmd, u8 *wbuf, int wlen, u8 *rbuf, int rlen) |
42 | { | 42 | { |
43 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ | 43 | int wo = (rbuf == NULL || rlen == 0); /* write-only */ |
44 | u8 sndbuf[1+wlen]; | 44 | u8 sndbuf[1+wlen]; |
45 | memset(sndbuf,0,1+wlen); | 45 | memset(sndbuf, 0, 1+wlen); |
46 | 46 | ||
47 | sndbuf[0] = cmd; | 47 | sndbuf[0] = cmd; |
48 | memcpy(&sndbuf[1],wbuf,wlen); | 48 | memcpy(&sndbuf[1], wbuf, wlen); |
49 | if (wo) | 49 | if (wo) |
50 | dvb_usb_generic_write(d,sndbuf,1+wlen); | 50 | dvb_usb_generic_write(d, sndbuf, 1+wlen); |
51 | else | 51 | else |
52 | dvb_usb_generic_rw(d,sndbuf,1+wlen,rbuf,rlen,0); | 52 | dvb_usb_generic_rw(d, sndbuf, 1+wlen, rbuf, rlen, 0); |
53 | 53 | ||
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
@@ -58,14 +58,14 @@ static int cxusb_ctrl_msg(struct dvb_usb_device *d, | |||
58 | static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) | 58 | static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) |
59 | { | 59 | { |
60 | struct cxusb_state *st = d->priv; | 60 | struct cxusb_state *st = d->priv; |
61 | u8 o[2],i; | 61 | u8 o[2], i; |
62 | 62 | ||
63 | if (st->gpio_write_state[GPIO_TUNER] == onoff) | 63 | if (st->gpio_write_state[GPIO_TUNER] == onoff) |
64 | return; | 64 | return; |
65 | 65 | ||
66 | o[0] = GPIO_TUNER; | 66 | o[0] = GPIO_TUNER; |
67 | o[1] = onoff; | 67 | o[1] = onoff; |
68 | cxusb_ctrl_msg(d,CMD_GPIO_WRITE,o,2,&i,1); | 68 | cxusb_ctrl_msg(d, CMD_GPIO_WRITE, o, 2, &i, 1); |
69 | 69 | ||
70 | if (i != 0x01) | 70 | if (i != 0x01) |
71 | deb_info("gpio_write failed.\n"); | 71 | deb_info("gpio_write failed.\n"); |
@@ -74,7 +74,8 @@ static void cxusb_gpio_tuner(struct dvb_usb_device *d, int onoff) | |||
74 | } | 74 | } |
75 | 75 | ||
76 | /* I2C */ | 76 | /* I2C */ |
77 | static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | 77 | static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], |
78 | int num) | ||
78 | { | 79 | { |
79 | struct dvb_usb_device *d = i2c_get_adapdata(adap); | 80 | struct dvb_usb_device *d = i2c_get_adapdata(adap); |
80 | int i; | 81 | int i; |
@@ -89,12 +90,12 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
89 | 90 | ||
90 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) | 91 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) |
91 | switch (msg[i].addr) { | 92 | switch (msg[i].addr) { |
92 | case 0x63: | 93 | case 0x63: |
93 | cxusb_gpio_tuner(d,0); | 94 | cxusb_gpio_tuner(d, 0); |
94 | break; | 95 | break; |
95 | default: | 96 | default: |
96 | cxusb_gpio_tuner(d,1); | 97 | cxusb_gpio_tuner(d, 1); |
97 | break; | 98 | break; |
98 | } | 99 | } |
99 | 100 | ||
100 | /* read request */ | 101 | /* read request */ |
@@ -103,26 +104,27 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
103 | obuf[0] = msg[i].len; | 104 | obuf[0] = msg[i].len; |
104 | obuf[1] = msg[i+1].len; | 105 | obuf[1] = msg[i+1].len; |
105 | obuf[2] = msg[i].addr; | 106 | obuf[2] = msg[i].addr; |
106 | memcpy(&obuf[3],msg[i].buf,msg[i].len); | 107 | memcpy(&obuf[3], msg[i].buf, msg[i].len); |
107 | 108 | ||
108 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, | 109 | if (cxusb_ctrl_msg(d, CMD_I2C_READ, |
109 | obuf, 3+msg[i].len, | 110 | obuf, 3+msg[i].len, |
110 | ibuf, 1+msg[i+1].len) < 0) | 111 | ibuf, 1+msg[i+1].len) < 0) |
111 | break; | 112 | break; |
112 | 113 | ||
113 | if (ibuf[0] != 0x08) | 114 | if (ibuf[0] != 0x08) |
114 | deb_i2c("i2c read may have failed\n"); | 115 | deb_i2c("i2c read may have failed\n"); |
115 | 116 | ||
116 | memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); | 117 | memcpy(msg[i+1].buf, &ibuf[1], msg[i+1].len); |
117 | 118 | ||
118 | i++; | 119 | i++; |
119 | } else { /* write */ | 120 | } else { /* write */ |
120 | u8 obuf[2+msg[i].len], ibuf; | 121 | u8 obuf[2+msg[i].len], ibuf; |
121 | obuf[0] = msg[i].addr; | 122 | obuf[0] = msg[i].addr; |
122 | obuf[1] = msg[i].len; | 123 | obuf[1] = msg[i].len; |
123 | memcpy(&obuf[2],msg[i].buf,msg[i].len); | 124 | memcpy(&obuf[2], msg[i].buf, msg[i].len); |
124 | 125 | ||
125 | if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) | 126 | if (cxusb_ctrl_msg(d, CMD_I2C_WRITE, obuf, |
127 | 2+msg[i].len, &ibuf,1) < 0) | ||
126 | break; | 128 | break; |
127 | if (ibuf != 0x08) | 129 | if (ibuf != 0x08) |
128 | deb_i2c("i2c write may have failed\n"); | 130 | deb_i2c("i2c write may have failed\n"); |
@@ -326,7 +328,6 @@ static int cxusb_mt352_demod_init(struct dvb_frontend* fe) | |||
326 | 328 | ||
327 | static struct cx22702_config cxusb_cx22702_config = { | 329 | static struct cx22702_config cxusb_cx22702_config = { |
328 | .demod_address = 0x63, | 330 | .demod_address = 0x63, |
329 | |||
330 | .output_mode = CX22702_PARALLEL_OUTPUT, | 331 | .output_mode = CX22702_PARALLEL_OUTPUT, |
331 | }; | 332 | }; |
332 | 333 | ||
@@ -399,7 +400,8 @@ static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) | |||
399 | 400 | ||
400 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1); | 401 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1); |
401 | 402 | ||
402 | if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, &adap->dev->i2c_adap)) != NULL) | 403 | if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, |
404 | &adap->dev->i2c_adap)) != NULL) | ||
403 | return 0; | 405 | return 0; |
404 | 406 | ||
405 | return -EIO; | 407 | return -EIO; |
@@ -412,7 +414,8 @@ static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) | |||
412 | 414 | ||
413 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); | 415 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
414 | 416 | ||
415 | if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config, &adap->dev->i2c_adap)) != NULL) | 417 | if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config, |
418 | &adap->dev->i2c_adap)) != NULL) | ||
416 | return 0; | 419 | return 0; |
417 | 420 | ||
418 | return -EIO; | 421 | return -EIO; |
@@ -426,7 +429,8 @@ static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap) | |||
426 | 429 | ||
427 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); | 430 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
428 | 431 | ||
429 | if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config, &adap->dev->i2c_adap)) != NULL) | 432 | if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config, |
433 | &adap->dev->i2c_adap)) != NULL) | ||
430 | return 0; | 434 | return 0; |
431 | 435 | ||
432 | return -EIO; | 436 | return -EIO; |
@@ -439,8 +443,11 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap) | |||
439 | 443 | ||
440 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); | 444 | cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); |
441 | 445 | ||
442 | if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, &adap->dev->i2c_adap)) != NULL) || | 446 | if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, |
443 | ((adap->fe = dvb_attach(zl10353_attach, &cxusb_zl10353_dee1601_config, &adap->dev->i2c_adap)) != NULL)) | 447 | &adap->dev->i2c_adap)) != NULL) || |
448 | ((adap->fe = dvb_attach(zl10353_attach, | ||
449 | &cxusb_zl10353_dee1601_config, | ||
450 | &adap->dev->i2c_adap)) != NULL)) | ||
444 | return 0; | 451 | return 0; |
445 | 452 | ||
446 | return -EIO; | 453 | return -EIO; |
@@ -452,7 +459,8 @@ static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap) | |||
452 | */ | 459 | */ |
453 | 460 | ||
454 | #define BLUEBIRD_01_ID_OFFSET 6638 | 461 | #define BLUEBIRD_01_ID_OFFSET 6638 |
455 | static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw) | 462 | static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, |
463 | const struct firmware *fw) | ||
456 | { | 464 | { |
457 | if (fw->size < BLUEBIRD_01_ID_OFFSET + 4) | 465 | if (fw->size < BLUEBIRD_01_ID_OFFSET + 4) |
458 | return -EINVAL; | 466 | return -EINVAL; |
@@ -460,10 +468,12 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const | |||
460 | if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && | 468 | if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && |
461 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { | 469 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { |
462 | 470 | ||
463 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; | 471 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = |
464 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; | 472 | udev->descriptor.idProduct + 1; |
473 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = | ||
474 | udev->descriptor.idProduct >> 8; | ||
465 | 475 | ||
466 | return usb_cypress_load_firmware(udev,fw,CYPRESS_FX2); | 476 | return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); |
467 | } | 477 | } |
468 | 478 | ||
469 | return -EINVAL; | 479 | return -EINVAL; |
@@ -477,7 +487,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties; | |||
477 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; | 487 | static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties; |
478 | 488 | ||
479 | static int cxusb_probe(struct usb_interface *intf, | 489 | static int cxusb_probe(struct usb_interface *intf, |
480 | const struct usb_device_id *id) | 490 | const struct usb_device_id *id) |
481 | { | 491 | { |
482 | if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || | 492 | if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 || |
483 | dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || | 493 | dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 || |
@@ -491,20 +501,20 @@ static int cxusb_probe(struct usb_interface *intf, | |||
491 | } | 501 | } |
492 | 502 | ||
493 | static struct usb_device_id cxusb_table [] = { | 503 | static struct usb_device_id cxusb_table [] = { |
494 | { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, | 504 | { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, |
495 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, | 505 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, |
496 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, | 506 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, |
497 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) }, | 507 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) }, |
498 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) }, | 508 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) }, |
499 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, | 509 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, |
500 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, | 510 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, |
501 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, | 511 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, |
502 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, | 512 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, |
503 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) }, | 513 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) }, |
504 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) }, | 514 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) }, |
505 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) }, | 515 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) }, |
506 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) }, | 516 | { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) }, |
507 | {} /* Terminating entry */ | 517 | {} /* Terminating entry */ |
508 | }; | 518 | }; |
509 | MODULE_DEVICE_TABLE (usb, cxusb_table); | 519 | MODULE_DEVICE_TABLE (usb, cxusb_table); |
510 | 520 | ||
@@ -765,7 +775,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { | |||
765 | static struct usb_driver cxusb_driver = { | 775 | static struct usb_driver cxusb_driver = { |
766 | .name = "dvb_usb_cxusb", | 776 | .name = "dvb_usb_cxusb", |
767 | .probe = cxusb_probe, | 777 | .probe = cxusb_probe, |
768 | .disconnect = dvb_usb_device_exit, | 778 | .disconnect = dvb_usb_device_exit, |
769 | .id_table = cxusb_table, | 779 | .id_table = cxusb_table, |
770 | }; | 780 | }; |
771 | 781 | ||