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
+13
View File
@@ -60,6 +60,7 @@
#include <nuttx/fs/fs.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -1864,6 +1865,12 @@ static FAR struct usbhost_class_s *
sem_init(&priv->exclsem, 0, 1);
sem_init(&priv->waitsem, 0, 0);
/* The waitsem semaphore is used for signaling and, hence, should
* not have priority inheritance enabled.
*/
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
/* Return the instance of the USB keyboard class driver */
return &priv->usbclass;
@@ -2423,6 +2430,12 @@ int usbhost_kbdinit(void)
sem_init(&g_exclsem, 0, 1);
sem_init(&g_syncsem, 0, 0);
/* The g_syncsem semaphore is used for signaling and, hence, should not
* have priority inheritance enabled.
*/
sem_setprotocol(&g_syncsem, SEM_PRIO_NONE);
/* Advertise our availability to support (certain) devices */
return usbhost_registerclass(&g_hidkbd);
+13
View File
@@ -57,6 +57,7 @@
#include <nuttx/kthread.h>
#include <nuttx/fs/fs.h>
#include <nuttx/wqueue.h>
#include <nuttx/semaphore.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h>
@@ -1934,6 +1935,12 @@ static FAR struct usbhost_class_s *
sem_init(&priv->exclsem, 0, 1);
sem_init(&priv->waitsem, 0, 0);
/* The waitsem semaphore is used for signaling and, hence, should
* not have priority inheritance enabled.
*/
sem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
/* Return the instance of the USB mouse class driver */
return &priv->usbclass;
@@ -2553,6 +2560,12 @@ int usbhost_mouse_init(void)
sem_init(&g_exclsem, 0, 1);
sem_init(&g_syncsem, 0, 0);
/* The g_syncsem semaphore is used for signaling and, hence, should not
* have priority inheritance enabled.
*/
sem_setprotocol(&g_syncsem, SEM_PRIO_NONE);
/* Advertise our availability to support (certain) mouse devices */
return usbhost_registerclass(&g_hidmouse);