summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c24
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h2
-rw-r--r--linux/drivers/media/dvb/ttpci/budget-av.c5
3 files changed, 10 insertions, 21 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 3e9e5aa87..fd3116c49 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -215,7 +215,7 @@ static int dvb_ca_en50221_check_camstatus (struct dvb_ca_private *ca, int slot)
}
/* poll mode */
- slot_status = ca->pub->poll_slot_status (ca->pub, slot);
+ slot_status = ca->pub->poll_slot_status (ca->pub, slot, ca->open);
cam_present_now = (slot_status & DVB_CA_EN50221_POLL_CAM_PRESENT) ? 1 : 0;
cam_changed = (slot_status & DVB_CA_EN50221_POLL_CAM_CHANGED) ? 1 : 0;
@@ -991,6 +991,7 @@ static int dvb_ca_en50221_thread (void *data)
char name[15];
int slot;
int flags;
+ int status;
int pktcount;
void *rxbuf;
@@ -1130,8 +1131,8 @@ static int dvb_ca_en50221_thread (void *data)
break;
case DVB_CA_SLOTSTATE_RUNNING:
- if (!ca->open)
- break;
+ if (!ca->open)
+ continue;
// no need to poll if the CAM supports IRQs
if (ca->slot_info[slot].da_irq_supported)
@@ -1139,7 +1140,7 @@ static int dvb_ca_en50221_thread (void *data)
// poll mode
pktcount = 0;
- while (dvb_ca_en50221_read_data(ca, slot, NULL, 0) > 0) {
+ while ((status = dvb_ca_en50221_read_data(ca, slot, NULL, 0)) > 0) {
if (!ca->open)
break;
@@ -1520,11 +1521,6 @@ static int dvb_ca_en50221_io_open (struct inode *inode, struct file *file)
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);
@@ -1552,7 +1548,6 @@ 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__);
@@ -1560,15 +1555,6 @@ 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;
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h
index 882ca41a2..dcb4e68b4 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.h
@@ -62,7 +62,7 @@ struct dvb_ca_en50221 {
* Poll slot status.
* Only necessary if DVB_CA_FLAG_EN50221_IRQ_CAMCHANGE is not set
*/
- int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot);
+ int (*poll_slot_status)(struct dvb_ca_en50221* ca, int slot, int open);
/* private data, used by caller */
void* data;
diff --git a/linux/drivers/media/dvb/ttpci/budget-av.c b/linux/drivers/media/dvb/ttpci/budget-av.c
index b6babd21a..ee5f0bc53 100644
--- a/linux/drivers/media/dvb/ttpci/budget-av.c
+++ b/linux/drivers/media/dvb/ttpci/budget-av.c
@@ -230,7 +230,7 @@ static int ciintf_slot_ts_enable (struct dvb_ca_en50221 *ca, int slot)
return 0;
}
-static int ciintf_poll_slot_status (struct dvb_ca_en50221 *ca, int slot)
+static int ciintf_poll_slot_status (struct dvb_ca_en50221 *ca, int slot, int open)
{
struct budget_av *budget_av = (struct budget_av *) ca->data;
struct saa7146_dev *saa = budget_av->budget.dev;
@@ -247,6 +247,9 @@ static int ciintf_poll_slot_status (struct dvb_ca_en50221 *ca, int slot)
if (cam)
budget_av->slot_status = 1;
+ } else if (!open) {
+ if (ciintf_read_cam_control(ca, 0, 0) == -ETIMEDOUT)
+ budget_av->slot_status = 0;
}
if (budget_av->slot_status == 1)