Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp174182rdb; Thu, 21 Dec 2023 06:13:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsrXb22wEEy6UFpuJTCyRT8yDIAByEXEX5Tni/a6p8WFPHQTXlknf7B/icxmSNDLly/dl0 X-Received: by 2002:a05:6a21:3284:b0:187:ce9f:e198 with SMTP id yt4-20020a056a21328400b00187ce9fe198mr992398pzb.5.1703167991613; Thu, 21 Dec 2023 06:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703167991; cv=none; d=google.com; s=arc-20160816; b=o9qPEMdyMGXR9uto42GODqXBN4L660ttmr4VPyqthk5S0mOlxBn7cHgQzLDVn7uP3o FoSbiypi8t3IuLqXyTZu3hOFd3jTHhh3AtTEYh/ZdhxXVTEdvX1yqm2YT5u+fmkUJuYq 0txbFeofqtX52eepW4Z0Vk1cYi0ia2yxz0/XH/yskfWLvFOOHt38GHORyq2/uU9Puqba r8+0MCtPN2kSBgE96nb2o0sKu9GnkjT9sUZ971KSFN+yhg9wqpSGxHfuiVe8XbgblN38 P/DcGMsxms1lhKFeKrJqP07Uywwu3Fim1jnzwj6K6d5zTB5OH8mhdrl858fiFpb4+GXv WYbw== 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=PBp/kI0n0J8XwNjRh8pLSTFV6N9OxHCw9BU3vtXvG80=; fh=29+NP+Avo3KW5WAFiPrv+jdOjQZBDMQJMXZlHI+I9m4=; b=AWtyjkcWWBeLW2b0lFXbg0YJQ8p/fU8o31VMxPbZUt7SKSIQcXe2lJAJfYEbayHrEL HEVmG17hZs37lIEKYgINiJhBYefubRqgvYpr5hpPIF96h09LznDD7/1ExqpwAGkDAQZ8 qkydKktzr6TcrcarI7J8z9Hv8DBS78HPRvYLcQAu4XqY/HEPO/GMz9yemwqtqNX6NaJV MedlmuTrq5uybDIY4DxCr5pCMmxVziKmYm70UsXljF6Hc9AqKhA15CHt0kXMlxAZFhfZ 9QxCSZcXk9up5n+Tx/g1cYkt2HqZLOkI9jMLyUVEke9KD2H7qb+nhNe8MD0zIVt/c/G/ zM5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=HIuDvn01; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=FoavjJCi; spf=pass (google.com: domain of linux-kernel+bounces-8527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8527-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. [147.75.48.161]) by mx.google.com with ESMTPS id s4-20020a656904000000b005cda401f189si1613954pgq.598.2023.12.21.06.13.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 06:13:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=HIuDvn01; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=FoavjJCi; spf=pass (google.com: domain of linux-kernel+bounces-8527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8527-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 AFE06B258C1 for ; Thu, 21 Dec 2023 13:59:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 629886D6FA; Thu, 21 Dec 2023 13:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="HIuDvn01"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="FoavjJCi" X-Original-To: linux-kernel@vger.kernel.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 A560E6D6CC for ; Thu, 21 Dec 2023 13:48:56 +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 compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id BBDAC5C0293; Thu, 21 Dec 2023 08:48:55 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 21 Dec 2023 08:48:55 -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=1703166535; x= 1703252935; bh=PBp/kI0n0J8XwNjRh8pLSTFV6N9OxHCw9BU3vtXvG80=; b=H IuDvn01LqcWi0C3Hd7AERs4UJmkkz+qSxPdbfFy7Cj4V3gRtcWHb/QU57t50cLFa mKT32d7aPDy8Zxhs1kk1+MkieEyOHMe780GJKhvjNMPY5aeWelWt9RxRe4JuW02m 9kv5SVizWuW5IcspWKH/lnUCLSvoeaG2o+gQRjIRGcceEnzzsCmuY84ZQtjrSlwj lANPEMs2c+6fL3LDLsQMXDHG8AqcxZRQZWgMAr9ZWpMBLPfk5PfdJsEHWklW3QKw 6ymO9Y7gPlymj6K9/JVFImx5Tn+yGzyV2l9RLsPYt8eGM0x+sCnxt8qliRG7mqv9 7o5YzaXnM5zC58bizd+sg== 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=1703166535; x= 1703252935; bh=PBp/kI0n0J8XwNjRh8pLSTFV6N9OxHCw9BU3vtXvG80=; b=F oavjJCir1WITV2vHJtlHCl8BENh1qh45/7Ja8Sbi4sntAGLcuUcnmP9zVb0yGfHW EFBBooPISK45ABDBJDmn1nV4asER9rWWZzFM5UH/scwEKZnXTlM2oewfOQduUWuC P7JZaX7RnVoqGRzuFWTVXHlIthlSwMUWkwG4P3oVTgvZ1ncjXXVYW/2cHLEwIxgW qYfbwGpy7O9a9U0Q1KY1eADu12Ic6pcL/q+WU/+Hsx1ikOYulE/hVxwQOVbtBADv RSDAJyK7tatHn+fN1acHwuzcZudsdFd3XSXiUgd0xRPkrToh88ZSmi1nQV+NkAha ncTx2C29nfs8m0r3tfZKQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdduhedgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 21 Dec 2023 08:48:54 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: adamg@pobox.com Subject: [PATCH v2 2/8] firewire: core: replace magic number with macro Date: Thu, 21 Dec 2023 22:48:43 +0900 Message-Id: <20231221134849.603857-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221134849.603857-1-o-takashi@sakamocchi.jp> References: <20231221134849.603857-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 96b0b43da863..315a2fe41643 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