Lines Matching refs:device

104 	struct dasd_device *device;  in dasd_alloc_device()  local
106 device = kzalloc(sizeof(struct dasd_device), GFP_ATOMIC); in dasd_alloc_device()
107 if (!device) in dasd_alloc_device()
111 device->ccw_mem = (void *) __get_free_pages(GFP_ATOMIC | GFP_DMA, 1); in dasd_alloc_device()
112 if (!device->ccw_mem) { in dasd_alloc_device()
113 kfree(device); in dasd_alloc_device()
117 device->erp_mem = (void *) get_zeroed_page(GFP_ATOMIC | GFP_DMA); in dasd_alloc_device()
118 if (!device->erp_mem) { in dasd_alloc_device()
119 free_pages((unsigned long) device->ccw_mem, 1); in dasd_alloc_device()
120 kfree(device); in dasd_alloc_device()
124 dasd_init_chunklist(&device->ccw_chunks, device->ccw_mem, PAGE_SIZE*2); in dasd_alloc_device()
125 dasd_init_chunklist(&device->erp_chunks, device->erp_mem, PAGE_SIZE); in dasd_alloc_device()
126 spin_lock_init(&device->mem_lock); in dasd_alloc_device()
127 atomic_set(&device->tasklet_scheduled, 0); in dasd_alloc_device()
128 tasklet_init(&device->tasklet, dasd_device_tasklet, in dasd_alloc_device()
129 (unsigned long) device); in dasd_alloc_device()
130 INIT_LIST_HEAD(&device->ccw_queue); in dasd_alloc_device()
131 timer_setup(&device->timer, dasd_device_timeout, 0); in dasd_alloc_device()
132 INIT_WORK(&device->kick_work, do_kick_device); in dasd_alloc_device()
133 INIT_WORK(&device->restore_device, do_restore_device); in dasd_alloc_device()
134 INIT_WORK(&device->reload_device, do_reload_device); in dasd_alloc_device()
135 INIT_WORK(&device->requeue_requests, do_requeue_requests); in dasd_alloc_device()
136 device->state = DASD_STATE_NEW; in dasd_alloc_device()
137 device->target = DASD_STATE_NEW; in dasd_alloc_device()
138 mutex_init(&device->state_mutex); in dasd_alloc_device()
139 spin_lock_init(&device->profile.lock); in dasd_alloc_device()
140 return device; in dasd_alloc_device()
146 void dasd_free_device(struct dasd_device *device) in dasd_free_device() argument
148 kfree(device->private); in dasd_free_device()
149 free_page((unsigned long) device->erp_mem); in dasd_free_device()
150 free_pages((unsigned long) device->ccw_mem, 1); in dasd_free_device()
151 kfree(device); in dasd_free_device()
191 static int dasd_state_new_to_known(struct dasd_device *device) in dasd_state_new_to_known() argument
199 dasd_get_device(device); in dasd_state_new_to_known()
201 if (device->block) { in dasd_state_new_to_known()
202 rc = dasd_alloc_queue(device->block); in dasd_state_new_to_known()
204 dasd_put_device(device); in dasd_state_new_to_known()
208 device->state = DASD_STATE_KNOWN; in dasd_state_new_to_known()
215 static int dasd_state_known_to_new(struct dasd_device *device) in dasd_state_known_to_new() argument
218 dasd_eer_disable(device); in dasd_state_known_to_new()
219 device->state = DASD_STATE_NEW; in dasd_state_known_to_new()
221 if (device->block) in dasd_state_known_to_new()
222 dasd_free_queue(device->block); in dasd_state_known_to_new()
225 dasd_put_device(device); in dasd_state_known_to_new()
245 static int dasd_state_known_to_basic(struct dasd_device *device) in dasd_state_known_to_basic() argument
247 struct dasd_block *block = device->block; in dasd_state_known_to_basic()
260 dasd_profile_on(&device->block->profile); in dasd_state_known_to_basic()
262 device->debugfs_dentry = in dasd_state_known_to_basic()
263 dasd_debugfs_setup(dev_name(&device->cdev->dev), in dasd_state_known_to_basic()
265 dasd_profile_init(&device->profile, device->debugfs_dentry); in dasd_state_known_to_basic()
266 dasd_hosts_init(device->debugfs_dentry, device); in dasd_state_known_to_basic()
269 device->debug_area = debug_register(dev_name(&device->cdev->dev), 4, 1, in dasd_state_known_to_basic()
271 debug_register_view(device->debug_area, &debug_sprintf_view); in dasd_state_known_to_basic()
272 debug_set_level(device->debug_area, DBF_WARNING); in dasd_state_known_to_basic()
273 DBF_DEV_EVENT(DBF_EMERG, device, "%s", "debug area created"); in dasd_state_known_to_basic()
275 device->state = DASD_STATE_BASIC; in dasd_state_known_to_basic()
283 static int dasd_state_basic_to_known(struct dasd_device *device) in dasd_state_basic_to_known() argument
287 if (device->discipline->basic_to_known) { in dasd_state_basic_to_known()
288 rc = device->discipline->basic_to_known(device); in dasd_state_basic_to_known()
293 if (device->block) { in dasd_state_basic_to_known()
294 dasd_profile_exit(&device->block->profile); in dasd_state_basic_to_known()
295 debugfs_remove(device->block->debugfs_dentry); in dasd_state_basic_to_known()
296 dasd_gendisk_free(device->block); in dasd_state_basic_to_known()
297 dasd_block_clear_timer(device->block); in dasd_state_basic_to_known()
299 rc = dasd_flush_device_queue(device); in dasd_state_basic_to_known()
302 dasd_device_clear_timer(device); in dasd_state_basic_to_known()
303 dasd_profile_exit(&device->profile); in dasd_state_basic_to_known()
304 dasd_hosts_exit(device); in dasd_state_basic_to_known()
305 debugfs_remove(device->debugfs_dentry); in dasd_state_basic_to_known()
306 DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device); in dasd_state_basic_to_known()
307 if (device->debug_area != NULL) { in dasd_state_basic_to_known()
308 debug_unregister(device->debug_area); in dasd_state_basic_to_known()
309 device->debug_area = NULL; in dasd_state_basic_to_known()
311 device->state = DASD_STATE_KNOWN; in dasd_state_basic_to_known()
329 static int dasd_state_basic_to_ready(struct dasd_device *device) in dasd_state_basic_to_ready() argument
336 block = device->block; in dasd_state_basic_to_ready()
343 device->state = DASD_STATE_UNFMT; in dasd_state_basic_to_ready()
344 disk = device->block->gdp; in dasd_state_basic_to_ready()
354 device->state = DASD_STATE_READY; in dasd_state_basic_to_ready()
357 device->state = DASD_STATE_BASIC; in dasd_state_basic_to_ready()
361 device->state = DASD_STATE_READY; in dasd_state_basic_to_ready()
364 if (device->discipline->basic_to_ready) in dasd_state_basic_to_ready()
365 rc = device->discipline->basic_to_ready(device); in dasd_state_basic_to_ready()
370 int _wait_for_empty_queues(struct dasd_device *device) in _wait_for_empty_queues() argument
372 if (device->block) in _wait_for_empty_queues()
373 return list_empty(&device->ccw_queue) && in _wait_for_empty_queues()
374 list_empty(&device->block->ccw_queue); in _wait_for_empty_queues()
376 return list_empty(&device->ccw_queue); in _wait_for_empty_queues()
384 static int dasd_state_ready_to_basic(struct dasd_device *device) in dasd_state_ready_to_basic() argument
388 device->state = DASD_STATE_BASIC; in dasd_state_ready_to_basic()
389 if (device->block) { in dasd_state_ready_to_basic()
390 struct dasd_block *block = device->block; in dasd_state_ready_to_basic()
393 device->state = DASD_STATE_READY; in dasd_state_ready_to_basic()
407 static int dasd_state_unfmt_to_basic(struct dasd_device *device) in dasd_state_unfmt_to_basic() argument
409 device->state = DASD_STATE_BASIC; in dasd_state_unfmt_to_basic()
419 dasd_state_ready_to_online(struct dasd_device * device) in dasd_state_ready_to_online() argument
425 device->state = DASD_STATE_ONLINE; in dasd_state_ready_to_online()
426 if (device->block) { in dasd_state_ready_to_online()
427 dasd_schedule_block_bh(device->block); in dasd_state_ready_to_online()
428 if ((device->features & DASD_FEATURE_USERAW)) { in dasd_state_ready_to_online()
429 disk = device->block->gdp; in dasd_state_ready_to_online()
433 disk = device->block->bdev->bd_disk; in dasd_state_ready_to_online()
445 static int dasd_state_online_to_ready(struct dasd_device *device) in dasd_state_online_to_ready() argument
452 if (device->discipline->online_to_ready) { in dasd_state_online_to_ready()
453 rc = device->discipline->online_to_ready(device); in dasd_state_online_to_ready()
458 device->state = DASD_STATE_READY; in dasd_state_online_to_ready()
459 if (device->block && !(device->features & DASD_FEATURE_USERAW)) { in dasd_state_online_to_ready()
460 disk = device->block->bdev->bd_disk; in dasd_state_online_to_ready()
472 static int dasd_increase_state(struct dasd_device *device) in dasd_increase_state() argument
477 if (device->state == DASD_STATE_NEW && in dasd_increase_state()
478 device->target >= DASD_STATE_KNOWN) in dasd_increase_state()
479 rc = dasd_state_new_to_known(device); in dasd_increase_state()
482 device->state == DASD_STATE_KNOWN && in dasd_increase_state()
483 device->target >= DASD_STATE_BASIC) in dasd_increase_state()
484 rc = dasd_state_known_to_basic(device); in dasd_increase_state()
487 device->state == DASD_STATE_BASIC && in dasd_increase_state()
488 device->target >= DASD_STATE_READY) in dasd_increase_state()
489 rc = dasd_state_basic_to_ready(device); in dasd_increase_state()
492 device->state == DASD_STATE_UNFMT && in dasd_increase_state()
493 device->target > DASD_STATE_UNFMT) in dasd_increase_state()
497 device->state == DASD_STATE_READY && in dasd_increase_state()
498 device->target >= DASD_STATE_ONLINE) in dasd_increase_state()
499 rc = dasd_state_ready_to_online(device); in dasd_increase_state()
507 static int dasd_decrease_state(struct dasd_device *device) in dasd_decrease_state() argument
512 if (device->state == DASD_STATE_ONLINE && in dasd_decrease_state()
513 device->target <= DASD_STATE_READY) in dasd_decrease_state()
514 rc = dasd_state_online_to_ready(device); in dasd_decrease_state()
517 device->state == DASD_STATE_READY && in dasd_decrease_state()
518 device->target <= DASD_STATE_BASIC) in dasd_decrease_state()
519 rc = dasd_state_ready_to_basic(device); in dasd_decrease_state()
522 device->state == DASD_STATE_UNFMT && in dasd_decrease_state()
523 device->target <= DASD_STATE_BASIC) in dasd_decrease_state()
524 rc = dasd_state_unfmt_to_basic(device); in dasd_decrease_state()
527 device->state == DASD_STATE_BASIC && in dasd_decrease_state()
528 device->target <= DASD_STATE_KNOWN) in dasd_decrease_state()
529 rc = dasd_state_basic_to_known(device); in dasd_decrease_state()
532 device->state == DASD_STATE_KNOWN && in dasd_decrease_state()
533 device->target <= DASD_STATE_NEW) in dasd_decrease_state()
534 rc = dasd_state_known_to_new(device); in dasd_decrease_state()
542 static void dasd_change_state(struct dasd_device *device) in dasd_change_state() argument
546 if (device->state == device->target) in dasd_change_state()
549 if (device->state < device->target) in dasd_change_state()
550 rc = dasd_increase_state(device); in dasd_change_state()
552 rc = dasd_decrease_state(device); in dasd_change_state()
556 device->target = device->state; in dasd_change_state()
559 kobject_uevent(&device->cdev->dev.kobj, KOBJ_CHANGE); in dasd_change_state()
561 if (device->state == device->target) in dasd_change_state()
573 struct dasd_device *device = container_of(work, struct dasd_device, kick_work); in do_kick_device() local
574 mutex_lock(&device->state_mutex); in do_kick_device()
575 dasd_change_state(device); in do_kick_device()
576 mutex_unlock(&device->state_mutex); in do_kick_device()
577 dasd_schedule_device_bh(device); in do_kick_device()
578 dasd_put_device(device); in do_kick_device()
581 void dasd_kick_device(struct dasd_device *device) in dasd_kick_device() argument
583 dasd_get_device(device); in dasd_kick_device()
585 if (!schedule_work(&device->kick_work)) in dasd_kick_device()
586 dasd_put_device(device); in dasd_kick_device()
596 struct dasd_device *device = container_of(work, struct dasd_device, in do_reload_device() local
598 device->discipline->reload(device); in do_reload_device()
599 dasd_put_device(device); in do_reload_device()
602 void dasd_reload_device(struct dasd_device *device) in dasd_reload_device() argument
604 dasd_get_device(device); in dasd_reload_device()
606 if (!schedule_work(&device->reload_device)) in dasd_reload_device()
607 dasd_put_device(device); in dasd_reload_device()
617 struct dasd_device *device = container_of(work, struct dasd_device, in do_restore_device() local
619 device->cdev->drv->restore(device->cdev); in do_restore_device()
620 dasd_put_device(device); in do_restore_device()
623 void dasd_restore_device(struct dasd_device *device) in dasd_restore_device() argument
625 dasd_get_device(device); in dasd_restore_device()
627 if (!schedule_work(&device->restore_device)) in dasd_restore_device()
628 dasd_put_device(device); in dasd_restore_device()
634 void dasd_set_target_state(struct dasd_device *device, int target) in dasd_set_target_state() argument
636 dasd_get_device(device); in dasd_set_target_state()
637 mutex_lock(&device->state_mutex); in dasd_set_target_state()
641 if (device->target != target) { in dasd_set_target_state()
642 if (device->state == target) in dasd_set_target_state()
644 device->target = target; in dasd_set_target_state()
646 if (device->state != device->target) in dasd_set_target_state()
647 dasd_change_state(device); in dasd_set_target_state()
648 mutex_unlock(&device->state_mutex); in dasd_set_target_state()
649 dasd_put_device(device); in dasd_set_target_state()
656 static inline int _wait_for_device(struct dasd_device *device) in _wait_for_device() argument
658 return (device->state == device->target); in _wait_for_device()
661 void dasd_enable_device(struct dasd_device *device) in dasd_enable_device() argument
663 dasd_set_target_state(device, DASD_STATE_ONLINE); in dasd_enable_device()
664 if (device->state <= DASD_STATE_KNOWN) in dasd_enable_device()
666 dasd_set_target_state(device, DASD_STATE_NEW); in dasd_enable_device()
668 wait_event(dasd_init_waitq, _wait_for_device(device)); in dasd_enable_device()
670 dasd_reload_device(device); in dasd_enable_device()
671 if (device->discipline->kick_validate) in dasd_enable_device()
672 device->discipline->kick_validate(device); in dasd_enable_device()
697 struct dasd_device *device; in dasd_profile_start() local
727 device = cqr->startdev; in dasd_profile_start()
728 if (device->profile.data) { in dasd_profile_start()
730 list_for_each(l, &device->ccw_queue) in dasd_profile_start()
734 spin_lock(&device->profile.lock); in dasd_profile_start()
735 if (device->profile.data) { in dasd_profile_start()
736 device->profile.data->dasd_io_nr_req[counter]++; in dasd_profile_start()
738 device->profile.data->dasd_read_nr_req[counter]++; in dasd_profile_start()
740 spin_unlock(&device->profile.lock); in dasd_profile_start()
807 struct dasd_device *device; in dasd_profile_end() local
812 device = cqr->startdev; in dasd_profile_end()
815 device->profile.data)) in dasd_profile_end()
874 spin_lock(&device->profile.lock); in dasd_profile_end()
875 if (device->profile.data) { in dasd_profile_end()
876 data = device->profile.data; in dasd_profile_end()
881 dasd_profile_end_add_data(device->profile.data, in dasd_profile_end()
890 spin_unlock(&device->profile.lock); in dasd_profile_end()
1182 struct dasd_device *device; in dasd_hosts_show() local
1185 device = m->private; in dasd_hosts_show()
1186 dasd_get_device(device); in dasd_hosts_show()
1188 if (device->discipline->hosts_print) in dasd_hosts_show()
1189 rc = device->discipline->hosts_print(device, m); in dasd_hosts_show()
1191 dasd_put_device(device); in dasd_hosts_show()
1197 struct dasd_device *device = inode->i_private; in dasd_hosts_open() local
1199 return single_open(file, dasd_hosts_show, device); in dasd_hosts_open()
1210 static void dasd_hosts_exit(struct dasd_device *device) in dasd_hosts_exit() argument
1212 debugfs_remove(device->hosts_dentry); in dasd_hosts_exit()
1213 device->hosts_dentry = NULL; in dasd_hosts_exit()
1217 struct dasd_device *device) in dasd_hosts_init() argument
1227 device, &dasd_hosts_fops); in dasd_hosts_init()
1229 device->hosts_dentry = pde; in dasd_hosts_init()
1233 struct dasd_device *device, in dasd_smalloc_request() argument
1247 spin_lock_irqsave(&device->mem_lock, flags); in dasd_smalloc_request()
1248 data = chunk = dasd_alloc_chunk(&device->ccw_chunks, size); in dasd_smalloc_request()
1249 spin_unlock_irqrestore(&device->mem_lock, flags); in dasd_smalloc_request()
1269 dasd_get_device(device); in dasd_smalloc_request()
1274 void dasd_sfree_request(struct dasd_ccw_req *cqr, struct dasd_device *device) in dasd_sfree_request() argument
1278 spin_lock_irqsave(&device->mem_lock, flags); in dasd_sfree_request()
1279 dasd_free_chunk(&device->ccw_chunks, cqr->mem_chunk); in dasd_sfree_request()
1280 spin_unlock_irqrestore(&device->mem_lock, flags); in dasd_sfree_request()
1281 dasd_put_device(device); in dasd_sfree_request()
1290 struct dasd_device *device; in dasd_check_cqr() local
1294 device = cqr->startdev; in dasd_check_cqr()
1295 if (strncmp((char *) &cqr->magic, device->discipline->ebcname, 4)) { in dasd_check_cqr()
1296 DBF_DEV_EVENT(DBF_WARNING, device, in dasd_check_cqr()
1300 *(unsigned int *) device->discipline->name); in dasd_check_cqr()
1314 struct dasd_device *device; in dasd_term_IO() local
1323 device = (struct dasd_device *) cqr->startdev; in dasd_term_IO()
1325 rc = ccw_device_clear(device->cdev, (long) cqr); in dasd_term_IO()
1331 DBF_DEV_EVENT(DBF_DEBUG, device, in dasd_term_IO()
1336 DBF_DEV_EVENT(DBF_ERR, device, "%s", in dasd_term_IO()
1349 DBF_DEV_EVENT(DBF_ERR, device, "%s", in dasd_term_IO()
1357 dev_err(&device->cdev->dev, "An error occurred in the " in dasd_term_IO()
1364 dasd_schedule_device_bh(device); in dasd_term_IO()
1375 struct dasd_device *device; in dasd_start_IO() local
1385 device = (struct dasd_device *) cqr->startdev; in dasd_start_IO()
1388 test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) && in dasd_start_IO()
1390 DBF_DEV_EVENT(DBF_DEBUG, device, "start_IO: return request %p " in dasd_start_IO()
1399 dev_err(&device->cdev->dev, "An error occurred in the DASD " in dasd_start_IO()
1408 cqr->lpm &= dasd_path_get_opm(device); in dasd_start_IO()
1410 cqr->lpm = dasd_path_get_opm(device); in dasd_start_IO()
1413 rc = ccw_device_tm_start(device->cdev, cqr->cpaddr, in dasd_start_IO()
1416 rc = ccw_device_start(device->cdev, cqr->cpaddr, in dasd_start_IO()
1424 DBF_DEV_EVENT(DBF_WARNING, device, "%s", in dasd_start_IO()
1436 DBF_DEV_EVENT(DBF_WARNING, device, in dasd_start_IO()
1439 } else if (cqr->lpm != dasd_path_get_opm(device)) { in dasd_start_IO()
1440 cqr->lpm = dasd_path_get_opm(device); in dasd_start_IO()
1441 DBF_DEV_EVENT(DBF_DEBUG, device, "%s", in dasd_start_IO()
1445 DBF_DEV_EVENT(DBF_WARNING, device, "%s", in dasd_start_IO()
1448 dasd_generic_last_path_gone(device); in dasd_start_IO()
1449 dasd_path_no_path(device); in dasd_start_IO()
1450 dasd_path_set_tbvpm(device, in dasd_start_IO()
1452 device->cdev)); in dasd_start_IO()
1456 DBF_DEV_EVENT(DBF_WARNING, device, "%s", in dasd_start_IO()
1460 DBF_DEV_EVENT(DBF_WARNING, device, "%s", in dasd_start_IO()
1465 DBF_DEV_EVENT(DBF_WARNING, device, "%s", in dasd_start_IO()
1472 dev_err(&device->cdev->dev, in dasd_start_IO()
1494 struct dasd_device *device; in dasd_device_timeout() local
1496 device = from_timer(device, t, timer); in dasd_device_timeout()
1497 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_device_timeout()
1499 dasd_device_remove_stop_bits(device, DASD_STOPPED_PENDING); in dasd_device_timeout()
1500 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_device_timeout()
1501 dasd_schedule_device_bh(device); in dasd_device_timeout()
1507 void dasd_device_set_timer(struct dasd_device *device, int expires) in dasd_device_set_timer() argument
1510 del_timer(&device->timer); in dasd_device_set_timer()
1512 mod_timer(&device->timer, jiffies + expires); in dasd_device_set_timer()
1519 void dasd_device_clear_timer(struct dasd_device *device) in dasd_device_clear_timer() argument
1521 del_timer(&device->timer); in dasd_device_clear_timer()
1529 struct dasd_device *device; in dasd_handle_killed_request() local
1541 device = dasd_device_from_cdev_locked(cdev); in dasd_handle_killed_request()
1542 if (IS_ERR(device)) { in dasd_handle_killed_request()
1549 device != cqr->startdev || in dasd_handle_killed_request()
1554 dasd_put_device(device); in dasd_handle_killed_request()
1561 dasd_device_clear_timer(device); in dasd_handle_killed_request()
1562 dasd_schedule_device_bh(device); in dasd_handle_killed_request()
1563 dasd_put_device(device); in dasd_handle_killed_request()
1566 void dasd_generic_handle_state_change(struct dasd_device *device) in dasd_generic_handle_state_change() argument
1569 dasd_eer_snss(device); in dasd_generic_handle_state_change()
1571 dasd_device_remove_stop_bits(device, DASD_STOPPED_PENDING); in dasd_generic_handle_state_change()
1572 dasd_schedule_device_bh(device); in dasd_generic_handle_state_change()
1573 if (device->block) { in dasd_generic_handle_state_change()
1574 dasd_schedule_block_bh(device->block); in dasd_generic_handle_state_change()
1575 if (device->block->request_queue) in dasd_generic_handle_state_change()
1576 blk_mq_run_hw_queues(device->block->request_queue, in dasd_generic_handle_state_change()
1596 struct dasd_device *device; in dasd_int_handler() local
1608 device = cqr->startdev; in dasd_int_handler()
1610 dasd_device_clear_timer(device); in dasd_int_handler()
1612 dasd_schedule_device_bh(device); in dasd_int_handler()
1636 device = dasd_device_from_cdev_locked(cdev); in dasd_int_handler()
1637 if (IS_ERR(device)) in dasd_int_handler()
1640 if (device->discipline == dasd_diag_discipline_pointer) { in dasd_int_handler()
1641 dasd_put_device(device); in dasd_int_handler()
1659 device->discipline->dump_sense_dbf(device, irb, "int"); in dasd_int_handler()
1661 if (device->features & DASD_FEATURE_ERPLOG) in dasd_int_handler()
1662 device->discipline->dump_sense(device, cqr, irb); in dasd_int_handler()
1663 device->discipline->check_for_device_change(device, cqr, irb); in dasd_int_handler()
1664 dasd_put_device(device); in dasd_int_handler()
1669 device = dasd_device_from_cdev_locked(cdev); in dasd_int_handler()
1670 if (!IS_ERR(device)) { in dasd_int_handler()
1671 device->discipline->check_attention(device, in dasd_int_handler()
1673 dasd_put_device(device); in dasd_int_handler()
1680 device = (struct dasd_device *) cqr->startdev; in dasd_int_handler()
1681 if (!device || in dasd_int_handler()
1682 strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) { in dasd_int_handler()
1692 dasd_device_clear_timer(device); in dasd_int_handler()
1694 dasd_schedule_device_bh(device); in dasd_int_handler()
1700 DBF_DEV_EVENT(DBF_DEBUG, device, "invalid status: bus_id %s, " in dasd_int_handler()
1713 if (cqr->devlist.next != &device->ccw_queue) { in dasd_int_handler()
1723 device->discipline->handle_hpf_error) in dasd_int_handler()
1724 device->discipline->handle_hpf_error(device, irb); in dasd_int_handler()
1731 if (cqr->lpm == dasd_path_get_opm(device)) in dasd_int_handler()
1732 DBF_DEV_EVENT(DBF_DEBUG, device, in dasd_int_handler()
1737 cqr->lpm = dasd_path_get_opm(device); in dasd_int_handler()
1744 (!device->stopped)) { in dasd_int_handler()
1745 if (device->discipline->start_IO(next) == 0) in dasd_int_handler()
1749 dasd_device_set_timer(device, expires); in dasd_int_handler()
1751 dasd_device_clear_timer(device); in dasd_int_handler()
1752 dasd_schedule_device_bh(device); in dasd_int_handler()
1758 struct dasd_device *device; in dasd_generic_uc_handler() local
1760 device = dasd_device_from_cdev_locked(cdev); in dasd_generic_uc_handler()
1762 if (IS_ERR(device)) in dasd_generic_uc_handler()
1764 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_generic_uc_handler()
1765 device->state != device->target || in dasd_generic_uc_handler()
1766 !device->discipline->check_for_device_change){ in dasd_generic_uc_handler()
1767 dasd_put_device(device); in dasd_generic_uc_handler()
1770 if (device->discipline->dump_sense_dbf) in dasd_generic_uc_handler()
1771 device->discipline->dump_sense_dbf(device, irb, "uc"); in dasd_generic_uc_handler()
1772 device->discipline->check_for_device_change(device, NULL, irb); in dasd_generic_uc_handler()
1773 dasd_put_device(device); in dasd_generic_uc_handler()
1783 static void __dasd_device_recovery(struct dasd_device *device, in __dasd_device_recovery() argument
1795 list_for_each_safe(l, n, &device->ccw_queue) { in __dasd_device_recovery()
1808 static void __dasd_device_process_ccw_queue(struct dasd_device *device, in __dasd_device_process_ccw_queue() argument
1815 list_for_each_safe(l, n, &device->ccw_queue) { in __dasd_device_process_ccw_queue()
1824 __dasd_device_recovery(device, cqr); in __dasd_device_process_ccw_queue()
1831 static void __dasd_process_cqr(struct dasd_device *device, in __dasd_process_cqr() argument
1849 dev_err(&device->cdev->dev, in __dasd_process_cqr()
1862 static void __dasd_device_process_final_queue(struct dasd_device *device, in __dasd_device_process_final_queue() argument
1874 __dasd_process_cqr(device, cqr); in __dasd_device_process_final_queue()
1877 __dasd_process_cqr(device, cqr); in __dasd_device_process_final_queue()
1887 static void __dasd_device_check_expire(struct dasd_device *device) in __dasd_device_check_expire() argument
1891 if (list_empty(&device->ccw_queue)) in __dasd_device_check_expire()
1893 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); in __dasd_device_check_expire()
1896 if (test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in __dasd_device_check_expire()
1903 if (device->discipline->term_IO(cqr) != 0) { in __dasd_device_check_expire()
1905 dev_err(&device->cdev->dev, in __dasd_device_check_expire()
1910 dasd_device_set_timer(device, 5*HZ); in __dasd_device_check_expire()
1912 dev_err(&device->cdev->dev, in __dasd_device_check_expire()
1923 static int __dasd_device_is_unusable(struct dasd_device *device, in __dasd_device_is_unusable() argument
1928 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) && in __dasd_device_is_unusable()
1929 !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in __dasd_device_is_unusable()
1936 if (device->stopped) { in __dasd_device_is_unusable()
1937 if (device->stopped & mask) { in __dasd_device_is_unusable()
1955 static void __dasd_device_start_head(struct dasd_device *device) in __dasd_device_start_head() argument
1960 if (list_empty(&device->ccw_queue)) in __dasd_device_start_head()
1962 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); in __dasd_device_start_head()
1966 if (__dasd_device_is_unusable(device, cqr)) { in __dasd_device_start_head()
1969 dasd_schedule_device_bh(device); in __dasd_device_start_head()
1973 rc = device->discipline->start_IO(cqr); in __dasd_device_start_head()
1975 dasd_device_set_timer(device, cqr->expires); in __dasd_device_start_head()
1977 dasd_schedule_device_bh(device); in __dasd_device_start_head()
1980 dasd_device_set_timer(device, 50); in __dasd_device_start_head()
1983 static void __dasd_device_check_path_events(struct dasd_device *device) in __dasd_device_check_path_events() argument
1987 if (!dasd_path_get_tbvpm(device)) in __dasd_device_check_path_events()
1990 if (device->stopped & in __dasd_device_check_path_events()
1993 rc = device->discipline->verify_path(device, in __dasd_device_check_path_events()
1994 dasd_path_get_tbvpm(device)); in __dasd_device_check_path_events()
1996 dasd_device_set_timer(device, 50); in __dasd_device_check_path_events()
1998 dasd_path_clear_all_verify(device); in __dasd_device_check_path_events()
2011 int dasd_flush_device_queue(struct dasd_device *device) in dasd_flush_device_queue() argument
2018 spin_lock_irq(get_ccwdev_lock(device->cdev)); in dasd_flush_device_queue()
2020 list_for_each_entry_safe(cqr, n, &device->ccw_queue, devlist) { in dasd_flush_device_queue()
2024 rc = device->discipline->term_IO(cqr); in dasd_flush_device_queue()
2027 dev_err(&device->cdev->dev, in dasd_flush_device_queue()
2044 spin_unlock_irq(get_ccwdev_lock(device->cdev)); in dasd_flush_device_queue()
2057 __dasd_device_process_final_queue(device, &flush_queue); in dasd_flush_device_queue()
2067 struct dasd_device *device = (struct dasd_device *) data; in dasd_device_tasklet() local
2070 atomic_set (&device->tasklet_scheduled, 0); in dasd_device_tasklet()
2072 spin_lock_irq(get_ccwdev_lock(device->cdev)); in dasd_device_tasklet()
2074 __dasd_device_check_expire(device); in dasd_device_tasklet()
2076 __dasd_device_process_ccw_queue(device, &final_queue); in dasd_device_tasklet()
2077 __dasd_device_check_path_events(device); in dasd_device_tasklet()
2078 spin_unlock_irq(get_ccwdev_lock(device->cdev)); in dasd_device_tasklet()
2080 __dasd_device_process_final_queue(device, &final_queue); in dasd_device_tasklet()
2081 spin_lock_irq(get_ccwdev_lock(device->cdev)); in dasd_device_tasklet()
2083 __dasd_device_start_head(device); in dasd_device_tasklet()
2084 spin_unlock_irq(get_ccwdev_lock(device->cdev)); in dasd_device_tasklet()
2087 dasd_put_device(device); in dasd_device_tasklet()
2093 void dasd_schedule_device_bh(struct dasd_device *device) in dasd_schedule_device_bh() argument
2096 if (atomic_cmpxchg (&device->tasklet_scheduled, 0, 1) != 0) in dasd_schedule_device_bh()
2098 dasd_get_device(device); in dasd_schedule_device_bh()
2099 tasklet_hi_schedule(&device->tasklet); in dasd_schedule_device_bh()
2103 void dasd_device_set_stop_bits(struct dasd_device *device, int bits) in dasd_device_set_stop_bits() argument
2105 device->stopped |= bits; in dasd_device_set_stop_bits()
2109 void dasd_device_remove_stop_bits(struct dasd_device *device, int bits) in dasd_device_remove_stop_bits() argument
2111 device->stopped &= ~bits; in dasd_device_remove_stop_bits()
2112 if (!device->stopped) in dasd_device_remove_stop_bits()
2123 struct dasd_device *device; in dasd_add_request_head() local
2126 device = cqr->startdev; in dasd_add_request_head()
2127 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_add_request_head()
2129 list_add(&cqr->devlist, &device->ccw_queue); in dasd_add_request_head()
2131 dasd_schedule_device_bh(device); in dasd_add_request_head()
2132 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_add_request_head()
2142 struct dasd_device *device; in dasd_add_request_tail() local
2145 device = cqr->startdev; in dasd_add_request_tail()
2146 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_add_request_tail()
2148 list_add_tail(&cqr->devlist, &device->ccw_queue); in dasd_add_request_tail()
2150 dasd_schedule_device_bh(device); in dasd_add_request_tail()
2151 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_add_request_tail()
2169 struct dasd_device *device; in _wait_for_wakeup() local
2172 device = cqr->startdev; in _wait_for_wakeup()
2173 spin_lock_irq(get_ccwdev_lock(device->cdev)); in _wait_for_wakeup()
2175 spin_unlock_irq(get_ccwdev_lock(device->cdev)); in _wait_for_wakeup()
2184 struct dasd_device *device; in __dasd_sleep_on_erp() local
2189 device = cqr->startdev; in __dasd_sleep_on_erp()
2192 device->discipline->handle_terminated_request(cqr); in __dasd_sleep_on_erp()
2196 erp_fn = device->discipline->erp_action(cqr); in __dasd_sleep_on_erp()
2203 __dasd_process_erp(device, cqr); in __dasd_sleep_on_erp()
2223 struct dasd_device *device; in _dasd_sleep_on() local
2230 device = maincqr->startdev; in _dasd_sleep_on()
2240 if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags) && in _dasd_sleep_on()
2247 if (device->stopped & ~DASD_STOPPED_PENDING && in _dasd_sleep_on()
2249 (!dasd_eer_enabled(device))) { in _dasd_sleep_on()
2258 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in _dasd_sleep_on()
2270 generic_waitq, !(device->stopped)); in _dasd_sleep_on()
2277 wait_event(generic_waitq, !(device->stopped)); in _dasd_sleep_on()
2327 struct dasd_device *device; in _dasd_sleep_on_queue() local
2334 device = cqr->startdev; in _dasd_sleep_on_queue()
2338 if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags) && in _dasd_sleep_on_queue()
2345 if (device->stopped & ~DASD_STOPPED_PENDING && in _dasd_sleep_on_queue()
2347 !dasd_eer_enabled(device)) { in _dasd_sleep_on_queue()
2356 generic_waitq, !device->stopped); in _dasd_sleep_on_queue()
2363 wait_event(generic_waitq, !(device->stopped)); in _dasd_sleep_on_queue()
2443 static inline int _dasd_term_running_cqr(struct dasd_device *device) in _dasd_term_running_cqr() argument
2448 if (list_empty(&device->ccw_queue)) in _dasd_term_running_cqr()
2450 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); in _dasd_term_running_cqr()
2451 rc = device->discipline->term_IO(cqr); in _dasd_term_running_cqr()
2464 struct dasd_device *device; in dasd_sleep_on_immediatly() local
2467 device = cqr->startdev; in dasd_sleep_on_immediatly()
2468 if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags) && in dasd_sleep_on_immediatly()
2474 spin_lock_irq(get_ccwdev_lock(device->cdev)); in dasd_sleep_on_immediatly()
2475 rc = _dasd_term_running_cqr(device); in dasd_sleep_on_immediatly()
2477 spin_unlock_irq(get_ccwdev_lock(device->cdev)); in dasd_sleep_on_immediatly()
2487 list_add(&cqr->devlist, device->ccw_queue.next); in dasd_sleep_on_immediatly()
2490 dasd_schedule_device_bh(device); in dasd_sleep_on_immediatly()
2492 spin_unlock_irq(get_ccwdev_lock(device->cdev)); in dasd_sleep_on_immediatly()
2504 dasd_schedule_device_bh(device); in dasd_sleep_on_immediatly()
2505 if (device->block) in dasd_sleep_on_immediatly()
2506 dasd_schedule_block_bh(device->block); in dasd_sleep_on_immediatly()
2523 struct dasd_device *device = cqr->startdev; in __dasd_cancel_req() local
2533 rc = device->discipline->term_IO(cqr); in __dasd_cancel_req()
2535 dev_err(&device->cdev->dev, in __dasd_cancel_req()
2545 dasd_schedule_device_bh(device); in __dasd_cancel_req()
2551 struct dasd_device *device = cqr->startdev; in dasd_cancel_req() local
2555 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_cancel_req()
2557 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_cancel_req()
2608 static void __dasd_process_erp(struct dasd_device *device, in __dasd_process_erp() argument
2614 DBF_DEV_EVENT(DBF_NOTICE, device, "%s", "ERP successful"); in __dasd_process_erp()
2616 dev_err(&device->cdev->dev, "ERP failed for the DASD\n"); in __dasd_process_erp()
2617 erp_fn = device->discipline->erp_postaction(cqr); in __dasd_process_erp()
3036 struct dasd_device *device; in dasd_times_out() local
3046 device = cqr->startdev ? cqr->startdev : block->base; in dasd_times_out()
3047 if (!device->blk_timeout) { in dasd_times_out()
3051 DBF_DEV_EVENT(DBF_WARNING, device, in dasd_times_out()
3056 spin_lock(get_ccwdev_lock(device->cdev)); in dasd_times_out()
3093 spin_unlock(get_ccwdev_lock(device->cdev)); in dasd_times_out()
3351 int dasd_device_is_ro(struct dasd_device *device) in dasd_device_is_ro() argument
3359 ccw_device_get_id(device->cdev, &dev_id); in dasd_device_is_ro()
3415 void dasd_generic_free_discipline(struct dasd_device *device) in dasd_generic_free_discipline() argument
3418 if (device->discipline) { in dasd_generic_free_discipline()
3419 if (device->discipline->uncheck_device) in dasd_generic_free_discipline()
3420 device->discipline->uncheck_device(device); in dasd_generic_free_discipline()
3421 module_put(device->discipline->owner); in dasd_generic_free_discipline()
3422 device->discipline = NULL; in dasd_generic_free_discipline()
3424 if (device->base_discipline) { in dasd_generic_free_discipline()
3425 module_put(device->base_discipline->owner); in dasd_generic_free_discipline()
3426 device->base_discipline = NULL; in dasd_generic_free_discipline()
3437 struct dasd_device *device; in dasd_generic_remove() local
3440 device = dasd_device_from_cdev(cdev); in dasd_generic_remove()
3441 if (IS_ERR(device)) { in dasd_generic_remove()
3445 if (test_and_set_bit(DASD_FLAG_OFFLINE, &device->flags) && in dasd_generic_remove()
3446 !test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_generic_remove()
3448 dasd_put_device(device); in dasd_generic_remove()
3457 dasd_set_target_state(device, DASD_STATE_NEW); in dasd_generic_remove()
3460 block = device->block; in dasd_generic_remove()
3461 dasd_delete_device(device); in dasd_generic_remove()
3482 struct dasd_device *device; in dasd_generic_set_online() local
3487 device = dasd_create_device(cdev); in dasd_generic_set_online()
3488 if (IS_ERR(device)) in dasd_generic_set_online()
3489 return PTR_ERR(device); in dasd_generic_set_online()
3492 if (device->features & DASD_FEATURE_USEDIAG) { in dasd_generic_set_online()
3502 dasd_delete_device(device); in dasd_generic_set_online()
3511 dasd_delete_device(device); in dasd_generic_set_online()
3517 dasd_delete_device(device); in dasd_generic_set_online()
3522 dasd_delete_device(device); in dasd_generic_set_online()
3525 device->base_discipline = base_discipline; in dasd_generic_set_online()
3526 device->discipline = discipline; in dasd_generic_set_online()
3529 rc = discipline->check_device(device); in dasd_generic_set_online()
3535 dasd_delete_device(device); in dasd_generic_set_online()
3539 dasd_set_target_state(device, DASD_STATE_ONLINE); in dasd_generic_set_online()
3540 if (device->state <= DASD_STATE_KNOWN) { in dasd_generic_set_online()
3544 dasd_set_target_state(device, DASD_STATE_NEW); in dasd_generic_set_online()
3545 if (device->block) in dasd_generic_set_online()
3546 dasd_free_block(device->block); in dasd_generic_set_online()
3547 dasd_delete_device(device); in dasd_generic_set_online()
3552 wait_event(dasd_init_waitq, _wait_for_device(device)); in dasd_generic_set_online()
3554 dasd_put_device(device); in dasd_generic_set_online()
3561 struct dasd_device *device; in dasd_generic_set_offline() local
3568 device = dasd_device_from_cdev_locked(cdev); in dasd_generic_set_offline()
3569 if (IS_ERR(device)) { in dasd_generic_set_offline()
3571 return PTR_ERR(device); in dasd_generic_set_offline()
3580 if (device->block) { in dasd_generic_set_offline()
3581 max_count = device->block->bdev ? 0 : -1; in dasd_generic_set_offline()
3582 open_count = atomic_read(&device->block->open_count); in dasd_generic_set_offline()
3601 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_generic_set_offline()
3602 if (test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_generic_set_offline()
3604 &device->flags); in dasd_generic_set_offline()
3610 set_bit(DASD_FLAG_OFFLINE, &device->flags); in dasd_generic_set_offline()
3617 if (test_and_clear_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags) && in dasd_generic_set_offline()
3618 !test_and_set_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_generic_set_offline()
3627 if (device->block) { in dasd_generic_set_offline()
3628 rc = fsync_bdev(device->block->bdev); in dasd_generic_set_offline()
3632 dasd_schedule_device_bh(device); in dasd_generic_set_offline()
3634 _wait_for_empty_queues(device)); in dasd_generic_set_offline()
3646 if (!test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_generic_set_offline()
3650 clear_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags); in dasd_generic_set_offline()
3654 dasd_set_target_state(device, DASD_STATE_NEW); in dasd_generic_set_offline()
3656 block = device->block; in dasd_generic_set_offline()
3657 dasd_delete_device(device); in dasd_generic_set_offline()
3670 clear_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags); in dasd_generic_set_offline()
3671 clear_bit(DASD_FLAG_OFFLINE, &device->flags); in dasd_generic_set_offline()
3673 dasd_put_device(device); in dasd_generic_set_offline()
3679 int dasd_generic_last_path_gone(struct dasd_device *device) in dasd_generic_last_path_gone() argument
3683 dev_warn(&device->cdev->dev, "No operational channel path is left " in dasd_generic_last_path_gone()
3685 DBF_DEV_EVENT(DBF_WARNING, device, "%s", "last path gone"); in dasd_generic_last_path_gone()
3687 dasd_eer_write(device, NULL, DASD_EER_NOPATH); in dasd_generic_last_path_gone()
3689 if (device->state < DASD_STATE_BASIC) in dasd_generic_last_path_gone()
3692 list_for_each_entry(cqr, &device->ccw_queue, devlist) in dasd_generic_last_path_gone()
3698 dasd_device_set_stop_bits(device, DASD_STOPPED_DC_WAIT); in dasd_generic_last_path_gone()
3699 dasd_device_clear_timer(device); in dasd_generic_last_path_gone()
3700 dasd_schedule_device_bh(device); in dasd_generic_last_path_gone()
3705 int dasd_generic_path_operational(struct dasd_device *device) in dasd_generic_path_operational() argument
3707 dev_info(&device->cdev->dev, "A channel path to the device has become " in dasd_generic_path_operational()
3709 DBF_DEV_EVENT(DBF_WARNING, device, "%s", "path operational"); in dasd_generic_path_operational()
3710 dasd_device_remove_stop_bits(device, DASD_STOPPED_DC_WAIT); in dasd_generic_path_operational()
3711 if (device->stopped & DASD_UNRESUMED_PM) { in dasd_generic_path_operational()
3712 dasd_device_remove_stop_bits(device, DASD_UNRESUMED_PM); in dasd_generic_path_operational()
3713 dasd_restore_device(device); in dasd_generic_path_operational()
3716 dasd_schedule_device_bh(device); in dasd_generic_path_operational()
3717 if (device->block) { in dasd_generic_path_operational()
3718 dasd_schedule_block_bh(device->block); in dasd_generic_path_operational()
3719 if (device->block->request_queue) in dasd_generic_path_operational()
3720 blk_mq_run_hw_queues(device->block->request_queue, in dasd_generic_path_operational()
3724 if (!device->stopped) in dasd_generic_path_operational()
3733 struct dasd_device *device; in dasd_generic_notify() local
3736 device = dasd_device_from_cdev_locked(cdev); in dasd_generic_notify()
3737 if (IS_ERR(device)) in dasd_generic_notify()
3744 dasd_path_no_path(device); in dasd_generic_notify()
3745 ret = dasd_generic_last_path_gone(device); in dasd_generic_notify()
3749 if (dasd_path_get_opm(device)) in dasd_generic_notify()
3750 ret = dasd_generic_path_operational(device); in dasd_generic_notify()
3753 dasd_put_device(device); in dasd_generic_notify()
3760 struct dasd_device *device; in dasd_generic_path_event() local
3763 device = dasd_device_from_cdev_locked(cdev); in dasd_generic_path_event()
3764 if (IS_ERR(device)) in dasd_generic_path_event()
3767 oldopm = dasd_path_get_opm(device); in dasd_generic_path_event()
3770 dasd_path_notoper(device, chp); in dasd_generic_path_event()
3773 dasd_path_available(device, chp); in dasd_generic_path_event()
3774 dasd_schedule_device_bh(device); in dasd_generic_path_event()
3777 if (!dasd_path_is_operational(device, chp) && in dasd_generic_path_event()
3778 !dasd_path_need_verify(device, chp)) { in dasd_generic_path_event()
3784 dasd_path_available(device, chp); in dasd_generic_path_event()
3785 dasd_schedule_device_bh(device); in dasd_generic_path_event()
3787 DBF_DEV_EVENT(DBF_WARNING, device, "%s", in dasd_generic_path_event()
3789 if (device->discipline->kick_validate) in dasd_generic_path_event()
3790 device->discipline->kick_validate(device); in dasd_generic_path_event()
3793 hpfpm = dasd_path_get_hpfpm(device); in dasd_generic_path_event()
3794 ifccpm = dasd_path_get_ifccpm(device); in dasd_generic_path_event()
3795 if (!dasd_path_get_opm(device) && hpfpm) { in dasd_generic_path_event()
3801 if (device->discipline->disable_hpf) in dasd_generic_path_event()
3802 device->discipline->disable_hpf(device); in dasd_generic_path_event()
3803 dasd_device_set_stop_bits(device, DASD_STOPPED_NOT_ACC); in dasd_generic_path_event()
3804 dasd_path_set_tbvpm(device, hpfpm); in dasd_generic_path_event()
3805 dasd_schedule_device_bh(device); in dasd_generic_path_event()
3806 dasd_schedule_requeue(device); in dasd_generic_path_event()
3807 } else if (!dasd_path_get_opm(device) && ifccpm) { in dasd_generic_path_event()
3813 dasd_path_set_tbvpm(device, ifccpm); in dasd_generic_path_event()
3814 dasd_schedule_device_bh(device); in dasd_generic_path_event()
3816 if (oldopm && !dasd_path_get_opm(device) && !hpfpm && !ifccpm) { in dasd_generic_path_event()
3817 dev_warn(&device->cdev->dev, in dasd_generic_path_event()
3819 DBF_DEV_EVENT(DBF_WARNING, device, in dasd_generic_path_event()
3821 dasd_eer_write(device, NULL, DASD_EER_NOPATH); in dasd_generic_path_event()
3822 dasd_device_set_stop_bits(device, in dasd_generic_path_event()
3825 dasd_put_device(device); in dasd_generic_path_event()
3829 int dasd_generic_verify_path(struct dasd_device *device, __u8 lpm) in dasd_generic_verify_path() argument
3831 if (!dasd_path_get_opm(device) && lpm) { in dasd_generic_verify_path()
3832 dasd_path_set_opm(device, lpm); in dasd_generic_verify_path()
3833 dasd_generic_path_operational(device); in dasd_generic_verify_path()
3835 dasd_path_add_opm(device, lpm); in dasd_generic_verify_path()
3843 static int dasd_generic_requeue_all_requests(struct dasd_device *device) in dasd_generic_requeue_all_requests() argument
3845 struct dasd_block *block = device->block; in dasd_generic_requeue_all_requests()
3875 dasd_schedule_device_bh(device); in dasd_generic_requeue_all_requests()
3881 struct dasd_device *device = container_of(work, struct dasd_device, in do_requeue_requests() local
3883 dasd_generic_requeue_all_requests(device); in do_requeue_requests()
3884 dasd_device_remove_stop_bits(device, DASD_STOPPED_NOT_ACC); in do_requeue_requests()
3885 if (device->block) in do_requeue_requests()
3886 dasd_schedule_block_bh(device->block); in do_requeue_requests()
3887 dasd_put_device(device); in do_requeue_requests()
3890 void dasd_schedule_requeue(struct dasd_device *device) in dasd_schedule_requeue() argument
3892 dasd_get_device(device); in dasd_schedule_requeue()
3894 if (!schedule_work(&device->requeue_requests)) in dasd_schedule_requeue()
3895 dasd_put_device(device); in dasd_schedule_requeue()
3901 struct dasd_device *device = dasd_device_from_cdev(cdev); in dasd_generic_pm_freeze() local
3903 if (IS_ERR(device)) in dasd_generic_pm_freeze()
3904 return PTR_ERR(device); in dasd_generic_pm_freeze()
3907 set_bit(DASD_FLAG_SUSPENDED, &device->flags); in dasd_generic_pm_freeze()
3909 if (device->discipline->freeze) in dasd_generic_pm_freeze()
3910 device->discipline->freeze(device); in dasd_generic_pm_freeze()
3913 dasd_device_set_stop_bits(device, DASD_STOPPED_PM); in dasd_generic_pm_freeze()
3915 return dasd_generic_requeue_all_requests(device); in dasd_generic_pm_freeze()
3921 struct dasd_device *device = dasd_device_from_cdev(cdev); in dasd_generic_restore_device() local
3924 if (IS_ERR(device)) in dasd_generic_restore_device()
3925 return PTR_ERR(device); in dasd_generic_restore_device()
3928 dasd_device_remove_stop_bits(device, in dasd_generic_restore_device()
3931 dasd_schedule_device_bh(device); in dasd_generic_restore_device()
3937 if (device->discipline->restore && !(device->stopped)) in dasd_generic_restore_device()
3938 rc = device->discipline->restore(device); in dasd_generic_restore_device()
3939 if (rc || device->stopped) in dasd_generic_restore_device()
3944 device->stopped |= DASD_UNRESUMED_PM; in dasd_generic_restore_device()
3946 if (device->block) { in dasd_generic_restore_device()
3947 dasd_schedule_block_bh(device->block); in dasd_generic_restore_device()
3948 if (device->block->request_queue) in dasd_generic_restore_device()
3949 blk_mq_run_hw_queues(device->block->request_queue, in dasd_generic_restore_device()
3953 clear_bit(DASD_FLAG_SUSPENDED, &device->flags); in dasd_generic_restore_device()
3954 dasd_put_device(device); in dasd_generic_restore_device()
3959 static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, in dasd_generic_build_rdc() argument
3968 cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device, in dasd_generic_build_rdc()
3973 dev_err(&device->cdev->dev, in dasd_generic_build_rdc()
3992 cqr->startdev = device; in dasd_generic_build_rdc()
3993 cqr->memdev = device; in dasd_generic_build_rdc()
4002 int dasd_generic_read_dev_chars(struct dasd_device *device, int magic, in dasd_generic_read_dev_chars() argument
4008 cqr = dasd_generic_build_rdc(device, rdc_buffer, rdc_buffer_size, in dasd_generic_read_dev_chars()
4055 struct dasd_device *device; in dasd_generic_shutdown() local
4057 device = dasd_device_from_cdev(cdev); in dasd_generic_shutdown()
4058 if (IS_ERR(device)) in dasd_generic_shutdown()
4061 if (device->block) in dasd_generic_shutdown()
4062 dasd_schedule_block_bh(device->block); in dasd_generic_shutdown()
4064 dasd_schedule_device_bh(device); in dasd_generic_shutdown()
4066 wait_event(shutdown_waitq, _wait_for_empty_queues(device)); in dasd_generic_shutdown()