aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2007-08-25 11:00:23 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:06:59 -0400
commit48136e1e93195b56dc3d9b0730917241b3365633 (patch)
tree56314dc49a2c092a090424326d65a3c34be622d0 /drivers
parent226835d7e0a1136bce2a0b923e0832ab47450a30 (diff)
V4L/DVB (6105): dvb_frontend: ts_bus_ctrl() handling fixed
ts_bus_ctrl() should only be called by - the first open - the last release call. Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 880d499cd36a..07c0db2abfbc 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1056,18 +1056,15 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
1056 1056
1057 dprintk ("%s\n", __FUNCTION__); 1057 dprintk ("%s\n", __FUNCTION__);
1058 1058
1059 if ((ret = dvb_generic_open (inode, file)) < 0) 1059 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) {
1060 return ret; 1060 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0)
1061
1062 if (fe->ops.ts_bus_ctrl) {
1063 if ((ret = fe->ops.ts_bus_ctrl (fe, 1)) < 0) {
1064 dvb_generic_release (inode, file);
1065 return ret; 1061 return ret;
1066 }
1067 } 1062 }
1068 1063
1069 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 1064 if ((ret = dvb_generic_open (inode, file)) < 0)
1065 goto err1;
1070 1066
1067 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
1071 /* normal tune mode when opened R/W */ 1068 /* normal tune mode when opened R/W */
1072 fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; 1069 fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT;
1073 fepriv->tone = -1; 1070 fepriv->tone = -1;
@@ -1075,13 +1072,20 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
1075 1072
1076 ret = dvb_frontend_start (fe); 1073 ret = dvb_frontend_start (fe);
1077 if (ret) 1074 if (ret)
1078 dvb_generic_release (inode, file); 1075 goto err2;
1079 1076
1080 /* empty event queue */ 1077 /* empty event queue */
1081 fepriv->events.eventr = fepriv->events.eventw = 0; 1078 fepriv->events.eventr = fepriv->events.eventw = 0;
1082 } 1079 }
1083 1080
1084 return ret; 1081 return ret;
1082
1083err2:
1084 dvb_generic_release(inode, file);
1085err1:
1086 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl)
1087 fe->ops.ts_bus_ctrl(fe, 0);
1088 return ret;
1085} 1089}
1086 1090
1087static int dvb_frontend_release(struct inode *inode, struct file *file) 1091static int dvb_frontend_release(struct inode *inode, struct file *file)
@@ -1096,16 +1100,18 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
1096 if ((file->f_flags & O_ACCMODE) != O_RDONLY) 1100 if ((file->f_flags & O_ACCMODE) != O_RDONLY)
1097 fepriv->release_jiffies = jiffies; 1101 fepriv->release_jiffies = jiffies;
1098 1102
1099 if (fe->ops.ts_bus_ctrl)
1100 fe->ops.ts_bus_ctrl (fe, 0);
1101
1102 ret = dvb_generic_release (inode, file); 1103 ret = dvb_generic_release (inode, file);
1103 1104
1104 if (dvbdev->users==-1 && fepriv->exit==1) { 1105 if (dvbdev->users == -1) {
1105 fops_put(file->f_op); 1106 if (fepriv->exit == 1) {
1106 file->f_op = NULL; 1107 fops_put(file->f_op);
1107 wake_up(&dvbdev->wait_queue); 1108 file->f_op = NULL;
1109 wake_up(&dvbdev->wait_queue);
1110 }
1111 if (fe->ops.ts_bus_ctrl)
1112 fe->ops.ts_bus_ctrl(fe, 0);
1108 } 1113 }
1114
1109 return ret; 1115 return ret;
1110} 1116}
1111 1117