Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+32 −27
Original line number Diff line number Diff line
@@ -1885,28 +1885,11 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device,
	}
}

/*
 * 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)
static void __dasd_process_cqr(struct dasd_device *device,
			       struct dasd_ccw_req *cqr)
{
	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];

	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) {
	case DASD_CQR_SUCCESS:
		cqr->status = DASD_CQR_DONE;
@@ -1925,12 +1908,34 @@ static void __dasd_device_process_final_queue(struct dasd_device *device,
			"reason=%s\n", errorstring);
		BUG();
	}
		if (cqr->callback != NULL)
			(callback)(cqr, callback_data);
		if (block)
	if (cqr->callback)
		cqr->callback(cqr, cqr->callback_data);
}

/*
 * 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);
		}
	}
}

/*
 * Take a look at the first request on the ccw queue and check