From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87144C433DF for ; Thu, 16 Jul 2020 05:52:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5089E2065E for ; Thu, 16 Jul 2020 05:52:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="L9GqP9EU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="juZS0NKw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5089E2065E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gYyMYDLhjoK+UzXvbZ+AArctt3orZSksdOaVXijr6vM=; b=L9GqP9EUlEWk/F8pHc4bqSW8q zjPy/5Ko4I3qrHaGYp+YV6u6X4UZARFFkBSGqdDVQ5jeNbMoNzYNL4losOFqMRq0uepHCPq0Yivg7 DSL21ZMzbE7E1xzul3dd3B6Yag1F/352AntLiyAZUQN29IIrcE1yrq2s3wClBqqwqCGmxlUD1M5mA TZdkKZUKluIv025kRxcKld0pTPmiCYNkb3TACxl+dGDaGhCwrVI7laoFqL/DaA5RVp2u/0aoYLEf9 Xl+TbqdxlLwidTVIGLuPr+lab7cPPQnfo5fKXJO1NEszESH3Y0utYCQPowllT38nOAJ3WgiUYKaJd A0tfvVEWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwnK-0003ge-Hd; Thu, 16 Jul 2020 05:50:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwnI-0003fM-3R for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 05:50:56 +0000 Received: from localhost (unknown [122.171.202.192]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E5122065E; Thu, 16 Jul 2020 05:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594878655; bh=K5M9VEUTLX2kdCyJTiXSp+ySzNwauaOQDdXxsbEw4Cs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=juZS0NKwsR33k8Y4iWXZk8HbFaogclJ9Cw5A9iVAP32qqQG4Unc1rqMDeuesHXXQc WfRrqJAYpIBDMBSmaOLVp7vHEFdDlHXzanW6eW0Nb3vNuFUfzjmYgYh2EcQIHvtNs2 rhejvi6M+Qshdsw1P7jATHZ7BUqn8U+VoZ9CBWWw= Date: Thu, 16 Jul 2020 11:20:50 +0530 From: Vinod Koul To: Anand Moon Subject: Re: [PATCH v4] phy: samsung: Use readl_poll_timeout function Message-ID: <20200716055050.GE55478@vkoul-mobl> References: <20200713074243.530-1-linux.amoon@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200713074243.530-1-linux.amoon@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_015056_252102_DEFFBBB0 X-CRM114-Status: GOOD ( 20.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Kishon Vijay Abraham I , Kukjin Kim , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 13-07-20, 07:42, Anand Moon wrote: > Instead of a busy waiting while loop using udelay > use readl_poll_timeout function to check the condition > is met or timeout occurs in crport_handshake function. > readl_poll_timeout is called in non atomic context so > it safe to sleep until the condition is met. > > Fixes: d8c80bb3b55b ("phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800") > Signed-off-by: Anand Moon > --- > Changes v4: > Rebased on to of patch [0] https://patchwork.kernel.org/patch/11651673/ > --Fix the commit message. > --Fix the error timeout condition for -ETIMEDOUT > --- > Changes v3: > --Fix the commit message. > --Drop the variable, used the value directly. > Changes v2: > --used the default timeout values. > --Added missing Fixed tags. > --- > drivers/phy/samsung/phy-exynos5-usbdrd.c | 39 ++++++++---------------- > 1 file changed, 12 insertions(+), 27 deletions(-) > > diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c > index 7f6279fb4f8f..ad81aa65cdff 100644 > --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c > +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -556,41 +557,25 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) > static int crport_handshake(struct exynos5_usbdrd_phy *phy_drd, > u32 val, u32 cmd) > { > - u32 usec = 100; > unsigned int result; > + int err; > > writel(val | cmd, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0); > > - do { > - result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1); > - if (result & PHYREG1_CR_ACK) > - break; > - > - udelay(1); > - } while (usec-- > 0); > - > - if (!usec) { > - dev_err(phy_drd->dev, > - "CRPORT handshake timeout1 (0x%08x)\n", val); > - return -ETIME; > + err = readl_poll_timeout(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1, > + result, (result & PHYREG1_CR_ACK), 1, 100); pls align this line to opening brace of preceding line: err = readl_poll_timeout(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1, result, (result & PHYREG1_CR_ACK), 1, 100); This is recommended way of splitting lines, see Documentation/process/coding-style.rst and run checkpatch.pl with --strict option thanks -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel