summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorMarkus Rechberger <mrechberger@gmail.com>2007-04-14 10:19:36 -0300
committerMarkus Rechberger <mrechberger@gmail.com>2007-04-14 10:19:36 -0300
commitd6e9e2354396258d2a011ac9331472e705b87207 (patch)
tree3242b8d3a8ebab27ec5c2d38b8fa486fcd082ce5 /linux
parenta50993cda9ca49aa4129ed55460e9c0bbeeb0781 (diff)
downloadmediapointer-dvb-s2-d6e9e2354396258d2a011ac9331472e705b87207.tar.gz
mediapointer-dvb-s2-d6e9e2354396258d2a011ac9331472e705b87207.tar.bz2
Fix 3/3 for bug 7819: fixed hotplugging for dvbnet
From: Markus Rechberger <markus.rechberger@amd.com> fixed hotplugging for dvbnet Signed-off-by: Michal CIJOML Semler <cijoml@volny.cz> Signed-off-by: Markus Rechberger <markus.rechberger@amd.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_demux.c2
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_demux.h1
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c32
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.h1
4 files changed, 32 insertions, 4 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.c b/linux/drivers/media/dvb/dvb-core/dvb_demux.c
index f558ac9c0..6d8d1c3df 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -1208,8 +1208,6 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux)
dmx->disconnect_frontend = dvbdmx_disconnect_frontend;
dmx->get_pes_pids = dvbdmx_get_pes_pids;
- init_waitqueue_head (&dvbdemux->wait_queue);
-
mutex_init(&dvbdemux->mutex);
spin_lock_init(&dvbdemux->lock);
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_demux.h b/linux/drivers/media/dvb/dvb-core/dvb_demux.h
index dcf20c4e3..099b149e5 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_demux.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_demux.h
@@ -122,7 +122,6 @@ struct dvb_demux {
u16 pids[DMX_TS_PES_OTHER];
int playing;
int recording;
- wait_queue_head_t wait_queue;
#define DMX_MAX_PID 0x2000
struct list_head feed_list;
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index 3e94e6cf9..7089412e3 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -1476,11 +1476,36 @@ static int dvb_net_ioctl(struct inode *inode, struct file *file,
return dvb_usercopy(inode, file, cmd, arg, dvb_net_do_ioctl);
}
+static int dvb_net_close(struct inode *inode, struct file *file)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct dvb_net *dvbnet = dvbdev->priv;
+
+ if (!dvbdev)
+ return -ENODEV;
+
+ if ((file->f_flags & O_ACCMODE) == O_RDONLY) {
+ dvbdev->readers++;
+ } else {
+ dvbdev->writers++;
+ }
+
+ dvbdev->users++;
+
+ if(dvbdev->users == 1 && dvbnet->exit==1) {
+ fops_put(file->f_op);
+ file->f_op = NULL;
+ wake_up(&dvbdev->wait_queue);
+ }
+ return 0;
+}
+
+
static struct file_operations dvb_net_fops = {
.owner = THIS_MODULE,
.ioctl = dvb_net_ioctl,
.open = dvb_generic_open,
- .release = dvb_generic_release,
+ .release = dvb_net_close,
};
static struct dvb_device dvbdev_net = {
@@ -1495,6 +1520,11 @@ void dvb_net_release (struct dvb_net *dvbnet)
{
int i;
+ dvbnet->exit = 1;
+ if (dvbnet->dvbdev->users < 1)
+ wait_event(dvbnet->dvbdev->wait_queue,
+ dvbnet->dvbdev->users==1);
+
dvb_unregister_device(dvbnet->dvbdev);
for (i=0; i<DVB_NET_DEVICES_MAX; i++) {
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.h b/linux/drivers/media/dvb/dvb-core/dvb_net.h
index f14e4ca38..3a3126cae 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.h
@@ -36,6 +36,7 @@ struct dvb_net {
struct dvb_device *dvbdev;
struct net_device *device[DVB_NET_DEVICES_MAX];
int state[DVB_NET_DEVICES_MAX];
+ unsigned int exit:1;
struct dmx_demux *demux;
};