diff options
author | gd78059 <none@none> | 2008-07-01 11:22:16 -0700 |
---|---|---|
committer | gd78059 <none@none> | 2008-07-01 11:22:16 -0700 |
commit | 22eb7cb54d8a6bcf6fe2674cb4b1f0cf2d85cfb6 (patch) | |
tree | 566d50817562c3269e1facc0905dcf7adf562774 /usr/src/uts/common/io | |
parent | 7f7c96a6a7060c462769ffdab973f2d77a5845b5 (diff) | |
download | illumos-gate-22eb7cb54d8a6bcf6fe2674cb4b1f0cf2d85cfb6.tar.gz |
6692913 MBLKL generates E_PTRDIFF_OVERFLOW lint warnings
6717598 MBLKSIZE() causes lint pointer-difference warnings
Diffstat (limited to 'usr/src/uts/common/io')
28 files changed, 193 insertions, 279 deletions
diff --git a/usr/src/uts/common/io/aggr/aggr_ctl.c b/usr/src/uts/common/io/aggr/aggr_ctl.c index 1e0fdbc437..7c5e97c1b0 100644 --- a/usr/src/uts/common/io/aggr/aggr_ctl.c +++ b/usr/src/uts/common/io/aggr/aggr_ctl.c @@ -39,7 +39,6 @@ static int aggr_ioc_delete(mblk_t *, int); static int aggr_ioc_info(mblk_t *, int); static int aggr_ioc_add(mblk_t *, int); static int aggr_ioc_remove(mblk_t *, int); -static int aggr_ioc_status(mblk_t *, int); static int aggr_ioc_modify(mblk_t *, int); typedef struct ioc_cmd_s { diff --git a/usr/src/uts/common/io/asy.c b/usr/src/uts/common/io/asy.c index 12ff96c905..543ab370e4 100644 --- a/usr/src/uts/common/io/asy.c +++ b/usr/src/uts/common/io/asy.c @@ -24,7 +24,7 @@ /* All Rights Reserved */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -3124,7 +3124,7 @@ async_nstart(struct asyncline *async, int mode) continue; } - while (bp != NULL && (cc = bp->b_wptr - bp->b_rptr) == 0) { + while (bp != NULL && ((cc = MBLKL(bp)) == 0)) { nbp = bp->b_cont; freeb(bp); bp = nbp; diff --git a/usr/src/uts/common/io/ath/ath_aux.c b/usr/src/uts/common/io/ath/ath_aux.c index 3b62c04230..093250e171 100644 --- a/usr/src/uts/common/io/ath/ath_aux.c +++ b/usr/src/uts/common/io/ath/ath_aux.c @@ -560,7 +560,7 @@ ath_beacon_config(ath_t *asc) bs.bs_bmissthreshold = ic->ic_bmissthreshold; if (bs.bs_bmissthreshold > 10) bs.bs_bmissthreshold = 10; - else if (bs.bs_bmissthreshold <= 0) + else if (bs.bs_bmissthreshold < 1) bs.bs_bmissthreshold = 1; /* * Calculate sleep duration. The configuration is diff --git a/usr/src/uts/common/io/ath/ath_main.c b/usr/src/uts/common/io/ath/ath_main.c index 8244085174..dab7e138b4 100644 --- a/usr/src/uts/common/io/ath/ath_main.c +++ b/usr/src/uts/common/io/ath/ath_main.c @@ -410,7 +410,7 @@ ath_desc_alloc(dev_info_t *devinfo, ath_t *asc) for (i = 0; i < ATH_RXBUF; i++, bf++, ds++) { bf->bf_desc = ds; bf->bf_daddr = asc->asc_desc_dma.cookie.dmac_address + - ((caddr_t)ds - (caddr_t)asc->asc_desc); + ((uintptr_t)ds - (uintptr_t)asc->asc_desc); list_insert_tail(&asc->asc_rxbuf_list, bf); /* alloc DMA memory */ @@ -428,7 +428,7 @@ ath_desc_alloc(dev_info_t *devinfo, ath_t *asc) for (i = 0; i < ATH_TXBUF; i++, bf++, ds++) { bf->bf_desc = ds; bf->bf_daddr = asc->asc_desc_dma.cookie.dmac_address + - ((caddr_t)ds - (caddr_t)asc->asc_desc); + ((uintptr_t)ds - (uintptr_t)asc->asc_desc); list_insert_tail(&asc->asc_txbuf_list, bf); /* alloc DMA memory */ @@ -698,7 +698,7 @@ ath_tx_start(ath_t *asc, struct ieee80211_node *in, struct ath_buf *bf, bcopy(mp->b_rptr, dest, mblen); dest += mblen; } - mbslen = dest - bf->bf_dma.mem_va; + mbslen = (uintptr_t)dest - (uintptr_t)bf->bf_dma.mem_va; pktlen += mbslen; bf->bf_in = in; diff --git a/usr/src/uts/common/io/audio/sada/framework/audio_support.c b/usr/src/uts/common/io/audio/sada/framework/audio_support.c index acf3cbe3f0..109583493d 100644 --- a/usr/src/uts/common/io/audio/sada/framework/audio_support.c +++ b/usr/src/uts/common/io/audio/sada/framework/audio_support.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1056,7 +1055,7 @@ audio_sup_wput(queue_t *q, mblk_t *mp) break; default: ATRACE("audio_sup_wput() IOCTL calling ch_wput()", - chptr); + chptr); rc = chptr->ch_wput(q, mp); } break; @@ -2454,7 +2453,7 @@ audio_sup_construct_minor(audiohdl_t handle, audio_device_type_e device_type) ATRACE_32("in audio_sup_construct_minor()", device_type); minor = (ddi_get_instance(dip) * minors_per_inst) + - audio_sup_type_to_minor(device_type); + audio_sup_type_to_minor(device_type); ATRACE_32("audio_sup_construct_minor() returning", minor); @@ -2659,7 +2658,7 @@ audio_sup_devt_to_ch_type(audio_state_t *statep, dev_t dev) ATRACE("audio_sup_devt_to_ch_type() statep", statep); chptr = &statep->as_channels[audio_sup_minor_to_ch( - statep, minor)]; + statep, minor)]; ATRACE("audio_sup_devt_to_ch_type() chptr", chptr); @@ -2851,7 +2850,7 @@ audio_sup_mblk_alloc(mblk_t *mp, size_t size) } /* no memory leak, time to allocate the new message */ - mp->b_cont = (struct msgb *)allocb((size), BPRI_HI); + mp->b_cont = allocb((size), BPRI_HI); if (mp->b_cont == NULL) { return (AUDIO_FAILURE); } @@ -3194,8 +3193,10 @@ audio_sup_get_qptr_instance(queue_t *q) dev_t dev = audio_sup_get_qptr_dev(q); audio_state_t *statep = audio_sup_devt_to_state(dev); int minor = getminor(dev); - int instance = minor / audio_sup_get_minors_per_inst( - AUDIO_STATE2HDL(statep)); + int instance; + + instance = minor / audio_sup_get_minors_per_inst( + AUDIO_STATE2HDL(statep)); ATRACE("in audio_sup_get_qptr_instance()", q); ATRACE_32("in audio_sup_get_qptr_instance() returning", instance); @@ -3247,7 +3248,7 @@ audio_sup_devt_to_state(dev_t dev) my_dip = statep->as_dip; my_major = statep->as_major; instance = getminor(dev) / - audio_sup_get_minors_per_inst(AUDIO_STATE2HDL(statep)); + audio_sup_get_minors_per_inst(AUDIO_STATE2HDL(statep)); if ((my_major == major) && (instance == ddi_get_instance(my_dip))) { @@ -3964,7 +3965,7 @@ audio_sup_wioctl(queue_t *q, mblk_t *mp, audio_ch_t *chptr) /* make sure this is a transparent ioctl */ if (iocbp->ioc_count != TRANSPARENT) { ATRACE_32("audio_sup_wioctl() not TRANSPARENT", - iocbp->ioc_count); + iocbp->ioc_count); error = EINVAL; goto nack; } @@ -3999,7 +4000,7 @@ audio_sup_wioctl(queue_t *q, mblk_t *mp, audio_ch_t *chptr) qreply(q, mp); ATRACE("audio_sup_wioctl() AUDIO_GET_CH_NUMBER returning", - chptr); + chptr); return (0); @@ -4069,10 +4070,9 @@ audio_sup_wioctl(queue_t *q, mblk_t *mp, audio_ch_t *chptr) state->ais_address, NULL); /* put the data in the buffer, but try to reuse it first */ - if ((mp->b_cont->b_datap->db_lim - - mp->b_cont->b_datap->db_base) < sizeof (audio_device_t)) { + if (MBLKSIZE(mp->b_cont) < sizeof (audio_device_t)) { freemsg(mp->b_cont); - mp->b_cont = (struct msgb *)allocb( + mp->b_cont = allocb( sizeof (*chptr->ch_dev_info), BPRI_MED); if (mp->b_cont == NULL) { error = EAGAIN; @@ -4112,12 +4112,10 @@ audio_sup_wioctl(queue_t *q, mblk_t *mp, audio_ch_t *chptr) state->ais_address, NULL); /* put the data in the buffer, but try to reuse it first */ - if ((mp->b_cont->b_datap->db_lim - - mp->b_cont->b_datap->db_base) < - sizeof (*chptr->ch_dev_info)) { + if (MBLKSIZE(mp->b_cont) < sizeof (*chptr->ch_dev_info)) { freemsg(mp->b_cont); - mp->b_cont = (struct msgb *)allocb( - sizeof (*chptr->ch_dev_info), BPRI_MED); + mp->b_cont = allocb( + sizeof (*chptr->ch_dev_info), BPRI_MED); if (mp->b_cont == NULL) { error = EAGAIN; goto nack; @@ -4157,11 +4155,9 @@ audio_sup_wioctl(queue_t *q, mblk_t *mp, audio_ch_t *chptr) state->ais_address, NULL); /* put the data in the buffer, but try to reuse it first */ - if ((mp->b_cont->b_datap->db_lim - - mp->b_cont->b_datap->db_base) < - sizeof (*chptr->ch_dev_info)) { + if (MBLKSIZE(mp->b_cont) < sizeof (*chptr->ch_dev_info)) { freemsg(mp->b_cont); - mp->b_cont = (struct msgb *)allocb( + mp->b_cont = allocb( sizeof (*chptr->ch_dev_info), BPRI_MED); if (mp->b_cont == NULL) { error = EAGAIN; diff --git a/usr/src/uts/common/io/dmfe/dmfe_main.c b/usr/src/uts/common/io/dmfe/dmfe_main.c index 93653c95bb..1e0c257ddc 100644 --- a/usr/src/uts/common/io/dmfe/dmfe_main.c +++ b/usr/src/uts/common/io/dmfe/dmfe_main.c @@ -278,19 +278,19 @@ static uchar_t dmfe_broadcast_addr[ETHERADDRL] = { uint32_t dmfe_chip_get32(dmfe_t *dmfep, off_t offset) { - caddr_t addr; + uint32_t *addr; - addr = dmfep->io_reg + offset; - return (ddi_get32(dmfep->io_handle, (uint32_t *)addr)); + addr = (void *)(dmfep->io_reg + offset); + return (ddi_get32(dmfep->io_handle, addr)); } void dmfe_chip_put32(dmfe_t *dmfep, off_t offset, uint32_t value) { - caddr_t addr; + uint32_t *addr; - addr = dmfep->io_reg + offset; - ddi_put32(dmfep->io_handle, (uint32_t *)addr, value); + addr = (void *)(dmfep->io_reg + offset); + ddi_put32(dmfep->io_handle, addr, value); } /* @@ -301,7 +301,7 @@ dmfe_ring_get32(dma_area_t *dma_p, uint_t index, uint_t offset) { uint32_t *addr; - addr = (uint32_t *)dma_p->mem_va; + addr = (void *)dma_p->mem_va; return (ddi_get32(dma_p->acc_hdl, addr + index*DESC_SIZE + offset)); } @@ -310,7 +310,7 @@ dmfe_ring_put32(dma_area_t *dma_p, uint_t index, uint_t offset, uint32_t value) { uint32_t *addr; - addr = (uint32_t *)dma_p->mem_va; + addr = (void *)dma_p->mem_va; ddi_put32(dma_p->acc_hdl, addr + index*DESC_SIZE + offset, value); } @@ -322,7 +322,7 @@ dmfe_setup_get32(dma_area_t *dma_p, uint_t index) { uint32_t *addr; - addr = (uint32_t *)dma_p->setup_va; + addr = (void *)dma_p->setup_va; return (ddi_get32(dma_p->acc_hdl, addr + index)); } @@ -331,7 +331,7 @@ dmfe_setup_put32(dma_area_t *dma_p, uint_t index, uint32_t value) { uint32_t *addr; - addr = (uint32_t *)dma_p->setup_va; + addr = (void *)dma_p->setup_va; ddi_put32(dma_p->acc_hdl, addr + index, value); } @@ -1145,7 +1145,7 @@ dmfe_send_msg(dmfe_t *dmfep, mblk_t *mp) * Copy all (remaining) mblks in the message ... */ for (; bp != NULL; bp = bp->b_cont) { - mblen = bp->b_wptr - bp->b_rptr; + mblen = MBLKL(bp); if ((totlen += mblen) <= DMFE_MAX_PKT_SIZE) { bcopy(bp->b_rptr, txb, mblen); txb += mblen; @@ -1683,7 +1683,7 @@ dmfe_factotum(caddr_t arg) { dmfe_t *dmfep; - dmfep = (dmfe_t *)arg; + dmfep = (void *)arg; ASSERT(dmfep->dmfe_guard == DMFE_GUARD); mutex_enter(dmfep->oplock); @@ -1939,7 +1939,7 @@ dmfe_interrupt(caddr_t arg) mblk_t *mp; boolean_t warning_msg = B_TRUE; - dmfep = (dmfe_t *)arg; + dmfep = (void *)arg; /* * A quick check as to whether the interrupt was from this @@ -2394,7 +2394,7 @@ dmfe_loop_ioctl(dmfe_t *dmfep, queue_t *wq, mblk_t *mp, int cmd) if (mp->b_cont == NULL || MBLKL(mp->b_cont) < sizeof (loopback_t)) return (IOC_INVAL); - loop_req_p = (loopback_t *)mp->b_cont->b_rptr; + loop_req_p = (void *)mp->b_cont->b_rptr; switch (cmd) { default: @@ -2465,7 +2465,7 @@ dmfe_m_ioctl(void *arg, queue_t *wq, mblk_t *mp) /* * Validate the command before bothering with the mutexen ... */ - iocp = (struct iocblk *)mp->b_rptr; + iocp = (void *)mp->b_rptr; cmd = iocp->ioc_cmd; switch (cmd) { default: diff --git a/usr/src/uts/common/io/dmfe/dmfe_mii.c b/usr/src/uts/common/io/dmfe/dmfe_mii.c index d63dfd291c..db04e18b0f 100644 --- a/usr/src/uts/common/io/dmfe/dmfe_mii.c +++ b/usr/src/uts/common/io/dmfe/dmfe_mii.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -255,7 +255,7 @@ static uint16_t dmfe_mii_response(dmfe_t *dmfep) { boolean_t ack; - uint32_t data; + uint16_t data; uint32_t tmp; int i; diff --git a/usr/src/uts/common/io/dmfe/dmfe_ndd.c b/usr/src/uts/common/io/dmfe/dmfe_ndd.c index 207c0d294a..47af8ac80b 100644 --- a/usr/src/uts/common/io/dmfe/dmfe_ndd.c +++ b/usr/src/uts/common/io/dmfe/dmfe_ndd.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -111,7 +111,7 @@ dmfe_param_get(queue_t *q, mblk_t *mp, caddr_t cp, cred_t *credp) _NOTE(ARGUNUSED(q, credp)) - ndp = (nd_param_t *)cp; + ndp = (void *)cp; (void) mi_mpprintf(mp, "%d", ndp->ndp_val); return (0); @@ -132,7 +132,7 @@ dmfe_param_set(queue_t *q, mblk_t *mp, char *value, caddr_t cp, cred_t *credp) _NOTE(ARGUNUSED(q, mp, credp)) - ndp = (nd_param_t *)cp; + ndp = (void *)cp; if (ndp->ndp_name[0] == '-') return (EACCES); /* shouldn't happen! */ @@ -145,7 +145,7 @@ dmfe_param_set(queue_t *q, mblk_t *mp, char *value, caddr_t cp, cred_t *credp) (ndp->ndp_val != new_value)) { ndp->ndp_dmfe->link_reset = B_TRUE; } - ndp->ndp_val = new_value; + ndp->ndp_val = (uint32_t)new_value; return (0); } diff --git a/usr/src/uts/common/io/ib/mgt/ibcm/ibcm_arp_link.c b/usr/src/uts/common/io/ib/mgt/ibcm/ibcm_arp_link.c index 640133b33a..af622d5c8f 100644 --- a/usr/src/uts/common/io/ib/mgt/ibcm/ibcm_arp_link.c +++ b/usr/src/uts/common/io/ib/mgt/ibcm/ibcm_arp_link.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -137,13 +137,11 @@ ibcm_arp_query_arp(ibcm_arp_prwqn_t *wqnp) } mp1->b_wptr += sizeof (void *); - /* LINTED */ - *(uintptr_t *)mp1->b_rptr = (uintptr_t)wqnp; /* store wqnp */ + *(uintptr_t *)(void *)mp1->b_rptr = (uintptr_t)wqnp; /* store wqnp */ cp = (char *)mp->b_rptr; bcopy(&ibcm_arp_areq_template, cp, sizeof (areq_t)); - /* LINTED */ - areqp = (areq_t *)cp; + areqp = (void *)cp; areqp->areq_name_length = name_len; cp = (char *)areqp + areqp->areq_name_offset; @@ -207,16 +205,14 @@ ibcm_arp_squery_arp(ibcm_arp_prwqn_t *wqnp) bzero(mp->b_rptr, len); mp->b_wptr += len + sizeof (uintptr_t); - /* LINTED */ - *(uintptr_t *)mp->b_rptr = (uintptr_t)wqnp; /* store wqnp */ + *(uintptr_t *)(void *)mp->b_rptr = (uintptr_t)wqnp; /* store wqnp */ mp->b_rptr += sizeof (uintptr_t); cp = (char *)mp->b_rptr; bcopy(&ibcm_arp_area_template, cp, sizeof (area_t)); - /* LINTED */ - areap = (area_t *)cp; + areap = (void *)cp; areap->area_cmd = AR_ENTRY_SQUERY; areap->area_name_length = name_len; cp = (char *)areap + areap->area_name_offset; @@ -233,8 +229,7 @@ ibcm_arp_squery_arp(ibcm_arp_prwqn_t *wqnp) freeb(mp); return (ENOMEM); } - /* LINTED */ - ioc = (struct iocblk *)mp1->b_rptr; + ioc = (void *)mp1->b_rptr; ioc->ioc_cmd = AR_ENTRY_SQUERY; ioc->ioc_error = 0; ioc->ioc_cr = NULL; @@ -285,8 +280,7 @@ ibcm_arp_add(ibcm_arp_prwqn_t *wqnp) cp = (char *)mp->b_rptr; bcopy(&ibcm_arp_area_template, cp, sizeof (area_t)); - /* LINTED */ - areap = (area_t *)mp->b_rptr; + areap = (void *)mp->b_rptr; areap->area_name_length = name_len; cp = (char *)areap + areap->area_name_offset; bcopy(wqnp->ifname, cp, name_len); @@ -547,14 +541,12 @@ ibcm_arp_pr_arp_query_ack(mblk_t *mp) /* * the first mblk contains the wqnp pointer for the request */ - /* LINTED */ if (MBLKL(mp) != sizeof (void *)) { freemsg(mp); return; } - /* LINTED */ - wqnp = *(ibcm_arp_prwqn_t **)mp->b_rptr; /* retrieve wqnp */ + wqnp = *(ibcm_arp_prwqn_t **)(void *)mp->b_rptr; /* retrieve wqnp */ ib_s = (ibcm_arp_streams_t *)wqnp->arg; mutex_enter(&ib_s->lock); @@ -572,15 +564,13 @@ ibcm_arp_pr_arp_query_ack(mblk_t *mp) rc = EPROTO; goto user_callback; } - /* LINTED */ if (MBLKL(mp->b_cont) < (sizeof (dl_unitdata_req_t) + IPOIB_ADDRL)) { IBTF_DPRINTF_L2(cmlog, "areq_ack: invalid len in " "dl_unitdatareq_t block\n"); rc = EPROTO; goto user_callback; } - /* LINTED */ - dlreq = (dl_unitdata_req_t *)mp->b_cont->b_rptr; + dlreq = (void *)mp->b_cont->b_rptr; if (dlreq->dl_primitive != DL_UNITDATA_REQ) { IBTF_DPRINTF_L2(cmlog, "areq_ack: invalid dl_primitive " "in dl_unitdatareq_t block\n"); @@ -639,14 +629,12 @@ ibcm_arp_pr_arp_squery_ack(mblk_t *mp) IBTF_DPRINTF_L4(cmlog, "ibcm_arp_pr_arp_squery_ack(%p)", mp); - /* LINTED */ if (MBLKL(mp) < sizeof (struct iocblk)) { freemsg(mp); return; } - /* LINTED */ - ioc = (struct iocblk *)mp->b_rptr; + ioc = (void *)mp->b_rptr; if ((ioc->ioc_cmd != AR_ENTRY_SQUERY) || (mp->b_cont == NULL)) { freemsg(mp); return; @@ -675,8 +663,7 @@ ibcm_arp_pr_arp_squery_ack(mblk_t *mp) return; } - /* LINTED */ - areap = (area_t *)mp1->b_rptr; + areap = (void *)mp1->b_rptr; cp = (char *)areap + areap->area_hw_addr_offset; bcopy(cp, &wqnp->dst_mac, IPOIB_ADDRL); diff --git a/usr/src/uts/common/io/mac/plugins/mac_ether.c b/usr/src/uts/common/io/mac/plugins/mac_ether.c index f48e4851c7..2c8938d652 100644 --- a/usr/src/uts/common/io/mac/plugins/mac_ether.c +++ b/usr/src/uts/common/io/mac/plugins/mac_ether.c @@ -331,7 +331,7 @@ mac_ether_header(const void *saddr, const void *daddr, uint32_t sap, if (mp == NULL) return (NULL); - ehp = (struct ether_header *)mp->b_rptr; + ehp = (void *)mp->b_rptr; bcopy(daddr, &(ehp->ether_dhost), ETHERADDRL); bcopy(saddr, &(ehp->ether_shost), ETHERADDRL); @@ -357,7 +357,7 @@ mac_ether_header_info(mblk_t *mp, void *mac_pdata, mac_header_info_t *hdr_info) if (MBLKL(mp) < sizeof (struct ether_header)) return (EINVAL); - ehp = (struct ether_header *)mp->b_rptr; + ehp = (void *)mp->b_rptr; ether_type = ntohs(ehp->ether_type); hdr_info->mhi_hdrsize = sizeof (struct ether_header); diff --git a/usr/src/uts/common/io/mac/plugins/mac_ib.c b/usr/src/uts/common/io/mac/plugins/mac_ib.c index 35503c6c7f..29d6d4882d 100644 --- a/usr/src/uts/common/io/mac/plugins/mac_ib.c +++ b/usr/src/uts/common/io/mac/plugins/mac_ib.c @@ -186,7 +186,7 @@ mac_ib_header(const void *saddr, const void *daddr, uint32_t sap, if (mp == NULL) return (NULL); - ibhp = (ib_header_info_t *)mp->b_rptr; + ibhp = (void *)mp->b_rptr; ibhp->ipib_rhdr.ipoib_type = htons(sap); ibhp->ipib_rhdr.ipoib_mbz = 0; bcopy(daddr, &ibhp->ib_dst, IPOIB_ADDRL); @@ -203,7 +203,7 @@ mac_ib_header_info(mblk_t *mp, void *mac_pdata, mac_header_info_t *hdr_info) if (MBLKL(mp) < sizeof (ib_header_info_t)) return (EINVAL); - ibhp = (ib_header_info_t *)mp->b_rptr; + ibhp = (void *)mp->b_rptr; hdr_info->mhi_hdrsize = sizeof (ib_header_info_t); hdr_info->mhi_daddr = (const uint8_t *)&(ibhp->ib_dst); @@ -242,7 +242,7 @@ mac_ib_header_cook(mblk_t *mp, void *pdata) if (MBLKL(mp) < sizeof (ipoib_ptxhdr_t)) return (NULL); - orig_hp = (ipoib_ptxhdr_t *)mp->b_rptr; + orig_hp = (void *)mp->b_rptr; llmp = mac_ib_header(NULL, &orig_hp->ipoib_dest, ntohs(orig_hp->ipoib_rhdr.ipoib_type), pdata, NULL, 0); if (llmp == NULL) diff --git a/usr/src/uts/common/io/mac/plugins/mac_wifi.c b/usr/src/uts/common/io/mac/plugins/mac_wifi.c index 85b8735c09..57b8d9d221 100644 --- a/usr/src/uts/common/io/mac/plugins/mac_wifi.c +++ b/usr/src/uts/common/io/mac/plugins/mac_wifi.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -297,14 +297,16 @@ mac_wifi_header_info(mblk_t *mp, void *pdata, mac_header_info_t *mhp) llcp += IEEE80211_WEP_EXTIVLEN; } - if (mp->b_wptr - llcp < sizeof (struct ieee80211_llc)) + if ((uintptr_t)mp->b_wptr - (uintptr_t)llcp < + sizeof (struct ieee80211_llc)) return (EINVAL); llc = (struct ieee80211_llc *)llcp; mhp->mhi_origsap = ntohs(llc->illc_ether_type); mhp->mhi_bindsap = mhp->mhi_origsap; mhp->mhi_pktsize = 0; - mhp->mhi_hdrsize = llcp + sizeof (*llc) - mp->b_rptr; + mhp->mhi_hdrsize = (uintptr_t)llcp + sizeof (*llc) - + (uintptr_t)mp->b_rptr; /* * Verify the LLC header is one of the known formats. As per MSFT's @@ -367,7 +369,7 @@ mac_wifi_header_cook(mblk_t *mp, void *pdata) if (MBLKL(mp) < sizeof (struct ether_header)) return (NULL); - ehp = (struct ether_header *)mp->b_rptr; + ehp = (void *)mp->b_rptr; llmp = mac_wifi_header(&ehp->ether_shost, &ehp->ether_dhost, ntohs(ehp->ether_type), pdata, NULL, 0); if (llmp == NULL) diff --git a/usr/src/uts/common/io/pcwl/pcwl.c b/usr/src/uts/common/io/pcwl/pcwl.c index 6a5eed3a4e..19344459a3 100644 --- a/usr/src/uts/common/io/pcwl/pcwl.c +++ b/usr/src/uts/common/io/pcwl/pcwl.c @@ -943,7 +943,7 @@ pcwl_send(pcwl_maci_t *pcwl_p, mblk_t *mblk_p) #ifdef DEBUG if (pcwl_debug & PCWL_DBG_SEND) { cmn_err(CE_NOTE, "pcwl send: packet"); - for (i = 0; i < mblk_p->b_wptr - mblk_p->b_rptr; i++) + for (i = 0; i < MBLKL(mblk_p); i++) cmn_err(CE_NOTE, "%x: %x\n", i, *((unsigned char *)mblk_p->b_rptr + i)); } diff --git a/usr/src/uts/common/io/rge/rge_chip.c b/usr/src/uts/common/io/rge/rge_chip.c index ce0ee66d80..a220750a43 100755 --- a/usr/src/uts/common/io/rge/rge_chip.c +++ b/usr/src/uts/common/io/rge/rge_chip.c @@ -130,38 +130,6 @@ rge_reg_put16(rge_t *rgep, uintptr_t regno, uint16_t data) ddi_put16(rgep->io_handle, REG16(rgep, regno), data); } -static void rge_reg_set16(rge_t *rgep, uintptr_t regno, uint16_t bits); -#pragma inline(rge_reg_set16) - -static void -rge_reg_set16(rge_t *rgep, uintptr_t regno, uint16_t bits) -{ - uint16_t regval; - - RGE_TRACE(("rge_reg_set16($%p, 0x%lx, 0x%x)", - (void *)rgep, regno, bits)); - - regval = rge_reg_get16(rgep, regno); - regval |= bits; - rge_reg_put16(rgep, regno, regval); -} - -static void rge_reg_clr16(rge_t *rgep, uintptr_t regno, uint16_t bits); -#pragma inline(rge_reg_clr16) - -static void -rge_reg_clr16(rge_t *rgep, uintptr_t regno, uint16_t bits) -{ - uint16_t regval; - - RGE_TRACE(("rge_reg_clr16($%p, 0x%lx, 0x%x)", - (void *)rgep, regno, bits)); - - regval = rge_reg_get16(rgep, regno); - regval &= ~bits; - rge_reg_put16(rgep, regno, regval); -} - static uint8_t rge_reg_get8(rge_t *rgep, uintptr_t regno); #pragma inline(rge_reg_get8) @@ -328,7 +296,7 @@ rge_atomic_shl32(uint32_t *sp, uint_t count) */ #if RGE_DEBUGGING -static void +void rge_phydump(rge_t *rgep) { uint16_t regs[32]; @@ -349,44 +317,6 @@ rge_phydump(rge_t *rgep) #endif /* RGE_DEBUGGING */ -/* - * Basic low-level function to probe for a PHY - * - * Returns TRUE if the PHY responds with valid data, FALSE otherwise - */ -static boolean_t -rge_phy_probe(rge_t *rgep) -{ - uint16_t phy_status; - - ASSERT(mutex_owned(rgep->genlock)); - - /* - * Read the MII_STATUS register twice, in - * order to clear any sticky bits (but they should - * have been cleared by the RESET, I think). - */ - phy_status = rge_mii_get16(rgep, MII_STATUS); - phy_status = rge_mii_get16(rgep, MII_STATUS); - RGE_DEBUG(("rge_phy_probe: status 0x%x", phy_status)); - - /* - * Now check the value read; it should have at least one bit set - * (for the device capabilities) and at least one clear (one of - * the error bits). So if we see all 0s or all 1s, there's a - * problem. In particular, rge_mii_get16() returns all 1s if - * communications fails ... - */ - switch (phy_status) { - case 0x0000: - case 0xffff: - return (B_FALSE); - - default : - return (B_TRUE); - } -} - static void rge_phy_check(rge_t *rgep) { diff --git a/usr/src/uts/common/io/rge/rge_rxtx.c b/usr/src/uts/common/io/rge/rge_rxtx.c index 7291d27f13..301b023e5a 100755 --- a/usr/src/uts/common/io/rge/rge_rxtx.c +++ b/usr/src/uts/common/io/rge/rge_rxtx.c @@ -525,7 +525,7 @@ rge_send_copy(rge_t *rgep, mblk_t *mp, uint16_t tci) bcopy(bp->b_rptr, txb, 2 * ETHERADDRL); txb += 2 * ETHERADDRL; totlen += 2 * ETHERADDRL; - mblen = bp->b_wptr - bp->b_rptr; + mblen = MBLKL(bp); ASSERT(mblen >= 2 * ETHERADDRL + VLAN_TAGSZ); mblen -= 2 * ETHERADDRL + VLAN_TAGSZ; if ((totlen += mblen) <= rgep->ethmax_size) { @@ -537,7 +537,7 @@ rge_send_copy(rge_t *rgep, mblk_t *mp, uint16_t tci) rgep->stats.obytes += VLAN_TAGSZ; } for (; bp != NULL; bp = bp->b_cont) { - mblen = bp->b_wptr - bp->b_rptr; + mblen = MBLKL(bp); if ((totlen += mblen) <= rgep->ethmax_size) { bcopy(bp->b_rptr, txb, mblen); txb += mblen; diff --git a/usr/src/uts/common/io/usb/clients/usbser/usbsacm/usbsacm.c b/usr/src/uts/common/io/usb/clients/usbser/usbsacm/usbsacm.c index f0c0892712..ed196e1ccb 100644 --- a/usr/src/uts/common/io/usb/clients/usbser/usbsacm/usbsacm.c +++ b/usr/src/uts/common/io/usb/clients/usbser/usbsacm/usbsacm.c @@ -1282,7 +1282,7 @@ usbsacm_ds_tx(ds_hdl_t hdl, uint_t port_num, mblk_t *mp) return (USB_SUCCESS); } - if (MBLKL(mp) <= 0) { + if (MBLKL(mp) < 1) { freemsg(mp); return (USB_SUCCESS); @@ -2450,7 +2450,7 @@ usbsacm_tx_start(usbsacm_port_t *acm_port) data->b_wptr += copylen; data_len += copylen; - if (MBLKL(mp) <= 0) { + if (MBLKL(mp) < 1) { acm_port->acm_tx_mp = unlinkb(mp); freeb(mp); } else { diff --git a/usr/src/uts/common/io/usb/clients/usbser/usbser.c b/usr/src/uts/common/io/usb/clients/usbser/usbser.c index 293f6440b5..8ee2b5d67f 100644 --- a/usr/src/uts/common/io/usb/clients/usbser/usbser.c +++ b/usr/src/uts/common/io/usb/clients/usbser/usbser.c @@ -2553,7 +2553,7 @@ usbser_data(usbser_port_t *pp, mblk_t *mp) return (USB_FAILURE); } - if ((MBLKL(mp) <= 0)) { + if ((MBLKL(mp) <= 1)) { freemsg(mp); return (USB_SUCCESS); diff --git a/usr/src/uts/common/io/usb/clients/usbser/usbser_keyspan/keyspan_dsd.c b/usr/src/uts/common/io/usb/clients/usbser/usbser_keyspan/keyspan_dsd.c index 831dfce4f2..61aa75541d 100644 --- a/usr/src/uts/common/io/usb/clients/usbser/usbser_keyspan/keyspan_dsd.c +++ b/usr/src/uts/common/io/usb/clients/usbser/usbser_keyspan/keyspan_dsd.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2505,7 +2505,7 @@ keyspan_tx_copy_data(keyspan_port_t *kp, mblk_t *data, int len) data->b_wptr += copylen; data_len += copylen; - if (MBLKL(mp) <= 0) { + if (MBLKL(mp) < 1) { kp->kp_tx_mp = unlinkb(mp); freeb(mp); } else { diff --git a/usr/src/uts/common/io/usb/clients/usbser/usbsprl/pl2303_dsd.c b/usr/src/uts/common/io/usb/clients/usbser/usbsprl/pl2303_dsd.c index 55f1ba8aa2..2db45c1216 100644 --- a/usr/src/uts/common/io/usb/clients/usbser/usbsprl/pl2303_dsd.c +++ b/usr/src/uts/common/io/usb/clients/usbser/usbsprl/pl2303_dsd.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -916,7 +916,7 @@ pl2303_tx(ds_hdl_t hdl, uint_t port_num, mblk_t *mp) return (USB_SUCCESS); } - if (MBLKL(mp) <= 0) { + if (MBLKL(mp) < 1) { USB_DPRINTF_L3(DPRINT_CTLOP, plp->pl_lh, "pl2303_tx: len<=0"); freemsg(mp); @@ -1738,7 +1738,7 @@ pl2303_tx_start(pl2303_state_t *plp, int *xferd) data->b_wptr += copylen; data_len += copylen; - if (MBLKL(mp) <= 0) { + if (MBLKL(mp) < 1) { plp->pl_tx_mp = unlinkb(mp); freeb(mp); } else { diff --git a/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c b/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c index df256da53c..3a91bff14f 100644 --- a/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c +++ b/usr/src/uts/common/io/usb/hcd/uhci/uhcipolled.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -104,7 +104,7 @@ uhci_hcdi_polled_input_init(usba_pipe_handle_data_t *ph, * copied into at this layer, so we need to keep track of it. */ uhci_polledp->uhci_polled_buf = - (uchar_t *)kmem_zalloc(POLLED_RAW_BUF_SIZE, KM_SLEEP); + (uchar_t *)kmem_zalloc(POLLED_RAW_BUF_SIZE, KM_SLEEP); *polled_buf = uhci_polledp->uhci_polled_buf; @@ -253,10 +253,9 @@ uhci_hcdi_polled_read(usb_console_info_impl_t *info, uint_t *num_characters) /* Copy the data into the message */ ddi_rep_get8(tw->tw_accesshandle, - (uint8_t *)uhci_polledp->uhci_polled_buf, - (uint8_t *)td->tw->tw_buf, - *num_characters, - DDI_DEV_AUTOINCR); + (uint8_t *)uhci_polledp->uhci_polled_buf, + (uint8_t *)td->tw->tw_buf, + *num_characters, DDI_DEV_AUTOINCR); } /* @@ -380,8 +379,6 @@ uhci_hcdi_polled_output_exit(usb_console_info_impl_t *info) return (USB_SUCCESS); } -static int uhci_polled_status; - /* * uhci_hcdi_polled_write: * Put a key character -- rewrite this! @@ -432,7 +429,7 @@ uhci_hcdi_polled_write(usb_console_info_impl_t *info, uchar_t *buf, ADJ_DATA_TOGGLE(pp); SetTD_devaddr(uhcip, td, ph->p_usba_device->usb_addr); SetTD_endpt(uhcip, td, ph->p_ep.bEndpointAddress & - END_POINT_ADDRESS_MASK); + END_POINT_ADDRESS_MASK); SetTD_PID(uhcip, td, PID_OUT); SetTD32(uhcip, td->buffer_address, tw->tw_cookie.dmac_address); @@ -497,8 +494,7 @@ uhci_polled_init(usba_pipe_handle_data_t *ph, } /* Allocate and intitialize a polled mode state structure */ - uhci_polledp = (uhci_polled_t *)kmem_zalloc(sizeof (uhci_polled_t), - KM_SLEEP); + uhci_polledp = kmem_zalloc(sizeof (uhci_polled_t), KM_SLEEP); /* * Keep a copy of normal mode state structure and pipe handle. @@ -745,12 +741,12 @@ uhci_polled_restore_state(uhci_polled_t *uhci_polledp) * Adjust data toggle */ pp = (uhci_pipe_private_t *) - uhci_polledp->uhci_polled_ph->p_hcd_private; + uhci_polledp->uhci_polled_ph->p_hcd_private; polled_td = uhci_polledp->uhci_polled_td; real_data_toggle = (GetTD_status(uhcip, polled_td) & UHCI_TD_ACTIVE) ? - GetTD_dtogg(uhcip, polled_td) : - !GetTD_dtogg(uhcip, polled_td); + GetTD_dtogg(uhcip, polled_td) : + !GetTD_dtogg(uhcip, polled_td); td = uhcip->uhci_outst_tds_head; while (td != NULL) { diff --git a/usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c b/usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c index fe2fba82b3..41d9c42ade 100644 --- a/usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c +++ b/usr/src/uts/common/io/usb/hcd/uhci/uhcitgt.c @@ -36,6 +36,7 @@ #include <sys/usb/hcd/uhci/uhcid.h> #include <sys/usb/hcd/uhci/uhcitgt.h> #include <sys/usb/hcd/uhci/uhciutil.h> +#include <sys/strsun.h> /* function prototypes */ static int uhci_pipe_send_isoc_data(uhci_state_t *uhcip, @@ -1133,7 +1134,7 @@ uhci_pipe_send_isoc_data( /* Check the size of isochronous request */ ASSERT(isoc_req->isoc_data != NULL); - length = isoc_req->isoc_data->b_wptr - isoc_req->isoc_data->b_rptr; + length = MBLKL(isoc_req->isoc_data); if (length > max_isoc_xfer_sz) { USB_DPRINTF_L2(PRINT_MASK_HCDI, uhcip->uhci_log_hdl, diff --git a/usr/src/uts/common/io/vuidmice/vuidm3p.c b/usr/src/uts/common/io/vuidmice/vuidm3p.c index 073176c724..746abfcbc8 100644 --- a/usr/src/uts/common/io/vuidmice/vuidm3p.c +++ b/usr/src/uts/common/io/vuidmice/vuidm3p.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,6 +31,7 @@ #include <sys/param.h> #include <sys/stream.h> +#include <sys/strsun.h> #include <sys/vuid_event.h> #include <sys/vuidmice.h> @@ -90,7 +90,7 @@ vuidm3p_sendButtonEvent(queue_t *const qp) if ((STATEP->buttons & mask) != (STATEP->oldbuttons & mask)) VUID_PUTNEXT(qp, VUID_BUT(b), FE_PAIR_NONE, 0, - (STATEP->buttons & mask ? 1 : 0)); + (STATEP->buttons & mask ? 1 : 0)); } } @@ -101,7 +101,7 @@ vuidm3p(queue_t *const qp, mblk_t *mp) uchar_t *bufp; bufp = mp->b_rptr; - r = mp->b_wptr - mp->b_rptr; + r = MBLKL(mp); for (r--; r >= 0; r--) { code = *bufp++; diff --git a/usr/src/uts/common/io/vuidmice/vuidm4p.c b/usr/src/uts/common/io/vuidmice/vuidm4p.c index bb451b0508..9af020b4af 100644 --- a/usr/src/uts/common/io/vuidmice/vuidm4p.c +++ b/usr/src/uts/common/io/vuidmice/vuidm4p.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,6 +31,7 @@ #include <sys/param.h> #include <sys/stream.h> +#include <sys/strsun.h> #include <sys/vuid_event.h> #include <sys/vuidmice.h> @@ -99,7 +99,7 @@ vuidm4p(queue_t *const qp, mblk_t *mp) unsigned char *bufp; bufp = mp->b_rptr; - r = mp->b_wptr - mp->b_rptr; + r = MBLKL(mp); for (r--; r >= 0; r--) { code = *bufp++; @@ -134,7 +134,7 @@ vuidm4p(queue_t *const qp, mblk_t *mp) /* Get the new state for the LEFT & RIGHT Button */ STATEP->buttons |= - (code & (MOUSE_BUTTON_L | MOUSE_BUTTON_R)); + (code & (MOUSE_BUTTON_L | MOUSE_BUTTON_R)); /* * bits 0 & 1 are bits 6 & 7 of X value @@ -170,7 +170,7 @@ vuidm4p(queue_t *const qp, mblk_t *mp) STATEP->state = MOUSE_DELTA_Y; STATEP->buttons |= - (STATEP->oldbuttons & MOUSE_BUTTON_M); + (STATEP->oldbuttons & MOUSE_BUTTON_M); /* * If we can peek at the next two mouse characters, diff --git a/usr/src/uts/common/io/vuidmice/vuidm5p.c b/usr/src/uts/common/io/vuidmice/vuidm5p.c index ce0faa37fb..f05a38c849 100644 --- a/usr/src/uts/common/io/vuidmice/vuidm5p.c +++ b/usr/src/uts/common/io/vuidmice/vuidm5p.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,6 +31,7 @@ #include <sys/param.h> #include <sys/stream.h> +#include <sys/strsun.h> #include <sys/vuid_event.h> #include <sys/vuidmice.h> @@ -85,7 +85,7 @@ vuidm5p(queue_t *const qp, mblk_t *mp) uchar_t *bufp; bufp = mp->b_rptr; - r = mp->b_wptr - mp->b_rptr; + r = MBLKL(mp); for (r--; r >= 0; r--) { code = *bufp++; diff --git a/usr/src/uts/common/io/vuidmice/vuidmice.c b/usr/src/uts/common/io/vuidmice/vuidmice.c index 6b05d64928..50182b5343 100644 --- a/usr/src/uts/common/io/vuidmice/vuidmice.c +++ b/usr/src/uts/common/io/vuidmice/vuidmice.c @@ -327,7 +327,7 @@ vuidmice_wput(queue_t *const qp, mblk_t *mp) return (0); case M_IOCTL: { - struct iocblk *iocbp = (struct iocblk *)mp->b_rptr; + struct iocblk *iocbp = (void *)mp->b_rptr; switch (iocbp->ioc_cmd) { case VUIDSFORMAT: @@ -348,7 +348,8 @@ vuidmice_wput(queue_t *const qp, mblk_t *mp) return (0); } - format_type = *(int *)mp->b_cont->b_rptr; + format_type = + *(int *)(void *)mp->b_cont->b_rptr; STATEP->format = (uchar_t)format_type; iocbp->ioc_rval = 0; iocbp->ioc_count = 0; @@ -388,7 +389,8 @@ vuidmice_wput(queue_t *const qp, mblk_t *mp) return (0); } - *(int *)mp->b_cont->b_rptr = (int)STATEP->format; + *(int *)(void *)mp->b_cont->b_rptr = + (int)STATEP->format; mp->b_cont->b_wptr += sizeof (int); iocbp->ioc_count = sizeof (int); @@ -430,7 +432,8 @@ vuidmice_wput(queue_t *const qp, mblk_t *mp) return (0); } - *(int *)mp->b_cont->b_rptr = (int)STATEP->nbuttons; + *(int *)(void *)mp->b_cont->b_rptr = + (int)STATEP->nbuttons; mp->b_cont->b_wptr += sizeof (int); iocbp->ioc_count = sizeof (int); @@ -494,7 +497,7 @@ VUID_PUTNEXT(queue_t *const qp, uchar_t event_id, uchar_t event_pair_type, drv_usecwait(10); } - fep = (Firm_event *)bp->b_wptr; + fep = (void *)bp->b_wptr; fep->id = vuid_id_addr(VKEY_FIRST) | vuid_id_offset(event_id); fep->pair_type = event_pair_type; @@ -527,8 +530,8 @@ vuidmice_miocdata(queue_t *qp, mblk_t *mp) int err = 0; - copyresp = (struct copyresp *)mp->b_rptr; - iocbp = (struct iocblk *)mp->b_rptr; + copyresp = (void *)mp->b_rptr; + iocbp = (void *)mp->b_rptr; if (copyresp->cp_rval) { err = EAGAIN; @@ -550,8 +553,8 @@ vuidmice_miocdata(queue_t *qp, mblk_t *mp) break; case VUIDGWHEELINFO: case VUIDGWHEELSTATE: - ioctmp = (mblk_t *)copyresp->cp_private; - Mouseioc = (Mouse_iocstate_t *)ioctmp->b_rptr; + ioctmp = copyresp->cp_private; + Mouseioc = (void *)ioctmp->b_rptr; if (Mouseioc->ioc_state == GETSTRUCT) { if (mp->b_cont == NULL) { err = EINVAL; @@ -594,8 +597,8 @@ vuidmice_miocdata(queue_t *qp, mblk_t *mp) break; case VUIDSWHEELSTATE: case MSIOSRESOLUTION: - ioctmp = (mblk_t *)copyresp->cp_private; - Mouseioc = (Mouse_iocstate_t *)ioctmp->b_rptr; + ioctmp = copyresp->cp_private; + Mouseioc = (void *)ioctmp->b_rptr; if (mp->b_cont == NULL) { err = EINVAL; @@ -614,7 +617,7 @@ vuidmice_miocdata(queue_t *qp, mblk_t *mp) if (mp->b_cont) { freemsg(mp->b_cont); - mp->b_cont = (mblk_t *)NULL; + mp->b_cont = NULL; } freemsg(ioctmp); iocbp->ioc_count = 0; @@ -634,11 +637,11 @@ err: mp->b_datap->db_type = M_IOCNAK; if (mp->b_cont) { freemsg(mp->b_cont); - mp->b_cont = (mblk_t *)NULL; + mp->b_cont = NULL; } if (copyresp->cp_private) { - freemsg((mblk_t *)copyresp->cp_private); - copyresp->cp_private = (mblk_t *)NULL; + freemsg(copyresp->cp_private); + copyresp->cp_private = NULL; } iocbp->ioc_count = 0; iocbp->ioc_error = err; @@ -665,18 +668,19 @@ vuidmice_handle_wheel_resolution_ioctl(queue_t *qp, mblk_t *mp, int cmd) mblk_t *ioctmp; mblk_t *datap; - struct iocblk *iocbp = (struct iocblk *)mp->b_rptr; + struct iocblk *iocbp = (void *)mp->b_rptr; if (iocbp->ioc_count == TRANSPARENT) { if (mp->b_cont == NULL) return (EINVAL); - useraddr = (caddr_t)*((caddr_t *)mp->b_cont->b_rptr); + useraddr = *((caddr_t *)(void *)mp->b_cont->b_rptr); switch (cmd) { case VUIDGWHEELCOUNT: size = sizeof (int); if ((datap = allocb(sizeof (int), BPRI_HI)) == NULL) return (EAGAIN); - *((int *)datap->b_wptr) = STATEP->vuid_mouse_mode; + *((int *)(void *)datap->b_wptr) = + STATEP->vuid_mouse_mode; mcopyout(mp, NULL, size, NULL, datap); qreply(qp, mp); @@ -695,10 +699,10 @@ vuidmice_handle_wheel_resolution_ioctl(queue_t *qp, mblk_t *mp, int cmd) break; } - if ((ioctmp = (mblk_t *)allocb(sizeof (Mouse_iocstate_t), + if ((ioctmp = allocb(sizeof (Mouse_iocstate_t), BPRI_MED)) == NULL) return (EAGAIN); - Mouseioc = (Mouse_iocstate_t *)ioctmp->b_rptr; + Mouseioc = (void *)ioctmp->b_rptr; Mouseioc->ioc_state = GETSTRUCT; Mouseioc->u_addr = useraddr; ioctmp->b_wptr = ioctmp->b_rptr + sizeof (Mouse_iocstate_t); @@ -717,7 +721,8 @@ vuidmice_handle_wheel_resolution_ioctl(queue_t *qp, mblk_t *mp, int cmd) err = EAGAIN; break; } - *((int *)datap->b_wptr) = STATEP->vuid_mouse_mode; + *((int *)(void *)datap->b_wptr) = + STATEP->vuid_mouse_mode; datap->b_wptr += sizeof (int); mp->b_cont = datap; break; @@ -771,7 +776,7 @@ vuidmice_service_wheel_info(register mblk_t *datap) wheel_info *wi; int err = 0; - wi = (wheel_info *)datap->b_rptr; + wi = (void *)datap->b_rptr; if (wi->vers != VUID_WHEEL_INFO_VERS) { err = EINVAL; return (err); @@ -796,7 +801,7 @@ vuidmice_service_wheel_state(register queue_t *qp, wheel_state *ws; uint_t err = 0; - ws = (wheel_state *)datap->b_rptr; + ws = (void *)datap->b_rptr; if (ws->vers != VUID_WHEEL_STATE_VERS) { err = EINVAL; return (err); diff --git a/usr/src/uts/common/io/vuidmice/vuidps2.c b/usr/src/uts/common/io/vuidmice/vuidps2.c index bd13b1d809..eb7787e93c 100644 --- a/usr/src/uts/common/io/vuidmice/vuidps2.c +++ b/usr/src/uts/common/io/vuidmice/vuidps2.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -38,6 +37,7 @@ #include <sys/vuidmice.h> #include <sys/vuid_wheel.h> #include <sys/mouse.h> +#include <sys/strsun.h> #include <sys/ddi.h> #include <sys/sunddi.h> @@ -172,7 +172,7 @@ vuidmice_send_wheel_event(queue_t *const qp, uchar_t event_id, return; } - fep = (Firm_event *)bp->b_wptr; + fep = (void *)bp->b_wptr; fep->id = vuid_id_addr(vuid_first(VUID_WHEEL)) | vuid_id_offset(event_id); fep->pair_type = event_pair_type; @@ -201,7 +201,7 @@ sendButtonEvent(queue_t *const qp) if ((STATEP->buttons & mask) != (STATEP->oldbuttons & mask)) VUID_PUTNEXT(qp, (uchar_t)BUT(bmap[b]), FE_PAIR_NONE, 0, - (STATEP->buttons & mask ? 1 : 0)); + (STATEP->buttons & mask ? 1 : 0)); } } @@ -463,7 +463,7 @@ restart: code &= 0xf; if (STATEP->wheel_state_bf & (1 << - VUIDMICE_VERTICAL_WHEEL_ID)) { + VUIDMICE_VERTICAL_WHEEL_ID)) { /* * PS/2 mouse reports -ve values * when the wheel is scrolled up. So @@ -516,7 +516,7 @@ packet_complete: * its not the start of the next packet, don't use * this packet. */ - if ((mp->b_wptr - mp->b_rptr) > 0 && + if (mp->b_wptr > mp->b_rptr && ((mp->b_rptr[0] ^ STATEP->sync_byte) & 0x08)) { /* * bit 3 not set diff --git a/usr/src/uts/common/io/wpi/wpi.c b/usr/src/uts/common/io/wpi/wpi.c index e226fff821..e557fde573 100644 --- a/usr/src/uts/common/io/wpi/wpi.c +++ b/usr/src/uts/common/io/wpi/wpi.c @@ -1078,10 +1078,10 @@ wpi_alloc_tx_ring(wpi_sc_t *sc, wpi_tx_ring_t *ring, int count, int qid) data->desc = desc_h + i; data->paddr_desc = paddr_desc_h + - ((caddr_t)data->desc - (caddr_t)desc_h); + ((uintptr_t)data->desc - (uintptr_t)desc_h); data->cmd = cmd_h + i; data->paddr_cmd = paddr_cmd_h + - ((caddr_t)data->cmd - (caddr_t)cmd_h); + ((uintptr_t)data->cmd - (uintptr_t)cmd_h); } return (err); @@ -2768,7 +2768,7 @@ wpi_scan(wpi_sc_t *sc) } /* setup length of probe request */ - hdr->pbrlen = LE_16(frm - (uint8_t *)wh); + hdr->pbrlen = LE_16((uintptr_t)frm - (uintptr_t)wh); /* align on a 4-byte boundary */ chan = (wpi_scan_chan_t *)frm; @@ -2782,7 +2782,7 @@ wpi_scan(wpi_sc_t *sc) frm += sizeof (wpi_scan_chan_t); } - pktlen = frm - (uint8_t *)cmd; + pktlen = (uintptr_t)frm - (uintptr_t)cmd; desc->flags = LE_32(WPI_PAD32(pktlen) << 28 | 1 << 24); desc->segs[0].addr = LE_32(data->dma_data.cookie.dmac_address); diff --git a/usr/src/uts/common/io/wscons.c b/usr/src/uts/common/io/wscons.c index f5c1a4bbed..04496f004f 100644 --- a/usr/src/uts/common/io/wscons.c +++ b/usr/src/uts/common/io/wscons.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -366,13 +366,13 @@ wcopen(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *crp) * consconfig_dacf asks us with CONSOPENPOLLED I/O. */ wscons.wc_polledio.cons_polledio_version = - CONSPOLLEDIO_V0; + CONSPOLLEDIO_V0; wscons.wc_polledio.cons_polledio_argument = - (cons_polledio_arg_t)&wscons; + (cons_polledio_arg_t)&wscons; wscons.wc_polledio.cons_polledio_enter = - wc_polled_enter; + wc_polled_enter; wscons.wc_polledio.cons_polledio_exit = - wc_polled_exit; + wc_polled_exit; #ifdef _HAVE_TEM_FIRMWARE /* @@ -442,7 +442,7 @@ wcuwput(queue_t *q, mblk_t *mp) struct iocblk *iocp; struct linkblk *linkp; - iocp = (struct iocblk *)mp->b_rptr; + iocp = (void *)mp->b_rptr; switch (iocp->ioc_cmd) { case I_LINK: /* stupid, but permitted */ @@ -452,7 +452,7 @@ wcuwput(queue_t *q, mblk_t *mp) miocnak(q, mp, 0, EINVAL); return (0); } - linkp = (struct linkblk *)mp->b_cont->b_rptr; + linkp = (void *)mp->b_cont->b_rptr; wscons.wc_kbdqueue = WR(linkp->l_qbot); mp->b_datap->db_type = M_IOCACK; iocp->ioc_count = 0; @@ -461,7 +461,7 @@ wcuwput(queue_t *q, mblk_t *mp) case I_UNLINK: /* stupid, but permitted */ case I_PUNLINK: - linkp = (struct linkblk *)mp->b_cont->b_rptr; + linkp = (void *)mp->b_cont->b_rptr; if (wscons.wc_kbdqueue != WR(linkp->l_qbot)) { /* not us */ miocnak(q, mp, 0, EINVAL); @@ -578,12 +578,12 @@ wc_getterm(mblk_t *mp) { char *term; intptr_t arg; - int flag = ((struct iocblk *)mp->b_rptr)->ioc_flag; + int flag = ((struct iocblk *)(void *)mp->b_rptr)->ioc_flag; STRUCT_DECL(cons_getterm, wcterm); STRUCT_INIT(wcterm, flag); - arg = *((intptr_t *)mp->b_cont->b_rptr); + arg = *((intptr_t *)(void *)mp->b_cont->b_rptr); if (ddi_copyin((void *)arg, STRUCT_BUF(wcterm), STRUCT_SIZE(wcterm), flag) != 0) { @@ -624,7 +624,7 @@ wcioctl(queue_t *q, mblk_t *mp) int error; long len; - iocp = (struct iocblk *)mp->b_rptr; + iocp = (void *)mp->b_rptr; switch (iocp->ioc_cmd) { case TIOCSWINSZ: @@ -646,7 +646,7 @@ wcioctl(queue_t *q, mblk_t *mp) case CONSOPENPOLLEDIO: DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wcioctl: CONSOPENPOLLEDIO\n")); + ("wcioctl: CONSOPENPOLLEDIO\n")); error = miocpullup(mp, sizeof (struct cons_polledio *)); if (error != 0) { @@ -661,8 +661,8 @@ wcioctl(queue_t *q, mblk_t *mp) if (consmode == CONS_KFB) wscons.wc_polledio.cons_polledio_putchar = wc_polled_putchar; - *(struct cons_polledio **)mp->b_cont->b_rptr = - &wscons.wc_polledio; + *(struct cons_polledio **)(void *)mp->b_cont->b_rptr = + &wscons.wc_polledio; mp->b_datap->db_type = M_IOCACK; @@ -707,14 +707,13 @@ wcioctl(queue_t *q, mblk_t *mp) /* * If we don't have exactly one continuation block, fail. */ - if (mp->b_cont == NULL || - mp->b_cont->b_cont != NULL) + if (mp->b_cont == NULL || mp->b_cont->b_cont != NULL) goto open_fail; /* * If there's no null terminator in the string, fail. */ - len = mp->b_cont->b_wptr - mp->b_cont->b_rptr; + len = MBLKL(mp->b_cont); if (memchr(mp->b_cont->b_rptr, 0, len) == NULL) goto open_fail; @@ -723,7 +722,7 @@ wcioctl(queue_t *q, mblk_t *mp) * dimensions from a property, e.g. screen-#rows. */ iocp->ioc_error = tem_init(&wscons.wc_tem, - (char *)mp->b_cont->b_rptr, iocp->ioc_cr); + (char *)mp->b_cont->b_rptr, iocp->ioc_cr); /* * Of course, if the terminal emulator initialization * failed, fail. @@ -732,7 +731,7 @@ wcioctl(queue_t *q, mblk_t *mp) goto open_fail; tem_register_modechg_cb(wscons.wc_tem, wc_modechg_cb, - (tem_modechg_cb_arg_t)&wscons); + (tem_modechg_cb_arg_t)&wscons); /* * Refresh terminal size with info from terminal emulator. @@ -818,7 +817,7 @@ wc_open_kb_polledio(struct wscons *wscons, queue_t *q, mblk_t *mp) struct iocblk *iocp; DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wc_open_kb_polledio: sending CONSOPENPOLLEDIO\n")); + ("wc_open_kb_polledio: sending CONSOPENPOLLEDIO\n")); mp2 = mkiocb(CONSOPENPOLLEDIO); @@ -840,11 +839,11 @@ wc_open_kb_polledio(struct wscons *wscons, queue_t *q, mblk_t *mp) goto nomem; } - iocp = (struct iocblk *)mp2->b_rptr; + iocp = (void *)mp2->b_rptr; iocp->ioc_count = sizeof (struct cons_polledio *); mp2->b_cont->b_wptr = mp2->b_cont->b_rptr + - sizeof (struct cons_polledio *); + sizeof (struct cons_polledio *); wscons->wc_pending_link = mp; wscons->wc_kb_getpolledio_id = iocp->ioc_id; @@ -854,7 +853,7 @@ wc_open_kb_polledio(struct wscons *wscons, queue_t *q, mblk_t *mp) return; nomem: - iocp = (struct iocblk *)mp->b_rptr; + iocp = (void *)mp->b_rptr; iocp->ioc_error = ENOMEM; mp->b_datap->db_type = M_IOCNAK; qreply(q, mp); @@ -873,7 +872,7 @@ wc_close_kb_polledio(struct wscons *wscons, queue_t *q, mblk_t *mp) struct iocblk *iocp; DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wc_close_kb_polledio: sending CONSCLOSEPOLLEDIO\n")); + ("wc_close_kb_polledio: sending CONSCLOSEPOLLEDIO\n")); mp2 = mkiocb(CONSCLOSEPOLLEDIO); @@ -896,7 +895,7 @@ wc_close_kb_polledio(struct wscons *wscons, queue_t *q, mblk_t *mp) goto nomem; } - iocp = (struct iocblk *)mp2->b_rptr; + iocp = (void *)mp2->b_rptr; iocp->ioc_count = 0; @@ -908,7 +907,7 @@ wc_close_kb_polledio(struct wscons *wscons, queue_t *q, mblk_t *mp) return; nomem: - iocp = (struct iocblk *)mp->b_rptr; + iocp = (void *)mp->b_rptr; iocp->ioc_error = ENOMEM; mp->b_datap->db_type = M_IOCNAK; qreply(q, mp); @@ -1021,7 +1020,7 @@ wcstart(void) if (nbp->b_wptr > nbp->b_rptr) { (void) tem_write(wscons.wc_tem, nbp->b_rptr, - nbp->b_wptr - nbp->b_rptr, + MBLKL(nbp), kcred); } } @@ -1032,7 +1031,7 @@ wcstart(void) } /* consmode = CONS_FW */ - if ((cc = bp->b_wptr - bp->b_rptr) == 0) { + if ((cc = MBLKL(bp)) == 0) { freemsg(bp); continue; } @@ -1081,7 +1080,7 @@ wcstart(void) freeb(nbp); if (bp == NULL) return; - cc = bp->b_wptr - bp->b_rptr; + cc = MBLKL(bp); } } #endif /* _HAVE_TEM_FIRMWARE */ @@ -1128,7 +1127,7 @@ wconsout(void *dummy) do { cp = bp->b_rptr; - cc = bp->b_wptr - cp; + cc = MBLKL(bp); while (cc != 0) { if (bytes_left == 0) { /* @@ -1170,7 +1169,7 @@ wclrput(queue_t *q, mblk_t *mp) struct iocblk *iocp; DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wclrput: wclrput type = 0x%x\n", mp->b_datap->db_type)); + ("wclrput: wclrput type = 0x%x\n", mp->b_datap->db_type)); switch (mp->b_datap->db_type) { @@ -1205,7 +1204,7 @@ wclrput(queue_t *q, mblk_t *mp) case M_IOCACK: case M_IOCNAK: - iocp = (struct iocblk *)mp->b_rptr; + iocp = (void *)mp->b_rptr; if (wscons.wc_pending_link != NULL && iocp->ioc_id == wscons.wc_kb_getpolledio_id) { switch (mp->b_datap->db_type) { @@ -1216,23 +1215,23 @@ wclrput(queue_t *q, mblk_t *mp) case CONSOPENPOLLEDIO: DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wclrput: " - "ACK CONSOPENPOLLEDIO\n")); + ("wclrput: " + "ACK CONSOPENPOLLEDIO\n")); wscons.wc_kb_polledio = - *(struct cons_polledio **) + *(struct cons_polledio **)(void *) mp->b_cont->b_rptr; wscons.wc_polledio. cons_polledio_getchar = - wc_polled_getchar; + wc_polled_getchar; wscons.wc_polledio. cons_polledio_ischar = - wc_polled_ischar; + wc_polled_ischar; break; case CONSCLOSEPOLLEDIO: DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wclrput: " - "ACK CONSCLOSEPOLLEDIO\n")); + ("wclrput: " + "ACK CONSCLOSEPOLLEDIO\n")); wscons.wc_kb_polledio = NULL; wscons.wc_kbdqueue = NULL; wscons.wc_polledio. @@ -1242,8 +1241,7 @@ wclrput(queue_t *q, mblk_t *mp) break; default: DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wclrput: " - "ACK UNKNOWN\n")); + ("wclrput: ACK UNKNOWN\n")); } break; @@ -1256,7 +1254,7 @@ wclrput(queue_t *q, mblk_t *mp) * underneath conskbd yet. */ DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wclrput: NAK\n")); + ("wclrput: NAK\n")); switch (iocp->ioc_cmd) { @@ -1286,7 +1284,7 @@ wclrput(queue_t *q, mblk_t *mp) default: /* inc M_ERROR, M_HANGUP, M_IOCACK, M_IOCNAK, ... */ DPRINTF(PRINT_L1, PRINT_MASK_ALL, - ("wclrput: Message DISCARDED\n")); + ("wclrput: Message DISCARDED\n")); if ((upq = wscons.wc_ttycommon.t_readq) != NULL) { putnext(upq, mp); } else { |