diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-07-29 20:26:39 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 10:35:13 -0400 |
commit | 4fcf812ca392303aa79dd50e96e83a29faa13bd0 (patch) | |
tree | 411c33d701989b44ba2f4ecb64fd0cba92214958 /drivers/scsi/isci | |
parent | 7ca3c803e85080afdff4097e60fefec865027809 (diff) |
[SCSI] libsas: export sas_alloc_task()
Now that isci has added a 3rd open coded user of this functionality just
share the libsas version.
Acked-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r-- | drivers/scsi/isci/task.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index d6bcdd013dc9..e2d9418683ce 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -1345,29 +1345,6 @@ static void isci_smp_task_done(struct sas_task *task) | |||
1345 | complete(&task->completion); | 1345 | complete(&task->completion); |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | static struct sas_task *isci_alloc_task(void) | ||
1349 | { | ||
1350 | struct sas_task *task = kzalloc(sizeof(*task), GFP_KERNEL); | ||
1351 | |||
1352 | if (task) { | ||
1353 | INIT_LIST_HEAD(&task->list); | ||
1354 | spin_lock_init(&task->task_state_lock); | ||
1355 | task->task_state_flags = SAS_TASK_STATE_PENDING; | ||
1356 | init_timer(&task->timer); | ||
1357 | init_completion(&task->completion); | ||
1358 | } | ||
1359 | |||
1360 | return task; | ||
1361 | } | ||
1362 | |||
1363 | static void isci_free_task(struct isci_host *ihost, struct sas_task *task) | ||
1364 | { | ||
1365 | if (task) { | ||
1366 | BUG_ON(!list_empty(&task->list)); | ||
1367 | kfree(task); | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1371 | static int isci_smp_execute_task(struct isci_host *ihost, | 1348 | static int isci_smp_execute_task(struct isci_host *ihost, |
1372 | struct domain_device *dev, void *req, | 1349 | struct domain_device *dev, void *req, |
1373 | int req_size, void *resp, int resp_size) | 1350 | int req_size, void *resp, int resp_size) |
@@ -1376,7 +1353,7 @@ static int isci_smp_execute_task(struct isci_host *ihost, | |||
1376 | struct sas_task *task = NULL; | 1353 | struct sas_task *task = NULL; |
1377 | 1354 | ||
1378 | for (retry = 0; retry < 3; retry++) { | 1355 | for (retry = 0; retry < 3; retry++) { |
1379 | task = isci_alloc_task(); | 1356 | task = sas_alloc_task(GFP_KERNEL); |
1380 | if (!task) | 1357 | if (!task) |
1381 | return -ENOMEM; | 1358 | return -ENOMEM; |
1382 | 1359 | ||
@@ -1439,13 +1416,13 @@ static int isci_smp_execute_task(struct isci_host *ihost, | |||
1439 | SAS_ADDR(dev->sas_addr), | 1416 | SAS_ADDR(dev->sas_addr), |
1440 | task->task_status.resp, | 1417 | task->task_status.resp, |
1441 | task->task_status.stat); | 1418 | task->task_status.stat); |
1442 | isci_free_task(ihost, task); | 1419 | sas_free_task(task); |
1443 | task = NULL; | 1420 | task = NULL; |
1444 | } | 1421 | } |
1445 | } | 1422 | } |
1446 | ex_err: | 1423 | ex_err: |
1447 | BUG_ON(retry == 3 && task != NULL); | 1424 | BUG_ON(retry == 3 && task != NULL); |
1448 | isci_free_task(ihost, task); | 1425 | sas_free_task(task); |
1449 | return res; | 1426 | return res; |
1450 | } | 1427 | } |
1451 | 1428 | ||