All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan Wu <bryan.wu-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
To: dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org
Cc: Bryan Wu <bryan.wu-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/4] Blackfin SPI driver: use cpu_relax() to replace continue in while busywait
Date: Fri,  2 Nov 2007 10:38:29 +0800	[thread overview]
Message-ID: <1193971112-7744-2-git-send-email-bryan.wu@analog.com> (raw)
In-Reply-To: <1193971112-7744-1-git-send-email-bryan.wu-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>

Signed-off-by: Bryan Wu <bryan.wu-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi_bfin5xx.c |   78 ++++++++++++++++++++++----------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 83c866d..fc0c374 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -186,7 +186,7 @@ static int flush(struct driver_data *drv_data)
 
 	/* wait for stop and clear stat */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
-		continue;
+		cpu_relax();
 
 	write_STAT(drv_data, BIT_STAT_CLR);
 
@@ -262,7 +262,7 @@ static void null_writer(struct driver_data *drv_data)
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, 0);
 		while ((read_STAT(drv_data) & BIT_STAT_TXS))
-			continue;
+			cpu_relax();
 		drv_data->tx += n_bytes;
 	}
 }
@@ -274,7 +274,7 @@ static void null_reader(struct driver_data *drv_data)
 
 	while (drv_data->rx < drv_data->rx_end) {
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		dummy_read(drv_data);
 		drv_data->rx += n_bytes;
 	}
@@ -287,12 +287,12 @@ static void u8_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		++drv_data->tx;
 	}
 }
@@ -303,14 +303,14 @@ static void u8_cs_chg_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 
 		cs_deactive(drv_data, chip);
 
@@ -325,7 +325,7 @@ static void u8_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -334,13 +334,13 @@ static void u8_reader(struct driver_data *drv_data)
 
 	while (drv_data->rx < drv_data->rx_end - 1) {
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 		++drv_data->rx;
 	}
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u8 *) (drv_data->rx) = read_SHAW(drv_data);
 	++drv_data->rx;
 }
@@ -351,7 +351,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -363,7 +363,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
 		cs_deactive(drv_data, chip);
 
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		cs_active(drv_data, chip);
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 		++drv_data->rx;
@@ -371,7 +371,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
 	cs_deactive(drv_data, chip);
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u8 *) (drv_data->rx) = read_SHAW(drv_data);
 	++drv_data->rx;
 }
@@ -380,15 +380,15 @@ static void u8_duplex(struct driver_data *drv_data)
 {
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* in duplex mode, clk is triggered by writing of TDBR */
 	while (drv_data->rx < drv_data->rx_end) {
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 		++drv_data->rx;
 		++drv_data->tx;
@@ -401,16 +401,16 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->rx < drv_data->rx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 
 		cs_deactive(drv_data, chip);
@@ -427,12 +427,12 @@ static void u16_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while ((read_STAT(drv_data) & BIT_STAT_TXS))
-			continue;
+			cpu_relax();
 		drv_data->tx += 2;
 	}
 }
@@ -443,14 +443,14 @@ static void u16_cs_chg_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while ((read_STAT(drv_data) & BIT_STAT_TXS))
-			continue;
+			cpu_relax();
 
 		cs_deactive(drv_data, chip);
 
@@ -465,7 +465,7 @@ static void u16_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -474,13 +474,13 @@ static void u16_reader(struct driver_data *drv_data)
 
 	while (drv_data->rx < (drv_data->rx_end - 2)) {
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 		drv_data->rx += 2;
 	}
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u16 *) (drv_data->rx) = read_SHAW(drv_data);
 	drv_data->rx += 2;
 }
@@ -491,7 +491,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -503,7 +503,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
 		cs_deactive(drv_data, chip);
 
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		cs_active(drv_data, chip);
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 		drv_data->rx += 2;
@@ -511,7 +511,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
 	cs_deactive(drv_data, chip);
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u16 *) (drv_data->rx) = read_SHAW(drv_data);
 	drv_data->rx += 2;
 }
@@ -520,15 +520,15 @@ static void u16_duplex(struct driver_data *drv_data)
 {
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* in duplex mode, clk is triggered by writing of TDBR */
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 		drv_data->rx += 2;
 		drv_data->tx += 2;
@@ -541,16 +541,16 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 
 		cs_deactive(drv_data, chip);
@@ -624,7 +624,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
 
 	/* Wait for DMA to complete */
 	while (get_dma_curr_irqstat(drv_data->dma_channel) & DMA_RUN)
-		continue;
+		cpu_relax();
 
 	/*
 	 * wait for the last transaction shifted out.  HRM states:
@@ -635,11 +635,11 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
 	if (drv_data->tx != NULL) {
 		while ((read_STAT(drv_data) & TXS) ||
 		       (read_STAT(drv_data) & TXS))
-			continue;
+			cpu_relax();
 	}
 
 	while (!(read_STAT(drv_data) & SPIF))
-		continue;
+		cpu_relax();
 
 	msg->actual_length += drv_data->len_in_bytes;
 
@@ -783,7 +783,7 @@ static void pump_transfers(unsigned long data)
 
 		/* poll for SPI completion before start */
 		while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-			continue;
+			cpu_relax();
 
 		/* dirty hack for autobuffer DMA mode */
 		if (drv_data->tx_dma == 0xFFFF) {
-- 
1.5.3.4

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

WARNING: multiple messages have this Message-ID (diff)
From: Bryan Wu <bryan.wu@analog.com>
To: dbrownell@users.sourceforge.net, akpm@linux-foundation.org
Cc: spi-devel-general@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Bryan Wu <bryan.wu@analog.com>
Subject: [PATCH 1/4] Blackfin SPI driver: use cpu_relax() to replace continue in while busywait
Date: Fri,  2 Nov 2007 10:38:29 +0800	[thread overview]
Message-ID: <1193971112-7744-2-git-send-email-bryan.wu@analog.com> (raw)
In-Reply-To: <1193971112-7744-1-git-send-email-bryan.wu@analog.com>

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
 drivers/spi/spi_bfin5xx.c |   78 ++++++++++++++++++++++----------------------
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 83c866d..fc0c374 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -186,7 +186,7 @@ static int flush(struct driver_data *drv_data)
 
 	/* wait for stop and clear stat */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
-		continue;
+		cpu_relax();
 
 	write_STAT(drv_data, BIT_STAT_CLR);
 
@@ -262,7 +262,7 @@ static void null_writer(struct driver_data *drv_data)
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, 0);
 		while ((read_STAT(drv_data) & BIT_STAT_TXS))
-			continue;
+			cpu_relax();
 		drv_data->tx += n_bytes;
 	}
 }
@@ -274,7 +274,7 @@ static void null_reader(struct driver_data *drv_data)
 
 	while (drv_data->rx < drv_data->rx_end) {
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		dummy_read(drv_data);
 		drv_data->rx += n_bytes;
 	}
@@ -287,12 +287,12 @@ static void u8_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		++drv_data->tx;
 	}
 }
@@ -303,14 +303,14 @@ static void u8_cs_chg_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 
 		cs_deactive(drv_data, chip);
 
@@ -325,7 +325,7 @@ static void u8_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -334,13 +334,13 @@ static void u8_reader(struct driver_data *drv_data)
 
 	while (drv_data->rx < drv_data->rx_end - 1) {
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 		++drv_data->rx;
 	}
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u8 *) (drv_data->rx) = read_SHAW(drv_data);
 	++drv_data->rx;
 }
@@ -351,7 +351,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -363,7 +363,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
 		cs_deactive(drv_data, chip);
 
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		cs_active(drv_data, chip);
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 		++drv_data->rx;
@@ -371,7 +371,7 @@ static void u8_cs_chg_reader(struct driver_data *drv_data)
 	cs_deactive(drv_data, chip);
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u8 *) (drv_data->rx) = read_SHAW(drv_data);
 	++drv_data->rx;
 }
@@ -380,15 +380,15 @@ static void u8_duplex(struct driver_data *drv_data)
 {
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* in duplex mode, clk is triggered by writing of TDBR */
 	while (drv_data->rx < drv_data->rx_end) {
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 		++drv_data->rx;
 		++drv_data->tx;
@@ -401,16 +401,16 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->rx < drv_data->rx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u8 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u8 *) (drv_data->rx) = read_RDBR(drv_data);
 
 		cs_deactive(drv_data, chip);
@@ -427,12 +427,12 @@ static void u16_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while ((read_STAT(drv_data) & BIT_STAT_TXS))
-			continue;
+			cpu_relax();
 		drv_data->tx += 2;
 	}
 }
@@ -443,14 +443,14 @@ static void u16_cs_chg_writer(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while ((read_STAT(drv_data) & BIT_STAT_TXS))
-			continue;
+			cpu_relax();
 
 		cs_deactive(drv_data, chip);
 
@@ -465,7 +465,7 @@ static void u16_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -474,13 +474,13 @@ static void u16_reader(struct driver_data *drv_data)
 
 	while (drv_data->rx < (drv_data->rx_end - 2)) {
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 		drv_data->rx += 2;
 	}
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u16 *) (drv_data->rx) = read_SHAW(drv_data);
 	drv_data->rx += 2;
 }
@@ -491,7 +491,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* clear TDBR buffer before read(else it will be shifted out) */
 	write_TDBR(drv_data, 0xFFFF);
@@ -503,7 +503,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
 		cs_deactive(drv_data, chip);
 
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		cs_active(drv_data, chip);
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 		drv_data->rx += 2;
@@ -511,7 +511,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data)
 	cs_deactive(drv_data, chip);
 
 	while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-		continue;
+		cpu_relax();
 	*(u16 *) (drv_data->rx) = read_SHAW(drv_data);
 	drv_data->rx += 2;
 }
@@ -520,15 +520,15 @@ static void u16_duplex(struct driver_data *drv_data)
 {
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	/* in duplex mode, clk is triggered by writing of TDBR */
 	while (drv_data->tx < drv_data->tx_end) {
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 		drv_data->rx += 2;
 		drv_data->tx += 2;
@@ -541,16 +541,16 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data)
 
 	/* poll for SPI completion before start */
 	while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-		continue;
+		cpu_relax();
 
 	while (drv_data->tx < drv_data->tx_end) {
 		cs_active(drv_data, chip);
 
 		write_TDBR(drv_data, (*(u16 *) (drv_data->tx)));
 		while (read_STAT(drv_data) & BIT_STAT_TXS)
-			continue;
+			cpu_relax();
 		while (!(read_STAT(drv_data) & BIT_STAT_RXS))
-			continue;
+			cpu_relax();
 		*(u16 *) (drv_data->rx) = read_RDBR(drv_data);
 
 		cs_deactive(drv_data, chip);
@@ -624,7 +624,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
 
 	/* Wait for DMA to complete */
 	while (get_dma_curr_irqstat(drv_data->dma_channel) & DMA_RUN)
-		continue;
+		cpu_relax();
 
 	/*
 	 * wait for the last transaction shifted out.  HRM states:
@@ -635,11 +635,11 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id)
 	if (drv_data->tx != NULL) {
 		while ((read_STAT(drv_data) & TXS) ||
 		       (read_STAT(drv_data) & TXS))
-			continue;
+			cpu_relax();
 	}
 
 	while (!(read_STAT(drv_data) & SPIF))
-		continue;
+		cpu_relax();
 
 	msg->actual_length += drv_data->len_in_bytes;
 
@@ -783,7 +783,7 @@ static void pump_transfers(unsigned long data)
 
 		/* poll for SPI completion before start */
 		while (!(read_STAT(drv_data) & BIT_STAT_SPIF))
-			continue;
+			cpu_relax();
 
 		/* dirty hack for autobuffer DMA mode */
 		if (drv_data->tx_dma == 0xFFFF) {
-- 
1.5.3.4

  parent reply	other threads:[~2007-11-02  2:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02  2:38 [PATCH 0/4] Blackfin SPI driver updates and fixing Bryan Wu
2007-11-02  2:38 ` Bryan Wu
     [not found] ` <1193971112-7744-1-git-send-email-bryan.wu-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
2007-11-02  2:38   ` Bryan Wu [this message]
2007-11-02  2:38     ` [PATCH 1/4] Blackfin SPI driver: use cpu_relax() to replace continue in while busywait Bryan Wu
2007-11-02  2:38   ` [PATCH 2/4] Blackfin SPI driver: use void __iomem * for regs_base Bryan Wu
2007-11-02  2:38     ` Bryan Wu
2007-11-02  2:38   ` [PATCH 3/4] Blackfin SPI driver: move hard coded pin_req to board file Bryan Wu
2007-11-02  2:38     ` Bryan Wu
     [not found]     ` <1193971112-7744-4-git-send-email-bryan.wu-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
2007-11-06  6:03       ` David Brownell
2007-11-06  6:03         ` David Brownell
     [not found]         ` <200711052203.42855.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-11-06  6:46           ` Bryan Wu
2007-11-06  6:46             ` Bryan Wu
2007-11-02  2:38   ` [PATCH 4/4] Blackfin SPI driver: reconfigure speed_hz and bits_per_word in each spi transfer Bryan Wu
2007-11-02  2:38     ` Bryan Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1193971112-7744-2-git-send-email-bryan.wu@analog.com \
    --to=bryan.wu-oylxuock7orqt0dzr+alfa@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.