Lines Matching full:device

10  * Device mapping and dasd= parameter parsing functions. All devmap
35 * between device number and device index. To find a dasd_devmap_t
36 * that corresponds to a device number of a device index each
38 * the device number and one to search by the device index. As
39 * soon as big minor numbers are available the device index list
40 * can be removed since the device number will then be identical
41 * to the device index.
48 struct dasd_device *device; member
129 * Read a device busid/devno from a string.
139 pr_err("The IPL device is not a CCW device\n"); in dasd_busid()
204 pr_warn("%.*s is not a supported device option\n", in dasd_feature_list()
272 * Split a string of a device range into its pieces and return the from, to, and
284 /* Do we have a range or a single device? */ in dasd_evaluate_range_param()
303 * Try to interprete the range string as a device number or a range of devices.
343 pr_err("%s is not a valid device range\n", range); in dasd_parse_range()
354 /* each device in dasd= parameter should be set initially online */ in dasd_parse_range()
374 * keywords and device ranges. The parameters in that list will be stored as
402 * Add a devmap for the device specified by busid. It is possible that
429 new->device = NULL; in dasd_add_busid()
457 * Find devmap for device with given bus_id.
480 * Forget all about the device numbers added so far.
492 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
501 * Find the device struct by its device index.
507 struct dasd_device *device; in dasd_device_from_devindex() local
515 /* Found the devmap for the device. */ in dasd_device_from_devindex()
519 if (devmap && devmap->device) { in dasd_device_from_devindex()
520 device = devmap->device; in dasd_device_from_devindex()
521 dasd_get_device(device); in dasd_device_from_devindex()
523 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
525 return device; in dasd_device_from_devindex()
545 * Create a dasd device structure for cdev.
551 struct dasd_device *device; in dasd_create_device() local
559 device = dasd_alloc_device(); in dasd_create_device()
560 if (IS_ERR(device)) in dasd_create_device()
561 return device; in dasd_create_device()
562 atomic_set(&device->ref_count, 3); in dasd_create_device()
565 if (!devmap->device) { in dasd_create_device()
566 devmap->device = device; in dasd_create_device()
567 device->devindex = devmap->devindex; in dasd_create_device()
568 device->features = devmap->features; in dasd_create_device()
570 device->cdev = cdev; in dasd_create_device()
578 dasd_free_device(device); in dasd_create_device()
583 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
586 device->paths_info = kset_create_and_add("paths_info", NULL, in dasd_create_device()
587 &device->cdev->dev.kobj); in dasd_create_device()
588 if (!device->paths_info) in dasd_create_device()
591 return device; in dasd_create_device()
597 static int dasd_devmap_get_pprc_status(struct dasd_device *device, in dasd_devmap_get_pprc_status() argument
602 if (!device->discipline || !device->discipline->pprc_status) { in dasd_devmap_get_pprc_status()
603 dev_warn(&device->cdev->dev, "Unable to query copy relation status\n"); in dasd_devmap_get_pprc_status()
611 if (device->discipline->pprc_status(device, temp)) { in dasd_devmap_get_pprc_status()
612 dev_warn(&device->cdev->dev, "Error during copy relation status query\n"); in dasd_devmap_get_pprc_status()
623 * depending on the primary/secondary state of the device it has to be
650 * - is the given device part of a copy pair setup
651 * - does the state of the device match the state in the PPRC status data
652 * - does the device UID match with the UID in the PPRC status data
653 * - to prevent misrouted IO check if the given device is present in all
656 static int dasd_devmap_check_copy_relation(struct dasd_device *device, in dasd_devmap_check_copy_relation() argument
666 if (!device->discipline || !device->discipline->get_uid || in dasd_devmap_check_copy_relation()
667 device->discipline->get_uid(device, &uid)) in dasd_devmap_check_copy_relation()
672 dev_warn(&device->cdev->dev, "Device not part of a copy relation\n"); in dasd_devmap_check_copy_relation()
676 /* double check which role the current device has */ in dasd_devmap_check_copy_relation()
679 dev_warn(&device->cdev->dev, "Copy pair secondary is setup as primary\n"); in dasd_devmap_check_copy_relation()
684 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
685 "Primary device %s does not match copy pair status primary device %04x\n", in dasd_devmap_check_copy_relation()
686 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
693 dev_warn(&device->cdev->dev, "Copy pair primary is setup as secondary\n"); in dasd_devmap_check_copy_relation()
698 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
699 "Secondary device %s does not match copy pair status secondary device %04x\n", in dasd_devmap_check_copy_relation()
700 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
708 * the current device has to be part of the copy relation of all in dasd_devmap_check_copy_relation()
713 tmp_dev = device; in dasd_devmap_check_copy_relation()
715 tmp_dev = copy->entry[j].device; in dasd_devmap_check_copy_relation()
725 "Copy pair relation does not contain device: %s\n", in dasd_devmap_check_copy_relation()
726 dev_name(&device->cdev->dev)); in dasd_devmap_check_copy_relation()
735 /* delete device from copy relation entry */
736 static void dasd_devmap_delete_copy_relation_device(struct dasd_device *device) in dasd_devmap_delete_copy_relation_device() argument
741 if (!device->copy) in dasd_devmap_delete_copy_relation_device()
744 copy = device->copy; in dasd_devmap_delete_copy_relation_device()
746 if (copy->entry[i].device == device) in dasd_devmap_delete_copy_relation_device()
747 copy->entry[i].device = NULL; in dasd_devmap_delete_copy_relation_device()
749 dasd_put_device(device); in dasd_devmap_delete_copy_relation_device()
750 device->copy = NULL; in dasd_devmap_delete_copy_relation_device()
754 * read all required information for a copy relation setup and setup the device
764 struct dasd_device *device; in dasd_devmap_set_device_copy_relation() local
771 device = devmap->device; in dasd_devmap_set_device_copy_relation()
772 if (!device) in dasd_devmap_set_device_copy_relation()
776 /* no copy pair setup for this device */ in dasd_devmap_set_device_copy_relation()
780 rc = dasd_devmap_get_pprc_status(device, &data); in dasd_devmap_set_device_copy_relation()
792 dev_warn(&device->cdev->dev, "Copy pair setup requested for device not in copy relation\n"); in dasd_devmap_set_device_copy_relation()
806 dev_warn(&device->cdev->dev, "Copy relation entry not found\n"); in dasd_devmap_set_device_copy_relation()
811 if (dasd_devmap_check_copy_relation(device, entry, data, copy)) { in dasd_devmap_set_device_copy_relation()
812 dev_warn(&device->cdev->dev, "Copy relation faulty\n"); in dasd_devmap_set_device_copy_relation()
817 dasd_get_device(device); in dasd_devmap_set_device_copy_relation()
818 copy->entry[i].device = device; in dasd_devmap_set_device_copy_relation()
819 device->copy = copy; in dasd_devmap_set_device_copy_relation()
832 * Remove a dasd device structure. The passed referenced
836 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
842 /* First remove device pointer from devmap. */ in dasd_delete_device()
843 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
846 if (devmap->device != device) { in dasd_delete_device()
848 dasd_put_device(device); in dasd_delete_device()
851 devmap->device = NULL; in dasd_delete_device()
855 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
856 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
857 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
860 dasd_devmap_delete_copy_relation_device(device); in dasd_delete_device()
865 atomic_sub(3, &device->ref_count); in dasd_delete_device()
868 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
870 dasd_generic_free_discipline(device); in dasd_delete_device()
872 kset_unregister(device->paths_info); in dasd_delete_device()
875 cdev = device->cdev; in dasd_delete_device()
876 device->cdev = NULL; in dasd_delete_device()
881 /* Now the device structure can be freed. */ in dasd_delete_device()
882 dasd_free_device(device); in dasd_delete_device()
890 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
898 * This function needs to be called with the ccw device
904 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
906 if (!device) in dasd_device_from_cdev_locked()
908 dasd_get_device(device); in dasd_device_from_cdev_locked()
909 return device; in dasd_device_from_cdev_locked()
918 struct dasd_device *device; in dasd_device_from_cdev() local
922 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
924 return device; in dasd_device_from_cdev()
927 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
931 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
942 struct dasd_device *device; in dasd_device_from_gendisk() local
947 device = NULL; in dasd_device_from_gendisk()
950 if (devmap && devmap->device) { in dasd_device_from_gendisk()
951 device = devmap->device; in dasd_device_from_gendisk()
952 dasd_get_device(device); in dasd_device_from_gendisk()
955 return device; in dasd_device_from_gendisk()
965 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
979 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
999 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
1002 struct dasd_device *device; in dasd_ro_show() local
1012 device = devmap->device; in dasd_ro_show()
1013 if (device) in dasd_ro_show()
1014 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_show()
1022 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
1026 struct dasd_device *device; in dasd_ro_store() local
1038 device = dasd_device_from_cdev(cdev); in dasd_ro_store()
1039 if (IS_ERR(device)) in dasd_ro_store()
1043 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
1045 if (!device->block || !device->block->gdp || in dasd_ro_store()
1046 test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_ro_store()
1050 /* Increase open_count to avoid losing the block device */ in dasd_ro_store()
1051 atomic_inc(&device->block->open_count); in dasd_ro_store()
1054 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
1055 atomic_dec(&device->block->open_count); in dasd_ro_store()
1058 dasd_put_device(device); in dasd_ro_store()
1069 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
1083 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
1101 * to talk to the device
1104 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
1118 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
1135 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
1153 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
1167 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
1184 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
1199 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, in dasd_safe_offline_store()
1203 struct dasd_device *device; in dasd_safe_offline_store() local
1208 device = dasd_device_from_cdev_locked(cdev); in dasd_safe_offline_store()
1209 if (IS_ERR(device)) { in dasd_safe_offline_store()
1210 rc = PTR_ERR(device); in dasd_safe_offline_store()
1215 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_safe_offline_store()
1216 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_safe_offline_store()
1218 dasd_put_device(device); in dasd_safe_offline_store()
1224 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); in dasd_safe_offline_store()
1225 dasd_put_device(device); in dasd_safe_offline_store()
1237 dasd_access_show(struct device *dev, struct device_attribute *attr, in dasd_access_show()
1241 struct dasd_device *device; in dasd_access_show() local
1244 device = dasd_device_from_cdev(cdev); in dasd_access_show()
1245 if (IS_ERR(device)) in dasd_access_show()
1246 return PTR_ERR(device); in dasd_access_show()
1248 if (!device->discipline) in dasd_access_show()
1250 else if (!device->discipline->host_access_count) in dasd_access_show()
1253 count = device->discipline->host_access_count(device); in dasd_access_show()
1255 dasd_put_device(device); in dasd_access_show()
1265 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
1268 struct dasd_device *device; in dasd_discipline_show() local
1271 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
1272 if (IS_ERR(device)) in dasd_discipline_show()
1274 else if (!device->discipline) { in dasd_discipline_show()
1275 dasd_put_device(device); in dasd_discipline_show()
1279 device->discipline->name); in dasd_discipline_show()
1280 dasd_put_device(device); in dasd_discipline_show()
1291 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
1294 struct dasd_device *device; in dasd_device_status_show() local
1297 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
1298 if (!IS_ERR(device)) { in dasd_device_status_show()
1299 switch (device->state) { in dasd_device_status_show()
1322 dasd_put_device(device); in dasd_device_status_show()
1330 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1333 struct dasd_device *device; in dasd_alias_show() local
1336 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1337 if (IS_ERR(device)) in dasd_alias_show()
1340 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1341 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1344 dasd_put_device(device); in dasd_alias_show()
1348 dasd_put_device(device); in dasd_alias_show()
1355 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1358 struct dasd_device *device; in dasd_vendor_show() local
1362 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1364 if (IS_ERR(device)) in dasd_vendor_show()
1367 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1368 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1371 dasd_put_device(device); in dasd_vendor_show()
1379 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1382 struct dasd_device *device; in dasd_uid_show() local
1386 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1388 if (IS_ERR(device)) in dasd_uid_show()
1391 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1392 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1406 /* should not happen, treat like base device */ in dasd_uid_show()
1416 dasd_put_device(device); in dasd_uid_show()
1426 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1432 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1433 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1440 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1443 struct dasd_device *device; in dasd_eer_store() local
1447 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1448 if (IS_ERR(device)) in dasd_eer_store()
1449 return PTR_ERR(device); in dasd_eer_store()
1455 rc = dasd_eer_enable(device); in dasd_eer_store()
1457 dasd_eer_disable(device); in dasd_eer_store()
1459 dasd_put_device(device); in dasd_eer_store()
1470 static ssize_t dasd_aq_mask_show(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_show()
1483 static ssize_t dasd_aq_mask_store(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_store()
1498 if (devmap->device) in dasd_aq_mask_store()
1499 devmap->device->aq_mask = devmap->aq_mask; in dasd_aq_mask_store()
1511 static ssize_t dasd_aqr_show(struct device *dev, struct device_attribute *attr, in dasd_aqr_show()
1526 static ssize_t dasd_aqr_store(struct device *dev, struct device_attribute *attr, in dasd_aqr_store()
1544 * a device gets autoquiesced
1547 dasd_aq_timeouts_show(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_show()
1550 struct dasd_device *device; in dasd_aq_timeouts_show() local
1553 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_show()
1554 if (IS_ERR(device)) in dasd_aq_timeouts_show()
1556 len = sysfs_emit(buf, "%u\n", device->aq_timeouts); in dasd_aq_timeouts_show()
1557 dasd_put_device(device); in dasd_aq_timeouts_show()
1562 dasd_aq_timeouts_store(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_store()
1565 struct dasd_device *device; in dasd_aq_timeouts_store() local
1568 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_store()
1569 if (IS_ERR(device)) in dasd_aq_timeouts_store()
1574 dasd_put_device(device); in dasd_aq_timeouts_store()
1579 device->aq_timeouts = val; in dasd_aq_timeouts_store()
1581 dasd_put_device(device); in dasd_aq_timeouts_store()
1592 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1594 struct dasd_device *device; in dasd_expires_show() local
1597 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1598 if (IS_ERR(device)) in dasd_expires_show()
1600 len = sysfs_emit(buf, "%lu\n", device->default_expires); in dasd_expires_show()
1601 dasd_put_device(device); in dasd_expires_show()
1606 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1609 struct dasd_device *device; in dasd_expires_store() local
1612 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1613 if (IS_ERR(device)) in dasd_expires_store()
1618 dasd_put_device(device); in dasd_expires_store()
1623 device->default_expires = val; in dasd_expires_store()
1625 dasd_put_device(device); in dasd_expires_store()
1632 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1634 struct dasd_device *device; in dasd_retries_show() local
1637 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1638 if (IS_ERR(device)) in dasd_retries_show()
1640 len = sysfs_emit(buf, "%lu\n", device->default_retries); in dasd_retries_show()
1641 dasd_put_device(device); in dasd_retries_show()
1646 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1649 struct dasd_device *device; in dasd_retries_store() local
1652 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1653 if (IS_ERR(device)) in dasd_retries_store()
1658 dasd_put_device(device); in dasd_retries_store()
1663 device->default_retries = val; in dasd_retries_store()
1665 dasd_put_device(device); in dasd_retries_store()
1672 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1675 struct dasd_device *device; in dasd_timeout_show() local
1678 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1679 if (IS_ERR(device)) in dasd_timeout_show()
1681 len = sysfs_emit(buf, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1682 dasd_put_device(device); in dasd_timeout_show()
1687 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1690 struct dasd_device *device; in dasd_timeout_store() local
1693 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1694 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1699 dasd_put_device(device); in dasd_timeout_store()
1702 if (!device->block->gdp) { in dasd_timeout_store()
1703 dasd_put_device(device); in dasd_timeout_store()
1707 device->blk_timeout = val; in dasd_timeout_store()
1708 blk_queue_rq_timeout(device->block->gdp->queue, val * HZ); in dasd_timeout_store()
1710 dasd_put_device(device); in dasd_timeout_store()
1719 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1722 struct dasd_device *device; in dasd_path_reset_store() local
1725 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1726 if (IS_ERR(device)) in dasd_path_reset_store()
1732 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1733 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1735 dasd_put_device(device); in dasd_path_reset_store()
1741 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1744 struct dasd_device *device; in dasd_hpf_show() local
1747 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1748 if (IS_ERR(device)) in dasd_hpf_show()
1750 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1751 dasd_put_device(device); in dasd_hpf_show()
1754 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1755 dasd_put_device(device); in dasd_hpf_show()
1761 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1782 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1802 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1806 struct dasd_device *device; in dasd_reservation_state_show() local
1809 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1810 if (IS_ERR(device)) in dasd_reservation_state_show()
1813 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1815 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1819 dasd_put_device(device); in dasd_reservation_state_show()
1823 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1827 struct dasd_device *device; in dasd_reservation_state_store() local
1830 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1831 if (IS_ERR(device)) in dasd_reservation_state_store()
1834 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1837 dasd_put_device(device); in dasd_reservation_state_store()
1848 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1851 struct dasd_device *device; in dasd_pm_show() local
1854 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1855 if (IS_ERR(device)) in dasd_pm_show()
1858 opm = dasd_path_get_opm(device); in dasd_pm_show()
1859 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1860 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1861 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1862 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1863 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1864 dasd_put_device(device); in dasd_pm_show()
1876 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1879 struct dasd_device *device; in dasd_path_threshold_show() local
1882 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1883 if (IS_ERR(device)) in dasd_path_threshold_show()
1885 len = sysfs_emit(buf, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1886 dasd_put_device(device); in dasd_path_threshold_show()
1891 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1894 struct dasd_device *device; in dasd_path_threshold_store() local
1898 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1899 if (IS_ERR(device)) in dasd_path_threshold_store()
1903 dasd_put_device(device); in dasd_path_threshold_store()
1907 device->path_thrhld = val; in dasd_path_threshold_store()
1909 dasd_put_device(device); in dasd_path_threshold_store()
1920 dasd_path_autodisable_show(struct device *dev, in dasd_path_autodisable_show()
1936 dasd_path_autodisable_store(struct device *dev, in dasd_path_autodisable_store()
1961 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1964 struct dasd_device *device; in dasd_path_interval_show() local
1967 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1968 if (IS_ERR(device)) in dasd_path_interval_show()
1970 len = sysfs_emit(buf, "%lu\n", device->path_interval); in dasd_path_interval_show()
1971 dasd_put_device(device); in dasd_path_interval_show()
1976 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1979 struct dasd_device *device; in dasd_path_interval_store() local
1983 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1984 if (IS_ERR(device)) in dasd_path_interval_store()
1989 dasd_put_device(device); in dasd_path_interval_store()
1994 device->path_interval = val; in dasd_path_interval_store()
1996 dasd_put_device(device); in dasd_path_interval_store()
2004 dasd_device_fcs_show(struct device *dev, struct device_attribute *attr, in dasd_device_fcs_show()
2007 struct dasd_device *device; in dasd_device_fcs_show() local
2011 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_fcs_show()
2012 if (IS_ERR(device)) in dasd_device_fcs_show()
2014 fc_sec = dasd_path_get_fcs_device(device); in dasd_device_fcs_show()
2019 dasd_put_device(device); in dasd_device_fcs_show()
2042 dasd_copy_pair_show(struct device *dev, in dasd_copy_pair_show()
2139 static int dasd_devmap_clear_copy_relation(struct device *dev) in dasd_devmap_clear_copy_relation()
2159 if (copy->entry[i].device == copy->active->device) in dasd_devmap_clear_copy_relation()
2162 if (copy->entry[i].device) in dasd_devmap_clear_copy_relation()
2169 if (copy->entry[i].device) { in dasd_devmap_clear_copy_relation()
2170 dasd_put_device(copy->entry[i].device); in dasd_devmap_clear_copy_relation()
2171 copy->entry[i].device->copy = NULL; in dasd_devmap_clear_copy_relation()
2172 copy->entry[i].device = NULL; in dasd_devmap_clear_copy_relation()
2224 static ssize_t dasd_copy_pair_store(struct device *dev, in dasd_copy_pair_store()
2232 struct dasd_device *device; in dasd_copy_pair_store() local
2267 if (sec_devmap->device) in dasd_copy_pair_store()
2292 /* if primary device is already online call device setup directly */ in dasd_copy_pair_store()
2293 if (prim_devmap->device && !prim_devmap->device->copy) { in dasd_copy_pair_store()
2294 device = prim_devmap->device; in dasd_copy_pair_store()
2295 if (device->discipline->pprc_enabled) { in dasd_copy_pair_store()
2296 pprc_enabled = device->discipline->pprc_enabled(device); in dasd_copy_pair_store()
2297 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_copy_pair_store()
2315 dasd_copy_role_show(struct device *dev, in dasd_copy_role_show()
2319 struct dasd_device *device; in dasd_copy_role_show() local
2322 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_copy_role_show()
2323 if (IS_ERR(device)) in dasd_copy_role_show()
2326 if (!device->copy) { in dasd_copy_role_show()
2330 copy = device->copy; in dasd_copy_role_show()
2331 /* only the active device is primary */ in dasd_copy_role_show()
2332 if (copy->active->device == device) { in dasd_copy_role_show()
2337 if (copy->entry[i].device == device) { in dasd_copy_role_show()
2345 dasd_put_device(device); in dasd_copy_role_show()
2350 static ssize_t dasd_device_ping(struct device *dev, in dasd_device_ping()
2354 struct dasd_device *device; in dasd_device_ping() local
2357 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_ping()
2358 if (IS_ERR(device)) in dasd_device_ping()
2367 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_device_ping()
2371 if (!device->discipline || !device->discipline->device_ping) { in dasd_device_ping()
2375 rc = device->discipline->device_ping(device); in dasd_device_ping()
2379 dasd_put_device(device); in dasd_device_ping()
2385 static ssize_t dasd_##_name##_show(struct device *dev, \
2390 struct dasd_device *device = dasd_device_from_cdev(cdev); \
2393 if (IS_ERR(device)) \
2395 if (device->discipline && _func) \
2396 val = _func(device); \
2397 dasd_put_device(device); \
2403 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
2404 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
2405 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
2406 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
2407 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
2408 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
2409 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
2410 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
2411 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
2520 if (devmap->device) in dasd_set_feature()
2521 devmap->device->features = devmap->features; in dasd_set_feature()
2539 static void dasd_path_init_kobj(struct dasd_device *device, int chp) in dasd_path_init_kobj() argument
2541 device->path[chp].kobj.kset = device->paths_info; in dasd_path_init_kobj()
2542 kobject_init(&device->path[chp].kobj, &path_attr_type); in dasd_path_init_kobj()
2545 void dasd_path_create_kobj(struct dasd_device *device, int chp) in dasd_path_create_kobj() argument
2549 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) in dasd_path_create_kobj()
2551 if (!device->paths_info) { in dasd_path_create_kobj()
2552 dev_warn(&device->cdev->dev, "Unable to create paths objects\n"); in dasd_path_create_kobj()
2555 if (device->path[chp].in_sysfs) in dasd_path_create_kobj()
2557 if (!device->path[chp].conf_data) in dasd_path_create_kobj()
2560 dasd_path_init_kobj(device, chp); in dasd_path_create_kobj()
2562 rc = kobject_add(&device->path[chp].kobj, NULL, "%x.%02x", in dasd_path_create_kobj()
2563 device->path[chp].cssid, device->path[chp].chpid); in dasd_path_create_kobj()
2565 kobject_put(&device->path[chp].kobj); in dasd_path_create_kobj()
2566 device->path[chp].in_sysfs = true; in dasd_path_create_kobj()
2570 void dasd_path_create_kobjects(struct dasd_device *device) in dasd_path_create_kobjects() argument
2574 opm = dasd_path_get_opm(device); in dasd_path_create_kobjects()
2578 dasd_path_create_kobj(device, pathmask_to_pos(lpm)); in dasd_path_create_kobjects()
2583 static void dasd_path_remove_kobj(struct dasd_device *device, int chp) in dasd_path_remove_kobj() argument
2585 if (device->path[chp].in_sysfs) { in dasd_path_remove_kobj()
2586 kobject_put(&device->path[chp].kobj); in dasd_path_remove_kobj()
2587 device->path[chp].in_sysfs = false; in dasd_path_remove_kobj()
2592 * As we keep kobjects for the lifetime of a device, this function must not be
2593 * called anywhere but in the context of offlining a device.
2595 void dasd_path_remove_kobjects(struct dasd_device *device) in dasd_path_remove_kobjects() argument
2600 dasd_path_remove_kobj(device, i); in dasd_path_remove_kobjects()