aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/ti
diff options
context:
space:
mode:
authorOleksandr Tymoshenko <gonzo@FreeBSD.org>2018-04-09 22:06:16 +0000
committerOleksandr Tymoshenko <gonzo@FreeBSD.org>2018-04-09 22:06:16 +0000
commitf7604b1b275455fc5506c3c83a4876f567bbc6b3 (patch)
tree40a5b93b5f618e99153acf0d1ffd93ec763bce3d /sys/arm/ti
parentc7fb0e1ddf717f58e069fd2339b05370b41df3ce (diff)
downloadsrc-f7604b1b275455fc5506c3c83a4876f567bbc6b3.tar.gz
src-f7604b1b275455fc5506c3c83a4876f567bbc6b3.zip
Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_alloc
Change OF_getencprop_alloc semantics to be combination of malloc and OF_getencprop and return size of the property, not number of elements allocated. For the use cases where number of elements is preferred introduce OF_getencprop_alloc_multi helper function that copies semantics of OF_getencprop_alloc prior to this change. This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi function signatures consistent with OF_getencprop_alloc and OF_getencprop_alloc_multi. Functionality-wise this patch is mostly rename of OF_getencprop_alloc to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo where 1 was used as a block size.
Notes
Notes: svn path=/head/; revision=332341
Diffstat (limited to 'sys/arm/ti')
-rw-r--r--sys/arm/ti/ti_adc.c9
-rw-r--r--sys/arm/ti/ti_pinmux.c4
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c
index 2b49789f5cea..011b9daeb3cc 100644
--- a/sys/arm/ti/ti_adc.c
+++ b/sys/arm/ti/ti_adc.c
@@ -777,8 +777,9 @@ ti_adc_attach(device_t dev)
if ((OF_getencprop(child, "ti,charge-delay", &cell,
sizeof(cell))) > 0)
sc->sc_charge_delay = cell;
- nwire_configs = OF_getencprop_alloc(child, "ti,wire-config",
- sizeof(*wire_configs), (void **)&wire_configs);
+ nwire_configs = OF_getencprop_alloc_multi(child,
+ "ti,wire-config", sizeof(*wire_configs),
+ (void **)&wire_configs);
if (nwire_configs != sc->sc_tsc_wires) {
device_printf(sc->sc_dev,
"invalid number of ti,wire-config: %d (should be %d)\n",
@@ -795,8 +796,8 @@ ti_adc_attach(device_t dev)
/* Read "adc" node properties */
child = ofw_bus_find_child(node, "adc");
if (child != 0) {
- sc->sc_adc_nchannels = OF_getencprop_alloc(child, "ti,adc-channels",
- sizeof(*channels), (void **)&channels);
+ sc->sc_adc_nchannels = OF_getencprop_alloc_multi(child,
+ "ti,adc-channels", sizeof(*channels), (void **)&channels);
if (sc->sc_adc_nchannels > 0) {
for (i = 0; i < sc->sc_adc_nchannels; i++)
sc->sc_adc_channels[i] = channels[i];
diff --git a/sys/arm/ti/ti_pinmux.c b/sys/arm/ti/ti_pinmux.c
index e102d61611ab..b532d9124ce6 100644
--- a/sys/arm/ti/ti_pinmux.c
+++ b/sys/arm/ti/ti_pinmux.c
@@ -340,8 +340,8 @@ ti_pinmux_configure_pins(device_t dev, phandle_t cfgxref)
sc = device_get_softc(dev);
cfgnode = OF_node_from_xref(cfgxref);
- ntuples = OF_getencprop_alloc(cfgnode, "pinctrl-single,pins", sizeof(*cfgtuples),
- (void **)&cfgtuples);
+ ntuples = OF_getencprop_alloc_multi(cfgnode, "pinctrl-single,pins",
+ sizeof(*cfgtuples), (void **)&cfgtuples);
if (ntuples < 0)
return (ENOENT);