diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-cd.c | 46 | ||||
-rw-r--r-- | drivers/ide/ide-cd.h | 12 | ||||
-rw-r--r-- | drivers/ide/ide-cs.c | 17 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 32 | ||||
-rw-r--r-- | drivers/ide/ide.c | 2 |
5 files changed, 45 insertions, 64 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 78ad38337..d209c29ff 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -282,9 +282,12 @@ * - cdrom_read_capacity returns one frame too little. * - Fix real capacity reporting. * + * 4.58 May 1, 2000 - Clean up ACER50 stuff. + * - Fix small problem with ide_cdrom_capacity + * *************************************************************************/ -#define IDECD_VERSION "4.57" +#define IDECD_VERSION "4.58" #include <linux/config.h> #include <linux/module.h> @@ -1521,7 +1524,7 @@ cdrom_lockdoor(ide_drive_t *drive, int lockflag, struct request_sense *sense) memset(&pc, 0, sizeof(pc)); pc.sense = sense; pc.c[0] = GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL; - pc.c[4] = (lockflag != 0); + pc.c[4] = lockflag ? 3 : 0; stat = cdrom_queue_packet_command (drive, &pc); } @@ -1857,6 +1860,10 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi, pc.buffer = cgc->buffer; pc.buflen = cgc->buflen; cgc->stat = cdrom_queue_packet_command(drive, &pc); + + /* + * FIXME: copy sense, don't just assign pointer!! + */ cgc->sense = pc.sense; return cgc->stat; @@ -2159,9 +2166,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) { struct cdrom_info *info = drive->driver_data; struct cdrom_device_info *devinfo = &info->devinfo; - int minor = (drive->select.b.unit)<<PARTN_BITS; + int minor = (drive->select.b.unit) << PARTN_BITS; - devinfo->dev = MKDEV (HWIF(drive)->major, minor | CD_PART_MASK); + devinfo->dev = MKDEV (HWIF(drive)->major, minor); devinfo->ops = &ide_cdrom_dops; devinfo->mask = 0; *(int *)&devinfo->speed = CDROM_STATE_FLAGS (drive)->current_speed; @@ -2195,22 +2202,23 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots) return register_cdrom(devinfo); } -/* - * the buffer struct used by ide_cdrom_get_capabilities() - */ -struct get_capabilities_buf { - char pad[8]; - struct atapi_capabilities_page cap; - char extra_cap[4]; -}; - static int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_page *cap) { struct cdrom_info *info = drive->driver_data; struct cdrom_device_info *cdi = &info->devinfo; struct cdrom_generic_command cgc; - int stat, attempts = 3; + int stat, attempts = 3, size = sizeof(*cap); + + /* + * ACER50 (and others?) require the full spec length mode sense + * page capabilities size, but older drives break. + */ + if (drive->id) { + if (!(!strcmp(drive->id->model, "ATAPI CD ROM DRIVE 50X MAX") || + !strcmp(drive->id->model, "WPI CDS-32X"))) + size -= sizeof(cap->pad); + } /* we have to cheat a little here. the packet will eventually * be queued with ide_cdrom_packet(), which extracts the @@ -2220,7 +2228,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag */ cdi->handle = (ide_drive_t *) drive; cdi->ops = &ide_cdrom_dops; - init_cdrom_command(&cgc, cap, sizeof(*cap), CGC_DATA_UNKNOWN); + init_cdrom_command(&cgc, cap, size, CGC_DATA_UNKNOWN); do { /* we seem to get stat=0x01,err=0x00 the first time (??) */ stat = cdrom_mode_sense(cdi, &cgc, GPMODE_CAPABILITIES_PAGE, 0); if (!stat) @@ -2513,9 +2521,8 @@ void ide_cdrom_release (struct inode *inode, struct file *file, static int ide_cdrom_check_media_change (ide_drive_t *drive) { - return cdrom_fops.check_media_change - (MKDEV (HWIF (drive)->major, - (drive->select.b.unit)<<PARTN_BITS)); + return cdrom_fops.check_media_change(MKDEV (HWIF (drive)->major, + (drive->select.b.unit) << PARTN_BITS)); } static @@ -2545,8 +2552,7 @@ unsigned long ide_cdrom_capacity (ide_drive_t *drive) { unsigned capacity; - capacity = cdrom_read_capacity(drive, &capacity, NULL); - return capacity ? 0 : capacity * SECTORS_PER_FRAME; + return cdrom_read_capacity(drive, &capacity, NULL) ? 0 : capacity * SECTORS_PER_FRAME; } static diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index bf603f596..1d901d3c7 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -10,15 +10,6 @@ #include <linux/cdrom.h> #include <asm/byteorder.h> -/* - * Apparently older drives have problems with filling out the entire - * mode_sense capability structure. Define this to 1 if your drive isn't - * probed correctly. - */ -#ifndef BROKEN_CAP_PAGE -#define BROKEN_CAP_PAGE 0 -#endif - /* Turn this on to have the driver print out the meanings of the ATAPI error codes. This will use up additional kernel-space memory, though. */ @@ -114,6 +105,7 @@ struct packet_command { char *buffer; int buflen; int stat; + int quiet; struct request_sense *sense; unsigned char c[12]; }; @@ -410,9 +402,7 @@ struct atapi_capabilities_page { unsigned short buffer_size; /* Current speed (in kB/s). */ unsigned short curspeed; -#if !BROKEN_CAP_PAGE char pad[4]; -#endif }; diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 73d285cb1..70da1321a 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -183,7 +183,6 @@ static dev_link_t *ide_attach(void) static void ide_detach(dev_link_t *link) { dev_link_t **linkp; - long flags; int ret; DEBUG(0, "ide_detach(0x%p)\n", link); @@ -194,14 +193,7 @@ static void ide_detach(dev_link_t *link) if (*linkp == NULL) return; - save_flags(flags); - cli(); - if (link->state & DEV_RELEASE_PENDING) { - del_timer(&link->release); - link->state &= ~DEV_RELEASE_PENDING; - } - restore_flags(flags); - + del_timer(&link->release); if (link->state & DEV_CONFIG) ide_release((u_long)link); @@ -425,11 +417,8 @@ int ide_event(event_t event, int priority, switch (event) { case CS_EVENT_CARD_REMOVAL: link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) { - link->release.expires = jiffies + HZ/20; - link->state |= DEV_RELEASE_PENDING; - add_timer(&link->release); - } + if (link->state & DEV_CONFIG) + mod_timer(&link->release, jiffies + HZ/20); break; case CS_EVENT_CARD_INSERTION: link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 22fdcbfe5..2b590266b 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -5887,24 +5887,20 @@ static ide_proc_entry_t idetape_proc[] = { * IDE subdriver functions, registered with ide.c */ static ide_driver_t idetape_driver = { - "ide-tape", /* name */ - IDETAPE_VERSION, /* version */ - ide_tape, /* media */ - 1, /* busy */ - 1, /* supports_dma */ - 1, /* supports_dsc_overlap */ - idetape_cleanup, /* cleanup */ - idetape_do_request, /* do_request */ - idetape_end_request, /* end_request */ - idetape_blkdev_ioctl, /* ioctl */ - idetape_blkdev_open, /* open */ - idetape_blkdev_release, /* release */ - NULL, /* media_change */ - NULL, /* revalidate */ - idetape_pre_reset, /* pre_reset */ - NULL, /* capacity */ - NULL, /* special */ - idetape_proc /* proc */ + name: "ide-tape", + version: IDETAPE_VERSION, + media: ide_tape, + busy: 1, + supports_dma: 1, + supports_dsc_overlap: 1, + cleanup: idetape_cleanup, + do_request: idetape_do_request, + end_request: idetape_end_request, + ioctl: idetape_blkdev_ioctl, + open: idetape_blkdev_open, + release: idetape_blkdev_release, + pre_reset: idetape_pre_reset, + proc: idetape_proc, }; int idetape_init (void); diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 712ec7502..039c0bfd9 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -1256,7 +1256,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) if (0 < (signed long)(jiffies + WAIT_MIN_SLEEP - sleep)) sleep = jiffies + WAIT_MIN_SLEEP; #if 1 - if (hwgroup->timer.next || hwgroup->timer.prev) + if (timer_pending(&hwgroup->timer)) printk("ide_set_handler: timer already active\n"); #endif hwgroup->sleeping = 1; /* so that ide_timer_expiry knows what to do */ |