Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firewire: ohci: minor code refactoring to localize text table

The string table for tcode is just used by log_ar_at_event(). In the case,
it is suitable to move the table inner the function definition.

This commit is for the purpose. Additionally, the hard-coded value for
tcode is replaced with defined macros as many as possible.

Link: https://lore.kernel.org/r/20240729134631.127189-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

+18 -10
+18 -10
drivers/firewire/ohci.c
··· 531 531 [0x1e] = "ack_type_error", [0x1f] = "-reserved-", 532 532 [0x20] = "pending/cancelled", 533 533 }; 534 - static const char *tcodes[] = { 535 - [0x0] = "QW req", [0x1] = "BW req", 536 - [0x2] = "W resp", [0x3] = "-reserved-", 537 - [0x4] = "QR req", [0x5] = "BR req", 538 - [0x6] = "QR resp", [0x7] = "BR resp", 539 - [0x8] = "cycle start", [0x9] = "Lk req", 540 - [0xa] = "async stream packet", [0xb] = "Lk resp", 541 - [0xc] = "-reserved-", [0xd] = "-reserved-", 542 - [0xe] = "link internal", [0xf] = "-reserved-", 543 - }; 544 534 545 535 static void log_ar_at_event(struct fw_ohci *ohci, 546 536 char dir, int speed, u32 *header, int evt) 547 537 { 538 + static const char *const tcodes[] = { 539 + [TCODE_WRITE_QUADLET_REQUEST] = "QW req", 540 + [TCODE_WRITE_BLOCK_REQUEST] = "BW req", 541 + [TCODE_WRITE_RESPONSE] = "W resp", 542 + [0x3] = "-reserved-", 543 + [TCODE_READ_QUADLET_REQUEST] = "QR req", 544 + [TCODE_READ_BLOCK_REQUEST] = "BR req", 545 + [TCODE_READ_QUADLET_RESPONSE] = "QR resp", 546 + [TCODE_READ_BLOCK_RESPONSE] = "BR resp", 547 + [TCODE_CYCLE_START] = "cycle start", 548 + [TCODE_LOCK_REQUEST] = "Lk req", 549 + [TCODE_STREAM_DATA] = "async stream packet", 550 + [TCODE_LOCK_RESPONSE] = "Lk resp", 551 + [0xc] = "-reserved-", 552 + [0xd] = "-reserved-", 553 + [TCODE_LINK_INTERNAL] = "link internal", 554 + [0xf] = "-reserved-", 555 + }; 548 556 int tcode = async_header_get_tcode(header); 549 557 char specific[12]; 550 558