diff options
author | Andreas Oberritter <obi@linuxtv.org> | 2011-12-09 19:37:00 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-30 14:16:01 -0500 |
commit | b9d5efcceb6b34ee20111b62cf7be61ae79af4e9 (patch) | |
tree | 7a0dc9653474e821ebd2de3ee1d2f6faf9cab75f | |
parent | a1dca1e30ac7991d8a90a3377008c850eb466edf (diff) |
[media] DVB: dvb_frontend: fix delayed thread exit
There are some issues and miss-behaves at the dvb fe thread:
1) dvb_shutdown_timeout should be dvb_shutdown_timeout * HZ
instead of (dvb_shutdown_timeout * HZ + 1);
2) add a memory barrier to warrant that all CPU's will consider the
new value for release_jiffies;
3) wake up dvb thread also when fepriv->exit == DVB_FE_NO_EXIT.
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 66537b10132c..3ff37cfde6ab 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -507,7 +507,7 @@ static int dvb_frontend_is_exiting(struct dvb_frontend *fe) | |||
507 | return 1; | 507 | return 1; |
508 | 508 | ||
509 | if (fepriv->dvbdev->writers == 1) | 509 | if (fepriv->dvbdev->writers == 1) |
510 | if (time_after(jiffies, fepriv->release_jiffies + | 510 | if (time_after_eq(jiffies, fepriv->release_jiffies + |
511 | dvb_shutdown_timeout * HZ)) | 511 | dvb_shutdown_timeout * HZ)) |
512 | return 1; | 512 | return 1; |
513 | 513 | ||
@@ -2116,12 +2116,15 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) | |||
2116 | 2116 | ||
2117 | dprintk ("%s\n", __func__); | 2117 | dprintk ("%s\n", __func__); |
2118 | 2118 | ||
2119 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) | 2119 | if ((file->f_flags & O_ACCMODE) != O_RDONLY) { |
2120 | fepriv->release_jiffies = jiffies; | 2120 | fepriv->release_jiffies = jiffies; |
2121 | mb(); | ||
2122 | } | ||
2121 | 2123 | ||
2122 | ret = dvb_generic_release (inode, file); | 2124 | ret = dvb_generic_release (inode, file); |
2123 | 2125 | ||
2124 | if (dvbdev->users == -1) { | 2126 | if (dvbdev->users == -1) { |
2127 | wake_up(&fepriv->wait_queue); | ||
2125 | if (fepriv->exit != DVB_FE_NO_EXIT) { | 2128 | if (fepriv->exit != DVB_FE_NO_EXIT) { |
2126 | fops_put(file->f_op); | 2129 | fops_put(file->f_op); |
2127 | file->f_op = NULL; | 2130 | file->f_op = NULL; |