From 21efb3cfc6ed49991638000f58bb23b838c76e25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 16 Feb 2007 17:34:50 -0500 Subject: [PATCH] firewire: Configure channel and speed at context creation time. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Stefan Richter --- drivers/firewire/fw-device-cdev.c | 11 +++++++++-- drivers/firewire/fw-device-cdev.h | 5 ++--- drivers/firewire/fw-iso.c | 11 +++++------ drivers/firewire/fw-ohci.c | 4 ++-- drivers/firewire/fw-transaction.h | 6 +++--- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index 6545fb8214d8..5c876188677f 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c @@ -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) diff --git a/drivers/firewire/fw-device-cdev.h b/drivers/firewire/fw-device-cdev.h index e32b39dc7e74..99e6aa629f4a 100644 --- a/drivers/firewire/fw-device-cdev.h +++ b/drivers/firewire/fw-device-cdev.h @@ -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; }; diff --git a/drivers/firewire/fw-iso.c b/drivers/firewire/fw-iso.c index deff6922a98f..dc5a7e3558ec 100644 --- a/drivers/firewire/fw-iso.c +++ b/drivers/firewire/fw-iso.c @@ -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); diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 12f109da4d8d..0088acd7718e 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c @@ -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, diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 1bbcbb341f2f..22e45ccd7b1d 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h @@ -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); -- 2.30.2