aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/b2c2/flexcop-usb.c2
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c46
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c12
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig2
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c21
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c2
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c10
-rw-r--r--drivers/media/dvb/dvb-usb/m920x.c7
-rw-r--r--drivers/media/dvb/frontends/dib0070.h15
-rw-r--r--drivers/media/dvb/frontends/dib7000p.h15
-rw-r--r--drivers/media/dvb/frontends/or51132.c6
-rw-r--r--drivers/media/dvb/ttpci/av7110.c9
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c34
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c2
-rw-r--r--drivers/media/dvb/ttusb-dec/Kconfig2
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c25
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusbdecfe.c10
17 files changed, 136 insertions, 84 deletions
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c
index 449fb5c3d0b1..ae0d76a5d51d 100644
--- a/drivers/media/dvb/b2c2/flexcop-usb.c
+++ b/drivers/media/dvb/b2c2/flexcop-usb.c
@@ -379,7 +379,7 @@ static void flexcop_usb_transfer_exit(struct flexcop_usb *fc_usb)
379 379
380static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb) 380static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
381{ 381{
382 u16 frame_size = fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize; 382 u16 frame_size = le16_to_cpu(fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize);
383 int bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO * frame_size,i,j,ret; 383 int bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO * frame_size,i,j,ret;
384 int buffer_offset = 0; 384 int buffer_offset = 0;
385 385
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index f5010e8671b8..a824f3719f81 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -82,22 +82,22 @@ enum cinergyt2_ep1_cmd {
82 82
83struct dvbt_set_parameters_msg { 83struct dvbt_set_parameters_msg {
84 uint8_t cmd; 84 uint8_t cmd;
85 uint32_t freq; 85 __le32 freq;
86 uint8_t bandwidth; 86 uint8_t bandwidth;
87 uint16_t tps; 87 __le16 tps;
88 uint8_t flags; 88 uint8_t flags;
89} __attribute__((packed)); 89} __attribute__((packed));
90 90
91struct dvbt_get_status_msg { 91struct dvbt_get_status_msg {
92 uint32_t freq; 92 __le32 freq;
93 uint8_t bandwidth; 93 uint8_t bandwidth;
94 uint16_t tps; 94 __le16 tps;
95 uint8_t flags; 95 uint8_t flags;
96 uint16_t gain; 96 __le16 gain;
97 uint8_t snr; 97 uint8_t snr;
98 uint32_t viterbi_error_rate; 98 __le32 viterbi_error_rate;
99 uint32_t rs_error_rate; 99 __le32 rs_error_rate;
100 uint32_t uncorrected_block_count; 100 __le32 uncorrected_block_count;
101 uint8_t lock_bits; 101 uint8_t lock_bits;
102 uint8_t prev_lock_bits; 102 uint8_t prev_lock_bits;
103} __attribute__((packed)); 103} __attribute__((packed));
@@ -136,6 +136,7 @@ struct cinergyt2 {
136 wait_queue_head_t poll_wq; 136 wait_queue_head_t poll_wq;
137 int pending_fe_events; 137 int pending_fe_events;
138 int disconnect_pending; 138 int disconnect_pending;
139 unsigned int uncorrected_block_count;
139 atomic_t inuse; 140 atomic_t inuse;
140 141
141 void *streambuf; 142 void *streambuf;
@@ -147,7 +148,7 @@ struct cinergyt2 {
147 char phys[64]; 148 char phys[64];
148 struct delayed_work rc_query_work; 149 struct delayed_work rc_query_work;
149 int rc_input_event; 150 int rc_input_event;
150 u32 rc_last_code; 151 __le32 rc_last_code;
151 unsigned long last_event_jiffies; 152 unsigned long last_event_jiffies;
152#endif 153#endif
153}; 154};
@@ -160,7 +161,7 @@ enum {
160 161
161struct cinergyt2_rc_event { 162struct cinergyt2_rc_event {
162 char type; 163 char type;
163 uint32_t value; 164 __le32 value;
164} __attribute__((packed)); 165} __attribute__((packed));
165 166
166static const uint32_t rc_keys[] = { 167static const uint32_t rc_keys[] = {
@@ -619,8 +620,11 @@ static int cinergyt2_ioctl (struct inode *inode, struct file *file,
619 { 620 {
620 uint32_t unc_count; 621 uint32_t unc_count;
621 622
622 unc_count = stat->uncorrected_block_count; 623 if (mutex_lock_interruptible(&cinergyt2->sem))
623 stat->uncorrected_block_count = 0; 624 return -ERESTARTSYS;
625 unc_count = cinergyt2->uncorrected_block_count;
626 cinergyt2->uncorrected_block_count = 0;
627 mutex_unlock(&cinergyt2->sem);
624 628
625 /* UNC are already converted to host byte order... */ 629 /* UNC are already converted to host byte order... */
626 return put_user(unc_count,(__u32 __user *) arg); 630 return put_user(unc_count,(__u32 __user *) arg);
@@ -769,7 +773,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
769 input_sync(cinergyt2->rc_input_dev); 773 input_sync(cinergyt2->rc_input_dev);
770 cinergyt2->rc_input_event = KEY_MAX; 774 cinergyt2->rc_input_event = KEY_MAX;
771 } 775 }
772 cinergyt2->rc_last_code = ~0; 776 cinergyt2->rc_last_code = cpu_to_le32(~0);
773 } 777 }
774 goto out; 778 goto out;
775 } 779 }
@@ -780,7 +784,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
780 n, le32_to_cpu(rc_events[n].value), rc_events[n].type); 784 n, le32_to_cpu(rc_events[n].value), rc_events[n].type);
781 785
782 if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC && 786 if (rc_events[n].type == CINERGYT2_RC_EVENT_TYPE_NEC &&
783 rc_events[n].value == ~0) { 787 rc_events[n].value == cpu_to_le32(~0)) {
784 /* keyrepeat bit -> just repeat last rc_input_event */ 788 /* keyrepeat bit -> just repeat last rc_input_event */
785 } else { 789 } else {
786 cinergyt2->rc_input_event = KEY_MAX; 790 cinergyt2->rc_input_event = KEY_MAX;
@@ -795,7 +799,7 @@ static void cinergyt2_query_rc (struct work_struct *work)
795 799
796 if (cinergyt2->rc_input_event != KEY_MAX) { 800 if (cinergyt2->rc_input_event != KEY_MAX) {
797 if (rc_events[n].value == cinergyt2->rc_last_code && 801 if (rc_events[n].value == cinergyt2->rc_last_code &&
798 cinergyt2->rc_last_code != ~0) { 802 cinergyt2->rc_last_code != cpu_to_le32(~0)) {
799 /* emit a key-up so the double event is recognized */ 803 /* emit a key-up so the double event is recognized */
800 dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event); 804 dprintk(1, "rc_input_event=%d UP\n", cinergyt2->rc_input_event);
801 input_report_key(cinergyt2->rc_input_dev, 805 input_report_key(cinergyt2->rc_input_dev,
@@ -829,7 +833,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
829 usb_make_path(cinergyt2->udev, cinergyt2->phys, sizeof(cinergyt2->phys)); 833 usb_make_path(cinergyt2->udev, cinergyt2->phys, sizeof(cinergyt2->phys));
830 strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys)); 834 strlcat(cinergyt2->phys, "/input0", sizeof(cinergyt2->phys));
831 cinergyt2->rc_input_event = KEY_MAX; 835 cinergyt2->rc_input_event = KEY_MAX;
832 cinergyt2->rc_last_code = ~0; 836 cinergyt2->rc_last_code = cpu_to_le32(~0);
833 INIT_DELAYED_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc); 837 INIT_DELAYED_WORK(&cinergyt2->rc_query_work, cinergyt2_query_rc);
834 838
835 input_dev->name = DRIVER_NAME " remote control"; 839 input_dev->name = DRIVER_NAME " remote control";
@@ -840,8 +844,8 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
840 input_dev->keycodesize = 0; 844 input_dev->keycodesize = 0;
841 input_dev->keycodemax = 0; 845 input_dev->keycodemax = 0;
842 input_dev->id.bustype = BUS_USB; 846 input_dev->id.bustype = BUS_USB;
843 input_dev->id.vendor = cinergyt2->udev->descriptor.idVendor; 847 input_dev->id.vendor = le16_to_cpu(cinergyt2->udev->descriptor.idVendor);
844 input_dev->id.product = cinergyt2->udev->descriptor.idProduct; 848 input_dev->id.product = le16_to_cpu(cinergyt2->udev->descriptor.idProduct);
845 input_dev->id.version = 1; 849 input_dev->id.version = 1;
846 input_dev->dev.parent = &cinergyt2->udev->dev; 850 input_dev->dev.parent = &cinergyt2->udev->dev;
847 851
@@ -889,18 +893,16 @@ static void cinergyt2_query (struct work_struct *work)
889 char cmd [] = { CINERGYT2_EP1_GET_TUNER_STATUS }; 893 char cmd [] = { CINERGYT2_EP1_GET_TUNER_STATUS };
890 struct dvbt_get_status_msg *s = &cinergyt2->status; 894 struct dvbt_get_status_msg *s = &cinergyt2->status;
891 uint8_t lock_bits; 895 uint8_t lock_bits;
892 uint32_t unc;
893 896
894 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 897 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem))
895 return; 898 return;
896 899
897 unc = s->uncorrected_block_count;
898 lock_bits = s->lock_bits; 900 lock_bits = s->lock_bits;
899 901
900 cinergyt2_command(cinergyt2, cmd, sizeof(cmd), (char *) s, sizeof(*s)); 902 cinergyt2_command(cinergyt2, cmd, sizeof(cmd), (char *) s, sizeof(*s));
901 903
902 unc += le32_to_cpu(s->uncorrected_block_count); 904 cinergyt2->uncorrected_block_count +=
903 s->uncorrected_block_count = unc; 905 le32_to_cpu(s->uncorrected_block_count);
904 906
905 if (lock_bits != s->lock_bits) { 907 if (lock_bits != s->lock_bits) {
906 wake_up_interruptible(&cinergyt2->poll_wq); 908 wake_up_interruptible(&cinergyt2->poll_wq);
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index 56d871cfd7fc..c2334aef4143 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -168,7 +168,7 @@ struct dvb_net_priv {
168 * stolen from eth.c out of the linux kernel, hacked for dvb-device 168 * stolen from eth.c out of the linux kernel, hacked for dvb-device
169 * by Michael Holzt <kju@debian.org> 169 * by Michael Holzt <kju@debian.org>
170 */ 170 */
171static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb, 171static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
172 struct net_device *dev) 172 struct net_device *dev)
173{ 173{
174 struct ethhdr *eth; 174 struct ethhdr *eth;
@@ -277,10 +277,10 @@ static int handle_one_ule_extension( struct dvb_net_priv *p )
277 if(ext_len >= 0) { 277 if(ext_len >= 0) {
278 p->ule_next_hdr += ext_len; 278 p->ule_next_hdr += ext_len;
279 if (!p->ule_bridged) { 279 if (!p->ule_bridged) {
280 p->ule_sndu_type = ntohs(*(unsigned short *)p->ule_next_hdr); 280 p->ule_sndu_type = ntohs(*(__be16 *)p->ule_next_hdr);
281 p->ule_next_hdr += 2; 281 p->ule_next_hdr += 2;
282 } else { 282 } else {
283 p->ule_sndu_type = ntohs(*(unsigned short *)(p->ule_next_hdr + ((p->ule_dbit ? 2 : 3) * ETH_ALEN))); 283 p->ule_sndu_type = ntohs(*(__be16 *)(p->ule_next_hdr + ((p->ule_dbit ? 2 : 3) * ETH_ALEN)));
284 /* This assures the extension handling loop will terminate. */ 284 /* This assures the extension handling loop will terminate. */
285 } 285 }
286 } 286 }
@@ -294,7 +294,7 @@ static int handle_one_ule_extension( struct dvb_net_priv *p )
294 if (ule_optional_ext_handlers[htype]) 294 if (ule_optional_ext_handlers[htype])
295 (void)ule_optional_ext_handlers[htype]( p ); 295 (void)ule_optional_ext_handlers[htype]( p );
296 p->ule_next_hdr += ext_len; 296 p->ule_next_hdr += ext_len;
297 p->ule_sndu_type = ntohs( *(unsigned short *)(p->ule_next_hdr-2) ); 297 p->ule_sndu_type = ntohs( *(__be16 *)(p->ule_next_hdr-2) );
298 /* 298 /*
299 * note: the length of the next header type is included in the 299 * note: the length of the next header type is included in the
300 * length of THIS optional extension header 300 * length of THIS optional extension header
@@ -594,8 +594,8 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
594 /* Check for complete payload. */ 594 /* Check for complete payload. */
595 if (priv->ule_sndu_remain <= 0) { 595 if (priv->ule_sndu_remain <= 0) {
596 /* Check CRC32, we've got it in our skb already. */ 596 /* Check CRC32, we've got it in our skb already. */
597 unsigned short ulen = htons(priv->ule_sndu_len); 597 __be16 ulen = htons(priv->ule_sndu_len);
598 unsigned short utype = htons(priv->ule_sndu_type); 598 __be16 utype = htons(priv->ule_sndu_type);
599 const u8 *tail; 599 const u8 *tail;
600 struct kvec iov[3] = { 600 struct kvec iov[3] = {
601 { &ulen, sizeof ulen }, 601 { &ulen, sizeof ulen },
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index cf4584e48b6d..f00a0eb40420 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -1,6 +1,6 @@
1config DVB_USB 1config DVB_USB
2 tristate "Support for various USB DVB devices" 2 tristate "Support for various USB DVB devices"
3 depends on DVB_CORE && USB && I2C 3 depends on DVB_CORE && USB && I2C && INPUT
4 depends on HOTPLUG # due to FW_LOADER 4 depends on HOTPLUG # due to FW_LOADER
5 select FW_LOADER 5 select FW_LOADER
6 help 6 help
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
index 346223856f59..c4d40fe01d57 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -111,8 +111,8 @@ static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
111 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1); 111 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
112 s8 a; 112 s8 a;
113 int if1=1220; 113 int if1=1220;
114 if (adap->dev->udev->descriptor.idVendor == USB_VID_HAUPPAUGE && 114 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
115 adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_500_2) { 115 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) {
116 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a; 116 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a;
117 } 117 }
118 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id], 118 return dvb_attach(mt2060_attach,adap->fe, tun_i2c,&bristol_mt2060_config[adap->id],
@@ -402,8 +402,8 @@ static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
402{ 402{
403 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; 403 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor;
404 404
405 if (desc->idVendor == USB_VID_PINNACLE && 405 if (desc->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
406 desc->idProduct == USB_PID_PINNACLE_EXPRESSCARD_320CX) 406 desc->idProduct == cpu_to_le16(USB_PID_PINNACLE_EXPRESSCARD_320CX))
407 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); 407 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
408 else 408 else
409 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 409 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
@@ -845,8 +845,8 @@ static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
845 struct i2c_adapter *tun_i2c; 845 struct i2c_adapter *tun_i2c;
846 s8 a; 846 s8 a;
847 int if1=1220; 847 int if1=1220;
848 if (adap->dev->udev->descriptor.idVendor == USB_VID_HAUPPAUGE && 848 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) &&
849 adap->dev->udev->descriptor.idProduct == USB_PID_HAUPPAUGE_NOVA_T_STICK) { 849 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) {
850 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a; 850 if (!eeprom_read(prim_i2c,0x58,&a)) if1=1220+a;
851 } 851 }
852 if (st->is_dib7000pc) 852 if (st->is_dib7000pc)
@@ -990,11 +990,12 @@ static struct dib7000p_config dib7070p_dib7000p_config = {
990/* STK7070P */ 990/* STK7070P */
991static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) 991static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
992{ 992{
993 if (adap->dev->udev->descriptor.idVendor == USB_VID_PINNACLE && 993 struct usb_device_descriptor *p = &adap->dev->udev->descriptor;
994 adap->dev->udev->descriptor.idProduct == USB_PID_PINNACLE_PCTV72E) 994 if (p->idVendor == cpu_to_le16(USB_VID_PINNACLE) &&
995 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); 995 p->idProduct == cpu_to_le16(USB_PID_PINNACLE_PCTV72E))
996 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
996 else 997 else
997 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 998 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
998 msleep(10); 999 msleep(10);
999 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); 1000 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1);
1000 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); 1001 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
index e1112e39fb63..733a7ff7b207 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
@@ -127,7 +127,7 @@ int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
127 if ((*pos + hx->len + 4) >= fw->size) 127 if ((*pos + hx->len + 4) >= fw->size)
128 return -EINVAL; 128 return -EINVAL;
129 129
130 hx->addr = le16_to_cpu( *((u16 *) &b[1]) ); 130 hx->addr = b[1] | (b[2] << 8);
131 hx->type = b[3]; 131 hx->type = b[3];
132 132
133 if (hx->type == 0x04) { 133 if (hx->type == 0x04) {
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index 9a942afaf0af..2653120673b7 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -146,24 +146,24 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
146 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 146 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
147 if (! (status & bm8pskFW_Loaded)) /* BCM4500 firmware loaded */ 147 if (! (status & bm8pskFW_Loaded)) /* BCM4500 firmware loaded */
148 if(gp8psk_load_bcm4500fw(d)) 148 if(gp8psk_load_bcm4500fw(d))
149 return EINVAL; 149 return -EINVAL;
150 150
151 if (! (status & bmIntersilOn)) /* LNB Power */ 151 if (! (status & bmIntersilOn)) /* LNB Power */
152 if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0, 152 if (gp8psk_usb_in_op(d, START_INTERSIL, 1, 0,
153 &buf, 1)) 153 &buf, 1))
154 return EINVAL; 154 return -EINVAL;
155 155
156 /* Set DVB mode to 1 */ 156 /* Set DVB mode to 1 */
157 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 157 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
158 if (gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0)) 158 if (gp8psk_usb_out_op(d, SET_DVB_MODE, 1, 0, NULL, 0))
159 return EINVAL; 159 return -EINVAL;
160 /* Abort possible TS (if previous tune crashed) */ 160 /* Abort possible TS (if previous tune crashed) */
161 if (gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0)) 161 if (gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0))
162 return EINVAL; 162 return -EINVAL;
163 } else { 163 } else {
164 /* Turn off LNB power */ 164 /* Turn off LNB power */
165 if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1)) 165 if (gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1))
166 return EINVAL; 166 return -EINVAL;
167 /* Turn off 8psk power */ 167 /* Turn off 8psk power */
168 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)) 168 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1))
169 return -EINVAL; 169 return -EINVAL;
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c
index a12e6f784fda..54626a0dbf68 100644
--- a/drivers/media/dvb/dvb-usb/m920x.c
+++ b/drivers/media/dvb/dvb-usb/m920x.c
@@ -16,6 +16,7 @@
16#include "qt1010.h" 16#include "qt1010.h"
17#include "tda1004x.h" 17#include "tda1004x.h"
18#include "tda827x.h" 18#include "tda827x.h"
19#include <asm/unaligned.h>
19 20
20/* debug */ 21/* debug */
21static int dvb_usb_m920x_debug; 22static int dvb_usb_m920x_debug;
@@ -347,13 +348,13 @@ static int m920x_firmware_download(struct usb_device *udev, const struct firmwar
347 348
348 for (pass = 0; pass < 2; pass++) { 349 for (pass = 0; pass < 2; pass++) {
349 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) { 350 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) {
350 value = le16_to_cpu(*(u16 *)(fw->data + i)); 351 value = get_unaligned_le16(fw->data + i);
351 i += sizeof(u16); 352 i += sizeof(u16);
352 353
353 index = le16_to_cpu(*(u16 *)(fw->data + i)); 354 index = get_unaligned_le16(fw->data + i);
354 i += sizeof(u16); 355 i += sizeof(u16);
355 356
356 size = le16_to_cpu(*(u16 *)(fw->data + i)); 357 size = get_unaligned_le16(fw->data + i);
357 i += sizeof(u16); 358 i += sizeof(u16);
358 359
359 if (pass == 1) { 360 if (pass == 1) {
diff --git a/drivers/media/dvb/frontends/dib0070.h b/drivers/media/dvb/frontends/dib0070.h
index 786e37d33889..3eedfdf505bc 100644
--- a/drivers/media/dvb/frontends/dib0070.h
+++ b/drivers/media/dvb/frontends/dib0070.h
@@ -37,7 +37,20 @@ struct dib0070_config {
37 u8 flip_chip; 37 u8 flip_chip;
38}; 38};
39 39
40extern struct dvb_frontend * dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg); 40#if defined(CONFIG_DVB_TUNER_DIB0070) || (defined(CONFIG_DVB_TUNER_DIB0070_MODULE) && defined(MODULE))
41extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe,
42 struct i2c_adapter *i2c,
43 struct dib0070_config *cfg);
44#else
45static inline struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe,
46 struct i2c_adapter *i2c,
47 struct dib0070_config *cfg)
48{
49 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
50 return NULL;
51}
52#endif
53
41extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, uint8_t open); 54extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, uint8_t open);
42extern u16 dib0070_wbd_offset(struct dvb_frontend *); 55extern u16 dib0070_wbd_offset(struct dvb_frontend *);
43 56
diff --git a/drivers/media/dvb/frontends/dib7000p.h b/drivers/media/dvb/frontends/dib7000p.h
index 081bd81f3da2..07c4d12ed5b7 100644
--- a/drivers/media/dvb/frontends/dib7000p.h
+++ b/drivers/media/dvb/frontends/dib7000p.h
@@ -37,7 +37,20 @@ struct dib7000p_config {
37 37
38#define DEFAULT_DIB7000P_I2C_ADDRESS 18 38#define DEFAULT_DIB7000P_I2C_ADDRESS 18
39 39
40extern struct dvb_frontend * dib7000p_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg); 40#if defined(CONFIG_DVB_DIB7000P) || (defined(CONFIG_DVB_DIB7000P_MODULE) && defined(MODULE))
41extern struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap,
42 u8 i2c_addr,
43 struct dib7000p_config *cfg);
44#else
45static inline struct dvb_frontend *dib7000p_attach(struct i2c_adapter *i2c_adap,
46 u8 i2c_addr,
47 struct dib7000p_config *cfg)
48{
49 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
50 return NULL;
51}
52#endif
53
41extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]); 54extern int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib7000p_config cfg[]);
42 55
43extern struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int); 56extern struct i2c_adapter * dib7000p_get_i2c_master(struct dvb_frontend *, enum dibx000_i2c_interface, int);
diff --git a/drivers/media/dvb/frontends/or51132.c b/drivers/media/dvb/frontends/or51132.c
index c7b5785f81f2..5ed32544de39 100644
--- a/drivers/media/dvb/frontends/or51132.c
+++ b/drivers/media/dvb/frontends/or51132.c
@@ -126,7 +126,7 @@ static int or51132_readreg(struct or51132_state *state, u8 reg)
126 reg, err); 126 reg, err);
127 return -EREMOTEIO; 127 return -EREMOTEIO;
128 } 128 }
129 return le16_to_cpup((u16*)buf); 129 return buf[0] | (buf[1] << 8);
130} 130}
131 131
132static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware *fw) 132static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware *fw)
@@ -140,9 +140,9 @@ static int or51132_load_firmware (struct dvb_frontend* fe, const struct firmware
140 dprintk("Firmware is %Zd bytes\n",fw->size); 140 dprintk("Firmware is %Zd bytes\n",fw->size);
141 141
142 /* Get size of firmware A and B */ 142 /* Get size of firmware A and B */
143 firmwareAsize = le32_to_cpu(*((u32*)fw->data)); 143 firmwareAsize = le32_to_cpu(*((__le32*)fw->data));
144 dprintk("FirmwareA is %i bytes\n",firmwareAsize); 144 dprintk("FirmwareA is %i bytes\n",firmwareAsize);
145 firmwareBsize = le32_to_cpu(*((u32*)(fw->data+4))); 145 firmwareBsize = le32_to_cpu(*((__le32*)(fw->data+4)));
146 dprintk("FirmwareB is %i bytes\n",firmwareBsize); 146 dprintk("FirmwareB is %i bytes\n",firmwareBsize);
147 147
148 /* Upload firmware */ 148 /* Upload firmware */
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 747e7f1a6267..f05d43d8b5cf 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -51,6 +51,7 @@
51#include <linux/crc32.h> 51#include <linux/crc32.h>
52#include <linux/i2c.h> 52#include <linux/i2c.h>
53#include <linux/kthread.h> 53#include <linux/kthread.h>
54#include <asm/unaligned.h>
54 55
55#include <asm/system.h> 56#include <asm/system.h>
56 57
@@ -1461,9 +1462,9 @@ static int check_firmware(struct av7110* av7110)
1461 ptr += 4; 1462 ptr += 4;
1462 1463
1463 /* check dpram file */ 1464 /* check dpram file */
1464 crc = ntohl(*(u32*) ptr); 1465 crc = get_unaligned_be32(ptr);
1465 ptr += 4; 1466 ptr += 4;
1466 len = ntohl(*(u32*) ptr); 1467 len = get_unaligned_be32(ptr);
1467 ptr += 4; 1468 ptr += 4;
1468 if (len >= 512) { 1469 if (len >= 512) {
1469 printk("dvb-ttpci: dpram file is way too big.\n"); 1470 printk("dvb-ttpci: dpram file is way too big.\n");
@@ -1478,9 +1479,9 @@ static int check_firmware(struct av7110* av7110)
1478 ptr += len; 1479 ptr += len;
1479 1480
1480 /* check root file */ 1481 /* check root file */
1481 crc = ntohl(*(u32*) ptr); 1482 crc = get_unaligned_be32(ptr);
1482 ptr += 4; 1483 ptr += 4;
1483 len = ntohl(*(u32*) ptr); 1484 len = get_unaligned_be32(ptr);
1484 ptr += 4; 1485 ptr += 4;
1485 1486
1486 if (len <= 200000 || len >= 300000 || 1487 if (len <= 200000 || len >= 300000 ||
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index 3e6b650fbb81..ec55a968f204 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -965,8 +965,9 @@ static u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x
965 965
966static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock) 966static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len, int nonblock)
967{ 967{
968 int i, n; 968 unsigned i, n;
969 int progressive = 0; 969 int progressive = 0;
970 int match = 0;
970 971
971 dprintk(2, "av7110:%p, \n", av7110); 972 dprintk(2, "av7110:%p, \n", av7110);
972 973
@@ -975,12 +976,31 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len
975 return -EBUSY; 976 return -EBUSY;
976 } 977 }
977 978
978 for (i = 0; i < len - 5; i++) { 979 /* search in buf for instances of 00 00 01 b5 1? */
979 /* get progressive flag from picture extension */ 980 for (i = 0; i < len; i++) {
980 if (buf[i] == 0x00 && buf[i+1] == 0x00 && 981 unsigned char c;
981 buf[i+2] == 0x01 && (unsigned char)buf[i+3] == 0xb5 && 982 if (get_user(c, buf + i))
982 (buf[i+4] & 0xf0) == 0x10) 983 return -EFAULT;
983 progressive = buf[i+5] & 0x08; 984 if (match == 5) {
985 progressive = c & 0x08;
986 match = 0;
987 }
988 if (c == 0x00) {
989 match = (match == 1 || match == 2) ? 2 : 1;
990 continue;
991 }
992 switch (match++) {
993 case 2: if (c == 0x01)
994 continue;
995 break;
996 case 3: if (c == 0xb5)
997 continue;
998 break;
999 case 4: if ((c & 0xf0) == 0x10)
1000 continue;
1001 break;
1002 }
1003 match = 0;
984 } 1004 }
985 1005
986 /* setting n always > 1, fixes problems when playing stillframes 1006 /* setting n always > 1, fixes problems when playing stillframes
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 732ce4de512e..5d2d81ab2371 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -552,7 +552,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack,
552 u16 csum = 0, cc; 552 u16 csum = 0, cc;
553 int i; 553 int i;
554 for (i = 0; i < len; i += 2) 554 for (i = 0; i < len; i += 2)
555 csum ^= le16_to_cpup((u16 *) (muxpack + i)); 555 csum ^= le16_to_cpup((__le16 *) (muxpack + i));
556 if (csum) { 556 if (csum) {
557 printk("%s: muxpack with incorrect checksum, ignoring\n", 557 printk("%s: muxpack with incorrect checksum, ignoring\n",
558 __func__); 558 __func__);
diff --git a/drivers/media/dvb/ttusb-dec/Kconfig b/drivers/media/dvb/ttusb-dec/Kconfig
index 0712899e39a4..a23cc0aa17d3 100644
--- a/drivers/media/dvb/ttusb-dec/Kconfig
+++ b/drivers/media/dvb/ttusb-dec/Kconfig
@@ -1,6 +1,6 @@
1config DVB_TTUSB_DEC 1config DVB_TTUSB_DEC
2 tristate "Technotrend/Hauppauge USB DEC devices" 2 tristate "Technotrend/Hauppauge USB DEC devices"
3 depends on DVB_CORE && USB 3 depends on DVB_CORE && USB && INPUT
4 depends on HOTPLUG # due to FW_LOADER 4 depends on HOTPLUG # due to FW_LOADER
5 select FW_LOADER 5 select FW_LOADER
6 select CRC32 6 select CRC32
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index 42eee04daa5d..fefdc05e84ac 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -343,7 +343,7 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode,
343 u8 c[COMMAND_PACKET_SIZE]; 343 u8 c[COMMAND_PACKET_SIZE];
344 int c_length; 344 int c_length;
345 int result; 345 int result;
346 unsigned int tmp; 346 __be32 tmp;
347 347
348 dprintk("%s\n", __func__); 348 dprintk("%s\n", __func__);
349 349
@@ -398,9 +398,9 @@ static void ttusb_dec_set_pids(struct ttusb_dec *dec)
398 0x00, 0x00, 0xff, 0xff, 398 0x00, 0x00, 0xff, 0xff,
399 0xff, 0xff, 0xff, 0xff }; 399 0xff, 0xff, 0xff, 0xff };
400 400
401 u16 pcr = htons(dec->pid[DMX_PES_PCR]); 401 __be16 pcr = htons(dec->pid[DMX_PES_PCR]);
402 u16 audio = htons(dec->pid[DMX_PES_AUDIO]); 402 __be16 audio = htons(dec->pid[DMX_PES_AUDIO]);
403 u16 video = htons(dec->pid[DMX_PES_VIDEO]); 403 __be16 video = htons(dec->pid[DMX_PES_VIDEO]);
404 404
405 dprintk("%s\n", __func__); 405 dprintk("%s\n", __func__);
406 406
@@ -435,7 +435,7 @@ static void ttusb_dec_process_pva(struct ttusb_dec *dec, u8 *pva, int length)
435 case 0x01: { /* VideoStream */ 435 case 0x01: { /* VideoStream */
436 int prebytes = pva[5] & 0x03; 436 int prebytes = pva[5] & 0x03;
437 int postbytes = (pva[5] & 0x0c) >> 2; 437 int postbytes = (pva[5] & 0x0c) >> 2;
438 u16 v_pes_payload_length; 438 __be16 v_pes_payload_length;
439 439
440 if (output_pva) { 440 if (output_pva) {
441 dec->video_filter->feed->cb.ts(pva, length, NULL, 0, 441 dec->video_filter->feed->cb.ts(pva, length, NULL, 0,
@@ -1006,7 +1006,7 @@ static int ttusb_dec_start_sec_feed(struct dvb_demux_feed *dvbdmxfeed)
1006 0x00, 0x00, 0x00, 0x00, 1006 0x00, 0x00, 0x00, 0x00,
1007 0x00, 0x00, 0x00, 0x00, 1007 0x00, 0x00, 0x00, 0x00,
1008 0x00 }; 1008 0x00 };
1009 u16 pid; 1009 __be16 pid;
1010 u8 c[COMMAND_PACKET_SIZE]; 1010 u8 c[COMMAND_PACKET_SIZE];
1011 int c_length; 1011 int c_length;
1012 int result; 1012 int result;
@@ -1278,9 +1278,10 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
1278 u8 *firmware = NULL; 1278 u8 *firmware = NULL;
1279 size_t firmware_size = 0; 1279 size_t firmware_size = 0;
1280 u16 firmware_csum = 0; 1280 u16 firmware_csum = 0;
1281 u16 firmware_csum_ns; 1281 __be16 firmware_csum_ns;
1282 u32 firmware_size_nl; 1282 __be32 firmware_size_nl;
1283 u32 crc32_csum, crc32_check, tmp; 1283 u32 crc32_csum, crc32_check;
1284 __be32 tmp;
1284 const struct firmware *fw_entry = NULL; 1285 const struct firmware *fw_entry = NULL;
1285 1286
1286 dprintk("%s\n", __func__); 1287 dprintk("%s\n", __func__);
@@ -1306,7 +1307,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
1306 valid. */ 1307 valid. */
1307 crc32_csum = crc32(~0L, firmware, 56) ^ ~0L; 1308 crc32_csum = crc32(~0L, firmware, 56) ^ ~0L;
1308 memcpy(&tmp, &firmware[56], 4); 1309 memcpy(&tmp, &firmware[56], 4);
1309 crc32_check = htonl(tmp); 1310 crc32_check = ntohl(tmp);
1310 if (crc32_csum != crc32_check) { 1311 if (crc32_csum != crc32_check) {
1311 printk("%s: crc32 check of DSP code failed (calculated " 1312 printk("%s: crc32 check of DSP code failed (calculated "
1312 "0x%08x != 0x%08x in file), file invalid.\n", 1313 "0x%08x != 0x%08x in file), file invalid.\n",
@@ -1627,7 +1628,7 @@ static int ttusb_dec_probe(struct usb_interface *intf,
1627 1628
1628 usb_set_intfdata(intf, (void *)dec); 1629 usb_set_intfdata(intf, (void *)dec);
1629 1630
1630 switch (le16_to_cpu(id->idProduct)) { 1631 switch (id->idProduct) {
1631 case 0x1006: 1632 case 0x1006:
1632 ttusb_dec_set_model(dec, TTUSB_DEC3000S); 1633 ttusb_dec_set_model(dec, TTUSB_DEC3000S);
1633 break; 1634 break;
@@ -1652,7 +1653,7 @@ static int ttusb_dec_probe(struct usb_interface *intf,
1652 ttusb_dec_init_dvb(dec); 1653 ttusb_dec_init_dvb(dec);
1653 1654
1654 dec->adapter.priv = dec; 1655 dec->adapter.priv = dec;
1655 switch (le16_to_cpu(id->idProduct)) { 1656 switch (id->idProduct) {
1656 case 0x1006: 1657 case 0x1006:
1657 dec->fe = ttusbdecfe_dvbs_attach(&fe_config); 1658 dec->fe = ttusbdecfe_dvbs_attach(&fe_config);
1658 break; 1659 break;
diff --git a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
index eb5eaeccd7c4..443af24097f3 100644
--- a/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
+++ b/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
@@ -86,7 +86,7 @@ static int ttusbdecfe_dvbt_set_frontend(struct dvb_frontend* fe, struct dvb_fron
86 0x00, 0x00, 0x00, 0xff, 86 0x00, 0x00, 0x00, 0xff,
87 0x00, 0x00, 0x00, 0xff }; 87 0x00, 0x00, 0x00, 0xff };
88 88
89 u32 freq = htonl(p->frequency / 1000); 89 __be32 freq = htonl(p->frequency / 1000);
90 memcpy(&b[4], &freq, sizeof (u32)); 90 memcpy(&b[4], &freq, sizeof (u32));
91 state->config->send_command(fe, 0x71, sizeof(b), b, NULL, NULL); 91 state->config->send_command(fe, 0x71, sizeof(b), b, NULL, NULL);
92 92
@@ -117,10 +117,10 @@ static int ttusbdecfe_dvbs_set_frontend(struct dvb_frontend* fe, struct dvb_fron
117 0x00, 0x00, 0x00, 0x00, 117 0x00, 0x00, 0x00, 0x00,
118 0x00, 0x00, 0x00, 0x00, 118 0x00, 0x00, 0x00, 0x00,
119 0x00, 0x00, 0x00, 0x00 }; 119 0x00, 0x00, 0x00, 0x00 };
120 u32 freq; 120 __be32 freq;
121 u32 sym_rate; 121 __be32 sym_rate;
122 u32 band; 122 __be32 band;
123 u32 lnb_voltage; 123 __be32 lnb_voltage;
124 124
125 freq = htonl(p->frequency + 125 freq = htonl(p->frequency +
126 (state->hi_band ? LOF_HI : LOF_LO)); 126 (state->hi_band ? LOF_HI : LOF_LO));