From patchwork Wed Nov 4 23:23:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 317984 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=-20.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 26A75C4741F for ; Wed, 4 Nov 2020 23:25:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0F6320825 for ; Wed, 4 Nov 2020 23:25:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tUt9OmDw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733053AbgKDXZ1 (ORCPT ); Wed, 4 Nov 2020 18:25:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732978AbgKDXY3 (ORCPT ); Wed, 4 Nov 2020 18:24: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 29358C0613CF for ; Wed, 4 Nov 2020 15:24:28 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id l23so365941ybl.23 for ; Wed, 04 Nov 2020 15:24:28 -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=eEB1sRKmOhyKT2s+qdOFoinbYDGAwcO7NeYhfFMxg+Q=; b=tUt9OmDwJhcPPhrZNj/nqogKhaEd+90/qdGhb2nTA+Yz2dfpD3noSnHhMam2QzHPjo 9qQ5kwHjM9vLUYpIr7v/CJdtGPmYJF1F9ydUaH4foaY72lus5HdCCq1ZIuU/mN1WiLQY Rrmabtm+iFFUQLIHiC/CR8s53IYF8R3pqCP65NUS7O7coMjWE4Gi0OUhK1LawZAYrjAr LNWhrQdANyVNdGRQ4+lXoU03/4t+zBhZkSb9LJtFWyQ2RjmF6L74Et5xHuwPRcJOMP1Z rv3lHcS4gvr/Tmn8+aT/QZWr3/8fKJeA+W5S/l+iPmK7Q6tS1+T/ImK9dzpcjai2Eamh ZJAQ== 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=eEB1sRKmOhyKT2s+qdOFoinbYDGAwcO7NeYhfFMxg+Q=; b=IzclIvUOXm23PWRcpQAS+xZEhgTB40B8fc1G38Oi+GUCK5httZdrj+IPH8QCYdofFZ eottRbJLYea+FPPvn6nCkNQtxaS3HJV4o/y7N5aVjoC+SaQeX02016dbeSnT+Qyk2JxT lhtx8LDQfVGzFh4d8e6GRvZFE6F7hVnqcKtDDUaVMHvTqQPzNSjDjw5YCwL6PNrVfQAN PLsQt2s7SudRyer2muUDDbAIeZTh9xFjcVIZTiVn100QkRpo5Oitd/N9VKX4o3m5xOMe JdZsqRb6DXAXSMTiwaCQcu44wlnC3lQCUr8eDB2PfcIwNRFA9tMIqTDQ1/4NP8fdQkWL +X+Q== X-Gm-Message-State: AOAM532U+SgjJYfpA7cLytYQxTUAPju9arUpWYvfZVgKrlX77TH3X8+e 6I7Ya8iMBZZLv2976j158VoMzt5MRm1By0A= X-Google-Smtp-Source: ABdhPJyWG5sGSzNmiRsHspbl4ooUVxIy7YNp80HOw5IVvMiRQ3hDfPGnRagU2OxiQKt1apMgzfktCFp+7Ba3Uuo= 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:a25:b792:: with SMTP id n18mr294244ybh.93.1604532267406; Wed, 04 Nov 2020 15:24:27 -0800 (PST) Date: Wed, 4 Nov 2020 15:23:48 -0800 In-Reply-To: <20201104232356.4038506-1-saravanak@google.com> Message-Id: <20201104232356.4038506-12-saravanak@google.com> Mime-Version: 1.0 References: <20201104232356.4038506-1-saravanak@google.com> X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v1 11/18] driver core: Redefine the meaning of fwnode_operations.add_links() From: Saravana Kannan To: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Ard Biesheuvel , Rob Herring , Frank Rowand , Marc Zyngier , Thomas Gleixner Cc: Saravana Kannan , Tomi Valkeinen , Laurent Pinchart , Grygorii Strashko , kernel-team@android.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, devicetree@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Change the meaning of fwnode_operations.add_links() to just create fwnode links by parsing the properties of a given fwnode. This patch doesn't actually make any code changes. To keeps things more digestable, the actual functional changes come in later patches in this series. Signed-off-by: Saravana Kannan --- include/linux/fwnode.h | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index afde643f37a2..ec02e1e939cc 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -78,44 +78,8 @@ struct fwnode_reference_args { * endpoint node. * @graph_get_port_parent: Return the parent node of a port node. * @graph_parse_endpoint: Parse endpoint for port and endpoint id. - * @add_links: Called after the device corresponding to the fwnode is added - * using device_add(). The function is expected to create device - * links to all the suppliers of the device that are available at - * the time this function is called. The function must NOT stop - * at the first failed device link if other unlinked supplier - * devices are present in the system. This is necessary for the - * driver/bus sync_state() callbacks to work correctly. - * - * For example, say Device-C depends on suppliers Device-S1 and - * Device-S2 and the dependency is listed in that order in the - * firmware. Say, S1 gets populated from the firmware after - * late_initcall_sync(). Say S2 is populated and probed way - * before that in device_initcall(). When C is populated, if this - * add_links() function doesn't continue past a "failed linking to - * S1" and continue linking C to S2, then S2 will get a - * sync_state() callback before C is probed. This is because from - * the perspective of S2, C was never a consumer when its - * sync_state() evaluation is done. To avoid this, the add_links() - * function has to go through all available suppliers of the - * device (that corresponds to this fwnode) and link to them - * before returning. - * - * If some suppliers are not yet available (indicated by an error - * return value), this function will be called again when other - * devices are added to allow creating device links to any newly - * available suppliers. - * - * Return 0 if device links have been successfully created to all - * the known suppliers of this device or if the supplier - * information is not known. - * - * Return -ENODEV if the suppliers needed for probing this device - * have not been registered yet (because device links can only be - * created to devices registered with the driver core). - * - * Return -EAGAIN if some of the suppliers of this device have not - * been registered yet, but none of those suppliers are necessary - * for probing the device. + * @add_links: Create fwnode links to all the suppliers of the fwnode. Return + * zero on success, a negative error code otherwise. */ struct fwnode_operations { struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); @@ -155,7 +119,7 @@ struct fwnode_operations { (*graph_get_port_parent)(struct fwnode_handle *fwnode); int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode, struct fwnode_endpoint *endpoint); - int (*add_links)(const struct fwnode_handle *fwnode, + int (*add_links)(struct fwnode_handle *fwnode, struct device *dev); };