Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
2f471d90
K
Kernel
项目概览
openeuler
/
Kernel
接近 2 年 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
2f471d90
编写于
8月 04, 2018
作者:
W
Wolfram Sang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'i2c-mux/for-next' of
https://github.com/peda-r/i2c-mux
into i2c/for-4.19
Simplify the probe function of the pca954x driver
上级
d211e62a
6856909c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
13 deletion
+11
-13
drivers/i2c/muxes/i2c-mux-pca954x.c
drivers/i2c/muxes/i2c-mux-pca954x.c
+11
-13
未找到文件。
drivers/i2c/muxes/i2c-mux-pca954x.c
浏览文件 @
2f471d90
...
@@ -349,7 +349,8 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -349,7 +349,8 @@ static int pca954x_probe(struct i2c_client *client,
{
{
struct
i2c_adapter
*
adap
=
to_i2c_adapter
(
client
->
dev
.
parent
);
struct
i2c_adapter
*
adap
=
to_i2c_adapter
(
client
->
dev
.
parent
);
struct
pca954x_platform_data
*
pdata
=
dev_get_platdata
(
&
client
->
dev
);
struct
pca954x_platform_data
*
pdata
=
dev_get_platdata
(
&
client
->
dev
);
struct
device_node
*
of_node
=
client
->
dev
.
of_node
;
struct
device
*
dev
=
&
client
->
dev
;
struct
device_node
*
np
=
dev
->
of_node
;
bool
idle_disconnect_dt
;
bool
idle_disconnect_dt
;
struct
gpio_desc
*
gpio
;
struct
gpio_desc
*
gpio
;
int
num
,
force
,
class
;
int
num
,
force
,
class
;
...
@@ -360,8 +361,7 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -360,8 +361,7 @@ static int pca954x_probe(struct i2c_client *client,
if
(
!
i2c_check_functionality
(
adap
,
I2C_FUNC_SMBUS_BYTE
))
if
(
!
i2c_check_functionality
(
adap
,
I2C_FUNC_SMBUS_BYTE
))
return
-
ENODEV
;
return
-
ENODEV
;
muxc
=
i2c_mux_alloc
(
adap
,
&
client
->
dev
,
muxc
=
i2c_mux_alloc
(
adap
,
dev
,
PCA954X_MAX_NCHANS
,
sizeof
(
*
data
),
0
,
PCA954X_MAX_NCHANS
,
sizeof
(
*
data
),
0
,
pca954x_select_chan
,
pca954x_deselect_mux
);
pca954x_select_chan
,
pca954x_deselect_mux
);
if
(
!
muxc
)
if
(
!
muxc
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -371,7 +371,7 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -371,7 +371,7 @@ static int pca954x_probe(struct i2c_client *client,
data
->
client
=
client
;
data
->
client
=
client
;
/* Reset the mux if a reset GPIO is specified. */
/* Reset the mux if a reset GPIO is specified. */
gpio
=
devm_gpiod_get_optional
(
&
client
->
dev
,
"reset"
,
GPIOD_OUT_HIGH
);
gpio
=
devm_gpiod_get_optional
(
dev
,
"reset"
,
GPIOD_OUT_HIGH
);
if
(
IS_ERR
(
gpio
))
if
(
IS_ERR
(
gpio
))
return
PTR_ERR
(
gpio
);
return
PTR_ERR
(
gpio
);
if
(
gpio
)
{
if
(
gpio
)
{
...
@@ -381,7 +381,7 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -381,7 +381,7 @@ static int pca954x_probe(struct i2c_client *client,
udelay
(
1
);
udelay
(
1
);
}
}
data
->
chip
=
of_device_get_match_data
(
&
client
->
dev
);
data
->
chip
=
of_device_get_match_data
(
dev
);
if
(
!
data
->
chip
)
if
(
!
data
->
chip
)
data
->
chip
=
&
chips
[
id
->
driver_data
];
data
->
chip
=
&
chips
[
id
->
driver_data
];
...
@@ -395,8 +395,7 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -395,8 +395,7 @@ static int pca954x_probe(struct i2c_client *client,
if
(
!
ret
&&
if
(
!
ret
&&
(
id
.
manufacturer_id
!=
data
->
chip
->
id
.
manufacturer_id
||
(
id
.
manufacturer_id
!=
data
->
chip
->
id
.
manufacturer_id
||
id
.
part_id
!=
data
->
chip
->
id
.
part_id
))
{
id
.
part_id
!=
data
->
chip
->
id
.
part_id
))
{
dev_warn
(
&
client
->
dev
,
dev_warn
(
dev
,
"unexpected device id %03x-%03x-%x
\n
"
,
"unexpected device id %03x-%03x-%x
\n
"
,
id
.
manufacturer_id
,
id
.
part_id
,
id
.
manufacturer_id
,
id
.
part_id
,
id
.
die_revision
);
id
.
die_revision
);
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -408,14 +407,14 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -408,14 +407,14 @@ static int pca954x_probe(struct i2c_client *client,
* initializes the mux to disconnected state.
* initializes the mux to disconnected state.
*/
*/
if
(
i2c_smbus_write_byte
(
client
,
0
)
<
0
)
{
if
(
i2c_smbus_write_byte
(
client
,
0
)
<
0
)
{
dev_warn
(
&
client
->
dev
,
"probe failed
\n
"
);
dev_warn
(
dev
,
"probe failed
\n
"
);
return
-
ENODEV
;
return
-
ENODEV
;
}
}
data
->
last_chan
=
0
;
/* force the first selection */
data
->
last_chan
=
0
;
/* force the first selection */
idle_disconnect_dt
=
of_node
&&
idle_disconnect_dt
=
np
&&
of_property_read_bool
(
of_node
,
"i2c-mux-idle-disconnect"
);
of_property_read_bool
(
np
,
"i2c-mux-idle-disconnect"
);
ret
=
pca954x_irq_setup
(
muxc
);
ret
=
pca954x_irq_setup
(
muxc
);
if
(
ret
)
if
(
ret
)
...
@@ -446,7 +445,7 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -446,7 +445,7 @@ static int pca954x_probe(struct i2c_client *client,
}
}
if
(
data
->
irq
)
{
if
(
data
->
irq
)
{
ret
=
devm_request_threaded_irq
(
&
client
->
dev
,
data
->
client
->
irq
,
ret
=
devm_request_threaded_irq
(
dev
,
data
->
client
->
irq
,
NULL
,
pca954x_irq_handler
,
NULL
,
pca954x_irq_handler
,
IRQF_ONESHOT
|
IRQF_SHARED
,
IRQF_ONESHOT
|
IRQF_SHARED
,
"pca954x"
,
data
);
"pca954x"
,
data
);
...
@@ -454,8 +453,7 @@ static int pca954x_probe(struct i2c_client *client,
...
@@ -454,8 +453,7 @@ static int pca954x_probe(struct i2c_client *client,
goto
fail_cleanup
;
goto
fail_cleanup
;
}
}
dev_info
(
&
client
->
dev
,
dev_info
(
dev
,
"registered %d multiplexed busses for I2C %s %s
\n
"
,
"registered %d multiplexed busses for I2C %s %s
\n
"
,
num
,
data
->
chip
->
muxtype
==
pca954x_ismux
num
,
data
->
chip
->
muxtype
==
pca954x_ismux
?
"mux"
:
"switch"
,
client
->
name
);
?
"mux"
:
"switch"
,
client
->
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录