diff options
author | Santosh Nayak <santoshprasadnayak@gmail.com> | 2012-02-26 08:33:30 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-29 17:49:55 -0500 |
commit | bdaefbf580cd200ae3230b6aacd1f4f2dadb18e3 (patch) | |
tree | d916cbf8b7cd029699875d0776193d81a7883d03 /drivers/scsi/pm8001/pm8001_hwi.c | |
parent | cd9b3d04b4cae6bdfd639e603649777f819ed783 (diff) |
[SCSI] pm8001: Fix bogus interrupt state flag issue.
Static checker is giving following warning:
" error: calling 'spin_unlock_irqrestore()' with bogus flags"
The code flow is as shown below:
process_oq() --> process_one_iomb --> mpi_sata_completion
In 'mpi_sata_completion'
the first call for 'spin_unlock_irqrestore()' is with flags=0,
which is as good as 'spin_unlock_irq()' ( unconditional interrupt
enabling).
So for better performance 'spin_unlock_irqrestore()' can be replaced
with 'spin_unlock_irq()' and 'spin_lock_irqsave()' can be replaced by
'spin_lock_irq()'.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
Acked-by: Jack Wang <jack_wang@usish.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_hwi.c')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 3920b49f4f57..871d1c3fa01b 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -2082,7 +2082,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2082 | { | 2082 | { |
2083 | struct sas_task *t; | 2083 | struct sas_task *t; |
2084 | struct pm8001_ccb_info *ccb; | 2084 | struct pm8001_ccb_info *ccb; |
2085 | unsigned long flags = 0; | ||
2086 | u32 param; | 2085 | u32 param; |
2087 | u32 status; | 2086 | u32 status; |
2088 | u32 tag; | 2087 | u32 tag; |
@@ -2221,9 +2220,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2221 | ts->stat = SAS_QUEUE_FULL; | 2220 | ts->stat = SAS_QUEUE_FULL; |
2222 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2221 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2223 | mb();/*in order to force CPU ordering*/ | 2222 | mb();/*in order to force CPU ordering*/ |
2224 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2223 | spin_unlock_irq(&pm8001_ha->lock); |
2225 | t->task_done(t); | 2224 | t->task_done(t); |
2226 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2225 | spin_lock_irq(&pm8001_ha->lock); |
2227 | return; | 2226 | return; |
2228 | } | 2227 | } |
2229 | break; | 2228 | break; |
@@ -2241,9 +2240,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2241 | ts->stat = SAS_QUEUE_FULL; | 2240 | ts->stat = SAS_QUEUE_FULL; |
2242 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2241 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2243 | mb();/*ditto*/ | 2242 | mb();/*ditto*/ |
2244 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2243 | spin_unlock_irq(&pm8001_ha->lock); |
2245 | t->task_done(t); | 2244 | t->task_done(t); |
2246 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2245 | spin_lock_irq(&pm8001_ha->lock); |
2247 | return; | 2246 | return; |
2248 | } | 2247 | } |
2249 | break; | 2248 | break; |
@@ -2269,9 +2268,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2269 | ts->stat = SAS_QUEUE_FULL; | 2268 | ts->stat = SAS_QUEUE_FULL; |
2270 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2269 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2271 | mb();/* ditto*/ | 2270 | mb();/* ditto*/ |
2272 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2271 | spin_unlock_irq(&pm8001_ha->lock); |
2273 | t->task_done(t); | 2272 | t->task_done(t); |
2274 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2273 | spin_lock_irq(&pm8001_ha->lock); |
2275 | return; | 2274 | return; |
2276 | } | 2275 | } |
2277 | break; | 2276 | break; |
@@ -2336,9 +2335,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2336 | ts->stat = SAS_QUEUE_FULL; | 2335 | ts->stat = SAS_QUEUE_FULL; |
2337 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2336 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2338 | mb();/*ditto*/ | 2337 | mb();/*ditto*/ |
2339 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2338 | spin_unlock_irq(&pm8001_ha->lock); |
2340 | t->task_done(t); | 2339 | t->task_done(t); |
2341 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2340 | spin_lock_irq(&pm8001_ha->lock); |
2342 | return; | 2341 | return; |
2343 | } | 2342 | } |
2344 | break; | 2343 | break; |
@@ -2360,9 +2359,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2360 | ts->stat = SAS_QUEUE_FULL; | 2359 | ts->stat = SAS_QUEUE_FULL; |
2361 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2360 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2362 | mb();/*ditto*/ | 2361 | mb();/*ditto*/ |
2363 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2362 | spin_unlock_irq(&pm8001_ha->lock); |
2364 | t->task_done(t); | 2363 | t->task_done(t); |
2365 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2364 | spin_lock_irq(&pm8001_ha->lock); |
2366 | return; | 2365 | return; |
2367 | } | 2366 | } |
2368 | break; | 2367 | break; |
@@ -2380,31 +2379,31 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2380 | ts->stat = SAS_DEV_NO_RESPONSE; | 2379 | ts->stat = SAS_DEV_NO_RESPONSE; |
2381 | break; | 2380 | break; |
2382 | } | 2381 | } |
2383 | spin_lock_irqsave(&t->task_state_lock, flags); | 2382 | spin_lock_irq(&t->task_state_lock); |
2384 | t->task_state_flags &= ~SAS_TASK_STATE_PENDING; | 2383 | t->task_state_flags &= ~SAS_TASK_STATE_PENDING; |
2385 | t->task_state_flags &= ~SAS_TASK_AT_INITIATOR; | 2384 | t->task_state_flags &= ~SAS_TASK_AT_INITIATOR; |
2386 | t->task_state_flags |= SAS_TASK_STATE_DONE; | 2385 | t->task_state_flags |= SAS_TASK_STATE_DONE; |
2387 | if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { | 2386 | if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { |
2388 | spin_unlock_irqrestore(&t->task_state_lock, flags); | 2387 | spin_unlock_irq(&t->task_state_lock); |
2389 | PM8001_FAIL_DBG(pm8001_ha, | 2388 | PM8001_FAIL_DBG(pm8001_ha, |
2390 | pm8001_printk("task 0x%p done with io_status 0x%x" | 2389 | pm8001_printk("task 0x%p done with io_status 0x%x" |
2391 | " resp 0x%x stat 0x%x but aborted by upper layer!\n", | 2390 | " resp 0x%x stat 0x%x but aborted by upper layer!\n", |
2392 | t, status, ts->resp, ts->stat)); | 2391 | t, status, ts->resp, ts->stat)); |
2393 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2392 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2394 | } else if (t->uldd_task) { | 2393 | } else if (t->uldd_task) { |
2395 | spin_unlock_irqrestore(&t->task_state_lock, flags); | 2394 | spin_unlock_irq(&t->task_state_lock); |
2396 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2395 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2397 | mb();/* ditto */ | 2396 | mb();/* ditto */ |
2398 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2397 | spin_unlock_irq(&pm8001_ha->lock); |
2399 | t->task_done(t); | 2398 | t->task_done(t); |
2400 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2399 | spin_lock_irq(&pm8001_ha->lock); |
2401 | } else if (!t->uldd_task) { | 2400 | } else if (!t->uldd_task) { |
2402 | spin_unlock_irqrestore(&t->task_state_lock, flags); | 2401 | spin_unlock_irq(&t->task_state_lock); |
2403 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2402 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2404 | mb();/*ditto*/ | 2403 | mb();/*ditto*/ |
2405 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2404 | spin_unlock_irq(&pm8001_ha->lock); |
2406 | t->task_done(t); | 2405 | t->task_done(t); |
2407 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2406 | spin_lock_irq(&pm8001_ha->lock); |
2408 | } | 2407 | } |
2409 | } | 2408 | } |
2410 | 2409 | ||
@@ -2412,7 +2411,6 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) | |||
2412 | static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | 2411 | static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) |
2413 | { | 2412 | { |
2414 | struct sas_task *t; | 2413 | struct sas_task *t; |
2415 | unsigned long flags = 0; | ||
2416 | struct task_status_struct *ts; | 2414 | struct task_status_struct *ts; |
2417 | struct pm8001_ccb_info *ccb; | 2415 | struct pm8001_ccb_info *ccb; |
2418 | struct pm8001_device *pm8001_dev; | 2416 | struct pm8001_device *pm8001_dev; |
@@ -2492,9 +2490,9 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
2492 | ts->stat = SAS_QUEUE_FULL; | 2490 | ts->stat = SAS_QUEUE_FULL; |
2493 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2491 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2494 | mb();/*ditto*/ | 2492 | mb();/*ditto*/ |
2495 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2493 | spin_unlock_irq(&pm8001_ha->lock); |
2496 | t->task_done(t); | 2494 | t->task_done(t); |
2497 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2495 | spin_lock_irq(&pm8001_ha->lock); |
2498 | return; | 2496 | return; |
2499 | } | 2497 | } |
2500 | break; | 2498 | break; |
@@ -2592,31 +2590,31 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb) | |||
2592 | ts->stat = SAS_OPEN_TO; | 2590 | ts->stat = SAS_OPEN_TO; |
2593 | break; | 2591 | break; |
2594 | } | 2592 | } |
2595 | spin_lock_irqsave(&t->task_state_lock, flags); | 2593 | spin_lock_irq(&t->task_state_lock); |
2596 | t->task_state_flags &= ~SAS_TASK_STATE_PENDING; | 2594 | t->task_state_flags &= ~SAS_TASK_STATE_PENDING; |
2597 | t->task_state_flags &= ~SAS_TASK_AT_INITIATOR; | 2595 | t->task_state_flags &= ~SAS_TASK_AT_INITIATOR; |
2598 | t->task_state_flags |= SAS_TASK_STATE_DONE; | 2596 | t->task_state_flags |= SAS_TASK_STATE_DONE; |
2599 | if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { | 2597 | if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { |
2600 | spin_unlock_irqrestore(&t->task_state_lock, flags); | 2598 | spin_unlock_irq(&t->task_state_lock); |
2601 | PM8001_FAIL_DBG(pm8001_ha, | 2599 | PM8001_FAIL_DBG(pm8001_ha, |
2602 | pm8001_printk("task 0x%p done with io_status 0x%x" | 2600 | pm8001_printk("task 0x%p done with io_status 0x%x" |
2603 | " resp 0x%x stat 0x%x but aborted by upper layer!\n", | 2601 | " resp 0x%x stat 0x%x but aborted by upper layer!\n", |
2604 | t, event, ts->resp, ts->stat)); | 2602 | t, event, ts->resp, ts->stat)); |
2605 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2603 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2606 | } else if (t->uldd_task) { | 2604 | } else if (t->uldd_task) { |
2607 | spin_unlock_irqrestore(&t->task_state_lock, flags); | 2605 | spin_unlock_irq(&t->task_state_lock); |
2608 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2606 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2609 | mb();/* ditto */ | 2607 | mb();/* ditto */ |
2610 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2608 | spin_unlock_irq(&pm8001_ha->lock); |
2611 | t->task_done(t); | 2609 | t->task_done(t); |
2612 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2610 | spin_lock_irq(&pm8001_ha->lock); |
2613 | } else if (!t->uldd_task) { | 2611 | } else if (!t->uldd_task) { |
2614 | spin_unlock_irqrestore(&t->task_state_lock, flags); | 2612 | spin_unlock_irq(&t->task_state_lock); |
2615 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); | 2613 | pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
2616 | mb();/*ditto*/ | 2614 | mb();/*ditto*/ |
2617 | spin_unlock_irqrestore(&pm8001_ha->lock, flags); | 2615 | spin_unlock_irq(&pm8001_ha->lock); |
2618 | t->task_done(t); | 2616 | t->task_done(t); |
2619 | spin_lock_irqsave(&pm8001_ha->lock, flags); | 2617 | spin_lock_irq(&pm8001_ha->lock); |
2620 | } | 2618 | } |
2621 | } | 2619 | } |
2622 | 2620 | ||