Commit 390a1512 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: firewire-lib: code cleanup for outgoing packet handling

In previous commit, this module has no need to reuse parameters of
incoming packets for outgoing packets anymore. This commit arranges some
needless codes for outgoing packet processing.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d9a16fc9
...@@ -411,15 +411,18 @@ static inline int queue_in_packet(struct amdtp_stream *s) ...@@ -411,15 +411,18 @@ static inline int queue_in_packet(struct amdtp_stream *s)
amdtp_stream_get_max_payload(s), false); amdtp_stream_get_max_payload(s), false);
} }
static int handle_out_packet(struct amdtp_stream *s, unsigned int data_blocks, static int handle_out_packet(struct amdtp_stream *s, unsigned int cycle)
unsigned int cycle, unsigned int syt)
{ {
__be32 *buffer; __be32 *buffer;
unsigned int syt;
unsigned int data_blocks;
unsigned int payload_length; unsigned int payload_length;
unsigned int pcm_frames; unsigned int pcm_frames;
struct snd_pcm_substream *pcm; struct snd_pcm_substream *pcm;
buffer = s->buffer.packets[s->packet_index].buffer; buffer = s->buffer.packets[s->packet_index].buffer;
syt = calculate_syt(s, cycle);
data_blocks = calculate_data_blocks(s, syt);
pcm_frames = s->process_data_blocks(s, buffer + 2, data_blocks, &syt); pcm_frames = s->process_data_blocks(s, buffer + 2, data_blocks, &syt);
buffer[0] = cpu_to_be32(ACCESS_ONCE(s->source_node_id_field) | buffer[0] = cpu_to_be32(ACCESS_ONCE(s->source_node_id_field) |
...@@ -588,8 +591,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, ...@@ -588,8 +591,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp,
void *private_data) void *private_data)
{ {
struct amdtp_stream *s = private_data; struct amdtp_stream *s = private_data;
unsigned int i, syt, packets = header_length / 4; unsigned int i, packets = header_length / 4;
unsigned int data_blocks;
u32 cycle; u32 cycle;
if (s->packet_index < 0) if (s->packet_index < 0)
...@@ -602,10 +604,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, ...@@ -602,10 +604,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp,
for (i = 0; i < packets; ++i) { for (i = 0; i < packets; ++i) {
cycle = increment_cycle_count(cycle, 1); cycle = increment_cycle_count(cycle, 1);
syt = calculate_syt(s, cycle); if (handle_out_packet(s, cycle) < 0) {
data_blocks = calculate_data_blocks(s, syt);
if (handle_out_packet(s, data_blocks, cycle, syt) < 0) {
s->packet_index = -1; s->packet_index = -1;
amdtp_stream_pcm_abort(s); amdtp_stream_pcm_abort(s);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment