Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193159
b: refs/heads/master
c: e36309f
h: refs/heads/master
i:
  193157: 509775d
  193155: be7f14e
  193151: ad505e3
v: v3
  • Loading branch information
matthieu castet authored and Mauro Carvalho Chehab committed May 19, 2010
1 parent c194e4c commit 5afba2e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8b661b508b3a4c8d9fc7a4b10507d3f1172947c3
refs/heads/master: e36309f54a6196792fce74100356ebdeaecabd56
25 changes: 17 additions & 8 deletions trunk/drivers/media/dvb/dvb-core/dvb_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ MODULE_PARM_DESC(dvb_mfe_wait_time, "Wait up to <mfe_wait_time> seconds on open(
* FESTATE_LOSTLOCK. When the lock has been lost, and we're searching it again.
*/

#define DVB_FE_NO_EXIT 0
#define DVB_FE_NORMAL_EXIT 1
#define DVB_FE_DEVICE_REMOVED 2

static DEFINE_MUTEX(frontend_mutex);

struct dvb_frontend_private {
Expand Down Expand Up @@ -497,7 +501,7 @@ static int dvb_frontend_is_exiting(struct dvb_frontend *fe)
{
struct dvb_frontend_private *fepriv = fe->frontend_priv;

if (fepriv->exit)
if (fepriv->exit != DVB_FE_NO_EXIT)
return 1;

if (fepriv->dvbdev->writers == 1)
Expand Down Expand Up @@ -559,7 +563,7 @@ static int dvb_frontend_thread(void *data)

if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
/* got signal or quitting */
fepriv->exit = 1;
fepriv->exit = DVB_FE_NORMAL_EXIT;
break;
}

Expand Down Expand Up @@ -673,7 +677,10 @@ static int dvb_frontend_thread(void *data)
}

fepriv->thread = NULL;
fepriv->exit = 0;
if (kthread_should_stop())
fepriv->exit = DVB_FE_DEVICE_REMOVED;
else
fepriv->exit = DVB_FE_NO_EXIT;
mb();

dvb_frontend_wakeup(fe);
Expand All @@ -686,7 +693,7 @@ static void dvb_frontend_stop(struct dvb_frontend *fe)

dprintk ("%s\n", __func__);

fepriv->exit = 1;
fepriv->exit = DVB_FE_NORMAL_EXIT;
mb();

if (!fepriv->thread)
Expand Down Expand Up @@ -755,7 +762,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
dprintk ("%s\n", __func__);

if (fepriv->thread) {
if (!fepriv->exit)
if (fepriv->exit == DVB_FE_NO_EXIT)
return 0;
else
dvb_frontend_stop (fe);
Expand All @@ -767,7 +774,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
return -EINTR;

fepriv->state = FESTATE_IDLE;
fepriv->exit = 0;
fepriv->exit = DVB_FE_NO_EXIT;
fepriv->thread = NULL;
mb();

Expand Down Expand Up @@ -1490,7 +1497,7 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,

dprintk("%s (%d)\n", __func__, _IOC_NR(cmd));

if (fepriv->exit)
if (fepriv->exit != DVB_FE_NO_EXIT)
return -ENODEV;

if ((file->f_flags & O_ACCMODE) == O_RDONLY &&
Expand Down Expand Up @@ -1916,6 +1923,8 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
int ret;

dprintk ("%s\n", __func__);
if (fepriv->exit == DVB_FE_DEVICE_REMOVED)
return -ENODEV;

if (adapter->mfe_shared) {
mutex_lock (&adapter->mfe_lock);
Expand Down Expand Up @@ -2008,7 +2017,7 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
ret = dvb_generic_release (inode, file);

if (dvbdev->users == -1) {
if (fepriv->exit == 1) {
if (fepriv->exit != DVB_FE_NO_EXIT) {
fops_put(file->f_op);
file->f_op = NULL;
wake_up(&dvbdev->wait_queue);
Expand Down

0 comments on commit 5afba2e

Please sign in to comment.