Re: [PATCH 05/14] stallion: prune lock_kernel calls

From: Arnd Bergmann
Date: Fri Apr 30 2010 - 14:06:49 EST


On Thursday 01 April 2010 18:05:19 Alan Cox wrote:
> @@ -4009,6 +4010,8 @@ static int stli_getbrdstats(combrd_t __user *bp)
> return -ENODEV;
>
> memset(&stli_brdstats, 0, sizeof(combrd_t));
> +
> + mutex_lock(&portp->port.mutex);
> stli_brdstats.brd = brdp->brdnr;
> stli_brdstats.type = brdp->brdtype;
> stli_brdstats.hwid = 0;
> @@ -4022,6 +4025,7 @@ static int stli_getbrdstats(combrd_t __user *bp)
> stli_brdstats.panels[i].hwid = brdp->panelids[i];
> stli_brdstats.panels[i].nrports = brdp->panels[i];
> }
> + mutex_unlock(&portp->port.mutex);
>
> if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t)))
> return -EFAULT;

I just tried porting my patches on top of yours (yes, it's been
some time). This one doesn't work, because there is no portp variable
in stli_getbrdstats.

On a related topic, in patch 06/14 "istallion: use bit ops for the board flags",
you have

> @@ -817,7 +817,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
> brdp = stli_brds[brdnr];
> if (brdp == NULL)
> return -ENODEV;
> - if ((brdp->state & BST_STARTED) == 0)
> + if (!(test_bit(BST_STARTED, &brdp->state))
> return -ENODEV;
> portnr = MINOR2PORT(minordev);
> if (portnr > brdp->nrports)

This won't work because brdp->state is an 'unsigned int' variable, while
bitops only work on 'unsigned long'.

Maybe you sent out a wrong version of this file?

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/