Title: [7389] trunk/drivers/spi/spi_bfin5xx.c: a minor optimization commented by Mike.
Revision
7389
Author
bhsong
Date
2009-09-20 22:39:27 -0400 (Sun, 20 Sep 2009)

Log Message

a minor optimization commented by Mike.  the only places we use
chip->flag is in the active/deactive and enable/disable function.
based on the assumption that we will call active/deactive a lot more
than enable/disable (at the minimum, we'll call it the same number of
times), we can save FLG# instead of FLS#.

Modified Paths

Diff

Modified: trunk/drivers/spi/spi_bfin5xx.c (7388 => 7389)


--- trunk/drivers/spi/spi_bfin5xx.c	2009-09-21 02:27:43 UTC (rev 7388)
+++ trunk/drivers/spi/spi_bfin5xx.c	2009-09-21 02:39:27 UTC (rev 7389)
@@ -190,7 +190,7 @@
 	if (likely(chip->chip_select_num)) {
 		u16 flag = read_FLAG(drv_data);
 
-		flag &= ~(chip->flag << 8);
+		flag &= ~chip->flag;
 
 		write_FLAG(drv_data, flag);
 	} else {
@@ -203,7 +203,7 @@
 	if (likely(chip->chip_select_num)) {
 		u16 flag = read_FLAG(drv_data);
 
-		flag |= (chip->flag << 8);
+		flag |= chip->flag;
 
 		write_FLAG(drv_data, flag);
 	} else {
@@ -220,7 +220,7 @@
 {
 	u16 flag = read_FLAG(drv_data);
 
-	flag |= chip->flag;
+	flag |= (chip->flag >> 8);
 
 	write_FLAG(drv_data, flag);
 }
@@ -229,7 +229,7 @@
 {
 	u16 flag = read_FLAG(drv_data);
 
-	flag &= ~chip->flag;
+	flag &= ~(chip->flag >> 8);
 
 	write_FLAG(drv_data, flag);
 }
@@ -1259,7 +1259,7 @@
 	 * SPI_BAUD, not the real baudrate
 	 */
 	chip->baud = hz_to_spi_baud(spi->max_speed_hz);
-	chip->flag = 1 << (spi->chip_select);
+	chip->flag = (1 << (spi->chip_select)) << 8;
 	chip->chip_select_num = spi->chip_select;
 
 	switch (chip->bits_per_word) {
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to