diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/hpt366.c | 2 | ||||
-rw-r--r-- | drivers/ide/ht6560b.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 14 | ||||
-rw-r--r-- | drivers/ide/ide-cs.c | 156 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 16 | ||||
-rw-r--r-- | drivers/ide/ide-disk_ioctl.c | 7 | ||||
-rw-r--r-- | drivers/ide/ide-floppy_ioctl.c | 7 | ||||
-rw-r--r-- | drivers/ide/ide-gd.c | 10 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 13 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 20 |
10 files changed, 67 insertions, 179 deletions
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index 45163693f73..97d98fbf584 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -12,7 +12,7 @@ * * * HighPoint has its own drivers (open source except for the RAID part) - * available from http://www.highpoint-tech.com/BIOS%20+%20Driver/. + * available from http://www.highpoint-tech.com/USA_new/service_support.htm * This may be useful to anyone wanting to work on this driver, however do not * trust them too much since the code tends to become less and less meaningful * as the time passes... :-/ diff --git a/drivers/ide/ht6560b.c b/drivers/ide/ht6560b.c index d81e49680c3..808bcdcbf8e 100644 --- a/drivers/ide/ht6560b.c +++ b/drivers/ide/ht6560b.c @@ -10,7 +10,6 @@ * Author: Mikko Ala-Fossi <maf@iki.fi> * Jan Evert van Grootheest <j.e.van.grootheest@caiway.nl> * - * Try: http://www.maf.iki.fi/~maf/ht6560b/ */ #define DRV_NAME "ht6560b" diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 31fc76960a8..0c73fe39a23 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -31,7 +31,6 @@ #include <linux/delay.h> #include <linux/timer.h> #include <linux/seq_file.h> -#include <linux/smp_lock.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/errno.h> @@ -52,6 +51,7 @@ #include "ide-cd.h" +static DEFINE_MUTEX(ide_cd_mutex); static DEFINE_MUTEX(idecd_ref_mutex); static void ide_cd_release(struct device *); @@ -1602,7 +1602,7 @@ static int idecd_open(struct block_device *bdev, fmode_t mode) struct cdrom_info *info; int rc = -ENXIO; - lock_kernel(); + mutex_lock(&ide_cd_mutex); info = ide_cd_get(bdev->bd_disk); if (!info) goto out; @@ -1611,7 +1611,7 @@ static int idecd_open(struct block_device *bdev, fmode_t mode) if (rc < 0) ide_cd_put(info); out: - unlock_kernel(); + mutex_unlock(&ide_cd_mutex); return rc; } @@ -1619,11 +1619,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode) { struct cdrom_info *info = ide_drv_g(disk, cdrom_info); - lock_kernel(); + mutex_lock(&ide_cd_mutex); cdrom_release(&info->devinfo, mode); ide_cd_put(info); - unlock_kernel(); + mutex_unlock(&ide_cd_mutex); return 0; } @@ -1694,9 +1694,9 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode, { int ret; - lock_kernel(); + mutex_lock(&ide_cd_mutex); ret = idecd_locked_ioctl(bdev, mode, cmd, arg); - unlock_kernel(); + mutex_unlock(&ide_cd_mutex); return ret; } diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 2a4cb9c18f0..404843e8611 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -43,7 +43,6 @@ #include <asm/io.h> #include <asm/system.h> -#include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> #include <pcmcia/cisreg.h> @@ -72,17 +71,6 @@ static int ide_config(struct pcmcia_device *); static void ide_detach(struct pcmcia_device *p_dev); - - - -/*====================================================================== - - ide_attach() creates an "instance" of the driver, allocating - local data structures for one device. The device is registered - with Card Services. - -======================================================================*/ - static int ide_probe(struct pcmcia_device *link) { ide_info_t *info; @@ -97,23 +85,12 @@ static int ide_probe(struct pcmcia_device *link) info->p_dev = link; link->priv = info; - link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; - link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; - link->conf.Attributes = CONF_ENABLE_IRQ; - link->conf.IntType = INT_MEMORY_AND_IO; + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO | + CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC; return ide_config(link); } /* ide_attach */ -/*====================================================================== - - This deletes a driver "instance". The device is de-registered - with Card Services. If it has been released, all local data - structures are freed. Otherwise, the structures will be freed - when the device is released. - -======================================================================*/ - static void ide_detach(struct pcmcia_device *link) { ide_info_t *info = link->priv; @@ -187,79 +164,31 @@ out_release: return NULL; } -/*====================================================================== - - ide_config() is scheduled to run after a CARD_INSERTION event - is received, to configure the PCMCIA socket, and to make the - ide device available to the system. - -======================================================================*/ - -struct pcmcia_config_check { - unsigned long ctl_base; - int skip_vcc; - int is_kme; -}; - -static int pcmcia_check_one_config(struct pcmcia_device *pdev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - unsigned int vcc, - void *priv_data) +static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) { - struct pcmcia_config_check *stk = priv_data; - - /* Check for matching Vcc, unless we're desperate */ - if (!stk->skip_vcc) { - if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) - return -ENODEV; - } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) - return -ENODEV; - } - } + int *is_kme = priv_data; - if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; - - pdev->conf.ConfigIndex = cfg->index; - pdev->resource[0]->start = io->win[0].base; - if (!(io->flags & CISTPL_IO_16BIT)) { - pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; - pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; - } - if (io->nwin == 2) { - pdev->resource[0]->end = 8; - pdev->resource[1]->start = io->win[1].base; - pdev->resource[1]->end = (stk->is_kme) ? 2 : 1; - if (pcmcia_request_io(pdev) != 0) - return -ENODEV; - stk->ctl_base = pdev->resource[1]->start; - } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { - pdev->resource[0]->end = io->win[0].len; - pdev->resource[1]->end = 0; - if (pcmcia_request_io(pdev) != 0) - return -ENODEV; - stk->ctl_base = pdev->resource[0]->start + 0x0e; - } else + if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { + pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + } + pdev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; + pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; + + if (pdev->resource[1]->end) { + pdev->resource[0]->end = 8; + pdev->resource[1]->end = (*is_kme) ? 2 : 1; + } else { + if (pdev->resource[0]->end < 16) return -ENODEV; - /* If we've got this far, we're done */ - return 0; } - return -ENODEV; + + return pcmcia_request_io(pdev); } static int ide_config(struct pcmcia_device *link) { ide_info_t *info = link->priv; - struct pcmcia_config_check *stk = NULL; int ret = 0, is_kme = 0; unsigned long io_base, ctl_base; struct ide_host *host; @@ -270,23 +199,21 @@ static int ide_config(struct pcmcia_device *link) ((link->card_id == PRODID_KME_KXLC005_A) || (link->card_id == PRODID_KME_KXLC005_B))); - stk = kzalloc(sizeof(*stk), GFP_KERNEL); - if (!stk) - goto err_mem; - stk->is_kme = is_kme; - stk->skip_vcc = io_base = ctl_base = 0; - - if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { - stk->skip_vcc = 1; - if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) + if (pcmcia_loop_config(link, pcmcia_check_one_config, &is_kme)) { + link->config_flags &= ~CONF_AUTO_CHECK_VCC; + if (pcmcia_loop_config(link, pcmcia_check_one_config, &is_kme)) goto failed; /* No suitable config found */ } io_base = link->resource[0]->start; - ctl_base = stk->ctl_base; + if (link->resource[1]->end) + ctl_base = link->resource[1]->start; + else + ctl_base = link->resource[0]->start + 0x0e; if (!link->irq) goto failed; - ret = pcmcia_request_configuration(link, &link->conf); + + ret = pcmcia_enable_device(link); if (ret) goto failed; @@ -311,29 +238,15 @@ static int ide_config(struct pcmcia_device *link) info->host = host; dev_info(&link->dev, "ide-cs: hd%c: Vpp = %d.%d\n", 'a' + host->ports[0]->index * 2, - link->conf.Vpp / 10, link->conf.Vpp % 10); + link->vpp / 10, link->vpp % 10); - kfree(stk); return 0; -err_mem: - printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); - goto failed; - failed: - kfree(stk); ide_release(link); return -ENODEV; } /* ide_config */ -/*====================================================================== - - After a card is removed, ide_release() will unregister the net - device, and release the PCMCIA configuration. If the device is - still open, this will be postponed until it is closed. - -======================================================================*/ - static void ide_release(struct pcmcia_device *link) { ide_info_t *info = link->priv; @@ -359,15 +272,6 @@ static void ide_release(struct pcmcia_device *link) } /* ide_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. A CARD_REMOVAL event - also sets some flags to discourage the ide drivers from - talking to the ports. - -======================================================================*/ - static struct pcmcia_device_id ide_ids[] = { PCMCIA_DEVICE_FUNC_ID(4), PCMCIA_DEVICE_MANF_CARD(0x0000, 0x0000), /* Corsair */ @@ -440,9 +344,7 @@ MODULE_DEVICE_TABLE(pcmcia, ide_ids); static struct pcmcia_driver ide_cs_driver = { .owner = THIS_MODULE, - .drv = { - .name = "ide-cs", - }, + .name = "ide-cs", .probe = ide_probe, .remove = ide_detach, .id_table = ide_ids, diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 7433e07de30..274798068a5 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -435,12 +435,11 @@ static int idedisk_prep_fn(struct request_queue *q, struct request *rq) if (!(rq->cmd_flags & REQ_FLUSH)) return BLKPREP_OK; - cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); + cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); /* FIXME: map struct ide_taskfile on rq->cmd[] */ BUG_ON(cmd == NULL); - memset(cmd, 0, sizeof(*cmd)); if (ata_id_flush_ext_enabled(drive->id) && (drive->capacity64 >= (1UL << 28))) cmd->tf.command = ATA_CMD_FLUSH_EXT; @@ -516,10 +515,10 @@ static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) return ide_no_data_taskfile(drive, &cmd); } -static void update_ordered(ide_drive_t *drive) +static void update_flush(ide_drive_t *drive) { u16 *id = drive->id; - unsigned ordered = QUEUE_ORDERED_NONE; + unsigned flush = 0; if (drive->dev_flags & IDE_DFLAG_WCACHE) { unsigned long long capacity; @@ -543,13 +542,12 @@ static void update_ordered(ide_drive_t *drive) drive->name, barrier ? "" : "not "); if (barrier) { - ordered = QUEUE_ORDERED_DRAIN_FLUSH; + flush = REQ_FLUSH; blk_queue_prep_rq(drive->queue, idedisk_prep_fn); } - } else - ordered = QUEUE_ORDERED_DRAIN; + } - blk_queue_ordered(drive->queue, ordered); + blk_queue_flush(drive->queue, flush); } ide_devset_get_flag(wcache, IDE_DFLAG_WCACHE); @@ -572,7 +570,7 @@ static int set_wcache(ide_drive_t *drive, int arg) } } - update_ordered(drive); + update_flush(drive); return err; } diff --git a/drivers/ide/ide-disk_ioctl.c b/drivers/ide/ide-disk_ioctl.c index ec94c66918f..da36f729ff3 100644 --- a/drivers/ide/ide-disk_ioctl.c +++ b/drivers/ide/ide-disk_ioctl.c @@ -1,10 +1,11 @@ #include <linux/kernel.h> #include <linux/ide.h> #include <linux/hdreg.h> -#include <linux/smp_lock.h> +#include <linux/mutex.h> #include "ide-disk.h" +static DEFINE_MUTEX(ide_disk_ioctl_mutex); static const struct ide_ioctl_devset ide_disk_ioctl_settings[] = { { HDIO_GET_ADDRESS, HDIO_SET_ADDRESS, &ide_devset_address }, { HDIO_GET_MULTCOUNT, HDIO_SET_MULTCOUNT, &ide_devset_multcount }, @@ -19,13 +20,13 @@ int ide_disk_ioctl(ide_drive_t *drive, struct block_device *bdev, fmode_t mode, { int err; - lock_kernel(); + mutex_lock(&ide_disk_ioctl_mutex); err = ide_setting_ioctl(drive, bdev, cmd, arg, ide_disk_ioctl_settings); if (err != -EOPNOTSUPP) goto out; err = generic_ide_ioctl(drive, bdev, cmd, arg); out: - unlock_kernel(); + mutex_unlock(&ide_disk_ioctl_mutex); return err; } diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c index fd3d05ab341..d267b7affad 100644 --- a/drivers/ide/ide-floppy_ioctl.c +++ b/drivers/ide/ide-floppy_ioctl.c @@ -5,7 +5,7 @@ #include <linux/kernel.h> #include <linux/ide.h> #include <linux/cdrom.h> -#include <linux/smp_lock.h> +#include <linux/mutex.h> #include <asm/unaligned.h> @@ -32,6 +32,7 @@ * On exit we set nformats to the number of records we've actually initialized. */ +static DEFINE_MUTEX(ide_floppy_ioctl_mutex); static int ide_floppy_get_format_capacities(ide_drive_t *drive, struct ide_atapi_pc *pc, int __user *arg) @@ -276,7 +277,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev, void __user *argp = (void __user *)arg; int err; - lock_kernel(); + mutex_lock(&ide_floppy_ioctl_mutex); if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) { err = ide_floppy_lockdoor(drive, &pc, arg, cmd); goto out; @@ -298,6 +299,6 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev, err = generic_ide_ioctl(drive, bdev, cmd, arg); out: - unlock_kernel(); + mutex_unlock(&ide_floppy_ioctl_mutex); return err; } diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 70aeeb18833..35c4b43585e 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c @@ -1,4 +1,3 @@ -#include <linux/smp_lock.h> #include <linux/module.h> #include <linux/types.h> #include <linux/string.h> @@ -23,6 +22,7 @@ #define IDE_GD_VERSION "1.18" /* module parameters */ +static DEFINE_MUTEX(ide_gd_mutex); static unsigned long debug_mask; module_param(debug_mask, ulong, 0644); @@ -242,9 +242,9 @@ static int ide_gd_unlocked_open(struct block_device *bdev, fmode_t mode) { int ret; - lock_kernel(); + mutex_lock(&ide_gd_mutex); ret = ide_gd_open(bdev, mode); - unlock_kernel(); + mutex_unlock(&ide_gd_mutex); return ret; } @@ -257,7 +257,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) ide_debug_log(IDE_DBG_FUNC, "enter"); - lock_kernel(); + mutex_lock(&ide_gd_mutex); if (idkp->openers == 1) drive->disk_ops->flush(drive); @@ -269,7 +269,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) idkp->openers--; ide_disk_put(idkp); - unlock_kernel(); + mutex_unlock(&ide_gd_mutex); return 0; } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index a381be81407..999dac054bc 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -441,19 +441,6 @@ void do_ide_request(struct request_queue *q) struct request *rq = NULL; ide_startstop_t startstop; - /* - * drive is doing pre-flush, ordered write, post-flush sequence. even - * though that is 3 requests, it must be seen as a single transaction. - * we must not preempt this drive until that is complete - */ - if (blk_queue_flushing(q)) - /* - * small race where queue could get replugged during - * the 3-request flush cycle, just yank the plug since - * we want it to finish asap - */ - blk_remove_plug(q); - spin_unlock_irq(q->queue_lock); /* HLD do_request() callback might sleep, make sure it's okay */ diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 6d622cb5ac8..7ecb1ade887 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -32,11 +32,9 @@ #include <linux/errno.h> #include <linux/genhd.h> #include <linux/seq_file.h> -#include <linux/smp_lock.h> #include <linux/slab.h> #include <linux/pci.h> #include <linux/ide.h> -#include <linux/smp_lock.h> #include <linux/completion.h> #include <linux/bitops.h> #include <linux/mutex.h> @@ -220,6 +218,7 @@ typedef struct ide_tape_obj { char write_prot; } idetape_tape_t; +static DEFINE_MUTEX(ide_tape_mutex); static DEFINE_MUTEX(idetape_ref_mutex); static DEFINE_MUTEX(idetape_chrdev_mutex); @@ -1426,9 +1425,9 @@ static long idetape_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { long ret; - lock_kernel(); + mutex_lock(&ide_tape_mutex); ret = do_idetape_chrdev_ioctl(file, cmd, arg); - unlock_kernel(); + mutex_unlock(&ide_tape_mutex); return ret; } @@ -1903,15 +1902,16 @@ static const struct file_operations idetape_fops = { .unlocked_ioctl = idetape_chrdev_ioctl, .open = idetape_chrdev_open, .release = idetape_chrdev_release, + .llseek = noop_llseek, }; static int idetape_open(struct block_device *bdev, fmode_t mode) { struct ide_tape_obj *tape; - lock_kernel(); + mutex_lock(&ide_tape_mutex); tape = ide_tape_get(bdev->bd_disk, false, 0); - unlock_kernel(); + mutex_unlock(&ide_tape_mutex); if (!tape) return -ENXIO; @@ -1923,9 +1923,9 @@ static int idetape_release(struct gendisk *disk, fmode_t mode) { struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); - lock_kernel(); + mutex_lock(&ide_tape_mutex); ide_tape_put(tape); - unlock_kernel(); + mutex_unlock(&ide_tape_mutex); return 0; } @@ -1937,11 +1937,11 @@ static int idetape_ioctl(struct block_device *bdev, fmode_t mode, ide_drive_t *drive = tape->drive; int err; - lock_kernel(); + mutex_lock(&ide_tape_mutex); err = generic_ide_ioctl(drive, bdev, cmd, arg); if (err == -EINVAL) err = idetape_blkdev_ioctl(drive, cmd, arg); - unlock_kernel(); + mutex_unlock(&ide_tape_mutex); return err; } |