lockdep_assert_held(&wq->wq_lock);
        memset(wq->wqcfg, 0, idxd->wqcfg_size);
        wq->type = IDXD_WQT_NONE;
-       wq->size = 0;
-       wq->group = NULL;
        wq->threshold = 0;
        wq->priority = 0;
        wq->ats_dis = 0;
        wq->max_batch_size = WQ_DEFAULT_MAX_BATCH;
 }
 
+static void idxd_wq_device_reset_cleanup(struct idxd_wq *wq)
+{
+       lockdep_assert_held(&wq->wq_lock);
+
+       idxd_wq_disable_cleanup(wq);
+       wq->size = 0;
+       wq->group = NULL;
+}
+
 static void idxd_wq_ref_release(struct percpu_ref *ref)
 {
        struct idxd_wq *wq = container_of(ref, struct idxd_wq, wq_active);
 
                if (wq->state == IDXD_WQ_ENABLED) {
                        idxd_wq_disable_cleanup(wq);
+                       idxd_wq_device_reset_cleanup(wq);
                        wq->state = IDXD_WQ_DISABLED;
                }
        }