kernel: workq: Fix type errors in delayable work handlers
A common pattern here was to take the work item as the subfield of a containing object. But the contained field is not a k_work, it's a k_work_delayable. Things were working only because the work field was first, so the pointers had the same value. Do things right and fix things to produce correct code if/when that field ever moves within delayable. Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
parent
6964f2b130
commit
731241f8d0
27 changed files with 72 additions and 36 deletions
|
@ -507,7 +507,8 @@ out:
|
|||
|
||||
static void tcp_send_process(struct k_work *work)
|
||||
{
|
||||
struct tcp *conn = CONTAINER_OF(work, struct tcp, send_timer);
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
|
||||
struct tcp *conn = CONTAINER_OF(dwork, struct tcp, send_timer);
|
||||
bool unref;
|
||||
|
||||
k_mutex_lock(&conn->lock, K_FOREVER);
|
||||
|
@ -1089,7 +1090,8 @@ static int tcp_send_queued_data(struct tcp *conn)
|
|||
|
||||
static void tcp_cleanup_recv_queue(struct k_work *work)
|
||||
{
|
||||
struct tcp *conn = CONTAINER_OF(work, struct tcp, recv_queue_timer);
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
|
||||
struct tcp *conn = CONTAINER_OF(dwork, struct tcp, recv_queue_timer);
|
||||
|
||||
k_mutex_lock(&conn->lock, K_FOREVER);
|
||||
|
||||
|
@ -1105,7 +1107,8 @@ static void tcp_cleanup_recv_queue(struct k_work *work)
|
|||
|
||||
static void tcp_resend_data(struct k_work *work)
|
||||
{
|
||||
struct tcp *conn = CONTAINER_OF(work, struct tcp, send_data_timer);
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
|
||||
struct tcp *conn = CONTAINER_OF(dwork, struct tcp, send_data_timer);
|
||||
bool conn_unref = false;
|
||||
int ret;
|
||||
|
||||
|
@ -1162,7 +1165,8 @@ static void tcp_resend_data(struct k_work *work)
|
|||
|
||||
static void tcp_timewait_timeout(struct k_work *work)
|
||||
{
|
||||
struct tcp *conn = CONTAINER_OF(work, struct tcp, timewait_timer);
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
|
||||
struct tcp *conn = CONTAINER_OF(dwork, struct tcp, timewait_timer);
|
||||
|
||||
NET_DBG("conn: %p %s", conn, log_strdup(tcp_conn_state(conn, NULL)));
|
||||
|
||||
|
@ -1180,7 +1184,8 @@ static void tcp_establish_timeout(struct tcp *conn)
|
|||
|
||||
static void tcp_fin_timeout(struct k_work *work)
|
||||
{
|
||||
struct tcp *conn = CONTAINER_OF(work, struct tcp, fin_timer);
|
||||
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
|
||||
struct tcp *conn = CONTAINER_OF(dwork, struct tcp, fin_timer);
|
||||
|
||||
if (conn->state == TCP_SYN_RECEIVED) {
|
||||
tcp_establish_timeout(conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue