Commit f2791e7e authored by Jens Axboe's avatar Jens Axboe

Revert "floppy: refactor open() flags handling"

This reverts commit 09954bad.
parent 468c298a
...@@ -3663,11 +3663,6 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) ...@@ -3663,11 +3663,6 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
opened_bdev[drive] = bdev; opened_bdev[drive] = bdev;
if (!(mode & (FMODE_READ|FMODE_WRITE))) {
res = -EINVAL;
goto out;
}
res = -ENXIO; res = -ENXIO;
if (!floppy_track_buffer) { if (!floppy_track_buffer) {
...@@ -3711,6 +3706,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) ...@@ -3711,6 +3706,8 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
if (UFDCS->rawcmd == 1) if (UFDCS->rawcmd == 1)
UFDCS->rawcmd = 2; UFDCS->rawcmd = 2;
if (!(mode & FMODE_NDELAY)) {
if (mode & (FMODE_READ|FMODE_WRITE)) {
UDRS->last_checked = 0; UDRS->last_checked = 0;
clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags); clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
check_disk_change(bdev); check_disk_change(bdev);
...@@ -3718,13 +3715,12 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) ...@@ -3718,13 +3715,12 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
goto out; goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags)) if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
goto out; goto out;
}
res = -EROFS; res = -EROFS;
if ((mode & FMODE_WRITE) && if ((mode & FMODE_WRITE) &&
!test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags)) !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
goto out; goto out;
}
mutex_unlock(&open_lock); mutex_unlock(&open_lock);
mutex_unlock(&floppy_mutex); mutex_unlock(&floppy_mutex);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment