summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-17 01:40:24 (GMT)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-02-17 01:40:24 (GMT)
commitc94964a4555eb58be3f45edf2b63a2b3f549ef29 (patch)
treea8a0bf41a6c2b675e8f376e870f26724e5870327 /drivers/ide/ide-disk.c
parent7b77d864af29c193f6cee8338dbda40accb9b27b (diff)
downloadlinux-c94964a4555eb58be3f45edf2b63a2b3f549ef29.tar.xz
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 0a05a37..e2cea18 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -77,6 +77,7 @@ struct ide_disk_obj {
ide_driver_t *driver;
struct gendisk *disk;
struct kref kref;
+ unsigned int openers; /* protected by BKL for now */
};
static DEFINE_MUTEX(idedisk_ref_mutex);
@@ -1081,8 +1082,9 @@ static int idedisk_open(struct inode *inode, struct file *filp)
drive = idkp->drive;
- drive->usage++;
- if (drive->removable && drive->usage == 1) {
+ idkp->openers++;
+
+ if (drive->removable && idkp->openers == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK;
@@ -1106,9 +1108,10 @@ static int idedisk_release(struct inode *inode, struct file *filp)
struct ide_disk_obj *idkp = ide_disk_g(disk);
ide_drive_t *drive = idkp->drive;
- if (drive->usage == 1)
+ if (idkp->openers == 1)
ide_cacheflush_p(drive);
- if (drive->removable && drive->usage == 1) {
+
+ if (drive->removable && idkp->openers == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK;
@@ -1117,7 +1120,8 @@ static int idedisk_release(struct inode *inode, struct file *filp)
if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
drive->doorlocking = 0;
}
- drive->usage--;
+
+ idkp->openers--;
ide_disk_put(idkp);