Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp47984lqt; Wed, 5 Jun 2024 16:53:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUp3dxfE9/bOk5Kr6Y6FzBRTiZVM4WJ6kUWj8oiQ/RNUJaqmb2LHzNsiKjLONU2pf0EWz93omnBdcgO2QPLJDFtyagfVArLMLQt4GU1pg== X-Google-Smtp-Source: AGHT+IEpocdLiufMUqzOzQOBPEfGXMP4+lWyzguA1sMdK3GF0U+iRsVZm+rkRNvKjBYrll9PNqPs X-Received: by 2002:a17:902:db02:b0:1f4:808e:9f6d with SMTP id d9443c01a7336-1f6a59ffc2cmr48911695ad.6.1717631632029; Wed, 05 Jun 2024 16:53:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717631632; cv=pass; d=google.com; s=arc-20160816; b=SFk4KdHCo3nHn03MDoyC2pK05OlDnK2CpfeBHtzaUD1NmN1aGD4/uwguqm6adtiTqO CRBogo7Fm4fmzUYXB3rJOMuiHLcN/aj8AJgpt47wdmo7smMg0CDSB5N9oLFcrG1xN+jO iRfKEmwJ9CtOm5JRDVzp24JuEg8QYMaPrg+xZ4fA15xowN34urkqFLehre8L8thPyibU jIVejxH+nBd/g8IjR0lyGGu2teRLhjOwuYBLDfWDW0Jlzmmev3VQYXzBnRY1JyY+brGZ qkMZKQ2iz9f/GbzOzQaZRGKbMVh+0wkPbyrE9y3bs5sRt/QtatgWfSyMMcQbLy4F4ODh F8PQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=qWFO7zoF+O3PVNs52gcGbFCEy0eI0C7UgJjzmWKpW4M=; fh=5EQyDiYgg+kua2A2AF9eJME8jasrrRA/Pgg86y+lzvY=; b=Y3s3zefAuOYCkz2TJtdmVbnj9RWWSUVbJjMf3zboq72zJcVP4qeBFnv8xGrPuI8YNW uZ+jI/+asH6YrTiECiIBvyinkLogK0OHalOQeqesg26cmVsHdkK/xp2AEs64GlUvju8Y bWXNlDKcVEqv7I2xHXEXAh++ZLf0UwJ28bNhO/8Lrpce6xJusE3tmJayIfDxOtQXor2d z8mVzsPu/Xk2OCAr4mmCDDjmUla5wWlHauJdJWwRhIlRgdATnTROhYv/BvyDR2HuHGew 8rq2gF5aYhNbJTYTUtRV0WZLLaefzdTkUTH2qxIDKd5AvTy+Bz9jsR4jbPQQnbRrbcEU Mpvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=ROQGTVMo; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=agncoT60; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-203429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd76f6dcsi1660275ad.158.2024.06.05.16.53.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 16:53:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b=ROQGTVMo; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=agncoT60; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-203429-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 83A622846CB for ; Wed, 5 Jun 2024 23:53:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29A35168C2E; Wed, 5 Jun 2024 23:52:21 +0000 (UTC) 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 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 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: 8bit 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-topology.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 -#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; node->color = color; - node->node_id = LOCAL_BUS | SELF_ID_PHY_ID(sid); - node->link_on = SELF_ID_LINK_ON(sid); - node->phy_speed = SELF_ID_PHY_SPEED(sid); - node->initiated_reset = SELF_ID_PHY_INITIATOR(sid); + node->node_id = LOCAL_BUS | phy_packet_self_id_get_phy_id(sid); + node->link_on = phy_packet_self_id_zero_get_link_active(sid); + // NOTE: Only two bits, thus only for SCODE_100, SCODE_200, SCODE_400, and SCODE_BETA. + node->phy_speed = phy_packet_self_id_zero_get_scode(sid); + node->initiated_reset = phy_packet_self_id_zero_get_initiated_reset(sid); node->port_count = port_count; 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 = 0; phy_id = 0; irm_node = NULL; - gap_count = SELF_ID_GAP_COUNT(*sid); + gap_count = phy_packet_self_id_zero_get_gap_count(*sid); beta_repeaters_present = false; while (enumerator.quadlet_count > 0) { @@ -162,9 +156,9 @@ static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self } } - if (phy_id != SELF_ID_PHY_ID(self_id_sequence[0])) { + if (phy_id != phy_packet_self_id_get_phy_id(self_id_sequence[0])) { fw_err(card, "PHY ID mismatch in self ID: %d != %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; } @@ -194,7 +188,7 @@ static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self if (phy_id == (card->node_id & 0x3f)) local_node = node; - if (SELF_ID_CONTENDER(self_id_sequence[0])) + if (phy_packet_self_id_zero_get_contender(self_id_sequence[0])) irm_node = node; for (port_index = 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 // 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]) != gap_count) + if (phy_packet_self_id_zero_get_gap_count(self_id_sequence[0]) != gap_count) gap_count = 0; update_hop_count(node); -- 2.43.0