Signed-off-by: Tim Small <[email protected]>
---
drivers/ide/ide-cd.c | 42 +++++++++++++++++++-----------------------
1 file changed, 19 insertions(+), 23 deletions(-)
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0b510ba..946d458 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1656,37 +1656,33 @@ static int idecd_get_spindown(struct cdrom_device_info
*cdi, unsigned long arg)
return 0;
}
-static int idecd_locked_ioctl(struct block_device *bdev, fmode_t mode,
- unsigned int cmd, unsigned long arg)
-{
- struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info);
- int err;
-
- switch (cmd) {
- case CDROMSETSPINDOWN:
- return idecd_set_spindown(&info->devinfo, arg);
- case CDROMGETSPINDOWN:
- return idecd_get_spindown(&info->devinfo, arg);
- default:
- break;
- }
-
- err = generic_ide_ioctl(info->drive, bdev, cmd, arg);
- if (err == -EINVAL)
- err = cdrom_ioctl(&info->devinfo, bdev, mode, cmd, arg);
-
- return err;
-}
-
static int idecd_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
+ struct cdrom_info *info;
int ret;
mutex_lock(&ide_cd_mutex);
- ret = idecd_locked_ioctl(bdev, mode, cmd, arg);
+ info = ide_drv_g(bdev->bd_disk, cdrom_info);
+
+ switch (cmd) {
+ case CDROMSETSPINDOWN:
+ ret = idecd_set_spindown(&info->devinfo, arg);
+ goto outunlock;
+ case CDROMGETSPINDOWN:
+ ret = idecd_get_spindown(&info->devinfo, arg);
+ goto outunlock;
+ }
+
+ ret = generic_ide_ioctl(info->drive, bdev, cmd, arg);
+ if (ret != -EINVAL)
+ goto outunlock;
+
mutex_unlock(&ide_cd_mutex);
+ return cdrom_ioctl(&info->devinfo, bdev, mode, cmd, arg);
+outunlock:
+ mutex_unlock(&ide_cd_mutex);
return ret;
}
--
2.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html