Lines Matching full:device
10 * Device mapping and dasd= parameter parsing functions. All devmap
34 * between device number and device index. To find a dasd_devmap_t
35 * that corresponds to a device number of a device index each
37 * the device number and one to search by the device index. As
38 * soon as big minor numbers are available the device index list
39 * can be removed since the device number will then be identical
40 * to the device index.
47 struct dasd_device *device; member
128 * Read a device busid/devno from a string.
138 pr_err("The IPL device is not a CCW device\n"); in dasd_busid()
203 pr_warn("%.*s is not a supported device option\n", in dasd_feature_list()
271 * Split a string of a device range into its pieces and return the from, to, and
283 /* Do we have a range or a single device? */ in dasd_evaluate_range_param()
302 * Try to interprete the range string as a device number or a range of devices.
342 pr_err("%s is not a valid device range\n", range); in dasd_parse_range()
353 /* each device in dasd= parameter should be set initially online */ in dasd_parse_range()
373 * keywords and device ranges. The parameters in that list will be stored as
401 * Add a devmap for the device specified by busid. It is possible that
428 new->device = NULL; in dasd_add_busid()
456 * Find devmap for device with given bus_id.
479 * Forget all about the device numbers added so far.
491 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
500 * Find the device struct by its device index.
506 struct dasd_device *device; in dasd_device_from_devindex() local
514 /* Found the devmap for the device. */ in dasd_device_from_devindex()
518 if (devmap && devmap->device) { in dasd_device_from_devindex()
519 device = devmap->device; in dasd_device_from_devindex()
520 dasd_get_device(device); in dasd_device_from_devindex()
522 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
524 return device; in dasd_device_from_devindex()
544 * Create a dasd device structure for cdev.
550 struct dasd_device *device; in dasd_create_device() local
558 device = dasd_alloc_device(); in dasd_create_device()
559 if (IS_ERR(device)) in dasd_create_device()
560 return device; in dasd_create_device()
561 atomic_set(&device->ref_count, 3); in dasd_create_device()
564 if (!devmap->device) { in dasd_create_device()
565 devmap->device = device; in dasd_create_device()
566 device->devindex = devmap->devindex; in dasd_create_device()
567 device->features = devmap->features; in dasd_create_device()
569 device->cdev = cdev; in dasd_create_device()
577 dasd_free_device(device); in dasd_create_device()
582 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
585 device->paths_info = kset_create_and_add("paths_info", NULL, in dasd_create_device()
586 &device->cdev->dev.kobj); in dasd_create_device()
587 if (!device->paths_info) in dasd_create_device()
590 return device; in dasd_create_device()
596 static int dasd_devmap_get_pprc_status(struct dasd_device *device, in dasd_devmap_get_pprc_status() argument
601 if (!device->discipline || !device->discipline->pprc_status) { in dasd_devmap_get_pprc_status()
602 dev_warn(&device->cdev->dev, "Unable to query copy relation status\n"); in dasd_devmap_get_pprc_status()
610 if (device->discipline->pprc_status(device, temp)) { in dasd_devmap_get_pprc_status()
611 dev_warn(&device->cdev->dev, "Error during copy relation status query\n"); in dasd_devmap_get_pprc_status()
622 * depending on the primary/secondary state of the device it has to be
649 * - is the given device part of a copy pair setup
650 * - does the state of the device match the state in the PPRC status data
651 * - does the device UID match with the UID in the PPRC status data
652 * - to prevent misrouted IO check if the given device is present in all
655 static int dasd_devmap_check_copy_relation(struct dasd_device *device, in dasd_devmap_check_copy_relation() argument
665 if (!device->discipline || !device->discipline->get_uid || in dasd_devmap_check_copy_relation()
666 device->discipline->get_uid(device, &uid)) in dasd_devmap_check_copy_relation()
671 dev_warn(&device->cdev->dev, "Device not part of a copy relation\n"); in dasd_devmap_check_copy_relation()
675 /* double check which role the current device has */ in dasd_devmap_check_copy_relation()
678 dev_warn(&device->cdev->dev, "Copy pair secondary is setup as primary\n"); in dasd_devmap_check_copy_relation()
683 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
684 "Primary device %s does not match copy pair status primary device %04x\n", in dasd_devmap_check_copy_relation()
685 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
692 dev_warn(&device->cdev->dev, "Copy pair primary is setup as secondary\n"); in dasd_devmap_check_copy_relation()
697 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
698 "Secondary device %s does not match copy pair status secondary device %04x\n", in dasd_devmap_check_copy_relation()
699 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
707 * the current device has to be part of the copy relation of all in dasd_devmap_check_copy_relation()
712 tmp_dev = device; in dasd_devmap_check_copy_relation()
714 tmp_dev = copy->entry[j].device; in dasd_devmap_check_copy_relation()
724 "Copy pair relation does not contain device: %s\n", in dasd_devmap_check_copy_relation()
725 dev_name(&device->cdev->dev)); in dasd_devmap_check_copy_relation()
734 /* delete device from copy relation entry */
735 static void dasd_devmap_delete_copy_relation_device(struct dasd_device *device) in dasd_devmap_delete_copy_relation_device() argument
740 if (!device->copy) in dasd_devmap_delete_copy_relation_device()
743 copy = device->copy; in dasd_devmap_delete_copy_relation_device()
745 if (copy->entry[i].device == device) in dasd_devmap_delete_copy_relation_device()
746 copy->entry[i].device = NULL; in dasd_devmap_delete_copy_relation_device()
748 dasd_put_device(device); in dasd_devmap_delete_copy_relation_device()
749 device->copy = NULL; in dasd_devmap_delete_copy_relation_device()
753 * read all required information for a copy relation setup and setup the device
763 struct dasd_device *device; in dasd_devmap_set_device_copy_relation() local
770 device = devmap->device; in dasd_devmap_set_device_copy_relation()
771 if (!device) in dasd_devmap_set_device_copy_relation()
775 /* no copy pair setup for this device */ in dasd_devmap_set_device_copy_relation()
779 rc = dasd_devmap_get_pprc_status(device, &data); in dasd_devmap_set_device_copy_relation()
791 dev_warn(&device->cdev->dev, "Copy pair setup requested for device not in copy relation\n"); in dasd_devmap_set_device_copy_relation()
805 dev_warn(&device->cdev->dev, "Copy relation entry not found\n"); in dasd_devmap_set_device_copy_relation()
810 if (dasd_devmap_check_copy_relation(device, entry, data, copy)) { in dasd_devmap_set_device_copy_relation()
811 dev_warn(&device->cdev->dev, "Copy relation faulty\n"); in dasd_devmap_set_device_copy_relation()
816 dasd_get_device(device); in dasd_devmap_set_device_copy_relation()
817 copy->entry[i].device = device; in dasd_devmap_set_device_copy_relation()
818 device->copy = copy; in dasd_devmap_set_device_copy_relation()
831 * Remove a dasd device structure. The passed referenced
835 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
841 /* First remove device pointer from devmap. */ in dasd_delete_device()
842 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
845 if (devmap->device != device) { in dasd_delete_device()
847 dasd_put_device(device); in dasd_delete_device()
850 devmap->device = NULL; in dasd_delete_device()
854 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
855 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
856 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
859 dasd_devmap_delete_copy_relation_device(device); in dasd_delete_device()
864 atomic_sub(3, &device->ref_count); in dasd_delete_device()
867 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
869 dasd_generic_free_discipline(device); in dasd_delete_device()
871 kset_unregister(device->paths_info); in dasd_delete_device()
874 cdev = device->cdev; in dasd_delete_device()
875 device->cdev = NULL; in dasd_delete_device()
880 /* Now the device structure can be freed. */ in dasd_delete_device()
881 dasd_free_device(device); in dasd_delete_device()
889 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
897 * This function needs to be called with the ccw device
903 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
905 if (!device) in dasd_device_from_cdev_locked()
907 dasd_get_device(device); in dasd_device_from_cdev_locked()
908 return device; in dasd_device_from_cdev_locked()
917 struct dasd_device *device; in dasd_device_from_cdev() local
921 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
923 return device; in dasd_device_from_cdev()
926 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
930 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
941 struct dasd_device *device; in dasd_device_from_gendisk() local
946 device = NULL; in dasd_device_from_gendisk()
949 if (devmap && devmap->device) { in dasd_device_from_gendisk()
950 device = devmap->device; in dasd_device_from_gendisk()
951 dasd_get_device(device); in dasd_device_from_gendisk()
954 return device; in dasd_device_from_gendisk()
964 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
978 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
998 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
1001 struct dasd_device *device; in dasd_ro_show() local
1011 device = devmap->device; in dasd_ro_show()
1012 if (device) in dasd_ro_show()
1013 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_show()
1021 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
1025 struct dasd_device *device; in dasd_ro_store() local
1037 device = dasd_device_from_cdev(cdev); in dasd_ro_store()
1038 if (IS_ERR(device)) in dasd_ro_store()
1042 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
1044 if (!device->block || !device->block->gdp || in dasd_ro_store()
1045 test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_ro_store()
1049 /* Increase open_count to avoid losing the block device */ in dasd_ro_store()
1050 atomic_inc(&device->block->open_count); in dasd_ro_store()
1053 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
1054 atomic_dec(&device->block->open_count); in dasd_ro_store()
1057 dasd_put_device(device); in dasd_ro_store()
1068 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
1082 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
1100 * to talk to the device
1103 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
1117 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
1134 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
1152 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
1166 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
1183 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
1198 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, in dasd_safe_offline_store()
1202 struct dasd_device *device; in dasd_safe_offline_store() local
1207 device = dasd_device_from_cdev_locked(cdev); in dasd_safe_offline_store()
1208 if (IS_ERR(device)) { in dasd_safe_offline_store()
1209 rc = PTR_ERR(device); in dasd_safe_offline_store()
1214 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_safe_offline_store()
1215 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_safe_offline_store()
1217 dasd_put_device(device); in dasd_safe_offline_store()
1223 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); in dasd_safe_offline_store()
1224 dasd_put_device(device); in dasd_safe_offline_store()
1236 dasd_access_show(struct device *dev, struct device_attribute *attr, in dasd_access_show()
1240 struct dasd_device *device; in dasd_access_show() local
1243 device = dasd_device_from_cdev(cdev); in dasd_access_show()
1244 if (IS_ERR(device)) in dasd_access_show()
1245 return PTR_ERR(device); in dasd_access_show()
1247 if (!device->discipline) in dasd_access_show()
1249 else if (!device->discipline->host_access_count) in dasd_access_show()
1252 count = device->discipline->host_access_count(device); in dasd_access_show()
1254 dasd_put_device(device); in dasd_access_show()
1264 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
1267 struct dasd_device *device; in dasd_discipline_show() local
1270 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
1271 if (IS_ERR(device)) in dasd_discipline_show()
1273 else if (!device->discipline) { in dasd_discipline_show()
1274 dasd_put_device(device); in dasd_discipline_show()
1278 device->discipline->name); in dasd_discipline_show()
1279 dasd_put_device(device); in dasd_discipline_show()
1290 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
1293 struct dasd_device *device; in dasd_device_status_show() local
1296 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
1297 if (!IS_ERR(device)) { in dasd_device_status_show()
1298 switch (device->state) { in dasd_device_status_show()
1321 dasd_put_device(device); in dasd_device_status_show()
1329 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1332 struct dasd_device *device; in dasd_alias_show() local
1335 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1336 if (IS_ERR(device)) in dasd_alias_show()
1339 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1340 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1343 dasd_put_device(device); in dasd_alias_show()
1347 dasd_put_device(device); in dasd_alias_show()
1354 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1357 struct dasd_device *device; in dasd_vendor_show() local
1361 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1363 if (IS_ERR(device)) in dasd_vendor_show()
1366 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1367 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1370 dasd_put_device(device); in dasd_vendor_show()
1378 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1381 struct dasd_device *device; in dasd_uid_show() local
1385 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1387 if (IS_ERR(device)) in dasd_uid_show()
1390 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1391 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1405 /* should not happen, treat like base device */ in dasd_uid_show()
1415 dasd_put_device(device); in dasd_uid_show()
1425 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1431 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1432 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1439 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1442 struct dasd_device *device; in dasd_eer_store() local
1446 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1447 if (IS_ERR(device)) in dasd_eer_store()
1448 return PTR_ERR(device); in dasd_eer_store()
1454 rc = dasd_eer_enable(device); in dasd_eer_store()
1456 dasd_eer_disable(device); in dasd_eer_store()
1458 dasd_put_device(device); in dasd_eer_store()
1469 static ssize_t dasd_aq_mask_show(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_show()
1482 static ssize_t dasd_aq_mask_store(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_store()
1497 if (devmap->device) in dasd_aq_mask_store()
1498 devmap->device->aq_mask = devmap->aq_mask; in dasd_aq_mask_store()
1510 static ssize_t dasd_aqr_show(struct device *dev, struct device_attribute *attr, in dasd_aqr_show()
1525 static ssize_t dasd_aqr_store(struct device *dev, struct device_attribute *attr, in dasd_aqr_store()
1543 * a device gets autoquiesced
1546 dasd_aq_timeouts_show(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_show()
1549 struct dasd_device *device; in dasd_aq_timeouts_show() local
1552 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_show()
1553 if (IS_ERR(device)) in dasd_aq_timeouts_show()
1555 len = sysfs_emit(buf, "%u\n", device->aq_timeouts); in dasd_aq_timeouts_show()
1556 dasd_put_device(device); in dasd_aq_timeouts_show()
1561 dasd_aq_timeouts_store(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_store()
1564 struct dasd_device *device; in dasd_aq_timeouts_store() local
1567 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_store()
1568 if (IS_ERR(device)) in dasd_aq_timeouts_store()
1573 dasd_put_device(device); in dasd_aq_timeouts_store()
1578 device->aq_timeouts = val; in dasd_aq_timeouts_store()
1580 dasd_put_device(device); in dasd_aq_timeouts_store()
1591 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1593 struct dasd_device *device; in dasd_expires_show() local
1596 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1597 if (IS_ERR(device)) in dasd_expires_show()
1599 len = sysfs_emit(buf, "%lu\n", device->default_expires); in dasd_expires_show()
1600 dasd_put_device(device); in dasd_expires_show()
1605 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1608 struct dasd_device *device; in dasd_expires_store() local
1611 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1612 if (IS_ERR(device)) in dasd_expires_store()
1617 dasd_put_device(device); in dasd_expires_store()
1622 device->default_expires = val; in dasd_expires_store()
1624 dasd_put_device(device); in dasd_expires_store()
1631 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1633 struct dasd_device *device; in dasd_retries_show() local
1636 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1637 if (IS_ERR(device)) in dasd_retries_show()
1639 len = sysfs_emit(buf, "%lu\n", device->default_retries); in dasd_retries_show()
1640 dasd_put_device(device); in dasd_retries_show()
1645 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1648 struct dasd_device *device; in dasd_retries_store() local
1651 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1652 if (IS_ERR(device)) in dasd_retries_store()
1657 dasd_put_device(device); in dasd_retries_store()
1662 device->default_retries = val; in dasd_retries_store()
1664 dasd_put_device(device); in dasd_retries_store()
1671 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1674 struct dasd_device *device; in dasd_timeout_show() local
1677 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1678 if (IS_ERR(device)) in dasd_timeout_show()
1680 len = sysfs_emit(buf, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1681 dasd_put_device(device); in dasd_timeout_show()
1686 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1689 struct dasd_device *device; in dasd_timeout_store() local
1692 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1693 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1698 dasd_put_device(device); in dasd_timeout_store()
1701 if (!device->block->gdp) { in dasd_timeout_store()
1702 dasd_put_device(device); in dasd_timeout_store()
1706 device->blk_timeout = val; in dasd_timeout_store()
1707 blk_queue_rq_timeout(device->block->gdp->queue, val * HZ); in dasd_timeout_store()
1709 dasd_put_device(device); in dasd_timeout_store()
1718 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1721 struct dasd_device *device; in dasd_path_reset_store() local
1724 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1725 if (IS_ERR(device)) in dasd_path_reset_store()
1731 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1732 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1734 dasd_put_device(device); in dasd_path_reset_store()
1740 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1743 struct dasd_device *device; in dasd_hpf_show() local
1746 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1747 if (IS_ERR(device)) in dasd_hpf_show()
1749 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1750 dasd_put_device(device); in dasd_hpf_show()
1753 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1754 dasd_put_device(device); in dasd_hpf_show()
1760 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1781 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1801 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1805 struct dasd_device *device; in dasd_reservation_state_show() local
1808 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1809 if (IS_ERR(device)) in dasd_reservation_state_show()
1812 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1814 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1818 dasd_put_device(device); in dasd_reservation_state_show()
1822 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1826 struct dasd_device *device; in dasd_reservation_state_store() local
1829 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1830 if (IS_ERR(device)) in dasd_reservation_state_store()
1833 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1836 dasd_put_device(device); in dasd_reservation_state_store()
1847 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1850 struct dasd_device *device; in dasd_pm_show() local
1853 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1854 if (IS_ERR(device)) in dasd_pm_show()
1857 opm = dasd_path_get_opm(device); in dasd_pm_show()
1858 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1859 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1860 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1861 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1862 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1863 dasd_put_device(device); in dasd_pm_show()
1875 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1878 struct dasd_device *device; in dasd_path_threshold_show() local
1881 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1882 if (IS_ERR(device)) in dasd_path_threshold_show()
1884 len = sysfs_emit(buf, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1885 dasd_put_device(device); in dasd_path_threshold_show()
1890 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1893 struct dasd_device *device; in dasd_path_threshold_store() local
1897 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1898 if (IS_ERR(device)) in dasd_path_threshold_store()
1902 dasd_put_device(device); in dasd_path_threshold_store()
1906 device->path_thrhld = val; in dasd_path_threshold_store()
1908 dasd_put_device(device); in dasd_path_threshold_store()
1919 dasd_path_autodisable_show(struct device *dev, in dasd_path_autodisable_show()
1935 dasd_path_autodisable_store(struct device *dev, in dasd_path_autodisable_store()
1960 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1963 struct dasd_device *device; in dasd_path_interval_show() local
1966 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1967 if (IS_ERR(device)) in dasd_path_interval_show()
1969 len = sysfs_emit(buf, "%lu\n", device->path_interval); in dasd_path_interval_show()
1970 dasd_put_device(device); in dasd_path_interval_show()
1975 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1978 struct dasd_device *device; in dasd_path_interval_store() local
1982 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1983 if (IS_ERR(device)) in dasd_path_interval_store()
1988 dasd_put_device(device); in dasd_path_interval_store()
1993 device->path_interval = val; in dasd_path_interval_store()
1995 dasd_put_device(device); in dasd_path_interval_store()
2003 dasd_device_fcs_show(struct device *dev, struct device_attribute *attr, in dasd_device_fcs_show()
2006 struct dasd_device *device; in dasd_device_fcs_show() local
2010 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_fcs_show()
2011 if (IS_ERR(device)) in dasd_device_fcs_show()
2013 fc_sec = dasd_path_get_fcs_device(device); in dasd_device_fcs_show()
2018 dasd_put_device(device); in dasd_device_fcs_show()
2041 dasd_copy_pair_show(struct device *dev, in dasd_copy_pair_show()
2138 static int dasd_devmap_clear_copy_relation(struct device *dev) in dasd_devmap_clear_copy_relation()
2158 if (copy->entry[i].device == copy->active->device) in dasd_devmap_clear_copy_relation()
2161 if (copy->entry[i].device) in dasd_devmap_clear_copy_relation()
2168 if (copy->entry[i].device) { in dasd_devmap_clear_copy_relation()
2169 dasd_put_device(copy->entry[i].device); in dasd_devmap_clear_copy_relation()
2170 copy->entry[i].device->copy = NULL; in dasd_devmap_clear_copy_relation()
2171 copy->entry[i].device = NULL; in dasd_devmap_clear_copy_relation()
2223 static ssize_t dasd_copy_pair_store(struct device *dev, in dasd_copy_pair_store()
2231 struct dasd_device *device; in dasd_copy_pair_store() local
2266 if (sec_devmap->device) in dasd_copy_pair_store()
2291 /* if primary device is already online call device setup directly */ in dasd_copy_pair_store()
2292 if (prim_devmap->device && !prim_devmap->device->copy) { in dasd_copy_pair_store()
2293 device = prim_devmap->device; in dasd_copy_pair_store()
2294 if (device->discipline->pprc_enabled) { in dasd_copy_pair_store()
2295 pprc_enabled = device->discipline->pprc_enabled(device); in dasd_copy_pair_store()
2296 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_copy_pair_store()
2314 dasd_copy_role_show(struct device *dev, in dasd_copy_role_show()
2318 struct dasd_device *device; in dasd_copy_role_show() local
2321 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_copy_role_show()
2322 if (IS_ERR(device)) in dasd_copy_role_show()
2325 if (!device->copy) { in dasd_copy_role_show()
2329 copy = device->copy; in dasd_copy_role_show()
2330 /* only the active device is primary */ in dasd_copy_role_show()
2331 if (copy->active->device == device) { in dasd_copy_role_show()
2336 if (copy->entry[i].device == device) { in dasd_copy_role_show()
2344 dasd_put_device(device); in dasd_copy_role_show()
2349 static ssize_t dasd_device_ping(struct device *dev, in dasd_device_ping()
2353 struct dasd_device *device; in dasd_device_ping() local
2356 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_ping()
2357 if (IS_ERR(device)) in dasd_device_ping()
2366 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_device_ping()
2370 if (!device->discipline || !device->discipline->device_ping) { in dasd_device_ping()
2374 rc = device->discipline->device_ping(device); in dasd_device_ping()
2378 dasd_put_device(device); in dasd_device_ping()
2384 static ssize_t dasd_##_name##_show(struct device *dev, \
2389 struct dasd_device *device = dasd_device_from_cdev(cdev); \
2392 if (IS_ERR(device)) \
2394 if (device->discipline && _func) \
2395 val = _func(device); \
2396 dasd_put_device(device); \
2402 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
2403 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
2404 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
2405 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
2406 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
2407 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
2408 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
2409 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
2410 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
2519 if (devmap->device) in dasd_set_feature()
2520 devmap->device->features = devmap->features; in dasd_set_feature()
2538 static void dasd_path_init_kobj(struct dasd_device *device, int chp) in dasd_path_init_kobj() argument
2540 device->path[chp].kobj.kset = device->paths_info; in dasd_path_init_kobj()
2541 kobject_init(&device->path[chp].kobj, &path_attr_type); in dasd_path_init_kobj()
2544 void dasd_path_create_kobj(struct dasd_device *device, int chp) in dasd_path_create_kobj() argument
2548 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) in dasd_path_create_kobj()
2550 if (!device->paths_info) { in dasd_path_create_kobj()
2551 dev_warn(&device->cdev->dev, "Unable to create paths objects\n"); in dasd_path_create_kobj()
2554 if (device->path[chp].in_sysfs) in dasd_path_create_kobj()
2556 if (!device->path[chp].conf_data) in dasd_path_create_kobj()
2559 dasd_path_init_kobj(device, chp); in dasd_path_create_kobj()
2561 rc = kobject_add(&device->path[chp].kobj, NULL, "%x.%02x", in dasd_path_create_kobj()
2562 device->path[chp].cssid, device->path[chp].chpid); in dasd_path_create_kobj()
2564 kobject_put(&device->path[chp].kobj); in dasd_path_create_kobj()
2565 device->path[chp].in_sysfs = true; in dasd_path_create_kobj()
2569 void dasd_path_create_kobjects(struct dasd_device *device) in dasd_path_create_kobjects() argument
2573 opm = dasd_path_get_opm(device); in dasd_path_create_kobjects()
2577 dasd_path_create_kobj(device, pathmask_to_pos(lpm)); in dasd_path_create_kobjects()
2582 static void dasd_path_remove_kobj(struct dasd_device *device, int chp) in dasd_path_remove_kobj() argument
2584 if (device->path[chp].in_sysfs) { in dasd_path_remove_kobj()
2585 kobject_put(&device->path[chp].kobj); in dasd_path_remove_kobj()
2586 device->path[chp].in_sysfs = false; in dasd_path_remove_kobj()
2591 * As we keep kobjects for the lifetime of a device, this function must not be
2592 * called anywhere but in the context of offlining a device.
2594 void dasd_path_remove_kobjects(struct dasd_device *device) in dasd_path_remove_kobjects() argument
2599 dasd_path_remove_kobj(device, i); in dasd_path_remove_kobjects()