err = platform_device_register(&floppy_device); if (err) goto out_flush_work;  
static int __init floppy_init(void){	int i, unit, drive;	int err, dr;	raw_cmd = NULL;	for (dr = 0; dr < N_DRIVE; dr++) {		disks[dr] = alloc_disk(1);		if (!disks[dr]) {			err = -ENOMEM;			goto out_put_disk;		}		disks[dr]->major = FLOPPY_MAJOR;		disks[dr]->first_minor = TOMINOR(dr);		disks[dr]->fops = &floppy_fops;		sprintf(disks[dr]->disk_name, "fd%d", dr);		init_timer(&motor_off_timer[dr]);		motor_off_timer[dr].data = dr;		motor_off_timer[dr].function = motor_off_callback;	}	devfs_mk_dir("floppy");	err = register_blkdev(FLOPPY_MAJOR, "fd");	if (err)		goto out_devfs_remove;	floppy_queue = blk_init_queue(do_fd_request, &floppy_lock);	if (!floppy_queue) {		err = -ENOMEM;		goto out_unreg_blkdev;	}	blk_queue_max_sectors(floppy_queue, 64);	blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,			    floppy_find, NULL, NULL);	for (i = 0; i < 256; i++)		if (ITYPE(i))			floppy_sizes[i] = floppy_type[ITYPE(i)].size;		else			floppy_sizes[i] = MAX_DISK_SIZE << 1;	reschedule_timeout(MAXTIMEOUT, "floppy init", MAXTIMEOUT);	config_types();	for (i = 0; i < N_FDC; i++) {		fdc = i;		CLEARSTRUCT(FDCS);		FDCS->dtr = -1;		FDCS->dor = 0x4;#if defined(__sparc__) || defined(__mc68000__)		/*sparcs/sun3x don't have a DOR reset which we can fall back on to */#ifdef __mc68000__		if (MACH_IS_SUN3X)#endif			FDCS->version = FDC_82072A;#endif	}	use_virtual_dma = can_use_virtual_dma & 1;#if defined(CONFIG_PPC64)	if (check_legacy_ioport(FDC1)) {		del_timer(&fd_timeout);		err = -ENODEV;		goto out_unreg_region;	}#endif	fdc_state[0].address = FDC1;	if (fdc_state[0].address == -1) {		del_timer(&fd_timeout);		err = -ENODEV;		goto out_unreg_region;	}#if N_FDC > 1	fdc_state[1].address = FDC2;#endif	fdc = 0;		/* reset fdc in case of unexpected interrupt */	err = floppy_grab_irq_and_dma();	if (err) {		del_timer(&fd_timeout);		err = -EBUSY;		goto out_unreg_region;	}	/* initialise drive state */	for (drive = 0; drive < N_DRIVE; drive++) {		CLEARSTRUCT(UDRS);		CLEARSTRUCT(UDRWE);		USETF(FD_DISK_NEWCHANGE);		USETF(FD_DISK_CHANGED);		USETF(FD_VERIFY);		UDRS->fd_device = -1;		floppy_track_buffer = NULL;		max_buffer_sectors = 0;	}	/*	 * Small 10 msec delay to let through any interrupt that	 * initialization might have triggered, to not	 * confuse detection:	 */	msleep(10);	for (i = 0; i < N_FDC; i++) {		fdc = i;		FDCS->driver_version = FD_DRIVER_VERSION;		for (unit = 0; unit < 4; unit++)			FDCS->track[unit] = 0;		if (FDCS->address == -1)			continue;		FDCS->rawcmd = 2;		if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) {			/* free ioports reserved by floppy_grab_irq_and_dma() */			release_region(FDCS->address + 2, 4);			release_region(FDCS->address + 7, 1);			FDCS->address = -1;			FDCS->version = FDC_NONE;			continue;		}		/* Try to determine the floppy controller type */		FDCS->version = get_fdc_version();		if (FDCS->version == FDC_NONE) {			/* free ioports reserved by floppy_grab_irq_and_dma() */			release_region(FDCS->address + 2, 4);			release_region(FDCS->address + 7, 1);			FDCS->address = -1;			continue;		}		if (can_use_virtual_dma == 2 && FDCS->version < FDC_82072A)			can_use_virtual_dma = 0;		have_no_fdc = 0;		/* Not all FDCs seem to be able to handle the version command		 * properly, so force a reset for the standard FDC clones,		 * to avoid interrupt garbage.		 */		user_reset_fdc(-1, FD_RESET_ALWAYS, 0);	}	fdc = 0;	del_timer(&fd_timeout);	current_drive = 0;	floppy_release_irq_and_dma();	initialising = 0;	if (have_no_fdc) {		DPRINT("no floppy controllers found\n");		err = have_no_fdc;		goto out_flush_work;	}	err = platform_device_register(&floppy_device);	if (err)		goto out_flush_work;	for (drive = 0; drive < N_DRIVE; drive++) {		if (!(allowed_drive_mask & (1 << drive)))			continue;		if (fdc_state[FDC(drive)].version == FDC_NONE)			continue;		/* to be cleaned up... */		disks[drive]->private_data = (void *)(long)drive;		disks[drive]->queue = floppy_queue;		disks[drive]->flags |= GENHD_FL_REMOVABLE;		disks[drive]->driverfs_dev = &floppy_device.dev;		add_disk(disks[drive]);	}	return 0;out_flush_work:	flush_scheduled_work();	if (usage_count)		floppy_release_irq_and_dma();out_unreg_region:	blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);	blk_cleanup_queue(floppy_queue);out_unreg_blkdev:	unregister_blkdev(FLOPPY_MAJOR, "fd");out_devfs_remove:	devfs_remove("floppy");out_put_disk:	while (dr--) {		del_timer(&motor_off_timer[dr]);		put_disk(disks[dr]);	}	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/94fd0db7bfb4a03da202fd426d4e8e7eab42ab86/floppy.c/clean/drivers/block/floppy.c