From 8a9764fc8b186b80beced4733be45ccb137c042a Mon Sep 17 00:00:00 2001 Message-Id: <8a9764fc8b186b80beced4733be45ccb137c042a.1525892957.git.joseph.salisbury@canonical.com> From: Joseph Salisbury Date: Wed, 9 May 2018 18:20:48 +0000 Subject: [PATCH 1/6] [PATCH 1/6] Revert "UBUNTU: SAUCE: cxlflash: Use IDR to manage adapter contexts" BugLink: http://bugs.launchpad.net/bugs/1768431 This reverts commit db1f1d0a3028e5cd11b1e56c64f6e07972451be1. --- drivers/scsi/cxlflash/ocxl_hw.c | 18 ++---------------- drivers/scsi/cxlflash/ocxl_hw.h | 1 - 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/cxlflash/ocxl_hw.c b/drivers/scsi/cxlflash/ocxl_hw.c index 3c311f3..98ac9da 100644 --- a/drivers/scsi/cxlflash/ocxl_hw.c +++ b/drivers/scsi/cxlflash/ocxl_hw.c @@ -13,7 +13,6 @@ */ #include -#include #include #include #include @@ -526,15 +525,7 @@ static void *ocxlflash_dev_context_init(struct pci_dev *pdev, void *afu_cookie) if (unlikely(!ctx)) { dev_err(dev, "%s: Context allocation failed\n", __func__); rc = -ENOMEM; - goto err1; - } - - idr_preload(GFP_KERNEL); - rc = idr_alloc(&afu->idr, ctx, 0, afu->max_pasid, GFP_NOWAIT); - idr_preload_end(); - if (unlikely(rc < 0)) { - dev_err(dev, "%s: idr_alloc failed rc=%d\n", __func__, rc); - goto err2; + goto err; } spin_lock_init(&ctx->slock); @@ -551,9 +542,7 @@ static void *ocxlflash_dev_context_init(struct pci_dev *pdev, void *afu_cookie) ctx->pending_fault = false; out: return ctx; -err2: - kfree(ctx); -err1: +err: ctx = ERR_PTR(rc); goto out; } @@ -584,7 +573,6 @@ static int ocxlflash_release_context(void *ctx_cookie) } mutex_unlock(&ctx->state_mutex); - idr_remove(&ctx->hw_afu->idr, ctx->pe); ocxlflash_release_mapping(ctx); kfree(ctx); out: @@ -744,7 +732,6 @@ static void ocxlflash_destroy_afu(void *afu_cookie) return; ocxlflash_release_context(afu->ocxl_ctx); - idr_destroy(&afu->idr); /* Disable the AFU */ pos = afu->acfg.dvsec_afu_control_pos; @@ -972,7 +959,6 @@ static void *ocxlflash_create_afu(struct pci_dev *pdev) goto err3; } - idr_init(&afu->idr); afu->ocxl_ctx = ctx; out: return afu; diff --git a/drivers/scsi/cxlflash/ocxl_hw.h b/drivers/scsi/cxlflash/ocxl_hw.h index eb1c24a..14f461f 100644 --- a/drivers/scsi/cxlflash/ocxl_hw.h +++ b/drivers/scsi/cxlflash/ocxl_hw.h @@ -41,7 +41,6 @@ struct ocxl_hw_afu { void __iomem *gmmio_virt; /* Global MMIO map */ void *link_token; /* Link token for the SPA */ - struct idr idr; /* IDR to manage contexts */ int max_pasid; /* Maximum number of contexts */ }; -- 2.7.4