Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp712503lqa; Sun, 28 Apr 2024 00:14:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXuBoaXJ2RZZjja133roUiP420FUu2eITQEx9Nxt7kpiOl563RJG5GL9cjCIlTS8Y/yVJqSi7VXqnhkGY/fR0WoSget8fM4uaxnhrTJMg== X-Google-Smtp-Source: AGHT+IEbW5mk9cDHOdR1ZzAaMEQEdwZGPcw5bkwmL8w9zTZRw1/U2NZs6oMSCRHVWiM0kWzF1DJK X-Received: by 2002:a17:903:2292:b0:1eb:5293:dc37 with SMTP id b18-20020a170903229200b001eb5293dc37mr4446474plh.10.1714288467324; Sun, 28 Apr 2024 00:14:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714288467; cv=pass; d=google.com; s=arc-20160816; b=TPvOK3E4DUNGSEDnO5j0plZt9l+Ky4ZJ7ntGxN8V+RWEjStdwl14chPvqQPpfpf8DV hAGvEmRFtVS/eD7CZyXnd2KE6zDgHNDB4nSaF6zb8VptWJmUaBwLdtqs7cy3Ppsryn1h JANxXR3FVyCqvCxbZH8yauUu+lSl96DdIpppQkt17Qe6GwTAoudQDjlg5Z3lclrtDoUx cSIDm7kIJuO1evRZ8FLIUZA4RDwXWkV3ytWEmEmxKGpsfZRfJltiknZC4tD4Sy3z5iQ4 GvlhMu5Nusl58Pie0YvN6tpVacgmJtRynXLmK5P40/j+dwJUgZN4v3cWhSsnILinS9BZ i+XQ== 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=470UmX6MvxsOpPDrhAZoiwlvja/CUYrvQC6qp4umF88=; fh=5EQyDiYgg+kua2A2AF9eJME8jasrrRA/Pgg86y+lzvY=; b=Zs0vU8zt0Yxv9s18IBbQceJJ4wBHRTMuIf410M5/mjfLl11pvdxVV82n3Qnp6S2ZAK 5gRxY6BI4XQYneS4WXC3f7PBKo9OiTb1YMBPV/MwGwOF1z0fVPz9DBLND3WcEvK6VMhL 2MJbnynsfY6o6mvGp1dphUXn+hANuHtL77ZDnP68UtsjnZcoeS1+VyoxFSCyCnz7bLRs +KWP0mS99Chf5x+JEcC1qiCgZvN/CD7nurzXQJehxxvRG3IFLCDM5qhP8TIyuOKTrObO g5qaXBclTSpJ0O0TcGyEn+B5l1XvctdeRI+nySHsbRNDlrbS98JeYQGeGqIl2cFxYXCA 6z4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm3 header.b=coJi8ATk; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QYqOW+Uw; 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-161299-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161299-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i2-20020a170902eb4200b001e0ccfd7818si17719086pli.412.2024.04.28.00.14.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 00:14:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161299-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm3 header.b=coJi8ATk; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=QYqOW+Uw; 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-161299-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161299-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CD16CB213D3 for ; Sun, 28 Apr 2024 07:14:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB35252F85; Sun, 28 Apr 2024 07:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="coJi8ATk"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="QYqOW+Uw" 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 EFC60524AD for ; Sun, 28 Apr 2024 07:13:59 +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=1714288441; cv=none; b=s4bwBCzIfeZjZxv+QIh9+9hbUXnXasY6Xd9Znem7m6n6mmJYmKqa3vQg1HzFuTEDbNw/qBVa0u9CeukW65got8XKm2IXl2K39DLzjSEF68dduMHPdRiBT1XDZmCNnrPJ375BchdVmyBVksMd+5oweg+lSI5qiVkJv7/XcJzCU64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714288441; c=relaxed/simple; bh=TJls4eJgjILIoLoh7e72vgk38wF3wZdb5E9SMVw62i8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Js+8rqsupnEsG5OpeGuXOBRVplCWd5ONq5ePP9jMzMKYdOZR8MQ0avXL1N4VrLTHEnna3uKAoCLbKd5ydMSq35HfRS0PThU8gskmdVxWbImh8t2oamamOXhe12ELUn608q/6U0XeYXzvkRQWAVuwqit3O7F2ULAEgkJEsFKXb6Y= 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=coJi8ATk; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=QYqOW+Uw; 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 compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.west.internal (Postfix) with ESMTP id 0C8C21C0010F; Sun, 28 Apr 2024 03:13:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 28 Apr 2024 03:13:59 -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=fm3; t=1714288438; x= 1714374838; bh=470UmX6MvxsOpPDrhAZoiwlvja/CUYrvQC6qp4umF88=; b=c oJi8ATkKxRWB8+w2DwpZlcoEDB6RAV47lw9TimBoY/5BRM0mAcj7Z+Ls4OGKEPg1 FtH+y/A0wZ9WGpmN9bgFeKG2VYDS0fsBe0v5O3teqXhjePEk/s3B2hWpNyUHS7Lw ec/tnSOiAqIpWjjRomozS+7FyiH5s2DzF0AkiRMNLCI0oq7Y739i0xxHJmtT1kYX HRfoH8cCEG9ukH5bPHANrAjuUuWaiiDisZ3LIW+9Sf/CMdJny0zICBCQj91uVQEd iQW/DmruuxAYPCE6cgHXeebTQhCljLwchnypAsz1dOtoEFVbU88nWqEbSHmM6KzU 6dmtZ4sNPvHI4KXTzoz/A== 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=fm3; t=1714288438; x= 1714374838; bh=470UmX6MvxsOpPDrhAZoiwlvja/CUYrvQC6qp4umF88=; b=Q YqOW+UwSpbxvF4GJPEJLGmuZgCYtQKx2+eV4U0RcRtJjmm1sDPzOryBG528sTwL3 tpCVqvMPQt11n1jOli4MUYnt75+a/bgcFKmcHeHFi0fpyzN27E6StrMa4AWNuy3v dgIVUTCfnUNG4Zigtv2K9Ezj0VpdMl1k6p7GcYlPrgj/rfPmqhL701ftxbm7/UJ1 KaDJXOQw+aVLAWyTxkoG3lObzo5T9ErDHWz9q8F2rQFJxUMHTDvWyS8ZeMb+ag4F tZKajJ6r+pAHYcB4VqswBijfPcS4jqVttW0/x14xu238oyBQljZtbATb+wf3CDAW 7lePIYCzujjJWX1WAGG3w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddtgedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 28 Apr 2024 03:13:57 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/8] firewire: ohci: replace local macros with common inline functions for asynchronous packet header Date: Sun, 28 Apr 2024 16:13:41 +0900 Message-ID: <20240428071347.409202-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240428071347.409202-1-o-takashi@sakamocchi.jp> References: <20240428071347.409202-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 uses the common inline functions to serialize and deserialize header of asynchronous packet. Signed-off-by: Takashi Sakamoto --- drivers/firewire/ohci.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index e4ad624c60cb..5f702f56ac7b 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -40,6 +40,7 @@ #include "core.h" #include "ohci.h" +#include "packet-header-definitions.h" #define ohci_info(ohci, f, args...) dev_info(ohci->card.device, f, ##args) #define ohci_notice(ohci, f, args...) dev_notice(ohci->card.device, f, ##args) @@ -1550,21 +1551,15 @@ static int handle_at_packet(struct context *context, return 1; } -#define HEADER_GET_DESTINATION(q) (((q) >> 16) & 0xffff) -#define HEADER_GET_TCODE(q) (((q) >> 4) & 0x0f) -#define HEADER_GET_OFFSET_HIGH(q) (((q) >> 0) & 0xffff) -#define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff) -#define HEADER_GET_EXTENDED_TCODE(q) (((q) >> 0) & 0xffff) - static void handle_local_rom(struct fw_ohci *ohci, struct fw_packet *packet, u32 csr) { struct fw_packet response; int tcode, length, i; - tcode = HEADER_GET_TCODE(packet->header[0]); + tcode = async_header_get_tcode(packet->header); if (TCODE_IS_BLOCK_PACKET(tcode)) - length = HEADER_GET_DATA_LENGTH(packet->header[3]); + length = async_header_get_data_length(packet->header); else length = 4; @@ -1591,10 +1586,10 @@ static void handle_local_lock(struct fw_ohci *ohci, __be32 *payload, lock_old; u32 lock_arg, lock_data; - tcode = HEADER_GET_TCODE(packet->header[0]); - length = HEADER_GET_DATA_LENGTH(packet->header[3]); + tcode = async_header_get_tcode(packet->header); + length = async_header_get_data_length(packet->header); payload = packet->payload; - ext_tcode = HEADER_GET_EXTENDED_TCODE(packet->header[3]); + ext_tcode = async_header_get_extended_tcode(packet->header); if (tcode == TCODE_LOCK_REQUEST && ext_tcode == EXTCODE_COMPARE_SWAP && length == 8) { @@ -1640,10 +1635,7 @@ static void handle_local_request(struct context *ctx, struct fw_packet *packet) packet->callback(packet, &ctx->ohci->card, packet->ack); } - offset = - ((unsigned long long) - HEADER_GET_OFFSET_HIGH(packet->header[1]) << 32) | - packet->header[2]; + offset = async_header_get_offset(packet->header); csr = offset - CSR_REGISTER_BASE; /* Handle config rom reads. */ @@ -1679,7 +1671,7 @@ static void at_context_transmit(struct context *ctx, struct fw_packet *packet) spin_lock_irqsave(&ctx->ohci->lock, flags); - if (HEADER_GET_DESTINATION(packet->header[0]) == ctx->ohci->node_id && + if (async_header_get_destination(packet->header) == ctx->ohci->node_id && ctx->ohci->generation == packet->generation) { spin_unlock_irqrestore(&ctx->ohci->lock, flags); -- 2.43.0