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 for self ID logging

Current implementation to log self ID sequence has the rest to be
refactored; e.g. moving translation-unit level variables to the
dependent block.

This commit is for the purpose.

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

+22 -14
+22 -14
drivers/firewire/ohci.c
··· 437 437 ? " ?" : ""); 438 438 } 439 439 440 - static const char *speed[] = { 441 - [0] = "S100", [1] = "S200", [2] = "S400", [3] = "beta", 442 - }; 443 - static const char *power[] = { 444 - [0] = "+0W", [1] = "+15W", [2] = "+30W", [3] = "+45W", 445 - [4] = "-3W", [5] = " ?W", [6] = "-3..-6W", [7] = "-3..-10W", 446 - }; 447 - static const char port[] = { '.', '-', 'p', 'c', }; 448 - 449 - static char _p(u32 *s, int shift) 440 + static unsigned int _p(u32 *s, int shift) 450 441 { 451 - return port[*s >> shift & 3]; 442 + return *s >> shift & 3; 452 443 } 453 444 454 445 static void log_selfids(struct fw_ohci *ohci, int generation, int self_id_count) 455 446 { 447 + static const char *const speed[] = { 448 + [0] = "S100", [1] = "S200", [2] = "S400", [3] = "beta", 449 + }; 450 + static const char *const power[] = { 451 + [0] = "+0W", [1] = "+15W", [2] = "+30W", [3] = "+45W", 452 + [4] = "-3W", [5] = " ?W", [6] = "-3..-6W", [7] = "-3..-10W", 453 + }; 454 + static const char port[] = { '.', '-', 'p', 'c', }; 456 455 u32 *s; 457 456 458 457 if (likely(!(param_debug & OHCI_PARAM_DEBUG_SELFIDS))) ··· 464 465 if ((*s & 1 << 23) == 0) 465 466 ohci_notice(ohci, 466 467 "selfID 0: %08x, phy %d [%c%c%c] %s gc=%d %s %s%s%s\n", 467 - *s, *s >> 24 & 63, _p(s, 6), _p(s, 4), _p(s, 2), 468 + *s, *s >> 24 & 63, 469 + port[_p(s, 6)], 470 + port[_p(s, 4)], 471 + port[_p(s, 2)], 468 472 speed[*s >> 14 & 3], *s >> 16 & 63, 469 473 power[*s >> 8 & 7], *s >> 22 & 1 ? "L" : "", 470 474 *s >> 11 & 1 ? "c" : "", *s & 2 ? "i" : ""); ··· 475 473 ohci_notice(ohci, 476 474 "selfID n: %08x, phy %d [%c%c%c%c%c%c%c%c]\n", 477 475 *s, *s >> 24 & 63, 478 - _p(s, 16), _p(s, 14), _p(s, 12), _p(s, 10), 479 - _p(s, 8), _p(s, 6), _p(s, 4), _p(s, 2)); 476 + port[_p(s, 16)], 477 + port[_p(s, 14)], 478 + port[_p(s, 12)], 479 + port[_p(s, 10)], 480 + port[_p(s, 8)], 481 + port[_p(s, 6)], 482 + port[_p(s, 4)], 483 + port[_p(s, 2)]); 480 484 } 481 485 482 486 static const char *evts[] = {