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/dvb-core | |
| 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/dvb-core')
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dmxdev.c | 46 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 8 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_demux.c | 26 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_functions.c | 12 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_i2c.c | 8 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_net.c | 25 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c | 21 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h | 7 | ||||
| -rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.c | 2 |
9 files changed, 74 insertions, 81 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dmxdev.c b/linux/drivers/media/dvb/dvb-core/dmxdev.c index 876cb1be8..741af182b 100644 --- a/linux/drivers/media/dvb/dvb-core/dmxdev.c +++ b/linux/drivers/media/dvb/dvb-core/dmxdev.c @@ -56,7 +56,7 @@ dvb_dmxdev_file_to_dvr(struct dmxdev *dmxdev, struct file *file) static inline void dvb_dmxdev_buffer_init(struct dmxdev_buffer *buffer) { - buffer->data=0; + buffer->data=NULL; buffer->size=8192; buffer->pread=0; buffer->pwrite=0; @@ -99,7 +99,7 @@ static inline int dvb_dmxdev_buffer_write(struct dmxdev_buffer *buf, const u8 *s } static ssize_t dvb_dmxdev_buffer_read(struct dmxdev_buffer *src, - int non_blocking, char *buf, size_t count, loff_t *ppos) + int non_blocking, char __user *buf, size_t count, loff_t *ppos) { unsigned long todo=count; int split, avail, error; @@ -164,12 +164,12 @@ static struct dmx_frontend * get_fe(struct dmx_demux *demux, int type) head=demux->get_frontends(demux); if (!head) - return 0; + return NULL; list_for_each(pos, head) if (DMX_FE_ENTRY(pos)->source==type) return DMX_FE_ENTRY(pos); - return 0; + return NULL; } static inline void dvb_dmxdev_dvr_state_set(struct dmxdev_dvr *dmxdevdvr, int state) @@ -246,7 +246,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file) void *mem=dmxdev->dvr_buffer.data; mb(); spin_lock_irq(&dmxdev->lock); - dmxdev->dvr_buffer.data=0; + dmxdev->dvr_buffer.data=NULL; spin_unlock_irq(&dmxdev->lock); vfree(mem); } @@ -255,7 +255,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file) return 0; } -static ssize_t dvb_dvr_write(struct file *file, const char *buf, +static ssize_t dvb_dvr_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev=(struct dvb_device *) file->private_data; @@ -273,7 +273,7 @@ static ssize_t dvb_dvr_write(struct file *file, const char *buf, return ret; } -static ssize_t dvb_dvr_read(struct file *file, char *buf, size_t count, +static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev=(struct dvb_device *) file->private_data; @@ -306,7 +306,7 @@ static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter, unsign return -EBUSY; spin_lock_irq(&dmxdevfilter->dev->lock); mem=buf->data; - buf->data=0; + buf->data=NULL; buf->size=size; buf->pwrite=buf->pread=0; spin_unlock_irq(&dmxdevfilter->dev->lock); @@ -499,7 +499,7 @@ static int dvb_dmxdev_filter_stop(struct dmxdev_filter *dmxdevfilter) release_filter(dmxdevfilter->feed.sec, dmxdevfilter->filter.sec); dvb_dmxdev_feed_restart(dmxdevfilter); - dmxdevfilter->feed.sec=0; + dmxdevfilter->feed.sec=NULL; break; case DMXDEV_TYPE_PES: if (!dmxdevfilter->feed.ts) @@ -508,7 +508,7 @@ static int dvb_dmxdev_filter_stop(struct dmxdev_filter *dmxdevfilter) dmxdevfilter->dev->demux-> release_ts_feed(dmxdevfilter->dev->demux, dmxdevfilter->feed.ts); - dmxdevfilter->feed.ts=0; + dmxdevfilter->feed.ts=NULL; break; default: if (dmxdevfilter->state==DMXDEV_STATE_ALLOCATED) @@ -560,8 +560,8 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) struct dmx_section_filter **secfilter=&filter->filter.sec; struct dmx_section_feed **secfeed=&filter->feed.sec; - *secfilter=0; - *secfeed=0; + *secfilter=NULL; + *secfeed=NULL; /* find active filter/feed with same PID */ for (i=0; i<dmxdev->filternum; i++) { @@ -642,7 +642,7 @@ static int dvb_dmxdev_filter_start(struct dmxdev_filter *filter) enum dmx_ts_pes ts_pes; struct dmx_ts_feed **tsfeed = &filter->feed.ts; - filter->feed.ts = 0; + filter->feed.ts = NULL; otype=para->output; ts_pes=(enum dmx_ts_pes) para->pes_type; @@ -719,7 +719,7 @@ static int dvb_demux_open(struct inode *inode, struct file *file) dvb_dmxdev_buffer_init(&dmxdevfilter->buffer); dmxdevfilter->type=DMXDEV_TYPE_NONE; dvb_dmxdev_filter_state_set(dmxdevfilter, DMXDEV_STATE_ALLOCATED); - dmxdevfilter->feed.ts=0; + dmxdevfilter->feed.ts=NULL; init_timer(&dmxdevfilter->timer); up(&dmxdev->mutex); @@ -744,7 +744,7 @@ static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, struct dmxdev_filter *d void *mem=dmxdevfilter->buffer.data; spin_lock_irq(&dmxdev->lock); - dmxdevfilter->buffer.data=0; + dmxdevfilter->buffer.data=NULL; spin_unlock_irq(&dmxdev->lock); vfree(mem); } @@ -808,7 +808,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev, } static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil, - struct file *file, char *buf, size_t count, loff_t *ppos) + struct file *file, char __user *buf, size_t count, loff_t *ppos) { int result, hcount; int done=0; @@ -847,7 +847,7 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil, ssize_t -dvb_demux_read(struct file *file, char *buf, size_t count, loff_t *ppos) +dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file); int ret=0; @@ -1010,7 +1010,7 @@ static struct file_operations dvb_demux_fops = { static struct dvb_device dvbdev_demux = { - .priv = 0, + .priv = NULL, .users = 1, .writers = 1, .fops = &dvb_demux_fops @@ -1083,7 +1083,7 @@ static struct file_operations dvb_dvr_fops = { }; static struct dvb_device dvbdev_dvr = { - .priv = 0, + .priv = NULL, .users = 1, .writers = 1, .fops = &dvb_dvr_fops @@ -1112,10 +1112,10 @@ dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter) spin_lock_init(&dmxdev->lock); for (i=0; i<dmxdev->filternum; i++) { dmxdev->filter[i].dev=dmxdev; - dmxdev->filter[i].buffer.data=0; + dmxdev->filter[i].buffer.data=NULL; dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE); dmxdev->dvr[i].dev=dmxdev; - dmxdev->dvr[i].buffer.data=0; + dmxdev->dvr[i].buffer.data=NULL; dvb_dmxdev_filter_state_set(&dmxdev->filter[i], DMXDEV_STATE_FREE); dvb_dmxdev_dvr_state_set(&dmxdev->dvr[i], DMXDEV_STATE_FREE); } @@ -1136,12 +1136,12 @@ dvb_dmxdev_release(struct dmxdev *dmxdev) if (dmxdev->filter) { vfree(dmxdev->filter); - dmxdev->filter=0; + dmxdev->filter=NULL; } if (dmxdev->dvr) { vfree(dmxdev->dvr); - dmxdev->dvr=0; + dmxdev->dvr=NULL; } dmxdev->demux->close(dmxdev->demux); } diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 346138f3b..f93be91a9 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -621,7 +621,7 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private* ca, int slot, u8* ebu /* OK, add it to the receive buffer, or copy into external buffer if supplied */ if (ebuf == NULL) { down_read(&ca->slot_info[slot].sem); - dvb_ringbuffer_pkt_write(&ca->slot_info[slot].rx_buffer, buf, bytes_read, 0); + dvb_ringbuffer_pkt_write(&ca->slot_info[slot].rx_buffer, buf, bytes_read); up_read(&ca->slot_info[slot].sem); } else { memcpy(ebuf, buf, bytes_read); @@ -1180,7 +1180,7 @@ static int dvb_ca_en50221_io_ioctl(struct inode *inode, struct file *file, unsig * * @return Number of bytes read, or <0 on error. */ -static ssize_t dvb_ca_en50221_io_write(struct file *file, const char *buf, size_t count, loff_t *ppos) +static ssize_t dvb_ca_en50221_io_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev=(struct dvb_device *) file->private_data; struct dvb_ca_private *ca=(struct dvb_ca_private*) dvbdev->priv; @@ -1295,7 +1295,7 @@ nextslot: * * @return Number of bytes read, or <0 on error. */ -static ssize_t dvb_ca_en50221_io_read(struct file *file, char *buf, size_t count, loff_t *ppos) +static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct dvb_device *dvbdev=(struct dvb_device *) file->private_data; struct dvb_ca_private *ca=(struct dvb_ca_private*) dvbdev->priv; @@ -1488,7 +1488,7 @@ static struct file_operations dvb_ca_fops = { }; static struct dvb_device dvbdev_ca = { - priv: 0, + priv: NULL, users: 1, readers: 1, writers: 1, diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index ccf8a5b66..3e965f01e 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -162,7 +162,7 @@ static inline int dvb_dmx_swfilter_payload (struct dvb_demux_feed *feed, const u feed->peslen += count; - return feed->cb.ts (&buf[p], count, 0, 0, &feed->feed.ts, DMX_OK); + return feed->cb.ts (&buf[p], count, NULL, 0, &feed->feed.ts, DMX_OK); } @@ -185,7 +185,7 @@ static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed, return 0; return feed->cb.sec (feed->feed.sec.secbuf, feed->feed.sec.seclen, - 0, 0, &f->filter, DMX_OK); + NULL, 0, &f->filter, DMX_OK); } @@ -375,7 +375,7 @@ static inline void dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, con if (feed->ts_type & TS_PAYLOAD_ONLY) dvb_dmx_swfilter_payload(feed, buf); else - feed->cb.ts(buf, 188, 0, 0, &feed->feed.ts, DMX_OK); + feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK); } if (feed->ts_type & TS_DECODER) if (feed->demux->write_to_decoder) @@ -424,7 +424,7 @@ void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) } if (feed->pid == 0x2000) - feed->cb.ts(buf, 188, 0, 0, &feed->feed.ts, DMX_OK); + feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK); } } @@ -644,7 +644,7 @@ static int dmx_ts_feed_set (struct dmx_ts_feed* ts_feed, u16 pid, int ts_type, if (feed->buffer_size) { #ifdef NOBUFS - feed->buffer=0; + feed->buffer=NULL; #else feed->buffer = vmalloc(feed->buffer_size); if (!feed->buffer) { @@ -743,11 +743,11 @@ static int dvbdmx_allocate_ts_feed (struct dmx_demux *dmx, struct dmx_ts_feed ** feed->demux = demux; feed->pid = 0xffff; feed->peslen = 0xfffa; - feed->buffer = 0; + feed->buffer = NULL; (*ts_feed) = &feed->feed.ts; (*ts_feed)->parent = dmx; - (*ts_feed)->priv = 0; + (*ts_feed)->priv = NULL; (*ts_feed)->is_filtering = 0; (*ts_feed)->start_filtering = dmx_ts_feed_start_filtering; (*ts_feed)->stop_filtering = dmx_ts_feed_stop_filtering; @@ -827,7 +827,7 @@ static int dmx_section_feed_allocate_filter(struct dmx_section_feed* feed, spin_lock_irq(&dvbdemux->lock); *filter = &dvbdmxfilter->filter; (*filter)->parent = feed; - (*filter)->priv = 0; + (*filter)->priv = NULL; dvbdmxfilter->feed = dvbdmxfeed; dvbdmxfilter->type = DMX_TYPE_SEC; dvbdmxfilter->state = DMX_STATE_READY; @@ -866,7 +866,7 @@ static int dmx_section_feed_set(struct dmx_section_feed* feed, dvbdmxfeed->feed.sec.check_crc = check_crc; #ifdef NOBUFS - dvbdmxfeed->buffer = 0; + dvbdmxfeed->buffer = NULL; #else dvbdmxfeed->buffer=vmalloc(dvbdmxfeed->buffer_size); if (!dvbdmxfeed->buffer) { @@ -1033,13 +1033,13 @@ static int dvbdmx_allocate_section_feed(struct dmx_demux *demux, dvbdmxfeed->feed.sec.secbuf = dvbdmxfeed->feed.sec.secbuf_base; dvbdmxfeed->feed.sec.secbufp = dvbdmxfeed->feed.sec.seclen = 0; dvbdmxfeed->feed.sec.tsfeedp = 0; - dvbdmxfeed->filter = 0; - dvbdmxfeed->buffer = 0; + dvbdmxfeed->filter = NULL; + dvbdmxfeed->buffer = NULL; (*feed)=&dvbdmxfeed->feed.sec; (*feed)->is_filtering = 0; (*feed)->parent = demux; - (*feed)->priv = 0; + (*feed)->priv = NULL; (*feed)->set = dmx_section_feed_set; (*feed)->allocate_filter = dmx_section_feed_allocate_filter; @@ -1251,7 +1251,7 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) if (!dvbdemux->memcopy) dvbdemux->memcopy = dvb_dmx_memcopy; - dmx->frontend = 0; + dmx->frontend = NULL; dmx->reg_list.prev = dmx->reg_list.next = &dmx->reg_list; dmx->priv = (void *) dvbdemux; dmx->open = dvbdmx_open; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_functions.c b/linux/drivers/media/dvb/dvb-core/dvb_functions.c index fb53bf492..7530287f4 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_functions.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_functions.c @@ -35,8 +35,12 @@ int dvb_usercopy(struct inode *inode, struct file *file, /* Copy arguments into temp kernel buffer */ switch (_IOC_DIR(cmd)) { case _IOC_NONE: - parg = (void *)arg; - break; + /* + * For this command, the pointer is actually an integer + * argument. + */ + parg = (void *) arg; + break; case _IOC_READ: /* some v4l ioctls are marked wrong ... */ case _IOC_WRITE: case (_IOC_WRITE | _IOC_READ): @@ -51,7 +55,7 @@ int dvb_usercopy(struct inode *inode, struct file *file, } err = -EFAULT; - if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd))) + if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd))) goto out; break; } @@ -68,7 +72,7 @@ int dvb_usercopy(struct inode *inode, struct file *file, { case _IOC_READ: case (_IOC_WRITE | _IOC_READ): - if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd))) + if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd))) err = -EFAULT; break; } diff --git a/linux/drivers/media/dvb/dvb-core/dvb_i2c.c b/linux/drivers/media/dvb/dvb-core/dvb_i2c.c index fd4989f4f..8bc8b5e7b 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_i2c.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_i2c.c @@ -191,8 +191,10 @@ dvb_register_i2c_bus (int (*xfer) (struct dvb_i2c_bus *i2c, if (down_interruptible (&dvb_i2c_mutex)) return NULL; - if (!(i2c = kmalloc (sizeof (struct dvb_i2c_bus), GFP_KERNEL))) + if (!(i2c = kmalloc (sizeof (struct dvb_i2c_bus), GFP_KERNEL))) { + up (&dvb_i2c_mutex); return NULL; + } INIT_LIST_HEAD(&i2c->list_head); INIT_LIST_HEAD(&i2c->client_list); @@ -239,8 +241,10 @@ int dvb_register_i2c_device (struct module *owner, if (down_interruptible (&dvb_i2c_mutex)) return -ERESTARTSYS; - if (!(entry = kmalloc (sizeof (struct dvb_i2c_device), GFP_KERNEL))) + if (!(entry = kmalloc (sizeof (struct dvb_i2c_device), GFP_KERNEL))) { + up(&dvb_i2c_mutex); return -ENOMEM; + } entry->owner = owner; entry->attach = attach; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index cbaf4155c..780a02fb6 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -677,7 +677,7 @@ static int dvb_net_filter_sec_set(struct net_device *dev, struct dvb_net_priv *priv = (struct dvb_net_priv*) dev->priv; int ret; - *secfilter=0; + *secfilter=NULL; ret = priv->secfeed->allocate_filter(priv->secfeed, secfilter); if (ret<0) { printk("%s: could not get filter\n", dev->name); @@ -726,9 +726,9 @@ static int dvb_net_feed_start(struct net_device *dev) if (priv->secfeed || priv->secfilter || priv->multi_secfilter[0]) printk("%s: BUG %d\n", __FUNCTION__, __LINE__); - priv->secfeed=0; - priv->secfilter=0; - priv->tsfeed = 0; + priv->secfeed=NULL; + priv->secfilter=NULL; + priv->tsfeed = NULL; if (priv->feedtype == DVB_NET_FEEDTYPE_MPE) { dprintk("%s: alloc secfeed\n", __FUNCTION__); @@ -744,7 +744,7 @@ static int dvb_net_feed_start(struct net_device *dev) if (ret<0) { printk("%s: could not set section feed\n", dev->name); priv->demux->release_section_feed(priv->demux, priv->secfeed); - priv->secfeed=0; + priv->secfeed=NULL; return ret; } @@ -799,7 +799,7 @@ static int dvb_net_feed_start(struct net_device *dev) if (ret < 0) { printk("%s: could not set ts feed\n", dev->name); priv->demux->release_ts_feed(priv->demux, priv->tsfeed); - priv->tsfeed = 0; + priv->tsfeed = NULL; return ret; } @@ -828,7 +828,7 @@ static int dvb_net_feed_stop(struct net_device *dev) dprintk("%s: release secfilter\n", __FUNCTION__); priv->secfeed->release_filter(priv->secfeed, priv->secfilter); - priv->secfilter=0; + priv->secfilter=NULL; } for (i=0; i<priv->multi_num; i++) { @@ -837,12 +837,12 @@ static int dvb_net_feed_stop(struct net_device *dev) __FUNCTION__, i); priv->secfeed->release_filter(priv->secfeed, priv->multi_secfilter[i]); - priv->multi_secfilter[i] = 0; + priv->multi_secfilter[i] = NULL; } } priv->demux->release_section_feed(priv->demux, priv->secfeed); - priv->secfeed = 0; + priv->secfeed = NULL; } else printk("%s: no feed to stop\n", dev->name); } else if (priv->feedtype == DVB_NET_FEEDTYPE_ULE) { @@ -852,7 +852,7 @@ static int dvb_net_feed_stop(struct net_device *dev) priv->tsfeed->stop_filtering(priv->tsfeed); } priv->demux->release_ts_feed(priv->demux, priv->tsfeed); - priv->tsfeed = 0; + priv->tsfeed = NULL; } else printk("%s: no ts feed to stop\n", dev->name); @@ -1176,16 +1176,13 @@ static int dvb_net_ioctl(struct inode *inode, struct file *file, static struct file_operations dvb_net_fops = { .owner = THIS_MODULE, - .read = 0, - .write = 0, .ioctl = dvb_net_ioctl, .open = dvb_generic_open, .release = dvb_generic_release, - .poll = 0, }; static struct dvb_device dvbdev_net = { - .priv = 0, + .priv = NULL, .users = 1, .writers = 1, .fops = &dvb_net_fops, diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c index d761c3fe3..fb6d94a69 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c @@ -133,8 +133,7 @@ ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, in -ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, - size_t len, int usermem) +ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len) { size_t todo = len; size_t split; @@ -142,28 +141,18 @@ ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, split = (rbuf->pwrite + len > rbuf->size) ? rbuf->size - rbuf->pwrite : 0; if (split > 0) { - if (!usermem) - memcpy(rbuf->data+rbuf->pwrite, buf, split); - else - if (copy_from_user(rbuf->data+rbuf->pwrite, - buf, split)) - return -EFAULT; + memcpy(rbuf->data+rbuf->pwrite, buf, split); buf += split; todo -= split; rbuf->pwrite = 0; } - if (!usermem) - memcpy(rbuf->data+rbuf->pwrite, buf, todo); - else - if (copy_from_user(rbuf->data+rbuf->pwrite, buf, todo)) - return -EFAULT; - + memcpy(rbuf->data+rbuf->pwrite, buf, todo); rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size; return len; } -ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len, int usermem) +ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len) { int status; ssize_t oldpwrite = rbuf->pwrite; @@ -171,7 +160,7 @@ ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t le DVB_RINGBUFFER_WRITE_BYTE(rbuf, len >> 8); DVB_RINGBUFFER_WRITE_BYTE(rbuf, len & 0xff); DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY); - status = dvb_ringbuffer_write(rbuf, buf, len, usermem); + status = dvb_ringbuffer_write(rbuf, buf, len); if (status < 0) rbuf->pwrite = oldpwrite; return status; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h index c72f6cb82..d18e9c4ba 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h @@ -53,7 +53,7 @@ struct dvb_ringbuffer { ** *** write <buflen> bytes *** ** free = dvb_ringbuffer_free(rbuf); ** if (free >= buflen) -** count = dvb_ringbuffer_write(rbuf, buffer, buflen, 0); +** count = dvb_ringbuffer_write(rbuf, buffer, buflen); ** else ** ... ** @@ -121,7 +121,7 @@ extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, ** returns number of bytes transferred or -EFAULT */ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, - size_t len, int usermem); + size_t len); /** @@ -130,11 +130,10 @@ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, * <rbuf> Ringbuffer to write to. * <buf> Buffer to write. * <len> Length of buffer (currently limited to 65535 bytes max). - * <usermem> Set to 1 if <buf> is in userspace. * returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL. */ extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, - size_t len, int usermem); + size_t len); /** * Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 5066ff0aa..a41bd09f5 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -194,7 +194,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, if ((id = dvbdev_get_free_id (adap, type)) < 0) { up (&dvbdev_register_lock); - *pdvbdev = 0; + *pdvbdev = NULL; printk ("%s: could get find free device id...\n", __FUNCTION__); return -ENFILE; } |
