.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * drivers/base/power/clock_ops.c - Generic clock manipulation PM callbacks |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp. |
---|
5 | | - * |
---|
6 | | - * This file is released under the GPLv2. |
---|
7 | 6 | */ |
---|
8 | 7 | |
---|
9 | 8 | #include <linux/kernel.h> |
---|
.. | .. |
---|
13 | 12 | #include <linux/pm_clock.h> |
---|
14 | 13 | #include <linux/clk.h> |
---|
15 | 14 | #include <linux/clkdev.h> |
---|
| 15 | +#include <linux/of_clk.h> |
---|
16 | 16 | #include <linux/slab.h> |
---|
17 | 17 | #include <linux/err.h> |
---|
18 | 18 | #include <linux/pm_domain.h> |
---|
.. | .. |
---|
65 | 65 | if (IS_ERR(ce->clk)) { |
---|
66 | 66 | ce->status = PCE_STATUS_ERROR; |
---|
67 | 67 | } else { |
---|
68 | | - clk_prepare(ce->clk); |
---|
69 | | - ce->status = PCE_STATUS_ACQUIRED; |
---|
70 | | - dev_dbg(dev, "Clock %pC con_id %s managed by runtime PM.\n", |
---|
71 | | - ce->clk, ce->con_id); |
---|
| 68 | + if (clk_prepare(ce->clk)) { |
---|
| 69 | + ce->status = PCE_STATUS_ERROR; |
---|
| 70 | + dev_err(dev, "clk_prepare() failed\n"); |
---|
| 71 | + } else { |
---|
| 72 | + ce->status = PCE_STATUS_ACQUIRED; |
---|
| 73 | + dev_dbg(dev, |
---|
| 74 | + "Clock %pC con_id %s managed by runtime PM.\n", |
---|
| 75 | + ce->clk, ce->con_id); |
---|
| 76 | + } |
---|
72 | 77 | } |
---|
73 | 78 | } |
---|
74 | 79 | |
---|
.. | .. |
---|
88 | 93 | if (con_id) { |
---|
89 | 94 | ce->con_id = kstrdup(con_id, GFP_KERNEL); |
---|
90 | 95 | if (!ce->con_id) { |
---|
91 | | - dev_err(dev, |
---|
92 | | - "Not enough memory for clock connection ID.\n"); |
---|
93 | 96 | kfree(ce); |
---|
94 | 97 | return -ENOMEM; |
---|
95 | 98 | } |
---|
.. | .. |
---|
191 | 194 | if (!dev || !dev->of_node) |
---|
192 | 195 | return -EINVAL; |
---|
193 | 196 | |
---|
194 | | - count = of_count_phandle_with_args(dev->of_node, "clocks", |
---|
195 | | - "#clock-cells"); |
---|
| 197 | + count = of_clk_get_parent_count(dev->of_node); |
---|
196 | 198 | if (count <= 0) |
---|
197 | 199 | return -ENODEV; |
---|
198 | 200 | |
---|