Lines Matching full:device

10  * Device mapping and dasd= parameter parsing functions. All devmap
36 * between device number and device index. To find a dasd_devmap_t
37 * that corresponds to a device number of a device index each
39 * the device number and one to search by the device index. As
40 * soon as big minor numbers are available the device index list
41 * can be removed since the device number will then be identical
42 * to the device index.
49 struct dasd_device *device; member
130 * Read a device busid/devno from a string.
140 pr_err("The IPL device is not a CCW device\n"); in dasd_busid()
205 pr_warn("%.*s is not a supported device option\n", in dasd_feature_list()
273 * Split a string of a device range into its pieces and return the from, to, and
285 /* Do we have a range or a single device? */ in dasd_evaluate_range_param()
304 * Try to interprete the range string as a device number or a range of devices.
344 pr_err("%s is not a valid device range\n", range); in dasd_parse_range()
355 /* each device in dasd= parameter should be set initially online */ in dasd_parse_range()
375 * keywords and device ranges. The parameters in that list will be stored as
403 * Add a devmap for the device specified by busid. It is possible that
430 new->device = NULL; in dasd_add_busid()
458 * Find devmap for device with given bus_id.
481 * Forget all about the device numbers added so far.
493 BUG_ON(devmap->device != NULL); in dasd_forget_ranges()
502 * Find the device struct by its device index.
508 struct dasd_device *device; in dasd_device_from_devindex() local
516 /* Found the devmap for the device. */ in dasd_device_from_devindex()
520 if (devmap && devmap->device) { in dasd_device_from_devindex()
521 device = devmap->device; in dasd_device_from_devindex()
522 dasd_get_device(device); in dasd_device_from_devindex()
524 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
526 return device; in dasd_device_from_devindex()
546 * Create a dasd device structure for cdev.
552 struct dasd_device *device; in dasd_create_device() local
560 device = dasd_alloc_device(); in dasd_create_device()
561 if (IS_ERR(device)) in dasd_create_device()
562 return device; in dasd_create_device()
563 atomic_set(&device->ref_count, 3); in dasd_create_device()
566 if (!devmap->device) { in dasd_create_device()
567 devmap->device = device; in dasd_create_device()
568 device->devindex = devmap->devindex; in dasd_create_device()
569 device->features = devmap->features; in dasd_create_device()
571 device->cdev = cdev; in dasd_create_device()
579 dasd_free_device(device); in dasd_create_device()
584 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
587 device->paths_info = kset_create_and_add("paths_info", NULL, in dasd_create_device()
588 &device->cdev->dev.kobj); in dasd_create_device()
589 if (!device->paths_info) in dasd_create_device()
592 return device; in dasd_create_device()
598 static int dasd_devmap_get_pprc_status(struct dasd_device *device, in dasd_devmap_get_pprc_status() argument
603 if (!device->discipline || !device->discipline->pprc_status) { in dasd_devmap_get_pprc_status()
604 dev_warn(&device->cdev->dev, "Unable to query copy relation status\n"); in dasd_devmap_get_pprc_status()
612 if (device->discipline->pprc_status(device, temp)) { in dasd_devmap_get_pprc_status()
613 dev_warn(&device->cdev->dev, "Error during copy relation status query\n"); in dasd_devmap_get_pprc_status()
624 * depending on the primary/secondary state of the device it has to be
651 * - is the given device part of a copy pair setup
652 * - does the state of the device match the state in the PPRC status data
653 * - does the device UID match with the UID in the PPRC status data
654 * - to prevent misrouted IO check if the given device is present in all
657 static int dasd_devmap_check_copy_relation(struct dasd_device *device, in dasd_devmap_check_copy_relation() argument
667 if (!device->discipline || !device->discipline->get_uid || in dasd_devmap_check_copy_relation()
668 device->discipline->get_uid(device, &uid)) in dasd_devmap_check_copy_relation()
673 dev_warn(&device->cdev->dev, "Device not part of a copy relation\n"); in dasd_devmap_check_copy_relation()
677 /* double check which role the current device has */ in dasd_devmap_check_copy_relation()
680 dev_warn(&device->cdev->dev, "Copy pair secondary is setup as primary\n"); in dasd_devmap_check_copy_relation()
685 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
686 "Primary device %s does not match copy pair status primary device %04x\n", in dasd_devmap_check_copy_relation()
687 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
694 dev_warn(&device->cdev->dev, "Copy pair primary is setup as secondary\n"); in dasd_devmap_check_copy_relation()
699 dev_warn(&device->cdev->dev, in dasd_devmap_check_copy_relation()
700 "Secondary device %s does not match copy pair status secondary device %04x\n", in dasd_devmap_check_copy_relation()
701 dev_name(&device->cdev->dev), in dasd_devmap_check_copy_relation()
709 * the current device has to be part of the copy relation of all in dasd_devmap_check_copy_relation()
714 tmp_dev = device; in dasd_devmap_check_copy_relation()
716 tmp_dev = copy->entry[j].device; in dasd_devmap_check_copy_relation()
726 "Copy pair relation does not contain device: %s\n", in dasd_devmap_check_copy_relation()
727 dev_name(&device->cdev->dev)); in dasd_devmap_check_copy_relation()
736 /* delete device from copy relation entry */
737 static void dasd_devmap_delete_copy_relation_device(struct dasd_device *device) in dasd_devmap_delete_copy_relation_device() argument
742 if (!device->copy) in dasd_devmap_delete_copy_relation_device()
745 copy = device->copy; in dasd_devmap_delete_copy_relation_device()
747 if (copy->entry[i].device == device) in dasd_devmap_delete_copy_relation_device()
748 copy->entry[i].device = NULL; in dasd_devmap_delete_copy_relation_device()
750 dasd_put_device(device); in dasd_devmap_delete_copy_relation_device()
751 device->copy = NULL; in dasd_devmap_delete_copy_relation_device()
755 * read all required information for a copy relation setup and setup the device
765 struct dasd_device *device; in dasd_devmap_set_device_copy_relation() local
772 device = devmap->device; in dasd_devmap_set_device_copy_relation()
773 if (!device) in dasd_devmap_set_device_copy_relation()
777 /* no copy pair setup for this device */ in dasd_devmap_set_device_copy_relation()
781 rc = dasd_devmap_get_pprc_status(device, &data); in dasd_devmap_set_device_copy_relation()
793 dev_warn(&device->cdev->dev, "Copy pair setup requested for device not in copy relation\n"); in dasd_devmap_set_device_copy_relation()
807 dev_warn(&device->cdev->dev, "Copy relation entry not found\n"); in dasd_devmap_set_device_copy_relation()
812 if (dasd_devmap_check_copy_relation(device, entry, data, copy)) { in dasd_devmap_set_device_copy_relation()
813 dev_warn(&device->cdev->dev, "Copy relation faulty\n"); in dasd_devmap_set_device_copy_relation()
818 dasd_get_device(device); in dasd_devmap_set_device_copy_relation()
819 copy->entry[i].device = device; in dasd_devmap_set_device_copy_relation()
820 device->copy = copy; in dasd_devmap_set_device_copy_relation()
833 * Remove a dasd device structure. The passed referenced
837 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
843 /* First remove device pointer from devmap. */ in dasd_delete_device()
844 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
847 if (devmap->device != device) { in dasd_delete_device()
849 dasd_put_device(device); in dasd_delete_device()
852 devmap->device = NULL; in dasd_delete_device()
856 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
857 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
858 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
861 dasd_devmap_delete_copy_relation_device(device); in dasd_delete_device()
866 atomic_sub(3, &device->ref_count); in dasd_delete_device()
869 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
871 dasd_generic_free_discipline(device); in dasd_delete_device()
873 kset_unregister(device->paths_info); in dasd_delete_device()
876 cdev = device->cdev; in dasd_delete_device()
877 device->cdev = NULL; in dasd_delete_device()
882 /* Now the device structure can be freed. */ in dasd_delete_device()
883 dasd_free_device(device); in dasd_delete_device()
891 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
899 * This function needs to be called with the ccw device
905 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
907 if (!device) in dasd_device_from_cdev_locked()
909 dasd_get_device(device); in dasd_device_from_cdev_locked()
910 return device; in dasd_device_from_cdev_locked()
919 struct dasd_device *device; in dasd_device_from_cdev() local
923 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
925 return device; in dasd_device_from_cdev()
928 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
932 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
943 struct dasd_device *device; in dasd_device_from_gendisk() local
948 device = NULL; in dasd_device_from_gendisk()
951 if (devmap && devmap->device) { in dasd_device_from_gendisk()
952 device = devmap->device; in dasd_device_from_gendisk()
953 dasd_get_device(device); in dasd_device_from_gendisk()
956 return device; in dasd_device_from_gendisk()
966 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
980 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
1000 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
1003 struct dasd_device *device; in dasd_ro_show() local
1013 device = devmap->device; in dasd_ro_show()
1014 if (device) in dasd_ro_show()
1015 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_show()
1023 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
1027 struct dasd_device *device; in dasd_ro_store() local
1039 device = dasd_device_from_cdev(cdev); in dasd_ro_store()
1040 if (IS_ERR(device)) in dasd_ro_store()
1044 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
1046 if (!device->block || !device->block->gdp || in dasd_ro_store()
1047 test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_ro_store()
1051 /* Increase open_count to avoid losing the block device */ in dasd_ro_store()
1052 atomic_inc(&device->block->open_count); in dasd_ro_store()
1055 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
1056 atomic_dec(&device->block->open_count); in dasd_ro_store()
1059 dasd_put_device(device); in dasd_ro_store()
1070 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
1084 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
1102 * to talk to the device
1105 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
1119 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
1136 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
1154 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
1168 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
1185 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
1200 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr, in dasd_safe_offline_store()
1204 struct dasd_device *device; in dasd_safe_offline_store() local
1209 device = dasd_device_from_cdev_locked(cdev); in dasd_safe_offline_store()
1210 if (IS_ERR(device)) { in dasd_safe_offline_store()
1211 rc = PTR_ERR(device); in dasd_safe_offline_store()
1216 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) || in dasd_safe_offline_store()
1217 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) { in dasd_safe_offline_store()
1219 dasd_put_device(device); in dasd_safe_offline_store()
1225 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags); in dasd_safe_offline_store()
1226 dasd_put_device(device); in dasd_safe_offline_store()
1238 dasd_access_show(struct device *dev, struct device_attribute *attr, in dasd_access_show()
1242 struct dasd_device *device; in dasd_access_show() local
1245 device = dasd_device_from_cdev(cdev); in dasd_access_show()
1246 if (IS_ERR(device)) in dasd_access_show()
1247 return PTR_ERR(device); in dasd_access_show()
1249 if (!device->discipline) in dasd_access_show()
1251 else if (!device->discipline->host_access_count) in dasd_access_show()
1254 count = device->discipline->host_access_count(device); in dasd_access_show()
1256 dasd_put_device(device); in dasd_access_show()
1266 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
1269 struct dasd_device *device; in dasd_discipline_show() local
1272 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
1273 if (IS_ERR(device)) in dasd_discipline_show()
1275 else if (!device->discipline) { in dasd_discipline_show()
1276 dasd_put_device(device); in dasd_discipline_show()
1280 device->discipline->name); in dasd_discipline_show()
1281 dasd_put_device(device); in dasd_discipline_show()
1292 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
1295 struct dasd_device *device; in dasd_device_status_show() local
1298 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
1299 if (!IS_ERR(device)) { in dasd_device_status_show()
1300 switch (device->state) { in dasd_device_status_show()
1323 dasd_put_device(device); in dasd_device_status_show()
1331 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1334 struct dasd_device *device; in dasd_alias_show() local
1337 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1338 if (IS_ERR(device)) in dasd_alias_show()
1341 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1342 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1345 dasd_put_device(device); in dasd_alias_show()
1349 dasd_put_device(device); in dasd_alias_show()
1356 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1359 struct dasd_device *device; in dasd_vendor_show() local
1363 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1365 if (IS_ERR(device)) in dasd_vendor_show()
1368 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1369 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1372 dasd_put_device(device); in dasd_vendor_show()
1380 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1383 struct dasd_device *device; in dasd_uid_show() local
1387 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1389 if (IS_ERR(device)) in dasd_uid_show()
1392 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1393 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1407 /* should not happen, treat like base device */ in dasd_uid_show()
1417 dasd_put_device(device); in dasd_uid_show()
1427 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1433 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1434 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1441 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1444 struct dasd_device *device; in dasd_eer_store() local
1448 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_eer_store()
1449 if (IS_ERR(device)) in dasd_eer_store()
1450 return PTR_ERR(device); in dasd_eer_store()
1456 rc = dasd_eer_enable(device); in dasd_eer_store()
1458 dasd_eer_disable(device); in dasd_eer_store()
1460 dasd_put_device(device); in dasd_eer_store()
1471 static ssize_t dasd_aq_mask_show(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_show()
1484 static ssize_t dasd_aq_mask_store(struct device *dev, struct device_attribute *attr, in dasd_aq_mask_store()
1499 if (devmap->device) in dasd_aq_mask_store()
1500 devmap->device->aq_mask = devmap->aq_mask; in dasd_aq_mask_store()
1512 static ssize_t dasd_aqr_show(struct device *dev, struct device_attribute *attr, in dasd_aqr_show()
1527 static ssize_t dasd_aqr_store(struct device *dev, struct device_attribute *attr, in dasd_aqr_store()
1545 * a device gets autoquiesced
1548 dasd_aq_timeouts_show(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_show()
1551 struct dasd_device *device; in dasd_aq_timeouts_show() local
1554 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_show()
1555 if (IS_ERR(device)) in dasd_aq_timeouts_show()
1557 len = sysfs_emit(buf, "%u\n", device->aq_timeouts); in dasd_aq_timeouts_show()
1558 dasd_put_device(device); in dasd_aq_timeouts_show()
1563 dasd_aq_timeouts_store(struct device *dev, struct device_attribute *attr, in dasd_aq_timeouts_store()
1566 struct dasd_device *device; in dasd_aq_timeouts_store() local
1569 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_aq_timeouts_store()
1570 if (IS_ERR(device)) in dasd_aq_timeouts_store()
1575 dasd_put_device(device); in dasd_aq_timeouts_store()
1580 device->aq_timeouts = val; in dasd_aq_timeouts_store()
1582 dasd_put_device(device); in dasd_aq_timeouts_store()
1593 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1595 struct dasd_device *device; in dasd_expires_show() local
1598 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1599 if (IS_ERR(device)) in dasd_expires_show()
1601 len = sysfs_emit(buf, "%lu\n", device->default_expires); in dasd_expires_show()
1602 dasd_put_device(device); in dasd_expires_show()
1607 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1610 struct dasd_device *device; in dasd_expires_store() local
1613 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1614 if (IS_ERR(device)) in dasd_expires_store()
1619 dasd_put_device(device); in dasd_expires_store()
1624 device->default_expires = val; in dasd_expires_store()
1626 dasd_put_device(device); in dasd_expires_store()
1633 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_retries_show()
1635 struct dasd_device *device; in dasd_retries_show() local
1638 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_show()
1639 if (IS_ERR(device)) in dasd_retries_show()
1641 len = sysfs_emit(buf, "%lu\n", device->default_retries); in dasd_retries_show()
1642 dasd_put_device(device); in dasd_retries_show()
1647 dasd_retries_store(struct device *dev, struct device_attribute *attr, in dasd_retries_store()
1650 struct dasd_device *device; in dasd_retries_store() local
1653 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_retries_store()
1654 if (IS_ERR(device)) in dasd_retries_store()
1659 dasd_put_device(device); in dasd_retries_store()
1664 device->default_retries = val; in dasd_retries_store()
1666 dasd_put_device(device); in dasd_retries_store()
1673 dasd_timeout_show(struct device *dev, struct device_attribute *attr, in dasd_timeout_show()
1676 struct dasd_device *device; in dasd_timeout_show() local
1679 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_show()
1680 if (IS_ERR(device)) in dasd_timeout_show()
1682 len = sysfs_emit(buf, "%lu\n", device->blk_timeout); in dasd_timeout_show()
1683 dasd_put_device(device); in dasd_timeout_show()
1688 dasd_timeout_store(struct device *dev, struct device_attribute *attr, in dasd_timeout_store()
1691 struct dasd_device *device; in dasd_timeout_store() local
1694 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_timeout_store()
1695 if (IS_ERR(device) || !device->block) in dasd_timeout_store()
1700 dasd_put_device(device); in dasd_timeout_store()
1703 if (!device->block->gdp) { in dasd_timeout_store()
1704 dasd_put_device(device); in dasd_timeout_store()
1708 device->blk_timeout = val; in dasd_timeout_store()
1709 blk_queue_rq_timeout(device->block->gdp->queue, val * HZ); in dasd_timeout_store()
1711 dasd_put_device(device); in dasd_timeout_store()
1720 dasd_path_reset_store(struct device *dev, struct device_attribute *attr, in dasd_path_reset_store()
1723 struct dasd_device *device; in dasd_path_reset_store() local
1726 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_reset_store()
1727 if (IS_ERR(device)) in dasd_path_reset_store()
1733 if (device->discipline && device->discipline->reset_path) in dasd_path_reset_store()
1734 device->discipline->reset_path(device, (__u8) val); in dasd_path_reset_store()
1736 dasd_put_device(device); in dasd_path_reset_store()
1742 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr, in dasd_hpf_show()
1745 struct dasd_device *device; in dasd_hpf_show() local
1748 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_hpf_show()
1749 if (IS_ERR(device)) in dasd_hpf_show()
1751 if (!device->discipline || !device->discipline->hpf_enabled) { in dasd_hpf_show()
1752 dasd_put_device(device); in dasd_hpf_show()
1755 hpf = device->discipline->hpf_enabled(device); in dasd_hpf_show()
1756 dasd_put_device(device); in dasd_hpf_show()
1762 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1783 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1803 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1807 struct dasd_device *device; in dasd_reservation_state_show() local
1810 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1811 if (IS_ERR(device)) in dasd_reservation_state_show()
1814 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1816 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1820 dasd_put_device(device); in dasd_reservation_state_show()
1824 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1828 struct dasd_device *device; in dasd_reservation_state_store() local
1831 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1832 if (IS_ERR(device)) in dasd_reservation_state_store()
1835 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1838 dasd_put_device(device); in dasd_reservation_state_store()
1849 static ssize_t dasd_pm_show(struct device *dev, in dasd_pm_show()
1852 struct dasd_device *device; in dasd_pm_show() local
1855 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_pm_show()
1856 if (IS_ERR(device)) in dasd_pm_show()
1859 opm = dasd_path_get_opm(device); in dasd_pm_show()
1860 nppm = dasd_path_get_nppm(device); in dasd_pm_show()
1861 cablepm = dasd_path_get_cablepm(device); in dasd_pm_show()
1862 cuirpm = dasd_path_get_cuirpm(device); in dasd_pm_show()
1863 hpfpm = dasd_path_get_hpfpm(device); in dasd_pm_show()
1864 ifccpm = dasd_path_get_ifccpm(device); in dasd_pm_show()
1865 dasd_put_device(device); in dasd_pm_show()
1877 dasd_path_threshold_show(struct device *dev, in dasd_path_threshold_show()
1880 struct dasd_device *device; in dasd_path_threshold_show() local
1883 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_show()
1884 if (IS_ERR(device)) in dasd_path_threshold_show()
1886 len = sysfs_emit(buf, "%lu\n", device->path_thrhld); in dasd_path_threshold_show()
1887 dasd_put_device(device); in dasd_path_threshold_show()
1892 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr, in dasd_path_threshold_store()
1895 struct dasd_device *device; in dasd_path_threshold_store() local
1899 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_threshold_store()
1900 if (IS_ERR(device)) in dasd_path_threshold_store()
1904 dasd_put_device(device); in dasd_path_threshold_store()
1908 device->path_thrhld = val; in dasd_path_threshold_store()
1910 dasd_put_device(device); in dasd_path_threshold_store()
1921 dasd_path_autodisable_show(struct device *dev, in dasd_path_autodisable_show()
1937 dasd_path_autodisable_store(struct device *dev, in dasd_path_autodisable_store()
1962 dasd_path_interval_show(struct device *dev, in dasd_path_interval_show()
1965 struct dasd_device *device; in dasd_path_interval_show() local
1968 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_show()
1969 if (IS_ERR(device)) in dasd_path_interval_show()
1971 len = sysfs_emit(buf, "%lu\n", device->path_interval); in dasd_path_interval_show()
1972 dasd_put_device(device); in dasd_path_interval_show()
1977 dasd_path_interval_store(struct device *dev, struct device_attribute *attr, in dasd_path_interval_store()
1980 struct dasd_device *device; in dasd_path_interval_store() local
1984 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_path_interval_store()
1985 if (IS_ERR(device)) in dasd_path_interval_store()
1990 dasd_put_device(device); in dasd_path_interval_store()
1995 device->path_interval = val; in dasd_path_interval_store()
1997 dasd_put_device(device); in dasd_path_interval_store()
2005 dasd_device_fcs_show(struct device *dev, struct device_attribute *attr, in dasd_device_fcs_show()
2008 struct dasd_device *device; in dasd_device_fcs_show() local
2012 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_fcs_show()
2013 if (IS_ERR(device)) in dasd_device_fcs_show()
2015 fc_sec = dasd_path_get_fcs_device(device); in dasd_device_fcs_show()
2020 dasd_put_device(device); in dasd_device_fcs_show()
2043 dasd_copy_pair_show(struct device *dev, in dasd_copy_pair_show()
2140 static int dasd_devmap_clear_copy_relation(struct device *dev) in dasd_devmap_clear_copy_relation()
2160 if (copy->entry[i].device == copy->active->device) in dasd_devmap_clear_copy_relation()
2163 if (copy->entry[i].device) in dasd_devmap_clear_copy_relation()
2170 if (copy->entry[i].device) { in dasd_devmap_clear_copy_relation()
2171 dasd_put_device(copy->entry[i].device); in dasd_devmap_clear_copy_relation()
2172 copy->entry[i].device->copy = NULL; in dasd_devmap_clear_copy_relation()
2173 copy->entry[i].device = NULL; in dasd_devmap_clear_copy_relation()
2225 static ssize_t dasd_copy_pair_store(struct device *dev, in dasd_copy_pair_store()
2233 struct dasd_device *device; in dasd_copy_pair_store() local
2268 if (sec_devmap->device) in dasd_copy_pair_store()
2293 /* if primary device is already online call device setup directly */ in dasd_copy_pair_store()
2294 if (prim_devmap->device && !prim_devmap->device->copy) { in dasd_copy_pair_store()
2295 device = prim_devmap->device; in dasd_copy_pair_store()
2296 if (device->discipline->pprc_enabled) { in dasd_copy_pair_store()
2297 pprc_enabled = device->discipline->pprc_enabled(device); in dasd_copy_pair_store()
2298 rc = dasd_devmap_set_device_copy_relation(device->cdev, in dasd_copy_pair_store()
2316 dasd_copy_role_show(struct device *dev, in dasd_copy_role_show()
2320 struct dasd_device *device; in dasd_copy_role_show() local
2323 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_copy_role_show()
2324 if (IS_ERR(device)) in dasd_copy_role_show()
2327 if (!device->copy) { in dasd_copy_role_show()
2331 copy = device->copy; in dasd_copy_role_show()
2332 /* only the active device is primary */ in dasd_copy_role_show()
2333 if (copy->active->device == device) { in dasd_copy_role_show()
2338 if (copy->entry[i].device == device) { in dasd_copy_role_show()
2346 dasd_put_device(device); in dasd_copy_role_show()
2351 static ssize_t dasd_device_ping(struct device *dev, in dasd_device_ping()
2355 struct dasd_device *device; in dasd_device_ping() local
2358 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_ping()
2359 if (IS_ERR(device)) in dasd_device_ping()
2368 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) { in dasd_device_ping()
2372 if (!device->discipline || !device->discipline->device_ping) { in dasd_device_ping()
2376 rc = device->discipline->device_ping(device); in dasd_device_ping()
2380 dasd_put_device(device); in dasd_device_ping()
2386 static ssize_t dasd_##_name##_show(struct device *dev, \
2391 struct dasd_device *device = dasd_device_from_cdev(cdev); \
2394 if (IS_ERR(device)) \
2396 if (device->discipline && _func) \
2397 val = _func(device); \
2398 dasd_put_device(device); \
2404 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
2405 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
2406 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
2407 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
2408 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
2409 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
2410 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
2411 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
2412 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
2521 if (devmap->device) in dasd_set_feature()
2522 devmap->device->features = devmap->features; in dasd_set_feature()
2540 static void dasd_path_init_kobj(struct dasd_device *device, int chp) in dasd_path_init_kobj() argument
2542 device->path[chp].kobj.kset = device->paths_info; in dasd_path_init_kobj()
2543 kobject_init(&device->path[chp].kobj, &path_attr_type); in dasd_path_init_kobj()
2546 void dasd_path_create_kobj(struct dasd_device *device, int chp) in dasd_path_create_kobj() argument
2550 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) in dasd_path_create_kobj()
2552 if (!device->paths_info) { in dasd_path_create_kobj()
2553 dev_warn(&device->cdev->dev, "Unable to create paths objects\n"); in dasd_path_create_kobj()
2556 if (device->path[chp].in_sysfs) in dasd_path_create_kobj()
2558 if (!device->path[chp].conf_data) in dasd_path_create_kobj()
2561 dasd_path_init_kobj(device, chp); in dasd_path_create_kobj()
2563 rc = kobject_add(&device->path[chp].kobj, NULL, "%x.%02x", in dasd_path_create_kobj()
2564 device->path[chp].cssid, device->path[chp].chpid); in dasd_path_create_kobj()
2566 kobject_put(&device->path[chp].kobj); in dasd_path_create_kobj()
2567 device->path[chp].in_sysfs = true; in dasd_path_create_kobj()
2571 void dasd_path_create_kobjects(struct dasd_device *device) in dasd_path_create_kobjects() argument
2575 opm = dasd_path_get_opm(device); in dasd_path_create_kobjects()
2579 dasd_path_create_kobj(device, pathmask_to_pos(lpm)); in dasd_path_create_kobjects()
2584 static void dasd_path_remove_kobj(struct dasd_device *device, int chp) in dasd_path_remove_kobj() argument
2586 if (device->path[chp].in_sysfs) { in dasd_path_remove_kobj()
2587 kobject_put(&device->path[chp].kobj); in dasd_path_remove_kobj()
2588 device->path[chp].in_sysfs = false; in dasd_path_remove_kobj()
2593 * As we keep kobjects for the lifetime of a device, this function must not be
2594 * called anywhere but in the context of offlining a device.
2596 void dasd_path_remove_kobjects(struct dasd_device *device) in dasd_path_remove_kobjects() argument
2601 dasd_path_remove_kobj(device, i); in dasd_path_remove_kobjects()