Index: freebsd-mos-driver/if_mos.c
===================================================================
--- freebsd-mos-driver/if_mos.c	(revision 276)
+++ freebsd-mos-driver/if_mos.c	(revision 277)
@@ -142,12 +142,10 @@
   DPRINTF("mos: %s: " fmt "\n",__FUNCTION__,## __VA_ARGS__)
 
-#define	USB_PRODUCT_MOSCHIP_MCS7730	0x7730	/* MCS7730 Ethernet */
-#define	USB_PRODUCT_SITECOMEU_LN030	0x0021	/* LN-030 */
-
-
-
-/*
- * Various supported device vendors/products.
- */
+#define	USB_PRODUCT_MOSCHIP_MCS7730	0x7730
+#define	USB_PRODUCT_SITECOMEU_LN030	0x0021
+
+
+
+/* Various supported device vendors/products. */
 static const struct usb_device_id mos_devs[] = {
 	{USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7730, MCS7730)},
@@ -196,5 +194,5 @@
 		.flags = {.pipe_bof = 1,.force_short_xfer = 1,},
 		.callback = mos_bulk_write_callback,
-		.timeout = 10000,	/* 10 seconds */
+		.timeout = 10000,
 	},
 
@@ -213,5 +211,5 @@
 		.direction = UE_DIR_IN,
 		.flags = {.pipe_bof = 1,.short_xfer_ok = 1,},
-		.bufsize = 0,		/* use wMaxPacketSize */
+		.bufsize = 0,
 		.callback = mos_intr_callback,
 	},
@@ -316,5 +314,4 @@
 	usb_error_t err;
 	uByte val;
-
 	val = aval;
 
@@ -533,4 +530,5 @@
 	struct mos_softc *sc = ifp->if_softc;
 	struct mii_data *mii = GET_MII(sc);
+	struct mii_softc *miisc;
 
 	MOS_LOCK_ASSERT(sc, MA_OWNED);
@@ -538,6 +536,4 @@
 	sc->mos_link = 0;
 	if (mii->mii_instance) {
-		struct mii_softc *miisc;
-
 		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
 		    mii_phy_reset(miisc);
@@ -570,5 +566,5 @@
 	struct ifnet *ifp = uether_getifp(ue);
 
-	u_int8_t rxmode;
+	uint8_t rxmode;
 
 	MOS_LOCK_ASSERT(sc, MA_OWNED);
@@ -595,7 +591,7 @@
 	struct ifmultiaddr *ifma;
 
-	u_int32_t h = 0;
-	u_int8_t rxmode;
-	u_int8_t hashtbl[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+	uint32_t h = 0;
+	uint8_t rxmode;
+	uint8_t hashtbl[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 	int allmulti = 0;
 
@@ -616,5 +612,4 @@
 		h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
 		    ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
-		//h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN) >> 26;
 		hashtbl[h / 8] |= 1 << (h % 8);
 	}
@@ -635,5 +630,5 @@
 mos_reset(struct mos_softc *sc)
 {
-	u_int8_t ctl;
+	uint8_t ctl;
 
 	ctl = mos_reg_read_1(sc, MOS_CTL);
@@ -674,23 +669,18 @@
 mos_probe(device_t dev)
 {
-	DPRINTFN(11, "mos: probe\n");
 	struct usb_attach_arg *uaa = device_get_ivars(dev);
+        int retval;
 
 	if (uaa->usb_mode != USB_MODE_HOST) {
-		DPRINTFN(11, "mos: not USB_MODE_HOST\n");
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigNum != MOS_CONFIG_NO) {
-		DPRINTFN(11, "mos: not MOS_CONFIG_NO %i vs %i\n", uaa->info.bConfigNum, MOS_CONFIG_NO);
 		return (ENXIO);
 	}
-	if (uaa->info.bIfaceIndex != MOS_IFACE_IDX) {
-		DPRINTFN(11, "mos: not MOS_IFACE_IDX %i vs %i\n", uaa->info.bIfaceIndex, MOS_IFACE_IDX);
+	if (uaa->info.bIfaceIndex != 0) {
 		return (ENXIO);
 	}
-	DPRINTFN(11, "mos: probe by generic means\n");
-	int retval = usbd_lookup_id_by_uaa(mos_devs, sizeof(mos_devs), uaa);
-
-	DPRINTFN(11, "mos: probe retval: %i (ENXIO:%i)\n", retval, ENXIO);
+
+	retval = usbd_lookup_id_by_uaa(mos_devs, sizeof(mos_devs), uaa);
 	return retval;
 }
@@ -706,5 +696,4 @@
 	struct mos_softc *sc = device_get_softc(dev);
 	struct usb_ether *ue = &sc->sc_ue;
-
 	uint8_t iface_index;
 	int error;
@@ -732,7 +721,7 @@
 
 	if (sc->mos_flags & MCS7730) {
-		DPRINTF("model: MCS7730\n");
+		MOS_DPRINTFN("model: MCS7730");
 	} else if (sc->mos_flags & MCS7830) {
-		DPRINTF("model: MCS7830\n");
+		MOS_DPRINTFN("model: MCS7830");
 	}
 	error = uether_ifattach(ue);
@@ -741,10 +730,10 @@
 		goto detach;
 	}
-	return (0);			/* success */
+	return (0);
 
 
 detach:
 	mos_detach(dev);
-	return (ENXIO);			/* failure */
+	return (ENXIO);
 }
 
@@ -754,9 +743,8 @@
 {
 	struct mos_softc *sc = uether_getsc(ue);
-
-	/*
-	 * Read MAC address, inform the world.
-	 */
-	int err = mos_readmac(sc, ue->ue_eaddr);
+        int err;
+
+	/* Read MAC address, inform the world. */
+	err = mos_readmac(sc, ue->ue_eaddr);
 
 	if (err)
@@ -799,5 +787,4 @@
 	uint16_t pktlen = 0;
 	struct usb_page_cache *pc;
-
 
 	usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL);
@@ -843,8 +830,7 @@
 		uether_rxflush(ue);
 		return;
-	default:			/* Error */
+	default:
 		MOS_DPRINTFN("bulk read error, %s", usbd_errstr(error));
 		if (error != USB_ERR_CANCELLED) {
-			/* try to clear stall first */
 			usbd_xfer_set_stall(xfer);
 			goto tr_setup;
@@ -859,5 +845,4 @@
  * the list buffers.
  */
-
 static void
 mos_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error)
@@ -902,9 +887,8 @@
 		ifp->if_opackets++;
 		return;
-	default:			/* Error */
+	default:
 		MOS_DPRINTFN("usb error on tx: %s\n", usbd_errstr(error));
 		ifp->if_oerrors++;
 		if (error != USB_ERR_CANCELLED) {
-			/* try to clear stall first */
 			usbd_xfer_set_stall(xfer);
 			goto tr_setup;
@@ -950,19 +934,13 @@
 	struct mos_softc *sc = uether_getsc(ue);
 	struct ifnet *ifp = uether_getifp(ue);
-	u_int8_t rxmode;
+	uint8_t rxmode;
 
 	MOS_LOCK_ASSERT(sc, MA_OWNED);
 
-	/*
-	 * Cancel pending I/O and free all RX/TX buffers.
-	 */
+	/* Cancel pending I/O and free all RX/TX buffers. */
 	mos_reset(sc);
 
-	/*
-	 * Write MAC address
-	 */
+	/* Write MAC address */
 	mos_writemac(sc, IF_LLADDR(ifp));
-
-
 
 	/* Read and set transmitter IPG values */
@@ -983,5 +961,4 @@
 
 	/* XXX: broadcast mode? */
-
 	mos_reg_write_1(sc, MOS_CTL, rxmode);
 
@@ -1000,6 +977,6 @@
 	struct ifnet *ifp = uether_getifp(&sc->sc_ue);
 	struct usb_page_cache *pc;
+	uint32_t pkt;
 	int actlen;
-	long pkt;
 
 	ifp->if_oerrors++;
@@ -1017,7 +994,6 @@
 tr_setup:
 		return;
-	default:			/* Error */
+	default:
 		if (error != USB_ERR_CANCELLED) {
-			/* try to clear stall first */
 			usbd_xfer_set_stall(xfer);
 			goto tr_setup;
@@ -1043,7 +1019,5 @@
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 
-	/*
-	 * stop all the transfers, if not already stopped:
-	 */
+	/* stop all the transfers, if not already stopped */
 	usbd_transfer_stop(sc->sc_xfer[MOS_ENDPT_TX]);
 	usbd_transfer_stop(sc->sc_xfer[MOS_ENDPT_RX]);
Index: freebsd-mos-driver/if_mosreg.h
===================================================================
--- freebsd-mos-driver/if_mosreg.h	(revision 276)
+++ freebsd-mos-driver/if_mosreg.h	(revision 277)
@@ -150,6 +150,6 @@
 #define MOS_IFACE_IDX		0
 
-#define MCS7730	0x0001			/* MCS7730 */
-#define MCS7830	0x0002			/* MCS7830 */
+#define MCS7730	0x0001
+#define MCS7830	0x0002
 
 #define MOS_INC(x, y)           (x) = (x + 1) % y
@@ -159,12 +159,12 @@
 	struct ifnet ifp;
 
-	u_int16_t mos_flags;
+	struct mtx sc_mtx;
+	struct usb_xfer *sc_xfer[MOS_ENDPT_MAX];
 
-	int	mos_link;
+	uint16_t mos_flags;
+
+	int mos_link;
 	unsigned char mos_ipgs[2];
 	unsigned char mos_phyaddrs[2];
-
-	struct mtx sc_mtx;
-	struct usb_xfer *sc_xfer[MOS_ENDPT_MAX];
 };
 
