summaryrefslogtreecommitdiff
path: root/drivers/scsi/bfa/bfad_drv.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2024-02-22 13:44:07 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2024-02-26 21:16:48 -0500
commit37126399da15e1d53da93c0282aca539bccc891b (patch)
treef84c13b633a58a3e8ea785fc9d294c21871d718b /drivers/scsi/bfa/bfad_drv.h
parentb69600231f751304db914c63b937f7098ed2895c (diff)
scsi: bfa: Fix function pointer type mismatch for state machines
The bfa driver is full of state machines and a generic abstraction layer for them. This relies on casting function pointers, but that is no longer allowed when CONFIG_CFI_CLANG is enabled and causes a huge number of warnings like: drivers/scsi/bfa/bfad.c:169:3: error: cast from 'void (*)(struct bfad_s *, enum bfad_sm_event)' to 'bfa_sm_t' (aka 'void (*)(void *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] bfa_sm_set_state(bfad, bfad_sm_created); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Rework the mechanism to no longer require the function pointer casts, by having separate types for each individual state machine. This in turn requires moving the enum definitions for each state machine into the header files in order to define the typedef. Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20240222124433.2046570-2-arnd@kernel.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/bfa/bfad_drv.h')
-rw-r--r--drivers/scsi/bfa/bfad_drv.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h
index 7682cfa34265..da42e3261237 100644
--- a/drivers/scsi/bfa/bfad_drv.h
+++ b/drivers/scsi/bfa/bfad_drv.h
@@ -175,11 +175,27 @@ union bfad_tmp_buf {
wwn_t wwn[BFA_FCS_MAX_LPORTS];
};
+/* BFAD state machine events */
+enum bfad_sm_event {
+ BFAD_E_CREATE = 1,
+ BFAD_E_KTHREAD_CREATE_FAILED = 2,
+ BFAD_E_INIT = 3,
+ BFAD_E_INIT_SUCCESS = 4,
+ BFAD_E_HAL_INIT_FAILED = 5,
+ BFAD_E_INIT_FAILED = 6,
+ BFAD_E_FCS_EXIT_COMP = 7,
+ BFAD_E_EXIT_COMP = 8,
+ BFAD_E_STOP = 9
+};
+
+struct bfad_s;
+typedef void (*bfad_sm_t)(struct bfad_s *, enum bfad_sm_event);
+
/*
* BFAD (PCI function) data structure
*/
struct bfad_s {
- bfa_sm_t sm; /* state machine */
+ bfad_sm_t sm; /* state machine */
struct list_head list_entry;
struct bfa_s bfa;
struct bfa_fcs_s bfa_fcs;
@@ -226,19 +242,6 @@ struct bfad_s {
struct list_head vport_list;
};
-/* BFAD state machine events */
-enum bfad_sm_event {
- BFAD_E_CREATE = 1,
- BFAD_E_KTHREAD_CREATE_FAILED = 2,
- BFAD_E_INIT = 3,
- BFAD_E_INIT_SUCCESS = 4,
- BFAD_E_HAL_INIT_FAILED = 5,
- BFAD_E_INIT_FAILED = 6,
- BFAD_E_FCS_EXIT_COMP = 7,
- BFAD_E_EXIT_COMP = 8,
- BFAD_E_STOP = 9
-};
-
/*
* RPORT data structure
*/