From patchwork Sat Aug 22 08:05:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 258795 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=-11.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT 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 51D09C433DF for ; Sat, 22 Aug 2020 08:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D6B321734 for ; Sat, 22 Aug 2020 08:09:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="EWQYwgKW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbgHVIJ1 (ORCPT ); Sat, 22 Aug 2020 04:09:27 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:63964 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726938AbgHVIJX (ORCPT ); Sat, 22 Aug 2020 04:09:23 -0400 X-UUID: fb20312230ef4a369dace70f1eb4e5b3-20200822 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=vQDriCyMjYjM6pnqq6iAk0QyjJohTMSr6/4Cj53MUf4=; b=EWQYwgKW9INvhUdqVoPGVHQ4lRCeAX+DIS/0eKiqI46NBFpzqFBZn2dxGXvOayJL96dPfdb3Cxb1JDQpV9wuJOrEYQzrXOgVzVfFYWtPui296h9JfQzmchfMGeocup3PmmhQgscaTsS0lWZfY+eyp1vk57iwShxVTuv1q1KjrS4=; X-UUID: fb20312230ef4a369dace70f1eb4e5b3-20200822 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 645605410; Sat, 22 Aug 2020 16:09:11 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 22 Aug 2020 16:09:10 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sat, 22 Aug 2020 16:09:08 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman CC: Felipe Balbi , Matthias Brugger , Chunfeng Yun , , , , , Lee Jones , Sergei Shtylyov , Mathias Nyman Subject: [PATCH v3 03/11] usb: pci-quirks: convert to readl_poll_timeout_atomic() Date: Sat, 22 Aug 2020 16:05:45 +0800 Message-ID: <1598083553-31896-3-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1598083553-31896-1-git-send-email-chunfeng.yun@mediatek.com> References: <1598083553-31896-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 14BCA79F542CC2DF6DF6C45CF08EFBF2CF6ED65BFFE122FDEB764F68DF392D022000:8 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Use readl_poll_timeout_atomic() to simplify code Cc: Mathias Nyman Signed-off-by: Chunfeng Yun --- v2~v3: no changes --- drivers/usb/host/pci-quirks.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- 1.9.1 diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index b8961c0..8920566 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -1012,15 +1013,9 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, { u32 result; - do { - result = readl(ptr); - result &= mask; - if (result == done) - return 0; - udelay(delay_usec); - wait_usec -= delay_usec; - } while (wait_usec > 0); - return -ETIMEDOUT; + return readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done), + delay_usec, wait_usec); } /*