Skip to content

Commit fff3df4

Browse files
committed
Merge branch 'pm-opp'
* pm-opp: opp: Allow required-opps to be used for non genpd use cases opp: use list_del_init instead of list_del/INIT_LIST_HEAD
2 parents 4d6035f + d5ddd4c commit fff3df4

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

drivers/opp/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,16 @@ static int _set_required_opps(struct device *dev,
893893
if (!required_opp_tables)
894894
return 0;
895895

896+
/*
897+
* We only support genpd's OPPs in the "required-opps" for now, as we
898+
* don't know much about other use cases. Error out if the required OPP
899+
* doesn't belong to a genpd.
900+
*/
901+
if (unlikely(!required_opp_tables[0]->is_genpd)) {
902+
dev_err(dev, "required-opps don't belong to a genpd\n");
903+
return -ENOENT;
904+
}
905+
896906
/* required-opps not fully initialized yet */
897907
if (lazy_linking_pending(opp_table))
898908
return -EBUSY;

drivers/opp/of.c

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -197,21 +197,8 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table,
197197
required_opp_tables[i] = _find_table_of_opp_np(required_np);
198198
of_node_put(required_np);
199199

200-
if (IS_ERR(required_opp_tables[i])) {
200+
if (IS_ERR(required_opp_tables[i]))
201201
lazy = true;
202-
continue;
203-
}
204-
205-
/*
206-
* We only support genpd's OPPs in the "required-opps" for now,
207-
* as we don't know how much about other cases. Error out if the
208-
* required OPP doesn't belong to a genpd.
209-
*/
210-
if (!required_opp_tables[i]->is_genpd) {
211-
dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n",
212-
required_np);
213-
goto free_required_tables;
214-
}
215202
}
216203

217204
/* Let's do the linking later on */
@@ -379,13 +366,6 @@ static void lazy_link_required_opp_table(struct opp_table *new_table)
379366
struct dev_pm_opp *opp;
380367
int i, ret;
381368

382-
/*
383-
* We only support genpd's OPPs in the "required-opps" for now,
384-
* as we don't know much about other cases.
385-
*/
386-
if (!new_table->is_genpd)
387-
return;
388-
389369
mutex_lock(&opp_table_lock);
390370

391371
list_for_each_entry_safe(opp_table, temp, &lazy_opp_tables, lazy) {
@@ -433,8 +413,7 @@ static void lazy_link_required_opp_table(struct opp_table *new_table)
433413

434414
/* All required opp-tables found, remove from lazy list */
435415
if (!lazy) {
436-
list_del(&opp_table->lazy);
437-
INIT_LIST_HEAD(&opp_table->lazy);
416+
list_del_init(&opp_table->lazy);
438417

439418
list_for_each_entry(opp, &opp_table->opp_list, node)
440419
_required_opps_available(opp, opp_table->required_opp_count);
@@ -874,7 +853,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
874853
return ERR_PTR(-ENOMEM);
875854

876855
ret = _read_opp_key(new_opp, opp_table, np, &rate_not_available);
877-
if (ret < 0 && !opp_table->is_genpd) {
856+
if (ret < 0) {
878857
dev_err(dev, "%s: opp key field not found\n", __func__);
879858
goto free_opp;
880859
}

0 commit comments

Comments
 (0)