Message ID | 1412857080-5100-1-git-send-email-m.szyprowski@samsung.com |
---|---|
State | New |
Headers | show |
On Thursday 09 October 2014 14:18:00 Marek Szyprowski wrote: > diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c > index 59fb12e..70780ad 100644 > --- a/drivers/of/of_reserved_mem.c > +++ b/drivers/of/of_reserved_mem.c > if (!rmem || !rmem->ops || !rmem->ops->device_init) > - return; > + return -EINVAL; > > rmem->ops->device_init(rmem, dev); > dev_info(dev, "assigned reserved memory node %s\n", rmem->name); > + return 0; > } You don't actually return the value from ->device_init() here but always return 0 on success. There are no callers of this function, so it's hard to tell if this actually makes a difference, but it contradicts your patch description. > diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h > index 5b5efae..ad2f670 100644 > --- a/include/linux/of_reserved_mem.h > +++ b/include/linux/of_reserved_mem.h > @@ -16,7 +16,7 @@ struct reserved_mem { > }; > > struct reserved_mem_ops { > - void (*device_init)(struct reserved_mem *rmem, > + int (*device_init)(struct reserved_mem *rmem, > struct device *dev); > void (*device_release)(struct reserved_mem *rmem, > struct device *dev); This part is definitely needed to avoid the new compile warnings we are getting. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 59fb12e..70780ad 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -243,23 +243,24 @@ static inline struct reserved_mem *__find_rmem(struct device_node *node) * This function assign memory region pointed by "memory-region" device tree * property to the given device. */ -void of_reserved_mem_device_init(struct device *dev) +int of_reserved_mem_device_init(struct device *dev) { struct reserved_mem *rmem; struct device_node *np; np = of_parse_phandle(dev->of_node, "memory-region", 0); if (!np) - return; + return -ENODEV; rmem = __find_rmem(np); of_node_put(np); if (!rmem || !rmem->ops || !rmem->ops->device_init) - return; + return -EINVAL; rmem->ops->device_init(rmem, dev); dev_info(dev, "assigned reserved memory node %s\n", rmem->name); + return 0; } /** diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 5b5efae..ad2f670 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h @@ -16,7 +16,7 @@ struct reserved_mem { }; struct reserved_mem_ops { - void (*device_init)(struct reserved_mem *rmem, + int (*device_init)(struct reserved_mem *rmem, struct device *dev); void (*device_release)(struct reserved_mem *rmem, struct device *dev); @@ -28,14 +28,17 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) #ifdef CONFIG_OF_RESERVED_MEM -void of_reserved_mem_device_init(struct device *dev); +int of_reserved_mem_device_init(struct device *dev); void of_reserved_mem_device_release(struct device *dev); void fdt_init_reserved_mem(void); void fdt_reserved_mem_save_node(unsigned long node, const char *uname, phys_addr_t base, phys_addr_t size); #else -static inline void of_reserved_mem_device_init(struct device *dev) { } +static inline int of_reserved_mem_device_init(struct device *dev) +{ + return -ENOSYS; +} static inline void of_reserved_mem_device_release(struct device *pdev) { } static inline void fdt_init_reserved_mem(void) { }
Driver calling of_reserved_mem_device_init() might be interested if the initialization has been successful or not, so add support for returning error code. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/of/of_reserved_mem.c | 7 ++++--- include/linux/of_reserved_mem.h | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-)