From owner-svn-src-head@freebsd.org Tue Apr 26 14:44:51 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02AFAB1C627; Tue, 26 Apr 2016 14:44:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA1B31529; Tue, 26 Apr 2016 14:44:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QEinQu031481; Tue, 26 Apr 2016 14:44:49 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QEinsC031478; Tue, 26 Apr 2016 14:44:49 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604261444.u3QEinsC031478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 26 Apr 2016 14:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298642 - in head/sys/powerpc: booke mpc85xx powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 14:44:51 -0000 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 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(); }