]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
firewire: core/ohci: minor refactoring for computation of configuration ROM size
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 14 Aug 2024 13:12:22 +0000 (22:12 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 14 Aug 2024 13:12:22 +0000 (22:12 +0900)
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.

Link: https://lore.kernel.org/r/20240814131222.69949-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/core-device.c
drivers/firewire/ohci.c

index 32ac0f115793a00304c68b3b75dbe53c76d4db4a..f71e118ef60aa514f57905164ca461eb819cf3e8 100644 (file)
@@ -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
index 979f1e1f2d164422648f77820f48ad1e438fa517..53132eae37fe3635e5d121602b0dc390cb49befb 100644 (file)
@@ -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;