public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Allen Pais <apais@linux.microsoft.com>
To: Tejun Heo <tj@kernel.org>
Cc: jiangshanlai@gmail.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: Introduce from_wq() helper for cleaner callback declarations
Date: Tue, 27 Feb 2024 11:06:28 -0800	[thread overview]
Message-ID: <FDCF9C39-1696-4FE1-9728-31FE879AC36F@linux.microsoft.com> (raw)
In-Reply-To: <Zd4xhvh9Drl4qrCV@slm.duckdns.org>

> 
> 
> On Tue, Feb 27, 2024 at 06:56:28PM +0000, Allen Pais wrote:
>> To streamline the transition from tasklets to worqueues, a new helper
>> function, from_wq(), 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_wq(local, w, work);
> 
> I'm not necessarily against it but it's a bit meh in terms of how much it
> saves. Also, can you please name it from_work()?

  I agree :). It does help a little in conversion. Sure, will send out a v2 right away.

Thanks.

> 
> Thanks.
> 
> -- 
> tejun


      reply	other threads:[~2024-02-27 19:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 18:56 [PATCH] workqueue: Introduce from_wq() helper for cleaner callback declarations Allen Pais
2024-02-27 19:01 ` Tejun Heo
2024-02-27 19:06   ` Allen Pais [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FDCF9C39-1696-4FE1-9728-31FE879AC36F@linux.microsoft.com \
    --to=apais@linux.microsoft.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox