Lines Matching refs:device
49 struct dasd_device *device; member
431 new->device = NULL; in dasd_add_busid()
494 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
509 struct dasd_device *device; in dasd_device_from_devindex() local
521 if (devmap && devmap->device) { in dasd_device_from_devindex()
522 device = devmap->device; in dasd_device_from_devindex()
523 dasd_get_device(device); in dasd_device_from_devindex()
525 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
527 return device; in dasd_device_from_devindex()
553 struct dasd_device *device; in dasd_create_device() local
561 device = dasd_alloc_device(); in dasd_create_device()
562 if (IS_ERR(device)) in dasd_create_device()
563 return device; in dasd_create_device()
564 atomic_set(&device->ref_count, 3); in dasd_create_device()
567 if (!devmap->device) { in dasd_create_device()
568 devmap->device = device; in dasd_create_device()
569 device->devindex = devmap->devindex; in dasd_create_device()
570 device->features = devmap->features; in dasd_create_device()
572 device->cdev = cdev; in dasd_create_device()
580 dasd_free_device(device); in dasd_create_device()
585 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
588 device->paths_info = kset_create_and_add("paths_info", NULL, in dasd_create_device()
589 &device->cdev->dev.kobj); in dasd_create_device()
590 if (!device->paths_info) in dasd_create_device()
593 return device; in dasd_create_device()
599 static int dasd_devmap_get_pprc_status(struct dasd_device *device, in dasd_devmap_get_pprc_status() argument
604 if (!device->discipline || !device->discipline->pprc_status) { in dasd_devmap_get_pprc_status()
605 dev_warn(&device->cdev->dev, "Unable to query copy relation status\n"); in dasd_devmap_get_pprc_status()
613 if (device->discipline->pprc_status(device, temp)) { in dasd_devmap_get_pprc_status()
614 dev_warn(&device->cdev->dev, "Error during copy relation status query\n"); in dasd_devmap_get_pprc_status()
658 static int dasd_devmap_check_copy_relation(struct dasd_device *device, in dasd_devmap_check_copy_relation() argument
668 if (!device->discipline || !device->discipline->get_uid || in dasd_devmap_check_copy_relation()
669 device->discipline->get_uid(device, &uid)) in dasd_devmap_check_copy_relation()
674 dev_warn(&device->cdev->dev, "Device not part of a copy relation\n"); in dasd_devmap_check_copy_relation()
681 dev_warn(&device->cdev->dev, "Copy pair secondary is setup as primary\n"); in dasd_devmap_check_copy_relation()
686 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
688 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
695 dev_warn(&device->cdev->dev, "Copy pair primary is setup as secondary\n"); in dasd_devmap_check_copy_relation()
700 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
702 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
715 tmp_dev = device; in dasd_devmap_check_copy_relation()
717 tmp_dev = copy->entry[j].device; in dasd_devmap_check_copy_relation()
728 dev_name(&device->cdev->dev)); in dasd_devmap_check_copy_relation()
738 static void dasd_devmap_delete_copy_relation_device(struct dasd_device *device) in dasd_devmap_delete_copy_relation_device() argument
743 if (!device->copy) in dasd_devmap_delete_copy_relation_device()
746 copy = device->copy; in dasd_devmap_delete_copy_relation_device()
748 if (copy->entry[i].device == device) in dasd_devmap_delete_copy_relation_device()
749 copy->entry[i].device = NULL; in dasd_devmap_delete_copy_relation_device()
751 dasd_put_device(device); in dasd_devmap_delete_copy_relation_device()
752 device->copy = NULL; in dasd_devmap_delete_copy_relation_device()
766 struct dasd_device *device; in dasd_devmap_set_device_copy_relation() local
773 device = devmap->device; in dasd_devmap_set_device_copy_relation()
774 if (!device) in dasd_devmap_set_device_copy_relation()
782 rc = dasd_devmap_get_pprc_status(device, &data); in dasd_devmap_set_device_copy_relation()
794 dev_warn(&device->cdev->dev, "Copy pair setup requested for device not in copy relation\n"); in dasd_devmap_set_device_copy_relation()
808 dev_warn(&device->cdev->dev, "Copy relation entry not found\n"); in dasd_devmap_set_device_copy_relation()
813 if (dasd_devmap_check_copy_relation(device, entry, data, copy)) { in dasd_devmap_set_device_copy_relation()
814 dev_warn(&device->cdev->dev, "Copy relation faulty\n"); in dasd_devmap_set_device_copy_relation()
819 dasd_get_device(device); in dasd_devmap_set_device_copy_relation()
820 copy->entry[i].device = device; in dasd_devmap_set_device_copy_relation()
821 device->copy = copy; in dasd_devmap_set_device_copy_relation()
838 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
845 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
848 if (devmap->device != device) { in dasd_delete_device()
850 dasd_put_device(device); in dasd_delete_device()
853 devmap->device = NULL; in dasd_delete_device()
857 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
858 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
859 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
862 dasd_devmap_delete_copy_relation_device(device); in dasd_delete_device()
867 atomic_sub(3, &device->ref_count); in dasd_delete_device()
870 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
872 dasd_generic_free_discipline(device); in dasd_delete_device()
874 kset_unregister(device->paths_info); in dasd_delete_device()
877 cdev = device->cdev; in dasd_delete_device()
878 device->cdev = NULL; in dasd_delete_device()
884 dasd_free_device(device); in dasd_delete_device()
892 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
906 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
908 if (!device) in dasd_device_from_cdev_locked()
910 dasd_get_device(device); in dasd_device_from_cdev_locked()
911 return device; in dasd_device_from_cdev_locked()
920 struct dasd_device *device; in dasd_device_from_cdev() local
924 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
926 return device; in dasd_device_from_cdev()
929 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
933 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
944 struct dasd_device *device; in dasd_device_from_gendisk() local
949 device = NULL; in dasd_device_from_gendisk()
952 if (devmap && devmap->device) { in dasd_device_from_gendisk()
953 device = devmap->device; in dasd_device_from_gendisk()
954 dasd_get_device(device); in dasd_device_from_gendisk()
957 return device; in dasd_device_from_gendisk()
967 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
981 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
1001 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
1004 struct dasd_device *device; in dasd_ro_show() local
1014 device = devmap->device; in dasd_ro_show()
1015 if (device) in dasd_ro_show()
1016 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_show()
1024 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
1028 struct dasd_device *device; in dasd_ro_store() local
1040 device = dasd_device_from_cdev(cdev); in dasd_ro_store()
1041 if (IS_ERR(device)) in dasd_ro_store()
1045 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
1047 if (!device->block || !device->block->gdp || in dasd_ro_store()
1048 test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_ro_store()
1053 atomic_inc(&device->block->open_count); in dasd_ro_store()
1056 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
1057 atomic_dec(&device->block->open_count); in dasd_ro_store()
1060 dasd_put_device(device); in dasd_ro_store()
1071 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
1085 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
1106 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
1120 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
1137 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
1155 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
1169 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
1186 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
1201 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, in dasd_safe_offline_store()
1205 struct dasd_device *device; in dasd_safe_offline_store() local
1210 device = dasd_device_from_cdev_locked(cdev); in dasd_safe_offline_store()
1211 if (IS_ERR(device)) { in dasd_safe_offline_store()
1212 rc = PTR_ERR(device); in dasd_safe_offline_store()
1217 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_safe_offline_store()
1218 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_safe_offline_store()
1220 dasd_put_device(device); in dasd_safe_offline_store()
1226 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); in dasd_safe_offline_store()
1227 dasd_put_device(device); in dasd_safe_offline_store()
1239 dasd_access_show(struct device *dev, struct device_attribute *attr, in dasd_access_show()
1243 struct dasd_device *device; in dasd_access_show() local
1246 device = dasd_device_from_cdev(cdev); in dasd_access_show()
1247 if (IS_ERR(device)) in dasd_access_show()
1248 return PTR_ERR(device); in dasd_access_show()
1250 if (!device->discipline) in dasd_access_show()
1252 else if (!device->discipline->host_access_count) in dasd_access_show()
1255 count = device->discipline->host_access_count(device); in dasd_access_show()
1257 dasd_put_device(device); in dasd_access_show()
1267 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
1270 struct dasd_device *device; in dasd_discipline_show() local
1273 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
1274 if (IS_ERR(device)) in dasd_discipline_show()
1276 else if (!device->discipline) { in dasd_discipline_show()
1277 dasd_put_device(device); in dasd_discipline_show()
1281 device->discipline->name); in dasd_discipline_show()
1282 dasd_put_device(device); in dasd_discipline_show()
1293 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
1296 struct dasd_device *device; in dasd_device_status_show() local
1299 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
1300 if (!IS_ERR(device)) { in dasd_device_status_show()
1301 switch (device->state) { in dasd_device_status_show()
1324 dasd_put_device(device); in dasd_device_status_show()
1332 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1335 struct dasd_device *device; in dasd_alias_show() local
1338 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1339 if (IS_ERR(device)) in dasd_alias_show()
1342 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1343 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1346 dasd_put_device(device); in dasd_alias_show()
1350 dasd_put_device(device); in dasd_alias_show()
1357 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1360 struct dasd_device *device; in dasd_vendor_show() local
1364 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1366 if (IS_ERR(device)) in dasd_vendor_show()
1369 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1370 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1373 dasd_put_device(device); in dasd_vendor_show()
1381 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1384 struct dasd_device *device; in dasd_uid_show() local
1388 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1390 if (IS_ERR(device)) in dasd_uid_show()
1393 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1394 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1418 dasd_put_device(device); in dasd_uid_show()
1428 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1434 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1435 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1442 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1445 struct dasd_device *device; in dasd_eer_store() local
1449 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1450 if (IS_ERR(device)) in dasd_eer_store()
1451 return PTR_ERR(device); in dasd_eer_store()
1457 rc = dasd_eer_enable(device); in dasd_eer_store()
1459 dasd_eer_disable(device); in dasd_eer_store()
1461 dasd_put_device(device); in dasd_eer_store()
1472 static ssize_t dasd_aq_mask_show(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_show()
1485 static ssize_t dasd_aq_mask_store(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_store()
1500 if (devmap->device) in dasd_aq_mask_store()
1501 devmap->device->aq_mask = devmap->aq_mask; in dasd_aq_mask_store()
1513 static ssize_t dasd_aqr_show(struct device *dev, struct device_attribute *attr, in dasd_aqr_show()
1528 static ssize_t dasd_aqr_store(struct device *dev, struct device_attribute *attr, in dasd_aqr_store()
1549 dasd_aq_timeouts_show(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_show()
1552 struct dasd_device *device; in dasd_aq_timeouts_show() local
1555 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_show()
1556 if (IS_ERR(device)) in dasd_aq_timeouts_show()
1558 len = sysfs_emit(buf, "%u\n", device->aq_timeouts); in dasd_aq_timeouts_show()
1559 dasd_put_device(device); in dasd_aq_timeouts_show()
1564 dasd_aq_timeouts_store(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_store()
1567 struct dasd_device *device; in dasd_aq_timeouts_store() local
1570 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_store()
1571 if (IS_ERR(device)) in dasd_aq_timeouts_store()
1576 dasd_put_device(device); in dasd_aq_timeouts_store()
1581 device->aq_timeouts = val; in dasd_aq_timeouts_store()
1583 dasd_put_device(device); in dasd_aq_timeouts_store()
1594 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1596 struct dasd_device *device; in dasd_expires_show() local
1599 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1600 if (IS_ERR(device)) in dasd_expires_show()
1602 len = sysfs_emit(buf, "%lu\n", device->default_expires); in dasd_expires_show()
1603 dasd_put_device(device); in dasd_expires_show()
1608 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1611 struct dasd_device *device; in dasd_expires_store() local
1614 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1615 if (IS_ERR(device)) in dasd_expires_store()
1620 dasd_put_device(device); in dasd_expires_store()
1625 device->default_expires = val; in dasd_expires_store()
1627 dasd_put_device(device); in dasd_expires_store()
1634 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1636 struct dasd_device *device; in dasd_retries_show() local
1639 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1640 if (IS_ERR(device)) in dasd_retries_show()
1642 len = sysfs_emit(buf, "%lu\n", device->default_retries); in dasd_retries_show()
1643 dasd_put_device(device); in dasd_retries_show()
1648 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1651 struct dasd_device *device; in dasd_retries_store() local
1654 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1655 if (IS_ERR(device)) in dasd_retries_store()
1660 dasd_put_device(device); in dasd_retries_store()
1665 device->default_retries = val; in dasd_retries_store()
1667 dasd_put_device(device); in dasd_retries_store()
1674 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1677 struct dasd_device *device; in dasd_timeout_show() local
1680 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1681 if (IS_ERR(device)) in dasd_timeout_show()
1683 len = sysfs_emit(buf, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1684 dasd_put_device(device); in dasd_timeout_show()
1689 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1692 struct dasd_device *device; in dasd_timeout_store() local
1695 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1696 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1701 dasd_put_device(device); in dasd_timeout_store()
1704 if (!device->block->gdp) { in dasd_timeout_store()
1705 dasd_put_device(device); in dasd_timeout_store()
1709 device->blk_timeout = val; in dasd_timeout_store()
1710 blk_queue_rq_timeout(device->block->gdp->queue, val * HZ); in dasd_timeout_store()
1712 dasd_put_device(device); in dasd_timeout_store()
1721 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1724 struct dasd_device *device; in dasd_path_reset_store() local
1727 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1728 if (IS_ERR(device)) in dasd_path_reset_store()
1734 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1735 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1737 dasd_put_device(device); in dasd_path_reset_store()
1743 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1746 struct dasd_device *device; in dasd_hpf_show() local
1749 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1750 if (IS_ERR(device)) in dasd_hpf_show()
1752 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1753 dasd_put_device(device); in dasd_hpf_show()
1756 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1757 dasd_put_device(device); in dasd_hpf_show()
1763 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1784 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1804 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1808 struct dasd_device *device; in dasd_reservation_state_show() local
1811 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1812 if (IS_ERR(device)) in dasd_reservation_state_show()
1815 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1817 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1821 dasd_put_device(device); in dasd_reservation_state_show()
1825 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1829 struct dasd_device *device; in dasd_reservation_state_store() local
1832 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1833 if (IS_ERR(device)) in dasd_reservation_state_store()
1836 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1839 dasd_put_device(device); in dasd_reservation_state_store()
1850 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1853 struct dasd_device *device; in dasd_pm_show() local
1856 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1857 if (IS_ERR(device)) in dasd_pm_show()
1860 opm = dasd_path_get_opm(device); in dasd_pm_show()
1861 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1862 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1863 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1864 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1865 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1866 dasd_put_device(device); in dasd_pm_show()
1878 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1881 struct dasd_device *device; in dasd_path_threshold_show() local
1884 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1885 if (IS_ERR(device)) in dasd_path_threshold_show()
1887 len = sysfs_emit(buf, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1888 dasd_put_device(device); in dasd_path_threshold_show()
1893 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1896 struct dasd_device *device; in dasd_path_threshold_store() local
1900 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1901 if (IS_ERR(device)) in dasd_path_threshold_store()
1905 dasd_put_device(device); in dasd_path_threshold_store()
1909 device->path_thrhld = val; in dasd_path_threshold_store()
1911 dasd_put_device(device); in dasd_path_threshold_store()
1922 dasd_path_autodisable_show(struct device *dev, in dasd_path_autodisable_show()
1938 dasd_path_autodisable_store(struct device *dev, in dasd_path_autodisable_store()
1963 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1966 struct dasd_device *device; in dasd_path_interval_show() local
1969 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1970 if (IS_ERR(device)) in dasd_path_interval_show()
1972 len = sysfs_emit(buf, "%lu\n", device->path_interval); in dasd_path_interval_show()
1973 dasd_put_device(device); in dasd_path_interval_show()
1978 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1981 struct dasd_device *device; in dasd_path_interval_store() local
1985 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1986 if (IS_ERR(device)) in dasd_path_interval_store()
1991 dasd_put_device(device); in dasd_path_interval_store()
1996 device->path_interval = val; in dasd_path_interval_store()
1998 dasd_put_device(device); in dasd_path_interval_store()
2006 dasd_device_fcs_show(struct device *dev, struct device_attribute *attr, in dasd_device_fcs_show()
2009 struct dasd_device *device; in dasd_device_fcs_show() local
2013 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_fcs_show()
2014 if (IS_ERR(device)) in dasd_device_fcs_show()
2016 fc_sec = dasd_path_get_fcs_device(device); in dasd_device_fcs_show()
2021 dasd_put_device(device); in dasd_device_fcs_show()
2044 dasd_copy_pair_show(struct device *dev, in dasd_copy_pair_show()
2141 static int dasd_devmap_clear_copy_relation(struct device *dev) in dasd_devmap_clear_copy_relation()
2161 if (copy->entry[i].device == copy->active->device) in dasd_devmap_clear_copy_relation()
2164 if (copy->entry[i].device) in dasd_devmap_clear_copy_relation()
2171 if (copy->entry[i].device) { in dasd_devmap_clear_copy_relation()
2172 dasd_put_device(copy->entry[i].device); in dasd_devmap_clear_copy_relation()
2173 copy->entry[i].device->copy = NULL; in dasd_devmap_clear_copy_relation()
2174 copy->entry[i].device = NULL; in dasd_devmap_clear_copy_relation()
2226 static ssize_t dasd_copy_pair_store(struct device *dev, in dasd_copy_pair_store()
2234 struct dasd_device *device; in dasd_copy_pair_store() local
2269 if (sec_devmap->device) in dasd_copy_pair_store()
2295 if (prim_devmap->device && !prim_devmap->device->copy) { in dasd_copy_pair_store()
2296 device = prim_devmap->device; in dasd_copy_pair_store()
2297 if (device->discipline->pprc_enabled) { in dasd_copy_pair_store()
2298 pprc_enabled = device->discipline->pprc_enabled(device); in dasd_copy_pair_store()
2299 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_copy_pair_store()
2317 dasd_copy_role_show(struct device *dev, in dasd_copy_role_show()
2321 struct dasd_device *device; in dasd_copy_role_show() local
2324 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_copy_role_show()
2325 if (IS_ERR(device)) in dasd_copy_role_show()
2328 if (!device->copy) { in dasd_copy_role_show()
2332 copy = device->copy; in dasd_copy_role_show()
2334 if (copy->active->device == device) { in dasd_copy_role_show()
2339 if (copy->entry[i].device == device) { in dasd_copy_role_show()
2347 dasd_put_device(device); in dasd_copy_role_show()
2352 static ssize_t dasd_device_ping(struct device *dev, in dasd_device_ping()
2356 struct dasd_device *device; in dasd_device_ping() local
2359 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_ping()
2360 if (IS_ERR(device)) in dasd_device_ping()
2369 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_device_ping()
2373 if (!device->discipline || !device->discipline->device_ping) { in dasd_device_ping()
2377 rc = device->discipline->device_ping(device); in dasd_device_ping()
2381 dasd_put_device(device); in dasd_device_ping()
2387 static ssize_t dasd_##_name##_show(struct device *dev, \
2392 struct dasd_device *device = dasd_device_from_cdev(cdev); \
2395 if (IS_ERR(device)) \
2397 if (device->discipline && _func) \
2398 val = _func(device); \
2399 dasd_put_device(device); \
2405 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
2406 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
2407 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
2408 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
2409 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
2410 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
2411 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
2412 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
2413 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
2522 if (devmap->device) in dasd_set_feature()
2523 devmap->device->features = devmap->features; in dasd_set_feature()
2541 static void dasd_path_init_kobj(struct dasd_device *device, int chp) in dasd_path_init_kobj() argument
2543 device->path[chp].kobj.kset = device->paths_info; in dasd_path_init_kobj()
2544 kobject_init(&device->path[chp].kobj, &path_attr_type); in dasd_path_init_kobj()
2547 void dasd_path_create_kobj(struct dasd_device *device, int chp) in dasd_path_create_kobj() argument
2551 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) in dasd_path_create_kobj()
2553 if (!device->paths_info) { in dasd_path_create_kobj()
2554 dev_warn(&device->cdev->dev, "Unable to create paths objects\n"); in dasd_path_create_kobj()
2557 if (device->path[chp].in_sysfs) in dasd_path_create_kobj()
2559 if (!device->path[chp].conf_data) in dasd_path_create_kobj()
2562 dasd_path_init_kobj(device, chp); in dasd_path_create_kobj()
2564 rc = kobject_add(&device->path[chp].kobj, NULL, "%x.%02x", in dasd_path_create_kobj()
2565 device->path[chp].cssid, device->path[chp].chpid); in dasd_path_create_kobj()
2567 kobject_put(&device->path[chp].kobj); in dasd_path_create_kobj()
2568 device->path[chp].in_sysfs = true; in dasd_path_create_kobj()
2572 void dasd_path_create_kobjects(struct dasd_device *device) in dasd_path_create_kobjects() argument
2576 opm = dasd_path_get_opm(device); in dasd_path_create_kobjects()
2580 dasd_path_create_kobj(device, pathmask_to_pos(lpm)); in dasd_path_create_kobjects()
2585 static void dasd_path_remove_kobj(struct dasd_device *device, int chp) in dasd_path_remove_kobj() argument
2587 if (device->path[chp].in_sysfs) { in dasd_path_remove_kobj()
2588 kobject_put(&device->path[chp].kobj); in dasd_path_remove_kobj()
2589 device->path[chp].in_sysfs = false; in dasd_path_remove_kobj()
2597 void dasd_path_remove_kobjects(struct dasd_device *device) in dasd_path_remove_kobjects() argument
2602 dasd_path_remove_kobj(device, i); in dasd_path_remove_kobjects()