From patchwork Fri Dec 18 21:07:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 345547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6946C4361B for ; Fri, 18 Dec 2020 21:08:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F15423B85 for ; Fri, 18 Dec 2020 21:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727445AbgLRVIh (ORCPT ); Fri, 18 Dec 2020 16:08:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725982AbgLRVIh (ORCPT ); Fri, 18 Dec 2020 16:08:37 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C14C0617A7 for ; Fri, 18 Dec 2020 13:07:56 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id z62so4760150yba.23 for ; Fri, 18 Dec 2020 13:07:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=t638+7+HwCPMmPZN8BttAu4YYFBZRz0rNr0gnq7g6kQ=; b=X3K1oA1NNGSEagu1/19qhOlEw2wzeX+pTdeitiFiKfBl/0vRXoXSli4nPvDlj86s+X s4V1X30EZgeNlYMAsIRUs4Lk+EBU6wBbW8a0+/E8cxTyO5TXKd+Qq/cbbl3KGC3dp1Jw zHjxfG2DHtUMZgDGW19yVH5m/r9XBeHzbZy8s9c0MeAYYwvCnL2diQwyZ/5JTP9naB21 7XWrwAUWXez3hSRRpJaY9U+B4WihIa+sCk/DuVPHuCreri5qKPw3Agb791Xkazj7LHqa Ol++VY12w1aNwvbEHmECXlPSaCC4tHzmXQgZv8MR6jA5SZwGtQLJcIhHIcQVDfmFpBYY QiAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=t638+7+HwCPMmPZN8BttAu4YYFBZRz0rNr0gnq7g6kQ=; b=WfrNXqeYZ99Bwrr6y2IV6dYV6wPAO9wW2Zb1nBlt4Y5fUXz5To0WLsIrmD0EgZ/NGl 1RK9RYtsSPdsJ0DKFy6Cu5vpGzrrEAGQIIaGAQgUqW3FbrFiEY6gDHB8T8DcfDP1/yZc FvoTjJgfEtfxLJ2qyfVREUCL5sipDW8wW6z0/xkUSNVWNf9haJKA8gqBfmfWDXfHUwEH 3V8ipitrKNibEoXqiJTsugJpVeN66cMyybseFJlx/QS25vXCaqBdhnYgE+igkqVR/spG 8cXJxPsEsUXKPJOVF6s/NRywTAbxvMnRbJR0mvUxoHha3EvYw/7ZPT7SYtU7ELl1nGhW uzWw== X-Gm-Message-State: AOAM531dDyTNxwBtEMNNtW4ikDNSxZm+4ObVn7fzJUjRCsxYtHj95OT2 5Rf5cPoD1sZVKaK//P30hGCVtnjUCvVFk+c= X-Google-Smtp-Source: ABdhPJx3FgmJDWeNm5zfdx0Y9sCCHts79Ft0KxctC8O+IgVj9pVl074vaJoAM7DoRFYel11ggk4LZAvZ6IKdvh0= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:7220:84ff:fe09:fedc]) (user=saravanak job=sendgmr) by 2002:a05:6902:100f:: with SMTP id w15mr8173561ybt.25.1608325675917; Fri, 18 Dec 2020 13:07:55 -0800 (PST) Date: Fri, 18 Dec 2020 13:07:50 -0800 Message-Id: <20201218210750.3455872-1-saravanak@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.684.gfbc64c5ab5-goog Subject: [PATCH] of: property: Add device link support for interrupts From: Saravana Kannan To: Greg Kroah-Hartman , Rob Herring , Frank Rowand Cc: Saravana Kannan , Marc Zyngier , Kevin Hilman , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support for creating device links out of interrupts property. Cc: Marc Zyngier Cc: Kevin Hilman Signed-off-by: Saravana Kannan --- Rob/Greg, This might need to go into driver-core to avoid conflict due to fw_devlink refactor series that merged there. Thanks, Saravana drivers/of/property.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 5f9eed79a8aa..e56a5eae0a0b 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1271,6 +1271,22 @@ static struct device_node *parse_iommu_maps(struct device_node *np, return of_parse_phandle(np, prop_name, (index * 4) + 1); } +static struct device_node *parse_interrupts(struct device_node *np, + const char *prop_name, int index) +{ + struct device_node *sup; + + if (strcmp(prop_name, "interrupts") || index) + return NULL; + + of_node_get(np); + while (np && !(sup = of_parse_phandle(np, "interrupt-parent", 0))) + np = of_get_next_parent(np); + of_node_put(np); + + return sup; +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1296,6 +1312,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl6, }, { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, + { .parse_prop = parse_interrupts, }, { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, },