Skip to contentSkip to conversation

cdx: Rename MCDI_LOGGING to CDX_MCDI_LOGGING

PATCH Superseded Abhijit Gangurde 2 participants 3 messages May 17, 2023 – May 24, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cdx: Rename MCDI_LOGGING to CDX_MCDI_LOGGING

MCDI_LOGGING is too generic considering other MCDI users SFC_MCDI_LOGGING and SFC_SIENA_MCDI_LOGGING. Rename it to CDX_MCDI_LOGGING makes it more domain specific.

---
 drivers/cdx/controller/Kconfig |  2 +-
 drivers/cdx/controller/mcdi.c  | 16 ++++++++--------
 drivers/cdx/controller/mcdi.h  |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/cdx/controller/Kconfig +1 -1
index c3e3b9ff8dfe..e7014e9819ea 100644
@@ -18,7 +18,7 @@ config CDX_CONTROLLER
 
 	  If unsure, say N.
 
-config MCDI_LOGGING
+config CDX_MCDI_LOGGING
 	bool "MCDI Logging for the CDX controller"
 	depends on CDX_CONTROLLER
 	help
drivers/cdx/controller/mcdi.c +8 -8
index a211a2ca762e..3a1fbc3d409e 100644
@@ -31,7 +31,7 @@ struct cdx_mcdi_copy_buffer {
 	struct cdx_dword buffer[DIV_ROUND_UP(MCDI_CTL_SDU_LEN_MAX, 4)];
 };
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 #define LOG_LINE_MAX		(1024 - 32)
 #endif
 
@@ -119,7 +119,7 @@ int cdx_mcdi_init(struct cdx_mcdi *cdx)
 	mcdi = cdx_mcdi_if(cdx);
 	mcdi->cdx = cdx;
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	mcdi->logging_buffer = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
 	if (!mcdi->logging_buffer)
 		goto fail2;
@@ -136,7 +136,7 @@ int cdx_mcdi_init(struct cdx_mcdi *cdx)
 
 	return 0;
 fail3:
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	kfree(mcdi->logging_buffer);
 fail2:
 #endif
@@ -156,7 +156,7 @@ void cdx_mcdi_finish(struct cdx_mcdi *cdx)
 
 	cdx_mcdi_wait_for_cleanup(cdx);
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	kfree(mcdi->logging_buffer);
 #endif
 
@@ -246,13 +246,13 @@ static void cdx_mcdi_send_request(struct cdx_mcdi *cdx,
 	size_t hdr_len;
 	bool not_epoch;
 	u32 xflags;
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	char *buf;
 #endif
 
 	if (!mcdi)
 		return;
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	buf = mcdi->logging_buffer; /* page-sized */
 #endif
 
@@ -281,7 +281,7 @@ static void cdx_mcdi_send_request(struct cdx_mcdi *cdx,
 			     MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM);
 	hdr_len = 8;
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	if (!WARN_ON_ONCE(!buf)) {
 		const struct cdx_dword *frags[] = { hdr, inbuf };
 		const size_t frag_len[] = { hdr_len, round_up(inlen, 4) };
@@ -700,7 +700,7 @@ static bool cdx_mcdi_complete_cmd(struct cdx_mcdi_iface *mcdi,
 		resp_data_len = 0;
 	}
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	if (!WARN_ON_ONCE(!mcdi->logging_buffer)) {
 		char *log = mcdi->logging_buffer;
 		int i, bytes = 0;
drivers/cdx/controller/mcdi.h +1 -1
index 0bfbeab04e43..c881f3ecd8a9 100644
@@ -170,7 +170,7 @@ struct cdx_mcdi_iface {
 	enum cdx_mcdi_mode mode;
 	u8 prev_seq;
 	bool new_epoch;
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	bool logging_enabled;
 	char *logging_buffer;
 #endif
Signature · 1 line
2.25.1
#1 lore raw
Quoted 17 lines · Abhijit Gangurde

MCDI_LOGGING is too generic considering other MCDI users SFC_MCDI_LOGGING and SFC_SIENA_MCDI_LOGGING. Rename it to CDX_MCDI_LOGGING makes it more domain specific.

---
 drivers/cdx/controller/Kconfig |  2 +-
 drivers/cdx/controller/mcdi.c  | 16 ++++++++--------
 drivers/cdx/controller/mcdi.h  |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/cdx/controller/Kconfig +0 -0
index c3e3b9ff8dfe..e7014e9819ea 100644

drivers/cdx/controller/Kconfig config CDX_CONTROLLER · line 21

Quoted 5 lines
drivers/cdx/controller/Kconfig +1 -1
@@ -18,7 +18,7 @@ config CDX_CONTROLLER
 
 	  If unsure, say N.
 
-config MCDI_LOGGING
+config CDX_MCDI_LOGGING

This is fine, but:

Quoted 17 lines
drivers/cdx/controller/Kconfig +0 -0
 	bool "MCDI Logging for the CDX controller"
 	depends on CDX_CONTROLLER
 	help
drivers/cdx/controller/mcdi.c +1 -1
index a211a2ca762e..3a1fbc3d409e 100644
@@ -31,7 +31,7 @@ struct cdx_mcdi_copy_buffer {
 	struct cdx_dword buffer[DIV_ROUND_UP(MCDI_CTL_SDU_LEN_MAX, 4)];
 };
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 #define LOG_LINE_MAX		(1024 - 32)
 #endif
 

drivers/cdx/controller/mcdi.c int cdx_mcdi_init(struct cdx_mcdi *cdx) · line 125

Quoted 8 lines
drivers/cdx/controller/mcdi.c +1 -1
@@ -119,7 +119,7 @@ int cdx_mcdi_init(struct cdx_mcdi *cdx)
 	mcdi = cdx_mcdi_if(cdx);
 	mcdi->cdx = cdx;
 
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
 	mcdi->logging_buffer = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
 	if (!mcdi->logging_buffer)
 		goto fail2;

This mess of #ifdef in the .c files is not ok.

Please move all of this "logging" stuff out into proper .h definitions so that it's not in the .c code at all.

thanks,

greg k-h

#2 lore raw

Hi Greg,

<snip>

Quoted 9 lines

drivers/cdx/controller/mcdi.c int cdx_mcdi_init(struct cdx_mcdi *cdx) · line 125

Quoted 6 lines
drivers/cdx/controller/mcdi.c +1 -1
-#ifdef CONFIG_MCDI_LOGGING
+#ifdef CONFIG_CDX_MCDI_LOGGING
      mcdi->logging_buffer = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
      if (!mcdi->logging_buffer)
              goto fail2;

This mess of #ifdef in the .c files is not ok.

Quoted 3 lines

Please move all of this "logging" stuff out into proper .h definitions so that it's not in the .c code at all.

Sure, will cleanup the #ifdefs in c file.
Will also update logging to be controlled by sysfs in next spin.

Quoted 3 lines

thanks,

greg k-h