diff options
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index ee5f4dfdab14..245ca99a641e 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <linux/interrupt.h> | 55 | #include <linux/interrupt.h> |
56 | #include <linux/notifier.h> | 56 | #include <linux/notifier.h> |
57 | #include <linux/cpu.h> | 57 | #include <linux/cpu.h> |
58 | #include <linux/mutex.h> | ||
58 | 59 | ||
59 | #include <scsi/scsi.h> | 60 | #include <scsi/scsi.h> |
60 | #include <scsi/scsi_cmnd.h> | 61 | #include <scsi/scsi_cmnd.h> |
@@ -209,7 +210,7 @@ static struct scsi_host_cmd_pool scsi_cmd_dma_pool = { | |||
209 | .gfp_mask = __GFP_DMA, | 210 | .gfp_mask = __GFP_DMA, |
210 | }; | 211 | }; |
211 | 212 | ||
212 | static DECLARE_MUTEX(host_cmd_pool_mutex); | 213 | static DEFINE_MUTEX(host_cmd_pool_mutex); |
213 | 214 | ||
214 | static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, | 215 | static struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, |
215 | gfp_t gfp_mask) | 216 | gfp_t gfp_mask) |
@@ -330,7 +331,7 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost) | |||
330 | * Select a command slab for this host and create it if not | 331 | * Select a command slab for this host and create it if not |
331 | * yet existant. | 332 | * yet existant. |
332 | */ | 333 | */ |
333 | down(&host_cmd_pool_mutex); | 334 | mutex_lock(&host_cmd_pool_mutex); |
334 | pool = (shost->unchecked_isa_dma ? &scsi_cmd_dma_pool : &scsi_cmd_pool); | 335 | pool = (shost->unchecked_isa_dma ? &scsi_cmd_dma_pool : &scsi_cmd_pool); |
335 | if (!pool->users) { | 336 | if (!pool->users) { |
336 | pool->slab = kmem_cache_create(pool->name, | 337 | pool->slab = kmem_cache_create(pool->name, |
@@ -342,7 +343,7 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost) | |||
342 | 343 | ||
343 | pool->users++; | 344 | pool->users++; |
344 | shost->cmd_pool = pool; | 345 | shost->cmd_pool = pool; |
345 | up(&host_cmd_pool_mutex); | 346 | mutex_unlock(&host_cmd_pool_mutex); |
346 | 347 | ||
347 | /* | 348 | /* |
348 | * Get one backup command for this host. | 349 | * Get one backup command for this host. |
@@ -359,7 +360,7 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost) | |||
359 | kmem_cache_destroy(pool->slab); | 360 | kmem_cache_destroy(pool->slab); |
360 | return -ENOMEM; | 361 | return -ENOMEM; |
361 | fail: | 362 | fail: |
362 | up(&host_cmd_pool_mutex); | 363 | mutex_unlock(&host_cmd_pool_mutex); |
363 | return -ENOMEM; | 364 | return -ENOMEM; |
364 | 365 | ||
365 | } | 366 | } |
@@ -381,10 +382,10 @@ void scsi_destroy_command_freelist(struct Scsi_Host *shost) | |||
381 | kmem_cache_free(shost->cmd_pool->slab, cmd); | 382 | kmem_cache_free(shost->cmd_pool->slab, cmd); |
382 | } | 383 | } |
383 | 384 | ||
384 | down(&host_cmd_pool_mutex); | 385 | mutex_lock(&host_cmd_pool_mutex); |
385 | if (!--shost->cmd_pool->users) | 386 | if (!--shost->cmd_pool->users) |
386 | kmem_cache_destroy(shost->cmd_pool->slab); | 387 | kmem_cache_destroy(shost->cmd_pool->slab); |
387 | up(&host_cmd_pool_mutex); | 388 | mutex_unlock(&host_cmd_pool_mutex); |
388 | } | 389 | } |
389 | 390 | ||
390 | #ifdef CONFIG_SCSI_LOGGING | 391 | #ifdef CONFIG_SCSI_LOGGING |