diff options
Diffstat (limited to 'drivers/media/dvb/ttusb-dec/ttusb_dec.c')
-rw-r--r-- | drivers/media/dvb/ttusb-dec/ttusb_dec.c | 112 |
1 files changed, 58 insertions, 54 deletions
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 1ec981d98b9..42eee04daa5 100644 --- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -52,6 +52,8 @@ MODULE_PARM_DESC(output_pva, "Output PVA from dvr device (default:off)"); module_param(enable_rc, int, 0644); MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)"); +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + #define dprintk if (debug) printk #define DRIVER_NAME "TechnoTrend/Hauppauge DEC USB" @@ -217,11 +219,11 @@ static void ttusb_dec_handle_irq( struct urb *urb) case -ETIME: /* this urb is dead, cleanup */ dprintk("%s:urb shutting down with status: %d\n", - __FUNCTION__, urb->status); + __func__, urb->status); return; default: dprintk("%s:nonzero status received: %d\n", - __FUNCTION__,urb->status); + __func__,urb->status); goto exit; } @@ -235,7 +237,7 @@ static void ttusb_dec_handle_irq( struct urb *urb) * keyrepeat signal is recieved for lets say 200ms. * this should/could be added later ... * for now lets report each signal as a key down and up*/ - dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]); + dprintk("%s:rc signal:%d\n", __func__, buffer[4]); input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1); input_sync(dec->rc_input_dev); input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0); @@ -245,7 +247,7 @@ static void ttusb_dec_handle_irq( struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if(retval) printk("%s - usb_commit_urb failed with result: %d\n", - __FUNCTION__, retval); + __func__, retval); } static u16 crc16(u16 crc, const u8 *buf, size_t len) @@ -268,7 +270,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, int result, actual_len, i; u8 *b; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL); if (!b) @@ -276,7 +278,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, if ((result = mutex_lock_interruptible(&dec->usb_mutex))) { kfree(b); - printk("%s: Failed to lock usb mutex.\n", __FUNCTION__); + printk("%s: Failed to lock usb mutex.\n", __func__); return result; } @@ -289,7 +291,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, memcpy(&b[4], params, param_length); if (debug) { - printk("%s: command: ", __FUNCTION__); + printk("%s: command: ", __func__); for (i = 0; i < param_length + 4; i++) printk("0x%02X ", b[i]); printk("\n"); @@ -300,7 +302,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, if (result) { printk("%s: command bulk message failed: error %d\n", - __FUNCTION__, result); + __func__, result); mutex_unlock(&dec->usb_mutex); kfree(b); return result; @@ -311,13 +313,13 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, if (result) { printk("%s: result bulk message failed: error %d\n", - __FUNCTION__, result); + __func__, result); mutex_unlock(&dec->usb_mutex); kfree(b); return result; } else { if (debug) { - printk("%s: result: ", __FUNCTION__); + printk("%s: result: ", __func__); for (i = 0; i < actual_len; i++) printk("0x%02X ", b[i]); printk("\n"); @@ -343,7 +345,7 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode, int result; unsigned int tmp; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); result = ttusb_dec_send_command(dec, 0x08, 0, NULL, &c_length, c); if (result) @@ -400,7 +402,7 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec) u16 audio = htons(dec->pid[DMX_PES_AUDIO]); u16 video = htons(dec->pid[DMX_PES_VIDEO]); - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); memcpy(&b[0], &pcr, 2); memcpy(&b[2], &audio, 2); @@ -419,12 +421,12 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec) static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length) { if (length < 8) { - printk("%s: packet too short - discarding\n", __FUNCTION__); + printk("%s: packet too short - discarding\n", __func__); return; } if (length > 8 + MAX_PVA_LENGTH) { - printk("%s: packet too long - discarding\n", __FUNCTION__); + printk("%s: packet too long - discarding\n", __func__); return; } @@ -507,7 +509,7 @@ static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length) break; default: - printk("%s: unknown PVA type: %02x.\n", __FUNCTION__, + printk("%s: unknown PVA type: %02x.\n", __func__, pva[2]); break; } @@ -546,7 +548,7 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec) u16 packet_id; if (dec->packet_length % 2) { - printk("%s: odd sized packet - discarding\n", __FUNCTION__); + printk("%s: odd sized packet - discarding\n", __func__); return; } @@ -554,7 +556,7 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec) csum ^= ((dec->packet[i] << 8) + dec->packet[i + 1]); if (csum) { - printk("%s: checksum failed - discarding\n", __FUNCTION__); + printk("%s: checksum failed - discarding\n", __func__); return; } @@ -563,7 +565,7 @@ static void ttusb_dec_process_packet(struct ttusb_dec *dec) if ((packet_id != dec->next_packet_id) && dec->next_packet_id) { printk("%s: warning: lost packets between %u and %u\n", - __FUNCTION__, dec->next_packet_id - 1, packet_id); + __func__, dec->next_packet_id - 1, packet_id); } if (packet_id == 0xffff) @@ -652,7 +654,7 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b, dec->packet_state = 7; } else { printk("%s: unknown packet type: " - "%02x%02x\n", __FUNCTION__, + "%02x%02x\n", __func__, dec->packet[0], dec->packet[1]); dec->packet_state = 0; } @@ -724,7 +726,7 @@ static void ttusb_dec_process_urb_frame(struct ttusb_dec *dec, u8 *b, default: printk("%s: illegal packet state encountered.\n", - __FUNCTION__); + __func__); dec->packet_state = 0; } } @@ -792,7 +794,7 @@ static void ttusb_dec_process_urb(struct urb *urb) } else { /* -ENOENT is expected when unlinking urbs */ if (urb->status != -ENOENT) - dprintk("%s: urb error: %d\n", __FUNCTION__, + dprintk("%s: urb error: %d\n", __func__, urb->status); } @@ -804,7 +806,7 @@ static void ttusb_dec_setup_urbs(struct ttusb_dec *dec) { int i, j, buffer_offset = 0; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); for (i = 0; i < ISO_BUF_COUNT; i++) { int frame_offset = 0; @@ -834,7 +836,7 @@ static void ttusb_dec_stop_iso_xfer(struct ttusb_dec *dec) { int i; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); if (mutex_lock_interruptible(&dec->iso_mutex)) return; @@ -889,7 +891,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec) { int i, result; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); if (mutex_lock_interruptible(&dec->iso_mutex)) return -EAGAIN; @@ -905,7 +907,7 @@ static int ttusb_dec_start_iso_xfer(struct ttusb_dec *dec) if ((result = usb_submit_urb(dec->iso_urb[i], GFP_ATOMIC))) { printk("%s: failed urb submission %d: " - "error %d\n", __FUNCTION__, i, result); + "error %d\n", __func__, i, result); while (i) { usb_kill_urb(dec->iso_urb[i - 1]); @@ -932,7 +934,7 @@ static int ttusb_dec_start_ts_feed(struct dvb_demux_feed *dvbdmxfeed) u8 b0[] = { 0x05 }; int result = 0; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); dprintk(" ts_type:"); @@ -1012,7 +1014,7 @@ static int ttusb_dec_start_sec_feed(struct dvb_demux_feed *dvbdmxfeed) unsigned long flags; u8 x = 1; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); pid = htons(dvbdmxfeed->pid); memcpy(&b0[0], &pid, 2); @@ -1052,7 +1054,7 @@ static int ttusb_dec_start_feed(struct dvb_demux_feed *dvbdmxfeed) { struct dvb_demux *dvbdmx = dvbdmxfeed->demux; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); if (!dvbdmx->dmx.frontend) return -EINVAL; @@ -1113,7 +1115,7 @@ static int ttusb_dec_stop_sec_feed(struct dvb_demux_feed *dvbdmxfeed) static int ttusb_dec_stop_feed(struct dvb_demux_feed *dvbdmxfeed) { - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); switch (dvbdmxfeed->type) { case DMX_TYPE_TS: @@ -1132,7 +1134,7 @@ static void ttusb_dec_free_iso_urbs(struct ttusb_dec *dec) { int i; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); for (i = 0; i < ISO_BUF_COUNT; i++) usb_free_urb(dec->iso_urb[i]); @@ -1147,7 +1149,7 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec) { int i; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); dec->iso_buffer = pci_alloc_consistent(NULL, ISO_FRAME_SIZE * @@ -1214,7 +1216,7 @@ static int ttusb_init_rc( struct ttusb_dec *dec) dec->rc_input_dev = input_dev; if (usb_submit_urb(dec->irq_urb, GFP_KERNEL)) - printk("%s: usb_submit_urb failed\n",__FUNCTION__); + printk("%s: usb_submit_urb failed\n",__func__); /* enable irq pipe */ ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL); @@ -1223,7 +1225,7 @@ static int ttusb_init_rc( struct ttusb_dec *dec) static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) { - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); dec->v_pes[0] = 0x00; dec->v_pes[1] = 0x00; @@ -1233,7 +1235,7 @@ static void ttusb_dec_init_v_pes(struct ttusb_dec *dec) static int ttusb_dec_init_usb(struct ttusb_dec *dec) { - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); mutex_init(&dec->usb_mutex); mutex_init(&dec->iso_mutex); @@ -1281,11 +1283,11 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) u32 crc32_csum, crc32_check, tmp; const struct firmware *fw_entry = NULL; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); if (request_firmware(&fw_entry, dec->firmware_name, &dec->udev->dev)) { printk(KERN_ERR "%s: Firmware (%s) unavailable.\n", - __FUNCTION__, dec->firmware_name); + __func__, dec->firmware_name); return 1; } @@ -1294,7 +1296,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) if (firmware_size < 60) { printk("%s: firmware size too small for DSP code (%zu < 60).\n", - __FUNCTION__, firmware_size); + __func__, firmware_size); release_firmware(fw_entry); return -1; } @@ -1308,7 +1310,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) if (crc32_csum != crc32_check) { printk("%s: crc32 check of DSP code failed (calculated " "0x%08x != 0x%08x in file), file invalid.\n", - __FUNCTION__, crc32_csum, crc32_check); + __func__, crc32_csum, crc32_check); release_firmware(fw_entry); return -1; } @@ -1376,7 +1378,7 @@ static int ttusb_dec_init_stb(struct ttusb_dec *dec) int result; unsigned int mode, model, version; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); result = ttusb_dec_get_stb_state(dec, &mode, &model, &version); @@ -1415,7 +1417,7 @@ static int ttusb_dec_init_stb(struct ttusb_dec *dec) default: printk(KERN_ERR "%s: unknown model returned " "by firmware (%08x) - please report\n", - __FUNCTION__, model); + __func__, model); return -1; break; } @@ -1434,12 +1436,14 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) { int result; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); if ((result = dvb_register_adapter(&dec->adapter, - dec->model_name, THIS_MODULE, &dec->udev->dev)) < 0) { + dec->model_name, THIS_MODULE, + &dec->udev->dev, + adapter_nr)) < 0) { printk("%s: dvb_register_adapter failed: error %d\n", - __FUNCTION__, result); + __func__, result); return result; } @@ -1454,7 +1458,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) dec->demux.write_to_decoder = NULL; if ((result = dvb_dmx_init(&dec->demux)) < 0) { - printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, + printk("%s: dvb_dmx_init failed: error %d\n", __func__, result); dvb_unregister_adapter(&dec->adapter); @@ -1468,7 +1472,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) if ((result = dvb_dmxdev_init(&dec->dmxdev, &dec->adapter)) < 0) { printk("%s: dvb_dmxdev_init failed: error %d\n", - __FUNCTION__, result); + __func__, result); dvb_dmx_release(&dec->demux); dvb_unregister_adapter(&dec->adapter); @@ -1480,7 +1484,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) if ((result = dec->demux.dmx.add_frontend(&dec->demux.dmx, &dec->frontend)) < 0) { - printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, + printk("%s: dvb_dmx_init failed: error %d\n", __func__, result); dvb_dmxdev_release(&dec->dmxdev); @@ -1492,7 +1496,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) if ((result = dec->demux.dmx.connect_frontend(&dec->demux.dmx, &dec->frontend)) < 0) { - printk("%s: dvb_dmx_init failed: error %d\n", __FUNCTION__, + printk("%s: dvb_dmx_init failed: error %d\n", __func__, result); dec->demux.dmx.remove_frontend(&dec->demux.dmx, &dec->frontend); @@ -1510,7 +1514,7 @@ static int ttusb_dec_init_dvb(struct ttusb_dec *dec) static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) { - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); dvb_net_release(&dec->dvb_net); dec->demux.dmx.close(&dec->demux.dmx); @@ -1528,7 +1532,7 @@ static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) static void ttusb_dec_exit_rc(struct ttusb_dec *dec) { - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); /* we have to check whether the irq URB is already submitted. * As the irq is submitted after the interface is changed, * this is the best method i figured out. @@ -1552,7 +1556,7 @@ static void ttusb_dec_exit_usb(struct ttusb_dec *dec) { int i; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); dec->iso_stream_count = 0; @@ -1612,12 +1616,12 @@ static int ttusb_dec_probe(struct usb_interface *intf, struct usb_device *udev; struct ttusb_dec *dec; - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); udev = interface_to_usbdev(intf); if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { - printk("%s: couldn't allocate memory.\n", __FUNCTION__); + printk("%s: couldn't allocate memory.\n", __func__); return -ENOMEM; } @@ -1692,7 +1696,7 @@ static void ttusb_dec_disconnect(struct usb_interface *intf) usb_set_intfdata(intf, NULL); - dprintk("%s\n", __FUNCTION__); + dprintk("%s\n", __func__); if (dec->active) { ttusb_dec_exit_tasklet(dec); @@ -1749,7 +1753,7 @@ static int __init ttusb_dec_init(void) int result; if ((result = usb_register(&ttusb_dec_driver)) < 0) { - printk("%s: initialisation failed: error %d.\n", __FUNCTION__, + printk("%s: initialisation failed: error %d.\n", __func__, result); return result; } |