Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
ab368854
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ab368854
编写于
5月 13, 2016
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'regulator/topic/supply' into regulator-next
上级
170b649e
45389c47
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
26 deletion
+41
-26
drivers/regulator/core.c
drivers/regulator/core.c
+41
-26
未找到文件。
drivers/regulator/core.c
浏览文件 @
ab368854
...
...
@@ -1541,6 +1541,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
ret
=
regulator_enable
(
rdev
->
supply
);
if
(
ret
<
0
)
{
_regulator_put
(
rdev
->
supply
);
rdev
->
supply
=
NULL
;
return
ret
;
}
}
...
...
@@ -3122,8 +3123,11 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
return
ret
;
if
(
bypassed
)
{
/* if bypassed the regulator must have a supply */
if
(
!
rdev
->
supply
)
return
-
EINVAL
;
if
(
!
rdev
->
supply
)
{
rdev_err
(
rdev
,
"bypassed regulator has no supply!
\n
"
);
return
-
EPROBE_DEFER
;
}
return
_regulator_get_voltage
(
rdev
->
supply
->
rdev
);
}
...
...
@@ -3861,7 +3865,12 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
static
int
regulator_register_resolve_supply
(
struct
device
*
dev
,
void
*
data
)
{
return
regulator_resolve_supply
(
dev_to_rdev
(
dev
));
struct
regulator_dev
*
rdev
=
dev_to_rdev
(
dev
);
if
(
regulator_resolve_supply
(
rdev
))
rdev_dbg
(
rdev
,
"unable to resolve supply
\n
"
);
return
0
;
}
/**
...
...
@@ -3935,8 +3944,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev
->
dev
.
of_node
=
of_node_get
(
config
->
of_node
);
}
mutex_lock
(
&
regulator_list_mutex
);
mutex_init
(
&
rdev
->
mutex
);
rdev
->
reg_data
=
config
->
driver_data
;
rdev
->
owner
=
regulator_desc
->
owner
;
...
...
@@ -3961,7 +3968,9 @@ regulator_register(const struct regulator_desc *regulator_desc,
if
((
config
->
ena_gpio
||
config
->
ena_gpio_initialized
)
&&
gpio_is_valid
(
config
->
ena_gpio
))
{
mutex_lock
(
&
regulator_list_mutex
);
ret
=
regulator_ena_gpio_request
(
rdev
,
config
);
mutex_unlock
(
&
regulator_list_mutex
);
if
(
ret
!=
0
)
{
rdev_err
(
rdev
,
"Failed to request enable GPIO%d: %d
\n
"
,
config
->
ena_gpio
,
ret
);
...
...
@@ -3974,43 +3983,53 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev
->
dev
.
parent
=
dev
;
dev_set_name
(
&
rdev
->
dev
,
"regulator.%lu"
,
(
unsigned
long
)
atomic_inc_return
(
&
regulator_no
));
ret
=
device_register
(
&
rdev
->
dev
);
if
(
ret
!=
0
)
{
put_device
(
&
rdev
->
dev
);
goto
wash
;
}
dev_set_drvdata
(
&
rdev
->
dev
,
rdev
);
/* set regulator constraints */
if
(
init_data
)
constraints
=
&
init_data
->
constraints
;
ret
=
set_machine_constraints
(
rdev
,
constraints
);
if
(
ret
<
0
)
goto
scrub
;
if
(
init_data
&&
init_data
->
supply_regulator
)
rdev
->
supply_name
=
init_data
->
supply_regulator
;
else
if
(
regulator_desc
->
supply_name
)
rdev
->
supply_name
=
regulator_desc
->
supply_name
;
/*
* Attempt to resolve the regulator supply, if specified,
* but don't return an error if we fail because we will try
* to resolve it again later as more regulators are added.
*/
if
(
regulator_resolve_supply
(
rdev
))
rdev_dbg
(
rdev
,
"unable to resolve supply
\n
"
);
ret
=
set_machine_constraints
(
rdev
,
constraints
);
if
(
ret
<
0
)
goto
wash
;
/* add consumers devices */
if
(
init_data
)
{
mutex_lock
(
&
regulator_list_mutex
);
for
(
i
=
0
;
i
<
init_data
->
num_consumer_supplies
;
i
++
)
{
ret
=
set_consumer_device_supply
(
rdev
,
init_data
->
consumer_supplies
[
i
].
dev_name
,
init_data
->
consumer_supplies
[
i
].
supply
);
if
(
ret
<
0
)
{
mutex_unlock
(
&
regulator_list_mutex
);
dev_err
(
dev
,
"Failed to set supply %s
\n
"
,
init_data
->
consumer_supplies
[
i
].
supply
);
goto
unset_supplies
;
}
}
mutex_unlock
(
&
regulator_list_mutex
);
}
ret
=
device_register
(
&
rdev
->
dev
);
if
(
ret
!=
0
)
{
put_device
(
&
rdev
->
dev
);
goto
unset_supplies
;
}
dev_set_drvdata
(
&
rdev
->
dev
,
rdev
);
rdev_init_debugfs
(
rdev
);
mutex_unlock
(
&
regulator_list_mutex
);
/* try to resolve regulators supply since a new one was registered */
class_for_each_device
(
&
regulator_class
,
NULL
,
NULL
,
...
...
@@ -4019,20 +4038,16 @@ regulator_register(const struct regulator_desc *regulator_desc,
return
rdev
;
unset_supplies:
mutex_lock
(
&
regulator_list_mutex
);
unset_regulator_supplies
(
rdev
);
scrub:
regulator_ena_gpio_free
(
rdev
);
device_unregister
(
&
rdev
->
dev
);
/* device core frees rdev */
goto
out
;
mutex_unlock
(
&
regulator_list_mutex
);
wash:
kfree
(
rdev
->
constraints
);
mutex_lock
(
&
regulator_list_mutex
);
regulator_ena_gpio_free
(
rdev
);
mutex_unlock
(
&
regulator_list_mutex
);
clean:
kfree
(
rdev
);
out:
mutex_unlock
(
&
regulator_list_mutex
);
kfree
(
config
);
return
ERR_PTR
(
ret
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录