ALSA: firewire-lib: obsolete macro for header of IT context
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 21 May 2019 14:57:36 +0000 (23:57 +0900)
committerTakashi Iwai <tiwai@suse.de>
Wed, 22 May 2019 10:28:26 +0000 (12:28 +0200)
The header size parameter of 1394 OHCI IT context has no effect.
Besides the header size of queued packet is different from context
header.

This commit cleans codes relevant to these two headers.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp-stream.c

index ce39cb92a11e2500d822c65d989cfe8c122ebb08..5ebdac2086c07c38937e863f7a8fa5905a7e94e5 100644 (file)
@@ -57,7 +57,6 @@
 #define QUEUE_LENGTH           48
 
 #define IR_HEADER_SIZE         8       // For header and timestamp.
-#define OUT_PACKET_HEADER_SIZE 0
 #define HEADER_TSTAMP_MASK     0x0000ffff
 
 static void pcm_period_tasklet(unsigned long data);
@@ -428,8 +427,7 @@ static void pcm_period_tasklet(unsigned long data)
                snd_pcm_period_elapsed(pcm);
 }
 
-static int queue_packet(struct amdtp_stream *s, unsigned int header_length,
-                       unsigned int payload_length)
+static int queue_packet(struct amdtp_stream *s, unsigned int payload_length)
 {
        struct fw_iso_packet p = {0};
        int err = 0;
@@ -439,7 +437,15 @@ static int queue_packet(struct amdtp_stream *s, unsigned int header_length,
 
        p.interrupt = IS_ALIGNED(s->packet_index + 1, INTERRUPT_INTERVAL);
        p.tag = s->tag;
-       p.header_length = header_length;
+
+       if (s->direction == AMDTP_IN_STREAM) {
+               // Queue one packet for IR context.
+               p.header_length = s->ctx_data.tx.ctx_header_size;
+       } else {
+               // No header for this packet.
+               p.header_length = 0;
+       }
+
        if (payload_length > 0)
                p.payload_length = payload_length;
        else
@@ -460,13 +466,12 @@ end:
 static inline int queue_out_packet(struct amdtp_stream *s,
                                   unsigned int payload_length)
 {
-       return queue_packet(s, OUT_PACKET_HEADER_SIZE, payload_length);
+       return queue_packet(s, payload_length);
 }
 
 static inline int queue_in_packet(struct amdtp_stream *s)
 {
-       return queue_packet(s, s->ctx_data.tx.ctx_header_size,
-                           s->ctx_data.tx.max_payload_length);
+       return queue_packet(s, s->ctx_data.tx.max_payload_length);
 }
 
 static int handle_out_packet(struct amdtp_stream *s,
@@ -888,7 +893,7 @@ int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
        } else {
                dir = DMA_TO_DEVICE;
                type = FW_ISO_CONTEXT_TRANSMIT;
-               ctx_header_size = OUT_PACKET_HEADER_SIZE;
+               ctx_header_size = 0;    // No effect for IT context.
        }
        err = iso_packets_buffer_init(&s->buffer, s->unit, QUEUE_LENGTH,
                                      amdtp_stream_get_max_payload(s), dir);