aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ti
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2016-04-21 19:57:40 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2016-04-21 19:57:40 +0000
commitd9c9c81c083a76a65c6cacf8fcbc0511e2ffa489 (patch)
treecd4dfa8859a5f57124d315ff395b524d7587e1ea /sys/dev/ti
parent5977d3e898348ce714243a4189cee906151aa522 (diff)
downloadsrc-d9c9c81c083a76a65c6cacf8fcbc0511e2ffa489.tar.gz
src-d9c9c81c083a76a65c6cacf8fcbc0511e2ffa489.zip
sys: use our roundup2/rounddown2() macros when param.h is available.
rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted.
Notes
Notes: svn path=/head/; revision=298433
Diffstat (limited to 'sys/dev/ti')
-rw-r--r--sys/dev/ti/if_ti.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 23ed50b9ab8d..538d65dbe986 100644
--- a/sys/dev/ti/if_ti.c
+++ b/sys/dev/ti/if_ti.c
@@ -434,7 +434,7 @@ ti_mem_read(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf)
segsize = cnt;
else
segsize = TI_WINLEN - (segptr % TI_WINLEN);
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
+ CSR_WRITE_4(sc, TI_WINBASE, rounddown2(segptr, TI_WINLEN));
bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle,
TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr,
segsize / 4);
@@ -464,7 +464,7 @@ ti_mem_write(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf)
segsize = cnt;
else
segsize = TI_WINLEN - (segptr % TI_WINLEN);
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
+ CSR_WRITE_4(sc, TI_WINBASE, rounddown2(segptr, TI_WINLEN));
bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle,
TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr,
segsize / 4);
@@ -491,7 +491,7 @@ ti_mem_zero(struct ti_softc *sc, uint32_t addr, uint32_t len)
segsize = cnt;
else
segsize = TI_WINLEN - (segptr % TI_WINLEN);
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
+ CSR_WRITE_4(sc, TI_WINBASE, rounddown2(segptr, TI_WINLEN));
bus_space_set_region_4(sc->ti_btag, sc->ti_bhandle,
TI_WINDOW + (segptr & (TI_WINLEN - 1)), 0, segsize / 4);
segptr += segsize;
@@ -559,7 +559,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len,
segsize = cnt;
else
segsize = TI_WINLEN - (segptr % TI_WINLEN);
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
+ CSR_WRITE_4(sc, TI_WINBASE, rounddown2(segptr, TI_WINLEN));
ti_offset = TI_WINDOW + (segptr & (TI_WINLEN -1));
@@ -628,7 +628,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len,
/*
* Set the segment pointer.
*/
- CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1)));
+ CSR_WRITE_4(sc, TI_WINBASE, rounddown2(segptr, TI_WINLEN));
ti_offset = TI_WINDOW + (segptr & (TI_WINLEN - 1));