Messages in this thread Patch in this message | | | From | Phil Edworthy <> | Subject | [PATCH v6 5/6] MIPS: Loongson 2F: Add clk_get_optional() function | Date | Fri, 16 Nov 2018 14:59:36 +0000 |
| |
clk_get_optional() returns NULL if not found instead of -ENOENT, otherwise the behaviour is the same as clk_get().
Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> --- arch/mips/loongson64/lemote-2f/clock.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/arch/mips/loongson64/lemote-2f/clock.c b/arch/mips/loongson64/lemote-2f/clock.c index 8281334df9c8..abbade58b635 100644 --- a/arch/mips/loongson64/lemote-2f/clock.c +++ b/arch/mips/loongson64/lemote-2f/clock.c @@ -53,6 +53,17 @@ struct clk *clk_get(struct device *dev, const char *id) } EXPORT_SYMBOL(clk_get); +struct clk *clk_get_optional(struct device *dev, const char *id) +{ + struct clk *clk = clk_get(dev, id); + + if (clk == ERR_PTR(-ENOENT)) + clk = NULL; + + return clk; +} +EXPORT_SYMBOL(clk_get_optional); + static void propagate_rate(struct clk *clk) { struct clk *clkp; -- 2.17.1
| |