drivers/input: rm sched_[un]lock

We use enter_critical_section to protect the read and write of priv structures,
sched_lock is mainly used to prevent active context switching caused by nxsem_post.
We do not actively switch contexts when reading and writing priv structures,
so sched_lock can be removed.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2023-08-09 15:02:54 +08:00
committed by Xiang Xiao
parent 73867b9759
commit c712a00620
6 changed files with 16 additions and 53 deletions
+5 -9
View File
@@ -331,7 +331,6 @@ static int tsc2007_waitsample(FAR struct tsc2007_dev_s *priv,
* from getting control while we muck with the semaphores.
*/
sched_lock();
flags = enter_critical_section();
/* Now release the semaphore that manages mutually exclusive access to
@@ -374,14 +373,6 @@ errout:
*/
leave_critical_section(flags);
/* Restore pre-emption. We might get suspended here but that is okay
* because we already have our sample. Note: this means that if there
* were two threads reading from the TSC2007 for some reason, the data
* might be read out of order.
*/
sched_unlock();
return ret;
}
@@ -541,6 +532,10 @@ static void tsc2007_worker(FAR void *arg)
DEBUGASSERT(priv != NULL);
/* Get exclusive access to the driver data structure */
nxmutex_lock(&priv->devlock);
/* Get a pointer the callbacks for convenience (and so the code is not so
* ugly).
*/
@@ -715,6 +710,7 @@ static void tsc2007_worker(FAR void *arg)
errout:
config->enable(config, true);
nxmutex_unlock(&priv->devlock);
}
/****************************************************************************