Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
71803232
Commit
71803232
authored
Mar 12, 2021
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pm-opp'
* pm-opp: opp: Don't drop extra references to OPPs accidentally
parents
b7dea0cb
bee7359f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
23 deletions
+27
-23
drivers/opp/core.c
drivers/opp/core.c
+25
-23
drivers/opp/opp.h
drivers/opp/opp.h
+2
-0
No files found.
drivers/opp/core.c
View file @
71803232
...
...
@@ -1492,7 +1492,11 @@ static struct dev_pm_opp *_opp_get_next(struct opp_table *opp_table,
mutex_lock
(
&
opp_table
->
lock
);
list_for_each_entry
(
temp
,
&
opp_table
->
opp_list
,
node
)
{
if
(
dynamic
==
temp
->
dynamic
)
{
/*
* Refcount must be dropped only once for each OPP by OPP core,
* do that with help of "removed" flag.
*/
if
(
!
temp
->
removed
&&
dynamic
==
temp
->
dynamic
)
{
opp
=
temp
;
break
;
}
...
...
@@ -1502,10 +1506,27 @@ static struct dev_pm_opp *_opp_get_next(struct opp_table *opp_table,
return
opp
;
}
bool
_opp_remove_all_static
(
struct
opp_table
*
opp_table
)
/*
* Can't call dev_pm_opp_put() from under the lock as debugfs removal needs to
* happen lock less to avoid circular dependency issues. This routine must be
* called without the opp_table->lock held.
*/
static
void
_opp_remove_all
(
struct
opp_table
*
opp_table
,
bool
dynamic
)
{
struct
dev_pm_opp
*
opp
;
while
((
opp
=
_opp_get_next
(
opp_table
,
dynamic
)))
{
opp
->
removed
=
true
;
dev_pm_opp_put
(
opp
);
/* Drop the references taken by dev_pm_opp_add() */
if
(
dynamic
)
dev_pm_opp_put_opp_table
(
opp_table
);
}
}
bool
_opp_remove_all_static
(
struct
opp_table
*
opp_table
)
{
mutex_lock
(
&
opp_table
->
lock
);
if
(
!
opp_table
->
parsed_static_opps
)
{
...
...
@@ -1520,13 +1541,7 @@ bool _opp_remove_all_static(struct opp_table *opp_table)
mutex_unlock
(
&
opp_table
->
lock
);
/*
* Can't remove the OPP from under the lock, debugfs removal needs to
* happen lock less to avoid circular dependency issues.
*/
while
((
opp
=
_opp_get_next
(
opp_table
,
false
)))
dev_pm_opp_put
(
opp
);
_opp_remove_all
(
opp_table
,
false
);
return
true
;
}
...
...
@@ -1539,25 +1554,12 @@ bool _opp_remove_all_static(struct opp_table *opp_table)
void
dev_pm_opp_remove_all_dynamic
(
struct
device
*
dev
)
{
struct
opp_table
*
opp_table
;
struct
dev_pm_opp
*
opp
;
int
count
=
0
;
opp_table
=
_find_opp_table
(
dev
);
if
(
IS_ERR
(
opp_table
))
return
;
/*
* Can't remove the OPP from under the lock, debugfs removal needs to
* happen lock less to avoid circular dependency issues.
*/
while
((
opp
=
_opp_get_next
(
opp_table
,
true
)))
{
dev_pm_opp_put
(
opp
);
count
++
;
}
/* Drop the references taken by dev_pm_opp_add() */
while
(
count
--
)
dev_pm_opp_put_opp_table
(
opp_table
);
_opp_remove_all
(
opp_table
,
true
);
/* Drop the reference taken by _find_opp_table() */
dev_pm_opp_put_opp_table
(
opp_table
);
...
...
drivers/opp/opp.h
View file @
71803232
...
...
@@ -56,6 +56,7 @@ extern struct list_head opp_tables, lazy_opp_tables;
* @dynamic: not-created from static DT entries.
* @turbo: true if turbo (boost) OPP
* @suspend: true if suspend OPP
* @removed: flag indicating that OPP's reference is dropped by OPP core.
* @pstate: Device's power domain's performance state.
* @rate: Frequency in hertz
* @level: Performance level
...
...
@@ -78,6 +79,7 @@ struct dev_pm_opp {
bool
dynamic
;
bool
turbo
;
bool
suspend
;
bool
removed
;
unsigned
int
pstate
;
unsigned
long
rate
;
unsigned
int
level
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment