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: Sebastian Ott <sebott@linux.ibm.com> Reviewed-by: Stefan Haberland <sth@linux.ibm.com> Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
7352c54693
commit
5c618c0cf4
@ -1885,6 +1885,33 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __dasd_process_cqr(struct dasd_device *device,
|
||||||
|
struct dasd_ccw_req *cqr)
|
||||||
|
{
|
||||||
|
char errorstring[ERRORLENGTH];
|
||||||
|
|
||||||
|
switch (cqr->status) {
|
||||||
|
case DASD_CQR_SUCCESS:
|
||||||
|
cqr->status = DASD_CQR_DONE;
|
||||||
|
break;
|
||||||
|
case DASD_CQR_ERROR:
|
||||||
|
cqr->status = DASD_CQR_NEED_ERP;
|
||||||
|
break;
|
||||||
|
case DASD_CQR_CLEARED:
|
||||||
|
cqr->status = DASD_CQR_TERMINATED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* internal error 12 - wrong cqr status*/
|
||||||
|
snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
|
||||||
|
dev_err(&device->cdev->dev,
|
||||||
|
"An error occurred in the DASD device driver, "
|
||||||
|
"reason=%s\n", errorstring);
|
||||||
|
BUG();
|
||||||
|
}
|
||||||
|
if (cqr->callback)
|
||||||
|
cqr->callback(cqr, cqr->callback_data);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the cqrs from the final queue are returned to the upper layer
|
* the cqrs from the final queue are returned to the upper layer
|
||||||
* by setting a dasd_block state and calling the callback function
|
* by setting a dasd_block state and calling the callback function
|
||||||
@ -1895,40 +1922,18 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
|
|||||||
struct list_head *l, *n;
|
struct list_head *l, *n;
|
||||||
struct dasd_ccw_req *cqr;
|
struct dasd_ccw_req *cqr;
|
||||||
struct dasd_block *block;
|
struct dasd_block *block;
|
||||||
void (*callback)(struct dasd_ccw_req *, void *data);
|
|
||||||
void *callback_data;
|
|
||||||
char errorstring[ERRORLENGTH];
|
|
||||||
|
|
||||||
list_for_each_safe(l, n, final_queue) {
|
list_for_each_safe(l, n, final_queue) {
|
||||||
cqr = list_entry(l, struct dasd_ccw_req, devlist);
|
cqr = list_entry(l, struct dasd_ccw_req, devlist);
|
||||||
list_del_init(&cqr->devlist);
|
list_del_init(&cqr->devlist);
|
||||||
block = cqr->block;
|
block = cqr->block;
|
||||||
callback = cqr->callback;
|
if (!block) {
|
||||||
callback_data = cqr->callback_data;
|
__dasd_process_cqr(device, cqr);
|
||||||
if (block)
|
} else {
|
||||||
spin_lock_bh(&block->queue_lock);
|
spin_lock_bh(&block->queue_lock);
|
||||||
switch (cqr->status) {
|
__dasd_process_cqr(device, cqr);
|
||||||
case DASD_CQR_SUCCESS:
|
|
||||||
cqr->status = DASD_CQR_DONE;
|
|
||||||
break;
|
|
||||||
case DASD_CQR_ERROR:
|
|
||||||
cqr->status = DASD_CQR_NEED_ERP;
|
|
||||||
break;
|
|
||||||
case DASD_CQR_CLEARED:
|
|
||||||
cqr->status = DASD_CQR_TERMINATED;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* internal error 12 - wrong cqr status*/
|
|
||||||
snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
|
|
||||||
dev_err(&device->cdev->dev,
|
|
||||||
"An error occurred in the DASD device driver, "
|
|
||||||
"reason=%s\n", errorstring);
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
if (cqr->callback != NULL)
|
|
||||||
(callback)(cqr, callback_data);
|
|
||||||
if (block)
|
|
||||||
spin_unlock_bh(&block->queue_lock);
|
spin_unlock_bh(&block->queue_lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user