Lines Matching refs:device

39  * between device number and device index. To find a dasd_devmap_t
40 * that corresponds to a device number of a device index each
42 * the device number and one to search by the device index. As
43 * soon as big minor numbers are available the device index list
44 * can be removed since the device number will then be identical
45 * to the device index.
52 struct dasd_device *device;
131 * Read a device busid/devno from a string.
141 pr_err("The IPL device is not a CCW device\n");
206 pr_warn("%.*s is not a supported device option\n",
274 * Split a string of a device range into its pieces and return the from, to, and
286 /* Do we have a range or a single device? */
305 * Try to interprete the range string as a device number or a range of devices.
345 pr_err("%s is not a valid device range\n", range);
356 /* each device in dasd= parameter should be set initially online */
376 * keywords and device ranges. The parameters in that list will be stored as
404 * Add a devmap for the device specified by busid. It is possible that
431 new->device = NULL;
442 * Find devmap for device with given bus_id.
473 * Forget all about the device numbers added so far.
485 BUG_ON(devmap->device != NULL);
494 * Find the device struct by its device index.
500 struct dasd_device *device;
508 /* Found the devmap for the device. */
512 if (devmap && devmap->device) {
513 device = devmap->device;
514 dasd_get_device(device);
516 device = ERR_PTR(-ENODEV);
518 return device;
538 * Create a dasd device structure for cdev.
544 struct dasd_device *device;
552 device = dasd_alloc_device();
553 if (IS_ERR(device))
554 return device;
555 atomic_set(&device->ref_count, 3);
558 if (!devmap->device) {
559 devmap->device = device;
560 device->devindex = devmap->devindex;
561 device->features = devmap->features;
563 device->cdev = cdev;
571 dasd_free_device(device);
576 dev_set_drvdata(&cdev->dev, device);
579 return device;
588 * Remove a dasd device structure. The passed referenced
592 dasd_delete_device(struct dasd_device *device)
598 /* First remove device pointer from devmap. */
599 devmap = dasd_find_busid(dev_name(&device->cdev->dev));
602 if (devmap->device != device) {
604 dasd_put_device(device);
607 devmap->device = NULL;
611 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
612 dev_set_drvdata(&device->cdev->dev, NULL);
613 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
619 atomic_sub(3, &device->ref_count);
622 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0);
624 dasd_generic_free_discipline(device);
626 cdev = device->cdev;
627 device->cdev = NULL;
632 /* Now the device structure can be freed. */
633 dasd_free_device(device);
641 dasd_put_device_wake(struct dasd_device *device)
649 * This function needs to be called with the ccw device
655 struct dasd_device *device = dev_get_drvdata(&cdev->dev);
657 if (!device)
659 dasd_get_device(device);
660 return device;
669 struct dasd_device *device;
673 device = dasd_device_from_cdev_locked(cdev);
675 return device;
678 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device)
682 devmap = dasd_find_busid(dev_name(&device->cdev->dev));
692 struct dasd_device *device;
697 device = NULL;
700 if (devmap && devmap->device) {
701 device = devmap->device;
702 dasd_get_device(device);
705 return device;
715 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr,
729 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr,
749 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf)
752 struct dasd_device *device;
762 device = devmap->device;
763 if (device)
764 ro_flag |= test_bit(DASD_FLAG_DEVICE_RO, &device->flags);
772 dasd_ro_store(struct device *dev, struct device_attribute *attr,
776 struct dasd_device *device;
788 device = dasd_device_from_cdev(cdev);
789 if (IS_ERR(device))
793 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags);
795 if (!device->block || !device->block->gdp ||
796 test_bit(DASD_FLAG_OFFLINE, &device->flags)) {
800 /* Increase open_count to avoid losing the block device */
801 atomic_inc(&device->block->open_count);
804 set_disk_ro(device->block->gdp, val);
805 atomic_dec(&device->block->open_count);
808 dasd_put_device(device);
819 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
833 dasd_erplog_store(struct device *dev, struct device_attribute *attr,
851 * to talk to the device
854 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf)
868 dasd_use_diag_store(struct device *dev, struct device_attribute *attr,
885 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) {
903 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf)
917 dasd_use_raw_store(struct device *dev, struct device_attribute *attr,
934 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) {
949 dasd_safe_offline_store(struct device *dev, struct device_attribute *attr,
953 struct dasd_device *device;
958 device = dasd_device_from_cdev_locked(cdev);
959 if (IS_ERR(device)) {
960 rc = PTR_ERR(device);
965 if (test_bit(DASD_FLAG_OFFLINE, &device->flags) ||
966 test_bit(DASD_FLAG_SAFE_OFFLINE_RUNNING, &device->flags)) {
968 dasd_put_device(device);
974 set_bit(DASD_FLAG_SAFE_OFFLINE, &device->flags);
975 dasd_put_device(device);
987 dasd_access_show(struct device *dev, struct device_attribute *attr,
991 struct dasd_device *device;
994 device = dasd_device_from_cdev(cdev);
995 if (IS_ERR(device))
996 return PTR_ERR(device);
998 if (!device->discipline)
1000 else if (!device->discipline->host_access_count)
1003 count = device->discipline->host_access_count(device);
1005 dasd_put_device(device);
1015 dasd_discipline_show(struct device *dev, struct device_attribute *attr,
1018 struct dasd_device *device;
1021 device = dasd_device_from_cdev(to_ccwdev(dev));
1022 if (IS_ERR(device))
1024 else if (!device->discipline) {
1025 dasd_put_device(device);
1029 device->discipline->name);
1030 dasd_put_device(device);
1041 dasd_device_status_show(struct device *dev, struct device_attribute *attr,
1044 struct dasd_device *device;
1047 device = dasd_device_from_cdev(to_ccwdev(dev));
1048 if (!IS_ERR(device)) {
1049 switch (device->state) {
1072 dasd_put_device(device);
1080 static ssize_t dasd_alias_show(struct device *dev,
1083 struct dasd_device *device;
1086 device = dasd_device_from_cdev(to_ccwdev(dev));
1087 if (IS_ERR(device))
1090 if (device->discipline && device->discipline->get_uid &&
1091 !device->discipline->get_uid(device, &uid)) {
1094 dasd_put_device(device);
1098 dasd_put_device(device);
1105 static ssize_t dasd_vendor_show(struct device *dev,
1108 struct dasd_device *device;
1112 device = dasd_device_from_cdev(to_ccwdev(dev));
1114 if (IS_ERR(device))
1117 if (device->discipline && device->discipline->get_uid &&
1118 !device->discipline->get_uid(device, &uid))
1121 dasd_put_device(device);
1133 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
1135 struct dasd_device *device;
1140 device = dasd_device_from_cdev(to_ccwdev(dev));
1142 if (IS_ERR(device))
1145 if (device->discipline && device->discipline->get_uid &&
1146 !device->discipline->get_uid(device, &uid)) {
1160 /* should not happen, treat like base device */
1176 dasd_put_device(device);
1186 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf)
1192 if (!IS_ERR(devmap) && devmap->device)
1193 eer_flag = dasd_eer_enabled(devmap->device);
1200 dasd_eer_store(struct device *dev, struct device_attribute *attr,
1203 struct dasd_device *device;
1207 device = dasd_device_from_cdev(to_ccwdev(dev));
1208 if (IS_ERR(device))
1209 return PTR_ERR(device);
1215 rc = dasd_eer_enable(device);
1217 dasd_eer_disable(device);
1219 dasd_put_device(device);
1230 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf)
1232 struct dasd_device *device;
1235 device = dasd_device_from_cdev(to_ccwdev(dev));
1236 if (IS_ERR(device))
1238 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_expires);
1239 dasd_put_device(device);
1244 dasd_expires_store(struct device *dev, struct device_attribute *attr,
1247 struct dasd_device *device;
1250 device = dasd_device_from_cdev(to_ccwdev(dev));
1251 if (IS_ERR(device))
1256 dasd_put_device(device);
1261 device->default_expires = val;
1263 dasd_put_device(device);
1270 dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf)
1272 struct dasd_device *device;
1275 device = dasd_device_from_cdev(to_ccwdev(dev));
1276 if (IS_ERR(device))
1278 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_retries);
1279 dasd_put_device(device);
1284 dasd_retries_store(struct device *dev, struct device_attribute *attr,
1287 struct dasd_device *device;
1290 device = dasd_device_from_cdev(to_ccwdev(dev));
1291 if (IS_ERR(device))
1296 dasd_put_device(device);
1301 device->default_retries = val;
1303 dasd_put_device(device);
1310 dasd_timeout_show(struct device *dev, struct device_attribute *attr,
1313 struct dasd_device *device;
1316 device = dasd_device_from_cdev(to_ccwdev(dev));
1317 if (IS_ERR(device))
1319 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->blk_timeout);
1320 dasd_put_device(device);
1325 dasd_timeout_store(struct device *dev, struct device_attribute *attr,
1328 struct dasd_device *device;
1332 device = dasd_device_from_cdev(to_ccwdev(dev));
1333 if (IS_ERR(device) || !device->block)
1338 dasd_put_device(device);
1341 q = device->block->request_queue;
1343 dasd_put_device(device);
1347 device->blk_timeout = val;
1349 blk_queue_rq_timeout(q, device->blk_timeout * HZ);
1351 dasd_put_device(device);
1360 dasd_path_reset_store(struct device *dev, struct device_attribute *attr,
1363 struct dasd_device *device;
1366 device = dasd_device_from_cdev(to_ccwdev(dev));
1367 if (IS_ERR(device))
1373 if (device->discipline && device->discipline->reset_path)
1374 device->discipline->reset_path(device, (__u8) val);
1376 dasd_put_device(device);
1382 static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr,
1385 struct dasd_device *device;
1388 device = dasd_device_from_cdev(to_ccwdev(dev));
1389 if (IS_ERR(device))
1391 if (!device->discipline || !device->discipline->hpf_enabled) {
1392 dasd_put_device(device);
1395 hpf = device->discipline->hpf_enabled(device);
1396 dasd_put_device(device);
1402 static ssize_t dasd_reservation_policy_show(struct device *dev,
1423 static ssize_t dasd_reservation_policy_store(struct device *dev,
1443 static ssize_t dasd_reservation_state_show(struct device *dev,
1447 struct dasd_device *device;
1450 device = dasd_device_from_cdev(to_ccwdev(dev));
1451 if (IS_ERR(device))
1454 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags))
1456 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags))
1460 dasd_put_device(device);
1464 static ssize_t dasd_reservation_state_store(struct device *dev,
1468 struct dasd_device *device;
1471 device = dasd_device_from_cdev(to_ccwdev(dev));
1472 if (IS_ERR(device))
1475 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags);
1478 dasd_put_device(device);
1489 static ssize_t dasd_pm_show(struct device *dev,
1492 struct dasd_device *device;
1495 device = dasd_device_from_cdev(to_ccwdev(dev));
1496 if (IS_ERR(device))
1499 opm = dasd_path_get_opm(device);
1500 nppm = dasd_path_get_nppm(device);
1501 cablepm = dasd_path_get_cablepm(device);
1502 cuirpm = dasd_path_get_cuirpm(device);
1503 hpfpm = dasd_path_get_hpfpm(device);
1504 ifccpm = dasd_path_get_ifccpm(device);
1505 dasd_put_device(device);
1517 dasd_path_threshold_show(struct device *dev,
1520 struct dasd_device *device;
1523 device = dasd_device_from_cdev(to_ccwdev(dev));
1524 if (IS_ERR(device))
1526 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->path_thrhld);
1527 dasd_put_device(device);
1532 dasd_path_threshold_store(struct device *dev, struct device_attribute *attr,
1535 struct dasd_device *device;
1539 device = dasd_device_from_cdev(to_ccwdev(dev));
1540 if (IS_ERR(device))
1544 dasd_put_device(device);
1548 device->path_thrhld = val;
1550 dasd_put_device(device);
1561 dasd_path_autodisable_show(struct device *dev,
1577 dasd_path_autodisable_store(struct device *dev,
1602 dasd_path_interval_show(struct device *dev,
1605 struct dasd_device *device;
1608 device = dasd_device_from_cdev(to_ccwdev(dev));
1609 if (IS_ERR(device))
1611 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->path_interval);
1612 dasd_put_device(device);
1617 dasd_path_interval_store(struct device *dev, struct device_attribute *attr,
1620 struct dasd_device *device;
1624 device = dasd_device_from_cdev(to_ccwdev(dev));
1625 if (IS_ERR(device))
1630 dasd_put_device(device);
1635 device->path_interval = val;
1637 dasd_put_device(device);
1646 static ssize_t dasd_##_name##_show(struct device *dev, \
1651 struct dasd_device *device = dasd_device_from_cdev(cdev); \
1654 if (IS_ERR(device)) \
1656 if (device->discipline && _func) \
1657 val = _func(device); \
1658 dasd_put_device(device); \
1664 DASD_DEFINE_ATTR(ese, device->discipline->is_ese);
1665 DASD_DEFINE_ATTR(extent_size, device->discipline->ext_size);
1666 DASD_DEFINE_ATTR(pool_id, device->discipline->ext_pool_id);
1667 DASD_DEFINE_ATTR(space_configured, device->discipline->space_configured);
1668 DASD_DEFINE_ATTR(space_allocated, device->discipline->space_allocated);
1669 DASD_DEFINE_ATTR(logical_capacity, device->discipline->logical_capacity);
1670 DASD_DEFINE_ATTR(warn_threshold, device->discipline->ext_pool_warn_thrshld);
1671 DASD_DEFINE_ATTR(cap_at_warnlevel, device->discipline->ext_pool_cap_at_warnlevel);
1672 DASD_DEFINE_ATTR(pool_oos, device->discipline->ext_pool_oos);
1773 if (devmap->device)
1774 devmap->device->features = devmap->features;