[1/1] cdx: Rename MCDI_LOGGING to CDX_MCDI_LOGGING

Message ID 20230517084404.187463-1-abhijit.gangurde@amd.com
State New
Headers
Series [1/1] cdx: Rename MCDI_LOGGING to CDX_MCDI_LOGGING |

Commit Message

Gangurde, Abhijit May 17, 2023, 8:44 a.m. UTC
  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.

Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/cdx/controller/Kconfig |  2 +-
 drivers/cdx/controller/mcdi.c  | 16 ++++++++--------
 drivers/cdx/controller/mcdi.h  |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)
  

Comments

Greg KH May 17, 2023, 8:53 a.m. UTC | #1
On Wed, May 17, 2023 at 02:14:03PM +0530, Abhijit Gangurde wrote:
> 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.
> 
> Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
> Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  drivers/cdx/controller/Kconfig |  2 +-
>  drivers/cdx/controller/mcdi.c  | 16 ++++++++--------
>  drivers/cdx/controller/mcdi.h  |  2 +-
>  3 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/cdx/controller/Kconfig b/drivers/cdx/controller/Kconfig
> index c3e3b9ff8dfe..e7014e9819ea 100644
> --- a/drivers/cdx/controller/Kconfig
> +++ b/drivers/cdx/controller/Kconfig
> @@ -18,7 +18,7 @@ config CDX_CONTROLLER
>  
>  	  If unsure, say N.
>  
> -config MCDI_LOGGING
> +config CDX_MCDI_LOGGING

This is fine, but:

>  	bool "MCDI Logging for the CDX controller"
>  	depends on CDX_CONTROLLER
>  	help
> diff --git a/drivers/cdx/controller/mcdi.c b/drivers/cdx/controller/mcdi.c
> index a211a2ca762e..3a1fbc3d409e 100644
> --- a/drivers/cdx/controller/mcdi.c
> +++ b/drivers/cdx/controller/mcdi.c
> @@ -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;

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
  
Gangurde, Abhijit May 24, 2023, 7:07 a.m. UTC | #2
Hi Greg,

<snip>
> >
> > -#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.
> 

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

> thanks,
> 
> greg k-h
  

Patch

diff --git a/drivers/cdx/controller/Kconfig b/drivers/cdx/controller/Kconfig
index c3e3b9ff8dfe..e7014e9819ea 100644
--- a/drivers/cdx/controller/Kconfig
+++ b/drivers/cdx/controller/Kconfig
@@ -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
diff --git a/drivers/cdx/controller/mcdi.c b/drivers/cdx/controller/mcdi.c
index a211a2ca762e..3a1fbc3d409e 100644
--- a/drivers/cdx/controller/mcdi.c
+++ b/drivers/cdx/controller/mcdi.c
@@ -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;
diff --git a/drivers/cdx/controller/mcdi.h b/drivers/cdx/controller/mcdi.h
index 0bfbeab04e43..c881f3ecd8a9 100644
--- a/drivers/cdx/controller/mcdi.h
+++ b/drivers/cdx/controller/mcdi.h
@@ -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