summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c16
1 files changed, 16 insertions, 0 deletions
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 2f96cdf0f..3e9e5aa87 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -1518,7 +1518,13 @@ static int dvb_ca_en50221_io_open (struct inode *inode, struct file *file)
return err;
for (i = 0; i < ca->slot_count; i++) {
+
if (ca->slot_info[i].slot_state == DVB_CA_SLOTSTATE_RUNNING) {
+ /* for cards without IRQs, check if we can still talk to them */
+ if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE))
+ if (ca->pub->read_attribute_mem(ca->pub, i, 0) < 0)
+ dvb_ca_en50221_slot_shutdown (ca, i);
+
down_write (&ca->slot_info[i].sem);
dvb_ringbuffer_flush (&ca->slot_info[i].rx_buffer);
up_write (&ca->slot_info[i].sem);
@@ -1546,6 +1552,7 @@ static int dvb_ca_en50221_io_release (struct inode *inode, struct file *file)
struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
struct dvb_ca_private *ca = (struct dvb_ca_private *) dvbdev->priv;
int err;
+ int i;
dprintk ("%s\n", __FUNCTION__);
@@ -1553,6 +1560,15 @@ static int dvb_ca_en50221_io_release (struct inode *inode, struct file *file)
ca->open = 0;
dvb_ca_en50221_thread_update_delay (ca);
+ /* for cards without IRQs, check if we can still talk to them */
+ for (i = 0; i < ca->slot_count; i++) {
+ if (ca->slot_info[i].slot_state == DVB_CA_SLOTSTATE_RUNNING) {
+ if (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_CAMCHANGE))
+ if (ca->pub->read_attribute_mem(ca->pub, i, 0) < 0)
+ dvb_ca_en50221_slot_shutdown (ca, i);
+ }
+ }
+
err = dvb_generic_release (inode, file);
if (err < 0)
return err;