Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
390cd85c
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看板
提交
390cd85c
编写于
3月 21, 2009
作者:
J
Jaswinder Singh Rajput
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
x86: kdebugfs.c cleanup
Impact: cleanup Signed-off-by:
N
Jaswinder Singh Rajput
<
jaswinderrajput@gmail.com
>
上级
271eb5c5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
46 deletion
+36
-46
arch/x86/kernel/kdebugfs.c
arch/x86/kernel/kdebugfs.c
+36
-46
未找到文件。
arch/x86/kernel/kdebugfs.c
浏览文件 @
390cd85c
...
...
@@ -8,11 +8,11 @@
*/
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <linux/
stat
.h>
#include <linux/
module
.h>
#include <linux/init.h>
#include <linux/stat.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <asm/setup.h>
...
...
@@ -26,9 +26,8 @@ struct setup_data_node {
u32
len
;
};
static
ssize_t
setup_data_read
(
struct
file
*
file
,
char
__user
*
user_buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
setup_data_read
(
struct
file
*
file
,
char
__user
*
user_buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
setup_data_node
*
node
=
file
->
private_data
;
unsigned
long
remain
;
...
...
@@ -39,20 +38,21 @@ setup_data_read(struct file *file, char __user *user_buf, size_t count,
if
(
pos
<
0
)
return
-
EINVAL
;
if
(
pos
>=
node
->
len
)
return
0
;
if
(
count
>
node
->
len
-
pos
)
count
=
node
->
len
-
pos
;
pa
=
node
->
paddr
+
sizeof
(
struct
setup_data
)
+
pos
;
pg
=
pfn_to_page
((
pa
+
count
-
1
)
>>
PAGE_SHIFT
);
if
(
PageHighMem
(
pg
))
{
p
=
ioremap_cache
(
pa
,
count
);
if
(
!
p
)
return
-
ENXIO
;
}
else
{
}
else
p
=
__va
(
pa
);
}
remain
=
copy_to_user
(
user_buf
,
p
,
count
);
...
...
@@ -70,12 +70,13 @@ setup_data_read(struct file *file, char __user *user_buf, size_t count,
static
int
setup_data_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
file
->
private_data
=
inode
->
i_private
;
return
0
;
}
static
const
struct
file_operations
fops_setup_data
=
{
.
read
=
setup_data_read
,
.
open
=
setup_data_open
,
.
read
=
setup_data_read
,
.
open
=
setup_data_open
,
};
static
int
__init
...
...
@@ -84,57 +85,50 @@ create_setup_data_node(struct dentry *parent, int no,
{
struct
dentry
*
d
,
*
type
,
*
data
;
char
buf
[
16
];
int
error
;
sprintf
(
buf
,
"%d"
,
no
);
d
=
debugfs_create_dir
(
buf
,
parent
);
if
(
!
d
)
{
error
=
-
ENOMEM
;
goto
err_return
;
}
if
(
!
d
)
return
-
ENOMEM
;
type
=
debugfs_create_x32
(
"type"
,
S_IRUGO
,
d
,
&
node
->
type
);
if
(
!
type
)
{
error
=
-
ENOMEM
;
if
(
!
type
)
goto
err_dir
;
}
data
=
debugfs_create_file
(
"data"
,
S_IRUGO
,
d
,
node
,
&
fops_setup_data
);
if
(
!
data
)
{
error
=
-
ENOMEM
;
if
(
!
data
)
goto
err_type
;
}
return
0
;
err_type:
debugfs_remove
(
type
);
err_dir:
debugfs_remove
(
d
);
err_return:
return
error
;
return
-
ENOMEM
;
}
static
int
__init
create_setup_data_nodes
(
struct
dentry
*
parent
)
{
struct
setup_data_node
*
node
;
struct
setup_data
*
data
;
int
error
,
no
=
0
;
int
error
=
-
ENOMEM
;
struct
dentry
*
d
;
struct
page
*
pg
;
u64
pa_data
;
int
no
=
0
;
d
=
debugfs_create_dir
(
"setup_data"
,
parent
);
if
(
!
d
)
{
error
=
-
ENOMEM
;
goto
err_return
;
}
if
(
!
d
)
return
-
ENOMEM
;
pa_data
=
boot_params
.
hdr
.
setup_data
;
while
(
pa_data
)
{
node
=
kmalloc
(
sizeof
(
*
node
),
GFP_KERNEL
);
if
(
!
node
)
{
error
=
-
ENOMEM
;
if
(
!
node
)
goto
err_dir
;
}
pg
=
pfn_to_page
((
pa_data
+
sizeof
(
*
data
)
-
1
)
>>
PAGE_SHIFT
);
if
(
PageHighMem
(
pg
))
{
data
=
ioremap_cache
(
pa_data
,
sizeof
(
*
data
));
...
...
@@ -143,9 +137,8 @@ static int __init create_setup_data_nodes(struct dentry *parent)
error
=
-
ENXIO
;
goto
err_dir
;
}
}
else
{
}
else
data
=
__va
(
pa_data
);
}
node
->
paddr
=
pa_data
;
node
->
type
=
data
->
type
;
...
...
@@ -159,11 +152,11 @@ static int __init create_setup_data_nodes(struct dentry *parent)
goto
err_dir
;
no
++
;
}
return
0
;
err_dir:
debugfs_remove
(
d
);
err_return:
return
error
;
}
...
...
@@ -175,28 +168,26 @@ static struct debugfs_blob_wrapper boot_params_blob = {
static
int
__init
boot_params_kdebugfs_init
(
void
)
{
struct
dentry
*
dbp
,
*
version
,
*
data
;
int
error
;
int
error
=
-
ENOMEM
;
dbp
=
debugfs_create_dir
(
"boot_params"
,
NULL
);
if
(
!
dbp
)
{
error
=
-
ENOMEM
;
goto
err_return
;
}
if
(
!
dbp
)
return
-
ENOMEM
;
version
=
debugfs_create_x16
(
"version"
,
S_IRUGO
,
dbp
,
&
boot_params
.
hdr
.
version
);
if
(
!
version
)
{
error
=
-
ENOMEM
;
if
(
!
version
)
goto
err_dir
;
}
data
=
debugfs_create_blob
(
"data"
,
S_IRUGO
,
dbp
,
&
boot_params_blob
);
if
(
!
data
)
{
error
=
-
ENOMEM
;
if
(
!
data
)
goto
err_version
;
}
error
=
create_setup_data_nodes
(
dbp
);
if
(
error
)
goto
err_data
;
return
0
;
err_data:
...
...
@@ -205,10 +196,9 @@ static int __init boot_params_kdebugfs_init(void)
debugfs_remove
(
version
);
err_dir:
debugfs_remove
(
dbp
);
err_return:
return
error
;
}
#endif
#endif
/* CONFIG_DEBUG_BOOT_PARAMS */
static
int
__init
arch_kdebugfs_init
(
void
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录