aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/task.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-05-08 14:47:15 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:47 -0400
commit67ea838d17acdad3331aeae848683c768df96aaa (patch)
tree30a80c95a1add14babf985a108973cc9c3caac83 /drivers/scsi/isci/task.c
parentb7645818cff1536038c0b21407eefb6b9d5755e6 (diff)
isci: unify request data structures
Make scic_sds_request a proper member of isci_request. Also let's us get rid of the dma pool object size tracking since we now know that all requests are sizeof(isci_request). While cleaning up the construct routine incidentally replaced SCI_FIELD_OFFSET with offsetof. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/task.c')
-rw-r--r--drivers/scsi/isci/task.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index 492faeea8b3a..7adaf71c19d1 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -300,8 +300,7 @@ static enum sci_status isci_task_request_build(
300 /* let the core do it's construct. */ 300 /* let the core do it's construct. */
301 status = scic_task_request_construct(&isci_host->sci, sci_device, 301 status = scic_task_request_construct(&isci_host->sci, sci_device,
302 SCI_CONTROLLER_INVALID_IO_TAG, 302 SCI_CONTROLLER_INVALID_IO_TAG,
303 request, &request->sci_req, 303 &request->sci);
304 &request->sci_request_handle);
305 304
306 if (status != SCI_SUCCESS) { 305 if (status != SCI_SUCCESS) {
307 dev_warn(&isci_host->pdev->dev, 306 dev_warn(&isci_host->pdev->dev,
@@ -312,14 +311,10 @@ static enum sci_status isci_task_request_build(
312 goto errout; 311 goto errout;
313 } 312 }
314 313
315 request->sci_request_handle->ireq = request;
316
317 /* XXX convert to get this from task->tproto like other drivers */ 314 /* XXX convert to get this from task->tproto like other drivers */
318 if (dev->dev_type == SAS_END_DEV) { 315 if (dev->dev_type == SAS_END_DEV) {
319 isci_tmf->proto = SAS_PROTOCOL_SSP; 316 isci_tmf->proto = SAS_PROTOCOL_SSP;
320 status = scic_task_request_construct_ssp( 317 status = scic_task_request_construct_ssp(&request->sci);
321 request->sci_request_handle
322 );
323 if (status != SCI_SUCCESS) 318 if (status != SCI_SUCCESS)
324 goto errout; 319 goto errout;
325 } 320 }
@@ -376,8 +371,7 @@ static void isci_tmf_timeout_cb(void *tmf_request_arg)
376 status = scic_controller_terminate_request( 371 status = scic_controller_terminate_request(
377 &request->isci_host->sci, 372 &request->isci_host->sci,
378 &request->isci_device->sci, 373 &request->isci_device->sci,
379 request->sci_request_handle 374 &request->sci);
380 );
381 375
382 dev_dbg(&request->isci_host->pdev->dev, 376 dev_dbg(&request->isci_host->pdev->dev,
383 "%s: tmf_request = %p; tmf = %p; status = %d\n", 377 "%s: tmf_request = %p; tmf = %p; status = %d\n",
@@ -467,9 +461,8 @@ int isci_task_execute_tmf(
467 status = scic_controller_start_task( 461 status = scic_controller_start_task(
468 &isci_host->sci, 462 &isci_host->sci,
469 sci_device, 463 sci_device,
470 request->sci_request_handle, 464 &request->sci,
471 SCI_CONTROLLER_INVALID_IO_TAG 465 SCI_CONTROLLER_INVALID_IO_TAG);
472 );
473 466
474 if (status != SCI_TASK_SUCCESS) { 467 if (status != SCI_TASK_SUCCESS) {
475 dev_warn(&isci_host->pdev->dev, 468 dev_warn(&isci_host->pdev->dev,
@@ -764,13 +757,13 @@ static void isci_terminate_request_core(
764 * device condition (if the request handle is NULL, then the 757 * device condition (if the request handle is NULL, then the
765 * request completed but needed additional handling here). 758 * request completed but needed additional handling here).
766 */ 759 */
767 if (isci_request->sci_request_handle != NULL) { 760 if (!isci_request->terminated) {
768 was_terminated = true; 761 was_terminated = true;
769 needs_cleanup_handling = true; 762 needs_cleanup_handling = true;
770 status = scic_controller_terminate_request( 763 status = scic_controller_terminate_request(
771 &isci_host->sci, 764 &isci_host->sci,
772 &isci_device->sci, 765 &isci_device->sci,
773 isci_request->sci_request_handle); 766 &isci_request->sci);
774 } 767 }
775 spin_unlock_irqrestore(&isci_host->scic_lock, flags); 768 spin_unlock_irqrestore(&isci_host->scic_lock, flags);
776 769
@@ -1430,7 +1423,7 @@ isci_task_request_complete(struct isci_host *ihost,
1430 enum isci_request_status old_state; 1423 enum isci_request_status old_state;
1431 struct isci_tmf *tmf = isci_request_access_tmf(ireq); 1424 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
1432 struct completion *tmf_complete; 1425 struct completion *tmf_complete;
1433 struct scic_sds_request *sci_req = ireq->sci_request_handle; 1426 struct scic_sds_request *sci_req = &ireq->sci;
1434 1427
1435 dev_dbg(&ihost->pdev->dev, 1428 dev_dbg(&ihost->pdev->dev,
1436 "%s: request = %p, status=%d\n", 1429 "%s: request = %p, status=%d\n",
@@ -1460,12 +1453,11 @@ isci_task_request_complete(struct isci_host *ihost,
1460 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ 1453 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */
1461 tmf_complete = tmf->complete; 1454 tmf_complete = tmf->complete;
1462 1455
1463 scic_controller_complete_io(&ihost->sci, &idev->sci, 1456 scic_controller_complete_io(&ihost->sci, &idev->sci, &ireq->sci);
1464 ireq->sci_request_handle); 1457 /* set the 'terminated' flag handle to make sure it cannot be terminated
1465 /* NULL the request handle to make sure it cannot be terminated
1466 * or completed again. 1458 * or completed again.
1467 */ 1459 */
1468 ireq->sci_request_handle = NULL; 1460 ireq->terminated = true;;
1469 1461
1470 isci_request_change_state(ireq, unallocated); 1462 isci_request_change_state(ireq, unallocated);
1471 list_del_init(&ireq->dev_node); 1463 list_del_init(&ireq->dev_node);