Commit 096b256
committed
clk: Drive clk_leaf_mux_set_rate_parent test from clk_ops
Running this kunit test with lockdep enabled leads to warning splats
about calling clk provider APIs without the clk_prepare lock held. I
proposed adding a wrapper around these APIs to grab the prepare lock so
we can call them from anywhere, and Maxime implemented that approach[1],
but it didn't look great. That's because we had to make more kunit
testing APIs just to call code from a place that isn't a clk provider
when the prepare lock isn't held.
Instead of doing that, let's implement a determine_rate clk_op for a new
leaf clk that is the child of the existing leaf clk. We can call
__clk_determine_rate() on the existing leaf clk from there, and stash
away the clk_rate_request struct to check once the clk_op returns. Drive
that clk_op by calling clk_round_rate() to keep things similar to how it
was before (i.e. nothing actually changes rate, just the new rate is
determined). This silences the warning by driving the test from a
clk_op where we know the prepare lock is held.
While looking at this in more detail, it was determined that the code we
intended to test in commit 262ca38 ("clk: Stop forwarding
clk_rate_requests to the parent") wasn't actually tested. The call to
__clk_determine_rate() wasn't actually getting to the newly introduced
code under the CLK_SET_RATE_PARENT if condition in
clk_core_round_rate_nolock() because the parent clk (the mux) could
round rates. We introduce a new leaf and make sure the parent of that
clk has no clk_ops so that we can be certain that the
CLK_SET_RATE_PARENT condition in clk_core_round_rate_nolock() is
evaluated.
Reported-by: Guenter Roeck <[email protected]>
Closes: https://lore.kernel.org/linux-clk/[email protected]/
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-lkp/[email protected]
Cc: Maxime Ripard <[email protected]>
Link: https://lore.kernel.org/r/[email protected] [1]
Fixes: 262ca38 ("clk: Stop forwarding clk_rate_requests to the parent")
Link: https://lore.kernel.org/r/[email protected]
Acked-by: Maxime Ripard <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>1 parent 0bb80ec commit 096b256
1 file changed
+48
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
2155 | 2157 | | |
2156 | 2158 | | |
2157 | 2159 | | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
2158 | 2184 | | |
2159 | 2185 | | |
2160 | 2186 | | |
| |||
2193 | 2219 | | |
2194 | 2220 | | |
2195 | 2221 | | |
2196 | | - | |
2197 | | - | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
2198 | 2230 | | |
2199 | 2231 | | |
2200 | 2232 | | |
| |||
2208 | 2240 | | |
2209 | 2241 | | |
2210 | 2242 | | |
| 2243 | + | |
2211 | 2244 | | |
2212 | 2245 | | |
2213 | 2246 | | |
2214 | 2247 | | |
2215 | 2248 | | |
2216 | 2249 | | |
2217 | | - | |
2218 | | - | |
2219 | | - | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
2220 | 2255 | | |
2221 | | - | |
| 2256 | + | |
2222 | 2257 | | |
2223 | 2258 | | |
2224 | 2259 | | |
2225 | 2260 | | |
2226 | 2261 | | |
2227 | 2262 | | |
2228 | | - | |
2229 | 2263 | | |
| 2264 | + | |
2230 | 2265 | | |
2231 | 2266 | | |
2232 | | - | |
2233 | | - | |
2234 | | - | |
2235 | | - | |
2236 | | - | |
| 2267 | + | |
2237 | 2268 | | |
2238 | 2269 | | |
2239 | 2270 | | |
| |||
2243 | 2274 | | |
2244 | 2275 | | |
2245 | 2276 | | |
2246 | | - | |
| 2277 | + | |
2247 | 2278 | | |
2248 | 2279 | | |
2249 | 2280 | | |
2250 | 2281 | | |
2251 | | - | |
2252 | | - | |
2253 | | - | |
2254 | | - | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
2255 | 2286 | | |
2256 | 2287 | | |
2257 | 2288 | | |
| |||
0 commit comments