Update of /cvsroot/linux-vax/kernel-2.5/drivers/vax/char
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14801
Modified Files:
dz.c dz.h
Log Message:
In 2.6.10, TTY drivers no longer have to worry about copying data from
user space in their .write function.
Index: dz.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/vax/char/dz.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dz.h 19 Nov 2004 12:50:05 -0000 1.1
+++ dz.h 22 Mar 2005 09:20:12 -0000 1.2
@@ -234,7 +234,7 @@
static void dz_hangup (struct tty_struct *);
static void show_serial_version (void);
-static int dz_write (struct tty_struct *, int, const unsigned char *, int);
+static int dz_write (struct tty_struct *, const unsigned char *, int);
static int dz_write_room (struct tty_struct *);
static int dz_chars_in_buffer (struct tty_struct *);
static int startup (struct dz_serial *);
Index: dz.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/vax/char/dz.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- dz.c 19 Nov 2004 12:50:05 -0000 1.1
+++ dz.c 22 Mar 2005 09:20:12 -0000 1.2
@@ -674,7 +674,7 @@
* main output routine.
* -------------------------------------------------------------------
*/
-static int dz_write (struct tty_struct *tty, int from_user,
+static int dz_write (struct tty_struct *tty,
const unsigned char *buf, int count)
{
struct dz_serial *info;
@@ -690,56 +690,23 @@
if (!tmp_buf)
tmp_buf = tmp_buffer;
- if (from_user) {
- down (&tmp_buf_sem);
- while (1) {
- c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
- DZ_XMIT_SIZE - info->xmit_head));
- if (c <= 0)
- break;
-
- c -= copy_from_user (tmp_buf, buf, c);
- if (!c) {
- if (!ret)
- ret = -EFAULT;
- break;
- }
-
- save_and_cli(flags);
-
- c = MIN(c, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
- DZ_XMIT_SIZE - info->xmit_head));
- memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c);
- info->xmit_head = ((info->xmit_head + c) &
- (DZ_XMIT_SIZE - 1));
- info->xmit_cnt += c;
- restore_flags(flags);
+ while (1) {
+ save_and_cli(flags);
- buf += c;
- count -= c;
- ret += c;
+ c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
+ DZ_XMIT_SIZE - info->xmit_head));
+ if (c <= 0) {
+ restore_flags (flags);
+ break;
}
- up(&tmp_buf_sem);
- } else {
- while (1) {
- save_and_cli(flags);
-
- c = MIN(count, MIN(DZ_XMIT_SIZE - info->xmit_cnt - 1,
- DZ_XMIT_SIZE - info->xmit_head));
- if (c <= 0) {
- restore_flags (flags);
- break;
- }
- memcpy(info->xmit_buf + info->xmit_head, buf, c);
- info->xmit_head = ((info->xmit_head + c) &
- (DZ_XMIT_SIZE-1));
- info->xmit_cnt += c;
- restore_flags(flags);
+ memcpy(info->xmit_buf + info->xmit_head, buf, c);
+ info->xmit_head = ((info->xmit_head + c) & (DZ_XMIT_SIZE-1));
+ info->xmit_cnt += c;
+ restore_flags(flags);
- buf += c;
- count -= c;
- ret += c;
- }
+ buf += c;
+ count -= c;
+ ret += c;
}
if (info->xmit_cnt) {
@@ -1255,7 +1222,7 @@
unsigned long flags;
spin_lock_irqsave (&dz_serio_lock, flags);
- dz_write (info->tty, 0, &one_byte, sizeof (one_byte));
+ dz_write (info->tty, &one_byte, sizeof (one_byte));
spin_unlock_irqrestore (&dz_serio_lock, flags);
return 0;
|