Input: make i8042_platform_init return 'real' error code
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
0854e52d86
commit
8d5987a6e1
6 changed files with 26 additions and 23 deletions
|
@ -69,16 +69,16 @@ static inline int i8042_platform_init(void)
|
||||||
*/
|
*/
|
||||||
#if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64)
|
#if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64)
|
||||||
if (!request_region(I8042_DATA_REG, 16, "i8042"))
|
if (!request_region(I8042_DATA_REG, 16, "i8042"))
|
||||||
return -1;
|
return -EBUSY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i8042_reset = 1;
|
i8042_reset = 1;
|
||||||
|
|
||||||
#if defined(CONFIG_PPC64)
|
#if defined(CONFIG_PPC64)
|
||||||
if (check_legacy_ioport(I8042_DATA_REG))
|
if (check_legacy_ioport(I8042_DATA_REG))
|
||||||
return -1;
|
return -EBUSY;
|
||||||
if (!request_region(I8042_DATA_REG, 16, "i8042"))
|
if (!request_region(I8042_DATA_REG, 16, "i8042"))
|
||||||
return -1;
|
return -EBUSY;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ static inline int i8042_platform_init(void)
|
||||||
#if 0
|
#if 0
|
||||||
/* XXX sgi_kh is a virtual address */
|
/* XXX sgi_kh is a virtual address */
|
||||||
if (!request_mem_region(sgi_kh, sizeof(struct hpc_keyb), "i8042"))
|
if (!request_mem_region(sgi_kh, sizeof(struct hpc_keyb), "i8042"))
|
||||||
return 1;
|
return -EBUSY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i8042_reset = 1;
|
i8042_reset = 1;
|
||||||
|
|
|
@ -53,7 +53,7 @@ static inline int i8042_platform_init(void)
|
||||||
#if 0
|
#if 0
|
||||||
/* XXX JAZZ_KEYBOARD_ADDRESS is a virtual address */
|
/* XXX JAZZ_KEYBOARD_ADDRESS is a virtual address */
|
||||||
if (!request_mem_region(JAZZ_KEYBOARD_ADDRESS, 2, "i8042"))
|
if (!request_mem_region(JAZZ_KEYBOARD_ADDRESS, 2, "i8042"))
|
||||||
return 1;
|
return -EBUSY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -48,10 +48,10 @@ static inline void i8042_write_command(int val)
|
||||||
#define OBP_PS2MS_NAME1 "kdmouse"
|
#define OBP_PS2MS_NAME1 "kdmouse"
|
||||||
#define OBP_PS2MS_NAME2 "mouse"
|
#define OBP_PS2MS_NAME2 "mouse"
|
||||||
|
|
||||||
static int i8042_platform_init(void)
|
static int __init i8042_platform_init(void)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_PCI
|
#ifndef CONFIG_PCI
|
||||||
return -1;
|
return -ENODEV;
|
||||||
#else
|
#else
|
||||||
char prop[128];
|
char prop[128];
|
||||||
int len;
|
int len;
|
||||||
|
@ -59,14 +59,14 @@ static int i8042_platform_init(void)
|
||||||
len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
|
len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
printk("i8042: Cannot get name property of root OBP node.\n");
|
printk("i8042: Cannot get name property of root OBP node.\n");
|
||||||
return -1;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
|
if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
|
||||||
/* Hardcoded values for MrCoffee. */
|
/* Hardcoded values for MrCoffee. */
|
||||||
i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
|
i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
|
||||||
kbd_iobase = ioremap(0x71300060, 8);
|
kbd_iobase = ioremap(0x71300060, 8);
|
||||||
if (!kbd_iobase)
|
if (!kbd_iobase)
|
||||||
return -1;
|
return -ENODEV;
|
||||||
} else {
|
} else {
|
||||||
struct linux_ebus *ebus;
|
struct linux_ebus *ebus;
|
||||||
struct linux_ebus_device *edev;
|
struct linux_ebus_device *edev;
|
||||||
|
@ -78,7 +78,7 @@ static int i8042_platform_init(void)
|
||||||
goto edev_found;
|
goto edev_found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -ENODEV;
|
||||||
|
|
||||||
edev_found:
|
edev_found:
|
||||||
for_each_edevchild(edev, child) {
|
for_each_edevchild(edev, child) {
|
||||||
|
@ -96,7 +96,7 @@ static int i8042_platform_init(void)
|
||||||
i8042_aux_irq == -1) {
|
i8042_aux_irq == -1) {
|
||||||
printk("i8042: Error, 8042 device lacks both kbd and "
|
printk("i8042: Error, 8042 device lacks both kbd and "
|
||||||
"mouse nodes.\n");
|
"mouse nodes.\n");
|
||||||
return -1;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ static void i8042_pnp_exit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int i8042_pnp_init(void)
|
static int __init i8042_pnp_init(void)
|
||||||
{
|
{
|
||||||
int result_kbd, result_aux;
|
int result_kbd, result_aux;
|
||||||
|
|
||||||
|
@ -322,25 +322,29 @@ static int i8042_pnp_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
static inline int i8042_pnp_init(void) { return 0; }
|
||||||
|
static inline void i8042_pnp_exit(void) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int i8042_platform_init(void)
|
static int __init i8042_platform_init(void)
|
||||||
{
|
{
|
||||||
|
int retval;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On ix86 platforms touching the i8042 data register region can do really
|
* On ix86 platforms touching the i8042 data register region can do really
|
||||||
* bad things. Because of this the region is always reserved on ix86 boxes.
|
* bad things. Because of this the region is always reserved on ix86 boxes.
|
||||||
*
|
*
|
||||||
* if (!request_region(I8042_DATA_REG, 16, "i8042"))
|
* if (!request_region(I8042_DATA_REG, 16, "i8042"))
|
||||||
* return -1;
|
* return -EBUSY;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
i8042_kbd_irq = I8042_MAP_IRQ(1);
|
i8042_kbd_irq = I8042_MAP_IRQ(1);
|
||||||
i8042_aux_irq = I8042_MAP_IRQ(12);
|
i8042_aux_irq = I8042_MAP_IRQ(12);
|
||||||
|
|
||||||
#ifdef CONFIG_PNP
|
retval = i8042_pnp_init();
|
||||||
if (i8042_pnp_init())
|
if (retval)
|
||||||
return -1;
|
return retval;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__ia64__)
|
#if defined(__ia64__)
|
||||||
i8042_reset = 1;
|
i8042_reset = 1;
|
||||||
|
@ -354,14 +358,12 @@ static inline int i8042_platform_init(void)
|
||||||
i8042_nomux = 1;
|
i8042_nomux = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void i8042_platform_exit(void)
|
static inline void i8042_platform_exit(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PNP
|
|
||||||
i8042_pnp_exit();
|
i8042_pnp_exit();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _I8042_X86IA64IO_H */
|
#endif /* _I8042_X86IA64IO_H */
|
||||||
|
|
|
@ -1066,8 +1066,9 @@ static int __init i8042_init(void)
|
||||||
init_timer(&i8042_timer);
|
init_timer(&i8042_timer);
|
||||||
i8042_timer.function = i8042_timer_func;
|
i8042_timer.function = i8042_timer_func;
|
||||||
|
|
||||||
if (i8042_platform_init())
|
err = i8042_platform_init();
|
||||||
return -EBUSY;
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ;
|
i8042_ports[I8042_AUX_PORT_NO].irq = I8042_AUX_IRQ;
|
||||||
i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ;
|
i8042_ports[I8042_KBD_PORT_NO].irq = I8042_KBD_IRQ;
|
||||||
|
|
Loading…
Reference in a new issue