sys/powerpc: 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:
Pedro F. Giffuni 2016-04-26 14:44:49 +00:00
parent 9af9422682
commit 910c079886
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298642
3 changed files with 4 additions and 4 deletions

View File

@ -1115,8 +1115,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
/* Allocate PTE tables for kernel KVA. */
kernel_pdir = data_end;
kernel_ptbls = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS +
PDIR_SIZE - 1) / PDIR_SIZE;
kernel_ptbls = howmany(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS,
PDIR_SIZE);
data_end += kernel_ptbls * PTBL_PAGES * PAGE_SIZE;
debugf(" kernel ptbls: %d\n", kernel_ptbls);
debugf(" kernel pdir at 0x%08x end = 0x%08x\n", kernel_pdir, data_end);

View File

@ -271,7 +271,7 @@ set_clock(struct fsl_sdhc_softc *sc, uint32_t clock)
* divisor = ceil(base_clock / clock)
* TODO: Reconsider symmetric rounding here instead of ceiling.
*/
divisor = (base_clock + clock - 1) / clock;
divisor = howmany(base_clock, clock);
while (divisor > 16) {
round = divisor & 0x1;

View File

@ -301,7 +301,7 @@ DELAY(int n)
u_quad_t tb, ttb;
tb = mftb();
ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick;
ttb = tb + howmany(n * 1000, ns_per_tick);
while (tb < ttb)
tb = mftb();
}