Commit 82f5279b0cd99a9163d34cfe926d0316d9dc0d37
ns16650: Make sure we have CONFIG_CLK set before using infrastructure
We cannot call on the CONFIG_CLK based clk_get_rate function unless CONFIG_CLK is set. Signed-off-by: Tom Rini <trini@konsulko.com>
Showing 2 changed files with 17 additions and 15 deletions Side-by-side Diff
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | #include <serial.h> |
14 | 14 | #include <watchdog.h> |
15 | 15 | #include <linux/types.h> |
16 | +#include <linux/compiler.h> | |
16 | 17 | #include <asm/io.h> |
17 | 18 | |
18 | 19 | DECLARE_GLOBAL_DATA_PTR; |
... | ... | @@ -353,8 +354,8 @@ |
353 | 354 | { |
354 | 355 | struct ns16550_platdata *plat = dev->platdata; |
355 | 356 | fdt_addr_t addr; |
356 | - struct clk clk; | |
357 | - int err; | |
357 | + __maybe_unused struct clk clk; | |
358 | + __maybe_unused int err; | |
358 | 359 | |
359 | 360 | /* try Processor Local Bus device first */ |
360 | 361 | addr = dev_get_addr(dev); |
... | ... | @@ -401,6 +402,7 @@ |
401 | 402 | plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset, |
402 | 403 | "reg-shift", 0); |
403 | 404 | |
405 | +#ifdef CONFIG_CLK | |
404 | 406 | err = clk_get_by_index(dev, 0, &clk); |
405 | 407 | if (!err) { |
406 | 408 | err = clk_get_rate(&clk); |
... | ... | @@ -410,6 +412,7 @@ |
410 | 412 | debug("ns16550 failed to get clock\n"); |
411 | 413 | return err; |
412 | 414 | } |
415 | +#endif | |
413 | 416 | |
414 | 417 | if (!plat->clock) |
415 | 418 | plat->clock = fdtdec_get_int(gd->fdt_blob, dev->of_offset, |
... | ... | @@ -98,20 +98,7 @@ |
98 | 98 | * @return 0 if OK, or a negative error code. |
99 | 99 | */ |
100 | 100 | int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk); |
101 | -#else | |
102 | -static inline int clk_get_by_index(struct udevice *dev, int index, | |
103 | - struct clk *clk) | |
104 | -{ | |
105 | - return -ENOSYS; | |
106 | -} | |
107 | 101 | |
108 | -static inline int clk_get_by_name(struct udevice *dev, const char *name, | |
109 | - struct clk *clk) | |
110 | -{ | |
111 | - return -ENOSYS; | |
112 | -} | |
113 | -#endif | |
114 | - | |
115 | 102 | /** |
116 | 103 | * clk_request - Request a clock by provider-specific ID. |
117 | 104 | * |
118 | 105 | |
... | ... | @@ -175,6 +162,18 @@ |
175 | 162 | int clk_disable(struct clk *clk); |
176 | 163 | |
177 | 164 | int soc_clk_dump(void); |
165 | +#else | |
166 | +static inline int clk_get_by_index(struct udevice *dev, int index, | |
167 | + struct clk *clk) | |
168 | +{ | |
169 | + return -ENOSYS; | |
170 | +} | |
178 | 171 | |
172 | +static inline int clk_get_by_name(struct udevice *dev, const char *name, | |
173 | + struct clk *clk) | |
174 | +{ | |
175 | + return -ENOSYS; | |
176 | +} | |
177 | +#endif | |
179 | 178 | #endif |
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf
-
mentioned in commit 021abf