Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp614335rdb; Thu, 15 Feb 2024 09:48:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbUf1t+XHrGW9hl+oY1ljIBGTDMB3tHUUXf3DmCYsdU7mZJw3gEjC5BpbmCBdJPxot//iySNfgVS4v5DQ9WNvB+3I1BfiaYIjb1xeVEA== X-Google-Smtp-Source: AGHT+IHSDQv5PuyAHY5BeaUJftUnC1QWxwsyuSqge+IdnNfZ0APgPq/sRWDr6T3Of7EXOunrTWVq X-Received: by 2002:a17:903:22c4:b0:1db:4961:2213 with SMTP id y4-20020a17090322c400b001db49612213mr3873565plg.27.1708019311921; Thu, 15 Feb 2024 09:48:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708019311; cv=pass; d=google.com; s=arc-20160816; b=d2HmUiw9vzQMygDGAYqXdQL5j/9Hr5xoGhIDQ+InQ0/jiqFJUxFlyVVp3CHRf+AEqS tzJLSxihN/GoQ2g/oVxoBrH+hOOSEAiLBB29ePsqeJxDZY6gLiSTBahZYPB11fPwqVFl FH5imuCTOZECV1Fz3QfPB7h5lUxitBC/sSy+HKy1SdMsUVo1BYUCdnQOX7iRcewlw9gw 8vTOrCFTFlm/BYf6Pd0z17H+c5GXSW6H8k7zNaO859/6Zom2aMmY5sZjSkdp+gGBtv6b AWEvgCPQ4bSnW0D/pDvSxxWU683NHBNG/iVfSjatXO2ZCHbRYUo/ExEpooaQNbr0Rmsr M7Mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=HquKZRHBV00ju6jdGp8jpiRgiVO9YKBQxry6Lkp4DJM=; fh=Uc7Po5K9YzeLRXDn9imU/kqgBWDRegi9yZ2rOZkdJt0=; b=E5celKqLh5akcdObDeuBPVGgEge8nNIdKYUsEjtuqxVyH7L62mnBA/YPaezmLlncRn qFdprmREUCvTYXj3EaOoTY48le7PA7GnoJEvPT3gFYJduhGViAu0yGai2H+0WoqhrBaW 0mQFqJSgUQnoLWtvrhzuWaAGJR0F6FqMAYyDgAekMgrOrfiS1lLCxC7KEP+FSHUIMYyT 5CS2t1AVBTOA2ftWOoSPj0IbNI/SB4NlpTpY36/JX46EP0eU5yj4h7+Ixg3LUgl8c4f7 SOQSZUse2CoofvSKuXEdjxfuZ5dUWvnHz2DumMKDwu6nNzh5RP+AFSGttZdxlmiB4gnQ Ocmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D4FOpQuM; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-67436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b8-20020a170903228800b001db6523914fsi1476121plh.309.2024.02.15.09.48.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 09:48:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D4FOpQuM; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-67436-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67436-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9960D28615C for ; Thu, 15 Feb 2024 17:48:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 261DB13957B; Thu, 15 Feb 2024 17:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="D4FOpQuM" Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3379F139560 for ; Thu, 15 Feb 2024 17:47:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708019247; cv=none; b=YsNstYjF3GFdEQrD5+QeUkGFVkVkFxyu3XwUAjNpiuYsz+bqQozMhadDqAy5vqgWOPMC1fFsCBSg28cnbeVN0Sd2koGH8449vDIPSoCTSYhPfMOm9mIuG8Eiaxhxpuf2W+ntRs5Z1GxgbDYF26ZVaksNF/GGkBNLWVg8IgK3XjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708019247; c=relaxed/simple; bh=ajmUHFUBbOZfizj8pnDDtY5izZYI3pCtjemyKv14bKA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=HQ6bIqxqpGAxFBdjURaozamB/gHHVX2o6UHvByCwvcJOZR7trhOPYQtY+3CEuXZAcuukZUDNR9OCu/jczsMcB5EXJQwenDnqNYmRsSSdSFirLLnjoNi4tyFLgcercAoIeQ6zNA6X+OXXBfABxg91a4ciH3li0fSBkx4qgORHErs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=D4FOpQuM; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2d11d17dddeso13643761fa.3 for ; Thu, 15 Feb 2024 09:47:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708019242; x=1708624042; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=HquKZRHBV00ju6jdGp8jpiRgiVO9YKBQxry6Lkp4DJM=; b=D4FOpQuMXbykR8B1nhzpDcPZLu9pj2zkbC+ImSXezWoEepcGuWf8P7CH7hMfOewZxU 3k5RtWEAFuS7EItUJZNZQvnKbp2V+mO+Z8EUM9XDk+42WJi4QF/ey8JJJuuMPS+olpSH peHgppBU6BP5Ox5iK3gDSaOPtqgqmTu+ABvvGvTb1PJlD3JBBn7bwKU6UtfPvgqF+sL4 sHCTvxiDYBHIOEgG9wdqH1L+nVhQF2MrdPg4f0sZEz70BiLYuGWZ+pLy1ZQe6lXajmpQ stFhKESkfSA0wP5t87qiL+GKF5pn2FNJQJeobnQokna1mqtR9ctJ6i0J5xgnuqYZlJmp frBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708019242; x=1708624042; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HquKZRHBV00ju6jdGp8jpiRgiVO9YKBQxry6Lkp4DJM=; b=tgHILZ3jTGdOzjna5iMS/bkvzHPEF2/qL2p4gIlsGZ8aqSL+N4Dybxjz17AscFDoV4 7+UhlpDIFP2YlbWSBvVr1rAsluglBRKbSYDcvpYXUP44y49fG305YrQQfNHNrkJUAh6s hUGiUwWwR1Ra3l7Um/RP7NERrqYZh7VIbL8uxw6i4gH4ygimPaK6ByS8iWxnRbLdIGsk gzPHa90QXCYIdJgXm6qLg9quo/MDfIzlsuYi6KWm69C++t10oivN/9ghdVkiqdPVpGFP 1LUuPG8o8duuVhFqUH8KmLxhqTxCP7OviqbzljlzCMNvlXLyaJEMXIOcKAOeNLEqNHrB QcEA== X-Forwarded-Encrypted: i=1; AJvYcCW+w4xQYgeeXwKSFT4FlTc1mLNJYKLPQ50N3n0sGRPbChYakaIQqxL8NB9WZIBduIZlR8N/lYqzA+DLN3+4xNxzsK0z7/S8/3uG1AZo X-Gm-Message-State: AOJu0YzfYBMwlkXCK6UfzsBrP68hm7qkdwbE9pqznQ5m1jdvEnAeeFA0 Dyqz1rjmTSATNjfdppkXfmQO934WXQYKnqKstsuDDYtrUEKMJHpeNWnO/HLD+zc= X-Received: by 2002:a05:6512:1152:b0:511:7ebe:b160 with SMTP id m18-20020a056512115200b005117ebeb160mr2306326lfg.45.1708019242290; Thu, 15 Feb 2024 09:47:22 -0800 (PST) Received: from [192.168.192.135] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id r1-20020a50d681000000b005638f04c122sm790193edi.14.2024.02.15.09.47.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Feb 2024 09:47:21 -0800 (PST) Message-ID: Date: Thu, 15 Feb 2024 18:47:20 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] PCI: dwc: Use the correct sleep function in wait_for_link Content-Language: en-US To: Serge Semin Cc: Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marijn Suijten , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold References: <20240215-topic-pci_sleep-v1-1-7ac79ac9739a@linaro.org> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwONM3eCI3qcYm5JNc5X+JthZOWsbIPSC1Rhxz3JmWIwP1udr5E3oN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SC1KL1lXGXeRM 8arzfyiB5wJ9tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 15.02.2024 15:17, Serge Semin wrote: > On Thu, Feb 15, 2024 at 11:39:31AM +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 >> --- >> Tested on Qualcomm SC8280XP CRD >> --- >> 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..abce6afceb91 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_MSLEEP_MAX); >> } >> >> 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..3f145d6a8a31 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_MSLEEP_MAX 100 > > Why do you use the _MAX suffix here? AFAICS any the timers normally > ensures the lower boundary value of the wait-duration, not the upper > one. So the more correct suffix would be _MIN. On the other hand, as > Alexander correctly noted, using fsleep() would be more suitable at > least from the maintainability point of view. Thus having a macro name > like LINK_WAIT_USLEEP_MIN or just LINK_WAIT_SLEEP_US would be more > appropriate. The later version is more preferable IMO. Agree with SLEEP_US Konrad