diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2008-05-19 06:17:47 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-06-05 10:27:15 -0400 |
commit | aa0fec62391cd429385e7f3f9fc4a1fb8e2d1218 (patch) | |
tree | 24cec104ec5bcea8fe4d12e1b158f6f0a105a080 /drivers/s390/scsi | |
parent | 7337891f381f856a63595392d7e79f2580912bf7 (diff) |
[SCSI] zfcp: Fix sparse warning by providing new entry in dbf
drivers/s390/scsi/zfcp_dbf.c:692:2: warning: context imbalance in
'zfcp_rec_dbf_event_thread' - different lock contexts for basic block
Replace the parameter indicating if the lock is held with a new entry
function that only acquires the lock. This makes the lock handling
more visible and removes the sparse warning.
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 23 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 18 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 4 |
3 files changed, 28 insertions, 17 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index e908c0631ace..558dae9639f3 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -670,24 +670,20 @@ static struct debug_view zfcp_rec_dbf_view = { | |||
670 | * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation | 670 | * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation |
671 | * @id2: identifier for event | 671 | * @id2: identifier for event |
672 | * @adapter: adapter | 672 | * @adapter: adapter |
673 | * @lock: non-zero value indicates that erp_lock has not yet been acquired | 673 | * This function assumes that the caller is holding erp_lock. |
674 | */ | 674 | */ |
675 | void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) | 675 | void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter) |
676 | { | 676 | { |
677 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | 677 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; |
678 | unsigned long flags = 0; | 678 | unsigned long flags = 0; |
679 | struct list_head *entry; | 679 | struct list_head *entry; |
680 | unsigned ready = 0, running = 0, total; | 680 | unsigned ready = 0, running = 0, total; |
681 | 681 | ||
682 | if (lock) | ||
683 | read_lock_irqsave(&adapter->erp_lock, flags); | ||
684 | list_for_each(entry, &adapter->erp_ready_head) | 682 | list_for_each(entry, &adapter->erp_ready_head) |
685 | ready++; | 683 | ready++; |
686 | list_for_each(entry, &adapter->erp_running_head) | 684 | list_for_each(entry, &adapter->erp_running_head) |
687 | running++; | 685 | running++; |
688 | total = adapter->erp_total_count; | 686 | total = adapter->erp_total_count; |
689 | if (lock) | ||
690 | read_unlock_irqrestore(&adapter->erp_lock, flags); | ||
691 | 687 | ||
692 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | 688 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); |
693 | memset(r, 0, sizeof(*r)); | 689 | memset(r, 0, sizeof(*r)); |
@@ -700,6 +696,21 @@ void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) | |||
700 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | 696 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); |
701 | } | 697 | } |
702 | 698 | ||
699 | /** | ||
700 | * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation | ||
701 | * @id2: identifier for event | ||
702 | * @adapter: adapter | ||
703 | * This function assumes that the caller does not hold erp_lock. | ||
704 | */ | ||
705 | void zfcp_rec_dbf_event_thread_lock(u8 id2, struct zfcp_adapter *adapter) | ||
706 | { | ||
707 | unsigned long flags; | ||
708 | |||
709 | read_lock_irqsave(&adapter->erp_lock, flags); | ||
710 | zfcp_rec_dbf_event_thread(id2, adapter); | ||
711 | read_unlock_irqrestore(&adapter->erp_lock, flags); | ||
712 | } | ||
713 | |||
703 | static void zfcp_rec_dbf_event_target(u8 id2, void *ref, | 714 | static void zfcp_rec_dbf_event_target(u8 id2, void *ref, |
704 | struct zfcp_adapter *adapter, | 715 | struct zfcp_adapter *adapter, |
705 | atomic_t *status, atomic_t *erp_count, | 716 | atomic_t *status, atomic_t *erp_count, |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 55a4fdc42626..d05b37054897 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -783,7 +783,7 @@ zfcp_erp_action_ready(struct zfcp_erp_action *erp_action) | |||
783 | 783 | ||
784 | zfcp_erp_action_to_ready(erp_action); | 784 | zfcp_erp_action_to_ready(erp_action); |
785 | up(&adapter->erp_ready_sem); | 785 | up(&adapter->erp_ready_sem); |
786 | zfcp_rec_dbf_event_thread(2, adapter, 0); | 786 | zfcp_rec_dbf_event_thread(2, adapter); |
787 | } | 787 | } |
788 | 788 | ||
789 | /* | 789 | /* |
@@ -995,7 +995,7 @@ zfcp_erp_thread_kill(struct zfcp_adapter *adapter) | |||
995 | 995 | ||
996 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, &adapter->status); | 996 | atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL, &adapter->status); |
997 | up(&adapter->erp_ready_sem); | 997 | up(&adapter->erp_ready_sem); |
998 | zfcp_rec_dbf_event_thread(2, adapter, 1); | 998 | zfcp_rec_dbf_event_thread_lock(2, adapter); |
999 | 999 | ||
1000 | wait_event(adapter->erp_thread_wqh, | 1000 | wait_event(adapter->erp_thread_wqh, |
1001 | !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, | 1001 | !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, |
@@ -1050,9 +1050,9 @@ zfcp_erp_thread(void *data) | |||
1050 | * no action in 'ready' queue to be processed and | 1050 | * no action in 'ready' queue to be processed and |
1051 | * thread is not to be killed | 1051 | * thread is not to be killed |
1052 | */ | 1052 | */ |
1053 | zfcp_rec_dbf_event_thread(4, adapter, 1); | 1053 | zfcp_rec_dbf_event_thread_lock(4, adapter); |
1054 | down_interruptible(&adapter->erp_ready_sem); | 1054 | down_interruptible(&adapter->erp_ready_sem); |
1055 | zfcp_rec_dbf_event_thread(5, adapter, 1); | 1055 | zfcp_rec_dbf_event_thread_lock(5, adapter); |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); | 1058 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); |
@@ -2062,9 +2062,9 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
2062 | * _must_ be the one belonging to the 'exchange config | 2062 | * _must_ be the one belonging to the 'exchange config |
2063 | * data' request. | 2063 | * data' request. |
2064 | */ | 2064 | */ |
2065 | zfcp_rec_dbf_event_thread(6, adapter, 1); | 2065 | zfcp_rec_dbf_event_thread_lock(6, adapter); |
2066 | down(&adapter->erp_ready_sem); | 2066 | down(&adapter->erp_ready_sem); |
2067 | zfcp_rec_dbf_event_thread(7, adapter, 1); | 2067 | zfcp_rec_dbf_event_thread_lock(7, adapter); |
2068 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | 2068 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { |
2069 | ZFCP_LOG_INFO("error: exchange of configuration data " | 2069 | ZFCP_LOG_INFO("error: exchange of configuration data " |
2070 | "for adapter %s timed out\n", | 2070 | "for adapter %s timed out\n", |
@@ -2118,9 +2118,9 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) | |||
2118 | } | 2118 | } |
2119 | 2119 | ||
2120 | ret = ZFCP_ERP_SUCCEEDED; | 2120 | ret = ZFCP_ERP_SUCCEEDED; |
2121 | zfcp_rec_dbf_event_thread(8, adapter, 1); | 2121 | zfcp_rec_dbf_event_thread_lock(8, adapter); |
2122 | down(&adapter->erp_ready_sem); | 2122 | down(&adapter->erp_ready_sem); |
2123 | zfcp_rec_dbf_event_thread(9, adapter, 1); | 2123 | zfcp_rec_dbf_event_thread_lock(9, adapter); |
2124 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | 2124 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { |
2125 | ZFCP_LOG_INFO("error: exchange port data timed out (adapter " | 2125 | ZFCP_LOG_INFO("error: exchange port data timed out (adapter " |
2126 | "%s)\n", zfcp_get_busid_by_adapter(adapter)); | 2126 | "%s)\n", zfcp_get_busid_by_adapter(adapter)); |
@@ -2876,7 +2876,7 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, | |||
2876 | /* finally put it into 'ready' queue and kick erp thread */ | 2876 | /* finally put it into 'ready' queue and kick erp thread */ |
2877 | list_add_tail(&erp_action->list, &adapter->erp_ready_head); | 2877 | list_add_tail(&erp_action->list, &adapter->erp_ready_head); |
2878 | up(&adapter->erp_ready_sem); | 2878 | up(&adapter->erp_ready_sem); |
2879 | zfcp_rec_dbf_event_thread(1, adapter, 0); | 2879 | zfcp_rec_dbf_event_thread(1, adapter); |
2880 | retval = 0; | 2880 | retval = 0; |
2881 | out: | 2881 | out: |
2882 | zfcp_rec_dbf_event_trigger(id, ref, want, need, erp_action, | 2882 | zfcp_rec_dbf_event_trigger(id, ref, want, need, erp_action, |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 16213cbbc4ba..e47ab8d05b67 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -169,8 +169,8 @@ extern void zfcp_erp_port_access_changed(struct zfcp_port *, u8, void *); | |||
169 | extern void zfcp_erp_unit_access_changed(struct zfcp_unit *, u8, void *); | 169 | extern void zfcp_erp_unit_access_changed(struct zfcp_unit *, u8, void *); |
170 | 170 | ||
171 | /******************************** AUX ****************************************/ | 171 | /******************************** AUX ****************************************/ |
172 | extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter, | 172 | extern void zfcp_rec_dbf_event_thread(u8 id, struct zfcp_adapter *adapter); |
173 | int lock); | 173 | extern void zfcp_rec_dbf_event_thread_lock(u8 id, struct zfcp_adapter *adapter); |
174 | extern void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *); | 174 | extern void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *); |
175 | extern void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port); | 175 | extern void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port); |
176 | extern void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit); | 176 | extern void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit); |