Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1178143lqb; Thu, 18 Apr 2024 02:24:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBKCgG7BjS1R2uce2wBJZKEIxG+Wew0MV+IGOLs/iNj8SNBzUFsiOuHkBmks6fjJYA8+h6jXh53Zlm3ECjQcX/wSU8az28nlMKiXnCQA== X-Google-Smtp-Source: AGHT+IF2UaHjk0jFZWWwxx3JLHATAbUaH83ZTD7/K/mIkgao79Bs2GbUyAhw8A+DGwWr/dPflZDN X-Received: by 2002:a17:907:7da3:b0:a55:76b6:2cc with SMTP id oz35-20020a1709077da300b00a5576b602ccmr614920ejc.69.1713432258208; Thu, 18 Apr 2024 02:24:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713432258; cv=pass; d=google.com; s=arc-20160816; b=MGVrYZnbMu9Z0yjUGfZDus7IYV0W9PQxLP8XOcQ77vtg077Mm9UWb4zEUSvXeHAxsG YKZN6FEkuSbDLNcuo39bzbccuqGxPMhegmjK7n97+1SMUpDiuSh+MZIJpxvd4HSikgwt uxstg1hmv3INxRhSsOpWxY+2UzVnch95b7iQ+K5+QsA1czkODViZrWLXwbrLFwREo60T tqervYjSit3fpdadY5hT97Rf0GEiFCphe+r56rCLvP35JaqxdZ7pXLpObO+fxVBjGLyS iAy8QHZB9H3mDo+vnWGBGd9pzCu8OOoFriQiOj/feuC8u9NYEl3RLbx9nlqCL+xBnx4G IwMg== 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=Ch3r5I1OGhaN3NR2WiBicVL9fQRlnB4kPOlrYiq9EzM=; fh=5EQyDiYgg+kua2A2AF9eJME8jasrrRA/Pgg86y+lzvY=; b=rQNb50eQqdIjntJYL4dGVj//JpWktHN97rVkeVhMcvcuQ1EYv5PUgqg1iGM0CFBAxq w6kliKtTruv/I016ih6Xj/jQyXFi4TqhHX2RSvOMacQQqKMld/Eji5MwBV/Mh0oiUpXF u3VZ7Z649vzAlHZpG+MdMn6JnQa9VbFDmK6Cc7gOKEw41RWCbYnkIy0vjVBcVyemnFIm Hu/Y6q2kHXsXX/fy3OHd0uQ+LZq5ELG/nYPt4kOaQwnRH/aIvE4Fd6kziA19tg9p8Xtp nJ3j7GCbJPFlUbOEs/CG062/4GA1yCY4IbK2cJ5AzSalt2BVHBISnnJstF4TK0CJKr9o 0poQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm3 header.b=jIfi2izG; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=CQtNw2JW; 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-149794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gt10-20020a170906f20a00b00a5265a8afd1si629421ejb.391.2024.04.18.02.24.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 02:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm3 header.b=jIfi2izG; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=CQtNw2JW; 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-149794-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149794-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 am.mirrors.kernel.org (Postfix) with ESMTPS id ABAFC1F2253E for ; Thu, 18 Apr 2024 09:24:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D315A15CD41; Thu, 18 Apr 2024 09:23:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="jIfi2izG"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CQtNw2JW" Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (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 ED9BF15B540 for ; Thu, 18 Apr 2024 09:23:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713432198; cv=none; b=s6aKR/hY0ejH/Rt3oquzikAHFovMcuuSdxvN9Qx0SM13awU7NvsUECRDFhf3noKSndtOLOBnf64Y4CcsiCEMjq52Xlq90bc7wJ0zvqixldSdBR9oZX1UV7yINwvunpg7JXUXRpFE/QZShaaOTs4ZdnSQ6TEw5Ap3CvsGUFUSPEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713432198; c=relaxed/simple; bh=BMhHOcQY8g+TwTPW7002AhR/TKwJYegmVfbGlf5Apxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aa5A0NJFbnZdI+Gh44X2zMQ99LSuENslM3MR1rtegaD08O/cFIq6QzyDmWalqi+EzcyuYmdFeeZJgYhebXt00TpojllvKUrYc3LCM44tYODUb0VBBcVa5zZmYKLTZSJ3g24+b4Hx4H+676ND64Po5GQjZuZkZiYhcZwqEswJnKQ= 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=jIfi2izG; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=CQtNw2JW; arc=none smtp.client-ip=103.168.172.149 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 compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id E48D413800E3; Thu, 18 Apr 2024 05:23:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 18 Apr 2024 05:23:15 -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=1713432195; x= 1713518595; bh=Ch3r5I1OGhaN3NR2WiBicVL9fQRlnB4kPOlrYiq9EzM=; b=j Ifi2izG+opErxtlq1kluCFRTNVBuYqAC40jjFxOnCEDDt4IdTfhSzn4vk1OnW5Wu 3vANSvwVG0ZO/rRQrp8KWt5QbHegA6fxaMnDMJys4eBlVqUR9lw3o1K+VIFpEusn wyENXjZ61/Jx1UPMtU2mLjUUXkpZkuUYxCw9ihWWLjTk85nDun66UmndiWx0wn2O 1EajbgscrEQPfd0dvwruPLQtX3WHcslbv+KBgSIA4DGjwz3yVM4ECmMSVvab8Z98 91gOKG8F8RSTnN8wmwbduJ4oXlWiqtGpQvmPZflmLO/cI+1ovH80szUiNHR/RqPX S96BhMji75d4+h0hIknSg== 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=1713432195; x= 1713518595; bh=Ch3r5I1OGhaN3NR2WiBicVL9fQRlnB4kPOlrYiq9EzM=; b=C QtNw2JW3dtmdRsqoy1e8ZQCk2xc8fRE2YwYT87hScjLP64ZGLpWmNai61iibqmgF p/vdTBd2az7MHorz9ZMP9SxJTPNKN57qMNBXVyeknF0byqTgeSLUfCDglCMsTISG EEvPhCQqmSk8OTorLTZlsy/osAAXpqVo+84he/PuB9XSwF1pIXy4Y725xFU8eJai g/x2rniFkOV/Q8yWhSrRUk/6+JTn3ABDb9jjHbUVagxST7BA5S+YDwUEjK/PTe+0 0pjgTAXGWG6RRWGRDdeNNFsNEYJEGq8R0S4mumXFK3UGH+HZ9zcYIy8eR8lr89AI A/+A1HGMLcwqDEHqhBq9Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudektddgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Apr 2024 05:23:14 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org Subject: [RFC PATCH 06/13] firewire: core: obsolete tcode check macros with inline functions Date: Thu, 18 Apr 2024 18:22:56 +0900 Message-ID: <20240418092303.19725-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240418092303.19725-6-o-takashi@sakamocchi.jp> References: <20240418092303.19725-1-o-takashi@sakamocchi.jp> <20240418092303.19725-2-o-takashi@sakamocchi.jp> <20240418092303.19725-3-o-takashi@sakamocchi.jp> <20240418092303.19725-4-o-takashi@sakamocchi.jp> <20240418092303.19725-5-o-takashi@sakamocchi.jp> <20240418092303.19725-6-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 declares the helper functions to check tcode to obsolete the functional macros. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-transaction.c | 4 ++-- drivers/firewire/core.h | 21 ++++++++++++++------- drivers/firewire/ohci.c | 6 +++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index 01ce07f87452..24febc23c0c4 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c @@ -972,7 +972,7 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE) return; - if (TCODE_IS_LINK_INTERNAL(async_header_get_tcode(p->header))) { + if (tcode_is_link_internal(async_header_get_tcode(p->header))) { fw_cdev_handle_phy_packet(card, p); return; } @@ -1109,7 +1109,7 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request { int start; - if (!TCODE_IS_READ_REQUEST(tcode)) { + if (!tcode_is_read_request(tcode)) { fw_send_response(card, request, RCODE_TYPE_ERROR); return; } diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index 95c10f3d2282..7c36d2628e37 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h @@ -225,13 +225,20 @@ static inline bool is_next_generation(int new_generation, int old_generation) #define TCODE_LINK_INTERNAL 0xe -#define TCODE_IS_READ_REQUEST(tcode) (((tcode) & ~1) == 4) -#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0) -#define TCODE_IS_LINK_INTERNAL(tcode) ((tcode) == TCODE_LINK_INTERNAL) -#define TCODE_IS_REQUEST(tcode) (((tcode) & 2) == 0) -#define TCODE_IS_RESPONSE(tcode) (((tcode) & 2) != 0) -#define TCODE_HAS_REQUEST_DATA(tcode) (((tcode) & 12) != 4) -#define TCODE_HAS_RESPONSE_DATA(tcode) (((tcode) & 12) != 0) +static inline bool tcode_is_read_request(unsigned int tcode) +{ + return (tcode & ~1u) == 4u; +} + +static inline bool tcode_is_block_packet(unsigned int tcode) +{ + return (tcode & 1u) != 0u; +} + +static inline bool tcode_is_link_internal(unsigned int tcode) +{ + return (tcode == TCODE_LINK_INTERNAL); +} #define LOCAL_BUS 0xffc0 diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 85223a1c90a1..77f098fb9484 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -1382,7 +1382,7 @@ static int at_context_queue_packet(struct context *ctx, (packet->header[0] & 0xffff0000)); header[2] = cpu_to_le32(packet->header[2]); - if (TCODE_IS_BLOCK_PACKET(tcode)) + if (tcode_is_block_packet(tcode)) header[3] = cpu_to_le32(packet->header[3]); else header[3] = (__force __le32) packet->header[3]; @@ -1568,7 +1568,7 @@ static void handle_local_rom(struct fw_ohci *ohci, int tcode, length, i; tcode = async_header_get_tcode(packet->header); - if (TCODE_IS_BLOCK_PACKET(tcode)) + if (tcode_is_block_packet(tcode)) length = async_header_get_data_length(packet->header); else length = 4; @@ -1577,7 +1577,7 @@ static void handle_local_rom(struct fw_ohci *ohci, if (i + length > CONFIG_ROM_SIZE) { fw_fill_response(&response, packet->header, RCODE_ADDRESS_ERROR, NULL, 0); - } else if (!TCODE_IS_READ_REQUEST(tcode)) { + } else if (!tcode_is_read_request(tcode)) { fw_fill_response(&response, packet->header, RCODE_TYPE_ERROR, NULL, 0); } else { -- 2.43.0