Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1591873rdb; Tue, 20 Feb 2024 00:23:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0i++ZuiNjTDl605bGFUqg2Hnw2ZyuFke718YxjSM80DKc13xsf6XyszIAXXUuP4pnQN2An1CKS6UM82ZtGVutO1mHAVmiI/6DesNSDQ== X-Google-Smtp-Source: AGHT+IH5X7R9/SD0kRDPgm2gxmss9pLbttZdufw5EcuQB2mqRfLzc4Av3+7U/5gC0igfsOo4SATX X-Received: by 2002:a05:6402:1814:b0:560:209:c800 with SMTP id g20-20020a056402181400b005600209c800mr11799181edy.18.1708417416577; Tue, 20 Feb 2024 00:23:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708417416; cv=pass; d=google.com; s=arc-20160816; b=vg4eaPZ5BhBqPvh7dv8BrAbQNZBSqLWLBAF3abKdIE/mSiqPpoGEU8qCPeGt15TXh/ nODQ7SkMuNI0KIZZKrKiH4wO+2v70mvB0OuJsTKfGg7Oa+bWteoF/gnaWaAu+SS21h5E npGnEzGws1gLOU9NFdgYWzd/Rt9OkzMXQ/ZU+Zt7brGNsWcvvuWPAQ31Ifkn45cdLv4D hmItXzNG8m8NPfTYanawUObaaxDux/r7HVrkq4nt7R66qkwknrZx0E2es2nZmcMK7Q9k wPwXtL5pWcF5z7hfX8WbEwTI9dDA7zL48mz4h3PxEMu7M7dtumu7StEefrOYpJCz5RBl TCog== 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:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yhzS7gjyZAMSqPfSnIomQgw0IjS5pNpsmG6LbeVHZV0=; fh=AbS8uD6Ft4C3+U+ZADO4pPw3ND8WMf8fhIfeRMAOlVA=; b=TJXRYrG/fd9diQTlhyJ8fMjG02lscUmonASreJonL2lFtuQcoXpx6wlAPzif0pLJIH Lhag3OXxAuKQeQdojX0L24bRdz5AkNID5mMUP7Fkj8DcsYbNibVdeZoMoJEbR3QEffzz dPAP4/Ooi9qPP9fnnS2+X0Ywqqy3j11x+G1kyja/ZIiY6CK8iLy0oXvLTGktSqKgtPPv xHaTqrkoMjH5FKbNkeSGfuIXKyODjC2pE+KYiR0BHkYP738a3XmRtNlz2893YpEFH11B eZOskSy3eVaIfKmq+JxWgPBxZgQIMyukboF/6IehsBls8kDvsqsB0thQZbNO1NOOyXB6 6MnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="n/YeIefq"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72540-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y21-20020a50e615000000b005641883f185si3128344edm.35.2024.02.20.00.23.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 00:23:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="n/YeIefq"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72540-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72540-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 575881F21AB5 for ; Tue, 20 Feb 2024 08:23:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D8CB5C8FD; Tue, 20 Feb 2024 08:23:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n/YeIefq" 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 59AEA41215; Tue, 20 Feb 2024 08:23:26 +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=1708417406; cv=none; b=K1/JZvmVI8g+zjvhKio+jIZXLtkd9klvcfJMAgJ/tEFCY9YP49XCeZclPZ+7pVJABr1qu3tc9W/Am+tUoZsDW9ItJrr6Yx/LEYZ4IVpWnyRCSzTGR67RQhhPnegJ5U8DU0ih0AUo7sVRVDDSLfImqn56gUEpbyhk0UbCRFLsKOo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417406; c=relaxed/simple; bh=Nf/BMUVPzmrkw7nlEkpvKgeiXFDPdOK5C8QKwBwv4oc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kAlW/9EcTwszJYMrSZ5xAu2q7rdwMo367kkAtxrEwWvSefNSLhIdhKYBY/Imdcnc/wedB3nHFcHcGOy+TV3xrGZKHXWSFbZWWKbaoY2Z5UFblAj44nt7XHUk7X0SwTL5ptrwDY9jScoew4jNvgv+0mMox7KgEsoOGGiMfeR7rfA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n/YeIefq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6940C433F1; Tue, 20 Feb 2024 08:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708417405; bh=Nf/BMUVPzmrkw7nlEkpvKgeiXFDPdOK5C8QKwBwv4oc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n/YeIefq+zuvaG5nrm8GRps/2GdfpASMSkFwHM/hyIti5vHcnsPfnsLGVxSVcSFTd H25HSCjIfoKY/oL/2O+LYXzXuEtue9baI2VNgyw+6+Gp3uH1GLvVhN54oRgeM+P2JB REcBPZLikFNjPxTGF1Tyrrp3BixcXRDjxPxKToZ6E41D3fxfPk0lXfIAigElJH1Gbf NDqreEp+ql/mwKRNcR1bKSOXftdCxg2qPSffRRLv9oAABd3PKvqJmh0odU/ZGA1EOH j8u4t9bN/2axzAtYqTRg3QcUNElTyfi3w03Pa6cL5O1Qg+I/xIFd7CmjPdvo5uoNJv xjfnwBBjeOZsQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rcLPQ-000000002WT-0bsS; Tue, 20 Feb 2024 09:23:24 +0100 Date: Tue, 20 Feb 2024 09:23:24 +0100 From: Johan Hovold To: Konrad Dybcio Cc: Bjorn Helgaas , Alexander Lobakin , 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] PCI: dwc: Use the correct sleep function in wait_for_link Message-ID: References: <20240215170258.GA1292702@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: On Thu, Feb 15, 2024 at 06:46:55PM +0100, Konrad Dybcio wrote: > On 15.02.2024 18:02, Bjorn Helgaas wrote: > > On Thu, Feb 15, 2024 at 02:35:13PM +0100, Alexander Lobakin wrote: > >> From: Konrad Dybcio > >> Date: Thu, 15 Feb 2024 11:39:31 +0100 > >> > >>> 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); > >> > >> Just use fsleep(LINK_WAIT_USLEEP_MAX) and let the kernel decide which > >> function to pick. > > IMO, fsleep only makes sense when the argument is variable.. This way, we > can save on bothering the compiler or adding an unnecessary branch I fully agree. Using fsleep() with a constant just looks sloppy (e.g. with that hardcoded usleep range) and hides what is really going on for no good reason. Johan