patch-2.1.78 linux/drivers/ap1000/ddv.c

Next file: linux/drivers/block/acsi.c
Previous file: linux/arch/i386/kernel/vm86.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.77/linux/drivers/ap1000/ddv.c linux/drivers/ap1000/ddv.c
@@ -985,9 +985,10 @@
 int init_module(void)
 {
 	int error = ddv_init();
-	ddv_geninit(&(struct gendisk) { 0,0,0,0,0,0,0,0,0,0,0 });
-	if (!error)
+	if (!error) {
+		ddv_geninit(&(struct gendisk) { 0,0,0,0,0,0,0,0,0,0,0 });
 		printk(KERN_INFO "DDV: Loaded as module.\n");
+	}
 	return error;
 }
 
@@ -995,6 +996,7 @@
 void cleanup_module(void)
 {
 	int i;
+	struct gendisk ** gdp;
 
 	for (i = 0 ; i < NUM_DDVDEVS; i++)
 		invalidate_buffers(MKDEV(MAJOR_NR, i));
@@ -1004,6 +1006,11 @@
 	OPT_IO(PRST) = PRST_IRST; 
 
 	unregister_blkdev( MAJOR_NR, DEVICE_NAME );
+	for (gdp = &gendisk_head; *gdp; gdp = &((*gdp)->next))
+		if (*gdp == &ddv_gendisk)
+			break;
+	if (*gdp)
+		*gdp = (*gdp)->next;
 	free_irq(APOPT0_IRQ, NULL);
 	blk_dev[MAJOR_NR].request_fn = 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov