Skip to content

Commit 1162825

Browse files
committed
firewire: ohci: replace local macros with common inline functions for asynchronous packet header
This commit uses the common inline functions to serialize and deserialize header of asynchronous packet. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent e8cd3e4 commit 1162825

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

drivers/firewire/ohci.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
#include "core.h"
4242
#include "ohci.h"
43+
#include "packet-header-definitions.h"
4344

4445
#define ohci_info(ohci, f, args...) dev_info(ohci->card.device, f, ##args)
4546
#define ohci_notice(ohci, f, args...) dev_notice(ohci->card.device, f, ##args)
@@ -1550,12 +1551,6 @@ static int handle_at_packet(struct context *context,
15501551
return 1;
15511552
}
15521553

1553-
#define HEADER_GET_DESTINATION(q) (((q) >> 16) & 0xffff)
1554-
#define HEADER_GET_TCODE(q) (((q) >> 4) & 0x0f)
1555-
#define HEADER_GET_OFFSET_HIGH(q) (((q) >> 0) & 0xffff)
1556-
#define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff)
1557-
#define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff)
1558-
15591554
static u32 get_cycle_time(struct fw_ohci *ohci);
15601555

15611556
static void handle_local_rom(struct fw_ohci *ohci,
@@ -1564,9 +1559,9 @@ static void handle_local_rom(struct fw_ohci *ohci,
15641559
struct fw_packet response;
15651560
int tcode, length, i;
15661561

1567-
tcode = HEADER_GET_TCODE(packet->header[0]);
1562+
tcode = async_header_get_tcode(packet->header);
15681563
if (TCODE_IS_BLOCK_PACKET(tcode))
1569-
length = HEADER_GET_DATA_LENGTH(packet->header[3]);
1564+
length = async_header_get_data_length(packet->header);
15701565
else
15711566
length = 4;
15721567

@@ -1595,10 +1590,10 @@ static void handle_local_lock(struct fw_ohci *ohci,
15951590
__be32 *payload, lock_old;
15961591
u32 lock_arg, lock_data;
15971592

1598-
tcode = HEADER_GET_TCODE(packet->header[0]);
1599-
length = HEADER_GET_DATA_LENGTH(packet->header[3]);
1593+
tcode = async_header_get_tcode(packet->header);
1594+
length = async_header_get_data_length(packet->header);
16001595
payload = packet->payload;
1601-
ext_tcode = HEADER_GET_EXTENDED_TCODE(packet->header[3]);
1596+
ext_tcode = async_header_get_extended_tcode(packet->header);
16021597

16031598
if (tcode == TCODE_LOCK_REQUEST &&
16041599
ext_tcode == EXTCODE_COMPARE_SWAP && length == 8) {
@@ -1646,10 +1641,7 @@ static void handle_local_request(struct context *ctx, struct fw_packet *packet)
16461641
packet->callback(packet, &ctx->ohci->card, packet->ack);
16471642
}
16481643

1649-
offset =
1650-
((unsigned long long)
1651-
HEADER_GET_OFFSET_HIGH(packet->header[1]) << 32) |
1652-
packet->header[2];
1644+
offset = async_header_get_offset(packet->header);
16531645
csr = offset - CSR_REGISTER_BASE;
16541646

16551647
/* Handle config rom reads. */
@@ -1683,7 +1675,7 @@ static void at_context_transmit(struct context *ctx, struct fw_packet *packet)
16831675

16841676
spin_lock_irqsave(&ctx->ohci->lock, flags);
16851677

1686-
if (HEADER_GET_DESTINATION(packet->header[0]) == ctx->ohci->node_id &&
1678+
if (async_header_get_destination(packet->header) == ctx->ohci->node_id &&
16871679
ctx->ohci->generation == packet->generation) {
16881680
spin_unlock_irqrestore(&ctx->ohci->lock, flags);
16891681

0 commit comments

Comments
 (0)