aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/block/dasd.c192
-rw-r--r--drivers/s390/block/dasd_genhd.c10
-rw-r--r--drivers/s390/cio/ccwgroup.c14
-rw-r--r--drivers/s390/cio/chsc.c10
-rw-r--r--drivers/s390/cio/device.c19
-rw-r--r--drivers/s390/cio/device_fsm.c20
-rw-r--r--drivers/s390/cio/device_pgid.c27
7 files changed, 182 insertions, 110 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index d8e9b95f0a1a..25c1ef6dfd44 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -52,7 +52,7 @@ static void dasd_setup_queue(struct dasd_device * device);
52static void dasd_free_queue(struct dasd_device * device); 52static void dasd_free_queue(struct dasd_device * device);
53static void dasd_flush_request_queue(struct dasd_device *); 53static void dasd_flush_request_queue(struct dasd_device *);
54static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); 54static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *);
55static void dasd_flush_ccw_queue(struct dasd_device *, int); 55static int dasd_flush_ccw_queue(struct dasd_device *, int);
56static void dasd_tasklet(struct dasd_device *); 56static void dasd_tasklet(struct dasd_device *);
57static void do_kick_device(void *data); 57static void do_kick_device(void *data);
58 58
@@ -60,6 +60,7 @@ static void do_kick_device(void *data);
60 * SECTION: Operations on the device structure. 60 * SECTION: Operations on the device structure.
61 */ 61 */
62static wait_queue_head_t dasd_init_waitq; 62static wait_queue_head_t dasd_init_waitq;
63static wait_queue_head_t dasd_flush_wq;
63 64
64/* 65/*
65 * Allocate memory for a new device structure. 66 * Allocate memory for a new device structure.
@@ -121,7 +122,7 @@ dasd_free_device(struct dasd_device *device)
121/* 122/*
122 * Make a new device known to the system. 123 * Make a new device known to the system.
123 */ 124 */
124static inline int 125static int
125dasd_state_new_to_known(struct dasd_device *device) 126dasd_state_new_to_known(struct dasd_device *device)
126{ 127{
127 int rc; 128 int rc;
@@ -145,7 +146,7 @@ dasd_state_new_to_known(struct dasd_device *device)
145/* 146/*
146 * Let the system forget about a device. 147 * Let the system forget about a device.
147 */ 148 */
148static inline void 149static int
149dasd_state_known_to_new(struct dasd_device * device) 150dasd_state_known_to_new(struct dasd_device * device)
150{ 151{
151 /* Disable extended error reporting for this device. */ 152 /* Disable extended error reporting for this device. */
@@ -163,12 +164,13 @@ dasd_state_known_to_new(struct dasd_device * device)
163 164
164 /* Give up reference we took in dasd_state_new_to_known. */ 165 /* Give up reference we took in dasd_state_new_to_known. */
165 dasd_put_device(device); 166 dasd_put_device(device);
167 return 0;
166} 168}
167 169
168/* 170/*
169 * Request the irq line for the device. 171 * Request the irq line for the device.
170 */ 172 */
171static inline int 173static int
172dasd_state_known_to_basic(struct dasd_device * device) 174dasd_state_known_to_basic(struct dasd_device * device)
173{ 175{
174 int rc; 176 int rc;
@@ -192,17 +194,23 @@ dasd_state_known_to_basic(struct dasd_device * device)
192/* 194/*
193 * Release the irq line for the device. Terminate any running i/o. 195 * Release the irq line for the device. Terminate any running i/o.
194 */ 196 */
195static inline void 197static int
196dasd_state_basic_to_known(struct dasd_device * device) 198dasd_state_basic_to_known(struct dasd_device * device)
197{ 199{
200 int rc;
201
198 dasd_gendisk_free(device); 202 dasd_gendisk_free(device);
199 dasd_flush_ccw_queue(device, 1); 203 rc = dasd_flush_ccw_queue(device, 1);
204 if (rc)
205 return rc;
206
200 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device); 207 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device);
201 if (device->debug_area != NULL) { 208 if (device->debug_area != NULL) {
202 debug_unregister(device->debug_area); 209 debug_unregister(device->debug_area);
203 device->debug_area = NULL; 210 device->debug_area = NULL;
204 } 211 }
205 device->state = DASD_STATE_KNOWN; 212 device->state = DASD_STATE_KNOWN;
213 return 0;
206} 214}
207 215
208/* 216/*
@@ -219,7 +227,7 @@ dasd_state_basic_to_known(struct dasd_device * device)
219 * In case the analysis returns an error, the device setup is stopped 227 * In case the analysis returns an error, the device setup is stopped
220 * (a fake disk was already added to allow formatting). 228 * (a fake disk was already added to allow formatting).
221 */ 229 */
222static inline int 230static int
223dasd_state_basic_to_ready(struct dasd_device * device) 231dasd_state_basic_to_ready(struct dasd_device * device)
224{ 232{
225 int rc; 233 int rc;
@@ -247,25 +255,31 @@ dasd_state_basic_to_ready(struct dasd_device * device)
247 * Forget format information. Check if the target level is basic 255 * Forget format information. Check if the target level is basic
248 * and if it is create fake disk for formatting. 256 * and if it is create fake disk for formatting.
249 */ 257 */
250static inline void 258static int
251dasd_state_ready_to_basic(struct dasd_device * device) 259dasd_state_ready_to_basic(struct dasd_device * device)
252{ 260{
253 dasd_flush_ccw_queue(device, 0); 261 int rc;
262
263 rc = dasd_flush_ccw_queue(device, 0);
264 if (rc)
265 return rc;
254 dasd_destroy_partitions(device); 266 dasd_destroy_partitions(device);
255 dasd_flush_request_queue(device); 267 dasd_flush_request_queue(device);
256 device->blocks = 0; 268 device->blocks = 0;
257 device->bp_block = 0; 269 device->bp_block = 0;
258 device->s2b_shift = 0; 270 device->s2b_shift = 0;
259 device->state = DASD_STATE_BASIC; 271 device->state = DASD_STATE_BASIC;
272 return 0;
260} 273}
261 274
262/* 275/*
263 * Back to basic. 276 * Back to basic.
264 */ 277 */
265static inline void 278static int
266dasd_state_unfmt_to_basic(struct dasd_device * device) 279dasd_state_unfmt_to_basic(struct dasd_device * device)
267{ 280{
268 device->state = DASD_STATE_BASIC; 281 device->state = DASD_STATE_BASIC;
282 return 0;
269} 283}
270 284
271/* 285/*
@@ -273,7 +287,7 @@ dasd_state_unfmt_to_basic(struct dasd_device * device)
273 * the requeueing of requests from the linux request queue to the 287 * the requeueing of requests from the linux request queue to the
274 * ccw queue. 288 * ccw queue.
275 */ 289 */
276static inline int 290static int
277dasd_state_ready_to_online(struct dasd_device * device) 291dasd_state_ready_to_online(struct dasd_device * device)
278{ 292{
279 device->state = DASD_STATE_ONLINE; 293 device->state = DASD_STATE_ONLINE;
@@ -284,16 +298,17 @@ dasd_state_ready_to_online(struct dasd_device * device)
284/* 298/*
285 * Stop the requeueing of requests again. 299 * Stop the requeueing of requests again.
286 */ 300 */
287static inline void 301static int
288dasd_state_online_to_ready(struct dasd_device * device) 302dasd_state_online_to_ready(struct dasd_device * device)
289{ 303{
290 device->state = DASD_STATE_READY; 304 device->state = DASD_STATE_READY;
305 return 0;
291} 306}
292 307
293/* 308/*
294 * Device startup state changes. 309 * Device startup state changes.
295 */ 310 */
296static inline int 311static int
297dasd_increase_state(struct dasd_device *device) 312dasd_increase_state(struct dasd_device *device)
298{ 313{
299 int rc; 314 int rc;
@@ -329,30 +344,37 @@ dasd_increase_state(struct dasd_device *device)
329/* 344/*
330 * Device shutdown state changes. 345 * Device shutdown state changes.
331 */ 346 */
332static inline int 347static int
333dasd_decrease_state(struct dasd_device *device) 348dasd_decrease_state(struct dasd_device *device)
334{ 349{
350 int rc;
351
352 rc = 0;
335 if (device->state == DASD_STATE_ONLINE && 353 if (device->state == DASD_STATE_ONLINE &&
336 device->target <= DASD_STATE_READY) 354 device->target <= DASD_STATE_READY)
337 dasd_state_online_to_ready(device); 355 rc = dasd_state_online_to_ready(device);
338 356
339 if (device->state == DASD_STATE_READY && 357 if (!rc &&
358 device->state == DASD_STATE_READY &&
340 device->target <= DASD_STATE_BASIC) 359 device->target <= DASD_STATE_BASIC)
341 dasd_state_ready_to_basic(device); 360 rc = dasd_state_ready_to_basic(device);
342 361
343 if (device->state == DASD_STATE_UNFMT && 362 if (!rc &&
363 device->state == DASD_STATE_UNFMT &&
344 device->target <= DASD_STATE_BASIC) 364 device->target <= DASD_STATE_BASIC)
345 dasd_state_unfmt_to_basic(device); 365 rc = dasd_state_unfmt_to_basic(device);
346 366
347 if (device->state == DASD_STATE_BASIC && 367 if (!rc &&
368 device->state == DASD_STATE_BASIC &&
348 device->target <= DASD_STATE_KNOWN) 369 device->target <= DASD_STATE_KNOWN)
349 dasd_state_basic_to_known(device); 370 rc = dasd_state_basic_to_known(device);
350 371
351 if (device->state == DASD_STATE_KNOWN && 372 if (!rc &&
373 device->state == DASD_STATE_KNOWN &&
352 device->target <= DASD_STATE_NEW) 374 device->target <= DASD_STATE_NEW)
353 dasd_state_known_to_new(device); 375 rc = dasd_state_known_to_new(device);
354 376
355 return 0; 377 return rc;
356} 378}
357 379
358/* 380/*
@@ -701,6 +723,7 @@ dasd_term_IO(struct dasd_ccw_req * cqr)
701 cqr->retries--; 723 cqr->retries--;
702 cqr->status = DASD_CQR_CLEAR; 724 cqr->status = DASD_CQR_CLEAR;
703 cqr->stopclk = get_clock(); 725 cqr->stopclk = get_clock();
726 cqr->starttime = 0;
704 DBF_DEV_EVENT(DBF_DEBUG, device, 727 DBF_DEV_EVENT(DBF_DEBUG, device,
705 "terminate cqr %p successful", 728 "terminate cqr %p successful",
706 cqr); 729 cqr);
@@ -978,6 +1001,7 @@ dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
978 irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { 1001 irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) {
979 cqr->status = DASD_CQR_QUEUED; 1002 cqr->status = DASD_CQR_QUEUED;
980 dasd_clear_timer(device); 1003 dasd_clear_timer(device);
1004 wake_up(&dasd_flush_wq);
981 dasd_schedule_bh(device); 1005 dasd_schedule_bh(device);
982 return; 1006 return;
983 } 1007 }
@@ -1241,6 +1265,10 @@ __dasd_check_expire(struct dasd_device * device)
1241 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); 1265 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
1242 if (cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) { 1266 if (cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) {
1243 if (time_after_eq(jiffies, cqr->expires + cqr->starttime)) { 1267 if (time_after_eq(jiffies, cqr->expires + cqr->starttime)) {
1268 DEV_MESSAGE(KERN_ERR, device,
1269 "internal error - timeout (%is) expired "
1270 "for cqr %p (%i retries left)",
1271 (cqr->expires/HZ), cqr, cqr->retries);
1244 if (device->discipline->term_IO(cqr) != 0) 1272 if (device->discipline->term_IO(cqr) != 0)
1245 /* Hmpf, try again in 1/10 sec */ 1273 /* Hmpf, try again in 1/10 sec */
1246 dasd_set_timer(device, 10); 1274 dasd_set_timer(device, 10);
@@ -1285,46 +1313,100 @@ __dasd_start_head(struct dasd_device * device)
1285 dasd_set_timer(device, 50); 1313 dasd_set_timer(device, 50);
1286} 1314}
1287 1315
1316static inline int
1317_wait_for_clear(struct dasd_ccw_req *cqr)
1318{
1319 return (cqr->status == DASD_CQR_QUEUED);
1320}
1321
1288/* 1322/*
1289 * Remove requests from the ccw queue. 1323 * Remove all requests from the ccw queue (all = '1') or only block device
1324 * requests in case all = '0'.
1325 * Take care of the erp-chain (chained via cqr->refers) and remove either
1326 * the whole erp-chain or none of the erp-requests.
1327 * If a request is currently running, term_IO is called and the request
1328 * is re-queued. Prior to removing the terminated request we need to wait
1329 * for the clear-interrupt.
1330 * In case termination is not possible we stop processing and just finishing
1331 * the already moved requests.
1290 */ 1332 */
1291static void 1333static int
1292dasd_flush_ccw_queue(struct dasd_device * device, int all) 1334dasd_flush_ccw_queue(struct dasd_device * device, int all)
1293{ 1335{
1336 struct dasd_ccw_req *cqr, *orig, *n;
1337 int rc, i;
1338
1294 struct list_head flush_queue; 1339 struct list_head flush_queue;
1295 struct list_head *l, *n;
1296 struct dasd_ccw_req *cqr;
1297 1340
1298 INIT_LIST_HEAD(&flush_queue); 1341 INIT_LIST_HEAD(&flush_queue);
1299 spin_lock_irq(get_ccwdev_lock(device->cdev)); 1342 spin_lock_irq(get_ccwdev_lock(device->cdev));
1300 list_for_each_safe(l, n, &device->ccw_queue) { 1343 rc = 0;
1301 cqr = list_entry(l, struct dasd_ccw_req, list); 1344restart:
1345 list_for_each_entry_safe(cqr, n, &device->ccw_queue, list) {
1346 /* get original request of erp request-chain */
1347 for (orig = cqr; orig->refers != NULL; orig = orig->refers);
1348
1302 /* Flush all request or only block device requests? */ 1349 /* Flush all request or only block device requests? */
1303 if (all == 0 && cqr->callback == dasd_end_request_cb) 1350 if (all == 0 && cqr->callback != dasd_end_request_cb &&
1351 orig->callback != dasd_end_request_cb) {
1304 continue; 1352 continue;
1305 if (cqr->status == DASD_CQR_IN_IO) 1353 }
1306 device->discipline->term_IO(cqr); 1354 /* Check status and move request to flush_queue */
1307 if (cqr->status != DASD_CQR_DONE || 1355 switch (cqr->status) {
1308 cqr->status != DASD_CQR_FAILED) { 1356 case DASD_CQR_IN_IO:
1309 cqr->status = DASD_CQR_FAILED; 1357 rc = device->discipline->term_IO(cqr);
1358 if (rc) {
1359 /* unable to terminate requeust */
1360 DEV_MESSAGE(KERN_ERR, device,
1361 "dasd flush ccw_queue is unable "
1362 " to terminate request %p",
1363 cqr);
1364 /* stop flush processing */
1365 goto finished;
1366 }
1367 break;
1368 case DASD_CQR_QUEUED:
1369 case DASD_CQR_ERROR:
1370 /* set request to FAILED */
1310 cqr->stopclk = get_clock(); 1371 cqr->stopclk = get_clock();
1372 cqr->status = DASD_CQR_FAILED;
1373 break;
1374 default: /* do not touch the others */
1375 break;
1376 }
1377 /* Rechain request (including erp chain) */
1378 for (i = 0; cqr != NULL; cqr = cqr->refers, i++) {
1379 cqr->endclk = get_clock();
1380 list_move_tail(&cqr->list, &flush_queue);
1381 }
1382 if (i > 1)
1383 /* moved more than one request - need to restart */
1384 goto restart;
1385 }
1386
1387finished:
1388 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1389 /* Now call the callback function of flushed requests */
1390restart_cb:
1391 list_for_each_entry_safe(cqr, n, &flush_queue, list) {
1392 if (cqr->status == DASD_CQR_CLEAR) {
1393 /* wait for clear interrupt! */
1394 wait_event(dasd_flush_wq, _wait_for_clear(cqr));
1395 cqr->status = DASD_CQR_FAILED;
1311 } 1396 }
1312 /* Process finished ERP request. */ 1397 /* Process finished ERP request. */
1313 if (cqr->refers) { 1398 if (cqr->refers) {
1314 __dasd_process_erp(device, cqr); 1399 __dasd_process_erp(device, cqr);
1315 continue; 1400 /* restart list_for_xx loop since dasd_process_erp
1401 * might remove multiple elements */
1402 goto restart_cb;
1316 } 1403 }
1317 /* Rechain request on device request queue */ 1404 /* call the callback function */
1318 cqr->endclk = get_clock(); 1405 cqr->endclk = get_clock();
1319 list_move_tail(&cqr->list, &flush_queue);
1320 }
1321 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1322 /* Now call the callback function of flushed requests */
1323 list_for_each_safe(l, n, &flush_queue) {
1324 cqr = list_entry(l, struct dasd_ccw_req, list);
1325 if (cqr->callback != NULL) 1406 if (cqr->callback != NULL)
1326 (cqr->callback)(cqr, cqr->callback_data); 1407 (cqr->callback)(cqr, cqr->callback_data);
1327 } 1408 }
1409 return rc;
1328} 1410}
1329 1411
1330/* 1412/*
@@ -1510,10 +1592,8 @@ dasd_sleep_on_interruptible(struct dasd_ccw_req * cqr)
1510 if (device->discipline->term_IO) { 1592 if (device->discipline->term_IO) {
1511 cqr->retries = -1; 1593 cqr->retries = -1;
1512 device->discipline->term_IO(cqr); 1594 device->discipline->term_IO(cqr);
1513 /*nished = 1595 /* wait (non-interruptible) for final status
1514 * wait (non-interruptible) for final status 1596 * because signal ist still pending */
1515 * because signal ist still pending
1516 */
1517 spin_unlock_irq(get_ccwdev_lock(device->cdev)); 1597 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1518 wait_event(wait_q, _wait_for_wakeup(cqr)); 1598 wait_event(wait_q, _wait_for_wakeup(cqr));
1519 spin_lock_irq(get_ccwdev_lock(device->cdev)); 1599 spin_lock_irq(get_ccwdev_lock(device->cdev));
@@ -1546,19 +1626,11 @@ static inline int
1546_dasd_term_running_cqr(struct dasd_device *device) 1626_dasd_term_running_cqr(struct dasd_device *device)
1547{ 1627{
1548 struct dasd_ccw_req *cqr; 1628 struct dasd_ccw_req *cqr;
1549 int rc;
1550 1629
1551 if (list_empty(&device->ccw_queue)) 1630 if (list_empty(&device->ccw_queue))
1552 return 0; 1631 return 0;
1553 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); 1632 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
1554 rc = device->discipline->term_IO(cqr); 1633 return device->discipline->term_IO(cqr);
1555 if (rc == 0) {
1556 /* termination successful */
1557 cqr->status = DASD_CQR_QUEUED;
1558 cqr->startclk = cqr->stopclk = 0;
1559 cqr->starttime = 0;
1560 }
1561 return rc;
1562} 1634}
1563 1635
1564int 1636int
@@ -1726,10 +1798,7 @@ dasd_flush_request_queue(struct dasd_device * device)
1726 return; 1798 return;
1727 1799
1728 spin_lock_irq(&device->request_queue_lock); 1800 spin_lock_irq(&device->request_queue_lock);
1729 while (!list_empty(&device->request_queue->queue_head)) { 1801 while ((req = elv_next_request(device->request_queue))) {
1730 req = elv_next_request(device->request_queue);
1731 if (req == NULL)
1732 break;
1733 blkdev_dequeue_request(req); 1802 blkdev_dequeue_request(req);
1734 dasd_end_request(req, 0); 1803 dasd_end_request(req, 0);
1735 } 1804 }
@@ -2091,6 +2160,7 @@ dasd_init(void)
2091 int rc; 2160 int rc;
2092 2161
2093 init_waitqueue_head(&dasd_init_waitq); 2162 init_waitqueue_head(&dasd_init_waitq);
2163 init_waitqueue_head(&dasd_flush_wq);
2094 2164
2095 /* register 'common' DASD debug area, used for all DBF_XXX calls */ 2165 /* register 'common' DASD debug area, used for all DBF_XXX calls */
2096 dasd_debug_area = debug_register("dasd", 1, 2, 8 * sizeof (long)); 2166 dasd_debug_area = debug_register("dasd", 1, 2, 8 * sizeof (long));
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index 4c272b70f41a..d163632101d2 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -83,10 +83,12 @@ dasd_gendisk_alloc(struct dasd_device *device)
83void 83void
84dasd_gendisk_free(struct dasd_device *device) 84dasd_gendisk_free(struct dasd_device *device)
85{ 85{
86 del_gendisk(device->gdp); 86 if (device->gdp) {
87 device->gdp->queue = NULL; 87 del_gendisk(device->gdp);
88 put_disk(device->gdp); 88 device->gdp->queue = NULL;
89 device->gdp = NULL; 89 put_disk(device->gdp);
90 device->gdp = NULL;
91 }
90} 92}
91 93
92/* 94/*
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 3cba6c9fab11..38954f5cd14c 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -183,11 +183,9 @@ ccwgroup_create(struct device *root,
183 183
184 gdev->creator_id = creator_id; 184 gdev->creator_id = creator_id;
185 gdev->count = argc; 185 gdev->count = argc;
186 gdev->dev = (struct device ) { 186 gdev->dev.bus = &ccwgroup_bus_type;
187 .bus = &ccwgroup_bus_type, 187 gdev->dev.parent = root;
188 .parent = root, 188 gdev->dev.release = ccwgroup_release;
189 .release = ccwgroup_release,
190 };
191 189
192 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", 190 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s",
193 gdev->cdev[0]->dev.bus_id); 191 gdev->cdev[0]->dev.bus_id);
@@ -391,10 +389,8 @@ int
391ccwgroup_driver_register (struct ccwgroup_driver *cdriver) 389ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
392{ 390{
393 /* register our new driver with the core */ 391 /* register our new driver with the core */
394 cdriver->driver = (struct device_driver) { 392 cdriver->driver.bus = &ccwgroup_bus_type;
395 .bus = &ccwgroup_bus_type, 393 cdriver->driver.name = cdriver->name;
396 .name = cdriver->name,
397 };
398 394
399 return driver_register(&cdriver->driver); 395 return driver_register(&cdriver->driver);
400} 396}
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 61ce3f1d5228..c28444af0919 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -238,8 +238,6 @@ s390_subchannel_remove_chpid(struct device *dev, void *data)
238 /* Check for single path devices. */ 238 /* Check for single path devices. */
239 if (sch->schib.pmcw.pim == 0x80) 239 if (sch->schib.pmcw.pim == 0x80)
240 goto out_unreg; 240 goto out_unreg;
241 if (sch->vpm == mask)
242 goto out_unreg;
243 241
244 if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) && 242 if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) &&
245 (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) && 243 (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) &&
@@ -258,6 +256,8 @@ s390_subchannel_remove_chpid(struct device *dev, void *data)
258 /* trigger path verification. */ 256 /* trigger path verification. */
259 if (sch->driver && sch->driver->verify) 257 if (sch->driver && sch->driver->verify)
260 sch->driver->verify(&sch->dev); 258 sch->driver->verify(&sch->dev);
259 else if (sch->vpm == mask)
260 goto out_unreg;
261out_unlock: 261out_unlock:
262 spin_unlock_irq(&sch->lock); 262 spin_unlock_irq(&sch->lock);
263 return 0; 263 return 0;
@@ -1391,10 +1391,8 @@ new_channel_path(int chpid)
1391 /* fill in status, etc. */ 1391 /* fill in status, etc. */
1392 chp->id = chpid; 1392 chp->id = chpid;
1393 chp->state = 1; 1393 chp->state = 1;
1394 chp->dev = (struct device) { 1394 chp->dev.parent = &css[0]->device;
1395 .parent = &css[0]->device, 1395 chp->dev.release = chp_release;
1396 .release = chp_release,
1397 };
1398 snprintf(chp->dev.bus_id, BUS_ID_SIZE, "chp0.%x", chpid); 1396 snprintf(chp->dev.bus_id, BUS_ID_SIZE, "chp0.%x", chpid);
1399 1397
1400 /* Obtain channel path description and fill it in. */ 1398 /* Obtain channel path description and fill it in. */
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 585fa04233c3..646da5640401 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -556,12 +556,11 @@ get_disc_ccwdev_by_devno(unsigned int devno, unsigned int ssid,
556 struct ccw_device *sibling) 556 struct ccw_device *sibling)
557{ 557{
558 struct device *dev; 558 struct device *dev;
559 struct match_data data = { 559 struct match_data data;
560 .devno = devno,
561 .ssid = ssid,
562 .sibling = sibling,
563 };
564 560
561 data.devno = devno;
562 data.ssid = ssid;
563 data.sibling = sibling;
565 dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno); 564 dev = bus_find_device(&ccw_bus_type, NULL, &data, match_devno);
566 565
567 return dev ? to_ccwdev(dev) : NULL; 566 return dev ? to_ccwdev(dev) : NULL;
@@ -835,10 +834,8 @@ io_subchannel_probe (struct subchannel *sch)
835 return -ENOMEM; 834 return -ENOMEM;
836 } 835 }
837 atomic_set(&cdev->private->onoff, 0); 836 atomic_set(&cdev->private->onoff, 0);
838 cdev->dev = (struct device) { 837 cdev->dev.parent = &sch->dev;
839 .parent = &sch->dev, 838 cdev->dev.release = ccw_device_release;
840 .release = ccw_device_release,
841 };
842 INIT_LIST_HEAD(&cdev->private->kick_work.entry); 839 INIT_LIST_HEAD(&cdev->private->kick_work.entry);
843 /* Do first half of device_register. */ 840 /* Do first half of device_register. */
844 device_initialize(&cdev->dev); 841 device_initialize(&cdev->dev);
@@ -977,9 +974,7 @@ ccw_device_console_enable (struct ccw_device *cdev, struct subchannel *sch)
977 int rc; 974 int rc;
978 975
979 /* Initialize the ccw_device structure. */ 976 /* Initialize the ccw_device structure. */
980 cdev->dev = (struct device) { 977 cdev->dev.parent= &sch->dev;
981 .parent = &sch->dev,
982 };
983 rc = io_subchannel_recog(cdev, sch); 978 rc = io_subchannel_recog(cdev, sch);
984 if (rc) 979 if (rc)
985 return rc; 980 return rc;
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 6d91c2eb205b..35e162ba6d54 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -267,12 +267,10 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
267 notify = 1; 267 notify = 1;
268 } 268 }
269 /* fill out sense information */ 269 /* fill out sense information */
270 cdev->id = (struct ccw_device_id) { 270 cdev->id.cu_type = cdev->private->senseid.cu_type;
271 .cu_type = cdev->private->senseid.cu_type, 271 cdev->id.cu_model = cdev->private->senseid.cu_model;
272 .cu_model = cdev->private->senseid.cu_model, 272 cdev->id.dev_type = cdev->private->senseid.dev_type;
273 .dev_type = cdev->private->senseid.dev_type, 273 cdev->id.dev_model = cdev->private->senseid.dev_model;
274 .dev_model = cdev->private->senseid.dev_model,
275 };
276 if (notify) { 274 if (notify) {
277 cdev->private->state = DEV_STATE_OFFLINE; 275 cdev->private->state = DEV_STATE_OFFLINE;
278 if (same_dev) { 276 if (same_dev) {
@@ -566,12 +564,10 @@ ccw_device_verify_done(struct ccw_device *cdev, int err)
566 /* Deliver fake irb to device driver, if needed. */ 564 /* Deliver fake irb to device driver, if needed. */
567 if (cdev->private->flags.fake_irb) { 565 if (cdev->private->flags.fake_irb) {
568 memset(&cdev->private->irb, 0, sizeof(struct irb)); 566 memset(&cdev->private->irb, 0, sizeof(struct irb));
569 cdev->private->irb.scsw = (struct scsw) { 567 cdev->private->irb.scsw.cc = 1;
570 .cc = 1, 568 cdev->private->irb.scsw.fctl = SCSW_FCTL_START_FUNC;
571 .fctl = SCSW_FCTL_START_FUNC, 569 cdev->private->irb.scsw.actl = SCSW_ACTL_START_PEND;
572 .actl = SCSW_ACTL_START_PEND, 570 cdev->private->irb.scsw.stctl = SCSW_STCTL_STATUS_PEND;
573 .stctl = SCSW_STCTL_STATUS_PEND,
574 };
575 cdev->private->flags.fake_irb = 0; 571 cdev->private->flags.fake_irb = 0;
576 if (cdev->handler) 572 if (cdev->handler)
577 cdev->handler(cdev, cdev->private->intparm, 573 cdev->handler(cdev, cdev->private->intparm,
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
index 32610fd8868e..1693a102dcfe 100644
--- a/drivers/s390/cio/device_pgid.c
+++ b/drivers/s390/cio/device_pgid.c
@@ -24,6 +24,21 @@
24#include "ioasm.h" 24#include "ioasm.h"
25 25
26/* 26/*
27 * Helper function called from interrupt context to decide whether an
28 * operation should be tried again.
29 */
30static int __ccw_device_should_retry(struct scsw *scsw)
31{
32 /* CC is only valid if start function bit is set. */
33 if ((scsw->fctl & SCSW_FCTL_START_FUNC) && scsw->cc == 1)
34 return 1;
35 /* No more activity. For sense and set PGID we stubbornly try again. */
36 if (!scsw->actl)
37 return 1;
38 return 0;
39}
40
41/*
27 * Start Sense Path Group ID helper function. Used in ccw_device_recog 42 * Start Sense Path Group ID helper function. Used in ccw_device_recog
28 * and ccw_device_sense_pgid. 43 * and ccw_device_sense_pgid.
29 */ 44 */
@@ -155,10 +170,10 @@ ccw_device_sense_pgid_irq(struct ccw_device *cdev, enum dev_event dev_event)
155 int ret; 170 int ret;
156 171
157 irb = (struct irb *) __LC_IRB; 172 irb = (struct irb *) __LC_IRB;
158 /* Retry sense pgid for cc=1. */ 173
159 if (irb->scsw.stctl == 174 if (irb->scsw.stctl ==
160 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) { 175 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
161 if (irb->scsw.cc == 1) { 176 if (__ccw_device_should_retry(&irb->scsw)) {
162 ret = __ccw_device_sense_pgid_start(cdev); 177 ret = __ccw_device_sense_pgid_start(cdev);
163 if (ret && ret != -EBUSY) 178 if (ret && ret != -EBUSY)
164 ccw_device_sense_pgid_done(cdev, ret); 179 ccw_device_sense_pgid_done(cdev, ret);
@@ -391,10 +406,10 @@ ccw_device_verify_irq(struct ccw_device *cdev, enum dev_event dev_event)
391 int ret; 406 int ret;
392 407
393 irb = (struct irb *) __LC_IRB; 408 irb = (struct irb *) __LC_IRB;
394 /* Retry set pgid for cc=1. */ 409
395 if (irb->scsw.stctl == 410 if (irb->scsw.stctl ==
396 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) { 411 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
397 if (irb->scsw.cc == 1) 412 if (__ccw_device_should_retry(&irb->scsw))
398 __ccw_device_verify_start(cdev); 413 __ccw_device_verify_start(cdev);
399 return; 414 return;
400 } 415 }
@@ -494,10 +509,10 @@ ccw_device_disband_irq(struct ccw_device *cdev, enum dev_event dev_event)
494 int ret; 509 int ret;
495 510
496 irb = (struct irb *) __LC_IRB; 511 irb = (struct irb *) __LC_IRB;
497 /* Retry set pgid for cc=1. */ 512
498 if (irb->scsw.stctl == 513 if (irb->scsw.stctl ==
499 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) { 514 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
500 if (irb->scsw.cc == 1) 515 if (__ccw_device_should_retry(&irb->scsw))
501 __ccw_device_disband_start(cdev); 516 __ccw_device_disband_start(cdev);
502 return; 517 return;
503 } 518 }