Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77231
b: refs/heads/master
c: 29ec683
h: refs/heads/master
i:
  77229: d07838c
  77227: 6c9339b
  77223: 29b6709
  77215: cb38b2a
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jan 26, 2008
1 parent 1e85754 commit 2a5ff60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b971df185807ceb358471e16ce8754ccfcc7de9
refs/heads/master: 29ec683f019608ca0cb6cf69011426ecb5daa69e
23 changes: 13 additions & 10 deletions trunk/drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,17 @@ static ide_driver_t idedisk_driver = {
#endif
};

static int idedisk_set_doorlock(ide_drive_t *drive, int on)
{
ide_task_t task;

memset(&task, 0, sizeof(task));
task.tf.command = on ? WIN_DOORLOCK : WIN_DOORUNLOCK;
task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;

return ide_no_data_taskfile(drive, &task);
}

static int idedisk_open(struct inode *inode, struct file *filp)
{
struct gendisk *disk = inode->i_bdev->bd_disk;
Expand All @@ -989,17 +1000,13 @@ static int idedisk_open(struct inode *inode, struct file *filp)
idkp->openers++;

if (drive->removable && idkp->openers == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tf.command = WIN_DOORLOCK;
args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
check_disk_change(inode->i_bdev);
/*
* Ignore the return code from door_lock,
* since the open() has already succeeded,
* and the door_lock is irrelevant at this point.
*/
if (drive->doorlocking && ide_no_data_taskfile(drive, &args))
if (drive->doorlocking && idedisk_set_doorlock(drive, 1))
drive->doorlocking = 0;
}
return 0;
Expand All @@ -1015,11 +1022,7 @@ static int idedisk_release(struct inode *inode, struct file *filp)
ide_cacheflush_p(drive);

if (drive->removable && idkp->openers == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tf.command = WIN_DOORUNLOCK;
args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
if (drive->doorlocking && ide_no_data_taskfile(drive, &args))
if (drive->doorlocking && idedisk_set_doorlock(drive, 0))
drive->doorlocking = 0;
}

Expand Down

0 comments on commit 2a5ff60

Please sign in to comment.