Lines Matching refs:unit
22 void zfcp_unit_scsi_scan(struct zfcp_unit *unit) in zfcp_unit_scsi_scan() argument
24 struct fc_rport *rport = unit->port->rport; in zfcp_unit_scsi_scan()
27 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun); in zfcp_unit_scsi_scan()
36 struct zfcp_unit *unit = container_of(work, struct zfcp_unit, in zfcp_unit_scsi_scan_work() local
39 zfcp_unit_scsi_scan(unit); in zfcp_unit_scsi_scan_work()
40 put_device(&unit->dev); in zfcp_unit_scsi_scan_work()
55 struct zfcp_unit *unit; in zfcp_unit_queue_scsi_scan() local
58 list_for_each_entry(unit, &port->unit_list, list) { in zfcp_unit_queue_scsi_scan()
59 get_device(&unit->dev); in zfcp_unit_queue_scsi_scan()
61 &unit->scsi_work) <= 0) in zfcp_unit_queue_scsi_scan()
62 put_device(&unit->dev); in zfcp_unit_queue_scsi_scan()
69 struct zfcp_unit *unit; in _zfcp_unit_find() local
71 list_for_each_entry(unit, &port->unit_list, list) in _zfcp_unit_find()
72 if (unit->fcp_lun == fcp_lun) { in _zfcp_unit_find()
73 get_device(&unit->dev); in _zfcp_unit_find()
74 return unit; in _zfcp_unit_find()
93 struct zfcp_unit *unit; in zfcp_unit_find() local
96 unit = _zfcp_unit_find(port, fcp_lun); in zfcp_unit_find()
98 return unit; in zfcp_unit_find()
107 struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev); in zfcp_unit_release() local
109 atomic_dec(&unit->port->units); in zfcp_unit_release()
110 kfree(unit); in zfcp_unit_release()
123 struct zfcp_unit *unit; in zfcp_unit_add() local
133 unit = zfcp_unit_find(port, fcp_lun); in zfcp_unit_add()
134 if (unit) { in zfcp_unit_add()
135 put_device(&unit->dev); in zfcp_unit_add()
140 unit = kzalloc(sizeof(struct zfcp_unit), GFP_KERNEL); in zfcp_unit_add()
141 if (!unit) { in zfcp_unit_add()
146 unit->port = port; in zfcp_unit_add()
147 unit->fcp_lun = fcp_lun; in zfcp_unit_add()
148 unit->dev.parent = &port->dev; in zfcp_unit_add()
149 unit->dev.release = zfcp_unit_release; in zfcp_unit_add()
150 unit->dev.groups = zfcp_unit_attr_groups; in zfcp_unit_add()
151 INIT_WORK(&unit->scsi_work, zfcp_unit_scsi_scan_work); in zfcp_unit_add()
153 if (dev_set_name(&unit->dev, "0x%016llx", in zfcp_unit_add()
155 kfree(unit); in zfcp_unit_add()
160 if (device_register(&unit->dev)) { in zfcp_unit_add()
161 put_device(&unit->dev); in zfcp_unit_add()
169 list_add_tail(&unit->list, &port->unit_list); in zfcp_unit_add()
177 zfcp_unit_scsi_scan(unit); in zfcp_unit_add()
195 struct scsi_device *zfcp_unit_sdev(struct zfcp_unit *unit) in zfcp_unit_sdev() argument
201 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun); in zfcp_unit_sdev()
202 port = unit->port; in zfcp_unit_sdev()
214 unsigned int zfcp_unit_sdev_status(struct zfcp_unit *unit) in zfcp_unit_sdev_status() argument
220 sdev = zfcp_unit_sdev(unit); in zfcp_unit_sdev_status()
240 struct zfcp_unit *unit; in zfcp_unit_remove() local
244 unit = _zfcp_unit_find(port, fcp_lun); in zfcp_unit_remove()
245 if (unit) in zfcp_unit_remove()
246 list_del(&unit->list); in zfcp_unit_remove()
249 if (!unit) in zfcp_unit_remove()
252 sdev = zfcp_unit_sdev(unit); in zfcp_unit_remove()
258 device_unregister(&unit->dev); in zfcp_unit_remove()
260 put_device(&unit->dev); /* undo _zfcp_unit_find() */ in zfcp_unit_remove()