Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp67649rdb; Sun, 17 Dec 2023 02:30:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8zVJH3Mw5BlIWWHk8zSK+xPa+r56tv+Tf6KE8/A5f5kvk1ncFHqxPF5+i04dTuwztvhn0 X-Received: by 2002:a05:600c:444c:b0:40b:3d6e:16b7 with SMTP id v12-20020a05600c444c00b0040b3d6e16b7mr8091627wmn.33.1702809045291; Sun, 17 Dec 2023 02:30:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702809045; cv=none; d=google.com; s=arc-20160816; b=utAYn1p0duwJSTbEXzsoiK4TL1r5oPrZcYfvlZrKWA8SnnTgVW0p9EpN7aiXvMVtx8 xhVITagNaLg2e51MQJBZlzOQrDX3sz+vsA/UK/BqliDSwt0jXN1/JO1wp6cpBwVtj4Yo IrF6vcu+Ma4cgK27CSwfpU+mq6SpLPcdGROBtZ6xvx29k18wXwX7Ggj1efhnENcIwVbc 5Bf9vbd8+N+zsHSkg3r4vuIbPaW50rnuU3bufrhqvXiXxe1XbVcFuRglavNW1BNBls5a g0QpVj69kCCpU5Vx5aPe+hR+NkpM9YWB3PwT1NzrHnV/e22RBruly12PdbeZR3uxcJxG 2VkA== ARC-Message-Signature: i=1; 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=/6Ta9woOfTDpfu4hjdamNnLTts8ODMKhVhLZw/OsZHE=; fh=29+NP+Avo3KW5WAFiPrv+jdOjQZBDMQJMXZlHI+I9m4=; b=Lha3q9CVnqbA7wL+lviV9Fm1jyIg/jFEfhMgrFJSHa9oR3wiDhfcN8njRIJFaKKaU1 bB0p6q5GhOa9XJZh0pXAV++jx+2d4+LuuDd+CtZE3vcREIBrd5LSKOYLcS9+CvvYu0W6 8bniL3g7/YhaYadB5GG+FH6JxHBJxmYdeGpzTQupP+OTMNrElqoegANr5l9dq/LJ7KtU 4lV4dRexEaxQOCltU+GuyNA4l/cqbX/yCyd76emBrgju50nUjAYdulY45cIWNtXi5mCr /V3kXrSNX/SFPge3RjycFPKgzMT5IXUgqMO9nMGNuY8uOIdrS5AayyvpZ/i0SHtCJjIA 0Uug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=udElJpNm; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=0iS9cBa2; spf=pass (google.com: domain of linux-kernel+bounces-2527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2527-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 v7-20020a170906180700b00a1d551f6324si9274830eje.355.2023.12.17.02.30.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 02:30:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2527-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=fm2 header.b=udElJpNm; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=0iS9cBa2; spf=pass (google.com: domain of linux-kernel+bounces-2527-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2527-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 CAFF31F21FDC for ; Sun, 17 Dec 2023 10:30:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C73F79F4; Sun, 17 Dec 2023 10:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="udElJpNm"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="0iS9cBa2" X-Original-To: linux-kernel@vger.kernel.org Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (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 AF2E2613C for ; Sun, 17 Dec 2023 10:30:21 +0000 (UTC) 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 mailout.nyi.internal (Postfix) with ESMTP id 83F015C0113; Sun, 17 Dec 2023 05:30:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sun, 17 Dec 2023 05:30:20 -0500 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=fm2; t=1702809020; x= 1702895420; bh=/6Ta9woOfTDpfu4hjdamNnLTts8ODMKhVhLZw/OsZHE=; b=u dElJpNmM8IX4CREWPjR1PnG8MwDSKDRHAVTZrKhneacCnqx+wKR/qZqdl+JoBY5C nJA8uoI+3jxPH+rJht0btFRsEz5/DutSaYyXc/G739V3sQtqOa0s/a/wvDfclrGr L4uzK3Zefs9hZysyXzwfDMloUVQgxakrFq6NkPWLThL0m3hjfdWDm5pQmwzRoZFL TrtcYg7rqP09g7UiQdQ41oxkzu2KSVb9cUg+Oh/FTNZtbaPcb+CtgRxoLC6XjgAr QsNuYq8UgAvS/a7tIoBqUcesbo+v2Ns/aVtQ+b9YmoYr5abr5O9g1Vv56uoswlPl 158mjO6lsRK8VSDjUz/cA== 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=fm2; t=1702809020; x= 1702895420; bh=/6Ta9woOfTDpfu4hjdamNnLTts8ODMKhVhLZw/OsZHE=; b=0 iS9cBa2rjrrEO2hdjyh2xoBiMgmTZSLtPXEhg4/HDC5Fq3vXbQm5PIJlHS+XL5B1 x//TzfsE+P17ep6LzDmddcNm50cIwZsqWqzlXJRrd1oF1GbYLfFSU9m47YlpGsVN grQMOcp9umLrx9K2RDcN+W587+WpcT1ItRYbYNuSMVwQNW9gfJTQvhE+spMAMfW/ wDQBpLL3euQFDxc4OJS+qgs8YcCLymq0bSW6AgIqf2wtVyofSkWYiNQnmuPRCxOu DVUhSj91sYTb9zRXuWDjNVgcFVaxNhsapciEIpgqQE6YxbzyNDdIoYAtbg6UhN6g y3ko9UNv4buPzrKMj0F7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtiedgudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Dec 2023 05:30:19 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: adamg@pobox.com Subject: [RFC PATCH 2/8] firewire: core: replace magic number with macro Date: Sun, 17 Dec 2023 19:30:05 +0900 Message-Id: <20231217103012.41273-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231217103012.41273-1-o-takashi@sakamocchi.jp> References: <20231217103012.41273-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 In IEEE 1394 specification, the size of bus information block of configuration ROM is fixed to 5, thus the offset of root directory is 5. Current implementation to handle device structures has the hard-coded offset. This commit replaces the offset with macro. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-device.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 16c32cb38f0f..137001f8a695 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -31,6 +31,8 @@ #include "core.h" +#define ROOT_DIR_OFFSET 5 + void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p) { ci->p = p + 1; @@ -135,7 +137,7 @@ static void get_ids(const u32 *directory, int *id) static void get_modalias_ids(const struct fw_unit *unit, int *id) { - get_ids(&fw_parent_device(unit)->config_rom[5], id); + get_ids(&fw_parent_device(unit)->config_rom[ROOT_DIR_OFFSET], id); get_ids(unit->directory, id); } @@ -259,7 +261,7 @@ static ssize_t show_immediate(struct device *dev, if (is_fw_unit(dev)) dir = fw_unit(dev)->directory; else - dir = fw_device(dev)->config_rom + 5; + dir = fw_device(dev)->config_rom + ROOT_DIR_OFFSET; fw_csr_iterator_init(&ci, dir); while (fw_csr_iterator_next(&ci, &key, &value)) @@ -292,7 +294,7 @@ static ssize_t show_text_leaf(struct device *dev, if (is_fw_unit(dev)) dir = fw_unit(dev)->directory; else - dir = fw_device(dev)->config_rom + 5; + dir = fw_device(dev)->config_rom + ROOT_DIR_OFFSET; if (buf) { bufsize = PAGE_SIZE - 1; @@ -446,7 +448,7 @@ static ssize_t units_show(struct device *dev, int key, value, i = 0; down_read(&fw_device_rwsem); - fw_csr_iterator_init(&ci, &device->config_rom[5]); + fw_csr_iterator_init(&ci, &device->config_rom[ROOT_DIR_OFFSET]); while (fw_csr_iterator_next(&ci, &key, &value)) { if (key != (CSR_UNIT | CSR_DIRECTORY)) continue; @@ -691,7 +693,7 @@ static void create_units(struct fw_device *device) int key, value, i; i = 0; - fw_csr_iterator_init(&ci, &device->config_rom[5]); + fw_csr_iterator_init(&ci, &device->config_rom[ROOT_DIR_OFFSET]); while (fw_csr_iterator_next(&ci, &key, &value)) { if (key != (CSR_UNIT | CSR_DIRECTORY)) continue; -- 2.39.2