[DVB] PATCH: Handling failure of dvb_frontend_start in dvb_frontend_open [2.5.69-70]

Daniele Bellucci (dbellucci@mybox.it)
Tue, 3 Jun 2003 22:34:57 +0200


This patch applies both to 2.5.69 and to 2.5.70

diff -urN linux-2.5.69-my/drivers/media/dvb/dvb-core/dvb_frontend.c linux-2.5.69/drivers/media/dvb/dvb-core/dvb_frontend.c
--- linux-2.5.69-my/drivers/media/dvb/dvb-core/dvb_frontend.c 2003-06-03 21:54:32.000000000 +0200
+++ linux-2.5.69/drivers/media/dvb/dvb-core/dvb_frontend.c 2003-06-03 22:08:07.000000000 +0200
@@ -20,6 +20,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ *
+ * Changes:
+ * 03/06/2003: handling failure of dvb_frontend_start in dvb_frontend_open
+ * Daniele Bellucci <bellucda@tiscali.it>.
*/

#include <linux/sched.h>
@@ -527,20 +531,21 @@


static
-void dvb_frontend_start (struct dvb_frontend_data *fe)
+pid_t dvb_frontend_start (struct dvb_frontend_data *fe)
{
+ pid_t dvb_kthread;
dprintk ("%s\n", __FUNCTION__);

if (fe->thread)
dvb_frontend_stop (fe);

if (down_interruptible (&fe->sem))
- return;
+ return -ERESTARTSYS;

fe->exit = 0;
fe->thread = (void*) ~0;

- kernel_thread (dvb_frontend_thread, fe, 0);
+ return kernel_thread (dvb_frontend_thread, fe, 0);
}


@@ -610,6 +615,7 @@
{
struct dvb_device *dvbdev = file->private_data;
struct dvb_frontend_data *fe = dvbdev->priv;
+ pid_t dvb_kthread;
int ret;

dprintk ("%s\n", __FUNCTION__);
@@ -618,12 +624,18 @@
return ret;

if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
- dvb_frontend_start (fe);
+ dvb_kthread = dvb_frontend_start (fe);
+ if (dvb_kthread < 0) {
+ ret = dvb_kthread;
+ dvb_generic_release(inode, file);
+ goto out;
+ }
+ }

/* empty event queue */
fe->events.eventr = fe->events.eventw;
}
-
+out:
return ret;
}

please apply.

Daniele Bellucci.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/