Lines Matching full:device

10  * Device mapping and dasd= parameter parsing functions. All devmap
38 * between device number and device index. To find a dasd_devmap_t
39 * that corresponds to a device number of a device index each
41 * the device number and one to search by the device index. As
42 * soon as big minor numbers are available the device index list
43 * can be removed since the device number will then be identical
44 * to the device index.
51 struct dasd_device *device; member
131 * Read a device busid/devno from a string.
141 pr_err("The IPL device is not a CCW device\n"); in dasd_busid()
206 pr_warn("%.*s is not a supported device option\n", in dasd_feature_list()
274 * Split a string of a device range into its pieces and return the from, to, and
286 /* Do we have a range or a single device? */ in dasd_evaluate_range_param()
305 * Try to interprete the range string as a device number or a range of devices.
345 pr_err("%s is not a valid device range\n", range); in dasd_parse_range()
356 /* each device in dasd= parameter should be set initially online */ in dasd_parse_range()
376 * keywords and device ranges. The parameters in that list will be stored as
404 * Add a devmap for the device specified by busid. It is possible that
431 new->device = NULL; in dasd_add_busid()
459 * Find devmap for device with given bus_id.
482 * Forget all about the device numbers added so far.
494 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
503 * Find the device struct by its device index.
509 struct dasd_device *device; in dasd_device_from_devindex() local
517 /* Found the devmap for the device. */ in dasd_device_from_devindex()
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()
547 * Create a dasd device structure for cdev.
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()
625 * depending on the primary/secondary state of the device it has to be
652 * - is the given device part of a copy pair setup
653 * - does the state of the device match the state in the PPRC status data
654 * - does the device UID match with the UID in the PPRC status data
655 * - to prevent misrouted IO check if the given device is present in all
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()
678 /* double check which role the current device has */ 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()
687 "Primary device %s does not match copy pair status primary device %04x\n", 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()
701 "Secondary device %s does not match copy pair status secondary device %04x\n", in dasd_devmap_check_copy_relation()
702 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
710 * the current device has to be part of the copy relation of all 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()
727 "Copy pair relation does not contain device: %s\n", in dasd_devmap_check_copy_relation()
728 dev_name(&device->cdev->dev)); in dasd_devmap_check_copy_relation()
737 /* delete device from copy relation entry */
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()
756 * read all required information for a copy relation setup and setup the 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()
778 /* no copy pair setup for this 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()
834 * Remove a dasd device structure. The passed referenced
838 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
844 /* First remove device pointer from devmap. */ in dasd_delete_device()
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()
883 /* Now the device structure can be freed. */ 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
900 * This function needs to be called with the ccw device
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()
1052 /* Increase open_count to avoid losing the block device */ 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()
1103 * to talk to the device
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()
1385 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1387 struct dasd_device *device; in dasd_uid_show() local
1392 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1394 if (IS_ERR(device)) in dasd_uid_show()
1397 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1398 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1412 /* should not happen, treat like base device */ in dasd_uid_show()
1428 dasd_put_device(device); in dasd_uid_show()
1438 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1444 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1445 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1452 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1455 struct dasd_device *device; in dasd_eer_store() local
1459 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1460 if (IS_ERR(device)) in dasd_eer_store()
1461 return PTR_ERR(device); in dasd_eer_store()
1467 rc = dasd_eer_enable(device); in dasd_eer_store()
1469 dasd_eer_disable(device); in dasd_eer_store()
1471 dasd_put_device(device); in dasd_eer_store()
1482 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1484 struct dasd_device *device; in dasd_expires_show() local
1487 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1488 if (IS_ERR(device)) in dasd_expires_show()
1490 len = sysfs_emit(buf, "%lu\n", device->default_expires); in dasd_expires_show()
1491 dasd_put_device(device); in dasd_expires_show()
1496 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1499 struct dasd_device *device; in dasd_expires_store() local
1502 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1503 if (IS_ERR(device)) in dasd_expires_store()
1508 dasd_put_device(device); in dasd_expires_store()
1513 device->default_expires = val; in dasd_expires_store()
1515 dasd_put_device(device); in dasd_expires_store()
1522 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1524 struct dasd_device *device; in dasd_retries_show() local
1527 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1528 if (IS_ERR(device)) in dasd_retries_show()
1530 len = sysfs_emit(buf, "%lu\n", device->default_retries); in dasd_retries_show()
1531 dasd_put_device(device); in dasd_retries_show()
1536 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1539 struct dasd_device *device; in dasd_retries_store() local
1542 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1543 if (IS_ERR(device)) in dasd_retries_store()
1548 dasd_put_device(device); in dasd_retries_store()
1553 device->default_retries = val; in dasd_retries_store()
1555 dasd_put_device(device); in dasd_retries_store()
1562 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1565 struct dasd_device *device; in dasd_timeout_show() local
1568 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1569 if (IS_ERR(device)) in dasd_timeout_show()
1571 len = sysfs_emit(buf, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1572 dasd_put_device(device); in dasd_timeout_show()
1577 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1580 struct dasd_device *device; in dasd_timeout_store() local
1583 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1584 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1589 dasd_put_device(device); in dasd_timeout_store()
1592 if (!device->block->gdp) { in dasd_timeout_store()
1593 dasd_put_device(device); in dasd_timeout_store()
1597 device->blk_timeout = val; in dasd_timeout_store()
1598 blk_queue_rq_timeout(device->block->gdp->queue, val * HZ); in dasd_timeout_store()
1600 dasd_put_device(device); in dasd_timeout_store()
1609 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1612 struct dasd_device *device; in dasd_path_reset_store() local
1615 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1616 if (IS_ERR(device)) in dasd_path_reset_store()
1622 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1623 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1625 dasd_put_device(device); in dasd_path_reset_store()
1631 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1634 struct dasd_device *device; in dasd_hpf_show() local
1637 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1638 if (IS_ERR(device)) in dasd_hpf_show()
1640 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1641 dasd_put_device(device); in dasd_hpf_show()
1644 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1645 dasd_put_device(device); in dasd_hpf_show()
1651 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1672 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1692 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1696 struct dasd_device *device; in dasd_reservation_state_show() local
1699 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1700 if (IS_ERR(device)) in dasd_reservation_state_show()
1703 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1705 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1709 dasd_put_device(device); in dasd_reservation_state_show()
1713 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1717 struct dasd_device *device; in dasd_reservation_state_store() local
1720 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1721 if (IS_ERR(device)) in dasd_reservation_state_store()
1724 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1727 dasd_put_device(device); in dasd_reservation_state_store()
1738 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1741 struct dasd_device *device; in dasd_pm_show() local
1744 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1745 if (IS_ERR(device)) in dasd_pm_show()
1748 opm = dasd_path_get_opm(device); in dasd_pm_show()
1749 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1750 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1751 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1752 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1753 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1754 dasd_put_device(device); in dasd_pm_show()
1766 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1769 struct dasd_device *device; in dasd_path_threshold_show() local
1772 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1773 if (IS_ERR(device)) in dasd_path_threshold_show()
1775 len = sysfs_emit(buf, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1776 dasd_put_device(device); in dasd_path_threshold_show()
1781 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1784 struct dasd_device *device; in dasd_path_threshold_store() local
1788 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1789 if (IS_ERR(device)) in dasd_path_threshold_store()
1793 dasd_put_device(device); in dasd_path_threshold_store()
1797 device->path_thrhld = val; in dasd_path_threshold_store()
1799 dasd_put_device(device); in dasd_path_threshold_store()
1810 dasd_path_autodisable_show(struct device *dev, in dasd_path_autodisable_show()
1826 dasd_path_autodisable_store(struct device *dev, in dasd_path_autodisable_store()
1851 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1854 struct dasd_device *device; in dasd_path_interval_show() local
1857 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1858 if (IS_ERR(device)) in dasd_path_interval_show()
1860 len = sysfs_emit(buf, "%lu\n", device->path_interval); in dasd_path_interval_show()
1861 dasd_put_device(device); in dasd_path_interval_show()
1866 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1869 struct dasd_device *device; in dasd_path_interval_store() local
1873 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1874 if (IS_ERR(device)) in dasd_path_interval_store()
1879 dasd_put_device(device); in dasd_path_interval_store()
1884 device->path_interval = val; in dasd_path_interval_store()
1886 dasd_put_device(device); in dasd_path_interval_store()
1894 dasd_device_fcs_show(struct device *dev, struct device_attribute *attr, in dasd_device_fcs_show()
1897 struct dasd_device *device; in dasd_device_fcs_show() local
1901 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_fcs_show()
1902 if (IS_ERR(device)) in dasd_device_fcs_show()
1904 fc_sec = dasd_path_get_fcs_device(device); in dasd_device_fcs_show()
1909 dasd_put_device(device); in dasd_device_fcs_show()
1932 dasd_copy_pair_show(struct device *dev, in dasd_copy_pair_show()
2029 static int dasd_devmap_clear_copy_relation(struct device *dev) in dasd_devmap_clear_copy_relation()
2049 if (copy->entry[i].device == copy->active->device) in dasd_devmap_clear_copy_relation()
2052 if (copy->entry[i].device) in dasd_devmap_clear_copy_relation()
2059 if (copy->entry[i].device) { in dasd_devmap_clear_copy_relation()
2060 dasd_put_device(copy->entry[i].device); in dasd_devmap_clear_copy_relation()
2061 copy->entry[i].device->copy = NULL; in dasd_devmap_clear_copy_relation()
2062 copy->entry[i].device = NULL; in dasd_devmap_clear_copy_relation()
2114 static ssize_t dasd_copy_pair_store(struct device *dev, in dasd_copy_pair_store()
2122 struct dasd_device *device; in dasd_copy_pair_store() local
2151 if (sec_devmap->device) in dasd_copy_pair_store()
2176 /* if primary device is already online call device setup directly */ in dasd_copy_pair_store()
2177 if (prim_devmap->device && !prim_devmap->device->copy) { in dasd_copy_pair_store()
2178 device = prim_devmap->device; in dasd_copy_pair_store()
2179 if (device->discipline->pprc_enabled) { in dasd_copy_pair_store()
2180 pprc_enabled = device->discipline->pprc_enabled(device); in dasd_copy_pair_store()
2181 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_copy_pair_store()
2199 dasd_copy_role_show(struct device *dev, in dasd_copy_role_show()
2203 struct dasd_device *device; in dasd_copy_role_show() local
2206 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_copy_role_show()
2207 if (IS_ERR(device)) in dasd_copy_role_show()
2210 if (!device->copy) { in dasd_copy_role_show()
2214 copy = device->copy; in dasd_copy_role_show()
2215 /* only the active device is primary */ in dasd_copy_role_show()
2216 if (copy->active->device == device) { in dasd_copy_role_show()
2221 if (copy->entry[i].device == device) { in dasd_copy_role_show()
2229 dasd_put_device(device); in dasd_copy_role_show()
2234 static ssize_t dasd_device_ping(struct device *dev, in dasd_device_ping()
2238 struct dasd_device *device; in dasd_device_ping() local
2241 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_ping()
2242 if (IS_ERR(device)) in dasd_device_ping()
2251 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_device_ping()
2255 if (!device->discipline || !device->discipline->device_ping) { in dasd_device_ping()
2259 rc = device->discipline->device_ping(device); in dasd_device_ping()
2263 dasd_put_device(device); in dasd_device_ping()
2269 static ssize_t dasd_##_name##_show(struct device *dev, \
2274 struct dasd_device *device = dasd_device_from_cdev(cdev); \
2277 if (IS_ERR(device)) \
2279 if (device->discipline && _func) \
2280 val = _func(device); \
2281 dasd_put_device(device); \
2287 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
2288 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
2289 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
2290 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
2291 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
2292 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
2293 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
2294 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
2295 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
2401 if (devmap->device) in dasd_set_feature()
2402 devmap->device->features = devmap->features; in dasd_set_feature()
2420 static void dasd_path_init_kobj(struct dasd_device *device, int chp) in dasd_path_init_kobj() argument
2422 device->path[chp].kobj.kset = device->paths_info; in dasd_path_init_kobj()
2423 kobject_init(&device->path[chp].kobj, &path_attr_type); in dasd_path_init_kobj()
2426 void dasd_path_create_kobj(struct dasd_device *device, int chp) in dasd_path_create_kobj() argument
2430 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) in dasd_path_create_kobj()
2432 if (!device->paths_info) { in dasd_path_create_kobj()
2433 dev_warn(&device->cdev->dev, "Unable to create paths objects\n"); in dasd_path_create_kobj()
2436 if (device->path[chp].in_sysfs) in dasd_path_create_kobj()
2438 if (!device->path[chp].conf_data) in dasd_path_create_kobj()
2441 dasd_path_init_kobj(device, chp); in dasd_path_create_kobj()
2443 rc = kobject_add(&device->path[chp].kobj, NULL, "%x.%02x", in dasd_path_create_kobj()
2444 device->path[chp].cssid, device->path[chp].chpid); in dasd_path_create_kobj()
2446 kobject_put(&device->path[chp].kobj); in dasd_path_create_kobj()
2447 device->path[chp].in_sysfs = true; in dasd_path_create_kobj()
2451 void dasd_path_create_kobjects(struct dasd_device *device) in dasd_path_create_kobjects() argument
2455 opm = dasd_path_get_opm(device); in dasd_path_create_kobjects()
2459 dasd_path_create_kobj(device, pathmask_to_pos(lpm)); in dasd_path_create_kobjects()
2464 static void dasd_path_remove_kobj(struct dasd_device *device, int chp) in dasd_path_remove_kobj() argument
2466 if (device->path[chp].in_sysfs) { in dasd_path_remove_kobj()
2467 kobject_put(&device->path[chp].kobj); in dasd_path_remove_kobj()
2468 device->path[chp].in_sysfs = false; in dasd_path_remove_kobj()
2473 * As we keep kobjects for the lifetime of a device, this function must not be
2474 * called anywhere but in the context of offlining a device.
2476 void dasd_path_remove_kobjects(struct dasd_device *device) in dasd_path_remove_kobjects() argument
2481 dasd_path_remove_kobj(device, i); in dasd_path_remove_kobjects()