Module Name:    src
Committed By:   pooka
Date:           Wed Dec 23 01:04:46 UTC 2009

Modified Files:
        src/share/man/man4: ugen.4
        src/sys/arch/amd64/conf: GENERIC
        src/sys/arch/evbarm/conf: MPCSA_GENERIC
        src/sys/arch/evbppc/conf: OPENBLOCKS266_OPT
        src/sys/arch/i386/conf: ALL GENERIC XBOX
        src/sys/arch/iyonix/conf: GENERIC
        src/sys/dev/usb: files.usb ugen.c

Log Message:
unifdef -D UGEN_BULK_RA_WB

Default behaviour unchanged, the feature must still be explicitly
enabled for a ugen fd.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man4/ugen.4
cvs rdiff -u -r1.259 -r1.260 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/MPCSA_GENERIC
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT
cvs rdiff -u -r1.222 -r1.223 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.954 -r1.955 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/conf/XBOX
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/iyonix/conf/GENERIC
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/usb/files.usb
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/usb/ugen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/ugen.4
diff -u src/share/man/man4/ugen.4:1.28 src/share/man/man4/ugen.4:1.29
--- src/share/man/man4/ugen.4:1.28	Mon Dec 21 19:04:36 2009
+++ src/share/man/man4/ugen.4	Wed Dec 23 01:04:45 2009
@@ -1,4 +1,4 @@
-.\" $NetBSD: ugen.4,v 1.28 2009/12/21 19:04:36 gdt Exp $
+.\" $NetBSD: ugen.4,v 1.29 2009/12/23 01:04:45 pooka Exp $
 .\"
 .\" Copyright (c) 1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -35,7 +35,6 @@
 .Nd USB generic device support
 .Sh SYNOPSIS
 .Cd "ugen* at uhub? flags N"
-.Cd options UGEN_BULK_RA_WB
 .Sh DESCRIPTION
 The
 .Nm
@@ -109,29 +108,22 @@
 .Xr write 2
 should be used.
 All IO operations on a bulk endpoint are normally unbuffered.
-On kernels built with the
-.Dv UGEN_BULK_RA_WB
-option, the
+The
 .Dv USB_SET_BULK_RA
 and
 .Dv USB_SET_BULK_WB
 .Xr ioctl 2
-calls are available, and enable read-ahead and write-behind buffering
-respectively.
+calls enable read-ahead and write-behind buffering, respectively.
 This buffering supports fixed-sized USB transfers and is intended for
 devices with regular and continuing data transfers.
 When read-ahead or write-behind are enabled, the file descriptor
 may be set to use non-blocking IO.
 .Pp
-When in a
-.Dv UGEN_BULK_RA_WB
-mode,
+When in a read-ahead/writeback mode,
 .Xr select 2
 for read and write operates normally, returning true if there is data
 in the read buffer and space in the write buffer, respectively.
-When not in a
-.Dv UGEN_BULK_RA_WB
-mode,
+When not,
 .Xr select 2
 always returns true, because there is no way to predict how the device
 will respond to a read or write request.

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.259 src/sys/arch/amd64/conf/GENERIC:1.260
--- src/sys/arch/amd64/conf/GENERIC:1.259	Sat Dec  5 20:11:03 2009
+++ src/sys/arch/amd64/conf/GENERIC	Wed Dec 23 01:04:45 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.259 2009/12/05 20:11:03 pooka Exp $
+# $NetBSD: GENERIC,v 1.260 2009/12/23 01:04:45 pooka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.259 $"
+#ident 		"GENERIC-$Revision: 1.260 $"
 
 maxusers	64		# estimated number of users
 
@@ -905,8 +905,6 @@
 
 # USB Generic driver
 ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-options	UGEN_BULK_RA_WB
 
 # USB 3G datacards
 u3g*	at uhub? port ?

Index: src/sys/arch/evbarm/conf/MPCSA_GENERIC
diff -u src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.11 src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.12
--- src/sys/arch/evbarm/conf/MPCSA_GENERIC:1.11	Sat Dec  5 20:11:11 2009
+++ src/sys/arch/evbarm/conf/MPCSA_GENERIC	Wed Dec 23 01:04:46 2009
@@ -1,4 +1,4 @@
-# $NetBSD: MPCSA_GENERIC,v 1.11 2009/12/05 20:11:11 pooka Exp $
+# $NetBSD: MPCSA_GENERIC,v 1.12 2009/12/23 01:04:46 pooka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.11 $"
+#ident 		"GENERIC-$Revision: 1.12 $"
 
 maxusers	32		# estimated number of users
 
@@ -574,8 +574,6 @@
 
 # USB Generic driver
 #ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-#options UGEN_BULK_RA_WB
 
 
 # IrDA and Consumer Ir devices

Index: src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT
diff -u src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT:1.10 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT:1.11
--- src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT:1.10	Sat Jan  3 17:47:24 2009
+++ src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT	Wed Dec 23 01:04:46 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: OPENBLOCKS266_OPT,v 1.10 2009/01/03 17:47:24 christos Exp $
+#	$NetBSD: OPENBLOCKS266_OPT,v 1.11 2009/12/23 01:04:46 pooka Exp $
 #
 
 include		"arch/evbppc/conf/OPENBLOCKS266"
@@ -264,9 +264,6 @@
 
 # USB Generic driver
 ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-options UGEN_BULK_RA_WB
-
 
 # CardBus IEEE1394 controllers
 fwohci*	at cardbus? function ?		# IEEE1394 Open Host Controller

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.222 src/sys/arch/i386/conf/ALL:1.223
--- src/sys/arch/i386/conf/ALL:1.222	Sat Dec  5 20:11:15 2009
+++ src/sys/arch/i386/conf/ALL	Wed Dec 23 01:04:46 2009
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.222 2009/12/05 20:11:15 pooka Exp $
+# $NetBSD: ALL,v 1.223 2009/12/23 01:04:46 pooka Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.222 $"
+#ident 		"ALL-$Revision: 1.223 $"
 
 maxusers	64		# estimated number of users
 
@@ -1288,8 +1288,6 @@
 
 # USB Generic driver
 ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-options 	UGEN_BULK_RA_WB
 
 # USB 3G datacards
 u3g*	at uhub? port ?

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.954 src/sys/arch/i386/conf/GENERIC:1.955
--- src/sys/arch/i386/conf/GENERIC:1.954	Sat Dec  5 20:11:15 2009
+++ src/sys/arch/i386/conf/GENERIC	Wed Dec 23 01:04:46 2009
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.954 2009/12/05 20:11:15 pooka Exp $
+# $NetBSD: GENERIC,v 1.955 2009/12/23 01:04:46 pooka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.954 $"
+#ident 		"GENERIC-$Revision: 1.955 $"
 
 maxusers	64		# estimated number of users
 
@@ -1234,8 +1234,6 @@
 
 # USB Generic driver
 ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-options 	UGEN_BULK_RA_WB
 
 # USB 3G datacards
 u3g*	at uhub? port ?

Index: src/sys/arch/i386/conf/XBOX
diff -u src/sys/arch/i386/conf/XBOX:1.16 src/sys/arch/i386/conf/XBOX:1.17
--- src/sys/arch/i386/conf/XBOX:1.16	Fri Mar 27 21:04:35 2009
+++ src/sys/arch/i386/conf/XBOX	Wed Dec 23 01:04:46 2009
@@ -1,4 +1,4 @@
-# $NetBSD: XBOX,v 1.16 2009/03/27 21:04:35 ad Exp $
+# $NetBSD: XBOX,v 1.17 2009/12/23 01:04:46 pooka Exp $
 #
 # XBOX -- A basic Microsoft XBox kernel config file.
 #
@@ -244,8 +244,6 @@
 
 # USB Generic driver
 ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-options UGEN_BULK_RA_WB
 
 
 # Audio Devices

Index: src/sys/arch/iyonix/conf/GENERIC
diff -u src/sys/arch/iyonix/conf/GENERIC:1.56 src/sys/arch/iyonix/conf/GENERIC:1.57
--- src/sys/arch/iyonix/conf/GENERIC:1.56	Sat Dec  5 20:11:15 2009
+++ src/sys/arch/iyonix/conf/GENERIC	Wed Dec 23 01:04:46 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC,v 1.56 2009/12/05 20:11:15 pooka Exp $
+#	$NetBSD: GENERIC,v 1.57 2009/12/23 01:04:46 pooka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.56 $"
+#ident 		"GENERIC-$Revision: 1.57 $"
 
 maxusers	32		# estimated number of users
 
@@ -647,8 +647,6 @@
 
 # USB Generic driver
 #ugen*	at uhub? port ?
-# On ugen bulk endpoints, perform read-ahead and write-behind.
-#options UGEN_BULK_RA_WB
 
 
 # IrDA and Consumer Ir devices

Index: src/sys/dev/usb/files.usb
diff -u src/sys/dev/usb/files.usb:1.92 src/sys/dev/usb/files.usb:1.93
--- src/sys/dev/usb/files.usb:1.92	Mon Nov 30 16:18:34 2009
+++ src/sys/dev/usb/files.usb	Wed Dec 23 01:04:45 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.usb,v 1.92 2009/11/30 16:18:34 tsutsui Exp $
+#	$NetBSD: files.usb,v 1.93 2009/12/23 01:04:45 pooka Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
@@ -54,7 +54,6 @@
 
 
 # Generic devices
-defflag UGEN_BULK_RA_WB
 device	ugen
 attach	ugen at usbdevif
 file	dev/usb/ugen.c			ugen			needs-flag

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.106 src/sys/dev/usb/ugen.c:1.107
--- src/sys/dev/usb/ugen.c:1.106	Sun Dec  6 21:40:31 2009
+++ src/sys/dev/usb/ugen.c	Wed Dec 23 01:04:45 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.106 2009/12/06 21:40:31 dyoung Exp $	*/
+/*	$NetBSD: ugen.c,v 1.107 2009/12/23 01:04:45 pooka Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.106 2009/12/06 21:40:31 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.107 2009/12/23 01:04:45 pooka Exp $");
 
 #include "opt_ugen_bulk_ra_wb.h"
 #include "opt_compat_netbsd.h"
@@ -107,13 +107,11 @@
 	u_char *limit;		/* end of circular buffer (isoc) */
 	u_char *cur;		/* current read location (isoc) */
 	u_int32_t timeout;
-#ifdef UGEN_BULK_RA_WB
 	u_int32_t ra_wb_bufsize; /* requested size for RA/WB buffer */
 	u_int32_t ra_wb_reqsize; /* requested xfer length for RA/WB */
 	u_int32_t ra_wb_used;	 /* how much is in buffer */
 	u_int32_t ra_wb_xferlen; /* current xfer length for RA/WB */
 	usbd_xfer_handle ra_wb_xfer;
-#endif
 	struct isoreq {
 		struct ugen_endpoint *sce;
 		usbd_xfer_handle xfer;
@@ -183,12 +181,10 @@
 		     usbd_status status);
 Static void ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr,
 			    usbd_status status);
-#ifdef UGEN_BULK_RA_WB
 Static void ugen_bulkra_intr(usbd_xfer_handle xfer, usbd_private_handle addr,
 			     usbd_status status);
 Static void ugen_bulkwb_intr(usbd_xfer_handle xfer, usbd_private_handle addr,
 			     usbd_status status);
-#endif
 Static int ugen_do_read(struct ugen_softc *, int, struct uio *, int);
 Static int ugen_do_write(struct ugen_softc *, int, struct uio *, int);
 Static int ugen_do_ioctl(struct ugen_softc *, int, u_long,
@@ -441,14 +437,12 @@
 				  edesc->bEndpointAddress, 0, &sce->pipeh);
 			if (err)
 				return (EIO);
-#ifdef UGEN_BULK_RA_WB
 			sce->ra_wb_bufsize = UGEN_BULK_RA_WB_BUFSIZE;
 			/* 
 			 * Use request size for non-RA/WB transfers
 			 * as the default.
 			 */
 			sce->ra_wb_reqsize = UGEN_BBSIZE;
-#endif
 			break;
 		case UE_ISOCHRONOUS:
 			if (dir == OUT)
@@ -554,13 +548,11 @@
 			for (i = 0; i < UGEN_NISOREQS; ++i)
 				usbd_free_xfer(sce->isoreqs[i].xfer);
 			break;
-#ifdef UGEN_BULK_RA_WB
 		case UE_BULK:
 			if (sce->state & (UGEN_BULK_RA | UGEN_BULK_WB))
 				/* ibuf freed below */
 				usbd_free_xfer(sce->ra_wb_xfer);
 			break;
-#endif
 		default:
 			break;
 		}
@@ -644,7 +636,6 @@
 		}
 		break;
 	case UE_BULK:
-#ifdef UGEN_BULK_RA_WB
 		if (sce->state & UGEN_BULK_RA) {
 			DPRINTFN(5, ("ugenread: BULK_RA req: %zd used: %d\n",
 				     uio->uio_resid, sce->ra_wb_used));
@@ -717,7 +708,6 @@
 			splx(s);
 			break;
 		}
-#endif
 		xfer = usbd_alloc_xfer(sc->sc_udev);
 		if (xfer == 0)
 			return (ENOMEM);
@@ -813,11 +803,9 @@
 	struct ugen_endpoint *sce = &sc->sc_endpoints[endpt][OUT];
 	u_int32_t n;
 	int error = 0;
-#ifdef UGEN_BULK_RA_WB
 	int s;
 	u_int32_t tn;
 	char *dbuf;
-#endif
 	usbd_xfer_handle xfer;
 	usbd_status err;
 
@@ -842,7 +830,6 @@
 
 	switch (sce->edesc->bmAttributes & UE_XFERTYPE) {
 	case UE_BULK:
-#ifdef UGEN_BULK_RA_WB
 		if (sce->state & UGEN_BULK_WB) {
 			DPRINTFN(5, ("ugenwrite: BULK_WB req: %zd used: %d\n",
 				     uio->uio_resid, sce->ra_wb_used));
@@ -924,7 +911,6 @@
 			splx(s);
 			break;
 		}
-#endif
 		xfer = usbd_alloc_xfer(sc->sc_udev);
 		if (xfer == 0)
 			return (EIO);
@@ -1169,7 +1155,6 @@
 	selnotify(&sce->rsel, 0, 0);
 }
 
-#ifdef UGEN_BULK_RA_WB
 Static void
 ugen_bulkra_intr(usbd_xfer_handle xfer, usbd_private_handle addr,
 		 usbd_status status)
@@ -1301,7 +1286,6 @@
 	}
 	selnotify(&sce->rsel, 0, 0);
 }
-#endif
 
 Static usbd_status
 ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno)
@@ -1453,7 +1437,6 @@
 		sce->timeout = *(int *)addr;
 		return (0);
 	case USB_SET_BULK_RA:
-#ifdef UGEN_BULK_RA_WB
 		if (endpt == USB_CONTROL_ENDPOINT)
 			return (EINVAL);
 		sce = &sc->sc_endpoints[endpt][IN];
@@ -1522,11 +1505,7 @@
 			sce->ibuf = NULL;
 		}
 		return (0);
-#else
-		return (EOPNOTSUPP);
-#endif
 	case USB_SET_BULK_WB:
-#ifdef UGEN_BULK_RA_WB
 		if (endpt == USB_CONTROL_ENDPOINT)
 			return (EINVAL);
 		sce = &sc->sc_endpoints[endpt][OUT];
@@ -1580,12 +1559,8 @@
 			sce->ibuf = NULL;
 		}
 		return (0);
-#else
-		return (EOPNOTSUPP);
-#endif
 	case USB_SET_BULK_RA_OPT:
 	case USB_SET_BULK_WB_OPT:
-#ifdef UGEN_BULK_RA_WB
 	{
 		struct usb_bulk_ra_wb_opt *opt;
 
@@ -1612,9 +1587,6 @@
 		sce->ra_wb_reqsize = opt->ra_wb_request_size;
 		return (0);
 	}
-#else
-		return (EOPNOTSUPP);
-#endif
 	default:
 		break;
 	}
@@ -1905,7 +1877,6 @@
 				selrecord(l, &sce_in->rsel);
 			break;
 		case UE_BULK:
-#ifdef UGEN_BULK_RA_WB
 			if (sce_in->state & UGEN_BULK_RA) {
 				if (sce_in->ra_wb_used > 0)
 					revents |= events &
@@ -1914,7 +1885,6 @@
 					selrecord(l, &sce_in->rsel);
 				break;
 			}
-#endif
 			/*
 			 * We have no easy way of determining if a read will
 			 * yield any data or a write will happen.
@@ -1932,7 +1902,6 @@
 			/* XXX unimplemented */
 			break;
 		case UE_BULK:
-#ifdef UGEN_BULK_RA_WB
 			if (sce_out->state & UGEN_BULK_WB) {
 				if (sce_out->ra_wb_used <
 				    sce_out->limit - sce_out->ibuf)
@@ -1942,7 +1911,6 @@
 					selrecord(l, &sce_out->rsel);
 				break;
 			}
-#endif
 			/*
 			 * We have no easy way of determining if a read will
 			 * yield any data or a write will happen.
@@ -1996,7 +1964,6 @@
 	return (1);
 }
 
-#ifdef UGEN_BULK_RA_WB
 static int
 filt_ugenread_bulk(struct knote *kn, long hint)
 {
@@ -2038,7 +2005,6 @@
 
 	return (1);
 }
-#endif
 
 static const struct filterops ugenread_intr_filtops =
 	{ 1, NULL, filt_ugenrdetach, filt_ugenread_intr };
@@ -2046,16 +2012,11 @@
 static const struct filterops ugenread_isoc_filtops =
 	{ 1, NULL, filt_ugenrdetach, filt_ugenread_isoc };
 
-#ifdef UGEN_BULK_RA_WB
 static const struct filterops ugenread_bulk_filtops =
 	{ 1, NULL, filt_ugenrdetach, filt_ugenread_bulk };
 
 static const struct filterops ugenwrite_bulk_filtops =
 	{ 1, NULL, filt_ugenrdetach, filt_ugenwrite_bulk };
-#else
-static const struct filterops ugen_seltrue_filtops =
-	{ 1, NULL, filt_ugenrdetach, filt_seltrue };
-#endif
 
 int
 ugenkqfilter(dev_t dev, struct knote *kn)
@@ -2085,17 +2046,8 @@
 			kn->kn_fop = &ugenread_isoc_filtops;
 			break;
 		case UE_BULK:
-#ifdef UGEN_BULK_RA_WB
 			kn->kn_fop = &ugenread_bulk_filtops;
 			break;
-#else
-			/*
-			 * We have no easy way of determining if a read will
-			 * yield any data or a write will happen.
-			 * So, emulate "seltrue".
-			 */
-			kn->kn_fop = &ugen_seltrue_filtops;
-#endif
 			break;
 		default:
 			return (EINVAL);
@@ -2115,16 +2067,7 @@
 			return (EINVAL);
 
 		case UE_BULK:
-#ifdef UGEN_BULK_RA_WB
 			kn->kn_fop = &ugenwrite_bulk_filtops;
-#else
-			/*
-			 * We have no easy way of determining if a read will
-			 * yield any data or a write will happen.
-			 * So, emulate "seltrue".
-			 */
-			kn->kn_fop = &ugen_seltrue_filtops;
-#endif
 			break;
 		default:
 			return (EINVAL);

Reply via email to