svn commit: r292428 - head/sys/dev/nand

Warner Losh imp at FreeBSD.org
Fri Dec 18 05:55:26 UTC 2015


Author: imp
Date: Fri Dec 18 05:55:24 2015
New Revision: 292428
URL: https://svnweb.freebsd.org/changeset/base/292428

Log:
  No need to test command values this way. There can be only one, even
  though the encoding is bit-wise today...

Modified:
  head/sys/dev/nand/nand_cdev.c
  head/sys/dev/nand/nand_geom.c

Modified: head/sys/dev/nand/nand_cdev.c
==============================================================================
--- head/sys/dev/nand/nand_cdev.c	Fri Dec 18 05:45:49 2015	(r292427)
+++ head/sys/dev/nand/nand_cdev.c	Fri Dec 18 05:55:24 2015	(r292428)
@@ -236,10 +236,10 @@ nand_strategy(struct bio *bp)
 	chip = dev->si_drv1;
 
 	nand_debug(NDBG_CDEV, "Strategy %s on chip %d [%p]\n",
-	    (bp->bio_cmd & BIO_READ) == BIO_READ ? "READ" : "WRITE",
+	    bp->bio_cmd == BIO_READ ? "READ" : "WRITE",
 	    chip->num, chip);
 
-	if ((bp->bio_cmd & BIO_READ) == BIO_READ) {
+	if (bp->bio_cmd == BIO_READ) {
 		err = nand_read(chip,
 		    bp->bio_offset & 0xffffffff,
 		    bp->bio_data, bp->bio_bcount);

Modified: head/sys/dev/nand/nand_geom.c
==============================================================================
--- head/sys/dev/nand/nand_geom.c	Fri Dec 18 05:45:49 2015	(r292427)
+++ head/sys/dev/nand/nand_geom.c	Fri Dec 18 05:55:24 2015	(r292428)
@@ -100,9 +100,9 @@ nand_strategy(struct bio *bp)
 	bp->bio_driver1 = BIO_NAND_STD;
 
 	nand_debug(NDBG_GEOM, "Strategy %s on chip %d [%p]",
-	    (bp->bio_cmd & BIO_READ) == BIO_READ ? "READ" :
-	    ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE ? "WRITE" :
-	    ((bp->bio_cmd & BIO_DELETE) == BIO_DELETE ? "DELETE" : "UNKNOWN")),
+	    bp->bio_cmd == BIO_READ ? "READ" :
+	    (bp->bio_cmd == BIO_WRITE ? "WRITE" :
+	    (bp->bio_cmd == BIO_DELETE ? "DELETE" : "UNKNOWN")),
 	    chip->num, chip);
 
 	mtx_lock(&chip->qlock);
@@ -122,9 +122,9 @@ nand_strategy_raw(struct bio *bp)
 	bp->bio_driver1 = BIO_NAND_RAW;
 
 	nand_debug(NDBG_GEOM, "Strategy %s on chip %d [%p]",
-	    (bp->bio_cmd & BIO_READ) == BIO_READ ? "READ" :
-	    ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE ? "WRITE" :
-	    ((bp->bio_cmd & BIO_DELETE) == BIO_DELETE ? "DELETE" : "UNKNOWN")),
+	    bp->bio_cmd == BIO_READ ? "READ" :
+	    (bp->bio_cmd == BIO_WRITE ? "WRITE" :
+	    (bp->bio_cmd == BIO_DELETE ? "DELETE" : "UNKNOWN")),
 	    chip->num, chip);
 
 	mtx_lock(&chip->qlock);
@@ -320,21 +320,21 @@ nand_io_proc(void *arg, int pending)
 			break;
 
 		if (bp->bio_driver1 == BIO_NAND_STD) {
-			if ((bp->bio_cmd & BIO_READ) == BIO_READ) {
+			if (bp->bio_cmd == BIO_READ) {
 				err = nand_read(chip,
 				    bp->bio_offset & 0xffffffff,
 				    bp->bio_data, bp->bio_bcount);
-			} else if ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE) {
+			} else if (bp->bio_cmd == BIO_WRITE) {
 				err = nand_write(chip,
 				    bp->bio_offset & 0xffffffff,
 				    bp->bio_data, bp->bio_bcount);
 			}
 		} else if (bp->bio_driver1 == BIO_NAND_RAW) {
-			if ((bp->bio_cmd & BIO_READ) == BIO_READ) {
+			if (bp->bio_cmd == BIO_READ) {
 				err = nand_read_raw(chip,
 				    bp->bio_offset & 0xffffffff,
 				    bp->bio_data, bp->bio_bcount);
-			} else if ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE) {
+			} else if (bp->bio_cmd == BIO_WRITE) {
 				err = nand_write_raw(chip,
 				    bp->bio_offset & 0xffffffff,
 				    bp->bio_data, bp->bio_bcount);
@@ -342,7 +342,7 @@ nand_io_proc(void *arg, int pending)
 		} else
 			panic("Unknown access type in bio->bio_driver1\n");
 
-		if ((bp->bio_cmd & BIO_DELETE) == BIO_DELETE) {
+		if (bp->bio_cmd == BIO_DELETE) {
 			nand_debug(NDBG_GEOM, "Delete on chip%d offset %lld "
 			    "length %ld\n", chip->num, bp->bio_offset,
 			    bp->bio_bcount);


More information about the svn-src-head mailing list