aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/configfs/configfs.txt10
-rw-r--r--Documentation/filesystems/configfs/configfs_example.c14
-rw-r--r--Documentation/serial/driver11
-rw-r--r--arch/cris/arch-v10/boot/Makefile1
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile14
-rw-r--r--arch/cris/arch-v10/boot/compressed/decompress.ld3
-rw-r--r--arch/cris/arch-v10/boot/compressed/head.S98
-rw-r--r--arch/cris/arch-v10/boot/compressed/misc.c144
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile9
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c2
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c20
-rw-r--r--arch/cris/arch-v32/boot/Makefile1
-rw-r--r--arch/cris/arch-v32/boot/compressed/Makefile6
-rw-r--r--arch/cris/arch-v32/boot/rescue/Makefile3
-rw-r--r--arch/cris/arch-v32/drivers/pcf8563.c2
-rw-r--r--arch/ia64/hp/sim/simserial.c46
-rw-r--r--arch/m68k/Kconfig36
-rw-r--r--arch/m68k/Makefile2
-rw-r--r--arch/m68k/amiga/config.c22
-rw-r--r--arch/m68k/atari/debug.c37
-rw-r--r--arch/m68k/fpsp040/Makefile1
-rw-r--r--arch/m68k/ifpsp060/Makefile1
-rw-r--r--arch/m68k/kernel/Makefile2
-rw-r--r--arch/m68k/kernel/setup.c9
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds3
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds7
-rw-r--r--arch/m68k/lib/Makefile2
-rw-r--r--arch/m68k/mac/Makefile2
-rw-r--r--arch/m68k/mac/baboon.c26
-rw-r--r--arch/m68k/mac/bootparse.c122
-rw-r--r--arch/m68k/mac/config.c11
-rw-r--r--arch/m68k/mac/debug.c41
-rw-r--r--arch/m68k/mac/oss.c8
-rw-r--r--arch/m68k/mac/psc.c4
-rw-r--r--arch/m68k/mac/via.c2
-rw-r--r--arch/m68k/math-emu/Makefile2
-rw-r--r--arch/m68k/mm/motorola.c1
-rw-r--r--arch/m68k/mm/sun3mmu.c1
-rw-r--r--arch/m68k/q40/config.c26
-rw-r--r--arch/m68k/sun3/Makefile2
-rw-r--r--arch/m68k/sun3/config.c7
-rw-r--r--arch/m68k/sun3/dvma.c2
-rw-r--r--arch/m68k/sun3/idprom.c4
-rw-r--r--arch/m68k/sun3/mmu_emu.c2
-rw-r--r--arch/m68k/sun3/prom/Makefile1
-rw-r--r--arch/m68k/sun3/prom/console.c6
-rw-r--r--arch/m68k/sun3/prom/init.c11
-rw-r--r--arch/m68k/sun3/prom/misc.c2
-rw-r--r--arch/m68k/sun3/prom/printf.c7
-rw-r--r--arch/m68k/sun3/sbus.c27
-rw-r--r--arch/m68k/sun3/sun3dvma.c2
-rw-r--r--arch/m68k/sun3/sun3ints.c2
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c2
-rw-r--r--drivers/acpi/bay.c3
-rw-r--r--drivers/acpi/dock.c3
-rw-r--r--drivers/acpi/glue.c3
-rw-r--r--drivers/block/ataflop.c4
-rw-r--r--drivers/bluetooth/hci_ldisc.c6
-rw-r--r--drivers/char/cyclades.c342
-rw-r--r--drivers/char/epca.c110
-rw-r--r--drivers/char/epca.h7
-rw-r--r--drivers/char/esp.c272
-rw-r--r--drivers/char/generic_serial.c158
-rw-r--r--drivers/char/ip2/i2lib.c4
-rw-r--r--drivers/char/ip2/ip2main.c7
-rw-r--r--drivers/char/isicom.c215
-rw-r--r--drivers/char/istallion.c116
-rw-r--r--drivers/char/moxa.c93
-rw-r--r--drivers/char/mxser.c284
-rw-r--r--drivers/char/n_hdlc.c6
-rw-r--r--drivers/char/n_r3964.c2
-rw-r--r--drivers/char/n_tty.c2
-rw-r--r--drivers/char/nvram.c2
-rw-r--r--drivers/char/pcmcia/synclink_cs.c4
-rw-r--r--drivers/char/pty.c10
-rw-r--r--drivers/char/rio/cirrus.h3
-rw-r--r--drivers/char/rio/cmdblk.h6
-rw-r--r--drivers/char/rio/cmdpkt.h6
-rw-r--r--drivers/char/rio/daemon.h6
-rw-r--r--drivers/char/rio/errors.h6
-rw-r--r--drivers/char/rio/func.h6
-rw-r--r--drivers/char/rio/map.h4
-rw-r--r--drivers/char/rio/param.h5
-rw-r--r--drivers/char/rio/parmmap.h7
-rw-r--r--drivers/char/rio/pci.h4
-rw-r--r--drivers/char/rio/protsts.h7
-rw-r--r--drivers/char/rio/rio_linux.c25
-rw-r--r--drivers/char/rio/rioboard.h6
-rw-r--r--drivers/char/rio/riocmd.c13
-rw-r--r--drivers/char/rio/rioctrl.c4
-rw-r--r--drivers/char/rio/riodrvr.h4
-rw-r--r--drivers/char/rio/rioinfo.h4
-rw-r--r--drivers/char/rio/rioinit.c3
-rw-r--r--drivers/char/rio/riointr.c14
-rw-r--r--drivers/char/rio/rioparam.c6
-rw-r--r--drivers/char/rio/rioroute.c3
-rw-r--r--drivers/char/rio/riospace.h4
-rw-r--r--drivers/char/rio/riotable.c3
-rw-r--r--drivers/char/rio/riotty.c20
-rw-r--r--drivers/char/rio/route.h6
-rw-r--r--drivers/char/rio/unixrup.h4
-rw-r--r--drivers/char/riscom8.c187
-rw-r--r--drivers/char/riscom8.h10
-rw-r--r--drivers/char/rocket.c139
-rw-r--r--drivers/char/rocket.h4
-rw-r--r--drivers/char/rocket_int.h11
-rw-r--r--drivers/char/selection.c3
-rw-r--r--drivers/char/specialix.c153
-rw-r--r--drivers/char/specialix_io8.h8
-rw-r--r--drivers/char/stallion.c160
-rw-r--r--drivers/char/sx.c115
-rw-r--r--drivers/char/synclink.c213
-rw-r--r--drivers/char/synclink_gt.c219
-rw-r--r--drivers/char/synclinkmp.c219
-rw-r--r--drivers/char/tty_io.c420
-rw-r--r--drivers/char/tty_ioctl.c16
-rw-r--r--drivers/dio/dio-driver.c14
-rw-r--r--drivers/input/keyboard/atakbd.c2
-rw-r--r--drivers/input/serio/serport.c2
-rw-r--r--drivers/isdn/capi/capi.c4
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c2
-rw-r--r--drivers/net/Kconfig9
-rw-r--r--drivers/net/ariadne.c47
-rw-r--r--drivers/net/hamradio/6pack.c2
-rw-r--r--drivers/net/hamradio/mkiss.c2
-rw-r--r--drivers/net/irda/irtty-sir.c2
-rw-r--r--drivers/net/netconsole.c10
-rw-r--r--drivers/net/ppp_async.c2
-rw-r--r--drivers/net/ppp_synctty.c2
-rw-r--r--drivers/net/slip.c2
-rw-r--r--drivers/net/wan/pc300_tty.c4
-rw-r--r--drivers/net/wan/x25_asy.c2
-rw-r--r--drivers/net/wireless/strip.c2
-rw-r--r--drivers/serial/21285.c12
-rw-r--r--drivers/serial/68328serial.c30
-rw-r--r--drivers/serial/68360serial.c52
-rw-r--r--drivers/serial/8250.c8
-rw-r--r--drivers/serial/8250.h2
-rw-r--r--drivers/serial/8250_pci.c2
-rw-r--r--drivers/serial/8250_pnp.c2
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/serial/Makefile2
-rw-r--r--drivers/serial/amba-pl010.c8
-rw-r--r--drivers/serial/amba-pl011.c4
-rw-r--r--drivers/serial/atmel_serial.c21
-rw-r--r--drivers/serial/bfin_5xx.c10
-rw-r--r--drivers/serial/bfin_sport_uart.c4
-rw-r--r--drivers/serial/clps711x.c9
-rw-r--r--drivers/serial/crisv10.c79
-rw-r--r--drivers/serial/dz.c4
-rw-r--r--drivers/serial/imx.c2
-rw-r--r--drivers/serial/ioc3_serial.c14
-rw-r--r--drivers/serial/ioc4_serial.c21
-rw-r--r--drivers/serial/ip22zilog.c4
-rw-r--r--drivers/serial/jsm/jsm_neo.c2
-rw-r--r--drivers/serial/jsm/jsm_tty.c8
-rw-r--r--drivers/serial/m32r_sio.c6
-rw-r--r--drivers/serial/mcf.c2
-rw-r--r--drivers/serial/mcfserial.c32
-rw-r--r--drivers/serial/mpc52xx_uart.c2
-rw-r--r--drivers/serial/mpsc.c6
-rw-r--r--drivers/serial/mux.c2
-rw-r--r--drivers/serial/netx-serial.c2
-rw-r--r--drivers/serial/pmac_zilog.c4
-rw-r--r--drivers/serial/pnx8xxx_uart.c4
-rw-r--r--drivers/serial/pxa.c2
-rw-r--r--drivers/serial/sa1100.c9
-rw-r--r--drivers/serial/sb1250-duart.c2
-rw-r--r--drivers/serial/sc26xx.c2
-rw-r--r--drivers/serial/serial_core.c82
-rw-r--r--drivers/serial/serial_ks8695.c2
-rw-r--r--drivers/serial/serial_lh7a40x.c2
-rw-r--r--drivers/serial/sh-sci.c8
-rw-r--r--drivers/serial/sn_console.c2
-rw-r--r--drivers/serial/sunhv.c2
-rw-r--r--drivers/serial/sunsab.c2
-rw-r--r--drivers/serial/sunsu.c4
-rw-r--r--drivers/serial/sunzilog.c4
-rw-r--r--drivers/serial/uartlite.c4
-rw-r--r--drivers/serial/ucc_uart.c2
-rw-r--r--drivers/serial/v850e_uart.c4
-rw-r--r--drivers/serial/vr41xx_siu.c2
-rw-r--r--drivers/serial/zs.c2
-rw-r--r--drivers/video/amifb.c3
-rw-r--r--drivers/video/atafb.c5
-rw-r--r--drivers/video/c2p.c3
-rw-r--r--drivers/zorro/proc.c4
-rw-r--r--drivers/zorro/zorro-sysfs.c10
-rw-r--r--drivers/zorro/zorro.c2
-rw-r--r--drivers/zorro/zorro.ids2
-rw-r--r--fs/configfs/dir.c28
-rw-r--r--fs/dlm/config.c45
-rw-r--r--fs/ocfs2/cluster/heartbeat.c19
-rw-r--r--fs/ocfs2/cluster/nodemanager.c49
-rw-r--r--fs/proc/proc_tty.c48
-rw-r--r--include/asm-avr32/ioctls.h4
-rw-r--r--include/asm-cris/Kbuild5
-rw-r--r--include/asm-frv/ioctls.h4
-rw-r--r--include/asm-frv/termbits.h5
-rw-r--r--include/asm-m68k/amigahw.h4
-rw-r--r--include/asm-m68k/amigaints.h2
-rw-r--r--include/asm-m68k/apollodma.h2
-rw-r--r--include/asm-m68k/dvma.h4
-rw-r--r--include/asm-m68k/fpu.h10
-rw-r--r--include/asm-m68k/irq.h2
-rw-r--r--include/asm-m68k/mac_baboon.h2
-rw-r--r--include/asm-m68k/mac_via.h1
-rw-r--r--include/asm-m68k/machines.h4
-rw-r--r--include/asm-m68k/macintosh.h5
-rw-r--r--include/asm-m68k/md.h2
-rw-r--r--include/asm-m68k/openprom.h1
-rw-r--r--include/asm-m68k/oplib.h3
-rw-r--r--include/asm-m68k/sbus.h5
-rw-r--r--include/asm-m68k/sun3-head.h1
-rw-r--r--include/asm-m68k/tlbflush.h8
-rw-r--r--include/linux/configfs.h7
-rw-r--r--include/linux/cyclades.h13
-rw-r--r--include/linux/generic_serial.h8
-rw-r--r--include/linux/hayesesp.h9
-rw-r--r--include/linux/istallion.h6
-rw-r--r--include/linux/serial_core.h27
-rw-r--r--include/linux/stallion.h6
-rw-r--r--include/linux/tty.h204
-rw-r--r--include/linux/tty_ldisc.h7
-rw-r--r--init/main.c5
-rw-r--r--net/bluetooth/rfcomm/tty.c13
-rw-r--r--net/irda/ircomm/ircomm_tty.c14
227 files changed, 2618 insertions, 3140 deletions
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt
index 15838d706ea2..44c97e6accb2 100644
--- a/Documentation/filesystems/configfs/configfs.txt
+++ b/Documentation/filesystems/configfs/configfs.txt
@@ -233,12 +233,10 @@ accomplished via the group operations specified on the group's
233config_item_type. 233config_item_type.
234 234
235 struct configfs_group_operations { 235 struct configfs_group_operations {
236 int (*make_item)(struct config_group *group, 236 struct config_item *(*make_item)(struct config_group *group,
237 const char *name, 237 const char *name);
238 struct config_item **new_item); 238 struct config_group *(*make_group)(struct config_group *group,
239 int (*make_group)(struct config_group *group, 239 const char *name);
240 const char *name,
241 struct config_group **new_group);
242 int (*commit_item)(struct config_item *item); 240 int (*commit_item)(struct config_item *item);
243 void (*disconnect_notify)(struct config_group *group, 241 void (*disconnect_notify)(struct config_group *group,
244 struct config_item *item); 242 struct config_item *item);
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c
index 0b422acd470c..039648791701 100644
--- a/Documentation/filesystems/configfs/configfs_example.c
+++ b/Documentation/filesystems/configfs/configfs_example.c
@@ -273,13 +273,13 @@ static inline struct simple_children *to_simple_children(struct config_item *ite
273 return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; 273 return item ? container_of(to_config_group(item), struct simple_children, group) : NULL;
274} 274}
275 275
276static int simple_children_make_item(struct config_group *group, const char *name, struct config_item **new_item) 276static struct config_item *simple_children_make_item(struct config_group *group, const char *name)
277{ 277{
278 struct simple_child *simple_child; 278 struct simple_child *simple_child;
279 279
280 simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); 280 simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL);
281 if (!simple_child) 281 if (!simple_child)
282 return -ENOMEM; 282 return ERR_PTR(-ENOMEM);
283 283
284 284
285 config_item_init_type_name(&simple_child->item, name, 285 config_item_init_type_name(&simple_child->item, name,
@@ -287,8 +287,7 @@ static int simple_children_make_item(struct config_group *group, const char *nam
287 287
288 simple_child->storeme = 0; 288 simple_child->storeme = 0;
289 289
290 *new_item = &simple_child->item; 290 return &simple_child->item;
291 return 0;
292} 291}
293 292
294static struct configfs_attribute simple_children_attr_description = { 293static struct configfs_attribute simple_children_attr_description = {
@@ -360,21 +359,20 @@ static struct configfs_subsystem simple_children_subsys = {
360 * children of its own. 359 * children of its own.
361 */ 360 */
362 361
363static int group_children_make_group(struct config_group *group, const char *name, struct config_group **new_group) 362static struct config_group *group_children_make_group(struct config_group *group, const char *name)
364{ 363{
365 struct simple_children *simple_children; 364 struct simple_children *simple_children;
366 365
367 simple_children = kzalloc(sizeof(struct simple_children), 366 simple_children = kzalloc(sizeof(struct simple_children),
368 GFP_KERNEL); 367 GFP_KERNEL);
369 if (!simple_children) 368 if (!simple_children)
370 return -ENOMEM; 369 return ERR_PTR(-ENOMEM);
371 370
372 371
373 config_group_init_type_name(&simple_children->group, name, 372 config_group_init_type_name(&simple_children->group, name,
374 &simple_children_type); 373 &simple_children_type);
375 374
376 *new_group = &simple_children->group; 375 return &simple_children->group;
377 return 0;
378} 376}
379 377
380static struct configfs_attribute group_children_attr_description = { 378static struct configfs_attribute group_children_attr_description = {
diff --git a/Documentation/serial/driver b/Documentation/serial/driver
index 88ad615dd338..77ba0afbe4db 100644
--- a/Documentation/serial/driver
+++ b/Documentation/serial/driver
@@ -186,6 +186,17 @@ hardware.
186 Locking: port_sem taken. 186 Locking: port_sem taken.
187 Interrupts: caller dependent. 187 Interrupts: caller dependent.
188 188
189 flush_buffer(port)
190 Flush any write buffers, reset any DMA state and stop any
191 ongoing DMA transfers.
192
193 This will be called whenever the port->info->xmit circular
194 buffer is cleared.
195
196 Locking: port->lock taken.
197 Interrupts: locally disabled.
198 This call must not sleep
199
189 set_termios(port,termios,oldtermios) 200 set_termios(port,termios,oldtermios)
190 Change the port parameters, including word length, parity, stop 201 Change the port parameters, including word length, parity, stop
191 bits. Update read_status_mask and ignore_status_mask to indicate 202 bits. Update read_status_mask and ignore_status_mask to indicate
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
index 20c83a53caf3..217203014433 100644
--- a/arch/cris/arch-v10/boot/Makefile
+++ b/arch/cris/arch-v10/boot/Makefile
@@ -2,7 +2,6 @@
2# arch/cris/arch-v10/boot/Makefile 2# arch/cris/arch-v10/boot/Makefile
3# 3#
4 4
5OBJCOPY = objcopy-cris
6OBJCOPYFLAGS = -O binary --remove-section=.bss 5OBJCOPYFLAGS = -O binary --remove-section=.bss
7 6
8subdir- := compressed rescue 7subdir- := compressed rescue
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
index 4a031cb27eb9..08d943ce4be7 100644
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ b/arch/cris/arch-v10/boot/compressed/Makefile
@@ -2,12 +2,10 @@
2# arch/cris/arch-v10/boot/compressed/Makefile 2# arch/cris/arch-v10/boot/compressed/Makefile
3# 3#
4 4
5CC = gcc-cris -melf $(LINUXINCLUDE) 5asflags-y += $(LINUXINCLUDE)
6ccflags-y += -O2 6ccflags-y += -O2 $(LINUXINCLUDE)
7LD = ld-cris 7ldflags-y += -T $(srctree)/$(obj)/decompress.ld
8ldflags-y += -T $(obj)/decompress.ld
9OBJECTS = $(obj)/head.o $(obj)/misc.o 8OBJECTS = $(obj)/head.o $(obj)/misc.o
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 9OBJCOPYFLAGS = -O binary --remove-section=.bss
12 10
13quiet_cmd_image = BUILD $@ 11quiet_cmd_image = BUILD $@
@@ -21,12 +19,6 @@ $(obj)/decompress.o: $(OBJECTS) FORCE
21$(obj)/decompress.bin: $(obj)/decompress.o FORCE 19$(obj)/decompress.bin: $(obj)/decompress.o FORCE
22 $(call if_changed,objcopy) 20 $(call if_changed,objcopy)
23 21
24$(obj)/head.o: $(obj)/head.S .config
25 @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
26
27$(obj)/misc.o: $(obj)/misc.c .config
28 @$(CC) -D__KERNEL__ -c $< -o $@
29
30$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE 22$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
31 $(call if_changed,image) 23 $(call if_changed,image)
32 24
diff --git a/arch/cris/arch-v10/boot/compressed/decompress.ld b/arch/cris/arch-v10/boot/compressed/decompress.ld
index 0b0a14fe6177..e80f4594d543 100644
--- a/arch/cris/arch-v10/boot/compressed/decompress.ld
+++ b/arch/cris/arch-v10/boot/compressed/decompress.ld
@@ -1,4 +1,5 @@
1OUTPUT_FORMAT(elf32-us-cris) 1/* OUTPUT_FORMAT(elf32-us-cris) */
2OUTPUT_FORMAT(elf32-cris)
2 3
3MEMORY 4MEMORY
4 { 5 {
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S
index 610bdb237553..981fbae84959 100644
--- a/arch/cris/arch-v10/boot/compressed/head.S
+++ b/arch/cris/arch-v10/boot/compressed/head.S
@@ -15,77 +15,77 @@
15#define COMMAND_LINE_MAGIC 0x87109563 15#define COMMAND_LINE_MAGIC 0x87109563
16 16
17 ;; Exported symbols 17 ;; Exported symbols
18
19 .globl _input_data
20 18
21 19 .globl input_data
20
21
22 .text 22 .text
23 23
24 nop 24 nop
25 di 25 di
26 26
27;; We need to initialze DRAM registers before we start using the DRAM 27;; We need to initialze DRAM registers before we start using the DRAM
28 28
29 cmp.d RAM_INIT_MAGIC, r8 ; Already initialized? 29 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
30 beq dram_init_finished 30 beq dram_init_finished
31 nop 31 nop
32 32
33#include "../../lib/dram_init.S" 33#include "../../lib/dram_init.S"
34 34
35dram_init_finished: 35dram_init_finished:
36 36
37 ;; Initiate the PA and PB ports 37 ;; Initiate the PA and PB ports
38 38
39 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0 39 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
40 move.b r0, [R_PORT_PA_DATA] 40 move.b $r0, [R_PORT_PA_DATA]
41 41
42 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0 42 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
43 move.b r0, [R_PORT_PA_DIR] 43 move.b $r0, [R_PORT_PA_DIR]
44 44
45 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0 45 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
46 move.b r0, [R_PORT_PB_DATA] 46 move.b $r0, [R_PORT_PB_DATA]
47 47
48 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0 48 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
49 move.b r0, [R_PORT_PB_DIR] 49 move.b $r0, [R_PORT_PB_DIR]
50 50
51 ;; Setup the stack to a suitably high address. 51 ;; Setup the stack to a suitably high address.
52 ;; We assume 8 MB is the minimum DRAM in an eLinux 52 ;; We assume 8 MB is the minimum DRAM in an eLinux
53 ;; product and put the sp at the top for now. 53 ;; product and put the sp at the top for now.
54 54
55 move.d 0x40800000, sp 55 move.d 0x40800000, $sp
56 56
57 ;; Figure out where the compressed piggyback image is 57 ;; Figure out where the compressed piggyback image is
58 ;; in the flash (since we wont try to copy it to DRAM 58 ;; in the flash (since we wont try to copy it to DRAM
59 ;; before unpacking). It is at _edata, but in flash. 59 ;; before unpacking). It is at _edata, but in flash.
60 ;; Use (_edata - basse) as offset to the current PC. 60 ;; Use (_edata - basse) as offset to the current PC.
61 61
62basse: move.d pc, r5 62basse: move.d $pc, $r5
63 and.d 0x7fffffff, r5 ; strip any non-cache bit 63 and.d 0x7fffffff, $r5 ; strip any non-cache bit
64 subq 2, r5 ; compensate for the move.d pc instr 64 subq 2, $r5 ; compensate for the move.d $pc instr
65 move.d r5, r0 ; save for later - flash address of 'basse' 65 move.d $r5, $r0 ; save for later - flash address of 'basse'
66 add.d _edata, r5 66 add.d _edata, $r5
67 sub.d basse, r5 ; r5 = flash address of '_edata' 67 sub.d basse, $r5 ; $r5 = flash address of '_edata'
68 68
69 ;; Copy text+data to DRAM 69 ;; Copy text+data to DRAM
70 70
71 move.d basse, r1 ; destination 71 move.d basse, $r1 ; destination
72 move.d _edata, r2 ; end destination 72 move.d _edata, $r2 ; end destination
731: move.w [r0+], r3 731: move.w [$r0+], $r3
74 move.w r3, [r1+] 74 move.w $r3, [$r1+]
75 cmp.d r2, r1 75 cmp.d $r2, $r1
76 bcs 1b 76 bcs 1b
77 nop 77 nop
78 78
79 move.d r5, [_input_data] ; for the decompressor 79 move.d $r5, [input_data] ; for the decompressor
80 80
81 81
82 ;; Clear the decompressors BSS (between _edata and _end) 82 ;; Clear the decompressors BSS (between _edata and _end)
83 83
84 moveq 0, r0 84 moveq 0, $r0
85 move.d _edata, r1 85 move.d _edata, $r1
86 move.d _end, r2 86 move.d _end, $r2
871: move.w r0, [r1+] 871: move.w $r0, [$r1+]
88 cmp.d r2, r1 88 cmp.d $r2, $r1
89 bcs 1b 89 bcs 1b
90 nop 90 nop
91 91
@@ -94,16 +94,16 @@ basse: move.d pc, r5
94 move.d $r10, [$r12] 94 move.d $r10, [$r12]
95 move.d _cmd_line_addr, $r12 95 move.d _cmd_line_addr, $r12
96 move.d $r11, [$r12] 96 move.d $r11, [$r12]
97
98 ;; Do the decompression and save compressed size in _inptr
99 97
100 jsr _decompress_kernel 98 ;; Do the decompression and save compressed size in inptr
101 99
102 ;; Put start address of root partition in r9 so the kernel can use it 100 jsr decompress_kernel
101
102 ;; Put start address of root partition in $r9 so the kernel can use it
103 ;; when mounting from flash 103 ;; when mounting from flash
104 104
105 move.d [_input_data], r9 ; flash address of compressed kernel 105 move.d [input_data], $r9 ; flash address of compressed kernel
106 add.d [_inptr], r9 ; size of compressed kernel 106 add.d [inptr], $r9 ; size of compressed kernel
107 107
108 ;; Restore command line magic and address. 108 ;; Restore command line magic and address.
109 move.d _cmd_line_magic, $r10 109 move.d _cmd_line_magic, $r10
@@ -112,12 +112,12 @@ basse: move.d pc, r5
112 move.d [$r11], $r11 112 move.d [$r11], $r11
113 113
114 ;; Enter the decompressed kernel 114 ;; Enter the decompressed kernel
115 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized 115 move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
116 jump 0x40004000 ; kernel is linked to this address 116 jump 0x40004000 ; kernel is linked to this address
117 117
118 .data 118 .data
119 119
120_input_data: 120input_data:
121 .dword 0 ; used by the decompressor 121 .dword 0 ; used by the decompressor
122_cmd_line_magic: 122_cmd_line_magic:
123 .dword 0 123 .dword 0
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
index 9a43ab19391e..18e13bce1400 100644
--- a/arch/cris/arch-v10/boot/compressed/misc.c
+++ b/arch/cris/arch-v10/boot/compressed/misc.c
@@ -29,12 +29,10 @@
29#define OF(args) args 29#define OF(args) args
30#define STATIC static 30#define STATIC static
31 31
32void* memset(void* s, int c, size_t n); 32void *memset(void *s, int c, size_t n);
33void* memcpy(void* __dest, __const void* __src, 33void *memcpy(void *__dest, __const void *__src, size_t __n);
34 size_t __n);
35
36#define memzero(s, n) memset ((s), 0, (n))
37 34
35#define memzero(s, n) memset((s), 0, (n))
38 36
39typedef unsigned char uch; 37typedef unsigned char uch;
40typedef unsigned short ush; 38typedef unsigned short ush;
@@ -62,57 +60,69 @@ static unsigned outcnt = 0; /* bytes in output buffer */
62#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ 60#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
63#define RESERVED 0xC0 /* bit 6,7: reserved */ 61#define RESERVED 0xC0 /* bit 6,7: reserved */
64 62
65#define get_byte() inbuf[inptr++] 63#define get_byte() (inbuf[inptr++])
66 64
67/* Diagnostic functions */ 65/* Diagnostic functions */
68#ifdef DEBUG 66#ifdef DEBUG
69# define Assert(cond,msg) {if(!(cond)) error(msg);} 67# define Assert(cond, msg) do { \
68 if (!(cond)) \
69 error(msg); \
70 } while (0)
70# define Trace(x) fprintf x 71# define Trace(x) fprintf x
71# define Tracev(x) {if (verbose) fprintf x ;} 72# define Tracev(x) do { \
72# define Tracevv(x) {if (verbose>1) fprintf x ;} 73 if (verbose) \
73# define Tracec(c,x) {if (verbose && (c)) fprintf x ;} 74 fprintf x; \
74# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} 75 } while (0)
76# define Tracevv(x) do { \
77 if (verbose > 1) \
78 fprintf x; \
79 } while (0)
80# define Tracec(c, x) do { \
81 if (verbose && (c)) \
82 fprintf x; \
83 } while (0)
84# define Tracecv(c, x) do { \
85 if (verbose > 1 && (c)) \
86 fprintf x; \
87 } while (0)
75#else 88#else
76# define Assert(cond,msg) 89# define Assert(cond, msg)
77# define Trace(x) 90# define Trace(x)
78# define Tracev(x) 91# define Tracev(x)
79# define Tracevv(x) 92# define Tracevv(x)
80# define Tracec(c,x) 93# define Tracec(c, x)
81# define Tracecv(c,x) 94# define Tracecv(c, x)
82#endif 95#endif
83 96
84static int fill_inbuf(void);
85static void flush_window(void); 97static void flush_window(void);
86static void error(char *m); 98static void error(char *m);
87static void gzip_mark(void **);
88static void gzip_release(void **);
89 99
90extern char *input_data; /* lives in head.S */ 100extern char *input_data; /* lives in head.S */
91 101
92static long bytes_out = 0; 102static long bytes_out = 0;
93static uch *output_data; 103static uch *output_data;
94static unsigned long output_ptr = 0; 104static unsigned long output_ptr = 0;
95 105
96static void *malloc(int size); 106static void *malloc(int size);
97static void free(void *where); 107static void free(void *where);
98static void error(char *m);
99static void gzip_mark(void **); 108static void gzip_mark(void **);
100static void gzip_release(void **); 109static void gzip_release(void **);
101 110
102static void puts(const char *); 111static void puts(const char *);
103 112
104/* the "heap" is put directly after the BSS ends, at end */ 113/* the "heap" is put directly after the BSS ends, at end */
105 114
106extern int end; 115extern int _end;
107static long free_mem_ptr = (long)&end; 116static long free_mem_ptr = (long)&_end;
108 117
109#include "../../../../../lib/inflate.c" 118#include "../../../../../lib/inflate.c"
110 119
111static void *malloc(int size) 120static void *malloc(int size)
112{ 121{
113 void *p; 122 void *p;
114 123
115 if (size <0) error("Malloc error"); 124 if (size < 0)
125 error("Malloc error");
116 126
117 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ 127 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
118 128
@@ -142,44 +152,47 @@ static void
142puts(const char *s) 152puts(const char *s)
143{ 153{
144#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 154#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
145 while(*s) { 155 while (*s) {
146#ifdef CONFIG_ETRAX_DEBUG_PORT0 156#ifdef CONFIG_ETRAX_DEBUG_PORT0
147 while(!(*R_SERIAL0_STATUS & (1 << 5))) ; 157 while (!(*R_SERIAL0_STATUS & (1 << 5))) ;
148 *R_SERIAL0_TR_DATA = *s++; 158 *R_SERIAL0_TR_DATA = *s++;
149#endif 159#endif
150#ifdef CONFIG_ETRAX_DEBUG_PORT1 160#ifdef CONFIG_ETRAX_DEBUG_PORT1
151 while(!(*R_SERIAL1_STATUS & (1 << 5))) ; 161 while (!(*R_SERIAL1_STATUS & (1 << 5))) ;
152 *R_SERIAL1_TR_DATA = *s++; 162 *R_SERIAL1_TR_DATA = *s++;
153#endif 163#endif
154#ifdef CONFIG_ETRAX_DEBUG_PORT2 164#ifdef CONFIG_ETRAX_DEBUG_PORT2
155 while(!(*R_SERIAL2_STATUS & (1 << 5))) ; 165 while (!(*R_SERIAL2_STATUS & (1 << 5))) ;
156 *R_SERIAL2_TR_DATA = *s++; 166 *R_SERIAL2_TR_DATA = *s++;
157#endif 167#endif
158#ifdef CONFIG_ETRAX_DEBUG_PORT3 168#ifdef CONFIG_ETRAX_DEBUG_PORT3
159 while(!(*R_SERIAL3_STATUS & (1 << 5))) ; 169 while (!(*R_SERIAL3_STATUS & (1 << 5))) ;
160 *R_SERIAL3_TR_DATA = *s++; 170 *R_SERIAL3_TR_DATA = *s++;
161#endif 171#endif
162 } 172 }
163#endif 173#endif
164} 174}
165 175
166void* 176void *memset(void *s, int c, size_t n)
167memset(void* s, int c, size_t n)
168{ 177{
169 int i; 178 int i;
170 char *ss = (char*)s; 179 char *ss = (char *)s;
180
181 for (i = 0; i < n; i++)
182 ss[i] = c;
171 183
172 for (i=0;i<n;i++) ss[i] = c; 184 return s;
173} 185}
174 186
175void* 187void *memcpy(void *__dest, __const void *__src, size_t __n)
176memcpy(void* __dest, __const void* __src,
177 size_t __n)
178{ 188{
179 int i; 189 int i;
180 char *d = (char *)__dest, *s = (char *)__src; 190 char *d = (char *)__dest, *s = (char *)__src;
181 191
182 for (i=0;i<__n;i++) d[i] = s[i]; 192 for (i = 0; i < __n; i++)
193 d[i] = s[i];
194
195 return __dest;
183} 196}
184 197
185/* =========================================================================== 198/* ===========================================================================
@@ -187,46 +200,44 @@ memcpy(void* __dest, __const void* __src,
187 * (Used for the decompressed data only.) 200 * (Used for the decompressed data only.)
188 */ 201 */
189 202
190static void 203static void flush_window(void)
191flush_window()
192{ 204{
193 ulg c = crc; /* temporary variable */ 205 ulg c = crc; /* temporary variable */
194 unsigned n; 206 unsigned n;
195 uch *in, *out, ch; 207 uch *in, *out, ch;
196 208
197 in = window; 209 in = window;
198 out = &output_data[output_ptr]; 210 out = &output_data[output_ptr];
199 for (n = 0; n < outcnt; n++) { 211 for (n = 0; n < outcnt; n++) {
200 ch = *out++ = *in++; 212 ch = *out = *in;
201 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 213 out++;
202 } 214 in++;
203 crc = c; 215 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
204 bytes_out += (ulg)outcnt; 216 }
205 output_ptr += (ulg)outcnt; 217 crc = c;
206 outcnt = 0; 218 bytes_out += (ulg)outcnt;
219 output_ptr += (ulg)outcnt;
220 outcnt = 0;
207} 221}
208 222
209static void 223static void error(char *x)
210error(char *x)
211{ 224{
212 puts("\n\n"); 225 puts("\n\n");
213 puts(x); 226 puts(x);
214 puts("\n\n -- System halted\n"); 227 puts("\n\n -- System halted\n");
215 228
216 while(1); /* Halt */ 229 while (1); /* Halt */
217} 230}
218 231
219void 232void setup_normal_output_buffer(void)
220setup_normal_output_buffer()
221{ 233{
222 output_data = (char *)KERNEL_LOAD_ADR; 234 output_data = (char *)KERNEL_LOAD_ADR;
223} 235}
224 236
225void 237void decompress_kernel(void)
226decompress_kernel()
227{ 238{
228 char revision; 239 char revision;
229 240
230 /* input_data is set in head.S */ 241 /* input_data is set in head.S */
231 inbuf = input_data; 242 inbuf = input_data;
232 243
@@ -257,11 +268,10 @@ decompress_kernel()
257 268
258 makecrc(); 269 makecrc();
259 270
260 __asm__ volatile ("move vr,%0" : "=rm" (revision)); 271 __asm__ volatile ("move $vr,%0" : "=rm" (revision));
261 if (revision < 10) 272 if (revision < 10) {
262 {
263 puts("You need an ETRAX 100LX to run linux 2.6\n"); 273 puts("You need an ETRAX 100LX to run linux 2.6\n");
264 while(1); 274 while (1);
265 } 275 }
266 276
267 puts("Uncompressing Linux...\n"); 277 puts("Uncompressing Linux...\n");
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
index 2e5045b9e19c..07688da92708 100644
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ b/arch/cris/arch-v10/boot/rescue/Makefile
@@ -2,12 +2,9 @@
2# Makefile for rescue (bootstrap) code 2# Makefile for rescue (bootstrap) code
3# 3#
4 4
5CC = gcc-cris -mlinux $(LINUXINCLUDE) 5ccflags-y += -O2 $(LINUXINCLUDE)
6ccflags-y += -O2 6asflags-y += $(LINUXINCLUDE)
7asflags-y += -traditional 7ldflags-y += -T $(srctree)/$(obj)/rescue.ld
8LD = gcc-cris -mlinux -nostdlib
9ldflags-y += -T $(obj)/rescue.ld
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 8OBJCOPYFLAGS = -O binary --remove-section=.bss
12obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 9obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
13OBJECT := $(obj)/head.o 10OBJECT := $(obj)/head.o
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index 52103d16dc6c..8769dc914073 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -233,7 +233,7 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
233 233
234 if (copy_to_user((struct rtc_time *) arg, &tm, 234 if (copy_to_user((struct rtc_time *) arg, &tm,
235 sizeof tm)) { 235 sizeof tm)) {
236 spin_unlock(&rtc_lock); 236 mutex_unlock(&rtc_lock);
237 return -EFAULT; 237 return -EFAULT;
238 } 238 }
239 239
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 04d5eee2c90c..3dc6e91ba39e 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -426,12 +426,18 @@ static int dummy_write(struct tty_struct * tty,
426 return count; 426 return count;
427} 427}
428 428
429static int 429static int dummy_write_room(struct tty_struct *tty)
430dummy_write_room(struct tty_struct *tty)
431{ 430{
432 return 8192; 431 return 8192;
433} 432}
434 433
434static const struct tty_operations dummy_ops = {
435 .open = dummy_open,
436 .close = dummy_close,
437 .write = dummy_write,
438 .write_room = dummy_write_room,
439};
440
435void __init 441void __init
436init_dummy_console(void) 442init_dummy_console(void)
437{ 443{
@@ -444,14 +450,14 @@ init_dummy_console(void)
444 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL; 450 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
445 dummy_driver.subtype = SERIAL_TYPE_NORMAL; 451 dummy_driver.subtype = SERIAL_TYPE_NORMAL;
446 dummy_driver.init_termios = tty_std_termios; 452 dummy_driver.init_termios = tty_std_termios;
453 /* Normally B9600 default... */
447 dummy_driver.init_termios.c_cflag = 454 dummy_driver.init_termios.c_cflag =
448 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ 455 B115200 | CS8 | CREAD | HUPCL | CLOCAL;
449 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 456 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
457 dummy_driver.init_termios.c_ispeed = 115200;
458 dummy_driver.init_termios.c_ospeed = 115200;
450 459
451 dummy_driver.open = dummy_open; 460 dummy_driver.ops = &dummy_ops;
452 dummy_driver.close = dummy_close;
453 dummy_driver.write = dummy_write;
454 dummy_driver.write_room = dummy_write_room;
455 if (tty_register_driver(&dummy_driver)) 461 if (tty_register_driver(&dummy_driver))
456 panic("Couldn't register dummy serial driver\n"); 462 panic("Couldn't register dummy serial driver\n");
457} 463}
diff --git a/arch/cris/arch-v32/boot/Makefile b/arch/cris/arch-v32/boot/Makefile
index 3f91349c5f12..99896ad60b30 100644
--- a/arch/cris/arch-v32/boot/Makefile
+++ b/arch/cris/arch-v32/boot/Makefile
@@ -2,7 +2,6 @@
2# arch/cris/arch-v32/boot/Makefile 2# arch/cris/arch-v32/boot/Makefile
3# 3#
4 4
5OBJCOPY = objcopy-cris
6OBJCOPYFLAGS = -O binary -R .note -R .comment 5OBJCOPYFLAGS = -O binary -R .note -R .comment
7 6
8subdir- := compressed rescue 7subdir- := compressed rescue
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
index 2c8c2c3039c5..d6335f26083b 100644
--- a/arch/cris/arch-v32/boot/compressed/Makefile
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -2,14 +2,10 @@
2# arch/cris/arch-v32/boot/compressed/Makefile 2# arch/cris/arch-v32/boot/compressed/Makefile
3# 3#
4 4
5CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
6asflags-y += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch 5asflags-y += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch
7ccflags-y += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch 6ccflags-y += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch
8LD = gcc-cris -mlinux -march=v32 -nostdlib 7ldflags-y += -T $(srctree)/$(obj)/decompress.ld
9ldflags-y += -T $(obj)/decompress.ld
10obj-y = head.o misc.o
11OBJECTS = $(obj)/head.o $(obj)/misc.o 8OBJECTS = $(obj)/head.o $(obj)/misc.o
12OBJCOPY = objcopy-cris
13OBJCOPYFLAGS = -O binary --remove-section=.bss 9OBJCOPYFLAGS = -O binary --remove-section=.bss
14 10
15quiet_cmd_image = BUILD $@ 11quiet_cmd_image = BUILD $@
diff --git a/arch/cris/arch-v32/boot/rescue/Makefile b/arch/cris/arch-v32/boot/rescue/Makefile
index c0987795dcb7..44ae0ad61f90 100644
--- a/arch/cris/arch-v32/boot/rescue/Makefile
+++ b/arch/cris/arch-v32/boot/rescue/Makefile
@@ -7,9 +7,8 @@ ccflags-y += -O2 -I $(srctree)/include/asm/arch/mach/ \
7 -I $(srctree)/include/asm/arch 7 -I $(srctree)/include/asm/arch
8asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch 8asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
9LD = gcc-cris -mlinux -march=v32 -nostdlib 9LD = gcc-cris -mlinux -march=v32 -nostdlib
10ldflags-y += -T $(obj)/rescue.ld 10ldflags-y += -T $(srctree)/$(obj)/rescue.ld
11LDPOSTFLAGS = -lgcc 11LDPOSTFLAGS = -lgcc
12OBJCOPY = objcopy-cris
13OBJCOPYFLAGS = -O binary --remove-section=.bss 12OBJCOPYFLAGS = -O binary --remove-section=.bss
14obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 13obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
15OBJECT := $(obj)/head.o 14OBJECT := $(obj)/head.o
diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
index 53db3870ba04..f263ab571221 100644
--- a/arch/cris/arch-v32/drivers/pcf8563.c
+++ b/arch/cris/arch-v32/drivers/pcf8563.c
@@ -229,7 +229,7 @@ int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
229 229
230 if (copy_to_user((struct rtc_time *) arg, &tm, 230 if (copy_to_user((struct rtc_time *) arg, &tm,
231 sizeof tm)) { 231 sizeof tm)) {
232 spin_unlock(&rtc_lock); 232 mutex_unlock(&rtc_lock);
233 return -EFAULT; 233 return -EFAULT;
234 } 234 }
235 235
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 23cafc80d2a4..24b1ad5334cb 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -193,18 +193,6 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
193 * ------------------------------------------------------------------- 193 * -------------------------------------------------------------------
194 */ 194 */
195 195
196#if 0
197/*
198 * not really used in our situation so keep them commented out for now
199 */
200static DECLARE_TASK_QUEUE(tq_serial); /* used to be at the top of the file */
201static void do_serial_bh(void)
202{
203 run_task_queue(&tq_serial);
204 printk(KERN_ERR "do_serial_bh: called\n");
205}
206#endif
207
208static void do_softint(struct work_struct *private_) 196static void do_softint(struct work_struct *private_)
209{ 197{
210 printk(KERN_ERR "simserial: do_softint called\n"); 198 printk(KERN_ERR "simserial: do_softint called\n");
@@ -351,11 +339,7 @@ static void rs_flush_buffer(struct tty_struct *tty)
351 info->xmit.head = info->xmit.tail = 0; 339 info->xmit.head = info->xmit.tail = 0;
352 local_irq_restore(flags); 340 local_irq_restore(flags);
353 341
354 wake_up_interruptible(&tty->write_wait); 342 tty_wakeup(tty);
355
356 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
357 tty->ldisc.write_wakeup)
358 (tty->ldisc.write_wakeup)(tty);
359} 343}
360 344
361/* 345/*
@@ -404,12 +388,6 @@ static void rs_unthrottle(struct tty_struct * tty)
404 printk(KERN_INFO "simrs_unthrottle called\n"); 388 printk(KERN_INFO "simrs_unthrottle called\n");
405} 389}
406 390
407/*
408 * rs_break() --- routine which turns the break handling on or off
409 */
410static void rs_break(struct tty_struct *tty, int break_state)
411{
412}
413 391
414static int rs_ioctl(struct tty_struct *tty, struct file * file, 392static int rs_ioctl(struct tty_struct *tty, struct file * file,
415 unsigned int cmd, unsigned long arg) 393 unsigned int cmd, unsigned long arg)
@@ -422,14 +400,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
422 } 400 }
423 401
424 switch (cmd) { 402 switch (cmd) {
425 case TIOCMGET:
426 printk(KERN_INFO "rs_ioctl: TIOCMGET called\n");
427 return -EINVAL;
428 case TIOCMBIS:
429 case TIOCMBIC:
430 case TIOCMSET:
431 printk(KERN_INFO "rs_ioctl: TIOCMBIS/BIC/SET called\n");
432 return -EINVAL;
433 case TIOCGSERIAL: 403 case TIOCGSERIAL:
434 printk(KERN_INFO "simrs_ioctl TIOCGSERIAL called\n"); 404 printk(KERN_INFO "simrs_ioctl TIOCGSERIAL called\n");
435 return 0; 405 return 0;
@@ -488,14 +458,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
488 458
489static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) 459static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
490{ 460{
491 unsigned int cflag = tty->termios->c_cflag;
492
493 if ( (cflag == old_termios->c_cflag)
494 && ( RELEVANT_IFLAG(tty->termios->c_iflag)
495 == RELEVANT_IFLAG(old_termios->c_iflag)))
496 return;
497
498
499 /* Handle turning off CRTSCTS */ 461 /* Handle turning off CRTSCTS */
500 if ((old_termios->c_cflag & CRTSCTS) && 462 if ((old_termios->c_cflag & CRTSCTS) &&
501 !(tty->termios->c_cflag & CRTSCTS)) { 463 !(tty->termios->c_cflag & CRTSCTS)) {
@@ -623,9 +585,8 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
623 * the line discipline to only process XON/XOFF characters. 585 * the line discipline to only process XON/XOFF characters.
624 */ 586 */
625 shutdown(info); 587 shutdown(info);
626 if (tty->ops->flush_buffer) 588 rs_flush_buffer(tty);
627 tty->ops->flush_buffer(tty); 589 tty_ldisc_flush(tty);
628 if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty);
629 info->event = 0; 590 info->event = 0;
630 info->tty = NULL; 591 info->tty = NULL;
631 if (info->blocked_open) { 592 if (info->blocked_open) {
@@ -955,7 +916,6 @@ static const struct tty_operations hp_ops = {
955 .stop = rs_stop, 916 .stop = rs_stop,
956 .start = rs_start, 917 .start = rs_start,
957 .hangup = rs_hangup, 918 .hangup = rs_hangup,
958 .break_ctl = rs_break,
959 .wait_until_sent = rs_wait_until_sent, 919 .wait_until_sent = rs_wait_until_sent,
960 .read_proc = rs_read_proc, 920 .read_proc = rs_read_proc,
961}; 921};
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 55ea52fe6aca..8c5e1de68fcb 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -490,28 +490,6 @@ config ATARI_MFPSER
490 Note for Falcon users: You also have an MFP port, it's just not 490 Note for Falcon users: You also have an MFP port, it's just not
491 wired to the outside... But you could use the port under Linux. 491 wired to the outside... But you could use the port under Linux.
492 492
493config ATARI_SCC
494 tristate "Atari SCC serial support"
495 depends on ATARI
496 ---help---
497 If you have serial ports based on a Zilog SCC chip (Modem2, Serial2,
498 LAN) and like to use them under Linux, say Y. All built-in SCC's are
499 supported (TT, MegaSTE, Falcon), and also the ST-ESCC. If you have
500 two connectors for channel A (Serial2 and LAN), they are visible as
501 two separate devices.
502
503 To compile this driver as a module, choose M here.
504
505config ATARI_SCC_DMA
506 bool "Atari SCC serial DMA support"
507 depends on ATARI_SCC
508 help
509 This enables DMA support for receiving data on channel A of the SCC.
510 If you have a TT you may say Y here and read
511 drivers/char/atari_SCC.README. All other users should say N here,
512 because only the TT has SCC-DMA, even if your machine keeps claiming
513 so at boot time.
514
515config ATARI_MIDI 493config ATARI_MIDI
516 tristate "Atari MIDI serial support" 494 tristate "Atari MIDI serial support"
517 depends on ATARI 495 depends on ATARI
@@ -578,18 +556,6 @@ config MAC_HID
578 depends on INPUT_ADBHID 556 depends on INPUT_ADBHID
579 default y 557 default y
580 558
581config ADB_KEYBOARD
582 bool "Support for ADB keyboard (old driver)"
583 depends on MAC && !INPUT_ADBHID
584 help
585 This option allows you to use an ADB keyboard attached to your
586 machine. Note that this disables any other (ie. PS/2) keyboard
587 support, even if your machine is physically capable of using both at
588 the same time.
589
590 If you use an ADB keyboard (4 pin connector), say Y here.
591 If you use a PS/2 keyboard (6 pin connector), say N here.
592
593config HPDCA 559config HPDCA
594 tristate "HP DCA serial support" 560 tristate "HP DCA serial support"
595 depends on DIO && SERIAL_8250 561 depends on DIO && SERIAL_8250
@@ -640,7 +606,7 @@ config DN_SERIAL
640 606
641config SERIAL_CONSOLE 607config SERIAL_CONSOLE
642 bool "Support for serial port console" 608 bool "Support for serial port console"
643 depends on (AMIGA || ATARI || MAC || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_SCC=y || ATARI_MIDI=y || MAC_SCC=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL) 609 depends on (AMIGA || ATARI || MAC || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || MAC_SCC=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL)
644 ---help--- 610 ---help---
645 If you say Y here, it will be possible to use a serial port as the 611 If you say Y here, it will be possible to use a serial port as the
646 system console (the system console is the device which receives all 612 system console (the system console is the device which receives all
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index b15173f28a23..8133dbc44964 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -13,7 +13,7 @@
13# Copyright (C) 1994 by Hamish Macdonald 13# Copyright (C) 1994 by Hamish Macdonald
14# 14#
15 15
16KBUILD_DEFCONFIG := amiga_defconfig 16KBUILD_DEFCONFIG := multi_defconfig
17 17
18# override top level makefile 18# override top level makefile
19AS += -m68020 19AS += -m68020
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 50f5daab46b7..df679d96b1cb 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -36,14 +36,11 @@
36#include <asm/machdep.h> 36#include <asm/machdep.h>
37#include <asm/io.h> 37#include <asm/io.h>
38 38
39unsigned long amiga_model; 39static unsigned long amiga_model;
40EXPORT_SYMBOL(amiga_model);
41 40
42unsigned long amiga_eclock; 41unsigned long amiga_eclock;
43EXPORT_SYMBOL(amiga_eclock); 42EXPORT_SYMBOL(amiga_eclock);
44 43
45unsigned long amiga_masterclock;
46
47unsigned long amiga_colorclock; 44unsigned long amiga_colorclock;
48EXPORT_SYMBOL(amiga_colorclock); 45EXPORT_SYMBOL(amiga_colorclock);
49 46
@@ -51,7 +48,9 @@ unsigned long amiga_chipset;
51EXPORT_SYMBOL(amiga_chipset); 48EXPORT_SYMBOL(amiga_chipset);
52 49
53unsigned char amiga_vblank; 50unsigned char amiga_vblank;
54unsigned char amiga_psfreq; 51EXPORT_SYMBOL(amiga_vblank);
52
53static unsigned char amiga_psfreq;
55 54
56struct amiga_hw_present amiga_hw_present; 55struct amiga_hw_present amiga_hw_present;
57EXPORT_SYMBOL(amiga_hw_present); 56EXPORT_SYMBOL(amiga_hw_present);
@@ -92,8 +91,6 @@ static char *amiga_models[] __initdata = {
92static char amiga_model_name[13] = "Amiga "; 91static char amiga_model_name[13] = "Amiga ";
93 92
94static void amiga_sched_init(irq_handler_t handler); 93static void amiga_sched_init(irq_handler_t handler);
95/* amiga specific irq functions */
96extern void amiga_init_IRQ(void);
97static void amiga_get_model(char *model); 94static void amiga_get_model(char *model);
98static int amiga_get_hardware_list(char *buffer); 95static int amiga_get_hardware_list(char *buffer);
99/* amiga specific timer functions */ 96/* amiga specific timer functions */
@@ -107,8 +104,6 @@ static void amiga_reset(void);
107extern void amiga_init_sound(void); 104extern void amiga_init_sound(void);
108static void amiga_mem_console_write(struct console *co, const char *b, 105static void amiga_mem_console_write(struct console *co, const char *b,
109 unsigned int count); 106 unsigned int count);
110void amiga_serial_console_write(struct console *co, const char *s,
111 unsigned int count);
112#ifdef CONFIG_HEARTBEAT 107#ifdef CONFIG_HEARTBEAT
113static void amiga_heartbeat(int on); 108static void amiga_heartbeat(int on);
114#endif 109#endif
@@ -418,8 +413,7 @@ void __init config_amiga(void)
418 mach_heartbeat = amiga_heartbeat; 413 mach_heartbeat = amiga_heartbeat;
419#endif 414#endif
420 415
421 /* Fill in the clock values (based on the 700 kHz E-Clock) */ 416 /* Fill in the clock value (based on the 700 kHz E-Clock) */
422 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
423 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */ 417 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
424 418
425 /* clear all DMA bits */ 419 /* clear all DMA bits */
@@ -817,8 +811,8 @@ static void amiga_serial_putc(char c)
817 ; 811 ;
818} 812}
819 813
820void amiga_serial_console_write(struct console *co, const char *s, 814static void amiga_serial_console_write(struct console *co, const char *s,
821 unsigned int count) 815 unsigned int count)
822{ 816{
823 while (count--) { 817 while (count--) {
824 if (*s == '\n') 818 if (*s == '\n')
@@ -827,7 +821,7 @@ void amiga_serial_console_write(struct console *co, const char *s,
827 } 821 }
828} 822}
829 823
830#ifdef CONFIG_SERIAL_CONSOLE 824#if 0
831void amiga_serial_puts(const char *s) 825void amiga_serial_puts(const char *s)
832{ 826{
833 amiga_serial_console_write(NULL, s, strlen(s)); 827 amiga_serial_console_write(NULL, s, strlen(s));
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index 043ddbc61c7b..702b15ccfab7 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -20,14 +20,6 @@
20#include <asm/atarihw.h> 20#include <asm/atarihw.h>
21#include <asm/atariints.h> 21#include <asm/atariints.h>
22 22
23/* Flag that Modem1 port is already initialized and used */
24int atari_MFP_init_done;
25EXPORT_SYMBOL(atari_MFP_init_done);
26
27/* Flag that Modem1 port is already initialized and used */
28int atari_SCC_init_done;
29EXPORT_SYMBOL(atari_SCC_init_done);
30
31/* Can be set somewhere, if a SCC master reset has already be done and should 23/* Can be set somewhere, if a SCC master reset has already be done and should
32 * not be repeated; used by kgdb */ 24 * not be repeated; used by kgdb */
33int atari_SCC_reset_done; 25int atari_SCC_reset_done;
@@ -47,8 +39,8 @@ static inline void ata_mfp_out(char c)
47 mfp.usart_dta = c; 39 mfp.usart_dta = c;
48} 40}
49 41
50void atari_mfp_console_write(struct console *co, const char *str, 42static void atari_mfp_console_write(struct console *co, const char *str,
51 unsigned int count) 43 unsigned int count)
52{ 44{
53 while (count--) { 45 while (count--) {
54 if (*str == '\n') 46 if (*str == '\n')
@@ -66,8 +58,8 @@ static inline void ata_scc_out(char c)
66 scc.cha_b_data = c; 58 scc.cha_b_data = c;
67} 59}
68 60
69void atari_scc_console_write(struct console *co, const char *str, 61static void atari_scc_console_write(struct console *co, const char *str,
70 unsigned int count) 62 unsigned int count)
71{ 63{
72 while (count--) { 64 while (count--) {
73 if (*str == '\n') 65 if (*str == '\n')
@@ -83,8 +75,8 @@ static inline void ata_midi_out(char c)
83 acia.mid_data = c; 75 acia.mid_data = c;
84} 76}
85 77
86void atari_midi_console_write(struct console *co, const char *str, 78static void atari_midi_console_write(struct console *co, const char *str,
87 unsigned int count) 79 unsigned int count)
88{ 80{
89 while (count--) { 81 while (count--) {
90 if (*str == '\n') 82 if (*str == '\n')
@@ -136,7 +128,7 @@ static void atari_par_console_write(struct console *co, const char *str,
136 } 128 }
137} 129}
138 130
139#ifdef CONFIG_SERIAL_CONSOLE 131#if 0
140int atari_mfp_console_wait_key(struct console *co) 132int atari_mfp_console_wait_key(struct console *co)
141{ 133{
142 while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */ 134 while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */
@@ -166,11 +158,7 @@ int atari_midi_console_wait_key(struct console *co)
166 * SCC serial ports. They're used by the debugging interface, kgdb, and the 158 * SCC serial ports. They're used by the debugging interface, kgdb, and the
167 * serial console code. 159 * serial console code.
168 */ 160 */
169#ifndef CONFIG_SERIAL_CONSOLE
170static void __init atari_init_mfp_port(int cflag) 161static void __init atari_init_mfp_port(int cflag)
171#else
172void atari_init_mfp_port(int cflag)
173#endif
174{ 162{
175 /* 163 /*
176 * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 164 * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150
@@ -193,8 +181,6 @@ void atari_init_mfp_port(int cflag)
193 mfp.tim_dt_d = baud_table[baud]; 181 mfp.tim_dt_d = baud_table[baud];
194 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ 182 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */
195 mfp.trn_stat |= 0x01; /* enable TX */ 183 mfp.trn_stat |= 0x01; /* enable TX */
196
197 atari_MFP_init_done = 1;
198} 184}
199 185
200#define SCC_WRITE(reg, val) \ 186#define SCC_WRITE(reg, val) \
@@ -214,11 +200,7 @@ void atari_init_mfp_port(int cflag)
214 MFPDELAY(); \ 200 MFPDELAY(); \
215 } while (0) 201 } while (0)
216 202
217#ifndef CONFIG_SERIAL_CONSOLE
218static void __init atari_init_scc_port(int cflag) 203static void __init atari_init_scc_port(int cflag)
219#else
220void atari_init_scc_port(int cflag)
221#endif
222{ 204{
223 extern int atari_SCC_reset_done; 205 extern int atari_SCC_reset_done;
224 static int clksrc_table[9] = 206 static int clksrc_table[9] =
@@ -277,14 +259,9 @@ void atari_init_scc_port(int cflag)
277 SCC_WRITE(5, reg5 | 8); 259 SCC_WRITE(5, reg5 | 8);
278 260
279 atari_SCC_reset_done = 1; 261 atari_SCC_reset_done = 1;
280 atari_SCC_init_done = 1;
281} 262}
282 263
283#ifndef CONFIG_SERIAL_CONSOLE
284static void __init atari_init_midi_port(int cflag) 264static void __init atari_init_midi_port(int cflag)
285#else
286void atari_init_midi_port(int cflag)
287#endif
288{ 265{
289 int baud = cflag & CBAUD; 266 int baud = cflag & CBAUD;
290 int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; 267 int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00;
diff --git a/arch/m68k/fpsp040/Makefile b/arch/m68k/fpsp040/Makefile
index 0214d2f6f8b0..9506d883ace5 100644
--- a/arch/m68k/fpsp040/Makefile
+++ b/arch/m68k/fpsp040/Makefile
@@ -10,7 +10,6 @@ obj-y := bindec.o binstr.o decbin.o do_func.o gen_except.o get_op.o \
10 x_bsun.o x_fline.o x_operr.o x_ovfl.o x_snan.o x_store.o \ 10 x_bsun.o x_fline.o x_operr.o x_ovfl.o x_snan.o x_store.o \
11 x_unfl.o x_unimp.o x_unsupp.o bugfix.o skeleton.o 11 x_unfl.o x_unimp.o x_unsupp.o bugfix.o skeleton.o
12 12
13EXTRA_AFLAGS := -traditional
14EXTRA_LDFLAGS := -x 13EXTRA_LDFLAGS := -x
15 14
16$(OS_OBJS): fpsp.h 15$(OS_OBJS): fpsp.h
diff --git a/arch/m68k/ifpsp060/Makefile b/arch/m68k/ifpsp060/Makefile
index 2fe8472cb5e3..43b435049452 100644
--- a/arch/m68k/ifpsp060/Makefile
+++ b/arch/m68k/ifpsp060/Makefile
@@ -6,5 +6,4 @@
6 6
7obj-y := fskeleton.o iskeleton.o os.o 7obj-y := fskeleton.o iskeleton.o os.o
8 8
9EXTRA_AFLAGS := -traditional
10EXTRA_LDFLAGS := -x 9EXTRA_LDFLAGS := -x
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 7a62a718143b..3a7f62225504 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -16,5 +16,3 @@ devres-y = ../../../kernel/irq/devres.o
16 16
17obj-$(CONFIG_PCI) += bios32.o 17obj-$(CONFIG_PCI) += bios32.o
18obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo 18obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
19
20EXTRA_AFLAGS := -traditional
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index a9fb83a8c180..ea1e44da19b9 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/fpu.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/machdep.h> 32#include <asm/machdep.h>
@@ -40,6 +41,11 @@
40#include <asm/dvma.h> 41#include <asm/dvma.h>
41#endif 42#endif
42 43
44#if !FPSTATESIZE || !NR_IRQS
45#warning No CPU/platform type selected, your kernel will not work!
46#warning Are you building an allnoconfig kernel?
47#endif
48
43unsigned long m68k_machtype; 49unsigned long m68k_machtype;
44EXPORT_SYMBOL(m68k_machtype); 50EXPORT_SYMBOL(m68k_machtype);
45unsigned long m68k_cputype; 51unsigned long m68k_cputype;
@@ -116,6 +122,7 @@ extern int bvme6000_parse_bootinfo(const struct bi_record *);
116extern int mvme16x_parse_bootinfo(const struct bi_record *); 122extern int mvme16x_parse_bootinfo(const struct bi_record *);
117extern int mvme147_parse_bootinfo(const struct bi_record *); 123extern int mvme147_parse_bootinfo(const struct bi_record *);
118extern int hp300_parse_bootinfo(const struct bi_record *); 124extern int hp300_parse_bootinfo(const struct bi_record *);
125extern int apollo_parse_bootinfo(const struct bi_record *);
119 126
120extern void config_amiga(void); 127extern void config_amiga(void);
121extern void config_atari(void); 128extern void config_atari(void);
@@ -183,6 +190,8 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
183 unknown = mvme147_parse_bootinfo(record); 190 unknown = mvme147_parse_bootinfo(record);
184 else if (MACH_IS_HP300) 191 else if (MACH_IS_HP300)
185 unknown = hp300_parse_bootinfo(record); 192 unknown = hp300_parse_bootinfo(record);
193 else if (MACH_IS_APOLLO)
194 unknown = apollo_parse_bootinfo(record);
186 else 195 else
187 unknown = 1; 196 unknown = 1;
188 } 197 }
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 7537cc5e6159..99b0784c0552 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -1,6 +1,7 @@
1/* ld script to make m68k Linux kernel */ 1/* ld script to make m68k Linux kernel */
2 2
3#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
4#include <asm/page.h>
4 5
5OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") 6OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
6OUTPUT_ARCH(m68k) 7OUTPUT_ARCH(m68k)
@@ -41,7 +42,7 @@ SECTIONS
41 _edata = .; /* End of data section */ 42 _edata = .; /* End of data section */
42 43
43 /* will be freed after init */ 44 /* will be freed after init */
44 . = ALIGN(4096); /* Init code and data */ 45 . = ALIGN(PAGE_SIZE); /* Init code and data */
45 __init_begin = .; 46 __init_begin = .;
46 .init.text : { 47 .init.text : {
47 _sinittext = .; 48 _sinittext = .;
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index cdc313e7c299..8a4919e4d36a 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -1,6 +1,7 @@
1/* ld script to make m68k Linux kernel */ 1/* ld script to make m68k Linux kernel */
2 2
3#include <asm-generic/vmlinux.lds.h> 3#include <asm-generic/vmlinux.lds.h>
4#include <asm/page.h>
4 5
5OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k") 6OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
6OUTPUT_ARCH(m68k) 7OUTPUT_ARCH(m68k)
@@ -34,7 +35,7 @@ SECTIONS
34 _edata = .; 35 _edata = .;
35 36
36 /* will be freed after init */ 37 /* will be freed after init */
37 . = ALIGN(8192); /* Init code and data */ 38 . = ALIGN(PAGE_SIZE); /* Init code and data */
38__init_begin = .; 39__init_begin = .;
39 .init.text : { 40 .init.text : {
40 _sinittext = .; 41 _sinittext = .;
@@ -61,12 +62,12 @@ __init_begin = .;
61 } 62 }
62 SECURITY_INIT 63 SECURITY_INIT
63#ifdef CONFIG_BLK_DEV_INITRD 64#ifdef CONFIG_BLK_DEV_INITRD
64 . = ALIGN(8192); 65 . = ALIGN(PAGE_SIZE);
65 __initramfs_start = .; 66 __initramfs_start = .;
66 .init.ramfs : { *(.init.ramfs) } 67 .init.ramfs : { *(.init.ramfs) }
67 __initramfs_end = .; 68 __initramfs_end = .;
68#endif 69#endif
69 . = ALIGN(8192); 70 . = ALIGN(PAGE_SIZE);
70 __init_end = .; 71 __init_end = .;
71 .data.init.task : { *(.data.init_task) } 72 .data.init.task : { *(.data.init_task) }
72 73
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index a18af095cd7c..af9abf8d9d98 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -2,7 +2,5 @@
2# Makefile for m68k-specific library files.. 2# Makefile for m68k-specific library files..
3# 3#
4 4
5EXTRA_AFLAGS := -traditional
6
7lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 5lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
8 checksum.o string.o uaccess.o 6 checksum.o string.o uaccess.o
diff --git a/arch/m68k/mac/Makefile b/arch/m68k/mac/Makefile
index 1d265ba365ad..daebd80bdef0 100644
--- a/arch/m68k/mac/Makefile
+++ b/arch/m68k/mac/Makefile
@@ -2,5 +2,5 @@
2# Makefile for Linux arch/m68k/mac source directory 2# Makefile for Linux arch/m68k/mac source directory
3# 3#
4 4
5obj-y := config.o bootparse.o macints.o iop.o via.o oss.o psc.o \ 5obj-y := config.o macints.o iop.o via.o oss.o psc.o \
6 baboon.o macboing.o debug.o misc.o 6 baboon.o macboing.o debug.o misc.o
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index 673a1085984d..dae9c982aa89 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -23,9 +23,7 @@
23/* #define DEBUG_IRQS */ 23/* #define DEBUG_IRQS */
24 24
25int baboon_present; 25int baboon_present;
26volatile struct baboon *baboon; 26static volatile struct baboon *baboon;
27
28irqreturn_t baboon_irq(int, void *);
29 27
30#if 0 28#if 0
31extern int macide_ack_intr(struct ata_channel *); 29extern int macide_ack_intr(struct ata_channel *);
@@ -50,20 +48,10 @@ void __init baboon_init(void)
50} 48}
51 49
52/* 50/*
53 * Register the Baboon interrupt dispatcher on nubus slot $C.
54 */
55
56void __init baboon_register_interrupts(void)
57{
58 request_irq(IRQ_NUBUS_C, baboon_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
59 "baboon", (void *) baboon);
60}
61
62/*
63 * Baboon interrupt handler. This works a lot like a VIA. 51 * Baboon interrupt handler. This works a lot like a VIA.
64 */ 52 */
65 53
66irqreturn_t baboon_irq(int irq, void *dev_id) 54static irqreturn_t baboon_irq(int irq, void *dev_id)
67{ 55{
68 int irq_bit, irq_num; 56 int irq_bit, irq_num;
69 unsigned char events; 57 unsigned char events;
@@ -95,6 +83,16 @@ irqreturn_t baboon_irq(int irq, void *dev_id)
95 return IRQ_HANDLED; 83 return IRQ_HANDLED;
96} 84}
97 85
86/*
87 * Register the Baboon interrupt dispatcher on nubus slot $C.
88 */
89
90void __init baboon_register_interrupts(void)
91{
92 request_irq(IRQ_NUBUS_C, baboon_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
93 "baboon", (void *) baboon);
94}
95
98void baboon_irq_enable(int irq) { 96void baboon_irq_enable(int irq) {
99#ifdef DEBUG_IRQUSE 97#ifdef DEBUG_IRQUSE
100 printk("baboon_irq_enable(%d)\n", irq); 98 printk("baboon_irq_enable(%d)\n", irq);
diff --git a/arch/m68k/mac/bootparse.c b/arch/m68k/mac/bootparse.c
deleted file mode 100644
index 36d223609823..000000000000
--- a/arch/m68k/mac/bootparse.c
+++ /dev/null
@@ -1,122 +0,0 @@
1#include <linux/string.h>
2#include <linux/kernel.h>
3#include <linux/sched.h>
4#include <asm/irq.h>
5#include <asm/setup.h>
6#include <asm/bootinfo.h>
7#include <asm/macintosh.h>
8
9/*
10 * Booter vars
11 */
12
13int boothowto;
14int _boothowto;
15
16/*
17 * Called early to parse the environment (passed to us from the booter)
18 * into a bootinfo struct. Will die as soon as we have our own booter
19 */
20
21#define atol(x) simple_strtoul(x,NULL,0)
22
23void parse_booter(char *env)
24{
25 char *name;
26 char *value;
27#if 0
28 while(0 && *env)
29#else
30 while(*env)
31#endif
32 {
33 name=env;
34 value=name;
35 while(*value!='='&&*value)
36 value++;
37 if(*value=='=')
38 *value++=0;
39 env=value;
40 while(*env)
41 env++;
42 env++;
43#if 0
44 if(strcmp(name,"VIDEO_ADDR")==0)
45 mac_mch.videoaddr=atol(value);
46 if(strcmp(name,"ROW_BYTES")==0)
47 mac_mch.videorow=atol(value);
48 if(strcmp(name,"SCREEN_DEPTH")==0)
49 mac_mch.videodepth=atol(value);
50 if(strcmp(name,"DIMENSIONS")==0)
51 mac_mch.dimensions=atol(value);
52#endif
53 if(strcmp(name,"BOOTTIME")==0)
54 mac_bi_data.boottime=atol(value);
55 if(strcmp(name,"GMTBIAS")==0)
56 mac_bi_data.gmtbias=atol(value);
57 if(strcmp(name,"BOOTERVER")==0)
58 mac_bi_data.bootver=atol(value);
59 if(strcmp(name,"MACOS_VIDEO")==0)
60 mac_bi_data.videological=atol(value);
61 if(strcmp(name,"MACOS_SCC")==0)
62 mac_bi_data.sccbase=atol(value);
63 if(strcmp(name,"MACHINEID")==0)
64 mac_bi_data.id=atol(value);
65 if(strcmp(name,"MEMSIZE")==0)
66 mac_bi_data.memsize=atol(value);
67 if(strcmp(name,"SERIAL_MODEM_FLAGS")==0)
68 mac_bi_data.serialmf=atol(value);
69 if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0)
70 mac_bi_data.serialhsk=atol(value);
71 if(strcmp(name,"SERIAL_MODEM_GPICLK")==0)
72 mac_bi_data.serialgpi=atol(value);
73 if(strcmp(name,"SERIAL_PRINT_FLAGS")==0)
74 mac_bi_data.printmf=atol(value);
75 if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0)
76 mac_bi_data.printhsk=atol(value);
77 if(strcmp(name,"SERIAL_PRINT_GPICLK")==0)
78 mac_bi_data.printgpi=atol(value);
79 if(strcmp(name,"PROCESSOR")==0)
80 mac_bi_data.cpuid=atol(value);
81 if(strcmp(name,"ROMBASE")==0)
82 mac_bi_data.rombase=atol(value);
83 if(strcmp(name,"TIMEDBRA")==0)
84 mac_bi_data.timedbra=atol(value);
85 if(strcmp(name,"ADBDELAY")==0)
86 mac_bi_data.adbdelay=atol(value);
87 }
88#if 0 /* XXX: TODO with m68k_mach_* */
89 /* Fill in the base stuff */
90 boot_info.machtype=MACH_MAC;
91 /* Read this from the macinfo we got ! */
92/* boot_info.cputype=CPU_68020|FPUB_68881;*/
93/* boot_info.memory[0].addr=0;*/
94/* boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/
95 boot_info.num_memory=1; /* On a MacII */
96 boot_info.ramdisk_size=0; /* For now */
97 *boot_info.command_line=0;
98#endif
99 }
100
101
102void print_booter(char *env)
103{
104 char *name;
105 char *value;
106 while(*env)
107 {
108 name=env;
109 value=name;
110 while(*value!='='&&*value)
111 value++;
112 if(*value=='=')
113 *value++=0;
114 env=value;
115 while(*env)
116 env++;
117 env++;
118 printk("%s=%s\n", name,value);
119 }
120 }
121
122
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index ad3e3bacae39..c45e18449f32 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -46,7 +46,6 @@
46/* Mac bootinfo struct */ 46/* Mac bootinfo struct */
47 47
48struct mac_booter_data mac_bi_data; 48struct mac_booter_data mac_bi_data;
49int mac_bisize = sizeof mac_bi_data;
50 49
51/* New m68k bootinfo stuff and videobase */ 50/* New m68k bootinfo stuff and videobase */
52 51
@@ -55,10 +54,8 @@ extern struct mem_info m68k_memory[NUM_MEMINFO];
55 54
56extern struct mem_info m68k_ramdisk; 55extern struct mem_info m68k_ramdisk;
57 56
58void *mac_env; /* Loaded by the boot asm */
59
60/* The phys. video addr. - might be bogus on some machines */ 57/* The phys. video addr. - might be bogus on some machines */
61unsigned long mac_orig_videoaddr; 58static unsigned long mac_orig_videoaddr;
62 59
63/* Mac specific timer functions */ 60/* Mac specific timer functions */
64extern unsigned long mac_gettimeoffset(void); 61extern unsigned long mac_gettimeoffset(void);
@@ -79,6 +76,8 @@ extern void mac_mksound(unsigned int, unsigned int);
79extern void nubus_sweep_video(void); 76extern void nubus_sweep_video(void);
80 77
81static void mac_get_model(char *str); 78static void mac_get_model(char *str);
79static void mac_identify(void);
80static void mac_report_hardware(void);
82 81
83static void __init mac_sched_init(irq_handler_t vector) 82static void __init mac_sched_init(irq_handler_t vector)
84{ 83{
@@ -765,7 +764,7 @@ static struct mac_model mac_data_table[] = {
765 } 764 }
766}; 765};
767 766
768void __init mac_identify(void) 767static void __init mac_identify(void)
769{ 768{
770 struct mac_model *m; 769 struct mac_model *m;
771 770
@@ -821,7 +820,7 @@ void __init mac_identify(void)
821 baboon_init(); 820 baboon_init();
822} 821}
823 822
824void __init mac_report_hardware(void) 823static void __init mac_report_hardware(void)
825{ 824{
826 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name); 825 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
827} 826}
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index e8a57138b4a6..2165740786a5 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -51,6 +51,8 @@ extern void mac_serial_print(const char *);
51static int peng, line; 51static int peng, line;
52#endif 52#endif
53 53
54#if 0
55
54void mac_debugging_short(int pos, short num) 56void mac_debugging_short(int pos, short num)
55{ 57{
56#ifdef DEBUG_SCREEN 58#ifdef DEBUG_SCREEN
@@ -125,6 +127,8 @@ void mac_debugging_long(int pos, long addr)
125#endif 127#endif
126} 128}
127 129
130#endif /* 0 */
131
128#ifdef DEBUG_SERIAL 132#ifdef DEBUG_SERIAL
129/* 133/*
130 * TODO: serial debug code 134 * TODO: serial debug code
@@ -142,12 +146,6 @@ struct mac_SCC {
142 146
143# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) 147# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
144 148
145/* Flag that serial port is already initialized and used */
146int mac_SCC_init_done;
147/* Can be set somewhere, if a SCC master reset has already be done and should
148 * not be repeated; used by kgdb */
149int mac_SCC_reset_done;
150
151static int scc_port = -1; 149static int scc_port = -1;
152 150
153static struct console mac_console_driver = { 151static struct console mac_console_driver = {
@@ -171,8 +169,8 @@ static struct console mac_console_driver = {
171 * this driver if Mac. 169 * this driver if Mac.
172 */ 170 */
173 171
174void mac_debug_console_write(struct console *co, const char *str, 172static void mac_debug_console_write(struct console *co, const char *str,
175 unsigned int count) 173 unsigned int count)
176{ 174{
177 mac_serial_print(str); 175 mac_serial_print(str);
178} 176}
@@ -209,8 +207,8 @@ static inline void mac_scca_out(char c)
209 scc.cha_a_data = c; 207 scc.cha_a_data = c;
210} 208}
211 209
212void mac_sccb_console_write(struct console *co, const char *str, 210static void mac_sccb_console_write(struct console *co, const char *str,
213 unsigned int count) 211 unsigned int count)
214{ 212{
215 while (count--) { 213 while (count--) {
216 if (*str == '\n') 214 if (*str == '\n')
@@ -219,8 +217,8 @@ void mac_sccb_console_write(struct console *co, const char *str,
219 } 217 }
220} 218}
221 219
222void mac_scca_console_write(struct console *co, const char *str, 220static void mac_scca_console_write(struct console *co, const char *str,
223 unsigned int count) 221 unsigned int count)
224{ 222{
225 while (count--) { 223 while (count--) {
226 if (*str == '\n') 224 if (*str == '\n')
@@ -265,14 +263,8 @@ void mac_scca_console_write(struct console *co, const char *str,
265 barrier(); \ 263 barrier(); \
266 } while(0) 264 } while(0)
267 265
268#ifndef CONFIG_SERIAL_CONSOLE
269static void __init mac_init_scc_port(int cflag, int port) 266static void __init mac_init_scc_port(int cflag, int port)
270#else
271void mac_init_scc_port(int cflag, int port)
272#endif
273{ 267{
274 extern int mac_SCC_reset_done;
275
276 /* 268 /*
277 * baud rates: 1200, 1800, 2400, 4800, 9600, 19.2k, 38.4k, 57.6k, 115.2k 269 * baud rates: 1200, 1800, 2400, 4800, 9600, 19.2k, 38.4k, 57.6k, 115.2k
278 */ 270 */
@@ -340,22 +332,9 @@ void mac_init_scc_port(int cflag, int port)
340 SCCA_WRITE(3, reg3 | 1); 332 SCCA_WRITE(3, reg3 | 1);
341 SCCA_WRITE(5, reg5 | 8); 333 SCCA_WRITE(5, reg5 | 8);
342 } 334 }
343
344 mac_SCC_reset_done = 1;
345 mac_SCC_init_done = 1;
346} 335}
347#endif /* DEBUG_SERIAL */ 336#endif /* DEBUG_SERIAL */
348 337
349void mac_init_scca_port(int cflag)
350{
351 mac_init_scc_port(cflag, 0);
352}
353
354void mac_init_sccb_port(int cflag)
355{
356 mac_init_scc_port(cflag, 1);
357}
358
359static int __init mac_debug_setup(char *arg) 338static int __init mac_debug_setup(char *arg)
360{ 339{
361 if (!MACH_IS_MAC) 340 if (!MACH_IS_MAC)
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index 3c943d2ec570..43d83e054b8e 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -30,8 +30,8 @@
30int oss_present; 30int oss_present;
31volatile struct mac_oss *oss; 31volatile struct mac_oss *oss;
32 32
33irqreturn_t oss_irq(int, void *); 33static irqreturn_t oss_irq(int, void *);
34irqreturn_t oss_nubus_irq(int, void *); 34static irqreturn_t oss_nubus_irq(int, void *);
35 35
36extern irqreturn_t via1_irq(int, void *); 36extern irqreturn_t via1_irq(int, void *);
37extern irqreturn_t mac_scc_dispatch(int, void *); 37extern irqreturn_t mac_scc_dispatch(int, void *);
@@ -92,7 +92,7 @@ void __init oss_nubus_init(void)
92 * and SCSI; everything else is routed to its own autovector IRQ. 92 * and SCSI; everything else is routed to its own autovector IRQ.
93 */ 93 */
94 94
95irqreturn_t oss_irq(int irq, void *dev_id) 95static irqreturn_t oss_irq(int irq, void *dev_id)
96{ 96{
97 int events; 97 int events;
98 98
@@ -126,7 +126,7 @@ irqreturn_t oss_irq(int irq, void *dev_id)
126 * Unlike the VIA/RBV this is on its own autovector interrupt level. 126 * Unlike the VIA/RBV this is on its own autovector interrupt level.
127 */ 127 */
128 128
129irqreturn_t oss_nubus_irq(int irq, void *dev_id) 129static irqreturn_t oss_nubus_irq(int irq, void *dev_id)
130{ 130{
131 int events, irq_bit, i; 131 int events, irq_bit, i;
132 132
diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
index d66f723b17c3..f84a4dd64f94 100644
--- a/arch/m68k/mac/psc.c
+++ b/arch/m68k/mac/psc.c
@@ -36,7 +36,7 @@ irqreturn_t psc_irq(int, void *);
36 * Debugging dump, used in various places to see what's going on. 36 * Debugging dump, used in various places to see what's going on.
37 */ 37 */
38 38
39void psc_debug_dump(void) 39static void psc_debug_dump(void)
40{ 40{
41 int i; 41 int i;
42 42
@@ -55,7 +55,7 @@ void psc_debug_dump(void)
55 * expanded to cover what I think are the other 7 channels. 55 * expanded to cover what I think are the other 7 channels.
56 */ 56 */
57 57
58void psc_dma_die_die_die(void) 58static void psc_dma_die_die_die(void)
59{ 59{
60 int i; 60 int i;
61 61
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index fa485df4160e..f3b27d04a31f 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -45,7 +45,7 @@ volatile long *via_memory_bogon=(long *)&via_memory_bogon;
45int rbv_present; 45int rbv_present;
46int via_alt_mapping; 46int via_alt_mapping;
47EXPORT_SYMBOL(via_alt_mapping); 47EXPORT_SYMBOL(via_alt_mapping);
48__u8 rbv_clear; 48static __u8 rbv_clear;
49 49
50/* 50/*
51 * Globals for accessing the VIA chip registers without having to 51 * Globals for accessing the VIA chip registers without having to
diff --git a/arch/m68k/math-emu/Makefile b/arch/m68k/math-emu/Makefile
index 539940401814..a0935bf98362 100644
--- a/arch/m68k/math-emu/Makefile
+++ b/arch/m68k/math-emu/Makefile
@@ -2,8 +2,6 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5EXTRA_AFLAGS := -traditional
6
7#EXTRA_AFLAGS += -DFPU_EMU_DEBUG 5#EXTRA_AFLAGS += -DFPU_EMU_DEBUG
8#EXTRA_CFLAGS += -DFPU_EMU_DEBUG 6#EXTRA_CFLAGS += -DFPU_EMU_DEBUG
9 7
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 30d34f285024..226795bdf355 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -285,7 +285,6 @@ void __init paging_init(void)
285 * to a couple of allocated pages 285 * to a couple of allocated pages
286 */ 286 */
287 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); 287 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
288 memset(empty_zero_page, 0, PAGE_SIZE);
289 288
290 /* 289 /*
291 * Set up SFC/DFC registers 290 * Set up SFC/DFC registers
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
index 6a6513aa1ce8..edceefc18870 100644
--- a/arch/m68k/mm/sun3mmu.c
+++ b/arch/m68k/mm/sun3mmu.c
@@ -53,7 +53,6 @@ void __init paging_init(void)
53 wp_works_ok = 0; 53 wp_works_ok = 0;
54#endif 54#endif
55 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); 55 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
56 memset(empty_zero_page, 0, PAGE_SIZE);
57 56
58 address = PAGE_OFFSET; 57 address = PAGE_OFFSET;
59 pg_dir = swapper_pg_dir; 58 pg_dir = swapper_pg_dir;
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 476e18eca758..be9de2f3dc48 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -41,14 +41,12 @@ static void q40_get_model(char *model);
41static int q40_get_hardware_list(char *buffer); 41static int q40_get_hardware_list(char *buffer);
42extern void q40_sched_init(irq_handler_t handler); 42extern void q40_sched_init(irq_handler_t handler);
43 43
44extern unsigned long q40_gettimeoffset(void); 44static unsigned long q40_gettimeoffset(void);
45extern int q40_hwclk(int, struct rtc_time *); 45static int q40_hwclk(int, struct rtc_time *);
46extern unsigned int q40_get_ss(void); 46static unsigned int q40_get_ss(void);
47extern int q40_set_clock_mmss(unsigned long); 47static int q40_set_clock_mmss(unsigned long);
48static int q40_get_rtc_pll(struct rtc_pll_info *pll); 48static int q40_get_rtc_pll(struct rtc_pll_info *pll);
49static int q40_set_rtc_pll(struct rtc_pll_info *pll); 49static int q40_set_rtc_pll(struct rtc_pll_info *pll);
50extern void q40_reset(void);
51void q40_halt(void);
52extern void q40_waitbut(void); 50extern void q40_waitbut(void);
53void q40_set_vectors(void); 51void q40_set_vectors(void);
54 52
@@ -127,7 +125,7 @@ static void q40_heartbeat(int on)
127} 125}
128#endif 126#endif
129 127
130void q40_reset(void) 128static void q40_reset(void)
131{ 129{
132 halted = 1; 130 halted = 1;
133 printk("\n\n*******************************************\n" 131 printk("\n\n*******************************************\n"
@@ -137,7 +135,8 @@ void q40_reset(void)
137 while (1) 135 while (1)
138 ; 136 ;
139} 137}
140void q40_halt(void) 138
139static void q40_halt(void)
141{ 140{
142 halted = 1; 141 halted = 1;
143 printk("\n\n*******************\n" 142 printk("\n\n*******************\n"
@@ -165,7 +164,8 @@ static unsigned int serports[] =
165{ 164{
166 0x3f8,0x2f8,0x3e8,0x2e8,0 165 0x3f8,0x2f8,0x3e8,0x2e8,0
167}; 166};
168void q40_disable_irqs(void) 167
168static void q40_disable_irqs(void)
169{ 169{
170 unsigned i, j; 170 unsigned i, j;
171 171
@@ -227,7 +227,7 @@ static inline unsigned char bin2bcd(unsigned char b)
227} 227}
228 228
229 229
230unsigned long q40_gettimeoffset(void) 230static unsigned long q40_gettimeoffset(void)
231{ 231{
232 return 5000 * (ql_ticks != 0); 232 return 5000 * (ql_ticks != 0);
233} 233}
@@ -248,7 +248,7 @@ unsigned long q40_gettimeoffset(void)
248 * }; 248 * };
249 */ 249 */
250 250
251int q40_hwclk(int op, struct rtc_time *t) 251static int q40_hwclk(int op, struct rtc_time *t)
252{ 252{
253 if (op) { 253 if (op) {
254 /* Write.... */ 254 /* Write.... */
@@ -285,7 +285,7 @@ int q40_hwclk(int op, struct rtc_time *t)
285 return 0; 285 return 0;
286} 286}
287 287
288unsigned int q40_get_ss(void) 288static unsigned int q40_get_ss(void)
289{ 289{
290 return bcd2bin(Q40_RTC_SECS); 290 return bcd2bin(Q40_RTC_SECS);
291} 291}
@@ -295,7 +295,7 @@ unsigned int q40_get_ss(void)
295 * clock is out by > 30 minutes. Logic lifted from atari code. 295 * clock is out by > 30 minutes. Logic lifted from atari code.
296 */ 296 */
297 297
298int q40_set_clock_mmss(unsigned long nowtime) 298static int q40_set_clock_mmss(unsigned long nowtime)
299{ 299{
300 int retval = 0; 300 int retval = 0;
301 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; 301 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
diff --git a/arch/m68k/sun3/Makefile b/arch/m68k/sun3/Makefile
index be1a8470d636..38ba0e0cedad 100644
--- a/arch/m68k/sun3/Makefile
+++ b/arch/m68k/sun3/Makefile
@@ -2,6 +2,6 @@
2# Makefile for Linux arch/m68k/sun3 source directory 2# Makefile for Linux arch/m68k/sun3 source directory
3# 3#
4 4
5obj-y := sun3ints.o sun3dvma.o sbus.o idprom.o 5obj-y := sun3ints.o sun3dvma.o idprom.o
6 6
7obj-$(CONFIG_SUN3) += config.o mmu_emu.o leds.o dvma.o intersil.o 7obj-$(CONFIG_SUN3) += config.o mmu_emu.o leds.o dvma.o intersil.o
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index c0fbd278fbb1..732087d0735c 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -36,7 +36,7 @@ extern char _text, _end;
36char sun3_reserved_pmeg[SUN3_PMEGS_NUM]; 36char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
37 37
38extern unsigned long sun3_gettimeoffset(void); 38extern unsigned long sun3_gettimeoffset(void);
39extern void sun3_sched_init(irq_handler_t handler); 39static void sun3_sched_init(irq_handler_t handler);
40extern void sun3_get_model (char* model); 40extern void sun3_get_model (char* model);
41extern void idprom_init (void); 41extern void idprom_init (void);
42extern int sun3_hwclk(int set, struct rtc_time *t); 42extern int sun3_hwclk(int set, struct rtc_time *t);
@@ -114,7 +114,8 @@ static void sun3_halt (void)
114 114
115/* sun3 bootmem allocation */ 115/* sun3 bootmem allocation */
116 116
117void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_end) 117static void __init sun3_bootmem_alloc(unsigned long memory_start,
118 unsigned long memory_end)
118{ 119{
119 unsigned long start_page; 120 unsigned long start_page;
120 121
@@ -164,7 +165,7 @@ void __init config_sun3(void)
164 sun3_bootmem_alloc(memory_start, memory_end); 165 sun3_bootmem_alloc(memory_start, memory_end);
165} 166}
166 167
167void __init sun3_sched_init(irq_handler_t timer_routine) 168static void __init sun3_sched_init(irq_handler_t timer_routine)
168{ 169{
169 sun3_disable_interrupts(); 170 sun3_disable_interrupts();
170 intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE); 171 intersil_clock->cmd_reg=(INTERSIL_RUN|INTERSIL_INT_DISABLE|INTERSIL_24H_MODE);
diff --git a/arch/m68k/sun3/dvma.c b/arch/m68k/sun3/dvma.c
index d2b3093f2405..d522eaab4551 100644
--- a/arch/m68k/sun3/dvma.c
+++ b/arch/m68k/sun3/dvma.c
@@ -19,7 +19,7 @@
19 19
20static unsigned long ptelist[120]; 20static unsigned long ptelist[120];
21 21
22inline unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr) 22static unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr)
23{ 23{
24 unsigned long pte; 24 unsigned long pte;
25 unsigned long j; 25 unsigned long j;
diff --git a/arch/m68k/sun3/idprom.c b/arch/m68k/sun3/idprom.c
index dca6ab6a4ede..c86ac37d1983 100644
--- a/arch/m68k/sun3/idprom.c
+++ b/arch/m68k/sun3/idprom.c
@@ -1,4 +1,4 @@
1/* $Id: idprom.c,v 1.22 1996/11/13 05:09:25 davem Exp $ 1/*
2 * idprom.c: Routines to load the idprom into kernel addresses and 2 * idprom.c: Routines to load the idprom into kernel addresses and
3 * interpret the data contained within. 3 * interpret the data contained within.
4 * 4 *
@@ -25,7 +25,7 @@ static struct idprom idprom_buffer;
25 * of the Sparc CPU and have a meaningful IDPROM machtype value that we 25 * of the Sparc CPU and have a meaningful IDPROM machtype value that we
26 * know about. See asm-sparc/machines.h for empirical constants. 26 * know about. See asm-sparc/machines.h for empirical constants.
27 */ 27 */
28struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = { 28static struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES] = {
29/* First, Sun3's */ 29/* First, Sun3's */
30 { .name = "Sun 3/160 Series", .id_machtype = (SM_SUN3 | SM_3_160) }, 30 { .name = "Sun 3/160 Series", .id_machtype = (SM_SUN3 | SM_3_160) },
31 { .name = "Sun 3/50", .id_machtype = (SM_SUN3 | SM_3_50) }, 31 { .name = "Sun 3/50", .id_machtype = (SM_SUN3 | SM_3_50) },
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index fb0f6a20cc3c..60f9d4500d72 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -55,7 +55,7 @@ unsigned char pmeg_ctx[PMEGS_NUM];
55 55
56/* pointers to the mm structs for each task in each 56/* pointers to the mm structs for each task in each
57 context. 0xffffffff is a marker for kernel context */ 57 context. 0xffffffff is a marker for kernel context */
58struct mm_struct *ctx_alloc[CONTEXTS_NUM] = { 58static struct mm_struct *ctx_alloc[CONTEXTS_NUM] = {
59 [0] = (struct mm_struct *)0xffffffff 59 [0] = (struct mm_struct *)0xffffffff
60}; 60};
61 61
diff --git a/arch/m68k/sun3/prom/Makefile b/arch/m68k/sun3/prom/Makefile
index 6e48ae2a7175..da7eac06bca0 100644
--- a/arch/m68k/sun3/prom/Makefile
+++ b/arch/m68k/sun3/prom/Makefile
@@ -1,4 +1,3 @@
1# $Id: Makefile,v 1.5 1995/11/25 00:59:48 davem Exp $
2# Makefile for the Sun Boot PROM interface library under 1# Makefile for the Sun Boot PROM interface library under
3# Linux. 2# Linux.
4# 3#
diff --git a/arch/m68k/sun3/prom/console.c b/arch/m68k/sun3/prom/console.c
index 52c1427863de..2bcb6e4bfe54 100644
--- a/arch/m68k/sun3/prom/console.c
+++ b/arch/m68k/sun3/prom/console.c
@@ -1,4 +1,4 @@
1/* $Id: console.c,v 1.10 1996/12/18 06:46:54 tridge Exp $ 1/*
2 * console.c: Routines that deal with sending and receiving IO 2 * console.c: Routines that deal with sending and receiving IO
3 * to/from the current console device using the PROM. 3 * to/from the current console device using the PROM.
4 * 4 *
@@ -104,8 +104,6 @@ prom_query_input_device()
104 return PROMDEV_ITTYB; 104 return PROMDEV_ITTYB;
105 } 105 }
106 return PROMDEV_I_UNK; 106 return PROMDEV_I_UNK;
107 case PROM_AP1000:
108 return PROMDEV_I_UNK;
109 }; 107 };
110} 108}
111#endif 109#endif
@@ -166,8 +164,6 @@ prom_query_output_device()
166 }; 164 };
167 } 165 }
168 break; 166 break;
169 case PROM_AP1000:
170 return PROMDEV_I_UNK;
171 }; 167 };
172 return PROMDEV_O_UNK; 168 return PROMDEV_O_UNK;
173} 169}
diff --git a/arch/m68k/sun3/prom/init.c b/arch/m68k/sun3/prom/init.c
index 202adfcc316e..d8e6349336b4 100644
--- a/arch/m68k/sun3/prom/init.c
+++ b/arch/m68k/sun3/prom/init.c
@@ -1,4 +1,4 @@
1/* $Id: init.c,v 1.9 1996/12/18 06:46:55 tridge Exp $ 1/*
2 * init.c: Initialize internal variables used by the PROM 2 * init.c: Initialize internal variables used by the PROM
3 * library functions. 3 * library functions.
4 * 4 *
@@ -31,11 +31,6 @@ extern void prom_ranges_init(void);
31 31
32void __init prom_init(struct linux_romvec *rp) 32void __init prom_init(struct linux_romvec *rp)
33{ 33{
34#ifdef CONFIG_AP1000
35 extern struct linux_romvec *ap_prom_init(void);
36 rp = ap_prom_init();
37#endif
38
39 romvec = rp; 34 romvec = rp;
40#ifndef CONFIG_SUN3 35#ifndef CONFIG_SUN3
41 switch(romvec->pv_romvers) { 36 switch(romvec->pv_romvers) {
@@ -53,10 +48,6 @@ void __init prom_init(struct linux_romvec *rp)
53 prom_printf("PROMLIB: Sun IEEE Prom not supported yet\n"); 48 prom_printf("PROMLIB: Sun IEEE Prom not supported yet\n");
54 prom_halt(); 49 prom_halt();
55 break; 50 break;
56 case 42: /* why not :-) */
57 prom_vers = PROM_AP1000;
58 break;
59
60 default: 51 default:
61 prom_printf("PROMLIB: Bad PROM version %d\n", 52 prom_printf("PROMLIB: Bad PROM version %d\n",
62 romvec->pv_romvers); 53 romvec->pv_romvers);
diff --git a/arch/m68k/sun3/prom/misc.c b/arch/m68k/sun3/prom/misc.c
index b88716f2c68c..3d60e1337f75 100644
--- a/arch/m68k/sun3/prom/misc.c
+++ b/arch/m68k/sun3/prom/misc.c
@@ -1,4 +1,4 @@
1/* $Id: misc.c,v 1.15 1997/05/14 20:45:00 davem Exp $ 1/*
2 * misc.c: Miscellaneous prom functions that don't belong 2 * misc.c: Miscellaneous prom functions that don't belong
3 * anywhere else. 3 * anywhere else.
4 * 4 *
diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c
index e7bfde377b5e..df85018f487a 100644
--- a/arch/m68k/sun3/prom/printf.c
+++ b/arch/m68k/sun3/prom/printf.c
@@ -1,4 +1,4 @@
1/* $Id: printf.c,v 1.5 1996/04/04 16:31:07 tridge Exp $ 1/*
2 * printf.c: Internal prom library printf facility. 2 * printf.c: Internal prom library printf facility.
3 * 3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -37,10 +37,6 @@ prom_printf(char *fmt, ...)
37 37
38 bptr = ppbuf; 38 bptr = ppbuf;
39 39
40#ifdef CONFIG_AP1000
41 ap_write(1,bptr,strlen(bptr));
42#else
43
44#ifdef CONFIG_KGDB 40#ifdef CONFIG_KGDB
45 if (kgdb_initialized) { 41 if (kgdb_initialized) {
46 printk("kgdb_initialized = %d\n", kgdb_initialized); 42 printk("kgdb_initialized = %d\n", kgdb_initialized);
@@ -54,7 +50,6 @@ prom_printf(char *fmt, ...)
54 prom_putchar(ch); 50 prom_putchar(ch);
55 } 51 }
56#endif 52#endif
57#endif
58 va_end(args); 53 va_end(args);
59 return; 54 return;
60} 55}
diff --git a/arch/m68k/sun3/sbus.c b/arch/m68k/sun3/sbus.c
deleted file mode 100644
index babdbfa3cda7..000000000000
--- a/arch/m68k/sun3/sbus.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * SBus helper functions
3 *
4 * Sun3 don't have a sbus, but many of the used devices are also
5 * used on Sparc machines with sbus. To avoid having a lot of
6 * duplicate code, we provide necessary glue stuff to make using
7 * of the sbus driver code possible.
8 *
9 * (C) 1999 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */
11
12#include <linux/types.h>
13#include <linux/compiler.h>
14#include <linux/init.h>
15
16int __init sbus_init(void)
17{
18 return 0;
19}
20
21void *sparc_alloc_io (u32 address, void *virtual, int len, char *name,
22 u32 bus_type, int rdonly)
23{
24 return (void *)address;
25}
26
27subsys_initcall(sbus_init);
diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
index 8709677fa025..f9277e8b4159 100644
--- a/arch/m68k/sun3/sun3dvma.c
+++ b/arch/m68k/sun3/sun3dvma.c
@@ -29,7 +29,7 @@ static inline void dvma_unmap_iommu(unsigned long a, int b)
29extern void sun3_dvma_init(void); 29extern void sun3_dvma_init(void);
30#endif 30#endif
31 31
32unsigned long iommu_use[IOMMU_TOTAL_ENTRIES]; 32static unsigned long iommu_use[IOMMU_TOTAL_ENTRIES];
33 33
34#define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT) 34#define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
35 35
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index cf93481adb1d..7364cd67455e 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -30,7 +30,7 @@ void sun3_enable_interrupts(void)
30 sun3_enable_irq(0); 30 sun3_enable_irq(0);
31} 31}
32 32
33int led_pattern[8] = { 33static int led_pattern[8] = {
34 ~(0x80), ~(0x01), 34 ~(0x80), ~(0x01),
35 ~(0x40), ~(0x02), 35 ~(0x40), ~(0x02),
36 ~(0x20), ~(0x04), 36 ~(0x20), ~(0x04),
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index b9c268c6b2fb..8b054e7a8ae8 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -392,7 +392,7 @@ static int mask_test_and_clear(volatile u8 *ptr, u8 mask)
392static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) 392static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port)
393{ 393{
394 struct uart_icount *icount = &port->uart.icount; 394 struct uart_icount *icount = &port->uart.icount;
395 struct tty_struct *tty = port->uart.info->tty; 395 struct tty_struct *tty = port->uart.info->port.tty;
396 unsigned ix; 396 unsigned ix;
397 int count; 397 int count;
398 u8 st, ch, push, status, overrun; 398 u8 st, ch, push, status, overrun;
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index e6caf5d42e0e..61b6c5beb2d3 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -380,9 +380,6 @@ static int __init bay_init(void)
380 if (acpi_disabled) 380 if (acpi_disabled)
381 return -ENODEV; 381 return -ENODEV;
382 382
383 if (acpi_disabled)
384 return -ENODEV;
385
386 /* look for dockable drive bays */ 383 /* look for dockable drive bays */
387 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 384 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
388 ACPI_UINT32_MAX, find_bay, &bays, NULL); 385 ACPI_UINT32_MAX, find_bay, &bays, NULL);
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 1e872e79db33..bb7c51f712bd 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -920,9 +920,6 @@ static int __init dock_init(void)
920 if (acpi_disabled) 920 if (acpi_disabled)
921 return 0; 921 return 0;
922 922
923 if (acpi_disabled)
924 return 0;
925
926 /* look for a dock station */ 923 /* look for a dock station */
927 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 924 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
928 ACPI_UINT32_MAX, find_dock, &num, NULL); 925 ACPI_UINT32_MAX, find_dock, &num, NULL);
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 0f2dd81736bd..2f173e83f8a7 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -338,9 +338,6 @@ static int __init acpi_rtc_init(void)
338 if (acpi_disabled) 338 if (acpi_disabled)
339 return 0; 339 return 0;
340 340
341 if (acpi_disabled)
342 return 0;
343
344 if (dev) { 341 if (dev) {
345 rtc_wake_setup(); 342 rtc_wake_setup();
346 rtc_info.wake_on = rtc_wake_on; 343 rtc_info.wake_on = rtc_wake_on;
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 424995073c6b..49f274197b16 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1880,11 +1880,11 @@ static int __init atari_floppy_init (void)
1880 1880
1881 if (!MACH_IS_ATARI) 1881 if (!MACH_IS_ATARI)
1882 /* Amiga, Mac, ... don't have Atari-compatible floppy :-) */ 1882 /* Amiga, Mac, ... don't have Atari-compatible floppy :-) */
1883 return -ENXIO; 1883 return -ENODEV;
1884 1884
1885 if (MACH_IS_HADES) 1885 if (MACH_IS_HADES)
1886 /* Hades doesn't have Atari-compatible floppy */ 1886 /* Hades doesn't have Atari-compatible floppy */
1887 return -ENXIO; 1887 return -ENODEV;
1888 1888
1889 if (register_blkdev(FLOPPY_MAJOR,"fd")) 1889 if (register_blkdev(FLOPPY_MAJOR,"fd"))
1890 return -EBUSY; 1890 return -EBUSY;
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index e5cd856a2fea..69df187d74ce 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -282,8 +282,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)
282 /* FIXME: why is this needed. Note don't use ldisc_ref here as the 282 /* FIXME: why is this needed. Note don't use ldisc_ref here as the
283 open path is before the ldisc is referencable */ 283 open path is before the ldisc is referencable */
284 284
285 if (tty->ldisc.flush_buffer) 285 if (tty->ldisc.ops->flush_buffer)
286 tty->ldisc.flush_buffer(tty); 286 tty->ldisc.ops->flush_buffer(tty);
287 tty_driver_flush_buffer(tty); 287 tty_driver_flush_buffer(tty);
288 288
289 return 0; 289 return 0;
@@ -514,7 +514,7 @@ static unsigned int hci_uart_tty_poll(struct tty_struct *tty,
514 514
515static int __init hci_uart_init(void) 515static int __init hci_uart_init(void)
516{ 516{
517 static struct tty_ldisc hci_uart_ldisc; 517 static struct tty_ldisc_ops hci_uart_ldisc;
518 int err; 518 int err;
519 519
520 BT_INFO("HCI UART driver ver %s", VERSION); 520 BT_INFO("HCI UART driver ver %s", VERSION);
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 6bff9d87dc57..e991dc85f2fb 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -762,7 +762,7 @@ static int cy_next_channel; /* next minor available */
762/* 762/*
763 * This is used to look up the divisor speeds and the timeouts 763 * This is used to look up the divisor speeds and the timeouts
764 * We're normally limited to 15 distinct baud rates. The extra 764 * We're normally limited to 15 distinct baud rates. The extra
765 * are accessed via settings in info->flags. 765 * are accessed via settings in info->port.flags.
766 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 766 * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
767 * 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 767 * 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
768 * HI VHI 768 * HI VHI
@@ -1003,7 +1003,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
1003 cy_writeb(base_addr + (CyCAR << index), save_xir); 1003 cy_writeb(base_addr + (CyCAR << index), save_xir);
1004 1004
1005 /* if there is nowhere to put the data, discard it */ 1005 /* if there is nowhere to put the data, discard it */
1006 if (info->tty == NULL) { 1006 if (info->port.tty == NULL) {
1007 if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == 1007 if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
1008 CyIVRRxEx) { /* exception */ 1008 CyIVRRxEx) { /* exception */
1009 data = readb(base_addr + (CyRDSR << index)); 1009 data = readb(base_addr + (CyRDSR << index));
@@ -1015,7 +1015,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
1015 goto end; 1015 goto end;
1016 } 1016 }
1017 /* there is an open port for this data */ 1017 /* there is an open port for this data */
1018 tty = info->tty; 1018 tty = info->port.tty;
1019 if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) == 1019 if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
1020 CyIVRRxEx) { /* exception */ 1020 CyIVRRxEx) { /* exception */
1021 data = readb(base_addr + (CyRDSR << index)); 1021 data = readb(base_addr + (CyRDSR << index));
@@ -1041,7 +1041,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
1041 readb(base_addr + (CyRDSR << 1041 readb(base_addr + (CyRDSR <<
1042 index)), TTY_BREAK); 1042 index)), TTY_BREAK);
1043 info->icount.rx++; 1043 info->icount.rx++;
1044 if (info->flags & ASYNC_SAK) 1044 if (info->port.flags & ASYNC_SAK)
1045 do_SAK(tty); 1045 do_SAK(tty);
1046 } else if (data & CyFRAME) { 1046 } else if (data & CyFRAME) {
1047 tty_insert_flip_char(tty, 1047 tty_insert_flip_char(tty,
@@ -1145,7 +1145,7 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
1145 goto end; 1145 goto end;
1146 } 1146 }
1147 info = &cinfo->ports[channel + chip * 4]; 1147 info = &cinfo->ports[channel + chip * 4];
1148 if (info->tty == NULL) { 1148 if (info->port.tty == NULL) {
1149 cy_writeb(base_addr + (CySRER << index), 1149 cy_writeb(base_addr + (CySRER << index),
1150 readb(base_addr + (CySRER << index)) & ~CyTxRdy); 1150 readb(base_addr + (CySRER << index)) & ~CyTxRdy);
1151 goto end; 1151 goto end;
@@ -1190,13 +1190,13 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
1190 } 1190 }
1191 goto done; 1191 goto done;
1192 } 1192 }
1193 if (info->xmit_buf == NULL) { 1193 if (info->port.xmit_buf == NULL) {
1194 cy_writeb(base_addr + (CySRER << index), 1194 cy_writeb(base_addr + (CySRER << index),
1195 readb(base_addr + (CySRER << index)) & 1195 readb(base_addr + (CySRER << index)) &
1196 ~CyTxRdy); 1196 ~CyTxRdy);
1197 goto done; 1197 goto done;
1198 } 1198 }
1199 if (info->tty->stopped || info->tty->hw_stopped) { 1199 if (info->port.tty->stopped || info->port.tty->hw_stopped) {
1200 cy_writeb(base_addr + (CySRER << index), 1200 cy_writeb(base_addr + (CySRER << index),
1201 readb(base_addr + (CySRER << index)) & 1201 readb(base_addr + (CySRER << index)) &
1202 ~CyTxRdy); 1202 ~CyTxRdy);
@@ -1211,7 +1211,7 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
1211 * character. This is necessary because there may not be room 1211 * character. This is necessary because there may not be room
1212 * for the two chars needed to send a NULL.) 1212 * for the two chars needed to send a NULL.)
1213 */ 1213 */
1214 outch = info->xmit_buf[info->xmit_tail]; 1214 outch = info->port.xmit_buf[info->xmit_tail];
1215 if (outch) { 1215 if (outch) {
1216 info->xmit_cnt--; 1216 info->xmit_cnt--;
1217 info->xmit_tail = (info->xmit_tail + 1) & 1217 info->xmit_tail = (info->xmit_tail + 1) &
@@ -1232,7 +1232,7 @@ static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
1232 } 1232 }
1233 1233
1234done: 1234done:
1235 tty_wakeup(info->tty); 1235 tty_wakeup(info->port.tty);
1236end: 1236end:
1237 /* end of service */ 1237 /* end of service */
1238 cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f); 1238 cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f);
@@ -1256,7 +1256,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
1256 mdm_change = readb(base_addr + (CyMISR << index)); 1256 mdm_change = readb(base_addr + (CyMISR << index));
1257 mdm_status = readb(base_addr + (CyMSVR1 << index)); 1257 mdm_status = readb(base_addr + (CyMSVR1 << index));
1258 1258
1259 if (!info->tty) 1259 if (!info->port.tty)
1260 goto end; 1260 goto end;
1261 1261
1262 if (mdm_change & CyANY_DELTA) { 1262 if (mdm_change & CyANY_DELTA) {
@@ -1273,29 +1273,29 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
1273 wake_up_interruptible(&info->delta_msr_wait); 1273 wake_up_interruptible(&info->delta_msr_wait);
1274 } 1274 }
1275 1275
1276 if ((mdm_change & CyDCD) && (info->flags & ASYNC_CHECK_CD)) { 1276 if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) {
1277 if (!(mdm_status & CyDCD)) { 1277 if (!(mdm_status & CyDCD)) {
1278 tty_hangup(info->tty); 1278 tty_hangup(info->port.tty);
1279 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1279 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1280 } 1280 }
1281 wake_up_interruptible(&info->open_wait); 1281 wake_up_interruptible(&info->port.open_wait);
1282 } 1282 }
1283 if ((mdm_change & CyCTS) && (info->flags & ASYNC_CTS_FLOW)) { 1283 if ((mdm_change & CyCTS) && (info->port.flags & ASYNC_CTS_FLOW)) {
1284 if (info->tty->hw_stopped) { 1284 if (info->port.tty->hw_stopped) {
1285 if (mdm_status & CyCTS) { 1285 if (mdm_status & CyCTS) {
1286 /* cy_start isn't used 1286 /* cy_start isn't used
1287 because... !!! */ 1287 because... !!! */
1288 info->tty->hw_stopped = 0; 1288 info->port.tty->hw_stopped = 0;
1289 cy_writeb(base_addr + (CySRER << index), 1289 cy_writeb(base_addr + (CySRER << index),
1290 readb(base_addr + (CySRER << index)) | 1290 readb(base_addr + (CySRER << index)) |
1291 CyTxRdy); 1291 CyTxRdy);
1292 tty_wakeup(info->tty); 1292 tty_wakeup(info->port.tty);
1293 } 1293 }
1294 } else { 1294 } else {
1295 if (!(mdm_status & CyCTS)) { 1295 if (!(mdm_status & CyCTS)) {
1296 /* cy_stop isn't used 1296 /* cy_stop isn't used
1297 because ... !!! */ 1297 because ... !!! */
1298 info->tty->hw_stopped = 1; 1298 info->port.tty->hw_stopped = 1;
1299 cy_writeb(base_addr + (CySRER << index), 1299 cy_writeb(base_addr + (CySRER << index),
1300 readb(base_addr + (CySRER << index)) & 1300 readb(base_addr + (CySRER << index)) &
1301 ~CyTxRdy); 1301 ~CyTxRdy);
@@ -1449,7 +1449,7 @@ static void cyz_handle_rx(struct cyclades_port *info,
1449 struct BUF_CTRL __iomem *buf_ctrl) 1449 struct BUF_CTRL __iomem *buf_ctrl)
1450{ 1450{
1451 struct cyclades_card *cinfo = info->card; 1451 struct cyclades_card *cinfo = info->card;
1452 struct tty_struct *tty = info->tty; 1452 struct tty_struct *tty = info->port.tty;
1453 unsigned int char_count; 1453 unsigned int char_count;
1454 int len; 1454 int len;
1455#ifdef BLOCKMOVE 1455#ifdef BLOCKMOVE
@@ -1542,7 +1542,7 @@ static void cyz_handle_tx(struct cyclades_port *info,
1542 struct BUF_CTRL __iomem *buf_ctrl) 1542 struct BUF_CTRL __iomem *buf_ctrl)
1543{ 1543{
1544 struct cyclades_card *cinfo = info->card; 1544 struct cyclades_card *cinfo = info->card;
1545 struct tty_struct *tty = info->tty; 1545 struct tty_struct *tty = info->port.tty;
1546 u8 data; 1546 u8 data;
1547 unsigned int char_count; 1547 unsigned int char_count;
1548#ifdef BLOCKMOVE 1548#ifdef BLOCKMOVE
@@ -1585,7 +1585,7 @@ static void cyz_handle_tx(struct cyclades_port *info,
1585 1585
1586 memcpy_toio((char *)(cinfo->base_addr + tx_bufaddr + 1586 memcpy_toio((char *)(cinfo->base_addr + tx_bufaddr +
1587 tx_put), 1587 tx_put),
1588 &info->xmit_buf[info->xmit_tail], 1588 &info->port.xmit_buf[info->xmit_tail],
1589 small_count); 1589 small_count);
1590 1590
1591 tx_put = (tx_put + small_count) & (tx_bufsize - 1); 1591 tx_put = (tx_put + small_count) & (tx_bufsize - 1);
@@ -1597,7 +1597,7 @@ static void cyz_handle_tx(struct cyclades_port *info,
1597 } 1597 }
1598#else 1598#else
1599 while (info->xmit_cnt && char_count) { 1599 while (info->xmit_cnt && char_count) {
1600 data = info->xmit_buf[info->xmit_tail]; 1600 data = info->port.xmit_buf[info->xmit_tail];
1601 info->xmit_cnt--; 1601 info->xmit_cnt--;
1602 info->xmit_tail = (info->xmit_tail + 1) & 1602 info->xmit_tail = (info->xmit_tail + 1) &
1603 (SERIAL_XMIT_SIZE - 1); 1603 (SERIAL_XMIT_SIZE - 1);
@@ -1642,7 +1642,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1642 special_count = 0; 1642 special_count = 0;
1643 delta_count = 0; 1643 delta_count = 0;
1644 info = &cinfo->ports[channel]; 1644 info = &cinfo->ports[channel];
1645 tty = info->tty; 1645 tty = info->port.tty;
1646 if (tty == NULL) 1646 if (tty == NULL)
1647 continue; 1647 continue;
1648 1648
@@ -1668,15 +1668,15 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1668 case C_CM_MDCD: 1668 case C_CM_MDCD:
1669 info->icount.dcd++; 1669 info->icount.dcd++;
1670 delta_count++; 1670 delta_count++;
1671 if (info->flags & ASYNC_CHECK_CD) { 1671 if (info->port.flags & ASYNC_CHECK_CD) {
1672 if ((fw_ver > 241 ? ((u_long) param) : 1672 if ((fw_ver > 241 ? ((u_long) param) :
1673 readl(&ch_ctrl->rs_status)) & 1673 readl(&ch_ctrl->rs_status)) &
1674 C_RS_DCD) { 1674 C_RS_DCD) {
1675 wake_up_interruptible(&info->open_wait); 1675 wake_up_interruptible(&info->port.open_wait);
1676 } else { 1676 } else {
1677 tty_hangup(info->tty); 1677 tty_hangup(info->port.tty);
1678 wake_up_interruptible(&info->open_wait); 1678 wake_up_interruptible(&info->port.open_wait);
1679 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1679 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1680 } 1680 }
1681 } 1681 }
1682 break; 1682 break;
@@ -1814,7 +1814,7 @@ static void cyz_poll(unsigned long arg)
1814 1814
1815 for (port = 0; port < cinfo->nports; port++) { 1815 for (port = 0; port < cinfo->nports; port++) {
1816 info = &cinfo->ports[port]; 1816 info = &cinfo->ports[port];
1817 tty = info->tty; 1817 tty = info->port.tty;
1818 buf_ctrl = &(zfw_ctrl->buf_ctrl[port]); 1818 buf_ctrl = &(zfw_ctrl->buf_ctrl[port]);
1819 1819
1820 if (!info->throttle) 1820 if (!info->throttle)
@@ -1853,22 +1853,22 @@ static int startup(struct cyclades_port *info)
1853 1853
1854 spin_lock_irqsave(&card->card_lock, flags); 1854 spin_lock_irqsave(&card->card_lock, flags);
1855 1855
1856 if (info->flags & ASYNC_INITIALIZED) { 1856 if (info->port.flags & ASYNC_INITIALIZED) {
1857 free_page(page); 1857 free_page(page);
1858 goto errout; 1858 goto errout;
1859 } 1859 }
1860 1860
1861 if (!info->type) { 1861 if (!info->type) {
1862 if (info->tty) 1862 if (info->port.tty)
1863 set_bit(TTY_IO_ERROR, &info->tty->flags); 1863 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
1864 free_page(page); 1864 free_page(page);
1865 goto errout; 1865 goto errout;
1866 } 1866 }
1867 1867
1868 if (info->xmit_buf) 1868 if (info->port.xmit_buf)
1869 free_page(page); 1869 free_page(page);
1870 else 1870 else
1871 info->xmit_buf = (unsigned char *)page; 1871 info->port.xmit_buf = (unsigned char *)page;
1872 1872
1873 spin_unlock_irqrestore(&card->card_lock, flags); 1873 spin_unlock_irqrestore(&card->card_lock, flags);
1874 1874
@@ -1909,10 +1909,10 @@ static int startup(struct cyclades_port *info)
1909 1909
1910 cy_writeb(base_addr + (CySRER << index), 1910 cy_writeb(base_addr + (CySRER << index),
1911 readb(base_addr + (CySRER << index)) | CyRxData); 1911 readb(base_addr + (CySRER << index)) | CyRxData);
1912 info->flags |= ASYNC_INITIALIZED; 1912 info->port.flags |= ASYNC_INITIALIZED;
1913 1913
1914 if (info->tty) 1914 if (info->port.tty)
1915 clear_bit(TTY_IO_ERROR, &info->tty->flags); 1915 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
1916 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 1916 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
1917 info->breakon = info->breakoff = 0; 1917 info->breakon = info->breakoff = 0;
1918 memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); 1918 memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats));
@@ -1994,9 +1994,9 @@ static int startup(struct cyclades_port *info)
1994 1994
1995 /* enable send, recv, modem !!! */ 1995 /* enable send, recv, modem !!! */
1996 1996
1997 info->flags |= ASYNC_INITIALIZED; 1997 info->port.flags |= ASYNC_INITIALIZED;
1998 if (info->tty) 1998 if (info->port.tty)
1999 clear_bit(TTY_IO_ERROR, &info->tty->flags); 1999 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
2000 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 2000 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
2001 info->breakon = info->breakoff = 0; 2001 info->breakon = info->breakoff = 0;
2002 memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats)); 2002 memset((char *)&info->idle_stats, 0, sizeof(info->idle_stats));
@@ -2065,7 +2065,7 @@ static void shutdown(struct cyclades_port *info)
2065 void __iomem *base_addr; 2065 void __iomem *base_addr;
2066 int chip, channel, index; 2066 int chip, channel, index;
2067 2067
2068 if (!(info->flags & ASYNC_INITIALIZED)) 2068 if (!(info->port.flags & ASYNC_INITIALIZED))
2069 return; 2069 return;
2070 2070
2071 card = info->card; 2071 card = info->card;
@@ -2087,14 +2087,14 @@ static void shutdown(struct cyclades_port *info)
2087 /* Clear delta_msr_wait queue to avoid mem leaks. */ 2087 /* Clear delta_msr_wait queue to avoid mem leaks. */
2088 wake_up_interruptible(&info->delta_msr_wait); 2088 wake_up_interruptible(&info->delta_msr_wait);
2089 2089
2090 if (info->xmit_buf) { 2090 if (info->port.xmit_buf) {
2091 unsigned char *temp; 2091 unsigned char *temp;
2092 temp = info->xmit_buf; 2092 temp = info->port.xmit_buf;
2093 info->xmit_buf = NULL; 2093 info->port.xmit_buf = NULL;
2094 free_page((unsigned long)temp); 2094 free_page((unsigned long)temp);
2095 } 2095 }
2096 cy_writeb(base_addr + (CyCAR << index), (u_char) channel); 2096 cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
2097 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { 2097 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) {
2098 cy_writeb(base_addr + (CyMSVR1 << index), ~CyRTS); 2098 cy_writeb(base_addr + (CyMSVR1 << index), ~CyRTS);
2099 cy_writeb(base_addr + (CyMSVR2 << index), ~CyDTR); 2099 cy_writeb(base_addr + (CyMSVR2 << index), ~CyDTR);
2100#ifdef CY_DEBUG_DTR 2100#ifdef CY_DEBUG_DTR
@@ -2108,9 +2108,9 @@ static void shutdown(struct cyclades_port *info)
2108 /* it may be appropriate to clear _XMIT at 2108 /* it may be appropriate to clear _XMIT at
2109 some later date (after testing)!!! */ 2109 some later date (after testing)!!! */
2110 2110
2111 if (info->tty) 2111 if (info->port.tty)
2112 set_bit(TTY_IO_ERROR, &info->tty->flags); 2112 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
2113 info->flags &= ~ASYNC_INITIALIZED; 2113 info->port.flags &= ~ASYNC_INITIALIZED;
2114 spin_unlock_irqrestore(&card->card_lock, flags); 2114 spin_unlock_irqrestore(&card->card_lock, flags);
2115 } else { 2115 } else {
2116 struct FIRM_ID __iomem *firm_id; 2116 struct FIRM_ID __iomem *firm_id;
@@ -2136,14 +2136,14 @@ static void shutdown(struct cyclades_port *info)
2136 2136
2137 spin_lock_irqsave(&card->card_lock, flags); 2137 spin_lock_irqsave(&card->card_lock, flags);
2138 2138
2139 if (info->xmit_buf) { 2139 if (info->port.xmit_buf) {
2140 unsigned char *temp; 2140 unsigned char *temp;
2141 temp = info->xmit_buf; 2141 temp = info->port.xmit_buf;
2142 info->xmit_buf = NULL; 2142 info->port.xmit_buf = NULL;
2143 free_page((unsigned long)temp); 2143 free_page((unsigned long)temp);
2144 } 2144 }
2145 2145
2146 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { 2146 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) {
2147 cy_writel(&ch_ctrl[channel].rs_control, 2147 cy_writel(&ch_ctrl[channel].rs_control,
2148 (__u32)(readl(&ch_ctrl[channel].rs_control) & 2148 (__u32)(readl(&ch_ctrl[channel].rs_control) &
2149 ~(C_RS_RTS | C_RS_DTR))); 2149 ~(C_RS_RTS | C_RS_DTR)));
@@ -2158,9 +2158,9 @@ static void shutdown(struct cyclades_port *info)
2158#endif 2158#endif
2159 } 2159 }
2160 2160
2161 if (info->tty) 2161 if (info->port.tty)
2162 set_bit(TTY_IO_ERROR, &info->tty->flags); 2162 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
2163 info->flags &= ~ASYNC_INITIALIZED; 2163 info->port.flags &= ~ASYNC_INITIALIZED;
2164 2164
2165 spin_unlock_irqrestore(&card->card_lock, flags); 2165 spin_unlock_irqrestore(&card->card_lock, flags);
2166 } 2166 }
@@ -2194,10 +2194,10 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2194 * If the device is in the middle of being closed, then block 2194 * If the device is in the middle of being closed, then block
2195 * until it's done, and then try again. 2195 * until it's done, and then try again.
2196 */ 2196 */
2197 if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) { 2197 if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) {
2198 wait_event_interruptible(info->close_wait, 2198 wait_event_interruptible(info->port.close_wait,
2199 !(info->flags & ASYNC_CLOSING)); 2199 !(info->port.flags & ASYNC_CLOSING));
2200 return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; 2200 return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS;
2201 } 2201 }
2202 2202
2203 /* 2203 /*
@@ -2206,32 +2206,32 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2206 */ 2206 */
2207 if ((filp->f_flags & O_NONBLOCK) || 2207 if ((filp->f_flags & O_NONBLOCK) ||
2208 (tty->flags & (1 << TTY_IO_ERROR))) { 2208 (tty->flags & (1 << TTY_IO_ERROR))) {
2209 info->flags |= ASYNC_NORMAL_ACTIVE; 2209 info->port.flags |= ASYNC_NORMAL_ACTIVE;
2210 return 0; 2210 return 0;
2211 } 2211 }
2212 2212
2213 /* 2213 /*
2214 * Block waiting for the carrier detect and the line to become 2214 * Block waiting for the carrier detect and the line to become
2215 * free (i.e., not in use by the callout). While we are in 2215 * free (i.e., not in use by the callout). While we are in
2216 * this loop, info->count is dropped by one, so that 2216 * this loop, info->port.count is dropped by one, so that
2217 * cy_close() knows when to free things. We restore it upon 2217 * cy_close() knows when to free things. We restore it upon
2218 * exit, either normal or abnormal. 2218 * exit, either normal or abnormal.
2219 */ 2219 */
2220 retval = 0; 2220 retval = 0;
2221 add_wait_queue(&info->open_wait, &wait); 2221 add_wait_queue(&info->port.open_wait, &wait);
2222#ifdef CY_DEBUG_OPEN 2222#ifdef CY_DEBUG_OPEN
2223 printk(KERN_DEBUG "cyc block_til_ready before block: ttyC%d, " 2223 printk(KERN_DEBUG "cyc block_til_ready before block: ttyC%d, "
2224 "count = %d\n", info->line, info->count); 2224 "count = %d\n", info->line, info->port.count);
2225#endif 2225#endif
2226 spin_lock_irqsave(&cinfo->card_lock, flags); 2226 spin_lock_irqsave(&cinfo->card_lock, flags);
2227 if (!tty_hung_up_p(filp)) 2227 if (!tty_hung_up_p(filp))
2228 info->count--; 2228 info->port.count--;
2229 spin_unlock_irqrestore(&cinfo->card_lock, flags); 2229 spin_unlock_irqrestore(&cinfo->card_lock, flags);
2230#ifdef CY_DEBUG_COUNT 2230#ifdef CY_DEBUG_COUNT
2231 printk(KERN_DEBUG "cyc block_til_ready: (%d): decrementing count to " 2231 printk(KERN_DEBUG "cyc block_til_ready: (%d): decrementing count to "
2232 "%d\n", current->pid, info->count); 2232 "%d\n", current->pid, info->port.count);
2233#endif 2233#endif
2234 info->blocked_open++; 2234 info->port.blocked_open++;
2235 2235
2236 if (!IS_CYC_Z(*cinfo)) { 2236 if (!IS_CYC_Z(*cinfo)) {
2237 chip = channel >> 2; 2237 chip = channel >> 2;
@@ -2260,8 +2260,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2260 2260
2261 set_current_state(TASK_INTERRUPTIBLE); 2261 set_current_state(TASK_INTERRUPTIBLE);
2262 if (tty_hung_up_p(filp) || 2262 if (tty_hung_up_p(filp) ||
2263 !(info->flags & ASYNC_INITIALIZED)) { 2263 !(info->port.flags & ASYNC_INITIALIZED)) {
2264 retval = ((info->flags & ASYNC_HUP_NOTIFY) ? 2264 retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?
2265 -EAGAIN : -ERESTARTSYS); 2265 -EAGAIN : -ERESTARTSYS);
2266 break; 2266 break;
2267 } 2267 }
@@ -2269,7 +2269,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2269 spin_lock_irqsave(&cinfo->card_lock, flags); 2269 spin_lock_irqsave(&cinfo->card_lock, flags);
2270 cy_writeb(base_addr + (CyCAR << index), 2270 cy_writeb(base_addr + (CyCAR << index),
2271 (u_char) channel); 2271 (u_char) channel);
2272 if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || 2272 if (!(info->port.flags & ASYNC_CLOSING) && (C_CLOCAL(tty) ||
2273 (readb(base_addr + 2273 (readb(base_addr +
2274 (CyMSVR1 << index)) & CyDCD))) { 2274 (CyMSVR1 << index)) & CyDCD))) {
2275 spin_unlock_irqrestore(&cinfo->card_lock, flags); 2275 spin_unlock_irqrestore(&cinfo->card_lock, flags);
@@ -2284,7 +2284,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2284#ifdef CY_DEBUG_OPEN 2284#ifdef CY_DEBUG_OPEN
2285 printk(KERN_DEBUG "cyc block_til_ready blocking: " 2285 printk(KERN_DEBUG "cyc block_til_ready blocking: "
2286 "ttyC%d, count = %d\n", 2286 "ttyC%d, count = %d\n",
2287 info->line, info->count); 2287 info->line, info->port.count);
2288#endif 2288#endif
2289 schedule(); 2289 schedule();
2290 } 2290 }
@@ -2298,7 +2298,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2298 firm_id = base_addr + ID_ADDRESS; 2298 firm_id = base_addr + ID_ADDRESS;
2299 if (!ISZLOADED(*cinfo)) { 2299 if (!ISZLOADED(*cinfo)) {
2300 __set_current_state(TASK_RUNNING); 2300 __set_current_state(TASK_RUNNING);
2301 remove_wait_queue(&info->open_wait, &wait); 2301 remove_wait_queue(&info->port.open_wait, &wait);
2302 return -EINVAL; 2302 return -EINVAL;
2303 } 2303 }
2304 2304
@@ -2327,12 +2327,12 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2327 2327
2328 set_current_state(TASK_INTERRUPTIBLE); 2328 set_current_state(TASK_INTERRUPTIBLE);
2329 if (tty_hung_up_p(filp) || 2329 if (tty_hung_up_p(filp) ||
2330 !(info->flags & ASYNC_INITIALIZED)) { 2330 !(info->port.flags & ASYNC_INITIALIZED)) {
2331 retval = ((info->flags & ASYNC_HUP_NOTIFY) ? 2331 retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?
2332 -EAGAIN : -ERESTARTSYS); 2332 -EAGAIN : -ERESTARTSYS);
2333 break; 2333 break;
2334 } 2334 }
2335 if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) || 2335 if (!(info->port.flags & ASYNC_CLOSING) && (C_CLOCAL(tty) ||
2336 (readl(&ch_ctrl[channel].rs_status) & 2336 (readl(&ch_ctrl[channel].rs_status) &
2337 C_RS_DCD))) { 2337 C_RS_DCD))) {
2338 break; 2338 break;
@@ -2344,28 +2344,28 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2344#ifdef CY_DEBUG_OPEN 2344#ifdef CY_DEBUG_OPEN
2345 printk(KERN_DEBUG "cyc block_til_ready blocking: " 2345 printk(KERN_DEBUG "cyc block_til_ready blocking: "
2346 "ttyC%d, count = %d\n", 2346 "ttyC%d, count = %d\n",
2347 info->line, info->count); 2347 info->line, info->port.count);
2348#endif 2348#endif
2349 schedule(); 2349 schedule();
2350 } 2350 }
2351 } 2351 }
2352 __set_current_state(TASK_RUNNING); 2352 __set_current_state(TASK_RUNNING);
2353 remove_wait_queue(&info->open_wait, &wait); 2353 remove_wait_queue(&info->port.open_wait, &wait);
2354 if (!tty_hung_up_p(filp)) { 2354 if (!tty_hung_up_p(filp)) {
2355 info->count++; 2355 info->port.count++;
2356#ifdef CY_DEBUG_COUNT 2356#ifdef CY_DEBUG_COUNT
2357 printk(KERN_DEBUG "cyc:block_til_ready (%d): incrementing " 2357 printk(KERN_DEBUG "cyc:block_til_ready (%d): incrementing "
2358 "count to %d\n", current->pid, info->count); 2358 "count to %d\n", current->pid, info->port.count);
2359#endif 2359#endif
2360 } 2360 }
2361 info->blocked_open--; 2361 info->port.blocked_open--;
2362#ifdef CY_DEBUG_OPEN 2362#ifdef CY_DEBUG_OPEN
2363 printk(KERN_DEBUG "cyc:block_til_ready after blocking: ttyC%d, " 2363 printk(KERN_DEBUG "cyc:block_til_ready after blocking: ttyC%d, "
2364 "count = %d\n", info->line, info->count); 2364 "count = %d\n", info->line, info->port.count);
2365#endif 2365#endif
2366 if (retval) 2366 if (retval)
2367 return retval; 2367 return retval;
2368 info->flags |= ASYNC_NORMAL_ACTIVE; 2368 info->port.flags |= ASYNC_NORMAL_ACTIVE;
2369 return 0; 2369 return 0;
2370} /* block_til_ready */ 2370} /* block_til_ready */
2371 2371
@@ -2456,27 +2456,27 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
2456 printk(KERN_DEBUG "cyc:cy_open ttyC%d\n", info->line); 2456 printk(KERN_DEBUG "cyc:cy_open ttyC%d\n", info->line);
2457#endif 2457#endif
2458 tty->driver_data = info; 2458 tty->driver_data = info;
2459 info->tty = tty; 2459 info->port.tty = tty;
2460 if (serial_paranoia_check(info, tty->name, "cy_open")) 2460 if (serial_paranoia_check(info, tty->name, "cy_open"))
2461 return -ENODEV; 2461 return -ENODEV;
2462 2462
2463#ifdef CY_DEBUG_OPEN 2463#ifdef CY_DEBUG_OPEN
2464 printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line, 2464 printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line,
2465 info->count); 2465 info->port.count);
2466#endif 2466#endif
2467 info->count++; 2467 info->port.count++;
2468#ifdef CY_DEBUG_COUNT 2468#ifdef CY_DEBUG_COUNT
2469 printk(KERN_DEBUG "cyc:cy_open (%d): incrementing count to %d\n", 2469 printk(KERN_DEBUG "cyc:cy_open (%d): incrementing count to %d\n",
2470 current->pid, info->count); 2470 current->pid, info->port.count);
2471#endif 2471#endif
2472 2472
2473 /* 2473 /*
2474 * If the port is the middle of closing, bail out now 2474 * If the port is the middle of closing, bail out now
2475 */ 2475 */
2476 if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) { 2476 if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) {
2477 wait_event_interruptible(info->close_wait, 2477 wait_event_interruptible(info->port.close_wait,
2478 !(info->flags & ASYNC_CLOSING)); 2478 !(info->port.flags & ASYNC_CLOSING));
2479 return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; 2479 return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS;
2480 } 2480 }
2481 2481
2482 /* 2482 /*
@@ -2641,9 +2641,9 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2641 } 2641 }
2642#ifdef CY_DEBUG_OPEN 2642#ifdef CY_DEBUG_OPEN
2643 printk(KERN_DEBUG "cyc:cy_close ttyC%d, count = %d\n", info->line, 2643 printk(KERN_DEBUG "cyc:cy_close ttyC%d, count = %d\n", info->line,
2644 info->count); 2644 info->port.count);
2645#endif 2645#endif
2646 if ((tty->count == 1) && (info->count != 1)) { 2646 if ((tty->count == 1) && (info->port.count != 1)) {
2647 /* 2647 /*
2648 * Uh, oh. tty->count is 1, which means that the tty 2648 * Uh, oh. tty->count is 1, which means that the tty
2649 * structure will be freed. Info->count should always 2649 * structure will be freed. Info->count should always
@@ -2652,24 +2652,24 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2652 * serial port won't be shutdown. 2652 * serial port won't be shutdown.
2653 */ 2653 */
2654 printk(KERN_ERR "cyc:cy_close: bad serial port count; " 2654 printk(KERN_ERR "cyc:cy_close: bad serial port count; "
2655 "tty->count is 1, info->count is %d\n", info->count); 2655 "tty->count is 1, info->port.count is %d\n", info->port.count);
2656 info->count = 1; 2656 info->port.count = 1;
2657 } 2657 }
2658#ifdef CY_DEBUG_COUNT 2658#ifdef CY_DEBUG_COUNT
2659 printk(KERN_DEBUG "cyc:cy_close at (%d): decrementing count to %d\n", 2659 printk(KERN_DEBUG "cyc:cy_close at (%d): decrementing count to %d\n",
2660 current->pid, info->count - 1); 2660 current->pid, info->port.count - 1);
2661#endif 2661#endif
2662 if (--info->count < 0) { 2662 if (--info->port.count < 0) {
2663#ifdef CY_DEBUG_COUNT 2663#ifdef CY_DEBUG_COUNT
2664 printk(KERN_DEBUG "cyc:cyc_close setting count to 0\n"); 2664 printk(KERN_DEBUG "cyc:cyc_close setting count to 0\n");
2665#endif 2665#endif
2666 info->count = 0; 2666 info->port.count = 0;
2667 } 2667 }
2668 if (info->count) { 2668 if (info->port.count) {
2669 spin_unlock_irqrestore(&card->card_lock, flags); 2669 spin_unlock_irqrestore(&card->card_lock, flags);
2670 return; 2670 return;
2671 } 2671 }
2672 info->flags |= ASYNC_CLOSING; 2672 info->port.flags |= ASYNC_CLOSING;
2673 2673
2674 /* 2674 /*
2675 * Now we wait for the transmit buffer to clear; and we notify 2675 * Now we wait for the transmit buffer to clear; and we notify
@@ -2677,8 +2677,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2677 */ 2677 */
2678 tty->closing = 1; 2678 tty->closing = 1;
2679 spin_unlock_irqrestore(&card->card_lock, flags); 2679 spin_unlock_irqrestore(&card->card_lock, flags);
2680 if (info->closing_wait != CY_CLOSING_WAIT_NONE) 2680 if (info->port.closing_wait != CY_CLOSING_WAIT_NONE)
2681 tty_wait_until_sent(tty, info->closing_wait); 2681 tty_wait_until_sent(tty, info->port.closing_wait);
2682 2682
2683 spin_lock_irqsave(&card->card_lock, flags); 2683 spin_lock_irqsave(&card->card_lock, flags);
2684 2684
@@ -2692,7 +2692,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2692 cy_writeb(base_addr + (CyCAR << index), (u_char) channel); 2692 cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
2693 cy_writeb(base_addr + (CySRER << index), 2693 cy_writeb(base_addr + (CySRER << index),
2694 readb(base_addr + (CySRER << index)) & ~CyRxData); 2694 readb(base_addr + (CySRER << index)) & ~CyRxData);
2695 if (info->flags & ASYNC_INITIALIZED) { 2695 if (info->port.flags & ASYNC_INITIALIZED) {
2696 /* Waiting for on-board buffers to be empty before 2696 /* Waiting for on-board buffers to be empty before
2697 closing the port */ 2697 closing the port */
2698 spin_unlock_irqrestore(&card->card_lock, flags); 2698 spin_unlock_irqrestore(&card->card_lock, flags);
@@ -2731,18 +2731,18 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2731 spin_lock_irqsave(&card->card_lock, flags); 2731 spin_lock_irqsave(&card->card_lock, flags);
2732 2732
2733 tty->closing = 0; 2733 tty->closing = 0;
2734 info->tty = NULL; 2734 info->port.tty = NULL;
2735 if (info->blocked_open) { 2735 if (info->port.blocked_open) {
2736 spin_unlock_irqrestore(&card->card_lock, flags); 2736 spin_unlock_irqrestore(&card->card_lock, flags);
2737 if (info->close_delay) { 2737 if (info->port.close_delay) {
2738 msleep_interruptible(jiffies_to_msecs 2738 msleep_interruptible(jiffies_to_msecs
2739 (info->close_delay)); 2739 (info->port.close_delay));
2740 } 2740 }
2741 wake_up_interruptible(&info->open_wait); 2741 wake_up_interruptible(&info->port.open_wait);
2742 spin_lock_irqsave(&card->card_lock, flags); 2742 spin_lock_irqsave(&card->card_lock, flags);
2743 } 2743 }
2744 info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 2744 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
2745 wake_up_interruptible(&info->close_wait); 2745 wake_up_interruptible(&info->port.close_wait);
2746 2746
2747#ifdef CY_DEBUG_OTHER 2747#ifdef CY_DEBUG_OTHER
2748 printk(KERN_DEBUG "cyc:cy_close done\n"); 2748 printk(KERN_DEBUG "cyc:cy_close done\n");
@@ -2777,7 +2777,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
2777 if (serial_paranoia_check(info, tty->name, "cy_write")) 2777 if (serial_paranoia_check(info, tty->name, "cy_write"))
2778 return 0; 2778 return 0;
2779 2779
2780 if (!info->xmit_buf) 2780 if (!info->port.xmit_buf)
2781 return 0; 2781 return 0;
2782 2782
2783 spin_lock_irqsave(&info->card->card_lock, flags); 2783 spin_lock_irqsave(&info->card->card_lock, flags);
@@ -2788,7 +2788,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
2788 if (c <= 0) 2788 if (c <= 0)
2789 break; 2789 break;
2790 2790
2791 memcpy(info->xmit_buf + info->xmit_head, buf, c); 2791 memcpy(info->port.xmit_buf + info->xmit_head, buf, c);
2792 info->xmit_head = (info->xmit_head + c) & 2792 info->xmit_head = (info->xmit_head + c) &
2793 (SERIAL_XMIT_SIZE - 1); 2793 (SERIAL_XMIT_SIZE - 1);
2794 info->xmit_cnt += c; 2794 info->xmit_cnt += c;
@@ -2826,7 +2826,7 @@ static int cy_put_char(struct tty_struct *tty, unsigned char ch)
2826 if (serial_paranoia_check(info, tty->name, "cy_put_char")) 2826 if (serial_paranoia_check(info, tty->name, "cy_put_char"))
2827 return 0; 2827 return 0;
2828 2828
2829 if (!info->xmit_buf) 2829 if (!info->port.xmit_buf)
2830 return 0; 2830 return 0;
2831 2831
2832 spin_lock_irqsave(&info->card->card_lock, flags); 2832 spin_lock_irqsave(&info->card->card_lock, flags);
@@ -2835,7 +2835,7 @@ static int cy_put_char(struct tty_struct *tty, unsigned char ch)
2835 return 0; 2835 return 0;
2836 } 2836 }
2837 2837
2838 info->xmit_buf[info->xmit_head++] = ch; 2838 info->port.xmit_buf[info->xmit_head++] = ch;
2839 info->xmit_head &= SERIAL_XMIT_SIZE - 1; 2839 info->xmit_head &= SERIAL_XMIT_SIZE - 1;
2840 info->xmit_cnt++; 2840 info->xmit_cnt++;
2841 info->idle_stats.xmit_bytes++; 2841 info->idle_stats.xmit_bytes++;
@@ -2860,7 +2860,7 @@ static void cy_flush_chars(struct tty_struct *tty)
2860 return; 2860 return;
2861 2861
2862 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 2862 if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
2863 !info->xmit_buf) 2863 !info->port.xmit_buf)
2864 return; 2864 return;
2865 2865
2866 start_xmit(info); 2866 start_xmit(info);
@@ -2988,27 +2988,27 @@ static void set_line_char(struct cyclades_port *info)
2988 int baud, baud_rate = 0; 2988 int baud, baud_rate = 0;
2989 int i; 2989 int i;
2990 2990
2991 if (!info->tty || !info->tty->termios) 2991 if (!info->port.tty || !info->port.tty->termios)
2992 return; 2992 return;
2993 2993
2994 if (info->line == -1) 2994 if (info->line == -1)
2995 return; 2995 return;
2996 2996
2997 cflag = info->tty->termios->c_cflag; 2997 cflag = info->port.tty->termios->c_cflag;
2998 iflag = info->tty->termios->c_iflag; 2998 iflag = info->port.tty->termios->c_iflag;
2999 2999
3000 /* 3000 /*
3001 * Set up the tty->alt_speed kludge 3001 * Set up the tty->alt_speed kludge
3002 */ 3002 */
3003 if (info->tty) { 3003 if (info->port.tty) {
3004 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 3004 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
3005 info->tty->alt_speed = 57600; 3005 info->port.tty->alt_speed = 57600;
3006 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 3006 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
3007 info->tty->alt_speed = 115200; 3007 info->port.tty->alt_speed = 115200;
3008 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 3008 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
3009 info->tty->alt_speed = 230400; 3009 info->port.tty->alt_speed = 230400;
3010 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 3010 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
3011 info->tty->alt_speed = 460800; 3011 info->port.tty->alt_speed = 460800;
3012 } 3012 }
3013 3013
3014 card = info->card; 3014 card = info->card;
@@ -3020,8 +3020,8 @@ static void set_line_char(struct cyclades_port *info)
3020 index = card->bus_index; 3020 index = card->bus_index;
3021 3021
3022 /* baud rate */ 3022 /* baud rate */
3023 baud = tty_get_baud_rate(info->tty); 3023 baud = tty_get_baud_rate(info->port.tty);
3024 if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == 3024 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
3025 ASYNC_SPD_CUST) { 3025 ASYNC_SPD_CUST) {
3026 if (info->custom_divisor) 3026 if (info->custom_divisor)
3027 baud_rate = info->baud / info->custom_divisor; 3027 baud_rate = info->baud / info->custom_divisor;
@@ -3038,7 +3038,7 @@ static void set_line_char(struct cyclades_port *info)
3038 if (i == 20) 3038 if (i == 20)
3039 i = 19; /* CD1400_MAX_SPEED */ 3039 i = 19; /* CD1400_MAX_SPEED */
3040 3040
3041 if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == 3041 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
3042 ASYNC_SPD_CUST) { 3042 ASYNC_SPD_CUST) {
3043 cyy_baud_calc(info, baud_rate); 3043 cyy_baud_calc(info, baud_rate);
3044 } else { 3044 } else {
@@ -3059,7 +3059,7 @@ static void set_line_char(struct cyclades_port *info)
3059 /* get it right for 134.5 baud */ 3059 /* get it right for 134.5 baud */
3060 info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + 3060 info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) +
3061 2; 3061 2;
3062 } else if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == 3062 } else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
3063 ASYNC_SPD_CUST) { 3063 ASYNC_SPD_CUST) {
3064 info->timeout = (info->xmit_fifo_size * HZ * 15 / 3064 info->timeout = (info->xmit_fifo_size * HZ * 15 /
3065 baud_rate) + 2; 3065 baud_rate) + 2;
@@ -3108,16 +3108,16 @@ static void set_line_char(struct cyclades_port *info)
3108 3108
3109 /* CTS flow control flag */ 3109 /* CTS flow control flag */
3110 if (cflag & CRTSCTS) { 3110 if (cflag & CRTSCTS) {
3111 info->flags |= ASYNC_CTS_FLOW; 3111 info->port.flags |= ASYNC_CTS_FLOW;
3112 info->cor2 |= CyCtsAE; 3112 info->cor2 |= CyCtsAE;
3113 } else { 3113 } else {
3114 info->flags &= ~ASYNC_CTS_FLOW; 3114 info->port.flags &= ~ASYNC_CTS_FLOW;
3115 info->cor2 &= ~CyCtsAE; 3115 info->cor2 &= ~CyCtsAE;
3116 } 3116 }
3117 if (cflag & CLOCAL) 3117 if (cflag & CLOCAL)
3118 info->flags &= ~ASYNC_CHECK_CD; 3118 info->port.flags &= ~ASYNC_CHECK_CD;
3119 else 3119 else
3120 info->flags |= ASYNC_CHECK_CD; 3120 info->port.flags |= ASYNC_CHECK_CD;
3121 3121
3122 /*********************************************** 3122 /***********************************************
3123 The hardware option, CyRtsAO, presents RTS when 3123 The hardware option, CyRtsAO, presents RTS when
@@ -3146,8 +3146,8 @@ static void set_line_char(struct cyclades_port *info)
3146 /* set line characteristics according configuration */ 3146 /* set line characteristics according configuration */
3147 3147
3148 cy_writeb(base_addr + (CySCHR1 << index), 3148 cy_writeb(base_addr + (CySCHR1 << index),
3149 START_CHAR(info->tty)); 3149 START_CHAR(info->port.tty));
3150 cy_writeb(base_addr + (CySCHR2 << index), STOP_CHAR(info->tty)); 3150 cy_writeb(base_addr + (CySCHR2 << index), STOP_CHAR(info->port.tty));
3151 cy_writeb(base_addr + (CyCOR1 << index), info->cor1); 3151 cy_writeb(base_addr + (CyCOR1 << index), info->cor1);
3152 cy_writeb(base_addr + (CyCOR2 << index), info->cor2); 3152 cy_writeb(base_addr + (CyCOR2 << index), info->cor2);
3153 cy_writeb(base_addr + (CyCOR3 << index), info->cor3); 3153 cy_writeb(base_addr + (CyCOR3 << index), info->cor3);
@@ -3163,7 +3163,7 @@ static void set_line_char(struct cyclades_port *info)
3163 (info->default_timeout ? info->default_timeout : 0x02)); 3163 (info->default_timeout ? info->default_timeout : 0x02));
3164 /* 10ms rx timeout */ 3164 /* 10ms rx timeout */
3165 3165
3166 if (C_CLOCAL(info->tty)) { 3166 if (C_CLOCAL(info->port.tty)) {
3167 /* without modem intr */ 3167 /* without modem intr */
3168 cy_writeb(base_addr + (CySRER << index), 3168 cy_writeb(base_addr + (CySRER << index),
3169 readb(base_addr + (CySRER << index)) | CyMdmCh); 3169 readb(base_addr + (CySRER << index)) | CyMdmCh);
@@ -3226,8 +3226,8 @@ static void set_line_char(struct cyclades_port *info)
3226#endif 3226#endif
3227 } 3227 }
3228 3228
3229 if (info->tty) 3229 if (info->port.tty)
3230 clear_bit(TTY_IO_ERROR, &info->tty->flags); 3230 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
3231 spin_unlock_irqrestore(&card->card_lock, flags); 3231 spin_unlock_irqrestore(&card->card_lock, flags);
3232 3232
3233 } else { 3233 } else {
@@ -3250,8 +3250,8 @@ static void set_line_char(struct cyclades_port *info)
3250 buf_ctrl = &zfw_ctrl->buf_ctrl[channel]; 3250 buf_ctrl = &zfw_ctrl->buf_ctrl[channel];
3251 3251
3252 /* baud rate */ 3252 /* baud rate */
3253 baud = tty_get_baud_rate(info->tty); 3253 baud = tty_get_baud_rate(info->port.tty);
3254 if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == 3254 if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
3255 ASYNC_SPD_CUST) { 3255 ASYNC_SPD_CUST) {
3256 if (info->custom_divisor) 3256 if (info->custom_divisor)
3257 baud_rate = info->baud / info->custom_divisor; 3257 baud_rate = info->baud / info->custom_divisor;
@@ -3266,7 +3266,7 @@ static void set_line_char(struct cyclades_port *info)
3266 /* get it right for 134.5 baud */ 3266 /* get it right for 134.5 baud */
3267 info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) + 3267 info->timeout = (info->xmit_fifo_size * HZ * 30 / 269) +
3268 2; 3268 2;
3269 } else if (baud == 38400 && (info->flags & ASYNC_SPD_MASK) == 3269 } else if (baud == 38400 && (info->port.flags & ASYNC_SPD_MASK) ==
3270 ASYNC_SPD_CUST) { 3270 ASYNC_SPD_CUST) {
3271 info->timeout = (info->xmit_fifo_size * HZ * 15 / 3271 info->timeout = (info->xmit_fifo_size * HZ * 15 /
3272 baud_rate) + 2; 3272 baud_rate) + 2;
@@ -3318,7 +3318,7 @@ static void set_line_char(struct cyclades_port *info)
3318 } 3318 }
3319 /* As the HW flow control is done in firmware, the driver 3319 /* As the HW flow control is done in firmware, the driver
3320 doesn't need to care about it */ 3320 doesn't need to care about it */
3321 info->flags &= ~ASYNC_CTS_FLOW; 3321 info->port.flags &= ~ASYNC_CTS_FLOW;
3322 3322
3323 /* XON/XOFF/XANY flow control flags */ 3323 /* XON/XOFF/XANY flow control flags */
3324 sw_flow = 0; 3324 sw_flow = 0;
@@ -3337,9 +3337,9 @@ static void set_line_char(struct cyclades_port *info)
3337 3337
3338 /* CD sensitivity */ 3338 /* CD sensitivity */
3339 if (cflag & CLOCAL) 3339 if (cflag & CLOCAL)
3340 info->flags &= ~ASYNC_CHECK_CD; 3340 info->port.flags &= ~ASYNC_CHECK_CD;
3341 else 3341 else
3342 info->flags |= ASYNC_CHECK_CD; 3342 info->port.flags |= ASYNC_CHECK_CD;
3343 3343
3344 if (baud == 0) { /* baud rate is zero, turn off line */ 3344 if (baud == 0) { /* baud rate is zero, turn off line */
3345 cy_writel(&ch_ctrl->rs_control, 3345 cy_writel(&ch_ctrl->rs_control,
@@ -3361,8 +3361,8 @@ static void set_line_char(struct cyclades_port *info)
3361 "was %x\n", info->line, retval); 3361 "was %x\n", info->line, retval);
3362 } 3362 }
3363 3363
3364 if (info->tty) 3364 if (info->port.tty)
3365 clear_bit(TTY_IO_ERROR, &info->tty->flags); 3365 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
3366 } 3366 }
3367} /* set_line_char */ 3367} /* set_line_char */
3368 3368
@@ -3381,9 +3381,9 @@ get_serial_info(struct cyclades_port *info,
3381 tmp.port = (info->card - cy_card) * 0x100 + info->line - 3381 tmp.port = (info->card - cy_card) * 0x100 + info->line -
3382 cinfo->first_line; 3382 cinfo->first_line;
3383 tmp.irq = cinfo->irq; 3383 tmp.irq = cinfo->irq;
3384 tmp.flags = info->flags; 3384 tmp.flags = info->port.flags;
3385 tmp.close_delay = info->close_delay; 3385 tmp.close_delay = info->port.close_delay;
3386 tmp.closing_wait = info->closing_wait; 3386 tmp.closing_wait = info->port.closing_wait;
3387 tmp.baud_base = info->baud; 3387 tmp.baud_base = info->baud;
3388 tmp.custom_divisor = info->custom_divisor; 3388 tmp.custom_divisor = info->custom_divisor;
3389 tmp.hub6 = 0; /*!!! */ 3389 tmp.hub6 = 0; /*!!! */
@@ -3402,13 +3402,13 @@ set_serial_info(struct cyclades_port *info,
3402 old_info = *info; 3402 old_info = *info;
3403 3403
3404 if (!capable(CAP_SYS_ADMIN)) { 3404 if (!capable(CAP_SYS_ADMIN)) {
3405 if (new_serial.close_delay != info->close_delay || 3405 if (new_serial.close_delay != info->port.close_delay ||
3406 new_serial.baud_base != info->baud || 3406 new_serial.baud_base != info->baud ||
3407 (new_serial.flags & ASYNC_FLAGS & 3407 (new_serial.flags & ASYNC_FLAGS &
3408 ~ASYNC_USR_MASK) != 3408 ~ASYNC_USR_MASK) !=
3409 (info->flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) 3409 (info->port.flags & ASYNC_FLAGS & ~ASYNC_USR_MASK))
3410 return -EPERM; 3410 return -EPERM;
3411 info->flags = (info->flags & ~ASYNC_USR_MASK) | 3411 info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) |
3412 (new_serial.flags & ASYNC_USR_MASK); 3412 (new_serial.flags & ASYNC_USR_MASK);
3413 info->baud = new_serial.baud_base; 3413 info->baud = new_serial.baud_base;
3414 info->custom_divisor = new_serial.custom_divisor; 3414 info->custom_divisor = new_serial.custom_divisor;
@@ -3422,13 +3422,13 @@ set_serial_info(struct cyclades_port *info,
3422 3422
3423 info->baud = new_serial.baud_base; 3423 info->baud = new_serial.baud_base;
3424 info->custom_divisor = new_serial.custom_divisor; 3424 info->custom_divisor = new_serial.custom_divisor;
3425 info->flags = (info->flags & ~ASYNC_FLAGS) | 3425 info->port.flags = (info->port.flags & ~ASYNC_FLAGS) |
3426 (new_serial.flags & ASYNC_FLAGS); 3426 (new_serial.flags & ASYNC_FLAGS);
3427 info->close_delay = new_serial.close_delay * HZ / 100; 3427 info->port.close_delay = new_serial.close_delay * HZ / 100;
3428 info->closing_wait = new_serial.closing_wait * HZ / 100; 3428 info->port.closing_wait = new_serial.closing_wait * HZ / 100;
3429 3429
3430check_and_exit: 3430check_and_exit:
3431 if (info->flags & ASYNC_INITIALIZED) { 3431 if (info->port.flags & ASYNC_INITIALIZED) {
3432 set_line_char(info); 3432 set_line_char(info);
3433 return 0; 3433 return 0;
3434 } else { 3434 } else {
@@ -3971,11 +3971,11 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
3971 break; 3971 break;
3972#endif /* CONFIG_CYZ_INTR */ 3972#endif /* CONFIG_CYZ_INTR */
3973 case CYSETWAIT: 3973 case CYSETWAIT:
3974 info->closing_wait = (unsigned short)arg * HZ / 100; 3974 info->port.closing_wait = (unsigned short)arg * HZ / 100;
3975 ret_val = 0; 3975 ret_val = 0;
3976 break; 3976 break;
3977 case CYGETWAIT: 3977 case CYGETWAIT:
3978 ret_val = info->closing_wait / (HZ / 100); 3978 ret_val = info->port.closing_wait / (HZ / 100);
3979 break; 3979 break;
3980 case TIOCGSERIAL: 3980 case TIOCGSERIAL:
3981 ret_val = get_serial_info(info, argp); 3981 ret_val = get_serial_info(info, argp);
@@ -4097,7 +4097,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
4097 */ 4097 */
4098 if (!(old_termios->c_cflag & CLOCAL) && 4098 if (!(old_termios->c_cflag & CLOCAL) &&
4099 (tty->termios->c_cflag & CLOCAL)) 4099 (tty->termios->c_cflag & CLOCAL))
4100 wake_up_interruptible(&info->open_wait); 4100 wake_up_interruptible(&info->port.open_wait);
4101#endif 4101#endif
4102} /* cy_set_termios */ 4102} /* cy_set_termios */
4103 4103
@@ -4326,14 +4326,14 @@ static void cy_hangup(struct tty_struct *tty)
4326 4326
4327 cy_flush_buffer(tty); 4327 cy_flush_buffer(tty);
4328 shutdown(info); 4328 shutdown(info);
4329 info->count = 0; 4329 info->port.count = 0;
4330#ifdef CY_DEBUG_COUNT 4330#ifdef CY_DEBUG_COUNT
4331 printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n", 4331 printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n",
4332 current->pid); 4332 current->pid);
4333#endif 4333#endif
4334 info->tty = NULL; 4334 info->port.tty = NULL;
4335 info->flags &= ~ASYNC_NORMAL_ACTIVE; 4335 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
4336 wake_up_interruptible(&info->open_wait); 4336 wake_up_interruptible(&info->port.open_wait);
4337} /* cy_hangup */ 4337} /* cy_hangup */
4338 4338
4339/* 4339/*
@@ -4376,15 +4376,14 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4376 for (port = cinfo->first_line; port < cinfo->first_line + nports; 4376 for (port = cinfo->first_line; port < cinfo->first_line + nports;
4377 port++) { 4377 port++) {
4378 info = &cinfo->ports[port - cinfo->first_line]; 4378 info = &cinfo->ports[port - cinfo->first_line];
4379 tty_port_init(&info->port);
4379 info->magic = CYCLADES_MAGIC; 4380 info->magic = CYCLADES_MAGIC;
4380 info->card = cinfo; 4381 info->card = cinfo;
4381 info->line = port; 4382 info->line = port;
4382 info->flags = STD_COM_FLAGS;
4383 info->closing_wait = CLOSING_WAIT_DELAY;
4384 info->close_delay = 5 * HZ / 10;
4385 4383
4386 init_waitqueue_head(&info->open_wait); 4384 info->port.closing_wait = CLOSING_WAIT_DELAY;
4387 init_waitqueue_head(&info->close_wait); 4385 info->port.close_delay = 5 * HZ / 10;
4386 info->port.flags = STD_COM_FLAGS;
4388 init_completion(&info->shutdown_wait); 4387 init_completion(&info->shutdown_wait);
4389 init_waitqueue_head(&info->delta_msr_wait); 4388 init_waitqueue_head(&info->delta_msr_wait);
4390 4389
@@ -5237,7 +5236,7 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
5237 for (j = 0; j < cy_card[i].nports; j++) { 5236 for (j = 0; j < cy_card[i].nports; j++) {
5238 info = &cy_card[i].ports[j]; 5237 info = &cy_card[i].ports[j];
5239 5238
5240 if (info->count) 5239 if (info->port.count)
5241 size = sprintf(buf + len, "%3d %8lu %10lu %8lu " 5240 size = sprintf(buf + len, "%3d %8lu %10lu %8lu "
5242 "%10lu %8lu %9lu %6ld\n", info->line, 5241 "%10lu %8lu %9lu %6ld\n", info->line,
5243 (cur_jifs - info->idle_stats.in_use) / 5242 (cur_jifs - info->idle_stats.in_use) /
@@ -5246,7 +5245,8 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
5246 HZ, info->idle_stats.recv_bytes, 5245 HZ, info->idle_stats.recv_bytes,
5247 (cur_jifs - info->idle_stats.recv_idle)/ 5246 (cur_jifs - info->idle_stats.recv_idle)/
5248 HZ, info->idle_stats.overruns, 5247 HZ, info->idle_stats.overruns,
5249 (long)info->tty->ldisc.num); 5248 /* FIXME: double check locking */
5249 (long)info->port.tty->ldisc.ops->num);
5250 else 5250 else
5251 size = sprintf(buf + len, "%3d %8lu %10lu %8lu " 5251 size = sprintf(buf + len, "%3d %8lu %10lu %8lu "
5252 "%10lu %8lu %9lu %6ld\n", 5252 "%10lu %8lu %9lu %6ld\n",
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index 60a4df7dac12..ac9995f6578b 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -432,7 +432,7 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
432 spin_unlock_irqrestore(&epca_lock, flags); 432 spin_unlock_irqrestore(&epca_lock, flags);
433 return; 433 return;
434 } 434 }
435 if (ch->count-- > 1) { 435 if (ch->port.count-- > 1) {
436 /* Begin channel is open more than once */ 436 /* Begin channel is open more than once */
437 /* 437 /*
438 * Return without doing anything. Someone might still 438 * Return without doing anything. Someone might still
@@ -442,19 +442,19 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
442 return; 442 return;
443 } 443 }
444 /* Port open only once go ahead with shutdown & reset */ 444 /* Port open only once go ahead with shutdown & reset */
445 BUG_ON(ch->count < 0); 445 BUG_ON(ch->port.count < 0);
446 446
447 /* 447 /*
448 * Let the rest of the driver know the channel is being closed. 448 * Let the rest of the driver know the channel is being closed.
449 * This becomes important if an open is attempted before close 449 * This becomes important if an open is attempted before close
450 * is finished. 450 * is finished.
451 */ 451 */
452 ch->asyncflags |= ASYNC_CLOSING; 452 ch->port.flags |= ASYNC_CLOSING;
453 tty->closing = 1; 453 tty->closing = 1;
454 454
455 spin_unlock_irqrestore(&epca_lock, flags); 455 spin_unlock_irqrestore(&epca_lock, flags);
456 456
457 if (ch->asyncflags & ASYNC_INITIALIZED) { 457 if (ch->port.flags & ASYNC_INITIALIZED) {
458 /* Setup an event to indicate when the 458 /* Setup an event to indicate when the
459 transmit buffer empties */ 459 transmit buffer empties */
460 setup_empty_event(tty, ch); 460 setup_empty_event(tty, ch);
@@ -469,17 +469,17 @@ static void pc_close(struct tty_struct *tty, struct file *filp)
469 spin_lock_irqsave(&epca_lock, flags); 469 spin_lock_irqsave(&epca_lock, flags);
470 tty->closing = 0; 470 tty->closing = 0;
471 ch->event = 0; 471 ch->event = 0;
472 ch->tty = NULL; 472 ch->port.tty = NULL;
473 spin_unlock_irqrestore(&epca_lock, flags); 473 spin_unlock_irqrestore(&epca_lock, flags);
474 474
475 if (ch->blocked_open) { 475 if (ch->port.blocked_open) {
476 if (ch->close_delay) 476 if (ch->close_delay)
477 msleep_interruptible(jiffies_to_msecs(ch->close_delay)); 477 msleep_interruptible(jiffies_to_msecs(ch->close_delay));
478 wake_up_interruptible(&ch->open_wait); 478 wake_up_interruptible(&ch->port.open_wait);
479 } 479 }
480 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | 480 ch->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED |
481 ASYNC_CLOSING); 481 ASYNC_CLOSING);
482 wake_up_interruptible(&ch->close_wait); 482 wake_up_interruptible(&ch->port.close_wait);
483 } 483 }
484} 484}
485 485
@@ -489,7 +489,7 @@ static void shutdown(struct channel *ch)
489 struct tty_struct *tty; 489 struct tty_struct *tty;
490 struct board_chan __iomem *bc; 490 struct board_chan __iomem *bc;
491 491
492 if (!(ch->asyncflags & ASYNC_INITIALIZED)) 492 if (!(ch->port.flags & ASYNC_INITIALIZED))
493 return; 493 return;
494 494
495 spin_lock_irqsave(&epca_lock, flags); 495 spin_lock_irqsave(&epca_lock, flags);
@@ -504,7 +504,7 @@ static void shutdown(struct channel *ch)
504 */ 504 */
505 if (bc) 505 if (bc)
506 writeb(0, &bc->idata); 506 writeb(0, &bc->idata);
507 tty = ch->tty; 507 tty = ch->port.tty;
508 508
509 /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */ 509 /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */
510 if (tty->termios->c_cflag & HUPCL) { 510 if (tty->termios->c_cflag & HUPCL) {
@@ -518,7 +518,7 @@ static void shutdown(struct channel *ch)
518 * will have to reinitialized. Set a flag to indicate this. 518 * will have to reinitialized. Set a flag to indicate this.
519 */ 519 */
520 /* Prevent future Digi programmed interrupts from coming active */ 520 /* Prevent future Digi programmed interrupts from coming active */
521 ch->asyncflags &= ~ASYNC_INITIALIZED; 521 ch->port.flags &= ~ASYNC_INITIALIZED;
522 spin_unlock_irqrestore(&epca_lock, flags); 522 spin_unlock_irqrestore(&epca_lock, flags);
523} 523}
524 524
@@ -538,12 +538,12 @@ static void pc_hangup(struct tty_struct *tty)
538 shutdown(ch); 538 shutdown(ch);
539 539
540 spin_lock_irqsave(&epca_lock, flags); 540 spin_lock_irqsave(&epca_lock, flags);
541 ch->tty = NULL; 541 ch->port.tty = NULL;
542 ch->event = 0; 542 ch->event = 0;
543 ch->count = 0; 543 ch->port.count = 0;
544 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED); 544 ch->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED);
545 spin_unlock_irqrestore(&epca_lock, flags); 545 spin_unlock_irqrestore(&epca_lock, flags);
546 wake_up_interruptible(&ch->open_wait); 546 wake_up_interruptible(&ch->port.open_wait);
547 } 547 }
548} 548}
549 549
@@ -795,7 +795,7 @@ static int block_til_ready(struct tty_struct *tty,
795 unsigned long flags; 795 unsigned long flags;
796 796
797 if (tty_hung_up_p(filp)) { 797 if (tty_hung_up_p(filp)) {
798 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 798 if (ch->port.flags & ASYNC_HUP_NOTIFY)
799 retval = -EAGAIN; 799 retval = -EAGAIN;
800 else 800 else
801 retval = -ERESTARTSYS; 801 retval = -ERESTARTSYS;
@@ -806,10 +806,10 @@ static int block_til_ready(struct tty_struct *tty,
806 * If the device is in the middle of being closed, then block until 806 * If the device is in the middle of being closed, then block until
807 * it's done, and then try again. 807 * it's done, and then try again.
808 */ 808 */
809 if (ch->asyncflags & ASYNC_CLOSING) { 809 if (ch->port.flags & ASYNC_CLOSING) {
810 interruptible_sleep_on(&ch->close_wait); 810 interruptible_sleep_on(&ch->port.close_wait);
811 811
812 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 812 if (ch->port.flags & ASYNC_HUP_NOTIFY)
813 return -EAGAIN; 813 return -EAGAIN;
814 else 814 else
815 return -ERESTARTSYS; 815 return -ERESTARTSYS;
@@ -820,7 +820,7 @@ static int block_til_ready(struct tty_struct *tty,
820 * If non-blocking mode is set, then make the check up front 820 * If non-blocking mode is set, then make the check up front
821 * and then exit. 821 * and then exit.
822 */ 822 */
823 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; 823 ch->port.flags |= ASYNC_NORMAL_ACTIVE;
824 return 0; 824 return 0;
825 } 825 }
826 if (tty->termios->c_cflag & CLOCAL) 826 if (tty->termios->c_cflag & CLOCAL)
@@ -828,24 +828,24 @@ static int block_til_ready(struct tty_struct *tty,
828 /* Block waiting for the carrier detect and the line to become free */ 828 /* Block waiting for the carrier detect and the line to become free */
829 829
830 retval = 0; 830 retval = 0;
831 add_wait_queue(&ch->open_wait, &wait); 831 add_wait_queue(&ch->port.open_wait, &wait);
832 832
833 spin_lock_irqsave(&epca_lock, flags); 833 spin_lock_irqsave(&epca_lock, flags);
834 /* We dec count so that pc_close will know when to free things */ 834 /* We dec count so that pc_close will know when to free things */
835 if (!tty_hung_up_p(filp)) 835 if (!tty_hung_up_p(filp))
836 ch->count--; 836 ch->port.count--;
837 ch->blocked_open++; 837 ch->port.blocked_open++;
838 while (1) { 838 while (1) {
839 set_current_state(TASK_INTERRUPTIBLE); 839 set_current_state(TASK_INTERRUPTIBLE);
840 if (tty_hung_up_p(filp) || 840 if (tty_hung_up_p(filp) ||
841 !(ch->asyncflags & ASYNC_INITIALIZED)) { 841 !(ch->port.flags & ASYNC_INITIALIZED)) {
842 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 842 if (ch->port.flags & ASYNC_HUP_NOTIFY)
843 retval = -EAGAIN; 843 retval = -EAGAIN;
844 else 844 else
845 retval = -ERESTARTSYS; 845 retval = -ERESTARTSYS;
846 break; 846 break;
847 } 847 }
848 if (!(ch->asyncflags & ASYNC_CLOSING) && 848 if (!(ch->port.flags & ASYNC_CLOSING) &&
849 (do_clocal || (ch->imodem & ch->dcd))) 849 (do_clocal || (ch->imodem & ch->dcd)))
850 break; 850 break;
851 if (signal_pending(current)) { 851 if (signal_pending(current)) {
@@ -864,17 +864,17 @@ static int block_til_ready(struct tty_struct *tty,
864 } 864 }
865 865
866 __set_current_state(TASK_RUNNING); 866 __set_current_state(TASK_RUNNING);
867 remove_wait_queue(&ch->open_wait, &wait); 867 remove_wait_queue(&ch->port.open_wait, &wait);
868 if (!tty_hung_up_p(filp)) 868 if (!tty_hung_up_p(filp))
869 ch->count++; 869 ch->port.count++;
870 ch->blocked_open--; 870 ch->port.blocked_open--;
871 871
872 spin_unlock_irqrestore(&epca_lock, flags); 872 spin_unlock_irqrestore(&epca_lock, flags);
873 873
874 if (retval) 874 if (retval)
875 return retval; 875 return retval;
876 876
877 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; 877 ch->port.flags |= ASYNC_NORMAL_ACTIVE;
878 return 0; 878 return 0;
879} 879}
880 880
@@ -933,7 +933,7 @@ static int pc_open(struct tty_struct *tty, struct file *filp)
933 * necessary because we do not wish to flush and shutdown the channel 933 * necessary because we do not wish to flush and shutdown the channel
934 * until the last app holding the channel open, closes it. 934 * until the last app holding the channel open, closes it.
935 */ 935 */
936 ch->count++; 936 ch->port.count++;
937 /* 937 /*
938 * Set a kernel structures pointer to our local channel structure. This 938 * Set a kernel structures pointer to our local channel structure. This
939 * way we can get to it when passed only a tty struct. 939 * way we can get to it when passed only a tty struct.
@@ -957,14 +957,14 @@ static int pc_open(struct tty_struct *tty, struct file *filp)
957 writew(head, &bc->rout); 957 writew(head, &bc->rout);
958 958
959 /* Set the channels associated tty structure */ 959 /* Set the channels associated tty structure */
960 ch->tty = tty; 960 ch->port.tty = tty;
961 961
962 /* 962 /*
963 * The below routine generally sets up parity, baud, flow control 963 * The below routine generally sets up parity, baud, flow control
964 * issues, etc.... It effect both control flags and input flags. 964 * issues, etc.... It effect both control flags and input flags.
965 */ 965 */
966 epcaparam(tty, ch); 966 epcaparam(tty, ch);
967 ch->asyncflags |= ASYNC_INITIALIZED; 967 ch->port.flags |= ASYNC_INITIALIZED;
968 memoff(ch); 968 memoff(ch);
969 spin_unlock_irqrestore(&epca_lock, flags); 969 spin_unlock_irqrestore(&epca_lock, flags);
970 970
@@ -976,7 +976,7 @@ static int pc_open(struct tty_struct *tty, struct file *filp)
976 * waiting for the line... 976 * waiting for the line...
977 */ 977 */
978 spin_lock_irqsave(&epca_lock, flags); 978 spin_lock_irqsave(&epca_lock, flags);
979 ch->tty = tty; 979 ch->port.tty = tty;
980 globalwinon(ch); 980 globalwinon(ch);
981 /* Enable Digi Data events */ 981 /* Enable Digi Data events */
982 writeb(1, &bc->idata); 982 writeb(1, &bc->idata);
@@ -1017,8 +1017,8 @@ static void __exit epca_module_exit(void)
1017 } 1017 }
1018 ch = card_ptr[crd]; 1018 ch = card_ptr[crd];
1019 for (count = 0; count < bd->numports; count++, ch++) { 1019 for (count = 0; count < bd->numports; count++, ch++) {
1020 if (ch && ch->tty) 1020 if (ch && ch->port.tty)
1021 tty_hangup(ch->tty); 1021 tty_hangup(ch->port.tty);
1022 } 1022 }
1023 } 1023 }
1024 pci_unregister_driver(&epca_driver); 1024 pci_unregister_driver(&epca_driver);
@@ -1427,7 +1427,7 @@ static void post_fep_init(unsigned int crd)
1427 ch->boardnum = crd; 1427 ch->boardnum = crd;
1428 ch->channelnum = i; 1428 ch->channelnum = i;
1429 ch->magic = EPCA_MAGIC; 1429 ch->magic = EPCA_MAGIC;
1430 ch->tty = NULL; 1430 ch->port.tty = NULL;
1431 1431
1432 if (shrinkmem) { 1432 if (shrinkmem) {
1433 fepcmd(ch, SETBUFFER, 32, 0, 0, 0); 1433 fepcmd(ch, SETBUFFER, 32, 0, 0, 0);
@@ -1510,10 +1510,10 @@ static void post_fep_init(unsigned int crd)
1510 ch->fepstopca = 0; 1510 ch->fepstopca = 0;
1511 1511
1512 ch->close_delay = 50; 1512 ch->close_delay = 50;
1513 ch->count = 0; 1513 ch->port.count = 0;
1514 ch->blocked_open = 0; 1514 ch->port.blocked_open = 0;
1515 init_waitqueue_head(&ch->open_wait); 1515 init_waitqueue_head(&ch->port.open_wait);
1516 init_waitqueue_head(&ch->close_wait); 1516 init_waitqueue_head(&ch->port.close_wait);
1517 1517
1518 spin_unlock_irqrestore(&epca_lock, flags); 1518 spin_unlock_irqrestore(&epca_lock, flags);
1519 } 1519 }
@@ -1633,15 +1633,15 @@ static void doevent(int crd)
1633 if (event & MODEMCHG_IND) { 1633 if (event & MODEMCHG_IND) {
1634 /* A modem signal change has been indicated */ 1634 /* A modem signal change has been indicated */
1635 ch->imodem = mstat; 1635 ch->imodem = mstat;
1636 if (ch->asyncflags & ASYNC_CHECK_CD) { 1636 if (ch->port.flags & ASYNC_CHECK_CD) {
1637 /* We are now receiving dcd */ 1637 /* We are now receiving dcd */
1638 if (mstat & ch->dcd) 1638 if (mstat & ch->dcd)
1639 wake_up_interruptible(&ch->open_wait); 1639 wake_up_interruptible(&ch->port.open_wait);
1640 else /* No dcd; hangup */ 1640 else /* No dcd; hangup */
1641 pc_sched_event(ch, EPCA_EVENT_HANGUP); 1641 pc_sched_event(ch, EPCA_EVENT_HANGUP);
1642 } 1642 }
1643 } 1643 }
1644 tty = ch->tty; 1644 tty = ch->port.tty;
1645 if (tty) { 1645 if (tty) {
1646 if (event & BREAK_IND) { 1646 if (event & BREAK_IND) {
1647 /* A break has been indicated */ 1647 /* A break has been indicated */
@@ -1880,9 +1880,9 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
1880 * that the driver will wait on carrier detect. 1880 * that the driver will wait on carrier detect.
1881 */ 1881 */
1882 if (ts->c_cflag & CLOCAL) 1882 if (ts->c_cflag & CLOCAL)
1883 ch->asyncflags &= ~ASYNC_CHECK_CD; 1883 ch->port.flags &= ~ASYNC_CHECK_CD;
1884 else 1884 else
1885 ch->asyncflags |= ASYNC_CHECK_CD; 1885 ch->port.flags |= ASYNC_CHECK_CD;
1886 mval = ch->m_dtr | ch->m_rts; 1886 mval = ch->m_dtr | ch->m_rts;
1887 } /* End CBAUD not detected */ 1887 } /* End CBAUD not detected */
1888 iflag = termios2digi_i(ch, ts->c_iflag); 1888 iflag = termios2digi_i(ch, ts->c_iflag);
@@ -1972,7 +1972,7 @@ static void receive_data(struct channel *ch)
1972 globalwinon(ch); 1972 globalwinon(ch);
1973 if (ch->statusflags & RXSTOPPED) 1973 if (ch->statusflags & RXSTOPPED)
1974 return; 1974 return;
1975 tty = ch->tty; 1975 tty = ch->port.tty;
1976 if (tty) 1976 if (tty)
1977 ts = tty->termios; 1977 ts = tty->termios;
1978 bc = ch->brdchan; 1978 bc = ch->brdchan;
@@ -2032,7 +2032,7 @@ static void receive_data(struct channel *ch)
2032 globalwinon(ch); 2032 globalwinon(ch);
2033 writew(tail, &bc->rout); 2033 writew(tail, &bc->rout);
2034 /* Must be called with global data */ 2034 /* Must be called with global data */
2035 tty_schedule_flip(ch->tty); 2035 tty_schedule_flip(ch->port.tty);
2036} 2036}
2037 2037
2038static int info_ioctl(struct tty_struct *tty, struct file *file, 2038static int info_ioctl(struct tty_struct *tty, struct file *file,
@@ -2262,8 +2262,8 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file,
2262 tty_wait_until_sent(tty, 0); 2262 tty_wait_until_sent(tty, 0);
2263 } else { 2263 } else {
2264 /* ldisc lock already held in ioctl */ 2264 /* ldisc lock already held in ioctl */
2265 if (tty->ldisc.flush_buffer) 2265 if (tty->ldisc.ops->flush_buffer)
2266 tty->ldisc.flush_buffer(tty); 2266 tty->ldisc.ops->flush_buffer(tty);
2267 } 2267 }
2268 unlock_kernel(); 2268 unlock_kernel();
2269 /* Fall Thru */ 2269 /* Fall Thru */
@@ -2376,7 +2376,7 @@ static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2376 2376
2377 if (!(old_termios->c_cflag & CLOCAL) && 2377 if (!(old_termios->c_cflag & CLOCAL) &&
2378 (tty->termios->c_cflag & CLOCAL)) 2378 (tty->termios->c_cflag & CLOCAL))
2379 wake_up_interruptible(&ch->open_wait); 2379 wake_up_interruptible(&ch->port.open_wait);
2380 2380
2381 } /* End if channel valid */ 2381 } /* End if channel valid */
2382} 2382}
@@ -2386,13 +2386,13 @@ static void do_softint(struct work_struct *work)
2386 struct channel *ch = container_of(work, struct channel, tqueue); 2386 struct channel *ch = container_of(work, struct channel, tqueue);
2387 /* Called in response to a modem change event */ 2387 /* Called in response to a modem change event */
2388 if (ch && ch->magic == EPCA_MAGIC) { 2388 if (ch && ch->magic == EPCA_MAGIC) {
2389 struct tty_struct *tty = ch->tty; 2389 struct tty_struct *tty = ch->port.tty;
2390 2390
2391 if (tty && tty->driver_data) { 2391 if (tty && tty->driver_data) {
2392 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { 2392 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
2393 tty_hangup(tty); 2393 tty_hangup(tty);
2394 wake_up_interruptible(&ch->open_wait); 2394 wake_up_interruptible(&ch->port.open_wait);
2395 ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; 2395 ch->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2396 } 2396 }
2397 } 2397 }
2398 } 2398 }
diff --git a/drivers/char/epca.h b/drivers/char/epca.h
index 3c77c02b5d65..d414bf2dbf7c 100644
--- a/drivers/char/epca.h
+++ b/drivers/char/epca.h
@@ -84,6 +84,7 @@ static char *board_desc[] =
84struct channel 84struct channel
85{ 85{
86 long magic; 86 long magic;
87 struct tty_port port;
87 unsigned char boardnum; 88 unsigned char boardnum;
88 unsigned char channelnum; 89 unsigned char channelnum;
89 unsigned char omodem; /* FEP output modem status */ 90 unsigned char omodem; /* FEP output modem status */
@@ -117,10 +118,7 @@ struct channel
117 unsigned short rxbufhead; 118 unsigned short rxbufhead;
118 unsigned short rxbufsize; 119 unsigned short rxbufsize;
119 int close_delay; 120 int close_delay;
120 int count;
121 int blocked_open;
122 unsigned long event; 121 unsigned long event;
123 int asyncflags;
124 uint dev; 122 uint dev;
125 unsigned long statusflags; 123 unsigned long statusflags;
126 unsigned long c_iflag; 124 unsigned long c_iflag;
@@ -132,9 +130,6 @@ struct channel
132 struct board_info *board; 130 struct board_info *board;
133 struct board_chan __iomem *brdchan; 131 struct board_chan __iomem *brdchan;
134 struct digi_struct digiext; 132 struct digi_struct digiext;
135 struct tty_struct *tty;
136 wait_queue_head_t open_wait;
137 wait_queue_head_t close_wait;
138 struct work_struct tqueue; 133 struct work_struct tqueue;
139 struct global_data __iomem *mailbox; 134 struct global_data __iomem *mailbox;
140}; 135};
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 84840ba13ff0..2eaf09f93e3d 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -128,9 +128,9 @@ static struct tty_driver *esp_driver;
128 128
129#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) 129#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
130#define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ 130#define DBG_CNT(s) printk(KERN_DEBUG "(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
131 tty->name, info->flags, \ 131 tty->name, info->port.flags, \
132 serial_driver.refcount, \ 132 serial_driver.refcount, \
133 info->count, tty->count, s) 133 info->port.count, tty->count, s)
134#else 134#else
135#define DBG_CNT(s) 135#define DBG_CNT(s)
136#endif 136#endif
@@ -172,13 +172,13 @@ static inline int serial_paranoia_check(struct esp_struct *info,
172 172
173static inline unsigned int serial_in(struct esp_struct *info, int offset) 173static inline unsigned int serial_in(struct esp_struct *info, int offset)
174{ 174{
175 return inb(info->port + offset); 175 return inb(info->io_port + offset);
176} 176}
177 177
178static inline void serial_out(struct esp_struct *info, int offset, 178static inline void serial_out(struct esp_struct *info, int offset,
179 unsigned char value) 179 unsigned char value)
180{ 180{
181 outb(value, info->port+offset); 181 outb(value, info->io_port+offset);
182} 182}
183 183
184/* 184/*
@@ -273,7 +273,7 @@ static inline void release_pio_buffer(struct esp_pio_buffer *buf)
273 273
274static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) 274static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)
275{ 275{
276 struct tty_struct *tty = info->tty; 276 struct tty_struct *tty = info->port.tty;
277 int i; 277 int i;
278 struct esp_pio_buffer *pio_buf; 278 struct esp_pio_buffer *pio_buf;
279 struct esp_pio_buffer *err_buf; 279 struct esp_pio_buffer *err_buf;
@@ -295,7 +295,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)
295 295
296 for (i = 0; i < num_bytes - 1; i += 2) { 296 for (i = 0; i < num_bytes - 1; i += 2) {
297 *((unsigned short *)(pio_buf->data + i)) = 297 *((unsigned short *)(pio_buf->data + i)) =
298 inw(info->port + UART_ESI_RX); 298 inw(info->io_port + UART_ESI_RX);
299 err_buf->data[i] = serial_in(info, UART_ESI_RWS); 299 err_buf->data[i] = serial_in(info, UART_ESI_RWS);
300 err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask; 300 err_buf->data[i + 1] = (err_buf->data[i] >> 3) & status_mask;
301 err_buf->data[i] &= status_mask; 301 err_buf->data[i] &= status_mask;
@@ -308,7 +308,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)
308 } 308 }
309 309
310 /* make sure everything is still ok since interrupts were enabled */ 310 /* make sure everything is still ok since interrupts were enabled */
311 tty = info->tty; 311 tty = info->port.tty;
312 312
313 if (!tty) { 313 if (!tty) {
314 release_pio_buffer(pio_buf); 314 release_pio_buffer(pio_buf);
@@ -325,7 +325,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes)
325 325
326 if (err_buf->data[i] & 0x04) { 326 if (err_buf->data[i] & 0x04) {
327 flag = TTY_BREAK; 327 flag = TTY_BREAK;
328 if (info->flags & ASYNC_SAK) 328 if (info->port.flags & ASYNC_SAK)
329 do_SAK(tty); 329 do_SAK(tty);
330 } else if (err_buf->data[i] & 0x02) 330 } else if (err_buf->data[i] & 0x02)
331 flag = TTY_FRAME; 331 flag = TTY_FRAME;
@@ -370,7 +370,7 @@ static void receive_chars_dma(struct esp_struct *info, int num_bytes)
370static inline void receive_chars_dma_done(struct esp_struct *info, 370static inline void receive_chars_dma_done(struct esp_struct *info,
371 int status) 371 int status)
372{ 372{
373 struct tty_struct *tty = info->tty; 373 struct tty_struct *tty = info->port.tty;
374 int num_bytes; 374 int num_bytes;
375 unsigned long flags; 375 unsigned long flags;
376 376
@@ -396,7 +396,7 @@ static inline void receive_chars_dma_done(struct esp_struct *info,
396 if (status & 0x10) { 396 if (status & 0x10) {
397 statflag = TTY_BREAK; 397 statflag = TTY_BREAK;
398 (info->icount.brk)++; 398 (info->icount.brk)++;
399 if (info->flags & ASYNC_SAK) 399 if (info->port.flags & ASYNC_SAK)
400 do_SAK(tty); 400 do_SAK(tty);
401 } else if (status & 0x08) { 401 } else if (status & 0x08) {
402 statflag = TTY_FRAME; 402 statflag = TTY_FRAME;
@@ -451,7 +451,7 @@ static inline void transmit_chars_pio(struct esp_struct *info,
451 451
452 for (i = 0; i < space_avail - 1; i += 2) { 452 for (i = 0; i < space_avail - 1; i += 2) {
453 outw(*((unsigned short *)(pio_buf->data + i)), 453 outw(*((unsigned short *)(pio_buf->data + i)),
454 info->port + UART_ESI_TX); 454 info->io_port + UART_ESI_TX);
455 } 455 }
456 456
457 if (space_avail & 0x0001) 457 if (space_avail & 0x0001)
@@ -470,8 +470,8 @@ static inline void transmit_chars_pio(struct esp_struct *info,
470 } 470 }
471 471
472 if (info->xmit_cnt < WAKEUP_CHARS) { 472 if (info->xmit_cnt < WAKEUP_CHARS) {
473 if (info->tty) 473 if (info->port.tty)
474 tty_wakeup(info->tty); 474 tty_wakeup(info->port.tty);
475 475
476#ifdef SERIAL_DEBUG_INTR 476#ifdef SERIAL_DEBUG_INTR
477 printk("THRE..."); 477 printk("THRE...");
@@ -507,8 +507,8 @@ static inline void transmit_chars_dma(struct esp_struct *info, int num_bytes)
507 info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1); 507 info->xmit_tail = (info->xmit_tail + dma_bytes) & (ESP_XMIT_SIZE - 1);
508 508
509 if (info->xmit_cnt < WAKEUP_CHARS) { 509 if (info->xmit_cnt < WAKEUP_CHARS) {
510 if (info->tty) 510 if (info->port.tty)
511 tty_wakeup(info->tty); 511 tty_wakeup(info->port.tty);
512 512
513#ifdef SERIAL_DEBUG_INTR 513#ifdef SERIAL_DEBUG_INTR
514 printk("THRE..."); 514 printk("THRE...");
@@ -575,18 +575,18 @@ static void check_modem_status(struct esp_struct *info)
575 wake_up_interruptible(&info->delta_msr_wait); 575 wake_up_interruptible(&info->delta_msr_wait);
576 } 576 }
577 577
578 if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { 578 if ((info->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
579#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) 579#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
580 printk("ttys%d CD now %s...", info->line, 580 printk("ttys%d CD now %s...", info->line,
581 (status & UART_MSR_DCD) ? "on" : "off"); 581 (status & UART_MSR_DCD) ? "on" : "off");
582#endif 582#endif
583 if (status & UART_MSR_DCD) 583 if (status & UART_MSR_DCD)
584 wake_up_interruptible(&info->open_wait); 584 wake_up_interruptible(&info->port.open_wait);
585 else { 585 else {
586#ifdef SERIAL_DEBUG_OPEN 586#ifdef SERIAL_DEBUG_OPEN
587 printk("scheduling hangup..."); 587 printk("scheduling hangup...");
588#endif 588#endif
589 tty_hangup(info->tty); 589 tty_hangup(info->port.tty);
590 } 590 }
591 } 591 }
592} 592}
@@ -609,7 +609,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
609 609
610 spin_lock(&info->lock); 610 spin_lock(&info->lock);
611 611
612 if (!info->tty) { 612 if (!info->port.tty) {
613 spin_unlock(&info->lock); 613 spin_unlock(&info->lock);
614 return IRQ_NONE; 614 return IRQ_NONE;
615 } 615 }
@@ -647,7 +647,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
647 num_bytes = serial_in(info, UART_ESI_STAT1) << 8; 647 num_bytes = serial_in(info, UART_ESI_STAT1) << 8;
648 num_bytes |= serial_in(info, UART_ESI_STAT2); 648 num_bytes |= serial_in(info, UART_ESI_STAT2);
649 649
650 num_bytes = tty_buffer_request_room(info->tty, num_bytes); 650 num_bytes = tty_buffer_request_room(info->port.tty, num_bytes);
651 651
652 if (num_bytes) { 652 if (num_bytes) {
653 if (dma_bytes || 653 if (dma_bytes ||
@@ -661,7 +661,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
661 661
662 if (!(info->stat_flags & (ESP_STAT_DMA_RX | ESP_STAT_DMA_TX)) && 662 if (!(info->stat_flags & (ESP_STAT_DMA_RX | ESP_STAT_DMA_TX)) &&
663 (scratch & 0x02) && (info->IER & UART_IER_THRI)) { 663 (scratch & 0x02) && (info->IER & UART_IER_THRI)) {
664 if ((info->xmit_cnt <= 0) || info->tty->stopped) { 664 if ((info->xmit_cnt <= 0) || info->port.tty->stopped) {
665 info->IER &= ~UART_IER_THRI; 665 info->IER &= ~UART_IER_THRI;
666 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 666 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);
667 serial_out(info, UART_ESI_CMD2, info->IER); 667 serial_out(info, UART_ESI_CMD2, info->IER);
@@ -782,7 +782,7 @@ static int startup(struct esp_struct *info)
782 782
783 spin_lock_irqsave(&info->lock, flags); 783 spin_lock_irqsave(&info->lock, flags);
784 784
785 if (info->flags & ASYNC_INITIALIZED) 785 if (info->port.flags & ASYNC_INITIALIZED)
786 goto out; 786 goto out;
787 787
788 if (!info->xmit_buf) { 788 if (!info->xmit_buf) {
@@ -806,7 +806,7 @@ static int startup(struct esp_struct *info)
806 num_chars |= serial_in(info, UART_ESI_STAT2); 806 num_chars |= serial_in(info, UART_ESI_STAT2);
807 807
808 while (num_chars > 1) { 808 while (num_chars > 1) {
809 inw(info->port + UART_ESI_RX); 809 inw(info->io_port + UART_ESI_RX);
810 num_chars -= 2; 810 num_chars -= 2;
811 } 811 }
812 812
@@ -834,9 +834,9 @@ static int startup(struct esp_struct *info)
834 834
835 if (retval) { 835 if (retval) {
836 if (capable(CAP_SYS_ADMIN)) { 836 if (capable(CAP_SYS_ADMIN)) {
837 if (info->tty) 837 if (info->port.tty)
838 set_bit(TTY_IO_ERROR, 838 set_bit(TTY_IO_ERROR,
839 &info->tty->flags); 839 &info->port.tty->flags);
840 retval = 0; 840 retval = 0;
841 } 841 }
842 goto out_unlocked; 842 goto out_unlocked;
@@ -874,30 +874,30 @@ static int startup(struct esp_struct *info)
874 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 874 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);
875 serial_out(info, UART_ESI_CMD2, info->IER); 875 serial_out(info, UART_ESI_CMD2, info->IER);
876 876
877 if (info->tty) 877 if (info->port.tty)
878 clear_bit(TTY_IO_ERROR, &info->tty->flags); 878 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
879 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 879 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
880 spin_unlock_irqrestore(&info->lock, flags); 880 spin_unlock_irqrestore(&info->lock, flags);
881 881
882 /* 882 /*
883 * Set up the tty->alt_speed kludge 883 * Set up the tty->alt_speed kludge
884 */ 884 */
885 if (info->tty) { 885 if (info->port.tty) {
886 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 886 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
887 info->tty->alt_speed = 57600; 887 info->port.tty->alt_speed = 57600;
888 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 888 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
889 info->tty->alt_speed = 115200; 889 info->port.tty->alt_speed = 115200;
890 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 890 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
891 info->tty->alt_speed = 230400; 891 info->port.tty->alt_speed = 230400;
892 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 892 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
893 info->tty->alt_speed = 460800; 893 info->port.tty->alt_speed = 460800;
894 } 894 }
895 895
896 /* 896 /*
897 * set the speed of the serial port 897 * set the speed of the serial port
898 */ 898 */
899 change_speed(info); 899 change_speed(info);
900 info->flags |= ASYNC_INITIALIZED; 900 info->port.flags |= ASYNC_INITIALIZED;
901 return 0; 901 return 0;
902 902
903out: 903out:
@@ -914,7 +914,7 @@ static void shutdown(struct esp_struct *info)
914{ 914{
915 unsigned long flags, f; 915 unsigned long flags, f;
916 916
917 if (!(info->flags & ASYNC_INITIALIZED)) 917 if (!(info->port.flags & ASYNC_INITIALIZED))
918 return; 918 return;
919 919
920#ifdef SERIAL_DEBUG_OPEN 920#ifdef SERIAL_DEBUG_OPEN
@@ -951,7 +951,7 @@ static void shutdown(struct esp_struct *info)
951 951
952 while (current_port) { 952 while (current_port) {
953 if ((current_port != info) && 953 if ((current_port != info) &&
954 (current_port->flags & ASYNC_INITIALIZED)) 954 (current_port->port.flags & ASYNC_INITIALIZED))
955 break; 955 break;
956 956
957 current_port = current_port->next_port; 957 current_port = current_port->next_port;
@@ -974,7 +974,7 @@ static void shutdown(struct esp_struct *info)
974 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 974 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);
975 serial_out(info, UART_ESI_CMD2, 0x00); 975 serial_out(info, UART_ESI_CMD2, 0x00);
976 976
977 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 977 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))
978 info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS); 978 info->MCR &= ~(UART_MCR_DTR|UART_MCR_RTS);
979 979
980 info->MCR &= ~UART_MCR_OUT2; 980 info->MCR &= ~UART_MCR_OUT2;
@@ -982,10 +982,10 @@ static void shutdown(struct esp_struct *info)
982 serial_out(info, UART_ESI_CMD2, UART_MCR); 982 serial_out(info, UART_ESI_CMD2, UART_MCR);
983 serial_out(info, UART_ESI_CMD2, info->MCR); 983 serial_out(info, UART_ESI_CMD2, info->MCR);
984 984
985 if (info->tty) 985 if (info->port.tty)
986 set_bit(TTY_IO_ERROR, &info->tty->flags); 986 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
987 987
988 info->flags &= ~ASYNC_INITIALIZED; 988 info->port.flags &= ~ASYNC_INITIALIZED;
989 spin_unlock_irqrestore(&info->lock, flags); 989 spin_unlock_irqrestore(&info->lock, flags);
990} 990}
991 991
@@ -1002,10 +1002,10 @@ static void change_speed(struct esp_struct *info)
1002 unsigned char flow1 = 0, flow2 = 0; 1002 unsigned char flow1 = 0, flow2 = 0;
1003 unsigned long flags; 1003 unsigned long flags;
1004 1004
1005 if (!info->tty || !info->tty->termios) 1005 if (!info->port.tty || !info->port.tty->termios)
1006 return; 1006 return;
1007 cflag = info->tty->termios->c_cflag; 1007 cflag = info->port.tty->termios->c_cflag;
1008 port = info->port; 1008 port = info->io_port;
1009 1009
1010 /* byte size and parity */ 1010 /* byte size and parity */
1011 switch (cflag & CSIZE) { 1011 switch (cflag & CSIZE) {
@@ -1029,9 +1029,9 @@ static void change_speed(struct esp_struct *info)
1029 if (cflag & CMSPAR) 1029 if (cflag & CMSPAR)
1030 cval |= UART_LCR_SPAR; 1030 cval |= UART_LCR_SPAR;
1031#endif 1031#endif
1032 baud = tty_get_baud_rate(info->tty); 1032 baud = tty_get_baud_rate(info->port.tty);
1033 if (baud == 38400 && 1033 if (baud == 38400 &&
1034 ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) 1034 ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
1035 quot = info->custom_divisor; 1035 quot = info->custom_divisor;
1036 else { 1036 else {
1037 if (baud == 134) /* Special case since 134 is really 134.5 */ 1037 if (baud == 134) /* Special case since 134 is really 134.5 */
@@ -1046,49 +1046,49 @@ static void change_speed(struct esp_struct *info)
1046 if (baud) { 1046 if (baud) {
1047 /* Actual rate */ 1047 /* Actual rate */
1048 baud = BASE_BAUD/quot; 1048 baud = BASE_BAUD/quot;
1049 tty_encode_baud_rate(info->tty, baud, baud); 1049 tty_encode_baud_rate(info->port.tty, baud, baud);
1050 } 1050 }
1051 info->timeout = ((1024 * HZ * bits * quot) / BASE_BAUD) + (HZ / 50); 1051 info->timeout = ((1024 * HZ * bits * quot) / BASE_BAUD) + (HZ / 50);
1052 1052
1053 /* CTS flow control flag and modem status interrupts */ 1053 /* CTS flow control flag and modem status interrupts */
1054 /* info->IER &= ~UART_IER_MSI; */ 1054 /* info->IER &= ~UART_IER_MSI; */
1055 if (cflag & CRTSCTS) { 1055 if (cflag & CRTSCTS) {
1056 info->flags |= ASYNC_CTS_FLOW; 1056 info->port.flags |= ASYNC_CTS_FLOW;
1057 /* info->IER |= UART_IER_MSI; */ 1057 /* info->IER |= UART_IER_MSI; */
1058 flow1 = 0x04; 1058 flow1 = 0x04;
1059 flow2 = 0x10; 1059 flow2 = 0x10;
1060 } else 1060 } else
1061 info->flags &= ~ASYNC_CTS_FLOW; 1061 info->port.flags &= ~ASYNC_CTS_FLOW;
1062 if (cflag & CLOCAL) 1062 if (cflag & CLOCAL)
1063 info->flags &= ~ASYNC_CHECK_CD; 1063 info->port.flags &= ~ASYNC_CHECK_CD;
1064 else 1064 else
1065 info->flags |= ASYNC_CHECK_CD; 1065 info->port.flags |= ASYNC_CHECK_CD;
1066 1066
1067 /* 1067 /*
1068 * Set up parity check flag 1068 * Set up parity check flag
1069 */ 1069 */
1070 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; 1070 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
1071 if (I_INPCK(info->tty)) 1071 if (I_INPCK(info->port.tty))
1072 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; 1072 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE;
1073 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 1073 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
1074 info->read_status_mask |= UART_LSR_BI; 1074 info->read_status_mask |= UART_LSR_BI;
1075 1075
1076 info->ignore_status_mask = 0; 1076 info->ignore_status_mask = 0;
1077#if 0 1077#if 0
1078 /* This should be safe, but for some broken bits of hardware... */ 1078 /* This should be safe, but for some broken bits of hardware... */
1079 if (I_IGNPAR(info->tty)) { 1079 if (I_IGNPAR(info->port.tty)) {
1080 info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; 1080 info->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
1081 info->read_status_mask |= UART_LSR_PE | UART_LSR_FE; 1081 info->read_status_mask |= UART_LSR_PE | UART_LSR_FE;
1082 } 1082 }
1083#endif 1083#endif
1084 if (I_IGNBRK(info->tty)) { 1084 if (I_IGNBRK(info->port.tty)) {
1085 info->ignore_status_mask |= UART_LSR_BI; 1085 info->ignore_status_mask |= UART_LSR_BI;
1086 info->read_status_mask |= UART_LSR_BI; 1086 info->read_status_mask |= UART_LSR_BI;
1087 /* 1087 /*
1088 * If we're ignore parity and break indicators, ignore 1088 * If we're ignore parity and break indicators, ignore
1089 * overruns too. (For real raw support). 1089 * overruns too. (For real raw support).
1090 */ 1090 */
1091 if (I_IGNPAR(info->tty)) { 1091 if (I_IGNPAR(info->port.tty)) {
1092 info->ignore_status_mask |= UART_LSR_OE | \ 1092 info->ignore_status_mask |= UART_LSR_OE | \
1093 UART_LSR_PE | UART_LSR_FE; 1093 UART_LSR_PE | UART_LSR_FE;
1094 info->read_status_mask |= UART_LSR_OE | \ 1094 info->read_status_mask |= UART_LSR_OE | \
@@ -1096,7 +1096,7 @@ static void change_speed(struct esp_struct *info)
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 if (I_IXOFF(info->tty)) 1099 if (I_IXOFF(info->port.tty))
1100 flow1 |= 0x81; 1100 flow1 |= 0x81;
1101 1101
1102 spin_lock_irqsave(&info->lock, flags); 1102 spin_lock_irqsave(&info->lock, flags);
@@ -1116,10 +1116,10 @@ static void change_speed(struct esp_struct *info)
1116 serial_out(info, UART_ESI_CMD2, flow2); 1116 serial_out(info, UART_ESI_CMD2, flow2);
1117 1117
1118 /* set flow control characters (XON/XOFF only) */ 1118 /* set flow control characters (XON/XOFF only) */
1119 if (I_IXOFF(info->tty)) { 1119 if (I_IXOFF(info->port.tty)) {
1120 serial_out(info, UART_ESI_CMD1, ESI_SET_FLOW_CHARS); 1120 serial_out(info, UART_ESI_CMD1, ESI_SET_FLOW_CHARS);
1121 serial_out(info, UART_ESI_CMD2, START_CHAR(info->tty)); 1121 serial_out(info, UART_ESI_CMD2, START_CHAR(info->port.tty));
1122 serial_out(info, UART_ESI_CMD2, STOP_CHAR(info->tty)); 1122 serial_out(info, UART_ESI_CMD2, STOP_CHAR(info->port.tty));
1123 serial_out(info, UART_ESI_CMD2, 0x10); 1123 serial_out(info, UART_ESI_CMD2, 0x10);
1124 serial_out(info, UART_ESI_CMD2, 0x21); 1124 serial_out(info, UART_ESI_CMD2, 0x21);
1125 switch (cflag & CSIZE) { 1125 switch (cflag & CSIZE) {
@@ -1355,9 +1355,9 @@ static int get_serial_info(struct esp_struct *info,
1355 memset(&tmp, 0, sizeof(tmp)); 1355 memset(&tmp, 0, sizeof(tmp));
1356 tmp.type = PORT_16550A; 1356 tmp.type = PORT_16550A;
1357 tmp.line = info->line; 1357 tmp.line = info->line;
1358 tmp.port = info->port; 1358 tmp.port = info->io_port;
1359 tmp.irq = info->irq; 1359 tmp.irq = info->irq;
1360 tmp.flags = info->flags; 1360 tmp.flags = info->port.flags;
1361 tmp.xmit_fifo_size = 1024; 1361 tmp.xmit_fifo_size = 1024;
1362 tmp.baud_base = BASE_BAUD; 1362 tmp.baud_base = BASE_BAUD;
1363 tmp.close_delay = info->close_delay; 1363 tmp.close_delay = info->close_delay;
@@ -1407,7 +1407,7 @@ static int set_serial_info(struct esp_struct *info,
1407 1407
1408 if ((new_serial.type != PORT_16550A) || 1408 if ((new_serial.type != PORT_16550A) ||
1409 (new_serial.hub6) || 1409 (new_serial.hub6) ||
1410 (info->port != new_serial.port) || 1410 (info->io_port != new_serial.port) ||
1411 (new_serial.baud_base != BASE_BAUD) || 1411 (new_serial.baud_base != BASE_BAUD) ||
1412 (new_serial.irq > 15) || 1412 (new_serial.irq > 15) ||
1413 (new_serial.irq < 2) || 1413 (new_serial.irq < 2) ||
@@ -1425,9 +1425,9 @@ static int set_serial_info(struct esp_struct *info,
1425 if (change_irq || 1425 if (change_irq ||
1426 (new_serial.close_delay != info->close_delay) || 1426 (new_serial.close_delay != info->close_delay) ||
1427 ((new_serial.flags & ~ASYNC_USR_MASK) != 1427 ((new_serial.flags & ~ASYNC_USR_MASK) !=
1428 (info->flags & ~ASYNC_USR_MASK))) 1428 (info->port.flags & ~ASYNC_USR_MASK)))
1429 return -EPERM; 1429 return -EPERM;
1430 info->flags = ((info->flags & ~ASYNC_USR_MASK) | 1430 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
1431 (new_serial.flags & ASYNC_USR_MASK)); 1431 (new_serial.flags & ASYNC_USR_MASK));
1432 info->custom_divisor = new_serial.custom_divisor; 1432 info->custom_divisor = new_serial.custom_divisor;
1433 } else { 1433 } else {
@@ -1441,9 +1441,9 @@ static int set_serial_info(struct esp_struct *info,
1441 if ((current_async->line >= info->line) && 1441 if ((current_async->line >= info->line) &&
1442 (current_async->line < (info->line + 8))) { 1442 (current_async->line < (info->line + 8))) {
1443 if (current_async == info) { 1443 if (current_async == info) {
1444 if (current_async->count > 1) 1444 if (current_async->port.count > 1)
1445 return -EBUSY; 1445 return -EBUSY;
1446 } else if (current_async->count) 1446 } else if (current_async->port.count)
1447 return -EBUSY; 1447 return -EBUSY;
1448 } 1448 }
1449 1449
@@ -1456,7 +1456,7 @@ static int set_serial_info(struct esp_struct *info,
1456 * At this point, we start making changes..... 1456 * At this point, we start making changes.....
1457 */ 1457 */
1458 1458
1459 info->flags = ((info->flags & ~ASYNC_FLAGS) | 1459 info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
1460 (new_serial.flags & ASYNC_FLAGS)); 1460 (new_serial.flags & ASYNC_FLAGS));
1461 info->custom_divisor = new_serial.custom_divisor; 1461 info->custom_divisor = new_serial.custom_divisor;
1462 info->close_delay = new_serial.close_delay * HZ/100; 1462 info->close_delay = new_serial.close_delay * HZ/100;
@@ -1487,18 +1487,18 @@ static int set_serial_info(struct esp_struct *info,
1487 } 1487 }
1488 } 1488 }
1489 1489
1490 if (info->flags & ASYNC_INITIALIZED) { 1490 if (info->port.flags & ASYNC_INITIALIZED) {
1491 if (((old_info.flags & ASYNC_SPD_MASK) != 1491 if (((old_info.port.flags & ASYNC_SPD_MASK) !=
1492 (info->flags & ASYNC_SPD_MASK)) || 1492 (info->port.flags & ASYNC_SPD_MASK)) ||
1493 (old_info.custom_divisor != info->custom_divisor)) { 1493 (old_info.custom_divisor != info->custom_divisor)) {
1494 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1494 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1495 info->tty->alt_speed = 57600; 1495 info->port.tty->alt_speed = 57600;
1496 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1496 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1497 info->tty->alt_speed = 115200; 1497 info->port.tty->alt_speed = 115200;
1498 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 1498 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
1499 info->tty->alt_speed = 230400; 1499 info->port.tty->alt_speed = 230400;
1500 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 1500 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
1501 info->tty->alt_speed = 460800; 1501 info->port.tty->alt_speed = 460800;
1502 change_speed(info); 1502 change_speed(info);
1503 } 1503 }
1504 } else 1504 } else
@@ -1554,9 +1554,9 @@ static int set_esp_config(struct esp_struct *info,
1554 1554
1555 while (current_async) { 1555 while (current_async) {
1556 if (current_async == info) { 1556 if (current_async == info) {
1557 if (current_async->count > 1) 1557 if (current_async->port.count > 1)
1558 return -EBUSY; 1558 return -EBUSY;
1559 } else if (current_async->count) 1559 } else if (current_async->port.count)
1560 return -EBUSY; 1560 return -EBUSY;
1561 1561
1562 current_async = current_async->next_port; 1562 current_async = current_async->next_port;
@@ -1578,7 +1578,7 @@ static int set_esp_config(struct esp_struct *info,
1578 spin_unlock_irqrestore(&info->lock, flags); 1578 spin_unlock_irqrestore(&info->lock, flags);
1579 } else { 1579 } else {
1580 /* DMA mode to PIO mode only */ 1580 /* DMA mode to PIO mode only */
1581 if (info->count > 1) 1581 if (info->port.count > 1)
1582 return -EBUSY; 1582 return -EBUSY;
1583 1583
1584 shutdown(info); 1584 shutdown(info);
@@ -1634,7 +1634,7 @@ static int set_esp_config(struct esp_struct *info,
1634 spin_unlock_irqrestore(&info->lock, flags); 1634 spin_unlock_irqrestore(&info->lock, flags);
1635 } 1635 }
1636 1636
1637 if (!(info->flags & ASYNC_INITIALIZED)) 1637 if (!(info->port.flags & ASYNC_INITIALIZED))
1638 retval = startup(info); 1638 retval = startup(info);
1639 1639
1640 return retval; 1640 return retval;
@@ -1917,9 +1917,9 @@ static void rs_close(struct tty_struct *tty, struct file *filp)
1917 1917
1918#ifdef SERIAL_DEBUG_OPEN 1918#ifdef SERIAL_DEBUG_OPEN
1919 printk(KERN_DEBUG "rs_close ttys%d, count = %d\n", 1919 printk(KERN_DEBUG "rs_close ttys%d, count = %d\n",
1920 info->line, info->count); 1920 info->line, info->port.count);
1921#endif 1921#endif
1922 if (tty->count == 1 && info->count != 1) { 1922 if (tty->count == 1 && info->port.count != 1) {
1923 /* 1923 /*
1924 * Uh, oh. tty->count is 1, which means that the tty 1924 * Uh, oh. tty->count is 1, which means that the tty
1925 * structure will be freed. Info->count should always 1925 * structure will be freed. Info->count should always
@@ -1927,19 +1927,19 @@ static void rs_close(struct tty_struct *tty, struct file *filp)
1927 * one, we've got real problems, since it means the 1927 * one, we've got real problems, since it means the
1928 * serial port won't be shutdown. 1928 * serial port won't be shutdown.
1929 */ 1929 */
1930 printk(KERN_DEBUG "rs_close: bad serial port count; tty->count is 1, info->count is %d\n", info->count); 1930 printk(KERN_DEBUG "rs_close: bad serial port count; tty->count is 1, info->port.count is %d\n", info->port.count);
1931 info->count = 1; 1931 info->port.count = 1;
1932 } 1932 }
1933 if (--info->count < 0) { 1933 if (--info->port.count < 0) {
1934 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n", 1934 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n",
1935 info->line, info->count); 1935 info->line, info->port.count);
1936 info->count = 0; 1936 info->port.count = 0;
1937 } 1937 }
1938 if (info->count) { 1938 if (info->port.count) {
1939 DBG_CNT("before DEC-2"); 1939 DBG_CNT("before DEC-2");
1940 goto out; 1940 goto out;
1941 } 1941 }
1942 info->flags |= ASYNC_CLOSING; 1942 info->port.flags |= ASYNC_CLOSING;
1943 1943
1944 spin_unlock_irqrestore(&info->lock, flags); 1944 spin_unlock_irqrestore(&info->lock, flags);
1945 /* 1945 /*
@@ -1958,7 +1958,7 @@ static void rs_close(struct tty_struct *tty, struct file *filp)
1958 /* info->IER &= ~UART_IER_RLSI; */ 1958 /* info->IER &= ~UART_IER_RLSI; */
1959 info->IER &= ~UART_IER_RDI; 1959 info->IER &= ~UART_IER_RDI;
1960 info->read_status_mask &= ~UART_LSR_DR; 1960 info->read_status_mask &= ~UART_LSR_DR;
1961 if (info->flags & ASYNC_INITIALIZED) { 1961 if (info->port.flags & ASYNC_INITIALIZED) {
1962 1962
1963 spin_lock_irqsave(&info->lock, flags); 1963 spin_lock_irqsave(&info->lock, flags);
1964 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK); 1964 serial_out(info, UART_ESI_CMD1, ESI_SET_SRV_MASK);
@@ -1981,15 +1981,15 @@ static void rs_close(struct tty_struct *tty, struct file *filp)
1981 rs_flush_buffer(tty); 1981 rs_flush_buffer(tty);
1982 tty_ldisc_flush(tty); 1982 tty_ldisc_flush(tty);
1983 tty->closing = 0; 1983 tty->closing = 0;
1984 info->tty = NULL; 1984 info->port.tty = NULL;
1985 1985
1986 if (info->blocked_open) { 1986 if (info->port.blocked_open) {
1987 if (info->close_delay) 1987 if (info->close_delay)
1988 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 1988 msleep_interruptible(jiffies_to_msecs(info->close_delay));
1989 wake_up_interruptible(&info->open_wait); 1989 wake_up_interruptible(&info->port.open_wait);
1990 } 1990 }
1991 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1991 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1992 wake_up_interruptible(&info->close_wait); 1992 wake_up_interruptible(&info->port.close_wait);
1993 return; 1993 return;
1994 1994
1995out: 1995out:
@@ -2047,10 +2047,10 @@ static void esp_hangup(struct tty_struct *tty)
2047 2047
2048 rs_flush_buffer(tty); 2048 rs_flush_buffer(tty);
2049 shutdown(info); 2049 shutdown(info);
2050 info->count = 0; 2050 info->port.count = 0;
2051 info->flags &= ~ASYNC_NORMAL_ACTIVE; 2051 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2052 info->tty = NULL; 2052 info->port.tty = NULL;
2053 wake_up_interruptible(&info->open_wait); 2053 wake_up_interruptible(&info->port.open_wait);
2054} 2054}
2055 2055
2056/* 2056/*
@@ -2071,11 +2071,11 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
2071 * until it's done, and then try again. 2071 * until it's done, and then try again.
2072 */ 2072 */
2073 if (tty_hung_up_p(filp) || 2073 if (tty_hung_up_p(filp) ||
2074 (info->flags & ASYNC_CLOSING)) { 2074 (info->port.flags & ASYNC_CLOSING)) {
2075 if (info->flags & ASYNC_CLOSING) 2075 if (info->port.flags & ASYNC_CLOSING)
2076 interruptible_sleep_on(&info->close_wait); 2076 interruptible_sleep_on(&info->port.close_wait);
2077#ifdef SERIAL_DO_RESTART 2077#ifdef SERIAL_DO_RESTART
2078 if (info->flags & ASYNC_HUP_NOTIFY) 2078 if (info->port.flags & ASYNC_HUP_NOTIFY)
2079 return -EAGAIN; 2079 return -EAGAIN;
2080 else 2080 else
2081 return -ERESTARTSYS; 2081 return -ERESTARTSYS;
@@ -2090,7 +2090,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
2090 */ 2090 */
2091 if ((filp->f_flags & O_NONBLOCK) || 2091 if ((filp->f_flags & O_NONBLOCK) ||
2092 (tty->flags & (1 << TTY_IO_ERROR))) { 2092 (tty->flags & (1 << TTY_IO_ERROR))) {
2093 info->flags |= ASYNC_NORMAL_ACTIVE; 2093 info->port.flags |= ASYNC_NORMAL_ACTIVE;
2094 return 0; 2094 return 0;
2095 } 2095 }
2096 2096
@@ -2100,20 +2100,20 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
2100 /* 2100 /*
2101 * Block waiting for the carrier detect and the line to become 2101 * Block waiting for the carrier detect and the line to become
2102 * free (i.e., not in use by the callout). While we are in 2102 * free (i.e., not in use by the callout). While we are in
2103 * this loop, info->count is dropped by one, so that 2103 * this loop, info->port.count is dropped by one, so that
2104 * rs_close() knows when to free things. We restore it upon 2104 * rs_close() knows when to free things. We restore it upon
2105 * exit, either normal or abnormal. 2105 * exit, either normal or abnormal.
2106 */ 2106 */
2107 retval = 0; 2107 retval = 0;
2108 add_wait_queue(&info->open_wait, &wait); 2108 add_wait_queue(&info->port.open_wait, &wait);
2109#ifdef SERIAL_DEBUG_OPEN 2109#ifdef SERIAL_DEBUG_OPEN
2110 printk(KERN_DEBUG "block_til_ready before block: ttys%d, count = %d\n", 2110 printk(KERN_DEBUG "block_til_ready before block: ttys%d, count = %d\n",
2111 info->line, info->count); 2111 info->line, info->port.count);
2112#endif 2112#endif
2113 spin_lock_irqsave(&info->lock, flags); 2113 spin_lock_irqsave(&info->lock, flags);
2114 if (!tty_hung_up_p(filp)) 2114 if (!tty_hung_up_p(filp))
2115 info->count--; 2115 info->port.count--;
2116 info->blocked_open++; 2116 info->port.blocked_open++;
2117 while (1) { 2117 while (1) {
2118 if ((tty->termios->c_cflag & CBAUD)) { 2118 if ((tty->termios->c_cflag & CBAUD)) {
2119 unsigned int scratch; 2119 unsigned int scratch;
@@ -2128,9 +2128,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
2128 } 2128 }
2129 set_current_state(TASK_INTERRUPTIBLE); 2129 set_current_state(TASK_INTERRUPTIBLE);
2130 if (tty_hung_up_p(filp) || 2130 if (tty_hung_up_p(filp) ||
2131 !(info->flags & ASYNC_INITIALIZED)) { 2131 !(info->port.flags & ASYNC_INITIALIZED)) {
2132#ifdef SERIAL_DO_RESTART 2132#ifdef SERIAL_DO_RESTART
2133 if (info->flags & ASYNC_HUP_NOTIFY) 2133 if (info->port.flags & ASYNC_HUP_NOTIFY)
2134 retval = -EAGAIN; 2134 retval = -EAGAIN;
2135 else 2135 else
2136 retval = -ERESTARTSYS; 2136 retval = -ERESTARTSYS;
@@ -2144,7 +2144,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
2144 if (serial_in(info, UART_ESI_STAT2) & UART_MSR_DCD) 2144 if (serial_in(info, UART_ESI_STAT2) & UART_MSR_DCD)
2145 do_clocal = 1; 2145 do_clocal = 1;
2146 2146
2147 if (!(info->flags & ASYNC_CLOSING) && 2147 if (!(info->port.flags & ASYNC_CLOSING) &&
2148 (do_clocal)) 2148 (do_clocal))
2149 break; 2149 break;
2150 if (signal_pending(current)) { 2150 if (signal_pending(current)) {
@@ -2153,25 +2153,25 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
2153 } 2153 }
2154#ifdef SERIAL_DEBUG_OPEN 2154#ifdef SERIAL_DEBUG_OPEN
2155 printk(KERN_DEBUG "block_til_ready blocking: ttys%d, count = %d\n", 2155 printk(KERN_DEBUG "block_til_ready blocking: ttys%d, count = %d\n",
2156 info->line, info->count); 2156 info->line, info->port.count);
2157#endif 2157#endif
2158 spin_unlock_irqrestore(&info->lock, flags); 2158 spin_unlock_irqrestore(&info->lock, flags);
2159 schedule(); 2159 schedule();
2160 spin_lock_irqsave(&info->lock, flags); 2160 spin_lock_irqsave(&info->lock, flags);
2161 } 2161 }
2162 set_current_state(TASK_RUNNING); 2162 set_current_state(TASK_RUNNING);
2163 remove_wait_queue(&info->open_wait, &wait); 2163 remove_wait_queue(&info->port.open_wait, &wait);
2164 if (!tty_hung_up_p(filp)) 2164 if (!tty_hung_up_p(filp))
2165 info->count++; 2165 info->port.count++;
2166 info->blocked_open--; 2166 info->port.blocked_open--;
2167 spin_unlock_irqrestore(&info->lock, flags); 2167 spin_unlock_irqrestore(&info->lock, flags);
2168#ifdef SERIAL_DEBUG_OPEN 2168#ifdef SERIAL_DEBUG_OPEN
2169 printk(KERN_DEBUG "block_til_ready after blocking: ttys%d, count = %d\n", 2169 printk(KERN_DEBUG "block_til_ready after blocking: ttys%d, count = %d\n",
2170 info->line, info->count); 2170 info->line, info->port.count);
2171#endif 2171#endif
2172 if (retval) 2172 if (retval)
2173 return retval; 2173 return retval;
2174 info->flags |= ASYNC_NORMAL_ACTIVE; 2174 info->port.flags |= ASYNC_NORMAL_ACTIVE;
2175 return 0; 2175 return 0;
2176} 2176}
2177 2177
@@ -2204,12 +2204,12 @@ static int esp_open(struct tty_struct *tty, struct file *filp)
2204 } 2204 }
2205 2205
2206#ifdef SERIAL_DEBUG_OPEN 2206#ifdef SERIAL_DEBUG_OPEN
2207 printk(KERN_DEBUG "esp_open %s, count = %d\n", tty->name, info->count); 2207 printk(KERN_DEBUG "esp_open %s, count = %d\n", tty->name, info->port.count);
2208#endif 2208#endif
2209 spin_lock_irqsave(&info->lock, flags); 2209 spin_lock_irqsave(&info->lock, flags);
2210 info->count++; 2210 info->port.count++;
2211 tty->driver_data = info; 2211 tty->driver_data = info;
2212 info->tty = tty; 2212 info->port.tty = tty;
2213 2213
2214 spin_unlock_irqrestore(&info->lock, flags); 2214 spin_unlock_irqrestore(&info->lock, flags);
2215 2215
@@ -2263,7 +2263,7 @@ static int autoconfig(struct esp_struct *info)
2263 int port_detected = 0; 2263 int port_detected = 0;
2264 unsigned long flags; 2264 unsigned long flags;
2265 2265
2266 if (!request_region(info->port, REGION_SIZE, "esp serial")) 2266 if (!request_region(info->io_port, REGION_SIZE, "esp serial"))
2267 return -EIO; 2267 return -EIO;
2268 2268
2269 spin_lock_irqsave(&info->lock, flags); 2269 spin_lock_irqsave(&info->lock, flags);
@@ -2300,7 +2300,7 @@ static int autoconfig(struct esp_struct *info)
2300 } 2300 }
2301 } 2301 }
2302 if (!port_detected) 2302 if (!port_detected)
2303 release_region(info->port, REGION_SIZE); 2303 release_region(info->io_port, REGION_SIZE);
2304 2304
2305 spin_unlock_irqrestore(&info->lock, flags); 2305 spin_unlock_irqrestore(&info->lock, flags);
2306 return (port_detected); 2306 return (port_detected);
@@ -2414,7 +2414,7 @@ static int __init espserial_init(void)
2414 offset = 0; 2414 offset = 0;
2415 2415
2416 do { 2416 do {
2417 info->port = esp[i] + offset; 2417 info->io_port = esp[i] + offset;
2418 info->irq = irq[i]; 2418 info->irq = irq[i];
2419 info->line = (i * 8) + (offset / 8); 2419 info->line = (i * 8) + (offset / 8);
2420 2420
@@ -2425,9 +2425,9 @@ static int __init espserial_init(void)
2425 } 2425 }
2426 2426
2427 info->custom_divisor = (divisor[i] >> (offset / 2)) & 0xf; 2427 info->custom_divisor = (divisor[i] >> (offset / 2)) & 0xf;
2428 info->flags = STD_COM_FLAGS; 2428 info->port.flags = STD_COM_FLAGS;
2429 if (info->custom_divisor) 2429 if (info->custom_divisor)
2430 info->flags |= ASYNC_SPD_CUST; 2430 info->port.flags |= ASYNC_SPD_CUST;
2431 info->magic = ESP_MAGIC; 2431 info->magic = ESP_MAGIC;
2432 info->close_delay = 5*HZ/10; 2432 info->close_delay = 5*HZ/10;
2433 info->closing_wait = 30*HZ; 2433 info->closing_wait = 30*HZ;
@@ -2436,13 +2436,13 @@ static int __init espserial_init(void)
2436 info->config.flow_off = flow_off; 2436 info->config.flow_off = flow_off;
2437 info->config.pio_threshold = pio_threshold; 2437 info->config.pio_threshold = pio_threshold;
2438 info->next_port = ports; 2438 info->next_port = ports;
2439 init_waitqueue_head(&info->open_wait); 2439 init_waitqueue_head(&info->port.open_wait);
2440 init_waitqueue_head(&info->close_wait); 2440 init_waitqueue_head(&info->port.close_wait);
2441 init_waitqueue_head(&info->delta_msr_wait); 2441 init_waitqueue_head(&info->delta_msr_wait);
2442 init_waitqueue_head(&info->break_wait); 2442 init_waitqueue_head(&info->break_wait);
2443 ports = info; 2443 ports = info;
2444 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ", 2444 printk(KERN_INFO "ttyP%d at 0x%04x (irq = %d) is an ESP ",
2445 info->line, info->port, info->irq); 2445 info->line, info->io_port, info->irq);
2446 2446
2447 if (info->line % 8) { 2447 if (info->line % 8) {
2448 printk("secondary port\n"); 2448 printk("secondary port\n");
@@ -2498,8 +2498,8 @@ static void __exit espserial_exit(void)
2498 put_tty_driver(esp_driver); 2498 put_tty_driver(esp_driver);
2499 2499
2500 while (ports) { 2500 while (ports) {
2501 if (ports->port) 2501 if (ports->io_port)
2502 release_region(ports->port, REGION_SIZE); 2502 release_region(ports->io_port, REGION_SIZE);
2503 temp_async = ports->next_port; 2503 temp_async = ports->next_port;
2504 kfree(ports); 2504 kfree(ports);
2505 ports = temp_async; 2505 ports = temp_async;
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 252f73e48596..19d3afb0e50c 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -60,7 +60,7 @@ int gs_put_char(struct tty_struct * tty, unsigned char ch)
60 60
61 if (!port) return 0; 61 if (!port) return 0;
62 62
63 if (! (port->flags & ASYNC_INITIALIZED)) return 0; 63 if (! (port->port.flags & ASYNC_INITIALIZED)) return 0;
64 64
65 /* Take a lock on the serial tranmit buffer! */ 65 /* Take a lock on the serial tranmit buffer! */
66 mutex_lock(& port->port_write_mutex); 66 mutex_lock(& port->port_write_mutex);
@@ -103,7 +103,7 @@ int gs_write(struct tty_struct * tty,
103 103
104 if (!port) return 0; 104 if (!port) return 0;
105 105
106 if (! (port->flags & ASYNC_INITIALIZED)) 106 if (! (port->port.flags & ASYNC_INITIALIZED))
107 return 0; 107 return 0;
108 108
109 /* get exclusive "write" access to this port (problem 3) */ 109 /* get exclusive "write" access to this port (problem 3) */
@@ -141,13 +141,13 @@ int gs_write(struct tty_struct * tty,
141 mutex_unlock(& port->port_write_mutex); 141 mutex_unlock(& port->port_write_mutex);
142 142
143 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", 143 gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n",
144 (port->flags & GS_TX_INTEN)?"enabled": "disabled"); 144 (port->port.flags & GS_TX_INTEN)?"enabled": "disabled");
145 145
146 if (port->xmit_cnt && 146 if (port->xmit_cnt &&
147 !tty->stopped && 147 !tty->stopped &&
148 !tty->hw_stopped && 148 !tty->hw_stopped &&
149 !(port->flags & GS_TX_INTEN)) { 149 !(port->port.flags & GS_TX_INTEN)) {
150 port->flags |= GS_TX_INTEN; 150 port->port.flags |= GS_TX_INTEN;
151 port->rd->enable_tx_interrupts (port); 151 port->rd->enable_tx_interrupts (port);
152 } 152 }
153 func_exit (); 153 func_exit ();
@@ -208,7 +208,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
208 gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port); 208 gs_dprintk (GS_DEBUG_FLUSH, "port=%p.\n", port);
209 if (port) { 209 if (port) {
210 gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n", 210 gs_dprintk (GS_DEBUG_FLUSH, "xmit_cnt=%x, xmit_buf=%p, tty=%p.\n",
211 port->xmit_cnt, port->xmit_buf, port->tty); 211 port->xmit_cnt, port->xmit_buf, port->port.tty);
212 } 212 }
213 213
214 if (!port || port->xmit_cnt < 0 || !port->xmit_buf) { 214 if (!port || port->xmit_cnt < 0 || !port->xmit_buf) {
@@ -217,7 +217,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
217 return -EINVAL; /* This is an error which we don't know how to handle. */ 217 return -EINVAL; /* This is an error which we don't know how to handle. */
218 } 218 }
219 219
220 rcib = gs_real_chars_in_buffer(port->tty); 220 rcib = gs_real_chars_in_buffer(port->port.tty);
221 221
222 if(rcib <= 0) { 222 if(rcib <= 0) {
223 gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n"); 223 gs_dprintk (GS_DEBUG_FLUSH, "nothing to wait for.\n");
@@ -236,7 +236,7 @@ static int gs_wait_tx_flushed (void * ptr, unsigned long timeout)
236 236
237 /* the expression is actually jiffies < end_jiffies, but that won't 237 /* the expression is actually jiffies < end_jiffies, but that won't
238 work around the wraparound. Tricky eh? */ 238 work around the wraparound. Tricky eh? */
239 while ((charsleft = gs_real_chars_in_buffer (port->tty)) && 239 while ((charsleft = gs_real_chars_in_buffer (port->port.tty)) &&
240 time_after (end_jiffies, jiffies)) { 240 time_after (end_jiffies, jiffies)) {
241 /* Units check: 241 /* Units check:
242 chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies! 242 chars * (bits/char) * (jiffies /sec) / (bits/sec) = jiffies!
@@ -309,7 +309,7 @@ void gs_flush_chars(struct tty_struct * tty)
309 } 309 }
310 310
311 /* Beats me -- REW */ 311 /* Beats me -- REW */
312 port->flags |= GS_TX_INTEN; 312 port->port.flags |= GS_TX_INTEN;
313 port->rd->enable_tx_interrupts (port); 313 port->rd->enable_tx_interrupts (port);
314 func_exit (); 314 func_exit ();
315} 315}
@@ -329,8 +329,8 @@ void gs_stop(struct tty_struct * tty)
329 329
330 if (port->xmit_cnt && 330 if (port->xmit_cnt &&
331 port->xmit_buf && 331 port->xmit_buf &&
332 (port->flags & GS_TX_INTEN) ) { 332 (port->port.flags & GS_TX_INTEN) ) {
333 port->flags &= ~GS_TX_INTEN; 333 port->port.flags &= ~GS_TX_INTEN;
334 port->rd->disable_tx_interrupts (port); 334 port->rd->disable_tx_interrupts (port);
335 } 335 }
336 func_exit (); 336 func_exit ();
@@ -349,8 +349,8 @@ void gs_start(struct tty_struct * tty)
349 349
350 if (port->xmit_cnt && 350 if (port->xmit_cnt &&
351 port->xmit_buf && 351 port->xmit_buf &&
352 !(port->flags & GS_TX_INTEN) ) { 352 !(port->port.flags & GS_TX_INTEN) ) {
353 port->flags |= GS_TX_INTEN; 353 port->port.flags |= GS_TX_INTEN;
354 port->rd->enable_tx_interrupts (port); 354 port->rd->enable_tx_interrupts (port);
355 } 355 }
356 func_exit (); 356 func_exit ();
@@ -365,7 +365,7 @@ static void gs_shutdown_port (struct gs_port *port)
365 365
366 if (!port) return; 366 if (!port) return;
367 367
368 if (!(port->flags & ASYNC_INITIALIZED)) 368 if (!(port->port.flags & ASYNC_INITIALIZED))
369 return; 369 return;
370 370
371 spin_lock_irqsave(&port->driver_lock, flags); 371 spin_lock_irqsave(&port->driver_lock, flags);
@@ -375,12 +375,12 @@ static void gs_shutdown_port (struct gs_port *port)
375 port->xmit_buf = NULL; 375 port->xmit_buf = NULL;
376 } 376 }
377 377
378 if (port->tty) 378 if (port->port.tty)
379 set_bit(TTY_IO_ERROR, &port->tty->flags); 379 set_bit(TTY_IO_ERROR, &port->port.tty->flags);
380 380
381 port->rd->shutdown_port (port); 381 port->rd->shutdown_port (port);
382 382
383 port->flags &= ~ASYNC_INITIALIZED; 383 port->port.flags &= ~ASYNC_INITIALIZED;
384 spin_unlock_irqrestore(&port->driver_lock, flags); 384 spin_unlock_irqrestore(&port->driver_lock, flags);
385 385
386 func_exit(); 386 func_exit();
@@ -396,16 +396,16 @@ void gs_hangup(struct tty_struct *tty)
396 if (!tty) return; 396 if (!tty) return;
397 397
398 port = tty->driver_data; 398 port = tty->driver_data;
399 tty = port->tty; 399 tty = port->port.tty;
400 if (!tty) 400 if (!tty)
401 return; 401 return;
402 402
403 gs_shutdown_port (port); 403 gs_shutdown_port (port);
404 port->flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE); 404 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|GS_ACTIVE);
405 port->tty = NULL; 405 port->port.tty = NULL;
406 port->count = 0; 406 port->port.count = 0;
407 407
408 wake_up_interruptible(&port->open_wait); 408 wake_up_interruptible(&port->port.open_wait);
409 func_exit (); 409 func_exit ();
410} 410}
411 411
@@ -424,7 +424,7 @@ int gs_block_til_ready(void *port_, struct file * filp)
424 424
425 if (!port) return 0; 425 if (!port) return 0;
426 426
427 tty = port->tty; 427 tty = port->port.tty;
428 428
429 if (!tty) return 0; 429 if (!tty) return 0;
430 430
@@ -433,9 +433,9 @@ int gs_block_til_ready(void *port_, struct file * filp)
433 * If the device is in the middle of being closed, then block 433 * If the device is in the middle of being closed, then block
434 * until it's done, and then try again. 434 * until it's done, and then try again.
435 */ 435 */
436 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { 436 if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
437 interruptible_sleep_on(&port->close_wait); 437 interruptible_sleep_on(&port->port.close_wait);
438 if (port->flags & ASYNC_HUP_NOTIFY) 438 if (port->port.flags & ASYNC_HUP_NOTIFY)
439 return -EAGAIN; 439 return -EAGAIN;
440 else 440 else
441 return -ERESTARTSYS; 441 return -ERESTARTSYS;
@@ -449,7 +449,7 @@ int gs_block_til_ready(void *port_, struct file * filp)
449 */ 449 */
450 if ((filp->f_flags & O_NONBLOCK) || 450 if ((filp->f_flags & O_NONBLOCK) ||
451 (tty->flags & (1 << TTY_IO_ERROR))) { 451 (tty->flags & (1 << TTY_IO_ERROR))) {
452 port->flags |= ASYNC_NORMAL_ACTIVE; 452 port->port.flags |= ASYNC_NORMAL_ACTIVE;
453 return 0; 453 return 0;
454 } 454 }
455 455
@@ -461,34 +461,34 @@ int gs_block_til_ready(void *port_, struct file * filp)
461 /* 461 /*
462 * Block waiting for the carrier detect and the line to become 462 * Block waiting for the carrier detect and the line to become
463 * free (i.e., not in use by the callout). While we are in 463 * free (i.e., not in use by the callout). While we are in
464 * this loop, port->count is dropped by one, so that 464 * this loop, port->port.count is dropped by one, so that
465 * rs_close() knows when to free things. We restore it upon 465 * rs_close() knows when to free things. We restore it upon
466 * exit, either normal or abnormal. 466 * exit, either normal or abnormal.
467 */ 467 */
468 retval = 0; 468 retval = 0;
469 469
470 add_wait_queue(&port->open_wait, &wait); 470 add_wait_queue(&port->port.open_wait, &wait);
471 471
472 gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n"); 472 gs_dprintk (GS_DEBUG_BTR, "after add waitq.\n");
473 spin_lock_irqsave(&port->driver_lock, flags); 473 spin_lock_irqsave(&port->driver_lock, flags);
474 if (!tty_hung_up_p(filp)) { 474 if (!tty_hung_up_p(filp)) {
475 port->count--; 475 port->port.count--;
476 } 476 }
477 spin_unlock_irqrestore(&port->driver_lock, flags); 477 spin_unlock_irqrestore(&port->driver_lock, flags);
478 port->blocked_open++; 478 port->port.blocked_open++;
479 while (1) { 479 while (1) {
480 CD = port->rd->get_CD (port); 480 CD = port->rd->get_CD (port);
481 gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD); 481 gs_dprintk (GS_DEBUG_BTR, "CD is now %d.\n", CD);
482 set_current_state (TASK_INTERRUPTIBLE); 482 set_current_state (TASK_INTERRUPTIBLE);
483 if (tty_hung_up_p(filp) || 483 if (tty_hung_up_p(filp) ||
484 !(port->flags & ASYNC_INITIALIZED)) { 484 !(port->port.flags & ASYNC_INITIALIZED)) {
485 if (port->flags & ASYNC_HUP_NOTIFY) 485 if (port->port.flags & ASYNC_HUP_NOTIFY)
486 retval = -EAGAIN; 486 retval = -EAGAIN;
487 else 487 else
488 retval = -ERESTARTSYS; 488 retval = -ERESTARTSYS;
489 break; 489 break;
490 } 490 }
491 if (!(port->flags & ASYNC_CLOSING) && 491 if (!(port->port.flags & ASYNC_CLOSING) &&
492 (do_clocal || CD)) 492 (do_clocal || CD))
493 break; 493 break;
494 gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n", 494 gs_dprintk (GS_DEBUG_BTR, "signal_pending is now: %d (%lx)\n",
@@ -500,17 +500,17 @@ int gs_block_til_ready(void *port_, struct file * filp)
500 schedule(); 500 schedule();
501 } 501 }
502 gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n", 502 gs_dprintk (GS_DEBUG_BTR, "Got out of the loop. (%d)\n",
503 port->blocked_open); 503 port->port.blocked_open);
504 set_current_state (TASK_RUNNING); 504 set_current_state (TASK_RUNNING);
505 remove_wait_queue(&port->open_wait, &wait); 505 remove_wait_queue(&port->port.open_wait, &wait);
506 if (!tty_hung_up_p(filp)) { 506 if (!tty_hung_up_p(filp)) {
507 port->count++; 507 port->port.count++;
508 } 508 }
509 port->blocked_open--; 509 port->port.blocked_open--;
510 if (retval) 510 if (retval)
511 return retval; 511 return retval;
512 512
513 port->flags |= ASYNC_NORMAL_ACTIVE; 513 port->port.flags |= ASYNC_NORMAL_ACTIVE;
514 func_exit (); 514 func_exit ();
515 return 0; 515 return 0;
516} 516}
@@ -529,10 +529,10 @@ void gs_close(struct tty_struct * tty, struct file * filp)
529 529
530 if (!port) return; 530 if (!port) return;
531 531
532 if (!port->tty) { 532 if (!port->port.tty) {
533 /* This seems to happen when this is called from vhangup. */ 533 /* This seems to happen when this is called from vhangup. */
534 gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->tty is NULL\n"); 534 gs_dprintk (GS_DEBUG_CLOSE, "gs: Odd: port->port.tty is NULL\n");
535 port->tty = tty; 535 port->port.tty = tty;
536 } 536 }
537 537
538 spin_lock_irqsave(&port->driver_lock, flags); 538 spin_lock_irqsave(&port->driver_lock, flags);
@@ -545,23 +545,23 @@ void gs_close(struct tty_struct * tty, struct file * filp)
545 return; 545 return;
546 } 546 }
547 547
548 if ((tty->count == 1) && (port->count != 1)) { 548 if ((tty->count == 1) && (port->port.count != 1)) {
549 printk(KERN_ERR "gs: gs_close port %p: bad port count;" 549 printk(KERN_ERR "gs: gs_close port %p: bad port count;"
550 " tty->count is 1, port count is %d\n", port, port->count); 550 " tty->count is 1, port count is %d\n", port, port->port.count);
551 port->count = 1; 551 port->port.count = 1;
552 } 552 }
553 if (--port->count < 0) { 553 if (--port->port.count < 0) {
554 printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->count); 554 printk(KERN_ERR "gs: gs_close port %p: bad port count: %d\n", port, port->port.count);
555 port->count = 0; 555 port->port.count = 0;
556 } 556 }
557 557
558 if (port->count) { 558 if (port->port.count) {
559 gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->count); 559 gs_dprintk(GS_DEBUG_CLOSE, "gs_close port %p: count: %d\n", port, port->port.count);
560 spin_unlock_irqrestore(&port->driver_lock, flags); 560 spin_unlock_irqrestore(&port->driver_lock, flags);
561 func_exit (); 561 func_exit ();
562 return; 562 return;
563 } 563 }
564 port->flags |= ASYNC_CLOSING; 564 port->port.flags |= ASYNC_CLOSING;
565 565
566 /* 566 /*
567 * Now we wait for the transmit buffer to clear; and we notify 567 * Now we wait for the transmit buffer to clear; and we notify
@@ -585,7 +585,7 @@ void gs_close(struct tty_struct * tty, struct file * filp)
585 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) 585 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE)
586 gs_wait_tx_flushed (port, port->closing_wait); 586 gs_wait_tx_flushed (port, port->closing_wait);
587 587
588 port->flags &= ~GS_ACTIVE; 588 port->port.flags &= ~GS_ACTIVE;
589 589
590 gs_flush_buffer(tty); 590 gs_flush_buffer(tty);
591 591
@@ -595,18 +595,18 @@ void gs_close(struct tty_struct * tty, struct file * filp)
595 port->event = 0; 595 port->event = 0;
596 port->rd->close (port); 596 port->rd->close (port);
597 port->rd->shutdown_port (port); 597 port->rd->shutdown_port (port);
598 port->tty = NULL; 598 port->port.tty = NULL;
599 599
600 if (port->blocked_open) { 600 if (port->port.blocked_open) {
601 if (port->close_delay) { 601 if (port->close_delay) {
602 spin_unlock_irqrestore(&port->driver_lock, flags); 602 spin_unlock_irqrestore(&port->driver_lock, flags);
603 msleep_interruptible(jiffies_to_msecs(port->close_delay)); 603 msleep_interruptible(jiffies_to_msecs(port->close_delay));
604 spin_lock_irqsave(&port->driver_lock, flags); 604 spin_lock_irqsave(&port->driver_lock, flags);
605 } 605 }
606 wake_up_interruptible(&port->open_wait); 606 wake_up_interruptible(&port->port.open_wait);
607 } 607 }
608 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED); 608 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING | ASYNC_INITIALIZED);
609 wake_up_interruptible(&port->close_wait); 609 wake_up_interruptible(&port->port.close_wait);
610 610
611 func_exit (); 611 func_exit ();
612} 612}
@@ -626,10 +626,10 @@ void gs_set_termios (struct tty_struct * tty,
626 port = tty->driver_data; 626 port = tty->driver_data;
627 627
628 if (!port) return; 628 if (!port) return;
629 if (!port->tty) { 629 if (!port->port.tty) {
630 /* This seems to happen when this is called after gs_close. */ 630 /* This seems to happen when this is called after gs_close. */
631 gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->tty is NULL\n"); 631 gs_dprintk (GS_DEBUG_TERMIOS, "gs: Odd: port->port.tty is NULL\n");
632 port->tty = tty; 632 port->port.tty = tty;
633 } 633 }
634 634
635 635
@@ -651,15 +651,15 @@ void gs_set_termios (struct tty_struct * tty,
651 baudrate = tty_get_baud_rate(tty); 651 baudrate = tty_get_baud_rate(tty);
652 652
653 if ((tiosp->c_cflag & CBAUD) == B38400) { 653 if ((tiosp->c_cflag & CBAUD) == B38400) {
654 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 654 if ( (port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
655 baudrate = 57600; 655 baudrate = 57600;
656 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 656 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
657 baudrate = 115200; 657 baudrate = 115200;
658 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 658 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
659 baudrate = 230400; 659 baudrate = 230400;
660 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 660 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
661 baudrate = 460800; 661 baudrate = 460800;
662 else if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 662 else if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
663 baudrate = (port->baud_base / port->custom_divisor); 663 baudrate = (port->baud_base / port->custom_divisor);
664 } 664 }
665 665
@@ -715,7 +715,7 @@ int gs_init_port(struct gs_port *port)
715 715
716 func_enter (); 716 func_enter ();
717 717
718 if (port->flags & ASYNC_INITIALIZED) { 718 if (port->port.flags & ASYNC_INITIALIZED) {
719 func_exit (); 719 func_exit ();
720 return 0; 720 return 0;
721 } 721 }
@@ -737,15 +737,15 @@ int gs_init_port(struct gs_port *port)
737 } 737 }
738 738
739 spin_lock_irqsave (&port->driver_lock, flags); 739 spin_lock_irqsave (&port->driver_lock, flags);
740 if (port->tty) 740 if (port->port.tty)
741 clear_bit(TTY_IO_ERROR, &port->tty->flags); 741 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
742 mutex_init(&port->port_write_mutex); 742 mutex_init(&port->port_write_mutex);
743 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 743 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
744 spin_unlock_irqrestore(&port->driver_lock, flags); 744 spin_unlock_irqrestore(&port->driver_lock, flags);
745 gs_set_termios(port->tty, NULL); 745 gs_set_termios(port->port.tty, NULL);
746 spin_lock_irqsave (&port->driver_lock, flags); 746 spin_lock_irqsave (&port->driver_lock, flags);
747 port->flags |= ASYNC_INITIALIZED; 747 port->port.flags |= ASYNC_INITIALIZED;
748 port->flags &= ~GS_TX_INTEN; 748 port->port.flags &= ~GS_TX_INTEN;
749 749
750 spin_unlock_irqrestore(&port->driver_lock, flags); 750 spin_unlock_irqrestore(&port->driver_lock, flags);
751 func_exit (); 751 func_exit ();
@@ -764,11 +764,11 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
764 if ((sio.baud_base != port->baud_base) || 764 if ((sio.baud_base != port->baud_base) ||
765 (sio.close_delay != port->close_delay) || 765 (sio.close_delay != port->close_delay) ||
766 ((sio.flags & ~ASYNC_USR_MASK) != 766 ((sio.flags & ~ASYNC_USR_MASK) !=
767 (port->flags & ~ASYNC_USR_MASK))) 767 (port->port.flags & ~ASYNC_USR_MASK)))
768 return(-EPERM); 768 return(-EPERM);
769 } 769 }
770 770
771 port->flags = (port->flags & ~ASYNC_USR_MASK) | 771 port->port.flags = (port->port.flags & ~ASYNC_USR_MASK) |
772 (sio.flags & ASYNC_USR_MASK); 772 (sio.flags & ASYNC_USR_MASK);
773 773
774 port->baud_base = sio.baud_base; 774 port->baud_base = sio.baud_base;
@@ -776,7 +776,7 @@ int gs_setserial(struct gs_port *port, struct serial_struct __user *sp)
776 port->closing_wait = sio.closing_wait; 776 port->closing_wait = sio.closing_wait;
777 port->custom_divisor = sio.custom_divisor; 777 port->custom_divisor = sio.custom_divisor;
778 778
779 gs_set_termios (port->tty, NULL); 779 gs_set_termios (port->port.tty, NULL);
780 780
781 return 0; 781 return 0;
782} 782}
@@ -793,7 +793,7 @@ int gs_getserial(struct gs_port *port, struct serial_struct __user *sp)
793 struct serial_struct sio; 793 struct serial_struct sio;
794 794
795 memset(&sio, 0, sizeof(struct serial_struct)); 795 memset(&sio, 0, sizeof(struct serial_struct));
796 sio.flags = port->flags; 796 sio.flags = port->port.flags;
797 sio.baud_base = port->baud_base; 797 sio.baud_base = port->baud_base;
798 sio.close_delay = port->close_delay; 798 sio.close_delay = port->close_delay;
799 sio.closing_wait = port->closing_wait; 799 sio.closing_wait = port->closing_wait;
@@ -821,10 +821,10 @@ void gs_got_break(struct gs_port *port)
821{ 821{
822 func_enter (); 822 func_enter ();
823 823
824 tty_insert_flip_char(port->tty, 0, TTY_BREAK); 824 tty_insert_flip_char(port->port.tty, 0, TTY_BREAK);
825 tty_schedule_flip(port->tty); 825 tty_schedule_flip(port->port.tty);
826 if (port->flags & ASYNC_SAK) { 826 if (port->port.flags & ASYNC_SAK) {
827 do_SAK (port->tty); 827 do_SAK (port->port.tty);
828 } 828 }
829 829
830 func_exit (); 830 func_exit ();
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
index 938879cc7bcc..0061e18aff60 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/char/ip2/i2lib.c
@@ -868,11 +868,11 @@ i2Input(i2ChanStrPtr pCh)
868 amountToMove = count; 868 amountToMove = count;
869 } 869 }
870 // Move the first block 870 // Move the first block
871 pCh->pTTY->ldisc.receive_buf( pCh->pTTY, 871 pCh->pTTY->ldisc.ops->receive_buf( pCh->pTTY,
872 &(pCh->Ibuf[stripIndex]), NULL, amountToMove ); 872 &(pCh->Ibuf[stripIndex]), NULL, amountToMove );
873 // If we needed to wrap, do the second data move 873 // If we needed to wrap, do the second data move
874 if (count > amountToMove) { 874 if (count > amountToMove) {
875 pCh->pTTY->ldisc.receive_buf( pCh->pTTY, 875 pCh->pTTY->ldisc.ops->receive_buf( pCh->pTTY,
876 pCh->Ibuf, NULL, count - amountToMove ); 876 pCh->Ibuf, NULL, count - amountToMove );
877 } 877 }
878 // Bump and wrap the stripIndex all at once by the amount of data read. This 878 // Bump and wrap the stripIndex all at once by the amount of data read. This
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 9a2394cda943..5dc74404058f 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -1289,11 +1289,12 @@ static void do_input(struct work_struct *work)
1289// code duplicated from n_tty (ldisc) 1289// code duplicated from n_tty (ldisc)
1290static inline void isig(int sig, struct tty_struct *tty, int flush) 1290static inline void isig(int sig, struct tty_struct *tty, int flush)
1291{ 1291{
1292 /* FIXME: This is completely bogus */
1292 if (tty->pgrp) 1293 if (tty->pgrp)
1293 kill_pgrp(tty->pgrp, sig, 1); 1294 kill_pgrp(tty->pgrp, sig, 1);
1294 if (flush || !L_NOFLSH(tty)) { 1295 if (flush || !L_NOFLSH(tty)) {
1295 if ( tty->ldisc.flush_buffer ) 1296 if ( tty->ldisc.ops->flush_buffer )
1296 tty->ldisc.flush_buffer(tty); 1297 tty->ldisc.ops->flush_buffer(tty);
1297 i2InputFlush( tty->driver_data ); 1298 i2InputFlush( tty->driver_data );
1298 } 1299 }
1299} 1300}
@@ -1342,7 +1343,7 @@ static void do_status(struct work_struct *work)
1342 } 1343 }
1343 tmp = pCh->pTTY->real_raw; 1344 tmp = pCh->pTTY->real_raw;
1344 pCh->pTTY->real_raw = 0; 1345 pCh->pTTY->real_raw = 0;
1345 pCh->pTTY->ldisc.receive_buf( pCh->pTTY, &brkc, &brkf, 1 ); 1346 pCh->pTTY->ldisc->ops.receive_buf( pCh->pTTY, &brkc, &brkf, 1 );
1346 pCh->pTTY->real_raw = tmp; 1347 pCh->pTTY->real_raw = tmp;
1347 } 1348 }
1348#endif /* NEVER_HAPPENS_AS_SETUP_XXX */ 1349#endif /* NEVER_HAPPENS_AS_SETUP_XXX */
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 4f3cefa8eb0e..d4281df10c22 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -198,17 +198,10 @@ struct isi_board {
198 198
199struct isi_port { 199struct isi_port {
200 unsigned short magic; 200 unsigned short magic;
201 unsigned int flags; 201 struct tty_port port;
202 int count;
203 int blocked_open;
204 int close_delay;
205 u16 channel; 202 u16 channel;
206 u16 status; 203 u16 status;
207 u16 closing_wait;
208 struct isi_board *card; 204 struct isi_board *card;
209 struct tty_struct *tty;
210 wait_queue_head_t close_wait;
211 wait_queue_head_t open_wait;
212 unsigned char *xmit_buf; 205 unsigned char *xmit_buf;
213 int xmit_head; 206 int xmit_head;
214 int xmit_tail; 207 int xmit_tail;
@@ -430,11 +423,11 @@ static void isicom_tx(unsigned long _data)
430 423
431 for (; count > 0; count--, port++) { 424 for (; count > 0; count--, port++) {
432 /* port not active or tx disabled to force flow control */ 425 /* port not active or tx disabled to force flow control */
433 if (!(port->flags & ASYNC_INITIALIZED) || 426 if (!(port->port.flags & ASYNC_INITIALIZED) ||
434 !(port->status & ISI_TXOK)) 427 !(port->status & ISI_TXOK))
435 continue; 428 continue;
436 429
437 tty = port->tty; 430 tty = port->port.tty;
438 431
439 if (tty == NULL) 432 if (tty == NULL)
440 continue; 433 continue;
@@ -458,7 +451,7 @@ static void isicom_tx(unsigned long _data)
458 if (residue == YES) { 451 if (residue == YES) {
459 residue = NO; 452 residue = NO;
460 if (cnt > 0) { 453 if (cnt > 0) {
461 wrd |= (port->xmit_buf[port->xmit_tail] 454 wrd |= (port->port.xmit_buf[port->xmit_tail]
462 << 8); 455 << 8);
463 port->xmit_tail = (port->xmit_tail + 1) 456 port->xmit_tail = (port->xmit_tail + 1)
464 & (SERIAL_XMIT_SIZE - 1); 457 & (SERIAL_XMIT_SIZE - 1);
@@ -474,14 +467,14 @@ static void isicom_tx(unsigned long _data)
474 if (cnt <= 0) 467 if (cnt <= 0)
475 break; 468 break;
476 word_count = cnt >> 1; 469 word_count = cnt >> 1;
477 outsw(base, port->xmit_buf+port->xmit_tail, word_count); 470 outsw(base, port->port.xmit_buf+port->xmit_tail, word_count);
478 port->xmit_tail = (port->xmit_tail 471 port->xmit_tail = (port->xmit_tail
479 + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); 472 + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1);
480 txcount -= (word_count << 1); 473 txcount -= (word_count << 1);
481 port->xmit_cnt -= (word_count << 1); 474 port->xmit_cnt -= (word_count << 1);
482 if (cnt & 0x0001) { 475 if (cnt & 0x0001) {
483 residue = YES; 476 residue = YES;
484 wrd = port->xmit_buf[port->xmit_tail]; 477 wrd = port->port.xmit_buf[port->xmit_tail];
485 port->xmit_tail = (port->xmit_tail + 1) 478 port->xmit_tail = (port->xmit_tail + 1)
486 & (SERIAL_XMIT_SIZE - 1); 479 & (SERIAL_XMIT_SIZE - 1);
487 port->xmit_cnt--; 480 port->xmit_cnt--;
@@ -548,13 +541,13 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
548 return IRQ_HANDLED; 541 return IRQ_HANDLED;
549 } 542 }
550 port = card->ports + channel; 543 port = card->ports + channel;
551 if (!(port->flags & ASYNC_INITIALIZED)) { 544 if (!(port->port.flags & ASYNC_INITIALIZED)) {
552 outw(0x0000, base+0x04); /* enable interrupts */ 545 outw(0x0000, base+0x04); /* enable interrupts */
553 spin_unlock(&card->card_lock); 546 spin_unlock(&card->card_lock);
554 return IRQ_HANDLED; 547 return IRQ_HANDLED;
555 } 548 }
556 549
557 tty = port->tty; 550 tty = port->port.tty;
558 if (tty == NULL) { 551 if (tty == NULL) {
559 word_count = byte_count >> 1; 552 word_count = byte_count >> 1;
560 while (byte_count > 1) { 553 while (byte_count > 1) {
@@ -572,7 +565,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
572 header = inw(base); 565 header = inw(base);
573 switch (header & 0xff) { 566 switch (header & 0xff) {
574 case 0: /* Change in EIA signals */ 567 case 0: /* Change in EIA signals */
575 if (port->flags & ASYNC_CHECK_CD) { 568 if (port->port.flags & ASYNC_CHECK_CD) {
576 if (port->status & ISI_DCD) { 569 if (port->status & ISI_DCD) {
577 if (!(header & ISI_DCD)) { 570 if (!(header & ISI_DCD)) {
578 /* Carrier has been lost */ 571 /* Carrier has been lost */
@@ -585,7 +578,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
585 /* Carrier has been detected */ 578 /* Carrier has been detected */
586 pr_dbg("interrupt: DCD->high.\n"); 579 pr_dbg("interrupt: DCD->high.\n");
587 port->status |= ISI_DCD; 580 port->status |= ISI_DCD;
588 wake_up_interruptible(&port->open_wait); 581 wake_up_interruptible(&port->port.open_wait);
589 } 582 }
590 } else { 583 } else {
591 if (header & ISI_DCD) 584 if (header & ISI_DCD)
@@ -594,17 +587,17 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
594 port->status &= ~ISI_DCD; 587 port->status &= ~ISI_DCD;
595 } 588 }
596 589
597 if (port->flags & ASYNC_CTS_FLOW) { 590 if (port->port.flags & ASYNC_CTS_FLOW) {
598 if (port->tty->hw_stopped) { 591 if (port->port.tty->hw_stopped) {
599 if (header & ISI_CTS) { 592 if (header & ISI_CTS) {
600 port->tty->hw_stopped = 0; 593 port->port.tty->hw_stopped = 0;
601 /* start tx ing */ 594 /* start tx ing */
602 port->status |= (ISI_TXOK 595 port->status |= (ISI_TXOK
603 | ISI_CTS); 596 | ISI_CTS);
604 tty_wakeup(tty); 597 tty_wakeup(tty);
605 } 598 }
606 } else if (!(header & ISI_CTS)) { 599 } else if (!(header & ISI_CTS)) {
607 port->tty->hw_stopped = 1; 600 port->port.tty->hw_stopped = 1;
608 /* stop tx ing */ 601 /* stop tx ing */
609 port->status &= ~(ISI_TXOK | ISI_CTS); 602 port->status &= ~(ISI_TXOK | ISI_CTS);
610 } 603 }
@@ -629,7 +622,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
629 622
630 case 1: /* Received Break !!! */ 623 case 1: /* Received Break !!! */
631 tty_insert_flip_char(tty, 0, TTY_BREAK); 624 tty_insert_flip_char(tty, 0, TTY_BREAK);
632 if (port->flags & ASYNC_SAK) 625 if (port->port.flags & ASYNC_SAK)
633 do_SAK(tty); 626 do_SAK(tty);
634 tty_flip_buffer_push(tty); 627 tty_flip_buffer_push(tty);
635 break; 628 break;
@@ -681,7 +674,7 @@ static void isicom_config_port(struct isi_port *port)
681 shift_count = card->shift_count; 674 shift_count = card->shift_count;
682 unsigned char flow_ctrl; 675 unsigned char flow_ctrl;
683 676
684 tty = port->tty; 677 tty = port->port.tty;
685 678
686 if (tty == NULL) 679 if (tty == NULL)
687 return; 680 return;
@@ -697,7 +690,7 @@ static void isicom_config_port(struct isi_port *port)
697 690
698 /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ 691 /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */
699 if (baud < 1 || baud > 4) 692 if (baud < 1 || baud > 4)
700 port->tty->termios->c_cflag &= ~CBAUDEX; 693 port->port.tty->termios->c_cflag &= ~CBAUDEX;
701 else 694 else
702 baud += 15; 695 baud += 15;
703 } 696 }
@@ -708,13 +701,13 @@ static void isicom_config_port(struct isi_port *port)
708 * the 'setserial' utility. 701 * the 'setserial' utility.
709 */ 702 */
710 703
711 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 704 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
712 baud++; /* 57.6 Kbps */ 705 baud++; /* 57.6 Kbps */
713 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 706 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
714 baud += 2; /* 115 Kbps */ 707 baud += 2; /* 115 Kbps */
715 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 708 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
716 baud += 3; /* 230 kbps*/ 709 baud += 3; /* 230 kbps*/
717 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 710 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
718 baud += 4; /* 460 kbps*/ 711 baud += 4; /* 460 kbps*/
719 } 712 }
720 if (linuxb_to_isib[baud] == -1) { 713 if (linuxb_to_isib[baud] == -1) {
@@ -754,15 +747,15 @@ static void isicom_config_port(struct isi_port *port)
754 InterruptTheCard(base); 747 InterruptTheCard(base);
755 } 748 }
756 if (C_CLOCAL(tty)) 749 if (C_CLOCAL(tty))
757 port->flags &= ~ASYNC_CHECK_CD; 750 port->port.flags &= ~ASYNC_CHECK_CD;
758 else 751 else
759 port->flags |= ASYNC_CHECK_CD; 752 port->port.flags |= ASYNC_CHECK_CD;
760 753
761 /* flow control settings ...*/ 754 /* flow control settings ...*/
762 flow_ctrl = 0; 755 flow_ctrl = 0;
763 port->flags &= ~ASYNC_CTS_FLOW; 756 port->port.flags &= ~ASYNC_CTS_FLOW;
764 if (C_CRTSCTS(tty)) { 757 if (C_CRTSCTS(tty)) {
765 port->flags |= ASYNC_CTS_FLOW; 758 port->port.flags |= ASYNC_CTS_FLOW;
766 flow_ctrl |= ISICOM_CTSRTS; 759 flow_ctrl |= ISICOM_CTSRTS;
767 } 760 }
768 if (I_IXON(tty)) 761 if (I_IXON(tty))
@@ -809,23 +802,15 @@ static int isicom_setup_port(struct isi_port *port)
809 struct isi_board *card = port->card; 802 struct isi_board *card = port->card;
810 unsigned long flags; 803 unsigned long flags;
811 804
812 if (port->flags & ASYNC_INITIALIZED) 805 if (port->port.flags & ASYNC_INITIALIZED)
813 return 0; 806 return 0;
814 if (!port->xmit_buf) { 807 if (tty_port_alloc_xmit_buf(&port->port) < 0)
815 /* Relies on BKL */ 808 return -ENOMEM;
816 unsigned long page = get_zeroed_page(GFP_KERNEL);
817 if (page == 0)
818 return -ENOMEM;
819 if (port->xmit_buf)
820 free_page(page);
821 else
822 port->xmit_buf = (unsigned char *) page;
823 }
824 809
825 spin_lock_irqsave(&card->card_lock, flags); 810 spin_lock_irqsave(&card->card_lock, flags);
826 if (port->tty) 811 if (port->port.tty)
827 clear_bit(TTY_IO_ERROR, &port->tty->flags); 812 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
828 if (port->count == 1) 813 if (port->port.count == 1)
829 card->count++; 814 card->count++;
830 815
831 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 816 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
@@ -839,7 +824,7 @@ static int isicom_setup_port(struct isi_port *port)
839 } 824 }
840 825
841 isicom_config_port(port); 826 isicom_config_port(port);
842 port->flags |= ASYNC_INITIALIZED; 827 port->port.flags |= ASYNC_INITIALIZED;
843 spin_unlock_irqrestore(&card->card_lock, flags); 828 spin_unlock_irqrestore(&card->card_lock, flags);
844 829
845 return 0; 830 return 0;
@@ -855,10 +840,10 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
855 840
856 /* block if port is in the process of being closed */ 841 /* block if port is in the process of being closed */
857 842
858 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { 843 if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
859 pr_dbg("block_til_ready: close in progress.\n"); 844 pr_dbg("block_til_ready: close in progress.\n");
860 interruptible_sleep_on(&port->close_wait); 845 interruptible_sleep_on(&port->port.close_wait);
861 if (port->flags & ASYNC_HUP_NOTIFY) 846 if (port->port.flags & ASYNC_HUP_NOTIFY)
862 return -EAGAIN; 847 return -EAGAIN;
863 else 848 else
864 return -ERESTARTSYS; 849 return -ERESTARTSYS;
@@ -869,7 +854,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
869 if ((filp->f_flags & O_NONBLOCK) || 854 if ((filp->f_flags & O_NONBLOCK) ||
870 (tty->flags & (1 << TTY_IO_ERROR))) { 855 (tty->flags & (1 << TTY_IO_ERROR))) {
871 pr_dbg("block_til_ready: non-block mode.\n"); 856 pr_dbg("block_til_ready: non-block mode.\n");
872 port->flags |= ASYNC_NORMAL_ACTIVE; 857 port->port.flags |= ASYNC_NORMAL_ACTIVE;
873 return 0; 858 return 0;
874 } 859 }
875 860
@@ -879,26 +864,26 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
879 /* block waiting for DCD to be asserted, and while 864 /* block waiting for DCD to be asserted, and while
880 callout dev is busy */ 865 callout dev is busy */
881 retval = 0; 866 retval = 0;
882 add_wait_queue(&port->open_wait, &wait); 867 add_wait_queue(&port->port.open_wait, &wait);
883 868
884 spin_lock_irqsave(&card->card_lock, flags); 869 spin_lock_irqsave(&card->card_lock, flags);
885 if (!tty_hung_up_p(filp)) 870 if (!tty_hung_up_p(filp))
886 port->count--; 871 port->port.count--;
887 port->blocked_open++; 872 port->port.blocked_open++;
888 spin_unlock_irqrestore(&card->card_lock, flags); 873 spin_unlock_irqrestore(&card->card_lock, flags);
889 874
890 while (1) { 875 while (1) {
891 raise_dtr_rts(port); 876 raise_dtr_rts(port);
892 877
893 set_current_state(TASK_INTERRUPTIBLE); 878 set_current_state(TASK_INTERRUPTIBLE);
894 if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { 879 if (tty_hung_up_p(filp) || !(port->port.flags & ASYNC_INITIALIZED)) {
895 if (port->flags & ASYNC_HUP_NOTIFY) 880 if (port->port.flags & ASYNC_HUP_NOTIFY)
896 retval = -EAGAIN; 881 retval = -EAGAIN;
897 else 882 else
898 retval = -ERESTARTSYS; 883 retval = -ERESTARTSYS;
899 break; 884 break;
900 } 885 }
901 if (!(port->flags & ASYNC_CLOSING) && 886 if (!(port->port.flags & ASYNC_CLOSING) &&
902 (do_clocal || (port->status & ISI_DCD))) { 887 (do_clocal || (port->status & ISI_DCD))) {
903 break; 888 break;
904 } 889 }
@@ -909,15 +894,15 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
909 schedule(); 894 schedule();
910 } 895 }
911 set_current_state(TASK_RUNNING); 896 set_current_state(TASK_RUNNING);
912 remove_wait_queue(&port->open_wait, &wait); 897 remove_wait_queue(&port->port.open_wait, &wait);
913 spin_lock_irqsave(&card->card_lock, flags); 898 spin_lock_irqsave(&card->card_lock, flags);
914 if (!tty_hung_up_p(filp)) 899 if (!tty_hung_up_p(filp))
915 port->count++; 900 port->port.count++;
916 port->blocked_open--; 901 port->port.blocked_open--;
917 spin_unlock_irqrestore(&card->card_lock, flags); 902 spin_unlock_irqrestore(&card->card_lock, flags);
918 if (retval) 903 if (retval)
919 return retval; 904 return retval;
920 port->flags |= ASYNC_NORMAL_ACTIVE; 905 port->port.flags |= ASYNC_NORMAL_ACTIVE;
921 return 0; 906 return 0;
922} 907}
923 908
@@ -947,9 +932,9 @@ static int isicom_open(struct tty_struct *tty, struct file *filp)
947 932
948 isicom_setup_board(card); 933 isicom_setup_board(card);
949 934
950 port->count++; 935 port->port.count++;
951 tty->driver_data = port; 936 tty->driver_data = port;
952 port->tty = tty; 937 port->port.tty = tty;
953 error = isicom_setup_port(port); 938 error = isicom_setup_port(port);
954 if (error == 0) 939 if (error == 0)
955 error = block_til_ready(tty, filp, port); 940 error = block_til_ready(tty, filp, port);
@@ -970,18 +955,15 @@ static void isicom_shutdown_port(struct isi_port *port)
970 struct isi_board *card = port->card; 955 struct isi_board *card = port->card;
971 struct tty_struct *tty; 956 struct tty_struct *tty;
972 957
973 tty = port->tty; 958 tty = port->port.tty;
974 959
975 if (!(port->flags & ASYNC_INITIALIZED)) 960 if (!(port->port.flags & ASYNC_INITIALIZED))
976 return; 961 return;
977 962
978 if (port->xmit_buf) { 963 tty_port_free_xmit_buf(&port->port);
979 free_page((unsigned long) port->xmit_buf); 964 port->port.flags &= ~ASYNC_INITIALIZED;
980 port->xmit_buf = NULL;
981 }
982 port->flags &= ~ASYNC_INITIALIZED;
983 /* 3rd October 2000 : Vinayak P Risbud */ 965 /* 3rd October 2000 : Vinayak P Risbud */
984 port->tty = NULL; 966 port->port.tty = NULL;
985 967
986 /*Fix done by Anil .S on 30-04-2001 968 /*Fix done by Anil .S on 30-04-2001
987 remote login through isi port has dtr toggle problem 969 remote login through isi port has dtr toggle problem
@@ -1046,33 +1028,33 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
1046 return; 1028 return;
1047 } 1029 }
1048 1030
1049 if (tty->count == 1 && port->count != 1) { 1031 if (tty->count == 1 && port->port.count != 1) {
1050 printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " 1032 printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port "
1051 "count tty->count = 1 port count = %d.\n", 1033 "count tty->count = 1 port count = %d.\n",
1052 card->base, port->count); 1034 card->base, port->port.count);
1053 port->count = 1; 1035 port->port.count = 1;
1054 } 1036 }
1055 if (--port->count < 0) { 1037 if (--port->port.count < 0) {
1056 printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " 1038 printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port "
1057 "count for channel%d = %d", card->base, port->channel, 1039 "count for channel%d = %d", card->base, port->channel,
1058 port->count); 1040 port->port.count);
1059 port->count = 0; 1041 port->port.count = 0;
1060 } 1042 }
1061 1043
1062 if (port->count) { 1044 if (port->port.count) {
1063 spin_unlock_irqrestore(&card->card_lock, flags); 1045 spin_unlock_irqrestore(&card->card_lock, flags);
1064 return; 1046 return;
1065 } 1047 }
1066 port->flags |= ASYNC_CLOSING; 1048 port->port.flags |= ASYNC_CLOSING;
1067 tty->closing = 1; 1049 tty->closing = 1;
1068 spin_unlock_irqrestore(&card->card_lock, flags); 1050 spin_unlock_irqrestore(&card->card_lock, flags);
1069 1051
1070 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1052 if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
1071 tty_wait_until_sent(tty, port->closing_wait); 1053 tty_wait_until_sent(tty, port->port.closing_wait);
1072 /* indicate to the card that no more data can be received 1054 /* indicate to the card that no more data can be received
1073 on this port */ 1055 on this port */
1074 spin_lock_irqsave(&card->card_lock, flags); 1056 spin_lock_irqsave(&card->card_lock, flags);
1075 if (port->flags & ASYNC_INITIALIZED) { 1057 if (port->port.flags & ASYNC_INITIALIZED) {
1076 card->port_status &= ~(1 << port->channel); 1058 card->port_status &= ~(1 << port->channel);
1077 outw(card->port_status, card->base + 0x02); 1059 outw(card->port_status, card->base + 0x02);
1078 } 1060 }
@@ -1085,18 +1067,18 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
1085 spin_lock_irqsave(&card->card_lock, flags); 1067 spin_lock_irqsave(&card->card_lock, flags);
1086 tty->closing = 0; 1068 tty->closing = 0;
1087 1069
1088 if (port->blocked_open) { 1070 if (port->port.blocked_open) {
1089 spin_unlock_irqrestore(&card->card_lock, flags); 1071 spin_unlock_irqrestore(&card->card_lock, flags);
1090 if (port->close_delay) { 1072 if (port->port.close_delay) {
1091 pr_dbg("scheduling until time out.\n"); 1073 pr_dbg("scheduling until time out.\n");
1092 msleep_interruptible( 1074 msleep_interruptible(
1093 jiffies_to_msecs(port->close_delay)); 1075 jiffies_to_msecs(port->port.close_delay));
1094 } 1076 }
1095 spin_lock_irqsave(&card->card_lock, flags); 1077 spin_lock_irqsave(&card->card_lock, flags);
1096 wake_up_interruptible(&port->open_wait); 1078 wake_up_interruptible(&port->port.open_wait);
1097 } 1079 }
1098 port->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 1080 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
1099 wake_up_interruptible(&port->close_wait); 1081 wake_up_interruptible(&port->port.close_wait);
1100 spin_unlock_irqrestore(&card->card_lock, flags); 1082 spin_unlock_irqrestore(&card->card_lock, flags);
1101} 1083}
1102 1084
@@ -1112,9 +1094,6 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf,
1112 if (isicom_paranoia_check(port, tty->name, "isicom_write")) 1094 if (isicom_paranoia_check(port, tty->name, "isicom_write"))
1113 return 0; 1095 return 0;
1114 1096
1115 if (!port->xmit_buf)
1116 return 0;
1117
1118 spin_lock_irqsave(&card->card_lock, flags); 1097 spin_lock_irqsave(&card->card_lock, flags);
1119 1098
1120 while (1) { 1099 while (1) {
@@ -1123,7 +1102,7 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf,
1123 if (cnt <= 0) 1102 if (cnt <= 0)
1124 break; 1103 break;
1125 1104
1126 memcpy(port->xmit_buf + port->xmit_head, buf, cnt); 1105 memcpy(port->port.xmit_buf + port->xmit_head, buf, cnt);
1127 port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE 1106 port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE
1128 - 1); 1107 - 1);
1129 port->xmit_cnt += cnt; 1108 port->xmit_cnt += cnt;
@@ -1147,16 +1126,13 @@ static int isicom_put_char(struct tty_struct *tty, unsigned char ch)
1147 if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) 1126 if (isicom_paranoia_check(port, tty->name, "isicom_put_char"))
1148 return 0; 1127 return 0;
1149 1128
1150 if (!port->xmit_buf)
1151 return 0;
1152
1153 spin_lock_irqsave(&card->card_lock, flags); 1129 spin_lock_irqsave(&card->card_lock, flags);
1154 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) { 1130 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) {
1155 spin_unlock_irqrestore(&card->card_lock, flags); 1131 spin_unlock_irqrestore(&card->card_lock, flags);
1156 return 0; 1132 return 0;
1157 } 1133 }
1158 1134
1159 port->xmit_buf[port->xmit_head++] = ch; 1135 port->port.xmit_buf[port->xmit_head++] = ch;
1160 port->xmit_head &= (SERIAL_XMIT_SIZE - 1); 1136 port->xmit_head &= (SERIAL_XMIT_SIZE - 1);
1161 port->xmit_cnt++; 1137 port->xmit_cnt++;
1162 spin_unlock_irqrestore(&card->card_lock, flags); 1138 spin_unlock_irqrestore(&card->card_lock, flags);
@@ -1172,7 +1148,7 @@ static void isicom_flush_chars(struct tty_struct *tty)
1172 return; 1148 return;
1173 1149
1174 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 1150 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
1175 !port->xmit_buf) 1151 !port->port.xmit_buf)
1176 return; 1152 return;
1177 1153
1178 /* this tells the transmitter to consider this port for 1154 /* this tells the transmitter to consider this port for
@@ -1274,23 +1250,23 @@ static int isicom_set_serial_info(struct isi_port *port,
1274 1250
1275 lock_kernel(); 1251 lock_kernel();
1276 1252
1277 reconfig_port = ((port->flags & ASYNC_SPD_MASK) != 1253 reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
1278 (newinfo.flags & ASYNC_SPD_MASK)); 1254 (newinfo.flags & ASYNC_SPD_MASK));
1279 1255
1280 if (!capable(CAP_SYS_ADMIN)) { 1256 if (!capable(CAP_SYS_ADMIN)) {
1281 if ((newinfo.close_delay != port->close_delay) || 1257 if ((newinfo.close_delay != port->port.close_delay) ||
1282 (newinfo.closing_wait != port->closing_wait) || 1258 (newinfo.closing_wait != port->port.closing_wait) ||
1283 ((newinfo.flags & ~ASYNC_USR_MASK) != 1259 ((newinfo.flags & ~ASYNC_USR_MASK) !=
1284 (port->flags & ~ASYNC_USR_MASK))) { 1260 (port->port.flags & ~ASYNC_USR_MASK))) {
1285 unlock_kernel(); 1261 unlock_kernel();
1286 return -EPERM; 1262 return -EPERM;
1287 } 1263 }
1288 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1264 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
1289 (newinfo.flags & ASYNC_USR_MASK)); 1265 (newinfo.flags & ASYNC_USR_MASK));
1290 } else { 1266 } else {
1291 port->close_delay = newinfo.close_delay; 1267 port->port.close_delay = newinfo.close_delay;
1292 port->closing_wait = newinfo.closing_wait; 1268 port->port.closing_wait = newinfo.closing_wait;
1293 port->flags = ((port->flags & ~ASYNC_FLAGS) | 1269 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1294 (newinfo.flags & ASYNC_FLAGS)); 1270 (newinfo.flags & ASYNC_FLAGS));
1295 } 1271 }
1296 if (reconfig_port) { 1272 if (reconfig_port) {
@@ -1314,10 +1290,10 @@ static int isicom_get_serial_info(struct isi_port *port,
1314 out_info.line = port - isi_ports; 1290 out_info.line = port - isi_ports;
1315 out_info.port = port->card->base; 1291 out_info.port = port->card->base;
1316 out_info.irq = port->card->irq; 1292 out_info.irq = port->card->irq;
1317 out_info.flags = port->flags; 1293 out_info.flags = port->port.flags;
1318/* out_info.baud_base = ? */ 1294/* out_info.baud_base = ? */
1319 out_info.close_delay = port->close_delay; 1295 out_info.close_delay = port->port.close_delay;
1320 out_info.closing_wait = port->closing_wait; 1296 out_info.closing_wait = port->port.closing_wait;
1321 unlock_kernel(); 1297 unlock_kernel();
1322 if (copy_to_user(info, &out_info, sizeof(out_info))) 1298 if (copy_to_user(info, &out_info, sizeof(out_info)))
1323 return -EFAULT; 1299 return -EFAULT;
@@ -1454,10 +1430,10 @@ static void isicom_hangup(struct tty_struct *tty)
1454 isicom_shutdown_port(port); 1430 isicom_shutdown_port(port);
1455 spin_unlock_irqrestore(&port->card->card_lock, flags); 1431 spin_unlock_irqrestore(&port->card->card_lock, flags);
1456 1432
1457 port->count = 0; 1433 port->port.count = 0;
1458 port->flags &= ~ASYNC_NORMAL_ACTIVE; 1434 port->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1459 port->tty = NULL; 1435 port->port.tty = NULL;
1460 wake_up_interruptible(&port->open_wait); 1436 wake_up_interruptible(&port->port.open_wait);
1461} 1437}
1462 1438
1463 1439
@@ -1736,6 +1712,12 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
1736 if (card_count >= BOARD_COUNT) 1712 if (card_count >= BOARD_COUNT)
1737 goto err; 1713 goto err;
1738 1714
1715 retval = pci_enable_device(pdev);
1716 if (retval) {
1717 dev_err(&pdev->dev, "failed to enable\n");
1718 goto err;
1719 }
1720
1739 dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device); 1721 dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device);
1740 1722
1741 /* allot the first empty slot in the array */ 1723 /* allot the first empty slot in the array */
@@ -1790,6 +1772,7 @@ errunrr:
1790errdec: 1772errdec:
1791 board->base = 0; 1773 board->base = 0;
1792 card_count--; 1774 card_count--;
1775 pci_disable_device(pdev);
1793err: 1776err:
1794 return retval; 1777 return retval;
1795} 1778}
@@ -1806,6 +1789,7 @@ static void __devexit isicom_remove(struct pci_dev *pdev)
1806 pci_release_region(pdev, 3); 1789 pci_release_region(pdev, 3);
1807 board->base = 0; 1790 board->base = 0;
1808 card_count--; 1791 card_count--;
1792 pci_disable_device(pdev);
1809} 1793}
1810 1794
1811static int __init isicom_init(void) 1795static int __init isicom_init(void)
@@ -1818,14 +1802,13 @@ static int __init isicom_init(void)
1818 isi_card[idx].ports = port; 1802 isi_card[idx].ports = port;
1819 spin_lock_init(&isi_card[idx].card_lock); 1803 spin_lock_init(&isi_card[idx].card_lock);
1820 for (channel = 0; channel < 16; channel++, port++) { 1804 for (channel = 0; channel < 16; channel++, port++) {
1805 tty_port_init(&port->port);
1821 port->magic = ISICOM_MAGIC; 1806 port->magic = ISICOM_MAGIC;
1822 port->card = &isi_card[idx]; 1807 port->card = &isi_card[idx];
1823 port->channel = channel; 1808 port->channel = channel;
1824 port->close_delay = 50 * HZ/100; 1809 port->port.close_delay = 50 * HZ/100;
1825 port->closing_wait = 3000 * HZ/100; 1810 port->port.closing_wait = 3000 * HZ/100;
1826 port->status = 0; 1811 port->status = 0;
1827 init_waitqueue_head(&port->open_wait);
1828 init_waitqueue_head(&port->close_wait);
1829 /* . . . */ 1812 /* . . . */
1830 } 1813 }
1831 isi_card[idx].base = 0; 1814 isi_card[idx].base = 0;
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 7c8b62f162bf..6ef1c565705c 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -735,8 +735,8 @@ static void stli_cleanup_ports(struct stlibrd *brdp)
735 for (j = 0; j < STL_MAXPORTS; j++) { 735 for (j = 0; j < STL_MAXPORTS; j++) {
736 portp = brdp->ports[j]; 736 portp = brdp->ports[j];
737 if (portp != NULL) { 737 if (portp != NULL) {
738 if (portp->tty != NULL) 738 if (portp->port.tty != NULL)
739 tty_hangup(portp->tty); 739 tty_hangup(portp->port.tty);
740 kfree(portp); 740 kfree(portp);
741 } 741 }
742 } 742 }
@@ -811,9 +811,9 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
811 * The sleep here does not need interrupt protection since the wakeup 811 * The sleep here does not need interrupt protection since the wakeup
812 * for it is done with the same context. 812 * for it is done with the same context.
813 */ 813 */
814 if (portp->flags & ASYNC_CLOSING) { 814 if (portp->port.flags & ASYNC_CLOSING) {
815 interruptible_sleep_on(&portp->close_wait); 815 interruptible_sleep_on(&portp->port.close_wait);
816 if (portp->flags & ASYNC_HUP_NOTIFY) 816 if (portp->port.flags & ASYNC_HUP_NOTIFY)
817 return -EAGAIN; 817 return -EAGAIN;
818 return -ERESTARTSYS; 818 return -ERESTARTSYS;
819 } 819 }
@@ -824,7 +824,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
824 * requires several commands to the board we will need to wait for any 824 * requires several commands to the board we will need to wait for any
825 * other open that is already initializing the port. 825 * other open that is already initializing the port.
826 */ 826 */
827 portp->tty = tty; 827 portp->port.tty = tty;
828 tty->driver_data = portp; 828 tty->driver_data = portp;
829 portp->refcount++; 829 portp->refcount++;
830 830
@@ -833,10 +833,10 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
833 if (signal_pending(current)) 833 if (signal_pending(current))
834 return -ERESTARTSYS; 834 return -ERESTARTSYS;
835 835
836 if ((portp->flags & ASYNC_INITIALIZED) == 0) { 836 if ((portp->port.flags & ASYNC_INITIALIZED) == 0) {
837 set_bit(ST_INITIALIZING, &portp->state); 837 set_bit(ST_INITIALIZING, &portp->state);
838 if ((rc = stli_initopen(brdp, portp)) >= 0) { 838 if ((rc = stli_initopen(brdp, portp)) >= 0) {
839 portp->flags |= ASYNC_INITIALIZED; 839 portp->port.flags |= ASYNC_INITIALIZED;
840 clear_bit(TTY_IO_ERROR, &tty->flags); 840 clear_bit(TTY_IO_ERROR, &tty->flags);
841 } 841 }
842 clear_bit(ST_INITIALIZING, &portp->state); 842 clear_bit(ST_INITIALIZING, &portp->state);
@@ -851,9 +851,9 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
851 * The sleep here does not need interrupt protection since the wakeup 851 * The sleep here does not need interrupt protection since the wakeup
852 * for it is done with the same context. 852 * for it is done with the same context.
853 */ 853 */
854 if (portp->flags & ASYNC_CLOSING) { 854 if (portp->port.flags & ASYNC_CLOSING) {
855 interruptible_sleep_on(&portp->close_wait); 855 interruptible_sleep_on(&portp->port.close_wait);
856 if (portp->flags & ASYNC_HUP_NOTIFY) 856 if (portp->port.flags & ASYNC_HUP_NOTIFY)
857 return -EAGAIN; 857 return -EAGAIN;
858 return -ERESTARTSYS; 858 return -ERESTARTSYS;
859 } 859 }
@@ -867,7 +867,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
867 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) 867 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0)
868 return rc; 868 return rc;
869 } 869 }
870 portp->flags |= ASYNC_NORMAL_ACTIVE; 870 portp->port.flags |= ASYNC_NORMAL_ACTIVE;
871 return 0; 871 return 0;
872} 872}
873 873
@@ -895,7 +895,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
895 return; 895 return;
896 } 896 }
897 897
898 portp->flags |= ASYNC_CLOSING; 898 portp->port.flags |= ASYNC_CLOSING;
899 899
900/* 900/*
901 * May want to wait for data to drain before closing. The BUSY flag 901 * May want to wait for data to drain before closing. The BUSY flag
@@ -911,7 +911,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
911 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) 911 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)
912 tty_wait_until_sent(tty, portp->closing_wait); 912 tty_wait_until_sent(tty, portp->closing_wait);
913 913
914 portp->flags &= ~ASYNC_INITIALIZED; 914 portp->port.flags &= ~ASYNC_INITIALIZED;
915 brdp = stli_brds[portp->brdnr]; 915 brdp = stli_brds[portp->brdnr];
916 stli_rawclose(brdp, portp, 0, 0); 916 stli_rawclose(brdp, portp, 0, 0);
917 if (tty->termios->c_cflag & HUPCL) { 917 if (tty->termios->c_cflag & HUPCL) {
@@ -931,16 +931,16 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
931 stli_flushbuffer(tty); 931 stli_flushbuffer(tty);
932 932
933 tty->closing = 0; 933 tty->closing = 0;
934 portp->tty = NULL; 934 portp->port.tty = NULL;
935 935
936 if (portp->openwaitcnt) { 936 if (portp->openwaitcnt) {
937 if (portp->close_delay) 937 if (portp->close_delay)
938 msleep_interruptible(jiffies_to_msecs(portp->close_delay)); 938 msleep_interruptible(jiffies_to_msecs(portp->close_delay));
939 wake_up_interruptible(&portp->open_wait); 939 wake_up_interruptible(&portp->port.open_wait);
940 } 940 }
941 941
942 portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 942 portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
943 wake_up_interruptible(&portp->close_wait); 943 wake_up_interruptible(&portp->port.close_wait);
944} 944}
945 945
946/*****************************************************************************/ 946/*****************************************************************************/
@@ -970,7 +970,7 @@ static int stli_initopen(struct stlibrd *brdp, struct stliport *portp)
970 sizeof(asynotify_t), 0)) < 0) 970 sizeof(asynotify_t), 0)) < 0)
971 return rc; 971 return rc;
972 972
973 tty = portp->tty; 973 tty = portp->port.tty;
974 if (tty == NULL) 974 if (tty == NULL)
975 return -ENODEV; 975 return -ENODEV;
976 stli_mkasyport(portp, &aport, tty->termios); 976 stli_mkasyport(portp, &aport, tty->termios);
@@ -1169,7 +1169,7 @@ static int stli_setport(struct stliport *portp)
1169 1169
1170 if (portp == NULL) 1170 if (portp == NULL)
1171 return -ENODEV; 1171 return -ENODEV;
1172 if (portp->tty == NULL) 1172 if (portp->port.tty == NULL)
1173 return -ENODEV; 1173 return -ENODEV;
1174 if (portp->brdnr >= stli_nrbrds) 1174 if (portp->brdnr >= stli_nrbrds)
1175 return -ENODEV; 1175 return -ENODEV;
@@ -1177,7 +1177,7 @@ static int stli_setport(struct stliport *portp)
1177 if (brdp == NULL) 1177 if (brdp == NULL)
1178 return -ENODEV; 1178 return -ENODEV;
1179 1179
1180 stli_mkasyport(portp, &aport, portp->tty->termios); 1180 stli_mkasyport(portp, &aport, portp->port.tty->termios);
1181 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); 1181 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0));
1182} 1182}
1183 1183
@@ -1196,7 +1196,7 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct
1196 rc = 0; 1196 rc = 0;
1197 doclocal = 0; 1197 doclocal = 0;
1198 1198
1199 if (portp->tty->termios->c_cflag & CLOCAL) 1199 if (portp->port.tty->termios->c_cflag & CLOCAL)
1200 doclocal++; 1200 doclocal++;
1201 1201
1202 spin_lock_irqsave(&stli_lock, flags); 1202 spin_lock_irqsave(&stli_lock, flags);
@@ -1211,14 +1211,14 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct
1211 &portp->asig, sizeof(asysigs_t), 0)) < 0) 1211 &portp->asig, sizeof(asysigs_t), 0)) < 0)
1212 break; 1212 break;
1213 if (tty_hung_up_p(filp) || 1213 if (tty_hung_up_p(filp) ||
1214 ((portp->flags & ASYNC_INITIALIZED) == 0)) { 1214 ((portp->port.flags & ASYNC_INITIALIZED) == 0)) {
1215 if (portp->flags & ASYNC_HUP_NOTIFY) 1215 if (portp->port.flags & ASYNC_HUP_NOTIFY)
1216 rc = -EBUSY; 1216 rc = -EBUSY;
1217 else 1217 else
1218 rc = -ERESTARTSYS; 1218 rc = -ERESTARTSYS;
1219 break; 1219 break;
1220 } 1220 }
1221 if (((portp->flags & ASYNC_CLOSING) == 0) && 1221 if (((portp->port.flags & ASYNC_CLOSING) == 0) &&
1222 (doclocal || (portp->sigs & TIOCM_CD))) { 1222 (doclocal || (portp->sigs & TIOCM_CD))) {
1223 break; 1223 break;
1224 } 1224 }
@@ -1226,7 +1226,7 @@ static int stli_waitcarrier(struct stlibrd *brdp, struct stliport *portp, struct
1226 rc = -ERESTARTSYS; 1226 rc = -ERESTARTSYS;
1227 break; 1227 break;
1228 } 1228 }
1229 interruptible_sleep_on(&portp->open_wait); 1229 interruptible_sleep_on(&portp->port.open_wait);
1230 } 1230 }
1231 1231
1232 spin_lock_irqsave(&stli_lock, flags); 1232 spin_lock_irqsave(&stli_lock, flags);
@@ -1548,7 +1548,7 @@ static int stli_getserial(struct stliport *portp, struct serial_struct __user *s
1548 sio.type = PORT_UNKNOWN; 1548 sio.type = PORT_UNKNOWN;
1549 sio.line = portp->portnr; 1549 sio.line = portp->portnr;
1550 sio.irq = 0; 1550 sio.irq = 0;
1551 sio.flags = portp->flags; 1551 sio.flags = portp->port.flags;
1552 sio.baud_base = portp->baud_base; 1552 sio.baud_base = portp->baud_base;
1553 sio.close_delay = portp->close_delay; 1553 sio.close_delay = portp->close_delay;
1554 sio.closing_wait = portp->closing_wait; 1554 sio.closing_wait = portp->closing_wait;
@@ -1583,11 +1583,11 @@ static int stli_setserial(struct stliport *portp, struct serial_struct __user *s
1583 if ((sio.baud_base != portp->baud_base) || 1583 if ((sio.baud_base != portp->baud_base) ||
1584 (sio.close_delay != portp->close_delay) || 1584 (sio.close_delay != portp->close_delay) ||
1585 ((sio.flags & ~ASYNC_USR_MASK) != 1585 ((sio.flags & ~ASYNC_USR_MASK) !=
1586 (portp->flags & ~ASYNC_USR_MASK))) 1586 (portp->port.flags & ~ASYNC_USR_MASK)))
1587 return -EPERM; 1587 return -EPERM;
1588 } 1588 }
1589 1589
1590 portp->flags = (portp->flags & ~ASYNC_USR_MASK) | 1590 portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) |
1591 (sio.flags & ASYNC_USR_MASK); 1591 (sio.flags & ASYNC_USR_MASK);
1592 portp->baud_base = sio.baud_base; 1592 portp->baud_base = sio.baud_base;
1593 portp->close_delay = sio.close_delay; 1593 portp->close_delay = sio.close_delay;
@@ -1751,7 +1751,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old)
1751 if ((old->c_cflag & CRTSCTS) && ((tiosp->c_cflag & CRTSCTS) == 0)) 1751 if ((old->c_cflag & CRTSCTS) && ((tiosp->c_cflag & CRTSCTS) == 0))
1752 tty->hw_stopped = 0; 1752 tty->hw_stopped = 0;
1753 if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) 1753 if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL))
1754 wake_up_interruptible(&portp->open_wait); 1754 wake_up_interruptible(&portp->port.open_wait);
1755} 1755}
1756 1756
1757/*****************************************************************************/ 1757/*****************************************************************************/
@@ -1834,7 +1834,7 @@ static void stli_hangup(struct tty_struct *tty)
1834 if (brdp == NULL) 1834 if (brdp == NULL)
1835 return; 1835 return;
1836 1836
1837 portp->flags &= ~ASYNC_INITIALIZED; 1837 portp->port.flags &= ~ASYNC_INITIALIZED;
1838 1838
1839 if (!test_bit(ST_CLOSING, &portp->state)) 1839 if (!test_bit(ST_CLOSING, &portp->state))
1840 stli_rawclose(brdp, portp, 0, 0); 1840 stli_rawclose(brdp, portp, 0, 0);
@@ -1855,12 +1855,12 @@ static void stli_hangup(struct tty_struct *tty)
1855 clear_bit(ST_TXBUSY, &portp->state); 1855 clear_bit(ST_TXBUSY, &portp->state);
1856 clear_bit(ST_RXSTOP, &portp->state); 1856 clear_bit(ST_RXSTOP, &portp->state);
1857 set_bit(TTY_IO_ERROR, &tty->flags); 1857 set_bit(TTY_IO_ERROR, &tty->flags);
1858 portp->tty = NULL; 1858 portp->port.tty = NULL;
1859 portp->flags &= ~ASYNC_NORMAL_ACTIVE; 1859 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1860 portp->refcount = 0; 1860 portp->refcount = 0;
1861 spin_unlock_irqrestore(&stli_lock, flags); 1861 spin_unlock_irqrestore(&stli_lock, flags);
1862 1862
1863 wake_up_interruptible(&portp->open_wait); 1863 wake_up_interruptible(&portp->port.open_wait);
1864} 1864}
1865 1865
1866/*****************************************************************************/ 1866/*****************************************************************************/
@@ -2188,7 +2188,7 @@ static void stli_read(struct stlibrd *brdp, struct stliport *portp)
2188 2188
2189 if (test_bit(ST_RXSTOP, &portp->state)) 2189 if (test_bit(ST_RXSTOP, &portp->state))
2190 return; 2190 return;
2191 tty = portp->tty; 2191 tty = portp->port.tty;
2192 if (tty == NULL) 2192 if (tty == NULL)
2193 return; 2193 return;
2194 2194
@@ -2362,7 +2362,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2362 if (ap->notify) { 2362 if (ap->notify) {
2363 nt = ap->changed; 2363 nt = ap->changed;
2364 ap->notify = 0; 2364 ap->notify = 0;
2365 tty = portp->tty; 2365 tty = portp->port.tty;
2366 2366
2367 if (nt.signal & SG_DCD) { 2367 if (nt.signal & SG_DCD) {
2368 oldsigs = portp->sigs; 2368 oldsigs = portp->sigs;
@@ -2370,10 +2370,10 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2370 clear_bit(ST_GETSIGS, &portp->state); 2370 clear_bit(ST_GETSIGS, &portp->state);
2371 if ((portp->sigs & TIOCM_CD) && 2371 if ((portp->sigs & TIOCM_CD) &&
2372 ((oldsigs & TIOCM_CD) == 0)) 2372 ((oldsigs & TIOCM_CD) == 0))
2373 wake_up_interruptible(&portp->open_wait); 2373 wake_up_interruptible(&portp->port.open_wait);
2374 if ((oldsigs & TIOCM_CD) && 2374 if ((oldsigs & TIOCM_CD) &&
2375 ((portp->sigs & TIOCM_CD) == 0)) { 2375 ((portp->sigs & TIOCM_CD) == 0)) {
2376 if (portp->flags & ASYNC_CHECK_CD) { 2376 if (portp->port.flags & ASYNC_CHECK_CD) {
2377 if (tty) 2377 if (tty)
2378 tty_hangup(tty); 2378 tty_hangup(tty);
2379 } 2379 }
@@ -2392,7 +2392,7 @@ static int stli_hostcmd(struct stlibrd *brdp, struct stliport *portp)
2392 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { 2392 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) {
2393 if (tty != NULL) { 2393 if (tty != NULL) {
2394 tty_insert_flip_char(tty, 0, TTY_BREAK); 2394 tty_insert_flip_char(tty, 0, TTY_BREAK);
2395 if (portp->flags & ASYNC_SAK) { 2395 if (portp->port.flags & ASYNC_SAK) {
2396 do_SAK(tty); 2396 do_SAK(tty);
2397 EBRDENABLE(brdp); 2397 EBRDENABLE(brdp);
2398 } 2398 }
@@ -2542,17 +2542,17 @@ static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermio
2542/* 2542/*
2543 * Start of by setting the baud, char size, parity and stop bit info. 2543 * Start of by setting the baud, char size, parity and stop bit info.
2544 */ 2544 */
2545 pp->baudout = tty_get_baud_rate(portp->tty); 2545 pp->baudout = tty_get_baud_rate(portp->port.tty);
2546 if ((tiosp->c_cflag & CBAUD) == B38400) { 2546 if ((tiosp->c_cflag & CBAUD) == B38400) {
2547 if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 2547 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
2548 pp->baudout = 57600; 2548 pp->baudout = 57600;
2549 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 2549 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
2550 pp->baudout = 115200; 2550 pp->baudout = 115200;
2551 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 2551 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
2552 pp->baudout = 230400; 2552 pp->baudout = 230400;
2553 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 2553 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
2554 pp->baudout = 460800; 2554 pp->baudout = 460800;
2555 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 2555 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
2556 pp->baudout = (portp->baud_base / portp->custom_divisor); 2556 pp->baudout = (portp->baud_base / portp->custom_divisor);
2557 } 2557 }
2558 if (pp->baudout > STL_MAXBAUD) 2558 if (pp->baudout > STL_MAXBAUD)
@@ -2625,9 +2625,9 @@ static void stli_mkasyport(struct stliport *portp, asyport_t *pp, struct ktermio
2625 * Set up clocal processing as required. 2625 * Set up clocal processing as required.
2626 */ 2626 */
2627 if (tiosp->c_cflag & CLOCAL) 2627 if (tiosp->c_cflag & CLOCAL)
2628 portp->flags &= ~ASYNC_CHECK_CD; 2628 portp->port.flags &= ~ASYNC_CHECK_CD;
2629 else 2629 else
2630 portp->flags |= ASYNC_CHECK_CD; 2630 portp->port.flags |= ASYNC_CHECK_CD;
2631 2631
2632/* 2632/*
2633 * Transfer any persistent flags into the asyport structure. 2633 * Transfer any persistent flags into the asyport structure.
@@ -2703,8 +2703,8 @@ static int stli_initports(struct stlibrd *brdp)
2703 portp->baud_base = STL_BAUDBASE; 2703 portp->baud_base = STL_BAUDBASE;
2704 portp->close_delay = STL_CLOSEDELAY; 2704 portp->close_delay = STL_CLOSEDELAY;
2705 portp->closing_wait = 30 * HZ; 2705 portp->closing_wait = 30 * HZ;
2706 init_waitqueue_head(&portp->open_wait); 2706 init_waitqueue_head(&portp->port.open_wait);
2707 init_waitqueue_head(&portp->close_wait); 2707 init_waitqueue_head(&portp->port.close_wait);
2708 init_waitqueue_head(&portp->raw_wait); 2708 init_waitqueue_head(&portp->raw_wait);
2709 panelport++; 2709 panelport++;
2710 if (panelport >= brdp->panels[panelnr]) { 2710 if (panelport >= brdp->panels[panelnr]) {
@@ -4246,18 +4246,18 @@ static int stli_portcmdstats(struct stliport *portp)
4246 stli_comstats.panel = portp->panelnr; 4246 stli_comstats.panel = portp->panelnr;
4247 stli_comstats.port = portp->portnr; 4247 stli_comstats.port = portp->portnr;
4248 stli_comstats.state = portp->state; 4248 stli_comstats.state = portp->state;
4249 stli_comstats.flags = portp->flags; 4249 stli_comstats.flags = portp->port.flag;
4250 4250
4251 spin_lock_irqsave(&brd_lock, flags); 4251 spin_lock_irqsave(&brd_lock, flags);
4252 if (portp->tty != NULL) { 4252 if (portp->port.tty != NULL) {
4253 if (portp->tty->driver_data == portp) { 4253 if (portp->port.tty->driver_data == portp) {
4254 stli_comstats.ttystate = portp->tty->flags; 4254 stli_comstats.ttystate = portp->port.tty->flags;
4255 stli_comstats.rxbuffered = -1; 4255 stli_comstats.rxbuffered = -1;
4256 if (portp->tty->termios != NULL) { 4256 if (portp->port.tty->termios != NULL) {
4257 stli_comstats.cflags = portp->tty->termios->c_cflag; 4257 stli_comstats.cflags = portp->port.tty->termios->c_cflag;
4258 stli_comstats.iflags = portp->tty->termios->c_iflag; 4258 stli_comstats.iflags = portp->port.tty->termios->c_iflag;
4259 stli_comstats.oflags = portp->tty->termios->c_oflag; 4259 stli_comstats.oflags = portp->port.tty->termios->c_oflag;
4260 stli_comstats.lflags = portp->tty->termios->c_lflag; 4260 stli_comstats.lflags = portp->port.tty->termios->c_lflag;
4261 } 4261 }
4262 } 4262 }
4263 } 4263 }
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index e21346da3101..2bba250ffc8e 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -130,17 +130,13 @@ struct moxaq_str {
130}; 130};
131 131
132struct moxa_port { 132struct moxa_port {
133 struct tty_port port;
133 struct moxa_board_conf *board; 134 struct moxa_board_conf *board;
134 struct tty_struct *tty;
135 void __iomem *tableAddr; 135 void __iomem *tableAddr;
136 136
137 int type; 137 int type;
138 int close_delay;
139 unsigned int count;
140 int asyncflags;
141 int cflag; 138 int cflag;
142 unsigned long statusflags; 139 unsigned long statusflags;
143 wait_queue_head_t open_wait;
144 140
145 u8 DCDState; 141 u8 DCDState;
146 u8 lineCtrl; 142 u8 lineCtrl;
@@ -348,10 +344,10 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file,
348 if (status & 4) 344 if (status & 4)
349 tmp.dcd = 1; 345 tmp.dcd = 1;
350 346
351 if (!p->tty || !p->tty->termios) 347 if (!p->port.tty || !p->port.tty->termios)
352 tmp.cflag = p->cflag; 348 tmp.cflag = p->cflag;
353 else 349 else
354 tmp.cflag = p->tty->termios->c_cflag; 350 tmp.cflag = p->port.tty->termios->c_cflag;
355copy: 351copy:
356 if (copy_to_user(argm, &tmp, sizeof(tmp))) { 352 if (copy_to_user(argm, &tmp, sizeof(tmp))) {
357 mutex_unlock(&moxa_openlock); 353 mutex_unlock(&moxa_openlock);
@@ -825,10 +821,9 @@ static int moxa_init_board(struct moxa_board_conf *brd, struct device *dev)
825 } 821 }
826 822
827 for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) { 823 for (i = 0, p = brd->ports; i < MAX_PORTS_PER_BOARD; i++, p++) {
824 tty_port_init(&p->port);
828 p->type = PORT_16550A; 825 p->type = PORT_16550A;
829 p->close_delay = 5 * HZ / 10;
830 p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; 826 p->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
831 init_waitqueue_head(&p->open_wait);
832 } 827 }
833 828
834 switch (brd->boardType) { 829 switch (brd->boardType) {
@@ -884,12 +879,12 @@ static void moxa_board_deinit(struct moxa_board_conf *brd)
884 879
885 /* pci hot-un-plug support */ 880 /* pci hot-un-plug support */
886 for (a = 0; a < brd->numPorts; a++) 881 for (a = 0; a < brd->numPorts; a++)
887 if (brd->ports[a].asyncflags & ASYNC_INITIALIZED) 882 if (brd->ports[a].port.flags & ASYNC_INITIALIZED)
888 tty_hangup(brd->ports[a].tty); 883 tty_hangup(brd->ports[a].port.tty);
889 while (1) { 884 while (1) {
890 opened = 0; 885 opened = 0;
891 for (a = 0; a < brd->numPorts; a++) 886 for (a = 0; a < brd->numPorts; a++)
892 if (brd->ports[a].asyncflags & ASYNC_INITIALIZED) 887 if (brd->ports[a].port.flags & ASYNC_INITIALIZED)
893 opened++; 888 opened++;
894 mutex_unlock(&moxa_openlock); 889 mutex_unlock(&moxa_openlock);
895 if (!opened) 890 if (!opened)
@@ -1104,9 +1099,9 @@ static void moxa_close_port(struct moxa_port *ch)
1104{ 1099{
1105 moxa_shut_down(ch); 1100 moxa_shut_down(ch);
1106 MoxaPortFlushData(ch, 2); 1101 MoxaPortFlushData(ch, 2);
1107 ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; 1102 ch->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1108 ch->tty->driver_data = NULL; 1103 ch->port.tty->driver_data = NULL;
1109 ch->tty = NULL; 1104 ch->port.tty = NULL;
1110} 1105}
1111 1106
1112static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp, 1107static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp,
@@ -1117,7 +1112,7 @@ static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp,
1117 u8 dcd; 1112 u8 dcd;
1118 1113
1119 while (1) { 1114 while (1) {
1120 prepare_to_wait(&ch->open_wait, &wait, TASK_INTERRUPTIBLE); 1115 prepare_to_wait(&ch->port.open_wait, &wait, TASK_INTERRUPTIBLE);
1121 if (tty_hung_up_p(filp)) { 1116 if (tty_hung_up_p(filp)) {
1122#ifdef SERIAL_DO_RESTART 1117#ifdef SERIAL_DO_RESTART
1123 retval = -ERESTARTSYS; 1118 retval = -ERESTARTSYS;
@@ -1138,7 +1133,7 @@ static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp,
1138 } 1133 }
1139 schedule(); 1134 schedule();
1140 } 1135 }
1141 finish_wait(&ch->open_wait, &wait); 1136 finish_wait(&ch->port.open_wait, &wait);
1142 1137
1143 return retval; 1138 return retval;
1144} 1139}
@@ -1163,16 +1158,16 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
1163 } 1158 }
1164 1159
1165 ch = &brd->ports[port % MAX_PORTS_PER_BOARD]; 1160 ch = &brd->ports[port % MAX_PORTS_PER_BOARD];
1166 ch->count++; 1161 ch->port.count++;
1167 tty->driver_data = ch; 1162 tty->driver_data = ch;
1168 ch->tty = tty; 1163 ch->port.tty = tty;
1169 if (!(ch->asyncflags & ASYNC_INITIALIZED)) { 1164 if (!(ch->port.flags & ASYNC_INITIALIZED)) {
1170 ch->statusflags = 0; 1165 ch->statusflags = 0;
1171 moxa_set_tty_param(tty, tty->termios); 1166 moxa_set_tty_param(tty, tty->termios);
1172 MoxaPortLineCtrl(ch, 1, 1); 1167 MoxaPortLineCtrl(ch, 1, 1);
1173 MoxaPortEnable(ch); 1168 MoxaPortEnable(ch);
1174 MoxaSetFifo(ch, ch->type == PORT_16550A); 1169 MoxaSetFifo(ch, ch->type == PORT_16550A);
1175 ch->asyncflags |= ASYNC_INITIALIZED; 1170 ch->port.flags |= ASYNC_INITIALIZED;
1176 } 1171 }
1177 mutex_unlock(&moxa_openlock); 1172 mutex_unlock(&moxa_openlock);
1178 1173
@@ -1181,11 +1176,11 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
1181 retval = moxa_block_till_ready(tty, filp, ch); 1176 retval = moxa_block_till_ready(tty, filp, ch);
1182 mutex_lock(&moxa_openlock); 1177 mutex_lock(&moxa_openlock);
1183 if (retval) { 1178 if (retval) {
1184 if (ch->count) /* 0 means already hung up... */ 1179 if (ch->port.count) /* 0 means already hung up... */
1185 if (--ch->count == 0) 1180 if (--ch->port.count == 0)
1186 moxa_close_port(ch); 1181 moxa_close_port(ch);
1187 } else 1182 } else
1188 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; 1183 ch->port.flags |= ASYNC_NORMAL_ACTIVE;
1189 mutex_unlock(&moxa_openlock); 1184 mutex_unlock(&moxa_openlock);
1190 1185
1191 return retval; 1186 return retval;
@@ -1204,21 +1199,21 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
1204 ch = tty->driver_data; 1199 ch = tty->driver_data;
1205 if (ch == NULL) 1200 if (ch == NULL)
1206 goto unlock; 1201 goto unlock;
1207 if (tty->count == 1 && ch->count != 1) { 1202 if (tty->count == 1 && ch->port.count != 1) {
1208 printk(KERN_WARNING "moxa_close: bad serial port count; " 1203 printk(KERN_WARNING "moxa_close: bad serial port count; "
1209 "tty->count is 1, ch->count is %d\n", ch->count); 1204 "tty->count is 1, ch->port.count is %d\n", ch->port.count);
1210 ch->count = 1; 1205 ch->port.count = 1;
1211 } 1206 }
1212 if (--ch->count < 0) { 1207 if (--ch->port.count < 0) {
1213 printk(KERN_WARNING "moxa_close: bad serial port count, " 1208 printk(KERN_WARNING "moxa_close: bad serial port count, "
1214 "device=%s\n", tty->name); 1209 "device=%s\n", tty->name);
1215 ch->count = 0; 1210 ch->port.count = 0;
1216 } 1211 }
1217 if (ch->count) 1212 if (ch->port.count)
1218 goto unlock; 1213 goto unlock;
1219 1214
1220 ch->cflag = tty->termios->c_cflag; 1215 ch->cflag = tty->termios->c_cflag;
1221 if (ch->asyncflags & ASYNC_INITIALIZED) { 1216 if (ch->port.flags & ASYNC_INITIALIZED) {
1222 moxa_setup_empty_event(tty); 1217 moxa_setup_empty_event(tty);
1223 tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */ 1218 tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */
1224 } 1219 }
@@ -1374,7 +1369,7 @@ static void moxa_set_termios(struct tty_struct *tty,
1374 return; 1369 return;
1375 moxa_set_tty_param(tty, old_termios); 1370 moxa_set_tty_param(tty, old_termios);
1376 if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty)) 1371 if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty))
1377 wake_up_interruptible(&ch->open_wait); 1372 wake_up_interruptible(&ch->port.open_wait);
1378} 1373}
1379 1374
1380static void moxa_stop(struct tty_struct *tty) 1375static void moxa_stop(struct tty_struct *tty)
@@ -1412,20 +1407,20 @@ static void moxa_hangup(struct tty_struct *tty)
1412 mutex_unlock(&moxa_openlock); 1407 mutex_unlock(&moxa_openlock);
1413 return; 1408 return;
1414 } 1409 }
1415 ch->count = 0; 1410 ch->port.count = 0;
1416 moxa_close_port(ch); 1411 moxa_close_port(ch);
1417 mutex_unlock(&moxa_openlock); 1412 mutex_unlock(&moxa_openlock);
1418 1413
1419 wake_up_interruptible(&ch->open_wait); 1414 wake_up_interruptible(&ch->port.open_wait);
1420} 1415}
1421 1416
1422static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd) 1417static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd)
1423{ 1418{
1424 dcd = !!dcd; 1419 dcd = !!dcd;
1425 1420
1426 if (dcd != p->DCDState && p->tty && C_CLOCAL(p->tty)) { 1421 if (dcd != p->DCDState && p->port.tty && C_CLOCAL(p->port.tty)) {
1427 if (!dcd) 1422 if (!dcd)
1428 tty_hangup(p->tty); 1423 tty_hangup(p->port.tty);
1429 } 1424 }
1430 p->DCDState = dcd; 1425 p->DCDState = dcd;
1431} 1426}
@@ -1433,9 +1428,9 @@ static void moxa_new_dcdstate(struct moxa_port *p, u8 dcd)
1433static int moxa_poll_port(struct moxa_port *p, unsigned int handle, 1428static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
1434 u16 __iomem *ip) 1429 u16 __iomem *ip)
1435{ 1430{
1436 struct tty_struct *tty = p->tty; 1431 struct tty_struct *tty = p->port.tty;
1437 void __iomem *ofsAddr; 1432 void __iomem *ofsAddr;
1438 unsigned int inited = p->asyncflags & ASYNC_INITIALIZED; 1433 unsigned int inited = p->port.flags & ASYNC_INITIALIZED;
1439 u16 intr; 1434 u16 intr;
1440 1435
1441 if (tty) { 1436 if (tty) {
@@ -1566,9 +1561,9 @@ static void moxa_setup_empty_event(struct tty_struct *tty)
1566 1561
1567static void moxa_shut_down(struct moxa_port *ch) 1562static void moxa_shut_down(struct moxa_port *ch)
1568{ 1563{
1569 struct tty_struct *tp = ch->tty; 1564 struct tty_struct *tp = ch->port.tty;
1570 1565
1571 if (!(ch->asyncflags & ASYNC_INITIALIZED)) 1566 if (!(ch->port.flags & ASYNC_INITIALIZED))
1572 return; 1567 return;
1573 1568
1574 MoxaPortDisable(ch); 1569 MoxaPortDisable(ch);
@@ -1580,7 +1575,7 @@ static void moxa_shut_down(struct moxa_port *ch)
1580 MoxaPortLineCtrl(ch, 0, 0); 1575 MoxaPortLineCtrl(ch, 0, 0);
1581 1576
1582 spin_lock_bh(&moxa_lock); 1577 spin_lock_bh(&moxa_lock);
1583 ch->asyncflags &= ~ASYNC_INITIALIZED; 1578 ch->port.flags &= ~ASYNC_INITIALIZED;
1584 spin_unlock_bh(&moxa_lock); 1579 spin_unlock_bh(&moxa_lock);
1585} 1580}
1586 1581
@@ -1975,7 +1970,7 @@ static int MoxaPortWriteData(struct moxa_port *port,
1975 c = (head > tail) ? (head - tail - 1) : (head - tail + tx_mask); 1970 c = (head > tail) ? (head - tail - 1) : (head - tail + tx_mask);
1976 if (c > len) 1971 if (c > len)
1977 c = len; 1972 c = len;
1978 moxaLog.txcnt[port->tty->index] += c; 1973 moxaLog.txcnt[port->port.tty->index] += c;
1979 total = c; 1974 total = c;
1980 if (spage == epage) { 1975 if (spage == epage) {
1981 bufhead = readw(ofsAddr + Ofs_txb); 1976 bufhead = readw(ofsAddr + Ofs_txb);
@@ -2017,7 +2012,7 @@ static int MoxaPortWriteData(struct moxa_port *port,
2017 2012
2018static int MoxaPortReadData(struct moxa_port *port) 2013static int MoxaPortReadData(struct moxa_port *port)
2019{ 2014{
2020 struct tty_struct *tty = port->tty; 2015 struct tty_struct *tty = port->port.tty;
2021 unsigned char *dst; 2016 unsigned char *dst;
2022 void __iomem *baseAddr, *ofsAddr, *ofs; 2017 void __iomem *baseAddr, *ofsAddr, *ofs;
2023 unsigned int count, len, total; 2018 unsigned int count, len, total;
@@ -2124,10 +2119,10 @@ static int moxa_get_serial_info(struct moxa_port *info,
2124{ 2119{
2125 struct serial_struct tmp = { 2120 struct serial_struct tmp = {
2126 .type = info->type, 2121 .type = info->type,
2127 .line = info->tty->index, 2122 .line = info->port.tty->index,
2128 .flags = info->asyncflags, 2123 .flags = info->port.flags,
2129 .baud_base = 921600, 2124 .baud_base = 921600,
2130 .close_delay = info->close_delay 2125 .close_delay = info->port.close_delay
2131 }; 2126 };
2132 return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0; 2127 return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
2133} 2128}
@@ -2148,13 +2143,13 @@ static int moxa_set_serial_info(struct moxa_port *info,
2148 2143
2149 if (!capable(CAP_SYS_ADMIN)) { 2144 if (!capable(CAP_SYS_ADMIN)) {
2150 if (((new_serial.flags & ~ASYNC_USR_MASK) != 2145 if (((new_serial.flags & ~ASYNC_USR_MASK) !=
2151 (info->asyncflags & ~ASYNC_USR_MASK))) 2146 (info->port.flags & ~ASYNC_USR_MASK)))
2152 return -EPERM; 2147 return -EPERM;
2153 } else 2148 } else
2154 info->close_delay = new_serial.close_delay * HZ / 100; 2149 info->port.close_delay = new_serial.close_delay * HZ / 100;
2155 2150
2156 new_serial.flags = (new_serial.flags & ~ASYNC_FLAGS); 2151 new_serial.flags = (new_serial.flags & ~ASYNC_FLAGS);
2157 new_serial.flags |= (info->asyncflags & ASYNC_FLAGS); 2152 new_serial.flags |= (info->port.flags & ASYNC_FLAGS);
2158 2153
2159 MoxaSetFifo(info, new_serial.type == PORT_16550A); 2154 MoxaSetFifo(info, new_serial.type == PORT_16550A);
2160 2155
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 4b81a85c5b53..6307e301bd26 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -222,8 +222,8 @@ struct mxser_mon_ext {
222struct mxser_board; 222struct mxser_board;
223 223
224struct mxser_port { 224struct mxser_port {
225 struct tty_port port;
225 struct mxser_board *board; 226 struct mxser_board *board;
226 struct tty_struct *tty;
227 227
228 unsigned long ioaddr; 228 unsigned long ioaddr;
229 unsigned long opmode_ioaddr; 229 unsigned long opmode_ioaddr;
@@ -234,7 +234,6 @@ struct mxser_port {
234 int rx_low_water; 234 int rx_low_water;
235 int baud_base; /* max. speed */ 235 int baud_base; /* max. speed */
236 int type; /* UART type */ 236 int type; /* UART type */
237 int flags; /* defined in tty.h */
238 237
239 int x_char; /* xon/xoff character */ 238 int x_char; /* xon/xoff character */
240 int IER; /* Interrupt Enable Register */ 239 int IER; /* Interrupt Enable Register */
@@ -244,20 +243,14 @@ struct mxser_port {
244 unsigned char ldisc_stop_rx; 243 unsigned char ldisc_stop_rx;
245 244
246 int custom_divisor; 245 int custom_divisor;
247 int close_delay;
248 unsigned short closing_wait;
249 unsigned char err_shadow; 246 unsigned char err_shadow;
250 unsigned long event;
251 247
252 int count; /* # of fd on device */
253 int blocked_open; /* # of blocked opens */
254 struct async_icount icount; /* kernel counters for 4 input interrupts */ 248 struct async_icount icount; /* kernel counters for 4 input interrupts */
255 int timeout; 249 int timeout;
256 250
257 int read_status_mask; 251 int read_status_mask;
258 int ignore_status_mask; 252 int ignore_status_mask;
259 int xmit_fifo_size; 253 int xmit_fifo_size;
260 unsigned char *xmit_buf;
261 int xmit_head; 254 int xmit_head;
262 int xmit_tail; 255 int xmit_tail;
263 int xmit_cnt; 256 int xmit_cnt;
@@ -267,7 +260,6 @@ struct mxser_port {
267 struct mxser_mon mon_data; 260 struct mxser_mon mon_data;
268 261
269 spinlock_t slock; 262 spinlock_t slock;
270 wait_queue_head_t open_wait;
271 wait_queue_head_t delta_msr_wait; 263 wait_queue_head_t delta_msr_wait;
272}; 264};
273 265
@@ -575,7 +567,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
575 */ 567 */
576 if ((filp->f_flags & O_NONBLOCK) || 568 if ((filp->f_flags & O_NONBLOCK) ||
577 test_bit(TTY_IO_ERROR, &tty->flags)) { 569 test_bit(TTY_IO_ERROR, &tty->flags)) {
578 port->flags |= ASYNC_NORMAL_ACTIVE; 570 port->port.flags |= ASYNC_NORMAL_ACTIVE;
579 return 0; 571 return 0;
580 } 572 }
581 573
@@ -585,32 +577,32 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
585 /* 577 /*
586 * Block waiting for the carrier detect and the line to become 578 * Block waiting for the carrier detect and the line to become
587 * free (i.e., not in use by the callout). While we are in 579 * free (i.e., not in use by the callout). While we are in
588 * this loop, port->count is dropped by one, so that 580 * this loop, port->port.count is dropped by one, so that
589 * mxser_close() knows when to free things. We restore it upon 581 * mxser_close() knows when to free things. We restore it upon
590 * exit, either normal or abnormal. 582 * exit, either normal or abnormal.
591 */ 583 */
592 retval = 0; 584 retval = 0;
593 add_wait_queue(&port->open_wait, &wait); 585 add_wait_queue(&port->port.open_wait, &wait);
594 586
595 spin_lock_irqsave(&port->slock, flags); 587 spin_lock_irqsave(&port->slock, flags);
596 if (!tty_hung_up_p(filp)) 588 if (!tty_hung_up_p(filp))
597 port->count--; 589 port->port.count--;
598 spin_unlock_irqrestore(&port->slock, flags); 590 spin_unlock_irqrestore(&port->slock, flags);
599 port->blocked_open++; 591 port->port.blocked_open++;
600 while (1) { 592 while (1) {
601 spin_lock_irqsave(&port->slock, flags); 593 spin_lock_irqsave(&port->slock, flags);
602 outb(inb(port->ioaddr + UART_MCR) | 594 outb(inb(port->ioaddr + UART_MCR) |
603 UART_MCR_DTR | UART_MCR_RTS, port->ioaddr + UART_MCR); 595 UART_MCR_DTR | UART_MCR_RTS, port->ioaddr + UART_MCR);
604 spin_unlock_irqrestore(&port->slock, flags); 596 spin_unlock_irqrestore(&port->slock, flags);
605 set_current_state(TASK_INTERRUPTIBLE); 597 set_current_state(TASK_INTERRUPTIBLE);
606 if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { 598 if (tty_hung_up_p(filp) || !(port->port.flags & ASYNC_INITIALIZED)) {
607 if (port->flags & ASYNC_HUP_NOTIFY) 599 if (port->port.flags & ASYNC_HUP_NOTIFY)
608 retval = -EAGAIN; 600 retval = -EAGAIN;
609 else 601 else
610 retval = -ERESTARTSYS; 602 retval = -ERESTARTSYS;
611 break; 603 break;
612 } 604 }
613 if (!(port->flags & ASYNC_CLOSING) && 605 if (!(port->port.flags & ASYNC_CLOSING) &&
614 (do_clocal || 606 (do_clocal ||
615 (inb(port->ioaddr + UART_MSR) & UART_MSR_DCD))) 607 (inb(port->ioaddr + UART_MSR) & UART_MSR_DCD)))
616 break; 608 break;
@@ -621,13 +613,13 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp,
621 schedule(); 613 schedule();
622 } 614 }
623 set_current_state(TASK_RUNNING); 615 set_current_state(TASK_RUNNING);
624 remove_wait_queue(&port->open_wait, &wait); 616 remove_wait_queue(&port->port.open_wait, &wait);
625 if (!tty_hung_up_p(filp)) 617 if (!tty_hung_up_p(filp))
626 port->count++; 618 port->port.count++;
627 port->blocked_open--; 619 port->port.blocked_open--;
628 if (retval) 620 if (retval)
629 return retval; 621 return retval;
630 port->flags |= ASYNC_NORMAL_ACTIVE; 622 port->port.flags |= ASYNC_NORMAL_ACTIVE;
631 return 0; 623 return 0;
632} 624}
633 625
@@ -636,7 +628,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
636 int quot = 0, baud; 628 int quot = 0, baud;
637 unsigned char cval; 629 unsigned char cval;
638 630
639 if (!info->tty || !info->tty->termios) 631 if (!info->port.tty || !info->port.tty->termios)
640 return -1; 632 return -1;
641 633
642 if (!(info->ioaddr)) 634 if (!(info->ioaddr))
@@ -647,13 +639,13 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
647 639
648 if (newspd == 134) { 640 if (newspd == 134) {
649 quot = 2 * info->baud_base / 269; 641 quot = 2 * info->baud_base / 269;
650 tty_encode_baud_rate(info->tty, 134, 134); 642 tty_encode_baud_rate(info->port.tty, 134, 134);
651 } else if (newspd) { 643 } else if (newspd) {
652 quot = info->baud_base / newspd; 644 quot = info->baud_base / newspd;
653 if (quot == 0) 645 if (quot == 0)
654 quot = 1; 646 quot = 1;
655 baud = info->baud_base/quot; 647 baud = info->baud_base/quot;
656 tty_encode_baud_rate(info->tty, baud, baud); 648 tty_encode_baud_rate(info->port.tty, baud, baud);
657 } else { 649 } else {
658 quot = 0; 650 quot = 0;
659 } 651 }
@@ -679,7 +671,7 @@ static int mxser_set_baud(struct mxser_port *info, long newspd)
679 outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */ 671 outb(cval, info->ioaddr + UART_LCR); /* reset DLAB */
680 672
681#ifdef BOTHER 673#ifdef BOTHER
682 if (C_BAUD(info->tty) == BOTHER) { 674 if (C_BAUD(info->port.tty) == BOTHER) {
683 quot = info->baud_base % newspd; 675 quot = info->baud_base % newspd;
684 quot *= 8; 676 quot *= 8;
685 if (quot % newspd > newspd / 2) { 677 if (quot % newspd > newspd / 2) {
@@ -707,14 +699,14 @@ static int mxser_change_speed(struct mxser_port *info,
707 int ret = 0; 699 int ret = 0;
708 unsigned char status; 700 unsigned char status;
709 701
710 if (!info->tty || !info->tty->termios) 702 if (!info->port.tty || !info->port.tty->termios)
711 return ret; 703 return ret;
712 cflag = info->tty->termios->c_cflag; 704 cflag = info->port.tty->termios->c_cflag;
713 if (!(info->ioaddr)) 705 if (!(info->ioaddr))
714 return ret; 706 return ret;
715 707
716 if (mxser_set_baud_method[info->tty->index] == 0) 708 if (mxser_set_baud_method[info->port.tty->index] == 0)
717 mxser_set_baud(info, tty_get_baud_rate(info->tty)); 709 mxser_set_baud(info, tty_get_baud_rate(info->port.tty));
718 710
719 /* byte size and parity */ 711 /* byte size and parity */
720 switch (cflag & CSIZE) { 712 switch (cflag & CSIZE) {
@@ -777,15 +769,15 @@ static int mxser_change_speed(struct mxser_port *info,
777 info->IER &= ~UART_IER_MSI; 769 info->IER &= ~UART_IER_MSI;
778 info->MCR &= ~UART_MCR_AFE; 770 info->MCR &= ~UART_MCR_AFE;
779 if (cflag & CRTSCTS) { 771 if (cflag & CRTSCTS) {
780 info->flags |= ASYNC_CTS_FLOW; 772 info->port.flags |= ASYNC_CTS_FLOW;
781 info->IER |= UART_IER_MSI; 773 info->IER |= UART_IER_MSI;
782 if ((info->type == PORT_16550A) || (info->board->chip_flag)) { 774 if ((info->type == PORT_16550A) || (info->board->chip_flag)) {
783 info->MCR |= UART_MCR_AFE; 775 info->MCR |= UART_MCR_AFE;
784 } else { 776 } else {
785 status = inb(info->ioaddr + UART_MSR); 777 status = inb(info->ioaddr + UART_MSR);
786 if (info->tty->hw_stopped) { 778 if (info->port.tty->hw_stopped) {
787 if (status & UART_MSR_CTS) { 779 if (status & UART_MSR_CTS) {
788 info->tty->hw_stopped = 0; 780 info->port.tty->hw_stopped = 0;
789 if (info->type != PORT_16550A && 781 if (info->type != PORT_16550A &&
790 !info->board->chip_flag) { 782 !info->board->chip_flag) {
791 outb(info->IER & ~UART_IER_THRI, 783 outb(info->IER & ~UART_IER_THRI,
@@ -795,11 +787,11 @@ static int mxser_change_speed(struct mxser_port *info,
795 outb(info->IER, info->ioaddr + 787 outb(info->IER, info->ioaddr +
796 UART_IER); 788 UART_IER);
797 } 789 }
798 tty_wakeup(info->tty); 790 tty_wakeup(info->port.tty);
799 } 791 }
800 } else { 792 } else {
801 if (!(status & UART_MSR_CTS)) { 793 if (!(status & UART_MSR_CTS)) {
802 info->tty->hw_stopped = 1; 794 info->port.tty->hw_stopped = 1;
803 if ((info->type != PORT_16550A) && 795 if ((info->type != PORT_16550A) &&
804 (!info->board->chip_flag)) { 796 (!info->board->chip_flag)) {
805 info->IER &= ~UART_IER_THRI; 797 info->IER &= ~UART_IER_THRI;
@@ -810,13 +802,13 @@ static int mxser_change_speed(struct mxser_port *info,
810 } 802 }
811 } 803 }
812 } else { 804 } else {
813 info->flags &= ~ASYNC_CTS_FLOW; 805 info->port.flags &= ~ASYNC_CTS_FLOW;
814 } 806 }
815 outb(info->MCR, info->ioaddr + UART_MCR); 807 outb(info->MCR, info->ioaddr + UART_MCR);
816 if (cflag & CLOCAL) { 808 if (cflag & CLOCAL) {
817 info->flags &= ~ASYNC_CHECK_CD; 809 info->port.flags &= ~ASYNC_CHECK_CD;
818 } else { 810 } else {
819 info->flags |= ASYNC_CHECK_CD; 811 info->port.flags |= ASYNC_CHECK_CD;
820 info->IER |= UART_IER_MSI; 812 info->IER |= UART_IER_MSI;
821 } 813 }
822 outb(info->IER, info->ioaddr + UART_IER); 814 outb(info->IER, info->ioaddr + UART_IER);
@@ -825,21 +817,21 @@ static int mxser_change_speed(struct mxser_port *info,
825 * Set up parity check flag 817 * Set up parity check flag
826 */ 818 */
827 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR; 819 info->read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
828 if (I_INPCK(info->tty)) 820 if (I_INPCK(info->port.tty))
829 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE; 821 info->read_status_mask |= UART_LSR_FE | UART_LSR_PE;
830 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 822 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
831 info->read_status_mask |= UART_LSR_BI; 823 info->read_status_mask |= UART_LSR_BI;
832 824
833 info->ignore_status_mask = 0; 825 info->ignore_status_mask = 0;
834 826
835 if (I_IGNBRK(info->tty)) { 827 if (I_IGNBRK(info->port.tty)) {
836 info->ignore_status_mask |= UART_LSR_BI; 828 info->ignore_status_mask |= UART_LSR_BI;
837 info->read_status_mask |= UART_LSR_BI; 829 info->read_status_mask |= UART_LSR_BI;
838 /* 830 /*
839 * If we're ignore parity and break indicators, ignore 831 * If we're ignore parity and break indicators, ignore
840 * overruns too. (For real raw support). 832 * overruns too. (For real raw support).
841 */ 833 */
842 if (I_IGNPAR(info->tty)) { 834 if (I_IGNPAR(info->port.tty)) {
843 info->ignore_status_mask |= 835 info->ignore_status_mask |=
844 UART_LSR_OE | 836 UART_LSR_OE |
845 UART_LSR_PE | 837 UART_LSR_PE |
@@ -851,16 +843,16 @@ static int mxser_change_speed(struct mxser_port *info,
851 } 843 }
852 } 844 }
853 if (info->board->chip_flag) { 845 if (info->board->chip_flag) {
854 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(info->tty)); 846 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(info->port.tty));
855 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(info->tty)); 847 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(info->port.tty));
856 if (I_IXON(info->tty)) { 848 if (I_IXON(info->port.tty)) {
857 mxser_enable_must_rx_software_flow_control( 849 mxser_enable_must_rx_software_flow_control(
858 info->ioaddr); 850 info->ioaddr);
859 } else { 851 } else {
860 mxser_disable_must_rx_software_flow_control( 852 mxser_disable_must_rx_software_flow_control(
861 info->ioaddr); 853 info->ioaddr);
862 } 854 }
863 if (I_IXOFF(info->tty)) { 855 if (I_IXOFF(info->port.tty)) {
864 mxser_enable_must_tx_software_flow_control( 856 mxser_enable_must_tx_software_flow_control(
865 info->ioaddr); 857 info->ioaddr);
866 } else { 858 } else {
@@ -890,15 +882,15 @@ static void mxser_check_modem_status(struct mxser_port *port, int status)
890 port->mon_data.modem_status = status; 882 port->mon_data.modem_status = status;
891 wake_up_interruptible(&port->delta_msr_wait); 883 wake_up_interruptible(&port->delta_msr_wait);
892 884
893 if ((port->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { 885 if ((port->port.flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) {
894 if (status & UART_MSR_DCD) 886 if (status & UART_MSR_DCD)
895 wake_up_interruptible(&port->open_wait); 887 wake_up_interruptible(&port->port.open_wait);
896 } 888 }
897 889
898 if (port->flags & ASYNC_CTS_FLOW) { 890 if (port->port.flags & ASYNC_CTS_FLOW) {
899 if (port->tty->hw_stopped) { 891 if (port->port.tty->hw_stopped) {
900 if (status & UART_MSR_CTS) { 892 if (status & UART_MSR_CTS) {
901 port->tty->hw_stopped = 0; 893 port->port.tty->hw_stopped = 0;
902 894
903 if ((port->type != PORT_16550A) && 895 if ((port->type != PORT_16550A) &&
904 (!port->board->chip_flag)) { 896 (!port->board->chip_flag)) {
@@ -908,11 +900,11 @@ static void mxser_check_modem_status(struct mxser_port *port, int status)
908 outb(port->IER, port->ioaddr + 900 outb(port->IER, port->ioaddr +
909 UART_IER); 901 UART_IER);
910 } 902 }
911 tty_wakeup(port->tty); 903 tty_wakeup(port->port.tty);
912 } 904 }
913 } else { 905 } else {
914 if (!(status & UART_MSR_CTS)) { 906 if (!(status & UART_MSR_CTS)) {
915 port->tty->hw_stopped = 1; 907 port->port.tty->hw_stopped = 1;
916 if (port->type != PORT_16550A && 908 if (port->type != PORT_16550A &&
917 !port->board->chip_flag) { 909 !port->board->chip_flag) {
918 port->IER &= ~UART_IER_THRI; 910 port->IER &= ~UART_IER_THRI;
@@ -935,23 +927,23 @@ static int mxser_startup(struct mxser_port *info)
935 927
936 spin_lock_irqsave(&info->slock, flags); 928 spin_lock_irqsave(&info->slock, flags);
937 929
938 if (info->flags & ASYNC_INITIALIZED) { 930 if (info->port.flags & ASYNC_INITIALIZED) {
939 free_page(page); 931 free_page(page);
940 spin_unlock_irqrestore(&info->slock, flags); 932 spin_unlock_irqrestore(&info->slock, flags);
941 return 0; 933 return 0;
942 } 934 }
943 935
944 if (!info->ioaddr || !info->type) { 936 if (!info->ioaddr || !info->type) {
945 if (info->tty) 937 if (info->port.tty)
946 set_bit(TTY_IO_ERROR, &info->tty->flags); 938 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
947 free_page(page); 939 free_page(page);
948 spin_unlock_irqrestore(&info->slock, flags); 940 spin_unlock_irqrestore(&info->slock, flags);
949 return 0; 941 return 0;
950 } 942 }
951 if (info->xmit_buf) 943 if (info->port.xmit_buf)
952 free_page(page); 944 free_page(page);
953 else 945 else
954 info->xmit_buf = (unsigned char *) page; 946 info->port.xmit_buf = (unsigned char *) page;
955 947
956 /* 948 /*
957 * Clear the FIFO buffers and disable them 949 * Clear the FIFO buffers and disable them
@@ -973,8 +965,8 @@ static int mxser_startup(struct mxser_port *info)
973 if (inb(info->ioaddr + UART_LSR) == 0xff) { 965 if (inb(info->ioaddr + UART_LSR) == 0xff) {
974 spin_unlock_irqrestore(&info->slock, flags); 966 spin_unlock_irqrestore(&info->slock, flags);
975 if (capable(CAP_SYS_ADMIN)) { 967 if (capable(CAP_SYS_ADMIN)) {
976 if (info->tty) 968 if (info->port.tty)
977 set_bit(TTY_IO_ERROR, &info->tty->flags); 969 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
978 return 0; 970 return 0;
979 } else 971 } else
980 return -ENODEV; 972 return -ENODEV;
@@ -1012,15 +1004,15 @@ static int mxser_startup(struct mxser_port *info)
1012 (void) inb(info->ioaddr + UART_IIR); 1004 (void) inb(info->ioaddr + UART_IIR);
1013 (void) inb(info->ioaddr + UART_MSR); 1005 (void) inb(info->ioaddr + UART_MSR);
1014 1006
1015 if (info->tty) 1007 if (info->port.tty)
1016 clear_bit(TTY_IO_ERROR, &info->tty->flags); 1008 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
1017 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 1009 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
1018 1010
1019 /* 1011 /*
1020 * and set the speed of the serial port 1012 * and set the speed of the serial port
1021 */ 1013 */
1022 mxser_change_speed(info, NULL); 1014 mxser_change_speed(info, NULL);
1023 info->flags |= ASYNC_INITIALIZED; 1015 info->port.flags |= ASYNC_INITIALIZED;
1024 spin_unlock_irqrestore(&info->slock, flags); 1016 spin_unlock_irqrestore(&info->slock, flags);
1025 1017
1026 return 0; 1018 return 0;
@@ -1034,7 +1026,7 @@ static void mxser_shutdown(struct mxser_port *info)
1034{ 1026{
1035 unsigned long flags; 1027 unsigned long flags;
1036 1028
1037 if (!(info->flags & ASYNC_INITIALIZED)) 1029 if (!(info->port.flags & ASYNC_INITIALIZED))
1038 return; 1030 return;
1039 1031
1040 spin_lock_irqsave(&info->slock, flags); 1032 spin_lock_irqsave(&info->slock, flags);
@@ -1048,15 +1040,15 @@ static void mxser_shutdown(struct mxser_port *info)
1048 /* 1040 /*
1049 * Free the IRQ, if necessary 1041 * Free the IRQ, if necessary
1050 */ 1042 */
1051 if (info->xmit_buf) { 1043 if (info->port.xmit_buf) {
1052 free_page((unsigned long) info->xmit_buf); 1044 free_page((unsigned long) info->port.xmit_buf);
1053 info->xmit_buf = NULL; 1045 info->port.xmit_buf = NULL;
1054 } 1046 }
1055 1047
1056 info->IER = 0; 1048 info->IER = 0;
1057 outb(0x00, info->ioaddr + UART_IER); 1049 outb(0x00, info->ioaddr + UART_IER);
1058 1050
1059 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 1051 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))
1060 info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS); 1052 info->MCR &= ~(UART_MCR_DTR | UART_MCR_RTS);
1061 outb(info->MCR, info->ioaddr + UART_MCR); 1053 outb(info->MCR, info->ioaddr + UART_MCR);
1062 1054
@@ -1072,10 +1064,10 @@ static void mxser_shutdown(struct mxser_port *info)
1072 /* read data port to reset things */ 1064 /* read data port to reset things */
1073 (void) inb(info->ioaddr + UART_RX); 1065 (void) inb(info->ioaddr + UART_RX);
1074 1066
1075 if (info->tty) 1067 if (info->port.tty)
1076 set_bit(TTY_IO_ERROR, &info->tty->flags); 1068 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
1077 1069
1078 info->flags &= ~ASYNC_INITIALIZED; 1070 info->port.flags &= ~ASYNC_INITIALIZED;
1079 1071
1080 if (info->board->chip_flag) 1072 if (info->board->chip_flag)
1081 SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr); 1073 SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->ioaddr);
@@ -1105,12 +1097,12 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
1105 return -ENODEV; 1097 return -ENODEV;
1106 1098
1107 tty->driver_data = info; 1099 tty->driver_data = info;
1108 info->tty = tty; 1100 info->port.tty = tty;
1109 /* 1101 /*
1110 * Start up serial port 1102 * Start up serial port
1111 */ 1103 */
1112 spin_lock_irqsave(&info->slock, flags); 1104 spin_lock_irqsave(&info->slock, flags);
1113 info->count++; 1105 info->port.count++;
1114 spin_unlock_irqrestore(&info->slock, flags); 1106 spin_unlock_irqrestore(&info->slock, flags);
1115 retval = mxser_startup(info); 1107 retval = mxser_startup(info);
1116 if (retval) 1108 if (retval)
@@ -1170,42 +1162,42 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1170 spin_unlock_irqrestore(&info->slock, flags); 1162 spin_unlock_irqrestore(&info->slock, flags);
1171 return; 1163 return;
1172 } 1164 }
1173 if ((tty->count == 1) && (info->count != 1)) { 1165 if ((tty->count == 1) && (info->port.count != 1)) {
1174 /* 1166 /*
1175 * Uh, oh. tty->count is 1, which means that the tty 1167 * Uh, oh. tty->count is 1, which means that the tty
1176 * structure will be freed. Info->count should always 1168 * structure will be freed. Info->port.count should always
1177 * be one in these conditions. If it's greater than 1169 * be one in these conditions. If it's greater than
1178 * one, we've got real problems, since it means the 1170 * one, we've got real problems, since it means the
1179 * serial port won't be shutdown. 1171 * serial port won't be shutdown.
1180 */ 1172 */
1181 printk(KERN_ERR "mxser_close: bad serial port count; " 1173 printk(KERN_ERR "mxser_close: bad serial port count; "
1182 "tty->count is 1, info->count is %d\n", info->count); 1174 "tty->count is 1, info->port.count is %d\n", info->port.count);
1183 info->count = 1; 1175 info->port.count = 1;
1184 } 1176 }
1185 if (--info->count < 0) { 1177 if (--info->port.count < 0) {
1186 printk(KERN_ERR "mxser_close: bad serial port count for " 1178 printk(KERN_ERR "mxser_close: bad serial port count for "
1187 "ttys%d: %d\n", tty->index, info->count); 1179 "ttys%d: %d\n", tty->index, info->port.count);
1188 info->count = 0; 1180 info->port.count = 0;
1189 } 1181 }
1190 if (info->count) { 1182 if (info->port.count) {
1191 spin_unlock_irqrestore(&info->slock, flags); 1183 spin_unlock_irqrestore(&info->slock, flags);
1192 return; 1184 return;
1193 } 1185 }
1194 info->flags |= ASYNC_CLOSING; 1186 info->port.flags |= ASYNC_CLOSING;
1195 spin_unlock_irqrestore(&info->slock, flags); 1187 spin_unlock_irqrestore(&info->slock, flags);
1196 /* 1188 /*
1197 * Save the termios structure, since this port may have 1189 * Save the termios structure, since this port may have
1198 * separate termios for callout and dialin. 1190 * separate termios for callout and dialin.
1199 */ 1191 */
1200 if (info->flags & ASYNC_NORMAL_ACTIVE) 1192 if (info->port.flags & ASYNC_NORMAL_ACTIVE)
1201 info->normal_termios = *tty->termios; 1193 info->normal_termios = *tty->termios;
1202 /* 1194 /*
1203 * Now we wait for the transmit buffer to clear; and we notify 1195 * Now we wait for the transmit buffer to clear; and we notify
1204 * the line discipline to only process XON/XOFF characters. 1196 * the line discipline to only process XON/XOFF characters.
1205 */ 1197 */
1206 tty->closing = 1; 1198 tty->closing = 1;
1207 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1199 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
1208 tty_wait_until_sent(tty, info->closing_wait); 1200 tty_wait_until_sent(tty, info->port.closing_wait);
1209 /* 1201 /*
1210 * At this point we stop accepting input. To do this, we 1202 * At this point we stop accepting input. To do this, we
1211 * disable the receive line status interrupts, and tell the 1203 * disable the receive line status interrupts, and tell the
@@ -1216,7 +1208,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1216 if (info->board->chip_flag) 1208 if (info->board->chip_flag)
1217 info->IER &= ~MOXA_MUST_RECV_ISR; 1209 info->IER &= ~MOXA_MUST_RECV_ISR;
1218 1210
1219 if (info->flags & ASYNC_INITIALIZED) { 1211 if (info->port.flags & ASYNC_INITIALIZED) {
1220 outb(info->IER, info->ioaddr + UART_IER); 1212 outb(info->IER, info->ioaddr + UART_IER);
1221 /* 1213 /*
1222 * Before we drop DTR, make sure the UART transmitter 1214 * Before we drop DTR, make sure the UART transmitter
@@ -1236,15 +1228,14 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1236 tty_ldisc_flush(tty); 1228 tty_ldisc_flush(tty);
1237 1229
1238 tty->closing = 0; 1230 tty->closing = 0;
1239 info->event = 0; 1231 info->port.tty = NULL;
1240 info->tty = NULL; 1232 if (info->port.blocked_open) {
1241 if (info->blocked_open) { 1233 if (info->port.close_delay)
1242 if (info->close_delay) 1234 schedule_timeout_interruptible(info->port.close_delay);
1243 schedule_timeout_interruptible(info->close_delay); 1235 wake_up_interruptible(&info->port.open_wait);
1244 wake_up_interruptible(&info->open_wait);
1245 } 1236 }
1246 1237
1247 info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 1238 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
1248} 1239}
1249 1240
1250static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) 1241static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count)
@@ -1253,7 +1244,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou
1253 struct mxser_port *info = tty->driver_data; 1244 struct mxser_port *info = tty->driver_data;
1254 unsigned long flags; 1245 unsigned long flags;
1255 1246
1256 if (!info->xmit_buf) 1247 if (!info->port.xmit_buf)
1257 return 0; 1248 return 0;
1258 1249
1259 while (1) { 1250 while (1) {
@@ -1262,7 +1253,7 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou
1262 if (c <= 0) 1253 if (c <= 0)
1263 break; 1254 break;
1264 1255
1265 memcpy(info->xmit_buf + info->xmit_head, buf, c); 1256 memcpy(info->port.xmit_buf + info->xmit_head, buf, c);
1266 spin_lock_irqsave(&info->slock, flags); 1257 spin_lock_irqsave(&info->slock, flags);
1267 info->xmit_head = (info->xmit_head + c) & 1258 info->xmit_head = (info->xmit_head + c) &
1268 (SERIAL_XMIT_SIZE - 1); 1259 (SERIAL_XMIT_SIZE - 1);
@@ -1294,14 +1285,14 @@ static int mxser_put_char(struct tty_struct *tty, unsigned char ch)
1294 struct mxser_port *info = tty->driver_data; 1285 struct mxser_port *info = tty->driver_data;
1295 unsigned long flags; 1286 unsigned long flags;
1296 1287
1297 if (!info->xmit_buf) 1288 if (!info->port.xmit_buf)
1298 return 0; 1289 return 0;
1299 1290
1300 if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) 1291 if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1)
1301 return 0; 1292 return 0;
1302 1293
1303 spin_lock_irqsave(&info->slock, flags); 1294 spin_lock_irqsave(&info->slock, flags);
1304 info->xmit_buf[info->xmit_head++] = ch; 1295 info->port.xmit_buf[info->xmit_head++] = ch;
1305 info->xmit_head &= SERIAL_XMIT_SIZE - 1; 1296 info->xmit_head &= SERIAL_XMIT_SIZE - 1;
1306 info->xmit_cnt++; 1297 info->xmit_cnt++;
1307 spin_unlock_irqrestore(&info->slock, flags); 1298 spin_unlock_irqrestore(&info->slock, flags);
@@ -1327,7 +1318,7 @@ static void mxser_flush_chars(struct tty_struct *tty)
1327 1318
1328 if (info->xmit_cnt <= 0 || 1319 if (info->xmit_cnt <= 0 ||
1329 tty->stopped || 1320 tty->stopped ||
1330 !info->xmit_buf || 1321 !info->port.xmit_buf ||
1331 (tty->hw_stopped && 1322 (tty->hw_stopped &&
1332 (info->type != PORT_16550A) && 1323 (info->type != PORT_16550A) &&
1333 (!info->board->chip_flag) 1324 (!info->board->chip_flag)
@@ -1370,13 +1361,13 @@ static int mxser_get_serial_info(struct mxser_port *info,
1370{ 1361{
1371 struct serial_struct tmp = { 1362 struct serial_struct tmp = {
1372 .type = info->type, 1363 .type = info->type,
1373 .line = info->tty->index, 1364 .line = info->port.tty->index,
1374 .port = info->ioaddr, 1365 .port = info->ioaddr,
1375 .irq = info->board->irq, 1366 .irq = info->board->irq,
1376 .flags = info->flags, 1367 .flags = info->port.flags,
1377 .baud_base = info->baud_base, 1368 .baud_base = info->baud_base,
1378 .close_delay = info->close_delay, 1369 .close_delay = info->port.close_delay,
1379 .closing_wait = info->closing_wait, 1370 .closing_wait = info->port.closing_wait,
1380 .custom_divisor = info->custom_divisor, 1371 .custom_divisor = info->custom_divisor,
1381 .hub6 = 0 1372 .hub6 = 0
1382 }; 1373 };
@@ -1403,33 +1394,33 @@ static int mxser_set_serial_info(struct mxser_port *info,
1403 new_serial.port != info->ioaddr) 1394 new_serial.port != info->ioaddr)
1404 return -EINVAL; 1395 return -EINVAL;
1405 1396
1406 flags = info->flags & ASYNC_SPD_MASK; 1397 flags = info->port.flags & ASYNC_SPD_MASK;
1407 1398
1408 if (!capable(CAP_SYS_ADMIN)) { 1399 if (!capable(CAP_SYS_ADMIN)) {
1409 if ((new_serial.baud_base != info->baud_base) || 1400 if ((new_serial.baud_base != info->baud_base) ||
1410 (new_serial.close_delay != info->close_delay) || 1401 (new_serial.close_delay != info->port.close_delay) ||
1411 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) 1402 ((new_serial.flags & ~ASYNC_USR_MASK) != (info->port.flags & ~ASYNC_USR_MASK)))
1412 return -EPERM; 1403 return -EPERM;
1413 info->flags = ((info->flags & ~ASYNC_USR_MASK) | 1404 info->port.flags = ((info->port.flags & ~ASYNC_USR_MASK) |
1414 (new_serial.flags & ASYNC_USR_MASK)); 1405 (new_serial.flags & ASYNC_USR_MASK));
1415 } else { 1406 } else {
1416 /* 1407 /*
1417 * OK, past this point, all the error checking has been done. 1408 * OK, past this point, all the error checking has been done.
1418 * At this point, we start making changes..... 1409 * At this point, we start making changes.....
1419 */ 1410 */
1420 info->flags = ((info->flags & ~ASYNC_FLAGS) | 1411 info->port.flags = ((info->port.flags & ~ASYNC_FLAGS) |
1421 (new_serial.flags & ASYNC_FLAGS)); 1412 (new_serial.flags & ASYNC_FLAGS));
1422 info->close_delay = new_serial.close_delay * HZ / 100; 1413 info->port.close_delay = new_serial.close_delay * HZ / 100;
1423 info->closing_wait = new_serial.closing_wait * HZ / 100; 1414 info->port.closing_wait = new_serial.closing_wait * HZ / 100;
1424 info->tty->low_latency = 1415 info->port.tty->low_latency =
1425 (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1416 (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1426 info->tty->low_latency = 0; 1417 info->port.tty->low_latency = 0;
1427 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST && 1418 if ((info->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
1428 (new_serial.baud_base != info->baud_base || 1419 (new_serial.baud_base != info->baud_base ||
1429 new_serial.custom_divisor != 1420 new_serial.custom_divisor !=
1430 info->custom_divisor)) { 1421 info->custom_divisor)) {
1431 baud = new_serial.baud_base / new_serial.custom_divisor; 1422 baud = new_serial.baud_base / new_serial.custom_divisor;
1432 tty_encode_baud_rate(info->tty, baud, baud); 1423 tty_encode_baud_rate(info->port.tty, baud, baud);
1433 } 1424 }
1434 } 1425 }
1435 1426
@@ -1437,8 +1428,8 @@ static int mxser_set_serial_info(struct mxser_port *info,
1437 1428
1438 process_txrx_fifo(info); 1429 process_txrx_fifo(info);
1439 1430
1440 if (info->flags & ASYNC_INITIALIZED) { 1431 if (info->port.flags & ASYNC_INITIALIZED) {
1441 if (flags != (info->flags & ASYNC_SPD_MASK)) { 1432 if (flags != (info->port.flags & ASYNC_SPD_MASK)) {
1442 spin_lock_irqsave(&info->slock, sl_flags); 1433 spin_lock_irqsave(&info->slock, sl_flags);
1443 mxser_change_speed(info, NULL); 1434 mxser_change_speed(info, NULL);
1444 spin_unlock_irqrestore(&info->slock, sl_flags); 1435 spin_unlock_irqrestore(&info->slock, sl_flags);
@@ -1693,12 +1684,12 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1693 continue; 1684 continue;
1694 } 1685 }
1695 1686
1696 if (!port->tty || !port->tty->termios) 1687 if (!port->port.tty || !port->port.tty->termios)
1697 GMStatus[i].cflag = 1688 GMStatus[i].cflag =
1698 port->normal_termios.c_cflag; 1689 port->normal_termios.c_cflag;
1699 else 1690 else
1700 GMStatus[i].cflag = 1691 GMStatus[i].cflag =
1701 port->tty->termios->c_cflag; 1692 port->port.tty->termios->c_cflag;
1702 1693
1703 status = inb(port->ioaddr + UART_MSR); 1694 status = inb(port->ioaddr + UART_MSR);
1704 if (status & 0x80 /*UART_MSR_DCD */ ) 1695 if (status & 0x80 /*UART_MSR_DCD */ )
@@ -1755,14 +1746,14 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1755 mon_data_ext.modem_status[i] = 1746 mon_data_ext.modem_status[i] =
1756 port->mon_data.modem_status; 1747 port->mon_data.modem_status;
1757 mon_data_ext.baudrate[i] = 1748 mon_data_ext.baudrate[i] =
1758 tty_get_baud_rate(port->tty); 1749 tty_get_baud_rate(port->port.tty);
1759 1750
1760 if (!port->tty || !port->tty->termios) { 1751 if (!port->port.tty || !port->port.tty->termios) {
1761 cflag = port->normal_termios.c_cflag; 1752 cflag = port->normal_termios.c_cflag;
1762 iflag = port->normal_termios.c_iflag; 1753 iflag = port->normal_termios.c_iflag;
1763 } else { 1754 } else {
1764 cflag = port->tty->termios->c_cflag; 1755 cflag = port->port.tty->termios->c_cflag;
1765 iflag = port->tty->termios->c_iflag; 1756 iflag = port->port.tty->termios->c_iflag;
1766 } 1757 }
1767 1758
1768 mon_data_ext.databits[i] = cflag & CSIZE; 1759 mon_data_ext.databits[i] = cflag & CSIZE;
@@ -1989,7 +1980,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
1989 else 1980 else
1990 info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT; 1981 info->mon_data.hold_reason |= NPPI_NOTIFY_XOFFXENT;
1991 1982
1992 if (info->tty->hw_stopped) 1983 if (info->port.tty->hw_stopped)
1993 info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD; 1984 info->mon_data.hold_reason |= NPPI_NOTIFY_CTSHOLD;
1994 else 1985 else
1995 info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; 1986 info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD;
@@ -2038,7 +2029,7 @@ static void mxser_stoprx(struct tty_struct *tty)
2038 } 2029 }
2039 } 2030 }
2040 2031
2041 if (info->tty->termios->c_cflag & CRTSCTS) { 2032 if (info->port.tty->termios->c_cflag & CRTSCTS) {
2042 info->MCR &= ~UART_MCR_RTS; 2033 info->MCR &= ~UART_MCR_RTS;
2043 outb(info->MCR, info->ioaddr + UART_MCR); 2034 outb(info->MCR, info->ioaddr + UART_MCR);
2044 } 2035 }
@@ -2075,7 +2066,7 @@ static void mxser_unthrottle(struct tty_struct *tty)
2075 } 2066 }
2076 } 2067 }
2077 2068
2078 if (info->tty->termios->c_cflag & CRTSCTS) { 2069 if (info->port.tty->termios->c_cflag & CRTSCTS) {
2079 info->MCR |= UART_MCR_RTS; 2070 info->MCR |= UART_MCR_RTS;
2080 outb(info->MCR, info->ioaddr + UART_MCR); 2071 outb(info->MCR, info->ioaddr + UART_MCR);
2081 } 2072 }
@@ -2106,7 +2097,7 @@ static void mxser_start(struct tty_struct *tty)
2106 unsigned long flags; 2097 unsigned long flags;
2107 2098
2108 spin_lock_irqsave(&info->slock, flags); 2099 spin_lock_irqsave(&info->slock, flags);
2109 if (info->xmit_cnt && info->xmit_buf) { 2100 if (info->xmit_cnt && info->port.xmit_buf) {
2110 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER); 2101 outb(info->IER & ~UART_IER_THRI, info->ioaddr + UART_IER);
2111 info->IER |= UART_IER_THRI; 2102 info->IER |= UART_IER_THRI;
2112 outb(info->IER, info->ioaddr + UART_IER); 2103 outb(info->IER, info->ioaddr + UART_IER);
@@ -2219,11 +2210,10 @@ static void mxser_hangup(struct tty_struct *tty)
2219 2210
2220 mxser_flush_buffer(tty); 2211 mxser_flush_buffer(tty);
2221 mxser_shutdown(info); 2212 mxser_shutdown(info);
2222 info->event = 0; 2213 info->port.count = 0;
2223 info->count = 0; 2214 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2224 info->flags &= ~ASYNC_NORMAL_ACTIVE; 2215 info->port.tty = NULL;
2225 info->tty = NULL; 2216 wake_up_interruptible(&info->port.open_wait);
2226 wake_up_interruptible(&info->open_wait);
2227} 2217}
2228 2218
2229/* 2219/*
@@ -2246,7 +2236,7 @@ static void mxser_rs_break(struct tty_struct *tty, int break_state)
2246 2236
2247static void mxser_receive_chars(struct mxser_port *port, int *status) 2237static void mxser_receive_chars(struct mxser_port *port, int *status)
2248{ 2238{
2249 struct tty_struct *tty = port->tty; 2239 struct tty_struct *tty = port->port.tty;
2250 unsigned char ch, gdl; 2240 unsigned char ch, gdl;
2251 int ignored = 0; 2241 int ignored = 0;
2252 int cnt = 0; 2242 int cnt = 0;
@@ -2302,7 +2292,7 @@ intr_old:
2302 flag = TTY_BREAK; 2292 flag = TTY_BREAK;
2303 port->icount.brk++; 2293 port->icount.brk++;
2304 2294
2305 if (port->flags & ASYNC_SAK) 2295 if (port->port.flags & ASYNC_SAK)
2306 do_SAK(tty); 2296 do_SAK(tty);
2307 } else if (*status & UART_LSR_PE) { 2297 } else if (*status & UART_LSR_PE) {
2308 flag = TTY_PARITY; 2298 flag = TTY_PARITY;
@@ -2333,7 +2323,7 @@ intr_old:
2333 } while (*status & UART_LSR_DR); 2323 } while (*status & UART_LSR_DR);
2334 2324
2335end_intr: 2325end_intr:
2336 mxvar_log.rxcnt[port->tty->index] += cnt; 2326 mxvar_log.rxcnt[port->port.tty->index] += cnt;
2337 port->mon_data.rxcnt += cnt; 2327 port->mon_data.rxcnt += cnt;
2338 port->mon_data.up_rxcnt += cnt; 2328 port->mon_data.up_rxcnt += cnt;
2339 2329
@@ -2354,18 +2344,18 @@ static void mxser_transmit_chars(struct mxser_port *port)
2354 if (port->x_char) { 2344 if (port->x_char) {
2355 outb(port->x_char, port->ioaddr + UART_TX); 2345 outb(port->x_char, port->ioaddr + UART_TX);
2356 port->x_char = 0; 2346 port->x_char = 0;
2357 mxvar_log.txcnt[port->tty->index]++; 2347 mxvar_log.txcnt[port->port.tty->index]++;
2358 port->mon_data.txcnt++; 2348 port->mon_data.txcnt++;
2359 port->mon_data.up_txcnt++; 2349 port->mon_data.up_txcnt++;
2360 port->icount.tx++; 2350 port->icount.tx++;
2361 return; 2351 return;
2362 } 2352 }
2363 2353
2364 if (port->xmit_buf == NULL) 2354 if (port->port.xmit_buf == NULL)
2365 return; 2355 return;
2366 2356
2367 if ((port->xmit_cnt <= 0) || port->tty->stopped || 2357 if ((port->xmit_cnt <= 0) || port->port.tty->stopped ||
2368 (port->tty->hw_stopped && 2358 (port->port.tty->hw_stopped &&
2369 (port->type != PORT_16550A) && 2359 (port->type != PORT_16550A) &&
2370 (!port->board->chip_flag))) { 2360 (!port->board->chip_flag))) {
2371 port->IER &= ~UART_IER_THRI; 2361 port->IER &= ~UART_IER_THRI;
@@ -2376,20 +2366,20 @@ static void mxser_transmit_chars(struct mxser_port *port)
2376 cnt = port->xmit_cnt; 2366 cnt = port->xmit_cnt;
2377 count = port->xmit_fifo_size; 2367 count = port->xmit_fifo_size;
2378 do { 2368 do {
2379 outb(port->xmit_buf[port->xmit_tail++], 2369 outb(port->port.xmit_buf[port->xmit_tail++],
2380 port->ioaddr + UART_TX); 2370 port->ioaddr + UART_TX);
2381 port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1); 2371 port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1);
2382 if (--port->xmit_cnt <= 0) 2372 if (--port->xmit_cnt <= 0)
2383 break; 2373 break;
2384 } while (--count > 0); 2374 } while (--count > 0);
2385 mxvar_log.txcnt[port->tty->index] += (cnt - port->xmit_cnt); 2375 mxvar_log.txcnt[port->port.tty->index] += (cnt - port->xmit_cnt);
2386 2376
2387 port->mon_data.txcnt += (cnt - port->xmit_cnt); 2377 port->mon_data.txcnt += (cnt - port->xmit_cnt);
2388 port->mon_data.up_txcnt += (cnt - port->xmit_cnt); 2378 port->mon_data.up_txcnt += (cnt - port->xmit_cnt);
2389 port->icount.tx += (cnt - port->xmit_cnt); 2379 port->icount.tx += (cnt - port->xmit_cnt);
2390 2380
2391 if (port->xmit_cnt < WAKEUP_CHARS) 2381 if (port->xmit_cnt < WAKEUP_CHARS)
2392 tty_wakeup(port->tty); 2382 tty_wakeup(port->port.tty);
2393 2383
2394 if (port->xmit_cnt <= 0) { 2384 if (port->xmit_cnt <= 0) {
2395 port->IER &= ~UART_IER_THRI; 2385 port->IER &= ~UART_IER_THRI;
@@ -2440,9 +2430,9 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id)
2440 if (iir & UART_IIR_NO_INT) 2430 if (iir & UART_IIR_NO_INT)
2441 break; 2431 break;
2442 iir &= MOXA_MUST_IIR_MASK; 2432 iir &= MOXA_MUST_IIR_MASK;
2443 if (!port->tty || 2433 if (!port->port.tty ||
2444 (port->flags & ASYNC_CLOSING) || 2434 (port->port.flags & ASYNC_CLOSING) ||
2445 !(port->flags & 2435 !(port->port.flags &
2446 ASYNC_INITIALIZED)) { 2436 ASYNC_INITIALIZED)) {
2447 status = inb(port->ioaddr + UART_LSR); 2437 status = inb(port->ioaddr + UART_LSR);
2448 outb(0x27, port->ioaddr + UART_FCR); 2438 outb(0x27, port->ioaddr + UART_FCR);
@@ -2550,6 +2540,7 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2550 2540
2551 for (i = 0; i < brd->info->nports; i++) { 2541 for (i = 0; i < brd->info->nports; i++) {
2552 info = &brd->ports[i]; 2542 info = &brd->ports[i];
2543 tty_port_init(&info->port);
2553 info->board = brd; 2544 info->board = brd;
2554 info->stop_rx = 0; 2545 info->stop_rx = 0;
2555 info->ldisc_stop_rx = 0; 2546 info->ldisc_stop_rx = 0;
@@ -2558,16 +2549,15 @@ static int __devinit mxser_initbrd(struct mxser_board *brd,
2558 if (brd->chip_flag != MOXA_OTHER_UART) 2549 if (brd->chip_flag != MOXA_OTHER_UART)
2559 mxser_enable_must_enchance_mode(info->ioaddr); 2550 mxser_enable_must_enchance_mode(info->ioaddr);
2560 2551
2561 info->flags = ASYNC_SHARE_IRQ; 2552 info->port.flags = ASYNC_SHARE_IRQ;
2562 info->type = brd->uart_type; 2553 info->type = brd->uart_type;
2563 2554
2564 process_txrx_fifo(info); 2555 process_txrx_fifo(info);
2565 2556
2566 info->custom_divisor = info->baud_base * 16; 2557 info->custom_divisor = info->baud_base * 16;
2567 info->close_delay = 5 * HZ / 10; 2558 info->port.close_delay = 5 * HZ / 10;
2568 info->closing_wait = 30 * HZ; 2559 info->port.closing_wait = 30 * HZ;
2569 info->normal_termios = mxvar_sdriver->init_termios; 2560 info->normal_termios = mxvar_sdriver->init_termios;
2570 init_waitqueue_head(&info->open_wait);
2571 init_waitqueue_head(&info->delta_msr_wait); 2561 init_waitqueue_head(&info->delta_msr_wait);
2572 memset(&info->mon_data, 0, sizeof(struct mxser_mon)); 2562 memset(&info->mon_data, 0, sizeof(struct mxser_mon));
2573 info->err_shadow = 0; 2563 info->err_shadow = 0;
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index a35bfd7ee80e..ed4e03333ab4 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -199,7 +199,7 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty);
199#define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data)) 199#define tty2n_hdlc(tty) ((struct n_hdlc *) ((tty)->disc_data))
200#define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty) 200#define n_hdlc2tty(n_hdlc) ((n_hdlc)->tty)
201 201
202static struct tty_ldisc n_hdlc_ldisc = { 202static struct tty_ldisc_ops n_hdlc_ldisc = {
203 .owner = THIS_MODULE, 203 .owner = THIS_MODULE,
204 .magic = TTY_LDISC_MAGIC, 204 .magic = TTY_LDISC_MAGIC,
205 .name = "hdlc", 205 .name = "hdlc",
@@ -342,8 +342,8 @@ static int n_hdlc_tty_open (struct tty_struct *tty)
342#endif 342#endif
343 343
344 /* Flush any pending characters in the driver and discipline. */ 344 /* Flush any pending characters in the driver and discipline. */
345 if (tty->ldisc.flush_buffer) 345 if (tty->ldisc.ops->flush_buffer)
346 tty->ldisc.flush_buffer(tty); 346 tty->ldisc.ops->flush_buffer(tty);
347 347
348 tty_driver_flush_buffer(tty); 348 tty_driver_flush_buffer(tty);
349 349
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index 902169062332..ae377aa473ba 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -143,7 +143,7 @@ static unsigned int r3964_poll(struct tty_struct *tty, struct file *file,
143static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, 143static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp,
144 char *fp, int count); 144 char *fp, int count);
145 145
146static struct tty_ldisc tty_ldisc_N_R3964 = { 146static struct tty_ldisc_ops tty_ldisc_N_R3964 = {
147 .owner = THIS_MODULE, 147 .owner = THIS_MODULE,
148 .magic = TTY_LDISC_MAGIC, 148 .magic = TTY_LDISC_MAGIC,
149 .name = "R3964", 149 .name = "R3964",
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 8096389b0dc2..708c2b1dbe51 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1573,7 +1573,7 @@ static unsigned int normal_poll(struct tty_struct *tty, struct file *file,
1573 return mask; 1573 return mask;
1574} 1574}
1575 1575
1576struct tty_ldisc tty_ldisc_N_TTY = { 1576struct tty_ldisc_ops tty_ldisc_N_TTY = {
1577 .magic = TTY_LDISC_MAGIC, 1577 .magic = TTY_LDISC_MAGIC,
1578 .name = "n_tty", 1578 .name = "n_tty",
1579 .open = n_tty_open, 1579 .open = n_tty_open,
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 197cd7a0c332..a22662b6a1a5 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -444,7 +444,7 @@ nvram_init(void)
444 444
445 /* First test whether the driver should init at all */ 445 /* First test whether the driver should init at all */
446 if (!CHECK_DRIVER_INIT()) 446 if (!CHECK_DRIVER_INIT())
447 return -ENXIO; 447 return -ENODEV;
448 448
449 ret = misc_register(&nvram_dev); 449 ret = misc_register(&nvram_dev);
450 if (ret) { 450 if (ret) {
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index fb2fb159faa3..b694d430f10e 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -514,8 +514,8 @@ static void ldisc_receive_buf(struct tty_struct *tty,
514 return; 514 return;
515 ld = tty_ldisc_ref(tty); 515 ld = tty_ldisc_ref(tty);
516 if (ld) { 516 if (ld) {
517 if (ld->receive_buf) 517 if (ld->ops->receive_buf)
518 ld->receive_buf(tty, data, flags, count); 518 ld->ops->receive_buf(tty, data, flags, count);
519 tty_ldisc_deref(ld); 519 tty_ldisc_deref(ld);
520 } 520 }
521} 521}
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 0a05c038ae6f..76b27932d229 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -111,7 +111,7 @@ static int pty_write(struct tty_struct * tty, const unsigned char *buf, int coun
111 c = to->receive_room; 111 c = to->receive_room;
112 if (c > count) 112 if (c > count)
113 c = count; 113 c = count;
114 to->ldisc.receive_buf(to, buf, NULL, c); 114 to->ldisc.ops->receive_buf(to, buf, NULL, c);
115 115
116 return c; 116 return c;
117} 117}
@@ -149,11 +149,11 @@ static int pty_chars_in_buffer(struct tty_struct *tty)
149 int count; 149 int count;
150 150
151 /* We should get the line discipline lock for "tty->link" */ 151 /* We should get the line discipline lock for "tty->link" */
152 if (!to || !to->ldisc.chars_in_buffer) 152 if (!to || !to->ldisc.ops->chars_in_buffer)
153 return 0; 153 return 0;
154 154
155 /* The ldisc must report 0 if no characters available to be read */ 155 /* The ldisc must report 0 if no characters available to be read */
156 count = to->ldisc.chars_in_buffer(to); 156 count = to->ldisc.ops->chars_in_buffer(to);
157 157
158 if (tty->driver->subtype == PTY_TYPE_SLAVE) return count; 158 if (tty->driver->subtype == PTY_TYPE_SLAVE) return count;
159 159
@@ -186,8 +186,8 @@ static void pty_flush_buffer(struct tty_struct *tty)
186 if (!to) 186 if (!to)
187 return; 187 return;
188 188
189 if (to->ldisc.flush_buffer) 189 if (to->ldisc.ops->flush_buffer)
190 to->ldisc.flush_buffer(to); 190 to->ldisc.ops->flush_buffer(to);
191 191
192 if (to->packet) { 192 if (to->packet) {
193 spin_lock_irqsave(&tty->ctrl_lock, flags); 193 spin_lock_irqsave(&tty->ctrl_lock, flags);
diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h
index a03a538a3efb..5ab51679caa2 100644
--- a/drivers/char/rio/cirrus.h
+++ b/drivers/char/rio/cirrus.h
@@ -35,9 +35,6 @@
35 ***************************************************************************/ 35 ***************************************************************************/
36 36
37#ifndef _cirrus_h 37#ifndef _cirrus_h
38#ifndef lint
39/* static char* _cirrus_h_sccs = "@(#)cirrus.h 1.16"; */
40#endif
41#define _cirrus_h 1 38#define _cirrus_h 1
42 39
43/* Bit fields for particular registers shared with driver */ 40/* Bit fields for particular registers shared with driver */
diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h
index c46b2fdb6626..9ed4f861675a 100644
--- a/drivers/char/rio/cmdblk.h
+++ b/drivers/char/rio/cmdblk.h
@@ -33,12 +33,6 @@
33#ifndef __rio_cmdblk_h__ 33#ifndef __rio_cmdblk_h__
34#define __rio_cmdblk_h__ 34#define __rio_cmdblk_h__
35 35
36#ifdef SCCS_LABELS
37#ifndef lint
38static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h 1.2";
39#endif
40#endif
41
42/* 36/*
43** the structure of a command block, used to queue commands destined for 37** the structure of a command block, used to queue commands destined for
44** a rup. 38** a rup.
diff --git a/drivers/char/rio/cmdpkt.h b/drivers/char/rio/cmdpkt.h
index 357ae5722436..c1e7a2798070 100644
--- a/drivers/char/rio/cmdpkt.h
+++ b/drivers/char/rio/cmdpkt.h
@@ -32,12 +32,6 @@
32#ifndef __rio_cmdpkt_h__ 32#ifndef __rio_cmdpkt_h__
33#define __rio_cmdpkt_h__ 33#define __rio_cmdpkt_h__
34 34
35#ifdef SCCS_LABELS
36#ifndef lint
37static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2";
38#endif
39#endif
40
41/* 35/*
42** overlays for the data area of a packet. Used in both directions 36** overlays for the data area of a packet. Used in both directions
43** (to build a packet to send, and to interpret a packet that arrives) 37** (to build a packet to send, and to interpret a packet that arrives)
diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h
index 6e63f8b2c479..4af90323fd00 100644
--- a/drivers/char/rio/daemon.h
+++ b/drivers/char/rio/daemon.h
@@ -33,12 +33,6 @@
33#ifndef __rio_daemon_h__ 33#ifndef __rio_daemon_h__
34#define __rio_daemon_h__ 34#define __rio_daemon_h__
35 35
36#ifdef SCCS_LABELS
37#ifndef lint
38static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3";
39#endif
40#endif
41
42 36
43/* 37/*
44** structures used on /dev/rio 38** structures used on /dev/rio
diff --git a/drivers/char/rio/errors.h b/drivers/char/rio/errors.h
index 1d0d89144337..bdb05234090a 100644
--- a/drivers/char/rio/errors.h
+++ b/drivers/char/rio/errors.h
@@ -33,12 +33,6 @@
33#ifndef __rio_errors_h__ 33#ifndef __rio_errors_h__
34#define __rio_errors_h__ 34#define __rio_errors_h__
35 35
36#ifdef SCCS_LABELS
37#ifndef lint
38static char *_errors_h_sccs_ = "@(#)errors.h 1.2";
39#endif
40#endif
41
42/* 36/*
43** error codes 37** error codes
44*/ 38*/
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h
index 9e7283bd81a0..078d44f85e45 100644
--- a/drivers/char/rio/func.h
+++ b/drivers/char/rio/func.h
@@ -35,12 +35,6 @@
35 35
36#include <linux/kdev_t.h> 36#include <linux/kdev_t.h>
37 37
38#ifdef SCCS_LABELS
39#ifndef lint
40static char *_func_h_sccs_ = "@(#)func.h 1.3";
41#endif
42#endif
43
44/* rioboot.c */ 38/* rioboot.c */
45int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); 39int RIOBootCodeRTA(struct rio_info *, struct DownLoad *);
46int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); 40int RIOBootCodeHOST(struct rio_info *, struct DownLoad *);
diff --git a/drivers/char/rio/map.h b/drivers/char/rio/map.h
index bdbcd09c8b81..8366978578c1 100644
--- a/drivers/char/rio/map.h
+++ b/drivers/char/rio/map.h
@@ -33,10 +33,6 @@
33#ifndef __rio_map_h__ 33#ifndef __rio_map_h__
34#define __rio_map_h__ 34#define __rio_map_h__
35 35
36#ifdef SCCS_LABELS
37static char *_map_h_sccs_ = "@(#)map.h 1.2";
38#endif
39
40/* 36/*
41** mapping structure passed to and from the config.rio program to 37** mapping structure passed to and from the config.rio program to
42** determine the current topology of the world 38** determine the current topology of the world
diff --git a/drivers/char/rio/param.h b/drivers/char/rio/param.h
index 675c200b2459..7e9b6283e8aa 100644
--- a/drivers/char/rio/param.h
+++ b/drivers/char/rio/param.h
@@ -33,11 +33,6 @@
33#ifndef __rio_param_h__ 33#ifndef __rio_param_h__
34#define __rio_param_h__ 34#define __rio_param_h__
35 35
36#ifdef SCCS_LABELS
37static char *_param_h_sccs_ = "@(#)param.h 1.2";
38#endif
39
40
41/* 36/*
42** the param command block, as used in OPEN and PARAM calls. 37** the param command block, as used in OPEN and PARAM calls.
43*/ 38*/
diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h
index 9764ef85c5a6..acc8fa439df5 100644
--- a/drivers/char/rio/parmmap.h
+++ b/drivers/char/rio/parmmap.h
@@ -37,13 +37,6 @@
37#ifndef _parmap_h 37#ifndef _parmap_h
38#define _parmap_h 38#define _parmap_h
39 39
40
41#ifdef SCCS_LABELS
42#ifndef lint
43/* static char *_rio_parmmap_h_sccs = "@(#)parmmap.h 1.4"; */
44#endif
45#endif
46
47typedef struct PARM_MAP PARM_MAP; 40typedef struct PARM_MAP PARM_MAP;
48 41
49struct PARM_MAP { 42struct PARM_MAP {
diff --git a/drivers/char/rio/pci.h b/drivers/char/rio/pci.h
index 1eba9118079b..6032f9135956 100644
--- a/drivers/char/rio/pci.h
+++ b/drivers/char/rio/pci.h
@@ -33,10 +33,6 @@
33#ifndef __rio_pci_h__ 33#ifndef __rio_pci_h__
34#define __rio_pci_h__ 34#define __rio_pci_h__
35 35
36#ifdef SCCS_LABELS
37static char *_pci_h_sccs_ = "@(#)pci.h 1.2";
38#endif
39
40/* 36/*
41** PCI stuff 37** PCI stuff
42*/ 38*/
diff --git a/drivers/char/rio/protsts.h b/drivers/char/rio/protsts.h
index 69fc4bc34153..8ab79401d3ee 100644
--- a/drivers/char/rio/protsts.h
+++ b/drivers/char/rio/protsts.h
@@ -37,13 +37,6 @@
37#ifndef _protsts_h 37#ifndef _protsts_h
38#define _protsts_h 1 38#define _protsts_h 1
39 39
40
41#ifdef SCCS_LABELS
42#ifndef lint
43/* static char *_rio_protsts_h_sccs = "@(#)protsts.h 1.4"; */
44#endif
45#endif
46
47/************************************************* 40/*************************************************
48 * ACK bit. Last Packet received OK. Set by 41 * ACK bit. Last Packet received OK. Set by
49 * rxpkt to indicate that the Packet has been 42 * rxpkt to indicate that the Packet has been
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 412777cd1e68..0cdfee152916 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -25,11 +25,6 @@
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, 25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
26 * USA. 26 * USA.
27 * 27 *
28 * Revision history:
29 * $Log: rio.c,v $
30 * Revision 1.1 1999/07/11 10:13:54 wolff
31 * Initial revision
32 *
33 * */ 28 * */
34 29
35#include <linux/module.h> 30#include <linux/module.h>
@@ -436,7 +431,7 @@ static void rio_disable_tx_interrupts(void *ptr)
436{ 431{
437 func_enter(); 432 func_enter();
438 433
439 /* port->gs.flags &= ~GS_TX_INTEN; */ 434 /* port->gs.port.flags &= ~GS_TX_INTEN; */
440 435
441 func_exit(); 436 func_exit();
442} 437}
@@ -460,7 +455,7 @@ static void rio_enable_tx_interrupts(void *ptr)
460 * In general we cannot count on "tx empty" interrupts, although 455 * In general we cannot count on "tx empty" interrupts, although
461 * the interrupt routine seems to be able to tell the difference. 456 * the interrupt routine seems to be able to tell the difference.
462 */ 457 */
463 PortP->gs.flags &= ~GS_TX_INTEN; 458 PortP->gs.port.flags &= ~GS_TX_INTEN;
464 459
465 func_exit(); 460 func_exit();
466} 461}
@@ -515,7 +510,7 @@ static void rio_shutdown_port(void *ptr)
515 func_enter(); 510 func_enter();
516 511
517 PortP = (struct Port *) ptr; 512 PortP = (struct Port *) ptr;
518 PortP->gs.tty = NULL; 513 PortP->gs.port.tty = NULL;
519 func_exit(); 514 func_exit();
520} 515}
521 516
@@ -534,7 +529,7 @@ static void rio_hungup(void *ptr)
534 func_enter(); 529 func_enter();
535 530
536 PortP = (struct Port *) ptr; 531 PortP = (struct Port *) ptr;
537 PortP->gs.tty = NULL; 532 PortP->gs.port.tty = NULL;
538 533
539 func_exit(); 534 func_exit();
540} 535}
@@ -554,12 +549,12 @@ static void rio_close(void *ptr)
554 549
555 riotclose(ptr); 550 riotclose(ptr);
556 551
557 if (PortP->gs.count) { 552 if (PortP->gs.port.count) {
558 printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count); 553 printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.port.count);
559 PortP->gs.count = 0; 554 PortP->gs.port.count = 0;
560 } 555 }
561 556
562 PortP->gs.tty = NULL; 557 PortP->gs.port.tty = NULL;
563 func_exit(); 558 func_exit();
564} 559}
565 560
@@ -854,8 +849,8 @@ static int rio_init_datastructures(void)
854 /* 849 /*
855 * Initializing wait queue 850 * Initializing wait queue
856 */ 851 */
857 init_waitqueue_head(&port->gs.open_wait); 852 init_waitqueue_head(&port->gs.port.open_wait);
858 init_waitqueue_head(&port->gs.close_wait); 853 init_waitqueue_head(&port->gs.port.close_wait);
859 } 854 }
860#else 855#else
861 /* We could postpone initializing them to when they are configured. */ 856 /* We could postpone initializing them to when they are configured. */
diff --git a/drivers/char/rio/rioboard.h b/drivers/char/rio/rioboard.h
index 822c071a693b..252230043c82 100644
--- a/drivers/char/rio/rioboard.h
+++ b/drivers/char/rio/rioboard.h
@@ -29,12 +29,6 @@
29/* */ 29/* */
30/************************************************************************/ 30/************************************************************************/
31 31
32/* History...
33
341.0.0 26/04/99 NPV Creation.
35
36*/
37
38#ifndef _rioboard_h /* If RIOBOARD.H not already defined */ 32#ifndef _rioboard_h /* If RIOBOARD.H not already defined */
39#define _rioboard_h 1 33#define _rioboard_h 1
40 34
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c
index 7b96e0814887..01f2654d5a2e 100644
--- a/drivers/char/rio/riocmd.c
+++ b/drivers/char/rio/riocmd.c
@@ -30,9 +30,6 @@
30** 30**
31** ----------------------------------------------------------------------------- 31** -----------------------------------------------------------------------------
32*/ 32*/
33#ifdef SCCS_LABELS
34static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2";
35#endif
36 33
37#include <linux/module.h> 34#include <linux/module.h>
38#include <linux/slab.h> 35#include <linux/slab.h>
@@ -487,12 +484,12 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
487 ** If the device is a modem, then check the modem 484 ** If the device is a modem, then check the modem
488 ** carrier. 485 ** carrier.
489 */ 486 */
490 if (PortP->gs.tty == NULL) 487 if (PortP->gs.port.tty == NULL)
491 break; 488 break;
492 if (PortP->gs.tty->termios == NULL) 489 if (PortP->gs.port.tty->termios == NULL)
493 break; 490 break;
494 491
495 if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) { 492 if (!(PortP->gs.port.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
496 493
497 rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n"); 494 rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
498 /* 495 /*
@@ -509,7 +506,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
509 ** wakeup anyone in WOPEN 506 ** wakeup anyone in WOPEN
510 */ 507 */
511 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) 508 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
512 wake_up_interruptible(&PortP->gs.open_wait); 509 wake_up_interruptible(&PortP->gs.port.open_wait);
513 } 510 }
514 } else { 511 } else {
515 /* 512 /*
@@ -517,7 +514,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc
517 */ 514 */
518 if (PortP->State & RIO_CARR_ON) { 515 if (PortP->State & RIO_CARR_ON) {
519 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN)) 516 if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
520 tty_hangup(PortP->gs.tty); 517 tty_hangup(PortP->gs.port.tty);
521 PortP->State &= ~RIO_CARR_ON; 518 PortP->State &= ~RIO_CARR_ON;
522 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); 519 rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
523 } 520 }
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index d65ceb9a434a..eecee0f576d2 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -29,10 +29,6 @@
29** 29**
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32#ifdef SCCS_LABELS
33static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3";
34#endif
35
36 32
37#include <linux/module.h> 33#include <linux/module.h>
38#include <linux/slab.h> 34#include <linux/slab.h>
diff --git a/drivers/char/rio/riodrvr.h b/drivers/char/rio/riodrvr.h
index 3cffe275f216..0907e711b355 100644
--- a/drivers/char/rio/riodrvr.h
+++ b/drivers/char/rio/riodrvr.h
@@ -35,10 +35,6 @@
35 35
36#include <asm/param.h> /* for HZ */ 36#include <asm/param.h> /* for HZ */
37 37
38#ifdef SCCS_LABELS
39static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3";
40#endif
41
42#define MEMDUMP_SIZE 32 38#define MEMDUMP_SIZE 32
43#define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT) 39#define MOD_DISABLE (RIO_NOREAD|RIO_NOWRITE|RIO_NOXPRINT)
44 40
diff --git a/drivers/char/rio/rioinfo.h b/drivers/char/rio/rioinfo.h
index 8de7966e603a..42ff1e79d96f 100644
--- a/drivers/char/rio/rioinfo.h
+++ b/drivers/char/rio/rioinfo.h
@@ -33,10 +33,6 @@
33#ifndef __rioinfo_h 33#ifndef __rioinfo_h
34#define __rioinfo_h 34#define __rioinfo_h
35 35
36#ifdef SCCS_LABELS
37static char *_rioinfo_h_sccs_ = "@(#)rioinfo.h 1.2";
38#endif
39
40/* 36/*
41** Host card data structure 37** Host card data structure
42*/ 38*/
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c
index add1718295ef..be0ba401966e 100644
--- a/drivers/char/rio/rioinit.c
+++ b/drivers/char/rio/rioinit.c
@@ -29,9 +29,6 @@
29** 29**
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32#ifdef SCCS_LABELS
33static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3";
34#endif
35 32
36#include <linux/module.h> 33#include <linux/module.h>
37#include <linux/slab.h> 34#include <linux/slab.h>
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c
index ea21686c69a4..71f87600907c 100644
--- a/drivers/char/rio/riointr.c
+++ b/drivers/char/rio/riointr.c
@@ -29,10 +29,6 @@
29** 29**
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32#ifdef SCCS_LABELS
33static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2";
34#endif
35
36 32
37#include <linux/module.h> 33#include <linux/module.h>
38#include <linux/slab.h> 34#include <linux/slab.h>
@@ -106,7 +102,7 @@ void RIOTxEnable(char *en)
106 102
107 PortP = (struct Port *) en; 103 PortP = (struct Port *) en;
108 p = (struct rio_info *) PortP->p; 104 p = (struct rio_info *) PortP->p;
109 tty = PortP->gs.tty; 105 tty = PortP->gs.port.tty;
110 106
111 107
112 rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt); 108 rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
@@ -162,7 +158,7 @@ void RIOTxEnable(char *en)
162 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 158 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
163 159
164 if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) 160 if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN))
165 tty_wakeup(PortP->gs.tty); 161 tty_wakeup(PortP->gs.port.tty);
166 162
167} 163}
168 164
@@ -245,7 +241,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
245 ** find corresponding tty structure. The process of mapping 241 ** find corresponding tty structure. The process of mapping
246 ** the ports puts these here. 242 ** the ports puts these here.
247 */ 243 */
248 ttyP = PortP->gs.tty; 244 ttyP = PortP->gs.port.tty;
249 245
250 /* 246 /*
251 ** Lock the port before we begin working on it. 247 ** Lock the port before we begin working on it.
@@ -339,7 +335,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP)
339 ** find corresponding tty structure. The process of mapping 335 ** find corresponding tty structure. The process of mapping
340 ** the ports puts these here. 336 ** the ports puts these here.
341 */ 337 */
342 ttyP = PortP->gs.tty; 338 ttyP = PortP->gs.port.tty;
343 /* If ttyP is NULL, the port is getting closed. Forget about it. */ 339 /* If ttyP is NULL, the port is getting closed. Forget about it. */
344 if (!ttyP) { 340 if (!ttyP) {
345 rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n"); 341 rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
@@ -546,7 +542,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP)
546 542
547 intCount++; 543 intCount++;
548 544
549 TtyP = PortP->gs.tty; 545 TtyP = PortP->gs.port.tty;
550 if (!TtyP) { 546 if (!TtyP) {
551 rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n"); 547 rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
552 return; 548 return;
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c
index 4810b845cc21..d687c17be152 100644
--- a/drivers/char/rio/rioparam.c
+++ b/drivers/char/rio/rioparam.c
@@ -30,10 +30,6 @@
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32 32
33#ifdef SCCS_LABELS
34static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3";
35#endif
36
37#include <linux/module.h> 33#include <linux/module.h>
38#include <linux/slab.h> 34#include <linux/slab.h>
39#include <linux/errno.h> 35#include <linux/errno.h>
@@ -164,7 +160,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)
164 160
165 func_enter(); 161 func_enter();
166 162
167 TtyP = PortP->gs.tty; 163 TtyP = PortP->gs.port.tty;
168 164
169 rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP); 165 rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
170 166
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c
index 7a9df7dcf9a8..706c2a25f7aa 100644
--- a/drivers/char/rio/rioroute.c
+++ b/drivers/char/rio/rioroute.c
@@ -29,9 +29,6 @@
29** 29**
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32#ifdef SCCS_LABELS
33static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3";
34#endif
35 32
36#include <linux/module.h> 33#include <linux/module.h>
37#include <linux/slab.h> 34#include <linux/slab.h>
diff --git a/drivers/char/rio/riospace.h b/drivers/char/rio/riospace.h
index 534f1f5b9f53..ffb31d4332b9 100644
--- a/drivers/char/rio/riospace.h
+++ b/drivers/char/rio/riospace.h
@@ -33,10 +33,6 @@
33#ifndef __rio_riospace_h__ 33#ifndef __rio_riospace_h__
34#define __rio_riospace_h__ 34#define __rio_riospace_h__
35 35
36#ifdef SCCS_LABELS
37static char *_riospace_h_sccs_ = "@(#)riospace.h 1.2";
38#endif
39
40#define RIO_LOCATOR_LEN 16 36#define RIO_LOCATOR_LEN 16
41#define MAX_RIO_BOARDS 4 37#define MAX_RIO_BOARDS 4
42 38
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c
index 2b24488e95f2..3d15802dc0f3 100644
--- a/drivers/char/rio/riotable.c
+++ b/drivers/char/rio/riotable.c
@@ -29,9 +29,6 @@
29** 29**
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32#ifdef SCCS_LABELS
33static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2";
34#endif
35 32
36#include <linux/module.h> 33#include <linux/module.h>
37#include <linux/slab.h> 34#include <linux/slab.h>
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c
index c99354843be1..2fb49e89b324 100644
--- a/drivers/char/rio/riotty.c
+++ b/drivers/char/rio/riotty.c
@@ -29,10 +29,6 @@
29** 29**
30** ----------------------------------------------------------------------------- 30** -----------------------------------------------------------------------------
31*/ 31*/
32#ifdef SCCS_LABELS
33static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3";
34#endif
35
36 32
37#define __EXPLICIT_DEF_H__ 33#define __EXPLICIT_DEF_H__
38 34
@@ -144,14 +140,14 @@ int riotopen(struct tty_struct *tty, struct file *filp)
144 140
145 tty->driver_data = PortP; 141 tty->driver_data = PortP;
146 142
147 PortP->gs.tty = tty; 143 PortP->gs.port.tty = tty;
148 PortP->gs.count++; 144 PortP->gs.port.count++;
149 145
150 rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt); 146 rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
151 147
152 retval = gs_init_port(&PortP->gs); 148 retval = gs_init_port(&PortP->gs);
153 if (retval) { 149 if (retval) {
154 PortP->gs.count--; 150 PortP->gs.port.count--;
155 return -ENXIO; 151 return -ENXIO;
156 } 152 }
157 /* 153 /*
@@ -297,7 +293,7 @@ int riotopen(struct tty_struct *tty, struct file *filp)
297 ** insert test for carrier here. -- ??? 293 ** insert test for carrier here. -- ???
298 ** I already see that test here. What's the deal? -- REW 294 ** I already see that test here. What's the deal? -- REW
299 */ 295 */
300 if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || 296 if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) ||
301 (PortP->ModemState & RIOC_MSVR1_CD)) { 297 (PortP->ModemState & RIOC_MSVR1_CD)) {
302 rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); 298 rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
303 /* 299 /*
@@ -305,16 +301,16 @@ int riotopen(struct tty_struct *tty, struct file *filp)
305 wakeup((caddr_t) &tp->tm.c_canq); 301 wakeup((caddr_t) &tp->tm.c_canq);
306 */ 302 */
307 PortP->State |= RIO_CARR_ON; 303 PortP->State |= RIO_CARR_ON;
308 wake_up_interruptible(&PortP->gs.open_wait); 304 wake_up_interruptible(&PortP->gs.port.open_wait);
309 } else { /* no carrier - wait for DCD */ 305 } else { /* no carrier - wait for DCD */
310 /* 306 /*
311 while (!(PortP->gs.tty->termios->c_state & CARR_ON) && 307 while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) &&
312 !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) 308 !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
313 */ 309 */
314 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { 310 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
315 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); 311 rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
316 /* 312 /*
317 PortP->gs.tty->termios->c_state |= WOPEN; 313 PortP->gs.port.tty->termios->c_state |= WOPEN;
318 */ 314 */
319 PortP->State |= RIO_WOPEN; 315 PortP->State |= RIO_WOPEN;
320 rio_spin_unlock_irqrestore(&PortP->portSem, flags); 316 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
@@ -384,7 +380,7 @@ int riotclose(void *ptr)
384 /* PortP = p->RIOPortp[SysPort]; */ 380 /* PortP = p->RIOPortp[SysPort]; */
385 rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); 381 rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
386 /* tp = PortP->TtyP; *//* Get tty */ 382 /* tp = PortP->TtyP; *//* Get tty */
387 tty = PortP->gs.tty; 383 tty = PortP->gs.port.tty;
388 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); 384 rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
389 385
390 if (PortP->gs.closing_wait) 386 if (PortP->gs.closing_wait)
diff --git a/drivers/char/rio/route.h b/drivers/char/rio/route.h
index 769744e575ab..20ed73f3fd7b 100644
--- a/drivers/char/rio/route.h
+++ b/drivers/char/rio/route.h
@@ -37,12 +37,6 @@
37#ifndef _route_h 37#ifndef _route_h
38#define _route_h 38#define _route_h
39 39
40#ifdef SCCS_LABELS
41#ifndef lint
42/* static char *_rio_route_h_sccs = "@(#)route.h 1.3"; */
43#endif
44#endif
45
46#define MAX_LINKS 4 40#define MAX_LINKS 4
47#define MAX_NODES 17 /* Maximum nodes in a subnet */ 41#define MAX_NODES 17 /* Maximum nodes in a subnet */
48#define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for 42#define NODE_BYTES ((MAX_NODES / 8) + 1) /* Number of bytes needed for
diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h
index 46bd532f7746..7abf0cba0f2c 100644
--- a/drivers/char/rio/unixrup.h
+++ b/drivers/char/rio/unixrup.h
@@ -33,10 +33,6 @@
33#ifndef __rio_unixrup_h__ 33#ifndef __rio_unixrup_h__
34#define __rio_unixrup_h__ 34#define __rio_unixrup_h__
35 35
36#ifdef SCCS_LABELS
37static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2";
38#endif
39
40/* 36/*
41** UnixRup data structure. This contains pointers to actual RUPs on the 37** UnixRup data structure. This contains pointers to actual RUPs on the
42** host card, and all the command/boot control stuff. 38** host card, and all the command/boot control stuff.
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index f073c710ab8d..724b2b20f4b2 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -322,7 +322,7 @@ static struct riscom_port *rc_get_port(struct riscom_board const *bp,
322 channel = rc_in(bp, CD180_GICR) >> GICR_CHAN_OFF; 322 channel = rc_in(bp, CD180_GICR) >> GICR_CHAN_OFF;
323 if (channel < CD180_NCH) { 323 if (channel < CD180_NCH) {
324 port = &rc_port[board_No(bp) * RC_NPORT + channel]; 324 port = &rc_port[board_No(bp) * RC_NPORT + channel];
325 if (port->flags & ASYNC_INITIALIZED) 325 if (port->port.flags & ASYNC_INITIALIZED)
326 return port; 326 return port;
327 } 327 }
328 printk(KERN_ERR "rc%d: %s interrupt from invalid port %d\n", 328 printk(KERN_ERR "rc%d: %s interrupt from invalid port %d\n",
@@ -341,7 +341,7 @@ static void rc_receive_exc(struct riscom_board const *bp)
341 if (port == NULL) 341 if (port == NULL)
342 return; 342 return;
343 343
344 tty = port->tty; 344 tty = port->port.tty;
345 345
346#ifdef RC_REPORT_OVERRUN 346#ifdef RC_REPORT_OVERRUN
347 status = rc_in(bp, CD180_RCSR); 347 status = rc_in(bp, CD180_RCSR);
@@ -364,7 +364,7 @@ static void rc_receive_exc(struct riscom_board const *bp)
364 printk(KERN_INFO "rc%d: port %d: Handling break...\n", 364 printk(KERN_INFO "rc%d: port %d: Handling break...\n",
365 board_No(bp), port_No(port)); 365 board_No(bp), port_No(port));
366 flag = TTY_BREAK; 366 flag = TTY_BREAK;
367 if (port->flags & ASYNC_SAK) 367 if (port->port.flags & ASYNC_SAK)
368 do_SAK(tty); 368 do_SAK(tty);
369 369
370 } else if (status & RCSR_PE) 370 } else if (status & RCSR_PE)
@@ -392,7 +392,7 @@ static void rc_receive(struct riscom_board const *bp)
392 if (port == NULL) 392 if (port == NULL)
393 return; 393 return;
394 394
395 tty = port->tty; 395 tty = port->port.tty;
396 396
397 count = rc_in(bp, CD180_RDCR); 397 count = rc_in(bp, CD180_RDCR);
398 398
@@ -422,7 +422,7 @@ static void rc_transmit(struct riscom_board const *bp)
422 if (port == NULL) 422 if (port == NULL)
423 return; 423 return;
424 424
425 tty = port->tty; 425 tty = port->port.tty;
426 426
427 if (port->IER & IER_TXEMPTY) { 427 if (port->IER & IER_TXEMPTY) {
428 /* FIFO drained */ 428 /* FIFO drained */
@@ -467,7 +467,7 @@ static void rc_transmit(struct riscom_board const *bp)
467 467
468 count = CD180_NFIFO; 468 count = CD180_NFIFO;
469 do { 469 do {
470 rc_out(bp, CD180_TDR, port->xmit_buf[port->xmit_tail++]); 470 rc_out(bp, CD180_TDR, port->port.xmit_buf[port->xmit_tail++]);
471 port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE-1); 471 port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE-1);
472 if (--port->xmit_cnt <= 0) 472 if (--port->xmit_cnt <= 0)
473 break; 473 break;
@@ -492,12 +492,12 @@ static void rc_check_modem(struct riscom_board const *bp)
492 if (port == NULL) 492 if (port == NULL)
493 return; 493 return;
494 494
495 tty = port->tty; 495 tty = port->port.tty;
496 496
497 mcr = rc_in(bp, CD180_MCR); 497 mcr = rc_in(bp, CD180_MCR);
498 if (mcr & MCR_CDCHG) { 498 if (mcr & MCR_CDCHG) {
499 if (rc_in(bp, CD180_MSVR) & MSVR_CD) 499 if (rc_in(bp, CD180_MSVR) & MSVR_CD)
500 wake_up_interruptible(&port->open_wait); 500 wake_up_interruptible(&port->port.open_wait);
501 else 501 else
502 tty_hangup(tty); 502 tty_hangup(tty);
503 } 503 }
@@ -632,15 +632,12 @@ static void rc_shutdown_board(struct riscom_board *bp)
632 */ 632 */
633static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port) 633static void rc_change_speed(struct riscom_board *bp, struct riscom_port *port)
634{ 634{
635 struct tty_struct *tty = port->tty; 635 struct tty_struct *tty = port->port.tty;
636 unsigned long baud; 636 unsigned long baud;
637 long tmp; 637 long tmp;
638 unsigned char cor1 = 0, cor3 = 0; 638 unsigned char cor1 = 0, cor3 = 0;
639 unsigned char mcor1 = 0, mcor2 = 0; 639 unsigned char mcor1 = 0, mcor2 = 0;
640 640
641 if (tty == NULL || tty->termios == NULL)
642 return;
643
644 port->IER = 0; 641 port->IER = 0;
645 port->COR2 = 0; 642 port->COR2 = 0;
646 port->MSVR = MSVR_RTS; 643 port->MSVR = MSVR_RTS;
@@ -786,39 +783,30 @@ static int rc_setup_port(struct riscom_board *bp, struct riscom_port *port)
786{ 783{
787 unsigned long flags; 784 unsigned long flags;
788 785
789 if (port->flags & ASYNC_INITIALIZED) 786 if (port->port.flags & ASYNC_INITIALIZED)
790 return 0; 787 return 0;
791 788
792 if (!port->xmit_buf) { 789 if (tty_port_alloc_xmit_buf(&port->port) < 0)
793 /* We may sleep in get_zeroed_page() */ 790 return -ENOMEM;
794 unsigned long tmp = get_zeroed_page(GFP_KERNEL); 791
795 if (tmp == 0)
796 return -ENOMEM;
797 if (port->xmit_buf)
798 free_page(tmp);
799 else
800 port->xmit_buf = (unsigned char *) tmp;
801 }
802 spin_lock_irqsave(&riscom_lock, flags); 792 spin_lock_irqsave(&riscom_lock, flags);
803 793
804 if (port->tty) 794 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
805 clear_bit(TTY_IO_ERROR, &port->tty->flags); 795 if (port->port.count == 1)
806 if (port->count == 1)
807 bp->count++; 796 bp->count++;
808 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 797 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
809 rc_change_speed(bp, port); 798 rc_change_speed(bp, port);
810 port->flags |= ASYNC_INITIALIZED; 799 port->port.flags |= ASYNC_INITIALIZED;
811 800
812 spin_unlock_irqrestore(&riscom_lock, flags); 801 spin_unlock_irqrestore(&riscom_lock, flags);
813 return 0; 802 return 0;
814} 803}
815 804
816/* Must be called with interrupts disabled */ 805/* Must be called with interrupts disabled */
817static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port) 806static void rc_shutdown_port(struct tty_struct *tty,
807 struct riscom_board *bp, struct riscom_port *port)
818{ 808{
819 struct tty_struct *tty; 809 if (!(port->port.flags & ASYNC_INITIALIZED))
820
821 if (!(port->flags & ASYNC_INITIALIZED))
822 return; 810 return;
823 811
824#ifdef RC_REPORT_OVERRUN 812#ifdef RC_REPORT_OVERRUN
@@ -836,14 +824,8 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
836 printk("].\n"); 824 printk("].\n");
837 } 825 }
838#endif 826#endif
839 if (port->xmit_buf) { 827 tty_port_free_xmit_buf(&port->port);
840 free_page((unsigned long) port->xmit_buf); 828 if (C_HUPCL(tty)) {
841 port->xmit_buf = NULL;
842 }
843
844 tty = port->tty;
845
846 if (tty == NULL || C_HUPCL(tty)) {
847 /* Drop DTR */ 829 /* Drop DTR */
848 bp->DTR |= (1u << port_No(port)); 830 bp->DTR |= (1u << port_No(port));
849 rc_out(bp, RC_DTR, bp->DTR); 831 rc_out(bp, RC_DTR, bp->DTR);
@@ -858,9 +840,8 @@ static void rc_shutdown_port(struct riscom_board *bp, struct riscom_port *port)
858 port->IER = 0; 840 port->IER = 0;
859 rc_out(bp, CD180_IER, port->IER); 841 rc_out(bp, CD180_IER, port->IER);
860 842
861 if (tty) 843 set_bit(TTY_IO_ERROR, &tty->flags);
862 set_bit(TTY_IO_ERROR, &tty->flags); 844 port->port.flags &= ~ASYNC_INITIALIZED;
863 port->flags &= ~ASYNC_INITIALIZED;
864 845
865 if (--bp->count < 0) { 846 if (--bp->count < 0) {
866 printk(KERN_INFO "rc%d: rc_shutdown_port: " 847 printk(KERN_INFO "rc%d: rc_shutdown_port: "
@@ -890,9 +871,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
890 * If the device is in the middle of being closed, then block 871 * If the device is in the middle of being closed, then block
891 * until it's done, and then try again. 872 * until it's done, and then try again.
892 */ 873 */
893 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { 874 if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
894 interruptible_sleep_on(&port->close_wait); 875 interruptible_sleep_on(&port->port.close_wait);
895 if (port->flags & ASYNC_HUP_NOTIFY) 876 if (port->port.flags & ASYNC_HUP_NOTIFY)
896 return -EAGAIN; 877 return -EAGAIN;
897 else 878 else
898 return -ERESTARTSYS; 879 return -ERESTARTSYS;
@@ -904,7 +885,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
904 */ 885 */
905 if ((filp->f_flags & O_NONBLOCK) || 886 if ((filp->f_flags & O_NONBLOCK) ||
906 (tty->flags & (1 << TTY_IO_ERROR))) { 887 (tty->flags & (1 << TTY_IO_ERROR))) {
907 port->flags |= ASYNC_NORMAL_ACTIVE; 888 port->port.flags |= ASYNC_NORMAL_ACTIVE;
908 return 0; 889 return 0;
909 } 890 }
910 891
@@ -919,16 +900,16 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
919 * exit, either normal or abnormal. 900 * exit, either normal or abnormal.
920 */ 901 */
921 retval = 0; 902 retval = 0;
922 add_wait_queue(&port->open_wait, &wait); 903 add_wait_queue(&port->port.open_wait, &wait);
923 904
924 spin_lock_irqsave(&riscom_lock, flags); 905 spin_lock_irqsave(&riscom_lock, flags);
925 906
926 if (!tty_hung_up_p(filp)) 907 if (!tty_hung_up_p(filp))
927 port->count--; 908 port->port.count--;
928 909
929 spin_unlock_irqrestore(&riscom_lock, flags); 910 spin_unlock_irqrestore(&riscom_lock, flags);
930 911
931 port->blocked_open++; 912 port->port.blocked_open++;
932 while (1) { 913 while (1) {
933 spin_lock_irqsave(&riscom_lock, flags); 914 spin_lock_irqsave(&riscom_lock, flags);
934 915
@@ -942,14 +923,14 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
942 923
943 set_current_state(TASK_INTERRUPTIBLE); 924 set_current_state(TASK_INTERRUPTIBLE);
944 if (tty_hung_up_p(filp) || 925 if (tty_hung_up_p(filp) ||
945 !(port->flags & ASYNC_INITIALIZED)) { 926 !(port->port.flags & ASYNC_INITIALIZED)) {
946 if (port->flags & ASYNC_HUP_NOTIFY) 927 if (port->port.flags & ASYNC_HUP_NOTIFY)
947 retval = -EAGAIN; 928 retval = -EAGAIN;
948 else 929 else
949 retval = -ERESTARTSYS; 930 retval = -ERESTARTSYS;
950 break; 931 break;
951 } 932 }
952 if (!(port->flags & ASYNC_CLOSING) && 933 if (!(port->port.flags & ASYNC_CLOSING) &&
953 (do_clocal || CD)) 934 (do_clocal || CD))
954 break; 935 break;
955 if (signal_pending(current)) { 936 if (signal_pending(current)) {
@@ -959,14 +940,14 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
959 schedule(); 940 schedule();
960 } 941 }
961 __set_current_state(TASK_RUNNING); 942 __set_current_state(TASK_RUNNING);
962 remove_wait_queue(&port->open_wait, &wait); 943 remove_wait_queue(&port->port.open_wait, &wait);
963 if (!tty_hung_up_p(filp)) 944 if (!tty_hung_up_p(filp))
964 port->count++; 945 port->port.count++;
965 port->blocked_open--; 946 port->port.blocked_open--;
966 if (retval) 947 if (retval)
967 return retval; 948 return retval;
968 949
969 port->flags |= ASYNC_NORMAL_ACTIVE; 950 port->port.flags |= ASYNC_NORMAL_ACTIVE;
970 return 0; 951 return 0;
971} 952}
972 953
@@ -990,9 +971,9 @@ static int rc_open(struct tty_struct *tty, struct file *filp)
990 if (error) 971 if (error)
991 return error; 972 return error;
992 973
993 port->count++; 974 port->port.count++;
994 tty->driver_data = port; 975 tty->driver_data = port;
995 port->tty = tty; 976 port->port.tty = tty;
996 977
997 error = rc_setup_port(bp, port); 978 error = rc_setup_port(bp, port);
998 if (error == 0) 979 if (error == 0)
@@ -1031,28 +1012,28 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
1031 goto out; 1012 goto out;
1032 1013
1033 bp = port_Board(port); 1014 bp = port_Board(port);
1034 if ((tty->count == 1) && (port->count != 1)) { 1015 if ((tty->count == 1) && (port->port.count != 1)) {
1035 printk(KERN_INFO "rc%d: rc_close: bad port count;" 1016 printk(KERN_INFO "rc%d: rc_close: bad port count;"
1036 " tty->count is 1, port count is %d\n", 1017 " tty->count is 1, port count is %d\n",
1037 board_No(bp), port->count); 1018 board_No(bp), port->port.count);
1038 port->count = 1; 1019 port->port.count = 1;
1039 } 1020 }
1040 if (--port->count < 0) { 1021 if (--port->port.count < 0) {
1041 printk(KERN_INFO "rc%d: rc_close: bad port count " 1022 printk(KERN_INFO "rc%d: rc_close: bad port count "
1042 "for tty%d: %d\n", 1023 "for tty%d: %d\n",
1043 board_No(bp), port_No(port), port->count); 1024 board_No(bp), port_No(port), port->port.count);
1044 port->count = 0; 1025 port->port.count = 0;
1045 } 1026 }
1046 if (port->count) 1027 if (port->port.count)
1047 goto out; 1028 goto out;
1048 port->flags |= ASYNC_CLOSING; 1029 port->port.flags |= ASYNC_CLOSING;
1049 /* 1030 /*
1050 * Now we wait for the transmit buffer to clear; and we notify 1031 * Now we wait for the transmit buffer to clear; and we notify
1051 * the line discipline to only process XON/XOFF characters. 1032 * the line discipline to only process XON/XOFF characters.
1052 */ 1033 */
1053 tty->closing = 1; 1034 tty->closing = 1;
1054 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) 1035 if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE)
1055 tty_wait_until_sent(tty, port->closing_wait); 1036 tty_wait_until_sent(tty, port->port.closing_wait);
1056 /* 1037 /*
1057 * At this point we stop accepting input. To do this, we 1038 * At this point we stop accepting input. To do this, we
1058 * disable the receive line status interrupts, and tell the 1039 * disable the receive line status interrupts, and tell the
@@ -1060,7 +1041,7 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
1060 * line status register. 1041 * line status register.
1061 */ 1042 */
1062 port->IER &= ~IER_RXD; 1043 port->IER &= ~IER_RXD;
1063 if (port->flags & ASYNC_INITIALIZED) { 1044 if (port->port.flags & ASYNC_INITIALIZED) {
1064 port->IER &= ~IER_TXRDY; 1045 port->IER &= ~IER_TXRDY;
1065 port->IER |= IER_TXEMPTY; 1046 port->IER |= IER_TXEMPTY;
1066 rc_out(bp, CD180_CAR, port_No(port)); 1047 rc_out(bp, CD180_CAR, port_No(port));
@@ -1077,19 +1058,19 @@ static void rc_close(struct tty_struct *tty, struct file *filp)
1077 break; 1058 break;
1078 } 1059 }
1079 } 1060 }
1080 rc_shutdown_port(bp, port); 1061 rc_shutdown_port(tty, bp, port);
1081 rc_flush_buffer(tty); 1062 rc_flush_buffer(tty);
1082 tty_ldisc_flush(tty); 1063 tty_ldisc_flush(tty);
1083 1064
1084 tty->closing = 0; 1065 tty->closing = 0;
1085 port->tty = NULL; 1066 port->port.tty = NULL;
1086 if (port->blocked_open) { 1067 if (port->port.blocked_open) {
1087 if (port->close_delay) 1068 if (port->port.close_delay)
1088 msleep_interruptible(jiffies_to_msecs(port->close_delay)); 1069 msleep_interruptible(jiffies_to_msecs(port->port.close_delay));
1089 wake_up_interruptible(&port->open_wait); 1070 wake_up_interruptible(&port->port.open_wait);
1090 } 1071 }
1091 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1072 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1092 wake_up_interruptible(&port->close_wait); 1073 wake_up_interruptible(&port->port.close_wait);
1093 1074
1094out: 1075out:
1095 spin_unlock_irqrestore(&riscom_lock, flags); 1076 spin_unlock_irqrestore(&riscom_lock, flags);
@@ -1108,9 +1089,6 @@ static int rc_write(struct tty_struct *tty,
1108 1089
1109 bp = port_Board(port); 1090 bp = port_Board(port);
1110 1091
1111 if (!tty || !port->xmit_buf)
1112 return 0;
1113
1114 while (1) { 1092 while (1) {
1115 spin_lock_irqsave(&riscom_lock, flags); 1093 spin_lock_irqsave(&riscom_lock, flags);
1116 1094
@@ -1119,7 +1097,7 @@ static int rc_write(struct tty_struct *tty,
1119 if (c <= 0) 1097 if (c <= 0)
1120 break; /* lock continues to be held */ 1098 break; /* lock continues to be held */
1121 1099
1122 memcpy(port->xmit_buf + port->xmit_head, buf, c); 1100 memcpy(port->port.xmit_buf + port->xmit_head, buf, c);
1123 port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1); 1101 port->xmit_head = (port->xmit_head + c) & (SERIAL_XMIT_SIZE-1);
1124 port->xmit_cnt += c; 1102 port->xmit_cnt += c;
1125 1103
@@ -1151,15 +1129,12 @@ static int rc_put_char(struct tty_struct *tty, unsigned char ch)
1151 if (rc_paranoia_check(port, tty->name, "rc_put_char")) 1129 if (rc_paranoia_check(port, tty->name, "rc_put_char"))
1152 return 0; 1130 return 0;
1153 1131
1154 if (!tty || !port->xmit_buf)
1155 return 0;
1156
1157 spin_lock_irqsave(&riscom_lock, flags); 1132 spin_lock_irqsave(&riscom_lock, flags);
1158 1133
1159 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1) 1134 if (port->xmit_cnt >= SERIAL_XMIT_SIZE - 1)
1160 goto out; 1135 goto out;
1161 1136
1162 port->xmit_buf[port->xmit_head++] = ch; 1137 port->port.xmit_buf[port->xmit_head++] = ch;
1163 port->xmit_head &= SERIAL_XMIT_SIZE - 1; 1138 port->xmit_head &= SERIAL_XMIT_SIZE - 1;
1164 port->xmit_cnt++; 1139 port->xmit_cnt++;
1165 ret = 1; 1140 ret = 1;
@@ -1177,8 +1152,7 @@ static void rc_flush_chars(struct tty_struct *tty)
1177 if (rc_paranoia_check(port, tty->name, "rc_flush_chars")) 1152 if (rc_paranoia_check(port, tty->name, "rc_flush_chars"))
1178 return; 1153 return;
1179 1154
1180 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || 1155 if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped)
1181 !port->xmit_buf)
1182 return; 1156 return;
1183 1157
1184 spin_lock_irqsave(&riscom_lock, flags); 1158 spin_lock_irqsave(&riscom_lock, flags);
@@ -1317,22 +1291,22 @@ static int rc_set_serial_info(struct riscom_port *port,
1317 return -EINVAL; 1291 return -EINVAL;
1318#endif 1292#endif
1319 1293
1320 change_speed = ((port->flags & ASYNC_SPD_MASK) != 1294 change_speed = ((port->port.flags & ASYNC_SPD_MASK) !=
1321 (tmp.flags & ASYNC_SPD_MASK)); 1295 (tmp.flags & ASYNC_SPD_MASK));
1322 1296
1323 if (!capable(CAP_SYS_ADMIN)) { 1297 if (!capable(CAP_SYS_ADMIN)) {
1324 if ((tmp.close_delay != port->close_delay) || 1298 if ((tmp.close_delay != port->port.close_delay) ||
1325 (tmp.closing_wait != port->closing_wait) || 1299 (tmp.closing_wait != port->port.closing_wait) ||
1326 ((tmp.flags & ~ASYNC_USR_MASK) != 1300 ((tmp.flags & ~ASYNC_USR_MASK) !=
1327 (port->flags & ~ASYNC_USR_MASK))) 1301 (port->port.flags & ~ASYNC_USR_MASK)))
1328 return -EPERM; 1302 return -EPERM;
1329 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1303 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
1330 (tmp.flags & ASYNC_USR_MASK)); 1304 (tmp.flags & ASYNC_USR_MASK));
1331 } else { 1305 } else {
1332 port->flags = ((port->flags & ~ASYNC_FLAGS) | 1306 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1333 (tmp.flags & ASYNC_FLAGS)); 1307 (tmp.flags & ASYNC_FLAGS));
1334 port->close_delay = tmp.close_delay; 1308 port->port.close_delay = tmp.close_delay;
1335 port->closing_wait = tmp.closing_wait; 1309 port->port.closing_wait = tmp.closing_wait;
1336 } 1310 }
1337 if (change_speed) { 1311 if (change_speed) {
1338 unsigned long flags; 1312 unsigned long flags;
@@ -1355,10 +1329,10 @@ static int rc_get_serial_info(struct riscom_port *port,
1355 tmp.line = port - rc_port; 1329 tmp.line = port - rc_port;
1356 tmp.port = bp->base; 1330 tmp.port = bp->base;
1357 tmp.irq = bp->irq; 1331 tmp.irq = bp->irq;
1358 tmp.flags = port->flags; 1332 tmp.flags = port->port.flags;
1359 tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC; 1333 tmp.baud_base = (RC_OSCFREQ + CD180_TPC/2) / CD180_TPC;
1360 tmp.close_delay = port->close_delay * HZ/100; 1334 tmp.close_delay = port->port.close_delay * HZ/100;
1361 tmp.closing_wait = port->closing_wait * HZ/100; 1335 tmp.closing_wait = port->port.closing_wait * HZ/100;
1362 tmp.xmit_fifo_size = CD180_NFIFO; 1336 tmp.xmit_fifo_size = CD180_NFIFO;
1363 return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0; 1337 return copy_to_user(retinfo, &tmp, sizeof(tmp)) ? -EFAULT : 0;
1364} 1338}
@@ -1480,7 +1454,7 @@ static void rc_start(struct tty_struct *tty)
1480 1454
1481 spin_lock_irqsave(&riscom_lock, flags); 1455 spin_lock_irqsave(&riscom_lock, flags);
1482 1456
1483 if (port->xmit_cnt && port->xmit_buf && !(port->IER & IER_TXRDY)) { 1457 if (port->xmit_cnt && port->port.xmit_buf && !(port->IER & IER_TXRDY)) {
1484 port->IER |= IER_TXRDY; 1458 port->IER |= IER_TXRDY;
1485 rc_out(bp, CD180_CAR, port_No(port)); 1459 rc_out(bp, CD180_CAR, port_No(port));
1486 rc_out(bp, CD180_IER, port->IER); 1460 rc_out(bp, CD180_IER, port->IER);
@@ -1498,11 +1472,11 @@ static void rc_hangup(struct tty_struct *tty)
1498 1472
1499 bp = port_Board(port); 1473 bp = port_Board(port);
1500 1474
1501 rc_shutdown_port(bp, port); 1475 rc_shutdown_port(tty, bp, port);
1502 port->count = 0; 1476 port->port.count = 0;
1503 port->flags &= ~ASYNC_NORMAL_ACTIVE; 1477 port->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1504 port->tty = NULL; 1478 port->port.tty = NULL;
1505 wake_up_interruptible(&port->open_wait); 1479 wake_up_interruptible(&port->port.open_wait);
1506} 1480}
1507 1481
1508static void rc_set_termios(struct tty_struct *tty, 1482static void rc_set_termios(struct tty_struct *tty,
@@ -1575,11 +1549,8 @@ static int __init rc_init_drivers(void)
1575 } 1549 }
1576 memset(rc_port, 0, sizeof(rc_port)); 1550 memset(rc_port, 0, sizeof(rc_port));
1577 for (i = 0; i < RC_NPORT * RC_NBOARD; i++) { 1551 for (i = 0; i < RC_NPORT * RC_NBOARD; i++) {
1552 tty_port_init(&rc_port[i].port);
1578 rc_port[i].magic = RISCOM8_MAGIC; 1553 rc_port[i].magic = RISCOM8_MAGIC;
1579 rc_port[i].close_delay = 50 * HZ / 100;
1580 rc_port[i].closing_wait = 3000 * HZ / 100;
1581 init_waitqueue_head(&rc_port[i].open_wait);
1582 init_waitqueue_head(&rc_port[i].close_wait);
1583 } 1554 }
1584 return 0; 1555 return 0;
1585} 1556}
diff --git a/drivers/char/riscom8.h b/drivers/char/riscom8.h
index cdfdf4394477..c9876b3f9714 100644
--- a/drivers/char/riscom8.h
+++ b/drivers/char/riscom8.h
@@ -66,23 +66,15 @@ struct riscom_board {
66 66
67struct riscom_port { 67struct riscom_port {
68 int magic; 68 int magic;
69 struct tty_port port;
69 int baud_base; 70 int baud_base;
70 int flags;
71 struct tty_struct * tty;
72 int count;
73 int blocked_open;
74 int timeout; 71 int timeout;
75 int close_delay;
76 unsigned char * xmit_buf;
77 int custom_divisor; 72 int custom_divisor;
78 int xmit_head; 73 int xmit_head;
79 int xmit_tail; 74 int xmit_tail;
80 int xmit_cnt; 75 int xmit_cnt;
81 wait_queue_head_t open_wait;
82 wait_queue_head_t close_wait;
83 short wakeup_chars; 76 short wakeup_chars;
84 short break_length; 77 short break_length;
85 unsigned short closing_wait;
86 unsigned char mark_mask; 78 unsigned char mark_mask;
87 unsigned char IER; 79 unsigned char IER;
88 unsigned char MSVR; 80 unsigned char MSVR;
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 743dc80a9325..e670eae2f510 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -72,6 +72,7 @@
72#include <linux/tty.h> 72#include <linux/tty.h>
73#include <linux/tty_driver.h> 73#include <linux/tty_driver.h>
74#include <linux/tty_flip.h> 74#include <linux/tty_flip.h>
75#include <linux/serial.h>
75#include <linux/string.h> 76#include <linux/string.h>
76#include <linux/fcntl.h> 77#include <linux/fcntl.h>
77#include <linux/ptrace.h> 78#include <linux/ptrace.h>
@@ -81,7 +82,7 @@
81#include <linux/completion.h> 82#include <linux/completion.h>
82#include <linux/wait.h> 83#include <linux/wait.h>
83#include <linux/pci.h> 84#include <linux/pci.h>
84#include <asm/uaccess.h> 85#include <linux/uaccess.h>
85#include <asm/atomic.h> 86#include <asm/atomic.h>
86#include <asm/unaligned.h> 87#include <asm/unaligned.h>
87#include <linux/bitops.h> 88#include <linux/bitops.h>
@@ -434,15 +435,15 @@ static void rp_do_transmit(struct r_port *info)
434#endif 435#endif
435 if (!info) 436 if (!info)
436 return; 437 return;
437 if (!info->tty) { 438 if (!info->port.tty) {
438 printk(KERN_WARNING "rp: WARNING %s called with " 439 printk(KERN_WARNING "rp: WARNING %s called with "
439 "info->tty==NULL\n", __func__); 440 "info->port.tty==NULL\n", __func__);
440 clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); 441 clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
441 return; 442 return;
442 } 443 }
443 444
444 spin_lock_irqsave(&info->slock, flags); 445 spin_lock_irqsave(&info->slock, flags);
445 tty = info->tty; 446 tty = info->port.tty;
446 info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp); 447 info->xmit_fifo_room = TXFIFO_SIZE - sGetTxCnt(cp);
447 448
448 /* Loop sending data to FIFO until done or FIFO full */ 449 /* Loop sending data to FIFO until done or FIFO full */
@@ -502,13 +503,13 @@ static void rp_handle_port(struct r_port *info)
502 "info->flags & NOT_INIT\n"); 503 "info->flags & NOT_INIT\n");
503 return; 504 return;
504 } 505 }
505 if (!info->tty) { 506 if (!info->port.tty) {
506 printk(KERN_WARNING "rp: WARNING: rp_handle_port called with " 507 printk(KERN_WARNING "rp: WARNING: rp_handle_port called with "
507 "info->tty==NULL\n"); 508 "info->port.tty==NULL\n");
508 return; 509 return;
509 } 510 }
510 cp = &info->channel; 511 cp = &info->channel;
511 tty = info->tty; 512 tty = info->port.tty;
512 513
513 IntMask = sGetChanIntID(cp) & info->intmask; 514 IntMask = sGetChanIntID(cp) & info->intmask;
514#ifdef ROCKET_DEBUG_INTR 515#ifdef ROCKET_DEBUG_INTR
@@ -530,7 +531,7 @@ static void rp_handle_port(struct r_port *info)
530 tty_hangup(tty); 531 tty_hangup(tty);
531 } 532 }
532 info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; 533 info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0;
533 wake_up_interruptible(&info->open_wait); 534 wake_up_interruptible(&info->port.open_wait);
534 } 535 }
535#ifdef ROCKET_DEBUG_INTR 536#ifdef ROCKET_DEBUG_INTR
536 if (IntMask & DELTA_CTS) { /* CTS change */ 537 if (IntMask & DELTA_CTS) { /* CTS change */
@@ -648,9 +649,9 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
648 info->board = board; 649 info->board = board;
649 info->aiop = aiop; 650 info->aiop = aiop;
650 info->chan = chan; 651 info->chan = chan;
651 info->closing_wait = 3000; 652 info->port.closing_wait = 3000;
652 info->close_delay = 50; 653 info->port.close_delay = 50;
653 init_waitqueue_head(&info->open_wait); 654 init_waitqueue_head(&info->port.open_wait);
654 init_completion(&info->close_wait); 655 init_completion(&info->close_wait);
655 info->flags &= ~ROCKET_MODE_MASK; 656 info->flags &= ~ROCKET_MODE_MASK;
656 switch (pc104[board][line]) { 657 switch (pc104[board][line]) {
@@ -717,7 +718,7 @@ static void configure_r_port(struct r_port *info,
717 unsigned rocketMode; 718 unsigned rocketMode;
718 int bits, baud, divisor; 719 int bits, baud, divisor;
719 CHANNEL_t *cp; 720 CHANNEL_t *cp;
720 struct ktermios *t = info->tty->termios; 721 struct ktermios *t = info->port.tty->termios;
721 722
722 cp = &info->channel; 723 cp = &info->channel;
723 cflag = t->c_cflag; 724 cflag = t->c_cflag;
@@ -750,7 +751,7 @@ static void configure_r_port(struct r_port *info,
750 } 751 }
751 752
752 /* baud rate */ 753 /* baud rate */
753 baud = tty_get_baud_rate(info->tty); 754 baud = tty_get_baud_rate(info->port.tty);
754 if (!baud) 755 if (!baud)
755 baud = 9600; 756 baud = 9600;
756 divisor = ((rp_baud_base[info->board] + (baud >> 1)) / baud) - 1; 757 divisor = ((rp_baud_base[info->board] + (baud >> 1)) / baud) - 1;
@@ -768,7 +769,7 @@ static void configure_r_port(struct r_port *info,
768 sSetBaud(cp, divisor); 769 sSetBaud(cp, divisor);
769 770
770 /* FIXME: Should really back compute a baud rate from the divisor */ 771 /* FIXME: Should really back compute a baud rate from the divisor */
771 tty_encode_baud_rate(info->tty, baud, baud); 772 tty_encode_baud_rate(info->port.tty, baud, baud);
772 773
773 if (cflag & CRTSCTS) { 774 if (cflag & CRTSCTS) {
774 info->intmask |= DELTA_CTS; 775 info->intmask |= DELTA_CTS;
@@ -793,15 +794,15 @@ static void configure_r_port(struct r_port *info,
793 * Handle software flow control in the board 794 * Handle software flow control in the board
794 */ 795 */
795#ifdef ROCKET_SOFT_FLOW 796#ifdef ROCKET_SOFT_FLOW
796 if (I_IXON(info->tty)) { 797 if (I_IXON(info->port.tty)) {
797 sEnTxSoftFlowCtl(cp); 798 sEnTxSoftFlowCtl(cp);
798 if (I_IXANY(info->tty)) { 799 if (I_IXANY(info->port.tty)) {
799 sEnIXANY(cp); 800 sEnIXANY(cp);
800 } else { 801 } else {
801 sDisIXANY(cp); 802 sDisIXANY(cp);
802 } 803 }
803 sSetTxXONChar(cp, START_CHAR(info->tty)); 804 sSetTxXONChar(cp, START_CHAR(info->port.tty));
804 sSetTxXOFFChar(cp, STOP_CHAR(info->tty)); 805 sSetTxXOFFChar(cp, STOP_CHAR(info->port.tty));
805 } else { 806 } else {
806 sDisTxSoftFlowCtl(cp); 807 sDisTxSoftFlowCtl(cp);
807 sDisIXANY(cp); 808 sDisIXANY(cp);
@@ -813,24 +814,24 @@ static void configure_r_port(struct r_port *info,
813 * Set up ignore/read mask words 814 * Set up ignore/read mask words
814 */ 815 */
815 info->read_status_mask = STMRCVROVRH | 0xFF; 816 info->read_status_mask = STMRCVROVRH | 0xFF;
816 if (I_INPCK(info->tty)) 817 if (I_INPCK(info->port.tty))
817 info->read_status_mask |= STMFRAMEH | STMPARITYH; 818 info->read_status_mask |= STMFRAMEH | STMPARITYH;
818 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 819 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
819 info->read_status_mask |= STMBREAKH; 820 info->read_status_mask |= STMBREAKH;
820 821
821 /* 822 /*
822 * Characters to ignore 823 * Characters to ignore
823 */ 824 */
824 info->ignore_status_mask = 0; 825 info->ignore_status_mask = 0;
825 if (I_IGNPAR(info->tty)) 826 if (I_IGNPAR(info->port.tty))
826 info->ignore_status_mask |= STMFRAMEH | STMPARITYH; 827 info->ignore_status_mask |= STMFRAMEH | STMPARITYH;
827 if (I_IGNBRK(info->tty)) { 828 if (I_IGNBRK(info->port.tty)) {
828 info->ignore_status_mask |= STMBREAKH; 829 info->ignore_status_mask |= STMBREAKH;
829 /* 830 /*
830 * If we're ignoring parity and break indicators, 831 * If we're ignoring parity and break indicators,
831 * ignore overruns too. (For real raw support). 832 * ignore overruns too. (For real raw support).
832 */ 833 */
833 if (I_IGNPAR(info->tty)) 834 if (I_IGNPAR(info->port.tty))
834 info->ignore_status_mask |= STMRCVROVRH; 835 info->ignore_status_mask |= STMRCVROVRH;
835 } 836 }
836 837
@@ -863,7 +864,7 @@ static void configure_r_port(struct r_port *info,
863 } 864 }
864} 865}
865 866
866/* info->count is considered critical, protected by spinlocks. */ 867/* info->port.count is considered critical, protected by spinlocks. */
867static int block_til_ready(struct tty_struct *tty, struct file *filp, 868static int block_til_ready(struct tty_struct *tty, struct file *filp,
868 struct r_port *info) 869 struct r_port *info)
869{ 870{
@@ -897,13 +898,13 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
897 898
898 /* 899 /*
899 * Block waiting for the carrier detect and the line to become free. While we are in 900 * Block waiting for the carrier detect and the line to become free. While we are in
900 * this loop, info->count is dropped by one, so that rp_close() knows when to free things. 901 * this loop, info->port.count is dropped by one, so that rp_close() knows when to free things.
901 * We restore it upon exit, either normal or abnormal. 902 * We restore it upon exit, either normal or abnormal.
902 */ 903 */
903 retval = 0; 904 retval = 0;
904 add_wait_queue(&info->open_wait, &wait); 905 add_wait_queue(&info->port.open_wait, &wait);
905#ifdef ROCKET_DEBUG_OPEN 906#ifdef ROCKET_DEBUG_OPEN
906 printk(KERN_INFO "block_til_ready before block: ttyR%d, count = %d\n", info->line, info->count); 907 printk(KERN_INFO "block_til_ready before block: ttyR%d, count = %d\n", info->line, info->port.count);
907#endif 908#endif
908 spin_lock_irqsave(&info->slock, flags); 909 spin_lock_irqsave(&info->slock, flags);
909 910
@@ -912,10 +913,10 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
912#else 913#else
913 if (!tty_hung_up_p(filp)) { 914 if (!tty_hung_up_p(filp)) {
914 extra_count = 1; 915 extra_count = 1;
915 info->count--; 916 info->port.count--;
916 } 917 }
917#endif 918#endif
918 info->blocked_open++; 919 info->port.blocked_open++;
919 920
920 spin_unlock_irqrestore(&info->slock, flags); 921 spin_unlock_irqrestore(&info->slock, flags);
921 922
@@ -940,24 +941,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
940 } 941 }
941#ifdef ROCKET_DEBUG_OPEN 942#ifdef ROCKET_DEBUG_OPEN
942 printk(KERN_INFO "block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n", 943 printk(KERN_INFO "block_til_ready blocking: ttyR%d, count = %d, flags=0x%0x\n",
943 info->line, info->count, info->flags); 944 info->line, info->port.count, info->flags);
944#endif 945#endif
945 schedule(); /* Don't hold spinlock here, will hang PC */ 946 schedule(); /* Don't hold spinlock here, will hang PC */
946 } 947 }
947 __set_current_state(TASK_RUNNING); 948 __set_current_state(TASK_RUNNING);
948 remove_wait_queue(&info->open_wait, &wait); 949 remove_wait_queue(&info->port.open_wait, &wait);
949 950
950 spin_lock_irqsave(&info->slock, flags); 951 spin_lock_irqsave(&info->slock, flags);
951 952
952 if (extra_count) 953 if (extra_count)
953 info->count++; 954 info->port.count++;
954 info->blocked_open--; 955 info->port.blocked_open--;
955 956
956 spin_unlock_irqrestore(&info->slock, flags); 957 spin_unlock_irqrestore(&info->slock, flags);
957 958
958#ifdef ROCKET_DEBUG_OPEN 959#ifdef ROCKET_DEBUG_OPEN
959 printk(KERN_INFO "block_til_ready after blocking: ttyR%d, count = %d\n", 960 printk(KERN_INFO "block_til_ready after blocking: ttyR%d, count = %d\n",
960 info->line, info->count); 961 info->line, info->port.count);
961#endif 962#endif
962 if (retval) 963 if (retval)
963 return retval; 964 return retval;
@@ -1001,9 +1002,9 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
1001 info->xmit_buf = (unsigned char *) page; 1002 info->xmit_buf = (unsigned char *) page;
1002 1003
1003 tty->driver_data = info; 1004 tty->driver_data = info;
1004 info->tty = tty; 1005 info->port.tty = tty;
1005 1006
1006 if (info->count++ == 0) { 1007 if (info->port.count++ == 0) {
1007 atomic_inc(&rp_num_ports_open); 1008 atomic_inc(&rp_num_ports_open);
1008 1009
1009#ifdef ROCKET_DEBUG_OPEN 1010#ifdef ROCKET_DEBUG_OPEN
@@ -1012,7 +1013,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
1012#endif 1013#endif
1013 } 1014 }
1014#ifdef ROCKET_DEBUG_OPEN 1015#ifdef ROCKET_DEBUG_OPEN
1015 printk(KERN_INFO "rp_open ttyR%d, count=%d\n", info->line, info->count); 1016 printk(KERN_INFO "rp_open ttyR%d, count=%d\n", info->line, info->port.count);
1016#endif 1017#endif
1017 1018
1018 /* 1019 /*
@@ -1048,13 +1049,13 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
1048 * Set up the tty->alt_speed kludge 1049 * Set up the tty->alt_speed kludge
1049 */ 1050 */
1050 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) 1051 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI)
1051 info->tty->alt_speed = 57600; 1052 info->port.tty->alt_speed = 57600;
1052 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) 1053 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI)
1053 info->tty->alt_speed = 115200; 1054 info->port.tty->alt_speed = 115200;
1054 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) 1055 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI)
1055 info->tty->alt_speed = 230400; 1056 info->port.tty->alt_speed = 230400;
1056 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) 1057 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP)
1057 info->tty->alt_speed = 460800; 1058 info->port.tty->alt_speed = 460800;
1058 1059
1059 configure_r_port(info, NULL); 1060 configure_r_port(info, NULL);
1060 if (tty->termios->c_cflag & CBAUD) { 1061 if (tty->termios->c_cflag & CBAUD) {
@@ -1076,7 +1077,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
1076} 1077}
1077 1078
1078/* 1079/*
1079 * Exception handler that closes a serial port. info->count is considered critical. 1080 * Exception handler that closes a serial port. info->port.count is considered critical.
1080 */ 1081 */
1081static void rp_close(struct tty_struct *tty, struct file *filp) 1082static void rp_close(struct tty_struct *tty, struct file *filp)
1082{ 1083{
@@ -1089,14 +1090,14 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
1089 return; 1090 return;
1090 1091
1091#ifdef ROCKET_DEBUG_OPEN 1092#ifdef ROCKET_DEBUG_OPEN
1092 printk(KERN_INFO "rp_close ttyR%d, count = %d\n", info->line, info->count); 1093 printk(KERN_INFO "rp_close ttyR%d, count = %d\n", info->line, info->port.count);
1093#endif 1094#endif
1094 1095
1095 if (tty_hung_up_p(filp)) 1096 if (tty_hung_up_p(filp))
1096 return; 1097 return;
1097 spin_lock_irqsave(&info->slock, flags); 1098 spin_lock_irqsave(&info->slock, flags);
1098 1099
1099 if ((tty->count == 1) && (info->count != 1)) { 1100 if ((tty->count == 1) && (info->port.count != 1)) {
1100 /* 1101 /*
1101 * Uh, oh. tty->count is 1, which means that the tty 1102 * Uh, oh. tty->count is 1, which means that the tty
1102 * structure will be freed. Info->count should always 1103 * structure will be freed. Info->count should always
@@ -1105,15 +1106,15 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
1105 * serial port won't be shutdown. 1106 * serial port won't be shutdown.
1106 */ 1107 */
1107 printk(KERN_WARNING "rp_close: bad serial port count; " 1108 printk(KERN_WARNING "rp_close: bad serial port count; "
1108 "tty->count is 1, info->count is %d\n", info->count); 1109 "tty->count is 1, info->port.count is %d\n", info->port.count);
1109 info->count = 1; 1110 info->port.count = 1;
1110 } 1111 }
1111 if (--info->count < 0) { 1112 if (--info->port.count < 0) {
1112 printk(KERN_WARNING "rp_close: bad serial port count for " 1113 printk(KERN_WARNING "rp_close: bad serial port count for "
1113 "ttyR%d: %d\n", info->line, info->count); 1114 "ttyR%d: %d\n", info->line, info->port.count);
1114 info->count = 0; 1115 info->port.count = 0;
1115 } 1116 }
1116 if (info->count) { 1117 if (info->port.count) {
1117 spin_unlock_irqrestore(&info->slock, flags); 1118 spin_unlock_irqrestore(&info->slock, flags);
1118 return; 1119 return;
1119 } 1120 }
@@ -1137,8 +1138,8 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
1137 /* 1138 /*
1138 * Wait for the transmit buffer to clear 1139 * Wait for the transmit buffer to clear
1139 */ 1140 */
1140 if (info->closing_wait != ROCKET_CLOSING_WAIT_NONE) 1141 if (info->port.closing_wait != ROCKET_CLOSING_WAIT_NONE)
1141 tty_wait_until_sent(tty, info->closing_wait); 1142 tty_wait_until_sent(tty, info->port.closing_wait);
1142 /* 1143 /*
1143 * Before we drop DTR, make sure the UART transmitter 1144 * Before we drop DTR, make sure the UART transmitter
1144 * has completely drained; this is especially 1145 * has completely drained; this is especially
@@ -1167,11 +1168,11 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
1167 1168
1168 clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); 1169 clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
1169 1170
1170 if (info->blocked_open) { 1171 if (info->port.blocked_open) {
1171 if (info->close_delay) { 1172 if (info->port.close_delay) {
1172 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 1173 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
1173 } 1174 }
1174 wake_up_interruptible(&info->open_wait); 1175 wake_up_interruptible(&info->port.open_wait);
1175 } else { 1176 } else {
1176 if (info->xmit_buf) { 1177 if (info->xmit_buf) {
1177 free_page((unsigned long) info->xmit_buf); 1178 free_page((unsigned long) info->xmit_buf);
@@ -1327,8 +1328,8 @@ static int get_config(struct r_port *info, struct rocket_config __user *retinfo)
1327 memset(&tmp, 0, sizeof (tmp)); 1328 memset(&tmp, 0, sizeof (tmp));
1328 tmp.line = info->line; 1329 tmp.line = info->line;
1329 tmp.flags = info->flags; 1330 tmp.flags = info->flags;
1330 tmp.close_delay = info->close_delay; 1331 tmp.close_delay = info->port.close_delay;
1331 tmp.closing_wait = info->closing_wait; 1332 tmp.closing_wait = info->port.closing_wait;
1332 tmp.port = rcktpt_io_addr[(info->line >> 5) & 3]; 1333 tmp.port = rcktpt_io_addr[(info->line >> 5) & 3];
1333 1334
1334 if (copy_to_user(retinfo, &tmp, sizeof (*retinfo))) 1335 if (copy_to_user(retinfo, &tmp, sizeof (*retinfo)))
@@ -1353,17 +1354,17 @@ static int set_config(struct r_port *info, struct rocket_config __user *new_info
1353 } 1354 }
1354 1355
1355 info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS)); 1356 info->flags = ((info->flags & ~ROCKET_FLAGS) | (new_serial.flags & ROCKET_FLAGS));
1356 info->close_delay = new_serial.close_delay; 1357 info->port.close_delay = new_serial.close_delay;
1357 info->closing_wait = new_serial.closing_wait; 1358 info->port.closing_wait = new_serial.closing_wait;
1358 1359
1359 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI) 1360 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_HI)
1360 info->tty->alt_speed = 57600; 1361 info->port.tty->alt_speed = 57600;
1361 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI) 1362 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_VHI)
1362 info->tty->alt_speed = 115200; 1363 info->port.tty->alt_speed = 115200;
1363 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI) 1364 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_SHI)
1364 info->tty->alt_speed = 230400; 1365 info->port.tty->alt_speed = 230400;
1365 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP) 1366 if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP)
1366 info->tty->alt_speed = 460800; 1367 info->port.tty->alt_speed = 460800;
1367 1368
1368 configure_r_port(info, NULL); 1369 configure_r_port(info, NULL);
1369 return 0; 1370 return 0;
@@ -1636,13 +1637,13 @@ static void rp_hangup(struct tty_struct *tty)
1636 rp_flush_buffer(tty); 1637 rp_flush_buffer(tty);
1637 if (info->flags & ROCKET_CLOSING) 1638 if (info->flags & ROCKET_CLOSING)
1638 return; 1639 return;
1639 if (info->count) 1640 if (info->port.count)
1640 atomic_dec(&rp_num_ports_open); 1641 atomic_dec(&rp_num_ports_open);
1641 clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]); 1642 clear_bit((info->aiop * 8) + info->chan, (void *) &xmit_flags[info->board]);
1642 1643
1643 info->count = 0; 1644 info->port.count = 0;
1644 info->flags &= ~ROCKET_NORMAL_ACTIVE; 1645 info->flags &= ~ROCKET_NORMAL_ACTIVE;
1645 info->tty = NULL; 1646 info->port.tty = NULL;
1646 1647
1647 cp = &info->channel; 1648 cp = &info->channel;
1648 sDisRxFIFO(cp); 1649 sDisRxFIFO(cp);
@@ -1653,7 +1654,7 @@ static void rp_hangup(struct tty_struct *tty)
1653 sClrTxXOFF(cp); 1654 sClrTxXOFF(cp);
1654 info->flags &= ~ROCKET_INITIALIZED; 1655 info->flags &= ~ROCKET_INITIALIZED;
1655 1656
1656 wake_up_interruptible(&info->open_wait); 1657 wake_up_interruptible(&info->port.open_wait);
1657} 1658}
1658 1659
1659/* 1660/*
@@ -1762,7 +1763,7 @@ static int rp_write(struct tty_struct *tty,
1762 1763
1763 /* Write remaining data into the port's xmit_buf */ 1764 /* Write remaining data into the port's xmit_buf */
1764 while (1) { 1765 while (1) {
1765 if (!info->tty) /* Seemingly obligatory check... */ 1766 if (!info->port.tty) /* Seemingly obligatory check... */
1766 goto end; 1767 goto end;
1767 c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1); 1768 c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1);
1768 c = min(c, XMIT_BUF_SIZE - info->xmit_head); 1769 c = min(c, XMIT_BUF_SIZE - info->xmit_head);
diff --git a/drivers/char/rocket.h b/drivers/char/rocket.h
index ae6b04f90c03..a8b09195ebba 100644
--- a/drivers/char/rocket.h
+++ b/drivers/char/rocket.h
@@ -64,8 +64,8 @@ struct rocket_version {
64/* 64/*
65 * For closing_wait and closing_wait2 65 * For closing_wait and closing_wait2
66 */ 66 */
67#define ROCKET_CLOSING_WAIT_NONE 65535 67#define ROCKET_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE
68#define ROCKET_CLOSING_WAIT_INF 0 68#define ROCKET_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF
69 69
70/* 70/*
71 * Rocketport ioctls -- "RP" 71 * Rocketport ioctls -- "RP"
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index 143cc432fdb2..21f3ff53ba32 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1125,18 +1125,14 @@ Warnings: This function writes the data byte without checking to see if
1125 1125
1126struct r_port { 1126struct r_port {
1127 int magic; 1127 int magic;
1128 struct tty_port port;
1128 int line; 1129 int line;
1129 int flags; 1130 int flags; /* Don't yet match the ASY_ flags!! */
1130 int count;
1131 int blocked_open;
1132 struct tty_struct *tty;
1133 unsigned int board:3; 1131 unsigned int board:3;
1134 unsigned int aiop:2; 1132 unsigned int aiop:2;
1135 unsigned int chan:3; 1133 unsigned int chan:3;
1136 CONTROLLER_t *ctlp; 1134 CONTROLLER_t *ctlp;
1137 CHANNEL_t channel; 1135 CHANNEL_t channel;
1138 int closing_wait;
1139 int close_delay;
1140 int intmask; 1136 int intmask;
1141 int xmit_fifo_room; /* room in xmit fifo */ 1137 int xmit_fifo_room; /* room in xmit fifo */
1142 unsigned char *xmit_buf; 1138 unsigned char *xmit_buf;
@@ -1148,8 +1144,7 @@ struct r_port {
1148 int read_status_mask; 1144 int read_status_mask;
1149 int cps; 1145 int cps;
1150 1146
1151 wait_queue_head_t open_wait; 1147 struct completion close_wait; /* Not yet matching the core */
1152 struct completion close_wait;
1153 spinlock_t slock; 1148 spinlock_t slock;
1154 struct mutex write_mtx; 1149 struct mutex write_mtx;
1155}; 1150};
diff --git a/drivers/char/selection.c b/drivers/char/selection.c
index d63f5ccc29e6..2978a49a172b 100644
--- a/drivers/char/selection.c
+++ b/drivers/char/selection.c
@@ -327,7 +327,8 @@ int paste_selection(struct tty_struct *tty)
327 } 327 }
328 count = sel_buffer_lth - pasted; 328 count = sel_buffer_lth - pasted;
329 count = min(count, tty->receive_room); 329 count = min(count, tty->receive_room);
330 tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count); 330 tty->ldisc.ops->receive_buf(tty, sel_buffer + pasted,
331 NULL, count);
331 pasted += count; 332 pasted += count;
332 } 333 }
333 remove_wait_queue(&vc->paste_wait, &wait); 334 remove_wait_queue(&vc->paste_wait, &wait);
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index 2ee4d9893757..037dc47e4cb1 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -608,9 +608,9 @@ static inline struct specialix_port * sx_get_port(struct specialix_board * bp,
608 dprintk (SX_DEBUG_CHAN, "channel: %d\n", channel); 608 dprintk (SX_DEBUG_CHAN, "channel: %d\n", channel);
609 if (channel < CD186x_NCH) { 609 if (channel < CD186x_NCH) {
610 port = &sx_port[board_No(bp) * SX_NPORT + channel]; 610 port = &sx_port[board_No(bp) * SX_NPORT + channel];
611 dprintk (SX_DEBUG_CHAN, "port: %d %p flags: 0x%x\n",board_No(bp) * SX_NPORT + channel, port, port->flags & ASYNC_INITIALIZED); 611 dprintk (SX_DEBUG_CHAN, "port: %d %p flags: 0x%lx\n",board_No(bp) * SX_NPORT + channel, port, port->port.flags & ASYNC_INITIALIZED);
612 612
613 if (port->flags & ASYNC_INITIALIZED) { 613 if (port->port.flags & ASYNC_INITIALIZED) {
614 dprintk (SX_DEBUG_CHAN, "port: %d %p\n", channel, port); 614 dprintk (SX_DEBUG_CHAN, "port: %d %p\n", channel, port);
615 func_exit(); 615 func_exit();
616 return port; 616 return port;
@@ -637,7 +637,7 @@ static inline void sx_receive_exc(struct specialix_board * bp)
637 func_exit(); 637 func_exit();
638 return; 638 return;
639 } 639 }
640 tty = port->tty; 640 tty = port->port.tty;
641 641
642 status = sx_in(bp, CD186x_RCSR); 642 status = sx_in(bp, CD186x_RCSR);
643 643
@@ -673,7 +673,7 @@ static inline void sx_receive_exc(struct specialix_board * bp)
673 dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", 673 dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n",
674 board_No(bp), port_No(port)); 674 board_No(bp), port_No(port));
675 flag = TTY_BREAK; 675 flag = TTY_BREAK;
676 if (port->flags & ASYNC_SAK) 676 if (port->port.flags & ASYNC_SAK)
677 do_SAK(tty); 677 do_SAK(tty);
678 678
679 } else if (status & RCSR_PE) 679 } else if (status & RCSR_PE)
@@ -707,7 +707,7 @@ static inline void sx_receive(struct specialix_board * bp)
707 func_exit(); 707 func_exit();
708 return; 708 return;
709 } 709 }
710 tty = port->tty; 710 tty = port->port.tty;
711 711
712 count = sx_in(bp, CD186x_RDCR); 712 count = sx_in(bp, CD186x_RDCR);
713 dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); 713 dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count);
@@ -734,7 +734,7 @@ static inline void sx_transmit(struct specialix_board * bp)
734 return; 734 return;
735 } 735 }
736 dprintk (SX_DEBUG_TX, "port: %p\n", port); 736 dprintk (SX_DEBUG_TX, "port: %p\n", port);
737 tty = port->tty; 737 tty = port->port.tty;
738 738
739 if (port->IER & IER_TXEMPTY) { 739 if (port->IER & IER_TXEMPTY) {
740 /* FIFO drained */ 740 /* FIFO drained */
@@ -811,7 +811,7 @@ static inline void sx_check_modem(struct specialix_board * bp)
811 if (!(port = sx_get_port(bp, "Modem"))) 811 if (!(port = sx_get_port(bp, "Modem")))
812 return; 812 return;
813 813
814 tty = port->tty; 814 tty = port->port.tty;
815 815
816 mcr = sx_in(bp, CD186x_MCR); 816 mcr = sx_in(bp, CD186x_MCR);
817 printk ("mcr = %02x.\n", mcr); 817 printk ("mcr = %02x.\n", mcr);
@@ -821,7 +821,7 @@ static inline void sx_check_modem(struct specialix_board * bp)
821 msvr_cd = sx_in(bp, CD186x_MSVR) & MSVR_CD; 821 msvr_cd = sx_in(bp, CD186x_MSVR) & MSVR_CD;
822 if (msvr_cd) { 822 if (msvr_cd) {
823 dprintk (SX_DEBUG_SIGNALS, "Waking up guys in open.\n"); 823 dprintk (SX_DEBUG_SIGNALS, "Waking up guys in open.\n");
824 wake_up_interruptible(&port->open_wait); 824 wake_up_interruptible(&port->port.open_wait);
825 } else { 825 } else {
826 dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n"); 826 dprintk (SX_DEBUG_SIGNALS, "Sending HUP.\n");
827 tty_hangup(tty); 827 tty_hangup(tty);
@@ -1030,7 +1030,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1030 1030
1031 func_enter(); 1031 func_enter();
1032 1032
1033 if (!(tty = port->tty) || !tty->termios) { 1033 if (!(tty = port->port.tty) || !tty->termios) {
1034 func_exit(); 1034 func_exit();
1035 return; 1035 return;
1036 } 1036 }
@@ -1052,9 +1052,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1052 baud = tty_get_baud_rate(tty); 1052 baud = tty_get_baud_rate(tty);
1053 1053
1054 if (baud == 38400) { 1054 if (baud == 38400) {
1055 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1055 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1056 baud = 57600; 1056 baud = 57600;
1057 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1057 if ((port->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1058 baud = 115200; 1058 baud = 115200;
1059 } 1059 }
1060 1060
@@ -1244,7 +1244,7 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port
1244 1244
1245 func_enter(); 1245 func_enter();
1246 1246
1247 if (port->flags & ASYNC_INITIALIZED) { 1247 if (port->port.flags & ASYNC_INITIALIZED) {
1248 func_exit(); 1248 func_exit();
1249 return 0; 1249 return 0;
1250 } 1250 }
@@ -1268,12 +1268,12 @@ static int sx_setup_port(struct specialix_board *bp, struct specialix_port *port
1268 1268
1269 spin_lock_irqsave(&port->lock, flags); 1269 spin_lock_irqsave(&port->lock, flags);
1270 1270
1271 if (port->tty) 1271 if (port->port.tty)
1272 clear_bit(TTY_IO_ERROR, &port->tty->flags); 1272 clear_bit(TTY_IO_ERROR, &port->port.tty->flags);
1273 1273
1274 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; 1274 port->xmit_cnt = port->xmit_head = port->xmit_tail = 0;
1275 sx_change_speed(bp, port); 1275 sx_change_speed(bp, port);
1276 port->flags |= ASYNC_INITIALIZED; 1276 port->port.flags |= ASYNC_INITIALIZED;
1277 1277
1278 spin_unlock_irqrestore(&port->lock, flags); 1278 spin_unlock_irqrestore(&port->lock, flags);
1279 1279
@@ -1292,7 +1292,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port *
1292 1292
1293 func_enter(); 1293 func_enter();
1294 1294
1295 if (!(port->flags & ASYNC_INITIALIZED)) { 1295 if (!(port->port.flags & ASYNC_INITIALIZED)) {
1296 func_exit(); 1296 func_exit();
1297 return; 1297 return;
1298 } 1298 }
@@ -1315,7 +1315,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port *
1315 spin_lock_irqsave(&bp->lock, flags); 1315 spin_lock_irqsave(&bp->lock, flags);
1316 sx_out(bp, CD186x_CAR, port_No(port)); 1316 sx_out(bp, CD186x_CAR, port_No(port));
1317 1317
1318 if (!(tty = port->tty) || C_HUPCL(tty)) { 1318 if (!(tty = port->port.tty) || C_HUPCL(tty)) {
1319 /* Drop DTR */ 1319 /* Drop DTR */
1320 sx_out(bp, CD186x_MSVDTR, 0); 1320 sx_out(bp, CD186x_MSVDTR, 0);
1321 } 1321 }
@@ -1330,7 +1330,7 @@ static void sx_shutdown_port(struct specialix_board *bp, struct specialix_port *
1330 spin_unlock_irqrestore(&bp->lock, flags); 1330 spin_unlock_irqrestore(&bp->lock, flags);
1331 if (tty) 1331 if (tty)
1332 set_bit(TTY_IO_ERROR, &tty->flags); 1332 set_bit(TTY_IO_ERROR, &tty->flags);
1333 port->flags &= ~ASYNC_INITIALIZED; 1333 port->port.flags &= ~ASYNC_INITIALIZED;
1334 1334
1335 if (!bp->count) 1335 if (!bp->count)
1336 sx_shutdown_board(bp); 1336 sx_shutdown_board(bp);
@@ -1354,9 +1354,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1354 * If the device is in the middle of being closed, then block 1354 * If the device is in the middle of being closed, then block
1355 * until it's done, and then try again. 1355 * until it's done, and then try again.
1356 */ 1356 */
1357 if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { 1357 if (tty_hung_up_p(filp) || port->port.flags & ASYNC_CLOSING) {
1358 interruptible_sleep_on(&port->close_wait); 1358 interruptible_sleep_on(&port->port.close_wait);
1359 if (port->flags & ASYNC_HUP_NOTIFY) { 1359 if (port->port.flags & ASYNC_HUP_NOTIFY) {
1360 func_exit(); 1360 func_exit();
1361 return -EAGAIN; 1361 return -EAGAIN;
1362 } else { 1362 } else {
@@ -1371,7 +1371,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1371 */ 1371 */
1372 if ((filp->f_flags & O_NONBLOCK) || 1372 if ((filp->f_flags & O_NONBLOCK) ||
1373 (tty->flags & (1 << TTY_IO_ERROR))) { 1373 (tty->flags & (1 << TTY_IO_ERROR))) {
1374 port->flags |= ASYNC_NORMAL_ACTIVE; 1374 port->port.flags |= ASYNC_NORMAL_ACTIVE;
1375 func_exit(); 1375 func_exit();
1376 return 0; 1376 return 0;
1377 } 1377 }
@@ -1387,13 +1387,13 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1387 * exit, either normal or abnormal. 1387 * exit, either normal or abnormal.
1388 */ 1388 */
1389 retval = 0; 1389 retval = 0;
1390 add_wait_queue(&port->open_wait, &wait); 1390 add_wait_queue(&port->port.open_wait, &wait);
1391 spin_lock_irqsave(&port->lock, flags); 1391 spin_lock_irqsave(&port->lock, flags);
1392 if (!tty_hung_up_p(filp)) { 1392 if (!tty_hung_up_p(filp)) {
1393 port->count--; 1393 port->port.count--;
1394 } 1394 }
1395 spin_unlock_irqrestore(&port->lock, flags); 1395 spin_unlock_irqrestore(&port->lock, flags);
1396 port->blocked_open++; 1396 port->port.blocked_open++;
1397 while (1) { 1397 while (1) {
1398 spin_lock_irqsave(&bp->lock, flags); 1398 spin_lock_irqsave(&bp->lock, flags);
1399 sx_out(bp, CD186x_CAR, port_No(port)); 1399 sx_out(bp, CD186x_CAR, port_No(port));
@@ -1410,14 +1410,14 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1410 spin_unlock_irqrestore(&bp->lock, flags); 1410 spin_unlock_irqrestore(&bp->lock, flags);
1411 set_current_state(TASK_INTERRUPTIBLE); 1411 set_current_state(TASK_INTERRUPTIBLE);
1412 if (tty_hung_up_p(filp) || 1412 if (tty_hung_up_p(filp) ||
1413 !(port->flags & ASYNC_INITIALIZED)) { 1413 !(port->port.flags & ASYNC_INITIALIZED)) {
1414 if (port->flags & ASYNC_HUP_NOTIFY) 1414 if (port->port.flags & ASYNC_HUP_NOTIFY)
1415 retval = -EAGAIN; 1415 retval = -EAGAIN;
1416 else 1416 else
1417 retval = -ERESTARTSYS; 1417 retval = -ERESTARTSYS;
1418 break; 1418 break;
1419 } 1419 }
1420 if (!(port->flags & ASYNC_CLOSING) && 1420 if (!(port->port.flags & ASYNC_CLOSING) &&
1421 (do_clocal || CD)) 1421 (do_clocal || CD))
1422 break; 1422 break;
1423 if (signal_pending(current)) { 1423 if (signal_pending(current)) {
@@ -1428,19 +1428,19 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1428 } 1428 }
1429 1429
1430 set_current_state(TASK_RUNNING); 1430 set_current_state(TASK_RUNNING);
1431 remove_wait_queue(&port->open_wait, &wait); 1431 remove_wait_queue(&port->port.open_wait, &wait);
1432 spin_lock_irqsave(&port->lock, flags); 1432 spin_lock_irqsave(&port->lock, flags);
1433 if (!tty_hung_up_p(filp)) { 1433 if (!tty_hung_up_p(filp)) {
1434 port->count++; 1434 port->port.count++;
1435 } 1435 }
1436 port->blocked_open--; 1436 port->port.blocked_open--;
1437 spin_unlock_irqrestore(&port->lock, flags); 1437 spin_unlock_irqrestore(&port->lock, flags);
1438 if (retval) { 1438 if (retval) {
1439 func_exit(); 1439 func_exit();
1440 return retval; 1440 return retval;
1441 } 1441 }
1442 1442
1443 port->flags |= ASYNC_NORMAL_ACTIVE; 1443 port->port.flags |= ASYNC_NORMAL_ACTIVE;
1444 func_exit(); 1444 func_exit();
1445 return 0; 1445 return 0;
1446} 1446}
@@ -1484,10 +1484,10 @@ static int sx_open(struct tty_struct * tty, struct file * filp)
1484 } 1484 }
1485 1485
1486 spin_lock_irqsave(&bp->lock, flags); 1486 spin_lock_irqsave(&bp->lock, flags);
1487 port->count++; 1487 port->port.count++;
1488 bp->count++; 1488 bp->count++;
1489 tty->driver_data = port; 1489 tty->driver_data = port;
1490 port->tty = tty; 1490 port->port.tty = tty;
1491 spin_unlock_irqrestore(&bp->lock, flags); 1491 spin_unlock_irqrestore(&bp->lock, flags);
1492 1492
1493 if ((error = sx_setup_port(bp, port))) { 1493 if ((error = sx_setup_port(bp, port))) {
@@ -1547,15 +1547,15 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1547 } 1547 }
1548 1548
1549 bp = port_Board(port); 1549 bp = port_Board(port);
1550 if ((tty->count == 1) && (port->count != 1)) { 1550 if ((tty->count == 1) && (port->port.count != 1)) {
1551 printk(KERN_ERR "sx%d: sx_close: bad port count;" 1551 printk(KERN_ERR "sx%d: sx_close: bad port count;"
1552 " tty->count is 1, port count is %d\n", 1552 " tty->count is 1, port count is %d\n",
1553 board_No(bp), port->count); 1553 board_No(bp), port->port.count);
1554 port->count = 1; 1554 port->port.count = 1;
1555 } 1555 }
1556 1556
1557 if (port->count > 1) { 1557 if (port->port.count > 1) {
1558 port->count--; 1558 port->port.count--;
1559 bp->count--; 1559 bp->count--;
1560 1560
1561 spin_unlock_irqrestore(&port->lock, flags); 1561 spin_unlock_irqrestore(&port->lock, flags);
@@ -1563,7 +1563,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1563 func_exit(); 1563 func_exit();
1564 return; 1564 return;
1565 } 1565 }
1566 port->flags |= ASYNC_CLOSING; 1566 port->port.flags |= ASYNC_CLOSING;
1567 /* 1567 /*
1568 * Now we wait for the transmit buffer to clear; and we notify 1568 * Now we wait for the transmit buffer to clear; and we notify
1569 * the line discipline to only process XON/XOFF characters. 1569 * the line discipline to only process XON/XOFF characters.
@@ -1571,8 +1571,8 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1571 tty->closing = 1; 1571 tty->closing = 1;
1572 spin_unlock_irqrestore(&port->lock, flags); 1572 spin_unlock_irqrestore(&port->lock, flags);
1573 dprintk (SX_DEBUG_OPEN, "Closing\n"); 1573 dprintk (SX_DEBUG_OPEN, "Closing\n");
1574 if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 1574 if (port->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
1575 tty_wait_until_sent(tty, port->closing_wait); 1575 tty_wait_until_sent(tty, port->port.closing_wait);
1576 } 1576 }
1577 /* 1577 /*
1578 * At this point we stop accepting input. To do this, we 1578 * At this point we stop accepting input. To do this, we
@@ -1582,7 +1582,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1582 */ 1582 */
1583 dprintk (SX_DEBUG_OPEN, "Closed\n"); 1583 dprintk (SX_DEBUG_OPEN, "Closed\n");
1584 port->IER &= ~IER_RXD; 1584 port->IER &= ~IER_RXD;
1585 if (port->flags & ASYNC_INITIALIZED) { 1585 if (port->port.flags & ASYNC_INITIALIZED) {
1586 port->IER &= ~IER_TXRDY; 1586 port->IER &= ~IER_TXRDY;
1587 port->IER |= IER_TXEMPTY; 1587 port->IER |= IER_TXEMPTY;
1588 spin_lock_irqsave(&bp->lock, flags); 1588 spin_lock_irqsave(&bp->lock, flags);
@@ -1611,10 +1611,10 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1611 board_No(bp), bp->count, tty->index); 1611 board_No(bp), bp->count, tty->index);
1612 bp->count = 0; 1612 bp->count = 0;
1613 } 1613 }
1614 if (--port->count < 0) { 1614 if (--port->port.count < 0) {
1615 printk(KERN_ERR "sx%d: sx_close: bad port count for tty%d: %d\n", 1615 printk(KERN_ERR "sx%d: sx_close: bad port count for tty%d: %d\n",
1616 board_No(bp), port_No(port), port->count); 1616 board_No(bp), port_No(port), port->port.count);
1617 port->count = 0; 1617 port->port.count = 0;
1618 } 1618 }
1619 1619
1620 sx_shutdown_port(bp, port); 1620 sx_shutdown_port(bp, port);
@@ -1622,16 +1622,16 @@ static void sx_close(struct tty_struct * tty, struct file * filp)
1622 tty_ldisc_flush(tty); 1622 tty_ldisc_flush(tty);
1623 spin_lock_irqsave(&port->lock, flags); 1623 spin_lock_irqsave(&port->lock, flags);
1624 tty->closing = 0; 1624 tty->closing = 0;
1625 port->tty = NULL; 1625 port->port.tty = NULL;
1626 spin_unlock_irqrestore(&port->lock, flags); 1626 spin_unlock_irqrestore(&port->lock, flags);
1627 if (port->blocked_open) { 1627 if (port->port.blocked_open) {
1628 if (port->close_delay) { 1628 if (port->port.close_delay) {
1629 msleep_interruptible(jiffies_to_msecs(port->close_delay)); 1629 msleep_interruptible(jiffies_to_msecs(port->port.close_delay));
1630 } 1630 }
1631 wake_up_interruptible(&port->open_wait); 1631 wake_up_interruptible(&port->port.open_wait);
1632 } 1632 }
1633 port->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1633 port->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1634 wake_up_interruptible(&port->close_wait); 1634 wake_up_interruptible(&port->port.close_wait);
1635 1635
1636 func_exit(); 1636 func_exit();
1637} 1637}
@@ -1815,7 +1815,7 @@ static int sx_tiocmget(struct tty_struct *tty, struct file *file)
1815 dprintk (SX_DEBUG_INIT, "Got msvr[%d] = %02x, car = %d.\n", 1815 dprintk (SX_DEBUG_INIT, "Got msvr[%d] = %02x, car = %d.\n",
1816 port_No(port), status, sx_in (bp, CD186x_CAR)); 1816 port_No(port), status, sx_in (bp, CD186x_CAR));
1817 dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port); 1817 dprintk (SX_DEBUG_INIT, "sx_port = %p, port = %p\n", sx_port, port);
1818 if (SX_CRTSCTS(port->tty)) { 1818 if (SX_CRTSCTS(port->port.tty)) {
1819 result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */ 1819 result = /* (status & MSVR_RTS) ? */ TIOCM_DTR /* : 0) */
1820 | ((status & MSVR_DTR) ? TIOCM_RTS : 0) 1820 | ((status & MSVR_DTR) ? TIOCM_RTS : 0)
1821 | ((status & MSVR_CD) ? TIOCM_CAR : 0) 1821 | ((status & MSVR_CD) ? TIOCM_CAR : 0)
@@ -1857,7 +1857,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file,
1857 /* if (set & TIOCM_DTR) 1857 /* if (set & TIOCM_DTR)
1858 port->MSVR |= MSVR_DTR; */ 1858 port->MSVR |= MSVR_DTR; */
1859 1859
1860 if (SX_CRTSCTS(port->tty)) { 1860 if (SX_CRTSCTS(port->port.tty)) {
1861 if (set & TIOCM_RTS) 1861 if (set & TIOCM_RTS)
1862 port->MSVR |= MSVR_DTR; 1862 port->MSVR |= MSVR_DTR;
1863 } else { 1863 } else {
@@ -1869,7 +1869,7 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file,
1869 port->MSVR &= ~MSVR_RTS; */ 1869 port->MSVR &= ~MSVR_RTS; */
1870 /* if (clear & TIOCM_DTR) 1870 /* if (clear & TIOCM_DTR)
1871 port->MSVR &= ~MSVR_DTR; */ 1871 port->MSVR &= ~MSVR_DTR; */
1872 if (SX_CRTSCTS(port->tty)) { 1872 if (SX_CRTSCTS(port->port.tty)) {
1873 if (clear & TIOCM_RTS) 1873 if (clear & TIOCM_RTS)
1874 port->MSVR &= ~MSVR_DTR; 1874 port->MSVR &= ~MSVR_DTR;
1875 } else { 1875 } else {
@@ -1929,27 +1929,27 @@ static inline int sx_set_serial_info(struct specialix_port * port,
1929 1929
1930 lock_kernel(); 1930 lock_kernel();
1931 1931
1932 change_speed = ((port->flags & ASYNC_SPD_MASK) != 1932 change_speed = ((port->port.flags & ASYNC_SPD_MASK) !=
1933 (tmp.flags & ASYNC_SPD_MASK)); 1933 (tmp.flags & ASYNC_SPD_MASK));
1934 change_speed |= (tmp.custom_divisor != port->custom_divisor); 1934 change_speed |= (tmp.custom_divisor != port->custom_divisor);
1935 1935
1936 if (!capable(CAP_SYS_ADMIN)) { 1936 if (!capable(CAP_SYS_ADMIN)) {
1937 if ((tmp.close_delay != port->close_delay) || 1937 if ((tmp.close_delay != port->port.close_delay) ||
1938 (tmp.closing_wait != port->closing_wait) || 1938 (tmp.closing_wait != port->port.closing_wait) ||
1939 ((tmp.flags & ~ASYNC_USR_MASK) != 1939 ((tmp.flags & ~ASYNC_USR_MASK) !=
1940 (port->flags & ~ASYNC_USR_MASK))) { 1940 (port->port.flags & ~ASYNC_USR_MASK))) {
1941 func_exit(); 1941 func_exit();
1942 unlock_kernel(); 1942 unlock_kernel();
1943 return -EPERM; 1943 return -EPERM;
1944 } 1944 }
1945 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1945 port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
1946 (tmp.flags & ASYNC_USR_MASK)); 1946 (tmp.flags & ASYNC_USR_MASK));
1947 port->custom_divisor = tmp.custom_divisor; 1947 port->custom_divisor = tmp.custom_divisor;
1948 } else { 1948 } else {
1949 port->flags = ((port->flags & ~ASYNC_FLAGS) | 1949 port->port.flags = ((port->port.flags & ~ASYNC_FLAGS) |
1950 (tmp.flags & ASYNC_FLAGS)); 1950 (tmp.flags & ASYNC_FLAGS));
1951 port->close_delay = tmp.close_delay; 1951 port->port.close_delay = tmp.close_delay;
1952 port->closing_wait = tmp.closing_wait; 1952 port->port.closing_wait = tmp.closing_wait;
1953 port->custom_divisor = tmp.custom_divisor; 1953 port->custom_divisor = tmp.custom_divisor;
1954 } 1954 }
1955 if (change_speed) { 1955 if (change_speed) {
@@ -1975,10 +1975,10 @@ static inline int sx_get_serial_info(struct specialix_port * port,
1975 tmp.line = port - sx_port; 1975 tmp.line = port - sx_port;
1976 tmp.port = bp->base; 1976 tmp.port = bp->base;
1977 tmp.irq = bp->irq; 1977 tmp.irq = bp->irq;
1978 tmp.flags = port->flags; 1978 tmp.flags = port->port.flags;
1979 tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC; 1979 tmp.baud_base = (SX_OSCFREQ + CD186x_TPC/2) / CD186x_TPC;
1980 tmp.close_delay = port->close_delay * HZ/100; 1980 tmp.close_delay = port->port.close_delay * HZ/100;
1981 tmp.closing_wait = port->closing_wait * HZ/100; 1981 tmp.closing_wait = port->port.closing_wait * HZ/100;
1982 tmp.custom_divisor = port->custom_divisor; 1982 tmp.custom_divisor = port->custom_divisor;
1983 tmp.xmit_fifo_size = CD186x_NFIFO; 1983 tmp.xmit_fifo_size = CD186x_NFIFO;
1984 unlock_kernel(); 1984 unlock_kernel();
@@ -2199,17 +2199,17 @@ static void sx_hangup(struct tty_struct * tty)
2199 2199
2200 sx_shutdown_port(bp, port); 2200 sx_shutdown_port(bp, port);
2201 spin_lock_irqsave(&port->lock, flags); 2201 spin_lock_irqsave(&port->lock, flags);
2202 bp->count -= port->count; 2202 bp->count -= port->port.count;
2203 if (bp->count < 0) { 2203 if (bp->count < 0) {
2204 printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n", 2204 printk(KERN_ERR "sx%d: sx_hangup: bad board count: %d port: %d\n",
2205 board_No(bp), bp->count, tty->index); 2205 board_No(bp), bp->count, tty->index);
2206 bp->count = 0; 2206 bp->count = 0;
2207 } 2207 }
2208 port->count = 0; 2208 port->port.count = 0;
2209 port->flags &= ~ASYNC_NORMAL_ACTIVE; 2209 port->port.flags &= ~ASYNC_NORMAL_ACTIVE;
2210 port->tty = NULL; 2210 port->port.tty = NULL;
2211 spin_unlock_irqrestore(&port->lock, flags); 2211 spin_unlock_irqrestore(&port->lock, flags);
2212 wake_up_interruptible(&port->open_wait); 2212 wake_up_interruptible(&port->port.open_wait);
2213 2213
2214 func_exit(); 2214 func_exit();
2215} 2215}
@@ -2224,10 +2224,6 @@ static void sx_set_termios(struct tty_struct * tty, struct ktermios * old_termio
2224 if (sx_paranoia_check(port, tty->name, "sx_set_termios")) 2224 if (sx_paranoia_check(port, tty->name, "sx_set_termios"))
2225 return; 2225 return;
2226 2226
2227 if (tty->termios->c_cflag == old_termios->c_cflag &&
2228 tty->termios->c_iflag == old_termios->c_iflag)
2229 return;
2230
2231 bp = port_Board(port); 2227 bp = port_Board(port);
2232 spin_lock_irqsave(&port->lock, flags); 2228 spin_lock_irqsave(&port->lock, flags);
2233 sx_change_speed(port_Board(port), port); 2229 sx_change_speed(port_Board(port), port);
@@ -2297,10 +2293,7 @@ static int sx_init_drivers(void)
2297 memset(sx_port, 0, sizeof(sx_port)); 2293 memset(sx_port, 0, sizeof(sx_port));
2298 for (i = 0; i < SX_NPORT * SX_NBOARD; i++) { 2294 for (i = 0; i < SX_NPORT * SX_NBOARD; i++) {
2299 sx_port[i].magic = SPECIALIX_MAGIC; 2295 sx_port[i].magic = SPECIALIX_MAGIC;
2300 sx_port[i].close_delay = 50 * HZ/100; 2296 tty_port_init(&sx_port[i].port);
2301 sx_port[i].closing_wait = 3000 * HZ/100;
2302 init_waitqueue_head(&sx_port[i].open_wait);
2303 init_waitqueue_head(&sx_port[i].close_wait);
2304 spin_lock_init(&sx_port[i].lock); 2297 spin_lock_init(&sx_port[i].lock);
2305 } 2298 }
2306 2299
diff --git a/drivers/char/specialix_io8.h b/drivers/char/specialix_io8.h
index 3f2f85bdf516..c63005274d9b 100644
--- a/drivers/char/specialix_io8.h
+++ b/drivers/char/specialix_io8.h
@@ -107,23 +107,17 @@ struct specialix_board {
107 107
108struct specialix_port { 108struct specialix_port {
109 int magic; 109 int magic;
110 struct tty_port port;
110 int baud_base; 111 int baud_base;
111 int flags; 112 int flags;
112 struct tty_struct * tty;
113 int count;
114 int blocked_open;
115 int timeout; 113 int timeout;
116 int close_delay;
117 unsigned char * xmit_buf; 114 unsigned char * xmit_buf;
118 int custom_divisor; 115 int custom_divisor;
119 int xmit_head; 116 int xmit_head;
120 int xmit_tail; 117 int xmit_tail;
121 int xmit_cnt; 118 int xmit_cnt;
122 wait_queue_head_t open_wait;
123 wait_queue_head_t close_wait;
124 short wakeup_chars; 119 short wakeup_chars;
125 short break_length; 120 short break_length;
126 unsigned short closing_wait;
127 unsigned char mark_mask; 121 unsigned char mark_mask;
128 unsigned char IER; 122 unsigned char IER;
129 unsigned char MSVR; 123 unsigned char MSVR;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index d17be10c5d21..0243efb0be95 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -613,17 +613,17 @@ static void stl_cd_change(struct stlport *portp)
613{ 613{
614 unsigned int oldsigs = portp->sigs; 614 unsigned int oldsigs = portp->sigs;
615 615
616 if (!portp->tty) 616 if (!portp->port.tty)
617 return; 617 return;
618 618
619 portp->sigs = stl_getsignals(portp); 619 portp->sigs = stl_getsignals(portp);
620 620
621 if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) 621 if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0))
622 wake_up_interruptible(&portp->open_wait); 622 wake_up_interruptible(&portp->port.open_wait);
623 623
624 if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) 624 if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0))
625 if (portp->flags & ASYNC_CHECK_CD) 625 if (portp->port.flags & ASYNC_CHECK_CD)
626 tty_hangup(portp->tty); 626 tty_hangup(portp->port.tty);
627} 627}
628 628
629/* 629/*
@@ -734,11 +734,11 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
734 * On the first open of the device setup the port hardware, and 734 * On the first open of the device setup the port hardware, and
735 * initialize the per port data structure. 735 * initialize the per port data structure.
736 */ 736 */
737 portp->tty = tty; 737 portp->port.tty = tty;
738 tty->driver_data = portp; 738 tty->driver_data = portp;
739 portp->refcount++; 739 portp->port.count++;
740 740
741 if ((portp->flags & ASYNC_INITIALIZED) == 0) { 741 if ((portp->port.flags & ASYNC_INITIALIZED) == 0) {
742 if (!portp->tx.buf) { 742 if (!portp->tx.buf) {
743 portp->tx.buf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL); 743 portp->tx.buf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL);
744 if (!portp->tx.buf) 744 if (!portp->tx.buf)
@@ -752,7 +752,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
752 stl_enablerxtx(portp, 1, 1); 752 stl_enablerxtx(portp, 1, 1);
753 stl_startrxtx(portp, 1, 0); 753 stl_startrxtx(portp, 1, 0);
754 clear_bit(TTY_IO_ERROR, &tty->flags); 754 clear_bit(TTY_IO_ERROR, &tty->flags);
755 portp->flags |= ASYNC_INITIALIZED; 755 portp->port.flags |= ASYNC_INITIALIZED;
756 } 756 }
757 757
758/* 758/*
@@ -761,9 +761,9 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
761 * The sleep here does not need interrupt protection since the wakeup 761 * The sleep here does not need interrupt protection since the wakeup
762 * for it is done with the same context. 762 * for it is done with the same context.
763 */ 763 */
764 if (portp->flags & ASYNC_CLOSING) { 764 if (portp->port.flags & ASYNC_CLOSING) {
765 interruptible_sleep_on(&portp->close_wait); 765 interruptible_sleep_on(&portp->port.close_wait);
766 if (portp->flags & ASYNC_HUP_NOTIFY) 766 if (portp->port.flags & ASYNC_HUP_NOTIFY)
767 return -EAGAIN; 767 return -EAGAIN;
768 return -ERESTARTSYS; 768 return -ERESTARTSYS;
769 } 769 }
@@ -777,7 +777,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
777 if ((rc = stl_waitcarrier(portp, filp)) != 0) 777 if ((rc = stl_waitcarrier(portp, filp)) != 0)
778 return rc; 778 return rc;
779 779
780 portp->flags |= ASYNC_NORMAL_ACTIVE; 780 portp->port.flags |= ASYNC_NORMAL_ACTIVE;
781 781
782 return 0; 782 return 0;
783} 783}
@@ -801,25 +801,25 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp)
801 801
802 spin_lock_irqsave(&stallion_lock, flags); 802 spin_lock_irqsave(&stallion_lock, flags);
803 803
804 if (portp->tty->termios->c_cflag & CLOCAL) 804 if (portp->port.tty->termios->c_cflag & CLOCAL)
805 doclocal++; 805 doclocal++;
806 806
807 portp->openwaitcnt++; 807 portp->openwaitcnt++;
808 if (! tty_hung_up_p(filp)) 808 if (! tty_hung_up_p(filp))
809 portp->refcount--; 809 portp->port.count--;
810 810
811 for (;;) { 811 for (;;) {
812 /* Takes brd_lock internally */ 812 /* Takes brd_lock internally */
813 stl_setsignals(portp, 1, 1); 813 stl_setsignals(portp, 1, 1);
814 if (tty_hung_up_p(filp) || 814 if (tty_hung_up_p(filp) ||
815 ((portp->flags & ASYNC_INITIALIZED) == 0)) { 815 ((portp->port.flags & ASYNC_INITIALIZED) == 0)) {
816 if (portp->flags & ASYNC_HUP_NOTIFY) 816 if (portp->port.flags & ASYNC_HUP_NOTIFY)
817 rc = -EBUSY; 817 rc = -EBUSY;
818 else 818 else
819 rc = -ERESTARTSYS; 819 rc = -ERESTARTSYS;
820 break; 820 break;
821 } 821 }
822 if (((portp->flags & ASYNC_CLOSING) == 0) && 822 if (((portp->port.flags & ASYNC_CLOSING) == 0) &&
823 (doclocal || (portp->sigs & TIOCM_CD))) 823 (doclocal || (portp->sigs & TIOCM_CD)))
824 break; 824 break;
825 if (signal_pending(current)) { 825 if (signal_pending(current)) {
@@ -827,11 +827,11 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp)
827 break; 827 break;
828 } 828 }
829 /* FIXME */ 829 /* FIXME */
830 interruptible_sleep_on(&portp->open_wait); 830 interruptible_sleep_on(&portp->port.open_wait);
831 } 831 }
832 832
833 if (! tty_hung_up_p(filp)) 833 if (! tty_hung_up_p(filp))
834 portp->refcount++; 834 portp->port.count++;
835 portp->openwaitcnt--; 835 portp->openwaitcnt--;
836 spin_unlock_irqrestore(&stallion_lock, flags); 836 spin_unlock_irqrestore(&stallion_lock, flags);
837 837
@@ -904,15 +904,15 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
904 spin_unlock_irqrestore(&stallion_lock, flags); 904 spin_unlock_irqrestore(&stallion_lock, flags);
905 return; 905 return;
906 } 906 }
907 if ((tty->count == 1) && (portp->refcount != 1)) 907 if ((tty->count == 1) && (portp->port.count != 1))
908 portp->refcount = 1; 908 portp->port.count = 1;
909 if (portp->refcount-- > 1) { 909 if (portp->port.count-- > 1) {
910 spin_unlock_irqrestore(&stallion_lock, flags); 910 spin_unlock_irqrestore(&stallion_lock, flags);
911 return; 911 return;
912 } 912 }
913 913
914 portp->refcount = 0; 914 portp->port.count = 0;
915 portp->flags |= ASYNC_CLOSING; 915 portp->port.flags |= ASYNC_CLOSING;
916 916
917/* 917/*
918 * May want to wait for any data to drain before closing. The BUSY 918 * May want to wait for any data to drain before closing. The BUSY
@@ -930,7 +930,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
930 930
931 931
932 spin_lock_irqsave(&stallion_lock, flags); 932 spin_lock_irqsave(&stallion_lock, flags);
933 portp->flags &= ~ASYNC_INITIALIZED; 933 portp->port.flags &= ~ASYNC_INITIALIZED;
934 spin_unlock_irqrestore(&stallion_lock, flags); 934 spin_unlock_irqrestore(&stallion_lock, flags);
935 935
936 stl_disableintrs(portp); 936 stl_disableintrs(portp);
@@ -949,16 +949,16 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
949 tty_ldisc_flush(tty); 949 tty_ldisc_flush(tty);
950 950
951 tty->closing = 0; 951 tty->closing = 0;
952 portp->tty = NULL; 952 portp->port.tty = NULL;
953 953
954 if (portp->openwaitcnt) { 954 if (portp->openwaitcnt) {
955 if (portp->close_delay) 955 if (portp->close_delay)
956 msleep_interruptible(jiffies_to_msecs(portp->close_delay)); 956 msleep_interruptible(jiffies_to_msecs(portp->close_delay));
957 wake_up_interruptible(&portp->open_wait); 957 wake_up_interruptible(&portp->port.open_wait);
958 } 958 }
959 959
960 portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 960 portp->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
961 wake_up_interruptible(&portp->close_wait); 961 wake_up_interruptible(&portp->port.close_wait);
962} 962}
963 963
964/*****************************************************************************/ 964/*****************************************************************************/
@@ -1153,7 +1153,7 @@ static int stl_getserial(struct stlport *portp, struct serial_struct __user *sp)
1153 memset(&sio, 0, sizeof(struct serial_struct)); 1153 memset(&sio, 0, sizeof(struct serial_struct));
1154 sio.line = portp->portnr; 1154 sio.line = portp->portnr;
1155 sio.port = portp->ioaddr; 1155 sio.port = portp->ioaddr;
1156 sio.flags = portp->flags; 1156 sio.flags = portp->port.flags;
1157 sio.baud_base = portp->baud_base; 1157 sio.baud_base = portp->baud_base;
1158 sio.close_delay = portp->close_delay; 1158 sio.close_delay = portp->close_delay;
1159 sio.closing_wait = portp->closing_wait; 1159 sio.closing_wait = portp->closing_wait;
@@ -1194,17 +1194,17 @@ static int stl_setserial(struct stlport *portp, struct serial_struct __user *sp)
1194 if ((sio.baud_base != portp->baud_base) || 1194 if ((sio.baud_base != portp->baud_base) ||
1195 (sio.close_delay != portp->close_delay) || 1195 (sio.close_delay != portp->close_delay) ||
1196 ((sio.flags & ~ASYNC_USR_MASK) != 1196 ((sio.flags & ~ASYNC_USR_MASK) !=
1197 (portp->flags & ~ASYNC_USR_MASK))) 1197 (portp->port.flags & ~ASYNC_USR_MASK)))
1198 return -EPERM; 1198 return -EPERM;
1199 } 1199 }
1200 1200
1201 portp->flags = (portp->flags & ~ASYNC_USR_MASK) | 1201 portp->port.flags = (portp->port.flags & ~ASYNC_USR_MASK) |
1202 (sio.flags & ASYNC_USR_MASK); 1202 (sio.flags & ASYNC_USR_MASK);
1203 portp->baud_base = sio.baud_base; 1203 portp->baud_base = sio.baud_base;
1204 portp->close_delay = sio.close_delay; 1204 portp->close_delay = sio.close_delay;
1205 portp->closing_wait = sio.closing_wait; 1205 portp->closing_wait = sio.closing_wait;
1206 portp->custom_divisor = sio.custom_divisor; 1206 portp->custom_divisor = sio.custom_divisor;
1207 stl_setport(portp, portp->tty->termios); 1207 stl_setport(portp, portp->port.tty->termios);
1208 return 0; 1208 return 0;
1209} 1209}
1210 1210
@@ -1353,7 +1353,7 @@ static void stl_settermios(struct tty_struct *tty, struct ktermios *old)
1353 stl_start(tty); 1353 stl_start(tty);
1354 } 1354 }
1355 if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL)) 1355 if (((old->c_cflag & CLOCAL) == 0) && (tiosp->c_cflag & CLOCAL))
1356 wake_up_interruptible(&portp->open_wait); 1356 wake_up_interruptible(&portp->port.open_wait);
1357} 1357}
1358 1358
1359/*****************************************************************************/ 1359/*****************************************************************************/
@@ -1438,7 +1438,7 @@ static void stl_hangup(struct tty_struct *tty)
1438 if (portp == NULL) 1438 if (portp == NULL)
1439 return; 1439 return;
1440 1440
1441 portp->flags &= ~ASYNC_INITIALIZED; 1441 portp->port.flags &= ~ASYNC_INITIALIZED;
1442 stl_disableintrs(portp); 1442 stl_disableintrs(portp);
1443 if (tty->termios->c_cflag & HUPCL) 1443 if (tty->termios->c_cflag & HUPCL)
1444 stl_setsignals(portp, 0, 0); 1444 stl_setsignals(portp, 0, 0);
@@ -1452,10 +1452,10 @@ static void stl_hangup(struct tty_struct *tty)
1452 portp->tx.head = NULL; 1452 portp->tx.head = NULL;
1453 portp->tx.tail = NULL; 1453 portp->tx.tail = NULL;
1454 } 1454 }
1455 portp->tty = NULL; 1455 portp->port.tty = NULL;
1456 portp->flags &= ~ASYNC_NORMAL_ACTIVE; 1456 portp->port.flags &= ~ASYNC_NORMAL_ACTIVE;
1457 portp->refcount = 0; 1457 portp->port.count = 0;
1458 wake_up_interruptible(&portp->open_wait); 1458 wake_up_interruptible(&portp->port.open_wait);
1459} 1459}
1460 1460
1461/*****************************************************************************/ 1461/*****************************************************************************/
@@ -1814,8 +1814,8 @@ static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp)
1814 portp->baud_base = STL_BAUDBASE; 1814 portp->baud_base = STL_BAUDBASE;
1815 portp->close_delay = STL_CLOSEDELAY; 1815 portp->close_delay = STL_CLOSEDELAY;
1816 portp->closing_wait = 30 * HZ; 1816 portp->closing_wait = 30 * HZ;
1817 init_waitqueue_head(&portp->open_wait); 1817 init_waitqueue_head(&portp->port.open_wait);
1818 init_waitqueue_head(&portp->close_wait); 1818 init_waitqueue_head(&portp->port.close_wait);
1819 portp->stats.brd = portp->brdnr; 1819 portp->stats.brd = portp->brdnr;
1820 portp->stats.panel = portp->panelnr; 1820 portp->stats.panel = portp->panelnr;
1821 portp->stats.port = portp->portnr; 1821 portp->stats.port = portp->portnr;
@@ -1840,8 +1840,8 @@ static void stl_cleanup_panels(struct stlbrd *brdp)
1840 portp = panelp->ports[k]; 1840 portp = panelp->ports[k];
1841 if (portp == NULL) 1841 if (portp == NULL)
1842 continue; 1842 continue;
1843 if (portp->tty != NULL) 1843 if (portp->port.tty != NULL)
1844 stl_hangup(portp->tty); 1844 stl_hangup(portp->port.tty);
1845 kfree(portp->tx.buf); 1845 kfree(portp->tx.buf);
1846 kfree(portp); 1846 kfree(portp);
1847 } 1847 }
@@ -2513,7 +2513,7 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
2513 } 2513 }
2514 2514
2515 portp->stats.state = portp->istate; 2515 portp->stats.state = portp->istate;
2516 portp->stats.flags = portp->flags; 2516 portp->stats.flags = portp->port.flags;
2517 portp->stats.hwid = portp->hwid; 2517 portp->stats.hwid = portp->hwid;
2518 2518
2519 portp->stats.ttystate = 0; 2519 portp->stats.ttystate = 0;
@@ -2524,16 +2524,16 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
2524 portp->stats.rxbuffered = 0; 2524 portp->stats.rxbuffered = 0;
2525 2525
2526 spin_lock_irqsave(&stallion_lock, flags); 2526 spin_lock_irqsave(&stallion_lock, flags);
2527 if (portp->tty != NULL) 2527 if (portp->port.tty != NULL)
2528 if (portp->tty->driver_data == portp) { 2528 if (portp->port.tty->driver_data == portp) {
2529 portp->stats.ttystate = portp->tty->flags; 2529 portp->stats.ttystate = portp->port.tty->flags;
2530 /* No longer available as a statistic */ 2530 /* No longer available as a statistic */
2531 portp->stats.rxbuffered = 1; /*portp->tty->flip.count; */ 2531 portp->stats.rxbuffered = 1; /*portp->port.tty->flip.count; */
2532 if (portp->tty->termios != NULL) { 2532 if (portp->port.tty->termios != NULL) {
2533 portp->stats.cflags = portp->tty->termios->c_cflag; 2533 portp->stats.cflags = portp->port.tty->termios->c_cflag;
2534 portp->stats.iflags = portp->tty->termios->c_iflag; 2534 portp->stats.iflags = portp->port.tty->termios->c_iflag;
2535 portp->stats.oflags = portp->tty->termios->c_oflag; 2535 portp->stats.oflags = portp->port.tty->termios->c_oflag;
2536 portp->stats.lflags = portp->tty->termios->c_lflag; 2536 portp->stats.lflags = portp->port.tty->termios->c_lflag;
2537 } 2537 }
2538 } 2538 }
2539 spin_unlock_irqrestore(&stallion_lock, flags); 2539 spin_unlock_irqrestore(&stallion_lock, flags);
@@ -2939,15 +2939,15 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp)
2939 } 2939 }
2940 baudrate = stl_baudrates[baudrate]; 2940 baudrate = stl_baudrates[baudrate];
2941 if ((tiosp->c_cflag & CBAUD) == B38400) { 2941 if ((tiosp->c_cflag & CBAUD) == B38400) {
2942 if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 2942 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
2943 baudrate = 57600; 2943 baudrate = 57600;
2944 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 2944 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
2945 baudrate = 115200; 2945 baudrate = 115200;
2946 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 2946 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
2947 baudrate = 230400; 2947 baudrate = 230400;
2948 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 2948 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
2949 baudrate = 460800; 2949 baudrate = 460800;
2950 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 2950 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
2951 baudrate = (portp->baud_base / portp->custom_divisor); 2951 baudrate = (portp->baud_base / portp->custom_divisor);
2952 } 2952 }
2953 if (baudrate > STL_CD1400MAXBAUD) 2953 if (baudrate > STL_CD1400MAXBAUD)
@@ -2969,9 +2969,9 @@ static void stl_cd1400setport(struct stlport *portp, struct ktermios *tiosp)
2969 mcor1 |= MCOR1_DCD; 2969 mcor1 |= MCOR1_DCD;
2970 mcor2 |= MCOR2_DCD; 2970 mcor2 |= MCOR2_DCD;
2971 sreron |= SRER_MODEM; 2971 sreron |= SRER_MODEM;
2972 portp->flags |= ASYNC_CHECK_CD; 2972 portp->port.flags |= ASYNC_CHECK_CD;
2973 } else 2973 } else
2974 portp->flags &= ~ASYNC_CHECK_CD; 2974 portp->port.flags &= ~ASYNC_CHECK_CD;
2975 2975
2976/* 2976/*
2977 * Setup cd1400 enhanced modes if we can. In particular we want to 2977 * Setup cd1400 enhanced modes if we can. In particular we want to
@@ -3242,7 +3242,7 @@ static void stl_cd1400flowctrl(struct stlport *portp, int state)
3242 3242
3243 if (portp == NULL) 3243 if (portp == NULL)
3244 return; 3244 return;
3245 tty = portp->tty; 3245 tty = portp->port.tty;
3246 if (tty == NULL) 3246 if (tty == NULL)
3247 return; 3247 return;
3248 3248
@@ -3304,7 +3304,7 @@ static void stl_cd1400sendflow(struct stlport *portp, int state)
3304 3304
3305 if (portp == NULL) 3305 if (portp == NULL)
3306 return; 3306 return;
3307 tty = portp->tty; 3307 tty = portp->port.tty;
3308 if (tty == NULL) 3308 if (tty == NULL)
3309 return; 3309 return;
3310 3310
@@ -3503,8 +3503,8 @@ static void stl_cd1400txisr(struct stlpanel *panelp, int ioaddr)
3503 if ((len == 0) || ((len < STL_TXBUFLOW) && 3503 if ((len == 0) || ((len < STL_TXBUFLOW) &&
3504 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { 3504 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) {
3505 set_bit(ASYI_TXLOW, &portp->istate); 3505 set_bit(ASYI_TXLOW, &portp->istate);
3506 if (portp->tty) 3506 if (portp->port.tty)
3507 tty_wakeup(portp->tty); 3507 tty_wakeup(portp->port.tty);
3508 } 3508 }
3509 3509
3510 if (len == 0) { 3510 if (len == 0) {
@@ -3568,7 +3568,7 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr)
3568 return; 3568 return;
3569 } 3569 }
3570 portp = panelp->ports[(ioack >> 3)]; 3570 portp = panelp->ports[(ioack >> 3)];
3571 tty = portp->tty; 3571 tty = portp->port.tty;
3572 3572
3573 if ((ioack & ACK_TYPMASK) == ACK_TYPRXGOOD) { 3573 if ((ioack & ACK_TYPMASK) == ACK_TYPRXGOOD) {
3574 outb((RDCR + portp->uartaddr), ioaddr); 3574 outb((RDCR + portp->uartaddr), ioaddr);
@@ -3613,7 +3613,7 @@ static void stl_cd1400rxisr(struct stlpanel *panelp, int ioaddr)
3613 if (portp->rxmarkmsk & status) { 3613 if (portp->rxmarkmsk & status) {
3614 if (status & ST_BREAK) { 3614 if (status & ST_BREAK) {
3615 status = TTY_BREAK; 3615 status = TTY_BREAK;
3616 if (portp->flags & ASYNC_SAK) { 3616 if (portp->port.flags & ASYNC_SAK) {
3617 do_SAK(tty); 3617 do_SAK(tty);
3618 BRDENABLE(portp->brdnr, portp->pagenr); 3618 BRDENABLE(portp->brdnr, portp->pagenr);
3619 } 3619 }
@@ -3899,15 +3899,15 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp)
3899 } 3899 }
3900 baudrate = stl_baudrates[baudrate]; 3900 baudrate = stl_baudrates[baudrate];
3901 if ((tiosp->c_cflag & CBAUD) == B38400) { 3901 if ((tiosp->c_cflag & CBAUD) == B38400) {
3902 if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 3902 if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
3903 baudrate = 57600; 3903 baudrate = 57600;
3904 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 3904 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
3905 baudrate = 115200; 3905 baudrate = 115200;
3906 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 3906 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
3907 baudrate = 230400; 3907 baudrate = 230400;
3908 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 3908 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
3909 baudrate = 460800; 3909 baudrate = 460800;
3910 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) 3910 else if ((portp->port.flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)
3911 baudrate = (portp->baud_base / portp->custom_divisor); 3911 baudrate = (portp->baud_base / portp->custom_divisor);
3912 } 3912 }
3913 if (baudrate > STL_SC26198MAXBAUD) 3913 if (baudrate > STL_SC26198MAXBAUD)
@@ -3922,11 +3922,11 @@ static void stl_sc26198setport(struct stlport *portp, struct ktermios *tiosp)
3922 * Check what form of modem signaling is required and set it up. 3922 * Check what form of modem signaling is required and set it up.
3923 */ 3923 */
3924 if (tiosp->c_cflag & CLOCAL) { 3924 if (tiosp->c_cflag & CLOCAL) {
3925 portp->flags &= ~ASYNC_CHECK_CD; 3925 portp->port.flags &= ~ASYNC_CHECK_CD;
3926 } else { 3926 } else {
3927 iopr |= IOPR_DCDCOS; 3927 iopr |= IOPR_DCDCOS;
3928 imron |= IR_IOPORT; 3928 imron |= IR_IOPORT;
3929 portp->flags |= ASYNC_CHECK_CD; 3929 portp->port.flags |= ASYNC_CHECK_CD;
3930 } 3930 }
3931 3931
3932/* 3932/*
@@ -4174,7 +4174,7 @@ static void stl_sc26198flowctrl(struct stlport *portp, int state)
4174 4174
4175 if (portp == NULL) 4175 if (portp == NULL)
4176 return; 4176 return;
4177 tty = portp->tty; 4177 tty = portp->port.tty;
4178 if (tty == NULL) 4178 if (tty == NULL)
4179 return; 4179 return;
4180 4180
@@ -4243,7 +4243,7 @@ static void stl_sc26198sendflow(struct stlport *portp, int state)
4243 4243
4244 if (portp == NULL) 4244 if (portp == NULL)
4245 return; 4245 return;
4246 tty = portp->tty; 4246 tty = portp->port.tty;
4247 if (tty == NULL) 4247 if (tty == NULL)
4248 return; 4248 return;
4249 4249
@@ -4421,8 +4421,8 @@ static void stl_sc26198txisr(struct stlport *portp)
4421 if ((len == 0) || ((len < STL_TXBUFLOW) && 4421 if ((len == 0) || ((len < STL_TXBUFLOW) &&
4422 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { 4422 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) {
4423 set_bit(ASYI_TXLOW, &portp->istate); 4423 set_bit(ASYI_TXLOW, &portp->istate);
4424 if (portp->tty) 4424 if (portp->port.tty)
4425 tty_wakeup(portp->tty); 4425 tty_wakeup(portp->port.tty);
4426 } 4426 }
4427 4427
4428 if (len == 0) { 4428 if (len == 0) {
@@ -4475,7 +4475,7 @@ static void stl_sc26198rxisr(struct stlport *portp, unsigned int iack)
4475 4475
4476 pr_debug("stl_sc26198rxisr(portp=%p,iack=%x)\n", portp, iack); 4476 pr_debug("stl_sc26198rxisr(portp=%p,iack=%x)\n", portp, iack);
4477 4477
4478 tty = portp->tty; 4478 tty = portp->port.tty;
4479 ioaddr = portp->ioaddr; 4479 ioaddr = portp->ioaddr;
4480 outb(GIBCR, (ioaddr + XP_ADDR)); 4480 outb(GIBCR, (ioaddr + XP_ADDR));
4481 len = inb(ioaddr + XP_DATA) + 1; 4481 len = inb(ioaddr + XP_DATA) + 1;
@@ -4527,7 +4527,7 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char
4527 struct tty_struct *tty; 4527 struct tty_struct *tty;
4528 unsigned int ioaddr; 4528 unsigned int ioaddr;
4529 4529
4530 tty = portp->tty; 4530 tty = portp->port.tty;
4531 ioaddr = portp->ioaddr; 4531 ioaddr = portp->ioaddr;
4532 4532
4533 if (status & SR_RXPARITY) 4533 if (status & SR_RXPARITY)
@@ -4544,7 +4544,7 @@ static void stl_sc26198rxbadch(struct stlport *portp, unsigned char status, char
4544 if (portp->rxmarkmsk & status) { 4544 if (portp->rxmarkmsk & status) {
4545 if (status & SR_RXBREAK) { 4545 if (status & SR_RXBREAK) {
4546 status = TTY_BREAK; 4546 status = TTY_BREAK;
4547 if (portp->flags & ASYNC_SAK) { 4547 if (portp->port.flags & ASYNC_SAK) {
4548 do_SAK(tty); 4548 do_SAK(tty);
4549 BRDENABLE(portp->brdnr, portp->pagenr); 4549 BRDENABLE(portp->brdnr, portp->pagenr);
4550 } 4550 }
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index b1a7a8cb65ea..d5cffcd6a572 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1,4 +1,3 @@
1
2/* sx.c -- driver for the Specialix SX series cards. 1/* sx.c -- driver for the Specialix SX series cards.
3 * 2 *
4 * This driver will also support the older SI, and XIO cards. 3 * This driver will also support the older SI, and XIO cards.
@@ -930,7 +929,7 @@ static int sx_set_real_termios(void *ptr)
930 929
931 func_enter2(); 930 func_enter2();
932 931
933 if (!port->gs.tty) 932 if (!port->gs.port.tty)
934 return 0; 933 return 0;
935 934
936 /* What is this doing here? -- REW 935 /* What is this doing here? -- REW
@@ -941,19 +940,19 @@ static int sx_set_real_termios(void *ptr)
941 940
942 sx_set_baud(port); 941 sx_set_baud(port);
943 942
944#define CFLAG port->gs.tty->termios->c_cflag 943#define CFLAG port->gs.port.tty->termios->c_cflag
945 sx_write_channel_byte(port, hi_mr1, 944 sx_write_channel_byte(port, hi_mr1,
946 (C_PARENB(port->gs.tty) ? MR1_WITH : MR1_NONE) | 945 (C_PARENB(port->gs.port.tty) ? MR1_WITH : MR1_NONE) |
947 (C_PARODD(port->gs.tty) ? MR1_ODD : MR1_EVEN) | 946 (C_PARODD(port->gs.port.tty) ? MR1_ODD : MR1_EVEN) |
948 (C_CRTSCTS(port->gs.tty) ? MR1_RTS_RXFLOW : 0) | 947 (C_CRTSCTS(port->gs.port.tty) ? MR1_RTS_RXFLOW : 0) |
949 (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) | 948 (((CFLAG & CSIZE) == CS8) ? MR1_8_BITS : 0) |
950 (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) | 949 (((CFLAG & CSIZE) == CS7) ? MR1_7_BITS : 0) |
951 (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) | 950 (((CFLAG & CSIZE) == CS6) ? MR1_6_BITS : 0) |
952 (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0)); 951 (((CFLAG & CSIZE) == CS5) ? MR1_5_BITS : 0));
953 952
954 sx_write_channel_byte(port, hi_mr2, 953 sx_write_channel_byte(port, hi_mr2,
955 (C_CRTSCTS(port->gs.tty) ? MR2_CTS_TXFLOW : 0) | 954 (C_CRTSCTS(port->gs.port.tty) ? MR2_CTS_TXFLOW : 0) |
956 (C_CSTOPB(port->gs.tty) ? MR2_2_STOP : 955 (C_CSTOPB(port->gs.port.tty) ? MR2_2_STOP :
957 MR2_1_STOP)); 956 MR2_1_STOP));
958 957
959 switch (CFLAG & CSIZE) { 958 switch (CFLAG & CSIZE) {
@@ -976,44 +975,44 @@ static int sx_set_real_termios(void *ptr)
976 } 975 }
977 976
978 sx_write_channel_byte(port, hi_prtcl, 977 sx_write_channel_byte(port, hi_prtcl,
979 (I_IXON(port->gs.tty) ? SP_TXEN : 0) | 978 (I_IXON(port->gs.port.tty) ? SP_TXEN : 0) |
980 (I_IXOFF(port->gs.tty) ? SP_RXEN : 0) | 979 (I_IXOFF(port->gs.port.tty) ? SP_RXEN : 0) |
981 (I_IXANY(port->gs.tty) ? SP_TANY : 0) | SP_DCEN); 980 (I_IXANY(port->gs.port.tty) ? SP_TANY : 0) | SP_DCEN);
982 981
983 sx_write_channel_byte(port, hi_break, 982 sx_write_channel_byte(port, hi_break,
984 (I_IGNBRK(port->gs.tty) ? BR_IGN : 0 | 983 (I_IGNBRK(port->gs.port.tty) ? BR_IGN : 0 |
985 I_BRKINT(port->gs.tty) ? BR_INT : 0)); 984 I_BRKINT(port->gs.port.tty) ? BR_INT : 0));
986 985
987 sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.tty)); 986 sx_write_channel_byte(port, hi_txon, START_CHAR(port->gs.port.tty));
988 sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.tty)); 987 sx_write_channel_byte(port, hi_rxon, START_CHAR(port->gs.port.tty));
989 sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.tty)); 988 sx_write_channel_byte(port, hi_txoff, STOP_CHAR(port->gs.port.tty));
990 sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.tty)); 989 sx_write_channel_byte(port, hi_rxoff, STOP_CHAR(port->gs.port.tty));
991 990
992 sx_reconfigure_port(port); 991 sx_reconfigure_port(port);
993 992
994 /* Tell line discipline whether we will do input cooking */ 993 /* Tell line discipline whether we will do input cooking */
995 if (I_OTHER(port->gs.tty)) { 994 if (I_OTHER(port->gs.port.tty)) {
996 clear_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); 995 clear_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags);
997 } else { 996 } else {
998 set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); 997 set_bit(TTY_HW_COOK_IN, &port->gs.port.tty->flags);
999 } 998 }
1000 sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ", 999 sx_dprintk(SX_DEBUG_TERMIOS, "iflags: %x(%d) ",
1001 (unsigned int)port->gs.tty->termios->c_iflag, 1000 (unsigned int)port->gs.port.tty->termios->c_iflag,
1002 I_OTHER(port->gs.tty)); 1001 I_OTHER(port->gs.port.tty));
1003 1002
1004/* Tell line discipline whether we will do output cooking. 1003/* Tell line discipline whether we will do output cooking.
1005 * If OPOST is set and no other output flags are set then we can do output 1004 * If OPOST is set and no other output flags are set then we can do output
1006 * processing. Even if only *one* other flag in the O_OTHER group is set 1005 * processing. Even if only *one* other flag in the O_OTHER group is set
1007 * we do cooking in software. 1006 * we do cooking in software.
1008 */ 1007 */
1009 if (O_OPOST(port->gs.tty) && !O_OTHER(port->gs.tty)) { 1008 if (O_OPOST(port->gs.port.tty) && !O_OTHER(port->gs.port.tty)) {
1010 set_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); 1009 set_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags);
1011 } else { 1010 } else {
1012 clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); 1011 clear_bit(TTY_HW_COOK_OUT, &port->gs.port.tty->flags);
1013 } 1012 }
1014 sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", 1013 sx_dprintk(SX_DEBUG_TERMIOS, "oflags: %x(%d)\n",
1015 (unsigned int)port->gs.tty->termios->c_oflag, 1014 (unsigned int)port->gs.port.tty->termios->c_oflag,
1016 O_OTHER(port->gs.tty)); 1015 O_OTHER(port->gs.port.tty));
1017 /* port->c_dcd = sx_get_CD (port); */ 1016 /* port->c_dcd = sx_get_CD (port); */
1018 func_exit(); 1017 func_exit();
1019 return 0; 1018 return 0;
@@ -1102,8 +1101,8 @@ static void sx_transmit_chars(struct sx_port *port)
1102 sx_disable_tx_interrupts(port); 1101 sx_disable_tx_interrupts(port);
1103 } 1102 }
1104 1103
1105 if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.tty) { 1104 if ((port->gs.xmit_cnt <= port->gs.wakeup_chars) && port->gs.port.tty) {
1106 tty_wakeup(port->gs.tty); 1105 tty_wakeup(port->gs.port.tty);
1107 sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n", 1106 sx_dprintk(SX_DEBUG_TRANSMIT, "Waking up.... ldisc (%d)....\n",
1108 port->gs.wakeup_chars); 1107 port->gs.wakeup_chars);
1109 } 1108 }
@@ -1126,7 +1125,7 @@ static inline void sx_receive_chars(struct sx_port *port)
1126 unsigned char *rp; 1125 unsigned char *rp;
1127 1126
1128 func_enter2(); 1127 func_enter2();
1129 tty = port->gs.tty; 1128 tty = port->gs.port.tty;
1130 while (1) { 1129 while (1) {
1131 rx_op = sx_read_channel_byte(port, hi_rxopos); 1130 rx_op = sx_read_channel_byte(port, hi_rxopos);
1132 c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff; 1131 c = (sx_read_channel_byte(port, hi_rxipos) - rx_op) & 0xff;
@@ -1211,12 +1210,12 @@ static inline void sx_check_modem_signals(struct sx_port *port)
1211 /* DCD went UP */ 1210 /* DCD went UP */
1212 if ((sx_read_channel_byte(port, hi_hstat) != 1211 if ((sx_read_channel_byte(port, hi_hstat) !=
1213 HS_IDLE_CLOSED) && 1212 HS_IDLE_CLOSED) &&
1214 !(port->gs.tty->termios-> 1213 !(port->gs.port.tty->termios->
1215 c_cflag & CLOCAL)) { 1214 c_cflag & CLOCAL)) {
1216 /* Are we blocking in open? */ 1215 /* Are we blocking in open? */
1217 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1216 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
1218 "active, unblocking open\n"); 1217 "active, unblocking open\n");
1219 wake_up_interruptible(&port->gs. 1218 wake_up_interruptible(&port->gs.port.
1220 open_wait); 1219 open_wait);
1221 } else { 1220 } else {
1222 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1221 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
@@ -1224,10 +1223,10 @@ static inline void sx_check_modem_signals(struct sx_port *port)
1224 } 1223 }
1225 } else { 1224 } else {
1226 /* DCD went down! */ 1225 /* DCD went down! */
1227 if (!(port->gs.tty->termios->c_cflag & CLOCAL)){ 1226 if (!(port->gs.port.tty->termios->c_cflag & CLOCAL)){
1228 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1227 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
1229 "dropped. hanging up....\n"); 1228 "dropped. hanging up....\n");
1230 tty_hangup(port->gs.tty); 1229 tty_hangup(port->gs.port.tty);
1231 } else { 1230 } else {
1232 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD " 1231 sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD "
1233 "dropped. ignoring.\n"); 1232 "dropped. ignoring.\n");
@@ -1325,7 +1324,7 @@ static irqreturn_t sx_interrupt(int irq, void *ptr)
1325 1324
1326 for (i = 0; i < board->nports; i++) { 1325 for (i = 0; i < board->nports; i++) {
1327 port = &board->ports[i]; 1326 port = &board->ports[i];
1328 if (port->gs.flags & GS_ACTIVE) { 1327 if (port->gs.port.flags & GS_ACTIVE) {
1329 if (sx_read_channel_byte(port, hi_state)) { 1328 if (sx_read_channel_byte(port, hi_state)) {
1330 sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: " 1329 sx_dprintk(SX_DEBUG_INTERRUPTS, "Port %d: "
1331 "modem signal change?... \n",i); 1330 "modem signal change?... \n",i);
@@ -1334,7 +1333,7 @@ static irqreturn_t sx_interrupt(int irq, void *ptr)
1334 if (port->gs.xmit_cnt) { 1333 if (port->gs.xmit_cnt) {
1335 sx_transmit_chars(port); 1334 sx_transmit_chars(port);
1336 } 1335 }
1337 if (!(port->gs.flags & SX_RX_THROTTLE)) { 1336 if (!(port->gs.port.flags & SX_RX_THROTTLE)) {
1338 sx_receive_chars(port); 1337 sx_receive_chars(port);
1339 } 1338 }
1340 } 1339 }
@@ -1373,7 +1372,7 @@ static void sx_disable_tx_interrupts(void *ptr)
1373 struct sx_port *port = ptr; 1372 struct sx_port *port = ptr;
1374 func_enter2(); 1373 func_enter2();
1375 1374
1376 port->gs.flags &= ~GS_TX_INTEN; 1375 port->gs.port.flags &= ~GS_TX_INTEN;
1377 1376
1378 func_exit(); 1377 func_exit();
1379} 1378}
@@ -1394,7 +1393,7 @@ static void sx_enable_tx_interrupts(void *ptr)
1394 1393
1395 /* XXX Must be "HIGH_WATER" for SI card according to doc. */ 1394 /* XXX Must be "HIGH_WATER" for SI card according to doc. */
1396 if (data_in_buffer < LOW_WATER) 1395 if (data_in_buffer < LOW_WATER)
1397 port->gs.flags &= ~GS_TX_INTEN; 1396 port->gs.port.flags &= ~GS_TX_INTEN;
1398 1397
1399 func_exit(); 1398 func_exit();
1400} 1399}
@@ -1442,8 +1441,8 @@ static void sx_shutdown_port(void *ptr)
1442 1441
1443 func_enter(); 1442 func_enter();
1444 1443
1445 port->gs.flags &= ~GS_ACTIVE; 1444 port->gs.port.flags &= ~GS_ACTIVE;
1446 if (port->gs.tty && (port->gs.tty->termios->c_cflag & HUPCL)) { 1445 if (port->gs.port.tty && (port->gs.port.tty->termios->c_cflag & HUPCL)) {
1447 sx_setsignals(port, 0, 0); 1446 sx_setsignals(port, 0, 0);
1448 sx_reconfigure_port(port); 1447 sx_reconfigure_port(port);
1449 } 1448 }
@@ -1485,8 +1484,8 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1485 spin_lock_irqsave(&port->gs.driver_lock, flags); 1484 spin_lock_irqsave(&port->gs.driver_lock, flags);
1486 1485
1487 tty->driver_data = port; 1486 tty->driver_data = port;
1488 port->gs.tty = tty; 1487 port->gs.port.tty = tty;
1489 port->gs.count++; 1488 port->gs.port.count++;
1490 spin_unlock_irqrestore(&port->gs.driver_lock, flags); 1489 spin_unlock_irqrestore(&port->gs.driver_lock, flags);
1491 1490
1492 sx_dprintk(SX_DEBUG_OPEN, "starting port\n"); 1491 sx_dprintk(SX_DEBUG_OPEN, "starting port\n");
@@ -1497,12 +1496,12 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1497 retval = gs_init_port(&port->gs); 1496 retval = gs_init_port(&port->gs);
1498 sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n"); 1497 sx_dprintk(SX_DEBUG_OPEN, "done gs_init\n");
1499 if (retval) { 1498 if (retval) {
1500 port->gs.count--; 1499 port->gs.port.count--;
1501 return retval; 1500 return retval;
1502 } 1501 }
1503 1502
1504 port->gs.flags |= GS_ACTIVE; 1503 port->gs.port.flags |= GS_ACTIVE;
1505 if (port->gs.count <= 1) 1504 if (port->gs.port.count <= 1)
1506 sx_setsignals(port, 1, 1); 1505 sx_setsignals(port, 1, 1);
1507 1506
1508#if 0 1507#if 0
@@ -1513,12 +1512,12 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1513 my_hd_io(port->board->base + port->ch_base, sizeof(*port)); 1512 my_hd_io(port->board->base + port->ch_base, sizeof(*port));
1514#endif 1513#endif
1515 1514
1516 if (port->gs.count <= 1) { 1515 if (port->gs.port.count <= 1) {
1517 if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) { 1516 if (sx_send_command(port, HS_LOPEN, -1, HS_IDLE_OPEN) != 1) {
1518 printk(KERN_ERR "sx: Card didn't respond to LOPEN " 1517 printk(KERN_ERR "sx: Card didn't respond to LOPEN "
1519 "command.\n"); 1518 "command.\n");
1520 spin_lock_irqsave(&port->gs.driver_lock, flags); 1519 spin_lock_irqsave(&port->gs.driver_lock, flags);
1521 port->gs.count--; 1520 port->gs.port.count--;
1522 spin_unlock_irqrestore(&port->gs.driver_lock, flags); 1521 spin_unlock_irqrestore(&port->gs.driver_lock, flags);
1523 return -EIO; 1522 return -EIO;
1524 } 1523 }
@@ -1526,11 +1525,11 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1526 1525
1527 retval = gs_block_til_ready(port, filp); 1526 retval = gs_block_til_ready(port, filp);
1528 sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n", 1527 sx_dprintk(SX_DEBUG_OPEN, "Block til ready returned %d. Count=%d\n",
1529 retval, port->gs.count); 1528 retval, port->gs.port.count);
1530 1529
1531 if (retval) { 1530 if (retval) {
1532/* 1531/*
1533 * Don't lower gs.count here because sx_close() will be called later 1532 * Don't lower gs.port.count here because sx_close() will be called later
1534 */ 1533 */
1535 1534
1536 return retval; 1535 return retval;
@@ -1571,14 +1570,14 @@ static void sx_close(void *ptr)
1571 } 1570 }
1572 1571
1573 sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n", 1572 sx_dprintk(SX_DEBUG_CLOSE, "waited %d jiffies for close. count=%d\n",
1574 5 * HZ - to - 1, port->gs.count); 1573 5 * HZ - to - 1, port->gs.port.count);
1575 1574
1576 if (port->gs.count) { 1575 if (port->gs.port.count) {
1577 sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n", 1576 sx_dprintk(SX_DEBUG_CLOSE, "WARNING port count:%d\n",
1578 port->gs.count); 1577 port->gs.port.count);
1579 /*printk("%s SETTING port count to zero: %p count: %d\n", 1578 /*printk("%s SETTING port count to zero: %p count: %d\n",
1580 __func__, port, port->gs.count); 1579 __func__, port, port->gs.port.count);
1581 port->gs.count = 0;*/ 1580 port->gs.port.count = 0;*/
1582 } 1581 }
1583 1582
1584 func_exit(); 1583 func_exit();
@@ -1939,7 +1938,7 @@ static void sx_throttle(struct tty_struct *tty)
1939 * control then throttle the port. 1938 * control then throttle the port.
1940 */ 1939 */
1941 if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) { 1940 if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) {
1942 port->gs.flags |= SX_RX_THROTTLE; 1941 port->gs.port.flags |= SX_RX_THROTTLE;
1943 } 1942 }
1944 func_exit(); 1943 func_exit();
1945} 1944}
@@ -1953,7 +1952,7 @@ static void sx_unthrottle(struct tty_struct *tty)
1953 * this port in case we disabled flow control while the port 1952 * this port in case we disabled flow control while the port
1954 * was throttled 1953 * was throttled
1955 */ 1954 */
1956 port->gs.flags &= ~SX_RX_THROTTLE; 1955 port->gs.port.flags &= ~SX_RX_THROTTLE;
1957 func_exit(); 1956 func_exit();
1958 return; 1957 return;
1959} 1958}
@@ -2396,6 +2395,7 @@ static int sx_init_portstructs(int nboards, int nports)
2396 board->ports = port; 2395 board->ports = port;
2397 for (j = 0; j < boards[i].nports; j++) { 2396 for (j = 0; j < boards[i].nports; j++) {
2398 sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); 2397 sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j);
2398 tty_port_init(&port->gs.port);
2399 port->gs.magic = SX_MAGIC; 2399 port->gs.magic = SX_MAGIC;
2400 port->gs.close_delay = HZ / 2; 2400 port->gs.close_delay = HZ / 2;
2401 port->gs.closing_wait = 30 * HZ; 2401 port->gs.closing_wait = 30 * HZ;
@@ -2408,9 +2408,6 @@ static int sx_init_portstructs(int nboards, int nports)
2408 /* 2408 /*
2409 * Initializing wait queue 2409 * Initializing wait queue
2410 */ 2410 */
2411 init_waitqueue_head(&port->gs.open_wait);
2412 init_waitqueue_head(&port->gs.close_wait);
2413
2414 port++; 2411 port++;
2415 } 2412 }
2416 } 2413 }
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 9d247d8a87a3..527d220aa4aa 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -180,19 +180,14 @@ struct tx_holding_buffer {
180 180
181struct mgsl_struct { 181struct mgsl_struct {
182 int magic; 182 int magic;
183 int flags; 183 struct tty_port port;
184 int count; /* count of opens */
185 int line; 184 int line;
186 int hw_version; 185 int hw_version;
187 unsigned short close_delay;
188 unsigned short closing_wait; /* time to wait before closing */
189 186
190 struct mgsl_icount icount; 187 struct mgsl_icount icount;
191 188
192 struct tty_struct *tty;
193 int timeout; 189 int timeout;
194 int x_char; /* xon/xoff character */ 190 int x_char; /* xon/xoff character */
195 int blocked_open; /* # of blocked opens */
196 u16 read_status_mask; 191 u16 read_status_mask;
197 u16 ignore_status_mask; 192 u16 ignore_status_mask;
198 unsigned char *xmit_buf; 193 unsigned char *xmit_buf;
@@ -200,9 +195,6 @@ struct mgsl_struct {
200 int xmit_tail; 195 int xmit_tail;
201 int xmit_cnt; 196 int xmit_cnt;
202 197
203 wait_queue_head_t open_wait;
204 wait_queue_head_t close_wait;
205
206 wait_queue_head_t status_event_wait_q; 198 wait_queue_head_t status_event_wait_q;
207 wait_queue_head_t event_wait_q; 199 wait_queue_head_t event_wait_q;
208 struct timer_list tx_timer; /* HDLC transmit timeout timer */ 200 struct timer_list tx_timer; /* HDLC transmit timeout timer */
@@ -975,8 +967,8 @@ static void ldisc_receive_buf(struct tty_struct *tty,
975 return; 967 return;
976 ld = tty_ldisc_ref(tty); 968 ld = tty_ldisc_ref(tty);
977 if (ld) { 969 if (ld) {
978 if (ld->receive_buf) 970 if (ld->ops->receive_buf)
979 ld->receive_buf(tty, data, flags, count); 971 ld->ops->receive_buf(tty, data, flags, count);
980 tty_ldisc_deref(ld); 972 tty_ldisc_deref(ld);
981 } 973 }
982} 974}
@@ -1134,7 +1126,7 @@ static void mgsl_bh_receive(struct mgsl_struct *info)
1134 1126
1135static void mgsl_bh_transmit(struct mgsl_struct *info) 1127static void mgsl_bh_transmit(struct mgsl_struct *info)
1136{ 1128{
1137 struct tty_struct *tty = info->tty; 1129 struct tty_struct *tty = info->port.tty;
1138 unsigned long flags; 1130 unsigned long flags;
1139 1131
1140 if ( debug_level >= DEBUG_LEVEL_BH ) 1132 if ( debug_level >= DEBUG_LEVEL_BH )
@@ -1276,7 +1268,7 @@ static void mgsl_isr_transmit_status( struct mgsl_struct *info )
1276 else 1268 else
1277#endif 1269#endif
1278 { 1270 {
1279 if (info->tty->stopped || info->tty->hw_stopped) { 1271 if (info->port.tty->stopped || info->port.tty->hw_stopped) {
1280 usc_stop_transmitter(info); 1272 usc_stop_transmitter(info);
1281 return; 1273 return;
1282 } 1274 }
@@ -1357,29 +1349,29 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info )
1357 wake_up_interruptible(&info->status_event_wait_q); 1349 wake_up_interruptible(&info->status_event_wait_q);
1358 wake_up_interruptible(&info->event_wait_q); 1350 wake_up_interruptible(&info->event_wait_q);
1359 1351
1360 if ( (info->flags & ASYNC_CHECK_CD) && 1352 if ( (info->port.flags & ASYNC_CHECK_CD) &&
1361 (status & MISCSTATUS_DCD_LATCHED) ) { 1353 (status & MISCSTATUS_DCD_LATCHED) ) {
1362 if ( debug_level >= DEBUG_LEVEL_ISR ) 1354 if ( debug_level >= DEBUG_LEVEL_ISR )
1363 printk("%s CD now %s...", info->device_name, 1355 printk("%s CD now %s...", info->device_name,
1364 (status & MISCSTATUS_DCD) ? "on" : "off"); 1356 (status & MISCSTATUS_DCD) ? "on" : "off");
1365 if (status & MISCSTATUS_DCD) 1357 if (status & MISCSTATUS_DCD)
1366 wake_up_interruptible(&info->open_wait); 1358 wake_up_interruptible(&info->port.open_wait);
1367 else { 1359 else {
1368 if ( debug_level >= DEBUG_LEVEL_ISR ) 1360 if ( debug_level >= DEBUG_LEVEL_ISR )
1369 printk("doing serial hangup..."); 1361 printk("doing serial hangup...");
1370 if (info->tty) 1362 if (info->port.tty)
1371 tty_hangup(info->tty); 1363 tty_hangup(info->port.tty);
1372 } 1364 }
1373 } 1365 }
1374 1366
1375 if ( (info->flags & ASYNC_CTS_FLOW) && 1367 if ( (info->port.flags & ASYNC_CTS_FLOW) &&
1376 (status & MISCSTATUS_CTS_LATCHED) ) { 1368 (status & MISCSTATUS_CTS_LATCHED) ) {
1377 if (info->tty->hw_stopped) { 1369 if (info->port.tty->hw_stopped) {
1378 if (status & MISCSTATUS_CTS) { 1370 if (status & MISCSTATUS_CTS) {
1379 if ( debug_level >= DEBUG_LEVEL_ISR ) 1371 if ( debug_level >= DEBUG_LEVEL_ISR )
1380 printk("CTS tx start..."); 1372 printk("CTS tx start...");
1381 if (info->tty) 1373 if (info->port.tty)
1382 info->tty->hw_stopped = 0; 1374 info->port.tty->hw_stopped = 0;
1383 usc_start_transmitter(info); 1375 usc_start_transmitter(info);
1384 info->pending_bh |= BH_TRANSMIT; 1376 info->pending_bh |= BH_TRANSMIT;
1385 return; 1377 return;
@@ -1388,8 +1380,8 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info )
1388 if (!(status & MISCSTATUS_CTS)) { 1380 if (!(status & MISCSTATUS_CTS)) {
1389 if ( debug_level >= DEBUG_LEVEL_ISR ) 1381 if ( debug_level >= DEBUG_LEVEL_ISR )
1390 printk("CTS tx stop..."); 1382 printk("CTS tx stop...");
1391 if (info->tty) 1383 if (info->port.tty)
1392 info->tty->hw_stopped = 1; 1384 info->port.tty->hw_stopped = 1;
1393 usc_stop_transmitter(info); 1385 usc_stop_transmitter(info);
1394 } 1386 }
1395 } 1387 }
@@ -1423,7 +1415,7 @@ static void mgsl_isr_transmit_data( struct mgsl_struct *info )
1423 1415
1424 usc_ClearIrqPendingBits( info, TRANSMIT_DATA ); 1416 usc_ClearIrqPendingBits( info, TRANSMIT_DATA );
1425 1417
1426 if (info->tty->stopped || info->tty->hw_stopped) { 1418 if (info->port.tty->stopped || info->port.tty->hw_stopped) {
1427 usc_stop_transmitter(info); 1419 usc_stop_transmitter(info);
1428 return; 1420 return;
1429 } 1421 }
@@ -1453,7 +1445,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
1453 u16 status; 1445 u16 status;
1454 int work = 0; 1446 int work = 0;
1455 unsigned char DataByte; 1447 unsigned char DataByte;
1456 struct tty_struct *tty = info->tty; 1448 struct tty_struct *tty = info->port.tty;
1457 struct mgsl_icount *icount = &info->icount; 1449 struct mgsl_icount *icount = &info->icount;
1458 1450
1459 if ( debug_level >= DEBUG_LEVEL_ISR ) 1451 if ( debug_level >= DEBUG_LEVEL_ISR )
@@ -1514,7 +1506,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info )
1514 1506
1515 if (status & RXSTATUS_BREAK_RECEIVED) { 1507 if (status & RXSTATUS_BREAK_RECEIVED) {
1516 flag = TTY_BREAK; 1508 flag = TTY_BREAK;
1517 if (info->flags & ASYNC_SAK) 1509 if (info->port.flags & ASYNC_SAK)
1518 do_SAK(tty); 1510 do_SAK(tty);
1519 } else if (status & RXSTATUS_PARITY_ERROR) 1511 } else if (status & RXSTATUS_PARITY_ERROR)
1520 flag = TTY_PARITY; 1512 flag = TTY_PARITY;
@@ -1771,7 +1763,7 @@ static int startup(struct mgsl_struct * info)
1771 if ( debug_level >= DEBUG_LEVEL_INFO ) 1763 if ( debug_level >= DEBUG_LEVEL_INFO )
1772 printk("%s(%d):mgsl_startup(%s)\n",__FILE__,__LINE__,info->device_name); 1764 printk("%s(%d):mgsl_startup(%s)\n",__FILE__,__LINE__,info->device_name);
1773 1765
1774 if (info->flags & ASYNC_INITIALIZED) 1766 if (info->port.flags & ASYNC_INITIALIZED)
1775 return 0; 1767 return 0;
1776 1768
1777 if (!info->xmit_buf) { 1769 if (!info->xmit_buf) {
@@ -1798,8 +1790,8 @@ static int startup(struct mgsl_struct * info)
1798 retval = mgsl_adapter_test(info); 1790 retval = mgsl_adapter_test(info);
1799 1791
1800 if ( retval ) { 1792 if ( retval ) {
1801 if (capable(CAP_SYS_ADMIN) && info->tty) 1793 if (capable(CAP_SYS_ADMIN) && info->port.tty)
1802 set_bit(TTY_IO_ERROR, &info->tty->flags); 1794 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
1803 mgsl_release_resources(info); 1795 mgsl_release_resources(info);
1804 return retval; 1796 return retval;
1805 } 1797 }
@@ -1807,10 +1799,10 @@ static int startup(struct mgsl_struct * info)
1807 /* program hardware for current parameters */ 1799 /* program hardware for current parameters */
1808 mgsl_change_params(info); 1800 mgsl_change_params(info);
1809 1801
1810 if (info->tty) 1802 if (info->port.tty)
1811 clear_bit(TTY_IO_ERROR, &info->tty->flags); 1803 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
1812 1804
1813 info->flags |= ASYNC_INITIALIZED; 1805 info->port.flags |= ASYNC_INITIALIZED;
1814 1806
1815 return 0; 1807 return 0;
1816 1808
@@ -1827,7 +1819,7 @@ static void shutdown(struct mgsl_struct * info)
1827{ 1819{
1828 unsigned long flags; 1820 unsigned long flags;
1829 1821
1830 if (!(info->flags & ASYNC_INITIALIZED)) 1822 if (!(info->port.flags & ASYNC_INITIALIZED))
1831 return; 1823 return;
1832 1824
1833 if (debug_level >= DEBUG_LEVEL_INFO) 1825 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1864,7 +1856,7 @@ static void shutdown(struct mgsl_struct * info)
1864 /* on the ISA adapter. This has no effect for the PCI adapter */ 1856 /* on the ISA adapter. This has no effect for the PCI adapter */
1865 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12)); 1857 usc_OutReg(info, PCR, (u16)((usc_InReg(info, PCR) | BIT13) | BIT12));
1866 1858
1867 if (!info->tty || info->tty->termios->c_cflag & HUPCL) { 1859 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) {
1868 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 1860 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
1869 usc_set_serial_signals(info); 1861 usc_set_serial_signals(info);
1870 } 1862 }
@@ -1873,10 +1865,10 @@ static void shutdown(struct mgsl_struct * info)
1873 1865
1874 mgsl_release_resources(info); 1866 mgsl_release_resources(info);
1875 1867
1876 if (info->tty) 1868 if (info->port.tty)
1877 set_bit(TTY_IO_ERROR, &info->tty->flags); 1869 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
1878 1870
1879 info->flags &= ~ASYNC_INITIALIZED; 1871 info->port.flags &= ~ASYNC_INITIALIZED;
1880 1872
1881} /* end of shutdown() */ 1873} /* end of shutdown() */
1882 1874
@@ -1908,7 +1900,7 @@ static void mgsl_program_hw(struct mgsl_struct *info)
1908 usc_EnableInterrupts(info, IO_PIN); 1900 usc_EnableInterrupts(info, IO_PIN);
1909 usc_get_serial_signals(info); 1901 usc_get_serial_signals(info);
1910 1902
1911 if (info->netcount || info->tty->termios->c_cflag & CREAD) 1903 if (info->netcount || info->port.tty->termios->c_cflag & CREAD)
1912 usc_start_receiver(info); 1904 usc_start_receiver(info);
1913 1905
1914 spin_unlock_irqrestore(&info->irq_spinlock,flags); 1906 spin_unlock_irqrestore(&info->irq_spinlock,flags);
@@ -1921,14 +1913,14 @@ static void mgsl_change_params(struct mgsl_struct *info)
1921 unsigned cflag; 1913 unsigned cflag;
1922 int bits_per_char; 1914 int bits_per_char;
1923 1915
1924 if (!info->tty || !info->tty->termios) 1916 if (!info->port.tty || !info->port.tty->termios)
1925 return; 1917 return;
1926 1918
1927 if (debug_level >= DEBUG_LEVEL_INFO) 1919 if (debug_level >= DEBUG_LEVEL_INFO)
1928 printk("%s(%d):mgsl_change_params(%s)\n", 1920 printk("%s(%d):mgsl_change_params(%s)\n",
1929 __FILE__,__LINE__, info->device_name ); 1921 __FILE__,__LINE__, info->device_name );
1930 1922
1931 cflag = info->tty->termios->c_cflag; 1923 cflag = info->port.tty->termios->c_cflag;
1932 1924
1933 /* if B0 rate (hangup) specified then negate DTR and RTS */ 1925 /* if B0 rate (hangup) specified then negate DTR and RTS */
1934 /* otherwise assert DTR and RTS */ 1926 /* otherwise assert DTR and RTS */
@@ -1976,7 +1968,7 @@ static void mgsl_change_params(struct mgsl_struct *info)
1976 * current data rate. 1968 * current data rate.
1977 */ 1969 */
1978 if (info->params.data_rate <= 460800) 1970 if (info->params.data_rate <= 460800)
1979 info->params.data_rate = tty_get_baud_rate(info->tty); 1971 info->params.data_rate = tty_get_baud_rate(info->port.tty);
1980 1972
1981 if ( info->params.data_rate ) { 1973 if ( info->params.data_rate ) {
1982 info->timeout = (32*HZ*bits_per_char) / 1974 info->timeout = (32*HZ*bits_per_char) /
@@ -1985,31 +1977,31 @@ static void mgsl_change_params(struct mgsl_struct *info)
1985 info->timeout += HZ/50; /* Add .02 seconds of slop */ 1977 info->timeout += HZ/50; /* Add .02 seconds of slop */
1986 1978
1987 if (cflag & CRTSCTS) 1979 if (cflag & CRTSCTS)
1988 info->flags |= ASYNC_CTS_FLOW; 1980 info->port.flags |= ASYNC_CTS_FLOW;
1989 else 1981 else
1990 info->flags &= ~ASYNC_CTS_FLOW; 1982 info->port.flags &= ~ASYNC_CTS_FLOW;
1991 1983
1992 if (cflag & CLOCAL) 1984 if (cflag & CLOCAL)
1993 info->flags &= ~ASYNC_CHECK_CD; 1985 info->port.flags &= ~ASYNC_CHECK_CD;
1994 else 1986 else
1995 info->flags |= ASYNC_CHECK_CD; 1987 info->port.flags |= ASYNC_CHECK_CD;
1996 1988
1997 /* process tty input control flags */ 1989 /* process tty input control flags */
1998 1990
1999 info->read_status_mask = RXSTATUS_OVERRUN; 1991 info->read_status_mask = RXSTATUS_OVERRUN;
2000 if (I_INPCK(info->tty)) 1992 if (I_INPCK(info->port.tty))
2001 info->read_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; 1993 info->read_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR;
2002 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 1994 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
2003 info->read_status_mask |= RXSTATUS_BREAK_RECEIVED; 1995 info->read_status_mask |= RXSTATUS_BREAK_RECEIVED;
2004 1996
2005 if (I_IGNPAR(info->tty)) 1997 if (I_IGNPAR(info->port.tty))
2006 info->ignore_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR; 1998 info->ignore_status_mask |= RXSTATUS_PARITY_ERROR | RXSTATUS_FRAMING_ERROR;
2007 if (I_IGNBRK(info->tty)) { 1999 if (I_IGNBRK(info->port.tty)) {
2008 info->ignore_status_mask |= RXSTATUS_BREAK_RECEIVED; 2000 info->ignore_status_mask |= RXSTATUS_BREAK_RECEIVED;
2009 /* If ignoring parity and break indicators, ignore 2001 /* If ignoring parity and break indicators, ignore
2010 * overruns too. (For real raw support). 2002 * overruns too. (For real raw support).
2011 */ 2003 */
2012 if (I_IGNPAR(info->tty)) 2004 if (I_IGNPAR(info->port.tty))
2013 info->ignore_status_mask |= RXSTATUS_OVERRUN; 2005 info->ignore_status_mask |= RXSTATUS_OVERRUN;
2014 } 2006 }
2015 2007
@@ -3113,32 +3105,32 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
3113 3105
3114 if (debug_level >= DEBUG_LEVEL_INFO) 3106 if (debug_level >= DEBUG_LEVEL_INFO)
3115 printk("%s(%d):mgsl_close(%s) entry, count=%d\n", 3107 printk("%s(%d):mgsl_close(%s) entry, count=%d\n",
3116 __FILE__,__LINE__, info->device_name, info->count); 3108 __FILE__,__LINE__, info->device_name, info->port.count);
3117 3109
3118 if (!info->count) 3110 if (!info->port.count)
3119 return; 3111 return;
3120 3112
3121 if (tty_hung_up_p(filp)) 3113 if (tty_hung_up_p(filp))
3122 goto cleanup; 3114 goto cleanup;
3123 3115
3124 if ((tty->count == 1) && (info->count != 1)) { 3116 if ((tty->count == 1) && (info->port.count != 1)) {
3125 /* 3117 /*
3126 * tty->count is 1 and the tty structure will be freed. 3118 * tty->count is 1 and the tty structure will be freed.
3127 * info->count should be one in this case. 3119 * info->port.count should be one in this case.
3128 * if it's not, correct it so that the port is shutdown. 3120 * if it's not, correct it so that the port is shutdown.
3129 */ 3121 */
3130 printk("mgsl_close: bad refcount; tty->count is 1, " 3122 printk("mgsl_close: bad refcount; tty->count is 1, "
3131 "info->count is %d\n", info->count); 3123 "info->port.count is %d\n", info->port.count);
3132 info->count = 1; 3124 info->port.count = 1;
3133 } 3125 }
3134 3126
3135 info->count--; 3127 info->port.count--;
3136 3128
3137 /* if at least one open remaining, leave hardware active */ 3129 /* if at least one open remaining, leave hardware active */
3138 if (info->count) 3130 if (info->port.count)
3139 goto cleanup; 3131 goto cleanup;
3140 3132
3141 info->flags |= ASYNC_CLOSING; 3133 info->port.flags |= ASYNC_CLOSING;
3142 3134
3143 /* set tty->closing to notify line discipline to 3135 /* set tty->closing to notify line discipline to
3144 * only process XON/XOFF characters. Only the N_TTY 3136 * only process XON/XOFF characters. Only the N_TTY
@@ -3148,14 +3140,14 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
3148 3140
3149 /* wait for transmit data to clear all layers */ 3141 /* wait for transmit data to clear all layers */
3150 3142
3151 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 3143 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
3152 if (debug_level >= DEBUG_LEVEL_INFO) 3144 if (debug_level >= DEBUG_LEVEL_INFO)
3153 printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n", 3145 printk("%s(%d):mgsl_close(%s) calling tty_wait_until_sent\n",
3154 __FILE__,__LINE__, info->device_name ); 3146 __FILE__,__LINE__, info->device_name );
3155 tty_wait_until_sent(tty, info->closing_wait); 3147 tty_wait_until_sent(tty, info->port.closing_wait);
3156 } 3148 }
3157 3149
3158 if (info->flags & ASYNC_INITIALIZED) 3150 if (info->port.flags & ASYNC_INITIALIZED)
3159 mgsl_wait_until_sent(tty, info->timeout); 3151 mgsl_wait_until_sent(tty, info->timeout);
3160 3152
3161 mgsl_flush_buffer(tty); 3153 mgsl_flush_buffer(tty);
@@ -3165,23 +3157,23 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
3165 shutdown(info); 3157 shutdown(info);
3166 3158
3167 tty->closing = 0; 3159 tty->closing = 0;
3168 info->tty = NULL; 3160 info->port.tty = NULL;
3169 3161
3170 if (info->blocked_open) { 3162 if (info->port.blocked_open) {
3171 if (info->close_delay) { 3163 if (info->port.close_delay) {
3172 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 3164 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
3173 } 3165 }
3174 wake_up_interruptible(&info->open_wait); 3166 wake_up_interruptible(&info->port.open_wait);
3175 } 3167 }
3176 3168
3177 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 3169 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
3178 3170
3179 wake_up_interruptible(&info->close_wait); 3171 wake_up_interruptible(&info->port.close_wait);
3180 3172
3181cleanup: 3173cleanup:
3182 if (debug_level >= DEBUG_LEVEL_INFO) 3174 if (debug_level >= DEBUG_LEVEL_INFO)
3183 printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__, 3175 printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__,
3184 tty->driver->name, info->count); 3176 tty->driver->name, info->port.count);
3185 3177
3186} /* end of mgsl_close() */ 3178} /* end of mgsl_close() */
3187 3179
@@ -3211,7 +3203,7 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout)
3211 if (mgsl_paranoia_check(info, tty->name, "mgsl_wait_until_sent")) 3203 if (mgsl_paranoia_check(info, tty->name, "mgsl_wait_until_sent"))
3212 return; 3204 return;
3213 3205
3214 if (!(info->flags & ASYNC_INITIALIZED)) 3206 if (!(info->port.flags & ASYNC_INITIALIZED))
3215 goto exit; 3207 goto exit;
3216 3208
3217 orig_jiffies = jiffies; 3209 orig_jiffies = jiffies;
@@ -3283,11 +3275,11 @@ static void mgsl_hangup(struct tty_struct *tty)
3283 mgsl_flush_buffer(tty); 3275 mgsl_flush_buffer(tty);
3284 shutdown(info); 3276 shutdown(info);
3285 3277
3286 info->count = 0; 3278 info->port.count = 0;
3287 info->flags &= ~ASYNC_NORMAL_ACTIVE; 3279 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
3288 info->tty = NULL; 3280 info->port.tty = NULL;
3289 3281
3290 wake_up_interruptible(&info->open_wait); 3282 wake_up_interruptible(&info->port.open_wait);
3291 3283
3292} /* end of mgsl_hangup() */ 3284} /* end of mgsl_hangup() */
3293 3285
@@ -3319,7 +3311,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3319 3311
3320 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ 3312 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
3321 /* nonblock mode is set or port is not enabled */ 3313 /* nonblock mode is set or port is not enabled */
3322 info->flags |= ASYNC_NORMAL_ACTIVE; 3314 info->port.flags |= ASYNC_NORMAL_ACTIVE;
3323 return 0; 3315 return 0;
3324 } 3316 }
3325 3317
@@ -3328,25 +3320,25 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3328 3320
3329 /* Wait for carrier detect and the line to become 3321 /* Wait for carrier detect and the line to become
3330 * free (i.e., not in use by the callout). While we are in 3322 * free (i.e., not in use by the callout). While we are in
3331 * this loop, info->count is dropped by one, so that 3323 * this loop, info->port.count is dropped by one, so that
3332 * mgsl_close() knows when to free things. We restore it upon 3324 * mgsl_close() knows when to free things. We restore it upon
3333 * exit, either normal or abnormal. 3325 * exit, either normal or abnormal.
3334 */ 3326 */
3335 3327
3336 retval = 0; 3328 retval = 0;
3337 add_wait_queue(&info->open_wait, &wait); 3329 add_wait_queue(&info->port.open_wait, &wait);
3338 3330
3339 if (debug_level >= DEBUG_LEVEL_INFO) 3331 if (debug_level >= DEBUG_LEVEL_INFO)
3340 printk("%s(%d):block_til_ready before block on %s count=%d\n", 3332 printk("%s(%d):block_til_ready before block on %s count=%d\n",
3341 __FILE__,__LINE__, tty->driver->name, info->count ); 3333 __FILE__,__LINE__, tty->driver->name, info->port.count );
3342 3334
3343 spin_lock_irqsave(&info->irq_spinlock, flags); 3335 spin_lock_irqsave(&info->irq_spinlock, flags);
3344 if (!tty_hung_up_p(filp)) { 3336 if (!tty_hung_up_p(filp)) {
3345 extra_count = true; 3337 extra_count = true;
3346 info->count--; 3338 info->port.count--;
3347 } 3339 }
3348 spin_unlock_irqrestore(&info->irq_spinlock, flags); 3340 spin_unlock_irqrestore(&info->irq_spinlock, flags);
3349 info->blocked_open++; 3341 info->port.blocked_open++;
3350 3342
3351 while (1) { 3343 while (1) {
3352 if (tty->termios->c_cflag & CBAUD) { 3344 if (tty->termios->c_cflag & CBAUD) {
@@ -3358,8 +3350,8 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3358 3350
3359 set_current_state(TASK_INTERRUPTIBLE); 3351 set_current_state(TASK_INTERRUPTIBLE);
3360 3352
3361 if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ 3353 if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){
3362 retval = (info->flags & ASYNC_HUP_NOTIFY) ? 3354 retval = (info->port.flags & ASYNC_HUP_NOTIFY) ?
3363 -EAGAIN : -ERESTARTSYS; 3355 -EAGAIN : -ERESTARTSYS;
3364 break; 3356 break;
3365 } 3357 }
@@ -3368,7 +3360,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3368 usc_get_serial_signals(info); 3360 usc_get_serial_signals(info);
3369 spin_unlock_irqrestore(&info->irq_spinlock,flags); 3361 spin_unlock_irqrestore(&info->irq_spinlock,flags);
3370 3362
3371 if (!(info->flags & ASYNC_CLOSING) && 3363 if (!(info->port.flags & ASYNC_CLOSING) &&
3372 (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { 3364 (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) {
3373 break; 3365 break;
3374 } 3366 }
@@ -3380,24 +3372,24 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
3380 3372
3381 if (debug_level >= DEBUG_LEVEL_INFO) 3373 if (debug_level >= DEBUG_LEVEL_INFO)
3382 printk("%s(%d):block_til_ready blocking on %s count=%d\n", 3374 printk("%s(%d):block_til_ready blocking on %s count=%d\n",
3383 __FILE__,__LINE__, tty->driver->name, info->count ); 3375 __FILE__,__LINE__, tty->driver->name, info->port.count );
3384 3376
3385 schedule(); 3377 schedule();
3386 } 3378 }
3387 3379
3388 set_current_state(TASK_RUNNING); 3380 set_current_state(TASK_RUNNING);
3389 remove_wait_queue(&info->open_wait, &wait); 3381 remove_wait_queue(&info->port.open_wait, &wait);
3390 3382
3391 if (extra_count) 3383 if (extra_count)
3392 info->count++; 3384 info->port.count++;
3393 info->blocked_open--; 3385 info->port.blocked_open--;
3394 3386
3395 if (debug_level >= DEBUG_LEVEL_INFO) 3387 if (debug_level >= DEBUG_LEVEL_INFO)
3396 printk("%s(%d):block_til_ready after blocking on %s count=%d\n", 3388 printk("%s(%d):block_til_ready after blocking on %s count=%d\n",
3397 __FILE__,__LINE__, tty->driver->name, info->count ); 3389 __FILE__,__LINE__, tty->driver->name, info->port.count );
3398 3390
3399 if (!retval) 3391 if (!retval)
3400 info->flags |= ASYNC_NORMAL_ACTIVE; 3392 info->port.flags |= ASYNC_NORMAL_ACTIVE;
3401 3393
3402 return retval; 3394 return retval;
3403 3395
@@ -3435,22 +3427,22 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
3435 return -ENODEV; 3427 return -ENODEV;
3436 3428
3437 tty->driver_data = info; 3429 tty->driver_data = info;
3438 info->tty = tty; 3430 info->port.tty = tty;
3439 3431
3440 if (debug_level >= DEBUG_LEVEL_INFO) 3432 if (debug_level >= DEBUG_LEVEL_INFO)
3441 printk("%s(%d):mgsl_open(%s), old ref count = %d\n", 3433 printk("%s(%d):mgsl_open(%s), old ref count = %d\n",
3442 __FILE__,__LINE__,tty->driver->name, info->count); 3434 __FILE__,__LINE__,tty->driver->name, info->port.count);
3443 3435
3444 /* If port is closing, signal caller to try again */ 3436 /* If port is closing, signal caller to try again */
3445 if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ 3437 if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){
3446 if (info->flags & ASYNC_CLOSING) 3438 if (info->port.flags & ASYNC_CLOSING)
3447 interruptible_sleep_on(&info->close_wait); 3439 interruptible_sleep_on(&info->port.close_wait);
3448 retval = ((info->flags & ASYNC_HUP_NOTIFY) ? 3440 retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?
3449 -EAGAIN : -ERESTARTSYS); 3441 -EAGAIN : -ERESTARTSYS);
3450 goto cleanup; 3442 goto cleanup;
3451 } 3443 }
3452 3444
3453 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 3445 info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
3454 3446
3455 spin_lock_irqsave(&info->netlock, flags); 3447 spin_lock_irqsave(&info->netlock, flags);
3456 if (info->netcount) { 3448 if (info->netcount) {
@@ -3458,10 +3450,10 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
3458 spin_unlock_irqrestore(&info->netlock, flags); 3450 spin_unlock_irqrestore(&info->netlock, flags);
3459 goto cleanup; 3451 goto cleanup;
3460 } 3452 }
3461 info->count++; 3453 info->port.count++;
3462 spin_unlock_irqrestore(&info->netlock, flags); 3454 spin_unlock_irqrestore(&info->netlock, flags);
3463 3455
3464 if (info->count == 1) { 3456 if (info->port.count == 1) {
3465 /* 1st open on this device, init hardware */ 3457 /* 1st open on this device, init hardware */
3466 retval = startup(info); 3458 retval = startup(info);
3467 if (retval < 0) 3459 if (retval < 0)
@@ -3484,9 +3476,9 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
3484cleanup: 3476cleanup:
3485 if (retval) { 3477 if (retval) {
3486 if (tty->count == 1) 3478 if (tty->count == 1)
3487 info->tty = NULL; /* tty layer will release tty struct */ 3479 info->port.tty = NULL; /* tty layer will release tty struct */
3488 if(info->count) 3480 if(info->port.count)
3489 info->count--; 3481 info->port.count--;
3490 } 3482 }
3491 3483
3492 return retval; 3484 return retval;
@@ -4332,13 +4324,12 @@ static struct mgsl_struct* mgsl_allocate_device(void)
4332 if (!info) { 4324 if (!info) {
4333 printk("Error can't allocate device instance data\n"); 4325 printk("Error can't allocate device instance data\n");
4334 } else { 4326 } else {
4327 tty_port_init(&info->port);
4335 info->magic = MGSL_MAGIC; 4328 info->magic = MGSL_MAGIC;
4336 INIT_WORK(&info->task, mgsl_bh_handler); 4329 INIT_WORK(&info->task, mgsl_bh_handler);
4337 info->max_frame_size = 4096; 4330 info->max_frame_size = 4096;
4338 info->close_delay = 5*HZ/10; 4331 info->port.close_delay = 5*HZ/10;
4339 info->closing_wait = 30*HZ; 4332 info->port.closing_wait = 30*HZ;
4340 init_waitqueue_head(&info->open_wait);
4341 init_waitqueue_head(&info->close_wait);
4342 init_waitqueue_head(&info->status_event_wait_q); 4333 init_waitqueue_head(&info->status_event_wait_q);
4343 init_waitqueue_head(&info->event_wait_q); 4334 init_waitqueue_head(&info->event_wait_q);
4344 spin_lock_init(&info->irq_spinlock); 4335 spin_lock_init(&info->irq_spinlock);
@@ -6575,7 +6566,7 @@ static bool mgsl_get_rx_frame(struct mgsl_struct *info)
6575 unsigned int framesize = 0; 6566 unsigned int framesize = 0;
6576 bool ReturnCode = false; 6567 bool ReturnCode = false;
6577 unsigned long flags; 6568 unsigned long flags;
6578 struct tty_struct *tty = info->tty; 6569 struct tty_struct *tty = info->port.tty;
6579 bool return_frame = false; 6570 bool return_frame = false;
6580 6571
6581 /* 6572 /*
@@ -6773,7 +6764,7 @@ static bool mgsl_get_raw_rx_frame(struct mgsl_struct *info)
6773 unsigned int framesize = 0; 6764 unsigned int framesize = 0;
6774 bool ReturnCode = false; 6765 bool ReturnCode = false;
6775 unsigned long flags; 6766 unsigned long flags;
6776 struct tty_struct *tty = info->tty; 6767 struct tty_struct *tty = info->port.tty;
6777 6768
6778 /* 6769 /*
6779 * current_rx_buffer points to the 1st buffer of the next available 6770 * current_rx_buffer points to the 1st buffer of the next available
@@ -7710,7 +7701,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
7710 unsigned short new_crctype; 7701 unsigned short new_crctype;
7711 7702
7712 /* return error if TTY interface open */ 7703 /* return error if TTY interface open */
7713 if (info->count) 7704 if (info->port.count)
7714 return -EBUSY; 7705 return -EBUSY;
7715 7706
7716 switch (encoding) 7707 switch (encoding)
@@ -7806,7 +7797,7 @@ static int hdlcdev_open(struct net_device *dev)
7806 7797
7807 /* arbitrate between network and tty opens */ 7798 /* arbitrate between network and tty opens */
7808 spin_lock_irqsave(&info->netlock, flags); 7799 spin_lock_irqsave(&info->netlock, flags);
7809 if (info->count != 0 || info->netcount != 0) { 7800 if (info->port.count != 0 || info->netcount != 0) {
7810 printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); 7801 printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name);
7811 spin_unlock_irqrestore(&info->netlock, flags); 7802 spin_unlock_irqrestore(&info->netlock, flags);
7812 return -EBUSY; 7803 return -EBUSY;
@@ -7892,7 +7883,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
7892 printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); 7883 printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name);
7893 7884
7894 /* return error if TTY interface open */ 7885 /* return error if TTY interface open */
7895 if (info->count) 7886 if (info->port.count)
7896 return -EBUSY; 7887 return -EBUSY;
7897 7888
7898 if (cmd != SIOCWANDEV) 7889 if (cmd != SIOCWANDEV)
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index d88a607e34b7..2c3e43bb2cc9 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -244,11 +244,11 @@ struct _input_signal_events {
244 */ 244 */
245struct slgt_info { 245struct slgt_info {
246 void *if_ptr; /* General purpose pointer (used by SPPP) */ 246 void *if_ptr; /* General purpose pointer (used by SPPP) */
247 struct tty_port port;
247 248
248 struct slgt_info *next_device; /* device list link */ 249 struct slgt_info *next_device; /* device list link */
249 250
250 int magic; 251 int magic;
251 int flags;
252 252
253 char device_name[25]; 253 char device_name[25];
254 struct pci_dev *pdev; 254 struct pci_dev *pdev;
@@ -260,23 +260,15 @@ struct slgt_info {
260 /* array of pointers to port contexts on this adapter */ 260 /* array of pointers to port contexts on this adapter */
261 struct slgt_info *port_array[SLGT_MAX_PORTS]; 261 struct slgt_info *port_array[SLGT_MAX_PORTS];
262 262
263 int count; /* count of opens */
264 int line; /* tty line instance number */ 263 int line; /* tty line instance number */
265 unsigned short close_delay;
266 unsigned short closing_wait; /* time to wait before closing */
267 264
268 struct mgsl_icount icount; 265 struct mgsl_icount icount;
269 266
270 struct tty_struct *tty;
271 int timeout; 267 int timeout;
272 int x_char; /* xon/xoff character */ 268 int x_char; /* xon/xoff character */
273 int blocked_open; /* # of blocked opens */
274 unsigned int read_status_mask; 269 unsigned int read_status_mask;
275 unsigned int ignore_status_mask; 270 unsigned int ignore_status_mask;
276 271
277 wait_queue_head_t open_wait;
278 wait_queue_head_t close_wait;
279
280 wait_queue_head_t status_event_wait_q; 272 wait_queue_head_t status_event_wait_q;
281 wait_queue_head_t event_wait_q; 273 wait_queue_head_t event_wait_q;
282 struct timer_list tx_timer; 274 struct timer_list tx_timer;
@@ -641,8 +633,8 @@ static void ldisc_receive_buf(struct tty_struct *tty,
641 return; 633 return;
642 ld = tty_ldisc_ref(tty); 634 ld = tty_ldisc_ref(tty);
643 if (ld) { 635 if (ld) {
644 if (ld->receive_buf) 636 if (ld->ops->receive_buf)
645 ld->receive_buf(tty, data, flags, count); 637 ld->ops->receive_buf(tty, data, flags, count);
646 tty_ldisc_deref(ld); 638 tty_ldisc_deref(ld);
647 } 639 }
648} 640}
@@ -672,20 +664,20 @@ static int open(struct tty_struct *tty, struct file *filp)
672 } 664 }
673 665
674 tty->driver_data = info; 666 tty->driver_data = info;
675 info->tty = tty; 667 info->port.tty = tty;
676 668
677 DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->count)); 669 DBGINFO(("%s open, old ref count = %d\n", info->device_name, info->port.count));
678 670
679 /* If port is closing, signal caller to try again */ 671 /* If port is closing, signal caller to try again */
680 if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ 672 if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){
681 if (info->flags & ASYNC_CLOSING) 673 if (info->port.flags & ASYNC_CLOSING)
682 interruptible_sleep_on(&info->close_wait); 674 interruptible_sleep_on(&info->port.close_wait);
683 retval = ((info->flags & ASYNC_HUP_NOTIFY) ? 675 retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?
684 -EAGAIN : -ERESTARTSYS); 676 -EAGAIN : -ERESTARTSYS);
685 goto cleanup; 677 goto cleanup;
686 } 678 }
687 679
688 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 680 info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
689 681
690 spin_lock_irqsave(&info->netlock, flags); 682 spin_lock_irqsave(&info->netlock, flags);
691 if (info->netcount) { 683 if (info->netcount) {
@@ -693,10 +685,10 @@ static int open(struct tty_struct *tty, struct file *filp)
693 spin_unlock_irqrestore(&info->netlock, flags); 685 spin_unlock_irqrestore(&info->netlock, flags);
694 goto cleanup; 686 goto cleanup;
695 } 687 }
696 info->count++; 688 info->port.count++;
697 spin_unlock_irqrestore(&info->netlock, flags); 689 spin_unlock_irqrestore(&info->netlock, flags);
698 690
699 if (info->count == 1) { 691 if (info->port.count == 1) {
700 /* 1st open on this device, init hardware */ 692 /* 1st open on this device, init hardware */
701 retval = startup(info); 693 retval = startup(info);
702 if (retval < 0) 694 if (retval < 0)
@@ -714,9 +706,9 @@ static int open(struct tty_struct *tty, struct file *filp)
714cleanup: 706cleanup:
715 if (retval) { 707 if (retval) {
716 if (tty->count == 1) 708 if (tty->count == 1)
717 info->tty = NULL; /* tty layer will release tty struct */ 709 info->port.tty = NULL; /* tty layer will release tty struct */
718 if(info->count) 710 if(info->port.count)
719 info->count--; 711 info->port.count--;
720 } 712 }
721 713
722 DBGINFO(("%s open rc=%d\n", info->device_name, retval)); 714 DBGINFO(("%s open rc=%d\n", info->device_name, retval));
@@ -729,32 +721,32 @@ static void close(struct tty_struct *tty, struct file *filp)
729 721
730 if (sanity_check(info, tty->name, "close")) 722 if (sanity_check(info, tty->name, "close"))
731 return; 723 return;
732 DBGINFO(("%s close entry, count=%d\n", info->device_name, info->count)); 724 DBGINFO(("%s close entry, count=%d\n", info->device_name, info->port.count));
733 725
734 if (!info->count) 726 if (!info->port.count)
735 return; 727 return;
736 728
737 if (tty_hung_up_p(filp)) 729 if (tty_hung_up_p(filp))
738 goto cleanup; 730 goto cleanup;
739 731
740 if ((tty->count == 1) && (info->count != 1)) { 732 if ((tty->count == 1) && (info->port.count != 1)) {
741 /* 733 /*
742 * tty->count is 1 and the tty structure will be freed. 734 * tty->count is 1 and the tty structure will be freed.
743 * info->count should be one in this case. 735 * info->port.count should be one in this case.
744 * if it's not, correct it so that the port is shutdown. 736 * if it's not, correct it so that the port is shutdown.
745 */ 737 */
746 DBGERR(("%s close: bad refcount; tty->count=1, " 738 DBGERR(("%s close: bad refcount; tty->count=1, "
747 "info->count=%d\n", info->device_name, info->count)); 739 "info->port.count=%d\n", info->device_name, info->port.count));
748 info->count = 1; 740 info->port.count = 1;
749 } 741 }
750 742
751 info->count--; 743 info->port.count--;
752 744
753 /* if at least one open remaining, leave hardware active */ 745 /* if at least one open remaining, leave hardware active */
754 if (info->count) 746 if (info->port.count)
755 goto cleanup; 747 goto cleanup;
756 748
757 info->flags |= ASYNC_CLOSING; 749 info->port.flags |= ASYNC_CLOSING;
758 750
759 /* set tty->closing to notify line discipline to 751 /* set tty->closing to notify line discipline to
760 * only process XON/XOFF characters. Only the N_TTY 752 * only process XON/XOFF characters. Only the N_TTY
@@ -764,12 +756,12 @@ static void close(struct tty_struct *tty, struct file *filp)
764 756
765 /* wait for transmit data to clear all layers */ 757 /* wait for transmit data to clear all layers */
766 758
767 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 759 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
768 DBGINFO(("%s call tty_wait_until_sent\n", info->device_name)); 760 DBGINFO(("%s call tty_wait_until_sent\n", info->device_name));
769 tty_wait_until_sent(tty, info->closing_wait); 761 tty_wait_until_sent(tty, info->port.closing_wait);
770 } 762 }
771 763
772 if (info->flags & ASYNC_INITIALIZED) 764 if (info->port.flags & ASYNC_INITIALIZED)
773 wait_until_sent(tty, info->timeout); 765 wait_until_sent(tty, info->timeout);
774 flush_buffer(tty); 766 flush_buffer(tty);
775 tty_ldisc_flush(tty); 767 tty_ldisc_flush(tty);
@@ -777,21 +769,21 @@ static void close(struct tty_struct *tty, struct file *filp)
777 shutdown(info); 769 shutdown(info);
778 770
779 tty->closing = 0; 771 tty->closing = 0;
780 info->tty = NULL; 772 info->port.tty = NULL;
781 773
782 if (info->blocked_open) { 774 if (info->port.blocked_open) {
783 if (info->close_delay) { 775 if (info->port.close_delay) {
784 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 776 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
785 } 777 }
786 wake_up_interruptible(&info->open_wait); 778 wake_up_interruptible(&info->port.open_wait);
787 } 779 }
788 780
789 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 781 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
790 782
791 wake_up_interruptible(&info->close_wait); 783 wake_up_interruptible(&info->port.close_wait);
792 784
793cleanup: 785cleanup:
794 DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->count)); 786 DBGINFO(("%s close exit, count=%d\n", tty->driver->name, info->port.count));
795} 787}
796 788
797static void hangup(struct tty_struct *tty) 789static void hangup(struct tty_struct *tty)
@@ -805,11 +797,11 @@ static void hangup(struct tty_struct *tty)
805 flush_buffer(tty); 797 flush_buffer(tty);
806 shutdown(info); 798 shutdown(info);
807 799
808 info->count = 0; 800 info->port.count = 0;
809 info->flags &= ~ASYNC_NORMAL_ACTIVE; 801 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
810 info->tty = NULL; 802 info->port.tty = NULL;
811 803
812 wake_up_interruptible(&info->open_wait); 804 wake_up_interruptible(&info->port.open_wait);
813} 805}
814 806
815static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) 807static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
@@ -959,7 +951,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout)
959 if (sanity_check(info, tty->name, "wait_until_sent")) 951 if (sanity_check(info, tty->name, "wait_until_sent"))
960 return; 952 return;
961 DBGINFO(("%s wait_until_sent entry\n", info->device_name)); 953 DBGINFO(("%s wait_until_sent entry\n", info->device_name));
962 if (!(info->flags & ASYNC_INITIALIZED)) 954 if (!(info->port.flags & ASYNC_INITIALIZED))
963 goto exit; 955 goto exit;
964 956
965 orig_jiffies = jiffies; 957 orig_jiffies = jiffies;
@@ -1500,7 +1492,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1500 unsigned short new_crctype; 1492 unsigned short new_crctype;
1501 1493
1502 /* return error if TTY interface open */ 1494 /* return error if TTY interface open */
1503 if (info->count) 1495 if (info->port.count)
1504 return -EBUSY; 1496 return -EBUSY;
1505 1497
1506 DBGINFO(("%s hdlcdev_attach\n", info->device_name)); 1498 DBGINFO(("%s hdlcdev_attach\n", info->device_name));
@@ -1599,7 +1591,7 @@ static int hdlcdev_open(struct net_device *dev)
1599 1591
1600 /* arbitrate between network and tty opens */ 1592 /* arbitrate between network and tty opens */
1601 spin_lock_irqsave(&info->netlock, flags); 1593 spin_lock_irqsave(&info->netlock, flags);
1602 if (info->count != 0 || info->netcount != 0) { 1594 if (info->port.count != 0 || info->netcount != 0) {
1603 DBGINFO(("%s hdlc_open busy\n", dev->name)); 1595 DBGINFO(("%s hdlc_open busy\n", dev->name));
1604 spin_unlock_irqrestore(&info->netlock, flags); 1596 spin_unlock_irqrestore(&info->netlock, flags);
1605 return -EBUSY; 1597 return -EBUSY;
@@ -1684,7 +1676,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1684 DBGINFO(("%s hdlcdev_ioctl\n", dev->name)); 1676 DBGINFO(("%s hdlcdev_ioctl\n", dev->name));
1685 1677
1686 /* return error if TTY interface open */ 1678 /* return error if TTY interface open */
1687 if (info->count) 1679 if (info->port.count)
1688 return -EBUSY; 1680 return -EBUSY;
1689 1681
1690 if (cmd != SIOCWANDEV) 1682 if (cmd != SIOCWANDEV)
@@ -1903,7 +1895,7 @@ static void hdlcdev_exit(struct slgt_info *info)
1903 */ 1895 */
1904static void rx_async(struct slgt_info *info) 1896static void rx_async(struct slgt_info *info)
1905{ 1897{
1906 struct tty_struct *tty = info->tty; 1898 struct tty_struct *tty = info->port.tty;
1907 struct mgsl_icount *icount = &info->icount; 1899 struct mgsl_icount *icount = &info->icount;
1908 unsigned int start, end; 1900 unsigned int start, end;
1909 unsigned char *p; 1901 unsigned char *p;
@@ -2054,7 +2046,7 @@ static void bh_handler(struct work_struct *work)
2054 2046
2055static void bh_transmit(struct slgt_info *info) 2047static void bh_transmit(struct slgt_info *info)
2056{ 2048{
2057 struct tty_struct *tty = info->tty; 2049 struct tty_struct *tty = info->port.tty;
2058 2050
2059 DBGBH(("%s bh_transmit\n", info->device_name)); 2051 DBGBH(("%s bh_transmit\n", info->device_name));
2060 if (tty) 2052 if (tty)
@@ -2100,17 +2092,17 @@ static void cts_change(struct slgt_info *info, unsigned short status)
2100 wake_up_interruptible(&info->event_wait_q); 2092 wake_up_interruptible(&info->event_wait_q);
2101 info->pending_bh |= BH_STATUS; 2093 info->pending_bh |= BH_STATUS;
2102 2094
2103 if (info->flags & ASYNC_CTS_FLOW) { 2095 if (info->port.flags & ASYNC_CTS_FLOW) {
2104 if (info->tty) { 2096 if (info->port.tty) {
2105 if (info->tty->hw_stopped) { 2097 if (info->port.tty->hw_stopped) {
2106 if (info->signals & SerialSignal_CTS) { 2098 if (info->signals & SerialSignal_CTS) {
2107 info->tty->hw_stopped = 0; 2099 info->port.tty->hw_stopped = 0;
2108 info->pending_bh |= BH_TRANSMIT; 2100 info->pending_bh |= BH_TRANSMIT;
2109 return; 2101 return;
2110 } 2102 }
2111 } else { 2103 } else {
2112 if (!(info->signals & SerialSignal_CTS)) 2104 if (!(info->signals & SerialSignal_CTS))
2113 info->tty->hw_stopped = 1; 2105 info->port.tty->hw_stopped = 1;
2114 } 2106 }
2115 } 2107 }
2116 } 2108 }
@@ -2143,12 +2135,12 @@ static void dcd_change(struct slgt_info *info, unsigned short status)
2143 wake_up_interruptible(&info->event_wait_q); 2135 wake_up_interruptible(&info->event_wait_q);
2144 info->pending_bh |= BH_STATUS; 2136 info->pending_bh |= BH_STATUS;
2145 2137
2146 if (info->flags & ASYNC_CHECK_CD) { 2138 if (info->port.flags & ASYNC_CHECK_CD) {
2147 if (info->signals & SerialSignal_DCD) 2139 if (info->signals & SerialSignal_DCD)
2148 wake_up_interruptible(&info->open_wait); 2140 wake_up_interruptible(&info->port.open_wait);
2149 else { 2141 else {
2150 if (info->tty) 2142 if (info->port.tty)
2151 tty_hangup(info->tty); 2143 tty_hangup(info->port.tty);
2152 } 2144 }
2153 } 2145 }
2154} 2146}
@@ -2191,12 +2183,12 @@ static void isr_serial(struct slgt_info *info)
2191 if ((status & IRQ_RXBREAK) && (status & RXBREAK)) { 2183 if ((status & IRQ_RXBREAK) && (status & RXBREAK)) {
2192 info->icount.brk++; 2184 info->icount.brk++;
2193 /* process break detection if tty control allows */ 2185 /* process break detection if tty control allows */
2194 if (info->tty) { 2186 if (info->port.tty) {
2195 if (!(status & info->ignore_status_mask)) { 2187 if (!(status & info->ignore_status_mask)) {
2196 if (info->read_status_mask & MASK_BREAK) { 2188 if (info->read_status_mask & MASK_BREAK) {
2197 tty_insert_flip_char(info->tty, 0, TTY_BREAK); 2189 tty_insert_flip_char(info->port.tty, 0, TTY_BREAK);
2198 if (info->flags & ASYNC_SAK) 2190 if (info->port.flags & ASYNC_SAK)
2199 do_SAK(info->tty); 2191 do_SAK(info->port.tty);
2200 } 2192 }
2201 } 2193 }
2202 } 2194 }
@@ -2316,7 +2308,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status)
2316 else 2308 else
2317#endif 2309#endif
2318 { 2310 {
2319 if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { 2311 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) {
2320 tx_stop(info); 2312 tx_stop(info);
2321 return; 2313 return;
2322 } 2314 }
@@ -2392,7 +2384,7 @@ static irqreturn_t slgt_interrupt(int dummy, void *dev_id)
2392 for(i=0; i < info->port_count ; i++) { 2384 for(i=0; i < info->port_count ; i++) {
2393 struct slgt_info *port = info->port_array[i]; 2385 struct slgt_info *port = info->port_array[i];
2394 2386
2395 if (port && (port->count || port->netcount) && 2387 if (port && (port->port.count || port->netcount) &&
2396 port->pending_bh && !port->bh_running && 2388 port->pending_bh && !port->bh_running &&
2397 !port->bh_requested) { 2389 !port->bh_requested) {
2398 DBGISR(("%s bh queued\n", port->device_name)); 2390 DBGISR(("%s bh queued\n", port->device_name));
@@ -2411,7 +2403,7 @@ static int startup(struct slgt_info *info)
2411{ 2403{
2412 DBGINFO(("%s startup\n", info->device_name)); 2404 DBGINFO(("%s startup\n", info->device_name));
2413 2405
2414 if (info->flags & ASYNC_INITIALIZED) 2406 if (info->port.flags & ASYNC_INITIALIZED)
2415 return 0; 2407 return 0;
2416 2408
2417 if (!info->tx_buf) { 2409 if (!info->tx_buf) {
@@ -2429,10 +2421,10 @@ static int startup(struct slgt_info *info)
2429 /* program hardware for current parameters */ 2421 /* program hardware for current parameters */
2430 change_params(info); 2422 change_params(info);
2431 2423
2432 if (info->tty) 2424 if (info->port.tty)
2433 clear_bit(TTY_IO_ERROR, &info->tty->flags); 2425 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
2434 2426
2435 info->flags |= ASYNC_INITIALIZED; 2427 info->port.flags |= ASYNC_INITIALIZED;
2436 2428
2437 return 0; 2429 return 0;
2438} 2430}
@@ -2444,7 +2436,7 @@ static void shutdown(struct slgt_info *info)
2444{ 2436{
2445 unsigned long flags; 2437 unsigned long flags;
2446 2438
2447 if (!(info->flags & ASYNC_INITIALIZED)) 2439 if (!(info->port.flags & ASYNC_INITIALIZED))
2448 return; 2440 return;
2449 2441
2450 DBGINFO(("%s shutdown\n", info->device_name)); 2442 DBGINFO(("%s shutdown\n", info->device_name));
@@ -2467,7 +2459,7 @@ static void shutdown(struct slgt_info *info)
2467 2459
2468 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); 2460 slgt_irq_off(info, IRQ_ALL | IRQ_MASTER);
2469 2461
2470 if (!info->tty || info->tty->termios->c_cflag & HUPCL) { 2462 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) {
2471 info->signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 2463 info->signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
2472 set_signals(info); 2464 set_signals(info);
2473 } 2465 }
@@ -2476,10 +2468,10 @@ static void shutdown(struct slgt_info *info)
2476 2468
2477 spin_unlock_irqrestore(&info->lock,flags); 2469 spin_unlock_irqrestore(&info->lock,flags);
2478 2470
2479 if (info->tty) 2471 if (info->port.tty)
2480 set_bit(TTY_IO_ERROR, &info->tty->flags); 2472 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
2481 2473
2482 info->flags &= ~ASYNC_INITIALIZED; 2474 info->port.flags &= ~ASYNC_INITIALIZED;
2483} 2475}
2484 2476
2485static void program_hw(struct slgt_info *info) 2477static void program_hw(struct slgt_info *info)
@@ -2508,7 +2500,7 @@ static void program_hw(struct slgt_info *info)
2508 get_signals(info); 2500 get_signals(info);
2509 2501
2510 if (info->netcount || 2502 if (info->netcount ||
2511 (info->tty && info->tty->termios->c_cflag & CREAD)) 2503 (info->port.tty && info->port.tty->termios->c_cflag & CREAD))
2512 rx_start(info); 2504 rx_start(info);
2513 2505
2514 spin_unlock_irqrestore(&info->lock,flags); 2506 spin_unlock_irqrestore(&info->lock,flags);
@@ -2522,11 +2514,11 @@ static void change_params(struct slgt_info *info)
2522 unsigned cflag; 2514 unsigned cflag;
2523 int bits_per_char; 2515 int bits_per_char;
2524 2516
2525 if (!info->tty || !info->tty->termios) 2517 if (!info->port.tty || !info->port.tty->termios)
2526 return; 2518 return;
2527 DBGINFO(("%s change_params\n", info->device_name)); 2519 DBGINFO(("%s change_params\n", info->device_name));
2528 2520
2529 cflag = info->tty->termios->c_cflag; 2521 cflag = info->port.tty->termios->c_cflag;
2530 2522
2531 /* if B0 rate (hangup) specified then negate DTR and RTS */ 2523 /* if B0 rate (hangup) specified then negate DTR and RTS */
2532 /* otherwise assert DTR and RTS */ 2524 /* otherwise assert DTR and RTS */
@@ -2558,7 +2550,7 @@ static void change_params(struct slgt_info *info)
2558 bits_per_char = info->params.data_bits + 2550 bits_per_char = info->params.data_bits +
2559 info->params.stop_bits + 1; 2551 info->params.stop_bits + 1;
2560 2552
2561 info->params.data_rate = tty_get_baud_rate(info->tty); 2553 info->params.data_rate = tty_get_baud_rate(info->port.tty);
2562 2554
2563 if (info->params.data_rate) { 2555 if (info->params.data_rate) {
2564 info->timeout = (32*HZ*bits_per_char) / 2556 info->timeout = (32*HZ*bits_per_char) /
@@ -2567,30 +2559,30 @@ static void change_params(struct slgt_info *info)
2567 info->timeout += HZ/50; /* Add .02 seconds of slop */ 2559 info->timeout += HZ/50; /* Add .02 seconds of slop */
2568 2560
2569 if (cflag & CRTSCTS) 2561 if (cflag & CRTSCTS)
2570 info->flags |= ASYNC_CTS_FLOW; 2562 info->port.flags |= ASYNC_CTS_FLOW;
2571 else 2563 else
2572 info->flags &= ~ASYNC_CTS_FLOW; 2564 info->port.flags &= ~ASYNC_CTS_FLOW;
2573 2565
2574 if (cflag & CLOCAL) 2566 if (cflag & CLOCAL)
2575 info->flags &= ~ASYNC_CHECK_CD; 2567 info->port.flags &= ~ASYNC_CHECK_CD;
2576 else 2568 else
2577 info->flags |= ASYNC_CHECK_CD; 2569 info->port.flags |= ASYNC_CHECK_CD;
2578 2570
2579 /* process tty input control flags */ 2571 /* process tty input control flags */
2580 2572
2581 info->read_status_mask = IRQ_RXOVER; 2573 info->read_status_mask = IRQ_RXOVER;
2582 if (I_INPCK(info->tty)) 2574 if (I_INPCK(info->port.tty))
2583 info->read_status_mask |= MASK_PARITY | MASK_FRAMING; 2575 info->read_status_mask |= MASK_PARITY | MASK_FRAMING;
2584 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 2576 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
2585 info->read_status_mask |= MASK_BREAK; 2577 info->read_status_mask |= MASK_BREAK;
2586 if (I_IGNPAR(info->tty)) 2578 if (I_IGNPAR(info->port.tty))
2587 info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING; 2579 info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING;
2588 if (I_IGNBRK(info->tty)) { 2580 if (I_IGNBRK(info->port.tty)) {
2589 info->ignore_status_mask |= MASK_BREAK; 2581 info->ignore_status_mask |= MASK_BREAK;
2590 /* If ignoring parity and break indicators, ignore 2582 /* If ignoring parity and break indicators, ignore
2591 * overruns too. (For real raw support). 2583 * overruns too. (For real raw support).
2592 */ 2584 */
2593 if (I_IGNPAR(info->tty)) 2585 if (I_IGNPAR(info->port.tty))
2594 info->ignore_status_mask |= MASK_OVERRUN; 2586 info->ignore_status_mask |= MASK_OVERRUN;
2595 } 2587 }
2596 2588
@@ -3141,7 +3133,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3141 3133
3142 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ 3134 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
3143 /* nonblock mode is set or port is not enabled */ 3135 /* nonblock mode is set or port is not enabled */
3144 info->flags |= ASYNC_NORMAL_ACTIVE; 3136 info->port.flags |= ASYNC_NORMAL_ACTIVE;
3145 return 0; 3137 return 0;
3146 } 3138 }
3147 3139
@@ -3150,21 +3142,21 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3150 3142
3151 /* Wait for carrier detect and the line to become 3143 /* Wait for carrier detect and the line to become
3152 * free (i.e., not in use by the callout). While we are in 3144 * free (i.e., not in use by the callout). While we are in
3153 * this loop, info->count is dropped by one, so that 3145 * this loop, info->port.count is dropped by one, so that
3154 * close() knows when to free things. We restore it upon 3146 * close() knows when to free things. We restore it upon
3155 * exit, either normal or abnormal. 3147 * exit, either normal or abnormal.
3156 */ 3148 */
3157 3149
3158 retval = 0; 3150 retval = 0;
3159 add_wait_queue(&info->open_wait, &wait); 3151 add_wait_queue(&info->port.open_wait, &wait);
3160 3152
3161 spin_lock_irqsave(&info->lock, flags); 3153 spin_lock_irqsave(&info->lock, flags);
3162 if (!tty_hung_up_p(filp)) { 3154 if (!tty_hung_up_p(filp)) {
3163 extra_count = true; 3155 extra_count = true;
3164 info->count--; 3156 info->port.count--;
3165 } 3157 }
3166 spin_unlock_irqrestore(&info->lock, flags); 3158 spin_unlock_irqrestore(&info->lock, flags);
3167 info->blocked_open++; 3159 info->port.blocked_open++;
3168 3160
3169 while (1) { 3161 while (1) {
3170 if ((tty->termios->c_cflag & CBAUD)) { 3162 if ((tty->termios->c_cflag & CBAUD)) {
@@ -3176,8 +3168,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3176 3168
3177 set_current_state(TASK_INTERRUPTIBLE); 3169 set_current_state(TASK_INTERRUPTIBLE);
3178 3170
3179 if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ 3171 if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){
3180 retval = (info->flags & ASYNC_HUP_NOTIFY) ? 3172 retval = (info->port.flags & ASYNC_HUP_NOTIFY) ?
3181 -EAGAIN : -ERESTARTSYS; 3173 -EAGAIN : -ERESTARTSYS;
3182 break; 3174 break;
3183 } 3175 }
@@ -3186,7 +3178,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3186 get_signals(info); 3178 get_signals(info);
3187 spin_unlock_irqrestore(&info->lock,flags); 3179 spin_unlock_irqrestore(&info->lock,flags);
3188 3180
3189 if (!(info->flags & ASYNC_CLOSING) && 3181 if (!(info->port.flags & ASYNC_CLOSING) &&
3190 (do_clocal || (info->signals & SerialSignal_DCD)) ) { 3182 (do_clocal || (info->signals & SerialSignal_DCD)) ) {
3191 break; 3183 break;
3192 } 3184 }
@@ -3201,14 +3193,14 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3201 } 3193 }
3202 3194
3203 set_current_state(TASK_RUNNING); 3195 set_current_state(TASK_RUNNING);
3204 remove_wait_queue(&info->open_wait, &wait); 3196 remove_wait_queue(&info->port.open_wait, &wait);
3205 3197
3206 if (extra_count) 3198 if (extra_count)
3207 info->count++; 3199 info->port.count++;
3208 info->blocked_open--; 3200 info->port.blocked_open--;
3209 3201
3210 if (!retval) 3202 if (!retval)
3211 info->flags |= ASYNC_NORMAL_ACTIVE; 3203 info->port.flags |= ASYNC_NORMAL_ACTIVE;
3212 3204
3213 DBGINFO(("%s block_til_ready ready, rc=%d\n", tty->driver->name, retval)); 3205 DBGINFO(("%s block_til_ready ready, rc=%d\n", tty->driver->name, retval));
3214 return retval; 3206 return retval;
@@ -3451,14 +3443,13 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
3451 DBGERR(("%s device alloc failed adapter=%d port=%d\n", 3443 DBGERR(("%s device alloc failed adapter=%d port=%d\n",
3452 driver_name, adapter_num, port_num)); 3444 driver_name, adapter_num, port_num));
3453 } else { 3445 } else {
3446 tty_port_init(&info->port);
3454 info->magic = MGSL_MAGIC; 3447 info->magic = MGSL_MAGIC;
3455 INIT_WORK(&info->task, bh_handler); 3448 INIT_WORK(&info->task, bh_handler);
3456 info->max_frame_size = 4096; 3449 info->max_frame_size = 4096;
3457 info->raw_rx_size = DMABUFSIZE; 3450 info->raw_rx_size = DMABUFSIZE;
3458 info->close_delay = 5*HZ/10; 3451 info->port.close_delay = 5*HZ/10;
3459 info->closing_wait = 30*HZ; 3452 info->port.closing_wait = 30*HZ;
3460 init_waitqueue_head(&info->open_wait);
3461 init_waitqueue_head(&info->close_wait);
3462 init_waitqueue_head(&info->status_event_wait_q); 3453 init_waitqueue_head(&info->status_event_wait_q);
3463 init_waitqueue_head(&info->event_wait_q); 3454 init_waitqueue_head(&info->event_wait_q);
3464 spin_lock_init(&info->netlock); 3455 spin_lock_init(&info->netlock);
@@ -4502,7 +4493,7 @@ static bool rx_get_frame(struct slgt_info *info)
4502 unsigned short status; 4493 unsigned short status;
4503 unsigned int framesize = 0; 4494 unsigned int framesize = 0;
4504 unsigned long flags; 4495 unsigned long flags;
4505 struct tty_struct *tty = info->tty; 4496 struct tty_struct *tty = info->port.tty;
4506 unsigned char addr_field = 0xff; 4497 unsigned char addr_field = 0xff;
4507 unsigned int crc_size = 0; 4498 unsigned int crc_size = 0;
4508 4499
@@ -4652,7 +4643,7 @@ static bool rx_get_buf(struct slgt_info *info)
4652 DBGDATA(info, info->rbufs[i].buf, count, "rx"); 4643 DBGDATA(info, info->rbufs[i].buf, count, "rx");
4653 DBGINFO(("rx_get_buf size=%d\n", count)); 4644 DBGINFO(("rx_get_buf size=%d\n", count));
4654 if (count) 4645 if (count)
4655 ldisc_receive_buf(info->tty, info->rbufs[i].buf, 4646 ldisc_receive_buf(info->port.tty, info->rbufs[i].buf,
4656 info->flag_buf, count); 4647 info->flag_buf, count);
4657 free_rbufs(info, i, i); 4648 free_rbufs(info, i, i);
4658 return true; 4649 return true;
@@ -4761,11 +4752,11 @@ static int irq_test(struct slgt_info *info)
4761{ 4752{
4762 unsigned long timeout; 4753 unsigned long timeout;
4763 unsigned long flags; 4754 unsigned long flags;
4764 struct tty_struct *oldtty = info->tty; 4755 struct tty_struct *oldtty = info->port.tty;
4765 u32 speed = info->params.data_rate; 4756 u32 speed = info->params.data_rate;
4766 4757
4767 info->params.data_rate = 921600; 4758 info->params.data_rate = 921600;
4768 info->tty = NULL; 4759 info->port.tty = NULL;
4769 4760
4770 spin_lock_irqsave(&info->lock, flags); 4761 spin_lock_irqsave(&info->lock, flags);
4771 async_mode(info); 4762 async_mode(info);
@@ -4793,7 +4784,7 @@ static int irq_test(struct slgt_info *info)
4793 spin_unlock_irqrestore(&info->lock,flags); 4784 spin_unlock_irqrestore(&info->lock,flags);
4794 4785
4795 info->params.data_rate = speed; 4786 info->params.data_rate = speed;
4796 info->tty = oldtty; 4787 info->port.tty = oldtty;
4797 4788
4798 info->init_error = info->irq_occurred ? 0 : DiagStatus_IrqFailure; 4789 info->init_error = info->irq_occurred ? 0 : DiagStatus_IrqFailure;
4799 return info->irq_occurred ? 0 : -ENODEV; 4790 return info->irq_occurred ? 0 : -ENODEV;
@@ -4833,7 +4824,7 @@ static int loopback_test(struct slgt_info *info)
4833 int rc = -ENODEV; 4824 int rc = -ENODEV;
4834 unsigned long flags; 4825 unsigned long flags;
4835 4826
4836 struct tty_struct *oldtty = info->tty; 4827 struct tty_struct *oldtty = info->port.tty;
4837 MGSL_PARAMS params; 4828 MGSL_PARAMS params;
4838 4829
4839 memcpy(&params, &info->params, sizeof(params)); 4830 memcpy(&params, &info->params, sizeof(params));
@@ -4841,7 +4832,7 @@ static int loopback_test(struct slgt_info *info)
4841 info->params.mode = MGSL_MODE_ASYNC; 4832 info->params.mode = MGSL_MODE_ASYNC;
4842 info->params.data_rate = 921600; 4833 info->params.data_rate = 921600;
4843 info->params.loopback = 1; 4834 info->params.loopback = 1;
4844 info->tty = NULL; 4835 info->port.tty = NULL;
4845 4836
4846 /* build and send transmit frame */ 4837 /* build and send transmit frame */
4847 for (count = 0; count < TESTFRAMESIZE; ++count) 4838 for (count = 0; count < TESTFRAMESIZE; ++count)
@@ -4879,7 +4870,7 @@ static int loopback_test(struct slgt_info *info)
4879 spin_unlock_irqrestore(&info->lock,flags); 4870 spin_unlock_irqrestore(&info->lock,flags);
4880 4871
4881 memcpy(&info->params, &params, sizeof(info->params)); 4872 memcpy(&info->params, &params, sizeof(info->params));
4882 info->tty = oldtty; 4873 info->port.tty = oldtty;
4883 4874
4884 info->init_error = rc ? DiagStatus_DmaFailure : 0; 4875 info->init_error = rc ? DiagStatus_DmaFailure : 0;
4885 return rc; 4876 return rc;
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
index 10241ed86100..5768c4136342 100644
--- a/drivers/char/synclinkmp.c
+++ b/drivers/char/synclinkmp.c
@@ -151,18 +151,15 @@ struct _input_signal_events {
151typedef struct _synclinkmp_info { 151typedef struct _synclinkmp_info {
152 void *if_ptr; /* General purpose pointer (used by SPPP) */ 152 void *if_ptr; /* General purpose pointer (used by SPPP) */
153 int magic; 153 int magic;
154 int flags; 154 struct tty_port port;
155 int count; /* count of opens */
156 int line; 155 int line;
157 unsigned short close_delay; 156 unsigned short close_delay;
158 unsigned short closing_wait; /* time to wait before closing */ 157 unsigned short closing_wait; /* time to wait before closing */
159 158
160 struct mgsl_icount icount; 159 struct mgsl_icount icount;
161 160
162 struct tty_struct *tty;
163 int timeout; 161 int timeout;
164 int x_char; /* xon/xoff character */ 162 int x_char; /* xon/xoff character */
165 int blocked_open; /* # of blocked opens */
166 u16 read_status_mask1; /* break detection (SR1 indications) */ 163 u16 read_status_mask1; /* break detection (SR1 indications) */
167 u16 read_status_mask2; /* parity/framing/overun (SR2 indications) */ 164 u16 read_status_mask2; /* parity/framing/overun (SR2 indications) */
168 unsigned char ignore_status_mask1; /* break detection (SR1 indications) */ 165 unsigned char ignore_status_mask1; /* break detection (SR1 indications) */
@@ -172,9 +169,6 @@ typedef struct _synclinkmp_info {
172 int tx_get; 169 int tx_get;
173 int tx_count; 170 int tx_count;
174 171
175 wait_queue_head_t open_wait;
176 wait_queue_head_t close_wait;
177
178 wait_queue_head_t status_event_wait_q; 172 wait_queue_head_t status_event_wait_q;
179 wait_queue_head_t event_wait_q; 173 wait_queue_head_t event_wait_q;
180 struct timer_list tx_timer; /* HDLC transmit timeout timer */ 174 struct timer_list tx_timer; /* HDLC transmit timeout timer */
@@ -462,13 +456,13 @@ static int synclinkmp_device_count = 0;
462 * .text section address and breakpoint on module load. 456 * .text section address and breakpoint on module load.
463 * This is useful for use with gdb and add-symbol-file command. 457 * This is useful for use with gdb and add-symbol-file command.
464 */ 458 */
465static int break_on_load=0; 459static int break_on_load = 0;
466 460
467/* 461/*
468 * Driver major number, defaults to zero to get auto 462 * Driver major number, defaults to zero to get auto
469 * assigned major number. May be forced as module parameter. 463 * assigned major number. May be forced as module parameter.
470 */ 464 */
471static int ttymajor=0; 465static int ttymajor = 0;
472 466
473/* 467/*
474 * Array of user specified options for ISA adapters. 468 * Array of user specified options for ISA adapters.
@@ -712,8 +706,8 @@ static void ldisc_receive_buf(struct tty_struct *tty,
712 return; 706 return;
713 ld = tty_ldisc_ref(tty); 707 ld = tty_ldisc_ref(tty);
714 if (ld) { 708 if (ld) {
715 if (ld->receive_buf) 709 if (ld->ops->receive_buf)
716 ld->receive_buf(tty, data, flags, count); 710 ld->ops->receive_buf(tty, data, flags, count);
717 tty_ldisc_deref(ld); 711 tty_ldisc_deref(ld);
718 } 712 }
719} 713}
@@ -747,22 +741,22 @@ static int open(struct tty_struct *tty, struct file *filp)
747 } 741 }
748 742
749 tty->driver_data = info; 743 tty->driver_data = info;
750 info->tty = tty; 744 info->port.tty = tty;
751 745
752 if (debug_level >= DEBUG_LEVEL_INFO) 746 if (debug_level >= DEBUG_LEVEL_INFO)
753 printk("%s(%d):%s open(), old ref count = %d\n", 747 printk("%s(%d):%s open(), old ref count = %d\n",
754 __FILE__,__LINE__,tty->driver->name, info->count); 748 __FILE__,__LINE__,tty->driver->name, info->port.count);
755 749
756 /* If port is closing, signal caller to try again */ 750 /* If port is closing, signal caller to try again */
757 if (tty_hung_up_p(filp) || info->flags & ASYNC_CLOSING){ 751 if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){
758 if (info->flags & ASYNC_CLOSING) 752 if (info->port.flags & ASYNC_CLOSING)
759 interruptible_sleep_on(&info->close_wait); 753 interruptible_sleep_on(&info->port.close_wait);
760 retval = ((info->flags & ASYNC_HUP_NOTIFY) ? 754 retval = ((info->port.flags & ASYNC_HUP_NOTIFY) ?
761 -EAGAIN : -ERESTARTSYS); 755 -EAGAIN : -ERESTARTSYS);
762 goto cleanup; 756 goto cleanup;
763 } 757 }
764 758
765 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 759 info->port.tty->low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
766 760
767 spin_lock_irqsave(&info->netlock, flags); 761 spin_lock_irqsave(&info->netlock, flags);
768 if (info->netcount) { 762 if (info->netcount) {
@@ -770,10 +764,10 @@ static int open(struct tty_struct *tty, struct file *filp)
770 spin_unlock_irqrestore(&info->netlock, flags); 764 spin_unlock_irqrestore(&info->netlock, flags);
771 goto cleanup; 765 goto cleanup;
772 } 766 }
773 info->count++; 767 info->port.count++;
774 spin_unlock_irqrestore(&info->netlock, flags); 768 spin_unlock_irqrestore(&info->netlock, flags);
775 769
776 if (info->count == 1) { 770 if (info->port.count == 1) {
777 /* 1st open on this device, init hardware */ 771 /* 1st open on this device, init hardware */
778 retval = startup(info); 772 retval = startup(info);
779 if (retval < 0) 773 if (retval < 0)
@@ -796,9 +790,9 @@ static int open(struct tty_struct *tty, struct file *filp)
796cleanup: 790cleanup:
797 if (retval) { 791 if (retval) {
798 if (tty->count == 1) 792 if (tty->count == 1)
799 info->tty = NULL; /* tty layer will release tty struct */ 793 info->port.tty = NULL; /* tty layer will release tty struct */
800 if(info->count) 794 if(info->port.count)
801 info->count--; 795 info->port.count--;
802 } 796 }
803 797
804 return retval; 798 return retval;
@@ -816,33 +810,33 @@ static void close(struct tty_struct *tty, struct file *filp)
816 810
817 if (debug_level >= DEBUG_LEVEL_INFO) 811 if (debug_level >= DEBUG_LEVEL_INFO)
818 printk("%s(%d):%s close() entry, count=%d\n", 812 printk("%s(%d):%s close() entry, count=%d\n",
819 __FILE__,__LINE__, info->device_name, info->count); 813 __FILE__,__LINE__, info->device_name, info->port.count);
820 814
821 if (!info->count) 815 if (!info->port.count)
822 return; 816 return;
823 817
824 if (tty_hung_up_p(filp)) 818 if (tty_hung_up_p(filp))
825 goto cleanup; 819 goto cleanup;
826 820
827 if ((tty->count == 1) && (info->count != 1)) { 821 if ((tty->count == 1) && (info->port.count != 1)) {
828 /* 822 /*
829 * tty->count is 1 and the tty structure will be freed. 823 * tty->count is 1 and the tty structure will be freed.
830 * info->count should be one in this case. 824 * info->port.count should be one in this case.
831 * if it's not, correct it so that the port is shutdown. 825 * if it's not, correct it so that the port is shutdown.
832 */ 826 */
833 printk("%s(%d):%s close: bad refcount; tty->count is 1, " 827 printk("%s(%d):%s close: bad refcount; tty->count is 1, "
834 "info->count is %d\n", 828 "info->port.count is %d\n",
835 __FILE__,__LINE__, info->device_name, info->count); 829 __FILE__,__LINE__, info->device_name, info->port.count);
836 info->count = 1; 830 info->port.count = 1;
837 } 831 }
838 832
839 info->count--; 833 info->port.count--;
840 834
841 /* if at least one open remaining, leave hardware active */ 835 /* if at least one open remaining, leave hardware active */
842 if (info->count) 836 if (info->port.count)
843 goto cleanup; 837 goto cleanup;
844 838
845 info->flags |= ASYNC_CLOSING; 839 info->port.flags |= ASYNC_CLOSING;
846 840
847 /* set tty->closing to notify line discipline to 841 /* set tty->closing to notify line discipline to
848 * only process XON/XOFF characters. Only the N_TTY 842 * only process XON/XOFF characters. Only the N_TTY
@@ -852,14 +846,14 @@ static void close(struct tty_struct *tty, struct file *filp)
852 846
853 /* wait for transmit data to clear all layers */ 847 /* wait for transmit data to clear all layers */
854 848
855 if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) { 849 if (info->port.closing_wait != ASYNC_CLOSING_WAIT_NONE) {
856 if (debug_level >= DEBUG_LEVEL_INFO) 850 if (debug_level >= DEBUG_LEVEL_INFO)
857 printk("%s(%d):%s close() calling tty_wait_until_sent\n", 851 printk("%s(%d):%s close() calling tty_wait_until_sent\n",
858 __FILE__,__LINE__, info->device_name ); 852 __FILE__,__LINE__, info->device_name );
859 tty_wait_until_sent(tty, info->closing_wait); 853 tty_wait_until_sent(tty, info->port.closing_wait);
860 } 854 }
861 855
862 if (info->flags & ASYNC_INITIALIZED) 856 if (info->port.flags & ASYNC_INITIALIZED)
863 wait_until_sent(tty, info->timeout); 857 wait_until_sent(tty, info->timeout);
864 858
865 flush_buffer(tty); 859 flush_buffer(tty);
@@ -869,23 +863,23 @@ static void close(struct tty_struct *tty, struct file *filp)
869 shutdown(info); 863 shutdown(info);
870 864
871 tty->closing = 0; 865 tty->closing = 0;
872 info->tty = NULL; 866 info->port.tty = NULL;
873 867
874 if (info->blocked_open) { 868 if (info->port.blocked_open) {
875 if (info->close_delay) { 869 if (info->port.close_delay) {
876 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 870 msleep_interruptible(jiffies_to_msecs(info->port.close_delay));
877 } 871 }
878 wake_up_interruptible(&info->open_wait); 872 wake_up_interruptible(&info->port.open_wait);
879 } 873 }
880 874
881 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 875 info->port.flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
882 876
883 wake_up_interruptible(&info->close_wait); 877 wake_up_interruptible(&info->port.close_wait);
884 878
885cleanup: 879cleanup:
886 if (debug_level >= DEBUG_LEVEL_INFO) 880 if (debug_level >= DEBUG_LEVEL_INFO)
887 printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__, 881 printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__,
888 tty->driver->name, info->count); 882 tty->driver->name, info->port.count);
889} 883}
890 884
891/* Called by tty_hangup() when a hangup is signaled. 885/* Called by tty_hangup() when a hangup is signaled.
@@ -905,11 +899,11 @@ static void hangup(struct tty_struct *tty)
905 flush_buffer(tty); 899 flush_buffer(tty);
906 shutdown(info); 900 shutdown(info);
907 901
908 info->count = 0; 902 info->port.count = 0;
909 info->flags &= ~ASYNC_NORMAL_ACTIVE; 903 info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
910 info->tty = NULL; 904 info->port.tty = NULL;
911 905
912 wake_up_interruptible(&info->open_wait); 906 wake_up_interruptible(&info->port.open_wait);
913} 907}
914 908
915/* Set new termios settings 909/* Set new termios settings
@@ -1123,7 +1117,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout)
1123 1117
1124 lock_kernel(); 1118 lock_kernel();
1125 1119
1126 if (!(info->flags & ASYNC_INITIALIZED)) 1120 if (!(info->port.flags & ASYNC_INITIALIZED))
1127 goto exit; 1121 goto exit;
1128 1122
1129 orig_jiffies = jiffies; 1123 orig_jiffies = jiffies;
@@ -1636,7 +1630,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
1636 unsigned short new_crctype; 1630 unsigned short new_crctype;
1637 1631
1638 /* return error if TTY interface open */ 1632 /* return error if TTY interface open */
1639 if (info->count) 1633 if (info->port.count)
1640 return -EBUSY; 1634 return -EBUSY;
1641 1635
1642 switch (encoding) 1636 switch (encoding)
@@ -1732,7 +1726,7 @@ static int hdlcdev_open(struct net_device *dev)
1732 1726
1733 /* arbitrate between network and tty opens */ 1727 /* arbitrate between network and tty opens */
1734 spin_lock_irqsave(&info->netlock, flags); 1728 spin_lock_irqsave(&info->netlock, flags);
1735 if (info->count != 0 || info->netcount != 0) { 1729 if (info->port.count != 0 || info->netcount != 0) {
1736 printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name); 1730 printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name);
1737 spin_unlock_irqrestore(&info->netlock, flags); 1731 spin_unlock_irqrestore(&info->netlock, flags);
1738 return -EBUSY; 1732 return -EBUSY;
@@ -1818,7 +1812,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1818 printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name); 1812 printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name);
1819 1813
1820 /* return error if TTY interface open */ 1814 /* return error if TTY interface open */
1821 if (info->count) 1815 if (info->port.count)
1822 return -EBUSY; 1816 return -EBUSY;
1823 1817
1824 if (cmd != SIOCWANDEV) 1818 if (cmd != SIOCWANDEV)
@@ -2126,7 +2120,7 @@ static void bh_receive(SLMP_INFO *info)
2126 2120
2127static void bh_transmit(SLMP_INFO *info) 2121static void bh_transmit(SLMP_INFO *info)
2128{ 2122{
2129 struct tty_struct *tty = info->tty; 2123 struct tty_struct *tty = info->port.tty;
2130 2124
2131 if ( debug_level >= DEBUG_LEVEL_BH ) 2125 if ( debug_level >= DEBUG_LEVEL_BH )
2132 printk( "%s(%d):%s bh_transmit() entry\n", 2126 printk( "%s(%d):%s bh_transmit() entry\n",
@@ -2176,7 +2170,7 @@ static void isr_timer(SLMP_INFO * info)
2176 2170
2177static void isr_rxint(SLMP_INFO * info) 2171static void isr_rxint(SLMP_INFO * info)
2178{ 2172{
2179 struct tty_struct *tty = info->tty; 2173 struct tty_struct *tty = info->port.tty;
2180 struct mgsl_icount *icount = &info->icount; 2174 struct mgsl_icount *icount = &info->icount;
2181 unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD); 2175 unsigned char status = read_reg(info, SR1) & info->ie1_value & (FLGD + IDLD + CDCD + BRKD);
2182 unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN; 2176 unsigned char status2 = read_reg(info, SR2) & info->ie2_value & OVRN;
@@ -2203,7 +2197,7 @@ static void isr_rxint(SLMP_INFO * info)
2203 if (!(status & info->ignore_status_mask1)) { 2197 if (!(status & info->ignore_status_mask1)) {
2204 if (info->read_status_mask1 & BRKD) { 2198 if (info->read_status_mask1 & BRKD) {
2205 tty_insert_flip_char(tty, 0, TTY_BREAK); 2199 tty_insert_flip_char(tty, 0, TTY_BREAK);
2206 if (info->flags & ASYNC_SAK) 2200 if (info->port.flags & ASYNC_SAK)
2207 do_SAK(tty); 2201 do_SAK(tty);
2208 } 2202 }
2209 } 2203 }
@@ -2237,7 +2231,7 @@ static void isr_rxrdy(SLMP_INFO * info)
2237{ 2231{
2238 u16 status; 2232 u16 status;
2239 unsigned char DataByte; 2233 unsigned char DataByte;
2240 struct tty_struct *tty = info->tty; 2234 struct tty_struct *tty = info->port.tty;
2241 struct mgsl_icount *icount = &info->icount; 2235 struct mgsl_icount *icount = &info->icount;
2242 2236
2243 if ( debug_level >= DEBUG_LEVEL_ISR ) 2237 if ( debug_level >= DEBUG_LEVEL_ISR )
@@ -2350,7 +2344,7 @@ static void isr_txeom(SLMP_INFO * info, unsigned char status)
2350 else 2344 else
2351#endif 2345#endif
2352 { 2346 {
2353 if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { 2347 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) {
2354 tx_stop(info); 2348 tx_stop(info);
2355 return; 2349 return;
2356 } 2350 }
@@ -2405,7 +2399,7 @@ static void isr_txrdy(SLMP_INFO * info)
2405 return; 2399 return;
2406 } 2400 }
2407 2401
2408 if (info->tty && (info->tty->stopped || info->tty->hw_stopped)) { 2402 if (info->port.tty && (info->port.tty->stopped || info->port.tty->hw_stopped)) {
2409 tx_stop(info); 2403 tx_stop(info);
2410 return; 2404 return;
2411 } 2405 }
@@ -2552,29 +2546,29 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )
2552 wake_up_interruptible(&info->status_event_wait_q); 2546 wake_up_interruptible(&info->status_event_wait_q);
2553 wake_up_interruptible(&info->event_wait_q); 2547 wake_up_interruptible(&info->event_wait_q);
2554 2548
2555 if ( (info->flags & ASYNC_CHECK_CD) && 2549 if ( (info->port.flags & ASYNC_CHECK_CD) &&
2556 (status & MISCSTATUS_DCD_LATCHED) ) { 2550 (status & MISCSTATUS_DCD_LATCHED) ) {
2557 if ( debug_level >= DEBUG_LEVEL_ISR ) 2551 if ( debug_level >= DEBUG_LEVEL_ISR )
2558 printk("%s CD now %s...", info->device_name, 2552 printk("%s CD now %s...", info->device_name,
2559 (status & SerialSignal_DCD) ? "on" : "off"); 2553 (status & SerialSignal_DCD) ? "on" : "off");
2560 if (status & SerialSignal_DCD) 2554 if (status & SerialSignal_DCD)
2561 wake_up_interruptible(&info->open_wait); 2555 wake_up_interruptible(&info->port.open_wait);
2562 else { 2556 else {
2563 if ( debug_level >= DEBUG_LEVEL_ISR ) 2557 if ( debug_level >= DEBUG_LEVEL_ISR )
2564 printk("doing serial hangup..."); 2558 printk("doing serial hangup...");
2565 if (info->tty) 2559 if (info->port.tty)
2566 tty_hangup(info->tty); 2560 tty_hangup(info->port.tty);
2567 } 2561 }
2568 } 2562 }
2569 2563
2570 if ( (info->flags & ASYNC_CTS_FLOW) && 2564 if ( (info->port.flags & ASYNC_CTS_FLOW) &&
2571 (status & MISCSTATUS_CTS_LATCHED) ) { 2565 (status & MISCSTATUS_CTS_LATCHED) ) {
2572 if ( info->tty ) { 2566 if ( info->port.tty ) {
2573 if (info->tty->hw_stopped) { 2567 if (info->port.tty->hw_stopped) {
2574 if (status & SerialSignal_CTS) { 2568 if (status & SerialSignal_CTS) {
2575 if ( debug_level >= DEBUG_LEVEL_ISR ) 2569 if ( debug_level >= DEBUG_LEVEL_ISR )
2576 printk("CTS tx start..."); 2570 printk("CTS tx start...");
2577 info->tty->hw_stopped = 0; 2571 info->port.tty->hw_stopped = 0;
2578 tx_start(info); 2572 tx_start(info);
2579 info->pending_bh |= BH_TRANSMIT; 2573 info->pending_bh |= BH_TRANSMIT;
2580 return; 2574 return;
@@ -2583,7 +2577,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )
2583 if (!(status & SerialSignal_CTS)) { 2577 if (!(status & SerialSignal_CTS)) {
2584 if ( debug_level >= DEBUG_LEVEL_ISR ) 2578 if ( debug_level >= DEBUG_LEVEL_ISR )
2585 printk("CTS tx stop..."); 2579 printk("CTS tx stop...");
2586 info->tty->hw_stopped = 1; 2580 info->port.tty->hw_stopped = 1;
2587 tx_stop(info); 2581 tx_stop(info);
2588 } 2582 }
2589 } 2583 }
@@ -2699,7 +2693,7 @@ static irqreturn_t synclinkmp_interrupt(int dummy, void *dev_id)
2699 * do not request bottom half processing if the 2693 * do not request bottom half processing if the
2700 * device is not open in a normal mode. 2694 * device is not open in a normal mode.
2701 */ 2695 */
2702 if ( port && (port->count || port->netcount) && 2696 if ( port && (port->port.count || port->netcount) &&
2703 port->pending_bh && !port->bh_running && 2697 port->pending_bh && !port->bh_running &&
2704 !port->bh_requested ) { 2698 !port->bh_requested ) {
2705 if ( debug_level >= DEBUG_LEVEL_ISR ) 2699 if ( debug_level >= DEBUG_LEVEL_ISR )
@@ -2725,7 +2719,7 @@ static int startup(SLMP_INFO * info)
2725 if ( debug_level >= DEBUG_LEVEL_INFO ) 2719 if ( debug_level >= DEBUG_LEVEL_INFO )
2726 printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name); 2720 printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name);
2727 2721
2728 if (info->flags & ASYNC_INITIALIZED) 2722 if (info->port.flags & ASYNC_INITIALIZED)
2729 return 0; 2723 return 0;
2730 2724
2731 if (!info->tx_buf) { 2725 if (!info->tx_buf) {
@@ -2748,10 +2742,10 @@ static int startup(SLMP_INFO * info)
2748 2742
2749 mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10)); 2743 mod_timer(&info->status_timer, jiffies + msecs_to_jiffies(10));
2750 2744
2751 if (info->tty) 2745 if (info->port.tty)
2752 clear_bit(TTY_IO_ERROR, &info->tty->flags); 2746 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
2753 2747
2754 info->flags |= ASYNC_INITIALIZED; 2748 info->port.flags |= ASYNC_INITIALIZED;
2755 2749
2756 return 0; 2750 return 0;
2757} 2751}
@@ -2762,7 +2756,7 @@ static void shutdown(SLMP_INFO * info)
2762{ 2756{
2763 unsigned long flags; 2757 unsigned long flags;
2764 2758
2765 if (!(info->flags & ASYNC_INITIALIZED)) 2759 if (!(info->port.flags & ASYNC_INITIALIZED))
2766 return; 2760 return;
2767 2761
2768 if (debug_level >= DEBUG_LEVEL_INFO) 2762 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -2784,17 +2778,17 @@ static void shutdown(SLMP_INFO * info)
2784 2778
2785 reset_port(info); 2779 reset_port(info);
2786 2780
2787 if (!info->tty || info->tty->termios->c_cflag & HUPCL) { 2781 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) {
2788 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 2782 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
2789 set_signals(info); 2783 set_signals(info);
2790 } 2784 }
2791 2785
2792 spin_unlock_irqrestore(&info->lock,flags); 2786 spin_unlock_irqrestore(&info->lock,flags);
2793 2787
2794 if (info->tty) 2788 if (info->port.tty)
2795 set_bit(TTY_IO_ERROR, &info->tty->flags); 2789 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
2796 2790
2797 info->flags &= ~ASYNC_INITIALIZED; 2791 info->port.flags &= ~ASYNC_INITIALIZED;
2798} 2792}
2799 2793
2800static void program_hw(SLMP_INFO *info) 2794static void program_hw(SLMP_INFO *info)
@@ -2825,7 +2819,7 @@ static void program_hw(SLMP_INFO *info)
2825 2819
2826 get_signals(info); 2820 get_signals(info);
2827 2821
2828 if (info->netcount || (info->tty && info->tty->termios->c_cflag & CREAD) ) 2822 if (info->netcount || (info->port.tty && info->port.tty->termios->c_cflag & CREAD) )
2829 rx_start(info); 2823 rx_start(info);
2830 2824
2831 spin_unlock_irqrestore(&info->lock,flags); 2825 spin_unlock_irqrestore(&info->lock,flags);
@@ -2838,14 +2832,14 @@ static void change_params(SLMP_INFO *info)
2838 unsigned cflag; 2832 unsigned cflag;
2839 int bits_per_char; 2833 int bits_per_char;
2840 2834
2841 if (!info->tty || !info->tty->termios) 2835 if (!info->port.tty || !info->port.tty->termios)
2842 return; 2836 return;
2843 2837
2844 if (debug_level >= DEBUG_LEVEL_INFO) 2838 if (debug_level >= DEBUG_LEVEL_INFO)
2845 printk("%s(%d):%s change_params()\n", 2839 printk("%s(%d):%s change_params()\n",
2846 __FILE__,__LINE__, info->device_name ); 2840 __FILE__,__LINE__, info->device_name );
2847 2841
2848 cflag = info->tty->termios->c_cflag; 2842 cflag = info->port.tty->termios->c_cflag;
2849 2843
2850 /* if B0 rate (hangup) specified then negate DTR and RTS */ 2844 /* if B0 rate (hangup) specified then negate DTR and RTS */
2851 /* otherwise assert DTR and RTS */ 2845 /* otherwise assert DTR and RTS */
@@ -2893,7 +2887,7 @@ static void change_params(SLMP_INFO *info)
2893 * current data rate. 2887 * current data rate.
2894 */ 2888 */
2895 if (info->params.data_rate <= 460800) { 2889 if (info->params.data_rate <= 460800) {
2896 info->params.data_rate = tty_get_baud_rate(info->tty); 2890 info->params.data_rate = tty_get_baud_rate(info->port.tty);
2897 } 2891 }
2898 2892
2899 if ( info->params.data_rate ) { 2893 if ( info->params.data_rate ) {
@@ -2903,30 +2897,30 @@ static void change_params(SLMP_INFO *info)
2903 info->timeout += HZ/50; /* Add .02 seconds of slop */ 2897 info->timeout += HZ/50; /* Add .02 seconds of slop */
2904 2898
2905 if (cflag & CRTSCTS) 2899 if (cflag & CRTSCTS)
2906 info->flags |= ASYNC_CTS_FLOW; 2900 info->port.flags |= ASYNC_CTS_FLOW;
2907 else 2901 else
2908 info->flags &= ~ASYNC_CTS_FLOW; 2902 info->port.flags &= ~ASYNC_CTS_FLOW;
2909 2903
2910 if (cflag & CLOCAL) 2904 if (cflag & CLOCAL)
2911 info->flags &= ~ASYNC_CHECK_CD; 2905 info->port.flags &= ~ASYNC_CHECK_CD;
2912 else 2906 else
2913 info->flags |= ASYNC_CHECK_CD; 2907 info->port.flags |= ASYNC_CHECK_CD;
2914 2908
2915 /* process tty input control flags */ 2909 /* process tty input control flags */
2916 2910
2917 info->read_status_mask2 = OVRN; 2911 info->read_status_mask2 = OVRN;
2918 if (I_INPCK(info->tty)) 2912 if (I_INPCK(info->port.tty))
2919 info->read_status_mask2 |= PE | FRME; 2913 info->read_status_mask2 |= PE | FRME;
2920 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 2914 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
2921 info->read_status_mask1 |= BRKD; 2915 info->read_status_mask1 |= BRKD;
2922 if (I_IGNPAR(info->tty)) 2916 if (I_IGNPAR(info->port.tty))
2923 info->ignore_status_mask2 |= PE | FRME; 2917 info->ignore_status_mask2 |= PE | FRME;
2924 if (I_IGNBRK(info->tty)) { 2918 if (I_IGNBRK(info->port.tty)) {
2925 info->ignore_status_mask1 |= BRKD; 2919 info->ignore_status_mask1 |= BRKD;
2926 /* If ignoring parity and break indicators, ignore 2920 /* If ignoring parity and break indicators, ignore
2927 * overruns too. (For real raw support). 2921 * overruns too. (For real raw support).
2928 */ 2922 */
2929 if (I_IGNPAR(info->tty)) 2923 if (I_IGNPAR(info->port.tty))
2930 info->ignore_status_mask2 |= OVRN; 2924 info->ignore_status_mask2 |= OVRN;
2931 } 2925 }
2932 2926
@@ -3346,7 +3340,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3346 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ 3340 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){
3347 /* nonblock mode is set or port is not enabled */ 3341 /* nonblock mode is set or port is not enabled */
3348 /* just verify that callout device is not active */ 3342 /* just verify that callout device is not active */
3349 info->flags |= ASYNC_NORMAL_ACTIVE; 3343 info->port.flags |= ASYNC_NORMAL_ACTIVE;
3350 return 0; 3344 return 0;
3351 } 3345 }
3352 3346
@@ -3355,25 +3349,25 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3355 3349
3356 /* Wait for carrier detect and the line to become 3350 /* Wait for carrier detect and the line to become
3357 * free (i.e., not in use by the callout). While we are in 3351 * free (i.e., not in use by the callout). While we are in
3358 * this loop, info->count is dropped by one, so that 3352 * this loop, info->port.count is dropped by one, so that
3359 * close() knows when to free things. We restore it upon 3353 * close() knows when to free things. We restore it upon
3360 * exit, either normal or abnormal. 3354 * exit, either normal or abnormal.
3361 */ 3355 */
3362 3356
3363 retval = 0; 3357 retval = 0;
3364 add_wait_queue(&info->open_wait, &wait); 3358 add_wait_queue(&info->port.open_wait, &wait);
3365 3359
3366 if (debug_level >= DEBUG_LEVEL_INFO) 3360 if (debug_level >= DEBUG_LEVEL_INFO)
3367 printk("%s(%d):%s block_til_ready() before block, count=%d\n", 3361 printk("%s(%d):%s block_til_ready() before block, count=%d\n",
3368 __FILE__,__LINE__, tty->driver->name, info->count ); 3362 __FILE__,__LINE__, tty->driver->name, info->port.count );
3369 3363
3370 spin_lock_irqsave(&info->lock, flags); 3364 spin_lock_irqsave(&info->lock, flags);
3371 if (!tty_hung_up_p(filp)) { 3365 if (!tty_hung_up_p(filp)) {
3372 extra_count = true; 3366 extra_count = true;
3373 info->count--; 3367 info->port.count--;
3374 } 3368 }
3375 spin_unlock_irqrestore(&info->lock, flags); 3369 spin_unlock_irqrestore(&info->lock, flags);
3376 info->blocked_open++; 3370 info->port.blocked_open++;
3377 3371
3378 while (1) { 3372 while (1) {
3379 if ((tty->termios->c_cflag & CBAUD)) { 3373 if ((tty->termios->c_cflag & CBAUD)) {
@@ -3385,8 +3379,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3385 3379
3386 set_current_state(TASK_INTERRUPTIBLE); 3380 set_current_state(TASK_INTERRUPTIBLE);
3387 3381
3388 if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)){ 3382 if (tty_hung_up_p(filp) || !(info->port.flags & ASYNC_INITIALIZED)){
3389 retval = (info->flags & ASYNC_HUP_NOTIFY) ? 3383 retval = (info->port.flags & ASYNC_HUP_NOTIFY) ?
3390 -EAGAIN : -ERESTARTSYS; 3384 -EAGAIN : -ERESTARTSYS;
3391 break; 3385 break;
3392 } 3386 }
@@ -3395,7 +3389,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3395 get_signals(info); 3389 get_signals(info);
3396 spin_unlock_irqrestore(&info->lock,flags); 3390 spin_unlock_irqrestore(&info->lock,flags);
3397 3391
3398 if (!(info->flags & ASYNC_CLOSING) && 3392 if (!(info->port.flags & ASYNC_CLOSING) &&
3399 (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) { 3393 (do_clocal || (info->serial_signals & SerialSignal_DCD)) ) {
3400 break; 3394 break;
3401 } 3395 }
@@ -3407,24 +3401,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3407 3401
3408 if (debug_level >= DEBUG_LEVEL_INFO) 3402 if (debug_level >= DEBUG_LEVEL_INFO)
3409 printk("%s(%d):%s block_til_ready() count=%d\n", 3403 printk("%s(%d):%s block_til_ready() count=%d\n",
3410 __FILE__,__LINE__, tty->driver->name, info->count ); 3404 __FILE__,__LINE__, tty->driver->name, info->port.count );
3411 3405
3412 schedule(); 3406 schedule();
3413 } 3407 }
3414 3408
3415 set_current_state(TASK_RUNNING); 3409 set_current_state(TASK_RUNNING);
3416 remove_wait_queue(&info->open_wait, &wait); 3410 remove_wait_queue(&info->port.open_wait, &wait);
3417 3411
3418 if (extra_count) 3412 if (extra_count)
3419 info->count++; 3413 info->port.count++;
3420 info->blocked_open--; 3414 info->port.blocked_open--;
3421 3415
3422 if (debug_level >= DEBUG_LEVEL_INFO) 3416 if (debug_level >= DEBUG_LEVEL_INFO)
3423 printk("%s(%d):%s block_til_ready() after, count=%d\n", 3417 printk("%s(%d):%s block_til_ready() after, count=%d\n",
3424 __FILE__,__LINE__, tty->driver->name, info->count ); 3418 __FILE__,__LINE__, tty->driver->name, info->port.count );
3425 3419
3426 if (!retval) 3420 if (!retval)
3427 info->flags |= ASYNC_NORMAL_ACTIVE; 3421 info->port.flags |= ASYNC_NORMAL_ACTIVE;
3428 3422
3429 return retval; 3423 return retval;
3430} 3424}
@@ -3806,13 +3800,12 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
3806 printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", 3800 printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n",
3807 __FILE__,__LINE__, adapter_num, port_num); 3801 __FILE__,__LINE__, adapter_num, port_num);
3808 } else { 3802 } else {
3803 tty_port_init(&info->port);
3809 info->magic = MGSL_MAGIC; 3804 info->magic = MGSL_MAGIC;
3810 INIT_WORK(&info->task, bh_handler); 3805 INIT_WORK(&info->task, bh_handler);
3811 info->max_frame_size = 4096; 3806 info->max_frame_size = 4096;
3812 info->close_delay = 5*HZ/10; 3807 info->port.close_delay = 5*HZ/10;
3813 info->closing_wait = 30*HZ; 3808 info->port.closing_wait = 30*HZ;
3814 init_waitqueue_head(&info->open_wait);
3815 init_waitqueue_head(&info->close_wait);
3816 init_waitqueue_head(&info->status_event_wait_q); 3809 init_waitqueue_head(&info->status_event_wait_q);
3817 init_waitqueue_head(&info->event_wait_q); 3810 init_waitqueue_head(&info->event_wait_q);
3818 spin_lock_init(&info->netlock); 3811 spin_lock_init(&info->netlock);
@@ -4883,7 +4876,7 @@ static bool rx_get_frame(SLMP_INFO *info)
4883 unsigned int framesize = 0; 4876 unsigned int framesize = 0;
4884 bool ReturnCode = false; 4877 bool ReturnCode = false;
4885 unsigned long flags; 4878 unsigned long flags;
4886 struct tty_struct *tty = info->tty; 4879 struct tty_struct *tty = info->port.tty;
4887 unsigned char addr_field = 0xff; 4880 unsigned char addr_field = 0xff;
4888 SCADESC *desc; 4881 SCADESC *desc;
4889 SCADESC_EX *desc_ex; 4882 SCADESC_EX *desc_ex;
@@ -5290,11 +5283,11 @@ static bool loopback_test(SLMP_INFO *info)
5290 bool rc = false; 5283 bool rc = false;
5291 unsigned long flags; 5284 unsigned long flags;
5292 5285
5293 struct tty_struct *oldtty = info->tty; 5286 struct tty_struct *oldtty = info->port.tty;
5294 u32 speed = info->params.clock_speed; 5287 u32 speed = info->params.clock_speed;
5295 5288
5296 info->params.clock_speed = 3686400; 5289 info->params.clock_speed = 3686400;
5297 info->tty = NULL; 5290 info->port.tty = NULL;
5298 5291
5299 /* assume failure */ 5292 /* assume failure */
5300 info->init_error = DiagStatus_DmaFailure; 5293 info->init_error = DiagStatus_DmaFailure;
@@ -5338,7 +5331,7 @@ static bool loopback_test(SLMP_INFO *info)
5338 spin_unlock_irqrestore(&info->lock,flags); 5331 spin_unlock_irqrestore(&info->lock,flags);
5339 5332
5340 info->params.clock_speed = speed; 5333 info->params.clock_speed = speed;
5341 info->tty = oldtty; 5334 info->port.tty = oldtty;
5342 5335
5343 return rc; 5336 return rc;
5344} 5337}
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 047a17339f83..82f6a8c86332 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -95,8 +95,9 @@
95#include <linux/wait.h> 95#include <linux/wait.h>
96#include <linux/bitops.h> 96#include <linux/bitops.h>
97#include <linux/delay.h> 97#include <linux/delay.h>
98#include <linux/seq_file.h>
98 99
99#include <asm/uaccess.h> 100#include <linux/uaccess.h>
100#include <asm/system.h> 101#include <asm/system.h>
101 102
102#include <linux/kbd_kern.h> 103#include <linux/kbd_kern.h>
@@ -682,7 +683,7 @@ static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
682static DEFINE_SPINLOCK(tty_ldisc_lock); 683static DEFINE_SPINLOCK(tty_ldisc_lock);
683static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); 684static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait);
684/* Line disc dispatch table */ 685/* Line disc dispatch table */
685static struct tty_ldisc tty_ldiscs[NR_LDISCS]; 686static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS];
686 687
687/** 688/**
688 * tty_register_ldisc - install a line discipline 689 * tty_register_ldisc - install a line discipline
@@ -697,7 +698,7 @@ static struct tty_ldisc tty_ldiscs[NR_LDISCS];
697 * takes tty_ldisc_lock to guard against ldisc races 698 * takes tty_ldisc_lock to guard against ldisc races
698 */ 699 */
699 700
700int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc) 701int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc)
701{ 702{
702 unsigned long flags; 703 unsigned long flags;
703 int ret = 0; 704 int ret = 0;
@@ -706,10 +707,9 @@ int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc)
706 return -EINVAL; 707 return -EINVAL;
707 708
708 spin_lock_irqsave(&tty_ldisc_lock, flags); 709 spin_lock_irqsave(&tty_ldisc_lock, flags);
709 tty_ldiscs[disc] = *new_ldisc; 710 tty_ldiscs[disc] = new_ldisc;
710 tty_ldiscs[disc].num = disc; 711 new_ldisc->num = disc;
711 tty_ldiscs[disc].flags |= LDISC_FLAG_DEFINED; 712 new_ldisc->refcount = 0;
712 tty_ldiscs[disc].refcount = 0;
713 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 713 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
714 714
715 return ret; 715 return ret;
@@ -737,19 +737,56 @@ int tty_unregister_ldisc(int disc)
737 return -EINVAL; 737 return -EINVAL;
738 738
739 spin_lock_irqsave(&tty_ldisc_lock, flags); 739 spin_lock_irqsave(&tty_ldisc_lock, flags);
740 if (tty_ldiscs[disc].refcount) 740 if (tty_ldiscs[disc]->refcount)
741 ret = -EBUSY; 741 ret = -EBUSY;
742 else 742 else
743 tty_ldiscs[disc].flags &= ~LDISC_FLAG_DEFINED; 743 tty_ldiscs[disc] = NULL;
744 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 744 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
745 745
746 return ret; 746 return ret;
747} 747}
748EXPORT_SYMBOL(tty_unregister_ldisc); 748EXPORT_SYMBOL(tty_unregister_ldisc);
749 749
750
751/**
752 * tty_ldisc_try_get - try and reference an ldisc
753 * @disc: ldisc number
754 * @ld: tty ldisc structure to complete
755 *
756 * Attempt to open and lock a line discipline into place. Return
757 * the line discipline refcounted and assigned in ld. On an error
758 * report the error code back
759 */
760
761static int tty_ldisc_try_get(int disc, struct tty_ldisc *ld)
762{
763 unsigned long flags;
764 struct tty_ldisc_ops *ldops;
765 int err = -EINVAL;
766
767 spin_lock_irqsave(&tty_ldisc_lock, flags);
768 ld->ops = NULL;
769 ldops = tty_ldiscs[disc];
770 /* Check the entry is defined */
771 if (ldops) {
772 /* If the module is being unloaded we can't use it */
773 if (!try_module_get(ldops->owner))
774 err = -EAGAIN;
775 else {
776 /* lock it */
777 ldops->refcount++;
778 ld->ops = ldops;
779 err = 0;
780 }
781 }
782 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
783 return err;
784}
785
750/** 786/**
751 * tty_ldisc_get - take a reference to an ldisc 787 * tty_ldisc_get - take a reference to an ldisc
752 * @disc: ldisc number 788 * @disc: ldisc number
789 * @ld: tty line discipline structure to use
753 * 790 *
754 * Takes a reference to a line discipline. Deals with refcounts and 791 * Takes a reference to a line discipline. Deals with refcounts and
755 * module locking counts. Returns NULL if the discipline is not available. 792 * module locking counts. Returns NULL if the discipline is not available.
@@ -760,32 +797,20 @@ EXPORT_SYMBOL(tty_unregister_ldisc);
760 * takes tty_ldisc_lock to guard against ldisc races 797 * takes tty_ldisc_lock to guard against ldisc races
761 */ 798 */
762 799
763struct tty_ldisc *tty_ldisc_get(int disc) 800static int tty_ldisc_get(int disc, struct tty_ldisc *ld)
764{ 801{
765 unsigned long flags; 802 int err;
766 struct tty_ldisc *ld;
767 803
768 if (disc < N_TTY || disc >= NR_LDISCS) 804 if (disc < N_TTY || disc >= NR_LDISCS)
769 return NULL; 805 return -EINVAL;
770 806 err = tty_ldisc_try_get(disc, ld);
771 spin_lock_irqsave(&tty_ldisc_lock, flags); 807 if (err == -EAGAIN) {
772 808 request_module("tty-ldisc-%d", disc);
773 ld = &tty_ldiscs[disc]; 809 err = tty_ldisc_try_get(disc, ld);
774 /* Check the entry is defined */ 810 }
775 if (ld->flags & LDISC_FLAG_DEFINED) { 811 return err;
776 /* If the module is being unloaded we can't use it */
777 if (!try_module_get(ld->owner))
778 ld = NULL;
779 else /* lock it */
780 ld->refcount++;
781 } else
782 ld = NULL;
783 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
784 return ld;
785} 812}
786 813
787EXPORT_SYMBOL_GPL(tty_ldisc_get);
788
789/** 814/**
790 * tty_ldisc_put - drop ldisc reference 815 * tty_ldisc_put - drop ldisc reference
791 * @disc: ldisc number 816 * @disc: ldisc number
@@ -797,22 +822,67 @@ EXPORT_SYMBOL_GPL(tty_ldisc_get);
797 * takes tty_ldisc_lock to guard against ldisc races 822 * takes tty_ldisc_lock to guard against ldisc races
798 */ 823 */
799 824
800void tty_ldisc_put(int disc) 825static void tty_ldisc_put(struct tty_ldisc_ops *ld)
801{ 826{
802 struct tty_ldisc *ld;
803 unsigned long flags; 827 unsigned long flags;
828 int disc = ld->num;
804 829
805 BUG_ON(disc < N_TTY || disc >= NR_LDISCS); 830 BUG_ON(disc < N_TTY || disc >= NR_LDISCS);
806 831
807 spin_lock_irqsave(&tty_ldisc_lock, flags); 832 spin_lock_irqsave(&tty_ldisc_lock, flags);
808 ld = &tty_ldiscs[disc]; 833 ld = tty_ldiscs[disc];
809 BUG_ON(ld->refcount == 0); 834 BUG_ON(ld->refcount == 0);
810 ld->refcount--; 835 ld->refcount--;
811 module_put(ld->owner); 836 module_put(ld->owner);
812 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 837 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
813} 838}
814 839
815EXPORT_SYMBOL_GPL(tty_ldisc_put); 840static void * tty_ldiscs_seq_start(struct seq_file *m, loff_t *pos)
841{
842 return (*pos < NR_LDISCS) ? pos : NULL;
843}
844
845static void * tty_ldiscs_seq_next(struct seq_file *m, void *v, loff_t *pos)
846{
847 (*pos)++;
848 return (*pos < NR_LDISCS) ? pos : NULL;
849}
850
851static void tty_ldiscs_seq_stop(struct seq_file *m, void *v)
852{
853}
854
855static int tty_ldiscs_seq_show(struct seq_file *m, void *v)
856{
857 int i = *(loff_t *)v;
858 struct tty_ldisc ld;
859
860 if (tty_ldisc_get(i, &ld) < 0)
861 return 0;
862 seq_printf(m, "%-10s %2d\n", ld.ops->name ? ld.ops->name : "???", i);
863 tty_ldisc_put(ld.ops);
864 return 0;
865}
866
867static const struct seq_operations tty_ldiscs_seq_ops = {
868 .start = tty_ldiscs_seq_start,
869 .next = tty_ldiscs_seq_next,
870 .stop = tty_ldiscs_seq_stop,
871 .show = tty_ldiscs_seq_show,
872};
873
874static int proc_tty_ldiscs_open(struct inode *inode, struct file *file)
875{
876 return seq_open(file, &tty_ldiscs_seq_ops);
877}
878
879const struct file_operations tty_ldiscs_proc_fops = {
880 .owner = THIS_MODULE,
881 .open = proc_tty_ldiscs_open,
882 .read = seq_read,
883 .llseek = seq_lseek,
884 .release = seq_release,
885};
816 886
817/** 887/**
818 * tty_ldisc_assign - set ldisc on a tty 888 * tty_ldisc_assign - set ldisc on a tty
@@ -829,8 +899,8 @@ EXPORT_SYMBOL_GPL(tty_ldisc_put);
829 899
830static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld) 900static void tty_ldisc_assign(struct tty_struct *tty, struct tty_ldisc *ld)
831{ 901{
902 ld->refcount = 0;
832 tty->ldisc = *ld; 903 tty->ldisc = *ld;
833 tty->ldisc.refcount = 0;
834} 904}
835 905
836/** 906/**
@@ -954,6 +1024,41 @@ static void tty_ldisc_enable(struct tty_struct *tty)
954} 1024}
955 1025
956/** 1026/**
1027 * tty_ldisc_restore - helper for tty ldisc change
1028 * @tty: tty to recover
1029 * @old: previous ldisc
1030 *
1031 * Restore the previous line discipline or N_TTY when a line discipline
1032 * change fails due to an open error
1033 */
1034
1035static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
1036{
1037 char buf[64];
1038 struct tty_ldisc new_ldisc;
1039
1040 /* There is an outstanding reference here so this is safe */
1041 tty_ldisc_get(old->ops->num, old);
1042 tty_ldisc_assign(tty, old);
1043 tty_set_termios_ldisc(tty, old->ops->num);
1044 if (old->ops->open && (old->ops->open(tty) < 0)) {
1045 tty_ldisc_put(old->ops);
1046 /* This driver is always present */
1047 if (tty_ldisc_get(N_TTY, &new_ldisc) < 0)
1048 panic("n_tty: get");
1049 tty_ldisc_assign(tty, &new_ldisc);
1050 tty_set_termios_ldisc(tty, N_TTY);
1051 if (new_ldisc.ops->open) {
1052 int r = new_ldisc.ops->open(tty);
1053 if (r < 0)
1054 panic("Couldn't open N_TTY ldisc for "
1055 "%s --- error %d.",
1056 tty_name(tty, buf), r);
1057 }
1058 }
1059}
1060
1061/**
957 * tty_set_ldisc - set line discipline 1062 * tty_set_ldisc - set line discipline
958 * @tty: the terminal to set 1063 * @tty: the terminal to set
959 * @ldisc: the line discipline 1064 * @ldisc: the line discipline
@@ -967,28 +1072,18 @@ static void tty_ldisc_enable(struct tty_struct *tty)
967 1072
968static int tty_set_ldisc(struct tty_struct *tty, int ldisc) 1073static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
969{ 1074{
970 int retval = 0; 1075 int retval;
971 struct tty_ldisc o_ldisc; 1076 struct tty_ldisc o_ldisc, new_ldisc;
972 char buf[64];
973 int work; 1077 int work;
974 unsigned long flags; 1078 unsigned long flags;
975 struct tty_ldisc *ld;
976 struct tty_struct *o_tty; 1079 struct tty_struct *o_tty;
977 1080
978 if ((ldisc < N_TTY) || (ldisc >= NR_LDISCS))
979 return -EINVAL;
980
981restart: 1081restart:
982 1082 /* This is a bit ugly for now but means we can break the 'ldisc
983 ld = tty_ldisc_get(ldisc); 1083 is part of the tty struct' assumption later */
984 /* Eduardo Blanco <ejbs@cs.cs.com.uy> */ 1084 retval = tty_ldisc_get(ldisc, &new_ldisc);
985 /* Cyrus Durgin <cider@speakeasy.org> */ 1085 if (retval)
986 if (ld == NULL) { 1086 return retval;
987 request_module("tty-ldisc-%d", ldisc);
988 ld = tty_ldisc_get(ldisc);
989 }
990 if (ld == NULL)
991 return -EINVAL;
992 1087
993 /* 1088 /*
994 * Problem: What do we do if this blocks ? 1089 * Problem: What do we do if this blocks ?
@@ -996,8 +1091,8 @@ restart:
996 1091
997 tty_wait_until_sent(tty, 0); 1092 tty_wait_until_sent(tty, 0);
998 1093
999 if (tty->ldisc.num == ldisc) { 1094 if (tty->ldisc.ops->num == ldisc) {
1000 tty_ldisc_put(ldisc); 1095 tty_ldisc_put(new_ldisc.ops);
1001 return 0; 1096 return 0;
1002 } 1097 }
1003 1098
@@ -1024,7 +1119,7 @@ restart:
1024 /* Free the new ldisc we grabbed. Must drop the lock 1119 /* Free the new ldisc we grabbed. Must drop the lock
1025 first. */ 1120 first. */
1026 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 1121 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
1027 tty_ldisc_put(ldisc); 1122 tty_ldisc_put(o_ldisc.ops);
1028 /* 1123 /*
1029 * There are several reasons we may be busy, including 1124 * There are several reasons we may be busy, including
1030 * random momentary I/O traffic. We must therefore 1125 * random momentary I/O traffic. We must therefore
@@ -1038,7 +1133,7 @@ restart:
1038 } 1133 }
1039 if (o_tty && o_tty->ldisc.refcount) { 1134 if (o_tty && o_tty->ldisc.refcount) {
1040 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 1135 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
1041 tty_ldisc_put(ldisc); 1136 tty_ldisc_put(o_tty->ldisc.ops);
1042 if (wait_event_interruptible(tty_ldisc_wait, o_tty->ldisc.refcount == 0) < 0) 1137 if (wait_event_interruptible(tty_ldisc_wait, o_tty->ldisc.refcount == 0) < 0)
1043 return -ERESTARTSYS; 1138 return -ERESTARTSYS;
1044 goto restart; 1139 goto restart;
@@ -1049,8 +1144,9 @@ restart:
1049 * another ldisc change 1144 * another ldisc change
1050 */ 1145 */
1051 if (!test_bit(TTY_LDISC, &tty->flags)) { 1146 if (!test_bit(TTY_LDISC, &tty->flags)) {
1147 struct tty_ldisc *ld;
1052 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 1148 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
1053 tty_ldisc_put(ldisc); 1149 tty_ldisc_put(new_ldisc.ops);
1054 ld = tty_ldisc_ref_wait(tty); 1150 ld = tty_ldisc_ref_wait(tty);
1055 tty_ldisc_deref(ld); 1151 tty_ldisc_deref(ld);
1056 goto restart; 1152 goto restart;
@@ -1060,7 +1156,7 @@ restart:
1060 if (o_tty) 1156 if (o_tty)
1061 clear_bit(TTY_LDISC, &o_tty->flags); 1157 clear_bit(TTY_LDISC, &o_tty->flags);
1062 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 1158 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
1063 1159
1064 /* 1160 /*
1065 * From this point on we know nobody has an ldisc 1161 * From this point on we know nobody has an ldisc
1066 * usage reference, nor can they obtain one until 1162 * usage reference, nor can they obtain one until
@@ -1070,45 +1166,30 @@ restart:
1070 work = cancel_delayed_work(&tty->buf.work); 1166 work = cancel_delayed_work(&tty->buf.work);
1071 /* 1167 /*
1072 * Wait for ->hangup_work and ->buf.work handlers to terminate 1168 * Wait for ->hangup_work and ->buf.work handlers to terminate
1169 * MUST NOT hold locks here.
1073 */ 1170 */
1074 flush_scheduled_work(); 1171 flush_scheduled_work();
1075 /* Shutdown the current discipline. */ 1172 /* Shutdown the current discipline. */
1076 if (tty->ldisc.close) 1173 if (o_ldisc.ops->close)
1077 (tty->ldisc.close)(tty); 1174 (o_ldisc.ops->close)(tty);
1078 1175
1079 /* Now set up the new line discipline. */ 1176 /* Now set up the new line discipline. */
1080 tty_ldisc_assign(tty, ld); 1177 tty_ldisc_assign(tty, &new_ldisc);
1081 tty_set_termios_ldisc(tty, ldisc); 1178 tty_set_termios_ldisc(tty, ldisc);
1082 if (tty->ldisc.open) 1179 if (new_ldisc.ops->open)
1083 retval = (tty->ldisc.open)(tty); 1180 retval = (new_ldisc.ops->open)(tty);
1084 if (retval < 0) { 1181 if (retval < 0) {
1085 tty_ldisc_put(ldisc); 1182 tty_ldisc_put(new_ldisc.ops);
1086 /* There is an outstanding reference here so this is safe */ 1183 tty_ldisc_restore(tty, &o_ldisc);
1087 tty_ldisc_assign(tty, tty_ldisc_get(o_ldisc.num));
1088 tty_set_termios_ldisc(tty, tty->ldisc.num);
1089 if (tty->ldisc.open && (tty->ldisc.open(tty) < 0)) {
1090 tty_ldisc_put(o_ldisc.num);
1091 /* This driver is always present */
1092 tty_ldisc_assign(tty, tty_ldisc_get(N_TTY));
1093 tty_set_termios_ldisc(tty, N_TTY);
1094 if (tty->ldisc.open) {
1095 int r = tty->ldisc.open(tty);
1096
1097 if (r < 0)
1098 panic("Couldn't open N_TTY ldisc for "
1099 "%s --- error %d.",
1100 tty_name(tty, buf), r);
1101 }
1102 }
1103 } 1184 }
1104 /* At this point we hold a reference to the new ldisc and a 1185 /* At this point we hold a reference to the new ldisc and a
1105 a reference to the old ldisc. If we ended up flipping back 1186 a reference to the old ldisc. If we ended up flipping back
1106 to the existing ldisc we have two references to it */ 1187 to the existing ldisc we have two references to it */
1107 1188
1108 if (tty->ldisc.num != o_ldisc.num && tty->ops->set_ldisc) 1189 if (tty->ldisc.ops->num != o_ldisc.ops->num && tty->ops->set_ldisc)
1109 tty->ops->set_ldisc(tty); 1190 tty->ops->set_ldisc(tty);
1110 1191
1111 tty_ldisc_put(o_ldisc.num); 1192 tty_ldisc_put(o_ldisc.ops);
1112 1193
1113 /* 1194 /*
1114 * Allow ldisc referencing to occur as soon as the driver 1195 * Allow ldisc referencing to occur as soon as the driver
@@ -1335,8 +1416,8 @@ void tty_wakeup(struct tty_struct *tty)
1335 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) { 1416 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) {
1336 ld = tty_ldisc_ref(tty); 1417 ld = tty_ldisc_ref(tty);
1337 if (ld) { 1418 if (ld) {
1338 if (ld->write_wakeup) 1419 if (ld->ops->write_wakeup)
1339 ld->write_wakeup(tty); 1420 ld->ops->write_wakeup(tty);
1340 tty_ldisc_deref(ld); 1421 tty_ldisc_deref(ld);
1341 } 1422 }
1342 } 1423 }
@@ -1357,8 +1438,8 @@ void tty_ldisc_flush(struct tty_struct *tty)
1357{ 1438{
1358 struct tty_ldisc *ld = tty_ldisc_ref(tty); 1439 struct tty_ldisc *ld = tty_ldisc_ref(tty);
1359 if (ld) { 1440 if (ld) {
1360 if (ld->flush_buffer) 1441 if (ld->ops->flush_buffer)
1361 ld->flush_buffer(tty); 1442 ld->ops->flush_buffer(tty);
1362 tty_ldisc_deref(ld); 1443 tty_ldisc_deref(ld);
1363 } 1444 }
1364 tty_buffer_flush(tty); 1445 tty_buffer_flush(tty);
@@ -1386,7 +1467,7 @@ static void tty_reset_termios(struct tty_struct *tty)
1386 * do_tty_hangup - actual handler for hangup events 1467 * do_tty_hangup - actual handler for hangup events
1387 * @work: tty device 1468 * @work: tty device
1388 * 1469 *
1389 * This can be called by the "eventd" kernel thread. That is process 1470k * This can be called by the "eventd" kernel thread. That is process
1390 * synchronous but doesn't hold any locks, so we need to make sure we 1471 * synchronous but doesn't hold any locks, so we need to make sure we
1391 * have the appropriate locks for what we're doing. 1472 * have the appropriate locks for what we're doing.
1392 * 1473 *
@@ -1449,14 +1530,14 @@ static void do_tty_hangup(struct work_struct *work)
1449 ld = tty_ldisc_ref(tty); 1530 ld = tty_ldisc_ref(tty);
1450 if (ld != NULL) { 1531 if (ld != NULL) {
1451 /* We may have no line discipline at this point */ 1532 /* We may have no line discipline at this point */
1452 if (ld->flush_buffer) 1533 if (ld->ops->flush_buffer)
1453 ld->flush_buffer(tty); 1534 ld->ops->flush_buffer(tty);
1454 tty_driver_flush_buffer(tty); 1535 tty_driver_flush_buffer(tty);
1455 if ((test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) && 1536 if ((test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) &&
1456 ld->write_wakeup) 1537 ld->ops->write_wakeup)
1457 ld->write_wakeup(tty); 1538 ld->ops->write_wakeup(tty);
1458 if (ld->hangup) 1539 if (ld->ops->hangup)
1459 ld->hangup(tty); 1540 ld->ops->hangup(tty);
1460 } 1541 }
1461 /* 1542 /*
1462 * FIXME: Once we trust the LDISC code better we can wait here for 1543 * FIXME: Once we trust the LDISC code better we can wait here for
@@ -1825,8 +1906,8 @@ static ssize_t tty_read(struct file *file, char __user *buf, size_t count,
1825 /* We want to wait for the line discipline to sort out in this 1906 /* We want to wait for the line discipline to sort out in this
1826 situation */ 1907 situation */
1827 ld = tty_ldisc_ref_wait(tty); 1908 ld = tty_ldisc_ref_wait(tty);
1828 if (ld->read) 1909 if (ld->ops->read)
1829 i = (ld->read)(tty, file, buf, count); 1910 i = (ld->ops->read)(tty, file, buf, count);
1830 else 1911 else
1831 i = -EIO; 1912 i = -EIO;
1832 tty_ldisc_deref(ld); 1913 tty_ldisc_deref(ld);
@@ -1978,10 +2059,10 @@ static ssize_t tty_write(struct file *file, const char __user *buf,
1978 printk(KERN_ERR "tty driver %s lacks a write_room method.\n", 2059 printk(KERN_ERR "tty driver %s lacks a write_room method.\n",
1979 tty->driver->name); 2060 tty->driver->name);
1980 ld = tty_ldisc_ref_wait(tty); 2061 ld = tty_ldisc_ref_wait(tty);
1981 if (!ld->write) 2062 if (!ld->ops->write)
1982 ret = -EIO; 2063 ret = -EIO;
1983 else 2064 else
1984 ret = do_tty_write(ld->write, tty, file, buf, count); 2065 ret = do_tty_write(ld->ops->write, tty, file, buf, count);
1985 tty_ldisc_deref(ld); 2066 tty_ldisc_deref(ld);
1986 return ret; 2067 return ret;
1987} 2068}
@@ -2007,6 +2088,42 @@ ssize_t redirected_tty_write(struct file *file, const char __user *buf,
2007 return tty_write(file, buf, count, ppos); 2088 return tty_write(file, buf, count, ppos);
2008} 2089}
2009 2090
2091void tty_port_init(struct tty_port *port)
2092{
2093 memset(port, 0, sizeof(*port));
2094 init_waitqueue_head(&port->open_wait);
2095 init_waitqueue_head(&port->close_wait);
2096 mutex_init(&port->mutex);
2097 port->close_delay = (50 * HZ) / 100;
2098 port->closing_wait = (3000 * HZ) / 100;
2099}
2100EXPORT_SYMBOL(tty_port_init);
2101
2102int tty_port_alloc_xmit_buf(struct tty_port *port)
2103{
2104 /* We may sleep in get_zeroed_page() */
2105 mutex_lock(&port->mutex);
2106 if (port->xmit_buf == NULL)
2107 port->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
2108 mutex_unlock(&port->mutex);
2109 if (port->xmit_buf == NULL)
2110 return -ENOMEM;
2111 return 0;
2112}
2113EXPORT_SYMBOL(tty_port_alloc_xmit_buf);
2114
2115void tty_port_free_xmit_buf(struct tty_port *port)
2116{
2117 mutex_lock(&port->mutex);
2118 if (port->xmit_buf != NULL) {
2119 free_page((unsigned long)port->xmit_buf);
2120 port->xmit_buf = NULL;
2121 }
2122 mutex_unlock(&port->mutex);
2123}
2124EXPORT_SYMBOL(tty_port_free_xmit_buf);
2125
2126
2010static char ptychar[] = "pqrstuvwxyzabcde"; 2127static char ptychar[] = "pqrstuvwxyzabcde";
2011 2128
2012/** 2129/**
@@ -2076,6 +2193,7 @@ static int init_dev(struct tty_driver *driver, int idx,
2076 struct ktermios *tp, **tp_loc, *o_tp, **o_tp_loc; 2193 struct ktermios *tp, **tp_loc, *o_tp, **o_tp_loc;
2077 struct ktermios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc; 2194 struct ktermios *ltp, **ltp_loc, *o_ltp, **o_ltp_loc;
2078 int retval = 0; 2195 int retval = 0;
2196 struct tty_ldisc *ld;
2079 2197
2080 /* check whether we're reopening an existing tty */ 2198 /* check whether we're reopening an existing tty */
2081 if (driver->flags & TTY_DRIVER_DEVPTS_MEM) { 2199 if (driver->flags & TTY_DRIVER_DEVPTS_MEM) {
@@ -2224,17 +2342,19 @@ static int init_dev(struct tty_driver *driver, int idx,
2224 * If we fail here just call release_tty to clean up. No need 2342 * If we fail here just call release_tty to clean up. No need
2225 * to decrement the use counts, as release_tty doesn't care. 2343 * to decrement the use counts, as release_tty doesn't care.
2226 */ 2344 */
2345
2346 ld = &tty->ldisc;
2227 2347
2228 if (tty->ldisc.open) { 2348 if (ld->ops->open) {
2229 retval = (tty->ldisc.open)(tty); 2349 retval = (ld->ops->open)(tty);
2230 if (retval) 2350 if (retval)
2231 goto release_mem_out; 2351 goto release_mem_out;
2232 } 2352 }
2233 if (o_tty && o_tty->ldisc.open) { 2353 if (o_tty && o_tty->ldisc.ops->open) {
2234 retval = (o_tty->ldisc.open)(o_tty); 2354 retval = (o_tty->ldisc.ops->open)(o_tty);
2235 if (retval) { 2355 if (retval) {
2236 if (tty->ldisc.close) 2356 if (ld->ops->close)
2237 (tty->ldisc.close)(tty); 2357 (ld->ops->close)(tty);
2238 goto release_mem_out; 2358 goto release_mem_out;
2239 } 2359 }
2240 tty_ldisc_enable(o_tty); 2360 tty_ldisc_enable(o_tty);
@@ -2378,6 +2498,7 @@ static void release_tty(struct tty_struct *tty, int idx)
2378static void release_dev(struct file *filp) 2498static void release_dev(struct file *filp)
2379{ 2499{
2380 struct tty_struct *tty, *o_tty; 2500 struct tty_struct *tty, *o_tty;
2501 struct tty_ldisc ld;
2381 int pty_master, tty_closing, o_tty_closing, do_sleep; 2502 int pty_master, tty_closing, o_tty_closing, do_sleep;
2382 int devpts; 2503 int devpts;
2383 int idx; 2504 int idx;
@@ -2611,26 +2732,27 @@ static void release_dev(struct file *filp)
2611 spin_unlock_irqrestore(&tty_ldisc_lock, flags); 2732 spin_unlock_irqrestore(&tty_ldisc_lock, flags);
2612 /* 2733 /*
2613 * Shutdown the current line discipline, and reset it to N_TTY. 2734 * Shutdown the current line discipline, and reset it to N_TTY.
2614 * N.B. why reset ldisc when we're releasing the memory??
2615 * 2735 *
2616 * FIXME: this MUST get fixed for the new reflocking 2736 * FIXME: this MUST get fixed for the new reflocking
2617 */ 2737 */
2618 if (tty->ldisc.close) 2738 if (tty->ldisc.ops->close)
2619 (tty->ldisc.close)(tty); 2739 (tty->ldisc.ops->close)(tty);
2620 tty_ldisc_put(tty->ldisc.num); 2740 tty_ldisc_put(tty->ldisc.ops);
2621 2741
2622 /* 2742 /*
2623 * Switch the line discipline back 2743 * Switch the line discipline back
2624 */ 2744 */
2625 tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); 2745 WARN_ON(tty_ldisc_get(N_TTY, &ld));
2746 tty_ldisc_assign(tty, &ld);
2626 tty_set_termios_ldisc(tty, N_TTY); 2747 tty_set_termios_ldisc(tty, N_TTY);
2627 if (o_tty) { 2748 if (o_tty) {
2628 /* FIXME: could o_tty be in setldisc here ? */ 2749 /* FIXME: could o_tty be in setldisc here ? */
2629 clear_bit(TTY_LDISC, &o_tty->flags); 2750 clear_bit(TTY_LDISC, &o_tty->flags);
2630 if (o_tty->ldisc.close) 2751 if (o_tty->ldisc.ops->close)
2631 (o_tty->ldisc.close)(o_tty); 2752 (o_tty->ldisc.ops->close)(o_tty);
2632 tty_ldisc_put(o_tty->ldisc.num); 2753 tty_ldisc_put(o_tty->ldisc.ops);
2633 tty_ldisc_assign(o_tty, tty_ldisc_get(N_TTY)); 2754 WARN_ON(tty_ldisc_get(N_TTY, &ld));
2755 tty_ldisc_assign(o_tty, &ld);
2634 tty_set_termios_ldisc(o_tty, N_TTY); 2756 tty_set_termios_ldisc(o_tty, N_TTY);
2635 } 2757 }
2636 /* 2758 /*
@@ -2899,8 +3021,8 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)
2899 return 0; 3021 return 0;
2900 3022
2901 ld = tty_ldisc_ref_wait(tty); 3023 ld = tty_ldisc_ref_wait(tty);
2902 if (ld->poll) 3024 if (ld->ops->poll)
2903 ret = (ld->poll)(tty, filp, wait); 3025 ret = (ld->ops->poll)(tty, filp, wait);
2904 tty_ldisc_deref(ld); 3026 tty_ldisc_deref(ld);
2905 return ret; 3027 return ret;
2906} 3028}
@@ -2974,7 +3096,7 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
2974 if (get_user(ch, p)) 3096 if (get_user(ch, p))
2975 return -EFAULT; 3097 return -EFAULT;
2976 ld = tty_ldisc_ref_wait(tty); 3098 ld = tty_ldisc_ref_wait(tty);
2977 ld->receive_buf(tty, &ch, &mbz, 1); 3099 ld->ops->receive_buf(tty, &ch, &mbz, 1);
2978 tty_ldisc_deref(ld); 3100 tty_ldisc_deref(ld);
2979 return 0; 3101 return 0;
2980} 3102}
@@ -3395,35 +3517,31 @@ static int tty_tiocmget(struct tty_struct *tty, struct file *file, int __user *p
3395static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd, 3517static int tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int cmd,
3396 unsigned __user *p) 3518 unsigned __user *p)
3397{ 3519{
3398 int retval = -EINVAL; 3520 int retval;
3399 3521 unsigned int set, clear, val;
3400 if (tty->ops->tiocmset) {
3401 unsigned int set, clear, val;
3402
3403 retval = get_user(val, p);
3404 if (retval)
3405 return retval;
3406
3407 set = clear = 0;
3408 switch (cmd) {
3409 case TIOCMBIS:
3410 set = val;
3411 break;
3412 case TIOCMBIC:
3413 clear = val;
3414 break;
3415 case TIOCMSET:
3416 set = val;
3417 clear = ~val;
3418 break;
3419 }
3420 3522
3421 set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; 3523 if (tty->ops->tiocmset == NULL)
3422 clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP; 3524 return -EINVAL;
3423 3525
3424 retval = tty->ops->tiocmset(tty, file, set, clear); 3526 retval = get_user(val, p);
3527 if (retval)
3528 return retval;
3529 set = clear = 0;
3530 switch (cmd) {
3531 case TIOCMBIS:
3532 set = val;
3533 break;
3534 case TIOCMBIC:
3535 clear = val;
3536 break;
3537 case TIOCMSET:
3538 set = val;
3539 clear = ~val;
3540 break;
3425 } 3541 }
3426 return retval; 3542 set &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
3543 clear &= TIOCM_DTR|TIOCM_RTS|TIOCM_OUT1|TIOCM_OUT2|TIOCM_LOOP;
3544 return tty->ops->tiocmset(tty, file, set, clear);
3427} 3545}
3428 3546
3429/* 3547/*
@@ -3528,7 +3646,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3528 case TIOCGSID: 3646 case TIOCGSID:
3529 return tiocgsid(tty, real_tty, p); 3647 return tiocgsid(tty, real_tty, p);
3530 case TIOCGETD: 3648 case TIOCGETD:
3531 return put_user(tty->ldisc.num, (int __user *)p); 3649 return put_user(tty->ldisc.ops->num, (int __user *)p);
3532 case TIOCSETD: 3650 case TIOCSETD:
3533 return tiocsetd(tty, p); 3651 return tiocsetd(tty, p);
3534#ifdef CONFIG_VT 3652#ifdef CONFIG_VT
@@ -3581,8 +3699,8 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
3581 } 3699 }
3582 ld = tty_ldisc_ref_wait(tty); 3700 ld = tty_ldisc_ref_wait(tty);
3583 retval = -EINVAL; 3701 retval = -EINVAL;
3584 if (ld->ioctl) { 3702 if (ld->ops->ioctl) {
3585 retval = ld->ioctl(tty, file, cmd, arg); 3703 retval = ld->ops->ioctl(tty, file, cmd, arg);
3586 if (retval == -ENOIOCTLCMD) 3704 if (retval == -ENOIOCTLCMD)
3587 retval = -EINVAL; 3705 retval = -EINVAL;
3588 } 3706 }
@@ -3609,8 +3727,8 @@ static long tty_compat_ioctl(struct file *file, unsigned int cmd,
3609 } 3727 }
3610 3728
3611 ld = tty_ldisc_ref_wait(tty); 3729 ld = tty_ldisc_ref_wait(tty);
3612 if (ld->compat_ioctl) 3730 if (ld->ops->compat_ioctl)
3613 retval = ld->compat_ioctl(tty, file, cmd, arg); 3731 retval = ld->ops->compat_ioctl(tty, file, cmd, arg);
3614 tty_ldisc_deref(ld); 3732 tty_ldisc_deref(ld);
3615 3733
3616 return retval; 3734 return retval;
@@ -3782,7 +3900,8 @@ static void flush_to_ldisc(struct work_struct *work)
3782 flag_buf = head->flag_buf_ptr + head->read; 3900 flag_buf = head->flag_buf_ptr + head->read;
3783 head->read += count; 3901 head->read += count;
3784 spin_unlock_irqrestore(&tty->buf.lock, flags); 3902 spin_unlock_irqrestore(&tty->buf.lock, flags);
3785 disc->receive_buf(tty, char_buf, flag_buf, count); 3903 disc->ops->receive_buf(tty, char_buf,
3904 flag_buf, count);
3786 spin_lock_irqsave(&tty->buf.lock, flags); 3905 spin_lock_irqsave(&tty->buf.lock, flags);
3787 } 3906 }
3788 /* Restore the queue head */ 3907 /* Restore the queue head */
@@ -3843,9 +3962,12 @@ EXPORT_SYMBOL(tty_flip_buffer_push);
3843 3962
3844static void initialize_tty_struct(struct tty_struct *tty) 3963static void initialize_tty_struct(struct tty_struct *tty)
3845{ 3964{
3965 struct tty_ldisc ld;
3846 memset(tty, 0, sizeof(struct tty_struct)); 3966 memset(tty, 0, sizeof(struct tty_struct));
3847 tty->magic = TTY_MAGIC; 3967 tty->magic = TTY_MAGIC;
3848 tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); 3968 if (tty_ldisc_get(N_TTY, &ld) < 0)
3969 panic("n_tty: init_tty");
3970 tty_ldisc_assign(tty, &ld);
3849 tty->session = NULL; 3971 tty->session = NULL;
3850 tty->pgrp = NULL; 3972 tty->pgrp = NULL;
3851 tty->overrun_time = jiffies; 3973 tty->overrun_time = jiffies;
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 8f81139d6194..ea9fc5d03b99 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -491,8 +491,8 @@ static void change_termios(struct tty_struct *tty, struct ktermios *new_termios)
491 491
492 ld = tty_ldisc_ref(tty); 492 ld = tty_ldisc_ref(tty);
493 if (ld != NULL) { 493 if (ld != NULL) {
494 if (ld->set_termios) 494 if (ld->ops->set_termios)
495 (ld->set_termios)(tty, &old_termios); 495 (ld->ops->set_termios)(tty, &old_termios);
496 tty_ldisc_deref(ld); 496 tty_ldisc_deref(ld);
497 } 497 }
498 mutex_unlock(&tty->termios_mutex); 498 mutex_unlock(&tty->termios_mutex);
@@ -552,8 +552,8 @@ static int set_termios(struct tty_struct *tty, void __user *arg, int opt)
552 ld = tty_ldisc_ref(tty); 552 ld = tty_ldisc_ref(tty);
553 553
554 if (ld != NULL) { 554 if (ld != NULL) {
555 if ((opt & TERMIOS_FLUSH) && ld->flush_buffer) 555 if ((opt & TERMIOS_FLUSH) && ld->ops->flush_buffer)
556 ld->flush_buffer(tty); 556 ld->ops->flush_buffer(tty);
557 tty_ldisc_deref(ld); 557 tty_ldisc_deref(ld);
558 } 558 }
559 559
@@ -959,12 +959,12 @@ int tty_perform_flush(struct tty_struct *tty, unsigned long arg)
959 ld = tty_ldisc_ref(tty); 959 ld = tty_ldisc_ref(tty);
960 switch (arg) { 960 switch (arg) {
961 case TCIFLUSH: 961 case TCIFLUSH:
962 if (ld && ld->flush_buffer) 962 if (ld && ld->ops->flush_buffer)
963 ld->flush_buffer(tty); 963 ld->ops->flush_buffer(tty);
964 break; 964 break;
965 case TCIOFLUSH: 965 case TCIOFLUSH:
966 if (ld && ld->flush_buffer) 966 if (ld && ld->ops->flush_buffer)
967 ld->flush_buffer(tty); 967 ld->ops->flush_buffer(tty);
968 /* fall through */ 968 /* fall through */
969 case TCOFLUSH: 969 case TCOFLUSH:
970 tty_driver_flush_buffer(tty); 970 tty_driver_flush_buffer(tty);
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c
index 8cd8507b1a8a..9c0c9afcd0ac 100644
--- a/drivers/dio/dio-driver.c
+++ b/drivers/dio/dio-driver.c
@@ -119,19 +119,7 @@ static int dio_bus_match(struct device *dev, struct device_driver *drv)
119 if (!ids) 119 if (!ids)
120 return 0; 120 return 0;
121 121
122 while (ids->id) { 122 return dio_match_device(ids, d) ? 1 : 0;
123 if (ids->id == DIO_WILDCARD)
124 return 1;
125 if (DIO_NEEDSSECID(ids->id & 0xff)) {
126 if (ids->id == d->id)
127 return 1;
128 } else {
129 if ((ids->id & 0xff) == (d->id & 0xff))
130 return 1;
131 }
132 ids++;
133 }
134 return 0;
135} 123}
136 124
137 125
diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c
index 4e92100c56a8..1839194ea987 100644
--- a/drivers/input/keyboard/atakbd.c
+++ b/drivers/input/keyboard/atakbd.c
@@ -220,7 +220,7 @@ static int __init atakbd_init(void)
220 int i, error; 220 int i, error;
221 221
222 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP)) 222 if (!MACH_IS_ATARI || !ATARIHW_PRESENT(ST_MFP))
223 return -EIO; 223 return -ENODEV;
224 224
225 // need to init core driver if not already done so 225 // need to init core driver if not already done so
226 if (atari_keyb_init()) 226 if (atari_keyb_init())
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c
index 7ff71ba7b7c9..b9694b6445d0 100644
--- a/drivers/input/serio/serport.c
+++ b/drivers/input/serio/serport.c
@@ -216,7 +216,7 @@ static void serport_ldisc_write_wakeup(struct tty_struct * tty)
216 * The line discipline structure. 216 * The line discipline structure.
217 */ 217 */
218 218
219static struct tty_ldisc serport_ldisc = { 219static struct tty_ldisc_ops serport_ldisc = {
220 .owner = THIS_MODULE, 220 .owner = THIS_MODULE,
221 .name = "input", 221 .name = "input",
222 .open = serport_ldisc_open, 222 .open = serport_ldisc_open,
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 2095153582f1..8a35029caca0 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -466,7 +466,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
466 ld = tty_ldisc_ref(mp->tty); 466 ld = tty_ldisc_ref(mp->tty);
467 if (ld == NULL) 467 if (ld == NULL)
468 return -1; 468 return -1;
469 if (ld->receive_buf == NULL) { 469 if (ld->ops->receive_buf == NULL) {
470#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) 470#if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
471 printk(KERN_DEBUG "capi: ldisc has no receive_buf function\n"); 471 printk(KERN_DEBUG "capi: ldisc has no receive_buf function\n");
472#endif 472#endif
@@ -501,7 +501,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
501 printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n", 501 printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n",
502 datahandle, skb->len); 502 datahandle, skb->len);
503#endif 503#endif
504 ld->receive_buf(mp->tty, skb->data, NULL, skb->len); 504 ld->ops->receive_buf(mp->tty, skb->data, NULL, skb->len);
505 kfree_skb(skb); 505 kfree_skb(skb);
506 tty_ldisc_deref(ld); 506 tty_ldisc_deref(ld);
507 return 0; 507 return 0;
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index 45d1ee93cd39..5e89fa177816 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -766,7 +766,7 @@ gigaset_tty_wakeup(struct tty_struct *tty)
766 cs_put(cs); 766 cs_put(cs);
767} 767}
768 768
769static struct tty_ldisc gigaset_ldisc = { 769static struct tty_ldisc_ops gigaset_ldisc = {
770 .owner = THIS_MODULE, 770 .owner = THIS_MODULE,
771 .magic = TTY_LDISC_MAGIC, 771 .magic = TTY_LDISC_MAGIC,
772 .name = "ser_gigaset", 772 .name = "ser_gigaset",
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 611e9fb18b67..3e5e64c33e18 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -325,15 +325,6 @@ config APNE
325 To compile this driver as a module, choose M here: the module 325 To compile this driver as a module, choose M here: the module
326 will be called apne. 326 will be called apne.
327 327
328config APOLLO_ELPLUS
329 tristate "Apollo 3c505 support"
330 depends on APOLLO
331 help
332 Say Y or M here if your Apollo has a 3Com 3c505 ISA Ethernet card.
333 If you don't have one made for Apollos, you can use one from a PC,
334 except that your Apollo won't be able to boot from it (because the
335 code in the ROM will be for a PC).
336
337config MAC8390 328config MAC8390
338 bool "Macintosh NS 8390 based ethernet cards" 329 bool "Macintosh NS 8390 based ethernet cards"
339 depends on MAC 330 depends on MAC
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index 10f3a196be32..29e53eb71c74 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -98,7 +98,6 @@ struct ariadne_private {
98 volatile u_short *rx_buff[RX_RING_SIZE]; 98 volatile u_short *rx_buff[RX_RING_SIZE];
99 int cur_tx, cur_rx; /* The next free ring entry */ 99 int cur_tx, cur_rx; /* The next free ring entry */
100 int dirty_tx; /* The ring entries to be free()ed. */ 100 int dirty_tx; /* The ring entries to be free()ed. */
101 struct net_device_stats stats;
102 char tx_full; 101 char tx_full;
103}; 102};
104 103
@@ -378,20 +377,19 @@ static void ariadne_init_ring(struct net_device *dev)
378 377
379static int ariadne_close(struct net_device *dev) 378static int ariadne_close(struct net_device *dev)
380{ 379{
381 struct ariadne_private *priv = netdev_priv(dev);
382 volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr; 380 volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
383 381
384 netif_stop_queue(dev); 382 netif_stop_queue(dev);
385 383
386 lance->RAP = CSR112; /* Missed Frame Count */ 384 lance->RAP = CSR112; /* Missed Frame Count */
387 priv->stats.rx_missed_errors = swapw(lance->RDP); 385 dev->stats.rx_missed_errors = swapw(lance->RDP);
388 lance->RAP = CSR0; /* PCnet-ISA Controller Status */ 386 lance->RAP = CSR0; /* PCnet-ISA Controller Status */
389 387
390 if (ariadne_debug > 1) { 388 if (ariadne_debug > 1) {
391 printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n", 389 printk(KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n",
392 dev->name, lance->RDP); 390 dev->name, lance->RDP);
393 printk(KERN_DEBUG "%s: %lu packets missed\n", dev->name, 391 printk(KERN_DEBUG "%s: %lu packets missed\n", dev->name,
394 priv->stats.rx_missed_errors); 392 dev->stats.rx_missed_errors);
395 } 393 }
396 394
397 /* We stop the LANCE here -- it occasionally polls memory if we don't. */ 395 /* We stop the LANCE here -- it occasionally polls memory if we don't. */
@@ -502,16 +500,16 @@ static irqreturn_t ariadne_interrupt(int irq, void *data)
502 if (status & TF_ERR) { 500 if (status & TF_ERR) {
503 /* There was an major error, log it. */ 501 /* There was an major error, log it. */
504 int err_status = priv->tx_ring[entry]->TMD3; 502 int err_status = priv->tx_ring[entry]->TMD3;
505 priv->stats.tx_errors++; 503 dev->stats.tx_errors++;
506 if (err_status & EF_RTRY) 504 if (err_status & EF_RTRY)
507 priv->stats.tx_aborted_errors++; 505 dev->stats.tx_aborted_errors++;
508 if (err_status & EF_LCAR) 506 if (err_status & EF_LCAR)
509 priv->stats.tx_carrier_errors++; 507 dev->stats.tx_carrier_errors++;
510 if (err_status & EF_LCOL) 508 if (err_status & EF_LCOL)
511 priv->stats.tx_window_errors++; 509 dev->stats.tx_window_errors++;
512 if (err_status & EF_UFLO) { 510 if (err_status & EF_UFLO) {
513 /* Ackk! On FIFO errors the Tx unit is turned off! */ 511 /* Ackk! On FIFO errors the Tx unit is turned off! */
514 priv->stats.tx_fifo_errors++; 512 dev->stats.tx_fifo_errors++;
515 /* Remove this verbosity later! */ 513 /* Remove this verbosity later! */
516 printk(KERN_ERR "%s: Tx FIFO error! Status %4.4x.\n", 514 printk(KERN_ERR "%s: Tx FIFO error! Status %4.4x.\n",
517 dev->name, csr0); 515 dev->name, csr0);
@@ -520,8 +518,8 @@ static irqreturn_t ariadne_interrupt(int irq, void *data)
520 } 518 }
521 } else { 519 } else {
522 if (status & (TF_MORE|TF_ONE)) 520 if (status & (TF_MORE|TF_ONE))
523 priv->stats.collisions++; 521 dev->stats.collisions++;
524 priv->stats.tx_packets++; 522 dev->stats.tx_packets++;
525 } 523 }
526 dirty_tx++; 524 dirty_tx++;
527 } 525 }
@@ -547,11 +545,11 @@ static irqreturn_t ariadne_interrupt(int irq, void *data)
547 /* Log misc errors. */ 545 /* Log misc errors. */
548 if (csr0 & BABL) { 546 if (csr0 & BABL) {
549 handled = 1; 547 handled = 1;
550 priv->stats.tx_errors++; /* Tx babble. */ 548 dev->stats.tx_errors++; /* Tx babble. */
551 } 549 }
552 if (csr0 & MISS) { 550 if (csr0 & MISS) {
553 handled = 1; 551 handled = 1;
554 priv->stats.rx_errors++; /* Missed a Rx frame. */ 552 dev->stats.rx_errors++; /* Missed a Rx frame. */
555 } 553 }
556 if (csr0 & MERR) { 554 if (csr0 & MERR) {
557 handled = 1; 555 handled = 1;
@@ -672,7 +670,7 @@ static int ariadne_start_xmit(struct sk_buff *skb, struct net_device *dev)
672 priv->cur_tx -= TX_RING_SIZE; 670 priv->cur_tx -= TX_RING_SIZE;
673 priv->dirty_tx -= TX_RING_SIZE; 671 priv->dirty_tx -= TX_RING_SIZE;
674 } 672 }
675 priv->stats.tx_bytes += len; 673 dev->stats.tx_bytes += len;
676 674
677 /* Trigger an immediate send poll. */ 675 /* Trigger an immediate send poll. */
678 lance->RAP = CSR0; /* PCnet-ISA Controller Status */ 676 lance->RAP = CSR0; /* PCnet-ISA Controller Status */
@@ -707,15 +705,15 @@ static int ariadne_rx(struct net_device *dev)
707 buffers, with only the last correctly noting the error. */ 705 buffers, with only the last correctly noting the error. */
708 if (status & RF_ENP) 706 if (status & RF_ENP)
709 /* Only count a general error at the end of a packet.*/ 707 /* Only count a general error at the end of a packet.*/
710 priv->stats.rx_errors++; 708 dev->stats.rx_errors++;
711 if (status & RF_FRAM) 709 if (status & RF_FRAM)
712 priv->stats.rx_frame_errors++; 710 dev->stats.rx_frame_errors++;
713 if (status & RF_OFLO) 711 if (status & RF_OFLO)
714 priv->stats.rx_over_errors++; 712 dev->stats.rx_over_errors++;
715 if (status & RF_CRC) 713 if (status & RF_CRC)
716 priv->stats.rx_crc_errors++; 714 dev->stats.rx_crc_errors++;
717 if (status & RF_BUFF) 715 if (status & RF_BUFF)
718 priv->stats.rx_fifo_errors++; 716 dev->stats.rx_fifo_errors++;
719 priv->rx_ring[entry]->RMD1 &= 0xff00|RF_STP|RF_ENP; 717 priv->rx_ring[entry]->RMD1 &= 0xff00|RF_STP|RF_ENP;
720 } else { 718 } else {
721 /* Malloc up new buffer, compatible with net-3. */ 719 /* Malloc up new buffer, compatible with net-3. */
@@ -731,7 +729,7 @@ static int ariadne_rx(struct net_device *dev)
731 break; 729 break;
732 730
733 if (i > RX_RING_SIZE-2) { 731 if (i > RX_RING_SIZE-2) {
734 priv->stats.rx_dropped++; 732 dev->stats.rx_dropped++;
735 priv->rx_ring[entry]->RMD1 |= RF_OWN; 733 priv->rx_ring[entry]->RMD1 |= RF_OWN;
736 priv->cur_rx++; 734 priv->cur_rx++;
737 } 735 }
@@ -764,8 +762,8 @@ static int ariadne_rx(struct net_device *dev)
764 762
765 netif_rx(skb); 763 netif_rx(skb);
766 dev->last_rx = jiffies; 764 dev->last_rx = jiffies;
767 priv->stats.rx_packets++; 765 dev->stats.rx_packets++;
768 priv->stats.rx_bytes += pkt_len; 766 dev->stats.rx_bytes += pkt_len;
769 } 767 }
770 768
771 priv->rx_ring[entry]->RMD1 |= RF_OWN; 769 priv->rx_ring[entry]->RMD1 |= RF_OWN;
@@ -783,7 +781,6 @@ static int ariadne_rx(struct net_device *dev)
783 781
784static struct net_device_stats *ariadne_get_stats(struct net_device *dev) 782static struct net_device_stats *ariadne_get_stats(struct net_device *dev)
785{ 783{
786 struct ariadne_private *priv = netdev_priv(dev);
787 volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr; 784 volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
788 short saved_addr; 785 short saved_addr;
789 unsigned long flags; 786 unsigned long flags;
@@ -791,11 +788,11 @@ static struct net_device_stats *ariadne_get_stats(struct net_device *dev)
791 local_irq_save(flags); 788 local_irq_save(flags);
792 saved_addr = lance->RAP; 789 saved_addr = lance->RAP;
793 lance->RAP = CSR112; /* Missed Frame Count */ 790 lance->RAP = CSR112; /* Missed Frame Count */
794 priv->stats.rx_missed_errors = swapw(lance->RDP); 791 dev->stats.rx_missed_errors = swapw(lance->RDP);
795 lance->RAP = saved_addr; 792 lance->RAP = saved_addr;
796 local_irq_restore(flags); 793 local_irq_restore(flags);
797 794
798 return &priv->stats; 795 return &dev->stats;
799} 796}
800 797
801 798
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index ffc937f5d15d..0f501d2ca935 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -775,7 +775,7 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file,
775 return err; 775 return err;
776} 776}
777 777
778static struct tty_ldisc sp_ldisc = { 778static struct tty_ldisc_ops sp_ldisc = {
779 .owner = THIS_MODULE, 779 .owner = THIS_MODULE,
780 .magic = TTY_LDISC_MAGIC, 780 .magic = TTY_LDISC_MAGIC,
781 .name = "6pack", 781 .name = "6pack",
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index b8740e6a5cec..3249df5e0f17 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -971,7 +971,7 @@ out:
971 mkiss_put(ax); 971 mkiss_put(ax);
972} 972}
973 973
974static struct tty_ldisc ax_ldisc = { 974static struct tty_ldisc_ops ax_ldisc = {
975 .owner = THIS_MODULE, 975 .owner = THIS_MODULE,
976 .magic = TTY_LDISC_MAGIC, 976 .magic = TTY_LDISC_MAGIC,
977 .name = "mkiss", 977 .name = "mkiss",
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index e6f40b7f9041..9e33196f9459 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -533,7 +533,7 @@ static void irtty_close(struct tty_struct *tty)
533 533
534/* ------------------------------------------------------- */ 534/* ------------------------------------------------------- */
535 535
536static struct tty_ldisc irda_ldisc = { 536static struct tty_ldisc_ops irda_ldisc = {
537 .magic = TTY_LDISC_MAGIC, 537 .magic = TTY_LDISC_MAGIC,
538 .name = "irda", 538 .name = "irda",
539 .flags = 0, 539 .flags = 0,
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 387a13395015..e13966bb5f77 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -585,9 +585,8 @@ static struct config_item_type netconsole_target_type = {
585 * Group operations and type for netconsole_subsys. 585 * Group operations and type for netconsole_subsys.
586 */ 586 */
587 587
588static int make_netconsole_target(struct config_group *group, 588static struct config_item *make_netconsole_target(struct config_group *group,
589 const char *name, 589 const char *name)
590 struct config_item **new_item)
591{ 590{
592 unsigned long flags; 591 unsigned long flags;
593 struct netconsole_target *nt; 592 struct netconsole_target *nt;
@@ -599,7 +598,7 @@ static int make_netconsole_target(struct config_group *group,
599 nt = kzalloc(sizeof(*nt), GFP_KERNEL); 598 nt = kzalloc(sizeof(*nt), GFP_KERNEL);
600 if (!nt) { 599 if (!nt) {
601 printk(KERN_ERR "netconsole: failed to allocate memory\n"); 600 printk(KERN_ERR "netconsole: failed to allocate memory\n");
602 return -ENOMEM; 601 return ERR_PTR(-ENOMEM);
603 } 602 }
604 603
605 nt->np.name = "netconsole"; 604 nt->np.name = "netconsole";
@@ -616,8 +615,7 @@ static int make_netconsole_target(struct config_group *group,
616 list_add(&nt->list, &target_list); 615 list_add(&nt->list, &target_list);
617 spin_unlock_irqrestore(&target_list_lock, flags); 616 spin_unlock_irqrestore(&target_list_lock, flags);
618 617
619 *new_item = &nt->item; 618 return &nt->item;
620 return 0;
621} 619}
622 620
623static void drop_netconsole_target(struct config_group *group, 621static void drop_netconsole_target(struct config_group *group,
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index f1a52def1241..451bdb57d6fc 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -378,7 +378,7 @@ ppp_asynctty_wakeup(struct tty_struct *tty)
378} 378}
379 379
380 380
381static struct tty_ldisc ppp_ldisc = { 381static struct tty_ldisc_ops ppp_ldisc = {
382 .owner = THIS_MODULE, 382 .owner = THIS_MODULE,
383 .magic = TTY_LDISC_MAGIC, 383 .magic = TTY_LDISC_MAGIC,
384 .name = "ppp", 384 .name = "ppp",
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index b8f0369a71e7..801d8f99d471 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -418,7 +418,7 @@ ppp_sync_wakeup(struct tty_struct *tty)
418} 418}
419 419
420 420
421static struct tty_ldisc ppp_sync_ldisc = { 421static struct tty_ldisc_ops ppp_sync_ldisc = {
422 .owner = THIS_MODULE, 422 .owner = THIS_MODULE,
423 .magic = TTY_LDISC_MAGIC, 423 .magic = TTY_LDISC_MAGIC,
424 .name = "pppsync", 424 .name = "pppsync",
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 84af68fdb6c2..1d58991d395b 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -1301,7 +1301,7 @@ static int sl_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1301#endif 1301#endif
1302/* VSV changes end */ 1302/* VSV changes end */
1303 1303
1304static struct tty_ldisc sl_ldisc = { 1304static struct tty_ldisc_ops sl_ldisc = {
1305 .owner = THIS_MODULE, 1305 .owner = THIS_MODULE,
1306 .magic = TTY_LDISC_MAGIC, 1306 .magic = TTY_LDISC_MAGIC,
1307 .name = "slip", 1307 .name = "slip",
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c
index eae94ab6b818..4518d0aa2480 100644
--- a/drivers/net/wan/pc300_tty.c
+++ b/drivers/net/wan/pc300_tty.c
@@ -688,9 +688,9 @@ static void cpc_tty_rx_work(struct work_struct *work)
688 if (cpc_tty->tty) { 688 if (cpc_tty->tty) {
689 ld = tty_ldisc_ref(cpc_tty->tty); 689 ld = tty_ldisc_ref(cpc_tty->tty);
690 if (ld) { 690 if (ld) {
691 if (ld->receive_buf) { 691 if (ld->ops->receive_buf) {
692 CPC_TTY_DBG("%s: call line disc. receive_buf\n",cpc_tty->name); 692 CPC_TTY_DBG("%s: call line disc. receive_buf\n",cpc_tty->name);
693 ld->receive_buf(cpc_tty->tty, (char *)(buf->data), &flags, buf->size); 693 ld->ops->receive_buf(cpc_tty->tty, (char *)(buf->data), &flags, buf->size);
694 } 694 }
695 tty_ldisc_deref(ld); 695 tty_ldisc_deref(ld);
696 } 696 }
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 069f8bb0a99f..2a6c7a60756f 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -754,7 +754,7 @@ static void x25_asy_setup(struct net_device *dev)
754 dev->flags = IFF_NOARP; 754 dev->flags = IFF_NOARP;
755} 755}
756 756
757static struct tty_ldisc x25_ldisc = { 757static struct tty_ldisc_ops x25_ldisc = {
758 .owner = THIS_MODULE, 758 .owner = THIS_MODULE,
759 .magic = TTY_LDISC_MAGIC, 759 .magic = TTY_LDISC_MAGIC,
760 .name = "X.25", 760 .name = "X.25",
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index 883af891ebfb..417e9e675fac 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -2728,7 +2728,7 @@ static int strip_ioctl(struct tty_struct *tty, struct file *file,
2728/************************************************************************/ 2728/************************************************************************/
2729/* Initialization */ 2729/* Initialization */
2730 2730
2731static struct tty_ldisc strip_ldisc = { 2731static struct tty_ldisc_ops strip_ldisc = {
2732 .magic = TTY_LDISC_MAGIC, 2732 .magic = TTY_LDISC_MAGIC,
2733 .name = "strip", 2733 .name = "strip",
2734 .owner = THIS_MODULE, 2734 .owner = THIS_MODULE,
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 0276471cb25e..6558a4037806 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -4,8 +4,6 @@
4 * Driver for the serial port on the 21285 StrongArm-110 core logic chip. 4 * Driver for the serial port on the 21285 StrongArm-110 core logic chip.
5 * 5 *
6 * Based on drivers/char/serial.c 6 * Based on drivers/char/serial.c
7 *
8 * $Id: 21285.c,v 1.37 2002/07/28 10:03:27 rmk Exp $
9 */ 7 */
10#include <linux/module.h> 8#include <linux/module.h>
11#include <linux/tty.h> 9#include <linux/tty.h>
@@ -88,7 +86,7 @@ static void serial21285_enable_ms(struct uart_port *port)
88static irqreturn_t serial21285_rx_chars(int irq, void *dev_id) 86static irqreturn_t serial21285_rx_chars(int irq, void *dev_id)
89{ 87{
90 struct uart_port *port = dev_id; 88 struct uart_port *port = dev_id;
91 struct tty_struct *tty = port->info->tty; 89 struct tty_struct *tty = port->info->port.tty;
92 unsigned int status, ch, flag, rxs, max_count = 256; 90 unsigned int status, ch, flag, rxs, max_count = 256;
93 91
94 status = *CSR_UARTFLG; 92 status = *CSR_UARTFLG;
@@ -237,8 +235,8 @@ serial21285_set_termios(struct uart_port *port, struct ktermios *termios,
237 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 235 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
238 quot = uart_get_divisor(port, baud); 236 quot = uart_get_divisor(port, baud);
239 237
240 if (port->info && port->info->tty) { 238 if (port->info && port->info->port.tty) {
241 struct tty_struct *tty = port->info->tty; 239 struct tty_struct *tty = port->info->port.tty;
242 unsigned int b = port->uartclk / (16 * quot); 240 unsigned int b = port->uartclk / (16 * quot);
243 tty_encode_baud_rate(tty, b, b); 241 tty_encode_baud_rate(tty, b, b);
244 } 242 }
@@ -494,7 +492,7 @@ static int __init serial21285_init(void)
494{ 492{
495 int ret; 493 int ret;
496 494
497 printk(KERN_INFO "Serial: 21285 driver $Revision: 1.37 $\n"); 495 printk(KERN_INFO "Serial: 21285 driver\n");
498 496
499 serial21285_setup_ports(); 497 serial21285_setup_ports();
500 498
@@ -515,5 +513,5 @@ module_init(serial21285_init);
515module_exit(serial21285_exit); 513module_exit(serial21285_exit);
516 514
517MODULE_LICENSE("GPL"); 515MODULE_LICENSE("GPL");
518MODULE_DESCRIPTION("Intel Footbridge (21285) serial driver $Revision: 1.37 $"); 516MODULE_DESCRIPTION("Intel Footbridge (21285) serial driver");
519MODULE_ALIAS_CHARDEV(SERIAL_21285_MAJOR, SERIAL_21285_MINOR); 517MODULE_ALIAS_CHARDEV(SERIAL_21285_MAJOR, SERIAL_21285_MINOR);
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index bbf5bc5892c7..381b12ac20e0 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -249,7 +249,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status)
249{ 249{
250#if 0 250#if 0
251 if(status & DCD) { 251 if(status & DCD) {
252 if((info->tty->termios->c_cflag & CRTSCTS) && 252 if((info->port.tty->termios->c_cflag & CRTSCTS) &&
253 ((info->curregs[3] & AUTO_ENAB)==0)) { 253 ((info->curregs[3] & AUTO_ENAB)==0)) {
254 info->curregs[3] |= AUTO_ENAB; 254 info->curregs[3] |= AUTO_ENAB;
255 info->pendregs[3] |= AUTO_ENAB; 255 info->pendregs[3] |= AUTO_ENAB;
@@ -274,7 +274,7 @@ static void status_handle(struct m68k_serial *info, unsigned short status)
274 274
275static void receive_chars(struct m68k_serial *info, unsigned short rx) 275static void receive_chars(struct m68k_serial *info, unsigned short rx)
276{ 276{
277 struct tty_struct *tty = info->tty; 277 struct tty_struct *tty = info->port.tty;
278 m68328_uart *uart = &uart_addr[info->line]; 278 m68328_uart *uart = &uart_addr[info->line];
279 unsigned char ch, flag; 279 unsigned char ch, flag;
280 280
@@ -345,7 +345,7 @@ static void transmit_chars(struct m68k_serial *info)
345 goto clear_and_return; 345 goto clear_and_return;
346 } 346 }
347 347
348 if((info->xmit_cnt <= 0) || info->tty->stopped) { 348 if((info->xmit_cnt <= 0) || info->port.tty->stopped) {
349 /* That's peculiar... TX ints off */ 349 /* That's peculiar... TX ints off */
350 uart->ustcnt &= ~USTCNT_TX_INTR_MASK; 350 uart->ustcnt &= ~USTCNT_TX_INTR_MASK;
351 goto clear_and_return; 351 goto clear_and_return;
@@ -403,7 +403,7 @@ static void do_softint(struct work_struct *work)
403 struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue); 403 struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue);
404 struct tty_struct *tty; 404 struct tty_struct *tty;
405 405
406 tty = info->tty; 406 tty = info->port.tty;
407 if (!tty) 407 if (!tty)
408 return; 408 return;
409#if 0 409#if 0
@@ -427,7 +427,7 @@ static void do_serial_hangup(struct work_struct *work)
427 struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup); 427 struct m68k_serial *info = container_of(work, struct m68k_serial, tqueue_hangup);
428 struct tty_struct *tty; 428 struct tty_struct *tty;
429 429
430 tty = info->tty; 430 tty = info->port.tty;
431 if (!tty) 431 if (!tty)
432 return; 432 return;
433 433
@@ -471,8 +471,8 @@ static int startup(struct m68k_serial * info)
471 uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK; 471 uart->ustcnt = USTCNT_UEN | USTCNT_RXEN | USTCNT_RX_INTR_MASK;
472#endif 472#endif
473 473
474 if (info->tty) 474 if (info->port.tty)
475 clear_bit(TTY_IO_ERROR, &info->tty->flags); 475 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
476 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 476 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
477 477
478 /* 478 /*
@@ -506,8 +506,8 @@ static void shutdown(struct m68k_serial * info)
506 info->xmit_buf = 0; 506 info->xmit_buf = 0;
507 } 507 }
508 508
509 if (info->tty) 509 if (info->port.tty)
510 set_bit(TTY_IO_ERROR, &info->tty->flags); 510 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
511 511
512 info->flags &= ~S_INITIALIZED; 512 info->flags &= ~S_INITIALIZED;
513 local_irq_restore(flags); 513 local_irq_restore(flags);
@@ -573,9 +573,9 @@ static void change_speed(struct m68k_serial *info)
573 unsigned cflag; 573 unsigned cflag;
574 int i; 574 int i;
575 575
576 if (!info->tty || !info->tty->termios) 576 if (!info->port.tty || !info->port.tty->termios)
577 return; 577 return;
578 cflag = info->tty->termios->c_cflag; 578 cflag = info->port.tty->termios->c_cflag;
579 if (!(port = info->port)) 579 if (!(port = info->port))
580 return; 580 return;
581 581
@@ -1131,7 +1131,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1131 tty_ldisc_flush(tty); 1131 tty_ldisc_flush(tty);
1132 tty->closing = 0; 1132 tty->closing = 0;
1133 info->event = 0; 1133 info->event = 0;
1134 info->tty = 0; 1134 info->port.tty = NULL;
1135#warning "This is not and has never been valid so fix it" 1135#warning "This is not and has never been valid so fix it"
1136#if 0 1136#if 0
1137 if (tty->ldisc.num != ldiscs[N_TTY].num) { 1137 if (tty->ldisc.num != ldiscs[N_TTY].num) {
@@ -1169,7 +1169,7 @@ void rs_hangup(struct tty_struct *tty)
1169 info->event = 0; 1169 info->event = 0;
1170 info->count = 0; 1170 info->count = 0;
1171 info->flags &= ~S_NORMAL_ACTIVE; 1171 info->flags &= ~S_NORMAL_ACTIVE;
1172 info->tty = 0; 1172 info->port.tty = NULL;
1173 wake_up_interruptible(&info->open_wait); 1173 wake_up_interruptible(&info->open_wait);
1174} 1174}
1175 1175
@@ -1286,7 +1286,7 @@ int rs_open(struct tty_struct *tty, struct file * filp)
1286 1286
1287 info->count++; 1287 info->count++;
1288 tty->driver_data = info; 1288 tty->driver_data = info;
1289 info->tty = tty; 1289 info->port.tty = tty;
1290 1290
1291 /* 1291 /*
1292 * Start up serial port 1292 * Start up serial port
@@ -1363,7 +1363,7 @@ rs68328_init(void)
1363 info = &m68k_soft[i]; 1363 info = &m68k_soft[i];
1364 info->magic = SERIAL_MAGIC; 1364 info->magic = SERIAL_MAGIC;
1365 info->port = (int) &uart_addr[i]; 1365 info->port = (int) &uart_addr[i];
1366 info->tty = 0; 1366 info->port.tty = NULL;
1367 info->irq = uart_irqs[i]; 1367 info->irq = uart_irqs[i];
1368 info->custom_divisor = 16; 1368 info->custom_divisor = 16;
1369 info->close_delay = 50; 1369 info->close_delay = 50;
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index d9d4e9552a4d..24661cd5e4fb 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -393,7 +393,7 @@ static void rs_360_start(struct tty_struct *tty)
393 393
394static _INLINE_ void receive_chars(ser_info_t *info) 394static _INLINE_ void receive_chars(ser_info_t *info)
395{ 395{
396 struct tty_struct *tty = info->tty; 396 struct tty_struct *tty = info->port.tty;
397 unsigned char ch, flag, *cp; 397 unsigned char ch, flag, *cp;
398 /*int ignored = 0;*/ 398 /*int ignored = 0;*/
399 int i; 399 int i;
@@ -514,7 +514,7 @@ static _INLINE_ void receive_chars(ser_info_t *info)
514 514
515static _INLINE_ void receive_break(ser_info_t *info) 515static _INLINE_ void receive_break(ser_info_t *info)
516{ 516{
517 struct tty_struct *tty = info->tty; 517 struct tty_struct *tty = info->port.tty;
518 518
519 info->state->icount.brk++; 519 info->state->icount.brk++;
520 /* Check to see if there is room in the tty buffer for 520 /* Check to see if there is room in the tty buffer for
@@ -528,7 +528,7 @@ static _INLINE_ void transmit_chars(ser_info_t *info)
528{ 528{
529 529
530 if ((info->flags & TX_WAKEUP) || 530 if ((info->flags & TX_WAKEUP) ||
531 (info->tty->flags & (1 << TTY_DO_WRITE_WAKEUP))) { 531 (info->port.tty->flags & (1 << TTY_DO_WRITE_WAKEUP))) {
532 schedule_work(&info->tqueue); 532 schedule_work(&info->tqueue);
533 } 533 }
534 534
@@ -584,12 +584,12 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
584 } 584 }
585 } 585 }
586 if (info->flags & ASYNC_CTS_FLOW) { 586 if (info->flags & ASYNC_CTS_FLOW) {
587 if (info->tty->hw_stopped) { 587 if (info->port.tty->hw_stopped) {
588 if (status & UART_MSR_CTS) { 588 if (status & UART_MSR_CTS) {
589#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) 589#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
590 printk("CTS tx start..."); 590 printk("CTS tx start...");
591#endif 591#endif
592 info->tty->hw_stopped = 0; 592 info->port.tty->hw_stopped = 0;
593 info->IER |= UART_IER_THRI; 593 info->IER |= UART_IER_THRI;
594 serial_out(info, UART_IER, info->IER); 594 serial_out(info, UART_IER, info->IER);
595 rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); 595 rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
@@ -600,7 +600,7 @@ static _INLINE_ void check_modem_status(struct async_struct *info)
600#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) 600#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
601 printk("CTS tx stop..."); 601 printk("CTS tx stop...");
602#endif 602#endif
603 info->tty->hw_stopped = 1; 603 info->port.tty->hw_stopped = 1;
604 info->IER &= ~UART_IER_THRI; 604 info->IER &= ~UART_IER_THRI;
605 serial_out(info, UART_IER, info->IER); 605 serial_out(info, UART_IER, info->IER);
606 } 606 }
@@ -670,7 +670,7 @@ static void do_softint(void *private_)
670 ser_info_t *info = (ser_info_t *) private_; 670 ser_info_t *info = (ser_info_t *) private_;
671 struct tty_struct *tty; 671 struct tty_struct *tty;
672 672
673 tty = info->tty; 673 tty = info->port.tty;
674 if (!tty) 674 if (!tty)
675 return; 675 return;
676 676
@@ -693,7 +693,7 @@ static void do_serial_hangup(void *private_)
693 struct async_struct *info = (struct async_struct *) private_; 693 struct async_struct *info = (struct async_struct *) private_;
694 struct tty_struct *tty; 694 struct tty_struct *tty;
695 695
696 tty = info->tty; 696 tty = info->port.tty;
697 if (!tty) 697 if (!tty)
698 return; 698 return;
699 699
@@ -721,8 +721,8 @@ static int startup(ser_info_t *info)
721 721
722#ifdef maybe 722#ifdef maybe
723 if (!state->port || !state->type) { 723 if (!state->port || !state->type) {
724 if (info->tty) 724 if (info->port.tty)
725 set_bit(TTY_IO_ERROR, &info->tty->flags); 725 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
726 goto errout; 726 goto errout;
727 } 727 }
728#endif 728#endif
@@ -734,12 +734,12 @@ static int startup(ser_info_t *info)
734 734
735#ifdef modem_control 735#ifdef modem_control
736 info->MCR = 0; 736 info->MCR = 0;
737 if (info->tty->termios->c_cflag & CBAUD) 737 if (info->port.tty->termios->c_cflag & CBAUD)
738 info->MCR = UART_MCR_DTR | UART_MCR_RTS; 738 info->MCR = UART_MCR_DTR | UART_MCR_RTS;
739#endif 739#endif
740 740
741 if (info->tty) 741 if (info->port.tty)
742 clear_bit(TTY_IO_ERROR, &info->tty->flags); 742 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
743 743
744 /* 744 /*
745 * and set the speed of the serial port 745 * and set the speed of the serial port
@@ -842,8 +842,8 @@ static void shutdown(ser_info_t *info)
842 smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 842 smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
843 } 843 }
844 844
845 if (info->tty) 845 if (info->port.tty)
846 set_bit(TTY_IO_ERROR, &info->tty->flags); 846 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
847 847
848 info->flags &= ~ASYNC_INITIALIZED; 848 info->flags &= ~ASYNC_INITIALIZED;
849 local_irq_restore(flags); 849 local_irq_restore(flags);
@@ -863,9 +863,9 @@ static void change_speed(ser_info_t *info)
863 volatile struct smc_regs *smcp; 863 volatile struct smc_regs *smcp;
864 volatile struct scc_regs *sccp; 864 volatile struct scc_regs *sccp;
865 865
866 if (!info->tty || !info->tty->termios) 866 if (!info->port.tty || !info->port.tty->termios)
867 return; 867 return;
868 cflag = info->tty->termios->c_cflag; 868 cflag = info->port.tty->termios->c_cflag;
869 869
870 state = info->state; 870 state = info->state;
871 871
@@ -936,24 +936,24 @@ static void change_speed(ser_info_t *info)
936 * Set up parity check flag 936 * Set up parity check flag
937 */ 937 */
938 info->read_status_mask = (BD_SC_EMPTY | BD_SC_OV); 938 info->read_status_mask = (BD_SC_EMPTY | BD_SC_OV);
939 if (I_INPCK(info->tty)) 939 if (I_INPCK(info->port.tty))
940 info->read_status_mask |= BD_SC_FR | BD_SC_PR; 940 info->read_status_mask |= BD_SC_FR | BD_SC_PR;
941 if (I_BRKINT(info->tty) || I_PARMRK(info->tty)) 941 if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
942 info->read_status_mask |= BD_SC_BR; 942 info->read_status_mask |= BD_SC_BR;
943 943
944 /* 944 /*
945 * Characters to ignore 945 * Characters to ignore
946 */ 946 */
947 info->ignore_status_mask = 0; 947 info->ignore_status_mask = 0;
948 if (I_IGNPAR(info->tty)) 948 if (I_IGNPAR(info->port.tty))
949 info->ignore_status_mask |= BD_SC_PR | BD_SC_FR; 949 info->ignore_status_mask |= BD_SC_PR | BD_SC_FR;
950 if (I_IGNBRK(info->tty)) { 950 if (I_IGNBRK(info->port.tty)) {
951 info->ignore_status_mask |= BD_SC_BR; 951 info->ignore_status_mask |= BD_SC_BR;
952 /* 952 /*
953 * If we're ignore parity and break indicators, ignore 953 * If we're ignore parity and break indicators, ignore
954 * overruns too. (For real raw support). 954 * overruns too. (For real raw support).
955 */ 955 */
956 if (I_IGNPAR(info->tty)) 956 if (I_IGNPAR(info->port.tty))
957 info->ignore_status_mask |= BD_SC_OV; 957 info->ignore_status_mask |= BD_SC_OV;
958 } 958 }
959 /* 959 /*
@@ -1658,7 +1658,7 @@ static void rs_360_close(struct tty_struct *tty, struct file * filp)
1658 tty_ldisc_flush(tty); 1658 tty_ldisc_flush(tty);
1659 tty->closing = 0; 1659 tty->closing = 0;
1660 info->event = 0; 1660 info->event = 0;
1661 info->tty = 0; 1661 info->port.tty = NULL;
1662 if (info->blocked_open) { 1662 if (info->blocked_open) {
1663 if (info->close_delay) { 1663 if (info->close_delay) {
1664 msleep_interruptible(jiffies_to_msecs(info->close_delay)); 1664 msleep_interruptible(jiffies_to_msecs(info->close_delay));
@@ -1758,7 +1758,7 @@ static void rs_360_hangup(struct tty_struct *tty)
1758 info->event = 0; 1758 info->event = 0;
1759 state->count = 0; 1759 state->count = 0;
1760 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1760 info->flags &= ~ASYNC_NORMAL_ACTIVE;
1761 info->tty = 0; 1761 info->port.tty = NULL;
1762 wake_up_interruptible(&info->open_wait); 1762 wake_up_interruptible(&info->open_wait);
1763} 1763}
1764 1764
@@ -1919,7 +1919,7 @@ static int rs_360_open(struct tty_struct *tty, struct file * filp)
1919 printk("rs_open %s, count = %d\n", tty->name, info->state->count); 1919 printk("rs_open %s, count = %d\n", tty->name, info->state->count);
1920#endif 1920#endif
1921 tty->driver_data = info; 1921 tty->driver_data = info;
1922 info->tty = tty; 1922 info->port.tty = tty;
1923 1923
1924 /* 1924 /*
1925 * Start up serial port 1925 * Start up serial port
@@ -1976,7 +1976,7 @@ static inline int line_info(char *buf, struct serial_state *state)
1976 info->port = state->port; 1976 info->port = state->port;
1977 info->flags = state->flags; 1977 info->flags = state->flags;
1978 info->quot = 0; 1978 info->quot = 0;
1979 info->tty = 0; 1979 info->port.tty = NULL;
1980 } 1980 }
1981 local_irq_disable(); 1981 local_irq_disable();
1982 status = serial_in(info, UART_MSR); 1982 status = serial_in(info, UART_MSR);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index be95e55b228b..ce948b66bbd4 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -12,8 +12,6 @@
12 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. 13 * (at your option) any later version.
14 * 14 *
15 * $Id: 8250.c,v 1.90 2002/07/28 10:03:27 rmk Exp $
16 *
17 * A note about mapbase / membase 15 * A note about mapbase / membase
18 * 16 *
19 * mapbase is the physical address of the IO port. 17 * mapbase is the physical address of the IO port.
@@ -1289,7 +1287,7 @@ static void serial8250_enable_ms(struct uart_port *port)
1289static void 1287static void
1290receive_chars(struct uart_8250_port *up, unsigned int *status) 1288receive_chars(struct uart_8250_port *up, unsigned int *status)
1291{ 1289{
1292 struct tty_struct *tty = up->port.info->tty; 1290 struct tty_struct *tty = up->port.info->port.tty;
1293 unsigned char ch, lsr = *status; 1291 unsigned char ch, lsr = *status;
1294 int max_count = 256; 1292 int max_count = 256;
1295 char flag; 1293 char flag;
@@ -2934,7 +2932,7 @@ static int __init serial8250_init(void)
2934 if (nr_uarts > UART_NR) 2932 if (nr_uarts > UART_NR)
2935 nr_uarts = UART_NR; 2933 nr_uarts = UART_NR;
2936 2934
2937 printk(KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ " 2935 printk(KERN_INFO "Serial: 8250/16550 driver"
2938 "%d ports, IRQ sharing %sabled\n", nr_uarts, 2936 "%d ports, IRQ sharing %sabled\n", nr_uarts,
2939 share_irqs ? "en" : "dis"); 2937 share_irqs ? "en" : "dis");
2940 2938
@@ -2995,7 +2993,7 @@ EXPORT_SYMBOL(serial8250_suspend_port);
2995EXPORT_SYMBOL(serial8250_resume_port); 2993EXPORT_SYMBOL(serial8250_resume_port);
2996 2994
2997MODULE_LICENSE("GPL"); 2995MODULE_LICENSE("GPL");
2998MODULE_DESCRIPTION("Generic 8250/16x50 serial driver $Revision: 1.90 $"); 2996MODULE_DESCRIPTION("Generic 8250/16x50 serial driver");
2999 2997
3000module_param(share_irqs, uint, 0644); 2998module_param(share_irqs, uint, 0644);
3001MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices" 2999MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices"
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index 91bd28f2bb47..78c00162b04e 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -11,8 +11,6 @@
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. 13 * (at your option) any later version.
14 *
15 * $Id: 8250.h,v 1.8 2002/07/21 21:32:30 rmk Exp $
16 */ 14 */
17 15
18#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 788c3559522d..1b36087665a2 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -10,8 +10,6 @@
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License. 12 * the Free Software Foundation; either version 2 of the License.
13 *
14 * $Id: 8250_pci.c,v 1.28 2002/11/02 11:14:18 rmk Exp $
15 */ 13 */
16#include <linux/module.h> 14#include <linux/module.h>
17#include <linux/init.h> 15#include <linux/init.h>
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index 638b68649e79..fde7f9ccf57e 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -12,8 +12,6 @@
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License. 14 * the Free Software Foundation; either version 2 of the License.
15 *
16 * $Id: 8250_pnp.c,v 1.10 2002/07/21 21:32:30 rmk Exp $
17 */ 15 */
18#include <linux/module.h> 16#include <linux/module.h>
19#include <linux/init.h> 17#include <linux/init.h>
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 18ca9075e131..8fc7451c0049 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1,8 +1,6 @@
1# 1#
2# Serial device configuration 2# Serial device configuration
3# 3#
4# $Id: Kconfig,v 1.11 2004/03/11 18:08:04 lethal Exp $
5#
6 4
7menu "Serial drivers" 5menu "Serial drivers"
8 depends on HAS_IOMEM 6 depends on HAS_IOMEM
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 7d85c1fbe7e0..3a0bbbe17aa3 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -1,8 +1,6 @@
1# 1#
2# Makefile for the kernel serial device drivers. 2# Makefile for the kernel serial device drivers.
3# 3#
4# $Id: Makefile,v 1.8 2002/07/21 21:32:30 rmk Exp $
5#
6 4
7obj-$(CONFIG_SERIAL_CORE) += serial_core.o 5obj-$(CONFIG_SERIAL_CORE) += serial_core.o
8obj-$(CONFIG_SERIAL_21285) += 21285.o 6obj-$(CONFIG_SERIAL_21285) += 21285.o
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index e88da72f8304..90b56c2c31e2 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -22,8 +22,6 @@
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * 24 *
25 * $Id: amba.c,v 1.41 2002/07/28 10:03:27 rmk Exp $
26 *
27 * This is a generic driver for ARM AMBA-type serial ports. They 25 * This is a generic driver for ARM AMBA-type serial ports. They
28 * have a lot of 16550-like features, but are not register compatible. 26 * have a lot of 16550-like features, but are not register compatible.
29 * Note that although they do have CTS, DCD and DSR inputs, they do 27 * Note that although they do have CTS, DCD and DSR inputs, they do
@@ -119,7 +117,7 @@ static void pl010_enable_ms(struct uart_port *port)
119 117
120static void pl010_rx_chars(struct uart_amba_port *uap) 118static void pl010_rx_chars(struct uart_amba_port *uap)
121{ 119{
122 struct tty_struct *tty = uap->port.info->tty; 120 struct tty_struct *tty = uap->port.info->port.tty;
123 unsigned int status, ch, flag, rsr, max_count = 256; 121 unsigned int status, ch, flag, rsr, max_count = 256;
124 122
125 status = readb(uap->port.membase + UART01x_FR); 123 status = readb(uap->port.membase + UART01x_FR);
@@ -791,7 +789,7 @@ static int __init pl010_init(void)
791{ 789{
792 int ret; 790 int ret;
793 791
794 printk(KERN_INFO "Serial: AMBA driver $Revision: 1.41 $\n"); 792 printk(KERN_INFO "Serial: AMBA driver\n");
795 793
796 ret = uart_register_driver(&amba_reg); 794 ret = uart_register_driver(&amba_reg);
797 if (ret == 0) { 795 if (ret == 0) {
@@ -812,5 +810,5 @@ module_init(pl010_init);
812module_exit(pl010_exit); 810module_exit(pl010_exit);
813 811
814MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd"); 812MODULE_AUTHOR("ARM Ltd/Deep Blue Solutions Ltd");
815MODULE_DESCRIPTION("ARM AMBA serial port driver $Revision: 1.41 $"); 813MODULE_DESCRIPTION("ARM AMBA serial port driver");
816MODULE_LICENSE("GPL"); 814MODULE_LICENSE("GPL");
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 08adc1de4a79..9d08f27208a1 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -22,8 +22,6 @@
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * 24 *
25 * $Id: amba.c,v 1.41 2002/07/28 10:03:27 rmk Exp $
26 *
27 * This is a generic driver for ARM AMBA-type serial ports. They 25 * This is a generic driver for ARM AMBA-type serial ports. They
28 * have a lot of 16550-like features, but are not register compatible. 26 * have a lot of 16550-like features, but are not register compatible.
29 * Note that although they do have CTS, DCD and DSR inputs, they do 27 * Note that although they do have CTS, DCD and DSR inputs, they do
@@ -109,7 +107,7 @@ static void pl011_enable_ms(struct uart_port *port)
109 107
110static void pl011_rx_chars(struct uart_amba_port *uap) 108static void pl011_rx_chars(struct uart_amba_port *uap)
111{ 109{
112 struct tty_struct *tty = uap->port.info->tty; 110 struct tty_struct *tty = uap->port.info->port.tty;
113 unsigned int status, ch, flag, max_count = 256; 111 unsigned int status, ch, flag, max_count = 256;
114 112
115 status = readw(uap->port.membase + UART01x_FR); 113 status = readw(uap->port.membase + UART01x_FR);
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 6aeef22bd203..1fee12c1f4f8 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -662,14 +662,14 @@ static void atmel_rx_from_ring(struct uart_port *port)
662 * uart_start(), which takes the lock. 662 * uart_start(), which takes the lock.
663 */ 663 */
664 spin_unlock(&port->lock); 664 spin_unlock(&port->lock);
665 tty_flip_buffer_push(port->info->tty); 665 tty_flip_buffer_push(port->info->port.tty);
666 spin_lock(&port->lock); 666 spin_lock(&port->lock);
667} 667}
668 668
669static void atmel_rx_from_dma(struct uart_port *port) 669static void atmel_rx_from_dma(struct uart_port *port)
670{ 670{
671 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 671 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
672 struct tty_struct *tty = port->info->tty; 672 struct tty_struct *tty = port->info->port.tty;
673 struct atmel_dma_buffer *pdc; 673 struct atmel_dma_buffer *pdc;
674 int rx_idx = atmel_port->pdc_rx_idx; 674 int rx_idx = atmel_port->pdc_rx_idx;
675 unsigned int head; 675 unsigned int head;
@@ -794,7 +794,7 @@ static void atmel_tasklet_func(unsigned long data)
794static int atmel_startup(struct uart_port *port) 794static int atmel_startup(struct uart_port *port)
795{ 795{
796 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 796 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
797 struct tty_struct *tty = port->info->tty; 797 struct tty_struct *tty = port->info->port.tty;
798 int retval; 798 int retval;
799 799
800 /* 800 /*
@@ -956,6 +956,20 @@ static void atmel_shutdown(struct uart_port *port)
956} 956}
957 957
958/* 958/*
959 * Flush any TX data submitted for DMA. Called when the TX circular
960 * buffer is reset.
961 */
962static void atmel_flush_buffer(struct uart_port *port)
963{
964 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
965
966 if (atmel_use_dma_tx(port)) {
967 UART_PUT_TCR(port, 0);
968 atmel_port->pdc_tx.ofs = 0;
969 }
970}
971
972/*
959 * Power / Clock management. 973 * Power / Clock management.
960 */ 974 */
961static void atmel_serial_pm(struct uart_port *port, unsigned int state, 975static void atmel_serial_pm(struct uart_port *port, unsigned int state,
@@ -1189,6 +1203,7 @@ static struct uart_ops atmel_pops = {
1189 .break_ctl = atmel_break_ctl, 1203 .break_ctl = atmel_break_ctl,
1190 .startup = atmel_startup, 1204 .startup = atmel_startup,
1191 .shutdown = atmel_shutdown, 1205 .shutdown = atmel_shutdown,
1206 .flush_buffer = atmel_flush_buffer,
1192 .set_termios = atmel_set_termios, 1207 .set_termios = atmel_set_termios,
1193 .type = atmel_type, 1208 .type = atmel_type,
1194 .release_port = atmel_release_port, 1209 .release_port = atmel_release_port,
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index fd9bb777df28..9d8543762a30 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -175,7 +175,7 @@ int kgdb_get_debug_char(void)
175#ifdef CONFIG_SERIAL_BFIN_PIO 175#ifdef CONFIG_SERIAL_BFIN_PIO
176static void bfin_serial_rx_chars(struct bfin_serial_port *uart) 176static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
177{ 177{
178 struct tty_struct *tty = uart->port.info->tty; 178 struct tty_struct *tty = uart->port.info->port.tty;
179 unsigned int status, ch, flg; 179 unsigned int status, ch, flg;
180 static struct timeval anomaly_start = { .tv_sec = 0 }; 180 static struct timeval anomaly_start = { .tv_sec = 0 };
181 181
@@ -393,7 +393,7 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
393 393
394static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) 394static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
395{ 395{
396 struct tty_struct *tty = uart->port.info->tty; 396 struct tty_struct *tty = uart->port.info->port.tty;
397 int i, flg, status; 397 int i, flg, status;
398 398
399 status = UART_GET_LSR(uart); 399 status = UART_GET_LSR(uart);
@@ -552,7 +552,7 @@ static void bfin_serial_mctrl_check(struct bfin_serial_port *uart)
552#ifdef CONFIG_SERIAL_BFIN_CTSRTS 552#ifdef CONFIG_SERIAL_BFIN_CTSRTS
553 unsigned int status; 553 unsigned int status;
554 struct uart_info *info = uart->port.info; 554 struct uart_info *info = uart->port.info;
555 struct tty_struct *tty = info->tty; 555 struct tty_struct *tty = info->port.tty;
556 556
557 status = bfin_serial_get_mctrl(&uart->port); 557 status = bfin_serial_get_mctrl(&uart->port);
558 uart_handle_cts_change(&uart->port, status & TIOCM_CTS); 558 uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
@@ -814,10 +814,10 @@ static void bfin_serial_set_ldisc(struct uart_port *port)
814 int line = port->line; 814 int line = port->line;
815 unsigned short val; 815 unsigned short val;
816 816
817 if (line >= port->info->tty->driver->num) 817 if (line >= port->info->port.tty->driver->num)
818 return; 818 return;
819 819
820 switch (port->info->tty->ldisc.num) { 820 switch (port->info->port.tty->ldisc.num) {
821 case N_IRDA: 821 case N_IRDA:
822 val = UART_GET_GCTL(&bfin_serial_ports[line]); 822 val = UART_GET_GCTL(&bfin_serial_ports[line]);
823 val |= (IREN | RPOLC); 823 val |= (IREN | RPOLC);
diff --git a/drivers/serial/bfin_sport_uart.c b/drivers/serial/bfin_sport_uart.c
index aca1240ad808..dd8564d25051 100644
--- a/drivers/serial/bfin_sport_uart.c
+++ b/drivers/serial/bfin_sport_uart.c
@@ -174,7 +174,7 @@ static int sport_uart_setup(struct sport_uart_port *up, int sclk, int baud_rate)
174static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id) 174static irqreturn_t sport_uart_rx_irq(int irq, void *dev_id)
175{ 175{
176 struct sport_uart_port *up = dev_id; 176 struct sport_uart_port *up = dev_id;
177 struct tty_struct *tty = up->port.info->tty; 177 struct tty_struct *tty = up->port.info->port.tty;
178 unsigned int ch; 178 unsigned int ch;
179 179
180 do { 180 do {
@@ -201,7 +201,7 @@ static irqreturn_t sport_uart_tx_irq(int irq, void *dev_id)
201static irqreturn_t sport_uart_err_irq(int irq, void *dev_id) 201static irqreturn_t sport_uart_err_irq(int irq, void *dev_id)
202{ 202{
203 struct sport_uart_port *up = dev_id; 203 struct sport_uart_port *up = dev_id;
204 struct tty_struct *tty = up->port.info->tty; 204 struct tty_struct *tty = up->port.info->port.tty;
205 unsigned int stat = SPORT_GET_STAT(up); 205 unsigned int stat = SPORT_GET_STAT(up);
206 206
207 /* Overflow in RX FIFO */ 207 /* Overflow in RX FIFO */
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
index 23827189ec0e..fc1fa9267c59 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/serial/clps711x.c
@@ -21,9 +21,6 @@
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 * $Id: clps711x.c,v 1.42 2002/07/28 10:03:28 rmk Exp $
26 *
27 */ 24 */
28 25
29#if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 26#if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
@@ -96,7 +93,7 @@ static void clps711xuart_enable_ms(struct uart_port *port)
96static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id) 93static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id)
97{ 94{
98 struct uart_port *port = dev_id; 95 struct uart_port *port = dev_id;
99 struct tty_struct *tty = port->info->tty; 96 struct tty_struct *tty = port->info->port.tty;
100 unsigned int status, ch, flg; 97 unsigned int status, ch, flg;
101 98
102 status = clps_readl(SYSFLG(port)); 99 status = clps_readl(SYSFLG(port));
@@ -551,7 +548,7 @@ static int __init clps711xuart_init(void)
551{ 548{
552 int ret, i; 549 int ret, i;
553 550
554 printk(KERN_INFO "Serial: CLPS711x driver $Revision: 1.42 $\n"); 551 printk(KERN_INFO "Serial: CLPS711x driver\n");
555 552
556 ret = uart_register_driver(&clps711x_reg); 553 ret = uart_register_driver(&clps711x_reg);
557 if (ret) 554 if (ret)
@@ -577,6 +574,6 @@ module_init(clps711xuart_init);
577module_exit(clps711xuart_exit); 574module_exit(clps711xuart_exit);
578 575
579MODULE_AUTHOR("Deep Blue Solutions Ltd"); 576MODULE_AUTHOR("Deep Blue Solutions Ltd");
580MODULE_DESCRIPTION("CLPS-711x generic serial driver $Revision: 1.42 $"); 577MODULE_DESCRIPTION("CLPS-711x generic serial driver");
581MODULE_LICENSE("GPL"); 578MODULE_LICENSE("GPL");
582MODULE_ALIAS_CHARDEV(SERIAL_CLPS711X_MAJOR, SERIAL_CLPS711X_MINOR); 579MODULE_ALIAS_CHARDEV(SERIAL_CLPS711X_MAJOR, SERIAL_CLPS711X_MINOR);
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 3e0366eab412..8249ac490559 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -968,7 +968,7 @@ static DEFINE_MUTEX(tmp_buf_mutex);
968/* Calculate the chartime depending on baudrate, numbor of bits etc. */ 968/* Calculate the chartime depending on baudrate, numbor of bits etc. */
969static void update_char_time(struct e100_serial * info) 969static void update_char_time(struct e100_serial * info)
970{ 970{
971 tcflag_t cflags = info->tty->termios->c_cflag; 971 tcflag_t cflags = info->port.tty->termios->c_cflag;
972 int bits; 972 int bits;
973 973
974 /* calc. number of bits / data byte */ 974 /* calc. number of bits / data byte */
@@ -1483,7 +1483,8 @@ rs_stop(struct tty_struct *tty)
1483 CIRC_CNT(info->xmit.head, 1483 CIRC_CNT(info->xmit.head,
1484 info->xmit.tail,SERIAL_XMIT_SIZE))); 1484 info->xmit.tail,SERIAL_XMIT_SIZE)));
1485 1485
1486 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); 1486 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char,
1487 STOP_CHAR(info->port.tty));
1487 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop); 1488 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, stop);
1488 if (tty->termios->c_iflag & IXON ) { 1489 if (tty->termios->c_iflag & IXON ) {
1489 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 1490 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
@@ -1772,7 +1773,7 @@ add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char fl
1772 1773
1773 info->icount.rx++; 1774 info->icount.rx++;
1774 } else { 1775 } else {
1775 struct tty_struct *tty = info->tty; 1776 struct tty_struct *tty = info->port.tty;
1776 tty_insert_flip_char(tty, data, flag); 1777 tty_insert_flip_char(tty, data, flag);
1777 info->icount.rx++; 1778 info->icount.rx++;
1778 } 1779 }
@@ -1838,7 +1839,7 @@ static unsigned int handle_all_descr_data(struct e100_serial *info)
1838 descr->status = 0; 1839 descr->status = 0;
1839 1840
1840 DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl); 1841 DFLOW( DEBUG_LOG(info->line, "RX %lu\n", recvl);
1841 if (info->tty->stopped) { 1842 if (info->port.tty->stopped) {
1842 unsigned char *buf = phys_to_virt(descr->buf); 1843 unsigned char *buf = phys_to_virt(descr->buf);
1843 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]); 1844 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[0]);
1844 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]); 1845 DEBUG_LOG(info->line, "rx 0x%02X\n", buf[1]);
@@ -1872,7 +1873,7 @@ static void receive_chars_dma(struct e100_serial *info)
1872 IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) | 1873 IO_STATE(R_DMA_CH6_CLR_INTR, clr_descr, do) |
1873 IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do); 1874 IO_STATE(R_DMA_CH6_CLR_INTR, clr_eop, do);
1874 1875
1875 tty = info->tty; 1876 tty = info->port.tty;
1876 if (!tty) /* Something wrong... */ 1877 if (!tty) /* Something wrong... */
1877 return; 1878 return;
1878 1879
@@ -2122,7 +2123,7 @@ static void flush_to_flip_buffer(struct e100_serial *info)
2122 unsigned long flags; 2123 unsigned long flags;
2123 2124
2124 local_irq_save(flags); 2125 local_irq_save(flags);
2125 tty = info->tty; 2126 tty = info->port.tty;
2126 2127
2127 if (!tty) { 2128 if (!tty) {
2128 local_irq_restore(flags); 2129 local_irq_restore(flags);
@@ -2287,7 +2288,7 @@ static
2287struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info) 2288struct e100_serial * handle_ser_rx_interrupt_no_dma(struct e100_serial *info)
2288{ 2289{
2289 unsigned long data_read; 2290 unsigned long data_read;
2290 struct tty_struct *tty = info->tty; 2291 struct tty_struct *tty = info->port.tty;
2291 2292
2292 if (!tty) { 2293 if (!tty) {
2293 printk("!NO TTY!\n"); 2294 printk("!NO TTY!\n");
@@ -2350,7 +2351,7 @@ more_data:
2350 data_in, data_read); 2351 data_in, data_read);
2351 char flag = TTY_NORMAL; 2352 char flag = TTY_NORMAL;
2352 if (info->errorcode == ERRCODE_INSERT_BREAK) { 2353 if (info->errorcode == ERRCODE_INSERT_BREAK) {
2353 struct tty_struct *tty = info->tty; 2354 struct tty_struct *tty = info->port.tty;
2354 tty_insert_flip_char(tty, 0, flag); 2355 tty_insert_flip_char(tty, 0, flag);
2355 info->icount.rx++; 2356 info->icount.rx++;
2356 } 2357 }
@@ -2396,7 +2397,7 @@ more_data:
2396 goto more_data; 2397 goto more_data;
2397 } 2398 }
2398 2399
2399 tty_flip_buffer_push(info->tty); 2400 tty_flip_buffer_push(info->port.tty);
2400 return info; 2401 return info;
2401} 2402}
2402 2403
@@ -2547,8 +2548,8 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2547 rstat = info->port[REG_STATUS]; 2548 rstat = info->port[REG_STATUS];
2548 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat)); 2549 DFLOW(DEBUG_LOG(info->line, "stat %x\n", rstat));
2549 e100_disable_serial_tx_ready_irq(info); 2550 e100_disable_serial_tx_ready_irq(info);
2550 if (info->tty->stopped) 2551 if (info->port.tty->stopped)
2551 rs_stop(info->tty); 2552 rs_stop(info->port.tty);
2552 /* Enable the DMA channel and tell it to continue */ 2553 /* Enable the DMA channel and tell it to continue */
2553 e100_enable_txdma_channel(info); 2554 e100_enable_txdma_channel(info);
2554 /* Wait 12 cycles before doing the DMA command */ 2555 /* Wait 12 cycles before doing the DMA command */
@@ -2561,9 +2562,10 @@ static void handle_ser_tx_interrupt(struct e100_serial *info)
2561 } 2562 }
2562 /* Normal char-by-char interrupt */ 2563 /* Normal char-by-char interrupt */
2563 if (info->xmit.head == info->xmit.tail 2564 if (info->xmit.head == info->xmit.tail
2564 || info->tty->stopped 2565 || info->port.tty->stopped
2565 || info->tty->hw_stopped) { 2566 || info->port.tty->hw_stopped) {
2566 DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n", info->tty->stopped)); 2567 DFLOW(DEBUG_LOG(info->line, "tx_int: stopped %i\n",
2568 info->port.tty->stopped));
2567 e100_disable_serial_tx_ready_irq(info); 2569 e100_disable_serial_tx_ready_irq(info);
2568 info->tr_running = 0; 2570 info->tr_running = 0;
2569 return; 2571 return;
@@ -2725,7 +2727,7 @@ do_softint(struct work_struct *work)
2725 2727
2726 info = container_of(work, struct e100_serial, work); 2728 info = container_of(work, struct e100_serial, work);
2727 2729
2728 tty = info->tty; 2730 tty = info->port.tty;
2729 if (!tty) 2731 if (!tty)
2730 return; 2732 return;
2731 2733
@@ -2767,8 +2769,8 @@ startup(struct e100_serial * info)
2767 /* Bits and pieces collected from below. Better to have them 2769 /* Bits and pieces collected from below. Better to have them
2768 in one ifdef:ed clause than to mix in a lot of ifdefs, 2770 in one ifdef:ed clause than to mix in a lot of ifdefs,
2769 right? */ 2771 right? */
2770 if (info->tty) 2772 if (info->port.tty)
2771 clear_bit(TTY_IO_ERROR, &info->tty->flags); 2773 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
2772 2774
2773 info->xmit.head = info->xmit.tail = 0; 2775 info->xmit.head = info->xmit.tail = 0;
2774 info->first_recv_buffer = info->last_recv_buffer = NULL; 2776 info->first_recv_buffer = info->last_recv_buffer = NULL;
@@ -2825,8 +2827,8 @@ startup(struct e100_serial * info)
2825 e100_disable_txdma_channel(info); 2827 e100_disable_txdma_channel(info);
2826 } 2828 }
2827 2829
2828 if (info->tty) 2830 if (info->port.tty)
2829 clear_bit(TTY_IO_ERROR, &info->tty->flags); 2831 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
2830 2832
2831 info->xmit.head = info->xmit.tail = 0; 2833 info->xmit.head = info->xmit.tail = 0;
2832 info->first_recv_buffer = info->last_recv_buffer = NULL; 2834 info->first_recv_buffer = info->last_recv_buffer = NULL;
@@ -2940,14 +2942,14 @@ shutdown(struct e100_serial * info)
2940 descr[i].buf = 0; 2942 descr[i].buf = 0;
2941 } 2943 }
2942 2944
2943 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) { 2945 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL)) {
2944 /* hang up DTR and RTS if HUPCL is enabled */ 2946 /* hang up DTR and RTS if HUPCL is enabled */
2945 e100_dtr(info, 0); 2947 e100_dtr(info, 0);
2946 e100_rts(info, 0); /* could check CRTSCTS before doing this */ 2948 e100_rts(info, 0); /* could check CRTSCTS before doing this */
2947 } 2949 }
2948 2950
2949 if (info->tty) 2951 if (info->port.tty)
2950 set_bit(TTY_IO_ERROR, &info->tty->flags); 2952 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
2951 2953
2952 info->flags &= ~ASYNC_INITIALIZED; 2954 info->flags &= ~ASYNC_INITIALIZED;
2953 local_irq_restore(flags); 2955 local_irq_restore(flags);
@@ -2964,12 +2966,12 @@ change_speed(struct e100_serial *info)
2964 unsigned long flags; 2966 unsigned long flags;
2965 /* first some safety checks */ 2967 /* first some safety checks */
2966 2968
2967 if (!info->tty || !info->tty->termios) 2969 if (!info->port.tty || !info->port.tty->termios)
2968 return; 2970 return;
2969 if (!info->port) 2971 if (!info->port)
2970 return; 2972 return;
2971 2973
2972 cflag = info->tty->termios->c_cflag; 2974 cflag = info->port.tty->termios->c_cflag;
2973 2975
2974 /* possibly, the tx/rx should be disabled first to do this safely */ 2976 /* possibly, the tx/rx should be disabled first to do this safely */
2975 2977
@@ -3097,10 +3099,11 @@ change_speed(struct e100_serial *info)
3097 3099
3098 info->port[REG_TR_CTRL] = info->tx_ctrl; 3100 info->port[REG_TR_CTRL] = info->tx_ctrl;
3099 info->port[REG_REC_CTRL] = info->rx_ctrl; 3101 info->port[REG_REC_CTRL] = info->rx_ctrl;
3100 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->tty)); 3102 xoff = IO_FIELD(R_SERIAL0_XOFF, xoff_char, STOP_CHAR(info->port.tty));
3101 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable); 3103 xoff |= IO_STATE(R_SERIAL0_XOFF, tx_stop, enable);
3102 if (info->tty->termios->c_iflag & IXON ) { 3104 if (info->port.tty->termios->c_iflag & IXON ) {
3103 DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n", STOP_CHAR(info->tty))); 3105 DFLOW(DEBUG_LOG(info->line, "FLOW XOFF enabled 0x%02X\n",
3106 STOP_CHAR(info->port.tty)));
3104 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable); 3107 xoff |= IO_STATE(R_SERIAL0_XOFF, auto_xoff, enable);
3105 } 3108 }
3106 3109
@@ -3475,7 +3478,7 @@ set_serial_info(struct e100_serial *info,
3475 info->type = new_serial.type; 3478 info->type = new_serial.type;
3476 info->close_delay = new_serial.close_delay; 3479 info->close_delay = new_serial.close_delay;
3477 info->closing_wait = new_serial.closing_wait; 3480 info->closing_wait = new_serial.closing_wait;
3478 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 3481 info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
3479 3482
3480 check_and_exit: 3483 check_and_exit:
3481 if (info->flags & ASYNC_INITIALIZED) { 3484 if (info->flags & ASYNC_INITIALIZED) {
@@ -3811,7 +3814,7 @@ rs_close(struct tty_struct *tty, struct file * filp)
3811 tty_ldisc_flush(tty); 3814 tty_ldisc_flush(tty);
3812 tty->closing = 0; 3815 tty->closing = 0;
3813 info->event = 0; 3816 info->event = 0;
3814 info->tty = 0; 3817 info->port.tty = NULL;
3815 if (info->blocked_open) { 3818 if (info->blocked_open) {
3816 if (info->close_delay) 3819 if (info->close_delay)
3817 schedule_timeout_interruptible(info->close_delay); 3820 schedule_timeout_interruptible(info->close_delay);
@@ -3915,7 +3918,7 @@ rs_hangup(struct tty_struct *tty)
3915 info->event = 0; 3918 info->event = 0;
3916 info->count = 0; 3919 info->count = 0;
3917 info->flags &= ~ASYNC_NORMAL_ACTIVE; 3920 info->flags &= ~ASYNC_NORMAL_ACTIVE;
3918 info->tty = 0; 3921 info->port.tty = NULL;
3919 wake_up_interruptible(&info->open_wait); 3922 wake_up_interruptible(&info->open_wait);
3920} 3923}
3921 3924
@@ -4077,9 +4080,9 @@ rs_open(struct tty_struct *tty, struct file * filp)
4077 4080
4078 info->count++; 4081 info->count++;
4079 tty->driver_data = info; 4082 tty->driver_data = info;
4080 info->tty = tty; 4083 info->port.tty = tty;
4081 4084
4082 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 4085 info->port.tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
4083 4086
4084 if (!tmp_buf) { 4087 if (!tmp_buf) {
4085 page = get_zeroed_page(GFP_KERNEL); 4088 page = get_zeroed_page(GFP_KERNEL);
@@ -4267,14 +4270,14 @@ static int line_info(char *buf, struct e100_serial *info)
4267 (unsigned long)info->max_recv_cnt); 4270 (unsigned long)info->max_recv_cnt);
4268 4271
4269#if 1 4272#if 1
4270 if (info->tty) { 4273 if (info->port.tty) {
4271 4274
4272 if (info->tty->stopped) 4275 if (info->port.tty->stopped)
4273 ret += sprintf(buf+ret, " stopped:%i", 4276 ret += sprintf(buf+ret, " stopped:%i",
4274 (int)info->tty->stopped); 4277 (int)info->port.tty->stopped);
4275 if (info->tty->hw_stopped) 4278 if (info->port.tty->hw_stopped)
4276 ret += sprintf(buf+ret, " hw_stopped:%i", 4279 ret += sprintf(buf+ret, " hw_stopped:%i",
4277 (int)info->tty->hw_stopped); 4280 (int)info->port.tty->hw_stopped);
4278 } 4281 }
4279 4282
4280 { 4283 {
@@ -4465,7 +4468,7 @@ rs_init(void)
4465 info->uses_dma_in = 0; 4468 info->uses_dma_in = 0;
4466 info->uses_dma_out = 0; 4469 info->uses_dma_out = 0;
4467 info->line = i; 4470 info->line = i;
4468 info->tty = 0; 4471 info->port.tty = NULL;
4469 info->type = PORT_ETRAX; 4472 info->type = PORT_ETRAX;
4470 info->tr_running = 0; 4473 info->tr_running = 0;
4471 info->forced_eop = 0; 4474 info->forced_eop = 0;
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index 0dddd68b20d2..a81d2c2ff8a2 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -197,7 +197,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
197 while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) { 197 while ((status = dz_in(dport, DZ_RBUF)) & DZ_DVAL) {
198 dport = &mux->dport[LINE(status)]; 198 dport = &mux->dport[LINE(status)];
199 uport = &dport->port; 199 uport = &dport->port;
200 tty = uport->info->tty; /* point to the proper dev */ 200 tty = uport->info->port.tty; /* point to the proper dev */
201 201
202 ch = UCHAR(status); /* grab the char */ 202 ch = UCHAR(status); /* grab the char */
203 flag = TTY_NORMAL; 203 flag = TTY_NORMAL;
@@ -249,7 +249,7 @@ static inline void dz_receive_chars(struct dz_mux *mux)
249 } 249 }
250 for (i = 0; i < DZ_NB_PORT; i++) 250 for (i = 0; i < DZ_NB_PORT; i++)
251 if (lines_rx[i]) 251 if (lines_rx[i])
252 tty_flip_buffer_push(mux->dport[i].port.info->tty); 252 tty_flip_buffer_push(mux->dport[i].port.info->port.tty);
253} 253}
254 254
255/* 255/*
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 64acb39a51ba..e0da4dc7bbf6 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -372,7 +372,7 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
372{ 372{
373 struct imx_port *sport = dev_id; 373 struct imx_port *sport = dev_id;
374 unsigned int rx,flg,ignored = 0; 374 unsigned int rx,flg,ignored = 0;
375 struct tty_struct *tty = sport->port.info->tty; 375 struct tty_struct *tty = sport->port.info->port.tty;
376 unsigned long flags, temp; 376 unsigned long flags, temp;
377 377
378 spin_lock_irqsave(&sport->port.lock,flags); 378 spin_lock_irqsave(&sport->port.lock,flags);
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index 4f1af71e9a1b..6dd98f9fb89c 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -905,7 +905,7 @@ static void transmit_chars(struct uart_port *the_port)
905 return; 905 return;
906 906
907 info = the_port->info; 907 info = the_port->info;
908 tty = info->tty; 908 tty = info->port.tty;
909 909
910 if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { 910 if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) {
911 /* Nothing to do or hw stopped */ 911 /* Nothing to do or hw stopped */
@@ -997,14 +997,14 @@ ioc3_change_speed(struct uart_port *the_port,
997 997
998 the_port->ignore_status_mask = N_ALL_INPUT; 998 the_port->ignore_status_mask = N_ALL_INPUT;
999 999
1000 info->tty->low_latency = 1; 1000 info->port.tty->low_latency = 1;
1001 1001
1002 if (I_IGNPAR(info->tty)) 1002 if (I_IGNPAR(info->port.tty))
1003 the_port->ignore_status_mask &= ~(N_PARITY_ERROR 1003 the_port->ignore_status_mask &= ~(N_PARITY_ERROR
1004 | N_FRAMING_ERROR); 1004 | N_FRAMING_ERROR);
1005 if (I_IGNBRK(info->tty)) { 1005 if (I_IGNBRK(info->port.tty)) {
1006 the_port->ignore_status_mask &= ~N_BREAK; 1006 the_port->ignore_status_mask &= ~N_BREAK;
1007 if (I_IGNPAR(info->tty)) 1007 if (I_IGNPAR(info->port.tty))
1008 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; 1008 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;
1009 } 1009 }
1010 if (!(cflag & CREAD)) { 1010 if (!(cflag & CREAD)) {
@@ -1399,14 +1399,14 @@ static int receive_chars(struct uart_port *the_port)
1399 /* Make sure all the pointers are "good" ones */ 1399 /* Make sure all the pointers are "good" ones */
1400 if (!info) 1400 if (!info)
1401 return 0; 1401 return 0;
1402 if (!info->tty) 1402 if (!info->port.tty)
1403 return 0; 1403 return 0;
1404 1404
1405 if (!(port->ip_flags & INPUT_ENABLE)) 1405 if (!(port->ip_flags & INPUT_ENABLE))
1406 return 0; 1406 return 0;
1407 1407
1408 spin_lock_irqsave(&the_port->lock, pflags); 1408 spin_lock_irqsave(&the_port->lock, pflags);
1409 tty = info->tty; 1409 tty = info->port.tty;
1410 1410
1411 read_count = do_read(the_port, ch, MAX_CHARS); 1411 read_count = do_read(the_port, ch, MAX_CHARS);
1412 if (read_count > 0) { 1412 if (read_count > 0) {
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 49b8a82b7b9f..6bab63cd5b29 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1635,7 +1635,7 @@ static void transmit_chars(struct uart_port *the_port)
1635 return; 1635 return;
1636 1636
1637 info = the_port->info; 1637 info = the_port->info;
1638 tty = info->tty; 1638 tty = info->port.tty;
1639 1639
1640 if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) { 1640 if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) {
1641 /* Nothing to do or hw stopped */ 1641 /* Nothing to do or hw stopped */
@@ -1738,14 +1738,14 @@ ioc4_change_speed(struct uart_port *the_port,
1738 1738
1739 the_port->ignore_status_mask = N_ALL_INPUT; 1739 the_port->ignore_status_mask = N_ALL_INPUT;
1740 1740
1741 info->tty->low_latency = 1; 1741 info->port.tty->low_latency = 1;
1742 1742
1743 if (I_IGNPAR(info->tty)) 1743 if (I_IGNPAR(info->port.tty))
1744 the_port->ignore_status_mask &= ~(N_PARITY_ERROR 1744 the_port->ignore_status_mask &= ~(N_PARITY_ERROR
1745 | N_FRAMING_ERROR); 1745 | N_FRAMING_ERROR);
1746 if (I_IGNBRK(info->tty)) { 1746 if (I_IGNBRK(info->port.tty)) {
1747 the_port->ignore_status_mask &= ~N_BREAK; 1747 the_port->ignore_status_mask &= ~N_BREAK;
1748 if (I_IGNPAR(info->tty)) 1748 if (I_IGNPAR(info->port.tty))
1749 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR; 1749 the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;
1750 } 1750 }
1751 if (!(cflag & CREAD)) { 1751 if (!(cflag & CREAD)) {
@@ -1801,7 +1801,8 @@ static inline int ic4_startup_local(struct uart_port *the_port)
1801 ioc4_set_proto(port, the_port->mapbase); 1801 ioc4_set_proto(port, the_port->mapbase);
1802 1802
1803 /* set the speed of the serial port */ 1803 /* set the speed of the serial port */
1804 ioc4_change_speed(the_port, info->tty->termios, (struct ktermios *)0); 1804 ioc4_change_speed(the_port, info->port.tty->termios,
1805 (struct ktermios *)0);
1805 1806
1806 return 0; 1807 return 0;
1807} 1808}
@@ -2346,11 +2347,11 @@ static void receive_chars(struct uart_port *the_port)
2346 /* Make sure all the pointers are "good" ones */ 2347 /* Make sure all the pointers are "good" ones */
2347 if (!info) 2348 if (!info)
2348 return; 2349 return;
2349 if (!info->tty) 2350 if (!info->port.tty)
2350 return; 2351 return;
2351 2352
2352 spin_lock_irqsave(&the_port->lock, pflags); 2353 spin_lock_irqsave(&the_port->lock, pflags);
2353 tty = info->tty; 2354 tty = info->port.tty;
2354 2355
2355 request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS); 2356 request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS);
2356 2357
@@ -2440,8 +2441,8 @@ static void ic4_shutdown(struct uart_port *the_port)
2440 2441
2441 wake_up_interruptible(&info->delta_msr_wait); 2442 wake_up_interruptible(&info->delta_msr_wait);
2442 2443
2443 if (info->tty) 2444 if (info->port.tty)
2444 set_bit(TTY_IO_ERROR, &info->tty->flags); 2445 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
2445 2446
2446 spin_lock_irqsave(&the_port->lock, port_flags); 2447 spin_lock_irqsave(&the_port->lock, port_flags);
2447 set_notification(port, N_ALL, 0); 2448 set_notification(port, N_ALL, 0);
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 9c95bc0398ad..0d9acbd0bb70 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -257,8 +257,8 @@ static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up
257 257
258 tty = NULL; 258 tty = NULL;
259 if (up->port.info != NULL && 259 if (up->port.info != NULL &&
260 up->port.info->tty != NULL) 260 up->port.info->port.tty != NULL)
261 tty = up->port.info->tty; 261 tty = up->port.info->port.tty;
262 262
263 for (;;) { 263 for (;;) {
264 ch = readb(&channel->control); 264 ch = readb(&channel->control);
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/serial/jsm/jsm_neo.c
index b2d6f5b1a7c2..b7584ca55ade 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/serial/jsm/jsm_neo.c
@@ -998,7 +998,7 @@ static void neo_param(struct jsm_channel *ch)
998 { 50, B50 }, 998 { 50, B50 },
999 }; 999 };
1000 1000
1001 cflag = C_BAUD(ch->uart_port.info->tty); 1001 cflag = C_BAUD(ch->uart_port.info->port.tty);
1002 baud = 9600; 1002 baud = 9600;
1003 for (i = 0; i < ARRAY_SIZE(baud_rates); i++) { 1003 for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
1004 if (baud_rates[i].cflag == cflag) { 1004 if (baud_rates[i].cflag == cflag) {
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 94ec66372508..a697914ae3d0 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -145,7 +145,7 @@ static void jsm_tty_send_xchar(struct uart_port *port, char ch)
145 struct ktermios *termios; 145 struct ktermios *termios;
146 146
147 spin_lock_irqsave(&port->lock, lock_flags); 147 spin_lock_irqsave(&port->lock, lock_flags);
148 termios = port->info->tty->termios; 148 termios = port->info->port.tty->termios;
149 if (ch == termios->c_cc[VSTART]) 149 if (ch == termios->c_cc[VSTART])
150 channel->ch_bd->bd_ops->send_start_character(channel); 150 channel->ch_bd->bd_ops->send_start_character(channel);
151 151
@@ -239,7 +239,7 @@ static int jsm_tty_open(struct uart_port *port)
239 channel->ch_cached_lsr = 0; 239 channel->ch_cached_lsr = 0;
240 channel->ch_stops_sent = 0; 240 channel->ch_stops_sent = 0;
241 241
242 termios = port->info->tty->termios; 242 termios = port->info->port.tty->termios;
243 channel->ch_c_cflag = termios->c_cflag; 243 channel->ch_c_cflag = termios->c_cflag;
244 channel->ch_c_iflag = termios->c_iflag; 244 channel->ch_c_iflag = termios->c_iflag;
245 channel->ch_c_oflag = termios->c_oflag; 245 channel->ch_c_oflag = termios->c_oflag;
@@ -272,7 +272,7 @@ static void jsm_tty_close(struct uart_port *port)
272 jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n"); 272 jsm_printk(CLOSE, INFO, &channel->ch_bd->pci_dev, "start\n");
273 273
274 bd = channel->ch_bd; 274 bd = channel->ch_bd;
275 ts = channel->uart_port.info->tty->termios; 275 ts = channel->uart_port.info->port.tty->termios;
276 276
277 channel->ch_flags &= ~(CH_STOPI); 277 channel->ch_flags &= ~(CH_STOPI);
278 278
@@ -515,7 +515,7 @@ void jsm_input(struct jsm_channel *ch)
515 if (!ch) 515 if (!ch)
516 return; 516 return;
517 517
518 tp = ch->uart_port.info->tty; 518 tp = ch->uart_port.info->port.tty;
519 519
520 bd = ch->ch_bd; 520 bd = ch->ch_bd;
521 if(!bd) 521 if(!bd)
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index c2bb11c02bde..23d030511019 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -325,7 +325,7 @@ static void m32r_sio_enable_ms(struct uart_port *port)
325 325
326static void receive_chars(struct uart_sio_port *up, int *status) 326static void receive_chars(struct uart_sio_port *up, int *status)
327{ 327{
328 struct tty_struct *tty = up->port.info->tty; 328 struct tty_struct *tty = up->port.info->port.tty;
329 unsigned char ch; 329 unsigned char ch;
330 unsigned char flag; 330 unsigned char flag;
331 int max_count = 256; 331 int max_count = 256;
@@ -1160,7 +1160,7 @@ static int __init m32r_sio_init(void)
1160{ 1160{
1161 int ret, i; 1161 int ret, i;
1162 1162
1163 printk(KERN_INFO "Serial: M32R SIO driver $Revision: 1.11 $ "); 1163 printk(KERN_INFO "Serial: M32R SIO driver\n");
1164 1164
1165 for (i = 0; i < NR_IRQS; i++) 1165 for (i = 0; i < NR_IRQS; i++)
1166 spin_lock_init(&irq_lists[i].lock); 1166 spin_lock_init(&irq_lists[i].lock);
@@ -1189,4 +1189,4 @@ EXPORT_SYMBOL(m32r_sio_suspend_port);
1189EXPORT_SYMBOL(m32r_sio_resume_port); 1189EXPORT_SYMBOL(m32r_sio_resume_port);
1190 1190
1191MODULE_LICENSE("GPL"); 1191MODULE_LICENSE("GPL");
1192MODULE_DESCRIPTION("Generic M32R SIO serial driver $Revision: 1.11 $"); 1192MODULE_DESCRIPTION("Generic M32R SIO serial driver");
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index 7e164e0cd211..b2001c5b145c 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -312,7 +312,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
312 uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); 312 uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag);
313 } 313 }
314 314
315 tty_flip_buffer_push(port->info->tty); 315 tty_flip_buffer_push(port->info->port.tty);
316} 316}
317 317
318/****************************************************************************/ 318/****************************************************************************/
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 56007cc8a9b3..fbe3835f6b77 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -327,7 +327,7 @@ static void mcfrs_start(struct tty_struct *tty)
327static inline void receive_chars(struct mcf_serial *info) 327static inline void receive_chars(struct mcf_serial *info)
328{ 328{
329 volatile unsigned char *uartp; 329 volatile unsigned char *uartp;
330 struct tty_struct *tty = info->tty; 330 struct tty_struct *tty = info->port.tty;
331 unsigned char status, ch, flag; 331 unsigned char status, ch, flag;
332 332
333 if (!tty) 333 if (!tty)
@@ -382,7 +382,7 @@ static inline void transmit_chars(struct mcf_serial *info)
382 info->stats.tx++; 382 info->stats.tx++;
383 } 383 }
384 384
385 if ((info->xmit_cnt <= 0) || info->tty->stopped) { 385 if ((info->xmit_cnt <= 0) || info->port.tty->stopped) {
386 info->imr &= ~MCFUART_UIR_TXREADY; 386 info->imr &= ~MCFUART_UIR_TXREADY;
387 uartp[MCFUART_UIMR] = info->imr; 387 uartp[MCFUART_UIMR] = info->imr;
388 return; 388 return;
@@ -428,7 +428,7 @@ irqreturn_t mcfrs_interrupt(int irq, void *dev_id)
428static void mcfrs_offintr(struct work_struct *work) 428static void mcfrs_offintr(struct work_struct *work)
429{ 429{
430 struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue); 430 struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue);
431 struct tty_struct *tty = info->tty; 431 struct tty_struct *tty = info->port.tty;
432 432
433 if (tty) 433 if (tty)
434 tty_wakeup(tty); 434 tty_wakeup(tty);
@@ -498,7 +498,7 @@ static void mcfrs_timer(void)
498static void do_serial_hangup(struct work_struct *work) 498static void do_serial_hangup(struct work_struct *work)
499{ 499{
500 struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue_hangup); 500 struct mcf_serial *info = container_of(work, struct mcf_serial, tqueue_hangup);
501 struct tty_struct *tty = info->tty; 501 struct tty_struct *tty = info->port.tty;
502 502
503 if (tty) 503 if (tty)
504 tty_hangup(tty); 504 tty_hangup(tty);
@@ -532,8 +532,8 @@ static int startup(struct mcf_serial * info)
532 uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */ 532 uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */
533 mcfrs_setsignals(info, 1, 1); 533 mcfrs_setsignals(info, 1, 1);
534 534
535 if (info->tty) 535 if (info->port.tty)
536 clear_bit(TTY_IO_ERROR, &info->tty->flags); 536 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
537 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; 537 info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
538 538
539 /* 539 /*
@@ -578,7 +578,7 @@ static void shutdown(struct mcf_serial * info)
578 uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */ 578 uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETRX; /* reset RX */
579 uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */ 579 uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETTX; /* reset TX */
580 580
581 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 581 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))
582 mcfrs_setsignals(info, 0, 0); 582 mcfrs_setsignals(info, 0, 0);
583 583
584 if (info->xmit_buf) { 584 if (info->xmit_buf) {
@@ -586,8 +586,8 @@ static void shutdown(struct mcf_serial * info)
586 info->xmit_buf = 0; 586 info->xmit_buf = 0;
587 } 587 }
588 588
589 if (info->tty) 589 if (info->port.tty)
590 set_bit(TTY_IO_ERROR, &info->tty->flags); 590 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
591 591
592 info->flags &= ~ASYNC_INITIALIZED; 592 info->flags &= ~ASYNC_INITIALIZED;
593 local_irq_restore(flags); 593 local_irq_restore(flags);
@@ -609,9 +609,9 @@ static void mcfrs_change_speed(struct mcf_serial *info)
609 unsigned int fraction; 609 unsigned int fraction;
610#endif 610#endif
611 611
612 if (!info->tty || !info->tty->termios) 612 if (!info->port.tty || !info->port.tty->termios)
613 return; 613 return;
614 cflag = info->tty->termios->c_cflag; 614 cflag = info->port.tty->termios->c_cflag;
615 if (info->addr == 0) 615 if (info->addr == 0)
616 return; 616 return;
617 617
@@ -623,7 +623,7 @@ static void mcfrs_change_speed(struct mcf_serial *info)
623 if (i & CBAUDEX) { 623 if (i & CBAUDEX) {
624 i &= ~CBAUDEX; 624 i &= ~CBAUDEX;
625 if (i < 1 || i > 4) 625 if (i < 1 || i > 4)
626 info->tty->termios->c_cflag &= ~CBAUDEX; 626 info->port.tty->termios->c_cflag &= ~CBAUDEX;
627 else 627 else
628 i += 15; 628 i += 15;
629 } 629 }
@@ -1216,7 +1216,7 @@ static void mcfrs_close(struct tty_struct *tty, struct file * filp)
1216 1216
1217 tty->closing = 0; 1217 tty->closing = 0;
1218 info->event = 0; 1218 info->event = 0;
1219 info->tty = 0; 1219 info->port.tty = NULL;
1220#if 0 1220#if 0
1221 if (tty->ldisc.num != ldiscs[N_TTY].num) { 1221 if (tty->ldisc.num != ldiscs[N_TTY].num) {
1222 if (tty->ldisc.close) 1222 if (tty->ldisc.close)
@@ -1325,7 +1325,7 @@ void mcfrs_hangup(struct tty_struct *tty)
1325 info->event = 0; 1325 info->event = 0;
1326 info->count = 0; 1326 info->count = 0;
1327 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1327 info->flags &= ~ASYNC_NORMAL_ACTIVE;
1328 info->tty = 0; 1328 info->port.tty = NULL;
1329 wake_up_interruptible(&info->open_wait); 1329 wake_up_interruptible(&info->open_wait);
1330} 1330}
1331 1331
@@ -1452,7 +1452,7 @@ int mcfrs_open(struct tty_struct *tty, struct file * filp)
1452#endif 1452#endif
1453 info->count++; 1453 info->count++;
1454 tty->driver_data = info; 1454 tty->driver_data = info;
1455 info->tty = tty; 1455 info->port.tty = tty;
1456 1456
1457 /* 1457 /*
1458 * Start up serial port 1458 * Start up serial port
@@ -1767,7 +1767,7 @@ mcfrs_init(void)
1767 for (i = 0, info = mcfrs_table; (i < NR_PORTS); i++, info++) { 1767 for (i = 0, info = mcfrs_table; (i < NR_PORTS); i++, info++) {
1768 info->magic = SERIAL_MAGIC; 1768 info->magic = SERIAL_MAGIC;
1769 info->line = i; 1769 info->line = i;
1770 info->tty = 0; 1770 info->port.tty = NULL;
1771 info->custom_divisor = 16; 1771 info->custom_divisor = 16;
1772 info->close_delay = 50; 1772 info->close_delay = 50;
1773 info->closing_wait = 3000; 1773 info->closing_wait = 3000;
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index efc971d9647b..36126070d9af 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -732,7 +732,7 @@ static struct uart_ops mpc52xx_uart_ops = {
732static inline int 732static inline int
733mpc52xx_uart_int_rx_chars(struct uart_port *port) 733mpc52xx_uart_int_rx_chars(struct uart_port *port)
734{ 734{
735 struct tty_struct *tty = port->info->tty; 735 struct tty_struct *tty = port->info->port.tty;
736 unsigned char ch, flag; 736 unsigned char ch, flag;
737 unsigned short status; 737 unsigned short status;
738 738
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index e8819c43f57d..c9f53e71f252 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -932,7 +932,7 @@ static int mpsc_make_ready(struct mpsc_port_info *pi)
932static int mpsc_rx_intr(struct mpsc_port_info *pi) 932static int mpsc_rx_intr(struct mpsc_port_info *pi)
933{ 933{
934 struct mpsc_rx_desc *rxre; 934 struct mpsc_rx_desc *rxre;
935 struct tty_struct *tty = pi->port.info->tty; 935 struct tty_struct *tty = pi->port.info->port.tty;
936 u32 cmdstat, bytes_in, i; 936 u32 cmdstat, bytes_in, i;
937 int rc = 0; 937 int rc = 0;
938 u8 *bp; 938 u8 *bp;
@@ -1972,7 +1972,7 @@ static int __init mpsc_drv_init(void)
1972{ 1972{
1973 int rc; 1973 int rc;
1974 1974
1975 printk(KERN_INFO "Serial: MPSC driver $Revision: 1.00 $\n"); 1975 printk(KERN_INFO "Serial: MPSC driver\n");
1976 1976
1977 memset(mpsc_ports, 0, sizeof(mpsc_ports)); 1977 memset(mpsc_ports, 0, sizeof(mpsc_ports));
1978 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1978 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
@@ -2004,7 +2004,7 @@ module_init(mpsc_drv_init);
2004module_exit(mpsc_drv_exit); 2004module_exit(mpsc_drv_exit);
2005 2005
2006MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>"); 2006MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
2007MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver $Revision: 1.00 $"); 2007MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver");
2008MODULE_VERSION(MPSC_VERSION); 2008MODULE_VERSION(MPSC_VERSION);
2009MODULE_LICENSE("GPL"); 2009MODULE_LICENSE("GPL");
2010MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR); 2010MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR);
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index e94031731a47..953a5ffa9b44 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -243,7 +243,7 @@ static void mux_write(struct uart_port *port)
243static void mux_read(struct uart_port *port) 243static void mux_read(struct uart_port *port)
244{ 244{
245 int data; 245 int data;
246 struct tty_struct *tty = port->info->tty; 246 struct tty_struct *tty = port->info->port.tty;
247 __u32 start_count = port->icount.rx; 247 __u32 start_count = port->icount.rx;
248 248
249 while(1) { 249 while(1) {
diff --git a/drivers/serial/netx-serial.c b/drivers/serial/netx-serial.c
index 81ac9bb4f39b..9f8ccb735c19 100644
--- a/drivers/serial/netx-serial.c
+++ b/drivers/serial/netx-serial.c
@@ -203,7 +203,7 @@ static void netx_txint(struct uart_port *port)
203static void netx_rxint(struct uart_port *port) 203static void netx_rxint(struct uart_port *port)
204{ 204{
205 unsigned char rx, flg, status; 205 unsigned char rx, flg, status;
206 struct tty_struct *tty = port->info->tty; 206 struct tty_struct *tty = port->info->port.tty;
207 207
208 while (!(readl(port->membase + UART_FR) & FR_RXFE)) { 208 while (!(readl(port->membase + UART_FR) & FR_RXFE)) {
209 rx = readl(port->membase + UART_DR); 209 rx = readl(port->membase + UART_DR);
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 794bd0f50d73..317b061f7641 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -242,12 +242,12 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap)
242 } 242 }
243 243
244 /* Sanity check, make sure the old bug is no longer happening */ 244 /* Sanity check, make sure the old bug is no longer happening */
245 if (uap->port.info == NULL || uap->port.info->tty == NULL) { 245 if (uap->port.info == NULL || uap->port.info->port.tty == NULL) {
246 WARN_ON(1); 246 WARN_ON(1);
247 (void)read_zsdata(uap); 247 (void)read_zsdata(uap);
248 return NULL; 248 return NULL;
249 } 249 }
250 tty = uap->port.info->tty; 250 tty = uap->port.info->port.tty;
251 251
252 while (1) { 252 while (1) {
253 error = 0; 253 error = 0;
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index d0e5a79ea635..22e30d21225e 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -181,7 +181,7 @@ static void pnx8xxx_enable_ms(struct uart_port *port)
181 181
182static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport) 182static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
183{ 183{
184 struct tty_struct *tty = sport->port.info->tty; 184 struct tty_struct *tty = sport->port.info->port.tty;
185 unsigned int status, ch, flg; 185 unsigned int status, ch, flg;
186 186
187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | 187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
@@ -824,7 +824,7 @@ static int __init pnx8xxx_serial_init(void)
824{ 824{
825 int ret; 825 int ret;
826 826
827 printk(KERN_INFO "Serial: PNX8XXX driver $Revision: 1.2 $\n"); 827 printk(KERN_INFO "Serial: PNX8XXX driver\n");
828 828
829 pnx8xxx_init_ports(); 829 pnx8xxx_init_ports();
830 830
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index b4f7ffb7688d..b9a93f326fb8 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -101,7 +101,7 @@ static void serial_pxa_stop_rx(struct uart_port *port)
101 101
102static inline void receive_chars(struct uart_pxa_port *up, int *status) 102static inline void receive_chars(struct uart_pxa_port *up, int *status)
103{ 103{
104 struct tty_struct *tty = up->port.info->tty; 104 struct tty_struct *tty = up->port.info->port.tty;
105 unsigned int ch, flag; 105 unsigned int ch, flag;
106 int max_count = 256; 106 int max_count = 256;
107 107
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 62b38582f5e9..a5e76cc18073 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -20,9 +20,6 @@
20 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 * $Id: sa1100.c,v 1.50 2002/07/29 14:41:04 rmk Exp $
25 *
26 */ 23 */
27 24
28#if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 25#if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
@@ -192,7 +189,7 @@ static void sa1100_enable_ms(struct uart_port *port)
192static void 189static void
193sa1100_rx_chars(struct sa1100_port *sport) 190sa1100_rx_chars(struct sa1100_port *sport)
194{ 191{
195 struct tty_struct *tty = sport->port.info->tty; 192 struct tty_struct *tty = sport->port.info->port.tty;
196 unsigned int status, ch, flg; 193 unsigned int status, ch, flg;
197 194
198 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | 195 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
@@ -892,7 +889,7 @@ static int __init sa1100_serial_init(void)
892{ 889{
893 int ret; 890 int ret;
894 891
895 printk(KERN_INFO "Serial: SA11x0 driver $Revision: 1.50 $\n"); 892 printk(KERN_INFO "Serial: SA11x0 driver\n");
896 893
897 sa1100_init_ports(); 894 sa1100_init_ports();
898 895
@@ -915,7 +912,7 @@ module_init(sa1100_serial_init);
915module_exit(sa1100_serial_exit); 912module_exit(sa1100_serial_exit);
916 913
917MODULE_AUTHOR("Deep Blue Solutions Ltd"); 914MODULE_AUTHOR("Deep Blue Solutions Ltd");
918MODULE_DESCRIPTION("SA1100 generic serial port driver $Revision: 1.50 $"); 915MODULE_DESCRIPTION("SA1100 generic serial port driver");
919MODULE_LICENSE("GPL"); 916MODULE_LICENSE("GPL");
920MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR); 917MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR);
921MODULE_ALIAS("platform:sa11x0-uart"); 918MODULE_ALIAS("platform:sa11x0-uart");
diff --git a/drivers/serial/sb1250-duart.c b/drivers/serial/sb1250-duart.c
index f8e1447a022a..a4fb343a08da 100644
--- a/drivers/serial/sb1250-duart.c
+++ b/drivers/serial/sb1250-duart.c
@@ -384,7 +384,7 @@ static void sbd_receive_chars(struct sbd_port *sport)
384 uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag); 384 uart_insert_char(uport, status, M_DUART_OVRUN_ERR, ch, flag);
385 } 385 }
386 386
387 tty_flip_buffer_push(uport->info->tty); 387 tty_flip_buffer_push(uport->info->port.tty);
388} 388}
389 389
390static void sbd_transmit_chars(struct sbd_port *sport) 390static void sbd_transmit_chars(struct sbd_port *sport)
diff --git a/drivers/serial/sc26xx.c b/drivers/serial/sc26xx.c
index ae2a9e2df777..e0be11ceaa25 100644
--- a/drivers/serial/sc26xx.c
+++ b/drivers/serial/sc26xx.c
@@ -141,7 +141,7 @@ static struct tty_struct *receive_chars(struct uart_port *port)
141 u8 status; 141 u8 status;
142 142
143 if (port->info != NULL) /* Unopened serial console */ 143 if (port->info != NULL) /* Unopened serial console */
144 tty = port->info->tty; 144 tty = port->info->port.tty;
145 145
146 while (limit-- > 0) { 146 while (limit-- > 0) {
147 status = READ_SC_PORT(port, SR); 147 status = READ_SC_PORT(port, SR);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 42d2e108b679..0bce1fe2c62a 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -50,7 +50,7 @@ static struct lock_class_key port_lock_key;
50 50
51#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 51#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
52 52
53#define uart_users(state) ((state)->count + ((state)->info ? (state)->info->blocked_open : 0)) 53#define uart_users(state) ((state)->count + ((state)->info ? (state)->info->port.blocked_open : 0))
54 54
55#ifdef CONFIG_SERIAL_CORE_CONSOLE 55#ifdef CONFIG_SERIAL_CORE_CONSOLE
56#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line) 56#define uart_console(port) ((port)->cons && (port)->cons->index == (port)->line)
@@ -113,7 +113,7 @@ static void uart_start(struct tty_struct *tty)
113static void uart_tasklet_action(unsigned long data) 113static void uart_tasklet_action(unsigned long data)
114{ 114{
115 struct uart_state *state = (struct uart_state *)data; 115 struct uart_state *state = (struct uart_state *)data;
116 tty_wakeup(state->info->tty); 116 tty_wakeup(state->info->port.tty);
117} 117}
118 118
119static inline void 119static inline void
@@ -135,7 +135,7 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)
135 135
136/* 136/*
137 * Startup the port. This will be called once per open. All calls 137 * Startup the port. This will be called once per open. All calls
138 * will be serialised by the per-port semaphore. 138 * will be serialised by the per-port mutex.
139 */ 139 */
140static int uart_startup(struct uart_state *state, int init_hw) 140static int uart_startup(struct uart_state *state, int init_hw)
141{ 141{
@@ -152,7 +152,7 @@ static int uart_startup(struct uart_state *state, int init_hw)
152 * once we have successfully opened the port. Also set 152 * once we have successfully opened the port. Also set
153 * up the tty->alt_speed kludge 153 * up the tty->alt_speed kludge
154 */ 154 */
155 set_bit(TTY_IO_ERROR, &info->tty->flags); 155 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
156 156
157 if (port->type == PORT_UNKNOWN) 157 if (port->type == PORT_UNKNOWN)
158 return 0; 158 return 0;
@@ -162,6 +162,7 @@ static int uart_startup(struct uart_state *state, int init_hw)
162 * buffer. 162 * buffer.
163 */ 163 */
164 if (!info->xmit.buf) { 164 if (!info->xmit.buf) {
165 /* This is protected by the per port mutex */
165 page = get_zeroed_page(GFP_KERNEL); 166 page = get_zeroed_page(GFP_KERNEL);
166 if (!page) 167 if (!page)
167 return -ENOMEM; 168 return -ENOMEM;
@@ -182,20 +183,20 @@ static int uart_startup(struct uart_state *state, int init_hw)
182 * Setup the RTS and DTR signals once the 183 * Setup the RTS and DTR signals once the
183 * port is open and ready to respond. 184 * port is open and ready to respond.
184 */ 185 */
185 if (info->tty->termios->c_cflag & CBAUD) 186 if (info->port.tty->termios->c_cflag & CBAUD)
186 uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); 187 uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
187 } 188 }
188 189
189 if (info->flags & UIF_CTS_FLOW) { 190 if (info->flags & UIF_CTS_FLOW) {
190 spin_lock_irq(&port->lock); 191 spin_lock_irq(&port->lock);
191 if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) 192 if (!(port->ops->get_mctrl(port) & TIOCM_CTS))
192 info->tty->hw_stopped = 1; 193 info->port.tty->hw_stopped = 1;
193 spin_unlock_irq(&port->lock); 194 spin_unlock_irq(&port->lock);
194 } 195 }
195 196
196 info->flags |= UIF_INITIALIZED; 197 info->flags |= UIF_INITIALIZED;
197 198
198 clear_bit(TTY_IO_ERROR, &info->tty->flags); 199 clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
199 } 200 }
200 201
201 if (retval && capable(CAP_SYS_ADMIN)) 202 if (retval && capable(CAP_SYS_ADMIN))
@@ -217,8 +218,8 @@ static void uart_shutdown(struct uart_state *state)
217 /* 218 /*
218 * Set the TTY IO error marker 219 * Set the TTY IO error marker
219 */ 220 */
220 if (info->tty) 221 if (info->port.tty)
221 set_bit(TTY_IO_ERROR, &info->tty->flags); 222 set_bit(TTY_IO_ERROR, &info->port.tty->flags);
222 223
223 if (info->flags & UIF_INITIALIZED) { 224 if (info->flags & UIF_INITIALIZED) {
224 info->flags &= ~UIF_INITIALIZED; 225 info->flags &= ~UIF_INITIALIZED;
@@ -226,7 +227,7 @@ static void uart_shutdown(struct uart_state *state)
226 /* 227 /*
227 * Turn off DTR and RTS early. 228 * Turn off DTR and RTS early.
228 */ 229 */
229 if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) 230 if (!info->port.tty || (info->port.tty->termios->c_cflag & HUPCL))
230 uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 231 uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
231 232
232 /* 233 /*
@@ -426,7 +427,7 @@ EXPORT_SYMBOL(uart_get_divisor);
426static void 427static void
427uart_change_speed(struct uart_state *state, struct ktermios *old_termios) 428uart_change_speed(struct uart_state *state, struct ktermios *old_termios)
428{ 429{
429 struct tty_struct *tty = state->info->tty; 430 struct tty_struct *tty = state->info->port.tty;
430 struct uart_port *port = state->port; 431 struct uart_port *port = state->port;
431 struct ktermios *termios; 432 struct ktermios *termios;
432 433
@@ -573,6 +574,8 @@ static void uart_flush_buffer(struct tty_struct *tty)
573 574
574 spin_lock_irqsave(&port->lock, flags); 575 spin_lock_irqsave(&port->lock, flags);
575 uart_circ_clear(&state->info->xmit); 576 uart_circ_clear(&state->info->xmit);
577 if (port->ops->flush_buffer)
578 port->ops->flush_buffer(port);
576 spin_unlock_irqrestore(&port->lock, flags); 579 spin_unlock_irqrestore(&port->lock, flags);
577 tty_wakeup(tty); 580 tty_wakeup(tty);
578} 581}
@@ -834,8 +837,8 @@ static int uart_set_info(struct uart_state *state,
834 state->closing_wait = closing_wait; 837 state->closing_wait = closing_wait;
835 if (new_serial.xmit_fifo_size) 838 if (new_serial.xmit_fifo_size)
836 port->fifosize = new_serial.xmit_fifo_size; 839 port->fifosize = new_serial.xmit_fifo_size;
837 if (state->info->tty) 840 if (state->info->port.tty)
838 state->info->tty->low_latency = 841 state->info->port.tty->low_latency =
839 (port->flags & UPF_LOW_LATENCY) ? 1 : 0; 842 (port->flags & UPF_LOW_LATENCY) ? 1 : 0;
840 843
841 check_and_exit: 844 check_and_exit:
@@ -855,7 +858,7 @@ static int uart_set_info(struct uart_state *state,
855 printk(KERN_NOTICE 858 printk(KERN_NOTICE
856 "%s sets custom speed on %s. This " 859 "%s sets custom speed on %s. This "
857 "is deprecated.\n", current->comm, 860 "is deprecated.\n", current->comm,
858 tty_name(state->info->tty, buf)); 861 tty_name(state->info->port.tty, buf));
859 } 862 }
860 uart_change_speed(state, NULL); 863 uart_change_speed(state, NULL);
861 } 864 }
@@ -887,7 +890,7 @@ static int uart_get_lsr_info(struct uart_state *state,
887 */ 890 */
888 if (port->x_char || 891 if (port->x_char ||
889 ((uart_circ_chars_pending(&state->info->xmit) > 0) && 892 ((uart_circ_chars_pending(&state->info->xmit) > 0) &&
890 !state->info->tty->stopped && !state->info->tty->hw_stopped)) 893 !state->info->port.tty->stopped && !state->info->port.tty->hw_stopped))
891 result &= ~TIOCSER_TEMT; 894 result &= ~TIOCSER_TEMT;
892 895
893 return put_user(result, value); 896 return put_user(result, value);
@@ -1237,7 +1240,7 @@ static void uart_set_termios(struct tty_struct *tty,
1237 */ 1240 */
1238 if (!(old_termios->c_cflag & CLOCAL) && 1241 if (!(old_termios->c_cflag & CLOCAL) &&
1239 (tty->termios->c_cflag & CLOCAL)) 1242 (tty->termios->c_cflag & CLOCAL))
1240 wake_up_interruptible(&state->info->open_wait); 1243 wake_up_interruptible(&state->info->port.open_wait);
1241#endif 1244#endif
1242} 1245}
1243 1246
@@ -1318,9 +1321,9 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1318 tty_ldisc_flush(tty); 1321 tty_ldisc_flush(tty);
1319 1322
1320 tty->closing = 0; 1323 tty->closing = 0;
1321 state->info->tty = NULL; 1324 state->info->port.tty = NULL;
1322 1325
1323 if (state->info->blocked_open) { 1326 if (state->info->port.blocked_open) {
1324 if (state->close_delay) 1327 if (state->close_delay)
1325 msleep_interruptible(state->close_delay); 1328 msleep_interruptible(state->close_delay);
1326 } else if (!uart_console(port)) { 1329 } else if (!uart_console(port)) {
@@ -1331,7 +1334,7 @@ static void uart_close(struct tty_struct *tty, struct file *filp)
1331 * Wake up anyone trying to open this port. 1334 * Wake up anyone trying to open this port.
1332 */ 1335 */
1333 state->info->flags &= ~UIF_NORMAL_ACTIVE; 1336 state->info->flags &= ~UIF_NORMAL_ACTIVE;
1334 wake_up_interruptible(&state->info->open_wait); 1337 wake_up_interruptible(&state->info->port.open_wait);
1335 1338
1336 done: 1339 done:
1337 mutex_unlock(&state->mutex); 1340 mutex_unlock(&state->mutex);
@@ -1415,8 +1418,8 @@ static void uart_hangup(struct tty_struct *tty)
1415 uart_shutdown(state); 1418 uart_shutdown(state);
1416 state->count = 0; 1419 state->count = 0;
1417 state->info->flags &= ~UIF_NORMAL_ACTIVE; 1420 state->info->flags &= ~UIF_NORMAL_ACTIVE;
1418 state->info->tty = NULL; 1421 state->info->port.tty = NULL;
1419 wake_up_interruptible(&state->info->open_wait); 1422 wake_up_interruptible(&state->info->port.open_wait);
1420 wake_up_interruptible(&state->info->delta_msr_wait); 1423 wake_up_interruptible(&state->info->delta_msr_wait);
1421 } 1424 }
1422 mutex_unlock(&state->mutex); 1425 mutex_unlock(&state->mutex);
@@ -1430,7 +1433,7 @@ static void uart_hangup(struct tty_struct *tty)
1430 */ 1433 */
1431static void uart_update_termios(struct uart_state *state) 1434static void uart_update_termios(struct uart_state *state)
1432{ 1435{
1433 struct tty_struct *tty = state->info->tty; 1436 struct tty_struct *tty = state->info->port.tty;
1434 struct uart_port *port = state->port; 1437 struct uart_port *port = state->port;
1435 1438
1436 if (uart_console(port) && port->cons->cflag) { 1439 if (uart_console(port) && port->cons->cflag) {
@@ -1469,17 +1472,17 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1469 struct uart_port *port = state->port; 1472 struct uart_port *port = state->port;
1470 unsigned int mctrl; 1473 unsigned int mctrl;
1471 1474
1472 info->blocked_open++; 1475 info->port.blocked_open++;
1473 state->count--; 1476 state->count--;
1474 1477
1475 add_wait_queue(&info->open_wait, &wait); 1478 add_wait_queue(&info->port.open_wait, &wait);
1476 while (1) { 1479 while (1) {
1477 set_current_state(TASK_INTERRUPTIBLE); 1480 set_current_state(TASK_INTERRUPTIBLE);
1478 1481
1479 /* 1482 /*
1480 * If we have been hung up, tell userspace/restart open. 1483 * If we have been hung up, tell userspace/restart open.
1481 */ 1484 */
1482 if (tty_hung_up_p(filp) || info->tty == NULL) 1485 if (tty_hung_up_p(filp) || info->port.tty == NULL)
1483 break; 1486 break;
1484 1487
1485 /* 1488 /*
@@ -1498,8 +1501,8 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1498 * have set TTY_IO_ERROR for a non-existant port. 1501 * have set TTY_IO_ERROR for a non-existant port.
1499 */ 1502 */
1500 if ((filp->f_flags & O_NONBLOCK) || 1503 if ((filp->f_flags & O_NONBLOCK) ||
1501 (info->tty->termios->c_cflag & CLOCAL) || 1504 (info->port.tty->termios->c_cflag & CLOCAL) ||
1502 (info->tty->flags & (1 << TTY_IO_ERROR))) 1505 (info->port.tty->flags & (1 << TTY_IO_ERROR)))
1503 break; 1506 break;
1504 1507
1505 /* 1508 /*
@@ -1507,7 +1510,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1507 * not set RTS here - we want to make sure we catch 1510 * not set RTS here - we want to make sure we catch
1508 * the data from the modem. 1511 * the data from the modem.
1509 */ 1512 */
1510 if (info->tty->termios->c_cflag & CBAUD) 1513 if (info->port.tty->termios->c_cflag & CBAUD)
1511 uart_set_mctrl(port, TIOCM_DTR); 1514 uart_set_mctrl(port, TIOCM_DTR);
1512 1515
1513 /* 1516 /*
@@ -1529,15 +1532,15 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1529 break; 1532 break;
1530 } 1533 }
1531 set_current_state(TASK_RUNNING); 1534 set_current_state(TASK_RUNNING);
1532 remove_wait_queue(&info->open_wait, &wait); 1535 remove_wait_queue(&info->port.open_wait, &wait);
1533 1536
1534 state->count++; 1537 state->count++;
1535 info->blocked_open--; 1538 info->port.blocked_open--;
1536 1539
1537 if (signal_pending(current)) 1540 if (signal_pending(current))
1538 return -ERESTARTSYS; 1541 return -ERESTARTSYS;
1539 1542
1540 if (!info->tty || tty_hung_up_p(filp)) 1543 if (!info->port.tty || tty_hung_up_p(filp))
1541 return -EAGAIN; 1544 return -EAGAIN;
1542 1545
1543 return 0; 1546 return 0;
@@ -1560,10 +1563,13 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1560 goto err_unlock; 1563 goto err_unlock;
1561 } 1564 }
1562 1565
1566 /* BKL: RACE HERE - LEAK */
1567 /* We should move this into the uart_state structure and kill off
1568 this whole complexity */
1563 if (!state->info) { 1569 if (!state->info) {
1564 state->info = kzalloc(sizeof(struct uart_info), GFP_KERNEL); 1570 state->info = kzalloc(sizeof(struct uart_info), GFP_KERNEL);
1565 if (state->info) { 1571 if (state->info) {
1566 init_waitqueue_head(&state->info->open_wait); 1572 init_waitqueue_head(&state->info->port.open_wait);
1567 init_waitqueue_head(&state->info->delta_msr_wait); 1573 init_waitqueue_head(&state->info->delta_msr_wait);
1568 1574
1569 /* 1575 /*
@@ -1620,7 +1626,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1620 * be re-entered while allocating the info structure, or while we 1626 * be re-entered while allocating the info structure, or while we
1621 * request any IRQs that the driver may need. This also has the nice 1627 * request any IRQs that the driver may need. This also has the nice
1622 * side-effect that it delays the action of uart_hangup, so we can 1628 * side-effect that it delays the action of uart_hangup, so we can
1623 * guarantee that info->tty will always contain something reasonable. 1629 * guarantee that info->port.tty will always contain something reasonable.
1624 */ 1630 */
1625 state = uart_get(drv, line); 1631 state = uart_get(drv, line);
1626 if (IS_ERR(state)) { 1632 if (IS_ERR(state)) {
@@ -1636,7 +1642,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
1636 tty->driver_data = state; 1642 tty->driver_data = state;
1637 tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0; 1643 tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0;
1638 tty->alt_speed = 0; 1644 tty->alt_speed = 0;
1639 state->info->tty = tty; 1645 state->info->port.tty = tty;
1640 1646
1641 /* 1647 /*
1642 * If the port is in the middle of closing, bail out now. 1648 * If the port is in the middle of closing, bail out now.
@@ -2099,8 +2105,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2099 /* 2105 /*
2100 * If that's unset, use the tty termios setting. 2106 * If that's unset, use the tty termios setting.
2101 */ 2107 */
2102 if (state->info && state->info->tty && termios.c_cflag == 0) 2108 if (state->info && state->info->port.tty && termios.c_cflag == 0)
2103 termios = *state->info->tty->termios; 2109 termios = *state->info->port.tty->termios;
2104 2110
2105 uart_change_pm(state, 0); 2111 uart_change_pm(state, 0);
2106 port->ops->set_termios(port, &termios, NULL); 2112 port->ops->set_termios(port, &termios, NULL);
@@ -2519,8 +2525,8 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2519 tty_unregister_device(drv->tty_driver, port->line); 2525 tty_unregister_device(drv->tty_driver, port->line);
2520 2526
2521 info = state->info; 2527 info = state->info;
2522 if (info && info->tty) 2528 if (info && info->port.tty)
2523 tty_vhangup(info->tty); 2529 tty_vhangup(info->port.tty);
2524 2530
2525 /* 2531 /*
2526 * All users of this port should now be disconnected from 2532 * All users of this port should now be disconnected from
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index 8721afe1ae4f..0edbc5dd378b 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -108,7 +108,7 @@ static void ks8695uart_disable_ms(struct uart_port *port)
108static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id) 108static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
109{ 109{
110 struct uart_port *port = dev_id; 110 struct uart_port *port = dev_id;
111 struct tty_struct *tty = port->info->tty; 111 struct tty_struct *tty = port->info->port.tty;
112 unsigned int status, ch, lsr, flg, max_count = 256; 112 unsigned int status, ch, lsr, flg, max_count = 256;
113 113
114 status = UART_GET_LSR(port); /* clears pending LSR interrupts */ 114 status = UART_GET_LSR(port); /* clears pending LSR interrupts */
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index eb18d429752d..cb49a5ac022f 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -137,7 +137,7 @@ static void lh7a40xuart_enable_ms (struct uart_port* port)
137 137
138static void lh7a40xuart_rx_chars (struct uart_port* port) 138static void lh7a40xuart_rx_chars (struct uart_port* port)
139{ 139{
140 struct tty_struct* tty = port->info->tty; 140 struct tty_struct* tty = port->info->port.tty;
141 int cbRxMax = 256; /* (Gross) limit on receive */ 141 int cbRxMax = 256; /* (Gross) limit on receive */
142 unsigned int data; /* Received data and status */ 142 unsigned int data; /* Received data and status */
143 unsigned int flag; 143 unsigned int flag;
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index ce6ee92b3a1b..208e42ba9455 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -521,7 +521,7 @@ static void sci_transmit_chars(struct uart_port *port)
521static inline void sci_receive_chars(struct uart_port *port) 521static inline void sci_receive_chars(struct uart_port *port)
522{ 522{
523 struct sci_port *sci_port = (struct sci_port *)port; 523 struct sci_port *sci_port = (struct sci_port *)port;
524 struct tty_struct *tty = port->info->tty; 524 struct tty_struct *tty = port->info->port.tty;
525 int i, count, copied = 0; 525 int i, count, copied = 0;
526 unsigned short status; 526 unsigned short status;
527 unsigned char flag; 527 unsigned char flag;
@@ -642,7 +642,7 @@ static inline int sci_handle_errors(struct uart_port *port)
642{ 642{
643 int copied = 0; 643 int copied = 0;
644 unsigned short status = sci_in(port, SCxSR); 644 unsigned short status = sci_in(port, SCxSR);
645 struct tty_struct *tty = port->info->tty; 645 struct tty_struct *tty = port->info->port.tty;
646 646
647 if (status & SCxSR_ORER(port)) { 647 if (status & SCxSR_ORER(port)) {
648 /* overrun error */ 648 /* overrun error */
@@ -692,7 +692,7 @@ static inline int sci_handle_breaks(struct uart_port *port)
692{ 692{
693 int copied = 0; 693 int copied = 0;
694 unsigned short status = sci_in(port, SCxSR); 694 unsigned short status = sci_in(port, SCxSR);
695 struct tty_struct *tty = port->info->tty; 695 struct tty_struct *tty = port->info->port.tty;
696 struct sci_port *s = &sci_ports[port->line]; 696 struct sci_port *s = &sci_ports[port->line];
697 697
698 if (uart_handle_break(port)) 698 if (uart_handle_break(port))
@@ -762,7 +762,7 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr)
762 } else { 762 } else {
763#if defined(SCIF_ORER) 763#if defined(SCIF_ORER)
764 if((sci_in(port, SCLSR) & SCIF_ORER) != 0) { 764 if((sci_in(port, SCLSR) & SCIF_ORER) != 0) {
765 struct tty_struct *tty = port->info->tty; 765 struct tty_struct *tty = port->info->port.tty;
766 766
767 sci_out(port, SCLSR, 0); 767 sci_out(port, SCLSR, 0);
768 tty_insert_flip_char(tty, 0, TTY_OVERRUN); 768 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index 019da2e05f0b..b73e3c0056cd 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -471,7 +471,7 @@ sn_receive_chars(struct sn_cons_port *port, unsigned long flags)
471 471
472 if (port->sc_port.info) { 472 if (port->sc_port.info) {
473 /* The serial_core stuffs are initilized, use them */ 473 /* The serial_core stuffs are initilized, use them */
474 tty = port->sc_port.info->tty; 474 tty = port->sc_port.info->port.tty;
475 } 475 }
476 else { 476 else {
477 /* Not registered yet - can't pass to tty layer. */ 477 /* Not registered yet - can't pass to tty layer. */
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 2847336742d7..aeeec5588afd 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -185,7 +185,7 @@ static struct tty_struct *receive_chars(struct uart_port *port)
185 struct tty_struct *tty = NULL; 185 struct tty_struct *tty = NULL;
186 186
187 if (port->info != NULL) /* Unopened serial console */ 187 if (port->info != NULL) /* Unopened serial console */
188 tty = port->info->tty; 188 tty = port->info->port.tty;
189 189
190 if (sunhv_ops->receive_chars(port, tty)) 190 if (sunhv_ops->receive_chars(port, tty))
191 sun_do_break(); 191 sun_do_break();
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 9ff5b38f3bee..15ee497e1c78 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -118,7 +118,7 @@ receive_chars(struct uart_sunsab_port *up,
118 int i; 118 int i;
119 119
120 if (up->port.info != NULL) /* Unopened serial console */ 120 if (up->port.info != NULL) /* Unopened serial console */
121 tty = up->port.info->tty; 121 tty = up->port.info->port.tty;
122 122
123 /* Read number of BYTES (Character + Status) available. */ 123 /* Read number of BYTES (Character + Status) available. */
124 if (stat->sreg.isr0 & SAB82532_ISR0_RPF) { 124 if (stat->sreg.isr0 & SAB82532_ISR0_RPF) {
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 03806a935209..e24e68235088 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1,4 +1,4 @@
1/* $Id: su.c,v 1.55 2002/01/08 16:00:16 davem Exp $ 1/*
2 * su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI 2 * su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI
3 * 3 *
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be) 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
@@ -311,7 +311,7 @@ static void sunsu_enable_ms(struct uart_port *port)
311static struct tty_struct * 311static struct tty_struct *
312receive_chars(struct uart_sunsu_port *up, unsigned char *status) 312receive_chars(struct uart_sunsu_port *up, unsigned char *status)
313{ 313{
314 struct tty_struct *tty = up->port.info->tty; 314 struct tty_struct *tty = up->port.info->port.tty;
315 unsigned char ch, flag; 315 unsigned char ch, flag;
316 int max_count = 256; 316 int max_count = 256;
317 int saw_console_brk = 0; 317 int saw_console_brk = 0;
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 7e9fa5ef0eb7..0f3d69b86d67 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -329,8 +329,8 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up,
329 329
330 tty = NULL; 330 tty = NULL;
331 if (up->port.info != NULL && /* Unopened serial console */ 331 if (up->port.info != NULL && /* Unopened serial console */
332 up->port.info->tty != NULL) /* Keyboard || mouse */ 332 up->port.info->port.tty != NULL) /* Keyboard || mouse */
333 tty = up->port.info->tty; 333 tty = up->port.info->port.tty;
334 334
335 for (;;) { 335 for (;;) {
336 336
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index b51c24245be4..6a3f8fb0c9dd 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -75,7 +75,7 @@ static struct uart_port ulite_ports[ULITE_NR_UARTS];
75 75
76static int ulite_receive(struct uart_port *port, int stat) 76static int ulite_receive(struct uart_port *port, int stat)
77{ 77{
78 struct tty_struct *tty = port->info->tty; 78 struct tty_struct *tty = port->info->port.tty;
79 unsigned char ch = 0; 79 unsigned char ch = 0;
80 char flag = TTY_NORMAL; 80 char flag = TTY_NORMAL;
81 81
@@ -162,7 +162,7 @@ static irqreturn_t ulite_isr(int irq, void *dev_id)
162 busy |= ulite_transmit(port, stat); 162 busy |= ulite_transmit(port, stat);
163 } while (busy); 163 } while (busy);
164 164
165 tty_flip_buffer_push(port->info->tty); 165 tty_flip_buffer_push(port->info->port.tty);
166 166
167 return IRQ_HANDLED; 167 return IRQ_HANDLED;
168} 168}
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index 566a8b42e05a..5c5d18dcb6ac 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -466,7 +466,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port)
466 int i; 466 int i;
467 unsigned char ch, *cp; 467 unsigned char ch, *cp;
468 struct uart_port *port = &qe_port->port; 468 struct uart_port *port = &qe_port->port;
469 struct tty_struct *tty = port->info->tty; 469 struct tty_struct *tty = port->info->port.tty;
470 struct qe_bd *bdp; 470 struct qe_bd *bdp;
471 u16 status; 471 u16 status;
472 unsigned int flg; 472 unsigned int flg;
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
index dd98aca6ed08..5acf061b6cd2 100644
--- a/drivers/serial/v850e_uart.c
+++ b/drivers/serial/v850e_uart.c
@@ -300,8 +300,8 @@ static irqreturn_t v850e_uart_rx_irq(int irq, void *data)
300 300
301 port->icount.rx++; 301 port->icount.rx++;
302 302
303 tty_insert_flip_char (port->info->tty, ch, ch_stat); 303 tty_insert_flip_char (port->info->port.tty, ch, ch_stat);
304 tty_schedule_flip (port->info->tty); 304 tty_schedule_flip (port->info->port.tty);
305 305
306 return IRQ_HANDLED; 306 return IRQ_HANDLED;
307} 307}
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index bb6ce6bba32f..0573f3b5175e 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -318,7 +318,7 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status)
318 char flag; 318 char flag;
319 int max_count = RX_MAX_COUNT; 319 int max_count = RX_MAX_COUNT;
320 320
321 tty = port->info->tty; 321 tty = port->info->port.tty;
322 lsr = *status; 322 lsr = *status;
323 323
324 do { 324 do {
diff --git a/drivers/serial/zs.c b/drivers/serial/zs.c
index 65f1294fd27b..bd45b6230fd8 100644
--- a/drivers/serial/zs.c
+++ b/drivers/serial/zs.c
@@ -602,7 +602,7 @@ static void zs_receive_chars(struct zs_port *zport)
602 uart_insert_char(uport, status, Rx_OVR, ch, flag); 602 uart_insert_char(uport, status, Rx_OVR, ch, flag);
603 } 603 }
604 604
605 tty_flip_buffer_push(uport->info->tty); 605 tty_flip_buffer_push(uport->info->port.tty);
606} 606}
607 607
608static void zs_raw_transmit_chars(struct zs_port *zport) 608static void zs_raw_transmit_chars(struct zs_port *zport)
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c
index 05a328c11a8b..45c154ade9ca 100644
--- a/drivers/video/amifb.c
+++ b/drivers/video/amifb.c
@@ -2383,6 +2383,9 @@ default_chipset:
2383 goto amifb_error; 2383 goto amifb_error;
2384 } 2384 }
2385 2385
2386 fb_videomode_to_modelist(ami_modedb, NUM_TOTAL_MODES,
2387 &fb_info.modelist);
2388
2386 round_down_bpp = 0; 2389 round_down_bpp = 0;
2387 chipptr = chipalloc(fb_info.fix.smem_len+ 2390 chipptr = chipalloc(fb_info.fix.smem_len+
2388 SPRITEMEMSIZE+ 2391 SPRITEMEMSIZE+
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index dff35474b854..fa55d356b535 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -3110,7 +3110,7 @@ int __init atafb_init(void)
3110 printk("atafb_init: start\n"); 3110 printk("atafb_init: start\n");
3111 3111
3112 if (!MACH_IS_ATARI) 3112 if (!MACH_IS_ATARI)
3113 return -ENXIO; 3113 return -ENODEV;
3114 3114
3115 do { 3115 do {
3116#ifdef ATAFB_EXT 3116#ifdef ATAFB_EXT
@@ -3230,6 +3230,9 @@ int __init atafb_init(void)
3230 return -EINVAL; 3230 return -EINVAL;
3231 } 3231 }
3232 3232
3233 fb_videomode_to_modelist(atafb_modedb, NUM_TOTAL_MODES,
3234 &fb_info.modelist);
3235
3233 atafb_set_disp(&fb_info); 3236 atafb_set_disp(&fb_info);
3234 3237
3235 fb_alloc_cmap(&(fb_info.cmap), 1 << fb_info.var.bits_per_pixel, 0); 3238 fb_alloc_cmap(&(fb_info.cmap), 1 << fb_info.var.bits_per_pixel, 0);
diff --git a/drivers/video/c2p.c b/drivers/video/c2p.c
index 5c30bbd33054..376bc07ff952 100644
--- a/drivers/video/c2p.c
+++ b/drivers/video/c2p.c
@@ -12,6 +12,7 @@
12 * for more details. 12 * for more details.
13 */ 13 */
14 14
15#include <linux/module.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include "c2p.h" 17#include "c2p.h"
17 18
@@ -226,4 +227,6 @@ void c2p(u8 *dst, const u8 *src, u32 dx, u32 dy, u32 width, u32 height,
226 dst += dst_nextline; 227 dst += dst_nextline;
227 } 228 }
228} 229}
230EXPORT_SYMBOL_GPL(c2p);
229 231
232MODULE_LICENSE("GPL");
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c
index 099b6fb5b5cb..d47c47fc048f 100644
--- a/drivers/zorro/proc.c
+++ b/drivers/zorro/proc.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: proc.c,v 1.1.2.1 1998/06/07 23:21:01 geert Exp $
3 *
4 * Procfs interface for the Zorro bus. 2 * Procfs interface for the Zorro bus.
5 * 3 *
6 * Copyright (C) 1998-2003 Geert Uytterhoeven 4 * Copyright (C) 1998-2003 Geert Uytterhoeven
@@ -160,4 +158,4 @@ static int __init zorro_proc_init(void)
160 return 0; 158 return 0;
161} 159}
162 160
163__initcall(zorro_proc_init); 161device_initcall(zorro_proc_init);
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 808b4f8675c5..3da712cc7708 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -15,6 +15,7 @@
15#include <linux/zorro.h> 15#include <linux/zorro.h>
16#include <linux/stat.h> 16#include <linux/stat.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/fs.h>
18 19
19#include "zorro.h" 20#include "zorro.h"
20 21
@@ -56,12 +57,6 @@ static ssize_t zorro_read_config(struct kobject *kobj,
56 struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device, 57 struct zorro_dev *z = to_zorro_dev(container_of(kobj, struct device,
57 kobj)); 58 kobj));
58 struct ConfigDev cd; 59 struct ConfigDev cd;
59 unsigned int size = sizeof(cd);
60
61 if (off > size)
62 return 0;
63 if (off+count > size)
64 count = size-off;
65 60
66 /* Construct a ConfigDev */ 61 /* Construct a ConfigDev */
67 memset(&cd, 0, sizeof(cd)); 62 memset(&cd, 0, sizeof(cd));
@@ -71,8 +66,7 @@ static ssize_t zorro_read_config(struct kobject *kobj,
71 cd.cd_BoardAddr = (void *)zorro_resource_start(z); 66 cd.cd_BoardAddr = (void *)zorro_resource_start(z);
72 cd.cd_BoardSize = zorro_resource_len(z); 67 cd.cd_BoardSize = zorro_resource_len(z);
73 68
74 memcpy(buf, (void *)&cd+off, count); 69 return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));
75 return count;
76} 70}
77 71
78static struct bin_attribute zorro_config_attr = { 72static struct bin_attribute zorro_config_attr = {
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index 4cc42b64820c..dff16d9767d8 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: zorro.c,v 1.1.2.1 1998/06/07 23:21:02 geert Exp $
3 *
4 * Zorro Bus Services 2 * Zorro Bus Services
5 * 3 *
6 * Copyright (C) 1995-2003 Geert Uytterhoeven 4 * Copyright (C) 1995-2003 Geert Uytterhoeven
diff --git a/drivers/zorro/zorro.ids b/drivers/zorro/zorro.ids
index 560fef2a7b1c..0c0f99e2dd62 100644
--- a/drivers/zorro/zorro.ids
+++ b/drivers/zorro/zorro.ids
@@ -4,8 +4,6 @@
4# Maintained by Geert Uytterhoeven <zorro@linux-m68k.org> 4# Maintained by Geert Uytterhoeven <zorro@linux-m68k.org>
5# If you have any new entries, please send them to the maintainer. 5# If you have any new entries, please send them to the maintainer.
6# 6#
7# $Id: zorro.ids,v 1.19 2002/10/14 13:08:58 geert Exp $
8#
9 7
10# Manufacturers and Products. Please keep sorted. 8# Manufacturers and Products. Please keep sorted.
11 9
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 0e64312a084c..179589be063a 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1027,9 +1027,10 @@ EXPORT_SYMBOL(configfs_undepend_item);
1027 1027
1028static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1028static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1029{ 1029{
1030 int ret, module_got = 0; 1030 int ret = 0;
1031 struct config_group *group; 1031 int module_got = 0;
1032 struct config_item *item; 1032 struct config_group *group = NULL;
1033 struct config_item *item = NULL;
1033 struct config_item *parent_item; 1034 struct config_item *parent_item;
1034 struct configfs_subsystem *subsys; 1035 struct configfs_subsystem *subsys;
1035 struct configfs_dirent *sd; 1036 struct configfs_dirent *sd;
@@ -1070,25 +1071,30 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1070 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name); 1071 snprintf(name, dentry->d_name.len + 1, "%s", dentry->d_name.name);
1071 1072
1072 mutex_lock(&subsys->su_mutex); 1073 mutex_lock(&subsys->su_mutex);
1073 group = NULL;
1074 item = NULL;
1075 if (type->ct_group_ops->make_group) { 1074 if (type->ct_group_ops->make_group) {
1076 ret = type->ct_group_ops->make_group(to_config_group(parent_item), name, &group); 1075 group = type->ct_group_ops->make_group(to_config_group(parent_item), name);
1077 if (!ret) { 1076 if (!group)
1077 group = ERR_PTR(-ENOMEM);
1078 if (!IS_ERR(group)) {
1078 link_group(to_config_group(parent_item), group); 1079 link_group(to_config_group(parent_item), group);
1079 item = &group->cg_item; 1080 item = &group->cg_item;
1080 } 1081 } else
1082 ret = PTR_ERR(group);
1081 } else { 1083 } else {
1082 ret = type->ct_group_ops->make_item(to_config_group(parent_item), name, &item); 1084 item = type->ct_group_ops->make_item(to_config_group(parent_item), name);
1083 if (!ret) 1085 if (!item)
1086 item = ERR_PTR(-ENOMEM);
1087 if (!IS_ERR(item))
1084 link_obj(parent_item, item); 1088 link_obj(parent_item, item);
1089 else
1090 ret = PTR_ERR(item);
1085 } 1091 }
1086 mutex_unlock(&subsys->su_mutex); 1092 mutex_unlock(&subsys->su_mutex);
1087 1093
1088 kfree(name); 1094 kfree(name);
1089 if (ret) { 1095 if (ret) {
1090 /* 1096 /*
1091 * If ret != 0, then link_obj() was never called. 1097 * If item == NULL, then link_obj() was never called.
1092 * There are no extra references to clean up. 1098 * There are no extra references to clean up.
1093 */ 1099 */
1094 goto out_put; 1100 goto out_put;
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
index 492d8caaaf25..c4e7d721bd8d 100644
--- a/fs/dlm/config.c
+++ b/fs/dlm/config.c
@@ -41,20 +41,16 @@ struct comm;
41struct nodes; 41struct nodes;
42struct node; 42struct node;
43 43
44static int make_cluster(struct config_group *, const char *, 44static struct config_group *make_cluster(struct config_group *, const char *);
45 struct config_group **);
46static void drop_cluster(struct config_group *, struct config_item *); 45static void drop_cluster(struct config_group *, struct config_item *);
47static void release_cluster(struct config_item *); 46static void release_cluster(struct config_item *);
48static int make_space(struct config_group *, const char *, 47static struct config_group *make_space(struct config_group *, const char *);
49 struct config_group **);
50static void drop_space(struct config_group *, struct config_item *); 48static void drop_space(struct config_group *, struct config_item *);
51static void release_space(struct config_item *); 49static void release_space(struct config_item *);
52static int make_comm(struct config_group *, const char *, 50static struct config_item *make_comm(struct config_group *, const char *);
53 struct config_item **);
54static void drop_comm(struct config_group *, struct config_item *); 51static void drop_comm(struct config_group *, struct config_item *);
55static void release_comm(struct config_item *); 52static void release_comm(struct config_item *);
56static int make_node(struct config_group *, const char *, 53static struct config_item *make_node(struct config_group *, const char *);
57 struct config_item **);
58static void drop_node(struct config_group *, struct config_item *); 54static void drop_node(struct config_group *, struct config_item *);
59static void release_node(struct config_item *); 55static void release_node(struct config_item *);
60 56
@@ -396,8 +392,8 @@ static struct node *to_node(struct config_item *i)
396 return i ? container_of(i, struct node, item) : NULL; 392 return i ? container_of(i, struct node, item) : NULL;
397} 393}
398 394
399static int make_cluster(struct config_group *g, const char *name, 395static struct config_group *make_cluster(struct config_group *g,
400 struct config_group **new_g) 396 const char *name)
401{ 397{
402 struct cluster *cl = NULL; 398 struct cluster *cl = NULL;
403 struct spaces *sps = NULL; 399 struct spaces *sps = NULL;
@@ -435,15 +431,14 @@ static int make_cluster(struct config_group *g, const char *name,
435 431
436 space_list = &sps->ss_group; 432 space_list = &sps->ss_group;
437 comm_list = &cms->cs_group; 433 comm_list = &cms->cs_group;
438 *new_g = &cl->group; 434 return &cl->group;
439 return 0;
440 435
441 fail: 436 fail:
442 kfree(cl); 437 kfree(cl);
443 kfree(gps); 438 kfree(gps);
444 kfree(sps); 439 kfree(sps);
445 kfree(cms); 440 kfree(cms);
446 return -ENOMEM; 441 return ERR_PTR(-ENOMEM);
447} 442}
448 443
449static void drop_cluster(struct config_group *g, struct config_item *i) 444static void drop_cluster(struct config_group *g, struct config_item *i)
@@ -471,8 +466,7 @@ static void release_cluster(struct config_item *i)
471 kfree(cl); 466 kfree(cl);
472} 467}
473 468
474static int make_space(struct config_group *g, const char *name, 469static struct config_group *make_space(struct config_group *g, const char *name)
475 struct config_group **new_g)
476{ 470{
477 struct space *sp = NULL; 471 struct space *sp = NULL;
478 struct nodes *nds = NULL; 472 struct nodes *nds = NULL;
@@ -495,14 +489,13 @@ static int make_space(struct config_group *g, const char *name,
495 INIT_LIST_HEAD(&sp->members); 489 INIT_LIST_HEAD(&sp->members);
496 mutex_init(&sp->members_lock); 490 mutex_init(&sp->members_lock);
497 sp->members_count = 0; 491 sp->members_count = 0;
498 *new_g = &sp->group; 492 return &sp->group;
499 return 0;
500 493
501 fail: 494 fail:
502 kfree(sp); 495 kfree(sp);
503 kfree(gps); 496 kfree(gps);
504 kfree(nds); 497 kfree(nds);
505 return -ENOMEM; 498 return ERR_PTR(-ENOMEM);
506} 499}
507 500
508static void drop_space(struct config_group *g, struct config_item *i) 501static void drop_space(struct config_group *g, struct config_item *i)
@@ -529,21 +522,19 @@ static void release_space(struct config_item *i)
529 kfree(sp); 522 kfree(sp);
530} 523}
531 524
532static int make_comm(struct config_group *g, const char *name, 525static struct config_item *make_comm(struct config_group *g, const char *name)
533 struct config_item **new_i)
534{ 526{
535 struct comm *cm; 527 struct comm *cm;
536 528
537 cm = kzalloc(sizeof(struct comm), GFP_KERNEL); 529 cm = kzalloc(sizeof(struct comm), GFP_KERNEL);
538 if (!cm) 530 if (!cm)
539 return -ENOMEM; 531 return ERR_PTR(-ENOMEM);
540 532
541 config_item_init_type_name(&cm->item, name, &comm_type); 533 config_item_init_type_name(&cm->item, name, &comm_type);
542 cm->nodeid = -1; 534 cm->nodeid = -1;
543 cm->local = 0; 535 cm->local = 0;
544 cm->addr_count = 0; 536 cm->addr_count = 0;
545 *new_i = &cm->item; 537 return &cm->item;
546 return 0;
547} 538}
548 539
549static void drop_comm(struct config_group *g, struct config_item *i) 540static void drop_comm(struct config_group *g, struct config_item *i)
@@ -563,15 +554,14 @@ static void release_comm(struct config_item *i)
563 kfree(cm); 554 kfree(cm);
564} 555}
565 556
566static int make_node(struct config_group *g, const char *name, 557static struct config_item *make_node(struct config_group *g, const char *name)
567 struct config_item **new_i)
568{ 558{
569 struct space *sp = to_space(g->cg_item.ci_parent); 559 struct space *sp = to_space(g->cg_item.ci_parent);
570 struct node *nd; 560 struct node *nd;
571 561
572 nd = kzalloc(sizeof(struct node), GFP_KERNEL); 562 nd = kzalloc(sizeof(struct node), GFP_KERNEL);
573 if (!nd) 563 if (!nd)
574 return -ENOMEM; 564 return ERR_PTR(-ENOMEM);
575 565
576 config_item_init_type_name(&nd->item, name, &node_type); 566 config_item_init_type_name(&nd->item, name, &node_type);
577 nd->nodeid = -1; 567 nd->nodeid = -1;
@@ -583,8 +573,7 @@ static int make_node(struct config_group *g, const char *name,
583 sp->members_count++; 573 sp->members_count++;
584 mutex_unlock(&sp->members_lock); 574 mutex_unlock(&sp->members_lock);
585 575
586 *new_i = &nd->item; 576 return &nd->item;
587 return 0;
588} 577}
589 578
590static void drop_node(struct config_group *g, struct config_item *i) 579static void drop_node(struct config_group *g, struct config_item *i)
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 443d108211ab..7dce1612553e 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1489,31 +1489,22 @@ static struct o2hb_heartbeat_group *to_o2hb_heartbeat_group(struct config_group
1489 : NULL; 1489 : NULL;
1490} 1490}
1491 1491
1492static int o2hb_heartbeat_group_make_item(struct config_group *group, 1492static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *group,
1493 const char *name, 1493 const char *name)
1494 struct config_item **new_item)
1495{ 1494{
1496 struct o2hb_region *reg = NULL; 1495 struct o2hb_region *reg = NULL;
1497 int ret = 0;
1498 1496
1499 reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL); 1497 reg = kzalloc(sizeof(struct o2hb_region), GFP_KERNEL);
1500 if (reg == NULL) { 1498 if (reg == NULL)
1501 ret = -ENOMEM; 1499 return ERR_PTR(-ENOMEM);
1502 goto out;
1503 }
1504 1500
1505 config_item_init_type_name(&reg->hr_item, name, &o2hb_region_type); 1501 config_item_init_type_name(&reg->hr_item, name, &o2hb_region_type);
1506 1502
1507 *new_item = &reg->hr_item;
1508
1509 spin_lock(&o2hb_live_lock); 1503 spin_lock(&o2hb_live_lock);
1510 list_add_tail(&reg->hr_all_item, &o2hb_all_regions); 1504 list_add_tail(&reg->hr_all_item, &o2hb_all_regions);
1511 spin_unlock(&o2hb_live_lock); 1505 spin_unlock(&o2hb_live_lock);
1512out:
1513 if (ret)
1514 kfree(reg);
1515 1506
1516 return ret; 1507 return &reg->hr_item;
1517} 1508}
1518 1509
1519static void o2hb_heartbeat_group_drop_item(struct config_group *group, 1510static void o2hb_heartbeat_group_drop_item(struct config_group *group,
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index b364b7052e46..816a3f61330c 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -644,35 +644,23 @@ out:
644 return ret; 644 return ret;
645} 645}
646 646
647static int o2nm_node_group_make_item(struct config_group *group, 647static struct config_item *o2nm_node_group_make_item(struct config_group *group,
648 const char *name, 648 const char *name)
649 struct config_item **new_item)
650{ 649{
651 struct o2nm_node *node = NULL; 650 struct o2nm_node *node = NULL;
652 int ret = 0;
653 651
654 if (strlen(name) > O2NM_MAX_NAME_LEN) { 652 if (strlen(name) > O2NM_MAX_NAME_LEN)
655 ret = -ENAMETOOLONG; 653 return ERR_PTR(-ENAMETOOLONG);
656 goto out;
657 }
658 654
659 node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); 655 node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL);
660 if (node == NULL) { 656 if (node == NULL)
661 ret = -ENOMEM; 657 return ERR_PTR(-ENOMEM);
662 goto out;
663 }
664 658
665 strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ 659 strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */
666 config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); 660 config_item_init_type_name(&node->nd_item, name, &o2nm_node_type);
667 spin_lock_init(&node->nd_lock); 661 spin_lock_init(&node->nd_lock);
668 662
669 *new_item = &node->nd_item; 663 return &node->nd_item;
670
671out:
672 if (ret)
673 kfree(node);
674
675 return ret;
676} 664}
677 665
678static void o2nm_node_group_drop_item(struct config_group *group, 666static void o2nm_node_group_drop_item(struct config_group *group,
@@ -756,31 +744,25 @@ static struct o2nm_cluster_group *to_o2nm_cluster_group(struct config_group *gro
756} 744}
757#endif 745#endif
758 746
759static int o2nm_cluster_group_make_group(struct config_group *group, 747static struct config_group *o2nm_cluster_group_make_group(struct config_group *group,
760 const char *name, 748 const char *name)
761 struct config_group **new_group)
762{ 749{
763 struct o2nm_cluster *cluster = NULL; 750 struct o2nm_cluster *cluster = NULL;
764 struct o2nm_node_group *ns = NULL; 751 struct o2nm_node_group *ns = NULL;
765 struct config_group *o2hb_group = NULL; 752 struct config_group *o2hb_group = NULL, *ret = NULL;
766 void *defs = NULL; 753 void *defs = NULL;
767 int ret = 0;
768 754
769 /* this runs under the parent dir's i_mutex; there can be only 755 /* this runs under the parent dir's i_mutex; there can be only
770 * one caller in here at a time */ 756 * one caller in here at a time */
771 if (o2nm_single_cluster) { 757 if (o2nm_single_cluster)
772 ret = -ENOSPC; 758 return ERR_PTR(-ENOSPC);
773 goto out;
774 }
775 759
776 cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); 760 cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL);
777 ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); 761 ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL);
778 defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL); 762 defs = kcalloc(3, sizeof(struct config_group *), GFP_KERNEL);
779 o2hb_group = o2hb_alloc_hb_set(); 763 o2hb_group = o2hb_alloc_hb_set();
780 if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL) { 764 if (cluster == NULL || ns == NULL || o2hb_group == NULL || defs == NULL)
781 ret = -ENOMEM;
782 goto out; 765 goto out;
783 }
784 766
785 config_group_init_type_name(&cluster->cl_group, name, 767 config_group_init_type_name(&cluster->cl_group, name,
786 &o2nm_cluster_type); 768 &o2nm_cluster_type);
@@ -797,15 +779,16 @@ static int o2nm_cluster_group_make_group(struct config_group *group,
797 cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; 779 cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT;
798 cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; 780 cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT;
799 781
800 *new_group = &cluster->cl_group; 782 ret = &cluster->cl_group;
801 o2nm_single_cluster = cluster; 783 o2nm_single_cluster = cluster;
802 784
803out: 785out:
804 if (ret) { 786 if (ret == NULL) {
805 kfree(cluster); 787 kfree(cluster);
806 kfree(ns); 788 kfree(ns);
807 o2hb_free_hb_set(o2hb_group); 789 o2hb_free_hb_set(o2hb_group);
808 kfree(defs); 790 kfree(defs);
791 ret = ERR_PTR(-ENOMEM);
809 } 792 }
810 793
811 return ret; 794 return ret;
diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c
index 21f490f5d65c..d153946d6d15 100644
--- a/fs/proc/proc_tty.c
+++ b/fs/proc/proc_tty.c
@@ -136,54 +136,6 @@ static const struct file_operations proc_tty_drivers_operations = {
136 .release = seq_release, 136 .release = seq_release,
137}; 137};
138 138
139static void * tty_ldiscs_seq_start(struct seq_file *m, loff_t *pos)
140{
141 return (*pos < NR_LDISCS) ? pos : NULL;
142}
143
144static void * tty_ldiscs_seq_next(struct seq_file *m, void *v, loff_t *pos)
145{
146 (*pos)++;
147 return (*pos < NR_LDISCS) ? pos : NULL;
148}
149
150static void tty_ldiscs_seq_stop(struct seq_file *m, void *v)
151{
152}
153
154static int tty_ldiscs_seq_show(struct seq_file *m, void *v)
155{
156 int i = *(loff_t *)v;
157 struct tty_ldisc *ld;
158
159 ld = tty_ldisc_get(i);
160 if (ld == NULL)
161 return 0;
162 seq_printf(m, "%-10s %2d\n", ld->name ? ld->name : "???", i);
163 tty_ldisc_put(i);
164 return 0;
165}
166
167static const struct seq_operations tty_ldiscs_seq_ops = {
168 .start = tty_ldiscs_seq_start,
169 .next = tty_ldiscs_seq_next,
170 .stop = tty_ldiscs_seq_stop,
171 .show = tty_ldiscs_seq_show,
172};
173
174static int proc_tty_ldiscs_open(struct inode *inode, struct file *file)
175{
176 return seq_open(file, &tty_ldiscs_seq_ops);
177}
178
179static const struct file_operations tty_ldiscs_proc_fops = {
180 .owner = THIS_MODULE,
181 .open = proc_tty_ldiscs_open,
182 .read = seq_read,
183 .llseek = seq_lseek,
184 .release = seq_release,
185};
186
187/* 139/*
188 * This function is called by tty_register_driver() to handle 140 * This function is called by tty_register_driver() to handle
189 * registering the driver's /proc handler into /proc/tty/driver/<foo> 141 * registering the driver's /proc handler into /proc/tty/driver/<foo>
diff --git a/include/asm-avr32/ioctls.h b/include/asm-avr32/ioctls.h
index 0500426b7186..0cf2c0a4502b 100644
--- a/include/asm-avr32/ioctls.h
+++ b/include/asm-avr32/ioctls.h
@@ -47,6 +47,10 @@
47#define TIOCSBRK 0x5427 /* BSD compatibility */ 47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */ 48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */ 49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52 56
diff --git a/include/asm-cris/Kbuild b/include/asm-cris/Kbuild
index 17455459c43f..b7037d80d461 100644
--- a/include/asm-cris/Kbuild
+++ b/include/asm-cris/Kbuild
@@ -1,7 +1,8 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-$(CONFIG_ETRAX_ARCH_V10) += arch-v10/ 3header-y += arch/
4header-$(CONFIG_ETRAX_ARCH_V32) += arch-v32/ 4header-y += arch-v10/
5header-y += arch-v32/
5 6
6header-y += ethernet.h 7header-y += ethernet.h
7header-y += rtc.h 8header-y += rtc.h
diff --git a/include/asm-frv/ioctls.h b/include/asm-frv/ioctls.h
index 341c7ddef2a3..d0c30e31fbda 100644
--- a/include/asm-frv/ioctls.h
+++ b/include/asm-frv/ioctls.h
@@ -47,6 +47,10 @@
47#define TIOCSBRK 0x5427 /* BSD compatibility */ 47#define TIOCSBRK 0x5427 /* BSD compatibility */
48#define TIOCCBRK 0x5428 /* BSD compatibility */ 48#define TIOCCBRK 0x5428 /* BSD compatibility */
49#define TIOCGSID 0x5429 /* Return the session ID of FD */ 49#define TIOCGSID 0x5429 /* Return the session ID of FD */
50#define TCGETS2 _IOR('T',0x2A, struct termios2)
51#define TCSETS2 _IOW('T',0x2B, struct termios2)
52#define TCSETSW2 _IOW('T',0x2C, struct termios2)
53#define TCSETSF2 _IOW('T',0x2D, struct termios2)
50#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
51#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
52 56
diff --git a/include/asm-frv/termbits.h b/include/asm-frv/termbits.h
index 74851b424d4f..5568492b5086 100644
--- a/include/asm-frv/termbits.h
+++ b/include/asm-frv/termbits.h
@@ -141,6 +141,7 @@ struct ktermios {
141#define HUPCL 0002000 141#define HUPCL 0002000
142#define CLOCAL 0004000 142#define CLOCAL 0004000
143#define CBAUDEX 0010000 143#define CBAUDEX 0010000
144#define BOTHER 0010000
144#define B57600 0010001 145#define B57600 0010001
145#define B115200 0010002 146#define B115200 0010002
146#define B230400 0010003 147#define B230400 0010003
@@ -156,11 +157,13 @@ struct ktermios {
156#define B3000000 0010015 157#define B3000000 0010015
157#define B3500000 0010016 158#define B3500000 0010016
158#define B4000000 0010017 159#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate (not used) */ 160#define CIBAUD 002003600000 /* Input baud rate */
160#define CTVB 004000000000 /* VisioBraille Terminal flow control */ 161#define CTVB 004000000000 /* VisioBraille Terminal flow control */
161#define CMSPAR 010000000000 /* mark or space (stick) parity */ 162#define CMSPAR 010000000000 /* mark or space (stick) parity */
162#define CRTSCTS 020000000000 /* flow control */ 163#define CRTSCTS 020000000000 /* flow control */
163 164
165#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
166
164/* c_lflag bits */ 167/* c_lflag bits */
165#define ISIG 0000001 168#define ISIG 0000001
166#define ICANON 0000002 169#define ICANON 0000002
diff --git a/include/asm-m68k/amigahw.h b/include/asm-m68k/amigahw.h
index a16fe4e5a28a..5ca5dd951a4a 100644
--- a/include/asm-m68k/amigahw.h
+++ b/include/asm-m68k/amigahw.h
@@ -22,8 +22,6 @@
22 * Different Amiga models 22 * Different Amiga models
23 */ 23 */
24 24
25extern unsigned long amiga_model;
26
27#define AMI_UNKNOWN (0) 25#define AMI_UNKNOWN (0)
28#define AMI_500 (1) 26#define AMI_500 (1)
29#define AMI_500PLUS (2) 27#define AMI_500PLUS (2)
@@ -59,11 +57,9 @@ extern unsigned long amiga_chipset;
59 */ 57 */
60 58
61extern unsigned long amiga_eclock; /* 700 kHz E Peripheral Clock */ 59extern unsigned long amiga_eclock; /* 700 kHz E Peripheral Clock */
62extern unsigned long amiga_masterclock; /* 28 MHz Master Clock */
63extern unsigned long amiga_colorclock; /* 3.5 MHz Color Clock */ 60extern unsigned long amiga_colorclock; /* 3.5 MHz Color Clock */
64extern unsigned long amiga_chip_size; /* Chip RAM Size (bytes) */ 61extern unsigned long amiga_chip_size; /* Chip RAM Size (bytes) */
65extern unsigned char amiga_vblank; /* VBLANK Frequency */ 62extern unsigned char amiga_vblank; /* VBLANK Frequency */
66extern unsigned char amiga_psfreq; /* Power Supply Frequency */
67 63
68 64
69#define AMIGAHW_DECLARE(name) unsigned name : 1 65#define AMIGAHW_DECLARE(name) unsigned name : 1
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h
index 7c8713468fd2..b1bcdb835ab9 100644
--- a/include/asm-m68k/amigaints.h
+++ b/include/asm-m68k/amigaints.h
@@ -98,6 +98,8 @@
98#define CIA_ICR_ALL 0x1f 98#define CIA_ICR_ALL 0x1f
99#define CIA_ICR_SETCLR 0x80 99#define CIA_ICR_SETCLR 0x80
100 100
101extern void amiga_init_IRQ(void);
102
101/* to access the interrupt control registers of CIA's use only 103/* to access the interrupt control registers of CIA's use only
102** these functions, they behave exactly like the amiga os routines 104** these functions, they behave exactly like the amiga os routines
103*/ 105*/
diff --git a/include/asm-m68k/apollodma.h b/include/asm-m68k/apollodma.h
index 6821e3ba32e9..954adc851adb 100644
--- a/include/asm-m68k/apollodma.h
+++ b/include/asm-m68k/apollodma.h
@@ -1,4 +1,4 @@
1/* $Id: dma.h,v 1.7 1992/12/14 00:29:34 root Exp root $ 1/*
2 * linux/include/asm/dma.h: Defines for using and allocating dma channels. 2 * linux/include/asm/dma.h: Defines for using and allocating dma channels.
3 * Written by Hennus Bergman, 1992. 3 * Written by Hennus Bergman, 1992.
4 * High DMA channel support & info by Hannu Savolainen 4 * High DMA channel support & info by Hannu Savolainen
diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h
index e1112de5a5e3..4fff408d0150 100644
--- a/include/asm-m68k/dvma.h
+++ b/include/asm-m68k/dvma.h
@@ -1,4 +1,4 @@
1/* $Id: dvma.h,v 1.4 1999/03/27 20:23:41 tsbogend Exp $ 1/*
2 * include/asm-m68k/dma.h 2 * include/asm-m68k/dma.h
3 * 3 *
4 * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu) 4 * Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu)
@@ -63,8 +63,6 @@ static inline int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr,
63 return 0; 63 return 0;
64} 64}
65 65
66extern unsigned long dvma_page(unsigned long kaddr, unsigned long vaddr);
67
68#else /* Sun3x */ 66#else /* Sun3x */
69 67
70/* sun3x dvma page support */ 68/* sun3x dvma page support */
diff --git a/include/asm-m68k/fpu.h b/include/asm-m68k/fpu.h
index 59701d7b4e78..ffb6b8cfc6d5 100644
--- a/include/asm-m68k/fpu.h
+++ b/include/asm-m68k/fpu.h
@@ -7,15 +7,15 @@
7 */ 7 */
8 8
9#if defined(CONFIG_M68020) || defined(CONFIG_M68030) 9#if defined(CONFIG_M68020) || defined(CONFIG_M68030)
10#define FPSTATESIZE (216/sizeof(unsigned char)) 10#define FPSTATESIZE (216)
11#elif defined(CONFIG_M68040) 11#elif defined(CONFIG_M68040)
12#define FPSTATESIZE (96/sizeof(unsigned char)) 12#define FPSTATESIZE (96)
13#elif defined(CONFIG_M68KFPU_EMU) 13#elif defined(CONFIG_M68KFPU_EMU)
14#define FPSTATESIZE (28/sizeof(unsigned char)) 14#define FPSTATESIZE (28)
15#elif defined(CONFIG_M68060) 15#elif defined(CONFIG_M68060)
16#define FPSTATESIZE (12/sizeof(unsigned char)) 16#define FPSTATESIZE (12)
17#else 17#else
18#define FPSTATESIZE error no_cpu_type_configured 18#define FPSTATESIZE (0)
19#endif 19#endif
20 20
21#endif /* __M68K_FPU_H */ 21#endif /* __M68K_FPU_H */
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index eb29a5260591..226bfc0f21b1 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -24,7 +24,7 @@
24#elif defined(CONFIG_HP300) 24#elif defined(CONFIG_HP300)
25#define NR_IRQS 8 25#define NR_IRQS 8
26#else 26#else
27#error unknown nr of irqs 27#define NR_IRQS 0
28#endif 28#endif
29 29
30/* 30/*
diff --git a/include/asm-m68k/mac_baboon.h b/include/asm-m68k/mac_baboon.h
index e87850830be8..c2a042b8c349 100644
--- a/include/asm-m68k/mac_baboon.h
+++ b/include/asm-m68k/mac_baboon.h
@@ -29,6 +29,4 @@ struct baboon {
29 */ 29 */
30}; 30};
31 31
32extern volatile struct baboon *baboon;
33
34#endif /* __ASSEMBLY **/ 32#endif /* __ASSEMBLY **/
diff --git a/include/asm-m68k/mac_via.h b/include/asm-m68k/mac_via.h
index 59b758cd16ad..39afb438b656 100644
--- a/include/asm-m68k/mac_via.h
+++ b/include/asm-m68k/mac_via.h
@@ -253,7 +253,6 @@
253 253
254extern volatile __u8 *via1,*via2; 254extern volatile __u8 *via1,*via2;
255extern int rbv_present,via_alt_mapping; 255extern int rbv_present,via_alt_mapping;
256extern __u8 rbv_clear;
257 256
258static inline int rbv_set_video_bpp(int bpp) 257static inline int rbv_set_video_bpp(int bpp)
259{ 258{
diff --git a/include/asm-m68k/machines.h b/include/asm-m68k/machines.h
index da6015a90f24..be667e84f01b 100644
--- a/include/asm-m68k/machines.h
+++ b/include/asm-m68k/machines.h
@@ -1,4 +1,4 @@
1/* $Id: machines.h,v 1.4 1995/11/25 02:31:58 davem Exp $ 1/*
2 * machines.h: Defines for taking apart the machine type value in the 2 * machines.h: Defines for taking apart the machine type value in the
3 * idprom and determining the kind of machine we are on. 3 * idprom and determining the kind of machine we are on.
4 * 4 *
@@ -21,8 +21,6 @@ struct Sun_Machine_Models {
21//#define NUM_SUN_MACHINES 23 21//#define NUM_SUN_MACHINES 23
22#define NUM_SUN_MACHINES 8 22#define NUM_SUN_MACHINES 8
23 23
24extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES];
25
26/* The machine type in the idprom area looks like this: 24/* The machine type in the idprom area looks like this:
27 * 25 *
28 * --------------- 26 * ---------------
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h
index 28b0f49ee521..05309f7e3d06 100644
--- a/include/asm-m68k/macintosh.h
+++ b/include/asm-m68k/macintosh.h
@@ -12,8 +12,6 @@ extern void mac_reset(void);
12extern void mac_poweroff(void); 12extern void mac_poweroff(void);
13extern void mac_init_IRQ(void); 13extern void mac_init_IRQ(void);
14extern int mac_irq_pending(unsigned int); 14extern int mac_irq_pending(unsigned int);
15extern void mac_identify(void);
16extern void mac_report_hardware(void);
17 15
18/* 16/*
19 * Floppy driver magic hook - probably shouldnt be here 17 * Floppy driver magic hook - probably shouldnt be here
@@ -21,9 +19,6 @@ extern void mac_report_hardware(void);
21 19
22extern void via1_set_head(int); 20extern void via1_set_head(int);
23 21
24extern void parse_booter(char *ptr);
25extern void print_booter(char *ptr);
26
27/* 22/*
28 * Macintosh Table 23 * Macintosh Table
29 */ 24 */
diff --git a/include/asm-m68k/md.h b/include/asm-m68k/md.h
index 467ea08383e4..d2f78f226f3d 100644
--- a/include/asm-m68k/md.h
+++ b/include/asm-m68k/md.h
@@ -1,4 +1,4 @@
1/* $Id: md.h,v 1.1 1997/12/15 15:12:04 jj Exp $ 1/*
2 * md.h: High speed xor_block operation for RAID4/5 2 * md.h: High speed xor_block operation for RAID4/5
3 * 3 *
4 */ 4 */
diff --git a/include/asm-m68k/openprom.h b/include/asm-m68k/openprom.h
index 869ab9176e9f..d33cdadf78e1 100644
--- a/include/asm-m68k/openprom.h
+++ b/include/asm-m68k/openprom.h
@@ -1,4 +1,3 @@
1/* $Id: openprom.h,v 1.19 1996/09/25 03:51:08 davem Exp $ */
2#ifndef __SPARC_OPENPROM_H 1#ifndef __SPARC_OPENPROM_H
3#define __SPARC_OPENPROM_H 2#define __SPARC_OPENPROM_H
4 3
diff --git a/include/asm-m68k/oplib.h b/include/asm-m68k/oplib.h
index 06caa2d08451..f082d03336bd 100644
--- a/include/asm-m68k/oplib.h
+++ b/include/asm-m68k/oplib.h
@@ -1,4 +1,4 @@
1/* $Id: oplib.h,v 1.12 1996/10/31 06:29:13 davem Exp $ 1/*
2 * oplib.h: Describes the interface and available routines in the 2 * oplib.h: Describes the interface and available routines in the
3 * Linux Prom library. 3 * Linux Prom library.
4 * 4 *
@@ -19,7 +19,6 @@ enum prom_major_version {
19 PROM_V2, /* sun4c and early sun4m V2 prom */ 19 PROM_V2, /* sun4c and early sun4m V2 prom */
20 PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */ 20 PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */
21 PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */ 21 PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */
22 PROM_AP1000, /* actually no prom at all */
23}; 22};
24 23
25extern enum prom_major_version prom_vers; 24extern enum prom_major_version prom_vers;
diff --git a/include/asm-m68k/sbus.h b/include/asm-m68k/sbus.h
index 3b25c0040aa6..bfe3ba147f2e 100644
--- a/include/asm-m68k/sbus.h
+++ b/include/asm-m68k/sbus.h
@@ -12,11 +12,6 @@ struct sbus_dev {
12 } reg_addrs[1]; 12 } reg_addrs[1];
13}; 13};
14 14
15extern void *sparc_alloc_io (u32, void *, int, char *, u32, int);
16#define sparc_alloc_io(a,b,c,d,e,f) (a)
17
18#define ARCH_SUN4 0
19
20/* sbus IO functions stolen from include/asm-sparc/io.h for the serial driver */ 15/* sbus IO functions stolen from include/asm-sparc/io.h for the serial driver */
21/* No SBUS on the Sun3, kludge -- sam */ 16/* No SBUS on the Sun3, kludge -- sam */
22 17
diff --git a/include/asm-m68k/sun3-head.h b/include/asm-m68k/sun3-head.h
index e74f384e269f..05af2f18b3bd 100644
--- a/include/asm-m68k/sun3-head.h
+++ b/include/asm-m68k/sun3-head.h
@@ -1,4 +1,3 @@
1/* $Id: head.h,v 1.32 1996/12/04 00:12:48 ecd Exp $ */
2#ifndef __SUN3_HEAD_H 1#ifndef __SUN3_HEAD_H
3#define __SUN3_HEAD_H 2#define __SUN3_HEAD_H
4 3
diff --git a/include/asm-m68k/tlbflush.h b/include/asm-m68k/tlbflush.h
index 17707ec315e2..acb6bf21a321 100644
--- a/include/asm-m68k/tlbflush.h
+++ b/include/asm-m68k/tlbflush.h
@@ -16,7 +16,7 @@ static inline void flush_tlb_kernel_page(void *addr)
16 ".chip 68k" 16 ".chip 68k"
17 : : "a" (addr)); 17 : : "a" (addr));
18 set_fs(old_fs); 18 set_fs(old_fs);
19 } else 19 } else if (CPU_IS_020_OR_030)
20 __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr)); 20 __asm__ __volatile__("pflush #4,#4,(%0)" : : "a" (addr));
21} 21}
22 22
@@ -29,7 +29,7 @@ static inline void __flush_tlb(void)
29 __asm__ __volatile__(".chip 68040\n\t" 29 __asm__ __volatile__(".chip 68040\n\t"
30 "pflushan\n\t" 30 "pflushan\n\t"
31 ".chip 68k"); 31 ".chip 68k");
32 else 32 else if (CPU_IS_020_OR_030)
33 __asm__ __volatile__("pflush #0,#4"); 33 __asm__ __volatile__("pflush #0,#4");
34} 34}
35 35
@@ -45,7 +45,7 @@ static inline void __flush_tlb_one(unsigned long addr)
45{ 45{
46 if (CPU_IS_040_OR_060) 46 if (CPU_IS_040_OR_060)
47 __flush_tlb040_one(addr); 47 __flush_tlb040_one(addr);
48 else 48 else if (CPU_IS_020_OR_030)
49 __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr)); 49 __asm__ __volatile__("pflush #0,#4,(%0)" : : "a" (addr));
50} 50}
51 51
@@ -60,7 +60,7 @@ static inline void flush_tlb_all(void)
60 __asm__ __volatile__(".chip 68040\n\t" 60 __asm__ __volatile__(".chip 68040\n\t"
61 "pflusha\n\t" 61 "pflusha\n\t"
62 ".chip 68k"); 62 ".chip 68k");
63 else 63 else if (CPU_IS_020_OR_030)
64 __asm__ __volatile__("pflusha"); 64 __asm__ __volatile__("pflusha");
65} 65}
66 66
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 0488f937634a..d62c19ff041c 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -148,7 +148,8 @@ struct configfs_attribute {
148 * items. If the item is a group, it may support mkdir(2). 148 * items. If the item is a group, it may support mkdir(2).
149 * Groups supply one of make_group() and make_item(). If the 149 * Groups supply one of make_group() and make_item(). If the
150 * group supports make_group(), one can create group children. If it 150 * group supports make_group(), one can create group children. If it
151 * supports make_item(), one can create config_item children. If it has 151 * supports make_item(), one can create config_item children. make_group()
152 * and make_item() return ERR_PTR() on errors. If it has
152 * default_groups on group->default_groups, it has automatically created 153 * default_groups on group->default_groups, it has automatically created
153 * group children. default_groups may coexist alongsize make_group() or 154 * group children. default_groups may coexist alongsize make_group() or
154 * make_item(), but if the group wishes to have only default_groups 155 * make_item(), but if the group wishes to have only default_groups
@@ -165,8 +166,8 @@ struct configfs_item_operations {
165}; 166};
166 167
167struct configfs_group_operations { 168struct configfs_group_operations {
168 int (*make_item)(struct config_group *group, const char *name, struct config_item **new_item); 169 struct config_item *(*make_item)(struct config_group *group, const char *name);
169 int (*make_group)(struct config_group *group, const char *name, struct config_group **new_group); 170 struct config_group *(*make_group)(struct config_group *group, const char *name);
170 int (*commit_item)(struct config_item *item); 171 int (*commit_item)(struct config_item *item);
171 void (*disconnect_notify)(struct config_group *group, struct config_item *item); 172 void (*disconnect_notify)(struct config_group *group, struct config_item *item);
172 void (*drop_item)(struct config_group *group, struct config_item *item); 173 void (*drop_item)(struct config_group *group, struct config_item *item);
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 504cb2c3fa9a..2d3d1e04ba92 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -550,11 +550,11 @@ struct cyclades_icount {
550 550
551struct cyclades_port { 551struct cyclades_port {
552 int magic; 552 int magic;
553 struct tty_port port;
553 struct cyclades_card *card; 554 struct cyclades_card *card;
554 int line; 555 int line;
555 int flags; /* defined in tty.h */ 556 int flags; /* defined in tty.h */
556 int type; /* UART type */ 557 int type; /* UART type */
557 struct tty_struct *tty;
558 int read_status_mask; 558 int read_status_mask;
559 int ignore_status_mask; 559 int ignore_status_mask;
560 int timeout; 560 int timeout;
@@ -567,13 +567,8 @@ struct cyclades_port {
567 int chip_rev; 567 int chip_rev;
568 int custom_divisor; 568 int custom_divisor;
569 u8 x_char; /* to be pushed out ASAP */ 569 u8 x_char; /* to be pushed out ASAP */
570 int close_delay;
571 unsigned short closing_wait;
572 int count; /* # of fd on device */
573 int breakon; 570 int breakon;
574 int breakoff; 571 int breakoff;
575 int blocked_open; /* # of blocked opens */
576 unsigned char *xmit_buf;
577 int xmit_head; 572 int xmit_head;
578 int xmit_tail; 573 int xmit_tail;
579 int xmit_cnt; 574 int xmit_cnt;
@@ -583,16 +578,14 @@ struct cyclades_port {
583 struct cyclades_monitor mon; 578 struct cyclades_monitor mon;
584 struct cyclades_idle_stats idle_stats; 579 struct cyclades_idle_stats idle_stats;
585 struct cyclades_icount icount; 580 struct cyclades_icount icount;
586 wait_queue_head_t open_wait;
587 wait_queue_head_t close_wait;
588 struct completion shutdown_wait; 581 struct completion shutdown_wait;
589 wait_queue_head_t delta_msr_wait; 582 wait_queue_head_t delta_msr_wait;
590 int throttle; 583 int throttle;
591}; 584};
592 585
593#define CLOSING_WAIT_DELAY 30*HZ 586#define CLOSING_WAIT_DELAY 30*HZ
594#define CY_CLOSING_WAIT_NONE 65535 587#define CY_CLOSING_WAIT_NONE ASYNC_CLOSING_WAIT_NONE
595#define CY_CLOSING_WAIT_INF 0 588#define CY_CLOSING_WAIT_INF ASYNC_CLOSING_WAIT_INF
596 589
597 590
598#define CyMAX_CHIPS_PER_CARD 8 591#define CyMAX_CHIPS_PER_CARD 8
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 110833666e37..4cc913939817 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -14,6 +14,7 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/tty.h>
17 18
18struct real_driver { 19struct real_driver {
19 void (*disable_tx_interrupts) (void *); 20 void (*disable_tx_interrupts) (void *);
@@ -33,17 +34,12 @@ struct real_driver {
33 34
34struct gs_port { 35struct gs_port {
35 int magic; 36 int magic;
37 struct tty_port port;
36 unsigned char *xmit_buf; 38 unsigned char *xmit_buf;
37 int xmit_head; 39 int xmit_head;
38 int xmit_tail; 40 int xmit_tail;
39 int xmit_cnt; 41 int xmit_cnt;
40 struct mutex port_write_mutex; 42 struct mutex port_write_mutex;
41 int flags;
42 wait_queue_head_t open_wait;
43 wait_queue_head_t close_wait;
44 int count;
45 int blocked_open;
46 struct tty_struct *tty;
47 unsigned long event; 43 unsigned long event;
48 unsigned short closing_wait; 44 unsigned short closing_wait;
49 int close_delay; 45 int close_delay;
diff --git a/include/linux/hayesesp.h b/include/linux/hayesesp.h
index 2177ee5b2fe2..940aeb51d53f 100644
--- a/include/linux/hayesesp.h
+++ b/include/linux/hayesesp.h
@@ -76,11 +76,10 @@ struct hayes_esp_config {
76 76
77struct esp_struct { 77struct esp_struct {
78 int magic; 78 int magic;
79 struct tty_port port;
79 spinlock_t lock; 80 spinlock_t lock;
80 int port; 81 int io_port;
81 int irq; 82 int irq;
82 int flags; /* defined in tty.h */
83 struct tty_struct *tty;
84 int read_status_mask; 83 int read_status_mask;
85 int ignore_status_mask; 84 int ignore_status_mask;
86 int timeout; 85 int timeout;
@@ -93,14 +92,10 @@ struct esp_struct {
93 int MCR; /* Modem control register */ 92 int MCR; /* Modem control register */
94 unsigned long last_active; 93 unsigned long last_active;
95 int line; 94 int line;
96 int count; /* # of fd on device */
97 int blocked_open; /* # of blocked opens */
98 unsigned char *xmit_buf; 95 unsigned char *xmit_buf;
99 int xmit_head; 96 int xmit_head;
100 int xmit_tail; 97 int xmit_tail;
101 int xmit_cnt; 98 int xmit_cnt;
102 wait_queue_head_t open_wait;
103 wait_queue_head_t close_wait;
104 wait_queue_head_t delta_msr_wait; 99 wait_queue_head_t delta_msr_wait;
105 wait_queue_head_t break_wait; 100 wait_queue_head_t break_wait;
106 struct async_icount icount; /* kernel counters for the 4 input interrupts */ 101 struct async_icount icount; /* kernel counters for the 4 input interrupts */
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 5a84fe944b74..0d1840723249 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -51,25 +51,21 @@
51 */ 51 */
52struct stliport { 52struct stliport {
53 unsigned long magic; 53 unsigned long magic;
54 struct tty_port port;
54 unsigned int portnr; 55 unsigned int portnr;
55 unsigned int panelnr; 56 unsigned int panelnr;
56 unsigned int brdnr; 57 unsigned int brdnr;
57 unsigned long state; 58 unsigned long state;
58 unsigned int devnr; 59 unsigned int devnr;
59 int flags;
60 int baud_base; 60 int baud_base;
61 int custom_divisor; 61 int custom_divisor;
62 int close_delay; 62 int close_delay;
63 int closing_wait; 63 int closing_wait;
64 int refcount;
65 int openwaitcnt; 64 int openwaitcnt;
66 int rc; 65 int rc;
67 int argsize; 66 int argsize;
68 void *argp; 67 void *argp;
69 unsigned int rxmarkmsk; 68 unsigned int rxmarkmsk;
70 struct tty_struct *tty;
71 wait_queue_head_t open_wait;
72 wait_queue_head_t close_wait;
73 wait_queue_head_t raw_wait; 69 wait_queue_head_t raw_wait;
74 struct asysigs asig; 70 struct asysigs asig;
75 unsigned long addr; 71 unsigned long addr;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index d8f31de632c5..f3a1c0e45021 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -190,6 +190,7 @@ struct uart_ops {
190 void (*break_ctl)(struct uart_port *, int ctl); 190 void (*break_ctl)(struct uart_port *, int ctl);
191 int (*startup)(struct uart_port *); 191 int (*startup)(struct uart_port *);
192 void (*shutdown)(struct uart_port *); 192 void (*shutdown)(struct uart_port *);
193 void (*flush_buffer)(struct uart_port *);
193 void (*set_termios)(struct uart_port *, struct ktermios *new, 194 void (*set_termios)(struct uart_port *, struct ktermios *new,
194 struct ktermios *old); 195 struct ktermios *old);
195 void (*set_ldisc)(struct uart_port *); 196 void (*set_ldisc)(struct uart_port *);
@@ -343,13 +344,15 @@ typedef unsigned int __bitwise__ uif_t;
343 * stuff here. 344 * stuff here.
344 */ 345 */
345struct uart_info { 346struct uart_info {
346 struct tty_struct *tty; 347 struct tty_port port;
347 struct circ_buf xmit; 348 struct circ_buf xmit;
348 uif_t flags; 349 uif_t flags;
349 350
350/* 351/*
351 * Definitions for info->flags. These are _private_ to serial_core, and 352 * Definitions for info->flags. These are _private_ to serial_core, and
352 * are specific to this structure. They may be queried by low level drivers. 353 * are specific to this structure. They may be queried by low level drivers.
354 *
355 * FIXME: use the ASY_ definitions
353 */ 356 */
354#define UIF_CHECK_CD ((__force uif_t) (1 << 25)) 357#define UIF_CHECK_CD ((__force uif_t) (1 << 25))
355#define UIF_CTS_FLOW ((__force uif_t) (1 << 26)) 358#define UIF_CTS_FLOW ((__force uif_t) (1 << 26))
@@ -357,11 +360,7 @@ struct uart_info {
357#define UIF_INITIALIZED ((__force uif_t) (1 << 31)) 360#define UIF_INITIALIZED ((__force uif_t) (1 << 31))
358#define UIF_SUSPENDED ((__force uif_t) (1 << 30)) 361#define UIF_SUSPENDED ((__force uif_t) (1 << 30))
359 362
360 int blocked_open;
361
362 struct tasklet_struct tlet; 363 struct tasklet_struct tlet;
363
364 wait_queue_head_t open_wait;
365 wait_queue_head_t delta_msr_wait; 364 wait_queue_head_t delta_msr_wait;
366}; 365};
367 366
@@ -438,8 +437,8 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
438#define uart_circ_chars_free(circ) \ 437#define uart_circ_chars_free(circ) \
439 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) 438 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE))
440 439
441#define uart_tx_stopped(port) \ 440#define uart_tx_stopped(portp) \
442 ((port)->info->tty->stopped || (port)->info->tty->hw_stopped) 441 ((portp)->info->port.tty->stopped || (portp)->info->port.tty->hw_stopped)
443 442
444/* 443/*
445 * The following are helper functions for the low level drivers. 444 * The following are helper functions for the low level drivers.
@@ -450,7 +449,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
450#ifdef SUPPORT_SYSRQ 449#ifdef SUPPORT_SYSRQ
451 if (port->sysrq) { 450 if (port->sysrq) {
452 if (ch && time_before(jiffies, port->sysrq)) { 451 if (ch && time_before(jiffies, port->sysrq)) {
453 handle_sysrq(ch, port->info ? port->info->tty : NULL); 452 handle_sysrq(ch, port->info ? port->info->port.tty : NULL);
454 port->sysrq = 0; 453 port->sysrq = 0;
455 return 1; 454 return 1;
456 } 455 }
@@ -479,7 +478,7 @@ static inline int uart_handle_break(struct uart_port *port)
479 } 478 }
480#endif 479#endif
481 if (port->flags & UPF_SAK) 480 if (port->flags & UPF_SAK)
482 do_SAK(info->tty); 481 do_SAK(info->port.tty);
483 return 0; 482 return 0;
484} 483}
485 484
@@ -502,9 +501,9 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status)
502 501
503 if (info->flags & UIF_CHECK_CD) { 502 if (info->flags & UIF_CHECK_CD) {
504 if (status) 503 if (status)
505 wake_up_interruptible(&info->open_wait); 504 wake_up_interruptible(&info->port.open_wait);
506 else if (info->tty) 505 else if (info->port.tty)
507 tty_hangup(info->tty); 506 tty_hangup(info->port.tty);
508 } 507 }
509} 508}
510 509
@@ -517,7 +516,7 @@ static inline void
517uart_handle_cts_change(struct uart_port *port, unsigned int status) 516uart_handle_cts_change(struct uart_port *port, unsigned int status)
518{ 517{
519 struct uart_info *info = port->info; 518 struct uart_info *info = port->info;
520 struct tty_struct *tty = info->tty; 519 struct tty_struct *tty = info->port.tty;
521 520
522 port->icount.cts++; 521 port->icount.cts++;
523 522
@@ -543,7 +542,7 @@ static inline void
543uart_insert_char(struct uart_port *port, unsigned int status, 542uart_insert_char(struct uart_port *port, unsigned int status,
544 unsigned int overrun, unsigned int ch, unsigned int flag) 543 unsigned int overrun, unsigned int ch, unsigned int flag)
545{ 544{
546 struct tty_struct *tty = port->info->tty; 545 struct tty_struct *tty = port->info->port.tty;
547 546
548 if ((status & port->ignore_status_mask & ~overrun) == 0) 547 if ((status & port->ignore_status_mask & ~overrun) == 0)
549 tty_insert_flip_char(tty, ch, flag); 548 tty_insert_flip_char(tty, ch, flag);
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
index 0424d75a5aaa..336af33c6ea4 100644
--- a/include/linux/stallion.h
+++ b/include/linux/stallion.h
@@ -69,6 +69,7 @@ struct stlrq {
69 */ 69 */
70struct stlport { 70struct stlport {
71 unsigned long magic; 71 unsigned long magic;
72 struct tty_port port;
72 unsigned int portnr; 73 unsigned int portnr;
73 unsigned int panelnr; 74 unsigned int panelnr;
74 unsigned int brdnr; 75 unsigned int brdnr;
@@ -76,12 +77,10 @@ struct stlport {
76 int uartaddr; 77 int uartaddr;
77 unsigned int pagenr; 78 unsigned int pagenr;
78 unsigned long istate; 79 unsigned long istate;
79 int flags;
80 int baud_base; 80 int baud_base;
81 int custom_divisor; 81 int custom_divisor;
82 int close_delay; 82 int close_delay;
83 int closing_wait; 83 int closing_wait;
84 int refcount;
85 int openwaitcnt; 84 int openwaitcnt;
86 int brklen; 85 int brklen;
87 unsigned int sigs; 86 unsigned int sigs;
@@ -92,9 +91,6 @@ struct stlport {
92 unsigned long clk; 91 unsigned long clk;
93 unsigned long hwid; 92 unsigned long hwid;
94 void *uartp; 93 void *uartp;
95 struct tty_struct *tty;
96 wait_queue_head_t open_wait;
97 wait_queue_head_t close_wait;
98 comstats_t stats; 94 comstats_t stats;
99 struct stlrq tx; 95 struct stlrq tx;
100}; 96};
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 324a3b231d40..4e5833073aa6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -71,7 +71,8 @@ struct tty_bufhead {
71 struct tty_buffer *head; /* Queue head */ 71 struct tty_buffer *head; /* Queue head */
72 struct tty_buffer *tail; /* Active buffer */ 72 struct tty_buffer *tail; /* Active buffer */
73 struct tty_buffer *free; /* Free queue head */ 73 struct tty_buffer *free; /* Free queue head */
74 int memory_used; /* Buffer space used excluding free queue */ 74 int memory_used; /* Buffer space used excluding
75 free queue */
75}; 76};
76/* 77/*
77 * When a break, frame error, or parity error happens, these codes are 78 * When a break, frame error, or parity error happens, these codes are
@@ -101,71 +102,96 @@ struct tty_bufhead {
101#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) 102#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT])
102#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) 103#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2])
103 104
104#define _I_FLAG(tty,f) ((tty)->termios->c_iflag & (f)) 105#define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f))
105#define _O_FLAG(tty,f) ((tty)->termios->c_oflag & (f)) 106#define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f))
106#define _C_FLAG(tty,f) ((tty)->termios->c_cflag & (f)) 107#define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f))
107#define _L_FLAG(tty,f) ((tty)->termios->c_lflag & (f)) 108#define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f))
108 109
109#define I_IGNBRK(tty) _I_FLAG((tty),IGNBRK) 110#define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK)
110#define I_BRKINT(tty) _I_FLAG((tty),BRKINT) 111#define I_BRKINT(tty) _I_FLAG((tty), BRKINT)
111#define I_IGNPAR(tty) _I_FLAG((tty),IGNPAR) 112#define I_IGNPAR(tty) _I_FLAG((tty), IGNPAR)
112#define I_PARMRK(tty) _I_FLAG((tty),PARMRK) 113#define I_PARMRK(tty) _I_FLAG((tty), PARMRK)
113#define I_INPCK(tty) _I_FLAG((tty),INPCK) 114#define I_INPCK(tty) _I_FLAG((tty), INPCK)
114#define I_ISTRIP(tty) _I_FLAG((tty),ISTRIP) 115#define I_ISTRIP(tty) _I_FLAG((tty), ISTRIP)
115#define I_INLCR(tty) _I_FLAG((tty),INLCR) 116#define I_INLCR(tty) _I_FLAG((tty), INLCR)
116#define I_IGNCR(tty) _I_FLAG((tty),IGNCR) 117#define I_IGNCR(tty) _I_FLAG((tty), IGNCR)
117#define I_ICRNL(tty) _I_FLAG((tty),ICRNL) 118#define I_ICRNL(tty) _I_FLAG((tty), ICRNL)
118#define I_IUCLC(tty) _I_FLAG((tty),IUCLC) 119#define I_IUCLC(tty) _I_FLAG((tty), IUCLC)
119#define I_IXON(tty) _I_FLAG((tty),IXON) 120#define I_IXON(tty) _I_FLAG((tty), IXON)
120#define I_IXANY(tty) _I_FLAG((tty),IXANY) 121#define I_IXANY(tty) _I_FLAG((tty), IXANY)
121#define I_IXOFF(tty) _I_FLAG((tty),IXOFF) 122#define I_IXOFF(tty) _I_FLAG((tty), IXOFF)
122#define I_IMAXBEL(tty) _I_FLAG((tty),IMAXBEL) 123#define I_IMAXBEL(tty) _I_FLAG((tty), IMAXBEL)
123#define I_IUTF8(tty) _I_FLAG((tty),IUTF8) 124#define I_IUTF8(tty) _I_FLAG((tty), IUTF8)
124 125
125#define O_OPOST(tty) _O_FLAG((tty),OPOST) 126#define O_OPOST(tty) _O_FLAG((tty), OPOST)
126#define O_OLCUC(tty) _O_FLAG((tty),OLCUC) 127#define O_OLCUC(tty) _O_FLAG((tty), OLCUC)
127#define O_ONLCR(tty) _O_FLAG((tty),ONLCR) 128#define O_ONLCR(tty) _O_FLAG((tty), ONLCR)
128#define O_OCRNL(tty) _O_FLAG((tty),OCRNL) 129#define O_OCRNL(tty) _O_FLAG((tty), OCRNL)
129#define O_ONOCR(tty) _O_FLAG((tty),ONOCR) 130#define O_ONOCR(tty) _O_FLAG((tty), ONOCR)
130#define O_ONLRET(tty) _O_FLAG((tty),ONLRET) 131#define O_ONLRET(tty) _O_FLAG((tty), ONLRET)
131#define O_OFILL(tty) _O_FLAG((tty),OFILL) 132#define O_OFILL(tty) _O_FLAG((tty), OFILL)
132#define O_OFDEL(tty) _O_FLAG((tty),OFDEL) 133#define O_OFDEL(tty) _O_FLAG((tty), OFDEL)
133#define O_NLDLY(tty) _O_FLAG((tty),NLDLY) 134#define O_NLDLY(tty) _O_FLAG((tty), NLDLY)
134#define O_CRDLY(tty) _O_FLAG((tty),CRDLY) 135#define O_CRDLY(tty) _O_FLAG((tty), CRDLY)
135#define O_TABDLY(tty) _O_FLAG((tty),TABDLY) 136#define O_TABDLY(tty) _O_FLAG((tty), TABDLY)
136#define O_BSDLY(tty) _O_FLAG((tty),BSDLY) 137#define O_BSDLY(tty) _O_FLAG((tty), BSDLY)
137#define O_VTDLY(tty) _O_FLAG((tty),VTDLY) 138#define O_VTDLY(tty) _O_FLAG((tty), VTDLY)
138#define O_FFDLY(tty) _O_FLAG((tty),FFDLY) 139#define O_FFDLY(tty) _O_FLAG((tty), FFDLY)
139 140
140#define C_BAUD(tty) _C_FLAG((tty),CBAUD) 141#define C_BAUD(tty) _C_FLAG((tty), CBAUD)
141#define C_CSIZE(tty) _C_FLAG((tty),CSIZE) 142#define C_CSIZE(tty) _C_FLAG((tty), CSIZE)
142#define C_CSTOPB(tty) _C_FLAG((tty),CSTOPB) 143#define C_CSTOPB(tty) _C_FLAG((tty), CSTOPB)
143#define C_CREAD(tty) _C_FLAG((tty),CREAD) 144#define C_CREAD(tty) _C_FLAG((tty), CREAD)
144#define C_PARENB(tty) _C_FLAG((tty),PARENB) 145#define C_PARENB(tty) _C_FLAG((tty), PARENB)
145#define C_PARODD(tty) _C_FLAG((tty),PARODD) 146#define C_PARODD(tty) _C_FLAG((tty), PARODD)
146#define C_HUPCL(tty) _C_FLAG((tty),HUPCL) 147#define C_HUPCL(tty) _C_FLAG((tty), HUPCL)
147#define C_CLOCAL(tty) _C_FLAG((tty),CLOCAL) 148#define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL)
148#define C_CIBAUD(tty) _C_FLAG((tty),CIBAUD) 149#define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD)
149#define C_CRTSCTS(tty) _C_FLAG((tty),CRTSCTS) 150#define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS)
150 151
151#define L_ISIG(tty) _L_FLAG((tty),ISIG) 152#define L_ISIG(tty) _L_FLAG((tty), ISIG)
152#define L_ICANON(tty) _L_FLAG((tty),ICANON) 153#define L_ICANON(tty) _L_FLAG((tty), ICANON)
153#define L_XCASE(tty) _L_FLAG((tty),XCASE) 154#define L_XCASE(tty) _L_FLAG((tty), XCASE)
154#define L_ECHO(tty) _L_FLAG((tty),ECHO) 155#define L_ECHO(tty) _L_FLAG((tty), ECHO)
155#define L_ECHOE(tty) _L_FLAG((tty),ECHOE) 156#define L_ECHOE(tty) _L_FLAG((tty), ECHOE)
156#define L_ECHOK(tty) _L_FLAG((tty),ECHOK) 157#define L_ECHOK(tty) _L_FLAG((tty), ECHOK)
157#define L_ECHONL(tty) _L_FLAG((tty),ECHONL) 158#define L_ECHONL(tty) _L_FLAG((tty), ECHONL)
158#define L_NOFLSH(tty) _L_FLAG((tty),NOFLSH) 159#define L_NOFLSH(tty) _L_FLAG((tty), NOFLSH)
159#define L_TOSTOP(tty) _L_FLAG((tty),TOSTOP) 160#define L_TOSTOP(tty) _L_FLAG((tty), TOSTOP)
160#define L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL) 161#define L_ECHOCTL(tty) _L_FLAG((tty), ECHOCTL)
161#define L_ECHOPRT(tty) _L_FLAG((tty),ECHOPRT) 162#define L_ECHOPRT(tty) _L_FLAG((tty), ECHOPRT)
162#define L_ECHOKE(tty) _L_FLAG((tty),ECHOKE) 163#define L_ECHOKE(tty) _L_FLAG((tty), ECHOKE)
163#define L_FLUSHO(tty) _L_FLAG((tty),FLUSHO) 164#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
164#define L_PENDIN(tty) _L_FLAG((tty),PENDIN) 165#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
165#define L_IEXTEN(tty) _L_FLAG((tty),IEXTEN) 166#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
166 167
167struct device; 168struct device;
168struct signal_struct; 169struct signal_struct;
170
171/*
172 * Port level information. Each device keeps its own port level information
173 * so provide a common structure for those ports wanting to use common support
174 * routines.
175 *
176 * The tty port has a different lifetime to the tty so must be kept apart.
177 * In addition be careful as tty -> port mappings are valid for the life
178 * of the tty object but in many cases port -> tty mappings are valid only
179 * until a hangup so don't use the wrong path.
180 */
181
182struct tty_port {
183 struct tty_struct *tty; /* Back pointer */
184 int blocked_open; /* Waiting to open */
185 int count; /* Usage count */
186 wait_queue_head_t open_wait; /* Open waiters */
187 wait_queue_head_t close_wait; /* Close waiters */
188 unsigned long flags; /* TTY flags ASY_*/
189 struct mutex mutex; /* Locking */
190 unsigned char *xmit_buf; /* Optional buffer */
191 int close_delay; /* Close port delay */
192 int closing_wait; /* Delay for output */
193};
194
169/* 195/*
170 * Where all of the state associated with a tty is kept while the tty 196 * Where all of the state associated with a tty is kept while the tty
171 * is open. Since the termios state should be kept even if the tty 197 * is open. Since the termios state should be kept even if the tty
@@ -185,6 +211,7 @@ struct tty_struct {
185 struct tty_driver *driver; 211 struct tty_driver *driver;
186 const struct tty_operations *ops; 212 const struct tty_operations *ops;
187 int index; 213 int index;
214 /* The ldisc objects are protected by tty_ldisc_lock at the moment */
188 struct tty_ldisc ldisc; 215 struct tty_ldisc ldisc;
189 struct mutex termios_mutex; 216 struct mutex termios_mutex;
190 spinlock_t ctrl_lock; 217 spinlock_t ctrl_lock;
@@ -213,7 +240,7 @@ struct tty_struct {
213 struct list_head tty_files; 240 struct list_head tty_files;
214 241
215#define N_TTY_BUF_SIZE 4096 242#define N_TTY_BUF_SIZE 4096
216 243
217 /* 244 /*
218 * The following is data for the N_TTY line discipline. For 245 * The following is data for the N_TTY line discipline. For
219 * historical reasons, this is included in the tty structure. 246 * historical reasons, this is included in the tty structure.
@@ -241,6 +268,7 @@ struct tty_struct {
241 spinlock_t read_lock; 268 spinlock_t read_lock;
242 /* If the tty has a pending do_SAK, queue it here - akpm */ 269 /* If the tty has a pending do_SAK, queue it here - akpm */
243 struct work_struct SAK_work; 270 struct work_struct SAK_work;
271 struct tty_port *port;
244}; 272};
245 273
246/* tty magic number */ 274/* tty magic number */
@@ -248,14 +276,14 @@ struct tty_struct {
248 276
249/* 277/*
250 * These bits are used in the flags field of the tty structure. 278 * These bits are used in the flags field of the tty structure.
251 * 279 *
252 * So that interrupts won't be able to mess up the queues, 280 * So that interrupts won't be able to mess up the queues,
253 * copy_to_cooked must be atomic with respect to itself, as must 281 * copy_to_cooked must be atomic with respect to itself, as must
254 * tty->write. Thus, you must use the inline functions set_bit() and 282 * tty->write. Thus, you must use the inline functions set_bit() and
255 * clear_bit() to make things atomic. 283 * clear_bit() to make things atomic.
256 */ 284 */
257#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */ 285#define TTY_THROTTLED 0 /* Call unthrottle() at threshold min */
258#define TTY_IO_ERROR 1 /* Canse an I/O error (may be no ldisc too) */ 286#define TTY_IO_ERROR 1 /* Cause an I/O error (may be no ldisc too) */
259#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */ 287#define TTY_OTHER_CLOSED 2 /* Other side (if any) has closed */
260#define TTY_EXCLUSIVE 3 /* Exclusive open mode */ 288#define TTY_EXCLUSIVE 3 /* Exclusive open mode */
261#define TTY_DEBUG 4 /* Debugging */ 289#define TTY_DEBUG 4 /* Debugging */
@@ -285,11 +313,11 @@ extern int vcs_init(void);
285extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode, 313extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
286 const char *routine); 314 const char *routine);
287extern char *tty_name(struct tty_struct *tty, char *buf); 315extern char *tty_name(struct tty_struct *tty, char *buf);
288extern void tty_wait_until_sent(struct tty_struct * tty, long timeout); 316extern void tty_wait_until_sent(struct tty_struct *tty, long timeout);
289extern int tty_check_change(struct tty_struct * tty); 317extern int tty_check_change(struct tty_struct *tty);
290extern void stop_tty(struct tty_struct * tty); 318extern void stop_tty(struct tty_struct *tty);
291extern void start_tty(struct tty_struct * tty); 319extern void start_tty(struct tty_struct *tty);
292extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc); 320extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
293extern int tty_unregister_ldisc(int disc); 321extern int tty_unregister_ldisc(int disc);
294extern int tty_register_driver(struct tty_driver *driver); 322extern int tty_register_driver(struct tty_driver *driver);
295extern int tty_unregister_driver(struct tty_driver *driver); 323extern int tty_unregister_driver(struct tty_driver *driver);
@@ -310,10 +338,10 @@ extern int is_current_pgrp_orphaned(void);
310extern struct pid *tty_get_pgrp(struct tty_struct *tty); 338extern struct pid *tty_get_pgrp(struct tty_struct *tty);
311extern int is_ignored(int sig); 339extern int is_ignored(int sig);
312extern int tty_signal(int sig, struct tty_struct *tty); 340extern int tty_signal(int sig, struct tty_struct *tty);
313extern void tty_hangup(struct tty_struct * tty); 341extern void tty_hangup(struct tty_struct *tty);
314extern void tty_vhangup(struct tty_struct * tty); 342extern void tty_vhangup(struct tty_struct *tty);
315extern void tty_unhangup(struct file *filp); 343extern void tty_unhangup(struct file *filp);
316extern int tty_hung_up_p(struct file * filp); 344extern int tty_hung_up_p(struct file *filp);
317extern void do_SAK(struct tty_struct *tty); 345extern void do_SAK(struct tty_struct *tty);
318extern void __do_SAK(struct tty_struct *tty); 346extern void __do_SAK(struct tty_struct *tty);
319extern void disassociate_ctty(int priv); 347extern void disassociate_ctty(int priv);
@@ -322,17 +350,17 @@ extern void tty_flip_buffer_push(struct tty_struct *tty);
322extern speed_t tty_get_baud_rate(struct tty_struct *tty); 350extern speed_t tty_get_baud_rate(struct tty_struct *tty);
323extern speed_t tty_termios_baud_rate(struct ktermios *termios); 351extern speed_t tty_termios_baud_rate(struct ktermios *termios);
324extern speed_t tty_termios_input_baud_rate(struct ktermios *termios); 352extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
325extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); 353extern void tty_termios_encode_baud_rate(struct ktermios *termios,
326extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); 354 speed_t ibaud, speed_t obaud);
355extern void tty_encode_baud_rate(struct tty_struct *tty,
356 speed_t ibaud, speed_t obaud);
327extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 357extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
328extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 358extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
329 359
330extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 360extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
331extern void tty_ldisc_deref(struct tty_ldisc *); 361extern void tty_ldisc_deref(struct tty_ldisc *);
332extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); 362extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *);
333 363extern const struct file_operations tty_ldiscs_proc_fops;
334extern struct tty_ldisc *tty_ldisc_get(int);
335extern void tty_ldisc_put(int);
336 364
337extern void tty_wakeup(struct tty_struct *tty); 365extern void tty_wakeup(struct tty_struct *tty);
338extern void tty_ldisc_flush(struct tty_struct *tty); 366extern void tty_ldisc_flush(struct tty_struct *tty);
@@ -351,10 +379,14 @@ extern void tty_write_unlock(struct tty_struct *tty);
351extern int tty_write_lock(struct tty_struct *tty, int ndelay); 379extern int tty_write_lock(struct tty_struct *tty, int ndelay);
352#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 380#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
353 381
382extern void tty_port_init(struct tty_port *port);
383extern int tty_port_alloc_xmit_buf(struct tty_port *port);
384extern void tty_port_free_xmit_buf(struct tty_port *port);
385
354 386
355 387
356/* n_tty.c */ 388/* n_tty.c */
357extern struct tty_ldisc tty_ldisc_N_TTY; 389extern struct tty_ldisc_ops tty_ldisc_N_TTY;
358 390
359/* tty_audit.c */ 391/* tty_audit.c */
360#ifdef CONFIG_AUDIT 392#ifdef CONFIG_AUDIT
@@ -363,7 +395,8 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
363extern void tty_audit_exit(void); 395extern void tty_audit_exit(void);
364extern void tty_audit_fork(struct signal_struct *sig); 396extern void tty_audit_fork(struct signal_struct *sig);
365extern void tty_audit_push(struct tty_struct *tty); 397extern void tty_audit_push(struct tty_struct *tty);
366extern void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid); 398extern void tty_audit_push_task(struct task_struct *tsk,
399 uid_t loginuid, u32 sessionid);
367#else 400#else
368static inline void tty_audit_add_data(struct tty_struct *tty, 401static inline void tty_audit_add_data(struct tty_struct *tty,
369 unsigned char *data, size_t size) 402 unsigned char *data, size_t size)
@@ -378,19 +411,20 @@ static inline void tty_audit_fork(struct signal_struct *sig)
378static inline void tty_audit_push(struct tty_struct *tty) 411static inline void tty_audit_push(struct tty_struct *tty)
379{ 412{
380} 413}
381static inline void tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) 414static inline void tty_audit_push_task(struct task_struct *tsk,
415 uid_t loginuid, u32 sessionid)
382{ 416{
383} 417}
384#endif 418#endif
385 419
386/* tty_ioctl.c */ 420/* tty_ioctl.c */
387extern int n_tty_ioctl(struct tty_struct * tty, struct file * file, 421extern int n_tty_ioctl(struct tty_struct *tty, struct file *file,
388 unsigned int cmd, unsigned long arg); 422 unsigned int cmd, unsigned long arg);
389 423
390/* serial.c */ 424/* serial.c */
391 425
392extern void serial_console_init(void); 426extern void serial_console_init(void);
393 427
394/* pcxx.c */ 428/* pcxx.c */
395 429
396extern int pcxe_open(struct tty_struct *tty, struct file *filp); 430extern int pcxe_open(struct tty_struct *tty, struct file *filp);
@@ -401,7 +435,7 @@ extern void console_print(const char *);
401 435
402/* vt.c */ 436/* vt.c */
403 437
404extern int vt_ioctl(struct tty_struct *tty, struct file * file, 438extern int vt_ioctl(struct tty_struct *tty, struct file *file,
405 unsigned int cmd, unsigned long arg); 439 unsigned int cmd, unsigned long arg);
406 440
407#endif /* __KERNEL__ */ 441#endif /* __KERNEL__ */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 6226504d9108..40f38d896777 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -104,7 +104,7 @@
104#include <linux/fs.h> 104#include <linux/fs.h>
105#include <linux/wait.h> 105#include <linux/wait.h>
106 106
107struct tty_ldisc { 107struct tty_ldisc_ops {
108 int magic; 108 int magic;
109 char *name; 109 char *name;
110 int num; 110 int num;
@@ -142,6 +142,11 @@ struct tty_ldisc {
142 int refcount; 142 int refcount;
143}; 143};
144 144
145struct tty_ldisc {
146 struct tty_ldisc_ops *ops;
147 int refcount;
148};
149
145#define TTY_LDISC_MAGIC 0x5403 150#define TTY_LDISC_MAGIC 0x5403
146 151
147#define LDISC_FLAG_DEFINED 0x00000001 152#define LDISC_FLAG_DEFINED 0x00000001
diff --git a/init/main.c b/init/main.c
index edeace036fd9..756eca4b821a 100644
--- a/init/main.c
+++ b/init/main.c
@@ -630,9 +630,10 @@ asmlinkage void __init start_kernel(void)
630 630
631#ifdef CONFIG_BLK_DEV_INITRD 631#ifdef CONFIG_BLK_DEV_INITRD
632 if (initrd_start && !initrd_below_start_ok && 632 if (initrd_start && !initrd_below_start_ok &&
633 initrd_start < min_low_pfn << PAGE_SHIFT) { 633 page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) {
634 printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " 634 printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
635 "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); 635 "disabling it.\n",
636 page_to_pfn(virt_to_page(initrd_start)), min_low_pfn);
636 initrd_start = 0; 637 initrd_start = 0;
637 } 638 }
638#endif 639#endif
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 5d163571d3f7..d3340dd52bcf 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -643,14 +643,7 @@ static void rfcomm_tty_wakeup(unsigned long arg)
643 return; 643 return;
644 644
645 BT_DBG("dev %p tty %p", dev, tty); 645 BT_DBG("dev %p tty %p", dev, tty);
646 646 tty_wakeup(tty);
647 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup)
648 (tty->ldisc.write_wakeup)(tty);
649
650 wake_up_interruptible(&tty->write_wait);
651#ifdef SERIAL_HAVE_POLL_WAIT
652 wake_up_interruptible(&tty->poll_wait);
653#endif
654} 647}
655 648
656static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev) 649static void rfcomm_tty_copy_pending(struct rfcomm_dev *dev)
@@ -1059,9 +1052,7 @@ static void rfcomm_tty_flush_buffer(struct tty_struct *tty)
1059 return; 1052 return;
1060 1053
1061 skb_queue_purge(&dev->dlc->tx_queue); 1054 skb_queue_purge(&dev->dlc->tx_queue);
1062 1055 tty_wakeup(tty);
1063 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && tty->ldisc.write_wakeup)
1064 tty->ldisc.write_wakeup(tty);
1065} 1056}
1066 1057
1067static void rfcomm_tty_send_xchar(struct tty_struct *tty, char ch) 1058static void rfcomm_tty_send_xchar(struct tty_struct *tty, char ch)
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 76c3057d0179..e4e2caeb9d82 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -650,12 +650,7 @@ static void ircomm_tty_do_softint(struct work_struct *work)
650 } 650 }
651 651
652 /* Check if user (still) wants to be waken up */ 652 /* Check if user (still) wants to be waken up */
653 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 653 tty_wakeup(tty);
654 tty->ldisc.write_wakeup)
655 {
656 (tty->ldisc.write_wakeup)(tty);
657 }
658 wake_up_interruptible(&tty->write_wait);
659} 654}
660 655
661/* 656/*
@@ -1141,6 +1136,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1141 struct sk_buff *skb) 1136 struct sk_buff *skb)
1142{ 1137{
1143 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; 1138 struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
1139 struct tty_ldisc *ld;
1144 1140
1145 IRDA_DEBUG(2, "%s()\n", __func__ ); 1141 IRDA_DEBUG(2, "%s()\n", __func__ );
1146 1142
@@ -1173,7 +1169,11 @@ static int ircomm_tty_data_indication(void *instance, void *sap,
1173 * involve the flip buffers, since we are not running in an interrupt 1169 * involve the flip buffers, since we are not running in an interrupt
1174 * handler 1170 * handler
1175 */ 1171 */
1176 self->tty->ldisc.receive_buf(self->tty, skb->data, NULL, skb->len); 1172
1173 ld = tty_ldisc_ref(self->tty);
1174 if (ld)
1175 ld->ops->receive_buf(self->tty, skb->data, NULL, skb->len);
1176 tty_ldisc_deref(ld);
1177 1177
1178 /* No need to kfree_skb - see ircomm_ttp_data_indication() */ 1178 /* No need to kfree_skb - see ircomm_ttp_data_indication() */
1179 1179