aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-07-01 00:19:31 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 14:01:33 -0400
commit230b27cd8e0494ecb463c0f3ae63d752c9d59666 (patch)
tree2f5f592b89deccf489fc9f551f32401703b975bf /drivers/media/dvb
parent8871c85d86829a2739ec797c4343ebd3664895b9 (diff)
V4L/DVB: drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes
Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c66
1 files changed, 35 insertions, 31 deletions
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index d2dabac9b63a..7deade7d1d23 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -53,7 +53,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
53 int status; 53 int status;
54 54
55 deb_data(">>> "); 55 deb_data(">>> ");
56 debug_dump(tx,txlen,deb_data); 56 debug_dump(tx, txlen, deb_data);
57 57
58 status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0), 58 status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0),
59 tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen, 59 tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen,
@@ -98,7 +98,7 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
98 deb_info("ep 0 read error (status = %d)\n",status); 98 deb_info("ep 0 read error (status = %d)\n",status);
99 99
100 deb_data("<<< "); 100 deb_data("<<< ");
101 debug_dump(rx,rxlen,deb_data); 101 debug_dump(rx, rxlen, deb_data);
102 102
103 return status; /* length in case of success */ 103 return status; /* length in case of success */
104} 104}
@@ -106,28 +106,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen
106int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val) 106int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
107{ 107{
108 u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) }; 108 u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
109 return dib0700_ctrl_wr(d,buf,3); 109 return dib0700_ctrl_wr(d, buf, sizeof(buf));
110} 110}
111 111
112static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) 112static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
113{ 113{
114 struct dib0700_state *st = d->priv; 114 struct dib0700_state *st = d->priv;
115 u8 b[3]; 115 u8 b[3];
116 int ret; 116 int ret;
117 117
118 if (st->fw_version >= 0x10201) { 118 if (st->fw_version >= 0x10201) {
119 b[0] = REQUEST_SET_USB_XFER_LEN; 119 b[0] = REQUEST_SET_USB_XFER_LEN;
120 b[1] = (nb_ts_packets >> 8)&0xff; 120 b[1] = (nb_ts_packets >> 8) & 0xff;
121 b[2] = nb_ts_packets & 0xff; 121 b[2] = nb_ts_packets & 0xff;
122 122
123 deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets); 123 deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
124 124
125 ret = dib0700_ctrl_wr(d, b, 3); 125 ret = dib0700_ctrl_wr(d, b, sizeof(b));
126 } else { 126 } else {
127 deb_info("this firmware does not allow to change the USB xfer len\n"); 127 deb_info("this firmware does not allow to change the USB xfer len\n");
128 ret = -EIO; 128 ret = -EIO;
129 } 129 }
130 return ret; 130
131 return ret;
131} 132}
132 133
133/* 134/*
@@ -178,7 +179,8 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
178 value = ((en_start << 7) | (en_stop << 6) | 179 value = ((en_start << 7) | (en_stop << 6) |
179 (msg[i].len & 0x3F)) << 8 | i2c_dest; 180 (msg[i].len & 0x3F)) << 8 | i2c_dest;
180 /* I2C ctrl + FE bus; */ 181 /* I2C ctrl + FE bus; */
181 index = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30); 182 index = ((gen_mode << 6) & 0xC0) |
183 ((bus_mode << 4) & 0x30);
182 184
183 result = usb_control_msg(d->udev, 185 result = usb_control_msg(d->udev,
184 usb_rcvctrlpipe(d->udev, 0), 186 usb_rcvctrlpipe(d->udev, 0),
@@ -198,11 +200,12 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg,
198 } else { 200 } else {
199 /* Write request */ 201 /* Write request */
200 buf[0] = REQUEST_NEW_I2C_WRITE; 202 buf[0] = REQUEST_NEW_I2C_WRITE;
201 buf[1] = (msg[i].addr << 1); 203 buf[1] = msg[i].addr << 1;
202 buf[2] = (en_start << 7) | (en_stop << 6) | 204 buf[2] = (en_start << 7) | (en_stop << 6) |
203 (msg[i].len & 0x3F); 205 (msg[i].len & 0x3F);
204 /* I2C ctrl + FE bus; */ 206 /* I2C ctrl + FE bus; */
205 buf[3] = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30); 207 buf[3] = ((gen_mode << 6) & 0xC0) |
208 ((bus_mode << 4) & 0x30);
206 /* The Actual i2c payload */ 209 /* The Actual i2c payload */
207 memcpy(&buf[4], msg[i].buf, msg[i].len); 210 memcpy(&buf[4], msg[i].buf, msg[i].len);
208 211
@@ -240,7 +243,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap,
240 243
241 for (i = 0; i < num; i++) { 244 for (i = 0; i < num; i++) {
242 /* fill in the address */ 245 /* fill in the address */
243 buf[1] = (msg[i].addr << 1); 246 buf[1] = msg[i].addr << 1;
244 /* fill the buffer */ 247 /* fill the buffer */
245 memcpy(&buf[2], msg[i].buf, msg[i].len); 248 memcpy(&buf[2], msg[i].buf, msg[i].len);
246 249
@@ -368,7 +371,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
368 u8 buf[260]; 371 u8 buf[260];
369 372
370 while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) { 373 while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
371 deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk); 374 deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",
375 hx.addr, hx.len, hx.chk);
372 376
373 buf[0] = hx.len; 377 buf[0] = hx.len;
374 buf[1] = (hx.addr >> 8) & 0xff; 378 buf[1] = (hx.addr >> 8) & 0xff;
@@ -408,16 +412,16 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
408 REQUEST_GET_VERSION, 412 REQUEST_GET_VERSION,
409 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, 413 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
410 b, sizeof(b), USB_CTRL_GET_TIMEOUT); 414 b, sizeof(b), USB_CTRL_GET_TIMEOUT);
411 fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11]; 415 fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11];
412 416
413 /* set the buffer size - DVB-USB is allocating URB buffers 417 /* set the buffer size - DVB-USB is allocating URB buffers
414 * only after the firwmare download was successful */ 418 * only after the firwmare download was successful */
415 for (i = 0; i < dib0700_device_count; i++) { 419 for (i = 0; i < dib0700_device_count; i++) {
416 for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters; 420 for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters;
417 adap_num++) { 421 adap_num++) {
418 if (fw_version >= 0x10201) 422 if (fw_version >= 0x10201) {
419 dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size; 423 dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size;
420 else { 424 } else {
421 /* for fw version older than 1.20.1, 425 /* for fw version older than 1.20.1,
422 * the buffersize has to be n times 512 */ 426 * the buffersize has to be n times 512 */
423 dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512; 427 dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512;
@@ -453,7 +457,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
453 if (st->disable_streaming_master_mode == 1) 457 if (st->disable_streaming_master_mode == 1)
454 b[2] = 0x00; 458 b[2] = 0x00;
455 else 459 else
456 b[2] = (0x01 << 4); /* Master mode */ 460 b[2] = 0x01 << 4; /* Master mode */
457 461
458 b[3] = 0x00; 462 b[3] = 0x00;
459 463
@@ -466,7 +470,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
466 470
467 b[2] |= st->channel_state; 471 b[2] |= st->channel_state;
468 472
469 deb_info("data for streaming: %x %x\n",b[1],b[2]); 473 deb_info("data for streaming: %x %x\n", b[1], b[2]);
470 474
471 return dib0700_ctrl_wr(adap->dev, b, 4); 475 return dib0700_ctrl_wr(adap->dev, b, 4);
472} 476}
@@ -631,7 +635,7 @@ resubmit:
631int dib0700_rc_setup(struct dvb_usb_device *d) 635int dib0700_rc_setup(struct dvb_usb_device *d)
632{ 636{
633 struct dib0700_state *st = d->priv; 637 struct dib0700_state *st = d->priv;
634 u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0}; 638 u8 rc_setup[3] = { REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0 };
635 struct urb *purb; 639 struct urb *purb;
636 int ret; 640 int ret;
637 int i; 641 int i;