All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Rumpf <prumpf@parcelfarce.linux.theplanet.co.uk>
To: Tigran Aivazian <tigran@veritas.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: [patch-2.4.2-ac8] misc_register() fix (was Re: Linux 2.4.2ac8
Date: Fri, 2 Mar 2001 11:03:18 +0000	[thread overview]
Message-ID: <20010302110318.C8678@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.21.0103021010570.1338-100000@penguin.homenet> <Pine.LNX.4.21.0103021053290.1338-100000@penguin.homenet>
In-Reply-To: <Pine.LNX.4.21.0103021053290.1338-100000@penguin.homenet>; from tigran@veritas.com on Fri, Mar 02, 2001 at 10:55:39AM +0000

On Fri, Mar 02, 2001 at 10:55:39AM +0000, Tigran Aivazian wrote:
> On Fri, 2 Mar 2001, Tigran Aivazian wrote:
> > On Thu, 1 Mar 2001, Alan Cox wrote:
> > > 2.4.2-ac8
> > > o	Stop two people claiming the same misc dev id	(Philipp Rumpf)
> > 
> > is this what has broken misc devi registration on my machine? I have two
> > misc devices -- microcode and psaux -- now (ac8) I get none, /proc/misc is
> > empty. Also, on boot gpm generates an "oops" from gpm.c(968) saying
> > "/dev/mouse: No such device"
> 
> Hi Alan,
> 
> here is the fix, tested, it works fine. The only unsatisfactory thing is
> that we do an extra if() on each iteration making misc_register()
> typically a few instructions slower. I will think a few minutes on how to
> make the old version work (i.e. I suspect it was just an incorrect walking
> of the misc_list in ac8).

See earlier patch.

> --- linux/drivers/char/misc.c.0	Fri Mar  2 09:35:01 2001
> +++ linux/drivers/char/misc.c	Fri Mar  2 10:01:17 2001
> @@ -175,14 +175,16 @@
>  	
>  	if (misc->next || misc->prev)
>  		return -EBUSY;
> +
>  	down(&misc_sem);
> -	c = misc_list.next;
>  
> -	while ((c != &misc_list) && (c->minor != misc->minor))
> +	c = misc_list.next;
> +	while (c != &misc_list) {
> +		if (c->minor == misc->minor) {
> +			up(&misc_sem);
> +			return -EBUSY;
> +		}
>  		c = c->next;
> -	if (c == &misc_list) {
> -		up(&misc_sem);
> -		return -EBUSY;
>  	}
>  
>  	if (misc->minor == MISC_DYNAMIC_MINOR) {

This is fine as well, and possibly more readable.

  reply	other threads:[~2001-03-02 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.21.0103021010570.1338-100000@penguin.homenet>
2001-03-02 10:55 ` [patch-2.4.2-ac8] misc_register() fix (was Re: Linux 2.4.2ac8 Tigran Aivazian
2001-03-02 11:03   ` Philipp Rumpf [this message]
2001-03-02 11:07   ` [OT] style-curiosity J . A . Magallon
     [not found]     ` <Pine.LNX.4.21.0103021223160.1338-100000@penguin.homenet>
2001-03-02 14:31       ` J . A . Magallon

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=20010302110318.C8678@parcelfarce.linux.theplanet.co.uk \
    --to=prumpf@parcelfarce.linux.theplanet.co.uk \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tigran@veritas.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.