From: Dan Williams Date: Sun, 1 May 2011 23:15:47 +0000 (-0700) Subject: isci: unify remote_device suspend_handlers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=323f0ec0fc72670f71210ba89611f6a1ec234394;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git isci: unify remote_device suspend_handlers Implement all states in scic_sds_remote_device_suspend() and delete the state handler. Reported-by: Christoph Hellwig Signed-off-by: Dan Williams --- diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 3344f38355cd..97ea8748335d 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c @@ -261,17 +261,20 @@ enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device return SCI_SUCCESS; } -/** - * - * @sci_dev: The remote device for which the suspend is being requested. - * - * This method invokes the remote device suspend state handler. enum sci_status - */ -enum sci_status scic_sds_remote_device_suspend( - struct scic_sds_remote_device *sci_dev, - u32 suspend_type) +enum sci_status scic_sds_remote_device_suspend(struct scic_sds_remote_device *sci_dev, + u32 suspend_type) { - return sci_dev->state_handlers->suspend_handler(sci_dev, suspend_type); + struct sci_base_state_machine *sm = &sci_dev->state_machine; + enum scic_sds_remote_device_states state = sm->current_state_id; + + if (state != SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD) { + dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", + __func__, state); + return SCI_FAILURE_INVALID_STATE; + } + + return scic_sds_remote_node_context_suspend(&sci_dev->rnc, + suspend_type, NULL, NULL); } /** @@ -674,12 +677,6 @@ default_device_handler(struct scic_sds_remote_device *sci_dev, return SCI_FAILURE_INVALID_STATE; } -static enum sci_status scic_sds_remote_device_default_suspend_handler( - struct scic_sds_remote_device *sci_dev, u32 suspend_type) -{ - return default_device_handler(sci_dev, __func__); -} - static enum sci_status scic_sds_remote_device_default_resume_handler( struct scic_sds_remote_device *sci_dev) { @@ -919,18 +916,6 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl return status; } -static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler( - struct scic_sds_remote_device *sci_dev, - u32 suspend_type) -{ - enum sci_status status; - - status = scic_sds_remote_node_context_suspend(&sci_dev->rnc, - suspend_type, NULL, NULL); - - return status; -} - static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handler( struct scic_sds_remote_device *sci_dev, u32 frame_index) @@ -976,91 +961,76 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl static const struct scic_sds_remote_device_state_handler scic_sds_remote_device_state_handler_table[] = { [SCI_BASE_REMOTE_DEVICE_STATE_INITIAL] = { - .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] = { - .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] = { - .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] = { - .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, }, [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { - .suspend_handler = scic_sds_remote_device_default_suspend_handler, .resume_handler = scic_sds_remote_device_default_resume_handler, .event_handler = scic_sds_stp_remote_device_ready_idle_substate_event_handler, .frame_handler = scic_sds_remote_device_default_frame_handler }, [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { - .suspend_handler = scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler, .resume_handler = scic_sds_remote_device_default_resume_handler, .event_handler = scic_sds_remote_device_general_event_handler, .frame_handler = scic_sds_stp_remote_device_ready_cmd_substate_frame_handler }, [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ] = { - .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_stp_remote_device_ready_ncq_substate_frame_handler }, [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = { - .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 }, [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { - .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 }, [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { - .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 }, [SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_CMD] = { - .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_smp_remote_device_ready_cmd_substate_frame_handler }, [SCI_BASE_REMOTE_DEVICE_STATE_STOPPING] = { - .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] = { - .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] = { - .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] = { - .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/remote_device.h b/drivers/scsi/isci/remote_device.h index dbfb13e2851d..f0cabd013bd8 100644 --- a/drivers/scsi/isci/remote_device.h +++ b/drivers/scsi/isci/remote_device.h @@ -386,7 +386,6 @@ typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)( * */ struct scic_sds_remote_device_state_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;