Commit 07203f64 authored by Ondrej Zary's avatar Ondrej Zary Committed by Bartlomiej Zolnierkiewicz

[PATCH] ide-floppy: software eject not working with LS-120 drive

The problem (eject not working on ATAPI LS-120 drive) is caused by
idefloppy_ioctl() function which *first* tries generic_ide_ioctl()
and *only* if it fails with -EINVAL, proceeds with the specific ioctls.
The generic eject command fails with something other than -EINVAL
and the specific one is never executed.

This patch fixes it by first going through the internal ioctls
and only trying generic_ide_ioctl() if none of them matches.
Signed-off-by: default avatarOndrej Zary <linux@rainbow-software.org>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent d868dd19
...@@ -2038,11 +2038,9 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, ...@@ -2038,11 +2038,9 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file,
struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk); struct ide_floppy_obj *floppy = ide_floppy_g(bdev->bd_disk);
ide_drive_t *drive = floppy->drive; ide_drive_t *drive = floppy->drive;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
int err = generic_ide_ioctl(drive, file, bdev, cmd, arg); int err;
int prevent = (arg) ? 1 : 0; int prevent = (arg) ? 1 : 0;
idefloppy_pc_t pc; idefloppy_pc_t pc;
if (err != -EINVAL)
return err;
switch (cmd) { switch (cmd) {
case CDROMEJECT: case CDROMEJECT:
...@@ -2094,7 +2092,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file, ...@@ -2094,7 +2092,7 @@ static int idefloppy_ioctl(struct inode *inode, struct file *file,
case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS:
return idefloppy_get_format_progress(drive, argp); return idefloppy_get_format_progress(drive, argp);
} }
return -EINVAL; return generic_ide_ioctl(drive, file, bdev, cmd, arg);
} }
static int idefloppy_media_changed(struct gendisk *disk) static int idefloppy_media_changed(struct gendisk *disk)
......
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