Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Apr 2004 20:30:40 -0800 (PST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 50233 for review
Message-ID:  <200404030430.i334Uesh012018@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=50233

Change 50233 by rwatson@rwatson_paprika on 2004/04/02 20:30:17

	- twa becomes i386-only, I think.
	- many if_ath and 802.11 fixes
	- syscons fixed on sparc64 so that make_dev() is called less early.  
	- various producer/consumer ring changes in if_rl, if_ste.

Affected files ...

.. //depot/projects/netperf_socket/sys/conf/NOTES#12 integrate
.. //depot/projects/netperf_socket/sys/dev/ath/if_ath.c#5 integrate
.. //depot/projects/netperf_socket/sys/dev/ath/if_ath_pci.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/ath/if_athioctl.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/ath/if_athvar.h#3 integrate
.. //depot/projects/netperf_socket/sys/dev/kbd/kbd.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/syscons/syscons.c#4 integrate
.. //depot/projects/netperf_socket/sys/dev/twa/twa.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/twa/twa_freebsd.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/twa/twa_includes.h#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_cpu_sparc64.c#3 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_dev_ns8250.c#2 integrate
.. //depot/projects/netperf_socket/sys/dev/uart/uart_kbd_sun.c#2 integrate
.. //depot/projects/netperf_socket/sys/i386/conf/NOTES#13 integrate
.. //depot/projects/netperf_socket/sys/kern/kern_thr.c#4 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211.c#3 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_input.c#2 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_node.c#3 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_node.h#2 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_output.c#2 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_proto.c#3 integrate
.. //depot/projects/netperf_socket/sys/net80211/ieee80211_var.h#3 integrate
.. //depot/projects/netperf_socket/sys/pci/if_rl.c#6 integrate
.. //depot/projects/netperf_socket/sys/pci/if_ste.c#9 integrate
.. //depot/projects/netperf_socket/sys/pci/if_stereg.h#3 integrate

Differences ...

==== //depot/projects/netperf_socket/sys/conf/NOTES#12 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1211 2004/03/31 18:46:13 vkashyap Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1212 2004/04/02 18:50:56 vkashyap Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -1388,14 +1388,6 @@
 device		twe		# 3ware ATA RAID
 
 #
-# 3ware 9000 series PATA/SATA RAID controller driver and options.
-# The driver is implemented as a SIM, and so, needs the CAM infrastructure.
-#
-options		TWA_DEBUG		# 0-10; 10 prints the most messages.
-options		TWA_FLASH_FIRMWARE	# firmware image bundled when defined.
-device		twa			# 3ware 9000 series PATA/SATA RAID
-
-#
 # The 'ATA' driver supports all ATA and ATAPI devices, including PC Card
 # devices. You only need one "device ata" for it to find all
 # PCI and PC Card ATA/ATAPI devices on modern machines.

==== //depot/projects/netperf_socket/sys/dev/ath/if_ath.c#5 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.47 2004/04/01 00:38:45 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.53 2004/04/03 00:06:23 sam Exp $");
 
 /*
  * Driver for the Atheros Wireless LAN controller.
@@ -270,7 +270,6 @@
 
 	TASK_INIT(&sc->sc_txtask, 0, ath_tx_proc, sc);
 	TASK_INIT(&sc->sc_rxtask, 0, ath_rx_proc, sc);
-	TASK_INIT(&sc->sc_swbatask, 0, ath_beacon_proc, sc);
 	TASK_INIT(&sc->sc_rxorntask, 0, ath_rxorn_proc, sc);
 	TASK_INIT(&sc->sc_fataltask, 0, ath_fatal_proc, sc);
 	TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc);
@@ -288,7 +287,7 @@
 	);
 	if (sc->sc_txhalq == (u_int) -1) {
 		if_printf(ifp, "unable to setup a data xmit queue!\n");
-		goto bad;
+		goto bad2;
 	}
 	sc->sc_bhalq = ath_hal_setuptxqueue(ah,
 		HAL_TX_QUEUE_BEACON,
@@ -296,7 +295,7 @@
 	);
 	if (sc->sc_bhalq == (u_int) -1) {
 		if_printf(ifp, "unable to setup a beacon xmit queue!\n");
-		goto bad;
+		goto bad2;
 	}
 
 	ifp->if_softc = sc;
@@ -317,7 +316,7 @@
 		| IEEE80211_C_HOSTAP		/* hostap mode */
 		| IEEE80211_C_MONITOR		/* monitor mode */
 		| IEEE80211_C_SHPREAMBLE	/* short preamble supported */
-		| IEEE80211_C_RCVMGT;		/* recv management frames */
+		;
 
 	/* get mac address from hardware */
 	ath_hal_getmac(ah, ic->ic_myaddr);
@@ -326,7 +325,9 @@
 	ieee80211_ifattach(ifp);
 	/* override default methods */
 	ic->ic_node_alloc = ath_node_alloc;
+	sc->sc_node_free = ic->ic_node_free;
 	ic->ic_node_free = ath_node_free;
+	sc->sc_node_copy = ic->ic_node_copy;
 	ic->ic_node_copy = ath_node_copy;
 	ic->ic_node_getrssi = ath_node_getrssi;
 	sc->sc_newstate = ic->ic_newstate;
@@ -355,6 +356,8 @@
 	sc->sc_rx_th.wr_ihdr.it_present = htole32(ATH_RX_RADIOTAP_PRESENT);
 
 	return 0;
+bad2:
+	ath_desc_free(sc);
 bad:
 	if (ah)
 		ath_hal_detach(ah);
@@ -432,6 +435,8 @@
 		DPRINTF(ATH_DEBUG_ANY, ("%s: invalid; ignored\n", __func__));
 		return;
 	}
+	if (!ath_hal_intrpend(ah))		/* shared irq, not for us */
+		return;
 	if ((ifp->if_flags & (IFF_RUNNING|IFF_UP)) != (IFF_RUNNING|IFF_UP)) {
 		DPRINTF(ATH_DEBUG_ANY, ("%s: if_flags 0x%x\n",
 			__func__, ifp->if_flags));
@@ -476,8 +481,14 @@
 			taskqueue_enqueue(taskqueue_swi, &sc->sc_rxtask);
 		if (status & HAL_INT_TX)
 			taskqueue_enqueue(taskqueue_swi, &sc->sc_txtask);
-		if (status & HAL_INT_SWBA)
-			taskqueue_enqueue(taskqueue_swi, &sc->sc_swbatask);
+		if (status & HAL_INT_SWBA) {
+			/*
+			 * Handle beacon transmission directly; deferring
+			 * this is too slow to meet timing constraints
+			 * under load.
+			 */
+			ath_beacon_proc(sc, 0);
+		}
 		if (status & HAL_INT_BMISS) {
 			sc->sc_stats.ast_bmiss++;
 			taskqueue_enqueue(taskqueue_swi, &sc->sc_bmisstask);
@@ -1507,14 +1518,18 @@
 		if (bf->bf_node == ni)
 			bf->bf_node = NULL;
 	}
-	free(ni, M_DEVBUF);
+	(*sc->sc_node_free)(ic, ni);
 }
 
 static void
 ath_node_copy(struct ieee80211com *ic,
 	struct ieee80211_node *dst, const struct ieee80211_node *src)
 {
-	*(struct ath_node *)dst = *(const struct ath_node *)src;
+        struct ath_softc *sc = ic->ic_if.if_softc;
+
+	memcpy(&dst[1], &src[1],
+		sizeof(struct ath_node) - sizeof(struct ieee80211_node));
+	(*sc->sc_node_copy)(ic, dst, src);
 }
 
 

==== //depot/projects/netperf_socket/sys/dev/ath/if_ath_pci.c#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath_pci.c,v 1.7 2004/03/17 17:50:27 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath_pci.c,v 1.8 2004/04/02 23:57:10 sam Exp $");
 
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.

==== //depot/projects/netperf_socket/sys/dev/ath/if_athioctl.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGES.
  *
- * $FreeBSD: src/sys/dev/ath/if_athioctl.h,v 1.5 2003/12/28 07:00:32 sam Exp $
+ * $FreeBSD: src/sys/dev/ath/if_athioctl.h,v 1.7 2004/04/02 23:57:10 sam Exp $
  */
 
 /*
@@ -70,6 +70,8 @@
 	u_int32_t	ast_tx_rts;	/* tx frames with rts enabled */
 	u_int32_t	ast_tx_cts;	/* tx frames with cts enabled */
 	u_int32_t	ast_tx_shortpre;/* tx frames with short preamble */
+	u_int32_t	ast_tx_altrate;	/* tx frames with alternate rate */
+	u_int32_t	ast_tx_protect;	/* tx frames with protection */
 	u_int32_t	ast_rx_nombuf;	/* rx setup failed 'cuz no mbuf */
 	u_int32_t	ast_rx_busdma;	/* rx setup failed for dma resrcs */
 	u_int32_t	ast_rx_orn;	/* rx failed 'cuz of desc overrun */
@@ -79,6 +81,7 @@
 	u_int32_t	ast_rx_phyerr;	/* rx failed 'cuz of PHY err */
 	u_int32_t	ast_rx_phy[32];	/* rx PHY error per-code counts */
 	u_int32_t	ast_rx_tooshort;/* rx discarded 'cuz frame too short */
+	u_int32_t	ast_rx_toobig;	/* rx discarded 'cuz frame too large */
 	u_int32_t	ast_rx_ctl;	/* rx discarded 'cuz ctl frame */
 	u_int32_t	ast_be_nombuf;	/* beacon setup failed 'cuz no mbuf */
 	u_int32_t	ast_per_cal;	/* periodic calibration calls */

==== //depot/projects/netperf_socket/sys/dev/ath/if_athvar.h#3 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
+ * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGES.
  *
- * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.11 2004/04/01 00:38:45 sam Exp $
+ * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.14 2004/04/03 03:33:02 sam Exp $
  */
 
 /*
@@ -93,6 +93,11 @@
 	struct ieee80211com	sc_ic;		/* IEEE 802.11 common */
 	int			(*sc_newstate)(struct ieee80211com *,
 					enum ieee80211_state, int);
+	void 			(*sc_node_free)(struct ieee80211com *,
+					struct ieee80211_node *);
+	void			(*sc_node_copy)(struct ieee80211com *,
+					struct ieee80211_node *,
+					const struct ieee80211_node *);
 	device_t		sc_dev;
 	bus_space_tag_t		sc_st;		/* bus space tag */
 	bus_space_handle_t	sc_sh;		/* bus space handle */
@@ -147,7 +152,6 @@
 	u_int			sc_bhalq;	/* HAL q for outgoing beacons */
 	struct ath_buf		*sc_bcbuf;	/* beacon buffer */
 	struct ath_buf		*sc_bufptr;	/* allocated buffer ptr */
-	struct task		sc_swbatask;	/* swba int processing */
 	struct task		sc_bmisstask;	/* bmiss int processing */
 
 	struct callout		sc_cal_ch;	/* callout handle for cals */

==== //depot/projects/netperf_socket/sys/dev/kbd/kbd.c#3 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/kbd/kbd.c,v 1.39 2004/02/21 21:10:43 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/kbd/kbd.c,v 1.41 2004/04/02 16:41:16 des Exp $");
 
 #include "opt_kbd.h"
 
@@ -56,7 +56,7 @@
 } genkbd_softc_t;
 
 static	SLIST_HEAD(, keyboard_driver) keyboard_drivers =
- 	SLIST_HEAD_INITIALIZER(keyboard_drivers);
+	SLIST_HEAD_INITIALIZER(keyboard_drivers);
 
 SET_DECLARE(kbddriver_set, const keyboard_driver_t);
 
@@ -94,14 +94,14 @@
 	new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO);
 	if (new_kbd == NULL) {
 		splx(s);
-		return ENOMEM;
+		return (ENOMEM);
 	}
 	new_kbdsw = malloc(sizeof(*new_kbdsw)*newsize, M_DEVBUF,
 			    M_NOWAIT|M_ZERO);
 	if (new_kbdsw == NULL) {
 		free(new_kbd, M_DEVBUF);
 		splx(s);
-		return ENOMEM;
+		return (ENOMEM);
 	}
 	bcopy(keyboard, new_kbd, sizeof(*keyboard)*keyboards);
 	bcopy(kbdsw, new_kbdsw, sizeof(*kbdsw)*keyboards);
@@ -117,7 +117,7 @@
 	if (bootverbose)
 		printf("kbd: new array size %d\n", keyboards);
 
-	return 0;
+	return (0);
 }
 
 /*
@@ -166,9 +166,9 @@
 kbd_add_driver(keyboard_driver_t *driver)
 {
 	if (SLIST_NEXT(driver, link))
-		return EINVAL;
+		return (EINVAL);
 	SLIST_INSERT_HEAD(&keyboard_drivers, driver, link);
-	return 0;
+	return (0);
 }
 
 int
@@ -176,7 +176,7 @@
 {
 	SLIST_REMOVE(&keyboard_drivers, driver, keyboard_driver, link);
 	SLIST_NEXT(driver, link) = NULL;
-	return 0;
+	return (0);
 }
 
 /* register a keyboard and associate it with a function table */
@@ -193,7 +193,7 @@
 	}
 	if (index >= keyboards) {
 		if (kbd_realloc_array())
-			return -1;
+			return (-1);
 	}
 
 	kbd->kb_index = index;
@@ -208,7 +208,7 @@
 		if (strcmp(p->name, kbd->kb_name) == 0) {
 			keyboard[index] = kbd;
 			kbdsw[index] = p->kbdsw;
-			return index;
+			return (index);
 		}
 	}
 	SET_FOREACH(list, kbddriver_set) {
@@ -216,11 +216,11 @@
 		if (strcmp(p->name, kbd->kb_name) == 0) {
 			keyboard[index] = kbd;
 			kbdsw[index] = p->kbdsw;
-			return index;
+			return (index);
 		}
 	}
 
-	return -1;
+	return (-1);
 }
 
 int
@@ -230,21 +230,21 @@
 	int s;
 
 	if ((kbd->kb_index < 0) || (kbd->kb_index >= keyboards))
-		return ENOENT;
+		return (ENOENT);
 	if (keyboard[kbd->kb_index] != kbd)
-		return ENOENT;
+		return (ENOENT);
 
 	s = spltty();
 	if (KBD_IS_BUSY(kbd)) {
 		error = (*kbd->kb_callback.kc_func)(kbd, KBDIO_UNLOADING,
-						    kbd->kb_callback.kc_arg);
+		    kbd->kb_callback.kc_arg);
 		if (error) {
 			splx(s);
-			return error;
+			return (error);
 		}
 		if (KBD_IS_BUSY(kbd)) {
 			splx(s);
-			return EBUSY;
+			return (EBUSY);
 		}
 	}
 	KBD_INVALID(kbd);
@@ -252,7 +252,7 @@
 	kbdsw[kbd->kb_index] = NULL;
 
 	splx(s);
-	return 0;
+	return (0);
 }
 
 /* find a funciton table by the driver name */
@@ -264,15 +264,15 @@
 
 	SLIST_FOREACH(p, &keyboard_drivers, link) {
 		if (strcmp(p->name, driver) == 0)
-			return p->kbdsw;
+			return (p->kbdsw);
 	}
 	SET_FOREACH(list, kbddriver_set) {
 		p = *list;
 		if (strcmp(p->name, driver) == 0)
-			return p->kbdsw;
+			return (p->kbdsw);
 	}
 
-	return NULL;
+	return (NULL);
 }
 
 /*
@@ -297,9 +297,9 @@
 			continue;
 		if ((unit != -1) && (keyboard[i]->kb_unit != unit))
 			continue;
-		return i;
+		return (i);
 	}
-	return -1;
+	return (-1);
 }
 
 /* allocate a keyboard */
@@ -311,14 +311,14 @@
 	int s;
 
 	if (func == NULL)
-		return -1;
+		return (-1);
 
 	s = spltty();
 	index = kbd_find_keyboard(driver, unit);
 	if (index >= 0) {
 		if (KBD_IS_BUSY(keyboard[index])) {
 			splx(s);
-			return -1;
+			return (-1);
 		}
 		keyboard[index]->kb_token = id;
 		KBD_BUSY(keyboard[index]);
@@ -327,7 +327,7 @@
 		(*kbdsw[index]->clear_state)(keyboard[index]);
 	}
 	splx(s);
-	return index;
+	return (index);
 }
 
 int
@@ -350,7 +350,7 @@
 		error = 0;
 	}
 	splx(s);
-	return error;
+	return (error);
 }
 
 int
@@ -373,7 +373,7 @@
 		error = 0;
 	}
 	splx(s);
-	return error;
+	return (error);
 }
 
 /* get a keyboard structure */
@@ -381,12 +381,12 @@
 *kbd_get_keyboard(int index)
 {
 	if ((index < 0) || (index >= keyboards))
-		return NULL;
+		return (NULL);
 	if (keyboard[index] == NULL)
-		return NULL;
+		return (NULL);
 	if (!KBD_IS_VALID(keyboard[index]))
-		return NULL;
-	return keyboard[index];
+		return (NULL);
+	return (keyboard[index]);
 }
 
 /*
@@ -411,7 +411,7 @@
 			(*p->configure)(flags);
 	}
 
-	return 0;
+	return (0);
 }
 
 #ifdef KBD_INSTALL_CDEV
@@ -449,17 +449,17 @@
 {
 
 	if (kbd->kb_index >= keyboards)
-		return EINVAL;
+		return (EINVAL);
 	if (keyboard[kbd->kb_index] != kbd)
-		return EINVAL;
+		return (EINVAL);
 
-	kbd->kb_dev = make_dev(&kbd_cdevsw, kbd->kb_index, UID_ROOT, GID_WHEEL, 0600,
-		       "%s%r", kbd->kb_name, kbd->kb_unit);
+	kbd->kb_dev = make_dev(&kbd_cdevsw, kbd->kb_index, UID_ROOT, GID_WHEEL,
+	    0600, "%s%r", kbd->kb_name, kbd->kb_unit);
 	make_dev_alias(kbd->kb_dev, "kbd%r", kbd->kb_index);
 	kbd->kb_dev->si_drv1 = malloc(sizeof(genkbd_softc_t), M_DEVBUF,
-			      M_WAITOK | M_ZERO);
+	    M_WAITOK | M_ZERO);
 	printf("kbd%d at %s%d\n", kbd->kb_index, kbd->kb_name, kbd->kb_unit);
-	return 0;
+	return (0);
 }
 
 int
@@ -467,14 +467,14 @@
 {
 
 	if (kbd->kb_index >= keyboards)
-		return EINVAL;
+		return (EINVAL);
 	if (keyboard[kbd->kb_index] != kbd)
-		return EINVAL;
+		return (EINVAL);
 
 	free(kbd->kb_dev->si_drv1, M_DEVBUF);
 	destroy_dev(kbd->kb_dev);
 
-	return 0;
+	return (0);
 }
 
 /*
@@ -501,13 +501,13 @@
 	kbd = kbd_get_keyboard(KBD_INDEX(dev));
 	if ((sc == NULL) || (kbd == NULL) || !KBD_IS_VALID(kbd)) {
 		splx(s);
-		return ENXIO;
+		return (ENXIO);
 	}
 	i = kbd_allocate(kbd->kb_name, kbd->kb_unit, sc,
-			 genkbd_event, (void *)sc);
+	    genkbd_event, (void *)sc);
 	if (i < 0) {
 		splx(s);
-		return EBUSY;
+		return (EBUSY);
 	}
 	/* assert(i == kbd->kb_index) */
 	/* assert(kbd == kbd_get_keyboard(i)) */
@@ -523,7 +523,7 @@
 	clist_alloc_cblocks(&sc->gkb_q, KB_QSIZE, KB_QSIZE/2); /* XXX */
 	splx(s);
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -549,7 +549,7 @@
 #endif
 	}
 	splx(s);
-	return 0;
+	return (0);
 }
 
 static int
@@ -568,24 +568,24 @@
 	kbd = kbd_get_keyboard(KBD_INDEX(dev));
 	if ((sc == NULL) || (kbd == NULL) || !KBD_IS_VALID(kbd)) {
 		splx(s);
-		return ENXIO;
+		return (ENXIO);
 	}
 	while (sc->gkb_q.c_cc == 0) {
 		if (flag & IO_NDELAY) {
 			splx(s);
-			return EWOULDBLOCK;
+			return (EWOULDBLOCK);
 		}
 		sc->gkb_flags |= KB_ASLEEP;
 		error = tsleep(sc, PZERO | PCATCH, "kbdrea", 0);
 		kbd = kbd_get_keyboard(KBD_INDEX(dev));
 		if ((kbd == NULL) || !KBD_IS_VALID(kbd)) {
 			splx(s);
-			return ENXIO;	/* our keyboard has gone... */
+			return (ENXIO);	/* our keyboard has gone... */
 		}
 		if (error) {
 			sc->gkb_flags &= ~KB_ASLEEP;
 			splx(s);
-			return error;
+			return (error);
 		}
 	}
 	splx(s);
@@ -602,7 +602,7 @@
 			break;
 	}
 
-	return error;
+	return (error);
 }
 
 static int
@@ -612,8 +612,8 @@
 
 	kbd = kbd_get_keyboard(KBD_INDEX(dev));
 	if ((kbd == NULL) || !KBD_IS_VALID(kbd))
-		return ENXIO;
-	return ENODEV;
+		return (ENXIO);
+	return (ENODEV);
 }
 
 static int
@@ -624,11 +624,11 @@
 
 	kbd = kbd_get_keyboard(KBD_INDEX(dev));
 	if ((kbd == NULL) || !KBD_IS_VALID(kbd))
-		return ENXIO;
+		return (ENXIO);
 	error = (*kbdsw[kbd->kb_index]->ioctl)(kbd, cmd, arg);
 	if (error == ENOIOCTL)
 		error = ENODEV;
-	return error;
+	return (error);
 }
 
 static int
@@ -652,7 +652,7 @@
 			selrecord(td, &sc->gkb_rsel);
 	}
 	splx(s);
-	return revents;
+	return (revents);
 }
 
 static int
@@ -678,9 +678,9 @@
 			wakeup(sc);
 		}
 		selwakeuppri(&sc->gkb_rsel, PZERO);
-		return 0;
+		return (0);
 	default:
-		return EINVAL;
+		return (EINVAL);
 	}
 
 	/* obtain the current key input mode */
@@ -733,7 +733,7 @@
 			break;
 		case FKEY | SPCLKEY:	/* a function key, return string */
 			cp = (*kbdsw[kbd->kb_index]->get_fkeystr)(kbd,
-							KEYCHAR(c), &len);
+			    KEYCHAR(c), &len);
 			if (cp != NULL) {
 				while (len-- >  0)
 					putc(*cp++, &sc->gkb_q);
@@ -751,7 +751,7 @@
 		selwakeuppri(&sc->gkb_rsel, PZERO);
 	}
 
-	return 0;
+	return (0);
 }
 
 #endif /* KBD_INSTALL_CDEV */
@@ -786,7 +786,7 @@
 	case KDGKBINFO:		/* get keyboard information */
 		((keyboard_info_t *)arg)->kb_index = kbd->kb_index;
 		i = imin(strlen(kbd->kb_name) + 1,
-			 sizeof(((keyboard_info_t *)arg)->kb_name));
+		    sizeof(((keyboard_info_t *)arg)->kb_name));
 		bcopy(kbd->kb_name, ((keyboard_info_t *)arg)->kb_name, i);
 		((keyboard_info_t *)arg)->kb_unit = kbd->kb_unit;
 		((keyboard_info_t *)arg)->kb_type = kbd->kb_type;
@@ -800,7 +800,7 @@
 
 	case KDGETREPEAT:	/* get keyboard repeat rate */
 		((int *)arg)[0] = kbd->kb_delay1;
-		((int *)arg)[1] = kbd->kb_delay2; 
+		((int *)arg)[1] = kbd->kb_delay2;
 		break;
 
 	case GIO_KEYMAP:	/* get keyboard translation table */
@@ -812,46 +812,46 @@
 		    curthread);
 		if (error != 0) {
 			splx(s);
-			return error;
+			return (error);
 		}
 		bzero(kbd->kb_accentmap, sizeof(*kbd->kb_accentmap));
 		bcopy(arg, kbd->kb_keymap, sizeof(*kbd->kb_keymap));
 		break;
 #else
 		splx(s);
-		return ENODEV;
+		return (ENODEV);
 #endif
 
 	case GIO_KEYMAPENT:	/* get keyboard translation table entry */
 		keyp = (keyarg_t *)arg;
-		if (keyp->keynum >= sizeof(kbd->kb_keymap->key)
-					/sizeof(kbd->kb_keymap->key[0])) {
+		if (keyp->keynum >= sizeof(kbd->kb_keymap->key) /
+		    sizeof(kbd->kb_keymap->key[0])) {
 			splx(s);
-			return EINVAL;
+			return (EINVAL);
 		}
 		bcopy(&kbd->kb_keymap->key[keyp->keynum], &keyp->key,
-		      sizeof(keyp->key));
+		    sizeof(keyp->key));
 		break;
 	case PIO_KEYMAPENT:	/* set keyboard translation table entry */
 #ifndef KBD_DISABLE_KEYMAP_LOAD
 		keyp = (keyarg_t *)arg;
-		if (keyp->keynum >= sizeof(kbd->kb_keymap->key)
-					/sizeof(kbd->kb_keymap->key[0])) {
+		if (keyp->keynum >= sizeof(kbd->kb_keymap->key) /
+		    sizeof(kbd->kb_keymap->key[0])) {
 			splx(s);
-			return EINVAL;
+			return (EINVAL);
 		}
 		error = key_change_ok(&kbd->kb_keymap->key[keyp->keynum],
 		    &keyp->key, curthread);
 		if (error != 0) {
 			splx(s);
-			return error;
+			return (error);
 		}
 		bcopy(&keyp->key, &kbd->kb_keymap->key[keyp->keynum],
-		      sizeof(keyp->key));
+		    sizeof(keyp->key));
 		break;
 #else
 		splx(s);
-		return ENODEV;
+		return (ENODEV);
 #endif
 
 	case GIO_DEADKEYMAP:	/* get accent key translation table */
@@ -863,23 +863,23 @@
 		    (accentmap_t *)arg, curthread);
 		if (error != 0) {
 			splx(s);
-			return error;
+			return (error);
 		}
 		bcopy(arg, kbd->kb_accentmap, sizeof(*kbd->kb_accentmap));
 		break;
 #else
 		splx(s);
-		return ENODEV;
+		return (ENODEV);
 #endif
 
 	case GETFKEY:		/* get functionkey string */
 		fkeyp = (fkeyarg_t *)arg;
 		if (fkeyp->keynum >= kbd->kb_fkeytab_size) {
 			splx(s);
-			return EINVAL;
+			return (EINVAL);
 		}
 		bcopy(kbd->kb_fkeytab[fkeyp->keynum].str, fkeyp->keydef,
-		      kbd->kb_fkeytab[fkeyp->keynum].len);
+		    kbd->kb_fkeytab[fkeyp->keynum].len);
 		fkeyp->flen = kbd->kb_fkeytab[fkeyp->keynum].len;
 		break;
 	case SETFKEY:		/* set functionkey string */
@@ -887,30 +887,30 @@
 		fkeyp = (fkeyarg_t *)arg;
 		if (fkeyp->keynum >= kbd->kb_fkeytab_size) {
 			splx(s);
-			return EINVAL;
+			return (EINVAL);
 		}
 		error = fkey_change_ok(&kbd->kb_fkeytab[fkeyp->keynum],
 		    fkeyp, curthread);
 		if (error != 0) {
 			splx(s);
-			return error;
+			return (error);
 		}
 		kbd->kb_fkeytab[fkeyp->keynum].len = imin(fkeyp->flen, MAXFK);
 		bcopy(fkeyp->keydef, kbd->kb_fkeytab[fkeyp->keynum].str,
-		      kbd->kb_fkeytab[fkeyp->keynum].len);
+		    kbd->kb_fkeytab[fkeyp->keynum].len);
 		break;
 #else
 		splx(s);
-		return ENODEV;
+		return (ENODEV);
 #endif
 
 	default:
 		splx(s);
-		return ENOIOCTL;
+		return (ENOIOCTL);
 	}
 
 	splx(s);
-	return 0;
+	return (0);
 }
 
 #ifndef KBD_DISABLE_KEYMAP_LOAD
@@ -928,7 +928,7 @@
 
 	/* Low keymap_restrict_change means any changes are OK. */
 	if (keymap_restrict_change <= 0)
-		return 0;
+		return (0);
 
 	/* High keymap_restrict_change means only root can change the keymap. */
 	if (keymap_restrict_change >= 2) {
@@ -939,7 +939,7 @@
 			return suser(td);
 		if (oldkey->flgs != newkey->flgs)
 			return suser(td);
-		return 0;
+		return (0);
 	}
 
 	/* Otherwise we have to see if any special keys are being changed. */
@@ -956,7 +956,7 @@
 		return suser(td);
 	}
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -967,9 +967,9 @@
 	for (keycode = 0; keycode < NUM_KEYS; keycode++) {
 		if ((error = key_change_ok(&oldmap->key[keycode],
 		    &newmap->key[keycode], td)) != 0)
-			return error;
+			return (error);
 	}
-	return 0;
+	return (0);
 }
 
 static int
@@ -979,7 +979,7 @@
 	int accent, i;
 
 	if (keymap_restrict_change <= 2)
-		return 0;
+		return (0);
 
 	if (oldmap->n_accs != newmap->n_accs)
 		return suser(td);
@@ -999,20 +999,20 @@
 		}
 	}
 
-	return 0;
+	return (0);
 }
 
 static int
 fkey_change_ok(fkeytab_t *oldkey, fkeyarg_t *newkey, struct thread *td)
 {
 	if (keymap_restrict_change <= 3)
-		return 0;
+		return (0);
 
 	if (oldkey->len != newkey->flen ||
 	    bcmp(oldkey->str, newkey->keydef, oldkey->len) != 0)
 		return suser(td);
 
-	return 0;
+	return (0);
 }
 #endif
 
@@ -1021,12 +1021,12 @@
 *genkbd_get_fkeystr(keyboard_t *kbd, int fkey, size_t *len)
 {
 	if (kbd == NULL)
-		return NULL;
+		return (NULL);
 	fkey -= F_FN;
 	if (fkey > kbd->kb_fkeytab_size)
-		return NULL;
+		return (NULL);
 	*len = kbd->kb_fkeytab[fkey].len;
-	return kbd->kb_fkeytab[fkey].str;
+	return (kbd->kb_fkeytab[fkey].str);
 }
 
 /* diagnostic dump */
@@ -1045,22 +1045,22 @@
 
 	for (i = 0; i < sizeof(name_table)/sizeof(name_table[0]); ++i) {
 		if (type == name_table[i].type)
-			return name_table[i].name;
+			return (name_table[i].name);
 	}
-	return "unknown";
+	return ("unknown");
 }
 
 void
 genkbd_diag(keyboard_t *kbd, int level)
 {
 	if (level > 0) {
-		printf("kbd%d: %s%d, %s (%d), config:0x%x, flags:0x%x", 
-		       kbd->kb_index, kbd->kb_name, kbd->kb_unit,
-		       get_kbd_type_name(kbd->kb_type), kbd->kb_type,
-		       kbd->kb_config, kbd->kb_flags);
+		printf("kbd%d: %s%d, %s (%d), config:0x%x, flags:0x%x",
+		    kbd->kb_index, kbd->kb_name, kbd->kb_unit,
+		    get_kbd_type_name(kbd->kb_type), kbd->kb_type,
+		    kbd->kb_config, kbd->kb_flags);
 		if (kbd->kb_io_base > 0)
-			printf(", port:0x%x-0x%x", kbd->kb_io_base, 
-			       kbd->kb_io_base + kbd->kb_io_size - 1);
+			printf(", port:0x%x-0x%x", kbd->kb_io_base,
+			    kbd->kb_io_base + kbd->kb_io_size - 1);
 		printf("\n");
 	}
 }
@@ -1085,22 +1085,22 @@
 	    || (kbd->kb_accentmap->acc[i - 1].accchar == 0)) {
 		/* the index is out of range or pointing to an empty entry */
 		*accents = 0;
-		return ERRKEY;
+		return (ERRKEY);
 	}
 
-	/* 
-	 * If the same accent key has been hit twice, produce the accent char
-	 * itself.
+	/*
+	 * If the same accent key has been hit twice, produce the accent
+	 * char itself.
 	 */
 	if (i == *accents) {
 		key = kbd->kb_accentmap->acc[i - 1].accchar;
 		*accents = 0;
-		return key;
+		return (key);
 	}
 
 	/* remember the index and wait for the next key  */
-	*accents = i; 
-	return NOKEY;
+	*accents = i;
+	return (NOKEY);
 }
 
 static u_int
@@ -1112,22 +1112,22 @@
 	acc = &kbd->kb_accentmap->acc[*accents - 1];
 	*accents = 0;
 
-	/* 
+	/*
 	 * If the accent key is followed by the space key,
 	 * produce the accent char itself.
 	 */
 	if (ch == ' ')
-		return acc->accchar;
+		return (acc->accchar);
 
 	/* scan the accent map */
 	for (i = 0; i < NUM_ACCENTCHARS; ++i) {
 		if (acc->map[i][0] == 0)	/* end of table */
 			break;
 		if (acc->map[i][0] == ch)
-			return acc->map[i][1];

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404030430.i334Uesh012018>