diff options
| author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-30 14:41:18 +0000 |
|---|---|---|
| committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2016-04-30 14:41:18 +0000 |
| commit | 4ed3c0e713adac46dcca8a9ee668221399b7b659 (patch) | |
| tree | 06929dc26671f0710b964d5bb0a7634f12528a36 /sys/dev | |
| parent | 7154bf4a413eca71cffdb37361ad19960501a2fa (diff) | |
Notes
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/acpi_support/acpi_hp.c | 3 | ||||
| -rw-r--r-- | sys/dev/cxgbe/t4_netmap.c | 2 | ||||
| -rw-r--r-- | sys/dev/fb/fb.c | 2 | ||||
| -rw-r--r-- | sys/dev/fb/vesa.c | 2 | ||||
| -rw-r--r-- | sys/dev/fb/vga.c | 2 | ||||
| -rw-r--r-- | sys/dev/iwn/if_iwn.c | 2 | ||||
| -rw-r--r-- | sys/dev/kbd/kbd.c | 2 | ||||
| -rw-r--r-- | sys/dev/syscons/scmouse.c | 6 | ||||
| -rw-r--r-- | sys/dev/syscons/scvgarndr.c | 2 | ||||
| -rw-r--r-- | sys/dev/vt/hw/vga/vt_vga.c | 2 | ||||
| -rw-r--r-- | sys/dev/vt/vt_core.c | 4 | ||||
| -rw-r--r-- | sys/dev/wpi/if_wpi.c | 2 |
12 files changed, 16 insertions, 15 deletions
diff --git a/sys/dev/acpi_support/acpi_hp.c b/sys/dev/acpi_support/acpi_hp.c index 282803814dc5..ec8589659438 100644 --- a/sys/dev/acpi_support/acpi_hp.c +++ b/sys/dev/acpi_support/acpi_hp.c @@ -1033,7 +1033,8 @@ acpi_hp_hex_decode(char* buffer) UINT8 *uin; UINT8 uout; - if (((int)length/2)*2 == length || length < 10) return; + if (rounddown((int)length, 2) == length || length < 10) + return; for (i = 0; i<length; ++i) { if (!((i+1)%3)) { diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 6f6df1095ef8..ba968d686c31 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -1119,7 +1119,7 @@ ncxgbe_attach(device_t dev) * freelist, and not the number of entries in the iq. (These two are * not exactly the same due to the space taken up by the status page). */ - na.num_rx_desc = (vi->qsize_rxq / 8) * 8; + na.num_rx_desc = rounddown(vi->qsize_rxq, 8); na.nm_txsync = cxgbe_netmap_txsync; na.nm_rxsync = cxgbe_netmap_rxsync; na.nm_register = cxgbe_netmap_reg; diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index aa2d30005f41..183abdc3bfcb 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -86,7 +86,7 @@ vid_realloc_array(void) return ENOMEM; s = spltty(); - newsize = ((adapters + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA; + newsize = rounddown(adapters + ARRAY_DELTA, ARRAY_DELTA); new_adp = malloc(sizeof(*new_adp)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); new_vidsw = malloc(sizeof(*new_vidsw)*newsize, M_DEVBUF, M_WAITOK | M_ZERO); diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c index cdd836cd3d3c..4ab83c30ff4b 100644 --- a/sys/dev/fb/vesa.c +++ b/sys/dev/fb/vesa.c @@ -1581,7 +1581,7 @@ vesa_set_origin(video_adapter_t *adp, off_t offset) regs.R_DX = offset / adp->va_window_gran; x86bios_intr(®s, 0x10); - adp->va_window_orig = (offset/adp->va_window_gran)*adp->va_window_gran; + adp->va_window_orig = rounddown(offset, adp->va_window_gran); return (0); /* XXX */ } diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index d0239b3a18b8..83b969470b5e 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -1252,7 +1252,7 @@ set_line_length(video_adapter_t *adp, int pixel) break; case V_INFO_MM_PACKED: count = (pixel + 7)/8; - bpl = ((pixel + 7)/8)*8; + bpl = rounddown(pixel + 7, 8); break; case V_INFO_MM_TEXT: count = (pixel + 7)/8; /* columns */ diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index bffa8de35fb9..01f28a00e98d 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -6335,7 +6335,7 @@ iwn_set_pslevel(struct iwn_softc *sc, int dtim, int level, int async) if (max == (uint32_t)-1) max = dtim * (skip_dtim + 1); else if (max > dtim) - max = (max / dtim) * dtim; + max = rounddown(max, dtim); } else max = dtim; for (i = 0; i < 5; i++) diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 45f483ac1a23..985a96040405 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -96,7 +96,7 @@ kbd_realloc_array(void) int s; s = spltty(); - newsize = ((keyboards + ARRAY_DELTA)/ARRAY_DELTA)*ARRAY_DELTA; + newsize = rounddown(keyboards + ARRAY_DELTA, ARRAY_DELTA); new_kbd = malloc(sizeof(*new_kbd)*newsize, M_DEVBUF, M_NOWAIT|M_ZERO); if (new_kbd == NULL) { splx(s); diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c index 589506643622..db26787c264e 100644 --- a/sys/dev/syscons/scmouse.c +++ b/sys/dev/syscons/scmouse.c @@ -495,7 +495,7 @@ mouse_cut_start(scr_stat *scp) i = skip_spc_left(scp, scp->mouse_pos) + 1; s = spltty(); scp->mouse_cut_start = - (scp->mouse_pos / scp->xsize) * scp->xsize + i; + rounddown(scp->mouse_pos, scp->xsize) + i; scp->mouse_cut_end = (scp->mouse_pos / scp->xsize + 1) * scp->xsize - 1; splx(s); @@ -540,7 +540,7 @@ mouse_cut_word(scr_stat *scp) * unless user specified SC_CUT_SEPCHARS in his kernel config file. */ if (scp->status & MOUSE_VISIBLE) { - sol = (scp->mouse_pos / scp->xsize) * scp->xsize; + sol = rounddown(scp->mouse_pos, scp->xsize); eol = sol + scp->xsize; c = sc_vtb_getc(&scp->vtb, scp->mouse_pos); if (IS_SEP_CHAR(c)) { @@ -589,7 +589,7 @@ mouse_cut_line(scr_stat *scp) int from; if (scp->status & MOUSE_VISIBLE) { - from = (scp->mouse_pos / scp->xsize) * scp->xsize; + from = rounddown(scp->mouse_pos, scp->xsize); mouse_do_cut(scp, from, from + scp->xsize - 1); len = strlen(cut_buffer); if (cut_buffer[len - 1] == '\r') diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c index fc7f02f58fef..2d2651746004 100644 --- a/sys/dev/syscons/scvgarndr.c +++ b/sys/dev/syscons/scvgarndr.c @@ -1035,7 +1035,7 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y) line_width = scp->sc->adp->va_line_width; xoff = (x - scp->xoff*8)%8; - yoff = y - (y/line_width)*line_width; + yoff = y - rounddown(y, line_width); ymax = imin(y + 16, scp->ypixel); outw(GDCIDX, 0x0805); /* read mode 1, write mode 0 */ diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index e81dcba7663a..9788b7e67265 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -912,7 +912,7 @@ vga_bitblt_bitmap(struct vt_device *vd, const struct vt_window *vw, uint8_t pattern_2colors; /* Align coordinates with the 8-pxels grid. */ - x1 = x / VT_VGA_PIXELS_BLOCK * VT_VGA_PIXELS_BLOCK; + x1 = rounddown(x, VT_VGA_PIXELS_BLOCK); y1 = y; x2 = roundup(x + width, VT_VGA_PIXELS_BLOCK); diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index 2884c57d0358..a90ab9f45adc 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -640,9 +640,9 @@ vt_compute_drawable_area(struct vt_window *vw) if (vt_draw_logo_cpus) vw->vw_draw_area.tr_begin.tp_row += vt_logo_sprite_height; vw->vw_draw_area.tr_end.tp_col = vw->vw_draw_area.tr_begin.tp_col + - vd->vd_width / vf->vf_width * vf->vf_width; + rounddown(vd->vd_width, vf->vf_width); vw->vw_draw_area.tr_end.tp_row = vw->vw_draw_area.tr_begin.tp_row + - height / vf->vf_height * vf->vf_height; + rounddown(height, vf->vf_height); } static void diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 897b986eec36..acaa8212c804 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -3814,7 +3814,7 @@ wpi_set_pslevel(struct wpi_softc *sc, uint8_t dtim, int level, int async) if (max == (uint32_t)-1) max = dtim * (skip_dtim + 1); else if (max > dtim) - max = (max / dtim) * dtim; + max = rounddown(max, dtim); } else max = dtim; |
