Message ID | 1491226922-20307-2-git-send-email-vivek.gautam@codeaurora.org |
---|---|
State | Superseded |
Headers | show |
Hi Vivek, [auto build test ERROR on balbi-usb/next] [also build test ERROR on v4.11-rc5 next-20170403] [cannot apply to pza/reset/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Vivek-Gautam/reset-APIs-to-manage-a-list-of-resets/20170404-111639 base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next config: i386-randconfig-r0-201714 (attached as .config) compiler: gcc-5 (Debian 5.4.1-2) 5.4.1 20160904 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): In file included from drivers/usb/dwc2/platform.c:48:0: >> include/linux/reset.h:84:1: error: expected identifier or '(' before '{' token { ^ include/linux/reset.h:83:19: warning: 'of_reset_control_get_count' declared 'static' but never defined [-Wunused-function] static inline int of_reset_control_get_count(struct device_node *node); ^ vim +84 include/linux/reset.h 78 int index, bool shared, bool optional) 79 { 80 return optional ? NULL : ERR_PTR(-ENOTSUPP); 81 } 82 83 static inline int of_reset_control_get_count(struct device_node *node); > 84 { 85 return -ENOTSUPP; 86 } 87 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index f1e5e65388bb..66db061165cb 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -455,3 +455,25 @@ int device_reset(struct device *dev) return ret; } EXPORT_SYMBOL_GPL(device_reset); + +/** + * of_reset_control_get_count - Count number of resets available with a device + * + * @node: device node that contains 'resets'. + * + * Returns positive reset count on success, or error number on failure and + * on count being zero. + */ +int of_reset_control_get_count(struct device_node *node) +{ + int count; + + count = of_count_phandle_with_args(node, "resets", "#reset-cells"); + if (count < 0) + return count; + if (count == 0) + return -ENODEV; + + return count; +} +EXPORT_SYMBOL_GPL(of_reset_control_get_count); diff --git a/include/linux/reset.h b/include/linux/reset.h index 96fb139bdd08..d89556412ccc 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -21,6 +21,7 @@ struct reset_control *__devm_reset_control_get(struct device *dev, bool optional); int __must_check device_reset(struct device *dev); +int of_reset_control_get_count(struct device_node *node); static inline int device_reset_optional(struct device *dev) { @@ -79,6 +80,11 @@ static inline struct reset_control *__devm_reset_control_get( return optional ? NULL : ERR_PTR(-ENOTSUPP); } +static inline int of_reset_control_get_count(struct device_node *node); +{ + return -ENOTSUPP; +} + #endif /* CONFIG_RESET_CONTROLLER */ /**
Count number of reset phandles available with the device node to know the resets a given device has. Cc: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> --- Changes since v1: - Handling the error path by returning error code for failures and ENODEV for count equal to 0. - Moved the function to drivers instead of putting in the includes. drivers/reset/core.c | 22 ++++++++++++++++++++++ include/linux/reset.h | 6 ++++++ 2 files changed, 28 insertions(+)