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:
Yong Cong Sin 2022-01-19 12:07:51 +08:00 committed by Anas Nashif
commit 731241f8d0
27 changed files with 72 additions and 36 deletions

View file

@ -467,8 +467,9 @@ static int http_wait_data(int sock, struct http_request *req)
static void http_timeout(struct k_work *work)
{
struct k_work_delayable *dwork = k_work_delayable_from_work(work);
struct http_client_internal_data *data =
CONTAINER_OF(work, struct http_client_internal_data, work);
CONTAINER_OF(dwork, struct http_client_internal_data, work);
(void)zsock_close(data->sock);
}