From 7fbafaa51960cd2f2a7afa63829b4135c9682a75 Mon Sep 17 00:00:00 2001 From: Henryk Dembkowski Date: Sat, 12 Feb 2011 11:50:05 -0800 Subject: [PATCH] isci: remote device and node cleanup step1 c99 the struct initializers (scic_sds_remote_device_state_handler_table[]): 1/ allows grep to consistently show method name associations. The naming is mostly consistent (except when it isn't) so this guarantees coverage of present and future exception cases. 2/ let's the compiler guarantee that the state table array entry correlates with an actual state name and detect accidental reordering or deletion of states. 3/ allows default handler's to be identified easily Change names from upper to low letters Cleanup empty lines Signed-off-by: Henryk Dembkowski Signed-off-by: Dan Williams --- drivers/scsi/isci/core/sci_base_remote_device.h | 3 - drivers/scsi/isci/core/scic_sds_remote_device.c | 284 ++++++++++----------- drivers/scsi/isci/core/scic_sds_remote_device.h | 77 ++---- .../scsi/isci/core/scic_sds_remote_node_context.c | 26 +- .../scsi/isci/core/scic_sds_remote_node_context.h | 46 +--- .../scsi/isci/core/scic_sds_stp_remote_device.c | 2 +- 6 files changed, 184 insertions(+), 254 deletions(-) diff --git a/drivers/scsi/isci/core/sci_base_remote_device.h b/drivers/scsi/isci/core/sci_base_remote_device.h index fe6614b..25c6ddd 100644 --- a/drivers/scsi/isci/core/sci_base_remote_device.h +++ b/drivers/scsi/isci/core/sci_base_remote_device.h @@ -130,9 +130,6 @@ enum sci_base_remote_device_states { * Simply the final state for the base remote device state machine. */ SCI_BASE_REMOTE_DEVICE_STATE_FINAL, - - SCI_BASE_REMOTE_DEVICE_MAX_STATES - }; /** diff --git a/drivers/scsi/isci/core/scic_sds_remote_device.c b/drivers/scsi/isci/core/scic_sds_remote_device.c index cb26d0c..b824e57 100644 --- a/drivers/scsi/isci/core/scic_sds_remote_device.c +++ b/drivers/scsi/isci/core/scic_sds_remote_device.c @@ -1707,168 +1707,142 @@ static enum sci_status scic_sds_remote_device_resetting_state_complete_request_h /* --------------------------------------------------------------------------- */ -struct scic_sds_remote_device_state_handler -scic_sds_remote_device_state_handler_table[SCI_BASE_REMOTE_DEVICE_MAX_STATES] = -{ - /* SCI_BASE_REMOTE_DEVICE_STATE_INITIAL */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_default_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_default_event_handler, - scic_sds_remote_device_default_frame_handler +const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = { + [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_default_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_default_event_handler, + .frame_handler = scic_sds_remote_device_default_frame_handler }, - /* SCI_BASE_REMOTE_DEVICE_STATE_STOPPED */ - { - { - scic_sds_remote_device_stopped_state_start_handler, - scic_sds_remote_device_stopped_state_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_stopped_state_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_default_event_handler, - scic_sds_remote_device_default_frame_handler + [SCI_BASE_REMOTE_DEVICE_STATE_STOPPED] = { + .parent.start_handler = scic_sds_remote_device_stopped_state_start_handler, + .parent.stop_handler = scic_sds_remote_device_stopped_state_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_stopped_state_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_default_event_handler, + .frame_handler = scic_sds_remote_device_default_frame_handler }, - /* SCI_BASE_REMOTE_DEVICE_STATE_STARTING */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_starting_state_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_general_event_handler, - scic_sds_remote_device_default_frame_handler + [SCI_BASE_REMOTE_DEVICE_STATE_STARTING] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_starting_state_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_general_event_handler, + .frame_handler = scic_sds_remote_device_default_frame_handler }, - /* SCI_BASE_REMOTE_DEVICE_STATE_READY */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_ready_state_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_ready_state_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_ready_state_start_io_handler, - scic_sds_remote_device_ready_state_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_ready_state_start_task_handler, - scic_sds_remote_device_ready_state_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_general_event_handler, - scic_sds_remote_device_general_frame_handler, + [SCI_BASE_REMOTE_DEVICE_STATE_READY] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_ready_state_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_ready_state_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_ready_state_start_io_handler, + .parent.complete_io_handler = scic_sds_remote_device_ready_state_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_ready_state_start_task_handler, + .parent.complete_task_handler = scic_sds_remote_device_ready_state_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_general_event_handler, + .frame_handler = scic_sds_remote_device_general_frame_handler, }, - /* SCI_BASE_REMOTE_DEVICE_STATE_STOPPING */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_stopping_state_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_stopping_state_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_stopping_state_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_general_event_handler, - scic_sds_remote_device_general_frame_handler + [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_stopping_state_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_stopping_state_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_stopping_state_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_general_event_handler, + .frame_handler = scic_sds_remote_device_general_frame_handler }, - /* SCI_BASE_REMOTE_DEVICE_STATE_FAILED */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_default_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_default_event_handler, - scic_sds_remote_device_general_frame_handler + [SCI_BASE_REMOTE_DEVICE_STATE_FAILED] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_default_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_default_event_handler, + .frame_handler = scic_sds_remote_device_general_frame_handler }, - /* SCI_BASE_REMOTE_DEVICE_STATE_RESETTING */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_resetting_state_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_resetting_state_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_resetting_state_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_resetting_state_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_default_event_handler, - scic_sds_remote_device_general_frame_handler + [SCI_BASE_REMOTE_DEVICE_STATE_RESETTING] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_resetting_state_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_resetting_state_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_resetting_state_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_resetting_state_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_default_event_handler, + .frame_handler = scic_sds_remote_device_general_frame_handler }, - /* SCI_BASE_REMOTE_DEVICE_STATE_FINAL */ - { - { - scic_sds_remote_device_default_start_handler, - scic_sds_remote_device_default_stop_handler, - scic_sds_remote_device_default_fail_handler, - scic_sds_remote_device_default_destruct_handler, - scic_sds_remote_device_default_reset_handler, - scic_sds_remote_device_default_reset_complete_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler, - scic_sds_remote_device_default_continue_request_handler, - scic_sds_remote_device_default_start_request_handler, - scic_sds_remote_device_default_complete_request_handler - }, - scic_sds_remote_device_default_suspend_handler, - scic_sds_remote_device_default_resume_handler, - scic_sds_remote_device_default_event_handler, - scic_sds_remote_device_default_frame_handler + [SCI_BASE_REMOTE_DEVICE_STATE_FINAL] = { + .parent.start_handler = scic_sds_remote_device_default_start_handler, + .parent.stop_handler = scic_sds_remote_device_default_stop_handler, + .parent.fail_handler = scic_sds_remote_device_default_fail_handler, + .parent.destruct_handler = scic_sds_remote_device_default_destruct_handler, + .parent.reset_handler = scic_sds_remote_device_default_reset_handler, + .parent.reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler, + .parent.start_io_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_io_handler = scic_sds_remote_device_default_complete_request_handler, + .parent.continue_io_handler = scic_sds_remote_device_default_continue_request_handler, + .parent.start_task_handler = scic_sds_remote_device_default_start_request_handler, + .parent.complete_task_handler = scic_sds_remote_device_default_complete_request_handler, + .suspend_handler = scic_sds_remote_device_default_suspend_handler, + .resume_handler = scic_sds_remote_device_default_resume_handler, + .event_handler = scic_sds_remote_device_default_event_handler, + .frame_handler = scic_sds_remote_device_default_frame_handler } }; diff --git a/drivers/scsi/isci/core/scic_sds_remote_device.h b/drivers/scsi/isci/core/scic_sds_remote_device.h index 44185a2..8aa0a5e 100644 --- a/drivers/scsi/isci/core/scic_sds_remote_device.h +++ b/drivers/scsi/isci/core/scic_sds_remote_device.h @@ -87,20 +87,21 @@ enum SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATES { SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_INITIAL, /** - * This is the ready operational substate for the remote device. This is the - * normal operational state for a remote device. + * This is the ready operational substate for the remote device. + * This is the normal operational state for a remote device. */ SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_OPERATIONAL, /** - * This is the suspended state for the remote device. This is the state that - * the device is placed in when a RNC suspend is received by the SCU hardware. + * This is the suspended state for the remote device. This is the state + * that the device is placed in when a RNC suspend is received by + * the SCU hardware. */ SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_SUSPENDED, /** - * This is the final state that the device is placed in before a change to the - * base state machine. + * This is the final state that the device is placed in before a change + * to the base state machine. */ SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATE_FINAL, @@ -110,8 +111,8 @@ enum SCIC_SDS_SSP_REMOTE_DEVICE_READY_SUBSTATES { /** * enum SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATES - * - * This is the enumeration for the struct scic_sds_remote_device ready substates for - * the STP remote device. + * This is the enumeration for the struct scic_sds_remote_device ready substates + * for the STP remote device. */ enum SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATES { /** @@ -161,13 +162,11 @@ enum SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATES { SCIC_SDS_STP_REMOTE_DEVICE_READY_MAX_SUBSTATES }; - /** * enum SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATES - * * This is the enumeration of the ready substates for the SMP REMOTE DEVICE. */ - enum SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATES { /** * This is the ready operational substate for the remote device. This is the @@ -184,9 +183,6 @@ enum SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATES { SCIC_SDS_SMP_REMOTE_DEVICE_READY_MAX_SUBSTATES }; - - - /** * struct scic_sds_remote_device - This structure contains the data for an SCU * implementation of the SCU Core device data. @@ -223,21 +219,22 @@ struct scic_sds_remote_device { struct sci_sas_address device_address; /** - * This filed is assinged the value of true if the device is directly attached - * to the port. + * This filed is assinged the value of true if the device is directly + * attached to the port. */ bool is_direct_attached; #if !defined(DISABLE_ATAPI) /** - * This filed is assinged the value of true if the device is an ATAPI device. + * This filed is assinged the value of true if the device is an ATAPI + * device. */ bool is_atapi; #endif /** - * This filed contains a pointer back to the port to which this device is - * assigned. + * This filed contains a pointer back to the port to which this device + * is assigned. */ struct scic_sds_port *owning_port; @@ -284,29 +281,28 @@ struct scic_sds_remote_device { * This field maintains the set of state handlers for the remote device * object. These are changed each time the remote device enters a new state. */ - struct scic_sds_remote_device_state_handler *state_handlers; + const struct scic_sds_remote_device_state_handler *state_handlers; }; - -typedef enum sci_status (*SCIC_SDS_REMOTE_DEVICE_HANDLER_T)( +typedef enum sci_status (*scic_sds_remote_device_handler_t)( struct scic_sds_remote_device *this_device); -typedef enum sci_status (*SCIC_SDS_REMOTE_DEVICE_SUSPEND_HANDLER_T)( +typedef enum sci_status (*scic_sds_remote_device_suspend_handler_t)( struct scic_sds_remote_device *this_device, u32 suspend_type); -typedef enum sci_status (*SCIC_SDS_REMOTE_DEVICE_RESUME_HANDLER_T)( +typedef enum sci_status (*scic_sds_remote_device_resume_handler_t)( struct scic_sds_remote_device *this_device); -typedef enum sci_status (*SCIC_SDS_REMOTE_DEVICE_FRAME_HANDLER_T)( +typedef enum sci_status (*scic_sds_remote_device_frame_handler_t)( struct scic_sds_remote_device *this_device, u32 frame_index); -typedef enum sci_status (*SCIC_SDS_REMOTE_DEVICE_EVENT_HANDLER_T)( +typedef enum sci_status (*scic_sds_remote_device_event_handler_t)( struct scic_sds_remote_device *this_device, u32 event_code); -typedef void (*SCIC_SDS_REMOTE_DEVICE_READY_NOT_READY_HANDLER_T)( +typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)( struct scic_sds_remote_device *this_device); /** @@ -318,23 +314,18 @@ typedef void (*SCIC_SDS_REMOTE_DEVICE_READY_NOT_READY_HANDLER_T)( */ struct scic_sds_remote_device_state_handler { struct sci_base_remote_device_state_handler parent; - - SCIC_SDS_REMOTE_DEVICE_SUSPEND_HANDLER_T suspend_handler; - SCIC_SDS_REMOTE_DEVICE_RESUME_HANDLER_T resume_handler; - - SCIC_SDS_REMOTE_DEVICE_EVENT_HANDLER_T event_handler; - SCIC_SDS_REMOTE_DEVICE_FRAME_HANDLER_T frame_handler; - + scic_sds_remote_device_suspend_handler_t suspend_handler; + scic_sds_remote_device_resume_handler_t resume_handler; + scic_sds_remote_device_event_handler_t event_handler; + scic_sds_remote_device_frame_handler_t frame_handler; }; - extern const struct sci_base_state scic_sds_remote_device_state_table[]; extern const struct sci_base_state scic_sds_ssp_remote_device_ready_substate_table[]; extern const struct sci_base_state scic_sds_stp_remote_device_ready_substate_table[]; extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_table[]; -extern struct scic_sds_remote_device_state_handler - scic_sds_remote_device_state_handler_table[]; +extern const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[]; extern struct scic_sds_remote_device_state_handler scic_sds_ssp_remote_device_ready_substate_handler_table[]; extern struct scic_sds_remote_device_state_handler @@ -480,10 +471,6 @@ extern struct scic_sds_remote_device_state_handler #define scic_sds_remote_device_set_working_request(device, request) \ ((device)->working_request = (request)) -/* --------------------------------------------------------------------------- */ - - - enum sci_status scic_sds_remote_device_frame_handler( struct scic_sds_remote_device *this_device, u32 frame_index); @@ -525,10 +512,6 @@ bool scic_sds_remote_device_is_atapi( #define scic_sds_remote_device_is_atapi(this_device) false #endif /* !defined(DISABLE_ATAPI) */ -/* --------------------------------------------------------------------------- */ - -/* --------------------------------------------------------------------------- */ - void scic_sds_remote_device_start_request( struct scic_sds_remote_device *this_device, struct scic_sds_request *the_request, @@ -540,7 +523,6 @@ void scic_sds_remote_device_continue_request( enum sci_status scic_sds_remote_device_default_start_handler( struct sci_base_remote_device *this_device); - enum sci_status scic_sds_remote_device_default_fail_handler( struct sci_base_remote_device *this_device); @@ -577,8 +559,6 @@ enum sci_status scic_sds_remote_device_default_frame_handler( struct scic_sds_remote_device *this_device, u32 frame_index); -/* --------------------------------------------------------------------------- */ - enum sci_status scic_sds_remote_device_ready_state_stop_handler( struct sci_base_remote_device *device); @@ -596,7 +576,4 @@ enum sci_status scic_sds_remote_device_general_event_handler( enum sci_status scic_sds_ssp_remote_device_ready_suspended_substate_resume_handler( struct scic_sds_remote_device *this_device); -/* --------------------------------------------------------------------------- */ - - #endif /* _SCIC_SDS_REMOTE_DEVICE_H_ */ diff --git a/drivers/scsi/isci/core/scic_sds_remote_node_context.c b/drivers/scsi/isci/core/scic_sds_remote_node_context.c index 79fe9a8..7fec322 100644 --- a/drivers/scsi/isci/core/scic_sds_remote_node_context.c +++ b/drivers/scsi/isci/core/scic_sds_remote_node_context.c @@ -195,7 +195,7 @@ void scic_sds_remote_node_context_construct_buffer( */ static void scic_sds_remote_node_context_setup_to_resume( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { if (this_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) { @@ -216,7 +216,7 @@ static void scic_sds_remote_node_context_setup_to_resume( */ static void scic_sds_remote_node_context_setup_to_destory( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { this_rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL; @@ -234,7 +234,7 @@ static void scic_sds_remote_node_context_setup_to_destory( */ static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { if (this_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) { @@ -251,7 +251,7 @@ static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler( static enum sci_status scic_sds_remote_node_context_default_destruct_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { dev_warn(scirdev_to_dev(this_rnc->device), @@ -270,7 +270,7 @@ static enum sci_status scic_sds_remote_node_context_default_destruct_handler( static enum sci_status scic_sds_remote_node_context_default_suspend_handler( struct scic_sds_remote_node_context *this_rnc, u32 suspend_type, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { dev_warn(scirdev_to_dev(this_rnc->device), @@ -285,7 +285,7 @@ static enum sci_status scic_sds_remote_node_context_default_suspend_handler( static enum sci_status scic_sds_remote_node_context_default_resume_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { dev_warn(scirdev_to_dev(this_rnc->device), @@ -372,7 +372,7 @@ static enum sci_status scic_sds_remote_node_context_success_start_task_handler( */ static enum sci_status scic_sds_remote_node_context_general_destruct_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { scic_sds_remote_node_context_setup_to_destory( @@ -391,7 +391,7 @@ static enum sci_status scic_sds_remote_node_context_general_destruct_handler( static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { if (this_rnc->remote_node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { @@ -449,7 +449,7 @@ static enum sci_status scic_sds_remote_node_context_posting_state_event_handler( static enum sci_status scic_sds_remote_node_context_invalidating_state_destruct_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { scic_sds_remote_node_context_setup_to_destory( @@ -575,7 +575,7 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler( struct scic_sds_remote_node_context *this_rnc, u32 suspend_type, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { this_rnc->user_callback = the_callback; @@ -662,7 +662,7 @@ static enum sci_status scic_sds_remote_node_context_ready_state_event_handler( static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { enum sci_status status; @@ -737,7 +737,7 @@ static enum sci_status scic_sds_remote_node_context_suspended_start_task_handler static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { scic_sds_remote_node_context_setup_to_resume( @@ -761,7 +761,7 @@ static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume */ static enum sci_status scic_sds_remote_node_context_await_suspension_state_resume_handler( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter) { scic_sds_remote_node_context_setup_to_resume( diff --git a/drivers/scsi/isci/core/scic_sds_remote_node_context.h b/drivers/scsi/isci/core/scic_sds_remote_node_context.h index 9e759a3..86c6d75 100644 --- a/drivers/scsi/isci/core/scic_sds_remote_node_context.h +++ b/drivers/scsi/isci/core/scic_sds_remote_node_context.h @@ -67,8 +67,6 @@ #include "sci_base_state.h" #include "sci_base_state_machine.h" -/* --------------------------------------------------------------------------- */ - /** * * @@ -85,77 +83,71 @@ struct scic_sds_request; struct scic_sds_remote_device; struct scic_sds_remote_node_context; -typedef void (*SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK)(void *); +typedef void (*scics_sds_remote_node_context_callback)(void *); -typedef enum sci_status (*SCIC_SDS_REMOTE_NODE_CONTEXT_OPERATION)( +typedef enum sci_status (*scic_sds_remote_node_context_operation)( struct scic_sds_remote_node_context *this_rnc, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter ); -typedef enum sci_status (*SCIC_SDS_REMOTE_NODE_CONTEXT_SUSPEND_OPERATION)( +typedef enum sci_status (*scic_sds_remote_node_context_suspend_operation)( struct scic_sds_remote_node_context *this_rnc, u32 suspension_type, - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK the_callback, + scics_sds_remote_node_context_callback the_callback, void *callback_parameter ); -typedef enum sci_status (*SCIC_SDS_REMOTE_NODE_CONTEXT_IO_REQUEST)( +typedef enum sci_status (*scic_sds_remote_node_context_io_request)( struct scic_sds_remote_node_context *this_rnc, struct scic_sds_request *the_request ); -typedef enum sci_status (*SCIC_SDS_REMOTE_NODE_CONTEXT_EVENT_HANDLER)( +typedef enum sci_status (*scic_sds_remote_node_context_event_handler)( struct scic_sds_remote_node_context *this_rnc, u32 event_code ); -/* --------------------------------------------------------------------------- */ - struct scic_sds_remote_node_context_handlers { /** * This handle is invoked to stop the RNC. The callback is invoked when after * the hardware notification that the RNC has been invalidated. */ - SCIC_SDS_REMOTE_NODE_CONTEXT_OPERATION destruct_handler; + scic_sds_remote_node_context_operation destruct_handler; /** * This handler is invoked when there is a request to suspend the RNC. The * callback is invoked after the hardware notification that the remote node is * suspended. */ - SCIC_SDS_REMOTE_NODE_CONTEXT_SUSPEND_OPERATION suspend_handler; + scic_sds_remote_node_context_suspend_operation suspend_handler; /** * This handler is invoked when there is a request to resume the RNC. The * callback is invoked when after the RNC has reached the ready state. */ - SCIC_SDS_REMOTE_NODE_CONTEXT_OPERATION resume_handler; + scic_sds_remote_node_context_operation resume_handler; /** * This handler is invoked when there is a request to start an io request * operation. */ - SCIC_SDS_REMOTE_NODE_CONTEXT_IO_REQUEST start_io_handler; + scic_sds_remote_node_context_io_request start_io_handler; /** * This handler is invoked when there is a request to start a task request * operation. */ - SCIC_SDS_REMOTE_NODE_CONTEXT_IO_REQUEST start_task_handler; + scic_sds_remote_node_context_io_request start_task_handler; /** * This handler is invoked where there is an RNC event that must be processed. */ - SCIC_SDS_REMOTE_NODE_CONTEXT_EVENT_HANDLER event_handler; + scic_sds_remote_node_context_event_handler event_handler; }; -/* --------------------------------------------------------------------------- */ - /** - * - * * This is the enumeration of the remote node context states. */ enum scis_sds_remote_node_context_states { @@ -232,8 +224,6 @@ enum SCIC_SDS_REMOTE_NODE_CONTEXT_DESTINATION_STATE { * associated with the remote node context object. The remote node context * (RNC) object models the the remote device information necessary to manage * the silicon RNC. - * - * */ struct scic_sds_remote_node_context { /* @@ -273,7 +263,7 @@ struct scic_sds_remote_node_context { * This field contains the callback function that the user requested to be * called when the requested state transition is complete. */ - SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK user_callback; + scics_sds_remote_node_context_callback user_callback; /** * This field contains the parameter that is called when the user requested @@ -289,16 +279,12 @@ struct scic_sds_remote_node_context { struct scic_sds_remote_node_context_handlers *state_handlers; }; -/* --------------------------------------------------------------------------- */ - extern const struct sci_base_state scic_sds_remote_node_context_state_table[]; extern struct scic_sds_remote_node_context_handlers scic_sds_remote_node_context_state_handler_table[ SCIC_SDS_REMOTE_NODE_CONTEXT_MAX_STATES]; -/* --------------------------------------------------------------------------- */ - void scic_sds_remote_node_context_construct( struct scic_sds_remote_device *device, struct scic_sds_remote_node_context *rnc, @@ -307,7 +293,6 @@ void scic_sds_remote_node_context_construct( void scic_sds_remote_node_context_construct_buffer( struct scic_sds_remote_node_context *rnc); - bool scic_sds_remote_node_context_is_ready( struct scic_sds_remote_node_context *this_rnc); @@ -335,7 +320,4 @@ bool scic_sds_remote_node_context_is_ready( #define scic_sds_remote_node_context_start_task(rnc, task) \ ((rnc)->state_handlers->start_task_handler(rnc, task)) -/* --------------------------------------------------------------------------- */ - #endif /* _SCIC_SDS_REMOTE_NODE_CONTEXT_H_ */ - diff --git a/drivers/scsi/isci/core/scic_sds_stp_remote_device.c b/drivers/scsi/isci/core/scic_sds_stp_remote_device.c index abe8f33..1320c95 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_remote_device.c +++ b/drivers/scsi/isci/core/scic_sds_stp_remote_device.c @@ -192,7 +192,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_substate_start_request_h scic_sds_remote_node_context_resume( this_device->rnc, - (SCICS_SDS_REMOTE_NODE_CONTEXT_CALLBACK) + (scics_sds_remote_node_context_callback) scic_sds_remote_device_continue_request, this_device); } -- 2.7.4