}
 
 /* The key must be already stored in q->key. */
-struct futex_hash_bucket *futex_q_lock(struct futex_q *q)
+void futex_q_lock(struct futex_q *q, struct futex_hash_bucket *hb)
        __acquires(&hb->lock)
 {
-       struct futex_hash_bucket *hb;
-
-       hb = futex_hash(&q->key);
-
        /*
         * Increment the counter before taking the lock so that
         * a potential waker won't miss a to-be-slept task that is
        q->lock_ptr = &hb->lock;
 
        spin_lock(&hb->lock);
-       return hb;
 }
 
 void futex_q_unlock(struct futex_hash_bucket *hb)
 
 #endif
 }
 
-extern struct futex_hash_bucket *futex_q_lock(struct futex_q *q);
+extern void futex_q_lock(struct futex_q *q, struct futex_hash_bucket *hb);
 extern void futex_q_unlock(struct futex_hash_bucket *hb);
 
 
 
                goto out;
 
 retry_private:
-       hb = futex_q_lock(&q);
+       hb = futex_hash(&q.key);
+       futex_q_lock(&q, hb);
 
        ret = futex_lock_pi_atomic(uaddr, hb, &q.key, &q.pi_state, current,
                                   &exiting, 0);
 
                struct futex_q *q = &vs[i].q;
                u32 val = vs[i].w.val;
 
-               hb = futex_q_lock(q);
+               hb = futex_hash(&q->key);
+               futex_q_lock(q, hb);
                ret = futex_get_value_locked(&uval, uaddr);
 
                if (!ret && uval == val) {
                return ret;
 
 retry_private:
-       hb = futex_q_lock(q);
+       hb = futex_hash(&q->key);
+       futex_q_lock(q, hb);
 
        ret = futex_get_value_locked(&uval, uaddr);