[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zd46Y8ZeAPug-P94@slm.duckdns.org>
Date: Tue, 27 Feb 2024 09:39:15 -1000
From: Tejun Heo <tj@...nel.org>
To: Allen Pais <apais@...ux.microsoft.com>
Cc: jiangshanlai@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] workqueue: Introduce from_work() helper for cleaner
callback declarations
On Tue, Feb 27, 2024 at 07:10:37PM +0000, Allen Pais wrote:
> To streamline the transition from tasklets to worqueues, a new helper
> function, from_work(), is introduced. This helper, inspired by existing
> from_() patterns, utilizes container_of() and eliminates the redundancy
> of declaring variable types, leading to more concise and readable code.
>
> The modified code snippet demonstrates the enhanced clarity achieved
> with from_wq():
>
> void callback(struct work_struct *w)
> {
> - struct some_data_structure *local = container_of(w,
> struct some_data_structure,
> work);
> + struct some_data_structure *local = from_work(local, w, work);
>
> This change aims to facilitate a smoother transition and uphold code
> quality standards.
>
> Based on:
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git disable_work-v3
>
> Signed-off-by: Allen Pais <allen.lkml@...il.com>
Applied to wq/for-6.9.
Thanks.
--
tejun
Powered by blists - more mailing lists