Lines Matching refs:device

51 	struct dasd_device *device;  member
432 new->device = NULL; in dasd_add_busid()
495 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
510 struct dasd_device *device; in dasd_device_from_devindex() local
522 if (devmap && devmap->device) { in dasd_device_from_devindex()
523 device = devmap->device; in dasd_device_from_devindex()
524 dasd_get_device(device); in dasd_device_from_devindex()
526 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
528 return device; in dasd_device_from_devindex()
554 struct dasd_device *device; in dasd_create_device() local
562 device = dasd_alloc_device(); in dasd_create_device()
563 if (IS_ERR(device)) in dasd_create_device()
564 return device; in dasd_create_device()
565 atomic_set(&device->ref_count, 3); in dasd_create_device()
568 if (!devmap->device) { in dasd_create_device()
569 devmap->device = device; in dasd_create_device()
570 device->devindex = devmap->devindex; in dasd_create_device()
571 device->features = devmap->features; in dasd_create_device()
573 device->cdev = cdev; in dasd_create_device()
581 dasd_free_device(device); in dasd_create_device()
586 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
589 device->paths_info = kset_create_and_add("paths_info", NULL, in dasd_create_device()
590 &device->cdev->dev.kobj); in dasd_create_device()
591 if (!device->paths_info) in dasd_create_device()
594 return device; in dasd_create_device()
600 static int dasd_devmap_get_pprc_status(struct dasd_device *device, in dasd_devmap_get_pprc_status() argument
605 if (!device->discipline || !device->discipline->pprc_status) { in dasd_devmap_get_pprc_status()
606 dev_warn(&device->cdev->dev, "Unable to query copy relation status\n"); in dasd_devmap_get_pprc_status()
614 if (device->discipline->pprc_status(device, temp)) { in dasd_devmap_get_pprc_status()
615 dev_warn(&device->cdev->dev, "Error during copy relation status query\n"); in dasd_devmap_get_pprc_status()
659 static int dasd_devmap_check_copy_relation(struct dasd_device *device, in dasd_devmap_check_copy_relation() argument
669 if (!device->discipline || !device->discipline->get_uid || in dasd_devmap_check_copy_relation()
670 device->discipline->get_uid(device, &uid)) in dasd_devmap_check_copy_relation()
675 dev_warn(&device->cdev->dev, "Device not part of a copy relation\n"); in dasd_devmap_check_copy_relation()
682 dev_warn(&device->cdev->dev, "Copy pair secondary is setup as primary\n"); in dasd_devmap_check_copy_relation()
687 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
689 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
696 dev_warn(&device->cdev->dev, "Copy pair primary is setup as secondary\n"); in dasd_devmap_check_copy_relation()
701 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
703 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
716 tmp_dev = device; in dasd_devmap_check_copy_relation()
718 tmp_dev = copy->entry[j].device; in dasd_devmap_check_copy_relation()
729 dev_name(&device->cdev->dev)); in dasd_devmap_check_copy_relation()
739 static void dasd_devmap_delete_copy_relation_device(struct dasd_device *device) in dasd_devmap_delete_copy_relation_device() argument
744 if (!device->copy) in dasd_devmap_delete_copy_relation_device()
747 copy = device->copy; in dasd_devmap_delete_copy_relation_device()
749 if (copy->entry[i].device == device) in dasd_devmap_delete_copy_relation_device()
750 copy->entry[i].device = NULL; in dasd_devmap_delete_copy_relation_device()
752 dasd_put_device(device); in dasd_devmap_delete_copy_relation_device()
753 device->copy = NULL; in dasd_devmap_delete_copy_relation_device()
767 struct dasd_device *device; in dasd_devmap_set_device_copy_relation() local
774 device = devmap->device; in dasd_devmap_set_device_copy_relation()
775 if (!device) in dasd_devmap_set_device_copy_relation()
783 rc = dasd_devmap_get_pprc_status(device, &data); in dasd_devmap_set_device_copy_relation()
795 dev_warn(&device->cdev->dev, "Copy pair setup requested for device not in copy relation\n"); in dasd_devmap_set_device_copy_relation()
809 dev_warn(&device->cdev->dev, "Copy relation entry not found\n"); in dasd_devmap_set_device_copy_relation()
814 if (dasd_devmap_check_copy_relation(device, entry, data, copy)) { in dasd_devmap_set_device_copy_relation()
815 dev_warn(&device->cdev->dev, "Copy relation faulty\n"); in dasd_devmap_set_device_copy_relation()
820 dasd_get_device(device); in dasd_devmap_set_device_copy_relation()
821 copy->entry[i].device = device; in dasd_devmap_set_device_copy_relation()
822 device->copy = copy; in dasd_devmap_set_device_copy_relation()
839 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
846 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
849 if (devmap->device != device) { in dasd_delete_device()
851 dasd_put_device(device); in dasd_delete_device()
854 devmap->device = NULL; in dasd_delete_device()
858 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
859 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
860 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
863 dasd_devmap_delete_copy_relation_device(device); in dasd_delete_device()
868 atomic_sub(3, &device->ref_count); in dasd_delete_device()
871 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
873 dasd_generic_free_discipline(device); in dasd_delete_device()
875 kset_unregister(device->paths_info); in dasd_delete_device()
878 cdev = device->cdev; in dasd_delete_device()
879 device->cdev = NULL; in dasd_delete_device()
885 dasd_free_device(device); in dasd_delete_device()
893 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
907 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
909 if (!device) in dasd_device_from_cdev_locked()
911 dasd_get_device(device); in dasd_device_from_cdev_locked()
912 return device; in dasd_device_from_cdev_locked()
921 struct dasd_device *device; in dasd_device_from_cdev() local
925 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
927 return device; in dasd_device_from_cdev()
930 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
934 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
945 struct dasd_device *device; in dasd_device_from_gendisk() local
950 device = NULL; in dasd_device_from_gendisk()
953 if (devmap && devmap->device) { in dasd_device_from_gendisk()
954 device = devmap->device; in dasd_device_from_gendisk()
955 dasd_get_device(device); in dasd_device_from_gendisk()
958 return device; in dasd_device_from_gendisk()
968 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
982 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
1002 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
1005 struct dasd_device *device; in dasd_ro_show() local
1015 device = devmap->device; in dasd_ro_show()
1016 if (device) in dasd_ro_show()
1017 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_show()
1025 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
1029 struct dasd_device *device; in dasd_ro_store() local
1041 device = dasd_device_from_cdev(cdev); in dasd_ro_store()
1042 if (IS_ERR(device)) in dasd_ro_store()
1046 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
1048 if (!device->block || !device->block->gdp || in dasd_ro_store()
1049 test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_ro_store()
1054 atomic_inc(&device->block->open_count); in dasd_ro_store()
1057 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
1058 atomic_dec(&device->block->open_count); in dasd_ro_store()
1061 dasd_put_device(device); in dasd_ro_store()
1072 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
1086 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
1107 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
1121 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
1138 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
1156 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
1170 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
1187 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
1202 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, in dasd_safe_offline_store()
1206 struct dasd_device *device; in dasd_safe_offline_store() local
1211 device = dasd_device_from_cdev_locked(cdev); in dasd_safe_offline_store()
1212 if (IS_ERR(device)) { in dasd_safe_offline_store()
1213 rc = PTR_ERR(device); in dasd_safe_offline_store()
1218 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_safe_offline_store()
1219 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_safe_offline_store()
1221 dasd_put_device(device); in dasd_safe_offline_store()
1227 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); in dasd_safe_offline_store()
1228 dasd_put_device(device); in dasd_safe_offline_store()
1240 dasd_access_show(struct device *dev, struct device_attribute *attr, in dasd_access_show()
1244 struct dasd_device *device; in dasd_access_show() local
1247 device = dasd_device_from_cdev(cdev); in dasd_access_show()
1248 if (IS_ERR(device)) in dasd_access_show()
1249 return PTR_ERR(device); in dasd_access_show()
1251 if (!device->discipline) in dasd_access_show()
1253 else if (!device->discipline->host_access_count) in dasd_access_show()
1256 count = device->discipline->host_access_count(device); in dasd_access_show()
1258 dasd_put_device(device); in dasd_access_show()
1268 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
1271 struct dasd_device *device; in dasd_discipline_show() local
1274 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
1275 if (IS_ERR(device)) in dasd_discipline_show()
1277 else if (!device->discipline) { in dasd_discipline_show()
1278 dasd_put_device(device); in dasd_discipline_show()
1282 device->discipline->name); in dasd_discipline_show()
1283 dasd_put_device(device); in dasd_discipline_show()
1294 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
1297 struct dasd_device *device; in dasd_device_status_show() local
1300 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
1301 if (!IS_ERR(device)) { in dasd_device_status_show()
1302 switch (device->state) { in dasd_device_status_show()
1325 dasd_put_device(device); in dasd_device_status_show()
1333 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1336 struct dasd_device *device; in dasd_alias_show() local
1339 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1340 if (IS_ERR(device)) in dasd_alias_show()
1343 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1344 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1347 dasd_put_device(device); in dasd_alias_show()
1351 dasd_put_device(device); in dasd_alias_show()
1358 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1361 struct dasd_device *device; in dasd_vendor_show() local
1365 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1367 if (IS_ERR(device)) in dasd_vendor_show()
1370 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1371 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1374 dasd_put_device(device); in dasd_vendor_show()
1382 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1385 struct dasd_device *device; in dasd_uid_show() local
1389 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1391 if (IS_ERR(device)) in dasd_uid_show()
1394 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1395 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1425 dasd_put_device(device); in dasd_uid_show()
1435 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1441 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1442 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1449 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1452 struct dasd_device *device; in dasd_eer_store() local
1456 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1457 if (IS_ERR(device)) in dasd_eer_store()
1458 return PTR_ERR(device); in dasd_eer_store()
1464 rc = dasd_eer_enable(device); in dasd_eer_store()
1466 dasd_eer_disable(device); in dasd_eer_store()
1468 dasd_put_device(device); in dasd_eer_store()
1479 static ssize_t dasd_aq_mask_show(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_show()
1492 static ssize_t dasd_aq_mask_store(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_store()
1507 if (devmap->device) in dasd_aq_mask_store()
1508 devmap->device->aq_mask = devmap->aq_mask; in dasd_aq_mask_store()
1520 static ssize_t dasd_aqr_show(struct device *dev, struct device_attribute *attr, in dasd_aqr_show()
1535 static ssize_t dasd_aqr_store(struct device *dev, struct device_attribute *attr, in dasd_aqr_store()
1556 dasd_aq_timeouts_show(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_show()
1559 struct dasd_device *device; in dasd_aq_timeouts_show() local
1562 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_show()
1563 if (IS_ERR(device)) in dasd_aq_timeouts_show()
1565 len = sysfs_emit(buf, "%u\n", device->aq_timeouts); in dasd_aq_timeouts_show()
1566 dasd_put_device(device); in dasd_aq_timeouts_show()
1571 dasd_aq_timeouts_store(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_store()
1574 struct dasd_device *device; in dasd_aq_timeouts_store() local
1577 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_store()
1578 if (IS_ERR(device)) in dasd_aq_timeouts_store()
1583 dasd_put_device(device); in dasd_aq_timeouts_store()
1588 device->aq_timeouts = val; in dasd_aq_timeouts_store()
1590 dasd_put_device(device); in dasd_aq_timeouts_store()
1601 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1603 struct dasd_device *device; in dasd_expires_show() local
1606 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1607 if (IS_ERR(device)) in dasd_expires_show()
1609 len = sysfs_emit(buf, "%lu\n", device->default_expires); in dasd_expires_show()
1610 dasd_put_device(device); in dasd_expires_show()
1615 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1618 struct dasd_device *device; in dasd_expires_store() local
1621 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1622 if (IS_ERR(device)) in dasd_expires_store()
1627 dasd_put_device(device); in dasd_expires_store()
1632 device->default_expires = val; in dasd_expires_store()
1634 dasd_put_device(device); in dasd_expires_store()
1641 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1643 struct dasd_device *device; in dasd_retries_show() local
1646 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1647 if (IS_ERR(device)) in dasd_retries_show()
1649 len = sysfs_emit(buf, "%lu\n", device->default_retries); in dasd_retries_show()
1650 dasd_put_device(device); in dasd_retries_show()
1655 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1658 struct dasd_device *device; in dasd_retries_store() local
1661 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1662 if (IS_ERR(device)) in dasd_retries_store()
1667 dasd_put_device(device); in dasd_retries_store()
1672 device->default_retries = val; in dasd_retries_store()
1674 dasd_put_device(device); in dasd_retries_store()
1681 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1684 struct dasd_device *device; in dasd_timeout_show() local
1687 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1688 if (IS_ERR(device)) in dasd_timeout_show()
1690 len = sysfs_emit(buf, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1691 dasd_put_device(device); in dasd_timeout_show()
1696 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1699 struct dasd_device *device; in dasd_timeout_store() local
1702 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1703 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1708 dasd_put_device(device); in dasd_timeout_store()
1711 if (!device->block->gdp) { in dasd_timeout_store()
1712 dasd_put_device(device); in dasd_timeout_store()
1716 device->blk_timeout = val; in dasd_timeout_store()
1717 blk_queue_rq_timeout(device->block->gdp->queue, val * HZ); in dasd_timeout_store()
1719 dasd_put_device(device); in dasd_timeout_store()
1728 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1731 struct dasd_device *device; in dasd_path_reset_store() local
1734 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1735 if (IS_ERR(device)) in dasd_path_reset_store()
1741 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1742 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1744 dasd_put_device(device); in dasd_path_reset_store()
1750 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1753 struct dasd_device *device; in dasd_hpf_show() local
1756 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1757 if (IS_ERR(device)) in dasd_hpf_show()
1759 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1760 dasd_put_device(device); in dasd_hpf_show()
1763 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1764 dasd_put_device(device); in dasd_hpf_show()
1770 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1791 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1811 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1815 struct dasd_device *device; in dasd_reservation_state_show() local
1818 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1819 if (IS_ERR(device)) in dasd_reservation_state_show()
1822 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1824 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1828 dasd_put_device(device); in dasd_reservation_state_show()
1832 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1836 struct dasd_device *device; in dasd_reservation_state_store() local
1839 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1840 if (IS_ERR(device)) in dasd_reservation_state_store()
1843 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1846 dasd_put_device(device); in dasd_reservation_state_store()
1857 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1860 struct dasd_device *device; in dasd_pm_show() local
1863 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1864 if (IS_ERR(device)) in dasd_pm_show()
1867 opm = dasd_path_get_opm(device); in dasd_pm_show()
1868 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1869 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1870 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1871 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1872 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1873 dasd_put_device(device); in dasd_pm_show()
1885 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1888 struct dasd_device *device; in dasd_path_threshold_show() local
1891 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1892 if (IS_ERR(device)) in dasd_path_threshold_show()
1894 len = sysfs_emit(buf, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1895 dasd_put_device(device); in dasd_path_threshold_show()
1900 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1903 struct dasd_device *device; in dasd_path_threshold_store() local
1907 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1908 if (IS_ERR(device)) in dasd_path_threshold_store()
1912 dasd_put_device(device); in dasd_path_threshold_store()
1916 device->path_thrhld = val; in dasd_path_threshold_store()
1918 dasd_put_device(device); in dasd_path_threshold_store()
1929 dasd_path_autodisable_show(struct device *dev, in dasd_path_autodisable_show()
1945 dasd_path_autodisable_store(struct device *dev, in dasd_path_autodisable_store()
1970 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1973 struct dasd_device *device; in dasd_path_interval_show() local
1976 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1977 if (IS_ERR(device)) in dasd_path_interval_show()
1979 len = sysfs_emit(buf, "%lu\n", device->path_interval); in dasd_path_interval_show()
1980 dasd_put_device(device); in dasd_path_interval_show()
1985 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1988 struct dasd_device *device; in dasd_path_interval_store() local
1992 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1993 if (IS_ERR(device)) in dasd_path_interval_store()
1998 dasd_put_device(device); in dasd_path_interval_store()
2003 device->path_interval = val; in dasd_path_interval_store()
2005 dasd_put_device(device); in dasd_path_interval_store()
2013 dasd_device_fcs_show(struct device *dev, struct device_attribute *attr, in dasd_device_fcs_show()
2016 struct dasd_device *device; in dasd_device_fcs_show() local
2020 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_fcs_show()
2021 if (IS_ERR(device)) in dasd_device_fcs_show()
2023 fc_sec = dasd_path_get_fcs_device(device); in dasd_device_fcs_show()
2028 dasd_put_device(device); in dasd_device_fcs_show()
2051 dasd_copy_pair_show(struct device *dev, in dasd_copy_pair_show()
2148 static int dasd_devmap_clear_copy_relation(struct device *dev) in dasd_devmap_clear_copy_relation()
2168 if (copy->entry[i].device == copy->active->device) in dasd_devmap_clear_copy_relation()
2171 if (copy->entry[i].device) in dasd_devmap_clear_copy_relation()
2178 if (copy->entry[i].device) { in dasd_devmap_clear_copy_relation()
2179 dasd_put_device(copy->entry[i].device); in dasd_devmap_clear_copy_relation()
2180 copy->entry[i].device->copy = NULL; in dasd_devmap_clear_copy_relation()
2181 copy->entry[i].device = NULL; in dasd_devmap_clear_copy_relation()
2233 static ssize_t dasd_copy_pair_store(struct device *dev, in dasd_copy_pair_store()
2241 struct dasd_device *device; in dasd_copy_pair_store() local
2276 if (sec_devmap->device) in dasd_copy_pair_store()
2302 if (prim_devmap->device && !prim_devmap->device->copy) { in dasd_copy_pair_store()
2303 device = prim_devmap->device; in dasd_copy_pair_store()
2304 if (device->discipline->pprc_enabled) { in dasd_copy_pair_store()
2305 pprc_enabled = device->discipline->pprc_enabled(device); in dasd_copy_pair_store()
2306 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_copy_pair_store()
2324 dasd_copy_role_show(struct device *dev, in dasd_copy_role_show()
2328 struct dasd_device *device; in dasd_copy_role_show() local
2331 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_copy_role_show()
2332 if (IS_ERR(device)) in dasd_copy_role_show()
2335 if (!device->copy) { in dasd_copy_role_show()
2339 copy = device->copy; in dasd_copy_role_show()
2341 if (copy->active->device == device) { in dasd_copy_role_show()
2346 if (copy->entry[i].device == device) { in dasd_copy_role_show()
2354 dasd_put_device(device); in dasd_copy_role_show()
2359 static ssize_t dasd_device_ping(struct device *dev, in dasd_device_ping()
2363 struct dasd_device *device; in dasd_device_ping() local
2366 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_ping()
2367 if (IS_ERR(device)) in dasd_device_ping()
2376 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_device_ping()
2380 if (!device->discipline || !device->discipline->device_ping) { in dasd_device_ping()
2384 rc = device->discipline->device_ping(device); in dasd_device_ping()
2388 dasd_put_device(device); in dasd_device_ping()
2394 static ssize_t dasd_##_name##_show(struct device *dev, \
2399 struct dasd_device *device = dasd_device_from_cdev(cdev); \
2402 if (IS_ERR(device)) \
2404 if (device->discipline && _func) \
2405 val = _func(device); \
2406 dasd_put_device(device); \
2412 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
2413 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
2414 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
2415 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
2416 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
2417 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
2418 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
2419 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
2420 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
2529 if (devmap->device) in dasd_set_feature()
2530 devmap->device->features = devmap->features; in dasd_set_feature()
2548 static void dasd_path_init_kobj(struct dasd_device *device, int chp) in dasd_path_init_kobj() argument
2550 device->path[chp].kobj.kset = device->paths_info; in dasd_path_init_kobj()
2551 kobject_init(&device->path[chp].kobj, &path_attr_type); in dasd_path_init_kobj()
2554 void dasd_path_create_kobj(struct dasd_device *device, int chp) in dasd_path_create_kobj() argument
2558 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) in dasd_path_create_kobj()
2560 if (!device->paths_info) { in dasd_path_create_kobj()
2561 dev_warn(&device->cdev->dev, "Unable to create paths objects\n"); in dasd_path_create_kobj()
2564 if (device->path[chp].in_sysfs) in dasd_path_create_kobj()
2566 if (!device->path[chp].conf_data) in dasd_path_create_kobj()
2569 dasd_path_init_kobj(device, chp); in dasd_path_create_kobj()
2571 rc = kobject_add(&device->path[chp].kobj, NULL, "%x.%02x", in dasd_path_create_kobj()
2572 device->path[chp].cssid, device->path[chp].chpid); in dasd_path_create_kobj()
2574 kobject_put(&device->path[chp].kobj); in dasd_path_create_kobj()
2575 device->path[chp].in_sysfs = true; in dasd_path_create_kobj()
2579 void dasd_path_create_kobjects(struct dasd_device *device) in dasd_path_create_kobjects() argument
2583 opm = dasd_path_get_opm(device); in dasd_path_create_kobjects()
2587 dasd_path_create_kobj(device, pathmask_to_pos(lpm)); in dasd_path_create_kobjects()
2592 static void dasd_path_remove_kobj(struct dasd_device *device, int chp) in dasd_path_remove_kobj() argument
2594 if (device->path[chp].in_sysfs) { in dasd_path_remove_kobj()
2595 kobject_put(&device->path[chp].kobj); in dasd_path_remove_kobj()
2596 device->path[chp].in_sysfs = false; in dasd_path_remove_kobj()
2604 void dasd_path_remove_kobjects(struct dasd_device *device) in dasd_path_remove_kobjects() argument
2609 dasd_path_remove_kobj(device, i); in dasd_path_remove_kobjects()