diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-02-04 14:57:38 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-04-29 18:00:27 -0400 |
commit | 3d269cb50c81d3bb01d5856d5157d4db346bab4b (patch) | |
tree | 469febbd344f4c9363ed1d1a815b95b4cecf62ae /drivers/ieee1394 | |
parent | 2446a79f4f0a5e88e5d8316dac407d66ac10f70d (diff) |
ieee1394: sbp2: move some memory allocations into non-atomic context
When the command ORB pool is created, the ORB list won't be accessed
concurrently. Therefore we don't have to take the spinlock there.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/sbp2.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index cae3816e68db..8c471ca11115 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -469,19 +469,13 @@ static void sbp2util_write_doorbell(struct work_struct *work) | |||
469 | static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu) | 469 | static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu) |
470 | { | 470 | { |
471 | struct sbp2_fwhost_info *hi = lu->hi; | 471 | struct sbp2_fwhost_info *hi = lu->hi; |
472 | int i; | ||
473 | unsigned long flags, orbs; | ||
474 | struct sbp2_command_info *cmd; | 472 | struct sbp2_command_info *cmd; |
473 | int i, orbs = sbp2_serialize_io ? 2 : SBP2_MAX_CMDS; | ||
475 | 474 | ||
476 | orbs = sbp2_serialize_io ? 2 : SBP2_MAX_CMDS; | ||
477 | |||
478 | spin_lock_irqsave(&lu->cmd_orb_lock, flags); | ||
479 | for (i = 0; i < orbs; i++) { | 475 | for (i = 0; i < orbs; i++) { |
480 | cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC); | 476 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); |
481 | if (!cmd) { | 477 | if (!cmd) |
482 | spin_unlock_irqrestore(&lu->cmd_orb_lock, flags); | ||
483 | return -ENOMEM; | 478 | return -ENOMEM; |
484 | } | ||
485 | cmd->command_orb_dma = dma_map_single(hi->host->device.parent, | 479 | cmd->command_orb_dma = dma_map_single(hi->host->device.parent, |
486 | &cmd->command_orb, | 480 | &cmd->command_orb, |
487 | sizeof(struct sbp2_command_orb), | 481 | sizeof(struct sbp2_command_orb), |
@@ -493,7 +487,6 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu) | |||
493 | INIT_LIST_HEAD(&cmd->list); | 487 | INIT_LIST_HEAD(&cmd->list); |
494 | list_add_tail(&cmd->list, &lu->cmd_orb_completed); | 488 | list_add_tail(&cmd->list, &lu->cmd_orb_completed); |
495 | } | 489 | } |
496 | spin_unlock_irqrestore(&lu->cmd_orb_lock, flags); | ||
497 | return 0; | 490 | return 0; |
498 | } | 491 | } |
499 | 492 | ||
@@ -870,11 +863,8 @@ static int sbp2_start_device(struct sbp2_lu *lu) | |||
870 | if (!lu->login_orb) | 863 | if (!lu->login_orb) |
871 | goto alloc_fail; | 864 | goto alloc_fail; |
872 | 865 | ||
873 | if (sbp2util_create_command_orb_pool(lu)) { | 866 | if (sbp2util_create_command_orb_pool(lu)) |
874 | SBP2_ERR("sbp2util_create_command_orb_pool failed!"); | 867 | goto alloc_fail; |
875 | sbp2_remove_device(lu); | ||
876 | return -ENOMEM; | ||
877 | } | ||
878 | 868 | ||
879 | /* Wait a second before trying to log in. Previously logged in | 869 | /* Wait a second before trying to log in. Previously logged in |
880 | * initiators need a chance to reconnect. */ | 870 | * initiators need a chance to reconnect. */ |