Module: xenomai-3 Branch: master Commit: 4fe9e77d5499bcf940fa78d603ac8a16c448b31f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4fe9e77d5499bcf940fa78d603ac8a16c448b31f
Author: Philippe Gerum <r...@xenomai.org> Date: Wed Sep 9 16:17:15 2015 +0200 drivers/can/raw: use safer way of detecting xmit abort --- kernel/drivers/can/rtcan_internal.h | 5 ----- kernel/drivers/can/rtcan_raw.c | 10 +++++----- kernel/drivers/can/rtcan_socket.c | 3 +-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/kernel/drivers/can/rtcan_internal.h b/kernel/drivers/can/rtcan_internal.h index b731e71..b290005 100644 --- a/kernel/drivers/can/rtcan_internal.h +++ b/kernel/drivers/can/rtcan_internal.h @@ -29,11 +29,6 @@ #include <linux/module.h> #include <rtdm/driver.h> -#ifndef LIST_POISON1 -/* 2.4 - 2.6 compatibility stuff */ -#define LIST_POISON1 ((void *) 0x0) -#endif - #ifdef CONFIG_XENO_DRIVERS_CAN_DEBUG #define RTCAN_ASSERT(expr, func) \ if (!(expr)) { \ diff --git a/kernel/drivers/can/rtcan_raw.c b/kernel/drivers/can/rtcan_raw.c index 9eb8531..2047529 100644 --- a/kernel/drivers/can/rtcan_raw.c +++ b/kernel/drivers/can/rtcan_raw.c @@ -888,9 +888,9 @@ ssize_t rtcan_raw_sendmsg(struct rtdm_fd *fd, tx_wait.rt_task = rtdm_task_current(); - /* If socket was not closed recently, register the task at the - * socket's TX wait queue and decrement the TX semaphore. This must be - * atomic. Finally, the task must be deregistered again (also atomic). */ + /* Register the task at the socket's TX wait queue and decrement + * the TX semaphore. This must be atomic. Finally, the task must + * be deregistered again (also atomic). */ cobalt_atomic_enter(s); list_add(&tx_wait.tx_wait_list, &sock->tx_wait_head); @@ -900,9 +900,9 @@ ssize_t rtcan_raw_sendmsg(struct rtdm_fd *fd, /* Only dequeue task again if socket isn't being closed i.e. if * this task was not unblocked within the close() function. */ - if (likely(tx_wait.tx_wait_list.next != LIST_POISON1)) + if (likely(!list_empty(&tx_wait.tx_wait_list))) /* Dequeue this task from the TX wait queue */ - list_del(&tx_wait.tx_wait_list); + list_del_init(&tx_wait.tx_wait_list); else /* The socket was closed. */ ret = -EBADF; diff --git a/kernel/drivers/can/rtcan_socket.c b/kernel/drivers/can/rtcan_socket.c index 6e6e79e..3c73fba 100644 --- a/kernel/drivers/can/rtcan_socket.c +++ b/kernel/drivers/can/rtcan_socket.c @@ -71,7 +71,6 @@ void rtcan_socket_cleanup(struct rtdm_fd *fd) rtdm_lockctx_t lock_ctx; int tx_list_empty; - /* Wake up sleeping senders. This is re-entrant-safe. */ do { cobalt_atomic_enter(lock_ctx); @@ -86,7 +85,7 @@ void rtcan_socket_cleanup(struct rtdm_fd *fd) struct tx_wait_queue, tx_wait_list); /* Remove it from list */ - list_del(&tx_waiting->tx_wait_list); + list_del_init(&tx_waiting->tx_wait_list); /* Wake task up (atomic section is left implicitly) */ rtdm_task_unblock(tx_waiting->rt_task); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://xenomai.org/mailman/listinfo/xenomai-git