diff options
author | Kenneth Aafloy <devnull@localhost> | 2004-07-12 18:15:34 +0000 |
---|---|---|
committer | Kenneth Aafloy <devnull@localhost> | 2004-07-12 18:15:34 +0000 |
commit | bcfcd8a4a5a3ab5bac73391be855e5770379d504 (patch) | |
tree | 6682191b2ae7be87ef4867d5ae4d2c0c334e945b /linux/drivers/media/dvb/dvb-core | |
parent | 481ccf4d48f8ed8928ab6d2ef02b39a6349ac300 (diff) | |
download | mediapointer-dvb-s2-bcfcd8a4a5a3ab5bac73391be855e5770379d504.tar.gz mediapointer-dvb-s2-bcfcd8a4a5a3ab5bac73391be855e5770379d504.tar.bz2 |
- Properly lock the frontend module on open/close.
- Remove module ref count changes to av7110 and budget-core,
as they did not do the right thing.
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core')
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index a45978f5e..7748ba9b6 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -96,6 +96,7 @@ struct dvb_frontend_data { struct dvb_device *dvbdev; struct dvb_frontend_parameters parameters; struct dvb_fe_events events; + struct module *module; struct semaphore sem; struct list_head list_head; wait_queue_head_t wait_queue; @@ -834,6 +835,11 @@ static int dvb_frontend_open (struct inode *inode, struct file *file) fe->events.eventr = fe->events.eventw = 0; } + if (!ret && fe->module) { + if (!try_module_get(fe->module)) + return -EINVAL; + } + return ret; } @@ -842,13 +848,19 @@ static int dvb_frontend_release (struct inode *inode, struct file *file) { struct dvb_device *dvbdev = file->private_data; struct dvb_frontend_data *fe = dvbdev->priv; + int ret = 0; dprintk ("%s\n", __FUNCTION__); if ((file->f_flags & O_ACCMODE) != O_RDONLY) fe->release_jiffies = jiffies; - return dvb_generic_release (inode, file); + ret = dvb_generic_release (inode, file); + + if (!ret && fe->module) + module_put(fe->module); + + return ret; } @@ -1171,7 +1183,8 @@ dvb_register_frontend_new (int (*ioctl) (struct dvb_frontend *frontend, unsigned int cmd, void *arg), struct dvb_adapter *dvb_adapter, void *data, - struct dvb_frontend_info *info) + struct dvb_frontend_info *info, + struct module *module) { struct list_head *entry; struct dvb_frontend_data *fe; @@ -1201,6 +1214,7 @@ dvb_register_frontend_new (int (*ioctl) (struct dvb_frontend *frontend, init_MUTEX (&fe->events.sem); fe->events.eventw = fe->events.eventr = 0; fe->events.overflow = 0; + fe->module = module; fe->frontend.ioctl = ioctl; fe->frontend.dvb_adapter = dvb_adapter; |