drivers: Disable priority inheritance on all semaphores used for signaling

This commit is contained in:
Gregory Nutt
2016-11-03 11:00:47 -06:00
parent bdde5720ca
commit 4fcbe8e410
20 changed files with 184 additions and 19 deletions
+9
View File
@@ -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
View File
@@ -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);