diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-04-30 15:03:14 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-04-30 17:08:13 -0400 |
commit | abaa5743e340c23922d92c9a5a6753ea3ae71e58 (patch) | |
tree | c90f0b63edbf99ea6f7bc63d6a15e2c8afe6ae9f /drivers | |
parent | 4f2592232ea951e52b2faf1abf519e13856ac6f4 (diff) |
firewire: Future proof the iso ioctls by adding a handle for the iso context.
Currently create context always returns 0 and the other iso
ioctls will expect user space to pass that in for subsequent ioctls.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firewire/fw-device-cdev.c | 16 | ||||
-rw-r--r-- | drivers/firewire/fw-device-cdev.h | 12 |
2 files changed, 24 insertions, 4 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index d2b867f44348..2910db69ec2c 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c | |||
@@ -80,6 +80,7 @@ struct client { | |||
80 | u64 bus_reset_closure; | 80 | u64 bus_reset_closure; |
81 | 81 | ||
82 | struct fw_iso_context *iso_context; | 82 | struct fw_iso_context *iso_context; |
83 | u64 iso_closure; | ||
83 | struct fw_iso_buffer buffer; | 84 | struct fw_iso_buffer buffer; |
84 | unsigned long vm_start; | 85 | unsigned long vm_start; |
85 | 86 | ||
@@ -626,7 +627,7 @@ iso_callback(struct fw_iso_context *context, u32 cycle, | |||
626 | return; | 627 | return; |
627 | 628 | ||
628 | interrupt->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT; | 629 | interrupt->interrupt.type = FW_CDEV_EVENT_ISO_INTERRUPT; |
629 | interrupt->interrupt.closure = 0; | 630 | interrupt->interrupt.closure = client->iso_closure; |
630 | interrupt->interrupt.cycle = cycle; | 631 | interrupt->interrupt.cycle = cycle; |
631 | interrupt->interrupt.header_length = header_length; | 632 | interrupt->interrupt.header_length = header_length; |
632 | memcpy(interrupt->interrupt.header, header, header_length); | 633 | memcpy(interrupt->interrupt.header, header, header_length); |
@@ -659,6 +660,7 @@ static int ioctl_create_iso_context(struct client *client, void *buffer) | |||
659 | return -EINVAL; | 660 | return -EINVAL; |
660 | } | 661 | } |
661 | 662 | ||
663 | client->iso_closure = request->closure; | ||
662 | client->iso_context = fw_iso_context_create(client->device->card, | 664 | client->iso_context = fw_iso_context_create(client->device->card, |
663 | request->type, | 665 | request->type, |
664 | request->channel, | 666 | request->channel, |
@@ -668,6 +670,9 @@ static int ioctl_create_iso_context(struct client *client, void *buffer) | |||
668 | if (IS_ERR(client->iso_context)) | 670 | if (IS_ERR(client->iso_context)) |
669 | return PTR_ERR(client->iso_context); | 671 | return PTR_ERR(client->iso_context); |
670 | 672 | ||
673 | /* We only support one context at this time. */ | ||
674 | request->handle = 0; | ||
675 | |||
671 | return 0; | 676 | return 0; |
672 | } | 677 | } |
673 | 678 | ||
@@ -683,7 +688,7 @@ static int ioctl_queue_iso(struct client *client, void *buffer) | |||
683 | u8 header[256]; | 688 | u8 header[256]; |
684 | } u; | 689 | } u; |
685 | 690 | ||
686 | if (ctx == NULL) | 691 | if (ctx == NULL || request->handle != 0) |
687 | return -EINVAL; | 692 | return -EINVAL; |
688 | 693 | ||
689 | /* If the user passes a non-NULL data pointer, has mmap()'ed | 694 | /* If the user passes a non-NULL data pointer, has mmap()'ed |
@@ -759,6 +764,8 @@ static int ioctl_start_iso(struct client *client, void *buffer) | |||
759 | { | 764 | { |
760 | struct fw_cdev_start_iso *request = buffer; | 765 | struct fw_cdev_start_iso *request = buffer; |
761 | 766 | ||
767 | if (request->handle != 0) | ||
768 | return -EINVAL; | ||
762 | if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) { | 769 | if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) { |
763 | if (request->tags == 0 || request->tags > 15) | 770 | if (request->tags == 0 || request->tags > 15) |
764 | return -EINVAL; | 771 | return -EINVAL; |
@@ -773,6 +780,11 @@ static int ioctl_start_iso(struct client *client, void *buffer) | |||
773 | 780 | ||
774 | static int ioctl_stop_iso(struct client *client, void *buffer) | 781 | static int ioctl_stop_iso(struct client *client, void *buffer) |
775 | { | 782 | { |
783 | struct fw_cdev_stop_iso *request = buffer; | ||
784 | |||
785 | if (request->handle != 0) | ||
786 | return -EINVAL; | ||
787 | |||
776 | return fw_iso_context_stop(client->iso_context); | 788 | return fw_iso_context_stop(client->iso_context); |
777 | } | 789 | } |
778 | 790 | ||
diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h index f2355e034eb4..026c768e3bf1 100644 --- a/drivers/firewire/fw-device-cdev.h +++ b/drivers/firewire/fw-device-cdev.h | |||
@@ -133,10 +133,10 @@ union fw_cdev_event { | |||
133 | #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) | 133 | #define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor) |
134 | #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) | 134 | #define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor) |
135 | 135 | ||
136 | #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOW('#', 0x08, struct fw_cdev_create_iso_context) | 136 | #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context) |
137 | #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) | 137 | #define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso) |
138 | #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) | 138 | #define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso) |
139 | #define FW_CDEV_IOC_STOP_ISO _IO('#', 0x0b) | 139 | #define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso) |
140 | 140 | ||
141 | /* FW_CDEV_VERSION History | 141 | /* FW_CDEV_VERSION History |
142 | * | 142 | * |
@@ -233,6 +233,8 @@ struct fw_cdev_create_iso_context { | |||
233 | __u32 header_size; | 233 | __u32 header_size; |
234 | __u32 channel; | 234 | __u32 channel; |
235 | __u32 speed; | 235 | __u32 speed; |
236 | __u64 closure; | ||
237 | __u32 handle; | ||
236 | }; | 238 | }; |
237 | 239 | ||
238 | struct fw_cdev_iso_packet { | 240 | struct fw_cdev_iso_packet { |
@@ -249,12 +251,18 @@ struct fw_cdev_queue_iso { | |||
249 | __u64 packets; | 251 | __u64 packets; |
250 | __u64 data; | 252 | __u64 data; |
251 | __u32 size; | 253 | __u32 size; |
254 | __u32 handle; | ||
252 | }; | 255 | }; |
253 | 256 | ||
254 | struct fw_cdev_start_iso { | 257 | struct fw_cdev_start_iso { |
255 | __s32 cycle; | 258 | __s32 cycle; |
256 | __u32 sync; | 259 | __u32 sync; |
257 | __u32 tags; | 260 | __u32 tags; |
261 | __u32 handle; | ||
262 | }; | ||
263 | |||
264 | struct fw_cdev_stop_iso { | ||
265 | __u32 handle; | ||
258 | }; | 266 | }; |
259 | 267 | ||
260 | #endif /* __fw_cdev_h */ | 268 | #endif /* __fw_cdev_h */ |