isci: kill SCI_IO_REQUEST_DATA_DIRECTION
authorDan Williams <dan.j.williams@intel.com>
Wed, 9 Feb 2011 01:53:10 +0000 (17:53 -0800)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 07:36:31 +0000 (00:36 -0700)
It's an unnecessary typedef that mirrors the kernel's enum
dma_data_direction.

Also cleanup some long variable names along the way.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/core/sci_types.h
drivers/scsi/isci/core/scic_sds_request.c
drivers/scsi/isci/core/scic_sds_stp_request.c
drivers/scsi/isci/core/scic_sds_stp_request.h
drivers/scsi/isci/core/scic_user_callback.h
drivers/scsi/isci/deprecated.c
drivers/scsi/isci/request.c
drivers/scsi/isci/request.h

index e15dc0c89e5c2eed5b905fd1290759c562d5268c..fda3680546e3544e7e3032d7086a5009fcd58471 100644 (file)
 #define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \
        ((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32)
 
-typedef enum {
-       SCI_IO_REQUEST_DATA_IN = 0,     /* Read operation */
-       SCI_IO_REQUEST_DATA_OUT,        /* Write operation */
-       SCI_IO_REQUEST_NO_DATA
-} SCI_IO_REQUEST_DATA_DIRECTION;
-
-
 enum sci_controller_mode {
        SCI_MODE_SPEED,         /* Optimized for performance */
        SCI_MODE_SIZE           /* Optimized for memory use */
index c696d246ea5a388de5be194302439dc8ef9a7da7..7c5b61bdee67d720d30ec21c151d1bd1564294cb 100644 (file)
@@ -588,34 +588,34 @@ static void scu_ssp_reqeust_construct_task_context(
  *
  */
 static void scu_ssp_io_request_construct_task_context(
-       struct scic_sds_request *this_request,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction,
-       u32 transfer_length_bytes)
+       struct scic_sds_request *sci_req,
+       enum dma_data_direction dir,
+       u32 len)
 {
        struct scu_task_context *task_context;
 
-       task_context = scic_sds_request_get_task_context(this_request);
+       task_context = scic_sds_request_get_task_context(sci_req);
 
-       scu_ssp_reqeust_construct_task_context(this_request, task_context);
+       scu_ssp_reqeust_construct_task_context(sci_req, task_context);
 
        task_context->ssp_command_iu_length = sizeof(struct sci_ssp_command_iu) / sizeof(u32);
        task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME;
 
-       switch (data_direction) {
-       case SCI_IO_REQUEST_DATA_IN:
-       case SCI_IO_REQUEST_NO_DATA:
+       switch (dir) {
+       case DMA_FROM_DEVICE:
+       case DMA_NONE:
+       default:
                task_context->task_type = SCU_TASK_TYPE_IOREAD;
                break;
-       case SCI_IO_REQUEST_DATA_OUT:
+       case DMA_TO_DEVICE:
                task_context->task_type = SCU_TASK_TYPE_IOWRITE;
                break;
        }
 
-       task_context->transfer_length_bytes = transfer_length_bytes;
+       task_context->transfer_length_bytes = len;
 
-       if (task_context->transfer_length_bytes > 0) {
-               scic_sds_request_build_sgl(this_request);
-       }
+       if (task_context->transfer_length_bytes > 0)
+               scic_sds_request_build_sgl(sci_req);
 }
 
 
@@ -694,37 +694,35 @@ static void scu_ssp_task_request_construct_task_context(
  *
  * enum sci_status
  */
-static enum sci_status scic_io_request_construct_sata(
-       struct scic_sds_request *this_request,
-       u8 sat_protocol,
-       u32 transfer_length,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction,
-       bool copy_rx_frame)
+static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *sci_req,
+                                                     u8 proto, u32 len,
+                                                     enum dma_data_direction dir,
+                                                     bool copy)
 {
        enum sci_status status = SCI_SUCCESS;
 
-       switch (sat_protocol) {
+       switch (proto) {
        case SAT_PROTOCOL_PIO_DATA_IN:
        case SAT_PROTOCOL_PIO_DATA_OUT:
-               status = scic_sds_stp_pio_request_construct(this_request, sat_protocol, copy_rx_frame);
+               status = scic_sds_stp_pio_request_construct(sci_req, proto, copy);
                break;
 
        case SAT_PROTOCOL_UDMA_DATA_IN:
        case SAT_PROTOCOL_UDMA_DATA_OUT:
-               status = scic_sds_stp_udma_request_construct(this_request, transfer_length, data_direction);
+               status = scic_sds_stp_udma_request_construct(sci_req, len, dir);
                break;
 
        case SAT_PROTOCOL_ATA_HARD_RESET:
        case SAT_PROTOCOL_SOFT_RESET:
-               status = scic_sds_stp_soft_reset_request_construct(this_request);
+               status = scic_sds_stp_soft_reset_request_construct(sci_req);
                break;
 
        case SAT_PROTOCOL_NON_DATA:
-               status = scic_sds_stp_non_data_request_construct(this_request);
+               status = scic_sds_stp_non_data_request_construct(sci_req);
                break;
 
        case SAT_PROTOCOL_FPDMA:
-               status = scic_sds_stp_ncq_request_construct(this_request, transfer_length, data_direction);
+               status = scic_sds_stp_ncq_request_construct(sci_req, len, dir);
                break;
 
 #if !defined(DISABLE_ATAPI)
@@ -733,7 +731,7 @@ static enum sci_status scic_io_request_construct_sata(
        case SAT_PROTOCOL_PACKET_DMA_DATA_OUT:
        case SAT_PROTOCOL_PACKET_PIO_DATA_IN:
        case SAT_PROTOCOL_PACKET_PIO_DATA_OUT:
-               status = scic_sds_stp_packet_request_construct(this_request);
+               status = scic_sds_stp_packet_request_construct(sci_req);
                break;
 #endif
 
@@ -743,10 +741,10 @@ static enum sci_status scic_io_request_construct_sata(
        case SAT_PROTOCOL_DEVICE_RESET:
        case SAT_PROTOCOL_RETURN_RESPONSE_INFO:
        default:
-               dev_err(scic_to_dev(this_request->owning_controller),
+               dev_err(scic_to_dev(sci_req->owning_controller),
                        "%s: SCIC IO Request 0x%p received un-handled "
                        "SAT Protocl %d.\n",
-                       __func__, this_request, sat_protocol);
+                       __func__, sci_req, proto);
 
                status = SCI_FAILURE;
                break;
@@ -945,35 +943,25 @@ enum sci_status scic_task_request_construct_ssp(
 }
 
 
-enum sci_status scic_io_request_construct_basic_sata(
-       struct scic_sds_request *sci_req)
+enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sci_req)
 {
        enum sci_status status;
-       struct scic_sds_stp_request *this_stp_request;
-       u8 sat_protocol;
-       u32 transfer_length;
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction;
-       bool copy_rx_frame = false;
+       struct scic_sds_stp_request *stp_req;
+       u8 proto;
+       u32 len;
+       enum dma_data_direction dir;
+       bool copy = false;
 
-       this_stp_request = (struct scic_sds_stp_request *)sci_req;
+       stp_req = container_of(sci_req, typeof(*stp_req), parent);
 
        sci_req->protocol = SCIC_STP_PROTOCOL;
 
-       transfer_length =
-               scic_cb_io_request_get_transfer_length(sci_req->user_request);
-       data_direction =
-               scic_cb_io_request_get_data_direction(sci_req->user_request);
+       len = scic_cb_io_request_get_transfer_length(sci_req->user_request);
+       dir = scic_cb_io_request_get_data_direction(sci_req->user_request);
+       proto = scic_cb_request_get_sat_protocol(sci_req->user_request);
+       copy = scic_cb_io_request_do_copy_rx_frames(stp_req->parent.user_request);
 
-       sat_protocol = scic_cb_request_get_sat_protocol(sci_req->user_request);
-       copy_rx_frame = scic_cb_io_request_do_copy_rx_frames(this_stp_request->parent.user_request);
-
-       status = scic_io_request_construct_sata(
-               sci_req,
-               sat_protocol,
-               transfer_length,
-               data_direction,
-               copy_rx_frame
-               );
+       status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy);
 
        if (status == SCI_SUCCESS)
                sci_base_state_machine_change_state(
index c14f6f10edb186df3ee244cd4c5976db482d3fc5..49c494c097cb75505aff8577a204dce679da6fed 100644 (file)
@@ -288,7 +288,7 @@ void scic_sds_stp_non_ncq_request_construct(
 
 /**
  *
- * @this_request: This parameter specifies the request to be constructed as an
+ * @sci_req: This parameter specifies the request to be constructed as an
  *    optimized request.
  * @optimized_task_type: This parameter specifies whether the request is to be
  *    an UDMA request or a NCQ request. - A value of 0 indicates UDMA. - A
@@ -298,24 +298,23 @@ void scic_sds_stp_non_ncq_request_construct(
  * requests that are optimized by the silicon (i.e. UDMA, NCQ). This method
  * returns an indication as to whether the construction was successful.
  */
-static void scic_sds_stp_optimized_request_construct(
-       struct scic_sds_request *this_request,
-       u8 optimized_task_type,
-       u32 transfer_length,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction)
+static void scic_sds_stp_optimized_request_construct(struct scic_sds_request *sci_req,
+                                                    u8 optimized_task_type,
+                                                    u32 len,
+                                                    enum dma_data_direction dir)
 {
-       struct scu_task_context *task_context = this_request->task_context_buffer;
+       struct scu_task_context *task_context = sci_req->task_context_buffer;
 
        /* Build the STP task context structure */
-       scu_sata_reqeust_construct_task_context(this_request, task_context);
+       scu_sata_reqeust_construct_task_context(sci_req, task_context);
 
        /* Copy over the SGL elements */
-       scic_sds_request_build_sgl(this_request);
+       scic_sds_request_build_sgl(sci_req);
 
        /* Copy over the number of bytes to be transfered */
-       task_context->transfer_length_bytes = transfer_length;
+       task_context->transfer_length_bytes = len;
 
-       if (data_direction == SCI_IO_REQUEST_DATA_OUT) {
+       if (dir == DMA_TO_DEVICE) {
                /*
                 * The difference between the DMA IN and DMA OUT request task type
                 * values are consistent with the difference between FPDMA READ
@@ -334,29 +333,24 @@ static void scic_sds_stp_optimized_request_construct(
 
 /**
  *
- * @this_request: This parameter specifies the request to be constructed.
+ * @sci_req: This parameter specifies the request to be constructed.
  *
  * This method will construct the STP UDMA request and its associated TC data.
  * This method returns an indication as to whether the construction was
  * successful. SCI_SUCCESS Currently this method always returns this value.
  */
-enum sci_status scic_sds_stp_udma_request_construct(
-       struct scic_sds_request *this_request,
-       u32 transfer_length,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction)
+enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci_req,
+                                                   u32 len,
+                                                   enum dma_data_direction dir)
 {
-       scic_sds_stp_non_ncq_request_construct(this_request);
+       scic_sds_stp_non_ncq_request_construct(sci_req);
 
-       scic_sds_stp_optimized_request_construct(
-               this_request,
-               SCU_TASK_TYPE_DMA_IN,
-               transfer_length,
-               data_direction
-               );
+       scic_sds_stp_optimized_request_construct(sci_req, SCU_TASK_TYPE_DMA_IN,
+                                                len, dir);
 
        sci_base_state_machine_construct(
-               &this_request->started_substate_machine,
-               &this_request->parent.parent,
+               &sci_req->started_substate_machine,
+               &sci_req->parent.parent,
                scic_sds_stp_request_started_udma_substate_table,
                SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
                );
@@ -366,23 +360,19 @@ enum sci_status scic_sds_stp_udma_request_construct(
 
 /**
  *
- * @this_request: This parameter specifies the request to be constructed.
+ * @sci_req: This parameter specifies the request to be constructed.
  *
  * This method will construct the STP UDMA request and its associated TC data.
  * This method returns an indication as to whether the construction was
  * successful. SCI_SUCCESS Currently this method always returns this value.
  */
-enum sci_status scic_sds_stp_ncq_request_construct(
-       struct scic_sds_request *this_request,
-       u32 transfer_length,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction)
+enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_req,
+                                                  u32 len,
+                                                  enum dma_data_direction dir)
 {
-       scic_sds_stp_optimized_request_construct(
-               this_request,
-               SCU_TASK_TYPE_FPDMAQ_READ,
-               transfer_length,
-               data_direction
-               );
+       scic_sds_stp_optimized_request_construct(sci_req,
+                                                SCU_TASK_TYPE_FPDMAQ_READ,
+                                                len, dir);
        return SCI_SUCCESS;
 }
 
index 5578d2baf7ca4ffcda7d254e4ab30232a9801165..0a12ff6417cc242780c49c0b6368f75592bcad67 100644 (file)
@@ -56,6 +56,7 @@
 #ifndef _SCIC_SDS_STP_REQUEST_T_
 #define _SCIC_SDS_STP_REQUEST_T_
 
+#include <linux/dma-mapping.h>
 #include "intel_sata.h"
 #include "sci_types.h"
 #include "scic_sds_request.h"
@@ -201,7 +202,7 @@ enum sci_status scic_sds_stp_pio_request_construct_pass_through(
 enum sci_status scic_sds_stp_udma_request_construct(
        struct scic_sds_request *this_request,
        u32 transfer_length,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction);
+       enum dma_data_direction dir);
 
 enum sci_status scic_sds_stp_non_data_request_construct(
        struct scic_sds_request *this_request);
@@ -212,7 +213,7 @@ enum sci_status scic_sds_stp_soft_reset_request_construct(
 enum sci_status scic_sds_stp_ncq_request_construct(
        struct scic_sds_request *this_request,
        u32 transfer_length,
-       SCI_IO_REQUEST_DATA_DIRECTION data_direction);
+       enum dma_data_direction dir);
 
 void scu_stp_raw_request_construct_task_context(
        struct scic_sds_stp_request *this_request,
index 4aa020e2f079d60f4bd278f8de907e1a2aa428c4..4df7106f61aa1e75524085ec760dadb49480510d 100644 (file)
@@ -246,11 +246,8 @@ u32 scic_cb_io_request_get_transfer_length(
  *    object.  It is a cookie that allows the user to provide the necessary
  *    information for this callback.
  *
- * This method returns the value of SCI_IO_REQUEST_DATA_OUT or
- * SCI_IO_REQUEST_DATA_IN, or SCI_IO_REQUEST_NO_DATA.
  */
-SCI_IO_REQUEST_DATA_DIRECTION scic_cb_io_request_get_data_direction(
-       void *scic_user_io_request);
+enum dma_data_direction scic_cb_io_request_get_data_direction(void *req);
 
 #ifndef SCI_SGL_OPTIMIZATION_ENABLED
 /**
index 847e6874e1a83193fd595065f290012b9f4a0542..0ee6679b810703bd34bce169b350a9902f474e06 100644 (file)
@@ -139,16 +139,10 @@ u32 scic_cb_io_request_get_transfer_length(
  * @scic_user_io_request: This parameter points to the user's IO request
  *    object.  It is a cookie that allows the user to provide the necessary
  *    information for this callback.
- *
- * This method returns the value of SCI_IO_REQUEST_DATA_OUT or
- * SCI_IO_REQUEST_DATA_IN, or SCI_IO_REQUEST_NO_DATA.
  */
-SCI_IO_REQUEST_DATA_DIRECTION scic_cb_io_request_get_data_direction(
-       void *scic_user_io_request)
+enum dma_data_direction scic_cb_io_request_get_data_direction(void *req)
 {
-       return isci_request_io_request_get_data_direction(
-                      scic_user_io_request
-                      );
+       return isci_request_io_request_get_data_direction(req);
 }
 
 
index e564121b6726985ec28b18dff026f3c3a57e1ef5..f7ba047d64ced0aca82166972c1b41c4dac17034 100644 (file)
@@ -1237,44 +1237,12 @@ u32 isci_request_io_request_get_transfer_length(struct isci_request *request)
  *
  * data direction for specified request.
  */
-SCI_IO_REQUEST_DATA_DIRECTION isci_request_io_request_get_data_direction(
+enum dma_data_direction isci_request_io_request_get_data_direction(
        struct isci_request *request)
 {
        struct sas_task *task = isci_request_access_task(request);
-       SCI_IO_REQUEST_DATA_DIRECTION ret;
 
-       switch (task->data_dir) {
-
-       case DMA_FROM_DEVICE:
-               ret = SCI_IO_REQUEST_DATA_IN;
-               dev_dbg(&request->isci_host->pdev->dev,
-                       "%s: request=%p, FROM_DEVICE\n",
-                       __func__,
-                       request);
-               break;
-
-       case DMA_TO_DEVICE:
-               ret = SCI_IO_REQUEST_DATA_OUT;
-               dev_dbg(&request->isci_host->pdev->dev,
-                       "%s: request=%p, TO_DEVICE\n",
-                       __func__,
-                       request);
-               break;
-
-       case DMA_BIDIRECTIONAL:
-       case DMA_NONE:
-       default:
-               ret = SCI_IO_REQUEST_NO_DATA;
-               dev_dbg(&request->isci_host->pdev->dev,
-                       "%s: request=%p, unhandled direction case, "
-                       "data_dir=%d\n",
-                       __func__,
-                       request,
-                       task->data_dir);
-               break;
-
-       }
-       return ret;
+       return task->data_dir;
 }
 
 /**
index 5079d4a7c41bb2009bedd9fb1d500ea0b6dc94de..166295ee8cfdc691e41262c23863985ced97705c 100644 (file)
@@ -346,8 +346,7 @@ void isci_request_io_request_complete(
 u32 isci_request_io_request_get_transfer_length(
        struct isci_request *request);
 
-SCI_IO_REQUEST_DATA_DIRECTION isci_request_io_request_get_data_direction(
-       struct isci_request *request);
+enum dma_data_direction isci_request_io_request_get_data_direction(struct isci_request *req);
 
 /**
  * isci_request_io_request_get_next_sge() - This function is called by the sci