Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
438c9da5
K
Kernel
项目概览
openeuler
/
Kernel
大约 1 年 前同步成功
通知
6
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
438c9da5
编写于
11月 02, 2005
作者:
D
Dmitry Torokhov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Input: locomokbd - convert to dynamic input allocation
Signed-off-by:
N
Dmitry Torokhov
<
dtor@mail.ru
>
上级
7afada45
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
32 deletion
+31
-32
drivers/input/keyboard/locomokbd.c
drivers/input/keyboard/locomokbd.c
+31
-32
未找到文件。
drivers/input/keyboard/locomokbd.c
浏览文件 @
438c9da5
...
...
@@ -76,7 +76,7 @@ static unsigned char locomokbd_keycode[LOCOMOKBD_NUMKEYS] = {
struct
locomokbd
{
unsigned
char
keycode
[
LOCOMOKBD_NUMKEYS
];
struct
input_dev
input
;
struct
input_dev
*
input
;
char
phys
[
32
];
struct
locomo_dev
*
ldev
;
...
...
@@ -136,8 +136,7 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd, struct pt_regs *
spin_lock_irqsave
(
&
locomokbd
->
lock
,
flags
);
if
(
regs
)
input_regs
(
&
locomokbd
->
input
,
regs
);
input_regs
(
locomokbd
->
input
,
regs
);
locomokbd_charge_all
(
membase
);
...
...
@@ -152,16 +151,16 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd, struct pt_regs *
scancode
=
SCANCODE
(
col
,
row
);
if
(
rowd
&
KB_ROWMASK
(
row
))
{
num_pressed
+=
1
;
input_report_key
(
&
locomokbd
->
input
,
locomokbd
->
keycode
[
scancode
],
1
);
input_report_key
(
locomokbd
->
input
,
locomokbd
->
keycode
[
scancode
],
1
);
}
else
{
input_report_key
(
&
locomokbd
->
input
,
locomokbd
->
keycode
[
scancode
],
0
);
input_report_key
(
locomokbd
->
input
,
locomokbd
->
keycode
[
scancode
],
0
);
}
}
locomokbd_reset_col
(
membase
,
col
);
}
locomokbd_activate_all
(
membase
);
input_sync
(
&
locomokbd
->
input
);
input_sync
(
locomokbd
->
input
);
/* if any keys are pressed, enable the timer */
if
(
num_pressed
)
...
...
@@ -196,13 +195,15 @@ static void locomokbd_timer_callback(unsigned long data)
static
int
locomokbd_probe
(
struct
locomo_dev
*
dev
)
{
struct
locomokbd
*
locomokbd
;
struct
input_dev
*
input_dev
;
int
i
,
ret
;
locomokbd
=
kmalloc
(
sizeof
(
struct
locomokbd
),
GFP_KERNEL
);
if
(
!
locomokbd
)
return
-
ENOMEM
;
memset
(
locomokbd
,
0
,
sizeof
(
struct
locomokbd
));
locomokbd
=
kzalloc
(
sizeof
(
struct
locomokbd
),
GFP_KERNEL
);
input_dev
=
input_allocate_device
();
if
(
!
locomokbd
||
!
input_dev
)
{
ret
=
-
ENOMEM
;
goto
free
;
}
/* try and claim memory region */
if
(
!
request_mem_region
((
unsigned
long
)
dev
->
mapbase
,
...
...
@@ -224,27 +225,26 @@ static int locomokbd_probe(struct locomo_dev *dev)
locomokbd
->
timer
.
function
=
locomokbd_timer_callback
;
locomokbd
->
timer
.
data
=
(
unsigned
long
)
locomokbd
;
locomokbd
->
input
.
evbit
[
0
]
=
BIT
(
EV_KEY
)
|
BIT
(
EV_REP
);
locomokbd
->
input
=
input_dev
;
strcpy
(
locomokbd
->
phys
,
"locomokbd/input0"
);
input_dev
->
name
=
"LoCoMo keyboard"
;
input_dev
->
phys
=
locomokbd
->
phys
;
input_dev
->
id
.
bustype
=
BUS_XTKBD
;
input_dev
->
id
.
vendor
=
0x0001
;
input_dev
->
id
.
product
=
0x0001
;
input_dev
->
id
.
version
=
0x0100
;
input_dev
->
private
=
locomokbd
;
init_input_dev
(
&
locomokbd
->
input
);
locomokbd
->
input
.
keycode
=
locomokbd
->
keycode
;
locomokbd
->
input
.
keycodesize
=
sizeof
(
unsigned
char
);
locomokbd
->
input
.
keycodemax
=
ARRAY_SIZE
(
locomokbd_keycode
);
locomokbd
->
input
.
private
=
locomokbd
;
input_dev
->
evbit
[
0
]
=
BIT
(
EV_KEY
)
|
BIT
(
EV_REP
);
input_dev
->
keycode
=
locomokbd
->
keycode
;
input_dev
->
keycodesize
=
sizeof
(
unsigned
char
);
input_dev
->
keycodemax
=
ARRAY_SIZE
(
locomokbd_keycode
);
memcpy
(
locomokbd
->
keycode
,
locomokbd_keycode
,
sizeof
(
locomokbd
->
keycode
));
for
(
i
=
0
;
i
<
LOCOMOKBD_NUMKEYS
;
i
++
)
set_bit
(
locomokbd
->
keycode
[
i
],
locomokbd
->
input
.
keybit
);
clear_bit
(
0
,
locomokbd
->
input
.
keybit
);
strcpy
(
locomokbd
->
phys
,
"locomokbd/input0"
);
locomokbd
->
input
.
name
=
"LoCoMo keyboard"
;
locomokbd
->
input
.
phys
=
locomokbd
->
phys
;
locomokbd
->
input
.
id
.
bustype
=
BUS_XTKBD
;
locomokbd
->
input
.
id
.
vendor
=
0x0001
;
locomokbd
->
input
.
id
.
product
=
0x0001
;
locomokbd
->
input
.
id
.
version
=
0x0100
;
set_bit
(
locomokbd
->
keycode
[
i
],
input_dev
->
keybit
);
clear_bit
(
0
,
input_dev
->
keybit
);
/* attempt to get the interrupt */
ret
=
request_irq
(
dev
->
irq
[
0
],
locomokbd_interrupt
,
0
,
"locomokbd"
,
locomokbd
);
...
...
@@ -253,9 +253,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
goto
out
;
}
input_register_device
(
&
locomokbd
->
input
);
printk
(
KERN_INFO
"input: LoCoMo keyboard on locomokbd
\n
"
);
input_register_device
(
locomokbd
->
input
);
return
0
;
...
...
@@ -263,6 +261,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
release_mem_region
((
unsigned
long
)
dev
->
mapbase
,
dev
->
length
);
locomo_set_drvdata
(
dev
,
NULL
);
free:
input_free_device
(
input_dev
);
kfree
(
locomokbd
);
return
ret
;
...
...
@@ -276,7 +275,7 @@ static int locomokbd_remove(struct locomo_dev *dev)
del_timer_sync
(
&
locomokbd
->
timer
);
input_unregister_device
(
&
locomokbd
->
input
);
input_unregister_device
(
locomokbd
->
input
);
locomo_set_drvdata
(
dev
,
NULL
);
release_mem_region
((
unsigned
long
)
dev
->
mapbase
,
dev
->
length
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录