firewire: Configure channel and speed at context creation time.
authorKristian Høgsberg <krh@redhat.com>
Fri, 16 Feb 2007 22:34:50 +0000 (17:34 -0500)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Fri, 9 Mar 2007 21:03:03 +0000 (22:03 +0100)
We need the channel number as we queue up iso packets for transmission
so we can fill out the header correctly.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/fw-device-cdev.c
drivers/firewire/fw-device-cdev.h
drivers/firewire/fw-iso.c
drivers/firewire/fw-ohci.c
drivers/firewire/fw-transaction.h

index 6545fb8..5c87618 100644 (file)
@@ -413,8 +413,16 @@ static int ioctl_create_iso_context(struct client *client, void __user *arg)
        if (request.type > FW_ISO_CONTEXT_RECEIVE)
                return -EINVAL;
 
+       if (request.channel > 63)
+               return -EINVAL;
+
+       if (request.speed > SCODE_3200)
+               return -EINVAL;
+
        client->iso_context = fw_iso_context_create(client->device->card,
                                                    request.type,
+                                                   request.channel,
+                                                   request.speed,
                                                    request.header_size,
                                                    iso_callback, client);
        if (IS_ERR(client->iso_context))
@@ -519,8 +527,7 @@ static int ioctl_start_iso(struct client *client, void __user *arg)
        if (copy_from_user(&request, arg, sizeof request))
                return -EFAULT;
 
-       return fw_iso_context_start(client->iso_context, request.channel,
-                                   request.speed, request.cycle);
+       return fw_iso_context_start(client->iso_context, request.cycle);
 }
 
 static int ioctl_stop_iso(struct client *client, void __user *arg)
index e32b39d..99e6aa6 100644 (file)
@@ -134,7 +134,8 @@ struct fw_cdev_allocate {
 struct fw_cdev_create_iso_context {
        __u32 type;
        __u32 header_size;
-       __u32 handle;
+       __u32 channel;
+       __u32 speed;
 };
 
 struct fw_cdev_iso_packet {
@@ -154,8 +155,6 @@ struct fw_cdev_queue_iso {
 };
 
 struct fw_cdev_start_iso {
-       __u32 channel;
-       __u32 speed;
        __s32 cycle;
 };
 
index deff692..dc5a7e3 100644 (file)
@@ -106,7 +106,8 @@ void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer,
 }
 
 struct fw_iso_context *
-fw_iso_context_create(struct fw_card *card, int type, size_t header_size,
+fw_iso_context_create(struct fw_card *card, int type,
+                     int channel, int speed, size_t header_size,
                      fw_iso_callback_t callback, void *callback_data)
 {
        struct fw_iso_context *ctx;
@@ -117,6 +118,8 @@ fw_iso_context_create(struct fw_card *card, int type, size_t header_size,
 
        ctx->card = card;
        ctx->type = type;
+       ctx->channel = channel;
+       ctx->speed = speed;
        ctx->header_size = header_size;
        ctx->callback = callback;
        ctx->callback_data = callback_data;
@@ -134,12 +137,8 @@ void fw_iso_context_destroy(struct fw_iso_context *ctx)
 EXPORT_SYMBOL(fw_iso_context_destroy);
 
 int
-fw_iso_context_start(struct fw_iso_context *ctx,
-                    int channel, int speed, int cycle)
+fw_iso_context_start(struct fw_iso_context *ctx, int cycle)
 {
-       ctx->channel = channel;
-       ctx->speed = speed;
-
        return ctx->card->driver->start_iso(ctx, cycle);
 }
 EXPORT_SYMBOL(fw_iso_context_start);
index 12f109d..0088acd 100644 (file)
@@ -1413,7 +1413,7 @@ static int ohci_start_iso(struct fw_iso_context *base, s32 cycle)
                if (cycle > 0)
                        cycle_match = IT_CONTEXT_CYCLE_MATCH_ENABLE |
                                (cycle & 0x7fff) << 16;
-               
+
                reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 1 << index);
                reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1 << index);
                context_run(&ctx->context, cycle_match);
@@ -1638,7 +1638,7 @@ ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
 
        return 0;
 }
+
 static int
 ohci_queue_iso_receive_bufferfill(struct fw_iso_context *base,
                                  struct fw_iso_packet *packet,
index 1bbcbb3..22e45cc 100644 (file)
@@ -373,7 +373,8 @@ void
 fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
 
 struct fw_iso_context *
-fw_iso_context_create(struct fw_card *card, int type, size_t header_size,
+fw_iso_context_create(struct fw_card *card, int type,
+                     int channel, int speed, size_t header_size,
                      fw_iso_callback_t callback, void *callback_data);
 
 void
@@ -386,8 +387,7 @@ fw_iso_context_queue(struct fw_iso_context *ctx,
                     unsigned long payload);
 
 int
-fw_iso_context_start(struct fw_iso_context *ctx,
-                   int channel, int speed, int cycle);
+fw_iso_context_start(struct fw_iso_context *ctx, int cycle);
 
 int
 fw_iso_context_stop(struct fw_iso_context *ctx);