Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2134910rbb; Tue, 27 Feb 2024 11:39:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU7TgPDiwuiI/AuMpcXVNe1xLY30cELB25jwwHuNLuu06bgsaulDeM4UYi+1g65kx7mqMlUVevUcqHNcDR23GG7YrWhnRQRH7k5g1ZMkQ== X-Google-Smtp-Source: AGHT+IGP4wPNinKcl6Xrah9SzNFdFgtqonEZgBAmW4aw+FeRYJHaeB0k51TgPMEChytUNquiw9HZ X-Received: by 2002:a05:6808:ecf:b0:3c0:4d21:e62a with SMTP id q15-20020a0568080ecf00b003c04d21e62amr3825137oiv.31.1709062767106; Tue, 27 Feb 2024 11:39:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709062767; cv=pass; d=google.com; s=arc-20160816; b=ZeQlLlzaiAOojjdz+LheRegDjkfFf9/dV6SOpj9rgYU1TWWAqdnNm42G3qFLQLlY9+ drBfXPvHeNP5H1aEnRaiyyGIlshvrfVH22xu8F74XdO1TJJaDuX8e/vHMkqIVDqSooly 9FabymEA0qNPs1thSkRq3T2NHtNPT5846OdXlc0lgAr+RgSbXUpc2LpK209yRF3s9qPj i0oQYL1ODHycz02Je8yHN2m7cKU2dD7FNOhZzKpPQW0Uus4zTSpQwpKyJ/XQ6D3STVAE 70IercEfGN7EZhwG1I3FIvcPpOBr5GR3CEcnZ8sQQ+BSSprX7umkhUZCRG4SZhmJjR1n bVyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=rKYVjvln7WqK9UOeHypkuBAH6upy75SMDhY2R5Rntz8=; fh=1ea2JUmW6TG3Cv38sHboO4QknP7fat8F0ehouNyXF6s=; b=t8uf9xXaSIKrgxmAX2PgMyftV8RR6G1RIce/4DnWN1z/CBl2IJ17EP7BWXxhq5GTbg DE0LGP/F1fKGia0IOFzVqyOTyKGa2a3ptddMwvpXmQw1H1QZxtaIPN/mB4kpIdBxDpQS u/I30i45zPmtcI6C3cNNDH4iTxdcIfuvS7C3qJuQgkDxjLsSiywV9wbD7+YRtxgaUjvN Grwhsd/TOnmG7UIAe9hw3yaH7yMS9QCs+q1Amx0iiSp+6ALTkJoq0TYF17Q8frbDMJGS nMpO1KWczu8/M5UXAMCYvMZQkNJNj5tKDbY5vzGYK5KJIlCCjyf9YMXLzIeEnrXJJNkL A4mg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K4qjaG13; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f41-20020a05622a1a2900b0042dd382928fsi8763343qtb.356.2024.02.27.11.39.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:39:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=K4qjaG13; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D3E321C23539 for ; Tue, 27 Feb 2024 19:39:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8321713AA27; Tue, 27 Feb 2024 19:39:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K4qjaG13" Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BF5B2511F for ; Tue, 27 Feb 2024 19:39:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709062759; cv=none; b=e0B0mYf2IHbkP4K45NfMifd2PyfY9JLSbpEL8KCmIooJFeQbmZV5WLVsBuXA0JDP3eDbfuYtoUtlOC2OK276oCBMYE41d80Drp0/GFQRj7grMdjgHeaWJCf6c7L2bQ6iR9n6PjqR+oqARcVvt7JA1kNCaE1kRmTz/dJYxdkhzGI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709062759; c=relaxed/simple; bh=NkpgtyhkUYlQd+libVSgyBRF5SshhQknVpyB3eR+xJo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OaS3vu9QgQ3tno7kEw+oEaGetpBOihRRncskm8KbI+vrMIs+wL+ATxszROnV8QUxlZ00QIsk4r8hI1GZ/ygOqffbZBb2OQ1+P53+7IopywkGCtjLSFhOHmZ6gQ+fyOJTcTSWtKfC6pGMipz5508Fay7oe3q8u2qv9oxitzPdNA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=K4qjaG13; arc=none smtp.client-ip=209.85.166.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-36503a4980aso10707125ab.3 for ; Tue, 27 Feb 2024 11:39:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709062757; x=1709667557; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=rKYVjvln7WqK9UOeHypkuBAH6upy75SMDhY2R5Rntz8=; b=K4qjaG13SbbJykIKdE9bm/wtsevnfJrButRy220Go36YhQctwcoDZLXV3c8BJIxcG3 AHPzYIjaPFNUNfBp7QPWmGpyLRrvuhh1YWPrL7m1BpOcVGXBo6+bx3vCaPw1kxRR5MQk 1DW9Yo/h57L0rudI8E/EflmP0fyNBikFYpk+fsGgQXOWNPmu5VEVcnGFzIfwc/CN8zkY 6jJ5PEi+xcimich+oE2JrDRBteBhaCejmv8IOTwGyDCD79qK/WjBSYR0XSyo/RKbh/Y7 e4nuZcjJvBpPyBLWzV0TNCTzMnk0EmP/wcSPV9kHk2vddclWjFZrwQGb2+2E1kfz011O kw9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709062757; x=1709667557; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rKYVjvln7WqK9UOeHypkuBAH6upy75SMDhY2R5Rntz8=; b=NPdUpwPSuBtglIi6txPclVFkBrKWPIne9E2Q4cAMkJXXrgbhFpEG5WzR7PGjT+WRlD Jz+krmF1L/4p5SKaxUY1IG92oARLMeRrZe/KDVas/+P3d4w6mbZmKi5wSlNBgag7w2Be buKnGfALi59EhQYhnZnQ5ZPU1SSKNH6sfnr5rJzJJzc/kVv4WjwDsGnhsBssvnk+hZYI BZAYdGw4fw1TztHMvfVnN6HWW12mfI/uf23d8u23/F0q4TNAquDZgszjvg3RUw661fSF 1KLNzy+frTWVO3XNacN0WaYw5DEj9SqvQ3lNgT6/HTwS+GUBIs0Ct0MYM+E/fqhjAysK hb3A== X-Forwarded-Encrypted: i=1; AJvYcCV2GycfaWM6x1LnUlWgd3hcScuZTRFbH7LDCxdz22TUxfD9Ndjsm+O4ZmuCJSPz0azL5Y8+iURcZmf2EInvGUPAS6bA0gw24u9ti+A8 X-Gm-Message-State: AOJu0YxUJMg1uwxhSEotKY0sQ/acqQ/njso+6mjskWBQa3OPcIUcp7ol HHjCuFdHnqNl89zmRvemouROhNrhzP5dokLx3GokjDMeLUG2X+p3 X-Received: by 2002:a92:c688:0:b0:365:2390:931f with SMTP id o8-20020a92c688000000b003652390931fmr11605284ilg.4.1709062757294; Tue, 27 Feb 2024 11:39:17 -0800 (PST) Received: from localhost ([2620:10d:c090:400::5:8305]) by smtp.gmail.com with ESMTPSA id o195-20020a62cdcc000000b006e4cf04e501sm262260pfg.13.2024.02.27.11.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:39:17 -0800 (PST) Sender: Tejun Heo Date: Tue, 27 Feb 2024 09:39:15 -1000 From: Tejun Heo To: Allen Pais Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] workqueue: Introduce from_work() helper for cleaner callback declarations Message-ID: References: <20240227191037.5839-1-apais@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240227191037.5839-1-apais@linux.microsoft.com> 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 Applied to wq/for-6.9. Thanks. -- tejun