aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-12-02 12:39:34 +0100
committerDan Dennedy <dan@dennedy.org>2008-12-03 19:56:32 -0800
commit788442d4031ecf06f00415e865cdd776d3c579f2 (patch)
treeca02150a68e5b7bf57c8837ab4a214c8f95836f2
parent7b8d2703525b40c743456c4bb2e129ae515c55bb (diff)
downloadlibraw1394-788442d4031ecf06f00415e865cdd776d3c579f2.tar.gz
[libraw1394 patch] Fix raw1394_channel_modify() on firewire-core
(juju) Reported by Adrian Knoth: fw_channel_modify() was unable to allocate some channels which were actually free. http://marc.info/?l=linux1394-devel&t=122818128900002 This can be easily fixed by replacing fw_channel_modify() by ieee1394_channel_modify() because this is highlevel enough to work with Juju as well. We only may want a separate fw_channel_modify() in the future when firewire-core gains a special ioctl() for that. Also fix a documentation typo: raw1394_channel_modify() did not show up in extracted API documentation due to a cut'n'paste typo in raw1394.h. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Dan Dennedy <dan@dennedy.org>
-rw-r--r--src/dispatch.c5
-rw-r--r--src/fw.c49
-rw-r--r--src/fw.h3
-rw-r--r--src/raw1394.h2
4 files changed, 2 insertions, 57 deletions
diff --git a/src/dispatch.c b/src/dispatch.c
index d202424..b5b123e 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -554,10 +554,7 @@ int raw1394_channel_modify (raw1394handle_t handle, unsigned int channel,
errno = EINVAL;
return -1;
}
- if (handle->is_fw)
- return fw_channel_modify(handle, channel, mode);
- else
- return ieee1394_channel_modify(handle, channel, mode);
+ return ieee1394_channel_modify(handle, channel, mode);
}
int raw1394_iso_xmit_init(raw1394handle_t handle,
diff --git a/src/fw.c b/src/fw.c
index eacbaaa..f5a9d95 100644
--- a/src/fw.c
+++ b/src/fw.c
@@ -1342,52 +1342,3 @@ fw_bandwidth_modify (raw1394handle_t handle,
return 0;
}
-
-int
-fw_channel_modify (raw1394handle_t handle,
- unsigned int channel,
- enum raw1394_modify_mode mode)
-{
- quadlet_t buffer, compare, swap, bit;
- nodeaddr_t addr;
- int result;
-
- if (channel >= 64)
- return -1;
- addr = CSR_REGISTER_BASE +
- CSR_CHANNELS_AVAILABLE_HI + 4 * (channel / 32);
- /* Read currently available channels from IRM. */
- result = raw1394_read(handle, raw1394_get_irm_id (handle), addr,
- sizeof buffer, &buffer);
- if (result < 0)
- return -1;
-
- /* IEEE numbers bits from MSB (0) to LSB (31). */
- bit = 1 << (31 - (channel & 31));
- compare = ntohl(buffer);
- switch (mode) {
- case RAW1394_MODIFY_ALLOC:
- if ((compare & bit) == 0)
- return -1;
- swap = buffer & ~bit;
- break;
-
- case RAW1394_MODIFY_FREE:
- if ((buffer & bit) != 0)
- return -1;
- swap = buffer | bit;
- break;
-
- default:
- return -1;
- }
-
- result = raw1394_lock (handle, raw1394_get_irm_id (handle), addr,
- RAW1394_EXTCODE_COMPARE_SWAP,
- htonl(swap), htonl(compare), &buffer);
-
- if (result < 0 || ntohl(buffer) != compare)
- return -1;
-
- return 0;
-}
diff --git a/src/fw.h b/src/fw.h
index 4ee9017..0bb3fcd 100644
--- a/src/fw.h
+++ b/src/fw.h
@@ -214,9 +214,6 @@ int fw_get_config_rom(fw_handle_t handle, quadlet_t *buffer,
int fw_bandwidth_modify (raw1394handle_t handle,
unsigned int bandwidth,
enum raw1394_modify_mode mode);
-int fw_channel_modify (raw1394handle_t handle,
- unsigned int channel,
- enum raw1394_modify_mode mode);
int fw_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
int prebuffer_packets);
diff --git a/src/raw1394.h b/src/raw1394.h
index c489c20..7bfeb05 100644
--- a/src/raw1394.h
+++ b/src/raw1394.h
@@ -1203,7 +1203,7 @@ raw1394_bandwidth_modify (raw1394handle_t handle, unsigned int bandwidth,
enum raw1394_modify_mode mode);
/**
- * raw1394_bandwidth_modify - allocate or release isochronous channel
+ * raw1394_channel_modify - allocate or release isochronous channel
* @handle: a libraw1394 handle
* @channel: isochronous channel
* @mode: whether to allocate or free