}
 
 
+static inline enum ffs_setup_state
+ffs_setup_state_clear_cancelled(struct ffs_data *ffs)
+{
+       return (enum ffs_setup_state)
+               cmpxchg(&ffs->setup_state, FFS_SETUP_CANCELLED, FFS_NO_SETUP);
+}
+
+
 static void ffs_func_eps_disable(struct ffs_function *func);
 static int __must_check ffs_func_eps_enable(struct ffs_function *func);
 
        ENTER();
 
        /* Fast check if setup was canceled */
-       if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELLED)
+       if (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)
                return -EIDRM;
 
        /* Acquire mutex */
                 * rather then _irqsave
                 */
                spin_lock_irq(&ffs->ev.waitq.lock);
-               switch (FFS_SETUP_STATE(ffs)) {
+               switch (ffs_setup_state_clear_cancelled(ffs)) {
                case FFS_SETUP_CANCELLED:
                        ret = -EIDRM;
                        goto done_spin;
                 * transition can be performed and it's protected by
                 * mutex.
                 */
-               if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELLED) {
+               if (ffs_setup_state_clear_cancelled(ffs) ==
+                   FFS_SETUP_CANCELLED) {
                        ret = -EIDRM;
 done_spin:
                        spin_unlock_irq(&ffs->ev.waitq.lock);
        ENTER();
 
        /* Fast check if setup was canceled */
-       if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELLED)
+       if (ffs_setup_state_clear_cancelled(ffs) == FFS_SETUP_CANCELLED)
                return -EIDRM;
 
        /* Acquire mutex */
         */
        spin_lock_irq(&ffs->ev.waitq.lock);
 
-       switch (FFS_SETUP_STATE(ffs)) {
+       switch (ffs_setup_state_clear_cancelled(ffs)) {
        case FFS_SETUP_CANCELLED:
                ret = -EIDRM;
                break;
                spin_lock_irq(&ffs->ev.waitq.lock);
 
                /* See ffs_ep0_write() */
-               if (FFS_SETUP_STATE(ffs) == FFS_SETUP_CANCELLED) {
+               if (ffs_setup_state_clear_cancelled(ffs) ==
+                   FFS_SETUP_CANCELLED) {
                        ret = -EIDRM;
                        break;
                }
 
         *               happens only in ep0 i/o  which is P: mutex
         * + FFS_SETUP_PENDING   -> FFS_SETUP_CANCELLED -- P: ev.waitq.lock
         * + FFS_SETUP_CANCELLED -> FFS_NO_SETUP        -- cmpxchg
+        *
+        * This field should never be accessed directly and instead
+        * ffs_setup_state_clear_cancelled function should be used.
         */
        enum ffs_setup_state            setup_state;
 
-#define FFS_SETUP_STATE(ffs)                                   \
-       ((enum ffs_setup_state)cmpxchg(&(ffs)->setup_state,     \
-                                      FFS_SETUP_CANCELLED, FFS_NO_SETUP))
-
        /* Events & such. */
        struct {
                u8                              types[4];