From patchwork Fri Feb 5 22:26:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071601 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, 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 6097CC433E0 for ; Sat, 6 Feb 2021 02:33:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28DFF64F70 for ; Sat, 6 Feb 2021 02:33:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbhBFCco (ORCPT ); Fri, 5 Feb 2021 21:32:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbhBFCcP (ORCPT ); Fri, 5 Feb 2021 21:32:15 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD8EC0698DD for ; Fri, 5 Feb 2021 14:26:52 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id m7so8664868ybm.19 for ; Fri, 05 Feb 2021 14:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=223PDDzeAXN7fiB0Z3sv31/CUo0CMPx1p1AufcopYWI=; b=SFHQmMRc/ic1nmrT5IMiYstkL++tDL7Z3c9ojJSjDDxJdd2i0nznkXSFR68OUU+aVL 37l+IB6klV569hlqPafHkvF6+7WsET3whuds9yrB7AV+RdCxsQ77OXj4J7Tcyq8/Ykby AlApFXR5yrG/7Vz11J14XoDvvGtfu1xCPL8V4LNO83ZHxI6bzavvye1rrEa6QHHFK9ZC VbK5aLF05CCF+bWVcucqMPqSUnnHjKES2+MRdskFBHbYTLhsN1Fzt8tWmeiWWfnkvi6G ubCkpqgDZw/sb8byBLZrzDfglYOud2eHQ2Bdkq3sgX+3NHRqCEOzx+TOG8IfoQk25pne myDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=223PDDzeAXN7fiB0Z3sv31/CUo0CMPx1p1AufcopYWI=; b=A0EnNlVTiSkl7H9VUEta3qUPvAepFvYwvm88M7ZVrSYK/BVLTBItp0eLpZuBAkA4RG QdGuPuHoEq39+iP5uOJMNoKztBeEf8JP+r3cYcS8JS4FuWHvKE2WU4xnKY+tw4wc4bhS oCXyiE2se99bVdnZzxDMLwwBEs3SPl5V1Ocm/UPwrxWVZVYtd716+YH3XIezpARFVy05 E3fnVjRgYX57ZdEB9AxNSiIDmz0b8Cn10CaweURSwYekDPcU//ebHjWAH38Z3Vwey41V OICWfjDcu1iGC225zS6M2dT6pl1bqqHJyCjsIxsxFLj69CrvdJtOWmeHp0gXL4lr+5IC CTrg== X-Gm-Message-State: AOAM5318Hn6W55KfwJDrkNMP1HOD/EEatRQH7+8ikHgJnikNJrPHEMUJ 4CkbwTOBO7g6x1IE2BaVqdsiV7y4KDUQJ88= X-Google-Smtp-Source: ABdhPJxrL9cH3mLaTtg3wJ/fW0QIFeUS4+4EDQLIPatw4HQvuGDNDATg7OIEzUZWu1cx19SOt5U8lpPfcWDatIE= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:2693:: with SMTP id m141mr9430134ybm.104.1612564011451; Fri, 05 Feb 2021 14:26:51 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:37 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-2-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 1/8] driver core: fw_devlink: Detect supplier devices that will never be added From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner , Saravana Kannan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org During the initial parsing of firmware by fw_devlink, fw_devlink might infer that some supplier firmware nodes would get populated as devices. But the inference is not always correct. This patch tries to logically detect and fix such mistakes as boot progresses or more devices probe. fw_devlink makes a fundamental assumption that once a device binds to a driver, it will populate (i.e: add as struct devices) all the child firmware nodes that could be populated as devices (if they aren't populated already). So, whenever a device probes, we check all its child firmware nodes. If a child firmware node has a corresponding device populated, we don't modify the child node or its descendants. However, if a child firmware node has not been populated as a device, we delete all the fwnode links where the child node or its descendants are suppliers. This ensures that no other device is blocked on a firmware node that will never be populated as a device. We also mark such fwnodes as NOT_DEVICE, so that no new fwnode links are created with these nodes as suppliers. Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") Signed-off-by: Saravana Kannan Acked-by: Rafael J. Wysocki --- drivers/base/core.c | 31 ++++++++++++++++++++++++++++--- include/linux/fwnode.h | 2 ++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 484a942884ba..c95b1daabac7 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -148,6 +148,21 @@ void fwnode_links_purge(struct fwnode_handle *fwnode) fwnode_links_purge_consumers(fwnode); } +static void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode) +{ + struct fwnode_handle *child; + + /* Don't purge consumer links of an added child */ + if (fwnode->dev) + return; + + fwnode->flags |= FWNODE_FLAG_NOT_DEVICE; + fwnode_links_purge_consumers(fwnode); + + fwnode_for_each_available_child_node(fwnode, child) + fw_devlink_purge_absent_suppliers(child); +} + #ifdef CONFIG_SRCU static DEFINE_MUTEX(device_links_lock); DEFINE_STATIC_SRCU(device_links_srcu); @@ -1154,12 +1169,22 @@ void device_links_driver_bound(struct device *dev) LIST_HEAD(sync_list); /* - * If a device probes successfully, it's expected to have created all + * If a device binds successfully, it's expected to have created all * the device links it needs to or make new device links as it needs - * them. So, it no longer needs to wait on any suppliers. + * them. So, fw_devlink no longer needs to create device links to any + * of the device's suppliers. + * + * Also, if a child firmware node of this bound device is not added as + * a device by now, assume it is never going to be added and make sure + * other devices don't defer probe indefinitely by waiting for such a + * child device. */ - if (dev->fwnode && dev->fwnode->dev == dev) + if (dev->fwnode && dev->fwnode->dev == dev) { + struct fwnode_handle *child; fwnode_links_purge_suppliers(dev->fwnode); + fwnode_for_each_available_child_node(dev->fwnode, child) + fw_devlink_purge_absent_suppliers(child); + } device_remove_file(dev, &dev_attr_waiting_for_supplier); device_links_write_lock(); diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index fde4ad97564c..21082f11473f 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -19,8 +19,10 @@ struct device; * fwnode link flags * * LINKS_ADDED: The fwnode has already be parsed to add fwnode links. + * NOT_DEVICE: The fwnode will never be populated as a struct device. */ #define FWNODE_FLAG_LINKS_ADDED BIT(0) +#define FWNODE_FLAG_NOT_DEVICE BIT(1) struct fwnode_handle { struct fwnode_handle *secondary; From patchwork Fri Feb 5 22:26:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071629 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, 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 CB5A3C433E6 for ; Sat, 6 Feb 2021 02:40:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A527465010 for ; Sat, 6 Feb 2021 02:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230448AbhBFCjX (ORCPT ); Fri, 5 Feb 2021 21:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbhBFCey (ORCPT ); Fri, 5 Feb 2021 21:34:54 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0E5CC0698E5 for ; Fri, 5 Feb 2021 14:26:54 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id w4so8772753ybc.7 for ; Fri, 05 Feb 2021 14:26:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=j8xLJ/gRsabqXmVqApH6UU1AJY7QICocc5XvPOoh2CA=; b=E5sFvJO7MoqTQ5HU1iZRDkvKf3YEJnMxgLBzB4Bdzzu+OwTihKotepF9+vecFbKNIx RMScWAE2zE8rfvaCnxQasMRx1b2r+VjvXf9v4q+HNHmXZS+zJmKBYlJ1jOnNKPkYLUUx +9C9RV4z0aszLyrKr2OQQUAT3XhAqGUElzBIGIsskZIGV69KYaqaW83ucTaO/doqcRq5 aA1hFJJYjJVvodQlIzs4Yf6qBGi+RWhj71EWMUCnJT+YB8Jg9U54RCqfkCTP8s/4Q2lH nfjbItiLvc4Ce0s3du8UwLa5Sd+7cG0N/EYOX2N9Kz9ci0pHOQ3JMNDAeaGfizIIj8Tt OyuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=j8xLJ/gRsabqXmVqApH6UU1AJY7QICocc5XvPOoh2CA=; b=mRmr1uaPwzNmg5ZGDSh1TxMNTxYEof1vOf/DiljmQURHCl1KLfZo6aqxAkd5tdGhWI 0IIb74LszDK5466gKas9kZoQowai9iLiw8uQ0XkVfI4g8VvO9cS5OutmkivAW9UZ6gb2 iI3Tr8pGaWLnevBPpa3F7/jv7N+Mvwyk9MpmrC4vsEGSgNlnih4YU1z5iuNNEiGCnIDq S6AlazePaEvkND+6hUBbcIR942Lgap/RESK78JpxE2J+Y6Mzo23Q14dXS+Y/qqxLfyes o8Y8ZguHXTwsvCMVSTOxsHhsZdAuPZoJjqPHOS6YZmUCgPz14gTTcZ96BuXjqxAPjLSD ylxw== X-Gm-Message-State: AOAM5318gAFM6Yh9egpMcndM+/FCu/StMJ7cQBn6CyDr7z5q3NEWCBJP 1Af+hl+FNa4m8HCyFzcBDUTWTDBlSimyCeo= X-Google-Smtp-Source: ABdhPJwaxJzPZ4XSeGkT3P5EprKNXkjzOOR8qEj+Bd02rhMYgGuOOcL7rRwb/dvXftOqDNpM24CwbGcGHu5s6VY= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:d648:: with SMTP id n69mr8876885ybg.462.1612564014028; Fri, 05 Feb 2021 14:26:54 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:38 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-3-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 2/8] of: property: Don't add links to absent suppliers From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner , Saravana Kannan Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org If driver core marks a firmware node as not a device, don't add fwnode links where it's a supplier. Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") Signed-off-by: Saravana Kannan Acked-by: Rob Herring --- 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 6287c6d60bb7..53d163c8d39b 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1103,7 +1103,9 @@ static int of_link_to_phandle(struct device_node *con_np, * created for them. */ sup_dev = get_dev_from_fwnode(&sup_np->fwnode); - if (!sup_dev && of_node_check_flag(sup_np, OF_POPULATED)) { + if (!sup_dev && + (of_node_check_flag(sup_np, OF_POPULATED) || + sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) { pr_debug("Not linking %pOFP to %pOFP - No struct device\n", con_np, sup_np); of_node_put(sup_np); From patchwork Fri Feb 5 22:26:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071817 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, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 3A46AC433E0 for ; Sat, 6 Feb 2021 03:18:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02F9464FBA for ; Sat, 6 Feb 2021 03:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232142AbhBFDRh (ORCPT ); Fri, 5 Feb 2021 22:17:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232033AbhBFCuX (ORCPT ); Fri, 5 Feb 2021 21:50:23 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 598D8C03C048 for ; Fri, 5 Feb 2021 14:26:57 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id f127so8663712ybf.12 for ; Fri, 05 Feb 2021 14:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=b4KyYLVrTLECRx+jmWSgUnKVrTsTSqPSowT6HXuVPvs=; b=OHW6wSTP29Ue99rfiI7cWlnG+iIdDrF/RFLn7uoMGaydP+0SO7iq4Wq4d3/eqO21ya KLmXP2JX5TSvNzDYoK5EV6DL9JdJSYMFn/F1Hp7y6d44BhceOCszy5fv7mkcI/x3YxAh xifCY/lhRuqpYU9xhi89Nys/lnLzdiyzix5IWrtJ/UWGBQrClmZRfFVt91VbD8X7eoQI 2Png0NqhsXQZ7vz6M4N1fZn/vcqGhrLWGbEWE5mv2GRT3g9PI82H9hTXw4D2uizG5j9B ZxcCTRk1HSgG6v0SC8Wo+iqzvg2U5sjEO1EbK7JZfh6t3yDpITS6bKeEhMEzd8jVwfLv 0Egg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=b4KyYLVrTLECRx+jmWSgUnKVrTsTSqPSowT6HXuVPvs=; b=Rxd2A11uXAA/VzHxe2onQzN+ljZ18QBUht6oGUVZG8uWfhcmFxsW9dTZlIVIE+781j exGJyGc8XauhYXxlxsWRvCAIOjmTJjpInKPBLXlu1Is8QPx9xJghI+nvpVsEVShDwhA8 a3PTHXonrhf+9L1ushNDgijhhyIDRAKVAPWVlR6ttDLELf3qP+8/q2Im5HnbPryeOyeK eFnsQH/4S4enecVLl3+S7Glyp8rSCK+GG6up10W7A4LqT9fHW4slEBZnYCAStjo32Uij frgx2NbNILM6GxZuoy96bSTbh/QnYLYBTcgE93D6YBlY3nIGJ0J9ghjRNyxpwByqRB2n AzFA== X-Gm-Message-State: AOAM533C3BYrGAoTICz9re2u08E1fCe1BdZFSbnbYchPrqbQ1AZy499U AJsQb0uwMg08ZRhsv0RXyo6tL90E9Z7Kwt0= X-Google-Smtp-Source: ABdhPJw60eK9Ayb2Dfnm6izl3OAD/ZSexeT7MabEdfxzu+ks3+x2ogPf1BgHRmP6XVGyEvP6jtupQy7fiaM7V/g= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:1188:: with SMTP id 130mr9154088ybr.138.1612564016624; Fri, 05 Feb 2021 14:26:56 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:39 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-4-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 3/8] driver core: Add fw_devlink.strict kernel param From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner Cc: Saravana Kannan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This param allows forcing all dependencies to be treated as mandatory. This will be useful for boards in which all optional dependencies like IOMMUs and DMAs need to be treated as mandatory dependencies. Signed-off-by: Saravana Kannan --- Documentation/admin-guide/kernel-parameters.txt | 5 +++++ drivers/base/core.c | 12 ++++++++++++ include/linux/fwnode.h | 1 + 3 files changed, 18 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a10b545c2070..692b63644133 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1433,6 +1433,11 @@ to enforce probe and suspend/resume ordering. rpm -- Like "on", but also use to order runtime PM. + fw_devlink.strict= + [KNL] Treat all inferred dependencies as mandatory + dependencies. This only applies for fw_devlink=on|rpm. + Format: + gamecon.map[2|3]= [HW,JOY] Multisystem joystick and NES/SNES/PSX pad support via parallel port (up to 5 devices per port) diff --git a/drivers/base/core.c b/drivers/base/core.c index c95b1daabac7..f466ab4f1c35 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1521,6 +1521,13 @@ static int __init fw_devlink_setup(char *arg) } early_param("fw_devlink", fw_devlink_setup); +static bool fw_devlink_strict; +static int __init fw_devlink_strict_setup(char *arg) +{ + return strtobool(arg, &fw_devlink_strict); +} +early_param("fw_devlink.strict", fw_devlink_strict_setup); + u32 fw_devlink_get_flags(void) { return fw_devlink_flags; @@ -1531,6 +1538,11 @@ static bool fw_devlink_is_permissive(void) return fw_devlink_flags == FW_DEVLINK_FLAGS_PERMISSIVE; } +bool fw_devlink_is_strict(void) +{ + return fw_devlink_strict && !fw_devlink_is_permissive(); +} + static void fw_devlink_parse_fwnode(struct fwnode_handle *fwnode) { if (fwnode->flags & FWNODE_FLAG_LINKS_ADDED) diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 21082f11473f..d5caefe39d93 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -162,6 +162,7 @@ static inline void fwnode_init(struct fwnode_handle *fwnode, } extern u32 fw_devlink_get_flags(void); +extern bool fw_devlink_is_strict(void); int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup); void fwnode_links_purge(struct fwnode_handle *fwnode); From patchwork Fri Feb 5 22:26:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071651 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, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 0D76AC433E9 for ; Sat, 6 Feb 2021 02:45:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD8C364F91 for ; Sat, 6 Feb 2021 02:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbhBFCoj (ORCPT ); Fri, 5 Feb 2021 21:44:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbhBFCcV (ORCPT ); Fri, 5 Feb 2021 21:32:21 -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 2C663C03C063 for ; Fri, 5 Feb 2021 14:27:00 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id n81so8657508ybg.20 for ; Fri, 05 Feb 2021 14:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=Bw5DCGRTYuHhV6CaEDXr7VykkGUog594vA90XJtHO1Y=; b=OJ24USk8NaXzKxxqD9cIc2fuOOLVmyyzmeeBnuhX2haf4opjBLOqqJRPp0oJB2TcJy QU5VBOCElNExNGxqLUxqgYZItGUiFhRtQzb3LQdbw3Y0LZcW3LuI88Njj48rtjKPsSZ2 4F0icSi17k6dTngdFP+PaTB0cFBlMjBumwi1fy39MHFAPu/w9n8my2gcennaSg5vjErP sQRLYkA7SGqEGGXM0TBNdHDG5nonXhw92Rf6mDDQik8AxtIwTOsa++xp6SeuTGFyIXpz MAv6/0kL+jIazKDHFcWr73Ze5NFqgWo6QJFSaG2D5SJFVSY04331pMLEzlZOwVgZ2YBU uyXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Bw5DCGRTYuHhV6CaEDXr7VykkGUog594vA90XJtHO1Y=; b=HKh1HGmfvYrLkUHlFyQv2Ct8RSyLKnvgeIRvD/B7Yc69uAVxaehv7WjjQiaKz1/AB/ ehAkBg/ibGz0rZ4xii7wgHjLfw0q2ezdpBpZC/9E+kR7G0N0dj/6ghrgygIqeGhUDqTX Ew1OWrNZo0+HfQTwEjw2lCd8G5g0pUX33F6uL+oj4CxMXZ4bxdz2F9iRRF8xGBnYRuVU SsbRojnn3K+a7nvJBTKYNIt3ybs8IRvVUG9EJSuz4ZVg/buaoesPOXBT9JZtLG23rqfO PkPF4KHmfYJ7qmhwjn2JCbKpnbhSqqAawm67KWzauRBfInvhsyBmF1JLT1Y8rZ12vHqd P2Rg== X-Gm-Message-State: AOAM5325CWNWNxaU1mk1Mg/f/pPy7g5sJryKdZYyoWBacloMg3HMVD03 NWpHbZjvsqa9HDVUnRBba6tXhJD7VLYkw6Y= X-Google-Smtp-Source: ABdhPJy8zXEis/xhZQjdQJH/U4yg9J4P3415kxIuICG74Qvlo/PkTtrQfpR8JQK+yrBlCNXAjS7e2k4VjoRZpiE= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:e54:: with SMTP id 81mr9240781ybo.404.1612564019429; Fri, 05 Feb 2021 14:26:59 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:40 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-5-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 4/8] of: property: Add fw_devlink support for optional properties From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner Cc: Saravana Kannan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Not all DT bindings are mandatory bindings. Add support for optional DT bindings and mark iommus, iommu-map, dmas as optional DT bindings. Signed-off-by: Saravana Kannan --- drivers/of/property.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 53d163c8d39b..962109082df1 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1235,6 +1235,7 @@ 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); + bool optional; }; DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") @@ -1308,12 +1309,12 @@ static struct device_node *parse_interrupts(struct device_node *np, static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, - { .parse_prop = parse_iommus, }, - { .parse_prop = parse_iommu_maps, }, + { .parse_prop = parse_iommus, .optional = true, }, + { .parse_prop = parse_iommu_maps, .optional = true, }, { .parse_prop = parse_mboxes, }, { .parse_prop = parse_io_channels, }, { .parse_prop = parse_interrupt_parent, }, - { .parse_prop = parse_dmas, }, + { .parse_prop = parse_dmas, .optional = true, }, { .parse_prop = parse_power_domains, }, { .parse_prop = parse_hwlocks, }, { .parse_prop = parse_extcon, }, @@ -1368,6 +1369,11 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) /* Do not stop at first failed link, link all available suppliers. */ while (!matched && s->parse_prop) { + if (s->optional && !fw_devlink_is_strict()) { + s++; + continue; + } + while ((phandle = s->parse_prop(con_np, prop_name, i))) { matched = true; i++; From patchwork Fri Feb 5 22:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071881 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, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 8FFC4C433E0 for ; Sat, 6 Feb 2021 03:43:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50AE364FB0 for ; Sat, 6 Feb 2021 03:43:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231723AbhBFDnh (ORCPT ); Fri, 5 Feb 2021 22:43:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230313AbhBFDlb (ORCPT ); Fri, 5 Feb 2021 22:41:31 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3199C08E8BB for ; Fri, 5 Feb 2021 14:27:02 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id 203so8751275ybz.2 for ; Fri, 05 Feb 2021 14:27:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=nTYZSPOjkc18IliuMfnfRh5H/pVF22NJbjiTgx5RAVQ=; b=Mm6nmK+U9sWgdy5Kl5FWR72rOFcOPFvROrGTmdoXRpZIiuZV62ELOWH/ANFl9FZv48 WKXxbas72ewJwQSAlM+tuQ5oro9iQc2J6lQg3Fj4ZGY95z4hvdDMslQ/xFUCHGw9JTQW ozCrQLXZ4ZZwk460RT8jQymPqzGWnn6RzLezbUwlZbxeN6sZ9i9EFrxpHIMJXDCZ+GtS ZxX35V5B8D7JFLk2l9CMndHRKsILANotrh6ov6yUqsjE4ZkLpQq/qs+6ILuymjBzW/t3 lfMT6f+nRYfVGGUpAXuGaHE3M4iW6zmvvcop6V9w3pEKg6VttIn53oZg6LRjtoP47yQC LIaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=nTYZSPOjkc18IliuMfnfRh5H/pVF22NJbjiTgx5RAVQ=; b=EqJVNeRug4UZaeYsrlb7JIME5luAG74QXhl5ntVj6btG9powDBo03HL9lAwvK11SFE +dyPnQFjeL3CfJUP+jw6RJE0G2g8WRAYUxXiL9D3oy4pA9gL7JL9M+NOs/gPxin6wqpE HlFihhzOCsHA22Oa0fbClNqrOtZVsPuDFLQJk2bbibEVCQJis6vdwv8hBp+k+L0EJVLx wAV0FCkavx+RRBy7AjJxk9fmHGEbjHghmk7Y5Z1RN6sqsVOuaGa/oFuzM4VFIA91/zzJ x5Wd6LzlvVPFbnE9AU+ZVnpHQfb3rh2XrQzejZbHxis6GEordms+vo+NHx8AItvzGWsT Ytzw== X-Gm-Message-State: AOAM530tCQCeh3C0iwtEvexpk9ueMjKtajMBje+1I93sSdfK+AD7tDDM UFc1lWhkIdqSk5/O1l+1RiVxGP7EzCoVxCs= X-Google-Smtp-Source: ABdhPJyW1m9SbXAqH09239WynVsuVFpGwpuvcunwzfCPoBBzTTIBp5GlOy/wl0ZJFwtPTfMh78OkuipnUZY/zB8= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:3104:: with SMTP id x4mr9895088ybx.141.1612564022147; Fri, 05 Feb 2021 14:27:02 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:41 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-6-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 5/8] driver core: fw_devlink: Handle suppliers that don't use driver core From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner Cc: Saravana Kannan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Device links only work between devices that use the driver core to match and bind a driver to a device. So, add an API for frameworks to let the driver core know that a fwnode has been initialized by a driver without using the driver core. Then use this information to make sure that fw_devlink doesn't make the consumers wait indefinitely on suppliers that'll never bind to a driver. Signed-off-by: Saravana Kannan --- drivers/base/core.c | 15 +++++++++++++++ include/linux/fwnode.h | 19 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index f466ab4f1c35..ea710b33bda6 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1636,6 +1636,17 @@ static int fw_devlink_create_devlink(struct device *con, sup_dev = get_dev_from_fwnode(sup_handle); if (sup_dev) { + /* + * If it's one of those drivers that don't actually bind to + * their device using driver core, then don't wait on this + * supplier device indefinitely. + */ + if (sup_dev->links.status == DL_DEV_NO_DRIVER && + sup_handle->flags & FWNODE_FLAG_INITIALIZED) { + ret = -EINVAL; + goto out; + } + /* * If this fails, it is due to cycles in device links. Just * give up on this link and treat it as invalid. @@ -1655,6 +1666,10 @@ static int fw_devlink_create_devlink(struct device *con, goto out; } + /* Supplier that's already initialized without a struct device. */ + if (sup_handle->flags & FWNODE_FLAG_INITIALIZED) + return -EINVAL; + /* * DL_FLAG_SYNC_STATE_ONLY doesn't block probing and supports * cycles. So cycle detection isn't necessary and shouldn't be diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index d5caefe39d93..dfefd43a737c 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -11,6 +11,7 @@ #include #include +#include struct fwnode_operations; struct device; @@ -18,11 +19,13 @@ struct device; /* * fwnode link flags * - * LINKS_ADDED: The fwnode has already be parsed to add fwnode links. - * NOT_DEVICE: The fwnode will never be populated as a struct device. + * LINKS_ADDED: The fwnode has already be parsed to add fwnode links. + * NOT_DEVICE: The fwnode will never be populated as a struct device. + * INITIALIZED: The hardware corresponding to fwnode has been initialized. */ #define FWNODE_FLAG_LINKS_ADDED BIT(0) #define FWNODE_FLAG_NOT_DEVICE BIT(1) +#define FWNODE_FLAG_INITIALIZED BIT(2) struct fwnode_handle { struct fwnode_handle *secondary; @@ -161,6 +164,18 @@ static inline void fwnode_init(struct fwnode_handle *fwnode, INIT_LIST_HEAD(&fwnode->suppliers); } +static inline void fwnode_dev_initialized(struct fwnode_handle *fwnode, + bool initialized) +{ + if (IS_ERR_OR_NULL(fwnode)) + return; + + if (initialized) + fwnode->flags |= FWNODE_FLAG_INITIALIZED; + else + fwnode->flags &= ~FWNODE_FLAG_INITIALIZED; +} + extern u32 fw_devlink_get_flags(void); extern bool fw_devlink_is_strict(void); int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup); From patchwork Fri Feb 5 22:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071681 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, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 9B99AC433E6 for ; Sat, 6 Feb 2021 02:51:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F51E64F91 for ; Sat, 6 Feb 2021 02:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231268AbhBFCug (ORCPT ); Fri, 5 Feb 2021 21:50:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231743AbhBFCn0 (ORCPT ); Fri, 5 Feb 2021 21:43:26 -0500 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DF34C08EB27 for ; Fri, 5 Feb 2021 14:27:05 -0800 (PST) Received: by mail-qv1-xf49.google.com with SMTP id e17so6120288qvo.9 for ; Fri, 05 Feb 2021 14:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=TYrtpVLRn3by/Vo/kcPBrt+TPgx+fv0qz/2DUsVYehs=; b=U3Djp3k+GP8+qJmYpXluNSRzD2CCSzeiwHY7gG5D/DqWI0d0WLtnjKmxmVZwbiIl0a DFuApaMx2zqSpPNTf2PGF1oJpYthPmhJ2nm7rd2FmpuV1zS4CjVC38Mf9NqZTb6tJ5Rs 93wkaMcPIgBSX8jCDP5L9RSQLRvhi2UMzrLfRacvFGFL/pq/TEt1Cdp+4z3JxfX6hUPY 3SaWd0T0LeIsrDoy5GbOj+zSX+2Le6Rc6XHW6dAFGuVc9CI83wb9jLeqsHTQhT8g0xqk FYbC9sFBEawc8DYagceFE3B8UJcbArkFf7OvdDS8fCXYYPCcSAz2G0+SwR2UiM/F+Tui URvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=TYrtpVLRn3by/Vo/kcPBrt+TPgx+fv0qz/2DUsVYehs=; b=WUsemLkw57cdwOqgZR7NO98c0xVJAobvpMnMn6VAY8AnbFgVu4a0jBxPwKxA9krJUK aVWH4eyL4GRFAU8P2z6ayYiBt2DFa/dhpG51fsbc8nrnRZ2ziIL+G4a9fF6WEWuqMZSL 3+hpz4VHRmGQEWhB3Ny+I/hGexxgs4+VNswmMHxrWYwPQvqNmcrCGWhQs1HmkzH+vGAt x97E6cybdBujyzf0gktozpO2EYBGrlE0jmIz6CNOcV95of1ySQwqyN1jtIcF5v52XeKv JXJMRKdHglFJgeaHuxTvww57V6ktCjzgydJdCNRvhCOP+Ep/jPJNJ5ZCFdQV+R6HCSrD UBWA== X-Gm-Message-State: AOAM5336+L1c3SeqzY2wccwXdkCgY6cqSgOwMzAButQS9zqJO6SAAYQo wdgKkzlDHrE6IF7f4B3KgAzxIczCu713Rz4= X-Google-Smtp-Source: ABdhPJwdjYLytH5Kf+IR/URLqg4oBMorIriHqSmnCdh9rbCozFjv7tkF2iAFZexBUHOTPiNpU3ZtLytbJBYvjy8= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:ad4:4e8a:: with SMTP id dy10mr6613039qvb.36.1612564024540; Fri, 05 Feb 2021 14:27:04 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:42 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-7-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 6/8] irqdomain: Mark fwnodes when their irqdomain is added/removed From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner Cc: Saravana Kannan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This allows fw_devlink to recognize irqdomain drivers that don't use the device-driver model to initialize the device. fw_devlink will use this information to make sure consumers of such irqdomain aren't indefinitely blocked from probing, waiting for the irqdomain device to appear and bind to a driver. Signed-off-by: Saravana Kannan --- kernel/irq/irqdomain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 6aacd342cd14..288151393a06 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -205,6 +205,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, } fwnode_handle_get(fwnode); + fwnode_dev_initialized(fwnode, true); /* Fill structure */ INIT_RADIX_TREE(&domain->revmap_tree, GFP_KERNEL); @@ -253,6 +254,7 @@ void irq_domain_remove(struct irq_domain *domain) pr_debug("Removed domain %s\n", domain->name); + fwnode_dev_initialized(domain->fwnode, false); fwnode_handle_put(domain->fwnode); if (domain->flags & IRQ_DOMAIN_NAME_ALLOCATED) kfree(domain->name); From patchwork Fri Feb 5 22:26:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071603 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, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 46B76C4332D for ; Sat, 6 Feb 2021 02:36:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D81864FEF for ; Sat, 6 Feb 2021 02:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbhBFCgk (ORCPT ); Fri, 5 Feb 2021 21:36:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbhBFCd3 (ORCPT ); Fri, 5 Feb 2021 21:33:29 -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 03125C08EB2B for ; Fri, 5 Feb 2021 14:27:08 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id i2so8773445ybl.16 for ; Fri, 05 Feb 2021 14:27:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=hqgmXDFwubR/4OnYp87mHqkgPgat9JpTuiz1JNw02ec=; b=HlWJductGnrWtiPlz4VOZAKZtOtHqGtLYG+/m1uG/3j65UbnLXs2ZbOsEsXyQxmcET g5WBXP+ZNdGYsnDNt1AesV/YgtyYbWi8DAfFoP0DUlB0H5AivhCjx7cacjqpzdvJGJkd KJC2axaJVKWb1aZIsjpltmtFIvFilsr/MFeX+VgPTcT+ctffNfukCK16/1DH2bNHZiHq Hs7/PR9SRig14irkeZyDibp5UYV06N4v4E99Aa8HWCyCWoP6sXyRZruGYn7FnGjIrZAc i9RLCHWExeGNkOCk36mOaRKleCDV2qf/Or99/FRsSW4kmlVWj7q6WRTD/+sE9+7tZQaK FlQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=hqgmXDFwubR/4OnYp87mHqkgPgat9JpTuiz1JNw02ec=; b=U6a6JZkOybfxnkuLE/fUFNIyO5tFq0FDETB2CoVSywcyaCb5ZGNCQ2wg0HgsaTCnJq bVesjBQQWpDdxxX3MNGKHSKs19o1Yal7f+lwcKF0fN+de26c0sWpiMSmINWXypIQYGDM Fh1Y5yLd+a9H5ST2SDW75NgGaR/i3XOgyo52vhlyinKXzRrPUiIWStFiG4y/BaYncgjW 3Kj+IhOxQT9FGz/SGOhxgckpNcNHuOPns5ZmCBoCzZ6qb/Ej2iYKuxvYurZZomFtvQFp pNo66rAK8Sma6Jjj2q63jCDNQfI3TkflX0rQdz7Jhk4XvH3tDNY+IpvUumyHdra6P2mY KySQ== X-Gm-Message-State: AOAM530Sbp2PdKVMbhFtNT5qhpd1phxrjV67ORsDn+eER7zLDwAP3CD2 CCVT6krVDIYJti2kyT0fEFXnN31dIA0r8uI= X-Google-Smtp-Source: ABdhPJypj8OxFVj8NpBAu+RA/WW+/KzA+etEoUDFgMecuxAKnsbx9dKd514JBTdlGgxWwGx8SVTerVvqi1AS370= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:5b8a:: with SMTP id p132mr10020763ybb.67.1612564027217; Fri, 05 Feb 2021 14:27:07 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:43 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-8-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 7/8] PM: domains: Mark fwnodes when their powerdomain is added/removed From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner , "Rafael J. Wysocki" Cc: Saravana Kannan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This allows fw_devlink to recognize power domain drivers that don't use the device-driver model to initialize the device. fw_devlink will use this information to make sure consumers of such power domain aren't indefinitely blocked from probing, waiting for the power domain device to appear and bind to a driver. Signed-off-by: Saravana Kannan --- drivers/base/power/domain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 9a14eedacb92..6ac52a038bb9 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2164,6 +2164,7 @@ static int genpd_add_provider(struct device_node *np, genpd_xlate_t xlate, cp->node = of_node_get(np); cp->data = data; cp->xlate = xlate; + fwnode_dev_initialized(&np->fwnode, true); mutex_lock(&of_genpd_mutex); list_add(&cp->link, &of_genpd_providers); @@ -2353,6 +2354,7 @@ void of_genpd_del_provider(struct device_node *np) } } + fwnode_dev_initialized(&cp->node->fwnode, false); list_del(&cp->link); of_node_put(cp->node); kfree(cp); From patchwork Fri Feb 5 22:26:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 12071679 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, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 A6C9CC43381 for ; Sat, 6 Feb 2021 02:51:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 804E764EEF for ; Sat, 6 Feb 2021 02:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232053AbhBFCut (ORCPT ); Fri, 5 Feb 2021 21:50:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbhBFCpF (ORCPT ); Fri, 5 Feb 2021 21:45:05 -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 6638EC08EC2B for ; Fri, 5 Feb 2021 14:27:10 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id q191so8733421ybg.4 for ; Fri, 05 Feb 2021 14:27:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=0bK1cCqgN588qufpQS/jjMkFLqvM+XaA6lencJh5Esw=; b=pd0J5a0Gj6OJSYp7XH9+FNQHPBJdLZKzDSYwPK5u1ibnaAHv+7CWag8ijunOE9TunY rfH4kJBJkTaXTV9oJb29EtaGVzAhamAsrUpD9WxBP9zdpVN+VSy75zOwQ8X3ZfAdhLMe mDKrHkXJdOvKIScsXP0LwxtmU+0Z8CAngf3uWgzTxFHgVYCjuL8rAz4Vsox/6LUAxzW5 MRcdF+4usBPhWiIaGf4NAtDC1+btGYzFBfT9G0+ShzhkBywErl48rl5a4pOA+2aiWGVY 8M7h6tRlVXuW8kVZ+qFMkd2OawDjkeFzk26X1oEdg4TO44R/lohfBKQybn9mqBUar5JT uqIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0bK1cCqgN588qufpQS/jjMkFLqvM+XaA6lencJh5Esw=; b=CgIDuq2LPJz9unN+d6wFAafjZWYN4w/CJh/yCGniuncUlQenNLCY+QqpBDqzl+gtSc tWT6OD92ZEADyIMUpE+3rlurhySTn3ysoNIpGPUw7p1yFZRruchCEMaKnXNYoB4JTzY2 +eoROCfzbuoERbXxAPFW3yaQoDYAO7rAtK4l/q8gwMOiHFrcpeU9P9v86VKV0SuDdioj 42SlqCMWdn+eruNlI199KOizR7Q8ZOwJFKHwiSRz0Pdc4b5SLhqxTinoLotJG2kLt0cN k088/8vI6bD5beFG2SxTReY348TlSURSaRO6DFWzR8+8X+3z2ApT+eK+bV3OZUydlUbS ZcaQ== X-Gm-Message-State: AOAM531YV1ORrJyklm20/I4ltSEYa0vWdUMG8UPRSxGWivSks2gGOFai n8nyVB2WfalwWvKJpiS+Vo4K2VHkQWsmKio= X-Google-Smtp-Source: ABdhPJw99YDc8d0ycmQvA2pScnXjqnl/G4/xLF7whBdxq6B/zNO/ve0DpZDnU/PkkiSIcO/DWD8tNvRuJW0clJs= Sender: "saravanak via sendgmr" X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6d36:b798:55d7:f5c5]) (user=saravanak job=sendgmr) by 2002:a25:743:: with SMTP id 64mr8649867ybh.333.1612564029679; Fri, 05 Feb 2021 14:27:09 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:44 -0800 In-Reply-To: <20210205222644.2357303-1-saravanak@google.com> Message-Id: <20210205222644.2357303-9-saravanak@google.com> Mime-Version: 1.0 References: <20210205222644.2357303-1-saravanak@google.com> X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH v4 8/8] clk: Mark fwnodes when their clock provider is added/removed From: Saravana Kannan To: Jonathan Corbet , Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Len Brown , Pavel Machek , Michael Turquette , Stephen Boyd , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner Cc: Saravana Kannan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Marek Szyprowski , Geert Uytterhoeven , kernel-team@android.com Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org This allows fw_devlink to recognize clock provider drivers that don't use the device-driver model to initialize the device. fw_devlink will use this information to make sure consumers of such clock providers aren't indefinitely blocked from probing, waiting for the power domain device to appear and bind to a driver. Signed-off-by: Saravana Kannan --- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 8c1d04db990d..27ff90eacb1f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -4555,6 +4555,8 @@ int of_clk_add_provider(struct device_node *np, if (ret < 0) of_clk_del_provider(np); + fwnode_dev_initialized(&np->fwnode, true); + return ret; } EXPORT_SYMBOL_GPL(of_clk_add_provider); @@ -4672,6 +4674,7 @@ void of_clk_del_provider(struct device_node *np) list_for_each_entry(cp, &of_clk_providers, link) { if (cp->node == np) { list_del(&cp->link); + fwnode_dev_initialized(&np->fwnode, false); of_node_put(cp->node); kfree(cp); break;