Skip to content

Commit b7da038

Browse files
committed
Revert "clk: Introduce a clock request API"
This reverts commit 23fbabe.
1 parent 63675e4 commit b7da038

File tree

2 files changed

+0
-125
lines changed

2 files changed

+0
-125
lines changed

drivers/clk/clk.c

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,12 @@ struct clk_core {
7777
unsigned int protect_count;
7878
unsigned long min_rate;
7979
unsigned long max_rate;
80-
unsigned long default_request_rate;
8180
unsigned long accuracy;
8281
int phase;
8382
struct clk_duty duty;
8483
struct hlist_head children;
8584
struct hlist_node child_node;
8685
struct hlist_head clks;
87-
struct list_head pending_requests;
8886
unsigned int notifier_count;
8987
#ifdef CONFIG_DEBUG_FS
9088
struct dentry *dentry;
@@ -107,12 +105,6 @@ struct clk {
107105
struct hlist_node clks_node;
108106
};
109107

110-
struct clk_request {
111-
struct list_head list;
112-
struct clk *clk;
113-
unsigned long rate;
114-
};
115-
116108
/*** runtime pm ***/
117109
static int clk_pm_runtime_get(struct clk_core *core)
118110
{
@@ -1462,14 +1454,10 @@ unsigned long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
14621454
{
14631455
int ret;
14641456
struct clk_rate_request req;
1465-
struct clk_request *clk_req;
14661457

14671458
clk_core_get_boundaries(hw->core, &req.min_rate, &req.max_rate);
14681459
req.rate = rate;
14691460

1470-
list_for_each_entry(clk_req, &hw->core->pending_requests, list)
1471-
req.min_rate = max(clk_req->rate, req.min_rate);
1472-
14731461
ret = clk_core_round_rate_nolock(hw->core, &req);
14741462
if (ret)
14751463
return 0;
@@ -1490,7 +1478,6 @@ EXPORT_SYMBOL_GPL(clk_hw_round_rate);
14901478
long clk_round_rate(struct clk *clk, unsigned long rate)
14911479
{
14921480
struct clk_rate_request req;
1493-
struct clk_request *clk_req;
14941481
int ret;
14951482

14961483
if (!clk)
@@ -1504,9 +1491,6 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
15041491
clk_core_get_boundaries(clk->core, &req.min_rate, &req.max_rate);
15051492
req.rate = rate;
15061493

1507-
list_for_each_entry(clk_req, &clk->core->pending_requests, list)
1508-
req.min_rate = max(clk_req->rate, req.min_rate);
1509-
15101494
ret = clk_core_round_rate_nolock(clk->core, &req);
15111495

15121496
if (clk->exclusive_count)
@@ -1974,7 +1958,6 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core,
19741958
unsigned long new_rate;
19751959
unsigned long min_rate;
19761960
unsigned long max_rate;
1977-
struct clk_request *req;
19781961
int p_index = 0;
19791962
long ret;
19801963

@@ -1989,9 +1972,6 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core,
19891972

19901973
clk_core_get_boundaries(core, &min_rate, &max_rate);
19911974

1992-
list_for_each_entry(req, &core->pending_requests, list)
1993-
min_rate = max(req->rate, min_rate);
1994-
19951975
/* find the closest rate and parent clk/rate */
19961976
if (clk_core_can_round(core)) {
19971977
struct clk_rate_request req;
@@ -2188,7 +2168,6 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core,
21882168
{
21892169
int ret, cnt;
21902170
struct clk_rate_request req;
2191-
struct clk_request *clk_req;
21922171

21932172
lockdep_assert_held(&prepare_lock);
21942173

@@ -2203,9 +2182,6 @@ static unsigned long clk_core_req_round_rate_nolock(struct clk_core *core,
22032182
clk_core_get_boundaries(core, &req.min_rate, &req.max_rate);
22042183
req.rate = req_rate;
22052184

2206-
list_for_each_entry(clk_req, &core->pending_requests, list)
2207-
req.min_rate = max(clk_req->rate, req.min_rate);
2208-
22092185
ret = clk_core_round_rate_nolock(core, &req);
22102186

22112187
/* restore the protection */
@@ -2299,9 +2275,6 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
22992275

23002276
ret = clk_core_set_rate_nolock(clk->core, rate);
23012277

2302-
if (!list_empty(&clk->core->pending_requests))
2303-
clk->core->default_request_rate = rate;
2304-
23052278
if (clk->exclusive_count)
23062279
clk_core_rate_protect(clk->core);
23072280

@@ -2470,99 +2443,6 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate)
24702443
}
24712444
EXPORT_SYMBOL_GPL(clk_set_max_rate);
24722445

2473-
/**
2474-
* clk_request_start - Request a rate to be enforced temporarily
2475-
* @clk: the clk to act on
2476-
* @rate: the new rate asked for
2477-
*
2478-
* This function will create a request to temporarily increase the rate
2479-
* of the clock to a given rate to a certain minimum.
2480-
*
2481-
* This is meant as a best effort mechanism and while the rate of the
2482-
* clock will be guaranteed to be equal or higher than the requested
2483-
* rate, there's none on what the actual rate will be due to other
2484-
* factors (other requests previously set, clock boundaries, etc.).
2485-
*
2486-
* Once the request is marked as done through clk_request_done(), the
2487-
* rate will be reverted back to what the rate was before the request.
2488-
*
2489-
* The reported boundaries of the clock will also be adjusted so that
2490-
* clk_round_rate() take those requests into account. A call to
2491-
* clk_set_rate() during a request will affect the rate the clock will
2492-
* return to after the requests on that clock are done.
2493-
*
2494-
* Returns 0 on success, an ERR_PTR otherwise.
2495-
*/
2496-
struct clk_request *clk_request_start(struct clk *clk, unsigned long rate)
2497-
{
2498-
struct clk_request *req;
2499-
int ret;
2500-
2501-
if (!clk)
2502-
return ERR_PTR(-EINVAL);
2503-
2504-
req = kzalloc(sizeof(*req), GFP_KERNEL);
2505-
if (!req)
2506-
return ERR_PTR(-ENOMEM);
2507-
2508-
clk_prepare_lock();
2509-
2510-
req->clk = clk;
2511-
req->rate = rate;
2512-
2513-
if (list_empty(&clk->core->pending_requests))
2514-
clk->core->default_request_rate = clk_core_get_rate_recalc(clk->core);
2515-
2516-
ret = clk_core_set_rate_nolock(clk->core, rate);
2517-
if (ret) {
2518-
clk_prepare_unlock();
2519-
kfree(req);
2520-
return ERR_PTR(ret);
2521-
}
2522-
2523-
list_add_tail(&req->list, &clk->core->pending_requests);
2524-
clk_prepare_unlock();
2525-
2526-
return req;
2527-
}
2528-
EXPORT_SYMBOL_GPL(clk_request_start);
2529-
2530-
/**
2531-
* clk_request_done - Mark a clk_request as done
2532-
* @req: the request to mark done
2533-
*
2534-
* This function will remove the rate request from the clock and adjust
2535-
* the clock rate back to either to what it was before the request
2536-
* started, or if there's any other request on that clock to a proper
2537-
* rate for them.
2538-
*/
2539-
void clk_request_done(struct clk_request *req)
2540-
{
2541-
struct clk_core *core = req->clk->core;
2542-
2543-
clk_prepare_lock();
2544-
2545-
list_del(&req->list);
2546-
2547-
if (list_empty(&core->pending_requests)) {
2548-
clk_core_set_rate_nolock(core, core->default_request_rate);
2549-
core->default_request_rate = 0;
2550-
} else {
2551-
struct clk_request *cur_req;
2552-
unsigned long new_rate = 0;
2553-
2554-
list_for_each_entry(cur_req, &core->pending_requests, list)
2555-
new_rate = max(new_rate, cur_req->rate);
2556-
2557-
clk_core_set_rate_nolock(core, new_rate);
2558-
}
2559-
2560-
clk_prepare_unlock();
2561-
2562-
kfree(req);
2563-
}
2564-
EXPORT_SYMBOL_GPL(clk_request_done);
2565-
25662446
/**
25672447
* clk_get_parent - return the parent of a clk
25682448
* @clk: the clk whose parent gets returned
@@ -4022,7 +3902,6 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
40223902
goto fail_parents;
40233903

40243904
INIT_HLIST_HEAD(&core->clks);
4025-
INIT_LIST_HEAD(&core->pending_requests);
40263905

40273906
/*
40283907
* Don't call clk_hw_create_clk() here because that would pin the

include/linux/clk.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
struct device;
1717
struct clk;
18-
struct clk_request;
1918
struct device_node;
2019
struct of_phandle_args;
2120

@@ -784,9 +783,6 @@ int clk_save_context(void);
784783
*/
785784
void clk_restore_context(void);
786785

787-
struct clk_request *clk_request_start(struct clk *clk, unsigned long rate);
788-
void clk_request_done(struct clk_request *req);
789-
790786
#else /* !CONFIG_HAVE_CLK */
791787

792788
static inline struct clk *clk_get(struct device *dev, const char *id)

0 commit comments

Comments
 (0)