diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-09 02:38:23 -0500 |
commit | da733563be5a9da26fe81d9f007262d00b846e22 (patch) | |
tree | db28291df94a2043af2123911984c5c173da4e6f /drivers/scsi/libsas/sas_init.c | |
parent | 6ccbcf2cb41131f8d56ef0723bf3f7c1f8486076 (diff) | |
parent | dab78d7924598ea4031663dd10db814e2e324928 (diff) |
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/scsi/libsas/sas_init.c')
-rw-r--r-- | drivers/scsi/libsas/sas_init.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 2dc55343f671..d81c3b1989f7 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
@@ -37,7 +37,32 @@ | |||
37 | 37 | ||
38 | #include "../scsi_sas_internal.h" | 38 | #include "../scsi_sas_internal.h" |
39 | 39 | ||
40 | struct kmem_cache *sas_task_cache; | 40 | static struct kmem_cache *sas_task_cache; |
41 | |||
42 | struct sas_task *sas_alloc_task(gfp_t flags) | ||
43 | { | ||
44 | struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags); | ||
45 | |||
46 | if (task) { | ||
47 | INIT_LIST_HEAD(&task->list); | ||
48 | spin_lock_init(&task->task_state_lock); | ||
49 | task->task_state_flags = SAS_TASK_STATE_PENDING; | ||
50 | init_timer(&task->timer); | ||
51 | init_completion(&task->completion); | ||
52 | } | ||
53 | |||
54 | return task; | ||
55 | } | ||
56 | EXPORT_SYMBOL_GPL(sas_alloc_task); | ||
57 | |||
58 | void sas_free_task(struct sas_task *task) | ||
59 | { | ||
60 | if (task) { | ||
61 | BUG_ON(!list_empty(&task->list)); | ||
62 | kmem_cache_free(sas_task_cache, task); | ||
63 | } | ||
64 | } | ||
65 | EXPORT_SYMBOL_GPL(sas_free_task); | ||
41 | 66 | ||
42 | /*------------ SAS addr hash -----------*/ | 67 | /*------------ SAS addr hash -----------*/ |
43 | void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | 68 | void sas_hash_addr(u8 *hashed, const u8 *sas_addr) |
@@ -152,10 +177,15 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha) | |||
152 | 177 | ||
153 | static int sas_get_linkerrors(struct sas_phy *phy) | 178 | static int sas_get_linkerrors(struct sas_phy *phy) |
154 | { | 179 | { |
155 | if (scsi_is_sas_phy_local(phy)) | 180 | if (scsi_is_sas_phy_local(phy)) { |
156 | /* FIXME: we have no local phy stats | 181 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); |
157 | * gathering at this time */ | 182 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
158 | return -EINVAL; | 183 | struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number]; |
184 | struct sas_internal *i = | ||
185 | to_sas_internal(sas_ha->core.shost->transportt); | ||
186 | |||
187 | return i->dft->lldd_control_phy(asd_phy, PHY_FUNC_GET_EVENTS, NULL); | ||
188 | } | ||
159 | 189 | ||
160 | return sas_smp_get_phy_events(phy); | 190 | return sas_smp_get_phy_events(phy); |
161 | } | 191 | } |
@@ -293,8 +323,7 @@ EXPORT_SYMBOL_GPL(sas_domain_release_transport); | |||
293 | 323 | ||
294 | static int __init sas_class_init(void) | 324 | static int __init sas_class_init(void) |
295 | { | 325 | { |
296 | sas_task_cache = kmem_cache_create("sas_task", sizeof(struct sas_task), | 326 | sas_task_cache = KMEM_CACHE(sas_task, SLAB_HWCACHE_ALIGN); |
297 | 0, SLAB_HWCACHE_ALIGN, NULL); | ||
298 | if (!sas_task_cache) | 327 | if (!sas_task_cache) |
299 | return -ENOMEM; | 328 | return -ENOMEM; |
300 | 329 | ||