Skip to contentSkip to conversation

PCI: add missing KERN_* constants to printks

PATCH Superseded Frank Seidel 7 participants 16 messages Feb 5, 2009 – Feb 13, 2009 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: add missing KERN_* constants to printks

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp_core.c |    6 +++---
 drivers/pci/hotplug/shpchp_core.c |    4 ++--
 drivers/pci/intel-iommu.c         |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/pci/hotplug/pciehp_core.c +3 -3
@@ -526,16 +526,16 @@ static int __init pcied_init(void)
 
 	pciehp_firmware_init();
 	retval = pcie_port_service_register(&hpdriver_portdrv);
- 	dbg("pcie_port_service_register = %d\n", retval);
+	dbg(KERN_DEBUG "pcie_port_service_register = %d\n", retval);
   	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
  	if (retval)
-		dbg("Failure to register service\n");
+		dbg(KERN_DEBUG "Failure to register service\n");
 	return retval;
 }
 
 static void __exit pcied_cleanup(void)
 {
-	dbg("unload_pciehpd()\n");
+	dbg(KERN_DEBUG "unload_pciehpd()\n");
 	pcie_port_service_unregister(&hpdriver_portdrv);
 	info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
 }
drivers/pci/hotplug/shpchp_core.c +2 -2
@@ -396,14 +396,14 @@ static int __init shpcd_init(void)
 	int retval = 0;
 
 	retval = pci_register_driver(&shpc_driver);
-	dbg("%s: pci_register_driver = %d\n", __func__, retval);
+	dbg(KERN_DEBUG "%s: pci_register_driver = %d\n", __func__, retval);
 	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
 	return retval;
 }
 
 static void __exit shpcd_cleanup(void)
 {
-	dbg("unload_shpchpd()\n");
+	dbg(KERN_DEBUG "unload_shpchpd()\n");
 	pci_unregister_driver(&shpc_driver);
 	info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
 }
drivers/pci/intel-iommu.c +1 -1
@@ -1960,7 +1960,7 @@ static inline void iommu_prepare_isa(voi
 	ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
 
 	if (ret)
-		printk("IOMMU: Failed to create 0-64M identity map, "
+		printk(KERN_ERR "IOMMU: Failed to create 0-64M identity map, "
 			"floppy might not work\n");
 
 }
#1 lore raw
Quoted 16 lines · Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp_core.c |    6 +++---
 drivers/pci/hotplug/shpchp_core.c |    4 ++--
 drivers/pci/intel-iommu.c         |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

drivers/pci/hotplug/pciehp_core.c static int __init pcied_init(void) · line 529

Quoted 5 lines
drivers/pci/hotplug/pciehp_core.c +1 -1
@@ -526,16 +526,16 @@ static int __init pcied_init(void)
 
 	pciehp_firmware_init();
 	retval = pcie_port_service_register(&hpdriver_portdrv);
- 	dbg("pcie_port_service_register = %d\n", retval);
+	dbg(KERN_DEBUG "pcie_port_service_register = %d\n", retval);

dbg() already sets the KERN_ level, right?

thanks,

greg k-h

#2 lore raw
Quoted 5 lines · Greg KH

drivers/pci/hotplug/pciehp_core.c static int __init pcied_init(void) · line 529

Quoted 2 lines · Frank Seidel
drivers/pci/hotplug/pciehp_core.c +1 -1
- 	dbg("pcie_port_service_register = %d\n", retval);
+	dbg(KERN_DEBUG "pcie_port_service_register = %d\n", retval);

dbg() already sets the KERN_ level, right?

No, its definition in pciehp.h is:

#define dbg(format, arg...)                                             \
        do {                                                            \
                if (pciehp_debug)                                       \
                        printk("%s: " format, MY_NAME , ## arg);        \
        } while (0)
#3 lore raw
Quoted 2 lines · Frank Seidel

No, its definition in pciehp.h is:
...

P.S.: I also thought about changing it directly inside the macro. Would you prefer that?
I decided against that because those printk-macros often still use the loglevel prefix and i didn't want to change semantics of the macro (eventhough one would of course suspect it to set KERN_DEBUG).

Thanks,
Frank

#4 lore raw
Quoted 10 lines · Frank Seidel
Quoted 2 lines · Frank Seidel

No, its definition in pciehp.h is:
...

P.S.: I also thought about changing it directly inside the macro. Would you prefer that?
I decided against that because those printk-macros often still use the loglevel prefix and i didn't want to change semantics of the macro (eventhough one would of course suspect it to set KERN_DEBUG).

I think that any macro called "dbg" should set the level automatically, as that is the way that the other macros in the kernel with this name do things...

thanks,

greg k-h

#5 lore raw
Quoted 3 lines · Greg KH

I think that any macro called "dbg" should set the level automatically, as that is the way that the other macros in the kernel with this name do things...

I fully agree. So i reworked the patch which makes it even more fit to its $SUBJECT.

Thanks,
Frank

#6 lore raw

PATCH v2 1/1 PCI: add missing KERN_* constants to printks

In reply to Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp.h |    3 ++-
 drivers/pci/hotplug/shpchp.h |    3 ++-
 drivers/pci/intel-iommu.c    |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/pci/intel-iommu.c +1 -1
@@ -1960,7 +1960,7 @@ static inline void iommu_prepare_isa(voi
 	ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
 
 	if (ret)
-		printk("IOMMU: Failed to create 0-64M identity map, "
+		printk(KERN_ERR "IOMMU: Failed to create 0-64M identity map, "
 			"floppy might not work\n");
 
 }
drivers/pci/hotplug/pciehp.h +2 -1
@@ -48,7 +48,8 @@ extern struct workqueue_struct *pciehp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (pciehp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
drivers/pci/hotplug/shpchp.h +2 -1
@@ -50,7 +50,8 @@ extern struct workqueue_struct *shpchp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (shpchp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
#7 lore raw

Hi,

I have some minor comments below.

Frank Seidel wrote:
(snip.)

drivers/pci/hotplug/pciehp.h extern struct workqueue_struct *pciehp_w · line 53

Quoted 10 lines
drivers/pci/hotplug/pciehp.h +2 -1
@@ -48,7 +48,8 @@ extern struct workqueue_struct *pciehp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (pciehp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)

How about below. I think we can write printk in one line.

#define dbg(format, arg...) \

do {									\
	if (pciehp_debug)						\
		printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg);	\
} while (0)

drivers/pci/hotplug/shpchp.h extern struct workqueue_struct *shpchp_w · line 55

Quoted 12 lines
drivers/pci/hotplug/pciehp.h +0 -0
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
drivers/pci/hotplug/shpchp.h +2 -1
@@ -50,7 +50,8 @@ extern struct workqueue_struct *shpchp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (shpchp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)

Ditto.

Thanks,
Kenji Kaneshige

#8 lore raw
Quoted 7 lines · Kenji Kaneshige

How about below. I think we can write printk in one line.

#define dbg(format, arg...) \

do {									\
	if (pciehp_debug)						\
		printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg);	\
} while (0)

I wanted to keep the change as simple as possible and didn't wanna play with surrounding indentation. But yes, if thats preferred... i gonna change the patch to this. Shall i?

Thanks,
Frank

#9 lore raw
Quoted 9 lines · Frank Seidel
Quoted 7 lines · Kenji Kaneshige

How about below. I think we can write printk in one line.

#define dbg(format, arg...) \

do {									\
	if (pciehp_debug)						\
		printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg);	\
} while (0)
Quoted 4 lines

I wanted to keep the change as simple as possible and didn't wanna play with surrounding indentation. But yes, if thats preferred... i gonna change the patch to this. Shall i?

I prefer it. I don't think it's so complex. And I can review and test shpchp/pciehp part of your patch on my machine.

Thanks,
Kenji Kaneshige

#10 lore raw
In reply to Frank Seidel
Quoted 27 lines · Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp.h |    3 ++-
 drivers/pci/hotplug/shpchp.h |    3 ++-
 drivers/pci/intel-iommu.c    |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/pci/intel-iommu.c +1 -1
@@ -1960,7 +1960,7 @@ static inline void iommu_prepare_isa(voi
 	ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
 
 	if (ret)
-		printk("IOMMU: Failed to create 0-64M identity map, "
+		printk(KERN_ERR "IOMMU: Failed to create 0-64M identity map, "
 			"floppy might not work\n");
 
 }

drivers/pci/hotplug/pciehp.h extern struct workqueue_struct *pciehp_w · line 55

Quoted 9 lines
drivers/pci/hotplug/pciehp.h +2 -1
@@ -48,7 +48,8 @@ extern struct workqueue_struct *pciehp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (pciehp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)

Why didn't you retouch the following dev_printk ?

#define ctrl_dbg(ctrl, format, arg...)                                  \
        do {                                                            \
                if (pciehp_debug)                                       \
                        dev_printk(, &ctrl->pcie->device,               \
                                        format, ## arg);                \
        } while (0)
Quoted 20 lines
drivers/pci/hotplug/shpchp.h +2 -2
@@ -50,7 +50,8 @@ extern struct workqueue_struct *shpchp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (shpchp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best regards,
Taku Izumi
#11 lore raw
Quoted 1 line · Taku Izumi

Why didn't you retouch the following dev_printk ?

Yes, good question. Thanks for the pointer.. that should then of course also be changed.

Thanks,
Frank

#12 lore raw
In reply to Taku Izumi
Quoted 40 lines · Taku Izumi
Quoted 27 lines · Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp.h |    3 ++-
 drivers/pci/hotplug/shpchp.h |    3 ++-
 drivers/pci/intel-iommu.c    |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/pci/intel-iommu.c +1 -1
@@ -1960,7 +1960,7 @@ static inline void iommu_prepare_isa(voi
 	ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
 
 	if (ret)
-		printk("IOMMU: Failed to create 0-64M identity map, "
+		printk(KERN_ERR "IOMMU: Failed to create 0-64M identity map, "
 			"floppy might not work\n");
 
 }

drivers/pci/hotplug/pciehp.h extern struct workqueue_struct *pciehp_w · line 55

Quoted 9 lines
drivers/pci/hotplug/pciehp.h +2 -1
@@ -48,7 +48,8 @@ extern struct workqueue_struct *pciehp_w
 #define dbg(format, arg...)						\
 	do {								\
 		if (pciehp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
+			printk(KERN_DEBUG "%s: " format, MY_NAME ,	\
+			       ## arg);					\
 	} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)

Why didn't you retouch the following dev_printk ?

Quoted 6 lines
#define ctrl_dbg(ctrl, format, arg...)                                  \
        do {                                                            \
                if (pciehp_debug)                                       \
                        dev_printk(, &ctrl->pcie->device,               \
                                        format, ## arg);                \
        } while (0)

That's almost the same as dev_dbg(), except for the test for pciehp_debug, for which you can probably get an alternative using CONFIG_DYNAMIC_PRINTK_DEBUG.

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010

#13 lore raw

PATCH v3 1/1 PCI: add missing KERN_* constants to printks

In reply to Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp.h |   10 +++++-----
 drivers/pci/hotplug/shpchp.h |   10 +++++-----
 drivers/pci/intel-iommu.c    |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/pci/intel-iommu.c +1 -1
@@ -1960,7 +1960,7 @@ static inline void iommu_prepare_isa(voi
 	ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
 
 	if (ret)
-		printk("IOMMU: Failed to create 0-64M identity map, "
+		printk(KERN_ERR "IOMMU: Failed to create 0-64M identity map, "
 			"floppy might not work\n");
 
 }
drivers/pci/hotplug/pciehp.h +5 -5
@@ -46,10 +46,10 @@ extern int pciehp_force;
 extern struct workqueue_struct *pciehp_wq;
 
 #define dbg(format, arg...)						\
-	do {								\
-		if (pciehp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
-	} while (0)
+do {									\
+	if (pciehp_debug)						\
+		printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg);	\
+} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
 #define info(format, arg...)						\
@@ -60,7 +60,7 @@ extern struct workqueue_struct *pciehp_w
 #define ctrl_dbg(ctrl, format, arg...)					\
 	do {								\
 		if (pciehp_debug)					\
-			dev_printk(, &ctrl->pcie->device,		\
+			dev_printk(KERN_DEBUG, &ctrl->pcie->device,	\
 					format, ## arg);		\
 	} while (0)
 #define ctrl_err(ctrl, format, arg...)					\
drivers/pci/hotplug/shpchp.h +5 -5
@@ -48,10 +48,10 @@ extern int shpchp_debug;
 extern struct workqueue_struct *shpchp_wq;
 
 #define dbg(format, arg...)						\
-	do {								\
-		if (shpchp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
-	} while (0)
+do {									\
+	if (shpchp_debug)						\
+		printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg);	\
+} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
 #define info(format, arg...)						\
@@ -62,7 +62,7 @@ extern struct workqueue_struct *shpchp_w
 #define ctrl_dbg(ctrl, format, arg...)					\
 	do {								\
 		if (shpchp_debug)					\
-			dev_printk(, &ctrl->pci_dev->dev,		\
+			dev_printk(KERN_DEBUG, &ctrl->pci_dev->dev,	\
 					format, ## arg);		\
 	} while (0)
 #define ctrl_err(ctrl, format, arg...)					\
Reviewed-by Tested-by on v3 1/1
#14 lore raw

Thank you for the updated patch.

Thanks,
Kenji Kaneshige

Quoted 82 lines · Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

---
 drivers/pci/hotplug/pciehp.h |   10 +++++-----
 drivers/pci/hotplug/shpchp.h |   10 +++++-----
 drivers/pci/intel-iommu.c    |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/pci/intel-iommu.c +1 -1
@@ -1960,7 +1960,7 @@ static inline void iommu_prepare_isa(voi
 	ret = iommu_prepare_identity_map(pdev, 0, 16*1024*1024);
 
 	if (ret)
-		printk("IOMMU: Failed to create 0-64M identity map, "
+		printk(KERN_ERR "IOMMU: Failed to create 0-64M identity map, "
 			"floppy might not work\n");
 
 }
drivers/pci/hotplug/pciehp.h +5 -5
@@ -46,10 +46,10 @@ extern int pciehp_force;
 extern struct workqueue_struct *pciehp_wq;
 
 #define dbg(format, arg...)						\
-	do {								\
-		if (pciehp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
-	} while (0)
+do {									\
+	if (pciehp_debug)						\
+		printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg);	\
+} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
 #define info(format, arg...)						\
@@ -60,7 +60,7 @@ extern struct workqueue_struct *pciehp_w
 #define ctrl_dbg(ctrl, format, arg...)					\
 	do {								\
 		if (pciehp_debug)					\
-			dev_printk(, &ctrl->pcie->device,		\
+			dev_printk(KERN_DEBUG, &ctrl->pcie->device,	\
 					format, ## arg);		\
 	} while (0)
 #define ctrl_err(ctrl, format, arg...)					\
drivers/pci/hotplug/shpchp.h +5 -6
@@ -48,10 +48,10 @@ extern int shpchp_debug;
 extern struct workqueue_struct *shpchp_wq;
 
 #define dbg(format, arg...)						\
-	do {								\
-		if (shpchp_debug)					\
-			printk("%s: " format, MY_NAME , ## arg);	\
-	} while (0)
+do {									\
+	if (shpchp_debug)						\
+		printk(KERN_DEBUG "%s: " format, MY_NAME , ## arg);	\
+} while (0)
 #define err(format, arg...)						\
 	printk(KERN_ERR "%s: " format, MY_NAME , ## arg)
 #define info(format, arg...)						\
@@ -62,7 +62,7 @@ extern struct workqueue_struct *shpchp_w
 #define ctrl_dbg(ctrl, format, arg...)					\
 	do {								\
 		if (shpchp_debug)					\
-			dev_printk(, &ctrl->pci_dev->dev,		\
+			dev_printk(KERN_DEBUG, &ctrl->pci_dev->dev,	\
 					format, ## arg);		\
 	} while (0)
 #define ctrl_err(ctrl, format, arg...)					\
--

To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#15 lore raw
In reply to Frank Seidel
Quoted 7 lines · Frank Seidel

From: Frank Seidel <[email protected]>

According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing pieces here for the pci subsystem.

Applied to my linux-next branch, thanks Frank.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center