From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 2796A5A0EB; Tue, 20 Feb 2024 07:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708412418; cv=none; b=AtIBv2keDxPtdlyZOmKpiEC6VzhpeflsXCYu13r1ZC9KiH0AwLINYNFOTDVtWMKFeqV8SThkWag9S5bvDPNw2mxSiqaIoFugAg1NwT8eADUji2n0rO9n6cPwcdfmDU1D5mvVcfitImtsTr1b/ha43lcNALEgEsWHu6Me1UznhoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708412418; c=relaxed/simple; bh=gvA7C1qXgupfhtfLt4Oax65NTnQad2ytf50sYY/59tY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MQHqIrJ3xXNxB1radDu82XCSwEEUFv2TKe0zK3oNeRO9g/cZxgzJt69h+3W7qfxJC0T5RxBsxBXLVA3kjK+ir4XF/4jxkBFTqrxBA4Xq+LdUcLmvLXNPuGfQzsZisO4Cr28lkPV6kmoWfsPk6ySeBMaTYS+JV2aOXOkve9T1G8M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KZYfWpSM; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KZYfWpSM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708412407; x=1739948407; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gvA7C1qXgupfhtfLt4Oax65NTnQad2ytf50sYY/59tY=; b=KZYfWpSMwx6UnweQTOReacewfPqA66+Hx9zRL611pvD9zUelCMwQ8PI3 z0GVRdIIy4xwZwsNvj+qM/aHaf6BIfoUcp+oW9GjOBJUIkZrjbtytJ+m4 VR1m4BOZvAIpb6nj0Nu1IFnCaBN/hPkfaPuGnXSYgSYhwjMcEeJ3WINAV SuUTUlppRfhLkf4b3NMXYjhI66fESXGzHH+xbR/i1n2SH74UAyerWZwbU I9Y3RLAL26vxAq3bBYhV60WO2d1QQWPkdU8qoX+DqRnBCFVTtvsDhrjYT tqqhXfNx8m9fneIu1UQTZyQK7eBAFD2RWC+UFjkskSYTyEGup7fsZUXSe w==; X-IronPort-AV: E=McAfee;i="6600,9927,10989"; a="2363501" X-IronPort-AV: E=Sophos;i="6.06,172,1705392000"; d="scan'208";a="2363501" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 23:00:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,172,1705392000"; d="scan'208";a="5055814" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 22:59:53 -0800 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 19CF611F7E1; Tue, 20 Feb 2024 08:59:51 +0200 (EET) Date: Tue, 20 Feb 2024 06:59:51 +0000 From: Sakari Ailus To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , Len Brown , linux-acpi@vger.kernel.org, Andy Shevchenko , Greg Kroah-Hartman , Daniel Scally , Heikki Krogerus , Julia Lawall , Nuno =?iso-8859-1?Q?S=E1?= , Cosmin Tanislav , Mihail Chindris , Rasmus Villemoes , Tomislav Denis , Marek Vasut , Olivier Moysan , Fabrice Gasnier , Lad Prabhakar , Dmitry Baryshkov , Marijn Suijten , Marius Cristea , Ibrahim Tilki , Peter Zijlstra , Jonathan Cameron Subject: Re: [PATCH v4 04/15] device property: Introduce device_for_each_child_node_scoped() Message-ID: References: <20240217164249.921878-1-jic23@kernel.org> <20240217164249.921878-5-jic23@kernel.org> Precedence: bulk X-Mailing-List: linux-iio@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: <20240217164249.921878-5-jic23@kernel.org> On Sat, Feb 17, 2024 at 04:42:38PM +0000, Jonathan Cameron wrote: > From: Jonathan Cameron > > Similar to recently propose for_each_child_of_node_scoped() this > new version of the loop macro instantiates a new local > struct fwnode_handle * that uses the __free(fwnode_handle) auto > cleanup handling so that if a reference to a node is held on early > exit from the loop the reference will be released. If the loop > runs to completion, the child pointer will be NULL and no action will > be taken. > > The reason this is useful is that it removes the need for > fwnode_handle_put() on early loop exits. If there is a need > to retain the reference, then return_ptr(child) or no_free_ptr(child) > may be used to safely disable the auto cleanup. > > Signed-off-by: Jonathan Cameron Reviewed-by: Sakari Ailus -- Sakari Ailus