aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.ibm.com>2018-05-24 06:18:58 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-06-12 09:14:11 -0400
commit5c618c0cf451f1d9746296b0d30c84af1bce3604 (patch)
tree4f6e45e0fec4519ae0edc2df52aef96d1a6171e4
parent7352c5469307395875f4b62f366a369ae1c46e83 (diff)
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>
-rw-r--r--drivers/s390/block/dasd.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 73cce3ecb97f..790b1fa3fec0 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1885,6 +1885,33 @@ static void __dasd_device_process_ccw_queue(struct dasd_device *device,
1885 } 1885 }
1886} 1886}
1887 1887
1888static void __dasd_process_cqr(struct dasd_device *device,
1889 struct dasd_ccw_req *cqr)
1890{
1891 char errorstring[ERRORLENGTH];
1892
1893 switch (cqr->status) {
1894 case DASD_CQR_SUCCESS:
1895 cqr->status = DASD_CQR_DONE;
1896 break;
1897 case DASD_CQR_ERROR:
1898 cqr->status = DASD_CQR_NEED_ERP;
1899 break;
1900 case DASD_CQR_CLEARED:
1901 cqr->status = DASD_CQR_TERMINATED;
1902 break;
1903 default:
1904 /* internal error 12 - wrong cqr status*/
1905 snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
1906 dev_err(&device->cdev->dev,
1907 "An error occurred in the DASD device driver, "
1908 "reason=%s\n", errorstring);
1909 BUG();
1910 }
1911 if (cqr->callback)
1912 cqr->callback(cqr, cqr->callback_data);
1913}
1914
1888/* 1915/*
1889 * the cqrs from the final queue are returned to the upper layer 1916 * the cqrs from the final queue are returned to the upper layer
1890 * by setting a dasd_block state and calling the callback function 1917 * 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,
1895 struct list_head *l, *n; 1922 struct list_head *l, *n;
1896 struct dasd_ccw_req *cqr; 1923 struct dasd_ccw_req *cqr;
1897 struct dasd_block *block; 1924 struct dasd_block *block;
1898 void (*callback)(struct dasd_ccw_req *, void *data);
1899 void *callback_data;
1900 char errorstring[ERRORLENGTH];
1901 1925
1902 list_for_each_safe(l, n, final_queue) { 1926 list_for_each_safe(l, n, final_queue) {
1903 cqr = list_entry(l, struct dasd_ccw_req, devlist); 1927 cqr = list_entry(l, struct dasd_ccw_req, devlist);
1904 list_del_init(&cqr->devlist); 1928 list_del_init(&cqr->devlist);
1905 block = cqr->block; 1929 block = cqr->block;
1906 callback = cqr->callback; 1930 if (!block) {
1907 callback_data = cqr->callback_data; 1931 __dasd_process_cqr(device, cqr);
1908 if (block) 1932 } else {
1909 spin_lock_bh(&block->queue_lock); 1933 spin_lock_bh(&block->queue_lock);
1910 switch (cqr->status) { 1934 __dasd_process_cqr(device, cqr);
1911 case DASD_CQR_SUCCESS:
1912 cqr->status = DASD_CQR_DONE;
1913 break;
1914 case DASD_CQR_ERROR:
1915 cqr->status = DASD_CQR_NEED_ERP;
1916 break;
1917 case DASD_CQR_CLEARED:
1918 cqr->status = DASD_CQR_TERMINATED;
1919 break;
1920 default:
1921 /* internal error 12 - wrong cqr status*/
1922 snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status);
1923 dev_err(&device->cdev->dev,
1924 "An error occurred in the DASD device driver, "
1925 "reason=%s\n", errorstring);
1926 BUG();
1927 }
1928 if (cqr->callback != NULL)
1929 (callback)(cqr, callback_data);
1930 if (block)
1931 spin_unlock_bh(&block->queue_lock); 1935 spin_unlock_bh(&block->queue_lock);
1936 }
1932 } 1937 }
1933} 1938}
1934 1939