diff options
author | Johannes Stezenbach <devnull@localhost> | 2004-07-31 00:05:45 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2004-07-31 00:05:45 +0000 |
commit | d3c7341869a8188aff16975a785c4c5d05c3fcb8 (patch) | |
tree | d0fa6a77187580a4ff427ed50608a2490f245cda /linux/drivers/media/dvb/ttpci | |
parent | 12994bfc905a0bb9f5ba354f7d11278d39dbc26b (diff) | |
download | mediapointer-dvb-s2-d3c7341869a8188aff16975a785c4c5d05c3fcb8.tar.gz mediapointer-dvb-s2-d3c7341869a8188aff16975a785c4c5d05c3fcb8.tar.bz2 |
merge back various cleanups from mainline kernel:
- sparse annotiations (viro)
- NULL noise removal (viro)
- #if where #ifdef should've been (saa7146) (viro)
- convert private ABS() to kernel's abs() (rddunlap)
- dvb_register_i2c_device() locking fix for -ENOMEM (akpm)
- dvb_register_i2c_bus() locking fix for -ENOMEM (akpm)
Diffstat (limited to 'linux/drivers/media/dvb/ttpci')
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 8 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_av.c | 71 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_ca.c | 42 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_hw.c | 10 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110_ir.c | 2 |
5 files changed, 87 insertions, 46 deletions
diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index f8a34b67c..e3e7105b7 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -389,7 +389,7 @@ static void debiirq (unsigned long data) case DATA_PIPING: if (av7110->handle2filter[handle]) DvbDmxFilterCallback((u8 *)av7110->debi_virt, - av7110->debilen, 0, 0, + av7110->debilen, NULL, 0, av7110->handle2filter[handle], DMX_OK, av7110); spin_lock(&av7110->debilock); @@ -722,7 +722,7 @@ static struct file_operations dvb_osd_fops = { }; static struct dvb_device dvbdev_osd = { - .priv = 0, + .priv = NULL, .users = 1, .writers = 1, .fops = &dvb_osd_fops, @@ -999,7 +999,7 @@ static int av7110_stop_feed(struct dvb_demux_feed *feed) !demux->pesfilter[feed->pes_type]) return -EINVAL; demux->pids[feed->pes_type] |= 0x8000; - demux->pesfilter[feed->pes_type] = 0; + demux->pesfilter[feed->pes_type] = NULL; } if (feed->ts_type & TS_DECODER && feed->pes_type < DMX_TS_PES_OTHER) { @@ -1526,7 +1526,7 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d /* ARM "watchdog" */ init_waitqueue_head(&av7110->arm_wait); - av7110->arm_thread = 0; + av7110->arm_thread = NULL; /* allocate and init buffers */ av7110->debi_virt = pci_alloc_consistent(dev->pci, 8192, diff --git a/linux/drivers/media/dvb/ttpci/av7110_av.c b/linux/drivers/media/dvb/ttpci/av7110_av.c index 05d6e57d3..ec3fe823f 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_av.c +++ b/linux/drivers/media/dvb/ttpci/av7110_av.c @@ -105,7 +105,7 @@ int av7110_record_cb(struct dvb_filter_pes2ts *p2t, u8 *buf, size_t len) if (buf[3] == 0xe0) // video PES do not have a length in TS buf[4] = buf[5] = 0; if (dvbdmxfeed->ts_type & TS_PAYLOAD_ONLY) - return dvbdmxfeed->cb.ts(buf, len, 0, 0, + return dvbdmxfeed->cb.ts(buf, len, NULL, 0, &dvbdmxfeed->feed.ts, DMX_OK); else return dvb_filter_pes2ts(p2t, buf, len, 1); @@ -117,7 +117,7 @@ static int dvb_filter_pes2ts_cb(void *priv, unsigned char *data) // DEB_EE(("dvb_demux_feed:%p\n", dvbdmxfeed)); - dvbdmxfeed->cb.ts(data, 188, 0, 0, + dvbdmxfeed->cb.ts(data, 188, NULL, 0, &dvbdmxfeed->feed.ts, DMX_OK); return 0; } @@ -391,7 +391,7 @@ static inline long aux_ring_buffer_write(struct dvb_ringbuffer *rbuf, free = dvb_ringbuffer_free(rbuf); if (free > todo) free = todo; - dvb_ringbuffer_write(rbuf, buf, free, 0); + dvb_ringbuffer_write(rbuf, buf, free); todo -= free; buf += free; } @@ -422,8 +422,8 @@ static void play_audio_cb(u8 *buf, int count, void *priv) #define FREE_COND (dvb_ringbuffer_free(&av7110->avout) >= 20 * 1024 && \ dvb_ringbuffer_free(&av7110->aout) >= 20 * 1024) -static ssize_t dvb_play(struct av7110 *av7110, const u8 *buf, - unsigned long count, int nonblock, int type, int umem) +static ssize_t dvb_play(struct av7110 *av7110, const u8 __user *buf, + unsigned long count, int nonblock, int type) { unsigned long todo = count, n; DEB_EE(("av7110: %p\n", av7110)); @@ -445,22 +445,47 @@ static ssize_t dvb_play(struct av7110 *av7110, const u8 *buf, n = todo; if (n > IPACKS * 2) n = IPACKS * 2; - if (umem) { - if (copy_from_user(av7110->kbuf[type], buf, n)) - return -EFAULT; - av7110_ipack_instant_repack(av7110->kbuf[type], n, - &av7110->ipack[type]); - } else { - av7110_ipack_instant_repack(buf, n, - &av7110->ipack[type]); + if (copy_from_user(av7110->kbuf[type], buf, n)) + return -EFAULT; + av7110_ipack_instant_repack(av7110->kbuf[type], n, + &av7110->ipack[type]); + todo -= n; + buf += n; + } + return count - todo; +} + +static ssize_t dvb_play_kernel(struct av7110 *av7110, const u8 *buf, + unsigned long count, int nonblock, int type) +{ + unsigned long todo = count, n; + DEB_EE(("av7110: %p\n", av7110)); + + if (!av7110->kbuf[type]) + return -ENOBUFS; + + if (nonblock && !FREE_COND) + return -EWOULDBLOCK; + + while (todo > 0) { + if (!FREE_COND) { + if (nonblock) + return count - todo; + if (wait_event_interruptible(av7110->avout.queue, + FREE_COND)) + return count - todo; } + n = todo; + if (n > IPACKS * 2) + n = IPACKS * 2; + av7110_ipack_instant_repack(buf, n, &av7110->ipack[type]); todo -= n; buf += n; } return count - todo; } -static ssize_t dvb_aplay(struct av7110 *av7110, const u8 *buf, +static ssize_t dvb_aplay(struct av7110 *av7110, const u8 __user *buf, unsigned long count, int nonblock, int type) { unsigned long todo = count, n; @@ -731,7 +756,7 @@ static void p_to_t(u8 const *buf, long int length, u16 pid, u8 *counter, memcpy(obuf + l, buf + c, TS_SIZE - l); c = length; } - feed->cb.ts(obuf, 188, 0, 0, &feed->feed.ts, DMX_OK); + feed->cb.ts(obuf, 188, NULL, 0, &feed->feed.ts, DMX_OK); pes_start = 0; } } @@ -869,7 +894,7 @@ static unsigned int dvb_video_poll(struct file *file, poll_table *wait) return mask; } -static ssize_t dvb_video_write(struct file *file, const char *buf, +static ssize_t dvb_video_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev = (struct dvb_device *) file->private_data; @@ -883,7 +908,7 @@ static ssize_t dvb_video_write(struct file *file, const char *buf, if (av7110->videostate.stream_source != VIDEO_SOURCE_MEMORY) return -EPERM; - return dvb_play(av7110, buf, count, file->f_flags & O_NONBLOCK, 1, 1); + return dvb_play(av7110, buf, count, file->f_flags & O_NONBLOCK, 1); } static unsigned int dvb_audio_poll(struct file *file, poll_table *wait) @@ -905,7 +930,7 @@ static unsigned int dvb_audio_poll(struct file *file, poll_table *wait) return mask; } -static ssize_t dvb_audio_write(struct file *file, const char *buf, +static ssize_t dvb_audio_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev = (struct dvb_device *) file->private_data; @@ -924,7 +949,7 @@ u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x00 }; #define MIN_IFRAME 400000 -static int play_iframe(struct av7110 *av7110, u8 *buf, unsigned int len, int nonblock) +static int play_iframe(struct av7110 *av7110, u8 __user *buf, unsigned int len, int nonblock) { int i, n; @@ -940,10 +965,10 @@ static int play_iframe(struct av7110 *av7110, u8 *buf, unsigned int len, int non n = MIN_IFRAME / len + 1; /* FIXME: nonblock? */ - dvb_play(av7110, iframe_header, sizeof(iframe_header), 0, 1, 0); + dvb_play_kernel(av7110, iframe_header, sizeof(iframe_header), 0, 1); for (i = 0; i < n; i++) - dvb_play(av7110, buf, len, 0, 1, 1); + dvb_play(av7110, buf, len, 0, 1); av7110_ipack_flush(&av7110->ipack[1]); return 0; @@ -1345,7 +1370,7 @@ static struct file_operations dvb_video_fops = { }; static struct dvb_device dvbdev_video = { - .priv = 0, + .priv = NULL, .users = 6, .readers = 5, /* arbitrary */ .writers = 1, @@ -1363,7 +1388,7 @@ static struct file_operations dvb_audio_fops = { }; static struct dvb_device dvbdev_audio = { - .priv = 0, + .priv = NULL, .users = 1, .writers = 1, .fops = &dvb_audio_fops, diff --git a/linux/drivers/media/dvb/ttpci/av7110_ca.c b/linux/drivers/media/dvb/ttpci/av7110_ca.c index cf91bb318..7e31d3236 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_ca.c +++ b/linux/drivers/media/dvb/ttpci/av7110_ca.c @@ -81,7 +81,7 @@ void ci_get_data(struct dvb_ringbuffer *cibuf, u8 *data, int len) DVB_RINGBUFFER_WRITE_BYTE(cibuf, len >> 8); DVB_RINGBUFFER_WRITE_BYTE(cibuf, len & 0xff); - dvb_ringbuffer_write(cibuf, data, len, 0); + dvb_ringbuffer_write(cibuf, data, len); wake_up_interruptible(&cibuf->queue); } @@ -106,9 +106,9 @@ void ci_ll_flush(struct dvb_ringbuffer *cirbuf, struct dvb_ringbuffer *ciwbuf) void ci_ll_release(struct dvb_ringbuffer *cirbuf, struct dvb_ringbuffer *ciwbuf) { vfree(cirbuf->data); - cirbuf->data = 0; + cirbuf->data = NULL; vfree(ciwbuf->data); - ciwbuf->data = 0; + ciwbuf->data = NULL; } int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file, @@ -129,7 +129,7 @@ int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file, for (i = 0; i < 2; i++) { if (slots & (1 << i)) { msg[2] = i; - dvb_ringbuffer_write(cibuf, msg, 8, 0); + dvb_ringbuffer_write(cibuf, msg, 8); slot[i].flags = 0; } } @@ -138,30 +138,46 @@ int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file, } static ssize_t ci_ll_write(struct dvb_ringbuffer *cibuf, struct file *file, - const char *buf, size_t count, loff_t *ppos) + const char __user *buf, size_t count, loff_t *ppos) { int free; int non_blocking = file->f_flags & O_NONBLOCK; + char *page = (char *)__get_free_page(GFP_USER); + int res; + if (!page) + return -ENOMEM; + + res = -EINVAL; if (count > 2048) - return -EINVAL; + goto out; + + res = -EFAULT; + if (copy_from_user(page, buf, count)) + goto out; + free = dvb_ringbuffer_free(cibuf); if (count + 2 > free) { + res = -EWOULDBLOCK; if (non_blocking) - return -EWOULDBLOCK; + goto out; + res = -ERESTARTSYS; if (wait_event_interruptible(cibuf->queue, (dvb_ringbuffer_free(cibuf) >= count + 2))) - return -ERESTARTSYS; + goto out; } DVB_RINGBUFFER_WRITE_BYTE(cibuf, count >> 8); DVB_RINGBUFFER_WRITE_BYTE(cibuf, count & 0xff); - return dvb_ringbuffer_write(cibuf, buf, count, 1); + res = dvb_ringbuffer_write(cibuf, page, count); +out: + free_page((unsigned long)page); + return res; } static ssize_t ci_ll_read(struct dvb_ringbuffer *cibuf, struct file *file, - char *buf, size_t count, loff_t *ppos) + char __user *buf, size_t count, loff_t *ppos) { int avail; int non_blocking = file->f_flags & O_NONBLOCK; @@ -297,7 +313,7 @@ static int dvb_ca_ioctl(struct inode *inode, struct file *file, return 0; } -static ssize_t dvb_ca_write(struct file *file, const char *buf, +static ssize_t dvb_ca_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev = (struct dvb_device *) file->private_data; @@ -307,7 +323,7 @@ static ssize_t dvb_ca_write(struct file *file, const char *buf, return ci_ll_write(&av7110->ci_wbuffer, file, buf, count, ppos); } -static ssize_t dvb_ca_read(struct file *file, char *buf, +static ssize_t dvb_ca_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev = (struct dvb_device *) file->private_data; @@ -330,7 +346,7 @@ static struct file_operations dvb_ca_fops = { }; static struct dvb_device dvbdev_ca = { - .priv = 0, + .priv = NULL, .users = 1, .writers = 1, .fops = &dvb_ca_fops, diff --git a/linux/drivers/media/dvb/ttpci/av7110_hw.c b/linux/drivers/media/dvb/ttpci/av7110_hw.c index 8b4388a61..71cfa7f05 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_hw.c +++ b/linux/drivers/media/dvb/ttpci/av7110_hw.c @@ -733,7 +733,7 @@ static osd_raw_window_t bpp2bit[8] = { }; static inline int LoadBitmap(struct av7110 *av7110, u16 format, - u16 dx, u16 dy, int inc, u8* data) + u16 dx, u16 dy, int inc, u8 __user * data) { int bpp; int i; @@ -848,7 +848,7 @@ static void OSDSetColor(struct av7110 *av7110, u8 color, u8 r, u8 g, u8 b, u8 bl color, ((blend >> 4) & 0x0f)); } -static int OSDSetPalette(struct av7110 *av7110, u32 *colors, u8 first, u8 last) +static int OSDSetPalette(struct av7110 *av7110, u32 __user * colors, u8 first, u8 last) { int i; int length = last - first + 1; @@ -860,10 +860,10 @@ static int OSDSetPalette(struct av7110 *av7110, u32 *colors, u8 first, u8 last) u32 color, blend, yuv; if (get_user(color, colors + i)) - return -EFAULT; + return -EFAULT; blend = (color & 0xF0000000) >> 4; yuv = blend ? RGB2YUV(color & 0xFF, (color >> 8) & 0xFF, - (color >> 16) & 0xFF) | blend : 0; + (color >> 16) & 0xFF) | blend : 0; yuv = ((yuv & 0xFFFF0000) >> 16) | ((yuv & 0x0000FFFF) << 16); wdebi(av7110, DEBINOSWAP, DATA_BUFF3_BASE + i * 4, yuv, 4); } @@ -874,7 +874,7 @@ static int OSDSetPalette(struct av7110 *av7110, u32 *colors, u8 first, u8 last) } static int OSDSetBlock(struct av7110 *av7110, int x0, int y0, - int x1, int y1, int inc, u8 *data) + int x1, int y1, int inc, u8 __user * data) { uint w, h, bpp, bpl, size, lpb, bnum, brest; int i; diff --git a/linux/drivers/media/dvb/ttpci/av7110_ir.c b/linux/drivers/media/dvb/ttpci/av7110_ir.c index 8691df9b5..9847c0b97 100644 --- a/linux/drivers/media/dvb/ttpci/av7110_ir.c +++ b/linux/drivers/media/dvb/ttpci/av7110_ir.c @@ -136,7 +136,7 @@ static void input_repeat_key(unsigned long data) } -static int av7110_ir_write_proc(struct file *file, const char *buffer, +static int av7110_ir_write_proc(struct file *file, const char __user *buffer, unsigned long count, void *data) { char *page; |