sys/arm: make use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
This commit is contained in:
parent
2a473e5a33
commit
d47c7f961b
@ -2285,7 +2285,7 @@ pmap_bootstrap(vm_offset_t firstaddr, struct pv_addr *l1pt)
|
||||
round_page(size * L2_TABLE_SIZE_REAL) / PAGE_SIZE,
|
||||
&pmap_kernel_l2ptp_kva, NULL);
|
||||
|
||||
size = (size + (L2_BUCKET_SIZE - 1)) / L2_BUCKET_SIZE;
|
||||
size = howmany(size, L2_BUCKET_SIZE);
|
||||
pmap_alloc_specials(&virtual_avail,
|
||||
round_page(size * sizeof(struct l2_dtable)) / PAGE_SIZE,
|
||||
&pmap_kernel_l2dtable_kva, NULL);
|
||||
|
@ -98,7 +98,7 @@ at91_pit_delay(int us)
|
||||
|
||||
/* Max delay ~= 260s. @ 133Mhz */
|
||||
pit_freq = at91_master_clock / PIT_PRESCALE;
|
||||
cnt = ((pit_freq * us) + (mhz -1)) / mhz;
|
||||
cnt = howmany(pit_freq * us, mhz);
|
||||
cnt = (cnt <= 0) ? 1 : cnt;
|
||||
|
||||
while (cnt > 0) {
|
||||
|
@ -388,7 +388,7 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr)
|
||||
*/
|
||||
ipgfreq = imx_ccm_ipg_hz();
|
||||
busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed);
|
||||
div = (ipgfreq + busfreq - 1) / busfreq;
|
||||
div = howmany(ipgfreq, busfreq);
|
||||
for (i = 0; i < nitems(clkdiv_table); i++) {
|
||||
if (clkdiv_table[i].divisor >= div)
|
||||
break;
|
||||
|
@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
MALLOC_DEFINE(M_AS3722_REG, "AS3722 regulator", "AS3722 power regulator");
|
||||
|
||||
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
|
||||
#define DIV_ROUND_UP(n,d) howmany(n, d)
|
||||
|
||||
enum as3722_reg_id {
|
||||
AS3722_REG_ID_SD0,
|
||||
|
Loading…
Reference in New Issue
Block a user