rfkill: use killable locks instead of interruptible
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Thu, 9 Oct 2008 21:15:29 +0000 (18:15 -0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 31 Oct 2008 23:00:08 +0000 (19:00 -0400)
Apparently, many applications don't expect to get EAGAIN from fd read/write
operations, since POSIX doesn't mandate it.

Use mutex_lock_killable instead of mutex_lock_interruptible, which won't
cause issues.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/rfkill/rfkill.c

index f949a482b0078b904d88b655da399d8706a48ca8..08be968f578d20db5973d1b920d0cb162944fc37 100644 (file)
@@ -431,8 +431,9 @@ static ssize_t rfkill_state_store(struct device *dev,
            state != RFKILL_STATE_SOFT_BLOCKED)
                return -EINVAL;
 
-       if (mutex_lock_interruptible(&rfkill->mutex))
-               return -ERESTARTSYS;
+       error = mutex_lock_killable(&rfkill->mutex);
+       if (error)
+               return error;
        error = rfkill_toggle_radio(rfkill, state, 0);
        mutex_unlock(&rfkill->mutex);
 
@@ -472,7 +473,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
         * Take the global lock to make sure the kernel is not in
         * the middle of rfkill_switch_all
         */
-       error = mutex_lock_interruptible(&rfkill_global_mutex);
+       error = mutex_lock_killable(&rfkill_global_mutex);
        if (error)
                return error;