Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2131408lqb; Mon, 27 May 2024 08:49:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0Ig9NsvfPOpKDOzb6DiQqQBWHT9lFpn0jN8dWXxYT+FTbugv1I11Ncfvr+CKC/FfXr7hfoyjykPwAg7wKNUclr+0IcwQPwr1tUpu/DA== X-Google-Smtp-Source: AGHT+IGPq6q3OvtfpkRZ+2lNpfHoKVHbfN6QwMpg9MbpIkdmM0IuN0DwYxV01y293ANl/m14dHLU X-Received: by 2002:a17:902:db10:b0:1f3:6a2:3090 with SMTP id d9443c01a7336-1f4494f3249mr99300245ad.49.1716824964782; Mon, 27 May 2024 08:49:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716824964; cv=pass; d=google.com; s=arc-20160816; b=wnD7K7K+ijxq27KRKsKjCyMzAp1MPI0WsXXBubVoD0wMn1LjIgLePnP6bYSOXsTTvi sD5TDGA1FN0Ge0j5AhEEck9dOeSMf6m8akWHiIkDCcrGqu+gB2GW7FSOuSoOGFNAfBBW 7qFs/mHwp+bKJwEz5fBVFSf7A7Ezvtc3Clz8Yo29/CbmwrPHBhEBEsczUostkQsMR41M Uu9oIFX5i+uaCA503EENsYLS3RTdzyuK1PU+5nkNqWPC9Qs22XDumJryl7SVhPAVQFwo C+U2xmg3V+mxu59e+ApR5i0TuSd4jPpFzGkf5cRs3vLx0kinSqOiYk1kMLv1E9NoB+SF By5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=xStqHp0Z9L4moOjaqlqZ6WgI2ytVS/1T0AjggkzI6MI=; fh=wZ/UxFpVg/UYgIvqyrvYmk64ISABnfeJlYnUp3TgGkA=; b=vw1eQombxPi3U/dq5DNZN7xIVpJvE2Nn0ynh34KAADIeY4a0ExeF2EgWamFw6ju0Dq TVQS5Z2rfPthv+ViLyBFzObNnbd8e7M5KsWVd93yBjtJ2Yi4117CuqDrpfbxW7WzGnda KFtoWntdntM0M1B9eTkY9n+sCC1cPnEptARESkmSMh/cTn7XI8Zc3oFkdIp74cEL4rtb ocHGZkc3NptaXj+C6A8k/LuCv2pn/YSvdV/671hi0oCqtRdWR/gboAsQtnSH1O93ngJh t6xGc6u1zjv/izzJzDTo5N5eiqLrqxYZJooeSHrA2m3UAfs2frA7cnA/FzqXUb42b4xU dJfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tutg1n3c; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191023-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191023-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c9e074dsi64225255ad.536.2024.05.27.08.49.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 08:49:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191023-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tutg1n3c; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191023-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191023-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 33A8EB31A9E for ; Mon, 27 May 2024 15:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 808E616EBF5; Mon, 27 May 2024 14:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Tutg1n3c" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 902A115F30F; Mon, 27 May 2024 14:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716821851; cv=none; b=BffvnzxLRjsmMWG1lhzi+bYLo1WZZeEBQZGKv3uANukEbxG2cJPinzCxqnfSkHZ/ShTOl0bRWlf5BTXeQEwV1IM0nHoVFdmGSF5G6+CHTPgHluYzRzmgSJKK68tO4+s1E1dZ26147qrJVY5ORVF7AxQoUnGh1/ac9qCI/NyUBq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716821851; c=relaxed/simple; bh=TPj1Ua3MXLPcEqd+42ujWJSzWinRENwbYJnUHrLZ/64=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZpW6gEDKe9UM6mUNMmod1S4ykIURFtlPXx49JZ5j3XeofRWbF2t7nLNzby3rhzUZoRz8sGY19V0QRxM45VIG05MtJr5G6XFahZqAQgjLkjj3x7Fdya3dworZ4L6vPdL0AYhMLScql5asxBeGF/gm31s6D7p16NevkgoJhoXNx1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Tutg1n3c; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D2C1C2BBFC; Mon, 27 May 2024 14:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716821850; bh=TPj1Ua3MXLPcEqd+42ujWJSzWinRENwbYJnUHrLZ/64=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Tutg1n3cW99Gf9udjFbpM6/iRV4wVDFisFeoqKaOCXPbaZ13Pi3oxi5ZeWdmPGHSf MVrKQiOqhVmxCg7nd4nIjojJAiCSKj0tKxqILXaFAPH7ZxNly3lDsZA/gFkzgxesAI 1Vhuq/Zoua4NmUmCveOXlkBp8s5QWrrAoPlQl+FKUQIcre0W2N0kNq1rAuVEqd1XZZ mObSxfsldL1eBZAaMOeO3yg0uhv6aztch2dVVDTeHnHJzodsuA6g57zCFVgr1QeyVS G9a5NzKofDDpdoQVcb9RnXaHspVl9K0FMi/CsQ5hO62JGQpLFCWDMeNVgaiYWKHQlG QnTcRagqL9ENg== Date: Mon, 27 May 2024 15:57:17 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: Javier Carrasco , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Jean Delvare , Guenter Roeck , Antoniu Miclaus , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Subject: Re: [PATCH v2 3/3] hwmon: (ltc2992) Use fwnode_for_each_available_child_node_scoped() Message-ID: <20240527155717.58292509@jic23-huawei> In-Reply-To: References: <20240523-fwnode_for_each_available_child_node_scoped-v2-0-701f3a03f2fb@gmail.com> <20240523-fwnode_for_each_available_child_node_scoped-v2-3-701f3a03f2fb@gmail.com> <20240526144851.493dd3f2@jic23-huawei> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.42; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Mon, 27 May 2024 17:30:10 +0300 Andy Shevchenko wrote: > Sun, May 26, 2024 at 02:48:51PM +0100, Jonathan Cameron kirjoitti: > > On Thu, 23 May 2024 17:47:16 +0200 > > Javier Carrasco wrote: > > > > > The scoped version of the fwnode_for_each_available_child_node() macro > > > automates object recfount decrement, avoiding possible memory leaks > > > in new error paths inside the loop like it happened when > > > commit '10b029020487 ("hwmon: (ltc2992) Avoid division by zero")' > > > was added. > > > > > > The new macro removes the need to manually call fwnode_handle_put() in > > > the existing error paths and in any future addition. It also removes the > > > need for the current child node declaration as well, as it is internally > > > declared. > > > > > > Reviewed-by: Andy Shevchenko > > > Signed-off-by: Javier Carrasco > > > > This looks like another instances of the lack of clarify about > > what device_for_each_child_node[_scoped]() guarantees about node availability. > > On DT it guarantees the node is available as ultimately calls > > of_get_next_available_child() > > > > On ACPI it doesn't (I think). > > For swnode, there isn't an obvious concept of available. > > > > It would be much better if we reached some agreement on this and > > hence could avoid using the fwnode variants just to get the _available_ form > > as done here. > > > Or just add the device_for_each_available_child_node[_scoped]() > > and call that in almost all cases. > > device_for_each*() _implies_ availability. You need to talk to Rob about all > this. The design of the device_for_each*() was exactly done in accordance with > his suggestions... > Does it imply that for ACPI? I can't find a query of _STA in the callbacks (which is there for the for fwnode_*available calls. Mind you it wouldn't be the first time I've missed something in the ACPI parsing code, so maybe it is there indirectly. I know from previous discussions that the DT version was intentional, but I'm nervous that the same assumptions don't apply to ACPI. > > In generic code, do we ever want to walk unavailable child nodes? > > ...which are most likely like your question here, i.e. why we ever need to > traverse over unavailable nodes. > Jonathan