From patchwork Mon Oct 15 06:38:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 10641201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38A5A3C13 for ; Mon, 15 Oct 2018 06:40:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A4702957A for ; Mon, 15 Oct 2018 06:40:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EA1229594; Mon, 15 Oct 2018 06:40:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C468E29000 for ; Mon, 15 Oct 2018 06:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726590AbeJOOYU (ORCPT ); Mon, 15 Oct 2018 10:24:20 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:39348 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726629AbeJOOYT (ORCPT ); Mon, 15 Oct 2018 10:24:19 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w9F6eOdF039282; Mon, 15 Oct 2018 01:40:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1539585624; bh=O1MNlTL8Ajqs/IldHTKK0tj83xOG0qZBKMcMwMMqaoc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lrkvqA/rQ7pOjG3OrQO+QGd9BicZbLFCz7PjNvwCyYYUBOkbpx42dpqShqRw2cd0m f+fDw7s/bC3cFKbhEnuoQ5EIeNsn2uYL5fIAzJ5VfeB2RHZ3h3AMh1snIOrzJABmHK tcfA59GxG17VR/+NtavmINoyEEujdR/ELcfMwzRQ= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w9F6eO5h005742; Mon, 15 Oct 2018 01:40:24 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 15 Oct 2018 01:40:24 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 15 Oct 2018 01:40:24 -0500 Received: from a0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w9F6eH4O023129; Mon, 15 Oct 2018 01:40:22 -0500 From: Vignesh R To: Mark Brown CC: , , , Vignesh R , Sekhar Nori Subject: [PATCH 1/3] spi: omap2-mcspi: Switch to readl_poll_timeout() Date: Mon, 15 Oct 2018 12:08:27 +0530 Message-ID: <20181015063829.26978-2-vigneshr@ti.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181015063829.26978-1-vigneshr@ti.com> References: <20181015063829.26978-1-vigneshr@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use standard readl_poll_timeout() macro for polling on status bits. Signed-off-by: Vignesh R --- drivers/spi/spi-omap2-mcspi.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 508c61c669e7..985f00d8a964 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -353,19 +354,9 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit) { - unsigned long timeout; - - timeout = jiffies + msecs_to_jiffies(1000); - while (!(readl_relaxed(reg) & bit)) { - if (time_after(jiffies, timeout)) { - if (!(readl_relaxed(reg) & bit)) - return -ETIMEDOUT; - else - return 0; - } - cpu_relax(); - } - return 0; + u32 val; + + return readl_poll_timeout(reg, val, val & bit, 1, MSEC_PER_SEC); } static void omap2_mcspi_rx_callback(void *data)