diff options
Diffstat (limited to 'drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c')
| -rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index cbe2f0de1442..420bb42d5233 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
| @@ -52,7 +52,7 @@ | |||
| 52 | my TTUSB, so let it undef'd unless you want to implement another | 52 | my TTUSB, so let it undef'd unless you want to implement another |
| 53 | frontend. never tested. | 53 | frontend. never tested. |
| 54 | 54 | ||
| 55 | DEBUG: | 55 | debug: |
| 56 | define it to > 3 for really hardcore debugging. you probably don't want | 56 | define it to > 3 for really hardcore debugging. you probably don't want |
| 57 | this unless the device doesn't load at all. > 2 for bandwidth statistics. | 57 | this unless the device doesn't load at all. > 2 for bandwidth statistics. |
| 58 | */ | 58 | */ |
| @@ -134,20 +134,19 @@ struct ttusb { | |||
| 134 | /* ugly workaround ... don't know why it's necessary to read */ | 134 | /* ugly workaround ... don't know why it's necessary to read */ |
| 135 | /* all result codes. */ | 135 | /* all result codes. */ |
| 136 | 136 | ||
| 137 | #define DEBUG 0 | ||
| 138 | static int ttusb_cmd(struct ttusb *ttusb, | 137 | static int ttusb_cmd(struct ttusb *ttusb, |
| 139 | const u8 * data, int len, int needresult) | 138 | const u8 * data, int len, int needresult) |
| 140 | { | 139 | { |
| 141 | int actual_len; | 140 | int actual_len; |
| 142 | int err; | 141 | int err; |
| 143 | #if DEBUG >= 3 | ||
| 144 | int i; | 142 | int i; |
| 145 | 143 | ||
| 146 | printk(">"); | 144 | if (debug >= 3) { |
| 147 | for (i = 0; i < len; ++i) | 145 | printk(KERN_DEBUG ">"); |
| 148 | printk(" %02x", data[i]); | 146 | for (i = 0; i < len; ++i) |
| 149 | printk("\n"); | 147 | printk(KERN_CONT " %02x", data[i]); |
| 150 | #endif | 148 | printk(KERN_CONT "\n"); |
| 149 | } | ||
| 151 | 150 | ||
| 152 | if (mutex_lock_interruptible(&ttusb->semusb) < 0) | 151 | if (mutex_lock_interruptible(&ttusb->semusb) < 0) |
| 153 | return -EAGAIN; | 152 | return -EAGAIN; |
| @@ -176,13 +175,15 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
| 176 | mutex_unlock(&ttusb->semusb); | 175 | mutex_unlock(&ttusb->semusb); |
| 177 | return err; | 176 | return err; |
| 178 | } | 177 | } |
| 179 | #if DEBUG >= 3 | 178 | |
| 180 | actual_len = ttusb->last_result[3] + 4; | 179 | if (debug >= 3) { |
| 181 | printk("<"); | 180 | actual_len = ttusb->last_result[3] + 4; |
| 182 | for (i = 0; i < actual_len; ++i) | 181 | printk(KERN_DEBUG "<"); |
| 183 | printk(" %02x", ttusb->last_result[i]); | 182 | for (i = 0; i < actual_len; ++i) |
| 184 | printk("\n"); | 183 | printk(KERN_CONT " %02x", ttusb->last_result[i]); |
| 185 | #endif | 184 | printk(KERN_CONT "\n"); |
| 185 | } | ||
| 186 | |||
| 186 | if (!needresult) | 187 | if (!needresult) |
| 187 | mutex_unlock(&ttusb->semusb); | 188 | mutex_unlock(&ttusb->semusb); |
| 188 | return 0; | 189 | return 0; |
| @@ -636,16 +637,13 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) | |||
| 636 | ++ttusb->mux_state; | 637 | ++ttusb->mux_state; |
| 637 | else { | 638 | else { |
| 638 | ttusb->mux_state = 0; | 639 | ttusb->mux_state = 0; |
| 639 | #if DEBUG > 3 | ||
| 640 | if (ttusb->insync) | ||
| 641 | printk("%02x ", data[-1]); | ||
| 642 | #else | ||
| 643 | if (ttusb->insync) { | 640 | if (ttusb->insync) { |
| 644 | printk("%s: lost sync.\n", | 641 | dprintk("%s: %02x\n", |
| 642 | __func__, data[-1]); | ||
| 643 | printk(KERN_INFO "%s: lost sync.\n", | ||
| 645 | __func__); | 644 | __func__); |
| 646 | ttusb->insync = 0; | 645 | ttusb->insync = 0; |
| 647 | } | 646 | } |
| 648 | #endif | ||
| 649 | } | 647 | } |
| 650 | break; | 648 | break; |
| 651 | case 3: | 649 | case 3: |
| @@ -744,6 +742,9 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) | |||
| 744 | static void ttusb_iso_irq(struct urb *urb) | 742 | static void ttusb_iso_irq(struct urb *urb) |
| 745 | { | 743 | { |
| 746 | struct ttusb *ttusb = urb->context; | 744 | struct ttusb *ttusb = urb->context; |
| 745 | struct usb_iso_packet_descriptor *d; | ||
| 746 | u8 *data; | ||
| 747 | int len, i; | ||
| 747 | 748 | ||
| 748 | if (!ttusb->iso_streaming) | 749 | if (!ttusb->iso_streaming) |
| 749 | return; | 750 | return; |
| @@ -755,21 +756,14 @@ static void ttusb_iso_irq(struct urb *urb) | |||
| 755 | #endif | 756 | #endif |
| 756 | 757 | ||
| 757 | if (!urb->status) { | 758 | if (!urb->status) { |
| 758 | int i; | ||
| 759 | for (i = 0; i < urb->number_of_packets; ++i) { | 759 | for (i = 0; i < urb->number_of_packets; ++i) { |
| 760 | struct usb_iso_packet_descriptor *d; | ||
| 761 | u8 *data; | ||
| 762 | int len; | ||
| 763 | numpkt++; | 760 | numpkt++; |
| 764 | if (time_after_eq(jiffies, lastj + HZ)) { | 761 | if (time_after_eq(jiffies, lastj + HZ)) { |
| 765 | #if DEBUG > 2 | 762 | dprintk("frames/s: %lu (ts: %d, stuff %d, " |
| 766 | printk | 763 | "sec: %d, invalid: %d, all: %d)\n", |
| 767 | ("frames/s: %d (ts: %d, stuff %d, sec: %d, invalid: %d, all: %d)\n", | 764 | numpkt * HZ / (jiffies - lastj), |
| 768 | numpkt * HZ / (jiffies - lastj), | 765 | numts, numstuff, numsec, numinvalid, |
| 769 | numts, numstuff, numsec, numinvalid, | 766 | numts + numstuff + numsec + numinvalid); |
| 770 | numts + numstuff + numsec + | ||
| 771 | numinvalid); | ||
| 772 | #endif | ||
| 773 | numts = numstuff = numsec = numinvalid = 0; | 767 | numts = numstuff = numsec = numinvalid = 0; |
| 774 | lastj = jiffies; | 768 | lastj = jiffies; |
| 775 | numpkt = 0; | 769 | numpkt = 0; |
