All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jordan <ledzep37@home.com>
To: Bill Nottingham <notting@redhat.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: ac10 ide-cd oopses on boot
Date: Thu, 19 Apr 2001 21:55:46 -0500	[thread overview]
Message-ID: <3ADFA532.CAEE58BB@home.com> (raw)
In-Reply-To: <20010420004914.A1052@werewolf.able.es> <E14qNWF-0008Jc-00@the-village.bc.nu> <20010420013429.A1054@werewolf.able.es> <20010419223850.A2177@nostromo.devel.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

Bill Nottingham wrote:
> 
> J . A . Magallon (jamagallon@able.es) said:
> > > Can you back out the ide-cd changes Jens did and see if that fixes it ?
> >
> > Reverted the changes in ide-cd.[hc], and same result.
> 
> You want to back out the stuff from drivers/cdrom/cdrom.c; I backed
> out the parts of the patch new there to ac10, and it worked again
> for me...
> 
> Bill
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

That worked here as well...here is a patch that should restore
linux/drivers/cdrom/cdrom.c back to its working ac9 state from ac10.

Jordan

[-- Attachment #2: patch-fix-cdrom-ac10 --]
[-- Type: text/plain, Size: 4241 bytes --]

--- linux_corrupt_cdrom/drivers/cdrom/cdrom.c	Thu Apr 19 19:31:00 2001
+++ linux/drivers/cdrom/cdrom.c	Wed Apr 18 01:49:05 2001
@@ -279,9 +279,6 @@
 static int lockdoor = 1;
 /* will we ever get to use this... sigh. */
 static int check_media_type;
-static unsigned long *cdrom_numbers;
-static DECLARE_MUTEX(cdrom_sem);
-
 MODULE_PARM(debug, "i");
 MODULE_PARM(autoclose, "i");
 MODULE_PARM(autoeject, "i");
@@ -343,38 +340,6 @@
 	check_media_change:	cdrom_media_changed,
 };
 
-/*
- * get or clear a new cdrom number, run under cdrom_sem
- */
-static int cdrom_get_entry(void)
-{
-	int i, nr, foo;
-
-	nr = 0;
-	foo = -1;
-	for (i = 0; i < CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8); i++) {
-		if (cdrom_numbers[i] == ~0UL) {
-			nr += sizeof(unsigned long) * 8;
-			continue;
-		}
-		foo = ffz(cdrom_numbers[i]);
-		set_bit(foo, &cdrom_numbers[i]);
-		nr += foo;
-		break;
-	}
-
-	return foo == -1 ? foo : nr;
-}
-
-static void cdrom_clear_entry(struct cdrom_device_info *cdi)
-{
-	int bit_nr = cdi->nr & ~(sizeof(unsigned long) * 8);
-	int cd_index = cdi->nr / (sizeof(unsigned long) * 8);
-
-	clear_bit(bit_nr, &cdrom_numbers[cd_index]);
-}
-
-
 /* This macro makes sure we don't have to check on cdrom_device_ops
  * existence in the run-time routines below. Change_capability is a
  * hack to have the capability flags defined const, while we can still
@@ -389,6 +354,7 @@
         struct cdrom_device_ops *cdo = cdi->ops;
         int *change_capability = (int *)&cdo->capability; /* hack */
 	char vname[16];
+	static unsigned int cdrom_counter;
 
 	cdinfo(CD_OPEN, "entering register_cdrom\n"); 
 
@@ -429,17 +395,7 @@
 
 	if (!devfs_handle)
 		devfs_handle = devfs_mk_dir (NULL, "cdroms", NULL);
-
-	/*
-	 * get new cdrom number
-	 */
-	down(&cdrom_sem);
-	cdi->nr = cdrom_get_entry();
-	up(&cdrom_sem);
-	if (cdi->nr == -1)
-		return -ENOMEM;
-
-	sprintf(vname, "cdrom%u", cdi->nr);
+	sprintf (vname, "cdrom%u", cdrom_counter++);
 	if (cdi->de) {
 		int pos;
 		devfs_handle_t slave;
@@ -462,13 +418,9 @@
 				    S_IFBLK | S_IRUGO | S_IWUGO,
 				    &cdrom_fops, NULL);
 	}
-
-	down(&cdrom_sem);
+	cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
 	cdi->next = topCdromPtr; 	
 	topCdromPtr = cdi;
-	up(&cdrom_sem);
-
-	cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
 	return 0;
 }
 #undef ENSURE
@@ -477,14 +429,12 @@
 {
 	struct cdrom_device_info *cdi, *prev;
 	int major = MAJOR(unreg->dev);
-	int bit_nr, cd_index;
 
 	cdinfo(CD_OPEN, "entering unregister_cdrom\n"); 
 
 	if (major < 0 || major >= MAX_BLKDEV)
 		return -1;
 
-	down(&cdrom_sem);
 	prev = NULL;
 	cdi = topCdromPtr;
 	while (cdi != NULL && cdi->dev != unreg->dev) {
@@ -492,20 +442,14 @@
 		cdi = cdi->next;
 	}
 
-	if (cdi == NULL) {
-		up(&cdrom_sem);
+	if (cdi == NULL)
 		return -2;
-	}
-
-	cdrom_clear_entry(cdi);
-
 	if (prev)
 		prev->next = cdi->next;
 	else
 		topCdromPtr = cdi->next;
-	up(&cdrom_sem);
 	cdi->ops->n_minors--;
-	devfs_unregister(cdi->de);
+	devfs_unregister (cdi->de);
 	cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" unregistered\n", cdi->name);
 	return 0;
 }
@@ -514,14 +458,10 @@
 {
 	struct cdrom_device_info *cdi;
 
-	down(&cdrom_sem);
-
 	cdi = topCdromPtr;
 	while (cdi != NULL && cdi->dev != dev)
 		cdi = cdi->next;
 
-	up(&cdrom_sem);
-
 	return cdi;
 }
 
@@ -2489,8 +2429,6 @@
 	}
 
 	pos = sprintf(info, "CD-ROM information, " VERSION "\n");
-
-	down(&cdrom_sem);
 	
 	pos += sprintf(info+pos, "\ndrive name:\t");
 	for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
@@ -2560,8 +2498,6 @@
 	for (cdi=topCdromPtr;cdi!=NULL;cdi=cdi->next)
 	    pos += sprintf(info+pos, "\t%d", CDROM_CAN(CDC_DVD_RAM) != 0);
 
-	up(&cdrom_sem);
-
 	strcpy(info+pos,"\n\n");
 		
         return proc_dostring(ctl, write, filp, buffer, lenp);
@@ -2708,10 +2644,6 @@
 
 static int __init cdrom_init(void)
 {
-	int n_entries = CDROM_MAX_CDROMS / (sizeof(unsigned long) * 8);
-
-	cdrom_numbers = kmalloc(n_entries * sizeof(unsigned long), GFP_KERNEL);
-
 #ifdef CONFIG_SYSCTL
 	cdrom_sysctl_register();
 #endif
@@ -2722,7 +2654,6 @@
 static void __exit cdrom_exit(void)
 {
 	printk(KERN_INFO "Uniform CD-ROM driver unloaded\n");
-	kfree(cdrom_numbers);
 #ifdef CONFIG_SYSCTL
 	cdrom_sysctl_unregister();
 #endif

  reply	other threads:[~2001-04-20  2:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-19 22:49 ac10 ide-cd oopses on boot J . A . Magallon
2001-04-19 23:07 ` Alan Cox
2001-04-19 23:34   ` J . A . Magallon
2001-04-20  2:38     ` Bill Nottingham
2001-04-20  2:55       ` Jordan [this message]
2001-04-20 10:44         ` [lkml]Re: " thunder7
2001-04-20  0:17   ` Udo A. Steinberg
2001-04-20  0:29     ` J . A . Magallon
2001-04-20  7:05 ` Stefan Jaschke
2001-04-20  8:45   ` patch: cdrom_init not called correctly (was Re: ac10 ide-cd oopses on boot) Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ADFA532.CAEE58BB@home.com \
    --to=ledzep37@home.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=notting@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.