aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsas/sas_init.c')
-rw-r--r--drivers/scsi/libsas/sas_init.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index 64fa6f53cb8b..e04f6d6f5aff 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -39,6 +39,7 @@
39#include "../scsi_sas_internal.h" 39#include "../scsi_sas_internal.h"
40 40
41static struct kmem_cache *sas_task_cache; 41static struct kmem_cache *sas_task_cache;
42static struct kmem_cache *sas_event_cache;
42 43
43struct sas_task *sas_alloc_task(gfp_t flags) 44struct sas_task *sas_alloc_task(gfp_t flags)
44{ 45{
@@ -364,8 +365,6 @@ void sas_prep_resume_ha(struct sas_ha_struct *ha)
364 struct asd_sas_phy *phy = ha->sas_phy[i]; 365 struct asd_sas_phy *phy = ha->sas_phy[i];
365 366
366 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); 367 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
367 phy->port_events_pending = 0;
368 phy->phy_events_pending = 0;
369 phy->frame_rcvd_size = 0; 368 phy->frame_rcvd_size = 0;
370 } 369 }
371} 370}
@@ -555,20 +554,42 @@ sas_domain_attach_transport(struct sas_domain_function_template *dft)
555} 554}
556EXPORT_SYMBOL_GPL(sas_domain_attach_transport); 555EXPORT_SYMBOL_GPL(sas_domain_attach_transport);
557 556
557
558struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy)
559{
560 gfp_t flags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
561
562 return kmem_cache_zalloc(sas_event_cache, flags);
563}
564
565void sas_free_event(struct asd_sas_event *event)
566{
567 kmem_cache_free(sas_event_cache, event);
568}
569
558/* ---------- SAS Class register/unregister ---------- */ 570/* ---------- SAS Class register/unregister ---------- */
559 571
560static int __init sas_class_init(void) 572static int __init sas_class_init(void)
561{ 573{
562 sas_task_cache = KMEM_CACHE(sas_task, SLAB_HWCACHE_ALIGN); 574 sas_task_cache = KMEM_CACHE(sas_task, SLAB_HWCACHE_ALIGN);
563 if (!sas_task_cache) 575 if (!sas_task_cache)
564 return -ENOMEM; 576 goto out;
577
578 sas_event_cache = KMEM_CACHE(asd_sas_event, SLAB_HWCACHE_ALIGN);
579 if (!sas_event_cache)
580 goto free_task_kmem;
565 581
566 return 0; 582 return 0;
583free_task_kmem:
584 kmem_cache_destroy(sas_task_cache);
585out:
586 return -ENOMEM;
567} 587}
568 588
569static void __exit sas_class_exit(void) 589static void __exit sas_class_exit(void)
570{ 590{
571 kmem_cache_destroy(sas_task_cache); 591 kmem_cache_destroy(sas_task_cache);
592 kmem_cache_destroy(sas_event_cache);
572} 593}
573 594
574MODULE_AUTHOR("Luben Tuikov <luben_tuikov@adaptec.com>"); 595MODULE_AUTHOR("Luben Tuikov <luben_tuikov@adaptec.com>");