From patchwork Tue Mar 5 05:04:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 778074 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 BB94A48CD4 for ; Tue, 5 Mar 2024 05:05:06 +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=1709615108; cv=none; b=P4m//64m6n1JXpKgS/0FgKwsnNgx/7QPZy37DD3MJVxX6Xw+8EtAcZwrzXZ3FwV+tE9XpiQIZVUEUSQxv7QOKuKZSYF3CboQx/HElO2gna23jz81FyI1wVFoUwXp6OI1r5jDoKOfOzOf+vTW45Le1KwIv5x7abBIa+Hp1YHYZyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709615108; c=relaxed/simple; bh=XZDv8ekUBDuPcx7JKwUSFcvODGOCjCS19jys6D4SP1U=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=PkfdOnmG1uIjcwMsYrzsAm1bVb+y1ElA2wtGGwc+21U3ZJ3sV16+REakQSzn4xAofepxfPMRVf2FAToHnIcb2H6uHQDgg6P5uU64LDofBWEmCT37PHly7z6IgZJEWYTcwb4QNRviWACN/ssJM8MPZqyrNGhIOVI7ZR9YyBGVusI= 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=2DrxWbXC; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2DrxWbXC" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5f38d676cecso81712477b3.0 for ; Mon, 04 Mar 2024 21:05:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709615106; x=1710219906; 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=0QkOR2sMhH+Si14pz9snYlJ/FpZBxS/MFY8PC4k8Ihg=; b=2DrxWbXCO75d+Bu/Yrx5LVx7+e61YOJ7kNnjDbKZ9f9fPcLL7yha9ztcwEWo50fTC0 vTNtddtLDeKGVHAj6VxhFxzlYgbn0/Vb/e6sQqoYhajatHIKzxIN76g/R3Nc0AWGlkbM KrG0yhldCCQWLuJS2hHWOxZarDEKJ0T5IwniOqhZq5i2OeStVLdVZiyY3tMzKtAnchtD SOsoO9PwC9JBn7JquAEH6ie7r5ihPEmRP4aH1ednrGU9A/9SWdO+JryGwGCrgAOfCU/R qWoDgRHWmefbd/aVWMVnH4HFzr7EVhNSiuEe1ogZBSIAOyWrOeNd8agig8xkyTYC6epk i/RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709615106; x=1710219906; 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=0QkOR2sMhH+Si14pz9snYlJ/FpZBxS/MFY8PC4k8Ihg=; b=ojfLkGbINojalKRt3ymb4/BbPGjH3IdxFxVL+99vweCHVVrM53SqgPQjR4Nr0gm2mU YODoU7qLQoQw34VNEoX2vyOzmuCg3YN6seDjbID2RYWy1Vd3p3iUoUPN41CZ0voR2hD+ obc5/RIGYTAW51ujgucM/lKjRYhTTRoZhr8cznCiR1OJHjqnj95+hyT8JKxSxd63t1Sb Lrdk3YK5q4pj0nW5biOZQCrl7mk2HG5jW+EQhgpyNhaya9sMVS0pAjwXvBRschTchLsO 7G7mQV6BwwUyAlLkEAChpmvFkTlgy8iYXnny0gDfe681M++zH1c/lF2wRAU8SSKGhjcD Qb1g== X-Forwarded-Encrypted: i=1; AJvYcCVuqYtC2Z48XbABvkofRICLWnBBsXCn0IO6d2KPcts5cKC4mbxgl8yzuOOu3BMMEYx7yHLqu4IUkflZaAjQ4H9F4AcnQe05z0gONA== X-Gm-Message-State: AOJu0Yyxt49qVnVFFDIHmm4/1uQmsMfnZB63e4iJQRuZmCyLXpO04qIU 9mTEZ/p5dHvkeutbA2REPTV0svS3wEXZPnAmfb4qFikVkgss05nhJNRd+mu40UEO3WOpGFLA63X wuud0pibJ3pWh8w== X-Google-Smtp-Source: AGHT+IFBN8VA4FaW/ghps1zLmeYuq0EAXL9hg4A2mHhIFtvwUqQNXCx0C87Vi+9hsAj/TMtp6ZI+h47oPYMl1AU= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:d64:6ee3:55a9:46e6]) (user=saravanak job=sendgmr) by 2002:a05:6902:10c1:b0:dc2:2e5c:a21d with SMTP id w1-20020a05690210c100b00dc22e5ca21dmr443242ybu.6.1709615105906; Mon, 04 Mar 2024 21:05:05 -0800 (PST) Date: Mon, 4 Mar 2024 21:04:54 -0800 In-Reply-To: <20240305050458.1400667-1-saravanak@google.com> Message-Id: <20240305050458.1400667-2-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305050458.1400667-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v5 1/3] driver core: Adds flags param to fwnode_link_add() From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Rob Herring , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown Cc: Saravana Kannan , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Rob Herring Allow the callers to set fwnode link flags when adding fwnode links. Signed-off-by: Saravana Kannan Acked-by: Rafael J. Wysocki Reviewed-by: Rob Herring --- drivers/base/core.c | 5 +++-- drivers/firmware/efi/sysfb_efi.c | 2 +- drivers/of/property.c | 2 +- include/linux/fwnode.h | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 9828da9b933c..adeff041d472 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -92,12 +92,13 @@ static int __fwnode_link_add(struct fwnode_handle *con, return 0; } -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup) +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup, + u8 flags) { int ret; mutex_lock(&fwnode_link_lock); - ret = __fwnode_link_add(con, sup, 0); + ret = __fwnode_link_add(con, sup, flags); mutex_unlock(&fwnode_link_lock); return ret; } diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c index 456d0e5eaf78..cc807ed35aed 100644 --- a/drivers/firmware/efi/sysfb_efi.c +++ b/drivers/firmware/efi/sysfb_efi.c @@ -336,7 +336,7 @@ static int efifb_add_links(struct fwnode_handle *fwnode) if (!sup_np) return 0; - fwnode_link_add(fwnode, of_fwnode_handle(sup_np)); + fwnode_link_add(fwnode, of_fwnode_handle(sup_np), 0); of_node_put(sup_np); return 0; diff --git a/drivers/of/property.c b/drivers/of/property.c index b71267c6667c..bce849f21ae2 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1085,7 +1085,7 @@ static void of_link_to_phandle(struct device_node *con_np, tmp_np = of_get_next_parent(tmp_np); } - fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np)); + fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), 0); } /** diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 2a72f55d26eb..c964749953e3 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -210,7 +210,8 @@ static inline void fwnode_dev_initialized(struct fwnode_handle *fwnode, } extern bool fw_devlink_is_strict(void); -int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup); +int fwnode_link_add(struct fwnode_handle *con, struct fwnode_handle *sup, + u8 flags); void fwnode_links_purge(struct fwnode_handle *fwnode); void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode); From patchwork Tue Mar 5 05:04:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 778337 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 D6C667BAF5 for ; Tue, 5 Mar 2024 05:05:09 +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=1709615111; cv=none; b=VntNZ+VDDmbf690OQ7x5w00maqwFIH5cf0qrrJn8NcqZL4lRkiFpeKC6/DRKvpOtqUZ68I8q9FnG37YoNTfb5/gIckeGVp8E0iyxCDeVJJoWs9gjJ1o/2XN491XKL+yRdT+8S1rt3/BZE1Rd8UurTbityzm1mgmwP+pl6aUmjDA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709615111; c=relaxed/simple; bh=KbTlvkqJZdkWz3JMFIvxA09yqx88DYjINdZ8RsQzQSg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=jUesXPEObO3NRdV17Oa6kslSBbvYItBADVCKfKyWq132SVJOhhgh5Tdyo1KhaqEcIb6WaEdqS1zUMiXkuRfP7L6vyWKWpS1KyDWJld4caqMXd44Bb4zrVefBN8QzeRUjiy0+Xg/lBPV951/0pUVZyImt0gh2PQO22fb+69n5HZQ= 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=FN/zM/lT; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FN/zM/lT" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607c9677a91so87706007b3.2 for ; Mon, 04 Mar 2024 21:05:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709615109; x=1710219909; 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=kq0SZT0ux4lTSc+RRyaK9dfv6pgUchfiIyZPjXxEFKk=; b=FN/zM/lTOHIj/8BYWIMntUXN7yeq9q9GgULLDzZpoeCxfR3zIrQBSSuYD+TzJgjLoo Tn53kMr/vfkLpS5w69T+CVIMnwGezCPIdBlyvAxIpS1UVmkz+n+XEbFU0cpMhv0rRwLX nj1WvJBkVqA6B1m9QVJZvB8eIETIf/gaq8d5gVWkqV1anGwvF1esN/2BUzreuE2ELhgP jkSgdXXRNZ9YkioI0dZ5y5sqfmu59SF/D0gctyvIxnJRQKTS8u5F0VXgMZDR7OZTM3n7 qD0o3ng9NrPIu2T0kCcuLz0aLmS/EJgJ0e0fMNQDhdX13cdoDX+T4wSlLhIXXThobt9U xkWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709615109; x=1710219909; 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=kq0SZT0ux4lTSc+RRyaK9dfv6pgUchfiIyZPjXxEFKk=; b=xED3c6OJyw8KiSMD+Zp/qk9mf7HoSMA/NtlxDGRAWrJdqKXsjiHTsMU6oB82UrR2Bc xMwsAmYUvc9Y4AIa9x4RwzM5Evl32cMqpd7jGmGEeuT1sgoxbeDEfYXlgpMRiT8QM9Tu OQFzu6KmNmjeFdzfM1jQchYb2YYu9aMhmcLTYUxZfPPlarRleqKps9PWPDJ1bKA/TzWw 8v2GmpElpMeALTPaSf+whic6Wd+QUOzIadrP/AH3V7MfKNMYmK5ejrakgTM3/PM1VoPJ AtJvjPKMS3QA+YTJS0Voj/nzEropRL8E7EiYHMPpOvNNgiwBhQU/Rbg8w7qqPc2wog3y wMiw== X-Forwarded-Encrypted: i=1; AJvYcCXhsWhGd9dVnDtMXtdKTEmsBeS1wjLpWHrvsd6nP76fTrj3wLxTEAYJcZVpKWvOOH1e53uI0uCwIuF38mTMtl9P8q8tDzxioezQLg== X-Gm-Message-State: AOJu0YwH+xvPvplNv1lYH5nfHHav7/Lv3W/xwtx9dtjiewvbF7AxXZmA CJ0yZvM/w8ua3Z8jQ36x9ZfdoQHZUtOodCPnhrMxhWvpfDvtmv8j6DpGUfbKrSkJS7pN1i7redI ee4/Tg9d62P1qOA== X-Google-Smtp-Source: AGHT+IE6/OTFvoDlN5dzzFm/6hXqO2ionBjtS7azhJTBXni5SA73D3v1dU11zMy141HH8FUf/OzA3QpN9CW4JHU= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:d64:6ee3:55a9:46e6]) (user=saravanak job=sendgmr) by 2002:a05:690c:a87:b0:608:a8da:1caf with SMTP id ci7-20020a05690c0a8700b00608a8da1cafmr3127642ywb.6.1709615108938; Mon, 04 Mar 2024 21:05:08 -0800 (PST) Date: Mon, 4 Mar 2024 21:04:55 -0800 In-Reply-To: <20240305050458.1400667-1-saravanak@google.com> Message-Id: <20240305050458.1400667-3-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305050458.1400667-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v5 2/3] driver core: Add FWLINK_FLAG_IGNORE to completely ignore a fwnode link From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Rob Herring , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown Cc: Saravana Kannan , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Rob Herring A fwnode link between specific supplier-consumer fwnodes can be added multiple times for multiple reasons. If that dependency doesn't exist, deleting the fwnode link once doesn't guarantee that it won't get created again. So, add FWLINK_FLAG_IGNORE flag to mark a fwnode link as one that needs to be completely ignored. Since a fwnode link's flags is an OR of all the flags passed to all the fwnode_link_add() calls to create that specific fwnode link, the FWLINK_FLAG_IGNORE flag is preserved and can be used to mark a fwnode link as on that need to be completely ignored until it is deleted. Signed-off-by: Saravana Kannan Acked-by: Rafael J. Wysocki Reviewed-by: Rob Herring --- drivers/base/core.c | 9 ++++++++- include/linux/fwnode.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index adeff041d472..fac017657d25 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1012,7 +1012,8 @@ static struct fwnode_handle *fwnode_links_check_suppliers( return NULL; list_for_each_entry(link, &fwnode->suppliers, c_hook) - if (!(link->flags & FWLINK_FLAG_CYCLE)) + if (!(link->flags & + (FWLINK_FLAG_CYCLE | FWLINK_FLAG_IGNORE))) return link->supplier; return NULL; @@ -1963,6 +1964,9 @@ static bool __fw_devlink_relax_cycles(struct device *con, } list_for_each_entry(link, &sup_handle->suppliers, c_hook) { + if (link->flags & FWLINK_FLAG_IGNORE) + continue; + if (__fw_devlink_relax_cycles(con, link->supplier)) { __fwnode_link_cycle(link); ret = true; @@ -2041,6 +2045,9 @@ static int fw_devlink_create_devlink(struct device *con, int ret = 0; u32 flags; + if (link->flags & FWLINK_FLAG_IGNORE) + return 0; + if (con->fwnode == link->consumer) flags = fw_devlink_get_flags(link->flags); else diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index c964749953e3..21699eee9641 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -53,8 +53,10 @@ struct fwnode_handle { * fwnode link flags * * CYCLE: The fwnode link is part of a cycle. Don't defer probe. + * IGNORE: Completely ignore this link, even during cycle detection. */ #define FWLINK_FLAG_CYCLE BIT(0) +#define FWLINK_FLAG_IGNORE BIT(1) struct fwnode_link { struct fwnode_handle *supplier; From patchwork Tue Mar 5 05:04:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 778073 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 E62B07D40A for ; Tue, 5 Mar 2024 05:05:12 +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=1709615114; cv=none; b=LwYpyUX+3R10MWkJL8XcrLsZ6drVmLc2dX/LJmNoa4kkZnAxyOzRU5+m5M437FElk4mbsHfbUAvwt3/waaw3qc5tXN0lh3GIAWxnaQ9xf7ryVWyVMefUM2nxnVAA/4dUpbGsrUhOApR2XpHm0CpaqoFejUbAccAFEW+HTIBkweg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709615114; c=relaxed/simple; bh=FgXbHdYbzu0zV1Fn+0Sm3Z2N29NaUTHdcJVRWQiFOe4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=QrGZUzsD8WO9p6YMtnKI2n0W0zr2Vux/WoppcnsIlnTaTUuJrH7SoC6MCoFoIv6PyVvVwdtMK1vJf9S3eGGaNqgc4ai6CzsZMSR0LK9StvmL9Z8NDSn60sWMiMdImv6WOrqAuKKlc/QNAWZLKE0K+MP1VjxoGsIuvg+oGIr5sv4= 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=y1FpB/Jy; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="y1FpB/Jy" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60966f363c1so77482487b3.3 for ; Mon, 04 Mar 2024 21:05:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709615112; x=1710219912; 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=2AK1RvhjBdB4hDhmPTNWoUxZx2sr2tNAM1/EjrC2JoM=; b=y1FpB/Jyx5C6fSs1Ap3r6/w8H9k3Y60pZNpsSMYvIHhyejogBqCcddbXL+JrFXK4jr LVGPWpQfaA9gk8QavlnbBmNOLdMXd4LKwFa+pdSqStD85Si0Y50hXqrLMdhAL5RG1K92 jUFHm95otGHqlWABF6YAX33/2QUJQfafQwseyAXK9xZWiYYzZ666Gut3dTBvV/pcQEdg QclDAB1zTRRbNCO/YzoHmyzYndCM+/wVLt/MgEMBoF/4GhWn3gbxXo3upofhlctmnmzK XfzdoWMyKEcjnnePfb6EOeXBpW5LsWbH1PGEFxin35vVIt/L1P/NaQrMxqkrDkCz4l95 hcoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709615112; x=1710219912; 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=2AK1RvhjBdB4hDhmPTNWoUxZx2sr2tNAM1/EjrC2JoM=; b=ptyzcVW7NvJbM66oFrcGBbPLT7I7bRuGdiq32DgFYlEu4Rf8CDZP2e611lytkd9rht 9YG1eUMEV5HBjN4GRJ6AC/gdpN0IWl5edC03a/uz52lLXdhRbhqrB3wRvtSEDbs7iHc2 vJ9v2G7B+aln260E8L/rE9UyoVrYZ/Cw/IpquWdFvnCKywYnMZ186MeeFpLoqnLfCAul 7Dd3+8nhLsKfK2CnoZgW/eHE9Xm4zS+NzUyeeV9exvtPS7x+qvj7btKn0SbWe/D86caf TI/agufp1WGxErPpYq4AtA+vgYhRKQjFausY4hrXM3qznjbBNyQykdWBoOr1yF34qaYK FxfA== X-Forwarded-Encrypted: i=1; AJvYcCVE+cANNG4f/PEt5e9BcmFyTKtynv1jJkT0D01UR/UPTypRWgR4ZvfkPWBP3+VIW+0QNdPRSER1JfDbwMrVbMq3YJs6JFciO5V+jw== X-Gm-Message-State: AOJu0YyDY3J3XetbtAOMD27l6xP15W/N3EbSyxbz5oftt9bksewOtaFw 4VXKvhhHLBJhit8NIBwp/ro4E4TaYSpQq7M9QamBSVFYwT+lMEyojkC7xu9bM5SaTH/sMD/nxDV LENyFygJQt7a9Jg== X-Google-Smtp-Source: AGHT+IH2KzRd8ijTXs0JYOCur+G/X47aFWeD6zQZ4dffImANFZRDeEhSxZMnhoOcs3UOxIj6Er5VZdNgNg1tQNM= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:d64:6ee3:55a9:46e6]) (user=saravanak job=sendgmr) by 2002:a05:690c:c9d:b0:607:cd11:5464 with SMTP id cm29-20020a05690c0c9d00b00607cd115464mr3058844ywb.9.1709615112162; Mon, 04 Mar 2024 21:05:12 -0800 (PST) Date: Mon, 4 Mar 2024 21:04:56 -0800 In-Reply-To: <20240305050458.1400667-1-saravanak@google.com> Message-Id: <20240305050458.1400667-4-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240305050458.1400667-1-saravanak@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v5 3/3] of: property: fw_devlink: Add support for "post-init-providers" property From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Ard Biesheuvel , Rob Herring , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown Cc: Saravana Kannan , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Rob Herring Add support for this property so that dependency cycles can be broken and fw_devlink can do better probe/suspend/resume ordering between devices in a dependency cycle. Signed-off-by: Saravana Kannan Acked-by: Rafael J. Wysocki Reviewed-by: Rob Herring --- drivers/of/property.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index bce849f21ae2..b517a92dabca 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1066,7 +1066,8 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, } static void of_link_to_phandle(struct device_node *con_np, - struct device_node *sup_np) + struct device_node *sup_np, + u8 flags) { struct device_node *tmp_np = of_node_get(sup_np); @@ -1085,7 +1086,7 @@ static void of_link_to_phandle(struct device_node *con_np, tmp_np = of_get_next_parent(tmp_np); } - fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), 0); + fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np), flags); } /** @@ -1198,6 +1199,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ * 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 + * @fwlink_flags: Optional fwnode link flags to use when creating a fwnode link + * for this property. * * Returns: * parse_prop() return values are @@ -1210,6 +1213,7 @@ struct supplier_bindings { const char *prop_name, int index); struct device_node *(*get_con_dev)(struct device_node *np); bool optional; + u8 fwlink_flags; }; DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") @@ -1240,6 +1244,7 @@ DEFINE_SIMPLE_PROP(leds, "leds", NULL) DEFINE_SIMPLE_PROP(backlight, "backlight", NULL) DEFINE_SIMPLE_PROP(panel, "panel", NULL) DEFINE_SIMPLE_PROP(msi_parent, "msi-parent", "#msi-cells") +DEFINE_SIMPLE_PROP(post_init_providers, "post-init-providers", NULL) DEFINE_SUFFIX_PROP(regulators, "-supply", NULL) DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells") @@ -1349,6 +1354,10 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, + { + .parse_prop = parse_post_init_providers, + .fwlink_flags = FWLINK_FLAG_IGNORE, + }, {} }; @@ -1393,7 +1402,7 @@ static int of_link_property(struct device_node *con_np, const char *prop_name) : of_node_get(con_np); matched = true; i++; - of_link_to_phandle(con_dev_np, phandle); + of_link_to_phandle(con_dev_np, phandle, s->fwlink_flags); of_node_put(phandle); of_node_put(con_dev_np); }