mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
firewire: core: add function variants for isochronous context creation
The fw_iso_callback union was added by a commit ebe4560ed5 ("firewire:
Remove function callback casts") to remove function pointer cast.
That change affected the cdev layer of the core code, but it is more
convenient for fw_iso_context_create() to accept the union directly.
This commit renames and changes the existing function to take the union
argument, and add static inline wrapper functions as variants.
Link: https://lore.kernel.org/r/20260117142823.440811-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
@@ -1026,25 +1026,10 @@ static enum dma_data_direction iso_dma_direction(struct fw_iso_context *context)
|
||||
return DMA_FROM_DEVICE;
|
||||
}
|
||||
|
||||
static struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *card,
|
||||
fw_iso_mc_callback_t callback,
|
||||
void *callback_data)
|
||||
{
|
||||
struct fw_iso_context *ctx;
|
||||
|
||||
ctx = fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL,
|
||||
0, 0, 0, NULL, callback_data);
|
||||
if (!IS_ERR(ctx))
|
||||
ctx->callback.mc = callback;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg)
|
||||
{
|
||||
struct fw_cdev_create_iso_context *a = &arg->create_iso_context;
|
||||
struct fw_iso_context *context;
|
||||
union fw_iso_callback cb;
|
||||
int ret;
|
||||
|
||||
BUILD_BUG_ON(FW_CDEV_ISO_CONTEXT_TRANSMIT != FW_ISO_CONTEXT_TRANSMIT ||
|
||||
@@ -1056,20 +1041,15 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg)
|
||||
case FW_ISO_CONTEXT_TRANSMIT:
|
||||
if (a->speed > SCODE_3200 || a->channel > 63)
|
||||
return -EINVAL;
|
||||
|
||||
cb.sc = iso_callback;
|
||||
break;
|
||||
|
||||
case FW_ISO_CONTEXT_RECEIVE:
|
||||
if (a->header_size < 4 || (a->header_size & 3) ||
|
||||
a->channel > 63)
|
||||
return -EINVAL;
|
||||
|
||||
cb.sc = iso_callback;
|
||||
break;
|
||||
|
||||
case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
|
||||
cb.mc = iso_mc_callback;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1077,12 +1057,10 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg)
|
||||
}
|
||||
|
||||
if (a->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
|
||||
context = fw_iso_mc_context_create(client->device->card, cb.mc,
|
||||
client);
|
||||
context = fw_iso_mc_context_create(client->device->card, iso_mc_callback, client);
|
||||
else
|
||||
context = fw_iso_context_create(client->device->card, a->type,
|
||||
a->channel, a->speed,
|
||||
a->header_size, cb.sc, client);
|
||||
context = fw_iso_context_create(client->device->card, a->type, a->channel, a->speed,
|
||||
a->header_size, iso_callback, client);
|
||||
if (IS_ERR(context))
|
||||
return PTR_ERR(context);
|
||||
if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW)
|
||||
|
||||
@@ -137,9 +137,8 @@ size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct fw_iso_context *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 *__fw_iso_context_create(struct fw_card *card, int type, int channel,
|
||||
int speed, size_t header_size, union fw_iso_callback callback, void *callback_data)
|
||||
{
|
||||
struct fw_iso_context *ctx;
|
||||
|
||||
@@ -153,7 +152,7 @@ struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
|
||||
ctx->channel = channel;
|
||||
ctx->speed = speed;
|
||||
ctx->header_size = header_size;
|
||||
ctx->callback.sc = callback;
|
||||
ctx->callback = callback;
|
||||
ctx->callback_data = callback_data;
|
||||
|
||||
trace_isoc_outbound_allocate(ctx, channel, speed);
|
||||
@@ -162,7 +161,7 @@ struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
|
||||
|
||||
return ctx;
|
||||
}
|
||||
EXPORT_SYMBOL(fw_iso_context_create);
|
||||
EXPORT_SYMBOL(__fw_iso_context_create);
|
||||
|
||||
void fw_iso_context_destroy(struct fw_iso_context *ctx)
|
||||
{
|
||||
|
||||
@@ -173,6 +173,15 @@ static inline void fw_iso_context_init_work(struct fw_iso_context *ctx, work_fun
|
||||
INIT_WORK(&ctx->work, func);
|
||||
}
|
||||
|
||||
static inline struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *card,
|
||||
fw_iso_mc_callback_t callback, void *callback_data)
|
||||
{
|
||||
union fw_iso_callback cb = { .mc = callback };
|
||||
|
||||
return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, 0, 0, 0, cb,
|
||||
callback_data);
|
||||
}
|
||||
|
||||
|
||||
/* -topology */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user