Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
7e2c225d
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
170
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7e2c225d
编写于
1月 23, 2014
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'spi/fix/core' into spi-linus
上级
7e22e911
13a42798
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
13 deletion
+27
-13
drivers/spi/spi.c
drivers/spi/spi.c
+20
-8
include/linux/spi/spi.h
include/linux/spi/spi.h
+7
-5
未找到文件。
drivers/spi/spi.c
浏览文件 @
7e2c225d
...
...
@@ -370,6 +370,17 @@ static void spi_dev_set_name(struct spi_device *spi)
spi
->
chip_select
);
}
static
int
spi_dev_check
(
struct
device
*
dev
,
void
*
data
)
{
struct
spi_device
*
spi
=
to_spi_device
(
dev
);
struct
spi_device
*
new_spi
=
data
;
if
(
spi
->
master
==
new_spi
->
master
&&
spi
->
chip_select
==
new_spi
->
chip_select
)
return
-
EBUSY
;
return
0
;
}
/**
* spi_add_device - Add spi_device allocated with spi_alloc_device
* @spi: spi_device to register
...
...
@@ -384,7 +395,6 @@ int spi_add_device(struct spi_device *spi)
static
DEFINE_MUTEX
(
spi_add_lock
);
struct
spi_master
*
master
=
spi
->
master
;
struct
device
*
dev
=
master
->
dev
.
parent
;
struct
device
*
d
;
int
status
;
/* Chipselects are numbered 0..max; validate. */
...
...
@@ -404,12 +414,10 @@ int spi_add_device(struct spi_device *spi)
*/
mutex_lock
(
&
spi_add_lock
);
d
=
bus_find_device_by_name
(
&
spi_bus_type
,
NULL
,
dev_name
(
&
spi
->
dev
)
);
if
(
d
!=
NULL
)
{
status
=
bus_for_each_dev
(
&
spi_bus_type
,
NULL
,
spi
,
spi_dev_check
);
if
(
status
)
{
dev_err
(
dev
,
"chipselect %d already in use
\n
"
,
spi
->
chip_select
);
put_device
(
d
);
status
=
-
EBUSY
;
goto
done
;
}
...
...
@@ -591,8 +599,10 @@ static int spi_transfer_one_message(struct spi_master *master,
goto
out
;
}
if
(
ret
>
0
)
if
(
ret
>
0
)
{
ret
=
0
;
wait_for_completion
(
&
master
->
xfer_completion
);
}
trace_spi_transfer_stop
(
msg
,
xfer
);
...
...
@@ -632,7 +642,7 @@ static int spi_transfer_one_message(struct spi_master *master,
*
* Called by SPI drivers using the core transfer_one_message()
* implementation to notify it that the current interrupt driven
* transfer has finised and the next one may be scheduled.
* transfer has finis
h
ed and the next one may be scheduled.
*/
void
spi_finalize_current_transfer
(
struct
spi_master
*
master
)
{
...
...
@@ -735,7 +745,9 @@ static void spi_pump_messages(struct kthread_work *work)
ret
=
master
->
transfer_one_message
(
master
,
master
->
cur_msg
);
if
(
ret
)
{
dev_err
(
&
master
->
dev
,
"failed to transfer one message from queue
\n
"
);
"failed to transfer one message from queue: %d
\n
"
,
ret
);
master
->
cur_msg
->
status
=
ret
;
spi_finalize_current_message
(
master
);
return
;
}
}
...
...
include/linux/spi/spi.h
浏览文件 @
7e2c225d
...
...
@@ -277,15 +277,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
* @unprepare_transfer_hardware: there are currently no more messages on the
* queue so the subsystem notifies the driver that it may relax the
* hardware by issuing this call
* @set_cs:
assert or deassert chip select, true to assert
. May be called
* @set_cs:
set the logic level of the chip select line
. May be called
* from interrupt context.
* @prepare_message: set up the controller to transfer a single message,
* for example doing DMA mapping. Called from threaded
* context.
* @transfer_one: transfer a single spi_transfer. When the
* driver is finished with this transfer it must call
* spi_finalize_current_transfer() so the subsystem can issue
* the next transfer
* @transfer_one: transfer a single spi_transfer.
* - return 0 if the transfer is finished,
* - return 1 if the transfer is still in progress. When
* the driver is finished with this transfer it must
* call spi_finalize_current_transfer() so the subsystem
* can issue the next transfer
* @unprepare_message: undo any work done by prepare_message().
* @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
* number. Any individual value may be -ENOENT for CS lines that
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录