2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
19 * bfa_wc.h Generic wait counter.
25 typedef void (*bfa_wc_resume_t
) (void *cbarg
);
28 bfa_wc_resume_t wc_resume
;
34 bfa_wc_up(struct bfa_wc_s
*wc
)
40 bfa_wc_down(struct bfa_wc_s
*wc
)
43 if (wc
->wc_count
== 0)
44 wc
->wc_resume(wc
->wc_cbarg
);
48 * Initialize a waiting counter.
51 bfa_wc_init(struct bfa_wc_s
*wc
, bfa_wc_resume_t wc_resume
, void *wc_cbarg
)
53 wc
->wc_resume
= wc_resume
;
54 wc
->wc_cbarg
= wc_cbarg
;
60 * Wait for counter to reach zero
63 bfa_wc_wait(struct bfa_wc_s
*wc
)