aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorBorislav Petkov <bbpetkov@yahoo.de>2008-02-06 04:38:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:10 -0500
commit35841f708070bd295a96f6c98e566f8b251c1b48 (patch)
tree17909536b4d668d5c4e78d23fdcc84cb88ea8737 /drivers/cdrom
parent18a2354db7d7e43da08c0351263fd5b5fc20a38d (diff)
drivers/cdrom/cdrom.c: simplify logic in cdrom_release()
Simplify logic in cdrom_release() without semantic change. Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/cdrom')
-rw-r--r--drivers/cdrom/cdrom.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 47e5b40510cb..db259e60289b 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1206,25 +1206,26 @@ int check_for_audio_disc(struct cdrom_device_info * cdi,
1206 return 0; 1206 return 0;
1207} 1207}
1208 1208
1209/* Admittedly, the logic below could be performed in a nicer way. */
1210int cdrom_release(struct cdrom_device_info *cdi, struct file *fp) 1209int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
1211{ 1210{
1212 struct cdrom_device_ops *cdo = cdi->ops; 1211 struct cdrom_device_ops *cdo = cdi->ops;
1213 int opened_for_data; 1212 int opened_for_data;
1214 1213
1215 cdinfo(CD_CLOSE, "entering cdrom_release\n"); 1214 cdinfo(CD_CLOSE, "entering cdrom_release\n");
1216 1215
1217 if (cdi->use_count > 0) 1216 if (cdi->use_count > 0)
1218 cdi->use_count--; 1217 cdi->use_count--;
1219 if (cdi->use_count == 0) 1218
1219 if (cdi->use_count == 0) {
1220 cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name); 1220 cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name);
1221 if (cdi->use_count == 0)
1222 cdrom_dvd_rw_close_write(cdi); 1221 cdrom_dvd_rw_close_write(cdi);
1223 if (cdi->use_count == 0 && 1222
1224 (cdo->capability & CDC_LOCK) && !keeplocked) { 1223 if ((cdo->capability & CDC_LOCK) && !keeplocked) {
1225 cdinfo(CD_CLOSE, "Unlocking door!\n"); 1224 cdinfo(CD_CLOSE, "Unlocking door!\n");
1226 cdo->lock_door(cdi, 0); 1225 cdo->lock_door(cdi, 0);
1226 }
1227 } 1227 }
1228
1228 opened_for_data = !(cdi->options & CDO_USE_FFLAGS) || 1229 opened_for_data = !(cdi->options & CDO_USE_FFLAGS) ||
1229 !(fp && fp->f_flags & O_NONBLOCK); 1230 !(fp && fp->f_flags & O_NONBLOCK);
1230 1231