aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ide-scsi.c8
-rw-r--r--drivers/scsi/sd.c11
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 8f6b5bf580f6..2b5b8a93bc10 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -801,15 +801,10 @@ static int idescsi_ide_open(struct inode *inode, struct file *filp)
801{ 801{
802 struct gendisk *disk = inode->i_bdev->bd_disk; 802 struct gendisk *disk = inode->i_bdev->bd_disk;
803 struct ide_scsi_obj *scsi; 803 struct ide_scsi_obj *scsi;
804 ide_drive_t *drive;
805 804
806 if (!(scsi = ide_scsi_get(disk))) 805 if (!(scsi = ide_scsi_get(disk)))
807 return -ENXIO; 806 return -ENXIO;
808 807
809 drive = scsi->drive;
810
811 drive->usage++;
812
813 return 0; 808 return 0;
814} 809}
815 810
@@ -817,9 +812,6 @@ static int idescsi_ide_release(struct inode *inode, struct file *filp)
817{ 812{
818 struct gendisk *disk = inode->i_bdev->bd_disk; 813 struct gendisk *disk = inode->i_bdev->bd_disk;
819 struct ide_scsi_obj *scsi = ide_scsi_g(disk); 814 struct ide_scsi_obj *scsi = ide_scsi_g(disk);
820 ide_drive_t *drive = scsi->drive;
821
822 drive->usage--;
823 815
824 ide_scsi_put(scsi); 816 ide_scsi_put(scsi);
825 817
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3f048bd6326d..5a8f55fea5ff 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1269,9 +1269,18 @@ repeat:
1269 1269
1270 /* Some devices return the total number of sectors, not the 1270 /* Some devices return the total number of sectors, not the
1271 * highest sector number. Make the necessary adjustment. */ 1271 * highest sector number. Make the necessary adjustment. */
1272 if (sdp->fix_capacity) 1272 if (sdp->fix_capacity) {
1273 --sdkp->capacity; 1273 --sdkp->capacity;
1274 1274
1275 /* Some devices have version which report the correct sizes
1276 * and others which do not. We guess size according to a heuristic
1277 * and err on the side of lowering the capacity. */
1278 } else {
1279 if (sdp->guess_capacity)
1280 if (sdkp->capacity & 0x01) /* odd sizes are odd */
1281 --sdkp->capacity;
1282 }
1283
1275got_data: 1284got_data:
1276 if (sector_size == 0) { 1285 if (sector_size == 0) {
1277 sector_size = 512; 1286 sector_size = 512;