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 00270C54EBC for ; Thu, 12 Jan 2023 13:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232111AbjALN1Z (ORCPT ); Thu, 12 Jan 2023 08:27:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbjALN1V (ORCPT ); Thu, 12 Jan 2023 08:27:21 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 431F0186DC; Thu, 12 Jan 2023 05:27:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673530040; x=1705066040; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=NAfWh46V7/4xTNxgEj+yJfX0uaEeW75r1+cw67vSYTM=; b=BcY24g9Ov7aHBnjmWp2/0wPhf9k1sa7AToMny6QUvTvsoLG/QttaGjAj iWNY3HoyESIWXKer4aIjPWjYzoRbnM0lSx7Hb48+x3g2MwfW09QgUY0xE xUlCu5flUrlD/FILbwfdFkMs8Wl/ysLKhsJHP1aDORomfXklORpYl5dXD fP102/YPMJn9ti+YO4LfN7n/WUxxMjsFmc0CKnK/W3J0k4j9jERLsQFjW R6x3SYig4UdP9RcQbP3PzsEGXOiCzSIUcwlCe0QKVlWQiGinTwEdonm26 9bQyoq/nQX+KEOzw/e/SlSM+xywuhgSwj0heeEJwh2DbCQOY/ViLyRFlB g==; X-IronPort-AV: E=McAfee;i="6500,9779,10587"; a="311526172" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="311526172" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 05:27:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10587"; a="800209398" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="800209398" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 12 Jan 2023 05:27:09 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 12 Jan 2023 15:27:09 +0200 Date: Thu, 12 Jan 2023 15:27:09 +0200 From: Heikki Krogerus 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 , Sakari Ailus , Greg Kroah-Hartman , "Rafael J . Wysocki" , Prashant Malani , Benson Leung , Guenter Roeck , Stephen Boyd , =?iso-8859-1?Q?N=EDcolas_F_=2E_R_=2E_A_=2E?= Prado , Marek Vasut , AngeloGioacchino Del Regno , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Javier Martinez Canillas , Lyude Paul , chrome-platform@lists.linux.dev, Xin Ji , Thomas Zimmermann , linux-kernel@vger.kernel.org, Allen Chen , linux-acpi@vger.kernel.org, Hsin-Yi Wang , Chen-Yu Tsai Subject: Re: [PATCH v10 1/9] device property: Add remote endpoint to devcon matcher Message-ID: References: <20230112042104.4107253-1-treapking@chromium.org> <20230112042104.4107253-2-treapking@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230112042104.4107253-2-treapking@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2023 at 12:20:56PM +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 Acked-by: Heikki Krogerus > --- > > Changes in v10: > - Collected Reviewed-by and Tested-by tags > > Changes in v6: > - New in v6 > > drivers/base/property.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/base/property.c b/drivers/base/property.c > index 2a5a37fcd998..48877af4e444 100644 > --- a/drivers/base/property.c > +++ b/drivers/base/property.c > @@ -1223,6 +1223,21 @@ 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); > + if (fwnode_device_is_available(node)) { > + ret = match(node, con_id, data); > + if (ret) { > + if (matches) > + matches[count] = ret; > + count++; > + } > + } > + > node = fwnode_graph_get_remote_port_parent(ep); > if (!fwnode_device_is_available(node)) { > fwnode_handle_put(node); > -- > 2.39.0.314.g84b9a713c41-goog -- heikki