Commit 5c618c0c authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/dasd: simplify locking in process_final_queue

Simplify locking in __dasd_device_process_final_queue to fix
the following sparse warning:

drivers/s390/block/dasd.c:1902:9: warning:
context imbalance in '__dasd_device_process_final_queue' - different lock contexts for basic block
Signed-off-by: default avatarSebastian Ott <sebott@linux.ibm.com>
Reviewed-by: default avatarStefan Haberland <sth@linux.ibm.com>
Reviewed-by: default avatarJan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 7352c546
...@@ -1885,28 +1885,11 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device, ...@@ -1885,28 +1885,11 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device,
} }
} }
/* static void __dasd_process_cqr(struct dasd_device *device,
* the cqrs from the final queue are returned to the upper layer struct dasd_ccw_req *cqr)
* by setting a dasd_block state and calling the callback function
*/
static void __dasd_device_process_final_queue(struct dasd_device *device,
struct list_head *final_queue)
{ {
struct list_head *l, *n;
struct dasd_ccw_req *cqr;
struct dasd_block *block;
void (*callback)(struct dasd_ccw_req *, void *data);
void *callback_data;
char errorstring[ERRORLENGTH]; char errorstring[ERRORLENGTH];
list_for_each_safe(l, n, final_queue) {
cqr = list_entry(l, struct dasd_ccw_req, devlist);
list_del_init(&cqr->devlist);
block = cqr->block;
callback = cqr->callback;
callback_data = cqr->callback_data;
if (block)
spin_lock_bh(&block->queue_lock);
switch (cqr->status) { switch (cqr->status) {
case DASD_CQR_SUCCESS: case DASD_CQR_SUCCESS:
cqr->status = DASD_CQR_DONE; cqr->status = DASD_CQR_DONE;
...@@ -1925,11 +1908,33 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, ...@@ -1925,11 +1908,33 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
"reason=%s\n", errorstring); "reason=%s\n", errorstring);
BUG(); BUG();
} }
if (cqr->callback != NULL) if (cqr->callback)
(callback)(cqr, callback_data); cqr->callback(cqr, cqr->callback_data);
if (block) }
/*
* the cqrs from the final queue are returned to the upper layer
* by setting a dasd_block state and calling the callback function
*/
static void __dasd_device_process_final_queue(struct dasd_device *device,
struct list_head *final_queue)
{
struct list_head *l, *n;
struct dasd_ccw_req *cqr;
struct dasd_block *block;
list_for_each_safe(l, n, final_queue) {
cqr = list_entry(l, struct dasd_ccw_req, devlist);
list_del_init(&cqr->devlist);
block = cqr->block;
if (!block) {
__dasd_process_cqr(device, cqr);
} else {
spin_lock_bh(&block->queue_lock);
__dasd_process_cqr(device, cqr);
spin_unlock_bh(&block->queue_lock); spin_unlock_bh(&block->queue_lock);
} }
}
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment