lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <cc4b6198b88277b2c0d56d288bde0e4c35e14d8b.1411397045.git.shuahkh@osg.samsung.com>
Date:	Mon, 22 Sep 2014 09:00:48 -0600
From:	Shuah Khan <shuahkh@....samsung.com>
To:	m.chehab@...sung.com, akpm@...ux-foundation.org,
	gregkh@...uxfoundation.org, crope@....fi, olebowle@....com,
	dheitmueller@...nellabs.co, hverkuil@...all.nl, ramakrmu@...co.com,
	sakari.ailus@...ux.intel.com, laurent.pinchart@...asonboard.com
Cc:	Shuah Khan <shuahkh@....samsung.com>, linux-kernel@...r.kernel.org,
	linux-media@...r.kernel.org
Subject: [PATCH 4/5] media: dvb-core changes to use media tuner token api

Change to hold media tuner token exclusive mode in
dvb_frontend_start() before starting the dvb thread
and release from dvb_frontend_thread() when thread
exits. dvb frontend thread is started only when the
dvb device is opened in Read/Write mode.

Signed-off-by: Shuah Khan <shuahkh@....samsung.com>
---
 drivers/media/dvb-core/dvb_frontend.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index c862ad7..22833c6 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -41,6 +41,7 @@
 #include <linux/jiffies.h>
 #include <linux/kthread.h>
 #include <asm/processor.h>
+#include <linux/media_tknres.h>
 
 #include "dvb_frontend.h"
 #include "dvbdev.h"
@@ -742,6 +743,7 @@ restart:
 	if (semheld)
 		up(&fepriv->sem);
 	dvb_frontend_wakeup(fe);
+	media_put_tuner_tkn(fe->dvb->device, MEDIA_MODE_DVB);
 	return 0;
 }
 
@@ -836,6 +838,13 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
 	fepriv->state = FESTATE_IDLE;
 	fe->exit = DVB_FE_NO_EXIT;
 	fepriv->thread = NULL;
+
+	ret = media_get_tuner_tkn(fe->dvb->device, MEDIA_MODE_DVB);
+	if (ret == -EBUSY) {
+		dev_info(fe->dvb->device, "dvb: Tuner is busy\n");
+		return ret;
+	}
+
 	mb();
 
 	fe_thread = kthread_run(dvb_frontend_thread, fe,
@@ -846,6 +855,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
 				"dvb_frontend_start: failed to start kthread (%d)\n",
 				ret);
 		up(&fepriv->sem);
+		media_put_tuner_tkn(fe->dvb->device, MEDIA_MODE_DVB);
 		return ret;
 	}
 	fepriv->thread = fe_thread;
-- 
1.7.10.4

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ