Received: by 2002:ab3:689a:0:b0:1da:d01c:d2b2 with SMTP id t26csp5328ltj; Fri, 19 Aug 2022 15:57:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR42mPvCAzsWAFKoypXvhbo9TAvu8slQwZ1nnQYdKjb2ohrVPu3gHJ1VgYy2MbDba25QZRhQ X-Received: by 2002:a17:907:3e28:b0:731:7ee0:add5 with SMTP id hp40-20020a1709073e2800b007317ee0add5mr6240688ejc.215.1660949856499; Fri, 19 Aug 2022 15:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660949856; cv=none; d=google.com; s=arc-20160816; b=0XBduxzQGhtCFb/z+up3fs10TXMPdba9jRJ0rKRF7iMRPdjYhTRcjZnA/FD129YGGb ageStessXJi1jeY29OiKKosEIUR6crDVtIQOIQE23qbc1aTI3xRR7XEsbShv5/al2mR6 /6IZY4uQRc8P643mk9wuqo5k3pKoweAAcmV8bnEnmGe0oyFHmpGk9TbkdyySe/fZgUa4 x4Y1IWWm+Vrraofqsv5iR8gx8AJMkEHlU+RDZUICYHrM8X4dNEVAsUAozz4hVeifIHXf vuaT6ed/3Q/X6GZvAvcEcezkDlz80lMUfkVEFKyd1/ozRV8UKqqZWdeymn6lyZVNf1L+ 89yA== 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=BQSSVea5wmDrGG7Dc55xjQCbKa6Vwa11xoA5juoPq98=; b=ZDySQsPiP4g2nzJbiKhkcgJjXPbRGGooUgK9FJxIkP8iQlnZtTQcdUSZBwOkuI9p83 KvqsWKy1dMq/GOQ9txvKsiNFp3dNG0V8piEcUxijfzmvXaflxWCWZTpTNGXEmtdSSXhM lFc1VoXzjWJlhSEgz1dH2FMCaqPbCIiN9P1/jiBRtmy72SdRfBhdD5+G9QUFMbNor/iS JcQeAMgHc4A5gwJ7VYXGz5YBXjMVg9dnJemNehlZdK+S4QfDvqKLJ1w32KxKXA7gepPb NdkTDqHsSJ2QSH14Ae09WpBcXUfsVP8n6aP4hA0ADN6jt70XT6oonx17u23P1Bpr6y8P jXEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="m/w4VOnW"; 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 sa18-20020a1709076d1200b0073bf04b426esi3915892ejc.246.2022.08.19.15.57.01; Fri, 19 Aug 2022 15:57:36 -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="m/w4VOnW"; 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 S232719AbiHSWQe (ORCPT + 99 others); Fri, 19 Aug 2022 18:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239693AbiHSWQZ (ORCPT ); Fri, 19 Aug 2022 18:16:25 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24533BE4EE for ; Fri, 19 Aug 2022 15:16:23 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id rj3-20020a17090b3e8300b001fae0be4dc4so2188390pjb.7 for ; Fri, 19 Aug 2022 15:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=BQSSVea5wmDrGG7Dc55xjQCbKa6Vwa11xoA5juoPq98=; b=m/w4VOnW+B6hFTGwigf+fYXoDEJW13olaVPFGBtgeL1hEtlqKKVCxTfQ9m5XcRiaIP 1rU1aOfA4hVzZN4ktFIgo02PwC457k0BiPqJAjQdBCLECZTjC3N0U+rJNb1RA5Xy5rB1 SRMGYHo9B4A05CZ4wmE6tAPMFVNFuEkTFRv9ORDih1ztXI17gefsQR8Hp4GMgh0/dFjI 45riHlDzcS/a1UF2P4EZRRNUrkaYCrC6DCKrVYRPbqbCEsuAoKVcYY5ez6bS/f6tgOoY DW8w+AJN+ksKbDtbDBbKnGOuwE6Vk9iibf6y0FMmZflAss8jby5psI/la1+FUIZ/hAMi gf/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=BQSSVea5wmDrGG7Dc55xjQCbKa6Vwa11xoA5juoPq98=; b=YQzOHeudyzxYTPQ5pkGvSxUjBP4YgfGqXkbJ2hsYpMq3GYr3bCtLaFw3WdjzRKntt/ uOb7iUn2OqCjmZ6onYjfQqR33k5u1AGiYinhCaP2AzQBkpEOyJXfAGZwqJaYvWmbeLdK edyudtoIJtnp8hOORwgPhJ3+VP9vZbAmV7/35C/x8OhaMMAv34XUHTjRURZoTuREkfjF aZKsJSv9F3N51M1rXPwaKBpsf2Ppj0DeaVwAz0wjkesxE3Lf1iojKk7PtGZYOOJ7FRHL hNxwUPqtam2Cav8bey0vnA7DMrlDbJPf36TokRwqg/267334IQlhgVef3GFm9QNYJGRx 8+GQ== X-Gm-Message-State: ACgBeo3EceipUpX/pFB6pIuoRu7VokBBFOPT6ECjEaX0SwBWqST8TjhH hV7zTuG9jIMQ45C35AgMFsFlZAfuTdObg4Q= X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:f93e:7b61:ce3d:5b06]) (user=saravanak job=sendgmr) by 2002:a17:902:720c:b0:172:a1ff:8c21 with SMTP id ba12-20020a170902720c00b00172a1ff8c21mr9292292plb.159.1660947382648; Fri, 19 Aug 2022 15:16:22 -0700 (PDT) Date: Fri, 19 Aug 2022 15:16:11 -0700 In-Reply-To: <20220819221616.2107893-1-saravanak@google.com> Message-Id: <20220819221616.2107893-2-saravanak@google.com> Mime-Version: 1.0 References: <20220819221616.2107893-1-saravanak@google.com> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog Subject: [PATCH v2 1/4] 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 , Joerg Roedel , Will Deacon , Robin Murphy , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Saravana Kannan Cc: Peng Fan , Luca Weiss , Doug Anderson , Colin Foster , Tony Lindgren , Alexander Stein , Naresh Kamboju , Geert Uytterhoeven , Jean-Philippe Brucker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, iommu@lists.linux.dev, 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,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=unavailable 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/ Fixes: 9cbffc7a5956 ("driver core: Delete driver_deferred_probe_check_state()") Reviewed-by: Tony Lindgren Tested-by: Tony Lindgren 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.595.g718a3a8f04-goog