Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2119238rbb; Tue, 27 Feb 2024 11:10:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjNjoV0SAjtCoVDTP5BFYlvrwLhPE6vB8mmxlbj26+Tzqadg6TTm0PsiGdjaZgJv5QKkektOKnEO8UxrkD44NvvJ4DL+5E9O6/CZ3QnA== X-Google-Smtp-Source: AGHT+IF64yXUFhIK3vswT2eabInwcS1f0Shk5kLtYZ522SzJJx4sD/ejm5nz+gkcYeOXm1UGZTWi X-Received: by 2002:a17:90b:3cb:b0:299:17dc:ba26 with SMTP id go11-20020a17090b03cb00b0029917dcba26mr7840592pjb.32.1709061009431; Tue, 27 Feb 2024 11:10:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709061009; cv=pass; d=google.com; s=arc-20160816; b=kqaujQbdXQ19QZ/4ocPjo9JiI8r8EVOcmywWAapNrcI99ftr52rnFnDQtz1tg0Ows8 zEDm6BxpTvNfaAokaj/zQFGDwsTTUYaoO58oxTBhfHuTsVG9cpOGHy52VHKSESRuP4c9 cjyrPInX7A0l8I4ngDgSRuvHZxsBJY2PBiazxXht7AYQXmqhQhy9t5BgWjnPxPK9qXk6 nA0Wju6BDuEKwiRjunGa/vEDouHaxi1I9qTtGqT3tRoJemIFJ9TVbLwrtuTt4HQRKz3/ Aol2X3eSAi92pUzJphHiu/9oPvwLIF4eiGav0h0kRdqVh6LZgWQcKW4eR34kex11zQlJ d5lQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature:dkim-filter; bh=3R4L23y6mvT50s2KsDN/kmp17xP0HbiJGH/JfodJIno=; fh=G0IZvvtf/ztzFnCEdRxSV6/Pn7VUTf6bZkwKwy6FH4o=; b=PQDc/Ru6MLDBoDoscEMcxHnv7ELtA+gfugPgw5a2UH6pb59Tdm9vuoOEc1ATuDxUQM YrIftqDC6QWvrUxHYuGbKnR18nuWkBW4tcBz1KaC1vdPMGbDe3yePpEiedoWusnKYGdP ockOKm+TqUgdzLVgr6h1YfIDJl6KMkk2b4l4VtCDqCog0tQ2ICpn7PPv9cRKfXxCyZhJ 6r354284PJ+Cyl5ecEw2hBHlQ5ihqPVRTmrInULdWKPcrxUjfw7aTc5WlPpATd5dlT63 DEcNJzDJ6Sc1v9Lyk5yD9brzbPATEBEd1ysMe//3e2O/b6z+hFS/kKaRYIjl9JxWg8fh 25TQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=oBcEYDtu; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-83896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w5-20020a17090ad60500b0029a9c2a22c0si5913064pju.61.2024.02.27.11.10.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:10:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=oBcEYDtu; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-83896-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F268028FB94 for ; Tue, 27 Feb 2024 19:06:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87D1951C33; Tue, 27 Feb 2024 19:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="oBcEYDtu" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CD9E3D988 for ; Tue, 27 Feb 2024 19:06:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060800; cv=none; b=SCPCcHP2ROdpBXQYdGBGSUGzn9AFL4udrJufb/5pdw6WNAqdDPGvohnJ+WOVVkWDilOriRbCbSNq2aUwYLPDGqWRPR+oHlPT5YEhYE8uwZoIL+ruXdNraQqkVZwGlZo0Hn645hNhbwCh3CRkEt/pg1MzIoExPUZWqptt2I7rJ8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060800; c=relaxed/simple; bh=NV0RUIdXMlo6Z2/AE6LFM7XFkZwaYAIqi+3rgxbOiZg=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=UIsWA42yjSRMzZ7q0C0LDA169N3QGq/A+bimK/oaa4au8G8kB1uMwWshUEtynqUV6yQWDC161phFX9vlbR9xI5x1AjkFgFlEHmc/ZFg1/lTkfJg58RHFRTUppG68PSLNEvqXvq4WMXPi1fo8HqLJbwBfYS3vzNZgCDjpLYf7drM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=oBcEYDtu; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from smtpclient.apple (d66-183-91-182.bchsia.telus.net [66.183.91.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 047D520B74C0; Tue, 27 Feb 2024 11:06:39 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 047D520B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1709060799; bh=3R4L23y6mvT50s2KsDN/kmp17xP0HbiJGH/JfodJIno=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=oBcEYDtusAVrVMGV7XA7J7FM5zrKZ5tex7b9gNLT5hYRG+hsJ4Ps3gynAEeQ/eDOc 188Lo1H6WAu8y7IPLdACuwBRZhl6eaLX/R7Ji2YWNW6KZaU91YEBwJ2Y50hM5nZ1uJ mltZ4MDQKi6GkmmQIROsBdBhTcoljsaestWHY8kI= Content-Type: text/plain; charset=us-ascii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\)) Subject: Re: [PATCH] workqueue: Introduce from_wq() helper for cleaner callback declarations From: Allen Pais In-Reply-To: Date: Tue, 27 Feb 2024 11:06:28 -0800 Cc: jiangshanlai@gmail.com, Linux Kernel Mailing List Content-Transfer-Encoding: quoted-printable Message-Id: References: <20240227185628.5336-1-apais@linux.microsoft.com> To: Tejun Heo X-Mailer: Apple Mail (2.3774.400.31) >=20 >=20 > 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. >>=20 >> The modified code snippet demonstrates the enhanced clarity achieved >> with from_wq(): >>=20 >> void callback(struct work_struct *w) >> { >> - struct some_data_structure *local =3D container_of(w, >> struct = some_data_structure, >> work); >> + struct some_data_structure *local =3D from_wq(local, w, work); >=20 > 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. >=20 > Thanks. >=20 > --=20 > tejun