Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
72155615
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
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看板
提交
72155615
编写于
11月 05, 2006
作者:
D
Dmitry Torokhov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Input: mice - handle errors when registering input devices
Signed-off-by:
N
Dmitry Torokhov
<
dtor@mail.ru
>
上级
127278ce
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
154 addition
and
60 deletion
+154
-60
drivers/input/mouse/amimouse.c
drivers/input/mouse/amimouse.c
+9
-2
drivers/input/mouse/inport.c
drivers/input/mouse/inport.c
+17
-6
drivers/input/mouse/logibm.c
drivers/input/mouse/logibm.c
+18
-6
drivers/input/mouse/pc110pad.c
drivers/input/mouse/pc110pad.c
+19
-7
drivers/input/mouse/psmouse-base.c
drivers/input/mouse/psmouse-base.c
+59
-25
drivers/input/mouse/rpcmouse.c
drivers/input/mouse/rpcmouse.c
+16
-4
drivers/input/mouse/sermouse.c
drivers/input/mouse/sermouse.c
+8
-5
drivers/input/mouse/vsxxxaa.c
drivers/input/mouse/vsxxxaa.c
+8
-5
未找到文件。
drivers/input/mouse/amimouse.c
浏览文件 @
72155615
...
...
@@ -95,10 +95,13 @@ static void amimouse_close(struct input_dev *dev)
static
int
__init
amimouse_init
(
void
)
{
int
err
;
if
(
!
MACH_IS_AMIGA
||
!
AMIGAHW_PRESENT
(
AMI_MOUSE
))
return
-
ENODEV
;
if
(
!
(
amimouse_dev
=
input_allocate_device
()))
amimouse_dev
=
input_allocate_device
();
if
(
!
amimouse_dev
)
return
-
ENOMEM
;
amimouse_dev
->
name
=
"Amiga mouse"
;
...
...
@@ -114,7 +117,11 @@ static int __init amimouse_init(void)
amimouse_dev
->
open
=
amimouse_open
;
amimouse_dev
->
close
=
amimouse_close
;
input_register_device
(
amimouse_dev
);
err
=
input_register_device
(
amimouse_dev
);
if
(
err
)
{
input_free_device
(
amimouse_dev
);
return
err
;
}
return
0
;
}
...
...
drivers/input/mouse/inport.c
浏览文件 @
72155615
...
...
@@ -135,6 +135,7 @@ static void inport_close(struct input_dev *dev)
static
int
__init
inport_init
(
void
)
{
unsigned
char
a
,
b
,
c
;
int
err
;
if
(
!
request_region
(
INPORT_BASE
,
INPORT_EXTENT
,
"inport"
))
{
printk
(
KERN_ERR
"inport.c: Can't allocate ports at %#x
\n
"
,
INPORT_BASE
);
...
...
@@ -145,15 +146,16 @@ static int __init inport_init(void)
b
=
inb
(
INPORT_SIGNATURE_PORT
);
c
=
inb
(
INPORT_SIGNATURE_PORT
);
if
(
a
==
b
||
a
!=
c
)
{
release_region
(
INPORT_BASE
,
INPORT_EXTENT
);
printk
(
KERN_ERR
"inport.c: Didn't find InPort mouse at %#x
\n
"
,
INPORT_BASE
);
return
-
ENODEV
;
err
=
-
ENODEV
;
goto
err_release_region
;
}
if
(
!
(
inport_dev
=
input_allocate_device
()))
{
inport_dev
=
input_allocate_device
();
if
(
!
inport_dev
)
{
printk
(
KERN_ERR
"inport.c: Not enough memory for input device
\n
"
);
release_region
(
INPORT_BASE
,
INPORT_EXTENT
)
;
return
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_release_region
;
}
inport_dev
->
name
=
INPORT_NAME
;
...
...
@@ -174,9 +176,18 @@ static int __init inport_init(void)
outb
(
INPORT_REG_MODE
,
INPORT_CONTROL_PORT
);
outb
(
INPORT_MODE_BASE
,
INPORT_DATA_PORT
);
input_register_device
(
inport_dev
);
err
=
input_register_device
(
inport_dev
);
if
(
err
)
goto
err_free_dev
;
return
0
;
err_free_dev:
input_free_device
(
inport_dev
);
err_release_region:
release_region
(
INPORT_BASE
,
INPORT_EXTENT
);
return
err
;
}
static
void
__exit
inport_exit
(
void
)
...
...
drivers/input/mouse/logibm.c
浏览文件 @
72155615
...
...
@@ -124,6 +124,8 @@ static void logibm_close(struct input_dev *dev)
static
int
__init
logibm_init
(
void
)
{
int
err
;
if
(
!
request_region
(
LOGIBM_BASE
,
LOGIBM_EXTENT
,
"logibm"
))
{
printk
(
KERN_ERR
"logibm.c: Can't allocate ports at %#x
\n
"
,
LOGIBM_BASE
);
return
-
EBUSY
;
...
...
@@ -134,18 +136,19 @@ static int __init logibm_init(void)
udelay
(
100
);
if
(
inb
(
LOGIBM_SIGNATURE_PORT
)
!=
LOGIBM_SIGNATURE_BYTE
)
{
release_region
(
LOGIBM_BASE
,
LOGIBM_EXTENT
);
printk
(
KERN_ERR
"logibm.c: Didn't find Logitech busmouse at %#x
\n
"
,
LOGIBM_BASE
);
return
-
ENODEV
;
err
=
-
ENODEV
;
goto
err_release_region
;
}
outb
(
LOGIBM_DEFAULT_MODE
,
LOGIBM_CONFIG_PORT
);
outb
(
LOGIBM_DISABLE_IRQ
,
LOGIBM_CONTROL_PORT
);
if
(
!
(
logibm_dev
=
input_allocate_device
()))
{
logibm_dev
=
input_allocate_device
();
if
(
!
logibm_dev
)
{
printk
(
KERN_ERR
"logibm.c: Not enough memory for input device
\n
"
);
release_region
(
LOGIBM_BASE
,
LOGIBM_EXTENT
)
;
return
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_release_region
;
}
logibm_dev
->
name
=
"Logitech bus mouse"
;
...
...
@@ -162,9 +165,18 @@ static int __init logibm_init(void)
logibm_dev
->
open
=
logibm_open
;
logibm_dev
->
close
=
logibm_close
;
input_register_device
(
logibm_dev
);
err
=
input_register_device
(
logibm_dev
);
if
(
err
)
goto
err_free_dev
;
return
0
;
err_free_dev:
input_free_device
(
logibm_dev
);
err_release_region:
release_region
(
LOGIBM_BASE
,
LOGIBM_EXTENT
);
return
err
;
}
static
void
__exit
logibm_exit
(
void
)
...
...
drivers/input/mouse/pc110pad.c
浏览文件 @
72155615
...
...
@@ -108,6 +108,7 @@ static int pc110pad_open(struct input_dev *dev)
static
int
__init
pc110pad_init
(
void
)
{
struct
pci_dev
*
dev
;
int
err
;
dev
=
pci_get_device
(
PCI_ANY_ID
,
PCI_ANY_ID
,
NULL
);
if
(
dev
)
{
...
...
@@ -124,16 +125,16 @@ static int __init pc110pad_init(void)
outb
(
PC110PAD_OFF
,
pc110pad_io
+
2
);
if
(
request_irq
(
pc110pad_irq
,
pc110pad_interrupt
,
0
,
"pc110pad"
,
NULL
))
{
release_region
(
pc110pad_io
,
4
);
printk
(
KERN_ERR
"pc110pad: Unable to get irq %d.
\n
"
,
pc110pad_irq
);
return
-
EBUSY
;
err
=
-
EBUSY
;
goto
err_release_region
;
}
if
(
!
(
pc110pad_dev
=
input_allocate_device
()))
{
free_irq
(
pc110pad_irq
,
NULL
);
release_region
(
pc110pad_io
,
4
);
pc110pad_dev
=
input_allocate_device
();
if
(
!
pc110pad_dev
)
{
printk
(
KERN_ERR
"pc110pad: Not enough memory.
\n
"
);
return
-
ENOMEM
;
err
=
-
ENOMEM
;
goto
err_free_irq
;
}
pc110pad_dev
->
name
=
"IBM PC110 TouchPad"
;
...
...
@@ -153,9 +154,20 @@ static int __init pc110pad_init(void)
pc110pad_dev
->
open
=
pc110pad_open
;
pc110pad_dev
->
close
=
pc110pad_close
;
input_register_device
(
pc110pad_dev
);
err
=
input_register_device
(
pc110pad_dev
);
if
(
err
)
goto
err_free_dev
;
return
0
;
err_free_dev:
input_free_device
(
pc110pad_dev
);
err_free_irq:
free_irq
(
pc110pad_irq
,
NULL
);
err_release_region:
release_region
(
pc110pad_io
,
4
);
return
err
;
}
static
void
__exit
pc110pad_exit
(
void
)
...
...
drivers/input/mouse/psmouse-base.c
浏览文件 @
72155615
...
...
@@ -1102,7 +1102,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
{
struct
psmouse
*
psmouse
,
*
parent
=
NULL
;
struct
input_dev
*
input_dev
;
int
retval
=
-
ENOMEM
;
int
retval
=
0
,
error
=
-
ENOMEM
;
mutex_lock
(
&
psmouse_mutex
);
...
...
@@ -1118,7 +1118,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
psmouse
=
kzalloc
(
sizeof
(
struct
psmouse
),
GFP_KERNEL
);
input_dev
=
input_allocate_device
();
if
(
!
psmouse
||
!
input_dev
)
goto
out
;
goto
err_free
;
ps2_init
(
&
psmouse
->
ps2dev
,
serio
);
INIT_WORK
(
&
psmouse
->
resync_work
,
psmouse_resync
,
psmouse
);
...
...
@@ -1129,14 +1129,13 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
serio_set_drvdata
(
serio
,
psmouse
);
retval
=
serio_open
(
serio
,
drv
);
if
(
retval
)
goto
out
;
error
=
serio_open
(
serio
,
drv
);
if
(
error
)
goto
err_clear_drvdata
;
if
(
psmouse_probe
(
psmouse
)
<
0
)
{
serio_close
(
serio
);
retval
=
-
ENODEV
;
goto
out
;
error
=
-
ENODEV
;
goto
err_close_serio
;
}
psmouse
->
rate
=
psmouse_rate
;
...
...
@@ -1150,30 +1149,44 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
psmouse_set_state
(
psmouse
,
PSMOUSE_CMD_MODE
);
psmouse_initialize
(
psmouse
);
input_register_device
(
psmouse
->
dev
);
error
=
input_register_device
(
psmouse
->
dev
);
if
(
error
)
goto
err_protocol_disconnect
;
if
(
parent
&&
parent
->
pt_activate
)
parent
->
pt_activate
(
parent
);
sysfs_create_group
(
&
serio
->
dev
.
kobj
,
&
psmouse_attribute_group
);
error
=
sysfs_create_group
(
&
serio
->
dev
.
kobj
,
&
psmouse_attribute_group
);
if
(
error
)
goto
err_pt_deactivate
;
psmouse_activate
(
psmouse
);
retval
=
0
;
out:
if
(
retval
)
{
serio_set_drvdata
(
serio
,
NULL
);
input_free_device
(
input_dev
);
kfree
(
psmouse
);
}
out:
/* If this is a pass-through port the parent needs to be re-activated */
if
(
parent
)
psmouse_activate
(
parent
);
mutex_unlock
(
&
psmouse_mutex
);
return
retval
;
err_pt_deactivate:
if
(
parent
&&
parent
->
pt_deactivate
)
parent
->
pt_deactivate
(
parent
);
err_protocol_disconnect:
if
(
psmouse
->
disconnect
)
psmouse
->
disconnect
(
psmouse
);
psmouse_set_state
(
psmouse
,
PSMOUSE_IGNORE
);
err_close_serio:
serio_close
(
serio
);
err_clear_drvdata:
serio_set_drvdata
(
serio
,
NULL
);
err_free:
input_free_device
(
input_dev
);
kfree
(
psmouse
);
retval
=
error
;
goto
out
;
}
...
...
@@ -1365,17 +1378,20 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
{
struct
serio
*
serio
=
psmouse
->
ps2dev
.
serio
;
struct
psmouse
*
parent
=
NULL
;
struct
input_dev
*
new_dev
;
const
struct
psmouse_protocol
*
proto
;
struct
input_dev
*
old_dev
,
*
new_dev
;
const
struct
psmouse_protocol
*
proto
,
*
old_proto
;
int
error
;
int
retry
=
0
;
if
(
!
(
proto
=
psmouse_protocol_by_name
(
buf
,
count
)))
proto
=
psmouse_protocol_by_name
(
buf
,
count
);
if
(
!
proto
)
return
-
EINVAL
;
if
(
psmouse
->
type
==
proto
->
type
)
return
count
;
if
(
!
(
new_dev
=
input_allocate_device
()))
new_dev
=
input_allocate_device
();
if
(
!
new_dev
)
return
-
ENOMEM
;
while
(
serio
->
child
)
{
...
...
@@ -1408,11 +1424,13 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
parent
->
pt_deactivate
(
parent
);
}
old_dev
=
psmouse
->
dev
;
old_proto
=
psmouse_protocol_by_type
(
psmouse
->
type
);
if
(
psmouse
->
disconnect
)
psmouse
->
disconnect
(
psmouse
);
psmouse_set_state
(
psmouse
,
PSMOUSE_IGNORE
);
input_unregister_device
(
psmouse
->
dev
);
psmouse
->
dev
=
new_dev
;
psmouse_set_state
(
psmouse
,
PSMOUSE_INITIALIZING
);
...
...
@@ -1426,7 +1444,23 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
psmouse_initialize
(
psmouse
);
psmouse_set_state
(
psmouse
,
PSMOUSE_CMD_MODE
);
input_register_device
(
psmouse
->
dev
);
error
=
input_register_device
(
psmouse
->
dev
);
if
(
error
)
{
if
(
psmouse
->
disconnect
)
psmouse
->
disconnect
(
psmouse
);
psmouse_set_state
(
psmouse
,
PSMOUSE_IGNORE
);
input_free_device
(
new_dev
);
psmouse
->
dev
=
old_dev
;
psmouse_set_state
(
psmouse
,
PSMOUSE_INITIALIZING
);
psmouse_switch_protocol
(
psmouse
,
old_proto
);
psmouse_initialize
(
psmouse
);
psmouse_set_state
(
psmouse
,
PSMOUSE_CMD_MODE
);
return
error
;
}
input_unregister_device
(
old_dev
);
if
(
parent
&&
parent
->
pt_activate
)
parent
->
pt_activate
(
parent
);
...
...
drivers/input/mouse/rpcmouse.c
浏览文件 @
72155615
...
...
@@ -66,7 +66,10 @@ static irqreturn_t rpcmouse_irq(int irq, void *dev_id)
static
int
__init
rpcmouse_init
(
void
)
{
if
(
!
(
rpcmouse_dev
=
input_allocate_device
()))
int
err
;
rpcmouse_dev
=
input_allocate_device
();
if
(
!
rpcmouse_dev
)
return
-
ENOMEM
;
rpcmouse_dev
->
name
=
"Acorn RiscPC Mouse"
;
...
...
@@ -85,13 +88,22 @@ static int __init rpcmouse_init(void)
if
(
request_irq
(
IRQ_VSYNCPULSE
,
rpcmouse_irq
,
IRQF_SHARED
,
"rpcmouse"
,
rpcmouse_dev
))
{
printk
(
KERN_ERR
"rpcmouse: unable to allocate VSYNC interrupt
\n
"
);
input_free_device
(
rpcmouse_dev
)
;
return
-
EBUSY
;
err
=
-
EBUSY
;
goto
err_free_dev
;
}
input_register_device
(
rpcmouse_dev
);
err
=
input_register_device
(
rpcmouse_dev
);
if
(
err
)
goto
err_free_irq
;
return
0
;
err_free_irq:
free_irq
(
IRQ_VSYNCPULSE
,
rpcmouse_dev
);
err_free_dev:
input_free_device
(
rpcmouse_dev
);
return
err
;
}
static
void
__exit
rpcmouse_exit
(
void
)
...
...
drivers/input/mouse/sermouse.c
浏览文件 @
72155615
...
...
@@ -246,7 +246,7 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
sermouse
=
kzalloc
(
sizeof
(
struct
sermouse
),
GFP_KERNEL
);
input_dev
=
input_allocate_device
();
if
(
!
sermouse
||
!
input_dev
)
goto
fail
;
goto
fail
1
;
sermouse
->
dev
=
input_dev
;
snprintf
(
sermouse
->
phys
,
sizeof
(
sermouse
->
phys
),
"%s/input0"
,
serio
->
phys
);
...
...
@@ -275,14 +275,17 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
err
=
serio_open
(
serio
,
drv
);
if
(
err
)
goto
fail
;
goto
fail
2
;
input_register_device
(
sermouse
->
dev
);
err
=
input_register_device
(
sermouse
->
dev
);
if
(
err
)
goto
fail3
;
return
0
;
fail:
serio_set_drvdata
(
serio
,
NULL
);
input_free_device
(
input_dev
);
fail3:
serio_close
(
serio
);
fail2:
serio_set_drvdata
(
serio
,
NULL
);
fail1:
input_free_device
(
input_dev
);
kfree
(
sermouse
);
return
err
;
}
...
...
drivers/input/mouse/vsxxxaa.c
浏览文件 @
72155615
...
...
@@ -497,7 +497,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
mouse
=
kzalloc
(
sizeof
(
struct
vsxxxaa
),
GFP_KERNEL
);
input_dev
=
input_allocate_device
();
if
(
!
mouse
||
!
input_dev
)
goto
fail
;
goto
fail
1
;
mouse
->
dev
=
input_dev
;
mouse
->
serio
=
serio
;
...
...
@@ -527,7 +527,7 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
err
=
serio_open
(
serio
,
drv
);
if
(
err
)
goto
fail
;
goto
fail
2
;
/*
* Request selftest. Standard packet format and differential
...
...
@@ -535,12 +535,15 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv)
*/
serio
->
write
(
serio
,
'T'
);
/* Test */
input_register_device
(
input_dev
);
err
=
input_register_device
(
input_dev
);
if
(
err
)
goto
fail3
;
return
0
;
fail:
serio_set_drvdata
(
serio
,
NULL
);
input_free_device
(
input_dev
);
fail3:
serio_close
(
serio
);
fail2:
serio_set_drvdata
(
serio
,
NULL
);
fail1:
input_free_device
(
input_dev
);
kfree
(
mouse
);
return
err
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录