On 30 November 2016 at 22:54, Stefan Roese <s...@denx.de> wrote: > Hi Simon, > > > On 01.12.2016 03:19, Simon Glass wrote: >> >> On 29 November 2016 at 23:24, Stefan Roese <s...@denx.de> wrote: >>> >>> The currently available functions accessing the 'reg' property of a >>> device only retrieve the address. Sometimes its also necessary to >>> retrieve the size described by the 'reg' property. This patch adds >>> the new function dev_get_addr_size_index() which retrieves both, >>> the address and the size described by the 'reg' property. >>> >>> Signed-off-by: Stefan Roese <s...@denx.de> >>> Cc: Simon Glass <s...@chromium.org> >>> --- >>> v2: >>> - Account 'index' in fdtdec_get_addr_size_auto_noparent() as >>> spotted by Simon >>> >>> drivers/core/device.c | 22 ++++++++++++++++++++++ >>> include/dm/device.h | 16 ++++++++++++++++ >>> 2 files changed, 38 insertions(+) >>> >> >> Acked-by: Simon Glass <s...@chromium.org> >> >> But please check below. >> >>> diff --git a/drivers/core/device.c b/drivers/core/device.c >>> index dcf5d9df7d..ed553d70a6 100644 >>> --- a/drivers/core/device.c >>> +++ b/drivers/core/device.c >>> @@ -693,6 +693,28 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, >>> int index) >>> #endif >>> } >>> >>> +fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index, >>> + fdt_size_t *size) >>> +{ >>> +#if CONFIG_IS_ENABLED(OF_CONTROL) >>> + /* >>> + * Only get the size in this first call. We'll get the addr in >>> the >>> + * next call to the exisiting dev_get_xxx function which handles >>> + * all config options. >>> + */ >>> + fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev->of_offset, >>> + "reg", index, size, false); >> >> >> The return value is not checked here. Is this because the >> dev_get_addr_index() function will return the same error? > > > Exactly. I didn't check the return value deliberately, as mentioned > in the comment above. I thought this would be clear enough but if > you don't think so, I can extend the comment a bit more. > > Thanks, > Stefan
Applied to u-boot-dm, thanks! _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot