Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp528878imn; Wed, 27 Jul 2022 12:43:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tLk09uqlLlXMDensVQsWjLjjgY436LL6cRc6d4uU3LuqScySU0kmdkYNd+cJvPgGYcH2Ic X-Received: by 2002:a17:907:980d:b0:72f:2cf2:9aff with SMTP id ji13-20020a170907980d00b0072f2cf29affmr18586756ejc.165.1658950999272; Wed, 27 Jul 2022 12:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658950999; cv=none; d=google.com; s=arc-20160816; b=B0FyoiWhtCzLYZQqY2LVohZ6dYZN3swxdhce9rIKnLCINyq0JvkFVPYHzayV5wO5Tn dOJ8/KfqrcepAF3aUd0b6bjgoKUTfg8iDC4tyr41HObgTmzUQTA8rDZxGapipWQRgidp glHJDPxOKDIiccfIhHyeQoWwRroGKY0IY/RZmsLroyWdnnLooNvMl11WTEoidapA7WFW phim6ubKX5W29N07JPJQsTap3YoaDLrAZOWv5pMWthHJNqB9R8V0eWN3CzhTulQSwmUw YbvLlBx+5OexnFwKqih92orMX2q7B9lFcToKTLqw0l1TuiJMv/Vq8T6l/QIyJeub1iZt h83Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=6PMRC4+7ETZ6O5YvP3kBSLPeIUc34qIh1gO+2nFmWRo=; b=D8nkML/osLtlphk613EaHBIXyBHzRd0fYtlQxEpUbUJ57cBigYKxFcPoOYjNnpXnoB M+Fy8DmmeIbsISYZFFdsNDVZxFfiFt7si4EjoZmQYUXa/aPNt2G1BT4DpEwnuu0GX5tM 67SzRaNJ9ETvnDGSG8I/l+5epT5DbmcfaihWxCVN/PzqIntnh8qt2om+NzoZiOjrTX64 jkBih5JoaDdkzxaI7lrLpw1PC+UyCRY9swz6pfCrmyAzddft+9aC7bZu5ATbR1qLvcB5 qNnZodYaXBbzH7pTOVtSJrK11/c3ssdU1YsJDIUivqdkR208St2F7RwZqc8n46YX/y44 4gPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=STPIcS3r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a170906941600b0071576eb9e6bsi16019991ejx.211.2022.07.27.12.42.54; Wed, 27 Jul 2022 12:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=STPIcS3r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236121AbiG0TJv (ORCPT + 99 others); Wed, 27 Jul 2022 15:09:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236700AbiG0TJQ (ORCPT ); Wed, 27 Jul 2022 15:09:16 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CEE361B3D for ; Wed, 27 Jul 2022 11:50:22 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-31f49eea05fso43503677b3.15 for ; Wed, 27 Jul 2022 11:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=6PMRC4+7ETZ6O5YvP3kBSLPeIUc34qIh1gO+2nFmWRo=; b=STPIcS3r2zaNxA7E/SkB84p7lfSdY7kdH/9tNvpaMzSSN00NwQMg3GYOWYlnYHebEw dMGQ1J91PpKVadenfIq5DclEZf4jsu47mwqHouONe7IY3flpoZWcwtOuipCkUgIuZhit d9tl/VwTZN/CWPNwrUx1oVGm8T+biHUfabWMcje4C0ng/f+uTVzgzBY+P6pNDRHyky9K kqzdmm5tt3M6Tp+rfLhRO5SQbGfAr/n/qnU0fenyBvchdXCGJUm/TymA34EiXmuTozO3 e3oiIP1EfCw1k4mCbjWkHYNKvdurnAKnXrpUFX1+Ch77LTzGUqubaU9RSw6tzBsHMZDr S5sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=6PMRC4+7ETZ6O5YvP3kBSLPeIUc34qIh1gO+2nFmWRo=; b=7zHT0XTycLm52LCGkYCDiTp9NnYxjPsXzglbJw7WuE3iwXc2OR5g9gdiKK2yrSVZ4C hnDvxGPDVqYNiY4Zxq11aMp2givZbB5PSlnuqWa19hPIMQUcZlkqFDN5EBPBrQxgz6g7 L76bddxqmOd6iyclrQdh+b/WP+cufUfbPsjXAtDJigGBSNWoIQ2a846ubt8xQ6hFN0lT wCPZKOPB0PETws2e0G/ctIiy5/cehlKc6/F7WLNDR14hv5nj11invKnqe57DBgJeRuaj pbB9gq/ZNbChM+6I6H7OCOfWO/0/sBuzhUw8vOcf7BdCPkomvvUo6mIyZQ7ojIBXJwxh XRLw== X-Gm-Message-State: AJIora+l60h363n0wK+Ks2mp2c1kpIXCyg03mf5xeQlN9RJ4p6055Gq3 lDQAMOSrU75mI4kbZbBqTkPRp31eXpuAhuw= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:40ee:bae0:a4fd:c75b]) (user=saravanak job=sendgmr) by 2002:a25:d4a:0:b0:671:6d11:d14e with SMTP id 71-20020a250d4a000000b006716d11d14emr9175171ybn.479.1658947821364; Wed, 27 Jul 2022 11:50:21 -0700 (PDT) Date: Wed, 27 Jul 2022 11:50:09 -0700 In-Reply-To: <20220727185012.3255200-1-saravanak@google.com> Message-Id: <20220727185012.3255200-2-saravanak@google.com> Mime-Version: 1.0 References: <20220727185012.3255200-1-saravanak@google.com> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog Subject: [PATCH v1 1/3] Revert "driver core: Delete driver_deferred_probe_check_state()" From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Saravana Kannan , naresh.kamboju@linaro.org, kernel-team@android.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 9cbffc7a59561be950ecc675d19a3d2b45202b2b. There are a few more issues to fix that have been reported in the thread for the original series [1]. We'll need to fix those before this will work. So, revert it for now. [1] - https://lore.kernel.org/lkml/20220601070707.3946847-1-saravanak@google.com/ Signed-off-by: Saravana Kannan --- drivers/base/dd.c | 30 ++++++++++++++++++++++++++++++ include/linux/device/driver.h | 1 + 2 files changed, 31 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 70f79fc71539..a8916d1bfdcb 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -274,12 +274,42 @@ static int __init deferred_probe_timeout_setup(char *str) } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); +/** + * driver_deferred_probe_check_state() - Check deferred probe state + * @dev: device to check + * + * Return: + * * -ENODEV if initcalls have completed and modules are disabled. + * * -ETIMEDOUT if the deferred probe timeout was set and has expired + * and modules are enabled. + * * -EPROBE_DEFER in other cases. + * + * Drivers or subsystems can opt-in to calling this function instead of directly + * returning -EPROBE_DEFER. + */ +int driver_deferred_probe_check_state(struct device *dev) +{ + if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) { + dev_warn(dev, "ignoring dependency for device, assuming no driver\n"); + return -ENODEV; + } + + if (!driver_deferred_probe_timeout && initcalls_done) { + dev_warn(dev, "deferred probe timeout, ignoring dependency\n"); + return -ETIMEDOUT; + } + + return -EPROBE_DEFER; +} +EXPORT_SYMBOL_GPL(driver_deferred_probe_check_state); + static void deferred_probe_timeout_work_func(struct work_struct *work) { struct device_private *p; fw_devlink_drivers_done(); + driver_deferred_probe_timeout = 0; driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 7acaabde5396..2114d65b862f 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -242,6 +242,7 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) extern int driver_deferred_probe_timeout; void driver_deferred_probe_add(struct device *dev); +int driver_deferred_probe_check_state(struct device *dev); void driver_init(void); /** -- 2.37.1.359.gd136c6c3e2-goog