From patchwork Thu Feb 20 05:04:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 183655 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp141055ile; Wed, 19 Feb 2020 21:05:10 -0800 (PST) X-Received: by 2002:a17:902:9b8b:: with SMTP id y11mr30415984plp.189.1582175110282; Wed, 19 Feb 2020 21:05:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582175110; cv=none; d=google.com; s=arc-20160816; b=Dyu3CpCyhXlMNVlv7U8ThTK1+MHV1xs2PO+fWbWASK7RyCkz7n6hye3lQtqcqvo+bn UJzjOcp1D/KtqNpTbvygX0+7RZezaX28Ch6bIOVu+dIJRmc9xdjON13D8+h/ZB3upJRE e4Cva0pYdb6Uf2Fb9H/79VyM6GFLrN053hcuLgSf2WcwWR1OcWpwh12GnyY+GAenbtK3 80o+QHdezpE7cRcWZAnviYdPIVsV4l4moBsf5B196Nn9Nck0L6EX1AScpl0TfHX4EbF5 MIbm+d/ClLHwrGbsSKiEVSkBy7CIKnlMbu/h4Om6SOTV5TFwmWgf0RMuwBW9I1npLHDu QXCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=BoWCoZRXomba4V/GQ9rnU2KelGn6IYNx6JgAzy0cALQPsZlAulNwv50DnPVoyK57C2 C/FlYXlwNSahlgndPO8maIzLVQZ/NqIEDJz/5VTOezZgj5Nwzr1it1ttNX37OFMRsHmM H8h04T/pcRwOaW9kNZ7PImta3+IZuUWgFxk9QsdUI9UsHqfZif4NZ2Fv2MYN8qHMZ1sc i2cER9wa/amf+lFZ+B0XM3hF9GG2NEm1xWZvMDvevRmyKcapDUbXPapincwTOMaq497f T+czd8QLHuSKuc+urg+v7IO28hak8bx9OpGXmb4zwW8YOz8qIQnttK4evTLgFzijq7aG XpdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KWtAXqoH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id u2sor1914514pgp.75.2020.02.19.21.05.10 for (Google Transport Security); Wed, 19 Feb 2020 21:05:10 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KWtAXqoH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=KWtAXqoH66/xVX33DhMaKTUdGX6Uf98AbL57ah+k6dEdauNQwApvPnNPHUiivq6Jdi 49xLg0mTm79BVYHbdcVGHKDyfCI7Yt8YhnlXGJHea2d2Y16+X+iCM76wvPNmXrV4dhfb KKtxMQCoagp0X+c11lVO9afWRHTd6fPbsvUjdhWnY6dEPBMgam5bDsEJ0yD01A23gyxO XyvFyW3dEfa9OwDK55NIUQRusiahMNtBIZGwbpxIjB1xAdamE56cpYEcFU/u6PxFnaWt V6wbP8AjfqY2Y56H4t559cVNwx9C1p0h6Vw2CRmcPmowj7AN8PIhT+73joESZcCRHPmP 3dBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=eKe5+T65PSqkFDSf54w1+M7HIg+kIpDNWFq1KBJhJBcxhGREuE+z9iIEhwnV+L9UKW ZajCVMQDJSPrEQYpa5M7hy7SpNAZLLru7Fs+LPgT205VJf/r+JQyenL03EsLKxqSn3G9 8I0F1jDyrtoVOb89bdduEGEgvuCm1v/noJLgIdQap/Y6AJOc2GsDQfJM2GsbS3gozhqN rtesZ/IlKPuQn4aWA7OKYp+0hkPVoE67xiWSPn2hoiPqw9zdc3fdpU023zTA4shUE9g3 3M3n6lrv83yo207Cot9yQxoBwbq/MKGOPh/XExPmWOFuLA0DVuxYUSoQsPNGY6DOC/II gmOQ== X-Gm-Message-State: APjAAAVQi0PG5r8xLdIp390Po5FzyH5mi5WVdEF2vxLV+1dQU3t6RkHl l3Xe+ji1JoKHKdnwpwkaGZLk/i7/ X-Google-Smtp-Source: APXvYqxtOMEIAg/0vMNdo4l2g1zhUCi8GqsKzxUcztilwfCWBSoXPh54dpJIreh60u0UmWS9iVnVSQ== X-Received: by 2002:a63:fc51:: with SMTP id r17mr31212077pgk.292.1582175109855; Wed, 19 Feb 2020 21:05:09 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:09 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 5/6] driver core: Rename deferred_probe_timeout and make it global Date: Thu, 20 Feb 2020 05:04:39 +0000 Message-Id: <20200220050440.45878-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> Since other subsystems (like regulator) have similar arbitrary timeouts for how long they try to resolve driver dependencies, rename deferred_probe_timeout to driver_deferred_probe_timeout and set it as global, so it can be shared. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz Change-Id: I92ee3b392004ecc9217c5337b54eda48c2d7f3ee --- v4: * Split out into its own patch as suggested by Mark * Renamed deferred_probe_timeout as suggested by Greg --- drivers/base/dd.c | 18 ++++++++++-------- include/linux/device/driver.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 408e4da081da..39f1ce6d4f1c 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -229,17 +229,19 @@ DEFINE_SHOW_ATTRIBUTE(deferred_devs); * In the case of modules, set the default probe timeout to * 30 seconds to give userland some time to load needed modules */ -static int deferred_probe_timeout = 30; +int driver_deferred_probe_timeout = 30; #else /* In the case of !modules, no probe timeout needed */ -static int deferred_probe_timeout = -1; +int driver_deferred_probe_timeout = -1; #endif +EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); + static int __init deferred_probe_timeout_setup(char *str) { int timeout; if (!kstrtoint(str, 10, &timeout)) - deferred_probe_timeout = timeout; + driver_deferred_probe_timeout = timeout; return 1; } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); @@ -259,10 +261,10 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); */ int driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done || deferred_probe_timeout > 0) + if (!initcalls_done || driver_deferred_probe_timeout > 0) return -EPROBE_DEFER; - if (!deferred_probe_timeout) { + if (!driver_deferred_probe_timeout) { dev_WARN(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } @@ -276,7 +278,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) { struct device_private *private, *p; - deferred_probe_timeout = 0; + driver_deferred_probe_timeout = 0; driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); @@ -310,9 +312,9 @@ static int deferred_probe_initcall(void) driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); - if (deferred_probe_timeout > 0) { + if (driver_deferred_probe_timeout > 0) { schedule_delayed_work(&deferred_probe_timeout_work, - deferred_probe_timeout * HZ); + driver_deferred_probe_timeout * HZ); } return 0; } diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 5242afabfaba..ee7ba5b5417e 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -236,6 +236,7 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) } #endif +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);