Re: [PATCH v5 00/13] clk: hisilicon: Migrate devm APIs

From: Stephen Boyd
Date: Fri Jul 28 2023 - 15:59:15 EST


Quoting David Yang (2023-07-23 09:22:25)
> Migrate devm APIs for HiSilicon clock drivers and remove redundant codes.
>
> This series is a partial improvement of [1]
>

Thanks for resending. Can you fix these checkpatch and compilation errors?

WARNING: Macros with flow control statements should be avoided
#581: FILE: drivers/clk/hisilicon/clk.c:165:
+#define hisi_clk_register_fn(fn, type, stmt) \
+int fn(struct device *dev, const struct type *clks, \
+ size_t num, struct hisi_clock_data *data) \
+{ \
+ void __iomem *base = data->base; \
+\
+ for (int i = 0; i < num; i++) { \
+ const struct type *p_clk = &clks[i]; \
+ struct clk_hw *clk = stmt; \
+\
+ if (IS_ERR(clk)) { \
+ pr_err("%s: failed to register clock %s\n", \
+ __func__, p_clk->name); \
+ return PTR_ERR(clk); \
+ } \
+\
+ if (p_clk->alias) \
+ clk_hw_register_clkdev(clk, p_clk->alias, NULL); \
+\
+ data->clk_data->hws[p_clk->id] = clk; \
+ } \
+\
+ return 0; \
+} \
+EXPORT_SYMBOL_GPL(fn);

WARNING: macros should not use a trailing semicolon
#581: FILE: drivers/clk/hisilicon/clk.c:165:
+#define hisi_clk_register_fn(fn, type, stmt) \
+int fn(struct device *dev, const struct type *clks, \
+ size_t num, struct hisi_clock_data *data) \
+{ \
+ void __iomem *base = data->base; \
+\
+ for (int i = 0; i < num; i++) { \
+ const struct type *p_clk = &clks[i]; \
+ struct clk_hw *clk = stmt; \
+\
+ if (IS_ERR(clk)) { \
+ pr_err("%s: failed to register clock %s\n", \
+ __func__, p_clk->name); \
+ return PTR_ERR(clk); \
+ } \
+\
+ if (p_clk->alias) \
+ clk_hw_register_clkdev(clk, p_clk->alias, NULL); \
+\
+ data->clk_data->hws[p_clk->id] = clk; \
+ } \
+\
+ return 0; \
+} \
+EXPORT_SYMBOL_GPL(fn);

These look like instead of macros just write the functions out.

total: 0 errors, 2 warnings, 1002 lines checked
in patch 'clk: hisilicon: Migrate devm APIs' (74cb486e14c6)
WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity")
#174: FILE: drivers/clk/hisilicon/clk-hix5hd2.c:337:
+MODULE_LICENSE("GPL v2");

total: 0 errors, 1 warnings, 150 lines checked
in patch 'clk: hisilicon: hix5hd2: Convert into platform driver module' (f40d4d59c265)
WARNING: DT compatible string "hisilicon,hip04-clock" appears un-documented -- check ./Documentation/devicetree/bindings/
#46: FILE: drivers/clk/hisilicon/clk-hip04.c:33:
+ { .compatible = "hisilicon,hip04-clock",

total: 0 errors, 1 warnings, 51 lines checked
in patch 'clk: hisilicon: hip04: Convert into platform driver module' (fc919e7f3f7b)
WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity")
#353: FILE: drivers/clk/hisilicon/clk-hi6220.c:299:
+MODULE_LICENSE("GPL v2");

total: 0 errors, 1 warnings, 324 lines checked
in patch 'clk: hisilicon: hi6220: Convert into platform driver module' (85c1694448a3)
WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity")
#298: FILE: drivers/clk/hisilicon/clk-hi3670.c:917:
+MODULE_LICENSE("GPL v2");

total: 0 errors, 1 warnings, 278 lines checked
in patch 'clk: hisilicon: hi3670: Convert into module' (934dee9208ea)
WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity")
#251: FILE: drivers/clk/hisilicon/clk-hi3660.c:550:
+MODULE_LICENSE("GPL v2");

total: 0 errors, 1 warnings, 231 lines checked
in patch 'clk: hisilicon: hi3660: Convert into module' (1ac1cef160ff)

drivers/clk/hisilicon/clk-hi3559a.c: In function ‘hi3559av100_shub_default_clk_set’:
drivers/clk/hisilicon/clk-hi3559a.c:628:53: error: ‘SZ_4K’ undeclared (first use in this function)
628 | crg_base = devm_ioremap(dev, CRG_BASE_ADDR, SZ_4K);
| ^~~~~