Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116303
b: refs/heads/master
c: 81ee1bb
h: refs/heads/master
i:
  116301: e3c6088
  116299: fcc70f1
  116295: d5f4f5f
  116287: ce40a85
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 17, 2008
1 parent 764069d commit 1283962
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 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: d7e747596829c1c11833ca0a1f5e64f400d20bf2
refs/heads/master: 81ee1bb51fff76aaa738668b92406b5117f125ed
22 changes: 13 additions & 9 deletions trunk/drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,12 +817,21 @@ static ide_driver_t idedisk_driver = {
static int idedisk_set_doorlock(ide_drive_t *drive, int on)
{
ide_task_t task;
int ret;

if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0)
return 0;

memset(&task, 0, sizeof(task));
task.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;

return ide_no_data_taskfile(drive, &task);
ret = ide_no_data_taskfile(drive, &task);

if (ret)
drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;

return ret;
}

static int idedisk_open(struct inode *inode, struct file *filp)
Expand All @@ -845,9 +854,7 @@ static int idedisk_open(struct inode *inode, struct file *filp)
* since the open() has already succeeded,
* and the door_lock is irrelevant at this point.
*/
if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) &&
idedisk_set_doorlock(drive, 1))
drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;
idedisk_set_doorlock(drive, 1);
check_disk_change(inode->i_bdev);
}
return 0;
Expand All @@ -862,11 +869,8 @@ static int idedisk_release(struct inode *inode, struct file *filp)
if (idkp->openers == 1)
ide_cacheflush_p(drive);

if ((drive->dev_flags & IDE_DFLAG_REMOVABLE) && idkp->openers == 1) {
if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) &&
idedisk_set_doorlock(drive, 0))
drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING;
}
if ((drive->dev_flags & IDE_DFLAG_REMOVABLE) && idkp->openers == 1)
idedisk_set_doorlock(drive, 0);

idkp->openers--;

Expand Down

0 comments on commit 1283962

Please sign in to comment.