Skip to contentSkip to conversation

bcma: use bcma_debug and pr_cont in MIPS driver

PATCH In review Rafał Miłecki 5 participants 6 messages Oct 16, 2017 – Oct 19, 2017 Broadcom specific amba driver (bcma)

lore
Share & tools
lore

Rafał Miłecki

author maintainer
#0 lore raw

PATCH 1/1 bcma: use bcma_debug and pr_cont in MIPS driver

From: Rafał Miłecki <[email protected]>

Using bcma_debug gives a device-specific prefix for messages and pr_cont is a common helper for continuing a line.

---
 drivers/bcma/driver_mips.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/bcma/driver_mips.c +4 -3
index 89af807cf29c..5904ef1aa624 100644
@@ -184,10 +184,11 @@ static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
 {
 	int i;
 	static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
-	printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
+
+	bcma_debug(dev->bus, "core 0x%04x, irq :", dev->id.id);
 	for (i = 0; i <= 6; i++)
-		printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
-	printk("\n");
+		pr_cont(" %s%s", irq_name[i], i == irq ? "*" : " ");
+	pr_cont("\n");
 }
 
 static void bcma_core_mips_dump_irq(struct bcma_bus *bus)
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Using bcma_debug gives a device-specific prefix for messages and pr_cont is a common helper for continuing a line.

Quoted 24 lines
---
 drivers/bcma/driver_mips.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/bcma/driver_mips.c +4 -3
index 89af807cf29c..5904ef1aa624 100644
@@ -184,10 +184,11 @@ static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
 {
 	int i;
 	static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
-	printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
+
+	bcma_debug(dev->bus, "core 0x%04x, irq :", dev->id.id);
 	for (i = 0; i <= 6; i++)
-		printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
-	printk("\n");
+		pr_cont(" %s%s", irq_name[i], i == irq ? "*" : " ");
+	pr_cont("\n");
 }
 
 static void bcma_core_mips_dump_irq(struct bcma_bus *bus)
#2 lore raw
Quoted 32 lines · Hauke Mehrtens
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Using bcma_debug gives a device-specific prefix for messages and pr_cont is a common helper for continuing a line.

Quoted 22 lines
---
 drivers/bcma/driver_mips.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/bcma/driver_mips.c +4 -3
index 89af807cf29c..5904ef1aa624 100644
@@ -184,10 +184,11 @@ static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
 {
 	int i;
 	static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
-	printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
+
+	bcma_debug(dev->bus, "core 0x%04x, irq :", dev->id.id);
 	for (i = 0; i <= 6; i++)
-		printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
-	printk("\n");
+		pr_cont(" %s%s", irq_name[i], i == irq ? "*" : " ");
+	pr_cont("\n");
 }
 
Quoted 2 lines

drivers/bcma/driver_mips.c static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq) · line 194

Quoted 2 lines
drivers/bcma/driver_mips.c +0 -0
 static void bcma_core_mips_dump_irq(struct bcma_bus *bus)

This isn't the same code as it depends on #define DEBUG and will not output the first line in most cases.

I'd suggest a nack.

Perhaps it'd be better to use a temporary and avoid the pr_cont uses like:

{
	int i;
	static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
	char interrupts[20];
	char *ints = interrupts;

	for (i = 0; i < ARRAY_SIZE(irq_name), i++)
		ints += sprintf(ints, " %s%c", irq_name[i], i == irq ? '*' : ' ');

	bcma_debug(dev->bus, "core 0x04x, irq: %s\n", dev->id.id, interrupts);
}
#3 lore raw
Quoted 5 lines · Joe Perches
Quoted 4 lines · Hauke Mehrtens
Quoted 3 lines · On 10/16/2017 02:54 PM, Rafa=C5=82 Mi=C5=82ecki wrote:

From: Rafa=C5=82 Mi=C5=82ecki <[email protected]>
=20
Using bcma_debug gives a device-specific prefix for messages and pr_co=

nt

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

is a common helper for continuing a line.
=20

=20

=20

Quoted 9 lines
Quoted 9 lines

drivers/bcma/driver_mips.c static void bcma_core_mips_print_irq(struct bcma=

Quoted 9 lines
---
 drivers/bcma/driver_mips.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

=20

drivers/bcma/driver_mips.c +0 -0
index 89af807cf29c..5904ef1aa624 100644
@@ -184,10 +184,11 @@ static void bcma_core_mips_print_irq(struct bcma=

_device *dev, unsigned int irq)

Quoted 3 lines
Quoted 3 lines

drivers/bcma/driver_mips.c static void bcma_core_mips_print_irq(struct bcma= · line 186

Quoted 3 lines
drivers/bcma/driver_mips.c +0 -0
 {
 	int i;
 	static const char *irq_name[] =3D {"2(S)", "3", "4", "5", "6", "D", =

"I"};

Quoted 16 lines
Quoted 4 lines
Quoted 4 lines
drivers/bcma/driver_mips.c +2 -1
-	printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
+
+	bcma_debug(dev->bus, "core 0x%04x, irq :", dev->id.id);
 	for (i =3D 0; i <=3D 6; i++)
Quoted 8 lines
Quoted 8 lines
drivers/bcma/driver_mips.c +2 -2
-		printk(" %s%s", irq_name[i], i =3D=3D irq ? "*" : " ");
-	printk("\n");
+		pr_cont(" %s%s", irq_name[i], i =3D=3D irq ? "*" : " ");
+	pr_cont("\n");
 }

=20=20
static void bcma_core_mips_dump_irq(struct bcma_bus *bus)
=20

This isn't the same code as it depends on #define DEBUG and will not output the first line in most cases.

Quoted 1 line

I'd suggest a nack.

Too late, I already applied this. Please submit a followup patch if something needs to be changed.

--=20
Kalle Valo

#4 lore raw
In reply to Joe Perches
Quoted 33 lines · Joe Perches
Quoted 32 lines · Hauke Mehrtens
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Using bcma_debug gives a device-specific prefix for messages and pr_cont is a common helper for continuing a line.

Quoted 22 lines
---
 drivers/bcma/driver_mips.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/bcma/driver_mips.c +4 -3
index 89af807cf29c..5904ef1aa624 100644
@@ -184,10 +184,11 @@ static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq)
 {
 	int i;
 	static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
-	printk(KERN_DEBUG KBUILD_MODNAME ": core 0x%04x, irq :", dev->id.id);
+
+	bcma_debug(dev->bus, "core 0x%04x, irq :", dev->id.id);
 	for (i = 0; i <= 6; i++)
-		printk(" %s%s", irq_name[i], i == irq ? "*" : " ");
-	printk("\n");
+		pr_cont(" %s%s", irq_name[i], i == irq ? "*" : " ");
+	pr_cont("\n");
 }
 
Quoted 5 lines
Quoted 2 lines

drivers/bcma/driver_mips.c static void bcma_core_mips_print_irq(struct bcma_device *dev, unsigned int irq) · line 194

Quoted 2 lines
drivers/bcma/driver_mips.c +0 -0
 static void bcma_core_mips_dump_irq(struct bcma_bus *bus)

This isn't the same code as it depends on #define DEBUG and will not output the first line in most cases.

Oh, I didn't think about bcma_debug (pr_debug) being no_printk indeed. AFAIU it will indeed make pr_cont default to the KERN_DEFAULT.

I'll try to test your code today or tomorrow, thanks!

#5 lore raw
In reply to Rafał Miłecki
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Using bcma_debug gives a device-specific prefix for messages and pr_cont is a common helper for continuing a line.

Patch applied to wireless-drivers-next.git, thanks.

66cc04424960 bcma: use bcma_debug and pr_cont in MIPS driver

Signature · 3 lines
https://patchwork.kernel.org/patch/10008245/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches