From patchwork Wed Feb 7 01:18:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 197691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1930247dyb; Tue, 6 Feb 2024 17:18:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmEDQa93SXbCUY7guvZCB6odq4BJhf2scH0EKX+kjlgOJgYIBIZB1nDIaIcCTdZnSL0M2A X-Received: by 2002:a05:6214:c65:b0:68c:92b4:bbf1 with SMTP id t5-20020a0562140c6500b0068c92b4bbf1mr4409994qvj.43.1707268728416; Tue, 06 Feb 2024 17:18:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707268728; cv=pass; d=google.com; s=arc-20160816; b=K5QNhmMPAFSiPBvFBZP4lhMb3LgOrr0oHDwiVqA+ituyhIrozjxJiY3z0yqF/ishdI U8ui8f5EoI7AOmJoPI3leqK1zAFoQxJINggndLqgq8PqY0CC0hQwyAYIByFGDV2KorLB YsoA7CRDhwdCeN0QKyKmQuGQsFUfC9pTlbRQou8+l45hDcGYkdeTxqjD4nW8N4VHT/tO j+740nx72slzMZgjDij6SPXwWXV4jmvlQfGSGyELd15GpsAJLKO2DV7if2/4UgOX9RBL 2jZwLVUHQb18GW/XRKDGFvHPdAL/03x79Neh8p/a1WrcmRO/wszgA+YAuk0G4UBxG/o+ 4jeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=nuaW4jYZxVUVmSijc5joqXItCJVV2wzRbkaJo6WoHUs=; fh=TqsYG8aHyBH14Zr+2L88X8pf7zmpGhBTBs1FsRoLiZo=; b=q1RPE3im30SRO/yJ5VRU2zBZO0nWUeAp8Xkj0LywxQho3sccSNeb2bT4kbVf1fNbHt ryONT3VjqD5SDnfMSKFiZrGPmJpznMyp0NTWgrj0rItgaDytlrvsPv9M1TJlrQDjmGq5 IKT7l5S8xghF+i1I7/d0eOd+ClU88cYx7zyiUq6h5JFFmg4vAEZEo8Kmnvh0BsyOdl97 yUR+hnu7r4NqAupOmDxhHMH2elkWYa5JQA/zfwxO3X5bVOZjnMsgL+5aqmd0OSQeXQRW zyw0AHjImXzGfuFabV0CtF+c6D0wNA/oVAh6taW6llz44Hsv3W1Mm+iFhs6cNLMZSlMf 4CWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=WJK4VpMx; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-55788-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55788-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCUHUGr7sZgyM+V0J7/rEscjipyWUDFj3I7ML15HgcfEp67/YfaUBXj+1RyF+y78CBGfXe6Y1viQh2igjinqlJF6OIT3kw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gs4-20020a056214226400b0068c46ab03c4si159426qvb.598.2024.02.06.17.18.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 17:18:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55788-ouuuleilei=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=@google.com header.s=20230601 header.b=WJK4VpMx; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-55788-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55788-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 2B1131C24511 for ; Wed, 7 Feb 2024 01:18:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A743DF69; Wed, 7 Feb 2024 01:18:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="WJK4VpMx" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 4545A9460 for ; Wed, 7 Feb 2024 01:18:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707268695; cv=none; b=ssuq6T5oNSDjgU9gCPqWf9Wx2oiTFC554pBnil4mMonUrJ5sSU6fW6hIxHE2DenbnPzZMyCNRatYYqVcPLocfhm9nFN89A68A592NYVp70XB4LsIjnMhC8D6qWYksj6vUz3Jjq+YVxS4cMS0sq2r5OpOQEgfyAr3QlDGfzaubyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707268695; c=relaxed/simple; bh=/sB8l6KWYH6DGCMNn36V9/w/rBzTre/Ew1T/Fov0yTA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=EiaWZvF+HFjUxMecxdBsnsryfZnvu98sCG5DwMF2Oh6rxA8YuDAqmf3ww1e02CdGXp9EFaLke8WaUcIlswNuk9hdThfS823c+NmCGePWIkE7JJo/ST/Pll/64b6LJ+9Cj0Wcwy3rL/oRppZxVBsRR898YQYdSe6bSi77NLdcLfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=WJK4VpMx; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6ade10cb8so313389276.0 for ; Tue, 06 Feb 2024 17:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707268693; x=1707873493; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=nuaW4jYZxVUVmSijc5joqXItCJVV2wzRbkaJo6WoHUs=; b=WJK4VpMxU4QTcyBxl96JWvvQu4iGzy7oe9i0fqN8z80g7jni06UaAYhxEK4F/bK0Rh oUB16eYgKY+PoanKIZxEsAsi/1WErAXefawXyPBDgmy8PLiEcginrXZtCv9PaeOIrP24 fpW8MOPu1UKXXksZNPyEnNedyeroPT+iJADCnIuuEpO5ly8CngPdsGUJJcSgrhnccLrX iyOtB3LVc/LrA+UFtEpctQO++UVqRTy3SQjmDmzkBLh8ibzZ78FJMZNSYcKNsM11gL4J bgxTOZHEYE9eTtqZhORpUhxa4ByA70fySxIhQxNo5xcYJq90binsOAlGVllpyrEnjhw4 Gibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707268693; x=1707873493; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nuaW4jYZxVUVmSijc5joqXItCJVV2wzRbkaJo6WoHUs=; b=w1PFRYINyv0AHYcJMlQOPM+wZN58HzO4Yz8SiZ5PrfKQ/aA/pE6DTVd04lSY8RFddA LiWS0wUKM4o1+dJFb5dc+uCisJP8O03Y2xnT9fdQcj5jMeG3+ohjos/ly2nYaOXkf3Pc UMthx8IWu1/Kb1JDOzwc6YIpPdiTHEouyco0f0gOX6/0fYLxFh/qum2zsX+x2SwzZin9 qVWjmFFfpZ/pzgrjALc1C8t19/k93cpYutb9E0KWjxivArttoFYAXUCOK5Kqg0/soDpA 2biCTkOn9qGvZvCSHSFaY3AkK01iWkjTlQJSxmCfydRXxk8BhXoRNUjDTymhr4IBkrbw XN3Q== X-Gm-Message-State: AOJu0YwYCiZS6s5Tbb/OX7sgR/sVWl/oD+/C8k6FjRQm7k5Kc292XsOx c21nPaXTdCkhZ0hinR1YNa1N+YnAcm56admWiHNN2v9xu50iTFG/3d7d6xGmqKqaRWnsU1Jgsa0 1bUWOMQMZOj9lxw== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:dc84:66b8:120:935a]) (user=saravanak job=sendgmr) by 2002:a25:ce0a:0:b0:dc7:31a4:23f6 with SMTP id x10-20020a25ce0a000000b00dc731a423f6mr73359ybe.2.1707268693254; Tue, 06 Feb 2024 17:18:13 -0800 (PST) Date: Tue, 6 Feb 2024 17:18:00 -0800 In-Reply-To: <20240207011803.2637531-1-saravanak@google.com> Message-Id: <20240207011803.2637531-2-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240207011803.2637531-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v2 1/3] of: property: Improve finding the consumer of a remote-endpoint property From: Saravana Kannan To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Saravana Kannan Cc: Xu Yang , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790201014104978549 X-GMAIL-MSGID: 1790201014104978549 We have a more accurate function to find the right consumer of a remote-endpoint property instead of searching for a parent with compatible string property. So, use that instead. While at it, make the code to find the consumer a bit more flexible and based on the property being parsed. Fixes: f7514a663016 ("of: property: fw_devlink: Add support for remote-endpoint") Signed-off-by: Saravana Kannan --- drivers/of/property.c | 47 +++++++++---------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 641a40cf5cf3..da70aaa62ca3 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1063,36 +1063,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, return of_device_get_match_data(dev); } -static struct device_node *of_get_compat_node(struct device_node *np) -{ - of_node_get(np); - - while (np) { - if (!of_device_is_available(np)) { - of_node_put(np); - np = NULL; - } - - if (of_property_present(np, "compatible")) - break; - - np = of_get_next_parent(np); - } - - return np; -} - -static struct device_node *of_get_compat_node_parent(struct device_node *np) -{ - struct device_node *parent, *node; - - parent = of_get_parent(np); - node = of_get_compat_node(parent); - of_node_put(parent); - - return node; -} - static void of_link_to_phandle(struct device_node *con_np, struct device_node *sup_np) { @@ -1222,10 +1192,10 @@ static struct device_node *parse_##fname(struct device_node *np, \ * parse_prop.prop_name: Name of property holding a phandle value * parse_prop.index: For properties holding a list of phandles, this is the * index into the list + * @get_con_dev: If the consumer node containing the property is never converted + * to a struct device, implement this ops so fw_devlink can use it + * to find the true consumer. * @optional: Describes whether a supplier is mandatory or not - * @node_not_dev: The consumer node containing the property is never converted - * to a struct device. Instead, parse ancestor nodes for the - * compatible property to find a node corresponding to a device. * * Returns: * parse_prop() return values are @@ -1236,8 +1206,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ struct supplier_bindings { struct device_node *(*parse_prop)(struct device_node *np, const char *prop_name, int index); + struct device_node *(*get_con_dev)(struct device_node *np); bool optional; - bool node_not_dev; }; DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") @@ -1352,7 +1322,10 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl6, }, { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, - { .parse_prop = parse_remote_endpoint, .node_not_dev = true, }, + { + .parse_prop = parse_remote_endpoint, + .get_con_dev = of_graph_get_port_parent, + }, { .parse_prop = parse_pwms, }, { .parse_prop = parse_resets, }, { .parse_prop = parse_leds, }, @@ -1403,8 +1376,8 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) while ((phandle = s->parse_prop(con_np, prop_name, i))) { struct device_node *con_dev_np; - con_dev_np = s->node_not_dev - ? of_get_compat_node_parent(con_np) + con_dev_np = s->get_con_dev + ? s->get_con_dev(con_np) : of_node_get(con_np); matched = true; i++; From patchwork Wed Feb 7 01:18:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 197693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1930564dyb; Tue, 6 Feb 2024 17:19:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQc0/777bFGZ8BjQ2ChsDG9tv6FvdZDN2CyoMjsYImTYLw1AB9PmNIuKGEATtM5reeFiTz X-Received: by 2002:a05:6a20:7623:b0:19e:5fe5:ff98 with SMTP id m35-20020a056a20762300b0019e5fe5ff98mr2817915pze.52.1707268781701; Tue, 06 Feb 2024 17:19:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707268781; cv=pass; d=google.com; s=arc-20160816; b=GvTtmQOE+YTFXxWt3t1qxa6DzsPb0kA4UR8nIfUv3xp0u4Hzd7iH58HqHL6/c+W47a Q0UI1iYUUAhZ8VoJL54ljnXigsxT9oCxFIYcGAN+K2VrTtUGI3f5fDElJIWfcM6cRBuM nnzked+KTQt1E1CxU1X5JuUmV4oRIToC2KFSXFmPQnq7Zsn76wvViYmWoL9JkLpExU1W xkw8RMKY/bGzcz5Rt8QEbPkt3MNcslbqcdLQldGSRGr74vaPvjA8BMycKoyQIWgLw5oq 4XvGdyGiNqKKuS8+S5KDC7JgiocD7joTJwmNwqVTAGIoUp3J/nTwOh1qTNpZtzVlE2tv XDfA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=pzwZNLSU6r/5TPCVrrLL62lmP2jEiRWNyfq6bcL8Mo0=; fh=DplsDzTnOsCYVoZF0v4+Rd2dKk7hwJ3/dXdWNit8oHM=; b=z4Ms7hox0cadZm4ScPPAPA/2ZY3/MXkCUDO5mpRgVK73R7Tt76P+u5ZOKYFN52K6mb Iz2wR9Dzi9TWXX6KDON+JHU5ahgIf1GpiJ8hqvHPG7cl5qNoVbwPkYnFH9NWBx8WADeI LAD4qlLvsjyhpbfbMmjYCTYo6WO4qaoOInd0lLGDrJY+LM6P2BMQ5q09x0ldMpeUrYXS 2+FZYLdOYBmF0r2z7F4zNIV0Wkv54hUFjTZsJA1Qbto+7D29HTLAUS6u8aU8nZuvhPjP BBxBmekQ/lRbjbNrwdGOM67uy3tfvD6b6ZKeldPVKIuD9iKRorixmKNt0v7YXEIt4GUz pERQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XlxjDbVI; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-55789-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55789-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVGNMttS5/GlDOlogBLgEeAKkCnsKbytKi5H4BiCTxa/H57NHVO+wT9txHP9gxj3Z+UePzPZVCxkZqr1GNkOwVleEeZSw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cm13-20020a056a00338d00b006ddce4f37c0si266551pfb.285.2024.02.06.17.19.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 17:19:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55789-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XlxjDbVI; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-55789-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55789-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 15444B2579B for ; Wed, 7 Feb 2024 01:19:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 437D0F9F7; Wed, 7 Feb 2024 01:18:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XlxjDbVI" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 EBFB8DDB3 for ; Wed, 7 Feb 2024 01:18:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707268698; cv=none; b=GOuR19FLZbovcBcZY16wOaJvJzw4THwil1R3ShCebIDsVc9BIIo0OaOrZ1v2oyUQbCNwovC47Tyy9r3GkqGdTXUvmDjUsiqMhD5LCMcgUOvMUf1bZBJEfk74jXDQYV5UPLhXp1xlEX5fooFqyovsnm9tsPEXygOEgyY9VFQsYhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707268698; c=relaxed/simple; bh=T62blaTiqzQLizGlfVWivOeIOmYziapjvmFfizRpV/g=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=jht1oxlFbu18aHiCoWsWi/xnrYAt4Vq62ixapMCctTZLZjnM7A3P3R/miDsb9MbgV2p3GKW80rB5EfLy8HBhyEUFvzT31yL99AmMWpnio0kl6OI8p9JagimqarzU2pH+CtTZtzK/mdpFPT3HeLFUhougIuYq2kaTC8jhNzWUa64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XlxjDbVI; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6041dbb7a78so2167707b3.0 for ; Tue, 06 Feb 2024 17:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707268696; x=1707873496; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pzwZNLSU6r/5TPCVrrLL62lmP2jEiRWNyfq6bcL8Mo0=; b=XlxjDbVIImD32kab5Kwo4YlVC7p8+E8aqJhRxHw3ADM7ebhWgRPO248dnC29vQAOaG 8fs2LK5ke80mt3oM3xQ7xaHCMTPvghS7nxPe7wS9M6vPWvfIP9wgqDxI04Pj2nxE2cV0 TWqzX4gBKVZ7cVirmgAZGQVCNDU/GdonLXs8DZ3z39gyU/9X/lo72EYCOvCoOsnRUUKi pH/LJfuVjZSoU6ounkkuxr2ptpwITbHFlTk2hlfc+Et5z0jLiJRvhIF9FHFqyME4N1Hk gPTHPItW5S3AMDYmuA0Q/mwPUwI8zJkX6tLZjWFQS3XUtMQzYhYiNhQaUQqF8W0pa0cl TBTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707268696; x=1707873496; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pzwZNLSU6r/5TPCVrrLL62lmP2jEiRWNyfq6bcL8Mo0=; b=lDNgWEpV+qwITySQ/wes1wv7Ncpisin73+4ReGvHi0XOKJ74Ml2EDjxzoUN7/TzY0o viBL6sKHJ6g4LHHqRjTJ2wuS19b22bD8WYk7SistcNy35EZlOQd1LM6QPYT9/9UKjDTS 5tuRAfwQuBwWhnKbR4lQ0NxdafJ8IxrqMEy15wv2sz2+Ss+irRVOOcN7anK98T0C9ArM KhK40kJHVgrQIRIZjY3uBwZJ9vnakRepTk9CYui2aHPMBD6ynA83eBbuzs8HZnK1q6o+ ON24jcv3aYV7nvTgIaYBZh4xt+1SuL2UeI5dgiPWCIahoRA4jSSTQJsu7CCsn1QJUZ2q fgSA== X-Gm-Message-State: AOJu0YypHRFFQTBGuOQwF0avdCZZAEVvjotahzMsmU7sG5m86gUta6yi rNUSmJxnYS7M1m7LEYbdYCU+qoWoug5Fup2/8rWygxOCbkJPLOgBdwWN31UpFndMfWyriQdwIiS W1itVVOxmaL3J/g== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:dc84:66b8:120:935a]) (user=saravanak job=sendgmr) by 2002:a81:9b82:0:b0:5fb:7e5b:b87f with SMTP id s124-20020a819b82000000b005fb7e5bb87fmr677991ywg.1.1707268695967; Tue, 06 Feb 2024 17:18:15 -0800 (PST) Date: Tue, 6 Feb 2024 17:18:01 -0800 In-Reply-To: <20240207011803.2637531-1-saravanak@google.com> Message-Id: <20240207011803.2637531-3-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240207011803.2637531-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v2 2/3] of: property: Improve finding the supplier of a remote-endpoint property From: Saravana Kannan To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Saravana Kannan Cc: Xu Yang , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790201070359852187 X-GMAIL-MSGID: 1790201070359852187 After commit 4a032827daa8 ("of: property: Simplify of_link_to_phandle()"), remote-endpoint properties created a fwnode link from the consumer device to the supplier endpoint. This is a tiny bit inefficient (not buggy) when trying to create device links or detecting cycles. So, improve this the same way we improved finding the consumer of a remote-endpoint property. Fixes: 4a032827daa8 ("of: property: Simplify of_link_to_phandle()") Signed-off-by: Saravana Kannan --- drivers/of/property.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index da70aaa62ca3..7bb2d8e290de 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1232,7 +1232,6 @@ DEFINE_SIMPLE_PROP(pinctrl5, "pinctrl-5", NULL) DEFINE_SIMPLE_PROP(pinctrl6, "pinctrl-6", NULL) DEFINE_SIMPLE_PROP(pinctrl7, "pinctrl-7", NULL) DEFINE_SIMPLE_PROP(pinctrl8, "pinctrl-8", NULL) -DEFINE_SIMPLE_PROP(remote_endpoint, "remote-endpoint", NULL) DEFINE_SIMPLE_PROP(pwms, "pwms", "#pwm-cells") DEFINE_SIMPLE_PROP(resets, "resets", "#reset-cells") DEFINE_SIMPLE_PROP(leds, "leds", NULL) @@ -1298,6 +1297,17 @@ static struct device_node *parse_interrupts(struct device_node *np, return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; } +static struct device_node *parse_remote_endpoint(struct device_node *np, + const char *prop_name, + int index) +{ + /* Return NULL for index > 0 to signify end of remote-endpoints. */ + if (!index || strcmp(prop_name, "remote-endpoint")) + return NULL; + + return of_graph_get_remote_port_parent(np); +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, From patchwork Wed Feb 7 01:18:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 197692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1930428dyb; Tue, 6 Feb 2024 17:19:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYhjMvUUwdXHE4RUimDFDu3E2M5tnquK7Guwi+bStZsyfYu9MQk/pvO64C9H/Gdg24Y3Xo X-Received: by 2002:ad4:5c4e:0:b0:68c:a48b:1837 with SMTP id a14-20020ad45c4e000000b0068ca48b1837mr4986106qva.56.1707268757139; Tue, 06 Feb 2024 17:19:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707268757; cv=pass; d=google.com; s=arc-20160816; b=Yhi4zThT4j+58mRUFH/to/4m5IppTdmWk9BQHOtPA2QxUSHypXuPWURGfxx3S5p4z8 RvoKcv0ee86MTSgGh9XINivWRjZdaSqW/GfDnE1blS9LYx1tW9WfYEKLMYncn9Agv3nS Q24StenAbIbLEAAI3zXo9tYis0KjiFCuM7yOT3FQDyBQ3PKPpNymr4yQsSObFqoi1wvd wVX0Uu0wHMU+glitYRoX9+y0Wxp60cjoLTKDAA9z6v/R3KRYtlegEm3SA62A1A2VN264 pU95UqfY2fTggVpHB+Co3acqIXQJugvgBH562QScWY/XBn8aLiIYGpMz8TN/nLWc96RK 0uyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=IALq/oq3h9hevE4KUuaY6CyXWslIu36itE2hrGdOodc=; fh=t6sQuURRABh0YfbEMgu04ki0+DB17f1yett9uB58gUc=; b=Wm3GDiuvxAPDumtBnrE2MCu8wuLhqnC12C0IVJBci9PtywWQz+vSxo+ynmi/RKtDcE DW+yl2CiUsCPaSb46A91X6sYeIjDYm1ftlB/ve0EmHNPXfVO9Ctw6UUjC/uZfQoflKGv PWL+Za+DPN0IMRCPHLVqSxzbr7mkWAEOL/wriqQllO6bq9FpnAy5RvhvRGN0esYV+7G4 FxX83iyd4j0hOCU3VmtGNn4nrfYgi+himw1siFK+XZ2kx9VfljkXX5dMEIGDCICfJUTd Caelq4Qhb0+kXlP3BdF/TwL18kHxV6LF2D/SQ7kcnnRykaw6NrlnaLVn9pK4GksyCATV PZhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=E5jDfe4Q; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-55790-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55790-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCWA4DzShUYbsEKz5ASVdaPJUKipYaOg462zWtclgiCmz8FSpLHLNBPxNNX0pF6+my9ugbPQSbUoClRDPQZCtp868ZCGWA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gs4-20020a056214226400b0068c46ab03c4si159426qvb.598.2024.02.06.17.19.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 17:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55790-ouuuleilei=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=@google.com header.s=20230601 header.b=E5jDfe4Q; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-55790-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55790-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 E8C2E1C246A1 for ; Wed, 7 Feb 2024 01:19:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 16EAD101C4; Wed, 7 Feb 2024 01:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="E5jDfe4Q" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 DEEB4EEDA for ; Wed, 7 Feb 2024 01:18:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707268701; cv=none; b=HzmHQnk4cLGMHTMdFoIn0Z2h2pZ61iDIysZcPH802JmKQfh76ibVm3+wNJ6NCwjkvF2eabxTq8Y9UAw934LTtLdYePhFtEAxrFNglFP2nheMfEj6zNB29FGp0YeCVZquUlPqwZN+A3v4vSI8Y/Lm2hTApdeU3zZ0hJMn9Ug/HhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707268701; c=relaxed/simple; bh=JJyqqsDhj00w4rvbp0+xvDd5ul7th/oRNUlKqIehj68=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=AYsa6hCOpkC1v+tWrhTSE2vAfIyj87HBPQ79UiqJ1pW3YApac/2RFQIOERKgvWLYdZGIwXicDvAJWaE77b+NrrtbxipswSpTAJa2rkkKLi74GRd74vruubw9cVvN/D8myJcBuVIFW7NeeRnnJL84B0C9LNstSK/3ONPQm7ciZI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=E5jDfe4Q; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60491e90830so654687b3.2 for ; Tue, 06 Feb 2024 17:18:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707268699; x=1707873499; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=IALq/oq3h9hevE4KUuaY6CyXWslIu36itE2hrGdOodc=; b=E5jDfe4QTJG4YayQayIPixvd9ItLqfrS5RRQcPItL8/NDiKG6yRM/W8eKiAxSyDZnu b4yjEQpoOcU3Q2omAWegWR7h81HwwhWuF6n07HPNOSDzzDM+v0/TjjwihmEWOjvWbV5R uA0jnxWx8LYpd7WvX/ewEAbVM5sF4ik4oOcPQ21KbddH7a+iedpS7km5CY8wUkjrvJsA W3h+ZfhfEBIPknIsd8ejRv1ALQ7lrlKEdMly1DIQ320xNbg9Tsb7XPwQS95y2axZm+Ut gOgQNy5JsRPMpM4hFH0EvhEbo56TMEUc7wTQ/tGcqob5AURFq3xtOP2kL4ojRn9aja1W e95g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707268699; x=1707873499; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IALq/oq3h9hevE4KUuaY6CyXWslIu36itE2hrGdOodc=; b=rUYA59bW5sem+rg++EnulCiPbUHrZ/pG2FpphKn/LQmvuDs91bEXesRV+TBGdFLvXS AOy7JM5ihmQbOo6edV02Xk20BRlYc1RXfEWldy1LLFSj+9Nr8itkN87W+ZYllK7j58p4 x9ss7/mBL/uL1QDtkbz5d3V6hz1xyft5rf4yfteLqQ67IFSp/+mF+Rkk2bRuI5TiSLQZ HiyVrcy5k22D4aLCPzIOD72mdf2st8R+tXCKKTwCoKr5iZNcoVRJTs9xrznJmDnZEve8 BRYxSnaJ0yYhpoeBzUBFi+nu5ILRCnMbEkoSUD9wiWgbugjNhCB9r2N/YYPmnrHsEONo o7MA== X-Gm-Message-State: AOJu0Ywrfd5bXbAmK5bJuUh/08olgRab5ID8KdqiSFzyjFqhf+a9WQu1 9+M4L5gcx6aRol50L4NMbBRMuXjkfobh6MN1HZ+7xIyJVZBcsJgpnm397faLps2+M4uefL+dJwW i9dHcHF1kIqeQFg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:dc84:66b8:120:935a]) (user=saravanak job=sendgmr) by 2002:a05:6902:168b:b0:dc6:d7a2:bc2 with SMTP id bx11-20020a056902168b00b00dc6d7a20bc2mr141599ybb.9.1707268698853; Tue, 06 Feb 2024 17:18:18 -0800 (PST) Date: Tue, 6 Feb 2024 17:18:02 -0800 In-Reply-To: <20240207011803.2637531-1-saravanak@google.com> Message-Id: <20240207011803.2637531-4-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240207011803.2637531-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v2 3/3] of: property: Add in-ports/out-ports support to of_graph_get_port_parent() From: Saravana Kannan To: Rob Herring , Frank Rowand , Greg Kroah-Hartman , Saravana Kannan Cc: Xu Yang , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790201044380681608 X-GMAIL-MSGID: 1790201044380681608 Similar to the existing "ports" node name, coresight device tree bindings have added "in-ports" and "out-ports" as standard node names for a collection of ports. Add support for these name to of_graph_get_port_parent() so that remote-endpoint parsing can find the correct parent node for these coresight ports too. Signed-off-by: Saravana Kannan --- drivers/of/property.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 7bb2d8e290de..39a3ee1dfb58 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -763,7 +763,9 @@ struct device_node *of_graph_get_port_parent(struct device_node *node) /* Walk 3 levels up only if there is 'ports' node. */ for (depth = 3; depth && node; depth--) { node = of_get_next_parent(node); - if (depth == 2 && !of_node_name_eq(node, "ports")) + if (depth == 2 && !of_node_name_eq(node, "ports") && + !of_node_name_eq(node, "in-ports") && + !of_node_name_eq(node, "out-ports")) break; } return node;