From: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
To: linux-scsi@vger.kernel.org,
James Bottomley <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>,
"Manoj N. Kumar" <manoj@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org,
Andrew Donnellan <andrew.donnellan@au1.ibm.com>,
Frederic Barrat <fbarrat@linux.vnet.ibm.com>,
Christophe Lombard <clombard@linux.vnet.ibm.com>
Subject: [PATCH 6/7] cxlflash: Abstract hardware dependent assignments
Date: Fri, 11 May 2018 14:06:05 -0500 [thread overview]
Message-ID: <1526065565-39041-1-git-send-email-ukrishn@linux.vnet.ibm.com> (raw)
In-Reply-To: <1526065440-38806-1-git-send-email-ukrishn@linux.vnet.ibm.com>
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>
---
drivers/scsi/cxlflash/main.c | 7 ++-----
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 c91e912..cd7dcc5 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,
cfg->init_state = INIT_STATE_NONE;
cfg->dev = pdev;
cfg->cxl_fops = cxlflash_cxl_fops;
-
- if (ddv->flags & CXLFLASH_OCXL_DEV)
- cfg->ops = &cxlflash_ocxl_ops;
- else
- cfg->ops = &cxlflash_cxl_ops;
+ cfg->ops = cxlflash_assign_ops(ddv);
+ WARN_ON_ONCE(!cfg->ops);
/*
* 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 6f1be62..ed4908e 100644
--- a/drivers/scsi/cxlflash/main.h
+++ b/drivers/scsi/cxlflash/main.h
@@ -20,6 +20,8 @@
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
+#include "backend.h"
+
#define CXLFLASH_NAME "cxlflash"
#define CXLFLASH_ADAPTER_NAME "IBM POWER CXL Flash Adapter"
#define CXLFLASH_MAX_ADAPTERS 32
@@ -100,6 +102,19 @@ struct dev_dependent_vals {
#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 {
u64 status;
char *desc;
--
2.1.0
next prev parent reply other threads:[~2018-05-11 19:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-11 19:04 [PATCH 0/7] Miscellaneous patches and bug fixes Uma Krishnan
2018-05-11 19:04 ` [PATCH 1/7] cxlflash: Yield to active send threads Uma Krishnan
2018-05-16 15:09 ` Matthew R. Ochs
2018-05-11 19:05 ` [PATCH 2/7] cxlflash: Limit the debug logs in the IO path Uma Krishnan
2018-05-16 15:53 ` Matthew R. Ochs
2018-05-11 19:05 ` [PATCH 3/7] cxlflash: Acquire semaphore before invoking ioctl services Uma Krishnan
2018-05-16 15:54 ` Matthew R. Ochs
2018-05-11 19:05 ` [PATCH 4/7] cxlflash: Use local mutex for AFU serialization Uma Krishnan
2018-05-11 19:05 ` [PATCH 5/7] cxlflash: Add include guards to backend.h Uma Krishnan
2018-05-16 15:58 ` Matthew R. Ochs
2018-05-11 19:06 ` Uma Krishnan [this message]
2018-05-16 15:59 ` [PATCH 6/7] cxlflash: Abstract hardware dependent assignments Matthew R. Ochs
2018-05-11 19:06 ` [PATCH 7/7] cxlflash: Isolate external module dependencies Uma Krishnan
2018-05-16 16:13 ` Matthew R. Ochs
2018-05-18 15:23 ` [PATCH 0/7] Miscellaneous patches and bug fixes Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526065565-39041-1-git-send-email-ukrishn@linux.vnet.ibm.com \
--to=ukrishn@linux.vnet.ibm.com \
--cc=andrew.donnellan@au1.ibm.com \
--cc=clombard@linux.vnet.ibm.com \
--cc=fbarrat@linux.vnet.ibm.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=manoj@linux.vnet.ibm.com \
--cc=martin.petersen@oracle.com \
--cc=mrochs@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).