> Date: Mon, 20 Jun 2011 19:30:52 -0400 (EDT) > From: Ted Unangst <ted.unan...@gmail.com> > > there's no need to cast to char *.
Some of those now will fit on a single line. > Index: dc.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/dc.c,v > retrieving revision 1.122 > diff -u -r1.122 dc.c > --- dc.c 5 Mar 2011 13:39:26 -0000 1.122 > +++ dc.c 20 Jun 2011 23:22:22 -0000 > @@ -749,7 +749,7 @@ > struct dc_mii_frame frame; > int i, phy_reg; > > - bzero((char *)&frame, sizeof(frame)); > + bzero(&frame, sizeof(frame)); > > if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) > return; > @@ -903,7 +903,7 @@ > sc->dc_cdata.dc_tx_cnt++; > sframe = &sc->dc_ldata->dc_tx_list[i]; > sp = &sc->dc_ldata->dc_sbuf[0]; > - bzero((char *)sp, DC_SFRAME_LEN); > + bzero(sp, DC_SFRAME_LEN); > > sframe->dc_data = htole32(sc->sc_listmap->dm_segs[0].ds_addr + > offsetof(struct dc_list_data, dc_sbuf)); > @@ -1126,7 +1126,7 @@ > sc->dc_cdata.dc_tx_cnt++; > sframe = &sc->dc_ldata->dc_tx_list[i]; > sp = &sc->dc_ldata->dc_sbuf[0]; > - bzero((char *)sp, DC_SFRAME_LEN); > + bzero(sp, DC_SFRAME_LEN); > > sframe->dc_data = htole32(sc->sc_listmap->dm_segs[0].ds_addr + > offsetof(struct dc_list_data, dc_sbuf)); > @@ -1934,7 +1934,7 @@ > * 82c169 chips. > */ > if (sc->dc_flags & DC_PNIC_RX_BUG_WAR) > - bzero((char *)mtod(m_new, char *), m_new->m_len); > + bzero(mtod(m_new, char *), m_new->m_len); > > bus_dmamap_sync(sc->sc_dmat, sc->dc_cdata.dc_rx_chain[i].sd_map, 0, > sc->dc_cdata.dc_rx_chain[i].sd_map->dm_mapsize, > @@ -3112,7 +3112,7 @@ > sc->dc_cdata.dc_rx_chain[i].sd_mbuf = NULL; > } > } > - bzero((char *)&sc->dc_ldata->dc_rx_list, > + bzero(&sc->dc_ldata->dc_rx_list, > sizeof(sc->dc_ldata->dc_rx_list)); > > /* > @@ -3136,7 +3136,7 @@ > sc->dc_cdata.dc_tx_chain[i].sd_mbuf = NULL; > } > } > - bzero((char *)&sc->dc_ldata->dc_tx_list, > + bzero(&sc->dc_ldata->dc_tx_list, > sizeof(sc->dc_ldata->dc_tx_list)); > > bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap, > Index: if_wi.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/if_wi.c,v > retrieving revision 1.149 > diff -u -r1.149 if_wi.c > --- if_wi.c 30 Aug 2010 20:42:27 -0000 1.149 > +++ if_wi.c 20 Jun 2011 23:25:38 -0000 > @@ -226,7 +226,7 @@ > printf(": unable to read station address\n"); > return (error); > } > - bcopy((char *)&mac.wi_mac_addr, (char *)&ic->ic_myaddr, > + bcopy(&mac.wi_mac_addr, &ic->ic_myaddr, > IEEE80211_ADDR_LEN); > > wi_get_id(sc); > @@ -332,7 +332,7 @@ > sc->wi_flags |= WI_FLAGS_HAS_WEP; > timeout_set(&sc->sc_timo, funcs->f_inquire, sc); > > - bzero((char *)&sc->wi_stats, sizeof(sc->wi_stats)); > + bzero(&sc->wi_stats, sizeof(sc->wi_stats)); > > /* Find supported rates. */ > rates.wi_type = WI_RID_DATA_RATES; > @@ -730,12 +730,12 @@ > m->m_pkthdr.len = m->m_len = > letoh16(rx_frame.wi_dat_len) + WI_SNAPHDR_LEN; > > - bcopy((char *)&rx_frame.wi_dst_addr, > - (char *)&eh->ether_dhost, ETHER_ADDR_LEN); > - bcopy((char *)&rx_frame.wi_src_addr, > - (char *)&eh->ether_shost, ETHER_ADDR_LEN); > - bcopy((char *)&rx_frame.wi_type, > - (char *)&eh->ether_type, ETHER_TYPE_LEN); > + bcopy(&rx_frame.wi_dst_addr, > + &eh->ether_dhost, ETHER_ADDR_LEN); > + bcopy(&rx_frame.wi_src_addr, > + &eh->ether_shost, ETHER_ADDR_LEN); > + bcopy(&rx_frame.wi_type, > + &eh->ether_type, ETHER_TYPE_LEN); > > if (wi_read_data(sc, id, WI_802_11_OFFSET, > mtod(m, caddr_t) + sizeof(struct ether_header), > @@ -1402,7 +1402,7 @@ > > ifp = &sc->sc_ic.ic_if; > > - bzero((char *)&mcast, sizeof(mcast)); > + bzero(&mcast, sizeof(mcast)); > > mcast.wi_type = WI_RID_MCAST_LIST; > mcast.wi_len = ((ETHER_ADDR_LEN / 2) * 16) + 1; > @@ -1416,7 +1416,7 @@ > ETHER_FIRST_MULTI(step, &sc->sc_ic.ic_ac, enm); > while (enm != NULL) { > if (i >= 16) { > - bzero((char *)&mcast, sizeof(mcast)); > + bzero(&mcast, sizeof(mcast)); > break; > } > > @@ -1424,7 +1424,7 @@ > ifp->if_flags |= IFF_ALLMULTI; > goto allmulti; > } > - bcopy(enm->enm_addrlo, (char *)&mcast.wi_mcast[i], > + bcopy(enm->enm_addrlo, &mcast.wi_mcast[i], > ETHER_ADDR_LEN); > i++; > ETHER_NEXT_MULTI(step, enm); > @@ -1446,9 +1446,9 @@ > > switch(wreq->wi_type) { > case WI_RID_MAC_NODE: > - bcopy((char *)&wreq->wi_val, LLADDR(ifp->if_sadl), > + bcopy(&wreq->wi_val, LLADDR(ifp->if_sadl), > ETHER_ADDR_LEN); > - bcopy((char *)&wreq->wi_val, (char *)&sc->sc_ic.ic_myaddr, > + bcopy(&wreq->wi_val, &sc->sc_ic.ic_myaddr, > ETHER_ADDR_LEN); > break; > case WI_RID_PORTTYPE: > @@ -1515,7 +1515,7 @@ > sc->wi_tx_key = letoh16(wreq->wi_val[0]); > break; > case WI_RID_DEFLT_CRYPT_KEYS: > - bcopy((char *)wreq, (char *)&sc->wi_keys, > + bcopy(wreq, &sc->wi_keys, > sizeof(struct wi_ltv_keys)); > break; > case WI_FRID_CRYPTO_ALG: > @@ -1628,7 +1628,7 @@ > switch (wreq->wi_type) { > case WI_RID_IFACE_STATS: > /* XXX native byte order */ > - bcopy((char *)&sc->wi_stats, (char *)&wreq->wi_val, > + bcopy(&sc->wi_stats, &wreq->wi_val, > sizeof(sc->wi_stats)); > wreq->wi_len = (sizeof(sc->wi_stats) / 2) + 1; > break; > @@ -1637,7 +1637,7 @@ > if (suser(p, 0)) > bzero(wreq, sizeof(struct wi_ltv_keys)); > else > - bcopy((char *)&sc->wi_keys, wreq, > + bcopy(&sc->wi_keys, wreq, > sizeof(struct wi_ltv_keys)); > break; > case WI_RID_PROCFRAME: > @@ -2162,9 +2162,9 @@ > mac.wi_len = 4; > mac.wi_type = WI_RID_MAC_NODE; > bcopy(LLADDR(ifp->if_sadl), > - (char *)&sc->sc_ic.ic_myaddr, ETHER_ADDR_LEN); > - bcopy((char *)&sc->sc_ic.ic_myaddr, > - (char *)&mac.wi_mac_addr, ETHER_ADDR_LEN); > + &sc->sc_ic.ic_myaddr, ETHER_ADDR_LEN); > + bcopy(&sc->sc_ic.ic_myaddr, > + &mac.wi_mac_addr, ETHER_ADDR_LEN); > wi_write_record(sc, (struct wi_ltv_gen *)&mac); > > /* > @@ -2268,8 +2268,8 @@ > key[2] = sc->wi_icv; > > klen = letoh16(sc->wi_keys.wi_keys[sc->wi_tx_key].wi_keylen); > - bcopy((char *)&sc->wi_keys.wi_keys[sc->wi_tx_key].wi_keydat, > - (char *)key + IEEE80211_WEP_IVLEN, klen); > + bcopy(&sc->wi_keys.wi_keys[sc->wi_tx_key].wi_keydat, > + key + IEEE80211_WEP_IVLEN, klen); > klen = (klen > IEEE80211_WEP_KEYLEN) ? RC4KEYLEN : RC4KEYLEN / 2; > > /* rc4 keysetup */ > @@ -2320,8 +2320,8 @@ > dat += 4; > > klen = letoh16(sc->wi_keys.wi_keys[kid].wi_keylen); > - bcopy((char *)&sc->wi_keys.wi_keys[kid].wi_keydat, > - (char *)key + IEEE80211_WEP_IVLEN, klen); > + bcopy(&sc->wi_keys.wi_keys[kid].wi_keydat, > + key + IEEE80211_WEP_IVLEN, klen); > klen = (klen > IEEE80211_WEP_KEYLEN) ? RC4KEYLEN : RC4KEYLEN / 2; > > /* rc4 keysetup */ > @@ -2371,7 +2371,7 @@ > if (m0 == NULL) > return; > > - bzero((char *)&tx_frame, sizeof(tx_frame)); > + bzero(&tx_frame, sizeof(tx_frame)); > tx_frame.wi_frame_ctl = htole16(WI_FTYPE_DATA | WI_STYPE_DATA); > id = sc->wi_tx_data_id; > eh = mtod(m0, struct ether_header *); > @@ -2397,33 +2397,33 @@ > eh->ether_type == htons(ETHERTYPE_ARP) || > eh->ether_type == htons(ETHERTYPE_REVARP) || > eh->ether_type == htons(ETHERTYPE_IPV6)) { > - bcopy((char *)&eh->ether_dhost, > - (char *)&tx_frame.wi_addr1, ETHER_ADDR_LEN); > + bcopy(&eh->ether_dhost, > + &tx_frame.wi_addr1, ETHER_ADDR_LEN); > if (sc->wi_ptype == WI_PORTTYPE_HOSTAP) { > tx_frame.wi_tx_ctl = htole16(WI_ENC_TX_MGMT); /* XXX */ > tx_frame.wi_frame_ctl |= htole16(WI_FCTL_FROMDS); > - bcopy((char *)&sc->sc_ic.ic_myaddr, > - (char *)&tx_frame.wi_addr2, ETHER_ADDR_LEN); > - bcopy((char *)&eh->ether_shost, > - (char *)&tx_frame.wi_addr3, ETHER_ADDR_LEN); > + bcopy(&sc->sc_ic.ic_myaddr, > + &tx_frame.wi_addr2, ETHER_ADDR_LEN); > + bcopy(&eh->ether_shost, > + &tx_frame.wi_addr3, ETHER_ADDR_LEN); > if (sc->wi_use_wep) > hostencrypt = 1; > } else if (sc->wi_ptype == WI_PORTTYPE_BSS && sc->wi_use_wep && > sc->wi_crypto_algorithm != WI_CRYPTO_FIRMWARE_WEP) { > tx_frame.wi_tx_ctl = htole16(WI_ENC_TX_MGMT); /* XXX */ > tx_frame.wi_frame_ctl |= htole16(WI_FCTL_TODS); > - bcopy((char *)&sc->sc_ic.ic_myaddr, > - (char *)&tx_frame.wi_addr2, ETHER_ADDR_LEN); > - bcopy((char *)&eh->ether_dhost, > - (char *)&tx_frame.wi_addr3, ETHER_ADDR_LEN); > + bcopy(&sc->sc_ic.ic_myaddr, > + &tx_frame.wi_addr2, ETHER_ADDR_LEN); > + bcopy(&eh->ether_dhost, > + &tx_frame.wi_addr3, ETHER_ADDR_LEN); > hostencrypt = 1; > } else > - bcopy((char *)&eh->ether_shost, > - (char *)&tx_frame.wi_addr2, ETHER_ADDR_LEN); > - bcopy((char *)&eh->ether_dhost, > - (char *)&tx_frame.wi_dst_addr, ETHER_ADDR_LEN); > - bcopy((char *)&eh->ether_shost, > - (char *)&tx_frame.wi_src_addr, ETHER_ADDR_LEN); > + bcopy(&eh->ether_shost, > + &tx_frame.wi_addr2, ETHER_ADDR_LEN); > + bcopy(&eh->ether_dhost, > + &tx_frame.wi_dst_addr, ETHER_ADDR_LEN); > + bcopy(&eh->ether_shost, > + &tx_frame.wi_src_addr, ETHER_ADDR_LEN); > > tx_frame.wi_dat_len = m0->m_pkthdr.len - WI_SNAPHDR_LEN; > tx_frame.wi_dat[0] = htons(WI_SNAP_WORD0); > @@ -2526,10 +2526,10 @@ > hdr = (struct wi_80211_hdr *)data; > dptr = data + sizeof(struct wi_80211_hdr); > > - bzero((char *)&tx_frame, sizeof(tx_frame)); > + bzero(&tx_frame, sizeof(tx_frame)); > id = sc->wi_tx_mgmt_id; > > - bcopy((char *)hdr, (char *)&tx_frame.wi_frame_ctl, > + bcopy(hdr, &tx_frame.wi_frame_ctl, > sizeof(struct wi_80211_hdr)); > > tx_frame.wi_tx_ctl = htole16(WI_ENC_TX_MGMT); > Index: if_wireg.h > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/if_wireg.h,v > retrieving revision 1.39 > diff -u -r1.39 if_wireg.h > --- if_wireg.h 3 Feb 2008 15:04:37 -0000 1.39 > +++ if_wireg.h 20 Jun 2011 23:25:58 -0000 > @@ -356,7 +356,7 @@ > int l; \ > \ > l = (str.i_len + 1) & ~0x1; \ > - bzero((char *)&s, sizeof(s)); \ > + bzero(&s, sizeof(s)); \ > s.wi_len = (l / 2) + 2; \ > s.wi_type = recno; \ > s.wi_str[0] = htole16(str.i_len); \ > Index: mtd8xx.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/mtd8xx.c,v > retrieving revision 1.17 > diff -u -r1.17 mtd8xx.c > --- mtd8xx.c 19 May 2010 15:27:35 -0000 1.17 > +++ mtd8xx.c 20 Jun 2011 23:26:09 -0000 > @@ -772,7 +772,7 @@ > sc->mtd_cdata.mtd_rx_chain[i].sd_mbuf = NULL; > } > } > - bzero((char *)&sc->mtd_ldata->mtd_rx_list, > + bzero(&sc->mtd_ldata->mtd_rx_list, > sizeof(sc->mtd_ldata->mtd_rx_list)); > > /* > @@ -792,7 +792,7 @@ > } > } > > - bzero((char *)&sc->mtd_ldata->mtd_tx_list, > + bzero(&sc->mtd_ldata->mtd_tx_list, > sizeof(sc->mtd_ldata->mtd_tx_list)); > > } > Index: ncr5380sbc.c > diff -u -r1.26 ncr5380sbc.c > --- ncr5380sbc.c 26 Jun 2010 23:24:44 -0000 1.26 > +++ ncr5380sbc.c 20 Jun 2011 23:26:17 -0000 > @@ -2496,7 +2496,7 @@ > ncr5380_clear_trace() > { > ncr5380_traceidx = 0; > - bzero((char *) ncr5380_tracebuf, sizeof(ncr5380_tracebuf)); > + bzero(ncr5380_tracebuf, sizeof(ncr5380_tracebuf)); > } > > void > Index: pgt.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/pgt.c,v > retrieving revision 1.66 > diff -u -r1.66 pgt.c > --- pgt.c 20 Sep 2010 07:40:41 -0000 1.66 > +++ pgt.c 20 Jun 2011 23:27:09 -0000 > @@ -1684,10 +1684,10 @@ > pmf->pmf_size = htobe32(pmd->pmd_len); > /* "set" and "retrieve" operations both send data */ > if (pmd->pmd_sendbuf != NULL) > - memcpy((char *)pmf + sizeof(*pmf), pmd->pmd_sendbuf, > + memcpy(pmf + 1, pmd->pmd_sendbuf, > pmd->pmd_len); > else > - bzero((char *)pmf + sizeof(*pmf), pmd->pmd_len); > + bzero(pmf + 1, pmd->pmd_len); > pmd->pmd_error = EINPROGRESS; > TAILQ_INSERT_TAIL(&sc->sc_mgmtinprog, pmd, pmd_link); > if (sc->sc_debug & SC_DEBUG_MGMT) > Index: rtl81x9.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/rtl81x9.c,v > retrieving revision 1.74 > diff -u -r1.74 rtl81x9.c > --- rtl81x9.c 7 Sep 2010 16:21:42 -0000 1.74 > +++ rtl81x9.c 20 Jun 2011 23:27:24 -0000 > @@ -1313,7 +1313,7 @@ > return (CSR_READ_2(sc, rl8139_reg)); > } > > - bzero((char *)&frame, sizeof(frame)); > + bzero(&frame, sizeof(frame)); > > frame.mii_phyaddr = phy; > frame.mii_regaddr = reg; > @@ -1357,7 +1357,7 @@ > return; > } > > - bzero((char *)&frame, sizeof(frame)); > + bzero(&frame, sizeof(frame)); > frame.mii_phyaddr = phy; > frame.mii_regaddr = reg; > frame.mii_data = val; > Index: ti.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/ti.c,v > retrieving revision 1.3 > diff -u -r1.3 ti.c > --- ti.c 20 Sep 2010 07:40:41 -0000 1.3 > +++ ti.c 20 Jun 2011 23:28:13 -0000 > @@ -954,7 +954,7 @@ > sc->ti_cdata.ti_rx_std_map[i]); > sc->ti_cdata.ti_rx_std_map[i] = 0; > } > - bzero((char *)&sc->ti_rdata->ti_rx_std_ring[i], > + bzero(&sc->ti_rdata->ti_rx_std_ring[i], > sizeof(struct ti_rx_desc)); > } > } > @@ -986,7 +986,7 @@ > m_freem(sc->ti_cdata.ti_rx_jumbo_chain[i]); > sc->ti_cdata.ti_rx_jumbo_chain[i] = NULL; > } > - bzero((char *)&sc->ti_rdata->ti_rx_jumbo_ring[i], > + bzero(&sc->ti_rdata->ti_rx_jumbo_ring[i], > sizeof(struct ti_rx_desc)); > } > } > @@ -1020,7 +1020,7 @@ > sc->ti_cdata.ti_rx_mini_map[i]); > sc->ti_cdata.ti_rx_mini_map[i] = 0; > } > - bzero((char *)&sc->ti_rdata->ti_rx_mini_ring[i], > + bzero(&sc->ti_rdata->ti_rx_mini_ring[i], > sizeof(struct ti_rx_desc)); > } > } > @@ -1042,7 +1042,7 @@ > sc->ti_cdata.ti_tx_map[i], link); > sc->ti_cdata.ti_tx_map[i] = 0; > } > - bzero((char *)&sc->ti_rdata->ti_tx_ring[i], > + bzero(&sc->ti_rdata->ti_tx_ring[i], > sizeof(struct ti_tx_desc)); > } > > @@ -1199,7 +1199,7 @@ > if (mc == NULL) > panic("ti_iff"); > > - bcopy(enm->enm_addrlo, (char *)&mc->mc_addr, > + bcopy(enm->enm_addrlo, &mc->mc_addr, > ETHER_ADDR_LEN); > SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, > mc_entries); > @@ -1510,7 +1510,7 @@ > * a Tigon 1 chip. > */ > CSR_WRITE_4(sc, TI_WINBASE, TI_TX_RING_BASE); > - bzero((char *)sc->ti_rdata->ti_tx_ring, > + bzero(sc->ti_rdata->ti_tx_ring, > TI_TX_RING_CNT * sizeof(struct ti_tx_desc)); > rcb = &sc->ti_rdata->ti_info.ti_tx_rcb; > if (sc->ti_hwrev == TI_HWREV_TIGON) > Index: xl.c > =================================================================== > RCS file: /home/tedu/cvs/src/sys/dev/ic/xl.c,v > retrieving revision 1.101 > diff -u -r1.101 xl.c > --- xl.c 17 Apr 2011 20:52:43 -0000 1.101 > +++ xl.c 20 Jun 2011 23:28:44 -0000 > @@ -450,7 +450,7 @@ > if (!(sc->xl_flags & XL_FLAG_PHYOK) && phy != 24) > return (0); > > - bzero((char *)&frame, sizeof(frame)); > + bzero(&frame, sizeof(frame)); > > frame.mii_phyaddr = phy; > frame.mii_regaddr = reg; > @@ -468,7 +468,7 @@ > if (!(sc->xl_flags & XL_FLAG_PHYOK) && phy != 24) > return; > > - bzero((char *)&frame, sizeof(frame)); > + bzero(&frame, sizeof(frame)); > > frame.mii_phyaddr = phy; > frame.mii_regaddr = reg; > @@ -1049,7 +1049,7 @@ > cd->xl_tx_chain[i].xl_prev = &cd->xl_tx_chain[prev]; > } > > - bzero((char *)ld->xl_tx_list, sizeof(struct xl_list) * XL_TX_LIST_CNT); > + bzero(ld->xl_tx_list, sizeof(struct xl_list) * XL_TX_LIST_CNT); > ld->xl_tx_list[0].xl_status = htole32(XL_TXSTAT_EMPTY); > > cd->xl_tx_prod = 1; > @@ -1533,7 +1533,7 @@ > int i; > struct mii_data *mii = NULL; > > - bzero((char *)&xl_stats, sizeof(struct xl_stats)); > + bzero(&xl_stats, sizeof(struct xl_stats)); > > sc = xsc; > ifp = &sc->sc_arpcom.ac_if; > @@ -2308,7 +2308,7 @@ > sc->xl_cdata.xl_rx_chain[i].xl_mbuf = NULL; > } > } > - bzero((char *)&sc->xl_ldata->xl_rx_list, > + bzero(&sc->xl_ldata->xl_rx_list, > sizeof(sc->xl_ldata->xl_rx_list)); > /* > * Free the TX list buffers. > @@ -2326,7 +2326,7 @@ > sc->xl_cdata.xl_tx_chain[i].xl_mbuf = NULL; > } > } > - bzero((char *)&sc->xl_ldata->xl_tx_list, > + bzero(&sc->xl_ldata->xl_tx_list, > sizeof(sc->xl_ldata->xl_tx_list)); > } > > @@ -2400,7 +2400,7 @@ > sc->sc_dev.dv_xname); > return; > } > - bcopy(enaddr, (char *)&sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); > + bcopy(enaddr, &sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); > > if (bus_dmamem_alloc(sc->sc_dmat, sizeof(struct xl_list_data), > PAGE_SIZE, 0, sc->sc_listseg, 1, &sc->sc_listnseg,