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: core: use inline helper functions to serialize phy config packet

This commit uses the added helper functions to obsolete the existing
implementation for phy configuration packet.

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

+10 -12
+10 -12
drivers/firewire/core-transaction.c
··· 30 30 31 31 #include "core.h" 32 32 #include "packet-header-definitions.h" 33 + #include "phy-packet-definitions.h" 33 34 #include <trace/events/firewire.h> 34 35 35 36 #define HEADER_DESTINATION_IS_BROADCAST(header) \ 36 37 ((async_header_get_destination(header) & 0x3f) == 0x3f) 37 - 38 - #define PHY_PACKET_CONFIG 0x0 39 - #define PHY_PACKET_LINK_ON 0x1 40 - #define PHY_PACKET_SELF_ID 0x2 41 - 42 - #define PHY_CONFIG_GAP_COUNT(gap_count) (((gap_count) << 16) | (1 << 22)) 43 - #define PHY_CONFIG_ROOT_ID(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23)) 44 - #define PHY_IDENTIFIER(id) ((id) << 30) 45 38 46 39 /* returns 0 if the split timeout handler is already running */ 47 40 static int try_cancel_split_timeout(struct fw_transaction *t) ··· 474 481 int node_id, int generation, int gap_count) 475 482 { 476 483 long timeout = DIV_ROUND_UP(HZ, 10); 477 - u32 data = PHY_IDENTIFIER(PHY_PACKET_CONFIG); 484 + u32 data = 0; 478 485 479 - if (node_id != FW_PHY_CONFIG_NO_NODE_ID) 480 - data |= PHY_CONFIG_ROOT_ID(node_id); 486 + phy_packet_set_packet_identifier(&data, PHY_PACKET_PACKET_IDENTIFIER_PHY_CONFIG); 487 + 488 + if (node_id != FW_PHY_CONFIG_NO_NODE_ID) { 489 + phy_packet_phy_config_set_root_id(&data, node_id); 490 + phy_packet_phy_config_set_force_root_node(&data, true); 491 + } 481 492 482 493 if (gap_count == FW_PHY_CONFIG_CURRENT_GAP_COUNT) { 483 494 gap_count = card->driver->read_phy_reg(card, 1); ··· 492 495 if (gap_count == 63) 493 496 return; 494 497 } 495 - data |= PHY_CONFIG_GAP_COUNT(gap_count); 498 + phy_packet_phy_config_set_gap_count(&data, gap_count); 499 + phy_packet_phy_config_set_gap_count_optimization(&data, true); 496 500 497 501 mutex_lock(&phy_config_mutex); 498 502