Rename a few kernel ABI testing helpers

Use more uniform names along the lines of abi_has_some_feature(...).

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
Stefan Richter 2010-06-20 19:02:53 +02:00
parent a29d69af5d
commit 3fc1f00be3
2 changed files with 14 additions and 9 deletions

View File

@ -156,9 +156,14 @@ int fw_iso_xmit_start(raw1394handle_t handle, int start_on_cycle,
return 0; return 0;
} }
static inline int abi_has_iso_rx_timestamps(fw_handle_t handle)
{
return handle->abi_version >= 2;
}
static inline int recv_header_length(fw_handle_t handle) static inline int recv_header_length(fw_handle_t handle)
{ {
return handle->abi_version >= 2 ? 8 : 4; return abi_has_iso_rx_timestamps(handle) ? 8 : 4;
} }
static int static int
@ -179,11 +184,9 @@ flush_recv_packets(raw1394handle_t handle,
quadlet_t header, *p, *end; quadlet_t header, *p, *end;
unsigned int len, cycle, dropped; unsigned int len, cycle, dropped;
unsigned char channel, tag, sy; unsigned char channel, tag, sy;
int header_has_timestamp;
p = interrupt->header; p = interrupt->header;
end = (void *) interrupt->header + interrupt->header_length; end = (void *) interrupt->header + interrupt->header_length;
header_has_timestamp = fwhandle->abi_version >= 2;
/* /*
* This is bogus, but it's the best we can do without accurate * This is bogus, but it's the best we can do without accurate
* timestamps. Assume that the first packet was received * timestamps. Assume that the first packet was received
@ -192,7 +195,7 @@ flush_recv_packets(raw1394handle_t handle,
* later. This also assumes that the interrupt event happened * later. This also assumes that the interrupt event happened
* immediately after the last packet was received. * immediately after the last packet was received.
*/ */
if (!header_has_timestamp) { if (!abi_has_iso_rx_timestamps(fwhandle)) {
cycle = interrupt->cycle; cycle = interrupt->cycle;
cycle &= 0x1fff; cycle &= 0x1fff;
cycle += 8000; cycle += 8000;
@ -209,7 +212,7 @@ flush_recv_packets(raw1394handle_t handle,
channel = (header >> 8) & 0x3f; channel = (header >> 8) & 0x3f;
sy = header & 0x0f; sy = header & 0x0f;
if (header_has_timestamp) if (abi_has_iso_rx_timestamps(fwhandle))
cycle = be32_to_cpu(*p++) & 0x1fff; cycle = be32_to_cpu(*p++) & 0x1fff;
else { else {
cycle++; cycle++;
@ -293,6 +296,8 @@ static int handle_iso_event(raw1394handle_t handle,
int cycle; int cycle;
fwhandle->iso.packet_count -= fwhandle->iso.irq_interval; fwhandle->iso.packet_count -= fwhandle->iso.irq_interval;
/* Check whether the ABI version provides iso tx timestamps. */
if (interrupt->header_length) { if (interrupt->header_length) {
/* /*
* Take the cycle of the last packet transmitted, add * Take the cycle of the last packet transmitted, add

View File

@ -1445,7 +1445,7 @@ iso_resource_modify(raw1394handle_t handle, unsigned int bandwidth,
return 0; return 0;
} }
static inline int abi_v2_available(raw1394handle_t handle) static inline int abi_has_iso_resource_management(raw1394handle_t handle)
{ {
return handle->mode.fw->abi_version >= 2; return handle->mode.fw->abi_version >= 2;
} }
@ -1459,7 +1459,7 @@ iso_resource_modify(raw1394handle_t handle, unsigned int bandwidth,
return -1; return -1;
} }
static inline int abi_v2_available(raw1394handle_t handle) static inline int abi_has_iso_resource_management(raw1394handle_t handle)
{ {
return 0; return 0;
} }
@ -1470,7 +1470,7 @@ int
fw_bandwidth_modify(raw1394handle_t handle, unsigned int bandwidth, fw_bandwidth_modify(raw1394handle_t handle, unsigned int bandwidth,
enum raw1394_modify_mode mode) enum raw1394_modify_mode mode)
{ {
if (abi_v2_available(handle)) if (abi_has_iso_resource_management(handle))
return iso_resource_modify(handle, bandwidth, -1, mode); return iso_resource_modify(handle, bandwidth, -1, mode);
else else
return ieee1394_bandwidth_modify(handle, bandwidth, mode); return ieee1394_bandwidth_modify(handle, bandwidth, mode);
@ -1480,7 +1480,7 @@ int
fw_channel_modify(raw1394handle_t handle, unsigned int channel, fw_channel_modify(raw1394handle_t handle, unsigned int channel,
enum raw1394_modify_mode mode) enum raw1394_modify_mode mode)
{ {
if (abi_v2_available(handle)) if (abi_has_iso_resource_management(handle))
return iso_resource_modify(handle, 0, channel, mode); return iso_resource_modify(handle, 0, channel, mode);
else else
return ieee1394_channel_modify(handle, channel, mode); return ieee1394_channel_modify(handle, channel, mode);