From fc497a4640d662955a6d75b5e5ca52703fbb525a Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 1 Mar 2017 18:53:05 +0000 Subject: MFC r308640: Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read integer data from the device tree. --- sys/arm/lpc/lpc_fb.c | 4 +--- sys/arm/lpc/lpc_timer.c | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'sys/arm/lpc') diff --git a/sys/arm/lpc/lpc_fb.c b/sys/arm/lpc/lpc_fb.c index b2eab8b..e496915 100644 --- a/sys/arm/lpc/lpc_fb.c +++ b/sys/arm/lpc/lpc_fb.c @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -280,10 +279,9 @@ lpc_fb_intr(void *arg) static int lpc_fb_fdt_read(phandle_t node, const char *name, uint32_t *ret) { - if (OF_getprop(node, name, ret, sizeof(uint32_t)) <= 0) + if (OF_getencprop(node, name, ret, sizeof(uint32_t)) <= 0) return (ENOENT); - *ret = fdt32_to_cpu(*ret); return (0); } diff --git a/sys/arm/lpc/lpc_timer.c b/sys/arm/lpc/lpc_timer.c index ded53fa..f745cf0 100644 --- a/sys/arm/lpc/lpc_timer.c +++ b/sys/arm/lpc/lpc_timer.c @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -158,7 +157,7 @@ lpc_timer_attach(device_t dev) /* Get PERIPH_CLK encoded in parent bus 'bus-frequency' property */ node = ofw_bus_get_node(dev); - if (OF_getprop(OF_parent(node), "bus-frequency", &freq, + if (OF_getencprop(OF_parent(node), "bus-frequency", &freq, sizeof(pcell_t)) <= 0) { bus_release_resources(dev, lpc_timer_spec, sc->lt_res); bus_teardown_intr(dev, sc->lt_res[2], intrcookie); @@ -166,8 +165,6 @@ lpc_timer_attach(device_t dev) return (ENXIO); } - freq = fdt32_to_cpu(freq); - /* Set desired frequency in event timer and timecounter */ sc->lt_et.et_frequency = (uint64_t)freq; lpc_timecounter.tc_frequency = (uint64_t)freq; -- cgit v1.1