Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
0469a43b
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0469a43b
编写于
9月 10, 2014
作者:
M
Mike Turquette
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'clk-next-debugfs-lock' into clk-next
上级
2fed71e5
6314b679
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
46 deletion
+28
-46
drivers/clk/clk.c
drivers/clk/clk.c
+27
-46
include/linux/clk-private.h
include/linux/clk-private.h
+1
-0
未找到文件。
drivers/clk/clk.c
浏览文件 @
0469a43b
...
@@ -100,6 +100,8 @@ static void clk_enable_unlock(unsigned long flags)
...
@@ -100,6 +100,8 @@ static void clk_enable_unlock(unsigned long flags)
static
struct
dentry
*
rootdir
;
static
struct
dentry
*
rootdir
;
static
int
inited
=
0
;
static
int
inited
=
0
;
static
DEFINE_MUTEX
(
clk_debug_lock
);
static
HLIST_HEAD
(
clk_debug_list
);
static
struct
hlist_head
*
all_lists
[]
=
{
static
struct
hlist_head
*
all_lists
[]
=
{
&
clk_root_list
,
&
clk_root_list
,
...
@@ -300,28 +302,6 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
...
@@ -300,28 +302,6 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
return
ret
;
return
ret
;
}
}
/* caller must hold prepare_lock */
static
int
clk_debug_create_subtree
(
struct
clk
*
clk
,
struct
dentry
*
pdentry
)
{
struct
clk
*
child
;
int
ret
=
-
EINVAL
;;
if
(
!
clk
||
!
pdentry
)
goto
out
;
ret
=
clk_debug_create_one
(
clk
,
pdentry
);
if
(
ret
)
goto
out
;
hlist_for_each_entry
(
child
,
&
clk
->
children
,
child_node
)
clk_debug_create_subtree
(
child
,
pdentry
);
ret
=
0
;
out:
return
ret
;
}
/**
/**
* clk_debug_register - add a clk node to the debugfs clk tree
* clk_debug_register - add a clk node to the debugfs clk tree
* @clk: the clk being added to the debugfs clk tree
* @clk: the clk being added to the debugfs clk tree
...
@@ -329,20 +309,21 @@ static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry)
...
@@ -329,20 +309,21 @@ static int clk_debug_create_subtree(struct clk *clk, struct dentry *pdentry)
* Dynamically adds a clk to the debugfs clk tree if debugfs has been
* Dynamically adds a clk to the debugfs clk tree if debugfs has been
* initialized. Otherwise it bails out early since the debugfs clk tree
* initialized. Otherwise it bails out early since the debugfs clk tree
* will be created lazily by clk_debug_init as part of a late_initcall.
* will be created lazily by clk_debug_init as part of a late_initcall.
*
* Caller must hold prepare_lock. Only clk_init calls this function (so
* far) so this is taken care.
*/
*/
static
int
clk_debug_register
(
struct
clk
*
clk
)
static
int
clk_debug_register
(
struct
clk
*
clk
)
{
{
int
ret
=
0
;
int
ret
=
0
;
mutex_lock
(
&
clk_debug_lock
);
hlist_add_head
(
&
clk
->
debug_node
,
&
clk_debug_list
);
if
(
!
inited
)
if
(
!
inited
)
goto
out
;
goto
unlock
;
ret
=
clk_debug_create_subtree
(
clk
,
rootdir
);
ret
=
clk_debug_create_one
(
clk
,
rootdir
);
unlock:
mutex_unlock
(
&
clk_debug_lock
);
out:
return
ret
;
return
ret
;
}
}
...
@@ -353,12 +334,18 @@ static int clk_debug_register(struct clk *clk)
...
@@ -353,12 +334,18 @@ static int clk_debug_register(struct clk *clk)
* Dynamically removes a clk and all it's children clk nodes from the
* Dynamically removes a clk and all it's children clk nodes from the
* debugfs clk tree if clk->dentry points to debugfs created by
* debugfs clk tree if clk->dentry points to debugfs created by
* clk_debug_register in __clk_init.
* clk_debug_register in __clk_init.
*
* Caller must hold prepare_lock.
*/
*/
static
void
clk_debug_unregister
(
struct
clk
*
clk
)
static
void
clk_debug_unregister
(
struct
clk
*
clk
)
{
{
mutex_lock
(
&
clk_debug_lock
);
if
(
!
clk
->
dentry
)
goto
out
;
hlist_del_init
(
&
clk
->
debug_node
);
debugfs_remove_recursive
(
clk
->
dentry
);
debugfs_remove_recursive
(
clk
->
dentry
);
clk
->
dentry
=
NULL
;
out:
mutex_unlock
(
&
clk_debug_lock
);
}
}
struct
dentry
*
clk_debugfs_add_file
(
struct
clk
*
clk
,
char
*
name
,
umode_t
mode
,
struct
dentry
*
clk_debugfs_add_file
(
struct
clk
*
clk
,
char
*
name
,
umode_t
mode
,
...
@@ -415,17 +402,12 @@ static int __init clk_debug_init(void)
...
@@ -415,17 +402,12 @@ static int __init clk_debug_init(void)
if
(
!
d
)
if
(
!
d
)
return
-
ENOMEM
;
return
-
ENOMEM
;
clk_prepare_lock
();
mutex_lock
(
&
clk_debug_lock
);
hlist_for_each_entry
(
clk
,
&
clk_debug_list
,
debug_node
)
hlist_for_each_entry
(
clk
,
&
clk_root_list
,
child_node
)
clk_debug_create_one
(
clk
,
rootdir
);
clk_debug_create_subtree
(
clk
,
rootdir
);
hlist_for_each_entry
(
clk
,
&
clk_orphan_list
,
child_node
)
clk_debug_create_subtree
(
clk
,
rootdir
);
inited
=
1
;
inited
=
1
;
mutex_unlock
(
&
clk_debug_lock
);
clk_prepare_unlock
();
return
0
;
return
0
;
}
}
...
@@ -2087,14 +2069,16 @@ void clk_unregister(struct clk *clk)
...
@@ -2087,14 +2069,16 @@ void clk_unregister(struct clk *clk)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
if
(
!
clk
||
WARN_ON_ONCE
(
IS_ERR
(
clk
)))
if
(
!
clk
||
WARN_ON_ONCE
(
IS_ERR
(
clk
)))
return
;
return
;
clk_debug_unregister
(
clk
);
clk_prepare_lock
();
clk_prepare_lock
();
if
(
clk
->
ops
==
&
clk_nodrv_ops
)
{
if
(
clk
->
ops
==
&
clk_nodrv_ops
)
{
pr_err
(
"%s: unregistered clock: %s
\n
"
,
__func__
,
clk
->
name
);
pr_err
(
"%s: unregistered clock: %s
\n
"
,
__func__
,
clk
->
name
);
goto
out
;
return
;
}
}
/*
/*
* Assign empty clock ops for consumers that might still hold
* Assign empty clock ops for consumers that might still hold
...
@@ -2113,16 +2097,13 @@ void clk_unregister(struct clk *clk)
...
@@ -2113,16 +2097,13 @@ void clk_unregister(struct clk *clk)
clk_set_parent
(
child
,
NULL
);
clk_set_parent
(
child
,
NULL
);
}
}
clk_debug_unregister
(
clk
);
hlist_del_init
(
&
clk
->
child_node
);
hlist_del_init
(
&
clk
->
child_node
);
if
(
clk
->
prepare_count
)
if
(
clk
->
prepare_count
)
pr_warn
(
"%s: unregistering prepared clock: %s
\n
"
,
pr_warn
(
"%s: unregistering prepared clock: %s
\n
"
,
__func__
,
clk
->
name
);
__func__
,
clk
->
name
);
kref_put
(
&
clk
->
ref
,
__clk_release
);
kref_put
(
&
clk
->
ref
,
__clk_release
);
out:
clk_prepare_unlock
();
clk_prepare_unlock
();
}
}
EXPORT_SYMBOL_GPL
(
clk_unregister
);
EXPORT_SYMBOL_GPL
(
clk_unregister
);
...
...
include/linux/clk-private.h
浏览文件 @
0469a43b
...
@@ -48,6 +48,7 @@ struct clk {
...
@@ -48,6 +48,7 @@ struct clk {
unsigned
long
accuracy
;
unsigned
long
accuracy
;
struct
hlist_head
children
;
struct
hlist_head
children
;
struct
hlist_node
child_node
;
struct
hlist_node
child_node
;
struct
hlist_node
debug_node
;
unsigned
int
notifier_count
;
unsigned
int
notifier_count
;
#ifdef CONFIG_DEBUG_FS
#ifdef CONFIG_DEBUG_FS
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录