Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firewire: core: add function variants for isochronous context creation

The fw_iso_callback union was added by a commit ebe4560ed5c ("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>

+27 -33
+3 -25
drivers/firewire/core-cdev.c
··· 1026 1026 return DMA_FROM_DEVICE; 1027 1027 } 1028 1028 1029 - static struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *card, 1030 - fw_iso_mc_callback_t callback, 1031 - void *callback_data) 1032 - { 1033 - struct fw_iso_context *ctx; 1034 - 1035 - ctx = fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, 1036 - 0, 0, 0, NULL, callback_data); 1037 - if (!IS_ERR(ctx)) 1038 - ctx->callback.mc = callback; 1039 - 1040 - return ctx; 1041 - } 1042 - 1043 1029 static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg) 1044 1030 { 1045 1031 struct fw_cdev_create_iso_context *a = &arg->create_iso_context; 1046 1032 struct fw_iso_context *context; 1047 - union fw_iso_callback cb; 1048 1033 int ret; 1049 1034 1050 1035 BUILD_BUG_ON(FW_CDEV_ISO_CONTEXT_TRANSMIT != FW_ISO_CONTEXT_TRANSMIT || ··· 1041 1056 case FW_ISO_CONTEXT_TRANSMIT: 1042 1057 if (a->speed > SCODE_3200 || a->channel > 63) 1043 1058 return -EINVAL; 1044 - 1045 - cb.sc = iso_callback; 1046 1059 break; 1047 1060 1048 1061 case FW_ISO_CONTEXT_RECEIVE: 1049 1062 if (a->header_size < 4 || (a->header_size & 3) || 1050 1063 a->channel > 63) 1051 1064 return -EINVAL; 1052 - 1053 - cb.sc = iso_callback; 1054 1065 break; 1055 1066 1056 1067 case FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL: 1057 - cb.mc = iso_mc_callback; 1058 1068 break; 1059 1069 1060 1070 default: ··· 1057 1077 } 1058 1078 1059 1079 if (a->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL) 1060 - context = fw_iso_mc_context_create(client->device->card, cb.mc, 1061 - client); 1080 + context = fw_iso_mc_context_create(client->device->card, iso_mc_callback, client); 1062 1081 else 1063 - context = fw_iso_context_create(client->device->card, a->type, 1064 - a->channel, a->speed, 1065 - a->header_size, cb.sc, client); 1082 + context = fw_iso_context_create(client->device->card, a->type, a->channel, a->speed, 1083 + a->header_size, iso_callback, client); 1066 1084 if (IS_ERR(context)) 1067 1085 return PTR_ERR(context); 1068 1086 if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW)
+4 -5
drivers/firewire/core-iso.c
··· 137 137 return 0; 138 138 } 139 139 140 - struct fw_iso_context *fw_iso_context_create(struct fw_card *card, 141 - int type, int channel, int speed, size_t header_size, 142 - fw_iso_callback_t callback, void *callback_data) 140 + struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int type, int channel, 141 + int speed, size_t header_size, union fw_iso_callback callback, void *callback_data) 143 142 { 144 143 struct fw_iso_context *ctx; 145 144 ··· 152 153 ctx->channel = channel; 153 154 ctx->speed = speed; 154 155 ctx->header_size = header_size; 155 - ctx->callback.sc = callback; 156 + ctx->callback = callback; 156 157 ctx->callback_data = callback_data; 157 158 158 159 trace_isoc_outbound_allocate(ctx, channel, speed); ··· 161 162 162 163 return ctx; 163 164 } 164 - EXPORT_SYMBOL(fw_iso_context_create); 165 + EXPORT_SYMBOL(__fw_iso_context_create); 165 166 166 167 void fw_iso_context_destroy(struct fw_iso_context *ctx) 167 168 {
+9
drivers/firewire/core.h
··· 173 173 INIT_WORK(&ctx->work, func); 174 174 } 175 175 176 + static inline struct fw_iso_context *fw_iso_mc_context_create(struct fw_card *card, 177 + fw_iso_mc_callback_t callback, void *callback_data) 178 + { 179 + union fw_iso_callback cb = { .mc = callback }; 180 + 181 + return __fw_iso_context_create(card, FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL, 0, 0, 0, cb, 182 + callback_data); 183 + } 184 + 176 185 177 186 /* -topology */ 178 187
+11 -3
include/linux/firewire.h
··· 558 558 void *callback_data; 559 559 }; 560 560 561 - struct fw_iso_context *fw_iso_context_create(struct fw_card *card, 562 - int type, int channel, int speed, size_t header_size, 563 - fw_iso_callback_t callback, void *callback_data); 561 + struct fw_iso_context *__fw_iso_context_create(struct fw_card *card, int type, int channel, 562 + int speed, size_t header_size, union fw_iso_callback callback, void *callback_data); 564 563 int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels); 565 564 int fw_iso_context_queue(struct fw_iso_context *ctx, 566 565 struct fw_iso_packet *packet, ··· 567 568 unsigned long payload); 568 569 void fw_iso_context_queue_flush(struct fw_iso_context *ctx); 569 570 int fw_iso_context_flush_completions(struct fw_iso_context *ctx); 571 + 572 + static inline struct fw_iso_context *fw_iso_context_create(struct fw_card *card, int type, 573 + int channel, int speed, size_t header_size, fw_iso_callback_t callback, 574 + void *callback_data) 575 + { 576 + union fw_iso_callback cb = { .sc = callback }; 577 + 578 + return __fw_iso_context_create(card, type, channel, speed, header_size, cb, callback_data); 579 + } 570 580 571 581 /** 572 582 * fw_iso_context_schedule_flush_completions() - schedule work item to process isochronous context.