[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] Re: [PATCH] change acquire/release_console_sem() to console_lock/unlock()
- To: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
- From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 21 Jan 2011 00:23:23 -0800
- Cc: Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx>, dri-devel@xxxxxxxxxxxxxxxxxxxxx, Paul Mackerras <paulus@xxxxxxxxx>, Panizzo <maramaopercheseimorto@xxxxxxxxx>, Phil Edworthy <phil.edworthy@xxxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxxx>, Tobias Schandinat <FlorianSchandinat@xxxxxx>, "James E.J. Bottomley" <jejb@xxxxxxxxxxxxxxxx>, Vlasenko <vda.linux@xxxxxxxxxxxxxx>, Kees Cook <kees.cook@xxxxxxxxxxxxx>, Marcin Slusarz <marcin.slusarz@xxxxxxxxx>, Antonino Daplas <adaplas@xxxxxxxxx>, Abhijeet Dharmapurikar <adharmap@xxxxxxxxxxxxxx>, Rusty Russell <rusty@xxxxxxxxxxxxxxx>, linux-geode@xxxxxxxxxxxxxxxxxxx, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, linux-omap@xxxxxxxxxxxxxxx, Girdwood <lrg@xxxxxxxxxxxxxxx>, Daniel Walker <dwalker@xxxxxxxxxxxxxx>, Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>, Geoff Levand <geoff@xxxxxxxxxxxxx>, Kosina <jkosina@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Ralf Baechle <ralf@xxxxxxxxxxxxxx>, McMartin <kyle@xxxxxxxxxxx>, Jiri, Werner, Takashi Iwai <tiwai@xxxxxxx>, Alex Deucher <alexdeucher@xxxxxxxxx>, Liam, linux-fbdev@xxxxxxxxxxxxxxx, James Hogan <james@xxxxxxxxxxxxx>, David Airlie <airlied@xxxxxxxx>, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Lars-Peter Clausen <lars@xxxxxxxxxx>, Wu Zhangjin <wuzhangjin@xxxxxxxxx>, Helge Deller <deller@xxxxxx>, Kay Sievers <kay.sievers@xxxxxxxx>, Ben Skeggs <bskeggs@xxxxxxxxxx>, Dave Airlie <airlied@xxxxxxxxxx>, Ondrej Zary <linux@xxxxxxxxxxxxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>, Magnus Damm <damm@xxxxxxxxxxxxx>, Daniel Mack <daniel@xxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Caglar Akyuz <caglar@xxxxxxxxxxxxxxxxxxxxx>, Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, Paul Mundt <lethal@xxxxxxxxxxxx>, Marcin KoÅcielnicki <koriakin@xxxxxxxx>, Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>, Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>, James Morris <jmorris@xxxxxxxxx>, Kuninori, Alberto, Denys, Thomas Gleixner <tglx@xxxxxxx>, Tony Lindgren <tony@xxxxxxxxxxx>, Andres Salomon <dilinger@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, Francisco Jerez <currojerez@xxxxxxxxxx>, Alexey Dobriyan <adobriyan@xxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Fink <werner@xxxxxxx>, Nicolas Pitre <nicolas.pitre@xxxxxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Kyle, linux-parisc@xxxxxxxxxxxxxxx, Greg KH <gregkh@xxxxxxx>, Ondrej Zajicek <santiago@xxxxxxxxxxxxx>, Jean Delvare <khali@xxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, Florian, Daniel Vetter <daniel.vetter@xxxxxxxx>, Julia Lawall <julia@xxxxxxx>, Jiri Slaby <jslaby@xxxxxxx>, devel@xxxxxxxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Lionel Debroux <lionel_debroux@xxxxxxxx>, David Brown <davidb@xxxxxxxxxxxxxx>, cbe-oss-dev@xxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, torbenh <torbenh@xxxxxx>, Jerome Glisse <jglisse@xxxxxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Guy Martin <gmsoft@xxxxxxxxxxxx>, Jason Wessel <jason.wessel@xxxxxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx, Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
- Delivery-date: Fri, 21 Jan 2011 04:51:45 -0800
- List-id: Xen developer discussion <xen-devel.lists.xensource.com>
On Fri, 21 Jan 2011 09:10:06 +0100 Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
wrote:
> include/linux/mutex.h:
>
> /*
> * NOTE: mutex_trylock() follows the spin_trylock() convention,
> * not the down_trylock() convention!
> *
> * Returns 1 if the mutex has been acquired successfully, and 0 on contention.
> */
> extern int mutex_trylock(struct mutex *lock);
>
> So that's why the return value was inverted (when treating it as a boolean).
> I can understand that.
>
> However:
>
> +/**
> + * console_trylock - try to lock the console system for exclusive use.
> + *
> + * Tried to acquire a lock which guarantees that the caller has
> + * exclusive access to the console system and the console_drivers list.
> + *
> + * returns -1 on success, and 0 on failure to acquire the lock.
> + */
> +int console_trylock(void)
>
> So this one returns -1 on success, not 1? Why?
Yup. All callers just test for non-zero, so...
---
a/kernel/printk.c~change-acquire-release_console_sem-to-console_lock-unlock-fix-2
+++ a/kernel/printk.c
@@ -1058,7 +1058,7 @@ EXPORT_SYMBOL(console_lock);
* Tried to acquire a lock which guarantees that the caller has
* exclusive access to the console system and the console_drivers list.
*
- * returns -1 on success, and 0 on failure to acquire the lock.
+ * returns 1 on success, and 0 on failure to acquire the lock.
*/
int console_trylock(void)
{
@@ -1070,7 +1070,7 @@ int console_trylock(void)
}
console_locked = 1;
console_may_schedule = 0;
- return -1;
+ return 1;
}
EXPORT_SYMBOL(console_trylock);
_
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|