Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
532a37cf
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
532a37cf
编写于
12月 16, 2005
作者:
K
Kyungmin Park
提交者:
Linus Torvalds
12月 18, 2005
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PATCH] mtd onenand driver: reduce stack usage
Signed-off-by:
N
Linus Torvalds
<
torvalds@osdl.org
>
上级
20ba89a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
7 deletion
+28
-7
drivers/mtd/onenand/onenand_base.c
drivers/mtd/onenand/onenand_base.c
+24
-3
drivers/mtd/onenand/onenand_bbt.c
drivers/mtd/onenand/onenand_bbt.c
+2
-2
include/linux/mtd/onenand.h
include/linux/mtd/onenand.h
+2
-2
未找到文件。
drivers/mtd/onenand/onenand_base.c
浏览文件 @
532a37cf
...
...
@@ -940,7 +940,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
u_char
*
eccbuf
,
struct
nand_oobinfo
*
oobsel
)
{
struct
onenand_chip
*
this
=
mtd
->
priv
;
unsigned
char
buffer
[
MAX_ONENAND_PAGESIZE
],
*
pbuf
;
unsigned
char
*
pbuf
;
size_t
total_len
,
len
;
int
i
,
written
=
0
;
int
ret
=
0
;
...
...
@@ -975,7 +975,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
/* Loop until all keve's data has been written */
len
=
0
;
while
(
count
)
{
pbuf
=
buffer
;
pbuf
=
this
->
page_buf
;
/*
* If the given tuple is >= pagesize then
* write it out from the iov
...
...
@@ -995,7 +995,7 @@ static int onenand_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs,
int
cnt
=
0
,
thislen
;
while
(
cnt
<
mtd
->
oobblock
)
{
thislen
=
min_t
(
int
,
mtd
->
oobblock
-
cnt
,
vecs
->
iov_len
-
len
);
memcpy
(
buffer
+
cnt
,
vecs
->
iov_base
+
len
,
thislen
);
memcpy
(
this
->
page_buf
+
cnt
,
vecs
->
iov_base
+
len
,
thislen
);
cnt
+=
thislen
;
len
+=
thislen
;
...
...
@@ -1519,6 +1519,18 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
this
->
read_bufferram
=
onenand_sync_read_bufferram
;
}
/* Allocate buffers, if necessary */
if
(
!
this
->
page_buf
)
{
size_t
len
;
len
=
mtd
->
oobblock
+
mtd
->
oobsize
;
this
->
page_buf
=
kmalloc
(
len
,
GFP_KERNEL
);
if
(
!
this
->
page_buf
)
{
printk
(
KERN_ERR
"onenand_scan(): Can't allocate page_buf
\n
"
);
return
-
ENOMEM
;
}
this
->
options
|=
ONENAND_PAGEBUF_ALLOC
;
}
this
->
state
=
FL_READY
;
init_waitqueue_head
(
&
this
->
wq
);
spin_lock_init
(
&
this
->
chip_lock
);
...
...
@@ -1580,12 +1592,21 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
*/
void
onenand_release
(
struct
mtd_info
*
mtd
)
{
struct
onenand_chip
*
this
=
mtd
->
priv
;
#ifdef CONFIG_MTD_PARTITIONS
/* Deregister partitions */
del_mtd_partitions
(
mtd
);
#endif
/* Deregister the device */
del_mtd_device
(
mtd
);
/* Free bad block table memory, if allocated */
if
(
this
->
bbm
)
kfree
(
this
->
bbm
);
/* Buffer allocated by onenand_scan */
if
(
this
->
options
&
ONENAND_PAGEBUF_ALLOC
)
kfree
(
this
->
page_buf
);
}
EXPORT_SYMBOL_GPL
(
onenand_scan
);
...
...
drivers/mtd/onenand/onenand_bbt.c
浏览文件 @
532a37cf
...
...
@@ -118,10 +118,10 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
*/
static
inline
int
onenand_memory_bbt
(
struct
mtd_info
*
mtd
,
struct
nand_bbt_descr
*
bd
)
{
unsigned
char
data_buf
[
MAX_ONENAND_PAGESIZE
]
;
struct
onenand_chip
*
this
=
mtd
->
priv
;
bd
->
options
&=
~
NAND_BBT_SCANEMPTY
;
return
create_bbt
(
mtd
,
data
_buf
,
bd
,
-
1
);
return
create_bbt
(
mtd
,
this
->
page
_buf
,
bd
,
-
1
);
}
/**
...
...
include/linux/mtd/onenand.h
浏览文件 @
532a37cf
...
...
@@ -17,7 +17,6 @@
#include <linux/mtd/bbm.h>
#define MAX_BUFFERRAM 2
#define MAX_ONENAND_PAGESIZE (2048 + 64)
/* Scan and identify a OneNAND device */
extern
int
onenand_scan
(
struct
mtd_info
*
mtd
,
int
max_chips
);
...
...
@@ -110,6 +109,7 @@ struct onenand_chip {
spinlock_t
chip_lock
;
wait_queue_head_t
wq
;
onenand_state_t
state
;
unsigned
char
*
page_buf
;
struct
nand_oobinfo
*
autooob
;
...
...
@@ -134,7 +134,7 @@ struct onenand_chip {
* Options bits
*/
#define ONENAND_CONT_LOCK (0x0001)
#define ONENAND_PAGEBUF_ALLOC (0x1000)
/*
* OneNAND Flash Manufacturer ID Codes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录