aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom/cdrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r--drivers/cdrom/cdrom.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 55eaf474d32..d620b449574 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -286,8 +286,6 @@
286 286
287/* used to tell the module to turn on full debugging messages */ 287/* used to tell the module to turn on full debugging messages */
288static bool debug; 288static bool debug;
289/* used to keep tray locked at all times */
290static int keeplocked;
291/* default compatibility mode */ 289/* default compatibility mode */
292static bool autoclose=1; 290static bool autoclose=1;
293static bool autoeject; 291static bool autoeject;
@@ -1204,7 +1202,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode)
1204 cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name); 1202 cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name);
1205 cdrom_dvd_rw_close_write(cdi); 1203 cdrom_dvd_rw_close_write(cdi);
1206 1204
1207 if ((cdo->capability & CDC_LOCK) && !keeplocked) { 1205 if ((cdo->capability & CDC_LOCK) && !cdi->keeplocked) {
1208 cdinfo(CD_CLOSE, "Unlocking door!\n"); 1206 cdinfo(CD_CLOSE, "Unlocking door!\n");
1209 cdo->lock_door(cdi, 0); 1207 cdo->lock_door(cdi, 0);
1210 } 1208 }
@@ -1371,7 +1369,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot)
1371 curslot = info->hdr.curslot; 1369 curslot = info->hdr.curslot;
1372 kfree(info); 1370 kfree(info);
1373 1371
1374 if (cdi->use_count > 1 || keeplocked) { 1372 if (cdi->use_count > 1 || cdi->keeplocked) {
1375 if (slot == CDSL_CURRENT) { 1373 if (slot == CDSL_CURRENT) {
1376 return curslot; 1374 return curslot;
1377 } else { 1375 } else {
@@ -2119,11 +2117,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
2119 if (!nr) 2117 if (!nr)
2120 return -ENOMEM; 2118 return -ENOMEM;
2121 2119
2122 if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) {
2123 ret = -EFAULT;
2124 goto out;
2125 }
2126
2127 cgc.data_direction = CGC_DATA_READ; 2120 cgc.data_direction = CGC_DATA_READ;
2128 while (nframes > 0) { 2121 while (nframes > 0) {
2129 if (nr > nframes) 2122 if (nr > nframes)
@@ -2132,7 +2125,7 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
2132 ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); 2125 ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW);
2133 if (ret) 2126 if (ret)
2134 break; 2127 break;
2135 if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { 2128 if (copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) {
2136 ret = -EFAULT; 2129 ret = -EFAULT;
2137 break; 2130 break;
2138 } 2131 }
@@ -2140,7 +2133,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
2140 nframes -= nr; 2133 nframes -= nr;
2141 lba += nr; 2134 lba += nr;
2142 } 2135 }
2143out:
2144 kfree(cgc.buffer); 2136 kfree(cgc.buffer);
2145 return ret; 2137 return ret;
2146} 2138}
@@ -2295,7 +2287,7 @@ static int cdrom_ioctl_eject(struct cdrom_device_info *cdi)
2295 2287
2296 if (!CDROM_CAN(CDC_OPEN_TRAY)) 2288 if (!CDROM_CAN(CDC_OPEN_TRAY))
2297 return -ENOSYS; 2289 return -ENOSYS;
2298 if (cdi->use_count != 1 || keeplocked) 2290 if (cdi->use_count != 1 || cdi->keeplocked)
2299 return -EBUSY; 2291 return -EBUSY;
2300 if (CDROM_CAN(CDC_LOCK)) { 2292 if (CDROM_CAN(CDC_LOCK)) {
2301 int ret = cdi->ops->lock_door(cdi, 0); 2293 int ret = cdi->ops->lock_door(cdi, 0);
@@ -2322,7 +2314,7 @@ static int cdrom_ioctl_eject_sw(struct cdrom_device_info *cdi,
2322 2314
2323 if (!CDROM_CAN(CDC_OPEN_TRAY)) 2315 if (!CDROM_CAN(CDC_OPEN_TRAY))
2324 return -ENOSYS; 2316 return -ENOSYS;
2325 if (keeplocked) 2317 if (cdi->keeplocked)
2326 return -EBUSY; 2318 return -EBUSY;
2327 2319
2328 cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT); 2320 cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT);
@@ -2453,7 +2445,7 @@ static int cdrom_ioctl_lock_door(struct cdrom_device_info *cdi,
2453 if (!CDROM_CAN(CDC_LOCK)) 2445 if (!CDROM_CAN(CDC_LOCK))
2454 return -EDRIVE_CANT_DO_THIS; 2446 return -EDRIVE_CANT_DO_THIS;
2455 2447
2456 keeplocked = arg ? 1 : 0; 2448 cdi->keeplocked = arg ? 1 : 0;
2457 2449
2458 /* 2450 /*
2459 * Don't unlock the door on multiple opens by default, but allow 2451 * Don't unlock the door on multiple opens by default, but allow