Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1137554pxa; Thu, 20 Aug 2020 03:39:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxV99RjyWqpyH4/d79gaI0AKJmx+pPKv4NoCfmICfJLorTvbiI6Smb1077b0c/DzPLEkzyk X-Received: by 2002:a17:906:b2c3:: with SMTP id cf3mr2699669ejb.387.1597919984792; Thu, 20 Aug 2020 03:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597919984; cv=none; d=google.com; s=arc-20160816; b=X8PbF6uxWpsMU6Q+dTVdNoqq4q+mVYAgGUK4U9zg50zHtiH66z77bpIcxCvER8/TJB a6Lwa4Ox801Ol+8Cf5x2GHcVE+khJd+zQxEj2FsEIxtvpXeFjWRKKcFkxp+jiNXrJwb7 B5pU8+9jtRJP7PEtw8NLt3F+wgDfru1rCOMy3idf5jbr9m4jBVVxXfXVYxUv7BIX4Lov DHCjsMM12ReNPt2Q13Vr77zrg0fw8+302tVp27UJBsdivY9xT8vHYcN3TQvVpUtKrGgn NAQVDQeoX5Ukz6JeuRcy89eGMUfeypGzAPdo/CL2Eze29Wl5ER3NyyhRBhmWjfYbkeQL xVNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=kYwjflgRQVoui32eapBhBFxV9IoHyH7UykeWpPqQmtM=; b=y4WhKlJrh0/zSb5Rgm2VhfJX9xPBAQLfNKz1oN41M4FsZRnONGoTqPyreAQKlz0khf Zq0CVEY6FLAPpE1WeyHe8YQmvrZD7WsFiwjVxJiL04rNfz5Sgr4WvPKuxXqSJpN7bXTV GSxgoDJlY+m/Uy0EeofUltKelpBCLoo4b3cmTMqinuzqQynNFdiXqSmURYq260MfJY6m Bh8PUHxRkNoeWBmt1mohqnLi64BddZDMxvTgicnTLIH4GOFaL1w2unY06L/0RKzNCkYt LxFp5qfl+uhmKBRo/CsXhA3ByKSeENbYgex+kWqSI2arqwSQTWdXdE+LYFIsIozY8PW8 8D/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YUCUJvfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga10si988849ejb.402.2020.08.20.03.39.20; Thu, 20 Aug 2020 03:39:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YUCUJvfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731926AbgHTKis (ORCPT + 99 others); Thu, 20 Aug 2020 06:38:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730963AbgHTKSD (ORCPT ); Thu, 20 Aug 2020 06:18:03 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376A1C061757; Thu, 20 Aug 2020 03:18:01 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id w14so1470935ljj.4; Thu, 20 Aug 2020 03:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kYwjflgRQVoui32eapBhBFxV9IoHyH7UykeWpPqQmtM=; b=YUCUJvfrTEooGe2XmrcE5ooa0JrwV+Mh0xPCIgP0m4H3+6vDf4NkhTLQmKh322gIa7 y5EdIV0jnmdsV/BsN9zhxZBk2UnrRxTTKYU5Fg6pOXUGkEceJt3FK1uBmEPe0O6EZD4m jxVmBi6A2rR492QA2Kdce72+QUA0XLeh3l8kHpIMy7NZqGq4p/CkGsw5SyRqov6ydrgh 26i3+kV0DS2CEoMpWYwj/l48eLpF6QMwCJXFt0nknR51Kf3yLPmkDbXbrC8/wSDimJ0R pzOk4cjzaQzSm1E68kujkeGofsy0Z0JFM490+h698hLK6ZQznCqJzw7XTZwvqEig0QG1 gQTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=kYwjflgRQVoui32eapBhBFxV9IoHyH7UykeWpPqQmtM=; b=XB/db52PCEVlUKXtqjdd5u6ItwEonbhOWKMqrE4vS719nR3Wl5fUsAT17K2+ZxJt/+ LeqEnMxGMMvJIXWTb9wlApO8Qa9ayG5SK+OQCfEpx5MkPJ4uwY8xqqvIPc4yuW78Ki+Y xwoDGE2/c0qBRc38XOCTiDD4tKl15PBe5/NHZY8RYaa7q8M/OXQ3F3Rgieyu0TtXzBzz dJfZ3LeSOFQIkNS87gNDaeU+6zmxlZXU+qTz4WZaf1vBmmOpKYx02JMyW2baCpxMmboW bPV/NHnOE3ElHWbA2gCDae/eKPpLFagMWA/JiMJKMTB8wnSlCfT5FPGl2iRWYAqVxzMq DNaQ== X-Gm-Message-State: AOAM532H1gMXCG/wjpEpmRrGhHlsdUMHpL3FAwNalARYkVrzg5RDc98K mT5NHUXADjxHmxKxdWQ4ZF0= X-Received: by 2002:a2e:9d17:: with SMTP id t23mr1247335lji.456.1597918679697; Thu, 20 Aug 2020 03:17:59 -0700 (PDT) Received: from ?IPv6:2a00:1fa0:42ab:a165:4cb2:5f04:a1e8:63b? ([2a00:1fa0:42ab:a165:4cb2:5f04:a1e8:63b]) by smtp.gmail.com with ESMTPSA id p8sm403098lfh.64.2020.08.20.03.17.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Aug 2020 03:17:59 -0700 (PDT) Subject: Re: [PATCH v2 09/11] usb: phy: phy-mv-usb: convert to readl_poll_timeout_atomic() To: Chunfeng Yun , Greg Kroah-Hartman Cc: Felipe Balbi , Matthias Brugger , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Lee Jones References: <1597902349-8998-1-git-send-email-chunfeng.yun@mediatek.com> <1597902349-8998-9-git-send-email-chunfeng.yun@mediatek.com> From: Sergei Shtylyov Organization: Brain-dead Software Message-ID: Date: Thu, 20 Aug 2020 13:17:49 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <1597902349-8998-9-git-send-email-chunfeng.yun@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.08.2020 8:45, Chunfeng Yun wrote: > Use readl_poll_timeout_atomic() to simplify code > > Signed-off-by: Chunfeng Yun > --- > v2: udelay 10us instead of 20us according to kerneldoc > --- > drivers/usb/phy/phy-mv-usb.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c > index ce767ec..e801569 100644 > --- a/drivers/usb/phy/phy-mv-usb.c > +++ b/drivers/usb/phy/phy-mv-usb.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -135,8 +136,8 @@ static int mv_otg_set_timer(struct mv_otg *mvotg, unsigned int id, > > static int mv_otg_reset(struct mv_otg *mvotg) > { > - unsigned int loops; > u32 tmp; > + int ret; > > /* Stop the controller */ > tmp = readl(&mvotg->op_regs->usbcmd); > @@ -146,15 +147,12 @@ static int mv_otg_reset(struct mv_otg *mvotg) > /* Reset the controller to get default values */ > writel(USBCMD_CTRL_RESET, &mvotg->op_regs->usbcmd); > > - loops = 500; > - while (readl(&mvotg->op_regs->usbcmd) & USBCMD_CTRL_RESET) { > - if (loops == 0) { > - dev_err(&mvotg->pdev->dev, > + ret = readl_poll_timeout_atomic(&mvotg->op_regs->usbcmd, tmp, > + (tmp & USBCMD_CTRL_RESET), 10, 10000); > + if (ret < 0) { > + dev_err(&mvotg->pdev->dev, > "Wait for RESET completed TIMEOUT\n"); You forgot to re-align this argument, it should start under & on the previous line... [...] MBR, Sergei