diff options
author | Michael Hunold <devnull@localhost> | 2004-08-18 17:44:05 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2004-08-18 17:44:05 +0000 |
commit | f9c9715b78a31c76a7c71f20925831cfe2c65506 (patch) | |
tree | e4da1641d7fbcff9933da75a2f532f3a813b547d /linux/drivers/media/dvb/dvb-core | |
parent | 0ec6de1c0fd4aee2037559520db72b6271f2fba3 (diff) | |
download | mediapointer-dvb-s2-f9c9715b78a31c76a7c71f20925831cfe2c65506.tar.gz mediapointer-dvb-s2-f9c9715b78a31c76a7c71f20925831cfe2c65506.tar.bz2 |
- nuke dvb functions stuff
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/Makefile | 2 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 10 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.h | 1 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_functions.c | 88 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_functions.h | 52 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.c | 66 | ||||
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvbdev.h | 10 |
8 files changed, 90 insertions, 146 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/Makefile b/linux/drivers/media/dvb/dvb-core/Makefile index b21da2ee6..9d534602a 100644 --- a/linux/drivers/media/dvb/dvb-core/Makefile +++ b/linux/drivers/media/dvb/dvb-core/Makefile @@ -3,7 +3,7 @@ # dvb-core-objs = dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o \ - dvb_ca_en50221.o dvb_functions.o dvb_frontend.o \ + dvb_ca_en50221.o dvb_frontend.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_ca_en50221.c b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 9567e00a8..448c0e304 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c @@ -279,7 +279,7 @@ static int dvb_ca_en50221_wait_if_status(struct dvb_ca_private* ca, int slot, u8 } /* wait for a bit */ - dvb_delay(1); + msleep(1); } dprintk("%s failed timeout:%lu\n", __FUNCTION__, jiffies - start); @@ -930,7 +930,11 @@ static int dvb_ca_en50221_thread(void* data) /* setup kernel thread */ snprintf(name, sizeof(name), "kdvb-ca-%i:%i", ca->dvbdev->adapter->num, ca->dvbdev->id); - dvb_kernel_thread_setup(name); + + lock_kernel (); + daemonize (name); + sigfillset (¤t->blocked); + unlock_kernel (); /* choose the correct initial delay */ dvb_ca_en50221_thread_update_delay(ca); @@ -1238,7 +1242,7 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, const char __user *buf } if (status != -EAGAIN) goto exit; - dvb_delay(1); + msleep(1); } if (!written) { status = -EIO; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index affc4dfdc..df58e8725 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -245,7 +245,7 @@ static void dvb_call_frontend_notifiers (struct dvb_frontend_data *fe, dprintk ("%s\n", __FUNCTION__); if (((s ^ fe->status) & FE_HAS_LOCK) && (s & FE_HAS_LOCK)) - dvb_delay (fe->info->notifier_delay); + msleep (fe->info->notifier_delay); fe->status = s; @@ -504,7 +504,10 @@ static int dvb_frontend_thread (void *data) snprintf (name, sizeof(name), "kdvb-fe-%i", fe->frontend.dvb_adapter->num); - dvb_kernel_thread_setup (name); + lock_kernel (); + daemonize (name); + sigfillset (¤t->blocked); + unlock_kernel (); dvb_call_frontend_notifiers (fe, 0); dvb_frontend_init (fe); diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h index e23c5f9b2..6d44705c1 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h @@ -34,6 +34,7 @@ #include <linux/i2c.h> #include <linux/module.h> #include <linux/errno.h> +#include <linux/delay.h> #include <linux/dvb/frontend.h> diff --git a/linux/drivers/media/dvb/dvb-core/dvb_functions.c b/linux/drivers/media/dvb/dvb-core/dvb_functions.c deleted file mode 100644 index 7530287f4..000000000 --- a/linux/drivers/media/dvb/dvb-core/dvb_functions.c +++ /dev/null @@ -1,88 +0,0 @@ -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/string.h> -#include <linux/module.h> -#include <linux/ioctl.h> -#include <linux/slab.h> -#include <linux/smp_lock.h> -#include <asm/uaccess.h> - -void dvb_kernel_thread_setup (const char *thread_name) -{ - lock_kernel (); - - daemonize (thread_name); - 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: - /* - * 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): - 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 __user *)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 __user *)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 deleted file mode 100644 index 0abb91c61..000000000 --- a/linux/drivers/media/dvb/dvb-core/dvb_functions.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * dvb_functions.h: isolate some Linux specific stuff from the dvb-core - * that can't be expressed as a one-liner - * in order to make porting to other environments easier - * - * Copyright (C) 2003 Convergence GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Lesser Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef __DVB_FUNCTIONS_H__ -#define __DVB_FUNCTIONS_H__ - -#include <linux/fs.h> - -/** - * a sleeping delay function, waits i ms - * - */ -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); - -#endif - diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 4cfed2a69..c62bffea9 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -321,6 +321,72 @@ int dvb_unregister_adapter(struct dvb_adapter *adap) return 0; } +/* 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: + /* + * 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): + 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 __user *)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 __user *)arg, parg, _IOC_SIZE(cmd))) + err = -EFAULT; + break; + } + +out: + if (mbuf) + kfree(mbuf); + + return err; +} static int __init init_dvbdev(void) { diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.h b/linux/drivers/media/dvb/dvb-core/dvbdev.h index c9e0f1b03..684bd5348 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.h +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.h @@ -89,5 +89,15 @@ 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); + +/* we don't mess with video_usercopy() any more, +we simply define out own dvb_usercopy(), which will hopefully 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)); + #endif /* #ifndef _DVBDEV_H_ */ |