Commit de5d35af authored by Uma Krishnan's avatar Uma Krishnan Committed by Martin K. Petersen

scsi: cxlflash: Abstract hardware dependent assignments

As a staging cleanup to support transport specific builds of the cxlflash
module, relocate device dependent assignments to header files. This will
avoid littering the core driver with conditional compilation logic.
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5e12397a
...@@ -3708,11 +3708,8 @@ static int cxlflash_probe(struct pci_dev *pdev, ...@@ -3708,11 +3708,8 @@ static int cxlflash_probe(struct pci_dev *pdev,
cfg->init_state = INIT_STATE_NONE; cfg->init_state = INIT_STATE_NONE;
cfg->dev = pdev; cfg->dev = pdev;
cfg->cxl_fops = cxlflash_cxl_fops; cfg->cxl_fops = cxlflash_cxl_fops;
cfg->ops = cxlflash_assign_ops(ddv);
if (ddv->flags & CXLFLASH_OCXL_DEV) WARN_ON_ONCE(!cfg->ops);
cfg->ops = &cxlflash_ocxl_ops;
else
cfg->ops = &cxlflash_cxl_ops;
/* /*
* Promoted LUNs move to the top of the LUN table. The rest stay on * Promoted LUNs move to the top of the LUN table. The rest stay on
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <scsi/scsi.h> #include <scsi/scsi.h>
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include "backend.h"
#define CXLFLASH_NAME "cxlflash" #define CXLFLASH_NAME "cxlflash"
#define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter" #define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter"
#define CXLFLASH_MAX_ADAPTERS 32 #define CXLFLASH_MAX_ADAPTERS 32
...@@ -100,6 +102,19 @@ struct dev_dependent_vals { ...@@ -100,6 +102,19 @@ struct dev_dependent_vals {
#define CXLFLASH_OCXL_DEV 0x0000000000000004ULL #define CXLFLASH_OCXL_DEV 0x0000000000000004ULL
}; };
static inline const struct cxlflash_backend_ops *
cxlflash_assign_ops(struct dev_dependent_vals *ddv)
{
const struct cxlflash_backend_ops *ops = NULL;
if (ddv->flags & CXLFLASH_OCXL_DEV)
ops = &cxlflash_ocxl_ops;
if (!(ddv->flags & CXLFLASH_OCXL_DEV))
ops = &cxlflash_cxl_ops;
return ops;
}
struct asyc_intr_info { struct asyc_intr_info {
u64 status; u64 status;
char *desc; char *desc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment