svn commit: r298643 - in head/sys/arm: arm at91 freescale/imx nvidia
Pedro F. Giffuni
pfg at FreeBSD.org
Tue Apr 26 14:47:54 UTC 2016
Author: pfg
Date: Tue Apr 26 14:47:52 2016
New Revision: 298643
URL: https://svnweb.freebsd.org/changeset/base/298643
Log:
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.
Modified:
head/sys/arm/arm/pmap-v4.c
head/sys/arm/at91/at91_pit.c
head/sys/arm/freescale/imx/imx_i2c.c
head/sys/arm/nvidia/as3722_regulators.c
Modified: head/sys/arm/arm/pmap-v4.c
==============================================================================
--- head/sys/arm/arm/pmap-v4.c Tue Apr 26 14:44:49 2016 (r298642)
+++ head/sys/arm/arm/pmap-v4.c Tue Apr 26 14:47:52 2016 (r298643)
@@ -2285,7 +2285,7 @@ pmap_bootstrap(vm_offset_t firstaddr, st
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);
Modified: head/sys/arm/at91/at91_pit.c
==============================================================================
--- head/sys/arm/at91/at91_pit.c Tue Apr 26 14:44:49 2016 (r298642)
+++ head/sys/arm/at91/at91_pit.c Tue Apr 26 14:47:52 2016 (r298643)
@@ -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) {
Modified: head/sys/arm/freescale/imx/imx_i2c.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_i2c.c Tue Apr 26 14:44:49 2016 (r298642)
+++ head/sys/arm/freescale/imx/imx_i2c.c Tue Apr 26 14:47:52 2016 (r298643)
@@ -388,7 +388,7 @@ i2c_reset(device_t dev, u_char speed, u_
*/
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;
Modified: head/sys/arm/nvidia/as3722_regulators.c
==============================================================================
--- head/sys/arm/nvidia/as3722_regulators.c Tue Apr 26 14:44:49 2016 (r298642)
+++ head/sys/arm/nvidia/as3722_regulators.c Tue Apr 26 14:47:52 2016 (r298643)
@@ -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,
More information about the svn-src-all
mailing list