From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09B8BC43334 for ; Mon, 18 Jul 2022 12:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233910AbiGRM1G (ORCPT ); Mon, 18 Jul 2022 08:27:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233407AbiGRM1F (ORCPT ); Mon, 18 Jul 2022 08:27:05 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91D5BAF; Mon, 18 Jul 2022 05:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658147224; x=1689683224; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=9pmvwK6gZKZsdPvJKC7erTRSJ1Azp96NhdXTB4qIeoo=; b=PsqWSWvhZs1FsjKfD8TmD/8cXT9hvRv8sUqsPVR11JKYhBhzEtOMVeyB wZrCJyvXmTE43gWDrFv/ABEIu4VvfjVZD2QLJuFY3ht88Rr7cCai5OPEh 2joA9fYPZ7g7hkq0pUdcCRMGTQREGLFbCS/pM97VMYHdvpi+YyXdmRSMP KSYrHRyThfszqUK2VyOmuNPACBjNcuAzhAcJraquPWx7sKl6mwCJe3YvL McHT/+GJhdwdzCcSiJ7DIVgmZ6mVT5v2p/iPyywdzX7tXq2VFd8wnkkCN eEhoO6aur1fHDkrOBV56Hp/46BwHsjOwUsqmH5ppTsVhnerERFK0k82Wu w==; X-IronPort-AV: E=McAfee;i="6400,9594,10411"; a="286948011" X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="286948011" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 05:27:03 -0700 X-IronPort-AV: E=Sophos;i="5.92,281,1650956400"; d="scan'208";a="601206977" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 05:26:58 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oDPpu-001OAV-2O; Mon, 18 Jul 2022 15:26:54 +0300 Date: Mon, 18 Jul 2022 15:26:54 +0300 From: Andy Shevchenko To: Marcin Wojtas Cc: Linux Kernel Mailing List , ACPI Devel Maling List , netdev , "Rafael J. Wysocki" , Sean Wang , Landen Chao , Linus Walleij , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King - ARM Linux , Heiner Kallweit , Grzegorz Bernacki , Grzegorz Jaszczyk , Tomasz Nowicki , Samer El-Haj-Mahmoud , upstream@semihalf.com Subject: Re: [net-next: PATCH v2 5/8] device property: introduce fwnode_dev_node_match Message-ID: References: <20220715085012.2630214-1-mw@semihalf.com> <20220715085012.2630214-6-mw@semihalf.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Sat, Jul 16, 2022 at 01:15:55AM +0200, Marcin Wojtas wrote: > pt., 15 lip 2022 o 21:42 Andy Shevchenko > napisaƂ(a): > > > > On Fri, Jul 15, 2022 at 10:36:29PM +0300, Andy Shevchenko wrote: > > > On Fri, Jul 15, 2022 at 10:50:09AM +0200, Marcin Wojtas wrote: > > > > This patch adds a new generic routine fwnode_dev_node_match > > > > that can be used e.g. as a callback for class_find_device(). > > > > It searches for the struct device corresponding to a > > > > struct fwnode_handle by iterating over device and > > > > its parents. > > > > > > Implementation > > > 1) misses the word 'parent'; > > I'm not sure. We don't necessarily look for parent device(s). We start > with a struct device and if it matches the fwnode, success is returned > immediately. Only otherwise we iterate over parent devices to find a > match. Yes, you iterate over parents. 0 iterations doesn't change semantics of all cases, right? > > > 2) located outside of the group of fwnode APIs operating on parents. > > I can shift it right below fwnode_get_nth_parent if you prefer. Yes, please do. > > > I would suggest to rename to fwnode_get_next_parent_node() and place > > > near to fwnode_get_next_parent_dev() (either before or after, where > > > it makes more sense). > > > > And matching function will be after that: > > > > return fwnode_get_next_parent_node(...) != NULL; > > > > Think about it. Maybe current solution is good enough, just needs better > > naming (fwnode_match_parent_node()? Dunno). > > > > P.S. Actually _get maybe misleading as we won't bump reference counting, > > rather _find? > > How about the following name: > fwnode_find_dev_match() > ? fwnode_find_parent_dev_match() LGTM, thanks! You iterate over parents. -- With Best Regards, Andy Shevchenko