From 626afb015b89cdafebd7d044f097a74d33b210bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81yszczek?= Date: Fri, 15 Feb 2019 19:18:55 -0600 Subject: [PATCH] nuttx/sched/mqueue: Change 'int prio' to 'unsigned int prio'. According to open group specification, priority field in mq_* functions should have unsigned type: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/mqueue.h.html --- drivers/audio/audio_null.c | 2 +- drivers/audio/cs43l22.c | 2 +- drivers/audio/vs1053.c | 2 +- drivers/audio/wm8776.c | 2 +- drivers/audio/wm8904.c | 2 +- include/mqueue.h | 13 ++++++++----- include/nuttx/mqueue.h | 12 +++++++----- sched/mqueue/mq_rcvinternal.c | 2 +- sched/mqueue/mq_receive.c | 4 ++-- sched/mqueue/mq_send.c | 5 +++-- sched/mqueue/mq_sndinternal.c | 6 +++--- sched/mqueue/mq_timedreceive.c | 6 ++++-- sched/mqueue/mq_timedsend.c | 8 ++++---- sched/mqueue/mqueue.h | 7 ++++--- wireless/bluetooth/bt_queue.c | 4 ++-- wireless/bluetooth/bt_queue.h | 2 +- 16 files changed, 44 insertions(+), 35 deletions(-) diff --git a/drivers/audio/audio_null.c b/drivers/audio/audio_null.c index 57aad1a499..f8df9af60f 100644 --- a/drivers/audio/audio_null.c +++ b/drivers/audio/audio_null.c @@ -424,7 +424,7 @@ static void *null_workerthread(pthread_addr_t pvarg) FAR struct null_dev_s *priv = (struct null_dev_s *) pvarg; struct audio_msg_s msg; int msglen; - int prio; + unsigned int prio; audinfo("Entry\n"); diff --git a/drivers/audio/cs43l22.c b/drivers/audio/cs43l22.c index b3e27cdc54..2f1336bd27 100644 --- a/drivers/audio/cs43l22.c +++ b/drivers/audio/cs43l22.c @@ -1560,7 +1560,7 @@ static void *cs43l22_workerthread(pthread_addr_t pvarg) struct audio_msg_s msg; FAR struct ap_buffer_s *apb; int msglen; - int prio; + unsigned int prio; audinfo("Entry\n"); diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c index 68ef2d5608..e71b57a7d1 100644 --- a/drivers/audio/vs1053.c +++ b/drivers/audio/vs1053.c @@ -1248,7 +1248,7 @@ static void *vs1053_workerthread(pthread_addr_t pvarg) struct audio_msg_s msg; FAR struct ap_buffer_s *apb; int size; - int prio; + unsigned int prio; #ifndef CONFIG_AUDIO_EXCLUDE_STOP uint16_t reg; #endif diff --git a/drivers/audio/wm8776.c b/drivers/audio/wm8776.c index d6531e0c1f..72953632b4 100644 --- a/drivers/audio/wm8776.c +++ b/drivers/audio/wm8776.c @@ -1151,7 +1151,7 @@ static void *wm8776_workerthread(pthread_addr_t pvarg) struct audio_msg_s msg; FAR struct ap_buffer_s *apb; int msglen; - int prio; + unsigned int prio; struct mq_attr attr; audinfo("Entry\n"); diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index 193dd62e63..536548b61e 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -2006,7 +2006,7 @@ static void *wm8904_workerthread(pthread_addr_t pvarg) struct audio_msg_s msg; FAR struct ap_buffer_s *apb; int msglen; - int prio; + unsigned int prio; audinfo("Entry\n"); diff --git a/include/mqueue.h b/include/mqueue.h index b1f2abaea3..d99f222753 100644 --- a/include/mqueue.h +++ b/include/mqueue.h @@ -87,11 +87,14 @@ extern "C" mqd_t mq_open(FAR const char *mq_name, int oflags, ...); int mq_close(mqd_t mqdes ); int mq_unlink(FAR const char *mq_name); -int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio); -int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio, - FAR const struct timespec *abstime); -ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, FAR int *prio); -ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, FAR int *prio, +int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio); +int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio, FAR const struct timespec *abstime); +ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, + FAR unsigned int *prio); +ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, + FAR unsigned int *prio, FAR const struct timespec *abstime); int mq_notify(mqd_t mqdes, const struct sigevent *notification); int mq_setattr(mqd_t mqdes, FAR const struct mq_attr *mq_stat, diff --git a/include/nuttx/mqueue.h b/include/nuttx/mqueue.h index f1c0f9f713..f3f514608a 100644 --- a/include/nuttx/mqueue.h +++ b/include/nuttx/mqueue.h @@ -181,7 +181,8 @@ struct task_group_s; /* Forward reference */ * ****************************************************************************/ -int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio); +int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen,\ + unsigned int prio); /**************************************************************************** * Name: nxmq_timedsend @@ -225,8 +226,8 @@ int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio); * ****************************************************************************/ -int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio, - FAR const struct timespec *abstime); +int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio, FAR const struct timespec *abstime); /**************************************************************************** * Name: nxmq_receive @@ -257,7 +258,7 @@ int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio, ****************************************************************************/ ssize_t nxmq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, - FAR int *prio); + FAR unsigned int *prio); /**************************************************************************** * Name: nxmq_timedreceive @@ -293,7 +294,8 @@ ssize_t nxmq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, ****************************************************************************/ ssize_t nxmq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, - FAR int *prio, FAR const struct timespec *abstime); + FAR unsigned int *prio, + FAR const struct timespec *abstime); /**************************************************************************** * Name: nxmq_free_msgq diff --git a/sched/mqueue/mq_rcvinternal.c b/sched/mqueue/mq_rcvinternal.c index 928a839ded..a170a945ff 100644 --- a/sched/mqueue/mq_rcvinternal.c +++ b/sched/mqueue/mq_rcvinternal.c @@ -260,7 +260,7 @@ int nxmq_wait_receive(mqd_t mqdes, FAR struct mqueue_msg_s **rcvmsg) ****************************************************************************/ ssize_t nxmq_do_receive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, - FAR char *ubuffer, int *prio) + FAR char *ubuffer, unsigned int *prio) { FAR struct tcb_s *btcb; irqstate_t flags; diff --git a/sched/mqueue/mq_receive.c b/sched/mqueue/mq_receive.c index 5961df770c..626dfd7106 100644 --- a/sched/mqueue/mq_receive.c +++ b/sched/mqueue/mq_receive.c @@ -85,7 +85,7 @@ ****************************************************************************/ ssize_t nxmq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, - FAR int *prio) + FAR unsigned int *prio) { FAR struct mqueue_msg_s *mqmsg; irqstate_t flags; @@ -179,7 +179,7 @@ ssize_t nxmq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, ****************************************************************************/ ssize_t mq_receive(mqd_t mqdes, FAR char *msg, size_t msglen, - FAR int *prio) + FAR unsigned int *prio) { int ret; diff --git a/sched/mqueue/mq_send.c b/sched/mqueue/mq_send.c index 9a5912f2ab..c9bf30299a 100644 --- a/sched/mqueue/mq_send.c +++ b/sched/mqueue/mq_send.c @@ -82,7 +82,8 @@ * ****************************************************************************/ -int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio) +int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio) { FAR struct mqueue_inode_s *msgq; FAR struct mqueue_msg_s *mqmsg = NULL; @@ -207,7 +208,7 @@ int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio) * ****************************************************************************/ -int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio) +int mq_send(mqd_t mqdes, FAR const char *msg, size_t msglen, unsigned int prio) { int ret; diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index 4873d2d959..8f6ac5c334 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -87,11 +87,11 @@ ****************************************************************************/ int nxmq_verify_send(mqd_t mqdes, FAR const char *msg, size_t msglen, - int prio) + unsigned int prio) { /* Verify the input parameters */ - if (!msg || !mqdes || prio < 0 || prio > MQ_PRIO_MAX) + if (msg == NULL || mqdes == NULL || prio > MQ_PRIO_MAX) { return -EINVAL; } @@ -339,7 +339,7 @@ int nxmq_wait_send(mqd_t mqdes) ****************************************************************************/ int nxmq_do_send(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, - FAR const char *msg, size_t msglen, int prio) + FAR const char *msg, size_t msglen, unsigned int prio) { FAR struct tcb_s *btcb; FAR struct mqueue_inode_s *msgq; diff --git a/sched/mqueue/mq_timedreceive.c b/sched/mqueue/mq_timedreceive.c index 27221067f7..14ecc9966c 100644 --- a/sched/mqueue/mq_timedreceive.c +++ b/sched/mqueue/mq_timedreceive.c @@ -151,7 +151,8 @@ static void nxmq_rcvtimeout(int argc, wdparm_t pid) ****************************************************************************/ ssize_t nxmq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, - FAR int *prio, FAR const struct timespec *abstime) + FAR unsigned int *prio, + FAR const struct timespec *abstime) { FAR struct tcb_s *rtcb = this_task(); FAR struct mqueue_msg_s *mqmsg; @@ -326,7 +327,8 @@ ssize_t nxmq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, ****************************************************************************/ ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen, - FAR int *prio, FAR const struct timespec *abstime) + FAR unsigned int *prio, + FAR const struct timespec *abstime) { int ret; diff --git a/sched/mqueue/mq_timedsend.c b/sched/mqueue/mq_timedsend.c index 2bb50c05a1..dc9f851d40 100644 --- a/sched/mqueue/mq_timedsend.c +++ b/sched/mqueue/mq_timedsend.c @@ -157,8 +157,8 @@ static void nxmq_sndtimeout(int argc, wdparm_t pid) * ****************************************************************************/ -int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio, - FAR const struct timespec *abstime) +int nxmq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio, FAR const struct timespec *abstime) { FAR struct tcb_s *rtcb = this_task(); FAR struct mqueue_inode_s *msgq; @@ -382,8 +382,8 @@ errout_with_mqmsg: * ****************************************************************************/ -int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio, - FAR const struct timespec *abstime) +int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio, FAR const struct timespec *abstime) { int ret; diff --git a/sched/mqueue/mqueue.h b/sched/mqueue/mqueue.h index 0602601b53..87e99e9de9 100644 --- a/sched/mqueue/mqueue.h +++ b/sched/mqueue/mqueue.h @@ -153,15 +153,16 @@ void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode); int nxmq_verify_receive(mqd_t mqdes, FAR char *msg, size_t msglen); int nxmq_wait_receive(mqd_t mqdes, FAR struct mqueue_msg_s **rcvmsg); ssize_t nxmq_do_receive(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, - FAR char *ubuffer, FAR int *prio); + FAR char *ubuffer, FAR unsigned int *prio); /* mq_sndinternal.c ********************************************************/ -int nxmq_verify_send(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio); +int nxmq_verify_send(mqd_t mqdes, FAR const char *msg, size_t msglen, + unsigned int prio); FAR struct mqueue_msg_s *nxmq_alloc_msg(void); int nxmq_wait_send(mqd_t mqdes); int nxmq_do_send(mqd_t mqdes, FAR struct mqueue_msg_s *mqmsg, - FAR const char *msg, size_t msglen, int prio); + FAR const char *msg, size_t msglen, unsigned int prio); /* mq_release.c ************************************************************/ diff --git a/wireless/bluetooth/bt_queue.c b/wireless/bluetooth/bt_queue.c index 9abcd7a7b1..e6d631edad 100644 --- a/wireless/bluetooth/bt_queue.c +++ b/wireless/bluetooth/bt_queue.c @@ -145,7 +145,7 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf) } u; ssize_t msgsize; - int priority; + unsigned int priority; DEBUGASSERT(mqd != NULL && buf != NULL); @@ -192,7 +192,7 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf) * ****************************************************************************/ -int bt_queue_send(mqd_t mqd, FAR struct bt_buf_s *buf, int priority) +int bt_queue_send(mqd_t mqd, FAR struct bt_buf_s *buf, unsigned int priority) { struct bt_bufmsg_s msg; int ret; diff --git a/wireless/bluetooth/bt_queue.h b/wireless/bluetooth/bt_queue.h index a465226a04..e02a15ce91 100644 --- a/wireless/bluetooth/bt_queue.h +++ b/wireless/bluetooth/bt_queue.h @@ -140,6 +140,6 @@ int bt_queue_receive(mqd_t mqd, FAR struct bt_buf_s **buf); * ****************************************************************************/ -int bt_queue_send(mqd_t mqd, FAR struct bt_buf_s *buf, int priority); +int bt_queue_send(mqd_t mqd, FAR struct bt_buf_s *buf, unsigned int priority); #endif /* __WIRELESS_BLUETOOTH_BT_QUEUE_H */