mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
nuttx/drivers: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/input/ads7843e.c
|
||||
*
|
||||
* Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Diego Sanchez <dsanchez@nx-engineering.com>
|
||||
*
|
||||
@@ -63,6 +63,7 @@
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wdog.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
@@ -340,7 +341,7 @@ static int ads7843e_sample(FAR struct ads7843e_dev_s *priv,
|
||||
* from changing until it has been reported.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Is there new ADS7843E sample data available? */
|
||||
|
||||
@@ -375,7 +376,7 @@ static int ads7843e_sample(FAR struct ads7843e_dev_s *priv,
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -398,7 +399,7 @@ static int ads7843e_waitsample(FAR struct ads7843e_dev_s *priv,
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Now release the semaphore that manages mutually exclusive access to
|
||||
* the device structure. This may cause other tasks to become ready to
|
||||
@@ -448,7 +449,7 @@ errout:
|
||||
* have pre-emption disabled.
|
||||
*/
|
||||
|
||||
irqrestore(flags);
|
||||
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
|
||||
@@ -1235,7 +1236,7 @@ int ads7843e_register(FAR struct spi_dev_s *spi,
|
||||
#ifdef CONFIG_ADS7843E_MULTIPLE
|
||||
priv->flink = g_ads7843elist;
|
||||
g_ads7843elist = priv;
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
#endif
|
||||
|
||||
/* Schedule work to perform the initial sampling and to set the data
|
||||
|
||||
Reference in New Issue
Block a user