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=-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=ham 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 D2E69C43463 for ; Mon, 21 Sep 2020 06:17:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 893B22084C for ; Mon, 21 Sep 2020 06:17:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="dMYOzZlA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726355AbgIUGRG (ORCPT ); Mon, 21 Sep 2020 02:17:06 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:63798 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726149AbgIUGRF (ORCPT ); Mon, 21 Sep 2020 02:17:05 -0400 X-UUID: 76199e3959b24f03ba6d17f8da1ed900-20200921 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=Xo5rf9xp9Q898V4NrJeKvL/NbIN1YvfdZlom51aDk10=; b=dMYOzZlAtRAPxAFM4lM+xpxev+mOaJjz8MoQcDuHI/7chEd3NHWJc94oR8awYOuaFRAR33A0PAeRtxI9X4sWfra+4Ed/fXeIgWNK3iSr/bEj1bVhAMvfwT2GogU4TuU8o++T5dyESf+0WXqFV4dLVYfxaGHo48GBdPaNTew9KnQ=; X-UUID: 76199e3959b24f03ba6d17f8da1ed900-20200921 Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1399888662; Mon, 21 Sep 2020 14:16:59 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 21 Sep 2020 14:16:57 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 21 Sep 2020 14:16:56 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi CC: Mathias Nyman , Matthias Brugger , Chunfeng Yun , "Eric W. Biederman" , Sumit Garg , Lee Jones , Jann Horn , Jason Yan , Arnd Bergmann , Chuhong Yuan , "Gustavo A. R. Silva" , "Ben Dooks (Codethink)" , Saurav Girepunje , , , , , Sergei Shtylyov , Daniel Thompson , Petr Mladek Subject: [PATCH v4 02/11] usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() Date: Mon, 21 Sep 2020 14:13:26 +0800 Message-ID: <1600668815-12135-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com> References: <1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 08E2723B77F099582DC762E959887646B7F9FDFF59FD8B41E444D08844B116772000:8 X-MTK: N Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org VXNlIHJlYWRsX3BvbGxfdGltZW91dF9hdG9taWMoKSB0byBzaW1wbGlmeSBjb2RlDQoNCkNjOiAi RXJpYyBXLiBCaWVkZXJtYW4iIDxlYmllZGVybUB4bWlzc2lvbi5jb20+DQpDYzogUGV0ciBNbGFk ZWsgPHBtbGFkZWtAc3VzZS5jb20+DQpTaWduZWQtb2ZmLWJ5OiBDaHVuZmVuZyBZdW4gPGNodW5m ZW5nLnl1bkBtZWRpYXRlay5jb20+DQotLS0NCnYyfnY0OiBubyBjaGFuZ2VzDQotLS0NCiBkcml2 ZXJzL3VzYi9lYXJseS9laGNpLWRiZ3AuYyB8IDE1ICsrKysrLS0tLS0tLS0tLQ0KIDEgZmlsZSBj aGFuZ2VkLCA1IGluc2VydGlvbnMoKyksIDEwIGRlbGV0aW9ucygtKQ0KDQpkaWZmIC0tZ2l0IGEv ZHJpdmVycy91c2IvZWFybHkvZWhjaS1kYmdwLmMgYi9kcml2ZXJzL3VzYi9lYXJseS9laGNpLWRi Z3AuYw0KaW5kZXggYjA3NWRiZi4uNDViNDJkOCAxMDA2NDQNCi0tLSBhL2RyaXZlcnMvdXNiL2Vh cmx5L2VoY2ktZGJncC5jDQorKysgYi9kcml2ZXJzL3VzYi9lYXJseS9laGNpLWRiZ3AuYw0KQEAg LTE1LDYgKzE1LDcgQEANCiAjaW5jbHVkZSA8bGludXgvY29uc29sZS5oPg0KICNpbmNsdWRlIDxs aW51eC9lcnJuby5oPg0KICNpbmNsdWRlIDxsaW51eC9pbml0Lmg+DQorI2luY2x1ZGUgPGxpbnV4 L2lvcG9sbC5oPg0KICNpbmNsdWRlIDxsaW51eC9wY2lfcmVncy5oPg0KICNpbmNsdWRlIDxsaW51 eC9wY2lfaWRzLmg+DQogI2luY2x1ZGUgPGxpbnV4L3VzYi9jaDkuaD4NCkBAIC0xNjEsMTcgKzE2 MiwxMSBAQCBzdGF0aWMgaW5saW5lIHUzMiBkYmdwX3BpZF9yZWFkX3VwZGF0ZSh1MzIgeCwgdTMy IHRvaykNCiBzdGF0aWMgaW50IGRiZ3Bfd2FpdF91bnRpbF9jb21wbGV0ZSh2b2lkKQ0KIHsNCiAJ dTMyIGN0cmw7DQotCWludCBsb29wID0gREJHUF9USU1FT1VUOw0KLQ0KLQlkbyB7DQotCQljdHJs ID0gcmVhZGwoJmVoY2lfZGVidWctPmNvbnRyb2wpOw0KLQkJLyogU3RvcCB3aGVuIHRoZSB0cmFu c2FjdGlvbiBpcyBmaW5pc2hlZCAqLw0KLQkJaWYgKGN0cmwgJiBEQkdQX0RPTkUpDQotCQkJYnJl YWs7DQotCQl1ZGVsYXkoMSk7DQotCX0gd2hpbGUgKC0tbG9vcCA+IDApOw0KKwlpbnQgcmV0Ow0K IA0KLQlpZiAoIWxvb3ApDQorCXJldCA9IHJlYWRsX3BvbGxfdGltZW91dF9hdG9taWMoJmVoY2lf ZGVidWctPmNvbnRyb2wsIGN0cmwsDQorCQkJCShjdHJsICYgREJHUF9ET05FKSwgMSwgREJHUF9U SU1FT1VUKTsNCisJaWYgKHJldCkNCiAJCXJldHVybiAtREJHUF9USU1FT1VUOw0KIA0KIAkvKg0K LS0gDQoxLjkuMQ0K 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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 285FDC43463 for ; Mon, 21 Sep 2020 06:25:40 +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 C7D7520708 for ; Mon, 21 Sep 2020 06:25:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yCmCd9/s"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="txyqOSAk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7D7520708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=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:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TDDtMPjKkyhwa71wVSeU/40o91WiULbMovA4Y69ldN8=; b=yCmCd9/sGKiJkQg0k7HqGQHCD dv1GkPaePCYVLL3GO3opdWPoOE6hrGSgn6YrZJeFtV10LH+uRzRO0U1VTuws0/iSOX5lty0Y/deA0 eHambF8JNtyUkkRTJoM7/w0WKbjx4drg33Fiay8ZA/tPVR0XP2J5gmVQhGC3/rS2RR6VdbY+0ll4/ BQFKJpzJtjEoEqtD4RAXLnFV/jVvHntrFxFxM1jEOcKQHApTQf3q6ZI26LuK1MsZPNkX2qyLnW6wO vyZ1a+DaIMRol+3YeZHWrqFcju8jNJBETzWcDT2WSFIR85+6yg4gqG1TvA9Pv1HCXx0gWxU54oAvT 6rDdIp8EQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKFGR-0005lD-Eo; Mon, 21 Sep 2020 06:25:27 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKFFh-0005Sd-Me; Mon, 21 Sep 2020 06:24:44 +0000 X-UUID: dc9defc220e545658d985ef79d55e87e-20200920 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=Xo5rf9xp9Q898V4NrJeKvL/NbIN1YvfdZlom51aDk10=; b=txyqOSAk8KwtI+KVRkHe9mCLKCDRIvHad4cZtkE9zAvDip3lusVd+Z9ORVI6OtBkUvLULmljoWrrZCj4b3x0QY5DhHR0YMgxx2XhxlLa7FIfpdCxMhRYDLBZmVy7LDEnt9SdzT5P/o36ac8lXimKdtUHWq+yAaMvtZdx/LqQfV0=; X-UUID: dc9defc220e545658d985ef79d55e87e-20200920 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1864512577; Sun, 20 Sep 2020 22:24:38 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 20 Sep 2020 23:17:00 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 21 Sep 2020 14:16:57 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 21 Sep 2020 14:16:56 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi Subject: [PATCH v4 02/11] usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() Date: Mon, 21 Sep 2020 14:13:26 +0800 Message-ID: <1600668815-12135-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com> References: <1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 08E2723B77F099582DC762E959887646B7F9FDFF59FD8B41E444D08844B116772000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_022441_956496_00796194 X-CRM114-Status: GOOD ( 14.61 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sumit Garg , Daniel Thompson , linux-usb@vger.kernel.org, Arnd Bergmann , Mathias Nyman , Jann Horn , Jason Yan , Chuhong Yuan , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, Saurav Girepunje , Chunfeng Yun , "Ben Dooks \(Codethink\)" , linux-mediatek@lists.infradead.org, "Eric W. Biederman" , Matthias Brugger , Petr Mladek , Lee Jones , Sergei Shtylyov , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use readl_poll_timeout_atomic() to simplify code Cc: "Eric W. Biederman" Cc: Petr Mladek Signed-off-by: Chunfeng Yun --- v2~v4: no changes --- drivers/usb/early/ehci-dbgp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c index b075dbf..45b42d8 100644 --- a/drivers/usb/early/ehci-dbgp.c +++ b/drivers/usb/early/ehci-dbgp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -161,17 +162,11 @@ static inline u32 dbgp_pid_read_update(u32 x, u32 tok) static int dbgp_wait_until_complete(void) { u32 ctrl; - int loop = DBGP_TIMEOUT; - - do { - ctrl = readl(&ehci_debug->control); - /* Stop when the transaction is finished */ - if (ctrl & DBGP_DONE) - break; - udelay(1); - } while (--loop > 0); + int ret; - if (!loop) + ret = readl_poll_timeout_atomic(&ehci_debug->control, ctrl, + (ctrl & DBGP_DONE), 1, DBGP_TIMEOUT); + if (ret) return -DBGP_TIMEOUT; /* -- 1.9.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 B4D6FC43464 for ; Mon, 21 Sep 2020 06:26:35 +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 6984C20739 for ; Mon, 21 Sep 2020 06:26:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IjzH0Lmz"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="txyqOSAk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6984C20739 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.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:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cI9goaEmQBNy/v7NeUQSrXVdQ7Xqw3RJxLSOl4Op6F0=; b=IjzH0LmzxGDrJIaDNrd16qS/Q V2NhW6HzvjHqDEfWY8wAFmVMPbuxMxQge+F2hrsNGFWlQI6GDxHbB/l+2UPRCkL2VS2QS85x9m5TM qiaHdNeyzPlaHMs6vsRP0AAHQOCgZ79/pPgeOloEizdB3BGmO+tj+p+H2x/ANvSYjKvFcQsAWKGvf ZYPkYJcbkmxbGxlXiHdtw4ccsHHJs3kFmL+KLB307EZcTX1vvNEOsTQaV9mIhw1CfzQi7yA7E1axB DsnVRZBixUTOf9iEmFekW89iXOPUDGxSBLVPex139sHbtLH++ro9Xh9VmcMkWmqOpt8V9/LAqDxYG vjxeDuNxg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKFGB-0005ep-6n; Mon, 21 Sep 2020 06:25:11 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKFFh-0005Sd-Me; Mon, 21 Sep 2020 06:24:44 +0000 X-UUID: dc9defc220e545658d985ef79d55e87e-20200920 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=Xo5rf9xp9Q898V4NrJeKvL/NbIN1YvfdZlom51aDk10=; b=txyqOSAk8KwtI+KVRkHe9mCLKCDRIvHad4cZtkE9zAvDip3lusVd+Z9ORVI6OtBkUvLULmljoWrrZCj4b3x0QY5DhHR0YMgxx2XhxlLa7FIfpdCxMhRYDLBZmVy7LDEnt9SdzT5P/o36ac8lXimKdtUHWq+yAaMvtZdx/LqQfV0=; X-UUID: dc9defc220e545658d985ef79d55e87e-20200920 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1864512577; Sun, 20 Sep 2020 22:24:38 -0800 Received: from MTKMBS31DR.mediatek.inc (172.27.6.102) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 20 Sep 2020 23:17:00 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 21 Sep 2020 14:16:57 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 21 Sep 2020 14:16:56 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman , Felipe Balbi Subject: [PATCH v4 02/11] usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic() Date: Mon, 21 Sep 2020 14:13:26 +0800 Message-ID: <1600668815-12135-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com> References: <1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 08E2723B77F099582DC762E959887646B7F9FDFF59FD8B41E444D08844B116772000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200921_022441_956496_00796194 X-CRM114-Status: GOOD ( 14.61 ) 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: Sumit Garg , Daniel Thompson , linux-usb@vger.kernel.org, Arnd Bergmann , Mathias Nyman , Jann Horn , Jason Yan , Chuhong Yuan , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, Saurav Girepunje , Chunfeng Yun , "Ben Dooks \(Codethink\)" , linux-mediatek@lists.infradead.org, "Eric W. Biederman" , Matthias Brugger , Petr Mladek , Lee Jones , Sergei Shtylyov , linux-arm-kernel@lists.infradead.org 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 Use readl_poll_timeout_atomic() to simplify code Cc: "Eric W. Biederman" Cc: Petr Mladek Signed-off-by: Chunfeng Yun --- v2~v4: no changes --- drivers/usb/early/ehci-dbgp.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c index b075dbf..45b42d8 100644 --- a/drivers/usb/early/ehci-dbgp.c +++ b/drivers/usb/early/ehci-dbgp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -161,17 +162,11 @@ static inline u32 dbgp_pid_read_update(u32 x, u32 tok) static int dbgp_wait_until_complete(void) { u32 ctrl; - int loop = DBGP_TIMEOUT; - - do { - ctrl = readl(&ehci_debug->control); - /* Stop when the transaction is finished */ - if (ctrl & DBGP_DONE) - break; - udelay(1); - } while (--loop > 0); + int ret; - if (!loop) + ret = readl_poll_timeout_atomic(&ehci_debug->control, ctrl, + (ctrl & DBGP_DONE), 1, DBGP_TIMEOUT); + if (ret) return -DBGP_TIMEOUT; /* -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel