diff options
author | Uma Krishnan <ukrishn@linux.vnet.ibm.com> | 2018-05-11 15:06:05 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-05-18 11:22:10 -0400 |
commit | de5d35aff5b34bc91a83adb0bf1788d3d23e92f4 (patch) | |
tree | c57d9a6eee33197af3ec9789b21000fbacd652fc /drivers/scsi/cxlflash | |
parent | 5e12397a9706391543e87cf088fff89fe05f0ad0 (diff) |
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: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/cxlflash')
-rw-r--r-- | drivers/scsi/cxlflash/main.c | 7 | ||||
-rw-r--r-- | drivers/scsi/cxlflash/main.h | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index c91e9127fc79..cd7dcc578dfb 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c | |||
@@ -3708,11 +3708,8 @@ static int cxlflash_probe(struct pci_dev *pdev, | |||
3708 | cfg->init_state = INIT_STATE_NONE; | 3708 | cfg->init_state = INIT_STATE_NONE; |
3709 | cfg->dev = pdev; | 3709 | cfg->dev = pdev; |
3710 | cfg->cxl_fops = cxlflash_cxl_fops; | 3710 | cfg->cxl_fops = cxlflash_cxl_fops; |
3711 | 3711 | cfg->ops = cxlflash_assign_ops(ddv); | |
3712 | if (ddv->flags & CXLFLASH_OCXL_DEV) | 3712 | WARN_ON_ONCE(!cfg->ops); |
3713 | cfg->ops = &cxlflash_ocxl_ops; | ||
3714 | else | ||
3715 | cfg->ops = &cxlflash_cxl_ops; | ||
3716 | 3713 | ||
3717 | /* | 3714 | /* |
3718 | * Promoted LUNs move to the top of the LUN table. The rest stay on | 3715 | * Promoted LUNs move to the top of the LUN table. The rest stay on |
diff --git a/drivers/scsi/cxlflash/main.h b/drivers/scsi/cxlflash/main.h index 6f1be621e473..ed4908e5dffb 100644 --- a/drivers/scsi/cxlflash/main.h +++ b/drivers/scsi/cxlflash/main.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <scsi/scsi.h> | 20 | #include <scsi/scsi.h> |
21 | #include <scsi/scsi_device.h> | 21 | #include <scsi/scsi_device.h> |
22 | 22 | ||
23 | #include "backend.h" | ||
24 | |||
23 | #define CXLFLASH_NAME "cxlflash" | 25 | #define CXLFLASH_NAME "cxlflash" |
24 | #define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter" | 26 | #define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter" |
25 | #define CXLFLASH_MAX_ADAPTERS 32 | 27 | #define CXLFLASH_MAX_ADAPTERS 32 |
@@ -100,6 +102,19 @@ struct dev_dependent_vals { | |||
100 | #define CXLFLASH_OCXL_DEV 0x0000000000000004ULL | 102 | #define CXLFLASH_OCXL_DEV 0x0000000000000004ULL |
101 | }; | 103 | }; |
102 | 104 | ||
105 | static inline const struct cxlflash_backend_ops * | ||
106 | cxlflash_assign_ops(struct dev_dependent_vals *ddv) | ||
107 | { | ||
108 | const struct cxlflash_backend_ops *ops = NULL; | ||
109 | |||
110 | if (ddv->flags & CXLFLASH_OCXL_DEV) | ||
111 | ops = &cxlflash_ocxl_ops; | ||
112 | if (!(ddv->flags & CXLFLASH_OCXL_DEV)) | ||
113 | ops = &cxlflash_cxl_ops; | ||
114 | |||
115 | return ops; | ||
116 | } | ||
117 | |||
103 | struct asyc_intr_info { | 118 | struct asyc_intr_info { |
104 | u64 status; | 119 | u64 status; |
105 | char *desc; | 120 | char *desc; |