| /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| * Copyright (C) International Business Machines Corp., 2000-2001 |
| * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
| #include <linux/spinlock.h> |
| * Conditional sleep where condition is protected by spinlock |
| * lock_cmd and unlock_cmd take and release the spinlock |
| #define __SLEEP_COND(wq, cond, lock_cmd, unlock_cmd) \ |
| DECLARE_WAITQUEUE(__wait, current); \ |
| add_wait_queue(&wq, &__wait); \ |
| set_current_state(TASK_UNINTERRUPTIBLE);\ |
| __set_current_state(TASK_RUNNING); \ |
| remove_wait_queue(&wq, &__wait); \ |