aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-16 20:40:24 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-16 20:40:24 -0500
commitc94964a4555eb58be3f45edf2b63a2b3f549ef29 (patch)
treea8a0bf41a6c2b675e8f376e870f26724e5870327 /drivers/ide/ide-disk.c
parent7b77d864af29c193f6cee8338dbda40accb9b27b (diff)
ide: remove ide_drive_t.usage
This field is no longer used by the core IDE code so fix ide-{disk,floppy} drivers to keep openers count in the driver specific objects and remove it from ide-{cd,scsi,tape} drivers (it was write-only). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 0a05a377d66a..e2cea1889c4d 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -77,6 +77,7 @@ struct ide_disk_obj {
77 ide_driver_t *driver; 77 ide_driver_t *driver;
78 struct gendisk *disk; 78 struct gendisk *disk;
79 struct kref kref; 79 struct kref kref;
80 unsigned int openers; /* protected by BKL for now */
80}; 81};
81 82
82static DEFINE_MUTEX(idedisk_ref_mutex); 83static DEFINE_MUTEX(idedisk_ref_mutex);
@@ -1081,8 +1082,9 @@ static int idedisk_open(struct inode *inode, struct file *filp)
1081 1082
1082 drive = idkp->drive; 1083 drive = idkp->drive;
1083 1084
1084 drive->usage++; 1085 idkp->openers++;
1085 if (drive->removable && drive->usage == 1) { 1086
1087 if (drive->removable && idkp->openers == 1) {
1086 ide_task_t args; 1088 ide_task_t args;
1087 memset(&args, 0, sizeof(ide_task_t)); 1089 memset(&args, 0, sizeof(ide_task_t));
1088 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK; 1090 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK;
@@ -1106,9 +1108,10 @@ static int idedisk_release(struct inode *inode, struct file *filp)
1106 struct ide_disk_obj *idkp = ide_disk_g(disk); 1108 struct ide_disk_obj *idkp = ide_disk_g(disk);
1107 ide_drive_t *drive = idkp->drive; 1109 ide_drive_t *drive = idkp->drive;
1108 1110
1109 if (drive->usage == 1) 1111 if (idkp->openers == 1)
1110 ide_cacheflush_p(drive); 1112 ide_cacheflush_p(drive);
1111 if (drive->removable && drive->usage == 1) { 1113
1114 if (drive->removable && idkp->openers == 1) {
1112 ide_task_t args; 1115 ide_task_t args;
1113 memset(&args, 0, sizeof(ide_task_t)); 1116 memset(&args, 0, sizeof(ide_task_t));
1114 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK; 1117 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK;
@@ -1117,7 +1120,8 @@ static int idedisk_release(struct inode *inode, struct file *filp)
1117 if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL)) 1120 if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
1118 drive->doorlocking = 0; 1121 drive->doorlocking = 0;
1119 } 1122 }
1120 drive->usage--; 1123
1124 idkp->openers--;
1121 1125
1122 ide_disk_put(idkp); 1126 ide_disk_put(idkp);
1123 1127