diff mbox series

[5/5] block: switch ldm partition code to use pr_xxx() functions

Message ID 20230808135702.628588-6-dlemoal@kernel.org (mailing list archive)
State New, archived
Headers show
Series Some minor cleanups | expand

Commit Message

Damien Le Moal Aug. 8, 2023, 1:57 p.m. UTC
Modify the ldm partition code to use the regular pr_info(), pr_err() etc
functions instead of using printk(). With this change, the function
_ldm_printk() is not necessary and removed. The special LDM_DEBUG
configuration option is also removed as regular dynamic debug control
can be used to turn on or off the debug messages. References to this
configuration option is removed from the documentation and from the m68k
defconfig.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 Documentation/admin-guide/ldm.rst |  7 +++----
 arch/m68k/configs/virt_defconfig  |  1 -
 block/partitions/Kconfig          | 10 ---------
 block/partitions/ldm.c            | 35 +++++++------------------------
 4 files changed, 10 insertions(+), 43 deletions(-)

Comments

Chaitanya Kulkarni Aug. 9, 2023, 2:08 a.m. UTC | #1
On 8/8/2023 6:57 AM, Damien Le Moal wrote:
> Modify the ldm partition code to use the regular pr_info(), pr_err() etc
> functions instead of using printk(). With this change, the function
> _ldm_printk() is not necessary and removed. The special LDM_DEBUG
> configuration option is also removed as regular dynamic debug control
> can be used to turn on or off the debug messages. References to this
> configuration option is removed from the documentation and from the m68k
> defconfig.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
Hannes Reinecke Aug. 9, 2023, 6:10 a.m. UTC | #2
On 8/8/23 15:57, Damien Le Moal wrote:
> Modify the ldm partition code to use the regular pr_info(), pr_err() etc
> functions instead of using printk(). With this change, the function
> _ldm_printk() is not necessary and removed. The special LDM_DEBUG
> configuration option is also removed as regular dynamic debug control
> can be used to turn on or off the debug messages. References to this
> configuration option is removed from the documentation and from the m68k
> defconfig.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>   Documentation/admin-guide/ldm.rst |  7 +++----
>   arch/m68k/configs/virt_defconfig  |  1 -
>   block/partitions/Kconfig          | 10 ---------
>   block/partitions/ldm.c            | 35 +++++++------------------------
>   4 files changed, 10 insertions(+), 43 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Johannes Thumshirn Aug. 15, 2023, 10:06 a.m. UTC | #3
On 08.08.23 19:56, Damien Le Moal wrote:
> +#define ldm_debug(f, a...) pr_debug("%s(): " f, __func__, ##a) +#define 
> ldm_crit(f, a...) pr_crit("%s(): " f, __func__, ##a) +#define 
> ldm_error(f, a...) pr_err("%s(): " f, __func__, ##a) +#define 
> ldm_info(f, a...) pr_info("%s(): " f, __func__, ##a)

Is there any value in keeping these ldm_XXX() macros around, other than 
printing the function name?

I'd just get rid of them as well and replace with the according pr_XXX() 
calls.
Damien Le Moal Aug. 15, 2023, 12:41 p.m. UTC | #4
On 8/15/23 19:06, Johannes Thumshirn wrote:
> On 08.08.23 19:56, Damien Le Moal wrote:
>> +#define ldm_debug(f, a...) pr_debug("%s(): " f, __func__, ##a) +#define 
>> ldm_crit(f, a...) pr_crit("%s(): " f, __func__, ##a) +#define 
>> ldm_error(f, a...) pr_err("%s(): " f, __func__, ##a) +#define 
>> ldm_info(f, a...) pr_info("%s(): " f, __func__, ##a)
> 
> Is there any value in keeping these ldm_XXX() macros around, other than 
> printing the function name?

You named it: I didn't want to change the messages.
I do not mind simplifying these by removing the function name, but if we do not,
then the macros actually simplify the print calls.

> 
> I'd just get rid of them as well and replace with the according pr_XXX() 
> calls.
diff mbox series

Patch

diff --git a/Documentation/admin-guide/ldm.rst b/Documentation/admin-guide/ldm.rst
index 12c571368e73..e7b69a03e938 100644
--- a/Documentation/admin-guide/ldm.rst
+++ b/Documentation/admin-guide/ldm.rst
@@ -80,10 +80,9 @@  To enable LDM, choose the following two options:
   - "Advanced partition selection" CONFIG_PARTITION_ADVANCED
   - "Windows Logical Disk Manager (Dynamic Disk) support" CONFIG_LDM_PARTITION
 
-If you believe the driver isn't working as it should, you can enable the extra
-debugging code.  This will produce a LOT of output.  The option is:
-
-  - "Windows LDM extra logging" CONFIG_LDM_DEBUG
+If you believe the driver isn't working as it should, you can enable extra
+debugging messages using dynamic debug.  This will produce a LOT of output.
+See Documentation/admin-guide/dynamic-debug-howto.rst for details.
 
 N.B. The partition code cannot be compiled as a module.
 
diff --git a/arch/m68k/configs/virt_defconfig b/arch/m68k/configs/virt_defconfig
index 311b57e73316..94dd334da74f 100644
--- a/arch/m68k/configs/virt_defconfig
+++ b/arch/m68k/configs/virt_defconfig
@@ -19,7 +19,6 @@  CONFIG_MINIX_SUBPARTITION=y
 CONFIG_SOLARIS_X86_PARTITION=y
 CONFIG_UNIXWARE_DISKLABEL=y
 CONFIG_LDM_PARTITION=y
-CONFIG_LDM_DEBUG=y
 CONFIG_SUN_PARTITION=y
 CONFIG_SYSV68_PARTITION=y
 CONFIG_NET=y
diff --git a/block/partitions/Kconfig b/block/partitions/Kconfig
index 7aff4eb81c60..71e4461fc35d 100644
--- a/block/partitions/Kconfig
+++ b/block/partitions/Kconfig
@@ -200,16 +200,6 @@  config LDM_PARTITION
 
 	  If unsure, say N.
 
-config LDM_DEBUG
-	bool "Windows LDM extra logging"
-	depends on LDM_PARTITION
-	help
-	  Say Y here if you would like LDM to log verbosely.  This could be
-	  helpful if the driver doesn't work as expected and you'd like to
-	  report a bug.
-
-	  If unsure, say N.
-
 config SGI_PARTITION
 	bool "SGI partition support" if PARTITION_ADVANCED
 	default y if DEFAULT_SGI_PARTITION
diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
index 38e58960ae03..691908c8c8f3 100644
--- a/block/partitions/ldm.c
+++ b/block/partitions/ldm.c
@@ -19,39 +19,18 @@ 
 #include "ldm.h"
 #include "check.h"
 
+#undef pr_fmt
+#define pr_fmt(fmt) "partition: ldm: " fmt
+
 /*
  * ldm_debug/info/error/crit - Output an error message
  * @f:    A printf format string containing the message
  * @...:  Variables to substitute into @f
- *
- * ldm_debug() writes a DEBUG level message to the syslog but only if the
- * driver was compiled with debug enabled. Otherwise, the call turns into a NOP.
  */
-#ifndef CONFIG_LDM_DEBUG
-#define ldm_debug(...)	do {} while (0)
-#else
-#define ldm_debug(f, a...) _ldm_printk (KERN_DEBUG, __func__, f, ##a)
-#endif
-
-#define ldm_crit(f, a...)  _ldm_printk (KERN_CRIT,  __func__, f, ##a)
-#define ldm_error(f, a...) _ldm_printk (KERN_ERR,   __func__, f, ##a)
-#define ldm_info(f, a...)  _ldm_printk (KERN_INFO,  __func__, f, ##a)
-
-static __printf(3, 4)
-void _ldm_printk(const char *level, const char *function, const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start (args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
-
-	printk("%s%s(): %pV\n", level, function, &vaf);
-
-	va_end(args);
-}
+#define ldm_debug(f, a...) pr_debug("%s(): " f, __func__, ##a)
+#define ldm_crit(f, a...)  pr_crit("%s(): " f, __func__, ##a)
+#define ldm_error(f, a...) pr_err("%s(): " f, __func__, ##a)
+#define ldm_info(f, a...)  pr_info("%s(): " f, __func__, ##a)
 
 /**
  * ldm_parse_privhead - Read the LDM Database PRIVHEAD structure