svn commit: r188094 - in projects/vap7/sys: . contrib/pf dev dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210 dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212 dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54...

Sam Leffler sam at FreeBSD.org
Tue Feb 3 11:49:29 PST 2009


Author: sam
Date: Tue Feb  3 19:49:26 2009
New Revision: 188094
URL: http://svn.freebsd.org/changeset/base/188094

Log:
  merge r188086: reorg ioctl code to simplify adding new requests

Modified:
  projects/vap7/sys/   (props changed)
  projects/vap7/sys/contrib/pf/   (props changed)
  projects/vap7/sys/dev/   (props changed)
  projects/vap7/sys/dev/ath/   (props changed)
  projects/vap7/sys/dev/ath/ath_hal/   (props changed)
  projects/vap7/sys/dev/ath/ath_hal/ar5210/   (props changed)
  projects/vap7/sys/dev/ath/ath_hal/ar5211/   (props changed)
  projects/vap7/sys/dev/ath/ath_hal/ar5212/   (props changed)
  projects/vap7/sys/dev/ath/ath_hal/ar5312/   (props changed)
  projects/vap7/sys/dev/ath/ath_hal/ar5416/   (props changed)
  projects/vap7/sys/dev/cfi/cfi_dev.c
  projects/vap7/sys/dev/cxgb/   (props changed)
  projects/vap7/sys/dev/usb2/   (props changed)
  projects/vap7/sys/i386/conf/USB2   (props changed)
  projects/vap7/sys/modules/usb2/   (props changed)
  projects/vap7/sys/net80211/   (props changed)

Modified: projects/vap7/sys/dev/cfi/cfi_dev.c
==============================================================================
--- projects/vap7/sys/dev/cfi/cfi_dev.c	Tue Feb  3 19:49:21 2009	(r188093)
+++ projects/vap7/sys/dev/cfi/cfi_dev.c	Tue Feb  3 19:49:26 2009	(r188094)
@@ -252,26 +252,31 @@ cfi_devioctl(struct cdev *dev, u_long cm
 	int error;
 	u_char val;
 
-	if (cmd != CFIOCQRY)
-		return (ENOIOCTL);
-
 	sc = dev->si_drv1;
+	error = 0;
 
-	error = (sc->sc_writing) ? cfi_block_finish(sc) : 0;
-	if (error)
-		return (error);
-
-	rq = (struct cfiocqry *)data;
-
-	if (rq->offset >= sc->sc_size / sc->sc_width)
-		return (ESPIPE);
-	if (rq->offset + rq->count > sc->sc_size / sc->sc_width)
-		return (ENOSPC);
-
-	while (!error && rq->count--) {
-		val = cfi_read_qry(sc, rq->offset++);
-		error = copyout(&val, rq->buffer++, 1);
+	switch(cmd) {
+	case CFIOCQRY:
+		if (sc->sc_writing) {
+			error = cfi_block_finish(sc);
+			if (error)
+				break;
+		}
+
+		rq = (struct cfiocqry *)data;
+		if (rq->offset >= sc->sc_size / sc->sc_width)
+			return (ESPIPE);
+		if (rq->offset + rq->count > sc->sc_size / sc->sc_width)
+			return (ENOSPC);
+
+		while (!error && rq->count--) {
+			val = cfi_read_qry(sc, rq->offset++);
+			error = copyout(&val, rq->buffer++, 1);
+		}
+		break;
+	default:
+		error = ENOIOCTL;
+		break;
 	}
-
 	return (error);
 }


More information about the svn-src-projects mailing list