]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firewire: ohci: use static inline functions to serialize data of AT DMA
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 2 Aug 2024 00:36:04 +0000 (09:36 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 2 Aug 2024 00:36:04 +0000 (09:36 +0900)
This commit replaces current implementation with the helper functions added
in the former commit.

Link: https://lore.kernel.org/r/20240802003606.109402-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/ohci.c

index a0bb0e87e18a2067f27848595c1fce0880cf42e6..e8429dbbc60df2e21b5430fa52a78df8063f5c25 100644 (file)
@@ -1409,12 +1409,6 @@ static int at_context_queue_packet(struct context *ctx,
        d[0].control   = cpu_to_le16(DESCRIPTOR_KEY_IMMEDIATE);
        d[0].res_count = cpu_to_le16(packet->timestamp);
 
-       /*
-        * The DMA format for asynchronous link packets is different
-        * from the IEEE1394 layout, so shift the fields around
-        * accordingly.
-        */
-
        tcode = async_header_get_tcode(packet->header);
        header = (__le32 *) &d[1];
        switch (tcode) {
@@ -1427,11 +1421,21 @@ static int at_context_queue_packet(struct context *ctx,
        case TCODE_READ_BLOCK_RESPONSE:
        case TCODE_LOCK_REQUEST:
        case TCODE_LOCK_RESPONSE:
-               header[0] = cpu_to_le32((packet->header[0] & 0xffff) |
-                                       (packet->speed << 16));
-               header[1] = cpu_to_le32((packet->header[1] & 0xffff) |
-                                       (packet->header[0] & 0xffff0000));
-               header[2] = cpu_to_le32(packet->header[2]);
+               ohci1394_at_data_set_src_bus_id(header, false);
+               ohci1394_at_data_set_speed(header, packet->speed);
+               ohci1394_at_data_set_tlabel(header, async_header_get_tlabel(packet->header));
+               ohci1394_at_data_set_retry(header, async_header_get_retry(packet->header));
+               ohci1394_at_data_set_tcode(header, tcode);
+
+               ohci1394_at_data_set_destination_id(header,
+                                                   async_header_get_destination(packet->header));
+
+               if (ctx == &ctx->ohci->at_response_ctx) {
+                       ohci1394_at_data_set_rcode(header, async_header_get_rcode(packet->header));
+               } else {
+                       ohci1394_at_data_set_destination_offset(header,
+                                                       async_header_get_offset(packet->header));
+               }
 
                if (tcode_is_block_packet(tcode))
                        header[3] = cpu_to_le32(packet->header[3]);
@@ -1440,10 +1444,10 @@ static int at_context_queue_packet(struct context *ctx,
 
                d[0].req_count = cpu_to_le16(packet->header_length);
                break;
-
        case TCODE_LINK_INTERNAL:
-               header[0] = cpu_to_le32((TCODE_LINK_INTERNAL << 4) |
-                                       (packet->speed << 16));
+               ohci1394_at_data_set_speed(header, packet->speed);
+               ohci1394_at_data_set_tcode(header, TCODE_LINK_INTERNAL);
+
                header[1] = cpu_to_le32(packet->header[1]);
                header[2] = cpu_to_le32(packet->header[2]);
                d[0].req_count = cpu_to_le16(12);