cdi->handle = (ide_drive_t *) drive; 
cdi->handle = drive; 
int ide_cdrom_probe_capabilities (ide_drive_t *drive){	struct cdrom_info *info = drive->driver_data;	struct cdrom_device_info *cdi = &info->devinfo;	struct atapi_capabilities_page cap;	int nslots = 1;	if (drive->media == ide_optical) {		CDROM_CONFIG_FLAGS(drive)->mo_drive = 1;		CDROM_CONFIG_FLAGS(drive)->ram = 1;		printk(KERN_ERR "%s: ATAPI magneto-optical drive\n", drive->name);		return nslots;	}	if (CDROM_CONFIG_FLAGS(drive)->nec260 ||	    !strcmp(drive->id->model,"STINGRAY 8422 IDE 8X CD-ROM 7-27-95")) {		CDROM_CONFIG_FLAGS(drive)->no_eject = 0;		CDROM_CONFIG_FLAGS(drive)->audio_play = 1;		return nslots;	}	/*	 * we have to cheat a little here. the packet will eventually	 * be queued with ide_cdrom_packet(), which extracts the	 * drive from cdi->handle. Since this device hasn't been	 * registered with the Uniform layer yet, it can't do this.	 * Same goes for cdi->ops.	 */	cdi->handle = (ide_drive_t *) drive;	cdi->ops = &ide_cdrom_dops;	if (ide_cdrom_get_capabilities(drive, &cap))		return 0;	if (cap.lock == 0)		CDROM_CONFIG_FLAGS(drive)->no_doorlock = 1;	if (cap.eject)		CDROM_CONFIG_FLAGS(drive)->no_eject = 0;	if (cap.cd_r_write)		CDROM_CONFIG_FLAGS(drive)->cd_r = 1;	if (cap.cd_rw_write) {		CDROM_CONFIG_FLAGS(drive)->cd_rw = 1;		CDROM_CONFIG_FLAGS(drive)->ram = 1;	}	if (cap.test_write)		CDROM_CONFIG_FLAGS(drive)->test_write = 1;	if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)		CDROM_CONFIG_FLAGS(drive)->dvd = 1;	if (cap.dvd_ram_write) {		CDROM_CONFIG_FLAGS(drive)->dvd_ram = 1;		CDROM_CONFIG_FLAGS(drive)->ram = 1;	}	if (cap.dvd_r_write)		CDROM_CONFIG_FLAGS(drive)->dvd_r = 1;	if (cap.audio_play)		CDROM_CONFIG_FLAGS(drive)->audio_play = 1;	if (cap.mechtype == mechtype_caddy || cap.mechtype == mechtype_popup)		CDROM_CONFIG_FLAGS(drive)->close_tray = 0;	/* Some drives used by Apple don't advertise audio play	 * but they do support reading TOC & audio datas	 */	if (strcmp(drive->id->model, "MATSHITADVD-ROM SR-8187") == 0 ||	    strcmp(drive->id->model, "MATSHITADVD-ROM SR-8186") == 0 ||	    strcmp(drive->id->model, "MATSHITADVD-ROM SR-8176") == 0 ||	    strcmp(drive->id->model, "MATSHITADVD-ROM SR-8174") == 0)		CDROM_CONFIG_FLAGS(drive)->audio_play = 1;#if ! STANDARD_ATAPI	if (cdi->sanyo_slot > 0) {		CDROM_CONFIG_FLAGS(drive)->is_changer = 1;		nslots = 3;	}	else#endif /* not STANDARD_ATAPI */	if (cap.mechtype == mechtype_individual_changer ||	    cap.mechtype == mechtype_cartridge_changer) {		if ((nslots = cdrom_number_of_slots(cdi)) > 1) {			CDROM_CONFIG_FLAGS(drive)->is_changer = 1;			CDROM_CONFIG_FLAGS(drive)->supp_disc_present = 1;		}	}	ide_cdrom_update_speed(drive, &cap);	/* don't print speed if the drive reported 0.	 */	printk(KERN_INFO "%s: ATAPI", drive->name);	if (CDROM_CONFIG_FLAGS(drive)->max_speed)		printk(" %dX", CDROM_CONFIG_FLAGS(drive)->max_speed);	printk(" %s", CDROM_CONFIG_FLAGS(drive)->dvd ? "DVD-ROM" : "CD-ROM");	if (CDROM_CONFIG_FLAGS(drive)->dvd_r|CDROM_CONFIG_FLAGS(drive)->dvd_ram)        	printk(" DVD%s%s",         	(CDROM_CONFIG_FLAGS(drive)->dvd_r)? "-R" : "",         	(CDROM_CONFIG_FLAGS(drive)->dvd_ram)? "-RAM" : "");        if (CDROM_CONFIG_FLAGS(drive)->cd_r|CDROM_CONFIG_FLAGS(drive)->cd_rw)         	printk(" CD%s%s",         	(CDROM_CONFIG_FLAGS(drive)->cd_r)? "-R" : "",         	(CDROM_CONFIG_FLAGS(drive)->cd_rw)? "/RW" : "");        if (CDROM_CONFIG_FLAGS(drive)->is_changer)         	printk(" changer w/%d slots", nslots);        else 	        	printk(" drive");	printk(", %dkB Cache", be16_to_cpu(cap.buffer_size));	if (drive->using_dma)		ide_dma_verbose(drive);	printk("\n");	return nslots;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/2a91f3e54ff27c6002597f689ba51c5fa657ddbd/ide-cd.c/buggy/drivers/ide/ide-cd.c