aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-05-03 07:57:47 +0900
committer坂本 貴史 <o-takashi@sakamocchi.jp>2022-05-03 08:31:29 +0900
commit478ea538c58c289e7a9d49da93329b6b3a9af0e0 (patch)
tree8c20ca1f493ca36a4851e176279410df917d3c55
parentc4788482d3ca6b2c597e09aac270fe19944dfddf (diff)
downloadlibhinoko-478ea538c58c289e7a9d49da93329b6b3a9af0e0.tar.gz
fw_iso_ctx: don't dispatch event recursively
Linux FireWire subsystem don't copy multiple event data in one call. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--src/fw_iso_ctx.c48
-rw-r--r--src/fw_iso_rx_multiple.c2
-rw-r--r--src/fw_iso_rx_single.c2
-rw-r--r--src/fw_iso_tx.c2
-rw-r--r--src/internal.h6
5 files changed, 24 insertions, 36 deletions
diff --git a/src/fw_iso_ctx.c b/src/fw_iso_ctx.c
index 6bb5906..a3940e2 100644
--- a/src/fw_iso_ctx.c
+++ b/src/fw_iso_ctx.c
@@ -672,7 +672,7 @@ static gboolean check_src(GSource *gsrc)
return !!(condition & (G_IO_IN | G_IO_ERR));
}
-static void handle_irq_event(struct fw_cdev_event_iso_interrupt *ev,
+static void handle_irq_event(const struct fw_cdev_event_iso_interrupt *ev,
GError **error)
{
if (HINOKO_IS_FW_ISO_RX_SINGLE((gpointer)ev->closure)) {
@@ -693,7 +693,7 @@ static void handle_irq_event(struct fw_cdev_event_iso_interrupt *ev,
fw_iso_ctx_queue_chunks(HINOKO_FW_ISO_CTX((gpointer)ev->closure), error);
}
-static void handle_irq_mc_event(struct fw_cdev_event_iso_interrupt_mc *ev,
+static void handle_irq_mc_event(const struct fw_cdev_event_iso_interrupt_mc *ev,
GError **error)
{
if (HINOKO_IS_FW_ISO_RX_MULTIPLE((gpointer)ev->closure)) {
@@ -719,7 +719,7 @@ static gboolean dispatch_src(GSource *gsrc, GSourceFunc cb, gpointer user_data)
GIOCondition condition;
GError *error;
int len;
- guint8 *buf;
+ const union fw_cdev_event *event;
if (priv->fd < 0)
return G_SOURCE_REMOVE;
@@ -739,33 +739,21 @@ static gboolean dispatch_src(GSource *gsrc, GSourceFunc cb, gpointer user_data)
return G_SOURCE_CONTINUE;
}
- buf = src->buf;
- while (len > 0) {
- union fw_cdev_event *ev = (union fw_cdev_event *)buf;
- size_t size = 0;
-
- switch (ev->common.type) {
- case FW_CDEV_EVENT_ISO_INTERRUPT:
- error = NULL;
- handle_irq_event(&ev->iso_interrupt, &error);
- if (error != NULL)
- goto error;
- size = sizeof(ev->iso_interrupt) +
- ev->iso_interrupt.header_length;
- break;
- case FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL:
- error = NULL;
- handle_irq_mc_event(&ev->iso_interrupt_mc, &error);
- if (error != NULL)
- goto error;
- size = sizeof(ev->iso_interrupt_mc);
- break;
- default:
- break;
- }
-
- len -= size;
- buf += size;
+ error = NULL;
+ event = (const union fw_cdev_event *)src->buf;
+ switch (event->common.type) {
+ case FW_CDEV_EVENT_ISO_INTERRUPT:
+ handle_irq_event(&event->iso_interrupt, &error);
+ if (error != NULL)
+ goto error;
+ break;
+ case FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL:
+ handle_irq_mc_event(&event->iso_interrupt_mc, &error);
+ if (error != NULL)
+ goto error;
+ break;
+ default:
+ break;
}
// Just be sure to continue to process this source.
diff --git a/src/fw_iso_rx_multiple.c b/src/fw_iso_rx_multiple.c
index c1dee0a..7bbce24 100644
--- a/src/fw_iso_rx_multiple.c
+++ b/src/fw_iso_rx_multiple.c
@@ -367,7 +367,7 @@ void hinoko_fw_iso_rx_multiple_stop(HinokoFwIsoRxMultiple *self)
}
void hinoko_fw_iso_rx_multiple_handle_event(HinokoFwIsoRxMultiple *self,
- struct fw_cdev_event_iso_interrupt_mc *event,
+ const struct fw_cdev_event_iso_interrupt_mc *event,
GError **error)
{
HinokoFwIsoRxMultiplePrivate *priv;
diff --git a/src/fw_iso_rx_single.c b/src/fw_iso_rx_single.c
index 142ac6a..be50a27 100644
--- a/src/fw_iso_rx_single.c
+++ b/src/fw_iso_rx_single.c
@@ -240,7 +240,7 @@ void hinoko_fw_iso_rx_single_stop(HinokoFwIsoRxSingle *self)
}
void hinoko_fw_iso_rx_single_handle_event(HinokoFwIsoRxSingle *self,
- struct fw_cdev_event_iso_interrupt *event,
+ const struct fw_cdev_event_iso_interrupt *event,
GError **error)
{
HinokoFwIsoRxSinglePrivate *priv;
diff --git a/src/fw_iso_tx.c b/src/fw_iso_tx.c
index 07aed43..718ab3f 100644
--- a/src/fw_iso_tx.c
+++ b/src/fw_iso_tx.c
@@ -275,7 +275,7 @@ void hinoko_fw_iso_tx_register_packet(HinokoFwIsoTx *self,
}
void hinoko_fw_iso_tx_handle_event(HinokoFwIsoTx *self,
- struct fw_cdev_event_iso_interrupt *event,
+ const struct fw_cdev_event_iso_interrupt *event,
GError **error)
{
guint sec = (event->cycle & 0x0000e000) >> 13;
diff --git a/src/internal.h b/src/internal.h
index a08595b..2c13067 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -28,15 +28,15 @@ void hinoko_fw_iso_ctx_read_frames(HinokoFwIsoCtx *self, guint offset,
guint *frame_size);
void hinoko_fw_iso_rx_single_handle_event(HinokoFwIsoRxSingle *self,
- struct fw_cdev_event_iso_interrupt *event,
+ const struct fw_cdev_event_iso_interrupt *event,
GError **error);
void hinoko_fw_iso_rx_multiple_handle_event(HinokoFwIsoRxMultiple *self,
- struct fw_cdev_event_iso_interrupt_mc *event,
+ const struct fw_cdev_event_iso_interrupt_mc *event,
GError **error);
void hinoko_fw_iso_tx_handle_event(HinokoFwIsoTx *self,
- struct fw_cdev_event_iso_interrupt *event,
+ const struct fw_cdev_event_iso_interrupt *event,
GError **error);
void hinoko_fw_iso_resource_ioctl(HinokoFwIsoResource *self,