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 50CCDC63797 for ; Sun, 5 Feb 2023 21:11:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbjBEVLt (ORCPT ); Sun, 5 Feb 2023 16:11:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjBEVLr (ORCPT ); Sun, 5 Feb 2023 16:11:47 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D569C12872; Sun, 5 Feb 2023 13:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675631506; x=1707167506; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Xm3HIRSFDbFA71kRsh0phLher1JTnUxzuHlDRPbBskE=; b=KtuaVtdb0CxjmcB3NgCOBM0X3QNRAIDR7uL4vJHIee98eJ9EWloIBadM LMYxCmIdzenGm8votPht7GoyJ0MQVZtue97DqAUJWApZezQr2+gPHQWvs pPyj8jArNJA2n7LmkQxAP+3Sxl99aqNqaRbaNWdfFatmbTVR/03CEW15m YqWI57VHkhuqVc5mLGQsVOsota0DdWyRXZgrbtH2Thj7iKJJzvwa37CRy jmvfgxUplfCmLRZBXx0i5XY/AACoqkBLY4eISMN9nANz3SGsHc4yfXc8V mnOdCrEt3r+Rl6zFieORvHKCuXbO1MRW5zdirilS1m108cr/b6jNAcxxL Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="309423297" X-IronPort-AV: E=Sophos;i="5.97,275,1669104000"; d="scan'208";a="309423297" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 13:11:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="659664078" X-IronPort-AV: E=Sophos;i="5.97,275,1669104000"; d="scan'208";a="659664078" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 13:11:37 -0800 Received: from kekkonen.localdomain (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with SMTP id 0A95F12190B; Sun, 5 Feb 2023 23:11:34 +0200 (EET) Date: Sun, 5 Feb 2023 23:11:34 +0200 From: Sakari Ailus To: Pin-yen Lin Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org, =?iso-8859-1?Q?N=EDcolas_F_=2E_R_=2E_A_=2E?= Prado , Hsin-Yi Wang , devicetree@vger.kernel.org, Allen Chen , Lyude Paul , linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, Marek Vasut , Xin Ji , Stephen Boyd , AngeloGioacchino Del Regno , Thomas Zimmermann , Javier Martinez Canillas , chrome-platform@lists.linux.dev, Chen-Yu Tsai Subject: Re: [PATCH v11 1/9] device property: Add remote endpoint to devcon matcher Message-ID: References: <20230204133040.1236799-1-treapking@chromium.org> <20230204133040.1236799-2-treapking@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230204133040.1236799-2-treapking@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pin-yen, On Sat, Feb 04, 2023 at 09:30:32PM +0800, Pin-yen Lin wrote: > From: Prashant Malani > > When searching the device graph for device matches, check the > remote-endpoint itself for a match. > > Some drivers register devices for individual endpoints. This allows > the matcher code to evaluate those for a match too, instead > of only looking at the remote parent devices. This is required when a > device supports two mode switches in its endpoints, so we can't simply > register the mode switch with the parent node. > > Signed-off-by: Prashant Malani > Signed-off-by: Pin-yen Lin > Reviewed-by: Chen-Yu Tsai > Tested-by: Chen-Yu Tsai Thanks for the update. I intended to give my Reviewed-by: but there's something still needs to be addressed. See below. > > --- > > Changes in v11: > - Added missing fwnode_handle_put in drivers/base/property.c > > Changes in v10: > - Collected Reviewed-by and Tested-by tags > > Changes in v6: > - New in v6 > > drivers/base/property.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/base/property.c b/drivers/base/property.c > index 2a5a37fcd998..e6f915b72eb7 100644 > --- a/drivers/base/property.c > +++ b/drivers/base/property.c > @@ -1223,6 +1223,22 @@ static unsigned int fwnode_graph_devcon_matches(struct fwnode_handle *fwnode, > break; > } > > + /* > + * Some drivers may register devices for endpoints. Check > + * the remote-endpoints for matches in addition to the remote > + * port parent. > + */ > + node = fwnode_graph_get_remote_endpoint(ep); Here fwnode_graph_get_remote_endpoint() returns an endpoint... > + if (fwnode_device_is_available(node)) { and you're calling fwnode_device_is_available() on the endpoint node, which always returns true. Shouldn't you call this on the device node instead? What about match() below? > + ret = match(node, con_id, data); > + if (ret) { > + if (matches) > + matches[count] = ret; > + count++; > + } > + } > + fwnode_handle_put(node); > + > node = fwnode_graph_get_remote_port_parent(ep); > if (!fwnode_device_is_available(node)) { > fwnode_handle_put(node); -- Kind regards, Sakari Ailus