Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp622710lqh; Thu, 28 Mar 2024 11:09:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXstIyqXMFyk2uu5YlTc1TYwobkmnQoWHScu7cK44EnOx62RhVJ0FFk5iKCw4xDeyQ2Pk2kdjALTq8LdroOqA6FAyhzUXvVv3s1Pu1/Pg== X-Google-Smtp-Source: AGHT+IGQPfbxBq8dEqUgHr1Zy96XNkTCgSp3Cl0gDvQf3r7hAZ7GLf97LmYVP0E7717rBgJbEMsH X-Received: by 2002:a05:620a:371b:b0:78b:befc:4c2c with SMTP id de27-20020a05620a371b00b0078bbefc4c2cmr223051qkb.58.1711649395023; Thu, 28 Mar 2024 11:09:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711649395; cv=pass; d=google.com; s=arc-20160816; b=yVTQ/GhWBtiHpNYlD3hVVmvVrfaoDNw/R9F6+Ftsi8bOfLN8fZgGdVrBixIJU6NLKf wMpzQxqpu/zeCd8ENyGWErV86Bm3VP3dC50kRj86SU1mZJTCZ9ywRBgYMa01ZWm9t9gB f3pumlPPi/YtfU5YccgiBzCUUkOHkTgDu4loGkC3EVaLksfqcDkUMWi/Dxuru17saS2R Of2GkIQOLjgrc964AOlgnfxcMMDdH7KGvWuTn9ezmtjJnfaPoYevp46K2MEAtjiEU+Fx HmOs90aO1LdEW2tWjpBel/xTBKEGvpU6opliZQK1sKIPiuRlnhYQzggInJBCtFzfjgzA 3dgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=ncPmgRb4JozDLkLHWPdlUkt/kOwp87y0kDtIWs+mXEA=; fh=OfBpGDNmLWfGid5cfyDOjgqXsZrTCQrTH01jo3xstBw=; b=LBqohDX6wCxhYW3MNzL5DR0nmy6Fxj4b8ya3MsefNav3xXXgu1AtpoPqzXIqNruRHX ft1mqAL56E48NVRRfyXCtzAu8IICzg3QOImy3HTNkVdQXMpy3u3whd7Qfy6ET2l6UAqg FoUJQWxGN62ung1Kw6007wY2AzoJ84PO6kh1SxM6kcb3XjJdkI+A9B7zTzt+er2fQJf/ 5johpPROJiud0a6NlX84kxcwDqHcU9x6Edj7HqmxBPZ84/fv5GKucVgLwKhrqf02W7uc zNKUWH5scni7dh4VbVACOuMAVHlrPghZUGJwmoXomHXl+Y4SMzkUZY2coQe+04ZIbctj yVwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VSQmZLzN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123400-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123400-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ou39-20020a05620a622700b00789f691a17bsi1911629qkn.12.2024.03.28.11.09.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 11:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123400-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VSQmZLzN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-123400-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123400-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BDC4F1C268EF for ; Thu, 28 Mar 2024 18:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4594F1327E4; Thu, 28 Mar 2024 18:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VSQmZLzN" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63EA712F38B; Thu, 28 Mar 2024 18:09:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711649382; cv=none; b=Wk7Nfm8uf3upeOiivZXJDNaX4XZyUJhRNYZlSIuSFH842KV23ymwaj3mcmyCtXTA7KjyKykqU7bRSqG8uYik8DlVIVDGWLHGgHzkk05bDCW80jusB1iPrmnLkNRKtjOp5e39+epraritoQ631dGIzriC/4iQeyVy5rVihqdKoTA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711649382; c=relaxed/simple; bh=He0L7am/V5CNl3ns9fu9G7ieIRAiLhmsEOwrMaSCWFo=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=lhzol7vvuB9y8Ozet7QYN3S/RtkZPVV0cQQKs7NTi/h8AvLMk5eetpiraKXOYmPtzVE+XoIfDlVG+gF1PEH60gXZtXO6dRvPYt4B5i4cxU4IQnBHHuIDfq/CdZI9T/5L5TyCjwQHp0VCVUNVyOmopBYQYc861U8Kfio7y4K5n8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VSQmZLzN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EC21C433C7; Thu, 28 Mar 2024 18:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711649381; bh=He0L7am/V5CNl3ns9fu9G7ieIRAiLhmsEOwrMaSCWFo=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=VSQmZLzN3F4Id6PkBByDxRYNwwmIAroujPN5YkCElzd/mjXqvezyVpjkeRliiYSCW EJLp7TuXhHEmBTAKBNJu1B9IUjKnEC+85kL4hSc0r8m2CAo1/G/Sz1oaylVAIsco+y MXE+kom41uvsAFX4q9OOIaEyyYyWWYZyOlgPekP4mrpsMhx/NmIJcw3+n+509pYJMn 2fVkvEbiqwg0Z8Tn5UxmR6kgwXMiIIy4OFhAMU3BvPy7+ibQvQhjtRUsHYu8HZ2ULz 6SBGwKNGO0yeWeQSVqE7IIGT/rJNyd42pE14ztptszfNeF09E5rM2q6/GPk9Oq1qbG siXvNn7gagnXA== Date: Thu, 28 Mar 2024 13:09:40 -0500 From: Bjorn Helgaas To: Konrad Dybcio Cc: Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marijn Suijten , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: Re: [PATCH v2] PCI: dwc: Use the correct sleep function in wait_for_link Message-ID: <20240328180940.GA1575046@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240215-topic-pci_sleep-v2-1-79334884546b@linaro.org> On Wed, Mar 27, 2024 at 07:24:49PM +0100, Konrad Dybcio wrote: > According to [1], msleep should be used for large sleeps, such as the > 100-ish ms one in this function. Comply with the guide and use it. > > [1] https://www.kernel.org/doc/Documentation/timers/timers-howto.txt > > Signed-off-by: Konrad Dybcio Thanks for fixing this up! No need to repost, but whoever applies this, please update the subject to be more specific: s/the correct sleep function/msleep()/ s/wait_for_link/dw_pcie_wait_for_link()/ Also update the doc link to something like this since timers-howto.txt no longer exists, and even timers-howto might be renamed or moved in the future: https://docs.kernel.org/6.8/timers/timers-howto.html > --- > Tested on Qualcomm SC8280XP CRD > --- > Changes in v2: > - Rename the define > - Sleep for 90ms (the lower boundary) instead of 100 > - Link to v1: https://lore.kernel.org/r/20240215-topic-pci_sleep-v1-1-7ac79ac9739a@linaro.org > --- > drivers/pci/controller/dwc/pcie-designware.c | 2 +- > drivers/pci/controller/dwc/pcie-designware.h | 3 +-- > 2 files changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index 250cf7f40b85..62915e4b2ebd 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -655,7 +655,7 @@ int dw_pcie_wait_for_link(struct dw_pcie *pci) > if (dw_pcie_link_up(pci)) > break; > > - usleep_range(LINK_WAIT_USLEEP_MIN, LINK_WAIT_USLEEP_MAX); > + msleep(LINK_WAIT_SLEEP_MS); > } > > if (retries >= LINK_WAIT_MAX_RETRIES) { > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index 26dae4837462..b17e8ff54f55 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -63,8 +63,7 @@ > > /* Parameters for the waiting for link up routine */ > #define LINK_WAIT_MAX_RETRIES 10 > -#define LINK_WAIT_USLEEP_MIN 90000 > -#define LINK_WAIT_USLEEP_MAX 100000 > +#define LINK_WAIT_SLEEP_MS 90 > > /* Parameters for the waiting for iATU enabled routine */ > #define LINK_WAIT_MAX_IATU_RETRIES 5 > > --- > base-commit: 26074e1be23143b2388cacb36166766c235feb7c > change-id: 20240215-topic-pci_sleep-368108a1fb6f > > Best regards, > -- > Konrad Dybcio >