linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Don Brace <don.brace@pmcs.com>
To: scott.teel@pmcs.com, Kevin.Barnett@pmcs.com,
	scott.benesh@pmcs.com, james.bottomley@parallels.com,
	hch@infradead.org, Justin.Lindley@pmcs.com, elliott@hpe.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH 09/21] hpsa: simplify check for device exposure
Date: Sat, 24 Oct 2015 14:53:21 -0500	[thread overview]
Message-ID: <20151024195321.17127.62124.stgit@brunhilda> (raw)
In-Reply-To: <20151024193306.17127.7819.stgit@brunhilda>

From: Kevin Barnett <kevin.barnett@pmcs.com>

remove macros and cleanup device exposure checking

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
---
 drivers/scsi/hpsa.c |   25 +++++++++++--------------
 drivers/scsi/hpsa.h |    6 +-----
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ff34c8e..7d109bc 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -791,8 +791,7 @@ static ssize_t path_info_show(struct device *dev,
 				PATH_STRING_LEN,
 				"PORT: %.2s ",
 				phys_connector);
-		if (hdev->devtype == TYPE_DISK &&
-			hdev->expose_state != HPSA_DO_NOT_EXPOSE) {
+		if (hdev->devtype == TYPE_DISK && hdev->expose_device) {
 			if (box == 0 || box == 0xFF) {
 				output_len += snprintf(path[i] + output_len,
 					PATH_STRING_LEN,
@@ -1152,7 +1151,7 @@ static inline void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
 				"RAID-?" : raid_label[dev->raid_level],
 			dev->offload_config ? '+' : '-',
 			dev->offload_enabled ? '+' : '-',
-			dev->expose_state);
+			dev->expose_device);
 }
 
 /* Add an entry into h->dev[] array. */
@@ -1225,7 +1224,7 @@ lun_assigned:
 	added[*nadded] = device;
 	(*nadded)++;
 	hpsa_show_dev_msg(__stringify(KERN_INFO), h, device,
-		device->expose_state & HPSA_SCSI_ADD ? "added" : "masked");
+		device->expose_device ? "added" : "masked");
 	device->offload_to_be_enabled = device->offload_enabled;
 	device->offload_enabled = 0;
 	return 0;
@@ -1777,7 +1776,7 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
 	for (i = 0; i < nremoved; i++) {
 		if (!removed[i])
 			continue;
-		if (removed[i]->expose_state & HPSA_SCSI_ADD) {
+		if (removed[i]->expose_device) {
 			struct scsi_device *sdev =
 				scsi_device_lookup(sh, removed[i]->bus,
 					removed[i]->target, removed[i]->lun);
@@ -1803,7 +1802,7 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
 	for (i = 0; i < nadded; i++) {
 		if (!added[i])
 			continue;
-		if (!(added[i]->expose_state & HPSA_SCSI_ADD))
+		if (!(added[i]->expose_device))
 			continue;
 		if (scsi_add_device(sh, added[i]->bus,
 			added[i]->target, added[i]->lun) == 0)
@@ -1852,7 +1851,7 @@ static int hpsa_slave_alloc(struct scsi_device *sdev)
 		sdev_id(sdev), sdev->lun);
 	if (likely(sd)) {
 		atomic_set(&sd->ioaccel_cmds_out, 0);
-		sdev->hostdata = (sd->expose_state & HPSA_SCSI_ADD) ? sd : NULL;
+		sdev->hostdata = sd->expose_device ? sd : NULL;
 	} else
 		sdev->hostdata = NULL;
 	spin_unlock_irqrestore(&h->devlock, flags);
@@ -1866,7 +1865,7 @@ static int hpsa_slave_configure(struct scsi_device *sdev)
 	int queue_depth;
 
 	sd = sdev->hostdata;
-	sdev->no_uld_attach = !sd || !(sd->expose_state & HPSA_ULD_ATTACH);
+	sdev->no_uld_attach = !sd || !sd->expose_device;
 
 	if (sd)
 		queue_depth = sd->queue_depth != 0 ?
@@ -3854,12 +3853,10 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)
 
 		/* do not expose masked devices */
 		if (MASKED_DEVICE(lunaddrbytes) &&
-			i < nphysicals + (raid_ctlr_position == 0)) {
-			this_device->expose_state = HPSA_DO_NOT_EXPOSE;
-		} else {
-			this_device->expose_state =
-					HPSA_SG_ATTACH | HPSA_ULD_ATTACH;
-		}
+			i < nphysicals + (raid_ctlr_position == 0))
+			this_device->expose_device = 0;
+		else
+			this_device->expose_device = 1;
 
 		switch (this_device->devtype) {
 		case TYPE_ROM:
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index fb07b70..aab722a 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -37,6 +37,7 @@ struct hpsa_scsi_dev_t {
 	int devtype;
 	int bus, target, lun;		/* as presented to the OS */
 	unsigned char scsi3addr[8];	/* as presented to the HW */
+	u8 expose_device;
 #define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
 	unsigned char device_id[16];    /* from inquiry pg. 0x83 */
 	unsigned char vendor[8];        /* bytes 8-15 of inquiry data */
@@ -75,11 +76,6 @@ struct hpsa_scsi_dev_t {
 	struct hpsa_scsi_dev_t *phys_disk[RAID_MAP_MAX_ENTRIES];
 	int nphysical_disks;
 	int supports_aborts;
-#define HPSA_DO_NOT_EXPOSE	0x0
-#define HPSA_SG_ATTACH		0x1
-#define HPSA_ULD_ATTACH		0x2
-#define HPSA_SCSI_ADD		(HPSA_SG_ATTACH | HPSA_ULD_ATTACH)
-	u8 expose_state;
 };
 
 struct reply_queue_buffer {


  parent reply	other threads:[~2015-10-24 19:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24 19:52 [PATCH 00/21] hpsa updates Don Brace
2015-10-24 19:52 ` [PATCH 01/21] hpsa: correct calls to dev_printk Don Brace
2015-10-26 12:52   ` Tomas Henzl
2015-10-26 13:41     ` Don Brace
2015-10-24 19:52 ` [PATCH 02/21] hpsa: allow driver requested rescans Don Brace
2015-10-26 14:36   ` Tomas Henzl
2015-10-24 19:52 ` [PATCH 03/21] hpsa: abandon rescans on memory alloaction failures Don Brace
2015-10-26 14:24   ` Tomas Henzl
2015-10-26 14:29     ` Don Brace
2015-10-26 14:32       ` Tomas Henzl
2015-10-26 14:36         ` Tomas Henzl
2015-10-24 19:52 ` [PATCH 04/21] hpsa: correct transfer length for 6 byte read/write commands Don Brace
2015-10-26 14:37   ` Tomas Henzl
2015-10-24 19:52 ` [PATCH 05/21] hpsa: fix hpsa_adjust_hpsa_scsi_table Don Brace
2015-10-26 14:55   ` Tomas Henzl
2015-10-26 15:22     ` Don Brace
2015-10-24 19:53 ` [PATCH 06/21] hpsa: fix physical target reset Don Brace
2015-10-24 19:53 ` [PATCH 07/21] hpsa: correct check for non-disk devices Don Brace
2015-10-24 19:53 ` [PATCH 08/21] hpsa: correct ioaccel2 sg chain len Don Brace
2015-10-24 19:53 ` Don Brace [this message]
2015-10-24 19:53 ` [PATCH 10/21] hpsa: simplify update scsi devices Don Brace
2015-10-24 19:53 ` [PATCH 11/21] hpsa: add function is_logical_device Don Brace
2015-10-24 19:53 ` [PATCH 12/21] hpsa: enhance hpsa_get_device_id Don Brace
2015-10-24 19:53 ` [PATCH 13/21] hpsa: refactor hpsa_figure_bus_target_lun Don Brace
2015-10-24 19:53 ` [PATCH 14/21] hpsa: move scsi_add_device and scsi_remove_device calls to new function Don Brace
2015-10-24 19:53 ` [PATCH 15/21] External array LUNs must use target and lun numbers assigned by the Don Brace
2015-10-24 19:54 ` [PATCH 16/21] hpsa: eliminate fake lun0 enclosures Don Brace
2015-10-24 19:54 ` [PATCH 17/21] hpsa: add discovery polling for PT RAID devices Don Brace
2015-10-24 19:54 ` [PATCH 18/21] hpsa: disable report lun data caching Don Brace
2015-10-24 19:54 ` [PATCH 19/21] hpsa: enhance device messages Don Brace
2015-10-24 20:19   ` kbuild test robot
2015-10-26 13:36     ` Don Brace
2015-10-24 19:54 ` [PATCH 20/21] hpsa: add in sas transport class Don Brace
2015-10-24 19:54 ` [PATCH 21/21] hpsa: bump the driver version Don Brace

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=20151024195321.17127.62124.stgit@brunhilda \
    --to=don.brace@pmcs.com \
    --cc=Justin.Lindley@pmcs.com \
    --cc=Kevin.Barnett@pmcs.com \
    --cc=elliott@hpe.com \
    --cc=hch@infradead.org \
    --cc=james.bottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=scott.benesh@pmcs.com \
    --cc=scott.teel@pmcs.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).