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 /include/scsi/libsas.h | |
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 'include/scsi/libsas.h')
-rw-r--r-- | include/scsi/libsas.h | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index ee866060f8a4..2517254b8403 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
@@ -555,36 +555,14 @@ struct sas_task { | |||
555 | struct work_struct abort_work; | 555 | struct work_struct abort_work; |
556 | }; | 556 | }; |
557 | 557 | ||
558 | extern struct kmem_cache *sas_task_cache; | ||
559 | |||
560 | #define SAS_TASK_STATE_PENDING 1 | 558 | #define SAS_TASK_STATE_PENDING 1 |
561 | #define SAS_TASK_STATE_DONE 2 | 559 | #define SAS_TASK_STATE_DONE 2 |
562 | #define SAS_TASK_STATE_ABORTED 4 | 560 | #define SAS_TASK_STATE_ABORTED 4 |
563 | #define SAS_TASK_NEED_DEV_RESET 8 | 561 | #define SAS_TASK_NEED_DEV_RESET 8 |
564 | #define SAS_TASK_AT_INITIATOR 16 | 562 | #define SAS_TASK_AT_INITIATOR 16 |
565 | 563 | ||
566 | static inline struct sas_task *sas_alloc_task(gfp_t flags) | 564 | extern struct sas_task *sas_alloc_task(gfp_t flags); |
567 | { | 565 | extern void sas_free_task(struct sas_task *task); |
568 | struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags); | ||
569 | |||
570 | if (task) { | ||
571 | INIT_LIST_HEAD(&task->list); | ||
572 | spin_lock_init(&task->task_state_lock); | ||
573 | task->task_state_flags = SAS_TASK_STATE_PENDING; | ||
574 | init_timer(&task->timer); | ||
575 | init_completion(&task->completion); | ||
576 | } | ||
577 | |||
578 | return task; | ||
579 | } | ||
580 | |||
581 | static inline void sas_free_task(struct sas_task *task) | ||
582 | { | ||
583 | if (task) { | ||
584 | BUG_ON(!list_empty(&task->list)); | ||
585 | kmem_cache_free(sas_task_cache, task); | ||
586 | } | ||
587 | } | ||
588 | 566 | ||
589 | struct sas_domain_function_template { | 567 | struct sas_domain_function_template { |
590 | /* The class calls these to notify the LLDD of an event. */ | 568 | /* The class calls these to notify the LLDD of an event. */ |