diff options
author | Markus Rechberger <markus.rechberger@amd.com> | 2007-04-14 09:19:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-04-27 14:45:32 -0400 |
commit | 2c4d336468b400f9a47d6c1785d230548b89ca24 (patch) | |
tree | 8f20269a1bb0e6385d4fb5b57b36009cdea85e27 /drivers/media | |
parent | 57861b432bda77f8bfafda2fb6f5a922d5f3aef1 (diff) |
V4L/DVB (5512): Fix 3/3 for bug 7819: fixed hotplugging for dvbnet
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 'drivers/media')
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_demux.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_demux.h | 1 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_net.c | 32 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_net.h | 1 |
4 files changed, 32 insertions, 4 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index f558ac9c0954..6d8d1c3df863 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
@@ -1208,8 +1208,6 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) | |||
1208 | dmx->disconnect_frontend = dvbdmx_disconnect_frontend; | 1208 | dmx->disconnect_frontend = dvbdmx_disconnect_frontend; |
1209 | dmx->get_pes_pids = dvbdmx_get_pes_pids; | 1209 | dmx->get_pes_pids = dvbdmx_get_pes_pids; |
1210 | 1210 | ||
1211 | init_waitqueue_head (&dvbdemux->wait_queue); | ||
1212 | |||
1213 | mutex_init(&dvbdemux->mutex); | 1211 | mutex_init(&dvbdemux->mutex); |
1214 | spin_lock_init(&dvbdemux->lock); | 1212 | spin_lock_init(&dvbdemux->lock); |
1215 | 1213 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.h b/drivers/media/dvb/dvb-core/dvb_demux.h index e1e91399afd9..2c5f915329ca 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.h +++ b/drivers/media/dvb/dvb-core/dvb_demux.h | |||
@@ -119,7 +119,6 @@ struct dvb_demux { | |||
119 | u16 pids[DMX_TS_PES_OTHER]; | 119 | u16 pids[DMX_TS_PES_OTHER]; |
120 | int playing; | 120 | int playing; |
121 | int recording; | 121 | int recording; |
122 | wait_queue_head_t wait_queue; | ||
123 | 122 | ||
124 | #define DMX_MAX_PID 0x2000 | 123 | #define DMX_MAX_PID 0x2000 |
125 | struct list_head feed_list; | 124 | struct list_head feed_list; |
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 6a5ab409c4e7..4ebf33a5ffa2 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -1439,11 +1439,36 @@ static int dvb_net_ioctl(struct inode *inode, struct file *file, | |||
1439 | return dvb_usercopy(inode, file, cmd, arg, dvb_net_do_ioctl); | 1439 | return dvb_usercopy(inode, file, cmd, arg, dvb_net_do_ioctl); |
1440 | } | 1440 | } |
1441 | 1441 | ||
1442 | static int dvb_net_close(struct inode *inode, struct file *file) | ||
1443 | { | ||
1444 | struct dvb_device *dvbdev = file->private_data; | ||
1445 | struct dvb_net *dvbnet = dvbdev->priv; | ||
1446 | |||
1447 | if (!dvbdev) | ||
1448 | return -ENODEV; | ||
1449 | |||
1450 | if ((file->f_flags & O_ACCMODE) == O_RDONLY) { | ||
1451 | dvbdev->readers++; | ||
1452 | } else { | ||
1453 | dvbdev->writers++; | ||
1454 | } | ||
1455 | |||
1456 | dvbdev->users++; | ||
1457 | |||
1458 | if(dvbdev->users == 1 && dvbnet->exit==1) { | ||
1459 | fops_put(file->f_op); | ||
1460 | file->f_op = NULL; | ||
1461 | wake_up(&dvbdev->wait_queue); | ||
1462 | } | ||
1463 | return 0; | ||
1464 | } | ||
1465 | |||
1466 | |||
1442 | static struct file_operations dvb_net_fops = { | 1467 | static struct file_operations dvb_net_fops = { |
1443 | .owner = THIS_MODULE, | 1468 | .owner = THIS_MODULE, |
1444 | .ioctl = dvb_net_ioctl, | 1469 | .ioctl = dvb_net_ioctl, |
1445 | .open = dvb_generic_open, | 1470 | .open = dvb_generic_open, |
1446 | .release = dvb_generic_release, | 1471 | .release = dvb_net_close, |
1447 | }; | 1472 | }; |
1448 | 1473 | ||
1449 | static struct dvb_device dvbdev_net = { | 1474 | static struct dvb_device dvbdev_net = { |
@@ -1458,6 +1483,11 @@ void dvb_net_release (struct dvb_net *dvbnet) | |||
1458 | { | 1483 | { |
1459 | int i; | 1484 | int i; |
1460 | 1485 | ||
1486 | dvbnet->exit = 1; | ||
1487 | if (dvbnet->dvbdev->users < 1) | ||
1488 | wait_event(dvbnet->dvbdev->wait_queue, | ||
1489 | dvbnet->dvbdev->users==1); | ||
1490 | |||
1461 | dvb_unregister_device(dvbnet->dvbdev); | 1491 | dvb_unregister_device(dvbnet->dvbdev); |
1462 | 1492 | ||
1463 | for (i=0; i<DVB_NET_DEVICES_MAX; i++) { | 1493 | for (i=0; i<DVB_NET_DEVICES_MAX; i++) { |
diff --git a/drivers/media/dvb/dvb-core/dvb_net.h b/drivers/media/dvb/dvb-core/dvb_net.h index f14e4ca38570..3a3126cae03b 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.h +++ b/drivers/media/dvb/dvb-core/dvb_net.h | |||
@@ -36,6 +36,7 @@ struct dvb_net { | |||
36 | struct dvb_device *dvbdev; | 36 | struct dvb_device *dvbdev; |
37 | struct net_device *device[DVB_NET_DEVICES_MAX]; | 37 | struct net_device *device[DVB_NET_DEVICES_MAX]; |
38 | int state[DVB_NET_DEVICES_MAX]; | 38 | int state[DVB_NET_DEVICES_MAX]; |
39 | unsigned int exit:1; | ||
39 | struct dmx_demux *demux; | 40 | struct dmx_demux *demux; |
40 | }; | 41 | }; |
41 | 42 | ||