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, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,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 23D15C433DF for ; Thu, 16 Jul 2020 05:58:09 +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 E55BE2065E for ; Thu, 16 Jul 2020 05:58:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SuhgUJJD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sl3ESia3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E55BE2065E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=r6kodt4gKqLaszG2zb0mcPrcwX/2ewRXo/tdr6OP320=; b=SuhgUJJD9OM+1oS20qWikWw0M gSvg4U53GZ2e2KUsJs3NLMdtV2MrQhezY/bLY+XM+Op7RhLbqGMZoezq9ZBP4mAY5NIW5+YEEubjf rSb0QB4+FDKCK0kgw7CoYUwzg6FNdeFukOkDyoThIIpJlFWACLtQbKH0EyCI+LQ+e9sNt/s4y8oeB Pu+9FtC8UkXRrGH8AQpzb8mLKK3KAl+9KCeQQrMmJ8FGzkw+0Dk2WoM8iEAMoup/zftlZ6bepyTnu Im4odRwPwY3EJMqCYYJ93b/xVdGZsKIiW/5uSn5/zHjLR0F4ysgfxz2uhW/FcdFbnLRTn2TNUSMU3 eMdSMx5iw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwsm-0004hh-89; Thu, 16 Jul 2020 05:56:36 +0000 Received: from mail-il1-x144.google.com ([2607:f8b0:4864:20::144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvwsj-0004hA-D9 for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 05:56:34 +0000 Received: by mail-il1-x144.google.com with SMTP id a11so4084728ilk.0 for ; Wed, 15 Jul 2020 22:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NKqwxZGmcFZhkY5PqY2mOI3LFTBG3HphbeVkF+HUG8I=; b=Sl3ESia33DmCibkAjRcraHWL27fvPEF8j8dd17Jru4nbSwqYbWexILtWJHHa4lujF6 ZJa16QmCDxCr+AkYmjBPZP6Pi4r1RJ2OOjfj/x0YFt/dJqS8rFb71m2Iu7si3/xzSwJm eDW407oO1We8b1NxGhofAq2djtIjynweShZBDUticICj6+9qGcgtTq7HVaBVaNKhJWFz a2aP9wd3PME8RwWkLgX9KnJNRCZ9ILmgVVOIsYpT926KGWqU179QaI8l2yeHQ3OTxX39 clLipZ/jtiF5MjCcVAhHxK2NPAea//5SdiGIJVWIS7eBGLIiDKKoaaOveCVTpIyeHNUD /zkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NKqwxZGmcFZhkY5PqY2mOI3LFTBG3HphbeVkF+HUG8I=; b=oZTYG9UYLwTQWRUa9L4eTPvQHHFSY6K/Ptmg7zAhEkJrSMNFq5cfHm6QVdrvZrlEhT +UlneJH3Tjo2pA7Z2TU9jk0PDsy/etwnY7TdTwecd6asblsKMgKPBZPu12g7hTI7T1/8 +SXVm/Z8ibprW46wMzG2KKHl8/37ACKKjRsWRK+Qd1WtzEjwTRseBxHQZoHrZ0HAWXo9 hVqq3xjUMiS9bPgr66O7WFfKHIxBvWBCjTazIjY3xYfdmzFmIsvq3HkcwVeAnvpAz5es frfEWkT3kRfvZYT9z3gTCRwuLn2r2GqIK6B3go/aPxo3OL4YWPRxrL4xX1pv91Ys4uYQ aKzA== X-Gm-Message-State: AOAM530/38HnWR6wSlKyQ2acAmGLcKov9YVyF7wBrczTTSYPXDjqkEpl 8IfcJgEPs69XyInx2gYdUfo8xUqEApBisofMAQ4= X-Google-Smtp-Source: ABdhPJzplWKsBmnfCnlFFgUFbdLvvNrvpFk8y8sFgwWqO2bTqu25XaP4zfDj9HlbP17tw0BkEeEcAQuF3r2ybvsACjI= X-Received: by 2002:a05:6e02:1070:: with SMTP id q16mr2836705ilj.221.1594878991645; Wed, 15 Jul 2020 22:56:31 -0700 (PDT) MIME-Version: 1.0 References: <20200713074243.530-1-linux.amoon@gmail.com> <20200716055050.GE55478@vkoul-mobl> In-Reply-To: <20200716055050.GE55478@vkoul-mobl> From: Anand Moon Date: Thu, 16 Jul 2020 11:26:20 +0530 Message-ID: Subject: Re: [PATCH v4] phy: samsung: Use readl_poll_timeout function To: Vinod Koul X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_015633_503621_2C7C4ED1 X-CRM114-Status: GOOD ( 26.02 ) 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 Mailing List , Linux Kernel , Krzysztof Kozlowski , Kishon Vijay Abraham I , Kukjin Kim , linux-arm-kernel , 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 Hi Vinod, On Thu, 16 Jul 2020 at 11:20, Vinod Koul wrote: > > 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 Ok, I will do this, just waiting for some more feedback on these changes. > > thanks > -- > ~Vinod -Anand _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel