diff options
-rw-r--r-- | drivers/ide/ide-cd.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index f0191f061775..2e0c93377582 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -714,6 +714,31 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason) | |||
714 | } | 714 | } |
715 | 715 | ||
716 | /* | 716 | /* |
717 | * Assume that the drive will always provide data in multiples of at least | ||
718 | * SECTOR_SIZE, as it gets hairy to keep track of the transfers otherwise. | ||
719 | */ | ||
720 | static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) | ||
721 | { | ||
722 | struct cdrom_info *cd = drive->driver_data; | ||
723 | |||
724 | if ((len % SECTOR_SIZE) == 0) | ||
725 | return 0; | ||
726 | |||
727 | printk(KERN_ERR "%s: %s: Bad transfer size %d\n", | ||
728 | drive->name, __FUNCTION__, len); | ||
729 | |||
730 | if (cd->cd_flags & IDE_CD_FLAG_LIMIT_NFRAMES) | ||
731 | printk(KERN_ERR " This drive is not supported by " | ||
732 | "this version of the driver\n"); | ||
733 | else { | ||
734 | printk(KERN_ERR " Trying to limit transfer sizes\n"); | ||
735 | cd->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES; | ||
736 | } | ||
737 | |||
738 | return 1; | ||
739 | } | ||
740 | |||
741 | /* | ||
717 | * Interrupt routine. Called when a read request has completed. | 742 | * Interrupt routine. Called when a read request has completed. |
718 | */ | 743 | */ |
719 | static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) | 744 | static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) |
@@ -774,18 +799,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) | |||
774 | if (cdrom_read_check_ireason (drive, len, ireason)) | 799 | if (cdrom_read_check_ireason (drive, len, ireason)) |
775 | return ide_stopped; | 800 | return ide_stopped; |
776 | 801 | ||
777 | /* Assume that the drive will always provide data in multiples | 802 | if (ide_cd_check_transfer_size(drive, len)) { |
778 | of at least SECTOR_SIZE, as it gets hairy to keep track | ||
779 | of the transfers otherwise. */ | ||
780 | if ((len % SECTOR_SIZE) != 0) { | ||
781 | printk (KERN_ERR "%s: cdrom_read_intr: Bad transfer size %d\n", | ||
782 | drive->name, len); | ||
783 | if (info->cd_flags & IDE_CD_FLAG_LIMIT_NFRAMES) | ||
784 | printk (KERN_ERR " This drive is not supported by this version of the driver\n"); | ||
785 | else { | ||
786 | printk (KERN_ERR " Trying to limit transfer sizes\n"); | ||
787 | info->cd_flags |= IDE_CD_FLAG_LIMIT_NFRAMES; | ||
788 | } | ||
789 | cdrom_end_request(drive, 0); | 803 | cdrom_end_request(drive, 0); |
790 | return ide_stopped; | 804 | return ide_stopped; |
791 | } | 805 | } |