Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp215311lqp; Wed, 22 May 2024 02:18:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZj5lddIptbjSdIqIKaAGRweFBowTP4SeK3XFE9HXeGjxHC8WfVQGrrkKIGcIJN9bdCbBFLBhLHkTWBegZcm2Z3t4GixQQ+/dMC0K6cg== X-Google-Smtp-Source: AGHT+IFtx4Ai1A90k6cJ1nhtfURjn+hmYcpM4/9Jd2cQB7oiQKZ3hBPlCNvtrdHwTyh53PyV7Ef7 X-Received: by 2002:a05:6214:524a:b0:699:221e:789c with SMTP id 6a1803df08f44-6ab8090dcc5mr13965786d6.62.1716369505827; Wed, 22 May 2024 02:18:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716369505; cv=pass; d=google.com; s=arc-20160816; b=UtgDVRg340A3vw/x4iyY7cLbVl6mc9g7gB47UaP06krkCZn71RuLhUcaRbMtB0JLaj A9Zmv7CAdTJEP8zQRNSKz+8PjxYD+ODIkPYbtDa3GaA8szc3em2MO9V1jjCuyIAXtPA0 LXfGSoHMRFViEOb++VFKGqkEUOERuXbxFW/0jN+rIKO2sOGmGQmCSsY7KWzVSJXQ2L7I AobTSZOkp1gyL01mZ39oeBBmLowdnS2OGN0/3xnzN9YQDRBsDdxJF+C7b+5wuURiYoMR 0hZKrs/pjeW5/hEKB0h8AcP9ZLPPkvQp36jC2qLZcAh5p0Hsq1I3a6mAeX6tOsEUqIFK eMaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=epqJO+ERpctNPXshaXqEX2wabNsS9uehY5up2W7EJXM=; fh=GVRw4JpE2IBPxK49kgG2N34oHupgiWzp3z+rojJNPXM=; b=qZUygAEySfhstY9NRVr2dWZ/vEBbk5xZfb4P6afsqCMzIxswdgwxP3IWlG4hXKbchP 77JhuKtvG2DmhvT++n0VHQnpw14DyK/X7keBKS3bC4ZA22/+jI2hmORy8d8zP7vr9D9J qEHoA+KItTDCqh85pIbMI0uFEWqgMhlx9duV28qwASs+kf4SfBFeawcv1Pe2YJcz8rbt 8JQ0oUMABYHOs0vPdn5VjUhm4H209k5yziNcpg80CwmoXFuc+s0Il0VM2V7SAJP0jwsn 3Zk234BXIq1yA1cfgO4QPS2M2vjk3KeUcoVafnGA7H4fGzDDzEDbSEyp9/OyV6Di8VWG 4PDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l5Dlvz+f; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-185976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185976-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f29a906si26060756d6.289.2024.05.22.02.18.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 02:18:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185976-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=l5Dlvz+f; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-185976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185976-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 79CFC1C219B7 for ; Wed, 22 May 2024 09:18:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DFED80633; Wed, 22 May 2024 09:18:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l5Dlvz+f" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 D4C19282E2; Wed, 22 May 2024 09:18:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716369497; cv=none; b=H8M+iPau1mGG1EtYAQyUiC2HzKQKSsLVNPQ4iVPMewEsLKEHPX4VHq0E/5tLATGXbz9CxAERR11DAGGkVAT+z66IXM8WkIOWnjp9YXU7hZPWmlwsI9FJkZoBHPS1GbHVMv1gWUC6z669KXsQP3b9L362yuqh9Kw7hhV9jhpVDeY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716369497; c=relaxed/simple; bh=Qr6USar02b6JYI0XqhLNAvs2zSTmqw+SpOFyKARZyC0=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=k8GlyRuWFHiChms8wxzErDy96pwDDSgW+fNZ3ltzGGz7DdQOyL0aiOWK5+UATdSB5ySyTioWwAkJjFjK+F4YiSszOg2ARauk3nDbySwYRGsEIlCA8wsdOMPtoE7GVG4acq0US4tA9bGGcR2WX7/yu0dKRbXHN2XfFQw1P+cUMAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=l5Dlvz+f; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a59b81d087aso917513266b.3; Wed, 22 May 2024 02:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716369494; x=1716974294; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=epqJO+ERpctNPXshaXqEX2wabNsS9uehY5up2W7EJXM=; b=l5Dlvz+fH33aWy94tUx/IHFrD50CHNRnNtC4+g74kdkZtuXpOvAH25C3MH2pyuaqDq MPgfgMgojnW0BPstFJVB9c4gtpv/VpSOj6eM9qdTtKzRibZ6Plzqne16skhoFJR43mhk PHG7sO5UCmQdFr0WTJS+FiI1fVhlnppvfvyl8r2WxFS9MZUDLRIKVlWjpcT1ZBYkezdE A1EBa5Fa875/c3jtsqzaqUYqUP0a3qlTI7ZtqoN5vwk+zx8uMyAfbbHhjcPntkZxNOLO FzL/UUqKK/kRr/TbqpI+omteT4eoLvSyXp6YT64vSVNifhcGH3TncN7yaVukestzOJKE 3w0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716369494; x=1716974294; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=epqJO+ERpctNPXshaXqEX2wabNsS9uehY5up2W7EJXM=; b=vxFAse96NaELpxaOizPBKMzH1YSBa5JbMyaXPISPsLdnmHSxcGbxGEStKjQCj2KhIS ER/mr/uJ9ejNp78QxGP7yCfa3r2GAQL3U5NW7dQBtwG4uBDM6l0FWIfLxnj3QMRvujTi dqMcWOV4KO3OS4ljQtWG//MUGg63vY+npi8t+VxRWo8WXj011lfLo39A2XwW917eYuK1 tgDo7dupkpISo7kHwKy+IOzTVbpzmZLtVnM7qlokw6fPtRwGQQo2tpYixzD9J6rq2R8n KdLjfcsTUNGgWcyFLuIxQGzvahVhijY/wJmsX4tZkBKozJWS9qPVXxRwZ3OmtfAPJkca cHuw== X-Forwarded-Encrypted: i=1; AJvYcCXTg3gn/Mw7DcmTAbbnlxXUOs81lGhjM+sIYbb3wpYUlCHqQEQkwh01d6jD3gJ8xKaprNWC58Lc6VsTXD2PUxgOSjaPpuzQ+LRLIifJBGYHtvjV6DTZftVeS9OE/vGLQM50gu0yjR4jtYE= X-Gm-Message-State: AOJu0Yz3/tCLH7La5uea1NbOkI5S9qzZrzBU5ztsVkAdy7Vd5mPB+s18 AaSy+za5COy+PSuK4BBFDrIykzdInm9KUDCoZtDhp8fRdHJEeE2b X-Received: by 2002:a17:906:c34d:b0:a59:ba2b:5915 with SMTP id a640c23a62f3a-a62281e11d5mr143893266b.50.1716369494032; Wed, 22 May 2024 02:18:14 -0700 (PDT) Received: from [127.0.1.1] (91-118-163-37.static.upcbusiness.at. [91.118.163.37]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5cec3d9b5csm836678066b.16.2024.05.22.02.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 02:18:13 -0700 (PDT) From: Javier Carrasco Subject: [PATCH 0/2] device property: introduce fwnode_for_each_available_child_node_scoped() Date: Wed, 22 May 2024 11:18:06 +0200 Message-Id: <20240522-fwnode_for_each_available_child_node_scoped-v1-0-1188b0da12dc@gmail.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="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAE64TWYC/x2N0QrDIAwAf6XkeYLaDbb9yhiSxWQGRItCNyj99 0ofj4O7DTo35Q7PaYPGq3atZYC7TEAJy5eNxsHgrb/am3dGfqVGDlJbYKQUcEXN+MkcKGmO4bS d6sLR3MWJfcQZnSUYxaWx6P+8vd77fgDv54G6fQAAAA== To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Jean Delvare , Guenter Roeck , Antoniu Miclaus , Jonathan Cameron Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1716369492; l=1324; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=Qr6USar02b6JYI0XqhLNAvs2zSTmqw+SpOFyKARZyC0=; b=skBC7zUYZmBdaCrkmOdXDTE2PXaZlyW5JfOQ1Hg+XTKbj89cB73pX1/WLeRvLF9XxGkP6ksJt l5P3CeIJplEDwPzIAUgDjPQvFfDXwvnqeKjyZpRX5uhwDc/nFvebP9g X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= The _scoped() version of the fwnode_for_each_available_child_node() follows the approach recently taken for other loops that handle child nodes like for_each_child_of_node_scoped() or device_for_each_child_node_scoped(), which are based on the __free() auto cleanup handler to remove the need for fwnode_handle_put() on early loop exits. This new variant has been tested with the LTC2992, which currently uses the non-scoped variant. There is one error path that does not decrement the refcount of the child node, which can be fixed by using the new macro. The bug was introduced in a later modification of the loop, which shows how useful an automatic cleanup solution can be in many uses of the non-scoped version. Signed-off-by: Javier Carrasco --- Javier Carrasco (2): device property: introduce fwnode_for_each_available_child_node_scoped() hwmon: (ltc2992) use fwnode_for_each_available_child_node_scoped() drivers/hwmon/ltc2992.c | 11 +++-------- include/linux/property.h | 5 +++++ 2 files changed, 8 insertions(+), 8 deletions(-) --- base-commit: 124cfbcd6d185d4f50be02d5f5afe61578916773 change-id: 20240521-fwnode_for_each_available_child_node_scoped-8f1f09d3a10c Best regards, -- Javier Carrasco