svn commit: r298642 - in head/sys/powerpc: booke mpc85xx powerpc

Pedro F. Giffuni pfg at FreeBSD.org
Tue Apr 26 14:44:51 UTC 2016


Author: pfg
Date: Tue Apr 26 14:44:49 2016
New Revision: 298642
URL: https://svnweb.freebsd.org/changeset/base/298642

Log:
  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.

Modified:
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/mpc85xx/fsl_sdhc.c
  head/sys/powerpc/powerpc/clock.c

Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c	Tue Apr 26 14:38:18 2016	(r298641)
+++ head/sys/powerpc/booke/pmap.c	Tue Apr 26 14:44:49 2016	(r298642)
@@ -1115,8 +1115,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset
 
 	/* 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);

Modified: head/sys/powerpc/mpc85xx/fsl_sdhc.c
==============================================================================
--- head/sys/powerpc/mpc85xx/fsl_sdhc.c	Tue Apr 26 14:38:18 2016	(r298641)
+++ head/sys/powerpc/mpc85xx/fsl_sdhc.c	Tue Apr 26 14:44:49 2016	(r298642)
@@ -271,7 +271,7 @@ set_clock(struct fsl_sdhc_softc *sc, uin
 	 * 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;

Modified: head/sys/powerpc/powerpc/clock.c
==============================================================================
--- head/sys/powerpc/powerpc/clock.c	Tue Apr 26 14:38:18 2016	(r298641)
+++ head/sys/powerpc/powerpc/clock.c	Tue Apr 26 14:44:49 2016	(r298642)
@@ -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();
 }


More information about the svn-src-head mailing list