From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 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