|
|
2a1b01 |
From 284886fbb4a85103cd82d061ebe4d1c93730b783 Mon Sep 17 00:00:00 2001
|
|
|
2a1b01 |
From: Ido Schimmel <idosch@nvidia.com>
|
|
|
2a1b01 |
Date: Tue, 12 Oct 2021 16:25:15 +0300
|
|
|
2a1b01 |
Subject: [PATCH 16/35] cmis: Consolidate code between IOCTL and netlink paths
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Now that both the netlink and IOCTL paths use the same memory map
|
|
|
2a1b01 |
structure for parsing, the code can be easily consolidated.
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
|
2a1b01 |
---
|
|
|
2a1b01 |
cmis.c | 38 ++++++++++++++++----------------------
|
|
|
2a1b01 |
1 file changed, 16 insertions(+), 22 deletions(-)
|
|
|
2a1b01 |
|
|
|
2a1b01 |
diff --git a/cmis.c b/cmis.c
|
|
|
2a1b01 |
index 2e01446b2315..eb7791dd59df 100644
|
|
|
2a1b01 |
--- a/cmis.c
|
|
|
2a1b01 |
+++ b/cmis.c
|
|
|
2a1b01 |
@@ -340,6 +340,20 @@ static void cmis_show_vendor_info(const struct cmis_memory_map *map)
|
|
|
2a1b01 |
CMIS_CLEI_END_OFFSET, "CLEI code");
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
+static void cmis_show_all_common(const struct cmis_memory_map *map)
|
|
|
2a1b01 |
+{
|
|
|
2a1b01 |
+ cmis_show_identifier(map);
|
|
|
2a1b01 |
+ cmis_show_power_info(map);
|
|
|
2a1b01 |
+ cmis_show_connector(map);
|
|
|
2a1b01 |
+ cmis_show_cbl_asm_len(map);
|
|
|
2a1b01 |
+ cmis_show_sig_integrity(map);
|
|
|
2a1b01 |
+ cmis_show_mit_compliance(map);
|
|
|
2a1b01 |
+ cmis_show_mod_lvl_monitors(map);
|
|
|
2a1b01 |
+ cmis_show_link_len(map);
|
|
|
2a1b01 |
+ cmis_show_vendor_info(map);
|
|
|
2a1b01 |
+ cmis_show_rev_compliance(map);
|
|
|
2a1b01 |
+}
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
static void cmis_memory_map_init_buf(struct cmis_memory_map *map,
|
|
|
2a1b01 |
const __u8 *id)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
@@ -367,17 +381,7 @@ void cmis_show_all_ioctl(const __u8 *id)
|
|
|
2a1b01 |
struct cmis_memory_map map = {};
|
|
|
2a1b01 |
|
|
|
2a1b01 |
cmis_memory_map_init_buf(&map, id);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
- cmis_show_identifier(&map);
|
|
|
2a1b01 |
- cmis_show_power_info(&map);
|
|
|
2a1b01 |
- cmis_show_connector(&map);
|
|
|
2a1b01 |
- cmis_show_cbl_asm_len(&map);
|
|
|
2a1b01 |
- cmis_show_sig_integrity(&map);
|
|
|
2a1b01 |
- cmis_show_mit_compliance(&map);
|
|
|
2a1b01 |
- cmis_show_mod_lvl_monitors(&map);
|
|
|
2a1b01 |
- cmis_show_link_len(&map);
|
|
|
2a1b01 |
- cmis_show_vendor_info(&map);
|
|
|
2a1b01 |
- cmis_show_rev_compliance(&map);
|
|
|
2a1b01 |
+ cmis_show_all_common(&map);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
static void
|
|
|
2a1b01 |
@@ -411,15 +415,5 @@ void cmis_show_all_nl(const struct ethtool_module_eeprom *page_zero,
|
|
|
2a1b01 |
struct cmis_memory_map map = {};
|
|
|
2a1b01 |
|
|
|
2a1b01 |
cmis_memory_map_init_pages(&map, page_zero, page_one);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
- cmis_show_identifier(&map);
|
|
|
2a1b01 |
- cmis_show_power_info(&map);
|
|
|
2a1b01 |
- cmis_show_connector(&map);
|
|
|
2a1b01 |
- cmis_show_cbl_asm_len(&map);
|
|
|
2a1b01 |
- cmis_show_sig_integrity(&map);
|
|
|
2a1b01 |
- cmis_show_mit_compliance(&map);
|
|
|
2a1b01 |
- cmis_show_mod_lvl_monitors(&map);
|
|
|
2a1b01 |
- cmis_show_link_len(&map);
|
|
|
2a1b01 |
- cmis_show_vendor_info(&map);
|
|
|
2a1b01 |
- cmis_show_rev_compliance(&map);
|
|
|
2a1b01 |
+ cmis_show_all_common(&map);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
--
|
|
|
2a1b01 |
2.35.1
|
|
|
2a1b01 |
|