Lines Matching refs:device
51 struct dasd_device *device; member
430 new->device = NULL; in dasd_add_busid()
484 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
499 struct dasd_device *device; in dasd_device_from_devindex() local
511 if (devmap && devmap->device) { in dasd_device_from_devindex()
512 device = devmap->device; in dasd_device_from_devindex()
513 dasd_get_device(device); in dasd_device_from_devindex()
515 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
517 return device; in dasd_device_from_devindex()
543 struct dasd_device *device; in dasd_create_device() local
551 device = dasd_alloc_device(); in dasd_create_device()
552 if (IS_ERR(device)) in dasd_create_device()
553 return device; in dasd_create_device()
554 atomic_set(&device->ref_count, 3); in dasd_create_device()
557 if (!devmap->device) { in dasd_create_device()
558 devmap->device = device; in dasd_create_device()
559 device->devindex = devmap->devindex; in dasd_create_device()
560 device->features = devmap->features; in dasd_create_device()
562 device->cdev = cdev; in dasd_create_device()
570 dasd_free_device(device); in dasd_create_device()
575 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
578 return device; in dasd_create_device()
591 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
598 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
601 if (devmap->device != device) { in dasd_delete_device()
603 dasd_put_device(device); in dasd_delete_device()
606 devmap->device = NULL; in dasd_delete_device()
610 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
611 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
612 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
618 atomic_sub(3, &device->ref_count); in dasd_delete_device()
621 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
623 dasd_generic_free_discipline(device); in dasd_delete_device()
625 cdev = device->cdev; in dasd_delete_device()
626 device->cdev = NULL; in dasd_delete_device()
632 dasd_free_device(device); in dasd_delete_device()
640 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
654 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
656 if (!device) in dasd_device_from_cdev_locked()
658 dasd_get_device(device); in dasd_device_from_cdev_locked()
659 return device; in dasd_device_from_cdev_locked()
668 struct dasd_device *device; in dasd_device_from_cdev() local
672 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
674 return device; in dasd_device_from_cdev()
677 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
681 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
691 struct dasd_device *device; in dasd_device_from_gendisk() local
696 device = NULL; in dasd_device_from_gendisk()
699 if (devmap && devmap->device) { in dasd_device_from_gendisk()
700 device = devmap->device; in dasd_device_from_gendisk()
701 dasd_get_device(device); in dasd_device_from_gendisk()
704 return device; in dasd_device_from_gendisk()
714 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
728 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
748 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
751 struct dasd_device *device; in dasd_ro_show() local
761 device = devmap->device; in dasd_ro_show()
762 if (device) in dasd_ro_show()
763 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_show()
771 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
775 struct dasd_device *device; in dasd_ro_store() local
787 device = dasd_device_from_cdev(cdev); in dasd_ro_store()
788 if (IS_ERR(device)) in dasd_ro_store()
792 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
794 if (!device->block || !device->block->gdp || in dasd_ro_store()
795 test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_ro_store()
800 atomic_inc(&device->block->open_count); in dasd_ro_store()
803 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
804 atomic_dec(&device->block->open_count); in dasd_ro_store()
807 dasd_put_device(device); in dasd_ro_store()
818 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
832 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
853 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
867 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
884 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
902 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
916 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
933 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
948 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, in dasd_safe_offline_store()
952 struct dasd_device *device; in dasd_safe_offline_store() local
957 device = dasd_device_from_cdev_locked(cdev); in dasd_safe_offline_store()
958 if (IS_ERR(device)) { in dasd_safe_offline_store()
959 rc = PTR_ERR(device); in dasd_safe_offline_store()
964 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_safe_offline_store()
965 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_safe_offline_store()
967 dasd_put_device(device); in dasd_safe_offline_store()
973 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); in dasd_safe_offline_store()
974 dasd_put_device(device); in dasd_safe_offline_store()
986 dasd_access_show(struct device *dev, struct device_attribute *attr, in dasd_access_show()
990 struct dasd_device *device; in dasd_access_show() local
993 device = dasd_device_from_cdev(cdev); in dasd_access_show()
994 if (IS_ERR(device)) in dasd_access_show()
995 return PTR_ERR(device); in dasd_access_show()
997 if (!device->discipline) in dasd_access_show()
999 else if (!device->discipline->host_access_count) in dasd_access_show()
1002 count = device->discipline->host_access_count(device); in dasd_access_show()
1004 dasd_put_device(device); in dasd_access_show()
1014 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
1017 struct dasd_device *device; in dasd_discipline_show() local
1020 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
1021 if (IS_ERR(device)) in dasd_discipline_show()
1023 else if (!device->discipline) { in dasd_discipline_show()
1024 dasd_put_device(device); in dasd_discipline_show()
1028 device->discipline->name); in dasd_discipline_show()
1029 dasd_put_device(device); in dasd_discipline_show()
1040 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
1043 struct dasd_device *device; in dasd_device_status_show() local
1046 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
1047 if (!IS_ERR(device)) { in dasd_device_status_show()
1048 switch (device->state) { in dasd_device_status_show()
1071 dasd_put_device(device); in dasd_device_status_show()
1079 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1082 struct dasd_device *device; in dasd_alias_show() local
1085 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1086 if (IS_ERR(device)) in dasd_alias_show()
1089 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1090 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1093 dasd_put_device(device); in dasd_alias_show()
1097 dasd_put_device(device); in dasd_alias_show()
1104 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1107 struct dasd_device *device; in dasd_vendor_show() local
1111 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1113 if (IS_ERR(device)) in dasd_vendor_show()
1116 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1117 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1120 dasd_put_device(device); in dasd_vendor_show()
1132 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1134 struct dasd_device *device; in dasd_uid_show() local
1139 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1141 if (IS_ERR(device)) in dasd_uid_show()
1144 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1145 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1175 dasd_put_device(device); in dasd_uid_show()
1185 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1191 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1192 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1199 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1202 struct dasd_device *device; in dasd_eer_store() local
1206 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1207 if (IS_ERR(device)) in dasd_eer_store()
1208 return PTR_ERR(device); in dasd_eer_store()
1214 rc = dasd_eer_enable(device); in dasd_eer_store()
1216 dasd_eer_disable(device); in dasd_eer_store()
1218 dasd_put_device(device); in dasd_eer_store()
1229 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1231 struct dasd_device *device; in dasd_expires_show() local
1234 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1235 if (IS_ERR(device)) in dasd_expires_show()
1237 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_expires); in dasd_expires_show()
1238 dasd_put_device(device); in dasd_expires_show()
1243 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1246 struct dasd_device *device; in dasd_expires_store() local
1249 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1250 if (IS_ERR(device)) in dasd_expires_store()
1255 dasd_put_device(device); in dasd_expires_store()
1260 device->default_expires = val; in dasd_expires_store()
1262 dasd_put_device(device); in dasd_expires_store()
1269 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1271 struct dasd_device *device; in dasd_retries_show() local
1274 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1275 if (IS_ERR(device)) in dasd_retries_show()
1277 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_retries); in dasd_retries_show()
1278 dasd_put_device(device); in dasd_retries_show()
1283 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1286 struct dasd_device *device; in dasd_retries_store() local
1289 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1290 if (IS_ERR(device)) in dasd_retries_store()
1295 dasd_put_device(device); in dasd_retries_store()
1300 device->default_retries = val; in dasd_retries_store()
1302 dasd_put_device(device); in dasd_retries_store()
1309 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1312 struct dasd_device *device; in dasd_timeout_show() local
1315 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1316 if (IS_ERR(device)) in dasd_timeout_show()
1318 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1319 dasd_put_device(device); in dasd_timeout_show()
1324 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1327 struct dasd_device *device; in dasd_timeout_store() local
1331 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1332 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1337 dasd_put_device(device); in dasd_timeout_store()
1340 q = device->block->request_queue; in dasd_timeout_store()
1342 dasd_put_device(device); in dasd_timeout_store()
1346 device->blk_timeout = val; in dasd_timeout_store()
1348 blk_queue_rq_timeout(q, device->blk_timeout * HZ); in dasd_timeout_store()
1350 dasd_put_device(device); in dasd_timeout_store()
1359 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1362 struct dasd_device *device; in dasd_path_reset_store() local
1365 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1366 if (IS_ERR(device)) in dasd_path_reset_store()
1372 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1373 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1375 dasd_put_device(device); in dasd_path_reset_store()
1381 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1384 struct dasd_device *device; in dasd_hpf_show() local
1387 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1388 if (IS_ERR(device)) in dasd_hpf_show()
1390 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1391 dasd_put_device(device); in dasd_hpf_show()
1394 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1395 dasd_put_device(device); in dasd_hpf_show()
1401 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1422 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1442 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1446 struct dasd_device *device; in dasd_reservation_state_show() local
1449 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1450 if (IS_ERR(device)) in dasd_reservation_state_show()
1453 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1455 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1459 dasd_put_device(device); in dasd_reservation_state_show()
1463 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1467 struct dasd_device *device; in dasd_reservation_state_store() local
1470 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1471 if (IS_ERR(device)) in dasd_reservation_state_store()
1474 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1477 dasd_put_device(device); in dasd_reservation_state_store()
1488 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1491 struct dasd_device *device; in dasd_pm_show() local
1494 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1495 if (IS_ERR(device)) in dasd_pm_show()
1498 opm = dasd_path_get_opm(device); in dasd_pm_show()
1499 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1500 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1501 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1502 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1503 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1504 dasd_put_device(device); in dasd_pm_show()
1516 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1519 struct dasd_device *device; in dasd_path_threshold_show() local
1522 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1523 if (IS_ERR(device)) in dasd_path_threshold_show()
1525 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1526 dasd_put_device(device); in dasd_path_threshold_show()
1531 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1534 struct dasd_device *device; in dasd_path_threshold_store() local
1538 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1539 if (IS_ERR(device)) in dasd_path_threshold_store()
1543 dasd_put_device(device); in dasd_path_threshold_store()
1547 device->path_thrhld = val; in dasd_path_threshold_store()
1549 dasd_put_device(device); in dasd_path_threshold_store()
1561 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1564 struct dasd_device *device; in dasd_path_interval_show() local
1567 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1568 if (IS_ERR(device)) in dasd_path_interval_show()
1570 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->path_interval); in dasd_path_interval_show()
1571 dasd_put_device(device); in dasd_path_interval_show()
1576 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1579 struct dasd_device *device; in dasd_path_interval_store() local
1583 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1584 if (IS_ERR(device)) in dasd_path_interval_store()
1589 dasd_put_device(device); in dasd_path_interval_store()
1594 device->path_interval = val; in dasd_path_interval_store()
1596 dasd_put_device(device); in dasd_path_interval_store()
1668 if (devmap->device) in dasd_set_feature()
1669 devmap->device->features = devmap->features; in dasd_set_feature()