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>
This commit is contained in:
Borislav Petkov 2008-02-06 01:38:08 -08:00 коммит произвёл Linus Torvalds
Родитель 18a2354db7
Коммит 35841f7080
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -1206,7 +1206,6 @@ int check_for_audio_disc(struct cdrom_device_info * cdi,
return 0;
}
/* Admittedly, the logic below could be performed in a nicer way. */
int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
{
struct cdrom_device_ops *cdo = cdi->ops;
@ -1216,15 +1215,17 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
if (cdi->use_count > 0)
cdi->use_count--;
if (cdi->use_count == 0)
if (cdi->use_count == 0) {
cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name);
if (cdi->use_count == 0)
cdrom_dvd_rw_close_write(cdi);
if (cdi->use_count == 0 &&
(cdo->capability & CDC_LOCK) && !keeplocked) {
if ((cdo->capability & CDC_LOCK) && !keeplocked) {
cdinfo(CD_CLOSE, "Unlocking door!\n");
cdo->lock_door(cdi, 0);
}
}
opened_for_data = !(cdi->options & CDO_USE_FFLAGS) ||
!(fp && fp->f_flags & O_NONBLOCK);