summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/adbmouse.c2
-rw-r--r--drivers/char/busmouse.c7
-rw-r--r--drivers/char/console.c2
-rw-r--r--drivers/char/defkeymap.c3
-rw-r--r--drivers/char/dn_keyb.c2
-rw-r--r--drivers/char/drm/fops.c2
-rw-r--r--drivers/char/ftape/Config.in26
-rw-r--r--drivers/char/joystick/Config.in22
-rw-r--r--drivers/char/keyboard.c1
-rw-r--r--drivers/char/mem.c13
-rw-r--r--drivers/char/misc.c6
-rw-r--r--drivers/char/n_hdlc.c97
-rw-r--r--drivers/char/n_tty.c5
-rw-r--r--drivers/char/pc110pad.c19
-rw-r--r--drivers/char/pc_keyb.c32
-rw-r--r--drivers/char/pms.c29
-rw-r--r--drivers/char/ppdev.c36
-rw-r--r--drivers/char/ppdev.h7
-rw-r--r--drivers/char/qpmouse.c2
-rw-r--r--drivers/char/tty_io.c60
20 files changed, 258 insertions, 115 deletions
diff --git a/drivers/char/adbmouse.c b/drivers/char/adbmouse.c
index eaf1a8357..95c25b519 100644
--- a/drivers/char/adbmouse.c
+++ b/drivers/char/adbmouse.c
@@ -35,8 +35,8 @@
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/init.h>
+#include <linux/adb_mouse.h>
-#include <asm/adb_mouse.h>
#ifdef __powerpc__
#include <asm/processor.h>
#endif
diff --git a/drivers/char/busmouse.c b/drivers/char/busmouse.c
index 4620a3d60..42c2642f6 100644
--- a/drivers/char/busmouse.c
+++ b/drivers/char/busmouse.c
@@ -144,7 +144,7 @@ busmouse_add_movementbuttons(int mousedev, int dx, int dy, int buttons)
wake_up(&mse->wait);
if (mse->fasyncptr)
- kill_fasync(mse->fasyncptr, SIGIO);
+ kill_fasync(mse->fasyncptr, SIGIO, POLL_IN);
}
}
@@ -450,13 +450,10 @@ bus_mouse_init(void)
#ifdef CONFIG_ATARIMOUSE
atari_mouse_init();
#endif
-#ifdef CONFIG_MAC_MOUSE
- mac_mouse_init();
-#endif
#ifdef CONFIG_SUN_MOUSE
sun_mouse_init();
#endif
-#ifdef CONFIG_ADBMOUSE
+#ifdef CONFIG_ADB_MOUSE
adb_mouse_init();
#endif
#ifdef CONFIG_RPCMOUSE
diff --git a/drivers/char/console.c b/drivers/char/console.c
index d0503cdcb..f452237ab 100644
--- a/drivers/char/console.c
+++ b/drivers/char/console.c
@@ -681,7 +681,7 @@ int vc_resize(unsigned int lines, unsigned int cols,
else {
unsigned short *p = (unsigned short *) kmalloc(ss, GFP_USER);
if (!p) {
- for (i = 0; i< currcons; i++)
+ for (i = first; i < currcons; i++)
if (newscreens[i])
kfree_s(newscreens[i], ss);
return -ENOMEM;
diff --git a/drivers/char/defkeymap.c b/drivers/char/defkeymap.c
index 42fae3568..d8ac176c2 100644
--- a/drivers/char/defkeymap.c
+++ b/drivers/char/defkeymap.c
@@ -233,7 +233,6 @@ struct kbdiacr accent_table[MAX_DIACR] = {
{'A', 'A', '\305'}, {'a', 'a', '\345'},
{'A', 'E', '\306'}, {'a', 'e', '\346'},
{',', 'C', '\307'}, {',', 'c', '\347'},
- {'\'', 'C', '\307'}, {'\'', 'c', '\347'},
{'`', 'E', '\310'}, {'`', 'e', '\350'},
{'\'', 'E', '\311'}, {'\'', 'e', '\351'},
{'^', 'E', '\312'}, {'^', 'e', '\352'},
@@ -260,4 +259,4 @@ struct kbdiacr accent_table[MAX_DIACR] = {
{'s', 'z', '\337'}, {'i', 'j', '\377'},
};
-unsigned int accent_table_size = 70;
+unsigned int accent_table_size = 68;
diff --git a/drivers/char/dn_keyb.c b/drivers/char/dn_keyb.c
index 97b237ca3..38010e29b 100644
--- a/drivers/char/dn_keyb.c
+++ b/drivers/char/dn_keyb.c
@@ -469,7 +469,7 @@ static void dn_keyb_process_mouse_event(unsigned char mouse_data) {
if (mouse_dy > 2048)
mouse_dy = 2048;
if (mouse_fasyncptr)
- kill_fasync(mouse_fasyncptr, SIGIO);
+ kill_fasync(mouse_fasyncptr, SIGIO, POLL_IN);
}
mouse_byte_count=0;
/* printk("mouse: %d, %d, %x\n",mouse_x,mouse_y,buttons); */
diff --git a/drivers/char/drm/fops.c b/drivers/char/drm/fops.c
index 12ab4d628..55deade81 100644
--- a/drivers/char/drm/fops.c
+++ b/drivers/char/drm/fops.c
@@ -197,7 +197,7 @@ int drm_write_string(drm_device_t *dev, const char *s)
send -= count;
}
- if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
+ if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_OUT);
DRM_DEBUG("waking\n");
wake_up_interruptible(&dev->buf_readers);
return 0;
diff --git a/drivers/char/ftape/Config.in b/drivers/char/ftape/Config.in
index 2f837be5b..59004dcf2 100644
--- a/drivers/char/ftape/Config.in
+++ b/drivers/char/ftape/Config.in
@@ -1,17 +1,17 @@
#
# Ftape configuration
#
-dep_tristate 'Zftape, the VFS interface' CONFIG_ZFTAPE $CONFIG_FTAPE
+dep_tristate ' Zftape, the VFS interface' CONFIG_ZFTAPE $CONFIG_FTAPE
if [ "$CONFIG_ZFTAPE" != "n" ]; then
- int 'Default block size' CONFIG_ZFT_DFLT_BLK_SZ 10240
- comment 'The compressor will be built as a module only!'
- define_bool CONFIG_ZFT_COMPRESSOR m
+ int ' Default block size' CONFIG_ZFT_DFLT_BLK_SZ 10240
+ comment ' The compressor will be built as a module only!'
+ define_bool CONFIG_ZFT_COMPRESSOR m
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- int 'Number of ftape buffers (EXPERIMENTAL)' CONFIG_FT_NR_BUFFERS 3
+ int ' Number of ftape buffers (EXPERIMENTAL)' CONFIG_FT_NR_BUFFERS 3
fi
if [ "$CONFIG_PROC_FS" = "y" ]; then
- bool 'Enable procfs status report (+2kb)' CONFIG_FT_PROC_FS y
+ bool ' Enable procfs status report (+2kb)' CONFIG_FT_PROC_FS
fi
choice 'Debugging output' \
"Normal CONFIG_FT_NORMAL_DEBUG \
@@ -25,14 +25,14 @@ choice 'Floppy tape controllers' \
FC-10/FC-20 CONFIG_FT_PROBE_FC10 \
Alt/82078 CONFIG_FT_ALT_FDC" Standard
if [ "$CONFIG_FT_STD_FDC" != "y" ]; then
- comment ' Consult the manuals of your tape drive for the correct settings!'
- hex ' IO base of the floppy disk controller' CONFIG_FT_FDC_BASE 0
- int ' IRQ channel of the floppy disk controller' CONFIG_FT_FDC_IRQ 0
- int ' DMA channel of the floppy disk controller' CONFIG_FT_FDC_DMA 0
+ comment ' Consult the manuals of your tape drive for the correct settings!'
+ hex ' IO base of the floppy disk controller' CONFIG_FT_FDC_BASE 0
+ int ' IRQ channel of the floppy disk controller' CONFIG_FT_FDC_IRQ 0
+ int ' DMA channel of the floppy disk controller' CONFIG_FT_FDC_DMA 0
fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- int 'Default FIFO threshold (EXPERIMENTAL)' CONFIG_FT_FDC_THR 8
- int 'Maximal data rate to use (EXPERIMENTAL)' CONFIG_FT_FDC_MAX_RATE 2000
+ int ' Default FIFO threshold (EXPERIMENTAL)' CONFIG_FT_FDC_THR 8
+ int ' Maximal data rate to use (EXPERIMENTAL)' CONFIG_FT_FDC_MAX_RATE 2000
fi
comment 'ONLY for DEC Alpha architectures'
-int 'CPU clock frequency of your DEC Alpha' CONFIG_FT_ALPHA_CLOCK 0
+int ' CPU clock frequency of your DEC Alpha' CONFIG_FT_ALPHA_CLOCK 0
diff --git a/drivers/char/joystick/Config.in b/drivers/char/joystick/Config.in
index a41eaac33..810decada 100644
--- a/drivers/char/joystick/Config.in
+++ b/drivers/char/joystick/Config.in
@@ -2,18 +2,18 @@
# Joystick lowlevel driver configuration
#
-dep_tristate ' Classic PC analog joysticks and gamepads' CONFIG_JOY_ANALOG $CONFIG_JOYSTICK
-dep_tristate ' FPGaming and MadCatz A3D controllers' CONFIG_JOY_ASSASIN $CONFIG_JOYSTICK
-dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_JOY_GRAVIS $CONFIG_JOYSTICK
-dep_tristate ' Logitech Digital joysticks and gamepads' CONFIG_JOY_LOGITECH $CONFIG_JOYSTICK
-dep_tristate ' Microsoft SideWinder, Genius Digital joysticks and gamepads' CONFIG_JOY_SIDEWINDER $CONFIG_JOYSTICK
-dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_JOY_THRUSTMASTER $CONFIG_JOYSTICK
-dep_tristate ' PDPI Lightning 4 gamecards' CONFIG_JOY_LIGHTNING $CONFIG_JOYSTICK
+dep_tristate ' Classic PC analog joysticks and gamepads' CONFIG_JOY_ANALOG $CONFIG_JOYSTICK
+dep_tristate ' FPGaming and MadCatz A3D controllers' CONFIG_JOY_ASSASIN $CONFIG_JOYSTICK
+dep_tristate ' Gravis GrIP joysticks and gamepads' CONFIG_JOY_GRAVIS $CONFIG_JOYSTICK
+dep_tristate ' Logitech Digital joysticks and gamepads' CONFIG_JOY_LOGITECH $CONFIG_JOYSTICK
+dep_tristate ' Microsoft SideWinder, Genius Digital joysticks and gamepads' CONFIG_JOY_SIDEWINDER $CONFIG_JOYSTICK
+dep_tristate ' ThrustMaster DirectConnect joysticks and gamepads' CONFIG_JOY_THRUSTMASTER $CONFIG_JOYSTICK
+dep_tristate ' PDPI Lightning 4 gamecards' CONFIG_JOY_LIGHTNING $CONFIG_JOYSTICK
if [ "$CONFIG_PARPORT" != "n" ]; then
- dep_tristate ' NES, SNES, PSX, Multisystem joysticks and gamepads' CONFIG_JOY_CONSOLE $CONFIG_JOYSTICK $CONFIG_PARPORT
- dep_tristate ' Sega, Multisystem joysticks and gamepads' CONFIG_JOY_DB9 $CONFIG_JOYSTICK $CONFIG_PARPORT
- dep_tristate ' TurboGraFX Multisystem joystick interface' CONFIG_JOY_TURBOGRAFX $CONFIG_JOYSTICK $CONFIG_PARPORT
+ dep_tristate ' NES, SNES, PSX, Multisystem joysticks and gamepads' CONFIG_JOY_CONSOLE $CONFIG_JOYSTICK $CONFIG_PARPORT
+ dep_tristate ' Sega, Multisystem joysticks and gamepads' CONFIG_JOY_DB9 $CONFIG_JOYSTICK $CONFIG_PARPORT
+ dep_tristate ' TurboGraFX Multisystem joystick interface' CONFIG_JOY_TURBOGRAFX $CONFIG_JOYSTICK $CONFIG_PARPORT
fi
if [ "$CONFIG_AMIGA" = "y" ]; then
- dep_tristate ' Amiga joysticks' CONFIG_JOY_AMIGA $CONFIG_JOYSTICK
+ dep_tristate ' Amiga joysticks' CONFIG_JOY_AMIGA $CONFIG_JOYSTICK
fi
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index def0b7c19..5989fbff5 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -32,6 +32,7 @@
#include <linux/string.h>
#include <linux/random.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <asm/keyboard.h>
#include <asm/bitops.h>
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index ff3158e96..9be0a51f5 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -50,7 +50,7 @@ extern void prom_con_init(void);
#ifdef CONFIG_MDA_CONSOLE
extern void mda_console_init(void);
#endif
-#if defined(CONFIG_PPC) || defined(CONFIG_MAC)
+#if defined(CONFIG_ADB)
extern void adbdev_init(void);
#endif
#ifdef CONFIG_USB
@@ -268,7 +268,8 @@ static ssize_t write_kmem(struct file * file, const char * buf,
return do_write_mem(file, (void*)p, p, buf, count, ppos);
}
-#if !defined(CONFIG_PPC) && !defined(__mc68000__)
+#if (!defined(CONFIG_PPC) && !defined(__mc68000__) && !defined(__mips__)) || \
+ defined(CONFIG_HAVE_IO_PORTS)
static ssize_t read_port(struct file * file, char * buf,
size_t count, loff_t *ppos)
{
@@ -517,7 +518,8 @@ static struct file_operations null_fops = {
NULL /* fsync */
};
-#if !defined(CONFIG_PPC) && !defined(__mc68000__)
+#if (!defined(CONFIG_PPC) && !defined(__mc68000__) && !defined(__mips__)) || \
+ defined(CONFIG_HAVE_IO_PORTS)
static struct file_operations port_fops = {
memory_lseek,
read_port,
@@ -571,7 +573,8 @@ static int memory_open(struct inode * inode, struct file * filp)
case 3:
filp->f_op = &null_fops;
break;
-#if !defined(CONFIG_PPC) && !defined(__mc68000__)
+#if (!defined(CONFIG_PPC) && !defined(__mc68000__) && !defined(__mips__)) || \
+ defined(CONFIG_HAVE_IO_PORTS)
case 4:
filp->f_op = &port_fops;
break;
@@ -667,7 +670,7 @@ int __init chr_dev_init(void)
#ifdef CONFIG_VIDEO_BT848
i2c_init();
#endif
-#if defined(CONFIG_PPC) || defined(CONFIG_MAC)
+#if defined(CONFIG_ADB)
adbdev_init();
#endif
#ifdef CONFIG_VIDEO_DEV
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index e9eec975c..c30f10594 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -261,6 +261,12 @@ int __init misc_init(void)
#ifdef CONFIG_NWFLASH
nwflash_init();
#endif
+#ifdef CONFIG_SGI_NEWPORT_GFX
+ gfx_register ();
+#endif
+#ifdef CONFIG_SGI
+ streamable_init ();
+#endif
if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
printk("unable to get major %d for misc devices\n",
MISC_MAJOR);
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index 7251a4e05..0717fa418 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -9,7 +9,7 @@
* Al Longyear <longyear@netcom.com>, Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>
*
* Original release 01/11/99
- * ==FILEDATE 19990524==
+ * ==FILEDATE 19990901==
*
* This code is released under the GNU General Public License (GPL)
*
@@ -21,8 +21,13 @@
* 1. tty write calls represent one complete transmit frame of data
* The device driver should accept the complete frame or none of
* the frame (busy) in the write method. Each write call should have
- * a byte count in the range of 2-4096 bytes (2 is min HDLC frame
- * with 1 addr byte and 1 ctrl byte).
+ * a byte count in the range of 2-65535 bytes (2 is min HDLC frame
+ * with 1 addr byte and 1 ctrl byte). The max byte count of 65535
+ * should include any crc bytes required. For example, when using
+ * CCITT CRC32, 4 crc bytes are required, so the maximum size frame
+ * the application may transmit is limited to 65531 bytes. For CCITT
+ * CRC16, the maximum application frame size would be 65533.
+ *
*
* 2. receive callbacks from the device driver represents
* one received frame. The device driver should bypass
@@ -73,7 +78,7 @@
*/
#define HDLC_MAGIC 0x239e
-#define HDLC_VERSION "1.2"
+#define HDLC_VERSION "1.11"
#include <linux/version.h>
#include <linux/config.h>
@@ -100,6 +105,7 @@
#include <linux/malloc.h>
#include <linux/tty.h>
#include <linux/errno.h>
+#include <linux/sched.h> /* to get the struct task_struct */
#include <linux/string.h> /* used in new tty drivers */
#include <linux/signal.h> /* used in new tty drivers */
#include <asm/system.h>
@@ -113,6 +119,13 @@
#include <linux/kerneld.h>
#endif
+#if LINUX_VERSION_CODE < VERSION(2,3,0)
+typedef struct wait_queue *wait_queue_head_t;
+#define DECLARE_WAITQUEUE(name,task) struct wait_queue (name) = {(task),NULL}
+#define init_waitqueue_head(head) *(head) = NULL
+#define set_current_state(a) current->state = (a)
+#endif
+
#if LINUX_VERSION_CODE >= VERSION(2,1,4)
#include <asm/segment.h>
#define GET_USER(error,value,addr) error = get_user(value,addr)
@@ -189,18 +202,21 @@ typedef size_t rw_count_t;
/*
* Buffers for individual HDLC frames
*/
-#define MAX_HDLC_FRAME_SIZE 4096
+#define MAX_HDLC_FRAME_SIZE 65535
#define DEFAULT_RX_BUF_COUNT 10
-#define MAX_RX_BUF_COUNT 30
+#define MAX_RX_BUF_COUNT 60
#define DEFAULT_TX_BUF_COUNT 1
+
typedef struct _n_hdlc_buf
{
struct _n_hdlc_buf *link;
int count;
- char buf[MAX_HDLC_FRAME_SIZE];
+ char buf[1];
} N_HDLC_BUF;
+#define N_HDLC_BUF_SIZE (sizeof(N_HDLC_BUF)+maxframe)
+
typedef struct _n_hdlc_buf_list
{
N_HDLC_BUF *head;
@@ -246,12 +262,16 @@ static struct n_hdlc *n_hdlc_alloc (void);
#if LINUX_VERSION_CODE >= VERSION(2,1,19)
MODULE_PARM(debuglevel, "i");
+MODULE_PARM(maxframe, "i");
#endif
/* debug level can be set by insmod for debugging purposes */
#define DEBUG_LEVEL_INFO 1
int debuglevel=0;
+/* max frame size for memory allocations */
+ssize_t maxframe=4096;
+
/* TTY callbacks */
static rw_ret_t n_hdlc_tty_read(struct tty_struct *,
@@ -353,6 +373,9 @@ static void n_hdlc_tty_close(struct tty_struct *tty)
printk (KERN_WARNING"n_hdlc: trying to close unopened tty!\n");
return;
}
+#if defined(TTY_NO_WRITE_SPLIT)
+ clear_bit(TTY_NO_WRITE_SPLIT,&tty->flags);
+#endif
tty->disc_data = NULL;
if (tty == n_hdlc->backup_tty)
n_hdlc->backup_tty = 0;
@@ -383,7 +406,9 @@ static int n_hdlc_tty_open (struct tty_struct *tty)
struct n_hdlc *n_hdlc = tty2n_hdlc (tty);
if (debuglevel >= DEBUG_LEVEL_INFO)
- printk("%s(%d)n_hdlc_tty_open() called\n",__FILE__,__LINE__);
+ printk("%s(%d)n_hdlc_tty_open() called (major=%u,minor=%u)\n",
+ __FILE__,__LINE__,
+ MAJOR(tty->device), MINOR(tty->device));
/* There should not be an existing table for this slot. */
if (n_hdlc) {
@@ -399,9 +424,14 @@ static int n_hdlc_tty_open (struct tty_struct *tty)
tty->disc_data = n_hdlc;
n_hdlc->tty = tty;
-
+
MOD_INC_USE_COUNT;
+#if defined(TTY_NO_WRITE_SPLIT)
+ /* change tty_io write() to not split large writes into 8K chunks */
+ set_bit(TTY_NO_WRITE_SPLIT,&tty->flags);
+#endif
+
/* Flush any pending characters in the driver and discipline. */
if (tty->ldisc.flush_buffer)
@@ -597,18 +627,26 @@ static void n_hdlc_tty_receive(struct tty_struct *tty,
return;
}
+ if ( count>maxframe ) {
+ if (debuglevel >= DEBUG_LEVEL_INFO)
+ printk("%s(%d) rx count>maxframesize, data discarded\n",
+ __FILE__,__LINE__);
+ return;
+ }
+
/* get a free HDLC buffer */
buf = n_hdlc_buf_get(&n_hdlc->rx_free_buf_list);
if (!buf) {
/* no buffers in free list, attempt to allocate another rx buffer */
/* unless the maximum count has been reached */
if (n_hdlc->rx_buf_list.count < MAX_RX_BUF_COUNT)
- buf = (N_HDLC_BUF*)kmalloc(sizeof(N_HDLC_BUF),GFP_ATOMIC);
+ buf = (N_HDLC_BUF*)kmalloc(N_HDLC_BUF_SIZE,GFP_ATOMIC);
}
if (!buf) {
- printk("%s(%d) no more rx buffers, data discarded\n",
- __FILE__,__LINE__);
+ if (debuglevel >= DEBUG_LEVEL_INFO)
+ printk("%s(%d) no more rx buffers, data discarded\n",
+ __FILE__,__LINE__);
return;
}
@@ -622,7 +660,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty,
/* wake up any blocked reads and perform async signalling */
wake_up_interruptible (&n_hdlc->read_wait);
if (n_hdlc->tty->fasync != NULL)
- kill_fasync (n_hdlc->tty->fasync, SIGIO);
+ kill_fasync (n_hdlc->tty->fasync, SIGIO, POLL_IN);
} /* end of n_hdlc_tty_receive() */
@@ -678,12 +716,11 @@ static rw_ret_t n_hdlc_tty_read (struct tty_struct *tty,
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
- /* TODO: no timeout? current->timeout = 0;*/
interruptible_sleep_on (&n_hdlc->read_wait);
if (signal_pending(current))
return -EINTR;
}
-
+
if (rbuf->count > nr) {
/* frame too large for caller's buffer (discard frame) */
ret = (rw_ret_t)-EOVERFLOW;
@@ -739,13 +776,13 @@ static rw_ret_t n_hdlc_tty_write (struct tty_struct *tty, struct file *file,
return -EIO;
/* verify frame size */
- if (count > MAX_HDLC_FRAME_SIZE) {
+ if (count > maxframe ) {
if (debuglevel & DEBUG_LEVEL_INFO)
printk (KERN_WARNING
"n_hdlc_tty_write: truncating user packet "
"from %lu to %d\n", (unsigned long) count,
- MAX_HDLC_FRAME_SIZE);
- count = MAX_HDLC_FRAME_SIZE;
+ maxframe );
+ count = maxframe;
}
/* Allocate transmit buffer */
@@ -754,8 +791,7 @@ static rw_ret_t n_hdlc_tty_write (struct tty_struct *tty, struct file *file,
/* sleep until transmit buffer available */
add_wait_queue(&n_hdlc->write_wait, &wait);
while (!tbuf) {
- /* TODO: no timeout? current->timeout = 0;*/
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
schedule();
n_hdlc = tty2n_hdlc (tty);
@@ -773,7 +809,7 @@ static rw_ret_t n_hdlc_tty_write (struct tty_struct *tty, struct file *file,
tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list);
}
- current->state = TASK_RUNNING;
+ set_current_state(TASK_RUNNING);
remove_wait_queue(&n_hdlc->write_wait, &wait);
}
@@ -1000,16 +1036,20 @@ static struct n_hdlc *n_hdlc_alloc (void)
/* allocate free rx buffer list */
for(i=0;i<DEFAULT_RX_BUF_COUNT;i++) {
- buf = (N_HDLC_BUF*)kmalloc(sizeof(N_HDLC_BUF),GFP_KERNEL);
+ buf = (N_HDLC_BUF*)kmalloc(N_HDLC_BUF_SIZE,GFP_KERNEL);
if (buf)
n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,buf);
+ else if (debuglevel >= DEBUG_LEVEL_INFO)
+ printk("%s(%d)n_hdlc_alloc(), kalloc() failed for rx buffer %d\n",__FILE__,__LINE__, i);
}
- /* allocate free rx buffer list */
+ /* allocate free tx buffer list */
for(i=0;i<DEFAULT_TX_BUF_COUNT;i++) {
- buf = (N_HDLC_BUF*)kmalloc(sizeof(N_HDLC_BUF),GFP_KERNEL);
+ buf = (N_HDLC_BUF*)kmalloc(N_HDLC_BUF_SIZE,GFP_KERNEL);
if (buf)
n_hdlc_buf_put(&n_hdlc->tx_free_buf_list,buf);
+ else if (debuglevel >= DEBUG_LEVEL_INFO)
+ printk("%s(%d)n_hdlc_alloc(), kalloc() failed for tx buffer %d\n",__FILE__,__LINE__, i);
}
/* Initialize the control block */
@@ -1108,7 +1148,14 @@ int init_module(void)
static struct tty_ldisc n_hdlc_ldisc;
int status;
- printk("HDLC line discipline: version %s\n", szVersion);
+ /* range check maxframe arg */
+ if ( maxframe<4096)
+ maxframe=4096;
+ else if ( maxframe>65535)
+ maxframe=65535;
+
+ printk("HDLC line discipline: version %s, maxframe=%u\n",
+ szVersion, maxframe);
/* Register the tty discipline */
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index d95cda30e..9027aa67e 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -604,7 +604,7 @@ send_signal:
tty->canon_head = tty->read_head;
tty->canon_data++;
if (tty->fasync)
- kill_fasync(tty->fasync, SIGIO);
+ kill_fasync(tty->fasync, SIGIO, POLL_IN);
if (waitqueue_active(&tty->read_wait))
wake_up_interruptible(&tty->read_wait);
return;
@@ -706,7 +706,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) {
if (tty->fasync)
- kill_fasync(tty->fasync, SIGIO);
+ kill_fasync(tty->fasync, SIGIO, POLL_IN);
if (waitqueue_active(&tty->read_wait))
wake_up_interruptible(&tty->read_wait);
}
@@ -854,6 +854,7 @@ static inline int copy_from_read_buf(struct tty_struct *tty,
retval = 0;
n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
if (n) {
+ mb();
retval = copy_to_user(*b, &tty->read_buf[tty->read_tail], n);
n -= retval;
tty->read_tail = (tty->read_tail + n) & (N_TTY_BUF_SIZE-1);
diff --git a/drivers/char/pc110pad.c b/drivers/char/pc110pad.c
index 0c00dcfa5..7e4518e15 100644
--- a/drivers/char/pc110pad.c
+++ b/drivers/char/pc110pad.c
@@ -30,6 +30,8 @@
#include <asm/signal.h>
#include <asm/io.h>
#include <asm/irq.h>
+#include <asm/semaphore.h>
+#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include "pc110pad.h"
@@ -51,7 +53,7 @@ static struct pc110pad_params current_params;
static wait_queue_head_t queue;
static struct fasync_struct *asyncptr;
static int active=0; /* number of concurrent open()s */
-
+static struct semaphore read_lock;
/*
* Utility to reset a timer to go off some time in the future.
@@ -75,7 +77,7 @@ static void wake_readers(void)
{
wake_up_interruptible(&queue);
if(asyncptr)
- kill_fasync(asyncptr, SIGIO);
+ kill_fasync(asyncptr, SIGIO, POLL_IN);
}
@@ -503,10 +505,13 @@ static int close_pad(struct inode * inode, struct file * file)
*/
static int open_pad(struct inode * inode, struct file * file)
{
+ unsigned long flags;
+
if (active++)
return 0;
MOD_INC_USE_COUNT;
+ save_flags(flags);
cli();
outb(0x30, current_params.io+2); /* switch off digitiser */
pad_irq(0,0,0); /* read to flush any pending bytes */
@@ -522,7 +527,7 @@ static int open_pad(struct inode * inode, struct file * file)
synthesize_tap=0;
del_timer(&bounce_timer);
del_timer(&tap_timer);
- sti();
+ restore_flags(flags);
return 0;
}
@@ -556,14 +561,19 @@ static ssize_t read_pad(struct file * file, char * buffer, size_t count, loff_t
{
int r;
+ down(&read_lock);
for(r=0; r<count; r++)
{
if(!read_byte_count)
new_sample(read_bytes);
if(put_user(read_bytes[read_byte_count], buffer+r))
- return -EFAULT;
+ {
+ r = -EFAULT;
+ break;
+ }
read_byte_count = (read_byte_count+1)%3;
}
+ up(&read_lock);
return r;
}
@@ -681,6 +691,7 @@ static void pc110pad_unload(void)
int init_module(void)
{
+ init_MUTEX(&read_lock);
return pc110pad_init();
}
diff --git a/drivers/char/pc_keyb.c b/drivers/char/pc_keyb.c
index 2acab7d8f..1118cf950 100644
--- a/drivers/char/pc_keyb.c
+++ b/drivers/char/pc_keyb.c
@@ -37,6 +37,8 @@
#include <asm/irq.h>
#include <asm/system.h>
+#include <asm/io.h>
+
/* Some configuration switches are present in the include file... */
#include <linux/pc_keyb.h>
@@ -100,7 +102,6 @@ static unsigned char mouse_reply_expected = 0;
static void kb_wait(void)
{
unsigned long timeout = KBC_TIMEOUT;
- unsigned char status;
do {
/*
@@ -404,7 +405,7 @@ static inline void handle_mouse_event(unsigned char scancode)
if (head != queue->tail) {
queue->head = head;
if (queue->fasync)
- kill_fasync(queue->fasync, SIGIO);
+ kill_fasync(queue->fasync, SIGIO, POLL_IN);
wake_up_interruptible(&queue->proc_list);
}
}
@@ -421,32 +422,43 @@ static inline void handle_mouse_event(unsigned char scancode)
static unsigned char handle_kbd_event(void)
{
unsigned char status = kbd_read_status();
+ unsigned int work = 10000;
while (status & KBD_STAT_OBF) {
unsigned char scancode;
scancode = kbd_read_input();
-
if (status & KBD_STAT_MOUSE_OBF) {
handle_mouse_event(scancode);
} else {
+#ifdef CONFIG_VT
if (do_acknowledge(scancode))
handle_scancode(scancode, !(scancode & 0x80));
+#endif
mark_bh(KEYBOARD_BH);
}
status = kbd_read_status();
+
+ if(!work--)
+ {
+ printk(KERN_ERR "pc_keyb: controller jammed (0x%02X).\n",
+ status);
+ break;
+ }
}
return status;
}
+
static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned long flags;
+#ifdef CONFIG_VT
kbd_pt_regs = regs;
-
+#endif
spin_lock_irqsave(&kbd_controller_lock, flags);
handle_kbd_event();
spin_unlock_irqrestore(&kbd_controller_lock, flags);
@@ -660,9 +672,9 @@ static char * __init initialize_kbd(void)
kbd_write_command_w(KBD_CCMD_WRITE_MODE);
kbd_write_output_w(KBD_MODE_KBD_INT
- | KBD_MODE_SYS
- | KBD_MODE_DISABLE_MOUSE
- | KBD_MODE_KCC);
+ | KBD_MODE_SYS
+ | KBD_MODE_DISABLE_MOUSE
+ | KBD_MODE_KCC);
/* ibm powerpc portables need this to use scan-code set 1 -- Cort */
kbd_write_command_w(KBD_CCMD_READ_MODE);
@@ -697,6 +709,8 @@ static char * __init initialize_kbd(void)
void __init pckbd_init_hw(void)
{
+ kbd_request_region();
+
/* Flush any pending input. */
kbd_clear_input();
@@ -832,7 +846,7 @@ static int release_aux(struct inode * inode, struct file * file)
return 0;
kbd_write_cmd(AUX_INTS_OFF); /* Disable controller ints */
kbd_write_command_w(KBD_CCMD_MOUSE_DISABLE);
- aux_free_irq(inode);
+ aux_free_irq(AUX_DEV);
return 0;
}
@@ -847,7 +861,7 @@ static int open_aux(struct inode * inode, struct file * file)
return 0;
}
queue->head = queue->tail = 0; /* Flush input queue */
- if (aux_request_irq(keyboard_interrupt, inode)) {
+ if (aux_request_irq(keyboard_interrupt, AUX_DEV)) {
aux_count--;
return -EBUSY;
}
diff --git a/drivers/char/pms.c b/drivers/char/pms.c
index 72653aa19..c96570b73 100644
--- a/drivers/char/pms.c
+++ b/drivers/char/pms.c
@@ -22,6 +22,7 @@
#include <linux/malloc.h>
#include <linux/mm.h>
#include <linux/ioport.h>
+#include <linux/init.h>
#include <asm/io.h>
#include <linux/sched.h>
#include <linux/videodev.h>
@@ -1024,21 +1025,11 @@ static int init_mediavision(void)
return 0;
}
-static void shutdown_mediavision(void)
-{
- release_region(io_port,3);
- release_region(0x9A01, 1);
-}
-
/*
- * Module stuff
+ * Initialization and module stuff
*/
-#ifdef MODULE
-int init_module(void)
-#else
-int init_pms_cards(struct video_init *v)
-#endif
+static int __init init_pms_cards(void)
{
printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n");
@@ -1057,15 +1048,21 @@ int init_pms_cards(struct video_init *v)
return video_register_device((struct video_device *)&pms_device, VFL_TYPE_GRABBER);
}
-#ifdef MODULE
-
MODULE_PARM(io_port,"i");
MODULE_PARM(mem_base,"i");
-void cleanup_module(void)
+static void __exit shutdown_mediavision(void)
+{
+ release_region(io_port,3);
+ release_region(0x9A01, 1);
+}
+
+static void __exit cleanup_pms_module(void)
{
shutdown_mediavision();
video_unregister_device((struct video_device *)&pms_device);
}
-#endif
+module_init(init_pms_cards);
+module_exit(cleanup_pms_module);
+
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index c210b0785..d73f128d8 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -34,8 +34,12 @@
* YIELD parport_yield_blocking
* WCTLONIRQ on interrupt, set control lines
* CLRIRQ clear (and return) interrupt count
+ * SETTIME sets device timeout (struct timeval)
+ * GETTIME gets device timeout (struct timeval)
* read/write read or write in current IEEE 1284 protocol
* select wait for interrupt (in readfds)
+ *
+ * Added SETTIME/GETTIME ioctl, Fred Barnes 1999.
*/
#include <linux/module.h>
@@ -74,6 +78,9 @@ struct pp_struct {
#define PP_BUFFER_SIZE 256
#define PARDEVICE_MAX 8
+/* ROUND_UP macro from fs/select.c */
+#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
+
static inline void enable_irq (struct pp_struct *pp)
{
struct parport *port = pp->pdev->port;
@@ -356,6 +363,8 @@ static int pp_ioctl(struct inode *inode, struct file *file,
unsigned char mask;
int mode;
int ret;
+ struct timeval par_timeout;
+ long to_jiffies;
case PPRSTATUS:
reg = parport_read_status (port);
@@ -451,6 +460,33 @@ static int pp_ioctl(struct inode *inode, struct file *file,
atomic_sub (ret, &pp->irqc);
return 0;
+ case PPSETTIME:
+ if (copy_from_user (&par_timeout, (struct timeval *)arg,
+ sizeof(struct timeval))) {
+ return -EFAULT;
+ }
+ /* Convert to jiffies, place in pp->pdev->timeout */
+ if ((par_timeout.tv_sec < 0) || (par_timeout.tv_usec < 0)) {
+ return -EINVAL;
+ }
+ to_jiffies = ROUND_UP(par_timeout.tv_usec, 1000000/HZ);
+ to_jiffies += par_timeout.tv_sec * (long)HZ;
+ if (to_jiffies <= 0) {
+ return -EINVAL;
+ }
+ pp->pdev->timeout = to_jiffies;
+ return 0;
+
+ case PPGETTIME:
+ to_jiffies = pp->pdev->timeout;
+ par_timeout.tv_sec = to_jiffies / HZ;
+ par_timeout.tv_usec = (to_jiffies % (long)HZ) * (1000000/HZ);
+ if (copy_to_user ((struct timeval *)arg, &par_timeout,
+ sizeof(struct timeval))) {
+ return -EFAULT;
+ }
+ return 0;
+
default:
printk (KERN_DEBUG CHRDEV "%x: What? (cmd=0x%x)\n", minor,
cmd);
diff --git a/drivers/char/ppdev.h b/drivers/char/ppdev.h
index 976374aed..f466f11e6 100644
--- a/drivers/char/ppdev.h
+++ b/drivers/char/ppdev.h
@@ -10,6 +10,7 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
+ * Added PPGETTIME/PPSETTIME, Fred Barnes, 1999
*/
#define PP_MAJOR 99
@@ -72,3 +73,9 @@ struct ppdev_frob_struct {
/* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */
#define PPSETPHASE _IOW(PP_IOCTL, 0x94, int)
+
+/* Set and get port timeout (struct timeval's) */
+#define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval)
+#define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval)
+
+
diff --git a/drivers/char/qpmouse.c b/drivers/char/qpmouse.c
index 8d5f9aa34..3de17ad5c 100644
--- a/drivers/char/qpmouse.c
+++ b/drivers/char/qpmouse.c
@@ -134,7 +134,7 @@ static void qp_interrupt(int cpl, void *dev_id, struct pt_regs * regs)
}
queue->head = head;
if (queue->fasync)
- kill_fasync(queue->fasync, SIGIO);
+ kill_fasync(queue->fasync, SIGIO, POLL_IN);
wake_up_interruptible(&queue->proc_list);
}
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7d99d5b68..17711734f 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -661,25 +661,31 @@ static inline ssize_t do_tty_write(
if (down_interruptible(&inode->i_sem)) {
return -ERESTARTSYS;
}
- for (;;) {
- unsigned long size = PAGE_SIZE*2;
- if (size > count)
- size = count;
+ if ( test_bit(TTY_NO_WRITE_SPLIT, &tty->flags) ) {
lock_kernel();
- ret = write(tty, file, buf, size);
+ written = write(tty, file, buf, count);
unlock_kernel();
- if (ret <= 0)
- break;
- written += ret;
- buf += ret;
- count -= ret;
- if (!count)
- break;
- ret = -ERESTARTSYS;
- if (signal_pending(current))
- break;
- if (current->need_resched)
- schedule();
+ } else {
+ for (;;) {
+ unsigned long size = PAGE_SIZE*2;
+ if (size > count)
+ size = count;
+ lock_kernel();
+ ret = write(tty, file, buf, size);
+ unlock_kernel();
+ if (ret <= 0)
+ break;
+ written += ret;
+ buf += ret;
+ count -= ret;
+ if (!count)
+ break;
+ ret = -ERESTARTSYS;
+ if (signal_pending(current))
+ break;
+ if (current->need_resched)
+ schedule();
+ }
}
if (written) {
file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
@@ -1996,7 +2002,8 @@ int tty_unregister_driver(struct tty_driver *driver)
{
int retval;
struct tty_driver *p;
- int found = 0;
+ int i, found = 0;
+ struct termios *tp;
const char *othername = NULL;
if (*driver->refcount)
@@ -2027,6 +2034,23 @@ int tty_unregister_driver(struct tty_driver *driver)
if (driver->next)
driver->next->prev = driver->prev;
+ /*
+ * Free the termios and termios_locked structures because
+ * we don't want to get memory leaks when modular tty
+ * drivers are removed from the kernel.
+ */
+ for (i = 0; i < driver->num; i++) {
+ tp = driver->termios[i];
+ if (tp) {
+ driver->termios[i] = NULL;
+ kfree_s(tp, sizeof(struct termios));
+ }
+ tp = driver->termios_locked[i];
+ if (tp) {
+ driver->termios_locked[i] = NULL;
+ kfree_s(tp, sizeof(struct termios));
+ }
+ }
proc_tty_unregister_driver(driver);
return 0;
}