diff options
Diffstat (limited to 'drivers/firewire/core-iso.c')
-rw-r--r-- | drivers/firewire/core-iso.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index 8f5aebfb29df..c003fa4e2db1 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c | |||
@@ -118,6 +118,23 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, | |||
118 | } | 118 | } |
119 | EXPORT_SYMBOL(fw_iso_buffer_destroy); | 119 | EXPORT_SYMBOL(fw_iso_buffer_destroy); |
120 | 120 | ||
121 | /* Convert DMA address to offset into virtually contiguous buffer. */ | ||
122 | size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed) | ||
123 | { | ||
124 | int i; | ||
125 | dma_addr_t address; | ||
126 | ssize_t offset; | ||
127 | |||
128 | for (i = 0; i < buffer->page_count; i++) { | ||
129 | address = page_private(buffer->pages[i]); | ||
130 | offset = (ssize_t)completed - (ssize_t)address; | ||
131 | if (offset > 0 && offset <= PAGE_SIZE) | ||
132 | return (i << PAGE_SHIFT) + offset; | ||
133 | } | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
121 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, | 138 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, |
122 | int type, int channel, int speed, size_t header_size, | 139 | int type, int channel, int speed, size_t header_size, |
123 | fw_iso_callback_t callback, void *callback_data) | 140 | fw_iso_callback_t callback, void *callback_data) |
@@ -134,7 +151,7 @@ struct fw_iso_context *fw_iso_context_create(struct fw_card *card, | |||
134 | ctx->channel = channel; | 151 | ctx->channel = channel; |
135 | ctx->speed = speed; | 152 | ctx->speed = speed; |
136 | ctx->header_size = header_size; | 153 | ctx->header_size = header_size; |
137 | ctx->callback = callback; | 154 | ctx->callback.sc = callback; |
138 | ctx->callback_data = callback_data; | 155 | ctx->callback_data = callback_data; |
139 | 156 | ||
140 | return ctx; | 157 | return ctx; |
@@ -143,9 +160,7 @@ EXPORT_SYMBOL(fw_iso_context_create); | |||
143 | 160 | ||
144 | void fw_iso_context_destroy(struct fw_iso_context *ctx) | 161 | void fw_iso_context_destroy(struct fw_iso_context *ctx) |
145 | { | 162 | { |
146 | struct fw_card *card = ctx->card; | 163 | ctx->card->driver->free_iso_context(ctx); |
147 | |||
148 | card->driver->free_iso_context(ctx); | ||
149 | } | 164 | } |
150 | EXPORT_SYMBOL(fw_iso_context_destroy); | 165 | EXPORT_SYMBOL(fw_iso_context_destroy); |
151 | 166 | ||
@@ -156,14 +171,17 @@ int fw_iso_context_start(struct fw_iso_context *ctx, | |||
156 | } | 171 | } |
157 | EXPORT_SYMBOL(fw_iso_context_start); | 172 | EXPORT_SYMBOL(fw_iso_context_start); |
158 | 173 | ||
174 | int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels) | ||
175 | { | ||
176 | return ctx->card->driver->set_iso_channels(ctx, channels); | ||
177 | } | ||
178 | |||
159 | int fw_iso_context_queue(struct fw_iso_context *ctx, | 179 | int fw_iso_context_queue(struct fw_iso_context *ctx, |
160 | struct fw_iso_packet *packet, | 180 | struct fw_iso_packet *packet, |
161 | struct fw_iso_buffer *buffer, | 181 | struct fw_iso_buffer *buffer, |
162 | unsigned long payload) | 182 | unsigned long payload) |
163 | { | 183 | { |
164 | struct fw_card *card = ctx->card; | 184 | return ctx->card->driver->queue_iso(ctx, packet, buffer, payload); |
165 | |||
166 | return card->driver->queue_iso(ctx, packet, buffer, payload); | ||
167 | } | 185 | } |
168 | EXPORT_SYMBOL(fw_iso_context_queue); | 186 | EXPORT_SYMBOL(fw_iso_context_queue); |
169 | 187 | ||
@@ -279,7 +297,7 @@ static void deallocate_channel(struct fw_card *card, int irm_id, | |||
279 | } | 297 | } |
280 | 298 | ||
281 | /** | 299 | /** |
282 | * fw_iso_resource_manage - Allocate or deallocate a channel and/or bandwidth | 300 | * fw_iso_resource_manage() - Allocate or deallocate a channel and/or bandwidth |
283 | * | 301 | * |
284 | * In parameters: card, generation, channels_mask, bandwidth, allocate | 302 | * In parameters: card, generation, channels_mask, bandwidth, allocate |
285 | * Out parameters: channel, bandwidth | 303 | * Out parameters: channel, bandwidth |