Lines Matching full:r
20 * @r: the resource manager to initialize
23 * If the device does not support all channel numbers, change @r->channels_mask
26 int fw_iso_resources_init(struct fw_iso_resources *r, struct fw_unit *unit) in fw_iso_resources_init() argument
28 r->channels_mask = ~0uLL; in fw_iso_resources_init()
29 r->unit = unit; in fw_iso_resources_init()
30 mutex_init(&r->mutex); in fw_iso_resources_init()
31 r->allocated = false; in fw_iso_resources_init()
39 * @r: the resource manager that is no longer needed
41 void fw_iso_resources_destroy(struct fw_iso_resources *r) in fw_iso_resources_destroy() argument
43 WARN_ON(r->allocated); in fw_iso_resources_destroy()
44 mutex_destroy(&r->mutex); in fw_iso_resources_destroy()
92 * @r: the resource manager
105 int fw_iso_resources_allocate(struct fw_iso_resources *r, in fw_iso_resources_allocate() argument
108 struct fw_card *card = fw_parent_device(r->unit)->card; in fw_iso_resources_allocate()
111 if (WARN_ON(r->allocated)) in fw_iso_resources_allocate()
114 r->bandwidth = packet_bandwidth(max_payload_bytes, speed); in fw_iso_resources_allocate()
118 r->generation = card->generation; in fw_iso_resources_allocate()
119 r->bandwidth_overhead = current_bandwidth_overhead(card); in fw_iso_resources_allocate()
126 mutex_lock(&r->mutex); in fw_iso_resources_allocate()
128 bandwidth = r->bandwidth + r->bandwidth_overhead; in fw_iso_resources_allocate()
129 fw_iso_resource_manage(card, r->generation, r->channels_mask, in fw_iso_resources_allocate()
132 mutex_unlock(&r->mutex); in fw_iso_resources_allocate()
136 r->channel = channel; in fw_iso_resources_allocate()
137 r->allocated = true; in fw_iso_resources_allocate()
140 dev_err(&r->unit->device, in fw_iso_resources_allocate()
143 dev_err(&r->unit->device, in fw_iso_resources_allocate()
147 mutex_unlock(&r->mutex); in fw_iso_resources_allocate()
155 * @r: the resource manager
164 int fw_iso_resources_update(struct fw_iso_resources *r) in fw_iso_resources_update() argument
166 struct fw_card *card = fw_parent_device(r->unit)->card; in fw_iso_resources_update()
169 mutex_lock(&r->mutex); in fw_iso_resources_update()
171 if (!r->allocated) { in fw_iso_resources_update()
172 mutex_unlock(&r->mutex); in fw_iso_resources_update()
177 r->generation = card->generation; in fw_iso_resources_update()
178 r->bandwidth_overhead = current_bandwidth_overhead(card); in fw_iso_resources_update()
181 bandwidth = r->bandwidth + r->bandwidth_overhead; in fw_iso_resources_update()
183 fw_iso_resource_manage(card, r->generation, 1uLL << r->channel, in fw_iso_resources_update()
190 r->allocated = false; in fw_iso_resources_update()
192 dev_err(&r->unit->device, in fw_iso_resources_update()
195 dev_err(&r->unit->device, in fw_iso_resources_update()
199 mutex_unlock(&r->mutex); in fw_iso_resources_update()
207 * @r: the resource manager
211 void fw_iso_resources_free(struct fw_iso_resources *r) in fw_iso_resources_free() argument
217 if (r->unit == NULL) in fw_iso_resources_free()
219 card = fw_parent_device(r->unit)->card; in fw_iso_resources_free()
221 mutex_lock(&r->mutex); in fw_iso_resources_free()
223 if (r->allocated) { in fw_iso_resources_free()
224 bandwidth = r->bandwidth + r->bandwidth_overhead; in fw_iso_resources_free()
225 fw_iso_resource_manage(card, r->generation, 1uLL << r->channel, in fw_iso_resources_free()
228 dev_err(&r->unit->device, in fw_iso_resources_free()
231 r->allocated = false; in fw_iso_resources_free()
234 mutex_unlock(&r->mutex); in fw_iso_resources_free()