mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
drivers: Disable priority inheritance on all semaphores used for signaling
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/analog/adc.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
@@ -441,9 +442,17 @@ int adc_register(FAR const char *path, FAR struct adc_dev_s *dev)
|
||||
|
||||
dev->ad_ocount = 0;
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&dev->ad_recv.af_sem, 0, 0);
|
||||
sem_init(&dev->ad_closesem, 0, 1);
|
||||
|
||||
/* The receive semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->ad_recv.af_sem, SEM_PRIO_NONE);
|
||||
|
||||
/* Reset the ADC hardware */
|
||||
|
||||
DEBUGASSERT(dev->ad_ops->ao_reset != NULL);
|
||||
|
||||
+10
-1
@@ -55,8 +55,9 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/analog/dac.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
@@ -515,9 +516,17 @@ int dac_register(FAR const char *path, FAR struct dac_dev_s *dev)
|
||||
|
||||
dev->ad_ocount = 0;
|
||||
|
||||
/* Initialize semaphores */
|
||||
|
||||
sem_init(&dev->ad_xmit.af_sem, 0, 0);
|
||||
sem_init(&dev->ad_closesem, 0, 1);
|
||||
|
||||
/* The transmit semaphore is used for signaling and, hence, should not have
|
||||
* priority inheritance enabled.
|
||||
*/
|
||||
|
||||
sem_setprotocol(&dev->ad_xmit.af_sem, SEM_PRIO_NONE);
|
||||
|
||||
dev->ad_ops->ao_reset(dev);
|
||||
|
||||
return register_driver(path, &dac_fops, 0555, dev);
|
||||
|
||||
Reference in New Issue
Block a user