Lines Matching defs:unit

16  * @unit: The zfcp LUN/unit to register
22 void zfcp_unit_scsi_scan(struct zfcp_unit *unit)
24 struct fc_rport *rport = unit->port->rport;
27 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
36 struct zfcp_unit *unit = container_of(work, struct zfcp_unit,
39 zfcp_unit_scsi_scan(unit);
40 put_device(&unit->dev);
55 struct zfcp_unit *unit;
58 list_for_each_entry(unit, &port->unit_list, list) {
59 get_device(&unit->dev);
61 &unit->scsi_work) <= 0)
62 put_device(&unit->dev);
69 struct zfcp_unit *unit;
71 list_for_each_entry(unit, &port->unit_list, list)
72 if (unit->fcp_lun == fcp_lun) {
73 get_device(&unit->dev);
74 return unit;
82 * @port: zfcp_port where to look for the unit
93 struct zfcp_unit *unit;
96 unit = _zfcp_unit_find(port, fcp_lun);
98 return unit;
107 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
109 atomic_dec(&unit->port->units);
110 kfree(unit);
114 * zfcp_unit_add - add unit to unit list of a port.
115 * @port: pointer to port where unit is added
116 * @fcp_lun: FCP LUN of unit to be added
119 * Sets up some unit internal structures and creates sysfs entry.
123 struct zfcp_unit *unit;
133 unit = zfcp_unit_find(port, fcp_lun);
134 if (unit) {
135 put_device(&unit->dev);
140 unit = kzalloc(sizeof(struct zfcp_unit), GFP_KERNEL);
141 if (!unit) {
146 unit->port = port;
147 unit->fcp_lun = fcp_lun;
148 unit->dev.parent = &port->dev;
149 unit->dev.release = zfcp_unit_release;
150 unit->dev.groups = zfcp_unit_attr_groups;
151 INIT_WORK(&unit->scsi_work, zfcp_unit_scsi_scan_work);
153 if (dev_set_name(&unit->dev, "0x%016llx",
155 kfree(unit);
160 if (device_register(&unit->dev)) {
161 put_device(&unit->dev);
169 list_add_tail(&unit->list, &port->unit_list);
177 zfcp_unit_scsi_scan(unit);
187 * @unit: The zfcp_unit where to get the SCSI device for
195 struct scsi_device *zfcp_unit_sdev(struct zfcp_unit *unit)
201 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
202 port = unit->port;
209 * @unit: The unit to lookup the SCSI device for
214 unsigned int zfcp_unit_sdev_status(struct zfcp_unit *unit)
220 sdev = zfcp_unit_sdev(unit);
232 * @port: The port where to remove the unit from the configuration
233 * @fcp_lun: The 64 bit LUN of the unit to remove
235 * Returns: -EINVAL if a unit with the specified LUN does not exist,
240 struct zfcp_unit *unit;
244 unit = _zfcp_unit_find(port, fcp_lun);
245 if (unit)
246 list_del(&unit->list);
249 if (!unit)
252 sdev = zfcp_unit_sdev(unit);
258 device_unregister(&unit->dev);
260 put_device(&unit->dev); /* undo _zfcp_unit_find() */