From: <ai...@us...> - 2003-09-27 09:22:36
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory sc8-pr-cvs1:/tmp/cvs-serv26117/drivers/char Modified Files: Makefile tty_io.c Log Message: Merge 2.4.21 - build fixes Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile 27 Sep 2003 07:43:27 -0000 1.8 +++ Makefile 27 Sep 2003 09:21:13 -0000 1.9 @@ -24,7 +24,7 @@ export-objs := busmouse.o console.o keyboard.o sysrq.o \ misc.o pty.o random.o selection.o serial.o \ sonypi.o tty_io.o tty_ioctl.o generic_serial.o \ - au1000_gpio.o hp_psaux.o nvram.o + au1000_gpio.o hp_psaux.o nvram.o scx200.o mod-subdirs := joystick ftape drm drm-4.0 pcmcia @@ -66,6 +66,20 @@ SERIAL = endif +ifeq ($(ARCH),parisc) + ifdef CONFIG_GSC_PS2 + KEYBD = hp_psaux.o hp_keyb.o + else + KEYBD = + endif + ifdef CONFIG_SERIAL_MUX + CONSOLE += mux.o + endif + ifdef CONFIG_PDC_CONSOLE + CONSOLE += pdc_console.o + endif +endif + ifdef CONFIG_Q40 KEYBD += q40_keyb.o SERIAL = serial.o @@ -208,6 +222,7 @@ obj-$(CONFIG_ATIXL_BUSMOUSE) += atixlmouse.o obj-$(CONFIG_LOGIBUSMOUSE) += logibusmouse.o obj-$(CONFIG_PRINTER) += lp.o +obj-$(CONFIG_TIPAR) += tipar.o ifeq ($(CONFIG_INPUT),y) obj-y += joystick/js.o @@ -226,6 +241,7 @@ obj-$(CONFIG_PC110_PAD) += pc110pad.o obj-$(CONFIG_MK712_MOUSE) += mk712.o obj-$(CONFIG_RTC) += rtc.o +obj-$(CONFIG_GEN_RTC) += genrtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o ifeq ($(CONFIG_PPC),) obj-$(CONFIG_NVRAM) += nvram.o @@ -260,6 +276,7 @@ obj-$(CONFIG_SERIAL_IPR) += generic_serial.o obj-$(CONFIG_NWBUTTON) += nwbutton.o obj-$(CONFIG_NWFLASH) += nwflash.o +obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o scx200.o # Only one watchdog can succeed. We probe the hardware watchdog # drivers first, then the softdog driver. This means if your hardware @@ -283,9 +300,10 @@ obj-$(CONFIG_SH_WDT) += shwdt.o obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o -#obj-$(CONFIG_ALIM1535_WDT) += alim1535d_wdt.o +obj-$(CONFIG_ALIM1535_WDT) += alim1535d_wdt.o obj-$(CONFIG_INDYDOG) += indydog.o obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o +obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o obj-$(CONFIG_AMD7XX_TCO) += amd7xx_tco.o @@ -293,6 +311,11 @@ subdir-$(CONFIG_MWAVE) += mwave ifeq ($(CONFIG_MWAVE),y) obj-y += mwave/mwave.o +endif + +subdir-$(CONFIG_IPMI_HANDLER) += ipmi +ifeq ($(CONFIG_IPMI_HANDLER),y) + obj-y += ipmi/ipmi.o endif include $(TOPDIR)/Rules.make Index: tty_io.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/tty_io.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- tty_io.c 27 Sep 2003 07:43:27 -0000 1.11 +++ tty_io.c 27 Sep 2003 09:21:13 -0000 1.12 @@ -127,12 +127,6 @@ extern struct tty_driver pts_driver[]; /* Unix98 pty slaves; for /dev/ptmx */ #endif -/* - * redirect is the pseudo-tty that console output - * is redirected to if asked by TIOCCONS. - */ -struct tty_struct * redirect; - static void initialize_tty_struct(struct tty_struct *tty); static ssize_t tty_read(struct file *, char *, size_t, loff_t *); @@ -427,6 +421,8 @@ release: tty_release, }; +static spinlock_t redirect_lock = SPIN_LOCK_UNLOCKED; +static struct file *redirect; /* * This can be called by the "eventd" kernel thread. That is process synchronous, * but doesn't hold any locks, so we need to make sure we have the appropriate @@ -436,6 +432,7 @@ { struct tty_struct *tty = (struct tty_struct *) data; struct file * cons_filp = NULL; + struct file *f = NULL; struct task_struct *p; struct list_head *l; int closecount = 0, n; @@ -445,6 +442,15 @@ /* inuse_filps is protected by the single kernel lock */ lock_kernel(); + + spin_lock(&redirect_lock); + if (redirect && redirect->private_data == tty) { + f = redirect; + redirect = NULL; + } + spin_unlock(&redirect_lock); + if (f) + fput(f); check_tty_count(tty, "do_tty_hangup"); file_list_lock(); @@ -743,7 +749,7 @@ { int is_console; struct tty_struct * tty; - struct inode *inode; + struct inode *inode = file->f_dentry->d_inode; /* Can't seek (pwrite) on ttys. */ if (ppos != &file->f_pos) @@ -757,10 +763,24 @@ is_console = (inode->i_rdev == SYSCONS_DEV || inode->i_rdev == CONSOLE_DEV); - if (is_console && redirect) - tty = redirect; - else - tty = (struct tty_struct *)file->private_data; + if (is_console) { + struct file *p = NULL; + + spin_lock(&redirect_lock); + if (redirect) { + get_file(redirect); + p = redirect; + } + spin_unlock(&redirect_lock); + + if (p) { + ssize_t res = p->f_op->write(p, buf, count, &p->f_pos); + fput(p); + return res; + } + } + + tty = (struct tty_struct *)file->private_data; if (tty_paranoia_check(tty, inode->i_rdev, "tty_write")) return -EIO; if (!tty || !tty->driver.write || (test_bit(TTY_IO_ERROR, &tty->flags))) @@ -1223,7 +1243,7 @@ /* * If _either_ side is closing, make sure there aren't any * processes that still think tty or o_tty is their controlling - * tty. Also, clear redirect if it points to either tty. + * tty. */ if (tty_closing || o_tty_closing) { struct task_struct *p; @@ -1234,9 +1254,6 @@ p->tty = NULL; } read_unlock(&tasklist_lock); - - if (redirect == tty || (o_tty && redirect == o_tty)) - redirect = NULL; } /* check whether both sides are closing ... */ @@ -1515,19 +1532,29 @@ return 0; } -static int tioccons(struct inode *inode, - struct tty_struct *tty, struct tty_struct *real_tty) +static int tioccons(struct inode *inode, struct file *file) { if (inode->i_rdev == SYSCONS_DEV || inode->i_rdev == CONSOLE_DEV) { + struct file *f; if (!suser()) return -EPERM; + spin_lock(&redirect_lock); + f = redirect; redirect = NULL; + spin_unlock(&redirect_lock); + if (f) + fput(f); return 0; } - if (redirect) + spin_lock(&redirect_lock); + if (redirect) { + spin_unlock(&redirect_lock); return -EBUSY; - redirect = real_tty; + } + get_file(file); + redirect = file; + spin_unlock(&redirect_lock); return 0; } @@ -1747,7 +1774,7 @@ case TIOCSWINSZ: return tiocswinsz(tty, real_tty, (struct winsize *) arg); case TIOCCONS: - return tioccons(inode, tty, real_tty); + return real_tty!=tty ? -EINVAL : tioccons(inode, file); case FIONBIO: return fionbio(file, (int *) arg); case TIOCEXCL: |