diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-03-02 10:26:23 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:48:23 -0400 |
commit | 488ca606f1277ae183c9c6a328adaecae54e1930 (patch) | |
tree | 4745efecd6730b9dd46699093bae57922d104497 | |
parent | 4e379ae6a6b6c7b0c4274476af807ffffe42534f (diff) |
[PATCH] switch ide-cd
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/ide/ide-cd.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 3533984355a6..133afd09843c 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -2089,17 +2089,15 @@ static ide_driver_t ide_cdrom_driver = { | |||
2089 | #endif | 2089 | #endif |
2090 | }; | 2090 | }; |
2091 | 2091 | ||
2092 | static int idecd_open(struct inode *inode, struct file *file) | 2092 | static int idecd_open(struct block_device *bdev, fmode_t mode) |
2093 | { | 2093 | { |
2094 | struct gendisk *disk = inode->i_bdev->bd_disk; | 2094 | struct cdrom_info *info = ide_cd_get(bdev->bd_disk); |
2095 | struct cdrom_info *info; | ||
2096 | int rc = -ENOMEM; | 2095 | int rc = -ENOMEM; |
2097 | 2096 | ||
2098 | info = ide_cd_get(disk); | ||
2099 | if (!info) | 2097 | if (!info) |
2100 | return -ENXIO; | 2098 | return -ENXIO; |
2101 | 2099 | ||
2102 | rc = cdrom_open(&info->devinfo, inode->i_bdev, file->f_mode); | 2100 | rc = cdrom_open(&info->devinfo, bdev, mode); |
2103 | 2101 | ||
2104 | if (rc < 0) | 2102 | if (rc < 0) |
2105 | ide_cd_put(info); | 2103 | ide_cd_put(info); |
@@ -2107,12 +2105,11 @@ static int idecd_open(struct inode *inode, struct file *file) | |||
2107 | return rc; | 2105 | return rc; |
2108 | } | 2106 | } |
2109 | 2107 | ||
2110 | static int idecd_release(struct inode *inode, struct file *file) | 2108 | static int idecd_release(struct gendisk *disk, fmode_t mode) |
2111 | { | 2109 | { |
2112 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
2113 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 2110 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
2114 | 2111 | ||
2115 | cdrom_release(&info->devinfo, file ? file->f_mode : 0); | 2112 | cdrom_release(&info->devinfo, mode); |
2116 | 2113 | ||
2117 | ide_cd_put(info); | 2114 | ide_cd_put(info); |
2118 | 2115 | ||
@@ -2158,10 +2155,9 @@ static int idecd_get_spindown(struct cdrom_device_info *cdi, unsigned long arg) | |||
2158 | return 0; | 2155 | return 0; |
2159 | } | 2156 | } |
2160 | 2157 | ||
2161 | static int idecd_ioctl(struct inode *inode, struct file *file, | 2158 | static int idecd_ioctl(struct block_device *bdev, fmode_t mode, |
2162 | unsigned int cmd, unsigned long arg) | 2159 | unsigned int cmd, unsigned long arg) |
2163 | { | 2160 | { |
2164 | struct block_device *bdev = inode->i_bdev; | ||
2165 | struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); | 2161 | struct cdrom_info *info = ide_drv_g(bdev->bd_disk, cdrom_info); |
2166 | int err; | 2162 | int err; |
2167 | 2163 | ||
@@ -2176,8 +2172,7 @@ static int idecd_ioctl(struct inode *inode, struct file *file, | |||
2176 | 2172 | ||
2177 | err = generic_ide_ioctl(info->drive, bdev, cmd, arg); | 2173 | err = generic_ide_ioctl(info->drive, bdev, cmd, arg); |
2178 | if (err == -EINVAL) | 2174 | if (err == -EINVAL) |
2179 | err = cdrom_ioctl(&info->devinfo, bdev, | 2175 | err = cdrom_ioctl(&info->devinfo, bdev, mode, cmd, arg); |
2180 | file ? file->f_mode : 0, cmd, arg); | ||
2181 | 2176 | ||
2182 | return err; | 2177 | return err; |
2183 | } | 2178 | } |
@@ -2200,9 +2195,9 @@ static int idecd_revalidate_disk(struct gendisk *disk) | |||
2200 | 2195 | ||
2201 | static struct block_device_operations idecd_ops = { | 2196 | static struct block_device_operations idecd_ops = { |
2202 | .owner = THIS_MODULE, | 2197 | .owner = THIS_MODULE, |
2203 | .__open = idecd_open, | 2198 | .open = idecd_open, |
2204 | .__release = idecd_release, | 2199 | .release = idecd_release, |
2205 | .__ioctl = idecd_ioctl, | 2200 | .locked_ioctl = idecd_ioctl, |
2206 | .media_changed = idecd_media_changed, | 2201 | .media_changed = idecd_media_changed, |
2207 | .revalidate_disk = idecd_revalidate_disk | 2202 | .revalidate_disk = idecd_revalidate_disk |
2208 | }; | 2203 | }; |