summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi/zfcp_def.h
diff options
context:
space:
mode:
authorSteffen Maier <maier@linux.ibm.com>2018-11-08 17:44:51 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-11-15 23:01:18 +0300
commit0023beece0c73bc11c1e2827c3de5bbbb66b4542 (patch)
treea35130de1ca046de21a6e2f4ebacffab4f2f9a48 /drivers/s390/scsi/zfcp_def.h
parentdf91eefd080dcd9801145d1c210d3b078cf912b1 (diff)
downloadlinux-0023beece0c73bc11c1e2827c3de5bbbb66b4542.tar.xz
scsi: zfcp: use enum zfcp_erp_steps for struct zfcp_erp_action.step
Use the already defined enum for this purpose to get at least some build checking (even though an enum is type equivalent to an int in C). v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in zfcp_erp.c") introduced the enum which was cpp defines previously. Since struct zfcp_erp_action type is embedded into other structures living in zfcp_def.h, we have to move enum zfcp_erp_act_type from its private definition in zfcp_erp.c to the zfcp-global zfcp_def.h Silence some false -Wswitch compiler warning cases with individual NOP cases. When adding more enum values and building with W=1 we would get compiler warnings about missed new cases. Add missing break statements in some of the above switch cases. No functional change, but making it future-proof. I think all of these should have had a break statement ever since, even if these switch cases happened to be the last ones in the switch statement body. "Fall through" in the context of switch case usually means not to have a break and fall through to the subsequent switch case. However, I think this old comment meant that here we do not have an _early return_ in the switch case but the code path continues after the switch case body. Signed-off-by: Steffen Maier <maier@linux.ibm.com> Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
-rw-r--r--drivers/s390/scsi/zfcp_def.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 121db4aa64bb..87d2f47a6990 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -107,6 +107,20 @@ enum zfcp_erp_act_type {
ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
};
+/*
+ * Values must fit into u16 because of code dependencies:
+ * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), zfcp_dbf_rec_run_wka(),
+ * &zfcp_dbf_rec_running.rec_step.
+ */
+enum zfcp_erp_steps {
+ ZFCP_ERP_STEP_UNINITIALIZED = 0x0000,
+ ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010,
+ ZFCP_ERP_STEP_PORT_CLOSING = 0x0100,
+ ZFCP_ERP_STEP_PORT_OPENING = 0x0800,
+ ZFCP_ERP_STEP_LUN_CLOSING = 0x1000,
+ ZFCP_ERP_STEP_LUN_OPENING = 0x2000,
+};
+
struct zfcp_erp_action {
struct list_head list;
enum zfcp_erp_act_type type; /* requested action code */
@@ -114,7 +128,7 @@ struct zfcp_erp_action {
struct zfcp_port *port;
struct scsi_device *sdev;
u32 status; /* recovery status */
- u32 step; /* active step of this erp action */
+ enum zfcp_erp_steps step; /* active step of this erp action */
unsigned long fsf_req_id;
struct timer_list timer;
};