Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Dec 2011 14:38:54 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r228229 - in stable/8/sys/dev/usb: . controller net serial storage template wlan
Message-ID:  <201112031438.pB3Ecsm6043567@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sat Dec  3 14:38:54 2011
New Revision: 228229
URL: http://svn.freebsd.org/changeset/base/228229

Log:
  MFC r227461:
  Style change.
  - Make it easier to port the USB code to other platforms by only using
  one set of memory functions for clearing and copying memory. None of
  the memory copies are overlapping. This means using bcopy() is not
  required.
  - Fix a compile warning when USB_HAVE_BUSDMA=0
  - Add missing semicolon in avr32dci.
  - Update some comments.

Modified:
  stable/8/sys/dev/usb/controller/at91dci.c
  stable/8/sys/dev/usb/controller/avr32dci.c
  stable/8/sys/dev/usb/controller/ehci.c
  stable/8/sys/dev/usb/controller/ohci.c
  stable/8/sys/dev/usb/controller/uhci.c
  stable/8/sys/dev/usb/net/if_kue.c
  stable/8/sys/dev/usb/net/uhso.c
  stable/8/sys/dev/usb/serial/ufoma.c
  stable/8/sys/dev/usb/serial/uftdi.c
  stable/8/sys/dev/usb/serial/umodem.c
  stable/8/sys/dev/usb/serial/uplcom.c
  stable/8/sys/dev/usb/serial/uvisor.c
  stable/8/sys/dev/usb/storage/umass.c
  stable/8/sys/dev/usb/storage/urio.c
  stable/8/sys/dev/usb/storage/ustorage_fs.c
  stable/8/sys/dev/usb/template/usb_template.c
  stable/8/sys/dev/usb/usb_busdma.c
  stable/8/sys/dev/usb/usb_compat_linux.c
  stable/8/sys/dev/usb/usb_dev.c
  stable/8/sys/dev/usb/usb_generic.c
  stable/8/sys/dev/usb/usb_msctest.c
  stable/8/sys/dev/usb/usb_request.c
  stable/8/sys/dev/usb/usb_transfer.c
  stable/8/sys/dev/usb/wlan/if_uath.c
  stable/8/sys/dev/usb/wlan/if_upgt.c
  stable/8/sys/dev/usb/wlan/if_urtw.c
  stable/8/sys/dev/usb/wlan/if_zyd.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/usb/controller/at91dci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/at91dci.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/controller/at91dci.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -2123,7 +2123,7 @@ tr_handle_get_port_status:
 		if (sc->sc_flags.status_vbus &&
 		    sc->sc_flags.status_bus_reset) {
 			/* reset endpoint flags */
-			bzero(sc->sc_ep_flags, sizeof(sc->sc_ep_flags));
+			memset(sc->sc_ep_flags, 0, sizeof(sc->sc_ep_flags));
 		}
 	}
 	if (sc->sc_flags.change_suspend) {

Modified: stable/8/sys/dev/usb/controller/avr32dci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/avr32dci.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/controller/avr32dci.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -415,12 +415,11 @@ repeat:
 			buf_res.length = count;
 		}
 		/* receive data */
-		bcopy(sc->physdata +
+		memcpy(buf_res.buffer, sc->physdata +
 		    (AVR32_EPTSTA_CURRENT_BANK(temp) << td->bank_shift) +
-		    (td->ep_no << 16) + (td->offset % td->max_packet_size),
-		    buf_res.buffer, buf_res.length)
+		    (td->ep_no << 16) + (td->offset % td->max_packet_size), buf_res.length);
 		/* update counters */
-		    count -= buf_res.length;
+		count -= buf_res.length;
 		td->offset += buf_res.length;
 		td->remainder -= buf_res.length;
 	}
@@ -491,12 +490,12 @@ repeat:
 			buf_res.length = count;
 		}
 		/* transmit data */
-		bcopy(buf_res.buffer, sc->physdata +
+		memcpy(sc->physdata +
 		    (AVR32_EPTSTA_CURRENT_BANK(temp) << td->bank_shift) +
 		    (td->ep_no << 16) + (td->offset % td->max_packet_size),
-		    buf_res.length)
+		    buf_res.buffer, buf_res.length);
 		/* update counters */
-		    count -= buf_res.length;
+		count -= buf_res.length;
 		td->offset += buf_res.length;
 		td->remainder -= buf_res.length;
 	}

Modified: stable/8/sys/dev/usb/controller/ehci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ehci.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/controller/ehci.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -3369,7 +3369,7 @@ ehci_roothub_exec(struct usb_device *ude
 		break;
 	case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
 		len = 16;
-		bzero(sc->sc_hub_desc.temp, 16);
+		memset(sc->sc_hub_desc.temp, 0, 16);
 		break;
 	case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
 		DPRINTFN(9, "get port status i=%d\n",

Modified: stable/8/sys/dev/usb/controller/ohci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/ohci.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/controller/ohci.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -2347,7 +2347,7 @@ ohci_roothub_exec(struct usb_device *ude
 
 	case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
 		len = 16;
-		bzero(sc->sc_hub_desc.temp, 16);
+		memset(sc->sc_hub_desc.temp, 0, 16);
 		break;
 	case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
 		DPRINTFN(9, "get port status i=%d\n",

Modified: stable/8/sys/dev/usb/controller/uhci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/uhci.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/controller/uhci.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -2702,7 +2702,7 @@ uhci_roothub_exec(struct usb_device *ude
 		break;
 	case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
 		len = 16;
-		bzero(sc->sc_hub_desc.temp, 16);
+		memset(sc->sc_hub_desc.temp, 0, 16);
 		break;
 	case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
 		if (index == 1)

Modified: stable/8/sys/dev/usb/net/if_kue.c
==============================================================================
--- stable/8/sys/dev/usb/net/if_kue.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/net/if_kue.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -380,8 +380,9 @@ kue_setmulti(struct usb_ether *ue)
 		 */
 		if (i == KUE_MCFILTCNT(sc))
 			break;
-		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
-		    KUE_MCFILT(sc, i), ETHER_ADDR_LEN);
+		memcpy(KUE_MCFILT(sc, i),
+		    LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
+		    ETHER_ADDR_LEN);
 		i++;
 	}
 	if_maddr_runlock(ifp);

Modified: stable/8/sys/dev/usb/net/uhso.c
==============================================================================
--- stable/8/sys/dev/usb/net/uhso.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/net/uhso.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -1153,7 +1153,7 @@ uhso_mux_read_callback(struct usb_xfer *
 		/* FALLTHROUGH */
 	case USB_ST_SETUP:
 tr_setup:
-		bzero(&req, sizeof(struct usb_device_request));
+		memset(&req, 0, sizeof(struct usb_device_request));
 		req.bmRequestType = UT_READ_CLASS_INTERFACE;
 		req.bRequest = UCDC_GET_ENCAPSULATED_RESPONSE;
 		USETW(req.wValue, 0);
@@ -1206,7 +1206,7 @@ uhso_mux_write_callback(struct usb_xfer 
 
 			usbd_get_page(pc, 0, &res);
 
-			bzero(&req, sizeof(struct usb_device_request));
+			memset(&req, 0, sizeof(struct usb_device_request));
 			req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
 			req.bRequest = UCDC_SEND_ENCAPSULATED_COMMAND;
 			USETW(req.wValue, 0);
@@ -1731,7 +1731,7 @@ uhso_if_rxflush(void *arg)
 			 * copy the IP-packet into it.
 			 */
 			m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-			bcopy(mtod(m0, uint8_t *), mtod(m, uint8_t *), iplen);
+			memcpy(mtod(m, uint8_t *), mtod(m0, uint8_t *), iplen);
 			m->m_pkthdr.len = m->m_len = iplen;
 
 			/* Adjust the size of the original mbuf */

Modified: stable/8/sys/dev/usb/serial/ufoma.c
==============================================================================
--- stable/8/sys/dev/usb/serial/ufoma.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/serial/ufoma.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -438,7 +438,7 @@ ufoma_attach(device_t dev)
 		goto detach;
 	}
 	sc->sc_modetable[0] = (elements + 1);
-	bcopy(mad->bMode, &sc->sc_modetable[1], elements);
+	memcpy(&sc->sc_modetable[1], mad->bMode, elements);
 
 	sc->sc_currentmode = UMCPC_ACM_MODE_UNLINKED;
 	sc->sc_modetoactivate = mad->bMode[0];
@@ -968,7 +968,7 @@ ufoma_cfg_param(struct ucom_softc *ucom,
 	}
 	DPRINTF("\n");
 
-	bzero(&ls, sizeof(ls));
+	memset(&ls, 0, sizeof(ls));
 
 	USETDW(ls.dwDTERate, t->c_ospeed);
 

Modified: stable/8/sys/dev/usb/serial/uftdi.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uftdi.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/serial/uftdi.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -560,7 +560,7 @@ static int
 uftdi_set_parm_soft(struct termios *t,
     struct uftdi_param_config *cfg, uint8_t type)
 {
-	bzero(cfg, sizeof(*cfg));
+	memset(cfg, 0, sizeof(*cfg));
 
 	switch (type) {
 	case UFTDI_TYPE_SIO:

Modified: stable/8/sys/dev/usb/serial/umodem.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umodem.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/serial/umodem.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -536,7 +536,7 @@ umodem_cfg_param(struct ucom_softc *ucom
 
 	DPRINTF("sc=%p\n", sc);
 
-	bzero(&ls, sizeof(ls));
+	memset(&ls, 0, sizeof(ls));
 
 	USETDW(ls.dwDTERate, t->c_ospeed);
 

Modified: stable/8/sys/dev/usb/serial/uplcom.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uplcom.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/serial/uplcom.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -659,7 +659,7 @@ uplcom_cfg_param(struct ucom_softc *ucom
 
 	DPRINTF("sc = %p\n", sc);
 
-	bzero(&ls, sizeof(ls));
+	memset(&ls, 0, sizeof(ls));
 
 	USETDW(ls.dwDTERate, t->c_ospeed);
 

Modified: stable/8/sys/dev/usb/serial/uvisor.c
==============================================================================
--- stable/8/sys/dev/usb/serial/uvisor.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/serial/uvisor.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -311,8 +311,9 @@ uvisor_attach(device_t dev)
 	int error;
 
 	DPRINTF("sc=%p\n", sc);
-	bcopy(uvisor_config, uvisor_config_copy,
+	memcpy(uvisor_config_copy, uvisor_config,
 	    sizeof(uvisor_config_copy));
+
 	device_set_usb_desc(dev);
 
 	mtx_init(&sc->sc_mtx, "uvisor", NULL, MTX_DEF);

Modified: stable/8/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/8/sys/dev/usb/storage/umass.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/storage/umass.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -891,7 +891,7 @@ umass_attach(device_t dev)
 	int32_t err;
 
 	/*
-	 * NOTE: the softc struct is bzero-ed in device_set_driver.
+	 * NOTE: the softc struct is cleared in device_set_driver.
 	 * We can safely call umass_detach without specifically
 	 * initializing the struct.
 	 */
@@ -1305,11 +1305,13 @@ umass_t_bbb_command_callback(struct usb_
 			}
 			sc->cbw.bCDBLength = sc->sc_transfer.cmd_len;
 
-			bcopy(sc->sc_transfer.cmd_data, sc->cbw.CBWCDB,
+			memcpy(sc->cbw.CBWCDB, sc->sc_transfer.cmd_data,
 			    sc->sc_transfer.cmd_len);
 
-			bzero(sc->sc_transfer.cmd_data + sc->sc_transfer.cmd_len,
-			    sizeof(sc->cbw.CBWCDB) - sc->sc_transfer.cmd_len);
+			memset(sc->sc_transfer.cmd_data +
+			    sc->sc_transfer.cmd_len, 0,
+			    sizeof(sc->cbw.CBWCDB) -
+			    sc->sc_transfer.cmd_len);
 
 			DIF(UDMASS_BBB, umass_bbb_dump_cbw(sc, &sc->cbw));
 
@@ -1480,9 +1482,9 @@ umass_t_bbb_status_callback(struct usb_x
 
 		/* Zero missing parts of the CSW: */
 
-		if (actlen < sizeof(sc->csw)) {
-			bzero(&sc->csw, sizeof(sc->csw));
-		}
+		if (actlen < sizeof(sc->csw))
+			memset(&sc->csw, 0, sizeof(sc->csw));
+
 		pc = usbd_xfer_get_frame(xfer, 0);
 		usbd_copy_out(pc, 0, &sc->csw, actlen);
 
@@ -2752,7 +2754,7 @@ umass_scsi_transform(struct umass_softc 
 		if (sc->sc_quirks & NO_TEST_UNIT_READY) {
 			DPRINTF(sc, UDMASS_SCSI, "Converted TEST_UNIT_READY "
 			    "to START_UNIT\n");
-			bzero(sc->sc_transfer.cmd_data, cmd_len);
+			memset(sc->sc_transfer.cmd_data, 0, cmd_len);
 			sc->sc_transfer.cmd_data[0] = START_STOP_UNIT;
 			sc->sc_transfer.cmd_data[4] = SSS_START;
 			return (1);
@@ -2765,14 +2767,14 @@ umass_scsi_transform(struct umass_softc 
 		 * information.
 		 */
 		if (sc->sc_quirks & FORCE_SHORT_INQUIRY) {
-			bcopy(cmd_ptr, sc->sc_transfer.cmd_data, cmd_len);
+			memcpy(sc->sc_transfer.cmd_data, cmd_ptr, cmd_len);
 			sc->sc_transfer.cmd_data[4] = SHORT_INQUIRY_LENGTH;
 			return (1);
 		}
 		break;
 	}
 
-	bcopy(cmd_ptr, sc->sc_transfer.cmd_data, cmd_len);
+	memcpy(sc->sc_transfer.cmd_data, cmd_ptr, cmd_len);
 	return (1);
 }
 
@@ -2807,10 +2809,11 @@ umass_rbc_transform(struct umass_softc *
 	case REQUEST_SENSE:
 	case PREVENT_ALLOW:
 
-		bcopy(cmd_ptr, sc->sc_transfer.cmd_data, cmd_len);
+		memcpy(sc->sc_transfer.cmd_data, cmd_ptr, cmd_len);
 
 		if ((sc->sc_quirks & RBC_PAD_TO_12) && (cmd_len < 12)) {
-			bzero(sc->sc_transfer.cmd_data + cmd_len, 12 - cmd_len);
+			memset(sc->sc_transfer.cmd_data + cmd_len,
+			    0, 12 - cmd_len);
 			cmd_len = 12;
 		}
 		sc->sc_transfer.cmd_len = cmd_len;
@@ -2838,7 +2841,7 @@ umass_ufi_transform(struct umass_softc *
 	sc->sc_transfer.cmd_len = UFI_COMMAND_LENGTH;
 
 	/* Zero the command data */
-	bzero(sc->sc_transfer.cmd_data, UFI_COMMAND_LENGTH);
+	memset(sc->sc_transfer.cmd_data, 0, UFI_COMMAND_LENGTH);
 
 	switch (cmd_ptr[0]) {
 		/*
@@ -2895,7 +2898,7 @@ umass_ufi_transform(struct umass_softc *
 		return (0);		/* failure */
 	}
 
-	bcopy(cmd_ptr, sc->sc_transfer.cmd_data, cmd_len);
+	memcpy(sc->sc_transfer.cmd_data, cmd_ptr, cmd_len);
 	return (1);			/* success */
 }
 
@@ -2916,7 +2919,7 @@ umass_atapi_transform(struct umass_softc
 	sc->sc_transfer.cmd_len = ATAPI_COMMAND_LENGTH;
 
 	/* Zero the command data */
-	bzero(sc->sc_transfer.cmd_data, ATAPI_COMMAND_LENGTH);
+	memset(sc->sc_transfer.cmd_data, 0, ATAPI_COMMAND_LENGTH);
 
 	switch (cmd_ptr[0]) {
 		/*
@@ -2930,7 +2933,7 @@ umass_atapi_transform(struct umass_softc
 		 * information.
 		 */
 		if (sc->sc_quirks & FORCE_SHORT_INQUIRY) {
-			bcopy(cmd_ptr, sc->sc_transfer.cmd_data, cmd_len);
+			memcpy(sc->sc_transfer.cmd_data, cmd_ptr, cmd_len);
 
 			sc->sc_transfer.cmd_data[4] = SHORT_INQUIRY_LENGTH;
 			return (1);
@@ -2991,7 +2994,7 @@ umass_atapi_transform(struct umass_softc
 		break;
 	}
 
-	bcopy(cmd_ptr, sc->sc_transfer.cmd_data, cmd_len);
+	memcpy(sc->sc_transfer.cmd_data, cmd_ptr, cmd_len);
 	return (1);			/* success */
 }
 

Modified: stable/8/sys/dev/usb/storage/urio.c
==============================================================================
--- stable/8/sys/dev/usb/storage/urio.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/storage/urio.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -440,7 +440,7 @@ urio_ioctl(struct usb_fifo *fifo, u_long
 			error = EPERM;
 			goto done;
 		}
-		bzero(&ur, sizeof(ur));
+		memset(&ur, 0, sizeof(ur));
 		rio_cmd = addr;
 		ur.ucr_request.bmRequestType =
 		    rio_cmd->requesttype | UT_READ_VENDOR_DEVICE;
@@ -451,7 +451,7 @@ urio_ioctl(struct usb_fifo *fifo, u_long
 			error = EPERM;
 			goto done;
 		}
-		bzero(&ur, sizeof(ur));
+		memset(&ur, 0, sizeof(ur));
 		rio_cmd = addr;
 		ur.ucr_request.bmRequestType =
 		    rio_cmd->requesttype | UT_WRITE_VENDOR_DEVICE;

Modified: stable/8/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- stable/8/sys/dev/usb/storage/ustorage_fs.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/storage/ustorage_fs.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -355,7 +355,7 @@ ustorage_fs_attach(device_t dev)
 	int unit;
 
 	/*
-	 * NOTE: the softc struct is bzero-ed in device_set_driver.
+	 * NOTE: the softc struct is cleared in device_set_driver.
 	 * We can safely call ustorage_fs_detach without specifically
 	 * initializing the struct.
 	 */
@@ -371,7 +371,9 @@ ustorage_fs_attach(device_t dev)
 			 * further
 			 */
 			ustorage_fs_ramdisk =
-			    malloc(USTORAGE_FS_RAM_SECT << 9, M_USB, M_ZERO | M_WAITOK);
+			    malloc(USTORAGE_FS_RAM_SECT << 9, M_USB,
+			    M_ZERO | M_WAITOK);
+
 			if (ustorage_fs_ramdisk == NULL) {
 				return (ENOMEM);
 			}

Modified: stable/8/sys/dev/usb/template/usb_template.c
==============================================================================
--- stable/8/sys/dev/usb/template/usb_template.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/template/usb_template.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -913,7 +913,7 @@ usb_hw_ep_resolve(struct usb_device *ude
 	}
 	ues = udev->bus->scratch[0].hw_ep_scratch;
 
-	bzero(ues, sizeof(*ues));
+	memset(ues, 0, sizeof(*ues));
 
 	ues->ep_max = ues->ep;
 	ues->cd = (void *)desc;
@@ -1240,7 +1240,7 @@ usb_temp_setup(struct usb_device *udev,
 	}
 	uts = udev->bus->scratch[0].temp_setup;
 
-	bzero(uts, sizeof(*uts));
+	memset(uts, 0, sizeof(*uts));
 
 	uts->usb_speed = udev->speed;
 	uts->self_powered = udev->flags.self_powered;

Modified: stable/8/sys/dev/usb/usb_busdma.c
==============================================================================
--- stable/8/sys/dev/usb/usb_busdma.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_busdma.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -80,9 +80,9 @@ void
 usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset,
     struct usb_page_search *res)
 {
+#if USB_HAVE_BUSDMA
 	struct usb_page *page;
 
-#if USB_HAVE_BUSDMA
 	if (pc->page_start) {
 
 		/* Case 1 - something has been loaded into DMA */
@@ -145,7 +145,7 @@ usbd_copy_in(struct usb_page_cache *cach
 		if (buf_res.length > len) {
 			buf_res.length = len;
 		}
-		bcopy(ptr, buf_res.buffer, buf_res.length);
+		memcpy(buf_res.buffer, ptr, buf_res.length);
 
 		offset += buf_res.length;
 		len -= buf_res.length;
@@ -267,7 +267,7 @@ usbd_copy_out(struct usb_page_cache *cac
 		if (res.length > len) {
 			res.length = len;
 		}
-		bcopy(res.buffer, ptr, res.length);
+		memcpy(ptr, res.buffer, res.length);
 
 		offset += res.length;
 		len -= res.length;
@@ -325,7 +325,7 @@ usbd_frame_zero(struct usb_page_cache *c
 		if (res.length > len) {
 			res.length = len;
 		}
-		bzero(res.buffer, res.length);
+		memset(res.buffer, 0, res.length);
 
 		offset += res.length;
 		len -= res.length;
@@ -560,7 +560,7 @@ usb_pc_alloc_mem(struct usb_page_cache *
 		bus_dmamem_free(utag->tag, ptr, map);
 		goto error;
 	}
-	bzero(ptr, size);
+	memset(ptr, 0, size);
 
 	usb_pc_cpu_flush(pc);
 
@@ -797,7 +797,7 @@ usb_dma_tag_setup(struct usb_dma_parent_
     struct mtx *mtx, usb_dma_callback_t *func,
     uint8_t ndmabits, uint8_t nudt)
 {
-	bzero(udpt, sizeof(*udpt));
+	memset(udpt, 0, sizeof(*udpt));
 
 	/* sanity checking */
 	if ((nudt == 0) ||
@@ -818,7 +818,7 @@ usb_dma_tag_setup(struct usb_dma_parent_
 	udpt->dma_bits = ndmabits;
 
 	while (nudt--) {
-		bzero(udt, sizeof(*udt));
+		memset(udt, 0, sizeof(*udt));
 		udt->tag_parent = udpt;
 		udt++;
 	}

Modified: stable/8/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- stable/8/sys/dev/usb/usb_compat_linux.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_compat_linux.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -564,7 +564,7 @@ usb_clear_halt(struct usb_device *dev, s
 	type = uhe->desc.bmAttributes & UE_XFERTYPE;
 	addr = uhe->desc.bEndpointAddress;
 
-	bzero(cfg, sizeof(cfg));
+	memset(cfg, 0, sizeof(cfg));
 
 	cfg[0].type = type;
 	cfg[0].endpoint = addr & UE_ADDR;
@@ -709,12 +709,12 @@ usb_control_msg(struct usb_device *dev, 
 	urb->dev = dev;
 	urb->endpoint = uhe;
 
-	bcopy(&req, urb->setup_packet, sizeof(req));
+	memcpy(urb->setup_packet, &req, sizeof(req));
 
 	if (size && (!(req.bmRequestType & UT_READ))) {
 		/* move the data to a real buffer */
-		bcopy(data, USB_ADD_BYTES(urb->setup_packet,
-		    sizeof(req)), size);
+		memcpy(USB_ADD_BYTES(urb->setup_packet, sizeof(req)),
+		    data, size);
 	}
 	err = usb_start_wait_urb(urb, timeout, &actlen);
 
@@ -789,7 +789,7 @@ usb_setup_endpoint(struct usb_device *de
 	if (bufsize == 0) {
 		return (0);
 	}
-	bzero(cfg, sizeof(cfg));
+	memset(cfg, 0, sizeof(cfg));
 
 	if (type == UE_ISOCHRONOUS) {
 
@@ -1251,7 +1251,7 @@ usb_init_urb(struct urb *urb)
 	if (urb == NULL) {
 		return;
 	}
-	bzero(urb, sizeof(*urb));
+	memset(urb, 0, sizeof(*urb));
 }
 
 /*------------------------------------------------------------------------*

Modified: stable/8/sys/dev/usb/usb_dev.c
==============================================================================
--- stable/8/sys/dev/usb/usb_dev.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_dev.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -1809,8 +1809,8 @@ usb_fifo_free_buffer(struct usb_fifo *f)
 	}
 	/* reset queues */
 
-	bzero(&f->free_q, sizeof(f->free_q));
-	bzero(&f->used_q, sizeof(f->used_q));
+	memset(&f->free_q, 0, sizeof(f->free_q));
+	memset(&f->used_q, 0, sizeof(f->used_q));
 }
 
 void
@@ -1909,7 +1909,7 @@ usb_fifo_put_data_linear(struct usb_fifo
 
 			io_len = MIN(len, m->cur_data_len);
 
-			bcopy(ptr, m->cur_data_ptr, io_len);
+			memcpy(m->cur_data_ptr, ptr, io_len);
 
 			m->cur_data_len = io_len;
 			ptr = USB_ADD_BYTES(ptr, io_len);
@@ -2052,7 +2052,7 @@ usb_fifo_get_data_linear(struct usb_fifo
 
 			io_len = MIN(len, m->cur_data_len);
 
-			bcopy(m->cur_data_ptr, ptr, io_len);
+			memcpy(ptr, m->cur_data_ptr, io_len);
 
 			len -= io_len;
 			ptr = USB_ADD_BYTES(ptr, io_len);

Modified: stable/8/sys/dev/usb/usb_generic.c
==============================================================================
--- stable/8/sys/dev/usb/usb_generic.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_generic.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -240,7 +240,7 @@ ugen_open_pipe_write(struct usb_fifo *f)
 		/* transfers are already opened */
 		return (0);
 	}
-	bzero(usb_config, sizeof(usb_config));
+	memset(usb_config, 0, sizeof(usb_config));
 
 	usb_config[1].type = UE_CONTROL;
 	usb_config[1].endpoint = 0;
@@ -308,7 +308,7 @@ ugen_open_pipe_read(struct usb_fifo *f)
 		/* transfers are already opened */
 		return (0);
 	}
-	bzero(usb_config, sizeof(usb_config));
+	memset(usb_config, 0, sizeof(usb_config));
 
 	usb_config[1].type = UE_CONTROL;
 	usb_config[1].endpoint = 0;

Modified: stable/8/sys/dev/usb/usb_msctest.c
==============================================================================
--- stable/8/sys/dev/usb/usb_msctest.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_msctest.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -476,8 +476,8 @@ bbb_command_start(struct bbb_transfer *s
 	sc->data_timeout = (data_timeout + USB_MS_HZ);
 	sc->actlen = 0;
 	sc->cmd_len = cmd_len;
-	bzero(&sc->cbw.CBWCDB, sizeof(sc->cbw.CBWCDB));
-	bcopy(cmd_ptr, &sc->cbw.CBWCDB, cmd_len);
+	memset(&sc->cbw.CBWCDB, 0, sizeof(sc->cbw.CBWCDB));
+	memcpy(&sc->cbw.CBWCDB, cmd_ptr, cmd_len);
 	DPRINTFN(1, "SCSI cmd = %*D\n", (int)cmd_len, &sc->cbw.CBWCDB, ":");
 
 	mtx_lock(&sc->mtx);

Modified: stable/8/sys/dev/usb/usb_request.c
==============================================================================
--- stable/8/sys/dev/usb/usb_request.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_request.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -517,7 +517,7 @@ usbd_do_request_flags(struct usb_device 
 				}
 			} else
 #endif
-				bcopy(desc, data, length);
+				memcpy(data, desc, length);
 		}
 		goto done;		/* success */
 	}

Modified: stable/8/sys/dev/usb/usb_transfer.c
==============================================================================
--- stable/8/sys/dev/usb/usb_transfer.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/usb_transfer.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -858,7 +858,7 @@ usbd_transfer_setup(struct usb_device *u
 	if (parm.err) {
 		goto done;
 	}
-	bzero(&parm, sizeof(parm));
+	memset(&parm, 0, sizeof(parm));
 
 	parm.udev = udev;
 	parm.speed = usbd_get_speed(udev);
@@ -982,7 +982,7 @@ usbd_transfer_setup(struct usb_device *u
 				 * memory:
 				 */
 				xfer = &dummy;
-				bzero(&dummy, sizeof(dummy));
+				memset(&dummy, 0, sizeof(dummy));
 				refcount++;
 			}
 

Modified: stable/8/sys/dev/usb/wlan/if_uath.c
==============================================================================
--- stable/8/sys/dev/usb/wlan/if_uath.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/wlan/if_uath.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -710,12 +710,12 @@ uath_cmdsend(struct uath_softc *sc, uint
 	cmd->buflen = roundup2(sizeof(struct uath_cmd_hdr) + ilen, 4);
 
 	hdr = (struct uath_cmd_hdr *)cmd->buf;
-	bzero(hdr, sizeof (struct uath_cmd_hdr));	/* XXX not needed */
+	memset(hdr, 0, sizeof(struct uath_cmd_hdr));
 	hdr->len   = htobe32(cmd->buflen);
 	hdr->code  = htobe32(code);
 	hdr->msgid = cmd->msgid;	/* don't care about endianness */
 	hdr->magic = htobe32((cmd->flags & UATH_CMD_FLAG_MAGIC) ? 1 << 24 : 0);
-	bcopy(idata, (uint8_t *)(hdr + 1), ilen);
+	memcpy((uint8_t *)(hdr + 1), idata, ilen);
 
 #ifdef UATH_DEBUG
 	if (sc->sc_debug & UATH_DEBUG_CMDS) {
@@ -1403,7 +1403,7 @@ uath_dataflush(struct uath_softc *sc)
 	chunk->flags = UATH_CFLAGS_FINAL;
 	chunk->length = htobe16(sizeof (struct uath_tx_desc));
 
-	bzero(desc, sizeof(struct uath_tx_desc));
+	memset(desc, 0, sizeof(struct uath_tx_desc));
 	desc->msglen = htobe32(sizeof(struct uath_tx_desc));
 	desc->msgid  = (sc->sc_msgid++) + 1; /* don't care about endianness */
 	desc->type   = htobe32(WDCMSG_FLUSH);
@@ -1482,7 +1482,7 @@ uath_set_chan(struct uath_softc *sc, str
 #endif
 	struct uath_cmd_reset reset;
 
-	bzero(&reset, sizeof reset);
+	memset(&reset, 0, sizeof(reset));
 	if (IEEE80211_IS_CHAN_2GHZ(c))
 		reset.flags |= htobe32(UATH_CHAN_2GHZ);
 	if (IEEE80211_IS_CHAN_5GHZ(c))
@@ -1971,7 +1971,7 @@ uath_create_connection(struct uath_softc
 	struct uath_cmd_create_connection create;
 
 	ni = ieee80211_ref_node(vap->iv_bss);
-	bzero(&create, sizeof create);
+	memset(&create, 0, sizeof(create));
 	create.connid = htobe32(connid);
 	create.bssid = htobe32(0);
 	/* XXX packed or not?  */
@@ -2000,7 +2000,7 @@ uath_set_rates(struct uath_softc *sc, co
 {
 	struct uath_cmd_rates rates;
 
-	bzero(&rates, sizeof rates);
+	memset(&rates, 0, sizeof(rates));
 	rates.connid = htobe32(UATH_ID_BSS);		/* XXX */
 	rates.size   = htobe32(sizeof(struct uath_cmd_rateset));
 	/* XXX bounds check rs->rs_nrates */
@@ -2022,7 +2022,7 @@ uath_write_associd(struct uath_softc *sc
 	struct uath_cmd_set_associd associd;
 
 	ni = ieee80211_ref_node(vap->iv_bss);
-	bzero(&associd, sizeof associd);
+	memset(&associd, 0, sizeof(associd));
 	associd.defaultrateix = htobe32(1);	/* XXX */
 	associd.associd = htobe32(ni->ni_associd);
 	associd.timoffset = htobe32(0x3b);	/* XXX */
@@ -2168,7 +2168,7 @@ uath_set_key(struct uath_softc *sc, cons
 	struct uath_cmd_crypto crypto;
 	int i;
 
-	bzero(&crypto, sizeof crypto);
+	memset(&crypto, 0, sizeof(crypto));
 	crypto.keyidx = htobe32(index);
 	crypto.magic1 = htobe32(1);
 	crypto.size   = htobe32(368);
@@ -2176,7 +2176,7 @@ uath_set_key(struct uath_softc *sc, cons
 	crypto.flags  = htobe32(0x80000068);
 	if (index != UATH_DEFAULT_KEY)
 		crypto.flags |= htobe32(index << 16);
-	memset(crypto.magic2, 0xff, sizeof crypto.magic2);
+	memset(crypto.magic2, 0xff, sizeof(crypto.magic2));
 
 	/*
 	 * Each byte of the key must be XOR'ed with 10101010 before being

Modified: stable/8/sys/dev/usb/wlan/if_upgt.c
==============================================================================
--- stable/8/sys/dev/usb/wlan/if_upgt.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/wlan/if_upgt.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -432,7 +432,7 @@ upgt_get_stats(struct upgt_softc *sc)
 	/*
 	 * Transmit the URB containing the CMD data.
 	 */
-	bzero(data_cmd->buf, MCLBYTES);
+	memset(data_cmd->buf, 0, MCLBYTES);
 
 	mem = (struct upgt_lmac_mem *)data_cmd->buf;
 	mem->addr = htole32(sc->sc_memaddr_frame_start +
@@ -540,7 +540,7 @@ upgt_set_led(struct upgt_softc *sc, int 
 	/*
 	 * Transmit the URB containing the CMD data.
 	 */
-	bzero(data_cmd->buf, MCLBYTES);
+	memset(data_cmd->buf, 0, MCLBYTES);
 
 	mem = (struct upgt_lmac_mem *)data_cmd->buf;
 	mem->addr = htole32(sc->sc_memaddr_frame_start +
@@ -670,7 +670,7 @@ upgt_set_macfilter(struct upgt_softc *sc
 	/*
 	 * Transmit the URB containing the CMD data.
 	 */
-	bzero(data_cmd->buf, MCLBYTES);
+	memset(data_cmd->buf, 0, MCLBYTES);
 
 	mem = (struct upgt_lmac_mem *)data_cmd->buf;
 	mem->addr = htole32(sc->sc_memaddr_frame_start +
@@ -785,11 +785,11 @@ upgt_setup_rates(struct ieee80211vap *va
 		 * will pickup a rate.
 		 */
 		if (ic->ic_curmode == IEEE80211_MODE_11B)
-			bcopy(rateset_auto_11b, sc->sc_cur_rateset,
+			memcpy(sc->sc_cur_rateset, rateset_auto_11b,
 			    sizeof(sc->sc_cur_rateset));
 		if (ic->ic_curmode == IEEE80211_MODE_11G ||
 		    ic->ic_curmode == IEEE80211_MODE_AUTO)
-			bcopy(rateset_auto_11g, sc->sc_cur_rateset,
+			memcpy(sc->sc_cur_rateset, rateset_auto_11g,
 			    sizeof(sc->sc_cur_rateset));
 	} else {
 		/* set a fixed rate */
@@ -975,7 +975,7 @@ upgt_set_chan(struct upgt_softc *sc, str
 	/*
 	 * Transmit the URB containing the CMD data.
 	 */
-	bzero(data_cmd->buf, MCLBYTES);
+	memset(data_cmd->buf, 0, MCLBYTES);
 
 	mem = (struct upgt_lmac_mem *)data_cmd->buf;
 	mem->addr = htole32(sc->sc_memaddr_frame_start +
@@ -998,11 +998,11 @@ upgt_set_chan(struct upgt_softc *sc, str
 	chan->settings = sc->sc_eeprom_freq6_settings;
 	chan->unknown3 = UPGT_CHANNEL_UNKNOWN3;
 
-	bcopy(&sc->sc_eeprom_freq3[channel].data, chan->freq3_1,
+	memcpy(chan->freq3_1, &sc->sc_eeprom_freq3[channel].data,
 	    sizeof(chan->freq3_1));
-	bcopy(&sc->sc_eeprom_freq4[channel], chan->freq4,
+	memcpy(chan->freq4, &sc->sc_eeprom_freq4[channel],
 	    sizeof(sc->sc_eeprom_freq4[channel]));
-	bcopy(&sc->sc_eeprom_freq3[channel].data, chan->freq3_2,
+	memcpy(chan->freq3_2, &sc->sc_eeprom_freq3[channel].data,
 	    sizeof(chan->freq3_2));
 
 	data_cmd->buflen = sizeof(*mem) + sizeof(*chan);
@@ -1331,7 +1331,7 @@ upgt_eeprom_read(struct upgt_softc *sc)
 		/*
 		 * Transmit the URB containing the CMD data.
 		 */
-		bzero(data_cmd->buf, MCLBYTES);
+		memset(data_cmd->buf, 0, MCLBYTES);
 
 		mem = (struct upgt_lmac_mem *)data_cmd->buf;
 		mem->addr = htole32(sc->sc_memaddr_frame_start +
@@ -1423,8 +1423,9 @@ upgt_rxeof(struct usb_xfer *xfer, struct
 		    "received EEPROM block (offset=%d, len=%d)\n",
 		    eeprom_offset, eeprom_len);
 
-		bcopy(data->buf + sizeof(struct upgt_lmac_eeprom) + 4,
-			sc->sc_eeprom + eeprom_offset, eeprom_len);
+		memcpy(sc->sc_eeprom + eeprom_offset,
+		    data->buf + sizeof(struct upgt_lmac_eeprom) + 4,
+		    eeprom_len);
 
 		/* EEPROM data has arrived in time, wakeup.  */
 		wakeup(sc);
@@ -1498,7 +1499,7 @@ upgt_rx(struct upgt_softc *sc, uint8_t *
 		return (NULL);
 	}
 	m_adj(m, ETHER_ALIGN);
-	bcopy(rxdesc->data, mtod(m, char *), pkglen);
+	memcpy(mtod(m, char *), rxdesc->data, pkglen);
 	/* trim FCS */
 	m->m_len = m->m_pkthdr.len = pkglen - IEEE80211_CRC_LEN;
 	m->m_pkthdr.rcvif = ifp;
@@ -1620,7 +1621,7 @@ upgt_fw_load(struct upgt_softc *sc)
 		goto fail;
 	}
 	data_cmd->buflen = sizeof(start_fwload_cmd);
-	bcopy(start_fwload_cmd, data_cmd->buf, data_cmd->buflen);
+	memcpy(data_cmd->buf, start_fwload_cmd, data_cmd->buflen);
 	upgt_bulk_tx(sc, data_cmd);
 
 	/* send X2 header */
@@ -1631,7 +1632,7 @@ upgt_fw_load(struct upgt_softc *sc)
 	}
 	data_cmd->buflen = sizeof(struct upgt_fw_x2_header);
 	x2 = (struct upgt_fw_x2_header *)data_cmd->buf;
-	bcopy(UPGT_X2_SIGNATURE, x2->signature, UPGT_X2_SIGNATURE_SIZE);
+	memcpy(x2->signature, UPGT_X2_SIGNATURE, UPGT_X2_SIGNATURE_SIZE);
 	x2->startaddr = htole32(UPGT_MEMADDR_FIRMWARE_START);
 	x2->len = htole32(fw->datasize);
 	x2->crc = upgt_crc32_le((uint8_t *)data_cmd->buf +
@@ -1925,7 +1926,7 @@ upgt_device_reset(struct upgt_softc *sc)
 		UPGT_UNLOCK(sc);
 		return (ENOBUFS);
 	}
-	bcopy(init_cmd, data->buf, sizeof(init_cmd));
+	memcpy(data->buf, init_cmd, sizeof(init_cmd));
 	data->buflen = sizeof(init_cmd);
 	upgt_bulk_tx(sc, data);
 	usb_pause_mtx(&sc->sc_mtx, 100);
@@ -2178,7 +2179,7 @@ upgt_tx_start(struct upgt_softc *sc, str
 	}
 
 	/* Transmit the URB containing the TX data.  */
-	bzero(data->buf, MCLBYTES);
+	memset(data->buf, 0, MCLBYTES);
 	mem = (struct upgt_lmac_mem *)data->buf;
 	mem->addr = htole32(data->addr);
 	txdesc = (struct upgt_lmac_tx_desc *)(mem + 1);
@@ -2192,7 +2193,7 @@ upgt_tx_start(struct upgt_softc *sc, str
 	} else {
 		/* data frames  */
 		txdesc->header1.flags = UPGT_H1_FLAGS_TX_DATA;
-		bcopy(sc->sc_cur_rateset, txdesc->rates, sizeof(txdesc->rates));
+		memcpy(txdesc->rates, sc->sc_cur_rateset, sizeof(txdesc->rates));
 	}
 	txdesc->header1.type = UPGT_H1_TYPE_TX_DATA;
 	txdesc->header1.len = htole16(m->m_pkthdr.len);

Modified: stable/8/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- stable/8/sys/dev/usb/wlan/if_urtw.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/wlan/if_urtw.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -1745,7 +1745,7 @@ urtw_tx_start(struct urtw_softc *sc, str
 	if ((0 == xferlen % 64) || (0 == xferlen % 512))
 		xferlen += 1;
 
-	bzero(data->buf, URTW_TX_MAXSIZE);
+	memset(data->buf, 0, URTW_TX_MAXSIZE);
 	flags = m0->m_pkthdr.len & 0xfff;
 	flags |= URTW_TX_FLAG_NO_ENC;
 	if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&

Modified: stable/8/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- stable/8/sys/dev/usb/wlan/if_zyd.c	Sat Dec  3 14:32:10 2011	(r228228)
+++ stable/8/sys/dev/usb/wlan/if_zyd.c	Sat Dec  3 14:38:54 2011	(r228229)
@@ -683,7 +683,7 @@ zyd_intr_read_callback(struct usb_xfer *
 				if (i != cnt)
 					continue;
 				/* copy answer into caller-supplied buffer */
-				bcopy(cmd->data, rqp->odata, rqp->olen);
+				memcpy(rqp->odata, cmd->data, rqp->olen);
 				DPRINTF(sc, ZYD_DEBUG_CMD,
 				    "command %p complete, data = %*D \n",
 				    rqp, rqp->olen, rqp->odata, ":");
@@ -783,7 +783,7 @@ zyd_cmd(struct zyd_softc *sc, uint16_t c
 		return (EINVAL);
 
 	cmd.code = htole16(code);
-	bcopy(idata, cmd.data, ilen);
+	memcpy(cmd.data, idata, ilen);
 	DPRINTF(sc, ZYD_DEBUG_CMD, "sending cmd %p = %*D\n",
 	    &rq, ilen, idata, ":");
 



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