aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/common/saa7146_core.c6
-rw-r--r--drivers/media/common/saa7146_fops.c32
-rw-r--r--drivers/media/common/saa7146_i2c.c16
-rw-r--r--drivers/media/common/saa7146_vbi.c4
-rw-r--r--drivers/media/common/saa7146_video.c46
-rw-r--r--drivers/media/dvb/dvb-core/demux.h92
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c2
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.h64
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ca_en50221.c2
-rw-r--r--drivers/media/dvb/dvb-core/dvb_filter.c332
-rw-r--r--drivers/media/dvb/dvb-core/dvb_filter.h102
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c8
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.h8
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c42
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ringbuffer.c262
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ringbuffer.h20
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c142
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.h6
-rw-r--r--drivers/media/video/bt832.c14
-rw-r--r--drivers/media/video/bttv-driver.c78
-rw-r--r--drivers/media/video/ir-kbd-i2c.c4
-rw-r--r--drivers/media/video/msp3400.c12
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c86
-rw-r--r--drivers/media/video/tda9887.c14
-rw-r--r--drivers/media/video/tvaudio.c14
-rw-r--r--drivers/media/video/tveeprom.c2
28 files changed, 717 insertions, 717 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 206cc2f61f26..2899d34e5f7e 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -174,8 +174,8 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt)
174 174
175int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) 175int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
176{ 176{
177 u32 *cpu; 177 u32 *cpu;
178 dma_addr_t dma_addr; 178 dma_addr_t dma_addr;
179 179
180 cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr); 180 cpu = pci_alloc_consistent(pci, PAGE_SIZE, &dma_addr);
181 if (NULL == cpu) { 181 if (NULL == cpu) {
@@ -405,7 +405,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
405 405
406 pci_set_drvdata(pci, dev); 406 pci_set_drvdata(pci, dev);
407 407
408 init_MUTEX(&dev->lock); 408 init_MUTEX(&dev->lock);
409 spin_lock_init(&dev->int_slock); 409 spin_lock_init(&dev->int_slock);
410 spin_lock_init(&dev->slock); 410 spin_lock_init(&dev->slock);
411 411
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index 37888989ea2e..09ec964dec5c 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -1,6 +1,6 @@
1#include <media/saa7146_vv.h> 1#include <media/saa7146_vv.h>
2 2
3#define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) 3#define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1)
4 4
5/****************************************************************************/ 5/****************************************************************************/
6/* resource management functions, shamelessly stolen from saa7134 driver */ 6/* resource management functions, shamelessly stolen from saa7134 driver */
@@ -102,9 +102,9 @@ void saa7146_buffer_finish(struct saa7146_dev *dev,
102 /* finish current buffer */ 102 /* finish current buffer */
103 if (NULL == q->curr) { 103 if (NULL == q->curr) {
104 DEB_D(("aiii. no current buffer\n")); 104 DEB_D(("aiii. no current buffer\n"));
105 return; 105 return;
106 } 106 }
107 107
108 q->curr->vb.state = state; 108 q->curr->vb.state = state;
109 do_gettimeofday(&q->curr->vb.ts); 109 do_gettimeofday(&q->curr->vb.ts);
110 wake_up(&q->curr->vb.done); 110 wake_up(&q->curr->vb.done);
@@ -143,13 +143,13 @@ void saa7146_buffer_next(struct saa7146_dev *dev,
143 // fixme: fix this for vflip != 0 143 // fixme: fix this for vflip != 0
144 144
145 saa7146_write(dev, PROT_ADDR1, 0); 145 saa7146_write(dev, PROT_ADDR1, 0);
146 saa7146_write(dev, MC2, (MASK_02|MASK_18)); 146 saa7146_write(dev, MC2, (MASK_02|MASK_18));
147 147
148 /* write the address of the rps-program */ 148 /* write the address of the rps-program */
149 saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle); 149 saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle);
150 /* turn on rps */ 150 /* turn on rps */
151 saa7146_write(dev, MC1, (MASK_12 | MASK_28)); 151 saa7146_write(dev, MC1, (MASK_12 | MASK_28));
152 152
153/* 153/*
154 printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1)); 154 printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1));
155 printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1)); 155 printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1));
@@ -246,7 +246,7 @@ static int fops_open(struct inode *inode, struct file *file)
246 goto out; 246 goto out;
247 } 247 }
248 memset(fh,0,sizeof(*fh)); 248 memset(fh,0,sizeof(*fh));
249 249
250 file->private_data = fh; 250 file->private_data = fh;
251 fh->dev = dev; 251 fh->dev = dev;
252 fh->type = type; 252 fh->type = type;
@@ -275,7 +275,7 @@ out:
275 file->private_data = NULL; 275 file->private_data = NULL;
276 } 276 }
277 up(&saa7146_devices_lock); 277 up(&saa7146_devices_lock);
278 return result; 278 return result;
279} 279}
280 280
281static int fops_release(struct inode *inode, struct file *file) 281static int fops_release(struct inode *inode, struct file *file)
@@ -405,7 +405,7 @@ static struct file_operations video_fops =
405static void vv_callback(struct saa7146_dev *dev, unsigned long status) 405static void vv_callback(struct saa7146_dev *dev, unsigned long status)
406{ 406{
407 u32 isr = status; 407 u32 isr = status;
408 408
409 DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status)); 409 DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status));
410 410
411 if (0 != (isr & (MASK_27))) { 411 if (0 != (isr & (MASK_27))) {
@@ -454,11 +454,11 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
454 handle different devices that might need different 454 handle different devices that might need different
455 configuration data) */ 455 configuration data) */
456 dev->ext_vv_data = ext_vv; 456 dev->ext_vv_data = ext_vv;
457 457
458 vv->video_minor = -1; 458 vv->video_minor = -1;
459 vv->vbi_minor = -1; 459 vv->vbi_minor = -1;
460 460
461 vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); 461 vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle);
462 if( NULL == vv->d_clipping.cpu_addr ) { 462 if( NULL == vv->d_clipping.cpu_addr ) {
463 ERR(("out of memory. aborting.\n")); 463 ERR(("out of memory. aborting.\n"));
464 kfree(vv); 464 kfree(vv);
@@ -468,7 +468,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
468 468
469 saa7146_video_uops.init(dev,vv); 469 saa7146_video_uops.init(dev,vv);
470 saa7146_vbi_uops.init(dev,vv); 470 saa7146_vbi_uops.init(dev,vv);
471 471
472 dev->vv_data = vv; 472 dev->vv_data = vv;
473 dev->vv_callback = &vv_callback; 473 dev->vv_callback = &vv_callback;
474 474
@@ -480,12 +480,12 @@ int saa7146_vv_release(struct saa7146_dev* dev)
480 struct saa7146_vv *vv = dev->vv_data; 480 struct saa7146_vv *vv = dev->vv_data;
481 481
482 DEB_EE(("dev:%p\n",dev)); 482 DEB_EE(("dev:%p\n",dev));
483 483
484 pci_free_consistent(dev->pci, SAA7146_RPS_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); 484 pci_free_consistent(dev->pci, SAA7146_RPS_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle);
485 kfree(vv); 485 kfree(vv);
486 dev->vv_data = NULL; 486 dev->vv_data = NULL;
487 dev->vv_callback = NULL; 487 dev->vv_callback = NULL;
488 488
489 return 0; 489 return 0;
490} 490}
491 491
@@ -498,7 +498,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
498 DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); 498 DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type));
499 499
500 // released by vfd->release 500 // released by vfd->release
501 vfd = video_device_alloc(); 501 vfd = video_device_alloc();
502 if (vfd == NULL) 502 if (vfd == NULL)
503 return -ENOMEM; 503 return -ENOMEM;
504 504
@@ -530,7 +530,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
530int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) 530int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev)
531{ 531{
532 struct saa7146_vv *vv = dev->vv_data; 532 struct saa7146_vv *vv = dev->vv_data;
533 533
534 DEB_EE(("dev:%p\n",dev)); 534 DEB_EE(("dev:%p\n",dev));
535 535
536 if( VFL_TYPE_GRABBER == (*vid)->type ) { 536 if( VFL_TYPE_GRABBER == (*vid)->type ) {
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c
index fec6beab8c28..8aabdd8fb3c5 100644
--- a/drivers/media/common/saa7146_i2c.c
+++ b/drivers/media/common/saa7146_i2c.c
@@ -276,8 +276,8 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
276 int i = 0, count = 0; 276 int i = 0, count = 0;
277 u32* buffer = dev->d_i2c.cpu_addr; 277 u32* buffer = dev->d_i2c.cpu_addr;
278 int err = 0; 278 int err = 0;
279 int address_err = 0; 279 int address_err = 0;
280 int short_delay = 0; 280 int short_delay = 0;
281 281
282 if (down_interruptible (&dev->i2c_lock)) 282 if (down_interruptible (&dev->i2c_lock))
283 return -ERESTARTSYS; 283 return -ERESTARTSYS;
@@ -325,7 +325,7 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
325 if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) { 325 if( 0 != (SAA7146_USE_I2C_IRQ & dev->ext->flags)) {
326 goto out; 326 goto out;
327 } 327 }
328 address_err++; 328 address_err++;
329 } 329 }
330 DEB_I2C(("error while sending message(s). starting again.\n")); 330 DEB_I2C(("error while sending message(s). starting again.\n"));
331 break; 331 break;
@@ -336,14 +336,14 @@ int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *msgs, in
336 break; 336 break;
337 } 337 }
338 338
339 /* delay a bit before retrying */ 339 /* delay a bit before retrying */
340 msleep(10); 340 msleep(10);
341 341
342 } while (err != num && retries--); 342 } while (err != num && retries--);
343 343
344 /* if every retry had an address error, exit right away */ 344 /* if every retry had an address error, exit right away */
345 if (address_err == retries) { 345 if (address_err == retries) {
346 goto out; 346 goto out;
347 } 347 }
348 348
349 /* if any things had to be read, get the results */ 349 /* if any things had to be read, get the results */
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c
index cb86a97fda1f..063986ec16b5 100644
--- a/drivers/media/common/saa7146_vbi.c
+++ b/drivers/media/common/saa7146_vbi.c
@@ -6,8 +6,8 @@ static int vbi_workaround(struct saa7146_dev *dev)
6{ 6{
7 struct saa7146_vv *vv = dev->vv_data; 7 struct saa7146_vv *vv = dev->vv_data;
8 8
9 u32 *cpu; 9 u32 *cpu;
10 dma_addr_t dma_addr; 10 dma_addr_t dma_addr;
11 11
12 int count = 0; 12 int count = 0;
13 int i; 13 int i;
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 8dd4d15ca36d..1d961023b837 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -150,23 +150,23 @@ static int try_win(struct saa7146_dev *dev, struct v4l2_window *win)
150 maxh = vv->standard->v_max_out; 150 maxh = vv->standard->v_max_out;
151 151
152 if (V4L2_FIELD_ANY == field) { 152 if (V4L2_FIELD_ANY == field) {
153 field = (win->w.height > maxh/2) 153 field = (win->w.height > maxh/2)
154 ? V4L2_FIELD_INTERLACED 154 ? V4L2_FIELD_INTERLACED
155 : V4L2_FIELD_TOP; 155 : V4L2_FIELD_TOP;
156 } 156 }
157 switch (field) { 157 switch (field) {
158 case V4L2_FIELD_TOP: 158 case V4L2_FIELD_TOP:
159 case V4L2_FIELD_BOTTOM: 159 case V4L2_FIELD_BOTTOM:
160 case V4L2_FIELD_ALTERNATE: 160 case V4L2_FIELD_ALTERNATE:
161 maxh = maxh / 2; 161 maxh = maxh / 2;
162 break; 162 break;
163 case V4L2_FIELD_INTERLACED: 163 case V4L2_FIELD_INTERLACED:
164 break; 164 break;
165 default: { 165 default: {
166 DEB_D(("no known field mode '%d'.\n",field)); 166 DEB_D(("no known field mode '%d'.\n",field));
167 return -EINVAL; 167 return -EINVAL;
168 }
168 } 169 }
169 }
170 170
171 win->field = field; 171 win->field = field;
172 if (win->w.width > maxw) 172 if (win->w.width > maxw)
@@ -887,7 +887,7 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
887 887
888 DEB_EE(("VIDIOC_QUERYCAP\n")); 888 DEB_EE(("VIDIOC_QUERYCAP\n"));
889 889
890 strcpy(cap->driver, "saa7146 v4l2"); 890 strcpy(cap->driver, "saa7146 v4l2");
891 strlcpy(cap->card, dev->ext->name, sizeof(cap->card)); 891 strlcpy(cap->card, dev->ext->name, sizeof(cap->card));
892 sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); 892 sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci));
893 cap->version = SAA7146_VERSION_CODE; 893 cap->version = SAA7146_VERSION_CODE;
@@ -1011,19 +1011,19 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1011 err = set_control(fh,arg); 1011 err = set_control(fh,arg);
1012 return err; 1012 return err;
1013 } 1013 }
1014 case VIDIOC_G_PARM: 1014 case VIDIOC_G_PARM:
1015 { 1015 {
1016 struct v4l2_streamparm *parm = arg; 1016 struct v4l2_streamparm *parm = arg;
1017 if( parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ) { 1017 if( parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ) {
1018 return -EINVAL; 1018 return -EINVAL;
1019 } 1019 }
1020 memset(&parm->parm.capture,0,sizeof(struct v4l2_captureparm)); 1020 memset(&parm->parm.capture,0,sizeof(struct v4l2_captureparm));
1021 parm->parm.capture.readbuffers = 1; 1021 parm->parm.capture.readbuffers = 1;
1022 // fixme: only for PAL! 1022 // fixme: only for PAL!
1023 parm->parm.capture.timeperframe.numerator = 1; 1023 parm->parm.capture.timeperframe.numerator = 1;
1024 parm->parm.capture.timeperframe.denominator = 25; 1024 parm->parm.capture.timeperframe.denominator = 25;
1025 return 0; 1025 return 0;
1026 } 1026 }
1027 case VIDIOC_G_FMT: 1027 case VIDIOC_G_FMT:
1028 { 1028 {
1029 struct v4l2_format *f = arg; 1029 struct v4l2_format *f = arg;
@@ -1383,7 +1383,7 @@ static struct videobuf_queue_ops video_qops = {
1383 1383
1384static void video_init(struct saa7146_dev *dev, struct saa7146_vv *vv) 1384static void video_init(struct saa7146_dev *dev, struct saa7146_vv *vv)
1385{ 1385{
1386 INIT_LIST_HEAD(&vv->video_q.queue); 1386 INIT_LIST_HEAD(&vv->video_q.queue);
1387 1387
1388 init_timer(&vv->video_q.timeout); 1388 init_timer(&vv->video_q.timeout);
1389 vv->video_q.timeout.function = saa7146_buffer_timeout; 1389 vv->video_q.timeout.function = saa7146_buffer_timeout;
diff --git a/drivers/media/dvb/dvb-core/demux.h b/drivers/media/dvb/dvb-core/demux.h
index 7d7b0067f228..9f025825b2d2 100644
--- a/drivers/media/dvb/dvb-core/demux.h
+++ b/drivers/media/dvb/dvb-core/demux.h
@@ -86,25 +86,25 @@ enum dmx_success {
86 86
87enum dmx_ts_pes 87enum dmx_ts_pes
88{ /* also send packets to decoder (if it exists) */ 88{ /* also send packets to decoder (if it exists) */
89 DMX_TS_PES_AUDIO0, 89 DMX_TS_PES_AUDIO0,
90 DMX_TS_PES_VIDEO0, 90 DMX_TS_PES_VIDEO0,
91 DMX_TS_PES_TELETEXT0, 91 DMX_TS_PES_TELETEXT0,
92 DMX_TS_PES_SUBTITLE0, 92 DMX_TS_PES_SUBTITLE0,
93 DMX_TS_PES_PCR0, 93 DMX_TS_PES_PCR0,
94 94
95 DMX_TS_PES_AUDIO1, 95 DMX_TS_PES_AUDIO1,
96 DMX_TS_PES_VIDEO1, 96 DMX_TS_PES_VIDEO1,
97 DMX_TS_PES_TELETEXT1, 97 DMX_TS_PES_TELETEXT1,
98 DMX_TS_PES_SUBTITLE1, 98 DMX_TS_PES_SUBTITLE1,
99 DMX_TS_PES_PCR1, 99 DMX_TS_PES_PCR1,
100 100
101 DMX_TS_PES_AUDIO2, 101 DMX_TS_PES_AUDIO2,
102 DMX_TS_PES_VIDEO2, 102 DMX_TS_PES_VIDEO2,
103 DMX_TS_PES_TELETEXT2, 103 DMX_TS_PES_TELETEXT2,
104 DMX_TS_PES_SUBTITLE2, 104 DMX_TS_PES_SUBTITLE2,
105 DMX_TS_PES_PCR2, 105 DMX_TS_PES_PCR2,
106 106
107 DMX_TS_PES_AUDIO3, 107 DMX_TS_PES_AUDIO3,
108 DMX_TS_PES_VIDEO3, 108 DMX_TS_PES_VIDEO3,
109 DMX_TS_PES_TELETEXT3, 109 DMX_TS_PES_TELETEXT3,
110 DMX_TS_PES_SUBTITLE3, 110 DMX_TS_PES_SUBTITLE3,
@@ -121,17 +121,17 @@ enum dmx_ts_pes
121 121
122 122
123struct dmx_ts_feed { 123struct dmx_ts_feed {
124 int is_filtering; /* Set to non-zero when filtering in progress */ 124 int is_filtering; /* Set to non-zero when filtering in progress */
125 struct dmx_demux *parent; /* Back-pointer */ 125 struct dmx_demux *parent; /* Back-pointer */
126 void *priv; /* Pointer to private data of the API client */ 126 void *priv; /* Pointer to private data of the API client */
127 int (*set) (struct dmx_ts_feed *feed, 127 int (*set) (struct dmx_ts_feed *feed,
128 u16 pid, 128 u16 pid,
129 int type, 129 int type,
130 enum dmx_ts_pes pes_type, 130 enum dmx_ts_pes pes_type,
131 size_t circular_buffer_size, 131 size_t circular_buffer_size,
132 struct timespec timeout); 132 struct timespec timeout);
133 int (*start_filtering) (struct dmx_ts_feed* feed); 133 int (*start_filtering) (struct dmx_ts_feed* feed);
134 int (*stop_filtering) (struct dmx_ts_feed* feed); 134 int (*stop_filtering) (struct dmx_ts_feed* feed);
135}; 135};
136 136
137/*--------------------------------------------------------------------------*/ 137/*--------------------------------------------------------------------------*/
@@ -139,35 +139,35 @@ struct dmx_ts_feed {
139/*--------------------------------------------------------------------------*/ 139/*--------------------------------------------------------------------------*/
140 140
141struct dmx_section_filter { 141struct dmx_section_filter {
142 u8 filter_value [DMX_MAX_FILTER_SIZE]; 142 u8 filter_value [DMX_MAX_FILTER_SIZE];
143 u8 filter_mask [DMX_MAX_FILTER_SIZE]; 143 u8 filter_mask [DMX_MAX_FILTER_SIZE];
144 u8 filter_mode [DMX_MAX_FILTER_SIZE]; 144 u8 filter_mode [DMX_MAX_FILTER_SIZE];
145 struct dmx_section_feed* parent; /* Back-pointer */ 145 struct dmx_section_feed* parent; /* Back-pointer */
146 void* priv; /* Pointer to private data of the API client */ 146 void* priv; /* Pointer to private data of the API client */
147}; 147};
148 148
149struct dmx_section_feed { 149struct dmx_section_feed {
150 int is_filtering; /* Set to non-zero when filtering in progress */ 150 int is_filtering; /* Set to non-zero when filtering in progress */
151 struct dmx_demux* parent; /* Back-pointer */ 151 struct dmx_demux* parent; /* Back-pointer */
152 void* priv; /* Pointer to private data of the API client */ 152 void* priv; /* Pointer to private data of the API client */
153 153
154 int check_crc; 154 int check_crc;
155 u32 crc_val; 155 u32 crc_val;
156 156
157 u8 *secbuf; 157 u8 *secbuf;
158 u8 secbuf_base[DMX_MAX_SECFEED_SIZE]; 158 u8 secbuf_base[DMX_MAX_SECFEED_SIZE];
159 u16 secbufp, seclen, tsfeedp; 159 u16 secbufp, seclen, tsfeedp;
160 160
161 int (*set) (struct dmx_section_feed* feed, 161 int (*set) (struct dmx_section_feed* feed,
162 u16 pid, 162 u16 pid,
163 size_t circular_buffer_size, 163 size_t circular_buffer_size,
164 int check_crc); 164 int check_crc);
165 int (*allocate_filter) (struct dmx_section_feed* feed, 165 int (*allocate_filter) (struct dmx_section_feed* feed,
166 struct dmx_section_filter** filter); 166 struct dmx_section_filter** filter);
167 int (*release_filter) (struct dmx_section_feed* feed, 167 int (*release_filter) (struct dmx_section_feed* feed,
168 struct dmx_section_filter* filter); 168 struct dmx_section_filter* filter);
169 int (*start_filtering) (struct dmx_section_feed* feed); 169 int (*start_filtering) (struct dmx_section_feed* feed);
170 int (*stop_filtering) (struct dmx_section_feed* feed); 170 int (*stop_filtering) (struct dmx_section_feed* feed);
171}; 171};
172 172
173/*--------------------------------------------------------------------------*/ 173/*--------------------------------------------------------------------------*/
@@ -205,10 +205,10 @@ enum dmx_frontend_source {
205}; 205};
206 206
207struct dmx_frontend { 207struct dmx_frontend {
208 struct list_head connectivity_list; /* List of front-ends that can 208 struct list_head connectivity_list; /* List of front-ends that can
209 be connected to a particular 209 be connected to a particular
210 demux */ 210 demux */
211 enum dmx_frontend_source source; 211 enum dmx_frontend_source source;
212}; 212};
213 213
214/*--------------------------------------------------------------------------*/ 214/*--------------------------------------------------------------------------*/
@@ -240,38 +240,38 @@ struct dmx_frontend {
240#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list) 240#define DMX_FE_ENTRY(list) list_entry(list, struct dmx_frontend, connectivity_list)
241 241
242struct dmx_demux { 242struct dmx_demux {
243 u32 capabilities; /* Bitfield of capability flags */ 243 u32 capabilities; /* Bitfield of capability flags */
244 struct dmx_frontend* frontend; /* Front-end connected to the demux */ 244 struct dmx_frontend* frontend; /* Front-end connected to the demux */
245 void* priv; /* Pointer to private data of the API client */ 245 void* priv; /* Pointer to private data of the API client */
246 int (*open) (struct dmx_demux* demux); 246 int (*open) (struct dmx_demux* demux);
247 int (*close) (struct dmx_demux* demux); 247 int (*close) (struct dmx_demux* demux);
248 int (*write) (struct dmx_demux* demux, const char* buf, size_t count); 248 int (*write) (struct dmx_demux* demux, const char* buf, size_t count);
249 int (*allocate_ts_feed) (struct dmx_demux* demux, 249 int (*allocate_ts_feed) (struct dmx_demux* demux,
250 struct dmx_ts_feed** feed, 250 struct dmx_ts_feed** feed,
251 dmx_ts_cb callback); 251 dmx_ts_cb callback);
252 int (*release_ts_feed) (struct dmx_demux* demux, 252 int (*release_ts_feed) (struct dmx_demux* demux,
253 struct dmx_ts_feed* feed); 253 struct dmx_ts_feed* feed);
254 int (*allocate_section_feed) (struct dmx_demux* demux, 254 int (*allocate_section_feed) (struct dmx_demux* demux,
255 struct dmx_section_feed** feed, 255 struct dmx_section_feed** feed,
256 dmx_section_cb callback); 256 dmx_section_cb callback);
257 int (*release_section_feed) (struct dmx_demux* demux, 257 int (*release_section_feed) (struct dmx_demux* demux,
258 struct dmx_section_feed* feed); 258 struct dmx_section_feed* feed);
259 int (*add_frontend) (struct dmx_demux* demux, 259 int (*add_frontend) (struct dmx_demux* demux,
260 struct dmx_frontend* frontend); 260 struct dmx_frontend* frontend);
261 int (*remove_frontend) (struct dmx_demux* demux, 261 int (*remove_frontend) (struct dmx_demux* demux,
262 struct dmx_frontend* frontend); 262 struct dmx_frontend* frontend);
263 struct list_head* (*get_frontends) (struct dmx_demux* demux); 263 struct list_head* (*get_frontends) (struct dmx_demux* demux);
264 int (*connect_frontend) (struct dmx_demux* demux, 264 int (*connect_frontend) (struct dmx_demux* demux,
265 struct dmx_frontend* frontend); 265 struct dmx_frontend* frontend);
266 int (*disconnect_frontend) (struct dmx_demux* demux); 266 int (*disconnect_frontend) (struct dmx_demux* demux);
267 267
268 int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids); 268 int (*get_pes_pids) (struct dmx_demux* demux, u16 *pids);
269 269
270 int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps); 270 int (*get_caps) (struct dmx_demux* demux, struct dmx_caps *caps);
271 271
272 int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src); 272 int (*set_source) (struct dmx_demux* demux, const dmx_source_t *src);
273 273
274 int (*get_stc) (struct dmx_demux* demux, unsigned int num, 274 int (*get_stc) (struct dmx_demux* demux, unsigned int num,
275 u64 *stc, unsigned int *base); 275 u64 *stc, unsigned int *base);
276}; 276};
277 277
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 8028c3a5e287..7b8373ad121b 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -947,7 +947,7 @@ static int dvb_demux_do_ioctl(struct inode *inode, struct file *file,
947 947
948 case DMX_GET_STC: 948 case DMX_GET_STC:
949 if (!dmxdev->demux->get_stc) { 949 if (!dmxdev->demux->get_stc) {
950 ret=-EINVAL; 950 ret=-EINVAL;
951 break; 951 break;
952 } 952 }
953 ret = dmxdev->demux->get_stc(dmxdev->demux, 953 ret = dmxdev->demux->get_stc(dmxdev->demux,
diff --git a/drivers/media/dvb/dvb-core/dmxdev.h b/drivers/media/dvb/dvb-core/dmxdev.h
index 395a9cd75012..fd72920c2199 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.h
+++ b/drivers/media/dvb/dvb-core/dmxdev.h
@@ -53,51 +53,51 @@ enum dmxdev_state {
53}; 53};
54 54
55struct dmxdev_buffer { 55struct dmxdev_buffer {
56 u8 *data; 56 u8 *data;
57 int size; 57 int size;
58 int pread; 58 int pread;
59 int pwrite; 59 int pwrite;
60 wait_queue_head_t queue; 60 wait_queue_head_t queue;
61 int error; 61 int error;
62}; 62};
63 63
64struct dmxdev_filter { 64struct dmxdev_filter {
65 struct dvb_device *dvbdev; 65 struct dvb_device *dvbdev;
66 66
67 union { 67 union {
68 struct dmx_section_filter *sec; 68 struct dmx_section_filter *sec;
69 } filter; 69 } filter;
70 70
71 union { 71 union {
72 struct dmx_ts_feed *ts; 72 struct dmx_ts_feed *ts;
73 struct dmx_section_feed *sec; 73 struct dmx_section_feed *sec;
74 } feed; 74 } feed;
75 75
76 union { 76 union {
77 struct dmx_sct_filter_params sec; 77 struct dmx_sct_filter_params sec;
78 struct dmx_pes_filter_params pes; 78 struct dmx_pes_filter_params pes;
79 } params; 79 } params;
80 80
81 int type; 81 int type;
82 enum dmxdev_state state; 82 enum dmxdev_state state;
83 struct dmxdev *dev; 83 struct dmxdev *dev;
84 struct dmxdev_buffer buffer; 84 struct dmxdev_buffer buffer;
85 85
86 struct semaphore mutex; 86 struct semaphore mutex;
87 87
88 /* only for sections */ 88 /* only for sections */
89 struct timer_list timer; 89 struct timer_list timer;
90 int todo; 90 int todo;
91 u8 secheader[3]; 91 u8 secheader[3];
92 92
93 u16 pid; 93 u16 pid;
94}; 94};
95 95
96 96
97struct dmxdev_dvr { 97struct dmxdev_dvr {
98 int state; 98 int state;
99 struct dmxdev *dev; 99 struct dmxdev *dev;
100 struct dmxdev_buffer buffer; 100 struct dmxdev_buffer buffer;
101}; 101};
102 102
103 103
@@ -105,16 +105,16 @@ struct dmxdev {
105 struct dvb_device *dvbdev; 105 struct dvb_device *dvbdev;
106 struct dvb_device *dvr_dvbdev; 106 struct dvb_device *dvr_dvbdev;
107 107
108 struct dmxdev_filter *filter; 108 struct dmxdev_filter *filter;
109 struct dmxdev_dvr *dvr; 109 struct dmxdev_dvr *dvr;
110 struct dmx_demux *demux; 110 struct dmx_demux *demux;
111 111
112 int filternum; 112 int filternum;
113 int capabilities; 113 int capabilities;
114#define DMXDEV_CAP_DUPLEX 1 114#define DMXDEV_CAP_DUPLEX 1
115 struct dmx_frontend *dvr_orig_fe; 115 struct dmx_frontend *dvr_orig_fe;
116 116
117 struct dmxdev_buffer dvr_buffer; 117 struct dmxdev_buffer dvr_buffer;
118#define DVR_BUFFER_SIZE (10*188*1024) 118#define DVR_BUFFER_SIZE (10*188*1024)
119 119
120 struct semaphore mutex; 120 struct semaphore mutex;
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index cb2e7d6ba283..5956c35d34ac 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -498,7 +498,7 @@ static int dvb_ca_en50221_parse_attributes(struct dvb_ca_private *ca, int slot)
498 /* process the CFTABLE_ENTRY tuples, and any after those */ 498 /* process the CFTABLE_ENTRY tuples, and any after those */
499 while ((!end_chain) && (address < 0x1000)) { 499 while ((!end_chain) && (address < 0x1000)) {
500 if ((status = dvb_ca_en50221_read_tuple(ca, slot, &address, &tupleType, 500 if ((status = dvb_ca_en50221_read_tuple(ca, slot, &address, &tupleType,
501 &tupleLength, tuple)) < 0) 501 &tupleLength, tuple)) < 0)
502 return status; 502 return status;
503 switch (tupleType) { 503 switch (tupleType) {
504 case 0x1B: // CISTPL_CFTABLE_ENTRY 504 case 0x1B: // CISTPL_CFTABLE_ENTRY
diff --git a/drivers/media/dvb/dvb-core/dvb_filter.c b/drivers/media/dvb/dvb-core/dvb_filter.c
index bd5143906084..c49fd0bd7181 100644
--- a/drivers/media/dvb/dvb-core/dvb_filter.c
+++ b/drivers/media/dvb/dvb-core/dvb_filter.c
@@ -72,12 +72,12 @@ static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, in
72 u8 pct; 72 u8 pct;
73 73
74 if (pr) printk( "Pic header: "); 74 if (pr) printk( "Pic header: ");
75 pic->temporal_reference[field] = (( headr[0] << 2 ) | 75 pic->temporal_reference[field] = (( headr[0] << 2 ) |
76 (headr[1] & 0x03) )& 0x03ff; 76 (headr[1] & 0x03) )& 0x03ff;
77 if (pr) printk( " temp ref: 0x%04x", pic->temporal_reference[field]); 77 if (pr) printk( " temp ref: 0x%04x", pic->temporal_reference[field]);
78 78
79 pct = ( headr[1] >> 2 ) & 0x07; 79 pct = ( headr[1] >> 2 ) & 0x07;
80 pic->picture_coding_type[field] = pct; 80 pic->picture_coding_type[field] = pct;
81 if (pr) { 81 if (pr) {
82 switch(pct){ 82 switch(pct){
83 case I_FRAME: 83 case I_FRAME:
@@ -93,17 +93,17 @@ static int read_picture_header(u8 *headr, struct mpg_picture *pic, int field, in
93 } 93 }
94 94
95 95
96 pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) | 96 pic->vinfo.vbv_delay = (( headr[1] >> 5 ) | ( headr[2] << 3) |
97 ( (headr[3] & 0x1F) << 11) ) & 0xffff; 97 ( (headr[3] & 0x1F) << 11) ) & 0xffff;
98 98
99 if (pr) printk( " vbv delay: 0x%04x", pic->vinfo.vbv_delay); 99 if (pr) printk( " vbv delay: 0x%04x", pic->vinfo.vbv_delay);
100 100
101 pic->picture_header_parameter = ( headr[3] & 0xe0 ) | 101 pic->picture_header_parameter = ( headr[3] & 0xe0 ) |
102 ((headr[4] & 0x80) >> 3); 102 ((headr[4] & 0x80) >> 3);
103 103
104 if ( pct == B_FRAME ){ 104 if ( pct == B_FRAME ){
105 pic->picture_header_parameter |= ( headr[4] >> 3 ) & 0x0f; 105 pic->picture_header_parameter |= ( headr[4] >> 3 ) & 0x0f;
106 } 106 }
107 if (pr) printk( " pic head param: 0x%x", 107 if (pr) printk( " pic head param: 0x%x",
108 pic->picture_header_parameter); 108 pic->picture_header_parameter);
109 109
@@ -124,18 +124,18 @@ static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr)
124 ((headr[0]<<4)& 0x30)| ((headr[1]>>4)& 0x0F), 124 ((headr[0]<<4)& 0x30)| ((headr[1]>>4)& 0x0F),
125 ((headr[1]<<3)& 0x38)| ((headr[2]>>5)& 0x0F)); 125 ((headr[1]<<3)& 0x38)| ((headr[2]>>5)& 0x0F));
126 126
127 if ( ( headr[3] & 0x40 ) != 0 ){ 127 if ( ( headr[3] & 0x40 ) != 0 ){
128 pic->closed_gop = 1; 128 pic->closed_gop = 1;
129 } else { 129 } else {
130 pic->closed_gop = 0; 130 pic->closed_gop = 0;
131 } 131 }
132 if (pr) printk("closed: %d", pic->closed_gop); 132 if (pr) printk("closed: %d", pic->closed_gop);
133 133
134 if ( ( headr[3] & 0x20 ) != 0 ){ 134 if ( ( headr[3] & 0x20 ) != 0 ){
135 pic->broken_link = 1; 135 pic->broken_link = 1;
136 } else { 136 } else {
137 pic->broken_link = 0; 137 pic->broken_link = 0;
138 } 138 }
139 if (pr) printk(" broken: %d\n", pic->broken_link); 139 if (pr) printk(" broken: %d\n", pic->broken_link);
140 140
141 return 0; 141 return 0;
@@ -146,7 +146,7 @@ static int read_gop_header(u8 *headr, struct mpg_picture *pic, int pr)
146/* needs 8 byte input */ 146/* needs 8 byte input */
147static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr) 147static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
148{ 148{
149 int sw; 149 int sw;
150 int form = -1; 150 int form = -1;
151 151
152 if (pr) printk("Reading sequence header\n"); 152 if (pr) printk("Reading sequence header\n");
@@ -154,9 +154,9 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
154 vi->horizontal_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4); 154 vi->horizontal_size = ((headr[1] &0xF0) >> 4) | (headr[0] << 4);
155 vi->vertical_size = ((headr[1] &0x0F) << 8) | (headr[2]); 155 vi->vertical_size = ((headr[1] &0x0F) << 8) | (headr[2]);
156 156
157 sw = (int)((headr[3]&0xF0) >> 4) ; 157 sw = (int)((headr[3]&0xF0) >> 4) ;
158 158
159 switch( sw ){ 159 switch( sw ){
160 case 1: 160 case 1:
161 if (pr) 161 if (pr)
162 printk("Videostream: ASPECT: 1:1"); 162 printk("Videostream: ASPECT: 1:1");
@@ -165,84 +165,84 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
165 case 2: 165 case 2:
166 if (pr) 166 if (pr)
167 printk("Videostream: ASPECT: 4:3"); 167 printk("Videostream: ASPECT: 4:3");
168 vi->aspect_ratio = 133; 168 vi->aspect_ratio = 133;
169 break; 169 break;
170 case 3: 170 case 3:
171 if (pr) 171 if (pr)
172 printk("Videostream: ASPECT: 16:9"); 172 printk("Videostream: ASPECT: 16:9");
173 vi->aspect_ratio = 177; 173 vi->aspect_ratio = 177;
174 break; 174 break;
175 case 4: 175 case 4:
176 if (pr) 176 if (pr)
177 printk("Videostream: ASPECT: 2.21:1"); 177 printk("Videostream: ASPECT: 2.21:1");
178 vi->aspect_ratio = 221; 178 vi->aspect_ratio = 221;
179 break; 179 break;
180 180
181 case 5 ... 15: 181 case 5 ... 15:
182 if (pr) 182 if (pr)
183 printk("Videostream: ASPECT: reserved"); 183 printk("Videostream: ASPECT: reserved");
184 vi->aspect_ratio = 0; 184 vi->aspect_ratio = 0;
185 break; 185 break;
186 186
187 default: 187 default:
188 vi->aspect_ratio = 0; 188 vi->aspect_ratio = 0;
189 return -1; 189 return -1;
190 } 190 }
191 191
192 if (pr) 192 if (pr)
193 printk(" Size = %dx%d",vi->horizontal_size,vi->vertical_size); 193 printk(" Size = %dx%d",vi->horizontal_size,vi->vertical_size);
194 194
195 sw = (int)(headr[3]&0x0F); 195 sw = (int)(headr[3]&0x0F);
196 196
197 switch ( sw ) { 197 switch ( sw ) {
198 case 1: 198 case 1:
199 if (pr) 199 if (pr)
200 printk(" FRate: 23.976 fps"); 200 printk(" FRate: 23.976 fps");
201 vi->framerate = 23976; 201 vi->framerate = 23976;
202 form = -1; 202 form = -1;
203 break; 203 break;
204 case 2: 204 case 2:
205 if (pr) 205 if (pr)
206 printk(" FRate: 24 fps"); 206 printk(" FRate: 24 fps");
207 vi->framerate = 24000; 207 vi->framerate = 24000;
208 form = -1; 208 form = -1;
209 break; 209 break;
210 case 3: 210 case 3:
211 if (pr) 211 if (pr)
212 printk(" FRate: 25 fps"); 212 printk(" FRate: 25 fps");
213 vi->framerate = 25000; 213 vi->framerate = 25000;
214 form = VIDEO_MODE_PAL; 214 form = VIDEO_MODE_PAL;
215 break; 215 break;
216 case 4: 216 case 4:
217 if (pr) 217 if (pr)
218 printk(" FRate: 29.97 fps"); 218 printk(" FRate: 29.97 fps");
219 vi->framerate = 29970; 219 vi->framerate = 29970;
220 form = VIDEO_MODE_NTSC; 220 form = VIDEO_MODE_NTSC;
221 break; 221 break;
222 case 5: 222 case 5:
223 if (pr) 223 if (pr)
224 printk(" FRate: 30 fps"); 224 printk(" FRate: 30 fps");
225 vi->framerate = 30000; 225 vi->framerate = 30000;
226 form = VIDEO_MODE_NTSC; 226 form = VIDEO_MODE_NTSC;
227 break; 227 break;
228 case 6: 228 case 6:
229 if (pr) 229 if (pr)
230 printk(" FRate: 50 fps"); 230 printk(" FRate: 50 fps");
231 vi->framerate = 50000; 231 vi->framerate = 50000;
232 form = VIDEO_MODE_PAL; 232 form = VIDEO_MODE_PAL;
233 break; 233 break;
234 case 7: 234 case 7:
235 if (pr) 235 if (pr)
236 printk(" FRate: 60 fps"); 236 printk(" FRate: 60 fps");
237 vi->framerate = 60000; 237 vi->framerate = 60000;
238 form = VIDEO_MODE_NTSC; 238 form = VIDEO_MODE_NTSC;
239 break; 239 break;
240 } 240 }
241 241
242 vi->bit_rate = (headr[4] << 10) | (headr[5] << 2) | (headr[6] & 0x03); 242 vi->bit_rate = (headr[4] << 10) | (headr[5] << 2) | (headr[6] & 0x03);
243 243
244 vi->vbv_buffer_size 244 vi->vbv_buffer_size
245 = (( headr[6] & 0xF8) >> 3 ) | (( headr[7] & 0x1F )<< 5); 245 = (( headr[6] & 0xF8) >> 3 ) | (( headr[7] & 0x1F )<< 5);
246 246
247 if (pr){ 247 if (pr){
248 printk(" BRate: %d Mbit/s",4*(vi->bit_rate)/10000); 248 printk(" BRate: %d Mbit/s",4*(vi->bit_rate)/10000);
@@ -250,7 +250,7 @@ static int read_sequence_header(u8 *headr, struct dvb_video_info *vi, int pr)
250 printk("\n"); 250 printk("\n");
251 } 251 }
252 252
253 vi->video_format = form; 253 vi->video_format = form;
254 254
255 return 0; 255 return 0;
256} 256}
@@ -308,7 +308,7 @@ static int get_ainfo(u8 *mbuf, int count, struct dvb_audio_info *ai, int pr)
308 if (!found) return -1; 308 if (!found) return -1;
309 309
310 if (c+3 >= count) return -1; 310 if (c+3 >= count) return -1;
311 headr = mbuf+c; 311 headr = mbuf+c;
312 312
313 ai->layer = (headr[1] & 0x06) >> 1; 313 ai->layer = (headr[1] & 0x06) >> 1;
314 314
@@ -368,7 +368,7 @@ int dvb_filter_get_ac3info(u8 *mbuf, int count, struct dvb_audio_info *ai, int p
368 if (c+5 >= count) return -1; 368 if (c+5 >= count) return -1;
369 369
370 ai->layer = 0; // 0 for AC3 370 ai->layer = 0; // 0 for AC3
371 headr = mbuf+c+2; 371 headr = mbuf+c+2;
372 372
373 frame = (headr[2]&0x3f); 373 frame = (headr[2]&0x3f);
374 ai->bit_rate = ac3_bitrates[frame >> 1]*1000; 374 ai->bit_rate = ac3_bitrates[frame >> 1]*1000;
@@ -396,159 +396,159 @@ EXPORT_SYMBOL(dvb_filter_get_ac3info);
396#if 0 396#if 0
397static u8 *skip_pes_header(u8 **bufp) 397static u8 *skip_pes_header(u8 **bufp)
398{ 398{
399 u8 *inbuf = *bufp; 399 u8 *inbuf = *bufp;
400 u8 *buf = inbuf; 400 u8 *buf = inbuf;
401 u8 *pts = NULL; 401 u8 *pts = NULL;
402 int skip = 0; 402 int skip = 0;
403 403
404 static const int mpeg1_skip_table[16] = { 404 static const int mpeg1_skip_table[16] = {
405 1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff, 405 1, 0xffff, 5, 10, 0xffff, 0xffff, 0xffff, 0xffff,
406 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff 406 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
407 }; 407 };
408 408
409 409
410 if ((inbuf[6] & 0xc0) == 0x80){ /* mpeg2 */ 410 if ((inbuf[6] & 0xc0) == 0x80){ /* mpeg2 */
411 if (buf[7] & PTS_ONLY) 411 if (buf[7] & PTS_ONLY)
412 pts = buf+9; 412 pts = buf+9;
413 else pts = NULL; 413 else pts = NULL;
414 buf = inbuf + 9 + inbuf[8]; 414 buf = inbuf + 9 + inbuf[8];
415 } else { /* mpeg1 */ 415 } else { /* mpeg1 */
416 for (buf = inbuf + 6; *buf == 0xff; buf++) 416 for (buf = inbuf + 6; *buf == 0xff; buf++)
417 if (buf == inbuf + 6 + 16) { 417 if (buf == inbuf + 6 + 16) {
418 break; 418 break;
419 } 419 }
420 if ((*buf & 0xc0) == 0x40) 420 if ((*buf & 0xc0) == 0x40)
421 buf += 2; 421 buf += 2;
422 skip = mpeg1_skip_table [*buf >> 4]; 422 skip = mpeg1_skip_table [*buf >> 4];
423 if (skip == 5 || skip == 10) pts = buf; 423 if (skip == 5 || skip == 10) pts = buf;
424 else pts = NULL; 424 else pts = NULL;
425 425
426 buf += mpeg1_skip_table [*buf >> 4]; 426 buf += mpeg1_skip_table [*buf >> 4];
427 } 427 }
428 428
429 *bufp = buf; 429 *bufp = buf;
430 return pts; 430 return pts;
431} 431}
432#endif 432#endif
433 433
434#if 0 434#if 0
435static void initialize_quant_matrix( u32 *matrix ) 435static void initialize_quant_matrix( u32 *matrix )
436{ 436{
437 int i; 437 int i;
438 438
439 matrix[0] = 0x08101013; 439 matrix[0] = 0x08101013;
440 matrix[1] = 0x10131616; 440 matrix[1] = 0x10131616;
441 matrix[2] = 0x16161616; 441 matrix[2] = 0x16161616;
442 matrix[3] = 0x1a181a1b; 442 matrix[3] = 0x1a181a1b;
443 matrix[4] = 0x1b1b1a1a; 443 matrix[4] = 0x1b1b1a1a;
444 matrix[5] = 0x1a1a1b1b; 444 matrix[5] = 0x1a1a1b1b;
445 matrix[6] = 0x1b1d1d1d; 445 matrix[6] = 0x1b1d1d1d;
446 matrix[7] = 0x2222221d; 446 matrix[7] = 0x2222221d;
447 matrix[8] = 0x1d1d1b1b; 447 matrix[8] = 0x1d1d1b1b;
448 matrix[9] = 0x1d1d2020; 448 matrix[9] = 0x1d1d2020;
449 matrix[10] = 0x22222526; 449 matrix[10] = 0x22222526;
450 matrix[11] = 0x25232322; 450 matrix[11] = 0x25232322;
451 matrix[12] = 0x23262628; 451 matrix[12] = 0x23262628;
452 matrix[13] = 0x28283030; 452 matrix[13] = 0x28283030;
453 matrix[14] = 0x2e2e3838; 453 matrix[14] = 0x2e2e3838;
454 matrix[15] = 0x3a454553; 454 matrix[15] = 0x3a454553;
455 455
456 for ( i = 16 ; i < 32 ; i++ ) 456 for ( i = 16 ; i < 32 ; i++ )
457 matrix[i] = 0x10101010; 457 matrix[i] = 0x10101010;
458} 458}
459#endif 459#endif
460 460
461#if 0 461#if 0
462static void initialize_mpg_picture(struct mpg_picture *pic) 462static void initialize_mpg_picture(struct mpg_picture *pic)
463{ 463{
464 int i; 464 int i;
465 465
466 /* set MPEG1 */ 466 /* set MPEG1 */
467 pic->mpeg1_flag = 1; 467 pic->mpeg1_flag = 1;
468 pic->profile_and_level = 0x4A ; /* MP@LL */ 468 pic->profile_and_level = 0x4A ; /* MP@LL */
469 pic->progressive_sequence = 1; 469 pic->progressive_sequence = 1;
470 pic->low_delay = 0; 470 pic->low_delay = 0;
471 471
472 pic->sequence_display_extension_flag = 0; 472 pic->sequence_display_extension_flag = 0;
473 for ( i = 0 ; i < 4 ; i++ ){ 473 for ( i = 0 ; i < 4 ; i++ ){
474 pic->frame_centre_horizontal_offset[i] = 0; 474 pic->frame_centre_horizontal_offset[i] = 0;
475 pic->frame_centre_vertical_offset[i] = 0; 475 pic->frame_centre_vertical_offset[i] = 0;
476 } 476 }
477 pic->last_frame_centre_horizontal_offset = 0; 477 pic->last_frame_centre_horizontal_offset = 0;
478 pic->last_frame_centre_vertical_offset = 0; 478 pic->last_frame_centre_vertical_offset = 0;
479 479
480 pic->picture_display_extension_flag[0] = 0; 480 pic->picture_display_extension_flag[0] = 0;
481 pic->picture_display_extension_flag[1] = 0; 481 pic->picture_display_extension_flag[1] = 0;
482 pic->sequence_header_flag = 0; 482 pic->sequence_header_flag = 0;
483 pic->gop_flag = 0; 483 pic->gop_flag = 0;
484 pic->sequence_end_flag = 0; 484 pic->sequence_end_flag = 0;
485} 485}
486#endif 486#endif
487 487
488#if 0 488#if 0
489static void mpg_set_picture_parameter( int32_t field_type, struct mpg_picture *pic ) 489static void mpg_set_picture_parameter( int32_t field_type, struct mpg_picture *pic )
490{ 490{
491 int16_t last_h_offset; 491 int16_t last_h_offset;
492 int16_t last_v_offset; 492 int16_t last_v_offset;
493 493
494 int16_t *p_h_offset; 494 int16_t *p_h_offset;
495 int16_t *p_v_offset; 495 int16_t *p_v_offset;
496 496
497 if ( pic->mpeg1_flag ){ 497 if ( pic->mpeg1_flag ){
498 pic->picture_structure[field_type] = VIDEO_FRAME_PICTURE; 498 pic->picture_structure[field_type] = VIDEO_FRAME_PICTURE;
499 pic->top_field_first = 0; 499 pic->top_field_first = 0;
500 pic->repeat_first_field = 0; 500 pic->repeat_first_field = 0;
501 pic->progressive_frame = 1; 501 pic->progressive_frame = 1;
502 pic->picture_coding_parameter = 0x000010; 502 pic->picture_coding_parameter = 0x000010;
503 } 503 }
504 504
505 /* Reset flag */ 505 /* Reset flag */
506 pic->picture_display_extension_flag[field_type] = 0; 506 pic->picture_display_extension_flag[field_type] = 0;
507 507
508 last_h_offset = pic->last_frame_centre_horizontal_offset; 508 last_h_offset = pic->last_frame_centre_horizontal_offset;
509 last_v_offset = pic->last_frame_centre_vertical_offset; 509 last_v_offset = pic->last_frame_centre_vertical_offset;
510 if ( field_type == FIRST_FIELD ){ 510 if ( field_type == FIRST_FIELD ){
511 p_h_offset = pic->frame_centre_horizontal_offset; 511 p_h_offset = pic->frame_centre_horizontal_offset;
512 p_v_offset = pic->frame_centre_vertical_offset; 512 p_v_offset = pic->frame_centre_vertical_offset;
513 *p_h_offset = last_h_offset; 513 *p_h_offset = last_h_offset;
514 *(p_h_offset + 1) = last_h_offset; 514 *(p_h_offset + 1) = last_h_offset;
515 *(p_h_offset + 2) = last_h_offset; 515 *(p_h_offset + 2) = last_h_offset;
516 *p_v_offset = last_v_offset; 516 *p_v_offset = last_v_offset;
517 *(p_v_offset + 1) = last_v_offset; 517 *(p_v_offset + 1) = last_v_offset;
518 *(p_v_offset + 2) = last_v_offset; 518 *(p_v_offset + 2) = last_v_offset;
519 } else { 519 } else {
520 pic->frame_centre_horizontal_offset[3] = last_h_offset; 520 pic->frame_centre_horizontal_offset[3] = last_h_offset;
521 pic->frame_centre_vertical_offset[3] = last_v_offset; 521 pic->frame_centre_vertical_offset[3] = last_v_offset;
522 } 522 }
523} 523}
524#endif 524#endif
525 525
526#if 0 526#if 0
527static void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_type) 527static void init_mpg_picture( struct mpg_picture *pic, int chan, int32_t field_type)
528{ 528{
529 pic->picture_header = 0; 529 pic->picture_header = 0;
530 pic->sequence_header_data 530 pic->sequence_header_data
531 = ( INIT_HORIZONTAL_SIZE << 20 ) 531 = ( INIT_HORIZONTAL_SIZE << 20 )
532 | ( INIT_VERTICAL_SIZE << 8 ) 532 | ( INIT_VERTICAL_SIZE << 8 )
533 | ( INIT_ASPECT_RATIO << 4 ) 533 | ( INIT_ASPECT_RATIO << 4 )
534 | ( INIT_FRAME_RATE ); 534 | ( INIT_FRAME_RATE );
535 pic->mpeg1_flag = 0; 535 pic->mpeg1_flag = 0;
536 pic->vinfo.horizontal_size 536 pic->vinfo.horizontal_size
537 = INIT_DISP_HORIZONTAL_SIZE; 537 = INIT_DISP_HORIZONTAL_SIZE;
538 pic->vinfo.vertical_size 538 pic->vinfo.vertical_size
539 = INIT_DISP_VERTICAL_SIZE; 539 = INIT_DISP_VERTICAL_SIZE;
540 pic->picture_display_extension_flag[field_type] 540 pic->picture_display_extension_flag[field_type]
541 = 0; 541 = 0;
542 pic->pts_flag[field_type] = 0; 542 pic->pts_flag[field_type] = 0;
543 543
544 pic->sequence_gop_header = 0; 544 pic->sequence_gop_header = 0;
545 pic->picture_header = 0; 545 pic->picture_header = 0;
546 pic->sequence_header_flag = 0; 546 pic->sequence_header_flag = 0;
547 pic->gop_flag = 0; 547 pic->gop_flag = 0;
548 pic->sequence_end_flag = 0; 548 pic->sequence_end_flag = 0;
549 pic->sequence_display_extension_flag = 0; 549 pic->sequence_display_extension_flag = 0;
550 pic->last_frame_centre_horizontal_offset = 0; 550 pic->last_frame_centre_horizontal_offset = 0;
551 pic->last_frame_centre_vertical_offset = 0; 551 pic->last_frame_centre_vertical_offset = 0;
552 pic->channel = chan; 552 pic->channel = chan;
553} 553}
554#endif 554#endif
@@ -588,11 +588,11 @@ int dvb_filter_pes2ts(struct dvb_filter_pes2ts *p2ts, unsigned char *pes,
588 buf[1]&=~0x40; 588 buf[1]&=~0x40;
589 } 589 }
590 if (!len) 590 if (!len)
591 return 0; 591 return 0;
592 buf[3]=0x30|((p2ts->cc++)&0x0f); 592 buf[3]=0x30|((p2ts->cc++)&0x0f);
593 rest=183-len; 593 rest=183-len;
594 if (rest) { 594 if (rest) {
595 buf[5]=0x00; 595 buf[5]=0x00;
596 if (rest-1) 596 if (rest-1)
597 memset(buf+6, 0xff, rest-1); 597 memset(buf+6, 0xff, rest-1);
598 } 598 }
diff --git a/drivers/media/dvb/dvb-core/dvb_filter.h b/drivers/media/dvb/dvb-core/dvb_filter.h
index b0848f7836b7..375e3be184b1 100644
--- a/drivers/media/dvb/dvb-core/dvb_filter.h
+++ b/drivers/media/dvb/dvb-core/dvb_filter.h
@@ -29,8 +29,8 @@ typedef int (dvb_filter_pes2ts_cb_t) (void *, unsigned char *);
29 29
30struct dvb_filter_pes2ts { 30struct dvb_filter_pes2ts {
31 unsigned char buf[188]; 31 unsigned char buf[188];
32 unsigned char cc; 32 unsigned char cc;
33 dvb_filter_pes2ts_cb_t *cb; 33 dvb_filter_pes2ts_cb_t *cb;
34 void *priv; 34 void *priv;
35}; 35};
36 36
@@ -162,7 +162,7 @@ struct dvb_video_info {
162 u32 bit_rate; 162 u32 bit_rate;
163 u32 comp_bit_rate; 163 u32 comp_bit_rate;
164 u32 vbv_buffer_size; 164 u32 vbv_buffer_size;
165 s16 vbv_delay; 165 s16 vbv_delay;
166 u32 CSPF; 166 u32 CSPF;
167 u32 off; 167 u32 off;
168}; 168};
@@ -173,60 +173,60 @@ struct dvb_video_info {
173#define VIDEO_FRAME_PICTURE 0x03 173#define VIDEO_FRAME_PICTURE 0x03
174 174
175struct mpg_picture { 175struct mpg_picture {
176 int channel; 176 int channel;
177 struct dvb_video_info vinfo; 177 struct dvb_video_info vinfo;
178 u32 *sequence_gop_header; 178 u32 *sequence_gop_header;
179 u32 *picture_header; 179 u32 *picture_header;
180 s32 time_code; 180 s32 time_code;
181 int low_delay; 181 int low_delay;
182 int closed_gop; 182 int closed_gop;
183 int broken_link; 183 int broken_link;
184 int sequence_header_flag; 184 int sequence_header_flag;
185 int gop_flag; 185 int gop_flag;
186 int sequence_end_flag; 186 int sequence_end_flag;
187 187
188 u8 profile_and_level; 188 u8 profile_and_level;
189 s32 picture_coding_parameter; 189 s32 picture_coding_parameter;
190 u32 matrix[32]; 190 u32 matrix[32];
191 s8 matrix_change_flag; 191 s8 matrix_change_flag;
192 192
193 u8 picture_header_parameter; 193 u8 picture_header_parameter;
194 /* bit 0 - 2: bwd f code 194 /* bit 0 - 2: bwd f code
195 bit 3 : fpb vector 195 bit 3 : fpb vector
196 bit 4 - 6: fwd f code 196 bit 4 - 6: fwd f code
197 bit 7 : fpf vector */ 197 bit 7 : fpf vector */
198 198
199 int mpeg1_flag; 199 int mpeg1_flag;
200 int progressive_sequence; 200 int progressive_sequence;
201 int sequence_display_extension_flag; 201 int sequence_display_extension_flag;
202 u32 sequence_header_data; 202 u32 sequence_header_data;
203 s16 last_frame_centre_horizontal_offset; 203 s16 last_frame_centre_horizontal_offset;
204 s16 last_frame_centre_vertical_offset; 204 s16 last_frame_centre_vertical_offset;
205 205
206 u32 pts[2]; /* [0] 1st field, [1] 2nd field */ 206 u32 pts[2]; /* [0] 1st field, [1] 2nd field */
207 int top_field_first; 207 int top_field_first;
208 int repeat_first_field; 208 int repeat_first_field;
209 int progressive_frame; 209 int progressive_frame;
210 int bank; 210 int bank;
211 int forward_bank; 211 int forward_bank;
212 int backward_bank; 212 int backward_bank;
213 int compress; 213 int compress;
214 s16 frame_centre_horizontal_offset[OFF_SIZE]; 214 s16 frame_centre_horizontal_offset[OFF_SIZE];
215 /* [0-2] 1st field, [3] 2nd field */ 215 /* [0-2] 1st field, [3] 2nd field */
216 s16 frame_centre_vertical_offset[OFF_SIZE]; 216 s16 frame_centre_vertical_offset[OFF_SIZE];
217 /* [0-2] 1st field, [3] 2nd field */ 217 /* [0-2] 1st field, [3] 2nd field */
218 s16 temporal_reference[2]; 218 s16 temporal_reference[2];
219 /* [0] 1st field, [1] 2nd field */ 219 /* [0] 1st field, [1] 2nd field */
220 220
221 s8 picture_coding_type[2]; 221 s8 picture_coding_type[2];
222 /* [0] 1st field, [1] 2nd field */ 222 /* [0] 1st field, [1] 2nd field */
223 s8 picture_structure[2]; 223 s8 picture_structure[2];
224 /* [0] 1st field, [1] 2nd field */ 224 /* [0] 1st field, [1] 2nd field */
225 s8 picture_display_extension_flag[2]; 225 s8 picture_display_extension_flag[2];
226 /* [0] 1st field, [1] 2nd field */ 226 /* [0] 1st field, [1] 2nd field */
227 /* picture_display_extenion() 0:no 1:exit*/ 227 /* picture_display_extenion() 0:no 1:exit*/
228 s8 pts_flag[2]; 228 s8 pts_flag[2];
229 /* [0] 1st field, [1] 2nd field */ 229 /* [0] 1st field, [1] 2nd field */
230}; 230};
231 231
232struct dvb_audio_info { 232struct dvb_audio_info {
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 6ffa6b216363..95ea5095e07e 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -372,10 +372,10 @@ static int dvb_frontend_thread(void *data)
372 372
373 snprintf (name, sizeof(name), "kdvb-fe-%i", fe->dvb->num); 373 snprintf (name, sizeof(name), "kdvb-fe-%i", fe->dvb->num);
374 374
375 lock_kernel(); 375 lock_kernel();
376 daemonize(name); 376 daemonize(name);
377 sigfillset(&current->blocked); 377 sigfillset(&current->blocked);
378 unlock_kernel(); 378 unlock_kernel();
379 379
380 fepriv->status = 0; 380 fepriv->status = 0;
381 dvb_frontend_init(fe); 381 dvb_frontend_init(fe);
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index 348c9b0b988a..1e0840d02f1f 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -41,10 +41,10 @@
41#include "dvbdev.h" 41#include "dvbdev.h"
42 42
43struct dvb_frontend_tune_settings { 43struct dvb_frontend_tune_settings {
44 int min_delay_ms; 44 int min_delay_ms;
45 int step_size; 45 int step_size;
46 int max_drift; 46 int max_drift;
47 struct dvb_frontend_parameters parameters; 47 struct dvb_frontend_parameters parameters;
48}; 48};
49 49
50struct dvb_frontend; 50struct dvb_frontend;
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index df536bd2e103..86bba81e851e 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -713,7 +713,7 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
713 if (buffer1_len > 32768) 713 if (buffer1_len > 32768)
714 printk(KERN_WARNING "length > 32k: %zu.\n", buffer1_len); 714 printk(KERN_WARNING "length > 32k: %zu.\n", buffer1_len);
715 /* printk("TS callback: %u bytes, %u TS cells @ %p.\n", 715 /* printk("TS callback: %u bytes, %u TS cells @ %p.\n",
716 buffer1_len, buffer1_len / TS_SZ, buffer1); */ 716 buffer1_len, buffer1_len / TS_SZ, buffer1); */
717 dvb_net_ule(dev, buffer1, buffer1_len); 717 dvb_net_ule(dev, buffer1, buffer1_len);
718 return 0; 718 return 0;
719} 719}
@@ -721,8 +721,8 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
721 721
722static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len) 722static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
723{ 723{
724 u8 *eth; 724 u8 *eth;
725 struct sk_buff *skb; 725 struct sk_buff *skb;
726 struct net_device_stats *stats = &(((struct dvb_net_priv *) dev->priv)->stats); 726 struct net_device_stats *stats = &(((struct dvb_net_priv *) dev->priv)->stats);
727 int snap = 0; 727 int snap = 0;
728 728
@@ -754,7 +754,7 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
754 return; 754 return;
755 } 755 }
756 snap = 8; 756 snap = 8;
757 } 757 }
758 if (pkt[7]) { 758 if (pkt[7]) {
759 /* FIXME: assemble datagram from multiple sections */ 759 /* FIXME: assemble datagram from multiple sections */
760 stats->rx_errors++; 760 stats->rx_errors++;
@@ -778,14 +778,14 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
778 memcpy(eth + 14, pkt + 12 + snap, pkt_len - 12 - 4 - snap); 778 memcpy(eth + 14, pkt + 12 + snap, pkt_len - 12 - 4 - snap);
779 779
780 /* create ethernet header: */ 780 /* create ethernet header: */
781 eth[0]=pkt[0x0b]; 781 eth[0]=pkt[0x0b];
782 eth[1]=pkt[0x0a]; 782 eth[1]=pkt[0x0a];
783 eth[2]=pkt[0x09]; 783 eth[2]=pkt[0x09];
784 eth[3]=pkt[0x08]; 784 eth[3]=pkt[0x08];
785 eth[4]=pkt[0x04]; 785 eth[4]=pkt[0x04];
786 eth[5]=pkt[0x03]; 786 eth[5]=pkt[0x03];
787 787
788 eth[6]=eth[7]=eth[8]=eth[9]=eth[10]=eth[11]=0; 788 eth[6]=eth[7]=eth[8]=eth[9]=eth[10]=eth[11]=0;
789 789
790 if (snap) { 790 if (snap) {
791 eth[12] = pkt[18]; 791 eth[12] = pkt[18];
@@ -807,7 +807,7 @@ static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len)
807 807
808 stats->rx_packets++; 808 stats->rx_packets++;
809 stats->rx_bytes+=skb->len; 809 stats->rx_bytes+=skb->len;
810 netif_rx(skb); 810 netif_rx(skb);
811} 811}
812 812
813static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len, 813static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
@@ -815,7 +815,7 @@ static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
815 struct dmx_section_filter *filter, 815 struct dmx_section_filter *filter,
816 enum dmx_success success) 816 enum dmx_success success)
817{ 817{
818 struct net_device *dev = filter->priv; 818 struct net_device *dev = filter->priv;
819 819
820 /** 820 /**
821 * we rely on the DVB API definition where exactly one complete 821 * we rely on the DVB API definition where exactly one complete
@@ -885,8 +885,8 @@ static int dvb_net_feed_start(struct net_device *dev)
885{ 885{
886 int ret = 0, i; 886 int ret = 0, i;
887 struct dvb_net_priv *priv = dev->priv; 887 struct dvb_net_priv *priv = dev->priv;
888 struct dmx_demux *demux = priv->demux; 888 struct dmx_demux *demux = priv->demux;
889 unsigned char *mac = (unsigned char *) dev->dev_addr; 889 unsigned char *mac = (unsigned char *) dev->dev_addr;
890 890
891 dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode); 891 dprintk("%s: rx_mode %i\n", __FUNCTION__, priv->rx_mode);
892 down(&priv->mutex); 892 down(&priv->mutex);
@@ -1129,12 +1129,12 @@ static int dvb_net_stop(struct net_device *dev)
1129 struct dvb_net_priv *priv = dev->priv; 1129 struct dvb_net_priv *priv = dev->priv;
1130 1130
1131 priv->in_use--; 1131 priv->in_use--;
1132 return dvb_net_feed_stop(dev); 1132 return dvb_net_feed_stop(dev);
1133} 1133}
1134 1134
1135static struct net_device_stats * dvb_net_get_stats(struct net_device *dev) 1135static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
1136{ 1136{
1137 return &((struct dvb_net_priv*) dev->priv)->stats; 1137 return &((struct dvb_net_priv*) dev->priv)->stats;
1138} 1138}
1139 1139
1140static void dvb_net_setup(struct net_device *dev) 1140static void dvb_net_setup(struct net_device *dev)
@@ -1360,10 +1360,10 @@ static struct file_operations dvb_net_fops = {
1360}; 1360};
1361 1361
1362static struct dvb_device dvbdev_net = { 1362static struct dvb_device dvbdev_net = {
1363 .priv = NULL, 1363 .priv = NULL,
1364 .users = 1, 1364 .users = 1,
1365 .writers = 1, 1365 .writers = 1,
1366 .fops = &dvb_net_fops, 1366 .fops = &dvb_net_fops,
1367}; 1367};
1368 1368
1369 1369
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
index fb6d94a69d71..283c6e9339a4 100644
--- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
+++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
@@ -42,216 +42,216 @@
42 42
43void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len) 43void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len)
44{ 44{
45 rbuf->pread=rbuf->pwrite=0; 45 rbuf->pread=rbuf->pwrite=0;
46 rbuf->data=data; 46 rbuf->data=data;
47 rbuf->size=len; 47 rbuf->size=len;
48 48
49 init_waitqueue_head(&rbuf->queue); 49 init_waitqueue_head(&rbuf->queue);
50 50
51 spin_lock_init(&(rbuf->lock)); 51 spin_lock_init(&(rbuf->lock));
52} 52}
53 53
54 54
55 55
56int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf) 56int dvb_ringbuffer_empty(struct dvb_ringbuffer *rbuf)
57{ 57{
58 return (rbuf->pread==rbuf->pwrite); 58 return (rbuf->pread==rbuf->pwrite);
59} 59}
60 60
61 61
62 62
63ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf) 63ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf)
64{ 64{
65 ssize_t free; 65 ssize_t free;
66 66
67 free = rbuf->pread - rbuf->pwrite; 67 free = rbuf->pread - rbuf->pwrite;
68 if (free <= 0) 68 if (free <= 0)
69 free += rbuf->size; 69 free += rbuf->size;
70 return free-1; 70 return free-1;
71} 71}
72 72
73 73
74 74
75ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf) 75ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf)
76{ 76{
77 ssize_t avail; 77 ssize_t avail;
78 78
79 avail = rbuf->pwrite - rbuf->pread; 79 avail = rbuf->pwrite - rbuf->pread;
80 if (avail < 0) 80 if (avail < 0)
81 avail += rbuf->size; 81 avail += rbuf->size;
82 return avail; 82 return avail;
83} 83}
84 84
85 85
86 86
87void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf) 87void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
88{ 88{
89 rbuf->pread = rbuf->pwrite; 89 rbuf->pread = rbuf->pwrite;
90} 90}
91 91
92 92
93 93
94void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf) 94void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf)
95{ 95{
96 unsigned long flags; 96 unsigned long flags;
97 97
98 spin_lock_irqsave(&rbuf->lock, flags); 98 spin_lock_irqsave(&rbuf->lock, flags);
99 dvb_ringbuffer_flush(rbuf); 99 dvb_ringbuffer_flush(rbuf);
100 spin_unlock_irqrestore(&rbuf->lock, flags); 100 spin_unlock_irqrestore(&rbuf->lock, flags);
101 101
102 wake_up(&rbuf->queue); 102 wake_up(&rbuf->queue);
103} 103}
104 104
105 105
106 106
107ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, int usermem) 107ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, int usermem)
108{ 108{
109 size_t todo = len; 109 size_t todo = len;
110 size_t split; 110 size_t split;
111 111
112 split = (rbuf->pread + len > rbuf->size) ? rbuf->size - rbuf->pread : 0; 112 split = (rbuf->pread + len > rbuf->size) ? rbuf->size - rbuf->pread : 0;
113 if (split > 0) { 113 if (split > 0) {
114 if (!usermem) 114 if (!usermem)
115 memcpy(buf, rbuf->data+rbuf->pread, split); 115 memcpy(buf, rbuf->data+rbuf->pread, split);
116 else 116 else
117 if (copy_to_user(buf, rbuf->data+rbuf->pread, split)) 117 if (copy_to_user(buf, rbuf->data+rbuf->pread, split))
118 return -EFAULT; 118 return -EFAULT;
119 buf += split; 119 buf += split;
120 todo -= split; 120 todo -= split;
121 rbuf->pread = 0; 121 rbuf->pread = 0;
122 } 122 }
123 if (!usermem) 123 if (!usermem)
124 memcpy(buf, rbuf->data+rbuf->pread, todo); 124 memcpy(buf, rbuf->data+rbuf->pread, todo);
125 else 125 else
126 if (copy_to_user(buf, rbuf->data+rbuf->pread, todo)) 126 if (copy_to_user(buf, rbuf->data+rbuf->pread, todo))
127 return -EFAULT; 127 return -EFAULT;
128 128
129 rbuf->pread = (rbuf->pread + todo) % rbuf->size; 129 rbuf->pread = (rbuf->pread + todo) % rbuf->size;
130 130
131 return len; 131 return len;
132} 132}
133 133
134 134
135 135
136ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len) 136ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len)
137{ 137{
138 size_t todo = len; 138 size_t todo = len;
139 size_t split; 139 size_t split;
140 140
141 split = (rbuf->pwrite + len > rbuf->size) ? rbuf->size - rbuf->pwrite : 0; 141 split = (rbuf->pwrite + len > rbuf->size) ? rbuf->size - rbuf->pwrite : 0;
142 142
143 if (split > 0) { 143 if (split > 0) {
144 memcpy(rbuf->data+rbuf->pwrite, buf, split); 144 memcpy(rbuf->data+rbuf->pwrite, buf, split);
145 buf += split; 145 buf += split;
146 todo -= split; 146 todo -= split;
147 rbuf->pwrite = 0; 147 rbuf->pwrite = 0;
148 } 148 }
149 memcpy(rbuf->data+rbuf->pwrite, buf, todo); 149 memcpy(rbuf->data+rbuf->pwrite, buf, todo);
150 rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size; 150 rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size;
151 151
152 return len; 152 return len;
153} 153}
154 154
155ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len) 155ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len)
156{ 156{
157 int status; 157 int status;
158 ssize_t oldpwrite = rbuf->pwrite; 158 ssize_t oldpwrite = rbuf->pwrite;
159 159
160 DVB_RINGBUFFER_WRITE_BYTE(rbuf, len >> 8); 160 DVB_RINGBUFFER_WRITE_BYTE(rbuf, len >> 8);
161 DVB_RINGBUFFER_WRITE_BYTE(rbuf, len & 0xff); 161 DVB_RINGBUFFER_WRITE_BYTE(rbuf, len & 0xff);
162 DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY); 162 DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY);
163 status = dvb_ringbuffer_write(rbuf, buf, len); 163 status = dvb_ringbuffer_write(rbuf, buf, len);
164 164
165 if (status < 0) rbuf->pwrite = oldpwrite; 165 if (status < 0) rbuf->pwrite = oldpwrite;
166 return status; 166 return status;
167} 167}
168 168
169ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx, 169ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx,
170 int offset, u8* buf, size_t len, int usermem) 170 int offset, u8* buf, size_t len, int usermem)
171{ 171{
172 size_t todo; 172 size_t todo;
173 size_t split; 173 size_t split;
174 size_t pktlen; 174 size_t pktlen;
175 175
176 pktlen = rbuf->data[idx] << 8; 176 pktlen = rbuf->data[idx] << 8;
177 pktlen |= rbuf->data[(idx + 1) % rbuf->size]; 177 pktlen |= rbuf->data[(idx + 1) % rbuf->size];
178 if (offset > pktlen) return -EINVAL; 178 if (offset > pktlen) return -EINVAL;
179 if ((offset + len) > pktlen) len = pktlen - offset; 179 if ((offset + len) > pktlen) len = pktlen - offset;
180 180
181 idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size; 181 idx = (idx + DVB_RINGBUFFER_PKTHDRSIZE + offset) % rbuf->size;
182 todo = len; 182 todo = len;
183 split = ((idx + len) > rbuf->size) ? rbuf->size - idx : 0; 183 split = ((idx + len) > rbuf->size) ? rbuf->size - idx : 0;
184 if (split > 0) { 184 if (split > 0) {
185 if (!usermem) 185 if (!usermem)
186 memcpy(buf, rbuf->data+idx, split); 186 memcpy(buf, rbuf->data+idx, split);
187 else 187 else
188 if (copy_to_user(buf, rbuf->data+idx, split)) 188 if (copy_to_user(buf, rbuf->data+idx, split))
189 return -EFAULT; 189 return -EFAULT;
190 buf += split; 190 buf += split;
191 todo -= split; 191 todo -= split;
192 idx = 0; 192 idx = 0;
193 } 193 }
194 if (!usermem) 194 if (!usermem)
195 memcpy(buf, rbuf->data+idx, todo); 195 memcpy(buf, rbuf->data+idx, todo);
196 else 196 else
197 if (copy_to_user(buf, rbuf->data+idx, todo)) 197 if (copy_to_user(buf, rbuf->data+idx, todo))
198 return -EFAULT; 198 return -EFAULT;
199 199
200 return len; 200 return len;
201} 201}
202 202
203void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer *rbuf, size_t idx) 203void dvb_ringbuffer_pkt_dispose(struct dvb_ringbuffer *rbuf, size_t idx)
204{ 204{
205 size_t pktlen; 205 size_t pktlen;
206 206
207 rbuf->data[(idx + 2) % rbuf->size] = PKT_DISPOSED; 207 rbuf->data[(idx + 2) % rbuf->size] = PKT_DISPOSED;
208 208
209 // clean up disposed packets 209 // clean up disposed packets
210 while(dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) { 210 while(dvb_ringbuffer_avail(rbuf) > DVB_RINGBUFFER_PKTHDRSIZE) {
211 if (DVB_RINGBUFFER_PEEK(rbuf, 2) == PKT_DISPOSED) { 211 if (DVB_RINGBUFFER_PEEK(rbuf, 2) == PKT_DISPOSED) {
212 pktlen = DVB_RINGBUFFER_PEEK(rbuf, 0) << 8; 212 pktlen = DVB_RINGBUFFER_PEEK(rbuf, 0) << 8;
213 pktlen |= DVB_RINGBUFFER_PEEK(rbuf, 1); 213 pktlen |= DVB_RINGBUFFER_PEEK(rbuf, 1);
214 DVB_RINGBUFFER_SKIP(rbuf, pktlen + DVB_RINGBUFFER_PKTHDRSIZE); 214 DVB_RINGBUFFER_SKIP(rbuf, pktlen + DVB_RINGBUFFER_PKTHDRSIZE);
215 } else { 215 } else {
216 // first packet is not disposed, so we stop cleaning now 216 // first packet is not disposed, so we stop cleaning now
217 break; 217 break;
218 } 218 }
219 } 219 }
220} 220}
221 221
222ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* pktlen) 222ssize_t dvb_ringbuffer_pkt_next(struct dvb_ringbuffer *rbuf, size_t idx, size_t* pktlen)
223{ 223{
224 int consumed; 224 int consumed;
225 int curpktlen; 225 int curpktlen;
226 int curpktstatus; 226 int curpktstatus;
227 227
228 if (idx == -1) { 228 if (idx == -1) {
229 idx = rbuf->pread; 229 idx = rbuf->pread;
230 } else { 230 } else {
231 curpktlen = rbuf->data[idx] << 8; 231 curpktlen = rbuf->data[idx] << 8;
232 curpktlen |= rbuf->data[(idx + 1) % rbuf->size]; 232 curpktlen |= rbuf->data[(idx + 1) % rbuf->size];
233 idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size; 233 idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size;
234 } 234 }
235 235
236 consumed = (idx - rbuf->pread) % rbuf->size; 236 consumed = (idx - rbuf->pread) % rbuf->size;
237 237
238 while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) { 238 while((dvb_ringbuffer_avail(rbuf) - consumed) > DVB_RINGBUFFER_PKTHDRSIZE) {
239 239
240 curpktlen = rbuf->data[idx] << 8; 240 curpktlen = rbuf->data[idx] << 8;
241 curpktlen |= rbuf->data[(idx + 1) % rbuf->size]; 241 curpktlen |= rbuf->data[(idx + 1) % rbuf->size];
242 curpktstatus = rbuf->data[(idx + 2) % rbuf->size]; 242 curpktstatus = rbuf->data[(idx + 2) % rbuf->size];
243 243
244 if (curpktstatus == PKT_READY) { 244 if (curpktstatus == PKT_READY) {
245 *pktlen = curpktlen; 245 *pktlen = curpktlen;
246 return idx; 246 return idx;
247 } 247 }
248 248
249 consumed += curpktlen + DVB_RINGBUFFER_PKTHDRSIZE; 249 consumed += curpktlen + DVB_RINGBUFFER_PKTHDRSIZE;
250 idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size; 250 idx = (idx + curpktlen + DVB_RINGBUFFER_PKTHDRSIZE) % rbuf->size;
251 } 251 }
252 252
253 // no packets available 253 // no packets available
254 return -1; 254 return -1;
255} 255}
256 256
257 257
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
index d18e9c4ba9ea..fa476f662f82 100644
--- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
+++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
@@ -31,13 +31,13 @@
31#include <linux/wait.h> 31#include <linux/wait.h>
32 32
33struct dvb_ringbuffer { 33struct dvb_ringbuffer {
34 u8 *data; 34 u8 *data;
35 ssize_t size; 35 ssize_t size;
36 ssize_t pread; 36 ssize_t pread;
37 ssize_t pwrite; 37 ssize_t pwrite;
38 38
39 wait_queue_head_t queue; 39 wait_queue_head_t queue;
40 spinlock_t lock; 40 spinlock_t lock;
41}; 41};
42 42
43#define DVB_RINGBUFFER_PKTHDRSIZE 3 43#define DVB_RINGBUFFER_PKTHDRSIZE 3
@@ -106,7 +106,7 @@ extern void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf);
106** returns number of bytes transferred or -EFAULT 106** returns number of bytes transferred or -EFAULT
107*/ 107*/
108extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, 108extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf,
109 size_t len, int usermem); 109 size_t len, int usermem);
110 110
111 111
112/* write routines & macros */ 112/* write routines & macros */
@@ -121,7 +121,7 @@ extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf,
121** returns number of bytes transferred or -EFAULT 121** returns number of bytes transferred or -EFAULT
122*/ 122*/
123extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, 123extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
124 size_t len); 124 size_t len);
125 125
126 126
127/** 127/**
@@ -133,7 +133,7 @@ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
133 * returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL. 133 * returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL.
134 */ 134 */
135extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, 135extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf,
136 size_t len); 136 size_t len);
137 137
138/** 138/**
139 * Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this 139 * Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this
@@ -149,7 +149,7 @@ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf,
149 * returns Number of bytes read, or -EFAULT. 149 * returns Number of bytes read, or -EFAULT.
150 */ 150 */
151extern ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx, 151extern ssize_t dvb_ringbuffer_pkt_read(struct dvb_ringbuffer *rbuf, size_t idx,
152 int offset, u8* buf, size_t len, int usermem); 152 int offset, u8* buf, size_t len, int usermem);
153 153
154/** 154/**
155 * Dispose of a packet in the ring buffer. 155 * Dispose of a packet in the ring buffer.
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 477b4fa56430..a4aee8665854 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -47,7 +47,7 @@ static LIST_HEAD(dvb_adapter_list);
47static DECLARE_MUTEX(dvbdev_register_lock); 47static DECLARE_MUTEX(dvbdev_register_lock);
48 48
49static const char * const dnames[] = { 49static const char * const dnames[] = {
50 "video", "audio", "sec", "frontend", "demux", "dvr", "ca", 50 "video", "audio", "sec", "frontend", "demux", "dvr", "ca",
51 "net", "osd" 51 "net", "osd"
52}; 52};
53 53
@@ -90,15 +90,15 @@ static int dvb_device_open(struct inode *inode, struct file *file)
90 90
91 file->private_data = dvbdev; 91 file->private_data = dvbdev;
92 old_fops = file->f_op; 92 old_fops = file->f_op;
93 file->f_op = fops_get(dvbdev->fops); 93 file->f_op = fops_get(dvbdev->fops);
94 if(file->f_op->open) 94 if(file->f_op->open)
95 err = file->f_op->open(inode,file); 95 err = file->f_op->open(inode,file);
96 if (err) { 96 if (err) {
97 fops_put(file->f_op); 97 fops_put(file->f_op);
98 file->f_op = fops_get(old_fops); 98 file->f_op = fops_get(old_fops);
99 } 99 }
100 fops_put(old_fops); 100 fops_put(old_fops);
101 return err; 101 return err;
102 } 102 }
103 return -ENODEV; 103 return -ENODEV;
104} 104}
@@ -117,21 +117,21 @@ static struct cdev dvb_device_cdev = {
117 117
118int dvb_generic_open(struct inode *inode, struct file *file) 118int dvb_generic_open(struct inode *inode, struct file *file)
119{ 119{
120 struct dvb_device *dvbdev = file->private_data; 120 struct dvb_device *dvbdev = file->private_data;
121 121
122 if (!dvbdev) 122 if (!dvbdev)
123 return -ENODEV; 123 return -ENODEV;
124 124
125 if (!dvbdev->users) 125 if (!dvbdev->users)
126 return -EBUSY; 126 return -EBUSY;
127 127
128 if ((file->f_flags & O_ACCMODE) == O_RDONLY) { 128 if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
129 if (!dvbdev->readers) 129 if (!dvbdev->readers)
130 return -EBUSY; 130 return -EBUSY;
131 dvbdev->readers--; 131 dvbdev->readers--;
132 } else { 132 } else {
133 if (!dvbdev->writers) 133 if (!dvbdev->writers)
134 return -EBUSY; 134 return -EBUSY;
135 dvbdev->writers--; 135 dvbdev->writers--;
136 } 136 }
137 137
@@ -143,10 +143,10 @@ EXPORT_SYMBOL(dvb_generic_open);
143 143
144int dvb_generic_release(struct inode *inode, struct file *file) 144int dvb_generic_release(struct inode *inode, struct file *file)
145{ 145{
146 struct dvb_device *dvbdev = file->private_data; 146 struct dvb_device *dvbdev = file->private_data;
147 147
148 if (!dvbdev) 148 if (!dvbdev)
149 return -ENODEV; 149 return -ENODEV;
150 150
151 if ((file->f_flags & O_ACCMODE) == O_RDONLY) { 151 if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
152 dvbdev->readers++; 152 dvbdev->readers++;
@@ -163,10 +163,10 @@ EXPORT_SYMBOL(dvb_generic_release);
163int dvb_generic_ioctl(struct inode *inode, struct file *file, 163int dvb_generic_ioctl(struct inode *inode, struct file *file,
164 unsigned int cmd, unsigned long arg) 164 unsigned int cmd, unsigned long arg)
165{ 165{
166 struct dvb_device *dvbdev = file->private_data; 166 struct dvb_device *dvbdev = file->private_data;
167 167
168 if (!dvbdev) 168 if (!dvbdev)
169 return -ENODEV; 169 return -ENODEV;
170 170
171 if (!dvbdev->kernel_ioctl) 171 if (!dvbdev->kernel_ioctl)
172 return -EINVAL; 172 return -EINVAL;
@@ -334,63 +334,63 @@ EXPORT_SYMBOL(dvb_unregister_adapter);
334 to the v4l "videodev.o" module, which is unnecessary for some 334 to the v4l "videodev.o" module, which is unnecessary for some
335 cards (ie. the budget dvb-cards don't need the v4l module...) */ 335 cards (ie. the budget dvb-cards don't need the v4l module...) */
336int dvb_usercopy(struct inode *inode, struct file *file, 336int dvb_usercopy(struct inode *inode, struct file *file,
337 unsigned int cmd, unsigned long arg, 337 unsigned int cmd, unsigned long arg,
338 int (*func)(struct inode *inode, struct file *file, 338 int (*func)(struct inode *inode, struct file *file,
339 unsigned int cmd, void *arg)) 339 unsigned int cmd, void *arg))
340{ 340{
341 char sbuf[128]; 341 char sbuf[128];
342 void *mbuf = NULL; 342 void *mbuf = NULL;
343 void *parg = NULL; 343 void *parg = NULL;
344 int err = -EINVAL; 344 int err = -EINVAL;
345 345
346 /* Copy arguments into temp kernel buffer */ 346 /* Copy arguments into temp kernel buffer */
347 switch (_IOC_DIR(cmd)) { 347 switch (_IOC_DIR(cmd)) {
348 case _IOC_NONE: 348 case _IOC_NONE:
349 /* 349 /*
350 * For this command, the pointer is actually an integer 350 * For this command, the pointer is actually an integer
351 * argument. 351 * argument.
352 */ 352 */
353 parg = (void *) arg; 353 parg = (void *) arg;
354 break; 354 break;
355 case _IOC_READ: /* some v4l ioctls are marked wrong ... */ 355 case _IOC_READ: /* some v4l ioctls are marked wrong ... */
356 case _IOC_WRITE: 356 case _IOC_WRITE:
357 case (_IOC_WRITE | _IOC_READ): 357 case (_IOC_WRITE | _IOC_READ):
358 if (_IOC_SIZE(cmd) <= sizeof(sbuf)) { 358 if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
359 parg = sbuf; 359 parg = sbuf;
360 } else { 360 } else {
361 /* too big to allocate from stack */ 361 /* too big to allocate from stack */
362 mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL); 362 mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
363 if (NULL == mbuf) 363 if (NULL == mbuf)
364 return -ENOMEM; 364 return -ENOMEM;
365 parg = mbuf; 365 parg = mbuf;
366 } 366 }
367 367
368 err = -EFAULT; 368 err = -EFAULT;
369 if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) 369 if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
370 goto out; 370 goto out;
371 break; 371 break;
372 } 372 }
373 373
374 /* call driver */ 374 /* call driver */
375 if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD) 375 if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD)
376 err = -EINVAL; 376 err = -EINVAL;
377 377
378 if (err < 0) 378 if (err < 0)
379 goto out; 379 goto out;
380 380
381 /* Copy results into user buffer */ 381 /* Copy results into user buffer */
382 switch (_IOC_DIR(cmd)) 382 switch (_IOC_DIR(cmd))
383 { 383 {
384 case _IOC_READ: 384 case _IOC_READ:
385 case (_IOC_WRITE | _IOC_READ): 385 case (_IOC_WRITE | _IOC_READ):
386 if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd))) 386 if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
387 err = -EFAULT; 387 err = -EFAULT;
388 break; 388 break;
389 } 389 }
390 390
391out: 391out:
392 kfree(mbuf); 392 kfree(mbuf);
393 return err; 393 return err;
394} 394}
395 395
396static int __init init_dvbdev(void) 396static int __init init_dvbdev(void)
@@ -427,10 +427,10 @@ error:
427 427
428static void __exit exit_dvbdev(void) 428static void __exit exit_dvbdev(void)
429{ 429{
430 devfs_remove("dvb"); 430 devfs_remove("dvb");
431 class_destroy(dvb_class); 431 class_destroy(dvb_class);
432 cdev_del(&dvb_device_cdev); 432 cdev_del(&dvb_device_cdev);
433 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); 433 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
434} 434}
435 435
436module_init(init_dvbdev); 436module_init(init_dvbdev);
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h
index a251867f30f1..0cc6e4a0e27c 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.h
+++ b/drivers/media/dvb/dvb-core/dvbdev.h
@@ -68,8 +68,8 @@ struct dvb_device {
68 int writers; 68 int writers;
69 int users; 69 int users;
70 70
71 /* don't really need those !? -- FIXME: use video_usercopy */ 71 /* don't really need those !? -- FIXME: use video_usercopy */
72 int (*kernel_ioctl)(struct inode *inode, struct file *file, 72 int (*kernel_ioctl)(struct inode *inode, struct file *file,
73 unsigned int cmd, void *arg); 73 unsigned int cmd, void *arg);
74 74
75 void *priv; 75 void *priv;
@@ -97,7 +97,7 @@ we simply define out own dvb_usercopy(), which will hopefully become
97generic_usercopy() someday... */ 97generic_usercopy() someday... */
98 98
99extern int dvb_usercopy(struct inode *inode, struct file *file, 99extern int dvb_usercopy(struct inode *inode, struct file *file,
100 unsigned int cmd, unsigned long arg, 100 unsigned int cmd, unsigned long arg,
101 int (*func)(struct inode *inode, struct file *file, 101 int (*func)(struct inode *inode, struct file *file,
102 unsigned int cmd, void *arg)); 102 unsigned int cmd, void *arg));
103 103
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
index e4063950ae57..3ca1d768bfd3 100644
--- a/drivers/media/video/bt832.c
+++ b/drivers/media/video/bt832.c
@@ -231,18 +231,18 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
231 231
232static struct i2c_driver driver = { 232static struct i2c_driver driver = {
233 .owner = THIS_MODULE, 233 .owner = THIS_MODULE,
234 .name = "i2c bt832 driver", 234 .name = "i2c bt832 driver",
235 .id = -1, /* FIXME */ 235 .id = -1, /* FIXME */
236 .flags = I2C_DF_NOTIFY, 236 .flags = I2C_DF_NOTIFY,
237 .attach_adapter = bt832_probe, 237 .attach_adapter = bt832_probe,
238 .detach_client = bt832_detach, 238 .detach_client = bt832_detach,
239 .command = bt832_command, 239 .command = bt832_command,
240}; 240};
241static struct i2c_client client_template = 241static struct i2c_client client_template =
242{ 242{
243 .name = "bt832", 243 .name = "bt832",
244 .flags = I2C_CLIENT_ALLOW_USE, 244 .flags = I2C_CLIENT_ALLOW_USE,
245 .driver = &driver, 245 .driver = &driver,
246}; 246};
247 247
248 248
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 3c58a2a68906..24f5afddafbb 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -727,71 +727,71 @@ void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
727 727
728static void set_pll_freq(struct bttv *btv, unsigned int fin, unsigned int fout) 728static void set_pll_freq(struct bttv *btv, unsigned int fin, unsigned int fout)
729{ 729{
730 unsigned char fl, fh, fi; 730 unsigned char fl, fh, fi;
731 731
732 /* prevent overflows */ 732 /* prevent overflows */
733 fin/=4; 733 fin/=4;
734 fout/=4; 734 fout/=4;
735 735
736 fout*=12; 736 fout*=12;
737 fi=fout/fin; 737 fi=fout/fin;
738 738
739 fout=(fout%fin)*256; 739 fout=(fout%fin)*256;
740 fh=fout/fin; 740 fh=fout/fin;
741 741
742 fout=(fout%fin)*256; 742 fout=(fout%fin)*256;
743 fl=fout/fin; 743 fl=fout/fin;
744 744
745 btwrite(fl, BT848_PLL_F_LO); 745 btwrite(fl, BT848_PLL_F_LO);
746 btwrite(fh, BT848_PLL_F_HI); 746 btwrite(fh, BT848_PLL_F_HI);
747 btwrite(fi|BT848_PLL_X, BT848_PLL_XCI); 747 btwrite(fi|BT848_PLL_X, BT848_PLL_XCI);
748} 748}
749 749
750static void set_pll(struct bttv *btv) 750static void set_pll(struct bttv *btv)
751{ 751{
752 int i; 752 int i;
753 753
754 if (!btv->pll.pll_crystal) 754 if (!btv->pll.pll_crystal)
755 return; 755 return;
756 756
757 if (btv->pll.pll_ofreq == btv->pll.pll_current) { 757 if (btv->pll.pll_ofreq == btv->pll.pll_current) {
758 dprintk("bttv%d: PLL: no change required\n",btv->c.nr); 758 dprintk("bttv%d: PLL: no change required\n",btv->c.nr);
759 return; 759 return;
760 } 760 }
761 761
762 if (btv->pll.pll_ifreq == btv->pll.pll_ofreq) { 762 if (btv->pll.pll_ifreq == btv->pll.pll_ofreq) {
763 /* no PLL needed */ 763 /* no PLL needed */
764 if (btv->pll.pll_current == 0) 764 if (btv->pll.pll_current == 0)
765 return; 765 return;
766 bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n", 766 bttv_printk(KERN_INFO "bttv%d: PLL can sleep, using XTAL (%d).\n",
767 btv->c.nr,btv->pll.pll_ifreq); 767 btv->c.nr,btv->pll.pll_ifreq);
768 btwrite(0x00,BT848_TGCTRL); 768 btwrite(0x00,BT848_TGCTRL);
769 btwrite(0x00,BT848_PLL_XCI); 769 btwrite(0x00,BT848_PLL_XCI);
770 btv->pll.pll_current = 0; 770 btv->pll.pll_current = 0;
771 return; 771 return;
772 } 772 }
773 773
774 bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr, 774 bttv_printk(KERN_INFO "bttv%d: PLL: %d => %d ",btv->c.nr,
775 btv->pll.pll_ifreq, btv->pll.pll_ofreq); 775 btv->pll.pll_ifreq, btv->pll.pll_ofreq);
776 set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq); 776 set_pll_freq(btv, btv->pll.pll_ifreq, btv->pll.pll_ofreq);
777 777
778 for (i=0; i<10; i++) { 778 for (i=0; i<10; i++) {
779 /* Let other people run while the PLL stabilizes */ 779 /* Let other people run while the PLL stabilizes */
780 bttv_printk("."); 780 bttv_printk(".");
781 msleep(10); 781 msleep(10);
782 782
783 if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) { 783 if (btread(BT848_DSTATUS) & BT848_DSTATUS_PLOCK) {
784 btwrite(0,BT848_DSTATUS); 784 btwrite(0,BT848_DSTATUS);
785 } else { 785 } else {
786 btwrite(0x08,BT848_TGCTRL); 786 btwrite(0x08,BT848_TGCTRL);
787 btv->pll.pll_current = btv->pll.pll_ofreq; 787 btv->pll.pll_current = btv->pll.pll_ofreq;
788 bttv_printk(" ok\n"); 788 bttv_printk(" ok\n");
789 return; 789 return;
790 } 790 }
791 } 791 }
792 btv->pll.pll_current = -1; 792 btv->pll.pll_current = -1;
793 bttv_printk("failed\n"); 793 bttv_printk("failed\n");
794 return; 794 return;
795} 795}
796 796
797/* used to switch between the bt848's analog/digital video capture modes */ 797/* used to switch between the bt848's analog/digital video capture modes */
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 124c502ea1f3..ca4027422e76 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -296,7 +296,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
296 IR_KEYTAB_TYPE *ir_codes = NULL; 296 IR_KEYTAB_TYPE *ir_codes = NULL;
297 char *name; 297 char *name;
298 int ir_type; 298 int ir_type;
299 struct IR_i2c *ir; 299 struct IR_i2c *ir;
300 struct input_dev *input_dev; 300 struct input_dev *input_dev;
301 301
302 ir = kzalloc(sizeof(struct IR_i2c), GFP_KERNEL); 302 ir = kzalloc(sizeof(struct IR_i2c), GFP_KERNEL);
@@ -304,7 +304,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
304 if (!ir || !input_dev) { 304 if (!ir || !input_dev) {
305 kfree(ir); 305 kfree(ir);
306 input_free_device(input_dev); 306 input_free_device(input_dev);
307 return -ENOMEM; 307 return -ENOMEM;
308 } 308 }
309 309
310 ir->c = client_template; 310 ir->c = client_template;
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index a23fb0338986..61b99b0d8583 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -1559,11 +1559,11 @@ static void msp_wake_thread(struct i2c_client *client);
1559static struct i2c_driver driver = { 1559static struct i2c_driver driver = {
1560 .owner = THIS_MODULE, 1560 .owner = THIS_MODULE,
1561 .name = "msp3400", 1561 .name = "msp3400",
1562 .id = I2C_DRIVERID_MSP3400, 1562 .id = I2C_DRIVERID_MSP3400,
1563 .flags = I2C_DF_NOTIFY, 1563 .flags = I2C_DF_NOTIFY,
1564 .attach_adapter = msp_probe, 1564 .attach_adapter = msp_probe,
1565 .detach_client = msp_detach, 1565 .detach_client = msp_detach,
1566 .command = msp_command, 1566 .command = msp_command,
1567 .driver = { 1567 .driver = {
1568 .suspend = msp_suspend, 1568 .suspend = msp_suspend,
1569 .resume = msp_resume, 1569 .resume = msp_resume,
@@ -1574,7 +1574,7 @@ static struct i2c_client client_template =
1574{ 1574{
1575 .name = "(unset)", 1575 .name = "(unset)",
1576 .flags = I2C_CLIENT_ALLOW_USE, 1576 .flags = I2C_CLIENT_ALLOW_USE,
1577 .driver = &driver, 1577 .driver = &driver,
1578}; 1578};
1579 1579
1580static int msp_attach(struct i2c_adapter *adap, int addr, int kind) 1580static int msp_attach(struct i2c_adapter *adap, int addr, int kind)
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index cdd1ed9c8065..cf1e0c2b0351 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -523,7 +523,7 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
523 h->standard = 0; 523 h->standard = 0;
524 524
525 i2c_set_clientdata(&h->client, h); 525 i2c_set_clientdata(&h->client, h);
526 i2c_attach_client(&h->client); 526 i2c_attach_client(&h->client);
527 return 0; 527 return 0;
528} 528}
529 529
@@ -597,19 +597,19 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
597 597
598static struct i2c_driver driver = { 598static struct i2c_driver driver = {
599 .owner = THIS_MODULE, 599 .owner = THIS_MODULE,
600 .name = "i2c saa6752hs MPEG encoder", 600 .name = "i2c saa6752hs MPEG encoder",
601 .id = I2C_DRIVERID_SAA6752HS, 601 .id = I2C_DRIVERID_SAA6752HS,
602 .flags = I2C_DF_NOTIFY, 602 .flags = I2C_DF_NOTIFY,
603 .attach_adapter = saa6752hs_probe, 603 .attach_adapter = saa6752hs_probe,
604 .detach_client = saa6752hs_detach, 604 .detach_client = saa6752hs_detach,
605 .command = saa6752hs_command, 605 .command = saa6752hs_command,
606}; 606};
607 607
608static struct i2c_client client_template = 608static struct i2c_client client_template =
609{ 609{
610 .name = "saa6752hs", 610 .name = "saa6752hs",
611 .flags = I2C_CLIENT_ALLOW_USE, 611 .flags = I2C_CLIENT_ALLOW_USE,
612 .driver = &driver, 612 .driver = &driver,
613}; 613};
614 614
615static int __init saa6752hs_init_module(void) 615static int __init saa6752hs_init_module(void)
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index 263c6e2e3e8e..f2788ebb59a8 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -59,7 +59,7 @@ module_param_array(index, int, NULL, 0444);
59MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); 59MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s).");
60 60
61#define dprintk(fmt, arg...) if (debug) \ 61#define dprintk(fmt, arg...) if (debug) \
62 printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) 62 printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg)
63 63
64/* 64/*
65 * Main chip structure 65 * Main chip structure
@@ -208,8 +208,8 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
208 208
209static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id, struct pt_regs *regs) 209static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id, struct pt_regs *regs)
210{ 210{
211 struct saa7134_dmasound *dmasound = dev_id; 211 struct saa7134_dmasound *dmasound = dev_id;
212 struct saa7134_dev *dev = dmasound->priv_data; 212 struct saa7134_dev *dev = dmasound->priv_data;
213 213
214 unsigned long report, status; 214 unsigned long report, status;
215 int loop, handled = 0; 215 int loop, handled = 0;
@@ -985,7 +985,7 @@ static int saa7134_alsa_init(void)
985 struct saa7134_dev *dev = NULL; 985 struct saa7134_dev *dev = NULL;
986 struct list_head *list; 986 struct list_head *list;
987 987
988 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); 988 printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n");
989 989
990 list_for_each(list,&saa7134_devlist) { 990 list_for_each(list,&saa7134_devlist) {
991 dev = list_entry(list, struct saa7134_dev, devlist); 991 dev = list_entry(list, struct saa7134_dev, devlist);
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 5a579194e455..1f68b9f3fdec 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -782,36 +782,36 @@ struct file_operations saa7134_mixer_fops = {
782 782
783static irqreturn_t saa7134_oss_irq(int irq, void *dev_id, struct pt_regs *regs) 783static irqreturn_t saa7134_oss_irq(int irq, void *dev_id, struct pt_regs *regs)
784{ 784{
785 struct saa7134_dmasound *dmasound = dev_id; 785 struct saa7134_dmasound *dmasound = dev_id;
786 struct saa7134_dev *dev = dmasound->priv_data; 786 struct saa7134_dev *dev = dmasound->priv_data;
787 unsigned long report, status; 787 unsigned long report, status;
788 int loop, handled = 0; 788 int loop, handled = 0;
789 789
790 for (loop = 0; loop < 10; loop++) { 790 for (loop = 0; loop < 10; loop++) {
791 report = saa_readl(SAA7134_IRQ_REPORT); 791 report = saa_readl(SAA7134_IRQ_REPORT);
792 status = saa_readl(SAA7134_IRQ_STATUS); 792 status = saa_readl(SAA7134_IRQ_STATUS);
793 793
794 if (report & SAA7134_IRQ_REPORT_DONE_RA3) { 794 if (report & SAA7134_IRQ_REPORT_DONE_RA3) {
795 handled = 1; 795 handled = 1;
796 saa_writel(SAA7134_IRQ_REPORT,report); 796 saa_writel(SAA7134_IRQ_REPORT,report);
797 saa7134_irq_oss_done(dev, status); 797 saa7134_irq_oss_done(dev, status);
798 } else { 798 } else {
799 goto out; 799 goto out;
800 } 800 }
801 } 801 }
802 802
803 if (loop == 10) { 803 if (loop == 10) {
804 dprintk("error! looping IRQ!"); 804 dprintk("error! looping IRQ!");
805 } 805 }
806out: 806out:
807 return IRQ_RETVAL(handled); 807 return IRQ_RETVAL(handled);
808} 808}
809 809
810int saa7134_oss_init1(struct saa7134_dev *dev) 810int saa7134_oss_init1(struct saa7134_dev *dev)
811{ 811{
812 812
813 if ((request_irq(dev->pci->irq, saa7134_oss_irq, 813 if ((request_irq(dev->pci->irq, saa7134_oss_irq,
814 SA_SHIRQ | SA_INTERRUPT, dev->name, 814 SA_SHIRQ | SA_INTERRUPT, dev->name,
815 (void*) &dev->dmasound)) < 0) 815 (void*) &dev->dmasound)) < 0)
816 return -1; 816 return -1;
817 817
@@ -905,7 +905,7 @@ static int saa7134_dsp_create(struct saa7134_dev *dev)
905 905
906 err = dev->dmasound.minor_dsp = 906 err = dev->dmasound.minor_dsp =
907 register_sound_dsp(&saa7134_dsp_fops, 907 register_sound_dsp(&saa7134_dsp_fops,
908 dsp_nr[dev->nr]); 908 dsp_nr[dev->nr]);
909 if (err < 0) { 909 if (err < 0) {
910 goto fail; 910 goto fail;
911 } 911 }
@@ -923,7 +923,7 @@ static int saa7134_dsp_create(struct saa7134_dev *dev)
923 return 0; 923 return 0;
924 924
925fail: 925fail:
926 unregister_sound_dsp(dev->dmasound.minor_dsp); 926 unregister_sound_dsp(dev->dmasound.minor_dsp);
927 return 0; 927 return 0;
928 928
929 929
@@ -956,49 +956,49 @@ static int oss_device_exit(struct saa7134_dev *dev)
956 956
957static int saa7134_oss_init(void) 957static int saa7134_oss_init(void)
958{ 958{
959 struct saa7134_dev *dev = NULL; 959 struct saa7134_dev *dev = NULL;
960 struct list_head *list; 960 struct list_head *list;
961 961
962 printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n"); 962 printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n");
963 963
964 list_for_each(list,&saa7134_devlist) { 964 list_for_each(list,&saa7134_devlist) {
965 dev = list_entry(list, struct saa7134_dev, devlist); 965 dev = list_entry(list, struct saa7134_dev, devlist);
966 if (dev->dmasound.priv_data == NULL) { 966 if (dev->dmasound.priv_data == NULL) {
967 oss_device_init(dev); 967 oss_device_init(dev);
968 } else { 968 } else {
969 printk(KERN_ERR "saa7134 OSS: DMA sound is being handled by ALSA, ignoring %s\n",dev->name); 969 printk(KERN_ERR "saa7134 OSS: DMA sound is being handled by ALSA, ignoring %s\n",dev->name);
970 return -EBUSY; 970 return -EBUSY;
971 } 971 }
972 } 972 }
973 973
974 if (dev == NULL) 974 if (dev == NULL)
975 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); 975 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n");
976 976
977 dmasound_init = oss_device_init; 977 dmasound_init = oss_device_init;
978 dmasound_exit = oss_device_exit; 978 dmasound_exit = oss_device_exit;
979 979
980 return 0; 980 return 0;
981 981
982} 982}
983 983
984static void saa7134_oss_exit(void) 984static void saa7134_oss_exit(void)
985{ 985{
986 struct saa7134_dev *dev = NULL; 986 struct saa7134_dev *dev = NULL;
987 struct list_head *list; 987 struct list_head *list;
988 988
989 list_for_each(list,&saa7134_devlist) { 989 list_for_each(list,&saa7134_devlist) {
990 dev = list_entry(list, struct saa7134_dev, devlist); 990 dev = list_entry(list, struct saa7134_dev, devlist);
991 991
992 /* Device isn't registered by OSS, probably ALSA's */ 992 /* Device isn't registered by OSS, probably ALSA's */
993 if (!dev->dmasound.minor_dsp) 993 if (!dev->dmasound.minor_dsp)
994 continue; 994 continue;
995 995
996 oss_device_exit(dev); 996 oss_device_exit(dev);
997 } 997 }
998 998
999 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); 999 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n");
1000 1000
1001 return; 1001 return;
1002} 1002}
1003 1003
1004module_init(saa7134_oss_init); 1004module_init(saa7134_oss_init);
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 4249127c0a1d..14a2066a61b2 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -819,12 +819,12 @@ static int tda9887_resume(struct device * dev)
819 819
820static struct i2c_driver driver = { 820static struct i2c_driver driver = {
821 .owner = THIS_MODULE, 821 .owner = THIS_MODULE,
822 .name = "i2c tda9887 driver", 822 .name = "i2c tda9887 driver",
823 .id = -1, /* FIXME */ 823 .id = -1, /* FIXME */
824 .flags = I2C_DF_NOTIFY, 824 .flags = I2C_DF_NOTIFY,
825 .attach_adapter = tda9887_probe, 825 .attach_adapter = tda9887_probe,
826 .detach_client = tda9887_detach, 826 .detach_client = tda9887_detach,
827 .command = tda9887_command, 827 .command = tda9887_command,
828 .driver = { 828 .driver = {
829 .suspend = tda9887_suspend, 829 .suspend = tda9887_suspend,
830 .resume = tda9887_resume, 830 .resume = tda9887_resume,
@@ -834,7 +834,7 @@ static struct i2c_client client_template =
834{ 834{
835 .name = "tda9887", 835 .name = "tda9887",
836 .flags = I2C_CLIENT_ALLOW_USE, 836 .flags = I2C_CLIENT_ALLOW_USE,
837 .driver = &driver, 837 .driver = &driver,
838}; 838};
839 839
840static int __init tda9887_init_module(void) 840static int __init tda9887_init_module(void)
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index c31bf28b73fe..67757fe07d8d 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1506,18 +1506,18 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1506 return -EIO; 1506 return -EIO;
1507 } 1507 }
1508 tvaudio_info("%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name); 1508 tvaudio_info("%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name);
1509 if (desc->flags) { 1509 if (desc->flags) {
1510 tvaudio_dbg("matches:%s%s%s.\n", 1510 tvaudio_dbg("matches:%s%s%s.\n",
1511 (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", 1511 (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "",
1512 (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", 1512 (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "",
1513 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); 1513 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : "");
1514 } 1514 }
1515 1515
1516 /* fill required data structures */ 1516 /* fill required data structures */
1517 strcpy(chip->c.name,desc->name); 1517 strcpy(chip->c.name,desc->name);
1518 chip->type = desc-chiplist; 1518 chip->type = desc-chiplist;
1519 chip->shadow.count = desc->registers+1; 1519 chip->shadow.count = desc->registers+1;
1520 chip->prevmode = -1; 1520 chip->prevmode = -1;
1521 /* register */ 1521 /* register */
1522 i2c_attach_client(&chip->c); 1522 i2c_attach_client(&chip->c);
1523 1523
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index d95aecebbda3..5c04989471b6 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -753,7 +753,7 @@ tveeprom_detect_client(struct i2c_adapter *adapter,
753 client->driver = &i2c_driver_tveeprom; 753 client->driver = &i2c_driver_tveeprom;
754 client->flags = I2C_CLIENT_ALLOW_USE; 754 client->flags = I2C_CLIENT_ALLOW_USE;
755 snprintf(client->name, sizeof(client->name), "tveeprom"); 755 snprintf(client->name, sizeof(client->name), "tveeprom");
756 i2c_attach_client(client); 756 i2c_attach_client(client);
757 return 0; 757 return 0;
758} 758}
759 759