diff options
Diffstat (limited to 'drivers/firewire/fw-cdev.c')
-rw-r--r-- | drivers/firewire/fw-cdev.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c index 214e534efee5..539dae5eb5b2 100644 --- a/drivers/firewire/fw-cdev.c +++ b/drivers/firewire/fw-cdev.c | |||
@@ -1242,6 +1242,38 @@ static int ioctl_send_broadcast_request(struct client *client, void *buffer) | |||
1242 | return init_request(client, request, LOCAL_BUS | 0x3f, SCODE_100); | 1242 | return init_request(client, request, LOCAL_BUS | 0x3f, SCODE_100); |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | struct stream_packet { | ||
1246 | struct fw_packet packet; | ||
1247 | u8 data[0]; | ||
1248 | }; | ||
1249 | |||
1250 | static void send_stream_packet_done(struct fw_packet *packet, | ||
1251 | struct fw_card *card, int status) | ||
1252 | { | ||
1253 | kfree(container_of(packet, struct stream_packet, packet)); | ||
1254 | } | ||
1255 | |||
1256 | static int ioctl_send_stream_packet(struct client *client, void *buffer) | ||
1257 | { | ||
1258 | struct fw_cdev_send_stream_packet *request = buffer; | ||
1259 | struct stream_packet *p; | ||
1260 | |||
1261 | p = kmalloc(sizeof(*p) + request->size, GFP_KERNEL); | ||
1262 | if (p == NULL) | ||
1263 | return -ENOMEM; | ||
1264 | |||
1265 | if (request->data && | ||
1266 | copy_from_user(p->data, u64_to_uptr(request->data), request->size)) { | ||
1267 | kfree(p); | ||
1268 | return -EFAULT; | ||
1269 | } | ||
1270 | fw_send_stream_packet(client->device->card, &p->packet, | ||
1271 | request->generation, request->speed, | ||
1272 | request->channel, request->sy, request->tag, | ||
1273 | p->data, request->size, send_stream_packet_done); | ||
1274 | return 0; | ||
1275 | } | ||
1276 | |||
1245 | static int (* const ioctl_handlers[])(struct client *client, void *buffer) = { | 1277 | static int (* const ioctl_handlers[])(struct client *client, void *buffer) = { |
1246 | ioctl_get_info, | 1278 | ioctl_get_info, |
1247 | ioctl_send_request, | 1279 | ioctl_send_request, |
@@ -1262,6 +1294,7 @@ static int (* const ioctl_handlers[])(struct client *client, void *buffer) = { | |||
1262 | ioctl_deallocate_iso_resource_once, | 1294 | ioctl_deallocate_iso_resource_once, |
1263 | ioctl_get_speed, | 1295 | ioctl_get_speed, |
1264 | ioctl_send_broadcast_request, | 1296 | ioctl_send_broadcast_request, |
1297 | ioctl_send_stream_packet, | ||
1265 | }; | 1298 | }; |
1266 | 1299 | ||
1267 | static int dispatch_ioctl(struct client *client, | 1300 | static int dispatch_ioctl(struct client *client, |