From nobody Fri Feb 13 00:31:03 2026 Received: from wfout2-smtp.messagingengine.com (wfout2-smtp.messagingengine.com [64.147.123.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BCB116FF2E for ; Wed, 5 Jun 2024 23:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717631539; cv=none; b=AKtzdZLAU3ctC6F/1nqXR6eCaWSdA/dSLvMmSfWeHSrjtz5CgL1ELHr6fkPjYuI21QlWzVNncOfSOpNCWHBZPFNRwXdXJOLTxrJrl68HK6b2zCOa8qCYdok1RRTFZrr7yhWE4ZYxVo8ed9v8S3oZl+INMCU1AHBShMtPrs5OJag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717631539; c=relaxed/simple; bh=ebmLsfA0LlsB0ePd7GOHkiCsMBiHmH04Q7vyI11vts8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ivRs96+swNZ0rgz3IJ64Ulodf423jgQebIQ4tipmvTdjGi/KxC5XgVOMKN2JMoeN6ea7b3XZwET5GABaWf3zbqVj7+H4+fxFbAwfXJhIWxUGi3P2Mgo14+XoAXzRi6Ls7iBomTtcXa0wa44hheqGj/HbcX3urPjfyc8xn7LK6wE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=ROQGTVMo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=agncoT60; arc=none smtp.client-ip=64.147.123.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="ROQGTVMo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="agncoT60" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.west.internal (Postfix) with ESMTP id 8B2F71C0005B; Wed, 5 Jun 2024 19:52:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 05 Jun 2024 19:52:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1717631537; x= 1717717937; bh=qWFO7zoF+O3PVNs52gcGbFCEy0eI0C7UgJjzmWKpW4M=; b=R OQGTVMomLqSTv3VH+Y59El3gBqQUuTxNqEUZqFZt8r3U5walYP4RCrLkqootNYnp PNVYugQ1pWbA1WSiq2ml2GfOmo0Y8knR3zmyuHmA1adJnKL4OXtNdNedEpXKaeI2 MjjIvZIuwAWNlugm/J8eMAy+ObwkUTF9Tey6iG0LgX3Eb+IHsnmsmekl78Y+C97R qKV8JJNe7OPQowfnXyEVyuCu/PI6JApWY3HQWPeuXAUwDJj+2MGWG8weIZBKXiw1 SGwzr4mnGFsb3Z8iTxDOfjSxvsZLmuWI5MBHUhX0iTe23WeEKtiMcyfqdprpHosF QUXPfIh4Vu2t1spSa+T1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717631537; x= 1717717937; bh=qWFO7zoF+O3PVNs52gcGbFCEy0eI0C7UgJjzmWKpW4M=; b=a gncoT60BiYOu5cWM92bVrwh4BRGZxTDcKYnWBXC9k+zN02UnbNbKEcwG/U/mwBwe eTsKXZdYCxvlaIbz746po+mlzdmhyLy2iaAxNhdGOWhkBAK8VceiacW1uF24NECZ JY1TH6R1xL5W6nMeIQMnkGlMvSHZ7PVvAKjaKROeFB0FpVx9iVHM++SQBM5XjH/d MrEEVRyNascOw+qOyJgdKf4BBOSwlhm1/rHkQPP3a7QeJl0DLMXQ82ad7tGLkkiL 94enZpBNqeK/59hIG3opkoPe0tRURRv948MDphGdwHSREjxWMV4MBVN0M+qFApij ZIrNHce04mGk9T7v5VvNQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeljedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Jun 2024 19:52:15 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [PATCH 08/11] firewire: core: use helper inline functions to deserialize self ID packet Date: Thu, 6 Jun 2024 08:51:52 +0900 Message-ID: <20240605235155.116468-9-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605235155.116468-1-o-takashi@sakamocchi.jp> References: <20240605235155.116468-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit replaces the existing implementation with the helper functions for self ID packet. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-topology.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topol= ogy.c index 999ba2b121cd..6ec100e17500 100644 --- a/drivers/firewire/core-topology.c +++ b/drivers/firewire/core-topology.c @@ -23,13 +23,6 @@ #include "phy-packet-definitions.h" #include =20 -#define SELF_ID_PHY_ID(q) (((q) >> 24) & 0x3f) -#define SELF_ID_LINK_ON(q) (((q) >> 22) & 0x01) -#define SELF_ID_GAP_COUNT(q) (((q) >> 16) & 0x3f) -#define SELF_ID_PHY_SPEED(q) (((q) >> 14) & 0x03) -#define SELF_ID_CONTENDER(q) (((q) >> 11) & 0x01) -#define SELF_ID_PHY_INITIATOR(q) (((q) >> 1) & 0x01) - static struct fw_node *fw_node_create(u32 sid, int port_count, int color) { struct fw_node *node; @@ -39,10 +32,11 @@ static struct fw_node *fw_node_create(u32 sid, int port= _count, int color) return NULL; =20 node->color =3D color; - node->node_id =3D LOCAL_BUS | SELF_ID_PHY_ID(sid); - node->link_on =3D SELF_ID_LINK_ON(sid); - node->phy_speed =3D SELF_ID_PHY_SPEED(sid); - node->initiated_reset =3D SELF_ID_PHY_INITIATOR(sid); + node->node_id =3D LOCAL_BUS | phy_packet_self_id_get_phy_id(sid); + node->link_on =3D phy_packet_self_id_zero_get_link_active(sid); + // NOTE: Only two bits, thus only for SCODE_100, SCODE_200, SCODE_400, an= d SCODE_BETA. + node->phy_speed =3D phy_packet_self_id_zero_get_scode(sid); + node->initiated_reset =3D phy_packet_self_id_zero_get_initiated_reset(sid= ); node->port_count =3D port_count; =20 refcount_set(&node->ref_count, 1); @@ -119,7 +113,7 @@ static struct fw_node *build_tree(struct fw_card *card,= const u32 *sid, int self stack_depth =3D 0; phy_id =3D 0; irm_node =3D NULL; - gap_count =3D SELF_ID_GAP_COUNT(*sid); + gap_count =3D phy_packet_self_id_zero_get_gap_count(*sid); beta_repeaters_present =3D false; =20 while (enumerator.quadlet_count > 0) { @@ -162,9 +156,9 @@ static struct fw_node *build_tree(struct fw_card *card,= const u32 *sid, int self } } =20 - if (phy_id !=3D SELF_ID_PHY_ID(self_id_sequence[0])) { + if (phy_id !=3D phy_packet_self_id_get_phy_id(self_id_sequence[0])) { fw_err(card, "PHY ID mismatch in self ID: %d !=3D %d\n", - phy_id, SELF_ID_PHY_ID(self_id_sequence[0])); + phy_id, phy_packet_self_id_get_phy_id(self_id_sequence[0])); return NULL; } =20 @@ -194,7 +188,7 @@ static struct fw_node *build_tree(struct fw_card *card,= const u32 *sid, int self if (phy_id =3D=3D (card->node_id & 0x3f)) local_node =3D node; =20 - if (SELF_ID_CONTENDER(self_id_sequence[0])) + if (phy_packet_self_id_zero_get_contender(self_id_sequence[0])) irm_node =3D node; =20 for (port_index =3D 0; port_index < total_port_count; ++port_index) { @@ -243,7 +237,7 @@ static struct fw_node *build_tree(struct fw_card *card,= const u32 *sid, int self =20 // If PHYs report different gap counts, set an invalid count which will = force a gap // count reconfiguration and a reset. - if (SELF_ID_GAP_COUNT(self_id_sequence[0]) !=3D gap_count) + if (phy_packet_self_id_zero_get_gap_count(self_id_sequence[0]) !=3D gap_= count) gap_count =3D 0; =20 update_hop_count(node); --=20 2.43.0