]> git.hungrycats.org Git - linux/commitdiff
[PATCH] fix cdrom autoclose
authorStas Sergeev <stsp@aknet.ru>
Sat, 8 Jan 2005 05:41:19 +0000 (21:41 -0800)
committerLinus Torvalds <torvalds@evo.osdl.org>
Sat, 8 Jan 2005 05:41:19 +0000 (21:41 -0800)
The attached patch fixes the CD-ROM autoclose.  It is broken in recent
kernels for CD-ROMs that do not properly report that the tray is opened.
Now on such a drives the kernel will do one close attempt and check for the
disc again.  This is how it used to work in the past.

Signed-off-by: Stas Sergeev <stsp@aknet.ru>
Acked-by: Alexander Kern <alex.kern@gmx.de>
Acked-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/cdrom/cdrom.c
drivers/ide/ide-cd.c

index fc4e07a4e8fa8e158ac18b07ab41e2be8a6088a0..fda53bb07ffb282b6b4a5d863479c47293d8d2af 100644 (file)
@@ -1076,6 +1076,8 @@ int open_for_data(struct cdrom_device_info * cdi)
                        }
                        cdinfo(CD_OPEN, "the tray is now closed.\n"); 
                }
+               /* the door should be closed now, check for the disc */
+               ret = cdo->drive_status(cdi, CDSL_CURRENT);
                if (ret!=CDS_DISC_OK) {
                        ret = -ENOMEDIUM;
                        goto clean_up_and_return;
index 7bf6d7e2ab338d656bcf3cdcbad5978a7017f63e..912dfca74e150a5e62ff9a20fb85173ac07a1bdc 100644 (file)
@@ -2688,9 +2688,9 @@ int ide_cdrom_drive_status (struct cdrom_device_info *cdi, int slot_nr)
         */
        if (sense.sense_key == NOT_READY) {
                if (sense.asc == 0x3a) {
-                       if (sense.ascq == 0 || sense.ascq == 1)
+                       if (sense.ascq == 1)
                                return CDS_NO_DISC;
-                       else if (sense.ascq == 2)
+                       else if (sense.ascq == 0 || sense.ascq == 2)
                                return CDS_TRAY_OPEN;
                }
        }