summaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-cd.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2019-11-28 17:14:59 +0100
committerArnd Bergmann <arnd@arndb.de>2020-01-03 09:42:52 +0100
commit1df23c6fe5b0654ece219985a0c32e40b100bd9a (patch)
treee371a8ed355a6abbf2e630f9712dedeeba5aa144 /drivers/ide/ide-cd.c
parent75c0b0e118b929cb8bad8ce1ab4c8be8a76c45e2 (diff)
downloadlinux-1df23c6fe5b0654ece219985a0c32e40b100bd9a.tar.gz
linux-1df23c6fe5b0654ece219985a0c32e40b100bd9a.tar.bz2
linux-1df23c6fe5b0654ece219985a0c32e40b100bd9a.zip
compat_ioctl: move HDIO ioctl handling into drivers/ide
Most of the HDIO ioctls are only used by the obsolete drivers/ide subsystem, these can be handled by changing ide_cmd_ioctl() to be aware of compat mode and doing the correct transformations in place and using it as both native and compat handlers for all drivers. The SCSI drivers implementing the same commands are already doing this in the drivers, so the compat_blkdev_driver_ioctl() function is no longer needed now. The BLKSECTSET and HDIO_GETGEO_BIG ioctls are not implemented in any driver any more and no longer need any conversion. Reviewed-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/ide/ide-cd.c')
-rw-r--r--drivers/ide/ide-cd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index e09b949a7c46..dcf8b51b47fd 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1711,7 +1711,6 @@ static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
return ret;
}
-#ifdef CONFIG_COMPAT
static int idecd_locked_compat_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
@@ -1728,8 +1727,12 @@ static int idecd_locked_compat_ioctl(struct block_device *bdev, fmode_t mode,
break;
}
- return cdrom_ioctl(&info->devinfo, bdev, mode, cmd,
- (unsigned long)argp);
+ err = generic_ide_ioctl(info->drive, bdev, cmd, arg);
+ if (err == -EINVAL)
+ err = cdrom_ioctl(&info->devinfo, bdev, mode, cmd,
+ (unsigned long)argp);
+
+ return err;
}
static int idecd_compat_ioctl(struct block_device *bdev, fmode_t mode,
@@ -1743,7 +1746,6 @@ static int idecd_compat_ioctl(struct block_device *bdev, fmode_t mode,
return ret;
}
-#endif
static unsigned int idecd_check_events(struct gendisk *disk,
unsigned int clearing)
@@ -1766,9 +1768,8 @@ static const struct block_device_operations idecd_ops = {
.open = idecd_open,
.release = idecd_release,
.ioctl = idecd_ioctl,
-#ifdef CONFIG_COMPAT
- .compat_ioctl = idecd_compat_ioctl,
-#endif
+ .compat_ioctl = IS_ENABLED(CONFIG_COMPAT) ?
+ idecd_compat_ioctl : NULL,
.check_events = idecd_check_events,
.revalidate_disk = idecd_revalidate_disk
};