aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-cd.c14
-rw-r--r--drivers/ide/ide-cs.c39
-rw-r--r--drivers/ide/ide-gd.c2
-rw-r--r--drivers/ide/ide-taskfile.c10
-rw-r--r--drivers/ide/tx4938ide.c2
-rw-r--r--drivers/ide/tx4939ide.c2
-rw-r--r--drivers/ide/via82cxxx.c2
7 files changed, 38 insertions, 33 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 5108e9739c96..31fc76960a8f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -508,15 +508,22 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
508 return (flags & REQ_FAILED) ? -EIO : 0; 508 return (flags & REQ_FAILED) ? -EIO : 0;
509} 509}
510 510
511static void ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) 511/*
512 * returns true if rq has been completed
513 */
514static bool ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
512{ 515{
513 unsigned int nr_bytes = cmd->nbytes - cmd->nleft; 516 unsigned int nr_bytes = cmd->nbytes - cmd->nleft;
514 517
515 if (cmd->tf_flags & IDE_TFLAG_WRITE) 518 if (cmd->tf_flags & IDE_TFLAG_WRITE)
516 nr_bytes -= cmd->last_xfer_len; 519 nr_bytes -= cmd->last_xfer_len;
517 520
518 if (nr_bytes > 0) 521 if (nr_bytes > 0) {
519 ide_complete_rq(drive, 0, nr_bytes); 522 ide_complete_rq(drive, 0, nr_bytes);
523 return true;
524 }
525
526 return false;
520} 527}
521 528
522static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) 529static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
@@ -681,7 +688,8 @@ out_end:
681 } 688 }
682 689
683 if (uptodate == 0 && rq->bio) 690 if (uptodate == 0 && rq->bio)
684 ide_cd_error_cmd(drive, cmd); 691 if (ide_cd_error_cmd(drive, cmd))
692 return ide_stopped;
685 693
686 /* make sure it's fully ended */ 694 /* make sure it's fully ended */
687 if (rq->cmd_type != REQ_TYPE_FS) { 695 if (rq->cmd_type != REQ_TYPE_FS) {
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 0b7815d2581c..2a4cb9c18f01 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -43,7 +43,6 @@
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/system.h> 44#include <asm/system.h>
45 45
46#include <pcmcia/cs_types.h>
47#include <pcmcia/cs.h> 46#include <pcmcia/cs.h>
48#include <pcmcia/cistpl.h> 47#include <pcmcia/cistpl.h>
49#include <pcmcia/ds.h> 48#include <pcmcia/ds.h>
@@ -98,9 +97,8 @@ static int ide_probe(struct pcmcia_device *link)
98 info->p_dev = link; 97 info->p_dev = link;
99 link->priv = info; 98 link->priv = info;
100 99
101 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 100 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
102 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 101 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
103 link->io.IOAddrLines = 3;
104 link->conf.Attributes = CONF_ENABLE_IRQ; 102 link->conf.Attributes = CONF_ENABLE_IRQ;
105 link->conf.IntType = INT_MEMORY_AND_IO; 103 link->conf.IntType = INT_MEMORY_AND_IO;
106 104
@@ -229,24 +227,27 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev,
229 227
230 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 228 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
231 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 229 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
230 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
231
232 pdev->conf.ConfigIndex = cfg->index; 232 pdev->conf.ConfigIndex = cfg->index;
233 pdev->io.BasePort1 = io->win[0].base; 233 pdev->resource[0]->start = io->win[0].base;
234 pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 234 if (!(io->flags & CISTPL_IO_16BIT)) {
235 if (!(io->flags & CISTPL_IO_16BIT)) 235 pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
236 pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 236 pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
237 }
237 if (io->nwin == 2) { 238 if (io->nwin == 2) {
238 pdev->io.NumPorts1 = 8; 239 pdev->resource[0]->end = 8;
239 pdev->io.BasePort2 = io->win[1].base; 240 pdev->resource[1]->start = io->win[1].base;
240 pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; 241 pdev->resource[1]->end = (stk->is_kme) ? 2 : 1;
241 if (pcmcia_request_io(pdev, &pdev->io) != 0) 242 if (pcmcia_request_io(pdev) != 0)
242 return -ENODEV; 243 return -ENODEV;
243 stk->ctl_base = pdev->io.BasePort2; 244 stk->ctl_base = pdev->resource[1]->start;
244 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { 245 } else if ((io->nwin == 1) && (io->win[0].len >= 16)) {
245 pdev->io.NumPorts1 = io->win[0].len; 246 pdev->resource[0]->end = io->win[0].len;
246 pdev->io.NumPorts2 = 0; 247 pdev->resource[1]->end = 0;
247 if (pcmcia_request_io(pdev, &pdev->io) != 0) 248 if (pcmcia_request_io(pdev) != 0)
248 return -ENODEV; 249 return -ENODEV;
249 stk->ctl_base = pdev->io.BasePort1 + 0x0e; 250 stk->ctl_base = pdev->resource[0]->start + 0x0e;
250 } else 251 } else
251 return -ENODEV; 252 return -ENODEV;
252 /* If we've got this far, we're done */ 253 /* If we've got this far, we're done */
@@ -280,7 +281,7 @@ static int ide_config(struct pcmcia_device *link)
280 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 281 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
281 goto failed; /* No suitable config found */ 282 goto failed; /* No suitable config found */
282 } 283 }
283 io_base = link->io.BasePort1; 284 io_base = link->resource[0]->start;
284 ctl_base = stk->ctl_base; 285 ctl_base = stk->ctl_base;
285 286
286 if (!link->irq) 287 if (!link->irq)
@@ -297,7 +298,7 @@ static int ide_config(struct pcmcia_device *link)
297 outb(0x81, ctl_base+1); 298 outb(0x81, ctl_base+1);
298 299
299 host = idecs_register(io_base, ctl_base, link->irq, link); 300 host = idecs_register(io_base, ctl_base, link->irq, link);
300 if (host == NULL && link->io.NumPorts1 == 0x20) { 301 if (host == NULL && resource_size(link->resource[0]) == 0x20) {
301 outb(0x02, ctl_base + 0x10); 302 outb(0x02, ctl_base + 0x10);
302 host = idecs_register(io_base + 0x10, ctl_base + 0x10, 303 host = idecs_register(io_base + 0x10, ctl_base + 0x10,
303 link->irq, link); 304 link->irq, link);
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 137337a795a9..70aeeb18833e 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -93,7 +93,7 @@ static void ide_disk_release(struct device *dev)
93 93
94/* 94/*
95 * On HPA drives the capacity needs to be 95 * On HPA drives the capacity needs to be
96 * reinitilized on resume otherwise the disk 96 * reinitialized on resume otherwise the disk
97 * can not be used and a hard reset is required 97 * can not be used and a hard reset is required
98 */ 98 */
99static void ide_gd_resume(ide_drive_t *drive) 99static void ide_gd_resume(ide_drive_t *drive)
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 67fb73559fd5..34b9872f35d1 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -480,13 +480,9 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
480 u16 nsect = 0; 480 u16 nsect = 0;
481 char __user *buf = (char __user *)arg; 481 char __user *buf = (char __user *)arg;
482 482
483 req_task = kzalloc(tasksize, GFP_KERNEL); 483 req_task = memdup_user(buf, tasksize);
484 if (req_task == NULL) 484 if (IS_ERR(req_task))
485 return -ENOMEM; 485 return PTR_ERR(req_task);
486 if (copy_from_user(req_task, buf, tasksize)) {
487 kfree(req_task);
488 return -EFAULT;
489 }
490 486
491 taskout = req_task->out_size; 487 taskout = req_task->out_size;
492 taskin = req_task->in_size; 488 taskin = req_task->in_size;
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index 1d80f1fdbc97..7002765b593c 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -64,7 +64,7 @@ static void tx4938ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
64 64
65 pair = ide_get_pair_dev(drive); 65 pair = ide_get_pair_dev(drive);
66 if (pair) 66 if (pair)
67 safe = min(safe, pair->pio_mode - XFER_PIO_0); 67 safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0);
68 tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, safe); 68 tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, safe);
69} 69}
70 70
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index 3c7367751873..bed3e39aac96 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -114,7 +114,7 @@ static void tx4939ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
114 114
115 pair = ide_get_pair_dev(drive); 115 pair = ide_get_pair_dev(drive);
116 if (pair) 116 if (pair)
117 safe = min(safe, pair->pio_mode - XFER_PIO_0); 117 safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0);
118 /* 118 /*
119 * Update Command Transfer Mode for master/slave and Data 119 * Update Command Transfer Mode for master/slave and Data
120 * Transfer Mode for this drive. 120 * Transfer Mode for this drive.
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c
index 101f40022386..d2a0997b78f8 100644
--- a/drivers/ide/via82cxxx.c
+++ b/drivers/ide/via82cxxx.c
@@ -79,7 +79,7 @@ static struct via_isa_bridge {
79 { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 79 { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
80 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 80 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
81 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 81 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
82 { "vt6415", PCI_DEVICE_ID_VIA_6410, 0x00, 0xff, ATA_UDMA6, VIA_BAD_AST }, 82 { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, ATA_UDMA6, VIA_BAD_AST },
83 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 83 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
84 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 84 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
85 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, 85 { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },