[PATCH] change acquire/release_console_sem() to console_lock/unlock()
akpm at linux-foundation.org
Fri Jan 21 19:23:23 EST 2011
On Fri, 21 Jan 2011 09:10:06 +0100 Geert Uytterhoeven <geert at linux-m68k.org> wrote:
> * 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.
> + * 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...
@@ -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.
@@ -1070,7 +1070,7 @@ int console_trylock(void)
console_locked = 1;
console_may_schedule = 0;
- return -1;
+ return 1;
More information about the Linuxppc-dev