Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6:
  tx493xide: use min_t() macro instead of min()
  drivers/ide: Use memdup_user
  via82cxxx: fix typo for VT6415 PCIE PATA IDE Host Controller support.
  ide-cd: Do not access completed requests in the irq handler
  • Loading branch information
Linus Torvalds committed Aug 10, 2010
2 parents 4d15393 + cd078af commit 0fcf12d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
14 changes: 11 additions & 3 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,15 +506,22 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
return (flags & REQ_FAILED) ? -EIO : 0;
}

static void ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
/*
* returns true if rq has been completed
*/
static bool ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
{
unsigned int nr_bytes = cmd->nbytes - cmd->nleft;

if (cmd->tf_flags & IDE_TFLAG_WRITE)
nr_bytes -= cmd->last_xfer_len;

if (nr_bytes > 0)
if (nr_bytes > 0) {
ide_complete_rq(drive, 0, nr_bytes);
return true;
}

return false;
}

static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
Expand Down Expand Up @@ -679,7 +686,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
}

if (uptodate == 0 && rq->bio)
ide_cd_error_cmd(drive, cmd);
if (ide_cd_error_cmd(drive, cmd))
return ide_stopped;

/* make sure it's fully ended */
if (blk_fs_request(rq) == 0) {
Expand Down
10 changes: 3 additions & 7 deletions drivers/ide/ide-taskfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,9 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
u16 nsect = 0;
char __user *buf = (char __user *)arg;

req_task = kzalloc(tasksize, GFP_KERNEL);
if (req_task == NULL)
return -ENOMEM;
if (copy_from_user(req_task, buf, tasksize)) {
kfree(req_task);
return -EFAULT;
}
req_task = memdup_user(buf, tasksize);
if (IS_ERR(req_task))
return PTR_ERR(req_task);

taskout = req_task->out_size;
taskin = req_task->in_size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/tx4938ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void tx4938ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)

pair = ide_get_pair_dev(drive);
if (pair)
safe = min(safe, pair->pio_mode - XFER_PIO_0);
safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0);
tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, safe);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/tx4939ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static void tx4939ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)

pair = ide_get_pair_dev(drive);
if (pair)
safe = min(safe, pair->pio_mode - XFER_PIO_0);
safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0);
/*
* Update Command Transfer Mode for master/slave and Data
* Transfer Mode for this drive.
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/via82cxxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static struct via_isa_bridge {
{ "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
{ "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
{ "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
{ "vt6415", PCI_DEVICE_ID_VIA_6410, 0x00, 0xff, ATA_UDMA6, VIA_BAD_AST },
{ "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, ATA_UDMA6, VIA_BAD_AST },
{ "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
{ "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
{ "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST },
Expand Down

0 comments on commit 0fcf12d

Please sign in to comment.