summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
authorBorislav Petkov <petkovbb@googlemail.com>2009-01-02 18:12:52 +0300
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-02 18:12:52 +0300
commit392de1d53dd40e2eebee3a0a26aa647a3865ca78 (patch)
tree6e904d52596b73d0f1ab343a4e84b0d8de5958fe /drivers/ide/ide-atapi.c
parent4f02ff06b4d33aba50ce5157c23e99cd21d447ee (diff)
downloadlinux-392de1d53dd40e2eebee3a0a26aa647a3865ca78.tar.xz
ide-atapi: accomodate transfer length calculation for ide-cd
... by factoring it out of ide_cd_do_request() into a helper, as suggested by Bart. There should be no functionality change resulting from this patch. Signed-off-by: Borislav Petkov <petkovbb@gmail.com> [bart: BLK_DEV_IDECD needs to select IDE_ATAPI now] Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 74273fdc8827..8884877bd2b5 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -252,6 +252,18 @@ int ide_scsi_expiry(ide_drive_t *drive)
}
EXPORT_SYMBOL_GPL(ide_scsi_expiry);
+int ide_cd_get_xferlen(struct request *rq)
+{
+ if (blk_fs_request(rq))
+ return 32768;
+ else if (blk_sense_request(rq) || blk_pc_request(rq) ||
+ rq->cmd_type == REQ_TYPE_ATA_PC)
+ return rq->data_len;
+ else
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ide_cd_get_xferlen);
+
/*
* This is the usual interrupt handler which will be called during a packet
* command. We will transfer some of the data (as requested by the drive)
@@ -551,7 +563,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
struct ide_atapi_pc *pc = drive->pc;
ide_hwif_t *hwif = drive->hwif;
u32 tf_flags;
- u16 bcount = 0;
+ u16 bcount;
u8 scsi = !!(drive->dev_flags & IDE_DFLAG_SCSI);
/* We haven't transferred any data yet */
@@ -560,6 +572,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout,
if (dev_is_idecd(drive)) {
tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
+ bcount = ide_cd_get_xferlen(hwif->hwgroup->rq);
} else if (scsi) {
tf_flags = 0;
bcount = min(pc->req_xfer, 63 * 1024);