diff options
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/Makefile | 2 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_compat.h | 32 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_demux.c | 1 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_functions.c | 99 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_functions.h | 15 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_ksyms.c | 65 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.c | 1 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.h | 5 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.c | 2 |
10 files changed, 117 insertions, 107 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/Makefile b/linux/drivers/media/dvb/dvb-core/Makefile index e3f63f4a8..a58e89e8c 100644 --- a/linux/drivers/media/dvb/dvb-core/Makefile +++ b/linux/drivers/media/dvb/dvb-core/Makefile @@ -3,6 +3,6 @@ # dvb-core-objs = dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ - dvb_frontend.o dvb_i2c.o dvb_net.o dvb_ksyms.o dvb_ringbuffer.o + dvb_functions.o dvb_frontend.o dvb_i2c.o dvb_net.o dvb_ksyms.o dvb_ringbuffer.o obj-$(CONFIG_DVB_CORE) += dvb-core.o diff --git a/linux/drivers/media/dvb/dvb-core/dvb_compat.h b/linux/drivers/media/dvb/dvb-core/dvb_compat.h index cd2d0c3f4..d2793a5d9 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_compat.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_compat.h @@ -10,43 +10,11 @@ /* necessary dummy functions due to the > 2.5.67 kernel i2c changes */ #define i2c_get_adapdata(adapter) (struct saa7146_dev*)adapter->data; -static inline -void kernel_thread_setup (const char *thread_name) -{ - lock_kernel (); - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)) - daemonize (); - strncpy (current->comm, thread_name, sizeof(current->comm)); -#else - daemonize (thread_name); -#endif - -/* not needed anymore in 2.5.x, done in daemonize() */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) - reparent_to_init (); -#endif - - sigfillset (¤t->blocked); - unlock_kernel (); -} - - - /** * compatibility crap for old kernels. No guarantee for a working driver * even when everything compiles. */ -/* we don't mess with video_usercopy() any more, -we simply define out own dvb_usercopy(), which will hopefull become -generic_usercopy() someday... */ - -extern int dvb_usercopy(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, - int (*func)(struct inode *inode, struct file *file, - unsigned int cmd, void *arg)); - /* FIXME: check what is really necessary in here */ #include <linux/module.h> #include <linux/list.h> diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c index 183d5f0c4..29699a433 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c @@ -28,6 +28,7 @@ #include <linux/module.h> #include <linux/poll.h> #include <linux/string.h> +#include <linux/crc32.h> #include "dvb_demux.h" #include "dvb_functions.h" diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index a1542b8b8..ee95bb16d 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -435,7 +435,7 @@ int dvb_frontend_thread (void *data) snprintf (name, sizeof(name), "kdvb-fe-%i:%i", fe->frontend.i2c->adapter->num, fe->frontend.i2c->id); - kernel_thread_setup (name); + dvb_kernel_thread_setup (name); fe->thread = current; fe->lost_sync_count = -1; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_functions.c b/linux/drivers/media/dvb/dvb-core/dvb_functions.c new file mode 100644 index 000000000..a2bc3ac15 --- /dev/null +++ b/linux/drivers/media/dvb/dvb-core/dvb_functions.c @@ -0,0 +1,99 @@ +#include <linux/smp_lock.h> +#include <linux/version.h> +#include <asm/uaccess.h> +#include <linux/string.h> +#include <linux/smp_lock.h> +#include <linux/version.h> +#include <linux/fs.h> +#include <asm/uaccess.h> +#include <asm/errno.h> +#include <linux/module.h> +#include <linux/ioctl.h> +#include <linux/slab.h> +#include <linux/fs.h> + +void dvb_kernel_thread_setup (const char *thread_name) +{ + lock_kernel (); + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)) + daemonize (); + strncpy (current->comm, thread_name, sizeof(current->comm)); +#else + daemonize (thread_name); +#endif + +/* not needed anymore in 2.5.x, done in daemonize() */ +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) + reparent_to_init(); +#endif + + sigfillset (¤t->blocked); + unlock_kernel (); +} + +/* if the miracle happens and "generic_usercopy()" is included into + the kernel, then this can vanish. please don't make the mistake and + define this as video_usercopy(). this will introduce a dependecy + to the v4l "videodev.o" module, which is unnecessary for some + cards (ie. the budget dvb-cards don't need the v4l module...) */ +int dvb_usercopy(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, + int (*func)(struct inode *inode, struct file *file, + unsigned int cmd, void *arg)) +{ + char sbuf[128]; + void *mbuf = NULL; + void *parg = NULL; + int err = -EINVAL; + + /* Copy arguments into temp kernel buffer */ + switch (_IOC_DIR(cmd)) { + case _IOC_NONE: + parg = (void *)arg; + break; + case _IOC_READ: /* some v4l ioctls are marked wrong ... */ + case _IOC_WRITE: + case (_IOC_WRITE | _IOC_READ): + if (_IOC_SIZE(cmd) <= sizeof(sbuf)) { + parg = sbuf; + } else { + /* too big to allocate from stack */ + mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL); + if (NULL == mbuf) + return -ENOMEM; + parg = mbuf; + } + + err = -EFAULT; + if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd))) + goto out; + break; + } + + /* call driver */ + if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD) + err = -EINVAL; + + if (err < 0) + goto out; + + /* Copy results into user buffer */ + switch (_IOC_DIR(cmd)) + { + case _IOC_READ: + case (_IOC_WRITE | _IOC_READ): + if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd))) + err = -EFAULT; + break; + } + +out: + if (mbuf) + kfree(mbuf); + + return err; +} + +EXPORT_SYMBOL(dvb_usercopy); +EXPORT_SYMBOL(dvb_kernel_thread_setup); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_functions.h b/linux/drivers/media/dvb/dvb-core/dvb_functions.h index f37bd8bad..6e67b684c 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_functions.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_functions.h @@ -5,13 +5,24 @@ * a sleeping delay function, waits i ms * */ -static -inline void dvb_delay(int i) +static inline +void dvb_delay(int i) { current->state=TASK_INTERRUPTIBLE; schedule_timeout((HZ*i)/1000); } +/* we don't mess with video_usercopy() any more, +we simply define out own dvb_usercopy(), which will hopefull become +generic_usercopy() someday... */ + +extern int dvb_usercopy(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, + int (*func)(struct inode *inode, struct file *file, + unsigned int cmd, void *arg)); + +extern void dvb_kernel_thread_setup (const char *thread_name); + #include "dvb_compat.h" #endif diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ksyms.c b/linux/drivers/media/dvb/dvb-core/dvb_ksyms.c index 776570f3b..af43e441a 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ksyms.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ksyms.c @@ -11,71 +11,6 @@ #include "dvb_net.h" #include "dvb_filter.h" - -/* if the miracle happens and "generic_usercopy()" is included into - the kernel, then this can vanish. please don't make the mistake and - define this as video_usercopy(). this will introduce a dependecy - to the v4l "videodev.o" module, which is unnecessary for some - cards (ie. the budget dvb-cards don't need the v4l module...) */ -int dvb_usercopy(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, - int (*func)(struct inode *inode, struct file *file, - unsigned int cmd, void *arg)) -{ - char sbuf[128]; - void *mbuf = NULL; - void *parg = NULL; - int err = -EINVAL; - - /* Copy arguments into temp kernel buffer */ - switch (_IOC_DIR(cmd)) { - case _IOC_NONE: - parg = (void *)arg; - break; - case _IOC_READ: /* some v4l ioctls are marked wrong ... */ - case _IOC_WRITE: - case (_IOC_WRITE | _IOC_READ): - if (_IOC_SIZE(cmd) <= sizeof(sbuf)) { - parg = sbuf; - } else { - /* too big to allocate from stack */ - mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL); - if (NULL == mbuf) - return -ENOMEM; - parg = mbuf; - } - - err = -EFAULT; - if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd))) - goto out; - break; - } - - /* call driver */ - if ((err = func(inode, file, cmd, parg)) == -ENOIOCTLCMD) - err = -EINVAL; - - if (err < 0) - goto out; - - /* Copy results into user buffer */ - switch (_IOC_DIR(cmd)) - { - case _IOC_READ: - case (_IOC_WRITE | _IOC_READ): - if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd))) - err = -EFAULT; - break; - } - -out: - if (mbuf) - kfree(mbuf); - - return err; -} -EXPORT_SYMBOL(dvb_usercopy); - EXPORT_SYMBOL(dvb_dmxdev_init); EXPORT_SYMBOL(dvb_dmxdev_release); EXPORT_SYMBOL(dvb_dmx_init); diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 9d6d6881f..dedba56d7 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -30,6 +30,7 @@ #include <linux/sched.h> #include <linux/init.h> #include <linux/slab.h> +#include <linux/version.h> #include "dvbdev.h" #include "dvb_functions.h" diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.h b/linux/drivers/media/dvb/dvb-core/dvbdev.h index fcf42e347..33b8089b2 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.h +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.h @@ -86,10 +86,5 @@ extern int dvb_generic_open (struct inode *inode, struct file *file); extern int dvb_generic_release (struct inode *inode, struct file *file); extern int dvb_generic_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg); -int dvb_usercopy(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg, - int (*func)(struct inode *inode, struct file *file, - unsigned int cmd, void *arg)); - #endif /* #ifndef _DVBDEV_H_ */ diff --git a/linux/drivers/media/dvb/ttpci/av7110.c b/linux/drivers/media/dvb/ttpci/av7110.c index 6a0d2878c..11185d662 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.c +++ b/linux/drivers/media/dvb/ttpci/av7110.c @@ -339,7 +339,7 @@ static int arm_thread(void *data) DEB_EE(("av7110: %p\n",av7110)); - kernel_thread_setup ("arm_mon"); + dvb_kernel_thread_setup ("arm_mon"); av7110->arm_thread = current; while (!av7110->arm_rmmod && !signal_pending(current)) { |