summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2012-05-01 12:43:01 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-05-10 04:15:46 -0400
commit1d94f94d89848762306b4a8bd5e658c11828ab12 (patch)
treeedcbf9e84b73b6853ed8f0790a1ebc0e504f81fe /drivers/scsi/hpsa.c
parent6cba3f1972de14421ef4cf4b46a15cc5d604e791 (diff)
[SCSI] hpsa: factor out tail calls to next_command() in process_(non)indexed_cmd()
This is in order to smooth the way for upcoming changes to allow use of multiple reply queues for command completions. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Matt Gates <matthew.gates@hp.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 87f8a1b8d2ea..bf5ed873a33e 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3379,22 +3379,21 @@ static inline u32 hpsa_tag_discard_error_bits(struct ctlr_info *h, u32 tag)
3379} 3379}
3380 3380
3381/* process completion of an indexed ("direct lookup") command */ 3381/* process completion of an indexed ("direct lookup") command */
3382static inline u32 process_indexed_cmd(struct ctlr_info *h, 3382static inline void process_indexed_cmd(struct ctlr_info *h,
3383 u32 raw_tag) 3383 u32 raw_tag)
3384{ 3384{
3385 u32 tag_index; 3385 u32 tag_index;
3386 struct CommandList *c; 3386 struct CommandList *c;
3387 3387
3388 tag_index = hpsa_tag_to_index(raw_tag); 3388 tag_index = hpsa_tag_to_index(raw_tag);
3389 if (bad_tag(h, tag_index, raw_tag)) 3389 if (!bad_tag(h, tag_index, raw_tag)) {
3390 return next_command(h); 3390 c = h->cmd_pool + tag_index;
3391 c = h->cmd_pool + tag_index; 3391 finish_cmd(c);
3392 finish_cmd(c); 3392 }
3393 return next_command(h);
3394} 3393}
3395 3394
3396/* process completion of a non-indexed command */ 3395/* process completion of a non-indexed command */
3397static inline u32 process_nonindexed_cmd(struct ctlr_info *h, 3396static inline void process_nonindexed_cmd(struct ctlr_info *h,
3398 u32 raw_tag) 3397 u32 raw_tag)
3399{ 3398{
3400 u32 tag; 3399 u32 tag;
@@ -3404,11 +3403,10 @@ static inline u32 process_nonindexed_cmd(struct ctlr_info *h,
3404 list_for_each_entry(c, &h->cmpQ, list) { 3403 list_for_each_entry(c, &h->cmpQ, list) {
3405 if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) { 3404 if ((c->busaddr & 0xFFFFFFE0) == (tag & 0xFFFFFFE0)) {
3406 finish_cmd(c); 3405 finish_cmd(c);
3407 return next_command(h); 3406 return;
3408 } 3407 }
3409 } 3408 }
3410 bad_tag(h, h->nr_cmds + 1, raw_tag); 3409 bad_tag(h, h->nr_cmds + 1, raw_tag);
3411 return next_command(h);
3412} 3410}
3413 3411
3414/* Some controllers, like p400, will give us one interrupt 3412/* Some controllers, like p400, will give us one interrupt
@@ -3483,10 +3481,11 @@ static irqreturn_t do_hpsa_intr_intx(int irq, void *dev_id)
3483 while (interrupt_pending(h)) { 3481 while (interrupt_pending(h)) {
3484 raw_tag = get_next_completion(h); 3482 raw_tag = get_next_completion(h);
3485 while (raw_tag != FIFO_EMPTY) { 3483 while (raw_tag != FIFO_EMPTY) {
3486 if (hpsa_tag_contains_index(raw_tag)) 3484 if (likely(hpsa_tag_contains_index(raw_tag)))
3487 raw_tag = process_indexed_cmd(h, raw_tag); 3485 process_indexed_cmd(h, raw_tag);
3488 else 3486 else
3489 raw_tag = process_nonindexed_cmd(h, raw_tag); 3487 process_nonindexed_cmd(h, raw_tag);
3488 raw_tag = next_command(h);
3490 } 3489 }
3491 } 3490 }
3492 spin_unlock_irqrestore(&h->lock, flags); 3491 spin_unlock_irqrestore(&h->lock, flags);
@@ -3503,10 +3502,11 @@ static irqreturn_t do_hpsa_intr_msi(int irq, void *dev_id)
3503 h->last_intr_timestamp = get_jiffies_64(); 3502 h->last_intr_timestamp = get_jiffies_64();
3504 raw_tag = get_next_completion(h); 3503 raw_tag = get_next_completion(h);
3505 while (raw_tag != FIFO_EMPTY) { 3504 while (raw_tag != FIFO_EMPTY) {
3506 if (hpsa_tag_contains_index(raw_tag)) 3505 if (likely(hpsa_tag_contains_index(raw_tag)))
3507 raw_tag = process_indexed_cmd(h, raw_tag); 3506 process_indexed_cmd(h, raw_tag);
3508 else 3507 else
3509 raw_tag = process_nonindexed_cmd(h, raw_tag); 3508 process_nonindexed_cmd(h, raw_tag);
3509 raw_tag = next_command(h);
3510 } 3510 }
3511 spin_unlock_irqrestore(&h->lock, flags); 3511 spin_unlock_irqrestore(&h->lock, flags);
3512 return IRQ_HANDLED; 3512 return IRQ_HANDLED;