patch-2.3.7 linux/drivers/acorn/char/serial-card.c

Next file: linux/drivers/acorn/net/ether1.c
Previous file: linux/drivers/acorn/char/mouse_rpc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/drivers/acorn/char/serial-card.c linux/drivers/acorn/char/serial-card.c
@@ -33,14 +33,20 @@
 #ifdef MODULE
 static int __serial_ports[NUM_SERIALS];
 static int __serial_pcount;
+static int __serial_addr[NUM_SERIALS];
 static struct expansion_card *expcard[MAX_ECARDS];
 #define ADD_ECARD(ec,card) expcard[(card)] = (ec)
-#define ADD_PORT(port) __serial_ports[__serial_pcount++] = (port)
+#define ADD_PORT(port,addr)					\
+	do {							\
+		__serial_ports[__serial_pcount] = (port);	\
+		__serial_addr[__serial_pcount] = (addr);	\
+		__serial_pcount += 1;				\
+	} while (0)
 #undef MY_INIT
 #define MY_INIT init_module
 #else
 #define ADD_ECARD(ec,card)
-#define ADD_PORT(port)
+#define ADD_PORT(port,addr)
 #endif
 
 static const card_ids serial_cids[] = { MY_CARD_LIST, { 0xffff, 0xffff } };
@@ -75,12 +81,15 @@
 	cardaddr = MY_BASE_ADDRESS(ec);
 
 	for (port = 0; port < MY_NUMPORTS; port ++) {
+	    unsigned long address;
 	    int line;
 
-	    line = serial_register_onedev (MY_PORT_ADDRESS(port, cardaddr), ec->irq);
+	    address = MY_PORT_ADDRESS(port, cardaddr);
+
+	    line = serial_register_onedev (address, ec->irq);
 	    if (line < 0)
 		break;
-	    ADD_PORT(line);
+	    ADD_PORT(line, address);
 	}
 
 	if (port) {
@@ -97,8 +106,10 @@
 {
     int i;
 
-    for (i = 0; i < __serial_pcount; i++)
-	unregister_serial (__serial_ports[i]);
+    for (i = 0; i < __serial_pcount; i++) {
+	unregister_serial(__serial_ports[i]);
+	release_region(__serial_addr[i], 8);
+    }
 
     for (i = 0; i < MAX_ECARDS; i++)
 	if (expcard[i])

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)