Lines Matching full:device

10  * Device mapping and dasd= parameter parsing functions. All devmap
38 * between device number and device index. To find a dasd_devmap_t
39 * that corresponds to a device number of a device index each
41 * the device number and one to search by the device index. As
42 * soon as big minor numbers are available the device index list
43 * can be removed since the device number will then be identical
44 * to the device index.
51 struct dasd_device *device; member
129 * Read a device busid/devno from a string.
140 pr_err("The IPL device is not a CCW device\n"); in dasd_busid()
218 pr_warning("%*s is not a supported device option\n", in dasd_feature_list()
304 * as a device number or a range of devices. If the interpretation is
333 pr_err("%s is not a valid device range\n", parsestring); in dasd_parse_range()
339 /* each device in dasd= parameter should be set initially online */ in dasd_parse_range()
370 * keywords and device ranges. When the dasd driver is build into the kernel,
403 * Add a devmap for the device specified by busid. It is possible that
431 new->device = NULL; in dasd_add_busid()
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); in dasd_forget_ranges()
494 * Find the device struct by its device index.
500 struct dasd_device *device; in dasd_device_from_devindex() local
508 /* Found the devmap for the device. */ in dasd_device_from_devindex()
512 if (devmap && devmap->device) { in dasd_device_from_devindex()
513 device = devmap->device; in dasd_device_from_devindex()
514 dasd_get_device(device); in dasd_device_from_devindex()
516 device = ERR_PTR(-ENODEV); in dasd_device_from_devindex()
518 return device; in dasd_device_from_devindex()
538 * Create a dasd device structure for cdev.
544 struct dasd_device *device; in dasd_create_device() local
552 device = dasd_alloc_device(); in dasd_create_device()
553 if (IS_ERR(device)) in dasd_create_device()
554 return device; in dasd_create_device()
555 atomic_set(&device->ref_count, 3); in dasd_create_device()
558 if (!devmap->device) { in dasd_create_device()
559 devmap->device = device; in dasd_create_device()
560 device->devindex = devmap->devindex; in dasd_create_device()
561 device->features = devmap->features; in dasd_create_device()
563 device->cdev = cdev; in dasd_create_device()
571 dasd_free_device(device); in dasd_create_device()
576 dev_set_drvdata(&cdev->dev, device); in dasd_create_device()
579 return device; in dasd_create_device()
588 * Remove a dasd device structure. The passed referenced
592 dasd_delete_device(struct dasd_device *device) in dasd_delete_device() argument
598 /* First remove device pointer from devmap. */ in dasd_delete_device()
599 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_delete_device()
602 if (devmap->device != device) { in dasd_delete_device()
604 dasd_put_device(device); in dasd_delete_device()
607 devmap->device = NULL; in dasd_delete_device()
611 spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
612 dev_set_drvdata(&device->cdev->dev, NULL); in dasd_delete_device()
613 spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags); in dasd_delete_device()
619 atomic_sub(3, &device->ref_count); in dasd_delete_device()
622 wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0); in dasd_delete_device()
625 cdev = device->cdev; in dasd_delete_device()
626 device->cdev = NULL; in dasd_delete_device()
631 /* Now the device structure can be freed. */ in dasd_delete_device()
632 dasd_free_device(device); in dasd_delete_device()
640 dasd_put_device_wake(struct dasd_device *device) in dasd_put_device_wake() argument
648 * This function needs to be called with the ccw device
654 struct dasd_device *device = dev_get_drvdata(&cdev->dev); in dasd_device_from_cdev_locked() local
656 if (!device) in dasd_device_from_cdev_locked()
658 dasd_get_device(device); in dasd_device_from_cdev_locked()
659 return device; in dasd_device_from_cdev_locked()
668 struct dasd_device *device; in dasd_device_from_cdev() local
672 device = dasd_device_from_cdev_locked(cdev); in dasd_device_from_cdev()
674 return device; in dasd_device_from_cdev()
677 void dasd_add_link_to_gendisk(struct gendisk *gdp, struct dasd_device *device) in dasd_add_link_to_gendisk() argument
681 devmap = dasd_find_busid(dev_name(&device->cdev->dev)); in dasd_add_link_to_gendisk()
691 struct dasd_device *device; in dasd_device_from_gendisk() local
696 device = NULL; in dasd_device_from_gendisk()
699 if (devmap && devmap->device) { in dasd_device_from_gendisk()
700 device = devmap->device; in dasd_device_from_gendisk()
701 dasd_get_device(device); in dasd_device_from_gendisk()
704 return device; in dasd_device_from_gendisk()
714 static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr, in dasd_ff_show()
728 static ssize_t dasd_ff_store(struct device *dev, struct device_attribute *attr, in dasd_ff_store()
748 if (devmap->device) in dasd_ff_store()
749 devmap->device->features = devmap->features; in dasd_ff_store()
760 dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_ro_show()
774 dasd_ro_store(struct device *dev, struct device_attribute *attr, in dasd_ro_store()
778 struct dasd_device *device; in dasd_ro_store() local
795 device = devmap->device; in dasd_ro_store()
796 if (device) { in dasd_ro_store()
797 device->features = devmap->features; in dasd_ro_store()
798 val = val || test_bit(DASD_FLAG_DEVICE_RO, &device->flags); in dasd_ro_store()
801 if (device && device->block && device->block->gdp) in dasd_ro_store()
802 set_disk_ro(device->block->gdp, val); in dasd_ro_store()
812 dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_erplog_show()
826 dasd_erplog_store(struct device *dev, struct device_attribute *attr, in dasd_erplog_store()
846 if (devmap->device) in dasd_erplog_store()
847 devmap->device->features = devmap->features; in dasd_erplog_store()
856 * to talk to the device
859 dasd_use_diag_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_diag_show()
873 dasd_use_diag_store(struct device *dev, struct device_attribute *attr, in dasd_use_diag_store()
892 if (!devmap->device && !(devmap->features & DASD_FEATURE_USERAW)) { in dasd_use_diag_store()
910 dasd_use_raw_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_use_raw_show()
924 dasd_use_raw_store(struct device *dev, struct device_attribute *attr, in dasd_use_raw_store()
941 if (!devmap->device && !(devmap->features & DASD_FEATURE_USEDIAG)) { in dasd_use_raw_store()
956 dasd_discipline_show(struct device *dev, struct device_attribute *attr, in dasd_discipline_show()
959 struct dasd_device *device; in dasd_discipline_show() local
962 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_discipline_show()
963 if (IS_ERR(device)) in dasd_discipline_show()
965 else if (!device->discipline) { in dasd_discipline_show()
966 dasd_put_device(device); in dasd_discipline_show()
970 device->discipline->name); in dasd_discipline_show()
971 dasd_put_device(device); in dasd_discipline_show()
982 dasd_device_status_show(struct device *dev, struct device_attribute *attr, in dasd_device_status_show()
985 struct dasd_device *device; in dasd_device_status_show() local
988 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_device_status_show()
989 if (!IS_ERR(device)) { in dasd_device_status_show()
990 switch (device->state) { in dasd_device_status_show()
1013 dasd_put_device(device); in dasd_device_status_show()
1021 static ssize_t dasd_alias_show(struct device *dev, in dasd_alias_show()
1024 struct dasd_device *device; in dasd_alias_show() local
1027 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_alias_show()
1028 if (IS_ERR(device)) in dasd_alias_show()
1031 if (device->discipline && device->discipline->get_uid && in dasd_alias_show()
1032 !device->discipline->get_uid(device, &uid)) { in dasd_alias_show()
1035 dasd_put_device(device); in dasd_alias_show()
1039 dasd_put_device(device); in dasd_alias_show()
1046 static ssize_t dasd_vendor_show(struct device *dev, in dasd_vendor_show()
1049 struct dasd_device *device; in dasd_vendor_show() local
1053 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_vendor_show()
1055 if (IS_ERR(device)) in dasd_vendor_show()
1058 if (device->discipline && device->discipline->get_uid && in dasd_vendor_show()
1059 !device->discipline->get_uid(device, &uid)) in dasd_vendor_show()
1062 dasd_put_device(device); in dasd_vendor_show()
1074 dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_uid_show()
1076 struct dasd_device *device; in dasd_uid_show() local
1081 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_uid_show()
1083 if (IS_ERR(device)) in dasd_uid_show()
1086 if (device->discipline && device->discipline->get_uid && in dasd_uid_show()
1087 !device->discipline->get_uid(device, &uid)) { in dasd_uid_show()
1101 /* should not happen, treat like base device */ in dasd_uid_show()
1117 dasd_put_device(device); in dasd_uid_show()
1127 dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_eer_show()
1133 if (!IS_ERR(devmap) && devmap->device) in dasd_eer_show()
1134 eer_flag = dasd_eer_enabled(devmap->device); in dasd_eer_show()
1141 dasd_eer_store(struct device *dev, struct device_attribute *attr, in dasd_eer_store()
1151 if (!devmap->device) in dasd_eer_store()
1159 rc = dasd_eer_enable(devmap->device); in dasd_eer_store()
1163 dasd_eer_disable(devmap->device); in dasd_eer_store()
1173 dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf) in dasd_expires_show()
1175 struct dasd_device *device; in dasd_expires_show() local
1178 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_show()
1179 if (IS_ERR(device)) in dasd_expires_show()
1181 len = snprintf(buf, PAGE_SIZE, "%lu\n", device->default_expires); in dasd_expires_show()
1182 dasd_put_device(device); in dasd_expires_show()
1187 dasd_expires_store(struct device *dev, struct device_attribute *attr, in dasd_expires_store()
1190 struct dasd_device *device; in dasd_expires_store() local
1193 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_expires_store()
1194 if (IS_ERR(device)) in dasd_expires_store()
1199 dasd_put_device(device); in dasd_expires_store()
1204 device->default_expires = val; in dasd_expires_store()
1206 dasd_put_device(device); in dasd_expires_store()
1212 static ssize_t dasd_reservation_policy_show(struct device *dev, in dasd_reservation_policy_show()
1233 static ssize_t dasd_reservation_policy_store(struct device *dev, in dasd_reservation_policy_store()
1251 if (devmap->device) in dasd_reservation_policy_store()
1252 devmap->device->features = devmap->features; in dasd_reservation_policy_store()
1263 static ssize_t dasd_reservation_state_show(struct device *dev, in dasd_reservation_state_show()
1267 struct dasd_device *device; in dasd_reservation_state_show() local
1270 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_show()
1271 if (IS_ERR(device)) in dasd_reservation_state_show()
1274 if (test_bit(DASD_FLAG_IS_RESERVED, &device->flags)) in dasd_reservation_state_show()
1276 else if (test_bit(DASD_FLAG_LOCK_STOLEN, &device->flags)) in dasd_reservation_state_show()
1280 dasd_put_device(device); in dasd_reservation_state_show()
1284 static ssize_t dasd_reservation_state_store(struct device *dev, in dasd_reservation_state_store()
1288 struct dasd_device *device; in dasd_reservation_state_store() local
1291 device = dasd_device_from_cdev(to_ccwdev(dev)); in dasd_reservation_state_store()
1292 if (IS_ERR(device)) in dasd_reservation_state_store()
1295 clear_bit(DASD_FLAG_LOCK_STOLEN, &device->flags); in dasd_reservation_state_store()
1298 dasd_put_device(device); in dasd_reservation_state_store()
1364 if (devmap->device) in dasd_set_feature()
1365 devmap->device->features = devmap->features; in dasd_set_feature()