From patchwork Wed Dec 20 04:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 181443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2409012dyi; Tue, 19 Dec 2023 20:19:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGClNcOkauamTNGcLBbP89XVkmfA37q7mZ9pwzhAZYLrBoeEjLKcCDQOLuwcTpAqAU7fMPp X-Received: by 2002:a05:620a:1465:b0:77e:fba3:a774 with SMTP id j5-20020a05620a146500b0077efba3a774mr13936119qkl.82.1703045939860; Tue, 19 Dec 2023 20:18:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703045939; cv=none; d=google.com; s=arc-20160816; b=UCwUbdG/QdNaBm433yplCfiCVLQj7EjvBdYQK81EhVPK43WtXqZW+V5N8qKe5ZApDE ftep8iqIERxtIInHpm7dOiWPtxKamKK0+1FwXPcRRHL6bsbFs96RF3Ewen8+DIwtv3Ne s5Wi3076Ctpfb5wHb2+exVavPGBpMiCUZ55o6OBdTGhSdIRseBJhgQe7DdoiEw8ZmjSu rSaX0CDVI2HP8cSjR/TZmfcR8l6+TZ+OkwdYWylXpVTiHMRAH8IyWRyYpZbJXUGyXtxH h5Vtxq4Tls6LmVhovQ02vJjWXB1reJoKS7rsswPVAWroSab7vkybdtdz5H6PmWCRFboW RhBA== 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=vlRY7kNWCqM0TkQhVQaWz4AU28ts1lMRduf7TpJmh6Ln7tdQDxUkKCmN20tUkRfDpG m1qZSP5mMBOj+0GomqHrXVbwcYviw6o/5VBpkomR17jx8eKPvc854L3KeXKRhf/Q2fsI pI8fAMbrSCSXGKMsxa+mYlPJIukR4TYCB0TkX3fN7bzfQgHFuIBI3RbQrMdZCI/lm7/P FjD4XlYTV9zQ1ocP4mkMBzgUEvMl++dfVIjGAjAFVaZkX2MqPa/pNX1J7LCJLF0Lzr7O fG9ct9qxAa+oDVpiBatDUEvSJu9ke6B9t18XeGLHkb52MViaRP9tCfJHA1QK0lzxzN/W K/UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=fY40KPok; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Dpy34s+f; spf=pass (google.com: domain of linux-kernel+bounces-6354-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6354-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u15-20020a05620a430f00b0077f76453bcesi23275643qko.30.2023.12.19.20.18.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 20:18:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6354-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=fY40KPok; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Dpy34s+f; spf=pass (google.com: domain of linux-kernel+bounces-6354-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6354-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A3B241C254F8 for ; Wed, 20 Dec 2023 04:18:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F35114F7F; Wed, 20 Dec 2023 04:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="fY40KPok"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Dpy34s+f" X-Original-To: linux-kernel@vger.kernel.org Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (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 51B3CC8CE for ; Wed, 20 Dec 2023 04:18:19 +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 compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 2A3373200A09; Tue, 19 Dec 2023 23:18:18 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 19 Dec 2023 23:18:18 -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=1703045897; x= 1703132297; bh=PBp/kI0n0J8XwNjRh8pLSTFV6N9OxHCw9BU3vtXvG80=; b=f Y40KPokZAY6J+ufOGjMPW2NLsBhIO/1jaJFshHolkz0OSX2yqX+5V2cEq+LTfvri q/6QMA+2R1dr8gbFO5/TATROjSnXZfC9XL3ceJIEK/VB1Mg9SFVIpqoX1fw+Njpx MbBwGYEUvSUyytGhSO0hdBiz1EikSymd0rKVZ9rF1R1VMpmiwYgjiSsVGpUenf7V bMRlDmXq7PGLeQJHLvhtzh0z2eJGa9ZMvhE8KbeDBqNvKJRmBLWC1G6JKIlkfPAo blSR6nbbH97y2+FSg4ixguyjS+B/LRJ9daQc1j5kDxAK8mnF76Fn+kpcBWLVt73Y sw8ppfGhQSrEQzvqcMq9g== 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=1703045897; x= 1703132297; bh=PBp/kI0n0J8XwNjRh8pLSTFV6N9OxHCw9BU3vtXvG80=; b=D py34s+f+qgQJ0jRSDUaGmewcd6Io0FZd252UL5qJt/8nnksY/cZm4OkRxEdMQCPu AmtlXSgV8MsqFa9grb5opBseDrCKpn1/1u9+wT1KYHcUv75GSc17GKN2GyptCz/h WhBrGFzXAloTxlzBLGXLYHtXMPvGpKVemovfSJDsSCnTjhDDk9tm8gpPegcdPRPn OrpOeABiCZS5Rcrs6k2BxJ7Mlpgwqqgk1lRYb8CFP/mf3LVqErCJwC4TfqtDI+9Z 3i2CMU8eYRm2fQI42d2BLyzNegSbq6sas5pySOjGtwal5oNHZTV/97UhFBFoIhnL bFjXVLF0Gn/goXi1lpZHg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdduuddgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghk rghshhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgje euvdfguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushht vghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhise hsrghkrghmohgttghhihdrjhhp X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 19 Dec 2023 23:18:16 -0500 (EST) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: adamg@pobox.com Subject: [PATCH 2/8] firewire: core: replace magic number with macro Date: Wed, 20 Dec 2023 13:18:00 +0900 Message-Id: <20231220041806.39816-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231220041806.39816-1-o-takashi@sakamocchi.jp> References: <20231220041806.39816-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785773099355592687 X-GMAIL-MSGID: 1785773099355592687 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;