diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h index a156145641..03904d852e 100644 --- a/components/drivers/include/ipc/workqueue.h +++ b/components/drivers/include/ipc/workqueue.h @@ -5,6 +5,7 @@ * * Change Logs: * Date Author Notes + * 2021-08-01 Meco Man remove rt_delayed_work_init() and rt_delayed_work structure */ #ifndef WORKQUEUE_H__ #define WORKQUEUE_H__ @@ -48,11 +49,6 @@ struct rt_work struct rt_workqueue *workqueue; }; -struct rt_delayed_work -{ - struct rt_work work; -}; - #ifdef RT_USING_HEAP /** * WorkQueue for DeviceDriver @@ -82,9 +78,6 @@ rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_wo work->type = 0; } -void rt_delayed_work_init(struct rt_delayed_work *work, void (*work_func)(struct rt_work *work, - void *work_data), void *work_data); - #endif /* RT_USING_HEAP */ #endif diff --git a/components/drivers/src/workqueue.c b/components/drivers/src/workqueue.c index 065c505015..8fcfd52688 100644 --- a/components/drivers/src/workqueue.c +++ b/components/drivers/src/workqueue.c @@ -5,7 +5,8 @@ * * Change Logs: * Date Author Notes - * 2017-02-27 bernard fix the re-work issue. + * 2017-02-27 Bernard fix the re-work issue. + * 2021-08-01 Meco Man remove rt_delayed_work_init() */ #include @@ -339,12 +340,6 @@ rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue) return RT_EOK; } -void rt_delayed_work_init(struct rt_delayed_work *work, void (*work_func)(struct rt_work *work, - void *work_data), void *work_data) -{ - rt_work_init(&work->work, work_func, work_data); -} - #ifdef RT_USING_SYSTEM_WORKQUEUE static struct rt_workqueue *sys_workq; diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c index dd3c5d3dc2..7b33038d17 100644 --- a/components/net/sal_socket/src/sal_socket.c +++ b/components/net/sal_socket/src/sal_socket.c @@ -165,7 +165,6 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data) struct netdev *netdev = (struct netdev *)work_data; socklen_t addr_len = sizeof(struct sockaddr_in); char send_data[SAL_INTERNET_BUFF_LEN], recv_data = 0; - struct rt_delayed_work *delay_work = (struct rt_delayed_work *)work; const char month[][SAL_INTERNET_MONTH_LEN] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; char date[SAL_INTERNET_DATE_LEN]; @@ -176,7 +175,7 @@ static void check_netdev_internet_up_work(struct rt_work *work, void *work_data) if (work) { - rt_free(delay_work); + rt_free(work); } /* get network interface socket operations */ @@ -287,18 +286,18 @@ int sal_check_netdev_internet_up(struct netdev *netdev) #ifdef SAL_INTERNET_CHECK /* workqueue for network connect */ - struct rt_delayed_work *net_work = RT_NULL; + struct rt_work *net_work = RT_NULL; - net_work = (struct rt_delayed_work *)rt_calloc(1, sizeof(struct rt_delayed_work)); + net_work = (struct rt_work *)rt_calloc(1, sizeof(struct rt_work)); if (net_work == RT_NULL) { LOG_W("No memory for network interface device(%s) delay work.", netdev->name); return -1; } - rt_delayed_work_init(net_work, check_netdev_internet_up_work, (void *)netdev); - rt_work_submit(&(net_work->work), RT_TICK_PER_SECOND); + rt_work_init(net_work, check_netdev_internet_up_work, (void *)netdev); + rt_work_submit(net_work, RT_TICK_PER_SECOND); #endif /* SAL_INTERNET_CHECK */ return 0; } @@ -619,7 +618,7 @@ int sal_accept(int socket, struct sockaddr *addr, socklen_t *addrlen) LOG_E("New socket registered failed, return error %d.", retval); return -1; } - + /* new socket create by accept should have the same netdev with server*/ new_sock->netdev = sock->netdev; /* socket structure user_data used to store the acquired new socket */ @@ -1176,4 +1175,3 @@ void sal_freeaddrinfo(struct addrinfo *ai) pf->netdb_ops->freeaddrinfo(ai); } } -