[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240814131222.69949-4-o-takashi@sakamocchi.jp>
Date: Wed, 14 Aug 2024 22:12:22 +0900
From: Takashi Sakamoto <o-takashi@...amocchi.jp>
To: linux1394-devel@...ts.sourceforge.net
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] firewire: core/ohci: minor refactoring for computation of configuration ROM size
The size of space for configuration ROM is defined by IEEE 1212. The start
and end offsets are available as some macros in UAPI header.
This commit uses these macros to compute the size.
Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
---
drivers/firewire/core-device.c | 3 ++-
drivers/firewire/ohci.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 32ac0f115793..f71e118ef60a 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -564,7 +564,8 @@ static int read_rom(struct fw_device *device,
return rcode;
}
-#define MAX_CONFIG_ROM_SIZE 256
+// By quadlet unit.
+#define MAX_CONFIG_ROM_SIZE ((CSR_CONFIG_ROM_END - CSR_CONFIG_ROM) / sizeof(u32))
/*
* Read the bus info block, perform a speed probe, and read all of the rest of
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 979f1e1f2d16..53132eae37fe 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -174,7 +174,7 @@ struct iso_context {
u8 tags;
};
-#define CONFIG_ROM_SIZE 1024
+#define CONFIG_ROM_SIZE (CSR_CONFIG_ROM_END - CSR_CONFIG_ROM)
struct fw_ohci {
struct fw_card card;
--
2.43.0
Powered by blists - more mailing lists