From: Daniel Mack Date: Fri, 9 Jan 2015 12:52:10 +0000 (+0100) Subject: connection, reply: move worker function to reply.h X-Git-Tag: upstream/0.20150129.081441utc~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8bf8a0d7b5786762a8a29184b44871ac9f3bfb8b;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git connection, reply: move worker function to reply.h Change kdbus_reply_list_scan() so it becomes the worker callback, so we can remove the the glue from connection.c. Signed-off-by: Daniel Mack --- diff --git a/connection.c b/connection.c index 87f90b3..ac0599c 100644 --- a/connection.c +++ b/connection.c @@ -104,14 +104,6 @@ static int kdbus_conn_queue_user_quota(const struct kdbus_conn *conn_src, return 0; } -static void kdbus_conn_work(struct work_struct *work) -{ - struct kdbus_conn *conn = - container_of(work, struct kdbus_conn, work.work); - - kdbus_reply_list_scan(conn); -} - /** * kdbus_cmd_msg_recv() - receive a message from the queue * @conn: Connection to work on @@ -1534,7 +1526,7 @@ struct kdbus_conn *kdbus_conn_new(struct kdbus_ep *ep, atomic_set(&conn->name_count, 0); atomic_set(&conn->request_count, 0); atomic_set(&conn->lost_count, 0); - INIT_DELAYED_WORK(&conn->work, kdbus_conn_work); + INIT_DELAYED_WORK(&conn->work, kdbus_reply_list_scan_work); conn->cred = get_current_cred(); init_waitqueue_head(&conn->wait); kdbus_queue_init(&conn->queue); diff --git a/reply.c b/reply.c index d979a0b..9e3559d 100644 --- a/reply.c +++ b/reply.c @@ -189,16 +189,22 @@ struct kdbus_reply *kdbus_reply_find(struct kdbus_conn *replying, } /** - * kdbus_reply_list_scan() - Scan the replies of a connection - * @conn: Connection to scan + * kdbus_reply_list_scan_work() - Worker callback to scan the replies of a + * connection for exceeded timeouts + * @work: Work struct of the connection to scan * * Walk the list of replies stored with a connection and look for entries * that have exceeded their timeout. If such an entry is found, a timeout * notification is sent to the waiting peer, and the reply is removed from * the list. + * + * The work is rescheduled to the nearest timeout found during the list + * iteration. */ -void kdbus_reply_list_scan(struct kdbus_conn *conn) +void kdbus_reply_list_scan_work(struct work_struct *work) { + struct kdbus_conn *conn = + container_of(work, struct kdbus_conn, work.work); struct kdbus_reply *reply, *reply_tmp; u64 deadline = ~0ULL; struct timespec64 ts; diff --git a/reply.h b/reply.h index 832fccb..a1d4c76 100644 --- a/reply.h +++ b/reply.h @@ -63,6 +63,6 @@ struct kdbus_reply *kdbus_reply_find(struct kdbus_conn *replying, u64 cookie); void kdbus_sync_reply_wakeup(struct kdbus_reply *reply, int err); -void kdbus_reply_list_scan(struct kdbus_conn *conn); +void kdbus_reply_list_scan_work(struct work_struct *work); #endif /* __KDBUS_REPLY_H */