Commit 87a9d57e authored by Vojtech Pavlik's avatar Vojtech Pavlik

Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input

parents bd039e05 921e8a00
...@@ -204,6 +204,8 @@ char *tty_name(struct tty_struct *tty, char *buf) ...@@ -204,6 +204,8 @@ char *tty_name(struct tty_struct *tty, char *buf)
return _tty_make_name(tty, (tty)?tty->driver.name:NULL, buf); return _tty_make_name(tty, (tty)?tty->driver.name:NULL, buf);
} }
EXPORT_SYMBOL(tty_name);
inline int tty_paranoia_check(struct tty_struct *tty, kdev_t device, inline int tty_paranoia_check(struct tty_struct *tty, kdev_t device,
const char *routine) const char *routine)
{ {
......
...@@ -62,7 +62,7 @@ static inline int i8042_platform_init(void) ...@@ -62,7 +62,7 @@ static inline int i8042_platform_init(void)
* 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 !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) #if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__)
if (!request_region(I8042_DATA_REG, 16, "i8042")) if (!request_region(I8042_DATA_REG, 16, "i8042"))
return 0; return 0;
#endif #endif
...@@ -71,7 +71,7 @@ static inline int i8042_platform_init(void) ...@@ -71,7 +71,7 @@ static inline int i8042_platform_init(void)
static inline void i8042_platform_exit(void) static inline void i8042_platform_exit(void)
{ {
#if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) #if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__)
release_region(I8042_DATA_REG, 16); release_region(I8042_DATA_REG, 16);
#endif #endif
} }
......
/* /*
* $Id: serport_old.c,v 1.10 2002/01/24 19:52:57 vojtech Exp $ * Input device TTY line discipline
*
* Copyright (c) 1999-2002 Vojtech Pavlik
* *
* Copyright (c) 1999-2001 Vojtech Pavlik
*/
/*
* This is a module that converts a tty line into a much simpler * This is a module that converts a tty line into a much simpler
* 'serial io port' abstraction that the input device drivers use. * 'serial io port' abstraction that the input device drivers use.
*/ */
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify it
* it under the terms of the GNU General Public License as published by * under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation.
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/ */
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -41,10 +25,13 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); ...@@ -41,10 +25,13 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input device TTY line discipline"); MODULE_DESCRIPTION("Input device TTY line discipline");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define SERPORT_BUSY 1
struct serport { struct serport {
struct tty_struct *tty; struct tty_struct *tty;
wait_queue_head_t wait; wait_queue_head_t wait;
struct serio serio; struct serio serio;
unsigned long flags;
char phys[32]; char phys[32];
}; };
...@@ -68,20 +55,20 @@ static int serport_serio_open(struct serio *serio) ...@@ -68,20 +55,20 @@ static int serport_serio_open(struct serio *serio)
static void serport_serio_close(struct serio *serio) static void serport_serio_close(struct serio *serio)
{ {
struct serport *serport = serio->driver; struct serport *serport = serio->driver;
serport->serio.type = 0;
wake_up_interruptible(&serport->wait); wake_up_interruptible(&serport->wait);
} }
/* /*
* serport_ldisc_open() is the routine that is called upon setting our line * serport_ldisc_open() is the routine that is called upon setting our line
* discipline on a tty. It looks for the Mag, and if found, registers * discipline on a tty. It prepares the serio struct.
* it as a joystick device.
*/ */
static int serport_ldisc_open(struct tty_struct *tty) static int serport_ldisc_open(struct tty_struct *tty)
{ {
struct serport *serport; struct serport *serport;
char ttyname[64]; char name[64];
int i;
MOD_INC_USE_COUNT; MOD_INC_USE_COUNT;
...@@ -96,11 +83,7 @@ static int serport_ldisc_open(struct tty_struct *tty) ...@@ -96,11 +83,7 @@ static int serport_ldisc_open(struct tty_struct *tty)
serport->tty = tty; serport->tty = tty;
tty->disc_data = serport; tty->disc_data = serport;
strcpy(ttyname, tty->driver.name); snprintf(serport->phys, sizeof(serport->phys), "%s/serio0", tty_name(tty, name));
for (i = 0; ttyname[i] != 0 && ttyname[i] != '/'; i++);
ttyname[i] = 0;
sprintf(serport->phys, "%s%d/serio0", ttyname, minor(tty->device) - tty->driver.minor_start);
serport->serio.name = serport_name; serport->serio.name = serport_name;
serport->serio.phys = serport->phys; serport->serio.phys = serport->phys;
...@@ -161,29 +144,18 @@ static int serport_ldisc_room(struct tty_struct *tty) ...@@ -161,29 +144,18 @@ static int serport_ldisc_room(struct tty_struct *tty)
static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char * buf, size_t nr) static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, unsigned char * buf, size_t nr)
{ {
struct serport *serport = (struct serport*) tty->disc_data; struct serport *serport = (struct serport*) tty->disc_data;
DECLARE_WAITQUEUE(wait, current); char name[64];
char name[32];
#ifdef CONFIG_DEVFS_FS if (test_and_set_bit(SERPORT_BUSY, &serport->flags))
sprintf(name, tty->driver.name, minor(tty->device) - tty->driver.minor_start); return -EBUSY;
#else
sprintf(name, "%s%d", tty->driver.name, minor(tty->device) - tty->driver.minor_start);
#endif
serio_register_port(&serport->serio); serio_register_port(&serport->serio);
printk(KERN_INFO "serio: Serial port %s\n", tty_name(tty, name));
printk(KERN_INFO "serio: Serial port %s\n", name); wait_event_interruptible(serport->wait, !serport->serio.type);
add_wait_queue(&serport->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
while(serport->serio.type && !signal_pending(current)) schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&serport->wait, &wait);
serio_unregister_port(&serport->serio); serio_unregister_port(&serport->serio);
clear_bit(SERPORT_BUSY, &serport->flags);
return 0; return 0;
} }
...@@ -195,10 +167,8 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi ...@@ -195,10 +167,8 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi
{ {
struct serport *serport = (struct serport*) tty->disc_data; struct serport *serport = (struct serport*) tty->disc_data;
switch (cmd) { if (cmd == SPIOCSTYPE)
case SPIOCSTYPE: return get_user(serport->serio.type, (unsigned long *) arg);
return get_user(serport->serio.type, (unsigned long *) arg);
}
return -EINVAL; return -EINVAL;
} }
...@@ -208,7 +178,6 @@ static void serport_ldisc_write_wakeup(struct tty_struct * tty) ...@@ -208,7 +178,6 @@ static void serport_ldisc_write_wakeup(struct tty_struct * tty)
struct serport *sp = (struct serport *) tty->disc_data; struct serport *sp = (struct serport *) tty->disc_data;
serio_dev_write_wakeup(&sp->serio); serio_dev_write_wakeup(&sp->serio);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment