Skip to contentSkip to conversation

msm: smd: Reduce driver log chatter

PATCH Superseded David Brown 3 participants 9 messages Nov 10, 2010 – Nov 12, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 msm: smd: Reduce driver log chatter

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change these to pr_debug() to match their purpose.

---
 arch/arm/mach-msm/smd.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-msm/smd.c +7 -7
index f07dc7c..544e4de 100644
@@ -89,7 +89,7 @@ static void smd_diag(void)
 	x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
 	if (x != 0) {
 		x[SZ_DIAG_ERR_MSG - 1] = 0;
-		pr_info("smem: DIAG '%s'\n", x);
+		pr_debug("smem: DIAG '%s'\n", x);
 	}
 }
 
@@ -312,7 +312,7 @@ static void smd_state_change(struct smd_channel *ch,
 {
 	ch->last_state = next;
 
-	pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
+	pr_debug("SMD: ch %d %d -> %d\n", ch->n, last, next);
 
 	switch (next) {
 	case SMD_SS_OPENING:
@@ -601,7 +601,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 	ch->pdev.name = ch->name;
 	ch->pdev.id = -1;
 
-	pr_info("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
+	pr_debug("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
 		ch->n, ch->fifo_size, ch->name);
 
 	mutex_lock(&smd_creation_mutex);
@@ -725,7 +725,7 @@ int smd_close(smd_channel_t *ch)
 {
 	unsigned long flags;
 
-	pr_info("smd_close(%p)\n", ch);
+	pr_debug("smd_close(%p)\n", ch);
 
 	if (ch == 0)
 		return -1;
@@ -939,7 +939,7 @@ int smsm_set_sleep_duration(uint32_t delay)
 int smd_core_init(void)
 {
 	int r;
-	pr_info("smd_core_init()\n");
+	pr_debug("smd_core_init()\n");
 
 	/* wait for essential items to be initialized */
 	for (;;) {
@@ -992,14 +992,14 @@ int smd_core_init(void)
 	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
 #endif
 
-	pr_info("smd_core_init() done\n");
+	pr_debug("smd_core_init() done\n");
 
 	return 0;
 }
 
 static int __devinit msm_smd_probe(struct platform_device *pdev)
 {
-	pr_info("smd_init()\n");
+	pr_debug("smd_init()\n");
 
 	/*
 	 * If we haven't waited for the ARM9 to boot up till now,
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH v2 1/1 msm: smd: Reduce driver log chatter

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change these to pr_debug() to match their purpose.

Cc Brian Swetland <[email protected]>
Cc Arve Hj?nnev?g <[email protected]>
---
 arch/arm/mach-msm/smd.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
arch/arm/mach-msm/smd.c +9 -7
index f07dc7c..37b35fb 100644
@@ -14,6 +14,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -89,7 +91,7 @@ static void smd_diag(void)
 	x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
 	if (x != 0) {
 		x[SZ_DIAG_ERR_MSG - 1] = 0;
-		pr_info("smem: DIAG '%s'\n", x);
+		pr_debug("smem: DIAG '%s'\n", x);
 	}
 }
 
@@ -312,7 +314,7 @@ static void smd_state_change(struct smd_channel *ch,
 {
 	ch->last_state = next;
 
-	pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
+	pr_debug("SMD: ch %d %d -> %d\n", ch->n, last, next);
 
 	switch (next) {
 	case SMD_SS_OPENING:
@@ -601,7 +603,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 	ch->pdev.name = ch->name;
 	ch->pdev.id = -1;
 
-	pr_info("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
+	pr_debug("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
 		ch->n, ch->fifo_size, ch->name);
 
 	mutex_lock(&smd_creation_mutex);
@@ -725,7 +727,7 @@ int smd_close(smd_channel_t *ch)
 {
 	unsigned long flags;
 
-	pr_info("smd_close(%p)\n", ch);
+	pr_debug("smd_close(%p)\n", ch);
 
 	if (ch == 0)
 		return -1;
@@ -939,7 +941,7 @@ int smsm_set_sleep_duration(uint32_t delay)
 int smd_core_init(void)
 {
 	int r;
-	pr_info("smd_core_init()\n");
+	pr_debug("smd_core_init()\n");
 
 	/* wait for essential items to be initialized */
 	for (;;) {
@@ -992,14 +994,14 @@ int smd_core_init(void)
 	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
 #endif
 
-	pr_info("smd_core_init() done\n");
+	pr_debug("smd_core_init() done\n");
 
 	return 0;
 }
 
 static int __devinit msm_smd_probe(struct platform_device *pdev)
 {
-	pr_info("smd_init()\n");
+	pr_debug("smd_init()\n");
 
 	/*
 	 * If we haven't waited for the ARM9 to boot up till now,
Signature · 1 line
1.7.3.2
#2 lore raw

arch/arm/mach-msm/smd.c

Quoted 4 lines · David Brown

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change these to pr_debug() to match their purpose.

arch/arm/mach-msm/smd.c +0 -0

[]

Quoted 1 line

+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

If you add this, you probably want to strip
a few prefixes from the formats.

arch/arm/mach-msm/smd.c static void smd_diag(void)

Quoted 5 lines
arch/arm/mach-msm/smd.c +1 -0
+
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -89,7 +91,7 @@ static void smd_diag(void)

[]

arch/arm/mach-msm/smd.c static void smd_diag(void) · line 94

Quoted 2 lines
arch/arm/mach-msm/smd.c +1 -1
-		pr_info("smem: DIAG '%s'\n", x);
+		pr_debug("smem: DIAG '%s'\n", x);

probably just

		pr_debug("DIAG '%s'\n", x);

arch/arm/mach-msm/smd.c static void smd_state_change(struct smd_channel *ch,

Quoted 4 lines
arch/arm/mach-msm/smd.c +0 -0
 	}
 }
 
@@ -312,7 +314,7 @@ static void smd_state_change(struct smd_channel *ch,

[]

arch/arm/mach-msm/smd.c static void smd_state_change(struct smd_channel *ch, · line 317

Quoted 2 lines
arch/arm/mach-msm/smd.c +1 -1
-	pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
+	pr_debug("SMD: ch %d %d -> %d\n", ch->n, last, next);
	pr_debug("ch %d %d -> %d\n", ch->n, last, next);
#3 lore raw

PATCH v3 1/1 msm: smd: Reduce driver log chatter

In reply to David Brown

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change these to pr_debug() to match their purpose.

Cc Brian Swetland <[email protected]>
Cc Arve Hj?nnev?g <[email protected]>

---
This addresses all of the feedback I've gotten so far.

 arch/arm/mach-msm/smd.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
arch/arm/mach-msm/smd.c +10 -8
index f07dc7c..2673527 100644
@@ -14,6 +14,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -89,7 +91,7 @@ static void smd_diag(void)
 	x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
 	if (x != 0) {
 		x[SZ_DIAG_ERR_MSG - 1] = 0;
-		pr_info("smem: DIAG '%s'\n", x);
+		pr_debug("DIAG '%s'\n", x);
 	}
 }
 
@@ -312,7 +314,7 @@ static void smd_state_change(struct smd_channel *ch,
 {
 	ch->last_state = next;
 
-	pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
+	pr_debug("ch %d %d -> %d\n", ch->n, last, next);
 
 	switch (next) {
 	case SMD_SS_OPENING:
@@ -601,7 +603,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 	ch->pdev.name = ch->name;
 	ch->pdev.id = -1;
 
-	pr_info("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
+	pr_debug("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
 		ch->n, ch->fifo_size, ch->name);
 
 	mutex_lock(&smd_creation_mutex);
@@ -621,7 +623,7 @@ static void smd_channel_probe_worker(struct work_struct *work)
 
 	shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
 	if (!shared) {
-		pr_err("smd: cannot find allocation table\n");
+		pr_err("cannot find allocation table\n");
 		return;
 	}
 	for (n = 0; n < 64; n++) {
@@ -725,7 +727,7 @@ int smd_close(smd_channel_t *ch)
 {
 	unsigned long flags;
 
-	pr_info("smd_close(%p)\n", ch);
+	pr_debug("smd_close(%p)\n", ch);
 
 	if (ch == 0)
 		return -1;
@@ -939,7 +941,7 @@ int smsm_set_sleep_duration(uint32_t delay)
 int smd_core_init(void)
 {
 	int r;
-	pr_info("smd_core_init()\n");
+	pr_debug("smd_core_init()\n");
 
 	/* wait for essential items to be initialized */
 	for (;;) {
@@ -992,14 +994,14 @@ int smd_core_init(void)
 	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
 #endif
 
-	pr_info("smd_core_init() done\n");
+	pr_debug("smd_core_init() done\n");
 
 	return 0;
 }
 
 static int __devinit msm_smd_probe(struct platform_device *pdev)
 {
-	pr_info("smd_init()\n");
+	pr_debug("smd_init()\n");
 
 	/*
 	 * If we haven't waited for the ARM9 to boot up till now,
Signature · 4 lines
1.7.3.2

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#4 lore raw
Quoted 1 line · David Brown
 arch/arm/mach-msm/smd.c |   18 ++++++++++--------

Hi again David. More trivia. Ignore at your pleasure.

arch/arm/mach-msm/smd.c

Quoted 2 lines
 1 files changed, 10 insertions(+), 8 deletions(-)
arch/arm/mach-msm/smd.c +0 -0

A moderately common kernel style uses macros like:

#define FUNC_ENTER() pr_debug("--> %s\n", __func__);
#define FUNC_EXIT() pr_debug("<-- %s\n", __func__);
or
#define FUNC_ENTER() pr_debug("Enter %s\n", __func__);
#define FUNC_EXIT() pr_debug("Exit %s\n", __func__);

The macro names vary.
I've seen enter, _enter, kenter, func_enter, etc.

arch/arm/mach-msm/smd.c int smsm_set_sleep_duration(uint32_t delay) · line 944

Quoted 6 lines
arch/arm/mach-msm/smd.c +1 -1
@@ -939,7 +941,7 @@ int smsm_set_sleep_duration(uint32_t delay)
 int smd_core_init(void)
 {
 	int r;
-	pr_info("smd_core_init()\n");
+	pr_debug("smd_core_init()\n");
	FUNC_ENTER();

arch/arm/mach-msm/smd.c int smd_core_init(void) · line 997

Quoted 6 lines
arch/arm/mach-msm/smd.c +1 -1
@@ -992,14 +994,14 @@ int smd_core_init(void)
 	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
 #endif
 
-	pr_info("smd_core_init() done\n");
+	pr_debug("smd_core_init() done\n");
	FUNC_EXIT();

arch/arm/mach-msm/smd.c int smd_core_init(void) · line 1004

Quoted 4 lines
arch/arm/mach-msm/smd.c +1 -1
 static int __devinit msm_smd_probe(struct platform_device *pdev)
 {
-	pr_info("smd_init()\n");
+	pr_debug("smd_init()\n");

wrong function name? FUNC_ENTER();

#5 lore raw

At this point, I think we could just drop the printk()s on the init functions. They date back from when we first brought up the driver and I'm not sure they're of much value at all any more.

Brian

Quoted 45 lines · Joe Perches
Quoted 1 line · David Brown

?arch/arm/mach-msm/smd.c | ? 18 ++++++++++--------

Hi again David. ?More trivia. Ignore at your pleasure.

arch/arm/mach-msm/smd.c

Quoted 2 lines

?1 files changed, 10 insertions(+), 8 deletions(-)

arch/arm/mach-msm/smd.c +0 -0

A moderately common kernel style uses macros like:

#define FUNC_ENTER() ? ?pr_debug("--> %s\n", __func__); #define FUNC_EXIT() ? ? pr_debug("<-- %s\n", __func__); or
#define FUNC_ENTER() ? ?pr_debug("Enter %s\n", __func__); #define FUNC_EXIT() ? ? pr_debug("Exit ?%s\n", __func__);

The macro names vary.
I've seen enter, _enter, kenter, func_enter, etc.

arch/arm/mach-msm/smd.c int smsm_set_sleep_duration(uint32_t delay) · line 944

Quoted 6 lines
arch/arm/mach-msm/smd.c +1 -1
@@ -939,7 +941,7 @@ int smsm_set_sleep_duration(uint32_t delay)
 ?int smd_core_init(void)
 ?{
 ? ? ? int r;
- ? ? pr_info("smd_core_init()\n");
+ ? ? pr_debug("smd_core_init()\n");

? ? ? ?FUNC_ENTER();

Quoted 6 lines
arch/arm/mach-msm/smd.c +0 -0
@@ -992,14 +994,14 @@ int smd_core_init(void)
 ? ? ? smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);

?#endif

- ? ? pr_info("smd_core_init() done\n");
+ ? ? pr_debug("smd_core_init() done\n");

? ? ? ?FUNC_EXIT();

Quoted 4 lines

?static int __devinit msm_smd_probe(struct platform_device *pdev) ?{
- ? ? pr_info("smd_init()\n");
+ ? ? pr_debug("smd_init()\n");

wrong function name? FUNC_ENTER();

#6 lore raw

PATCH v4 1/1 msm: smd: Reduce driver log chatter

In reply to David Brown

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change some of these to pr_debug() to match their purpose, and remove others that aren't really useful.

Cc Brian Swetland <[email protected]>
Cc Arve Hj?nnev?g <[email protected]>
---
 arch/arm/mach-msm/smd.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
arch/arm/mach-msm/smd.c +7 -10
index f07dc7c..eec464f 100644
@@ -14,6 +14,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -89,7 +91,7 @@ static void smd_diag(void)
 	x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
 	if (x != 0) {
 		x[SZ_DIAG_ERR_MSG - 1] = 0;
-		pr_info("smem: DIAG '%s'\n", x);
+		pr_debug("DIAG '%s'\n", x);
 	}
 }
 
@@ -312,7 +314,7 @@ static void smd_state_change(struct smd_channel *ch,
 {
 	ch->last_state = next;
 
-	pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
+	pr_debug("ch %d %d -> %d\n", ch->n, last, next);
 
 	switch (next) {
 	case SMD_SS_OPENING:
@@ -601,7 +603,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 	ch->pdev.name = ch->name;
 	ch->pdev.id = -1;
 
-	pr_info("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
+	pr_debug("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
 		ch->n, ch->fifo_size, ch->name);
 
 	mutex_lock(&smd_creation_mutex);
@@ -621,7 +623,7 @@ static void smd_channel_probe_worker(struct work_struct *work)
 
 	shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
 	if (!shared) {
-		pr_err("smd: cannot find allocation table\n");
+		pr_err("cannot find allocation table\n");
 		return;
 	}
 	for (n = 0; n < 64; n++) {
@@ -725,7 +727,7 @@ int smd_close(smd_channel_t *ch)
 {
 	unsigned long flags;
 
-	pr_info("smd_close(%p)\n", ch);
+	pr_debug("smd_close(%p)\n", ch);
 
 	if (ch == 0)
 		return -1;
@@ -939,7 +941,6 @@ int smsm_set_sleep_duration(uint32_t delay)
 int smd_core_init(void)
 {
 	int r;
-	pr_info("smd_core_init()\n");
 
 	/* wait for essential items to be initialized */
 	for (;;) {
@@ -992,15 +993,11 @@ int smd_core_init(void)
 	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
 #endif
 
-	pr_info("smd_core_init() done\n");
-
 	return 0;
 }
 
 static int __devinit msm_smd_probe(struct platform_device *pdev)
 {
-	pr_info("smd_init()\n");
-
 	/*
 	 * If we haven't waited for the ARM9 to boot up till now,
 	 * then we need to wait here. Otherwise this should just
Signature · 4 lines
1.7.3.2

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#7 lore raw
Quoted 3 lines · David Brown

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change some of these to pr_debug() to match their purpose, and remove others that aren't really useful.

Hi David.

arch/arm/mach-msm/smd.c int smd_close(smd_channel_t *ch) · line 730

Quoted 7 lines
 arch/arm/mach-msm/smd.c |   17 +++++++----------
arch/arm/mach-msm/smd.c +1 -1
@@ -725,7 +727,7 @@ int smd_close(smd_channel_t *ch)
 {
 	unsigned long flags;
 
-	pr_info("smd_close(%p)\n", ch);
+	pr_debug("smd_close(%p)\n", ch);

Why keep a printk for close without a printk for open? I suggest removing this one too.

#8 lore raw

PATCH v5 1/1 msm: smd: Reduce driver log chatter

In reply to David Brown

The MSM smd driver logs numerous messages during startup that are useful for debug purposes. Change some of these to pr_debug() to match their purpose, and remove others that aren't really useful.

Cc Brian Swetland <[email protected]>
Cc Arve Hj?nnev?g <[email protected]>
---
 arch/arm/mach-msm/smd.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
arch/arm/mach-msm/smd.c +6 -11
index f07dc7c..657be73 100644
@@ -14,6 +14,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/fs.h>
@@ -89,7 +91,7 @@ static void smd_diag(void)
 	x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
 	if (x != 0) {
 		x[SZ_DIAG_ERR_MSG - 1] = 0;
-		pr_info("smem: DIAG '%s'\n", x);
+		pr_debug("DIAG '%s'\n", x);
 	}
 }
 
@@ -312,7 +314,7 @@ static void smd_state_change(struct smd_channel *ch,
 {
 	ch->last_state = next;
 
-	pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
+	pr_debug("ch %d %d -> %d\n", ch->n, last, next);
 
 	switch (next) {
 	case SMD_SS_OPENING:
@@ -601,7 +603,7 @@ static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
 	ch->pdev.name = ch->name;
 	ch->pdev.id = -1;
 
-	pr_info("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
+	pr_debug("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
 		ch->n, ch->fifo_size, ch->name);
 
 	mutex_lock(&smd_creation_mutex);
@@ -621,7 +623,7 @@ static void smd_channel_probe_worker(struct work_struct *work)
 
 	shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
 	if (!shared) {
-		pr_err("smd: cannot find allocation table\n");
+		pr_err("cannot find allocation table\n");
 		return;
 	}
 	for (n = 0; n < 64; n++) {
@@ -725,8 +727,6 @@ int smd_close(smd_channel_t *ch)
 {
 	unsigned long flags;
 
-	pr_info("smd_close(%p)\n", ch);
-
 	if (ch == 0)
 		return -1;
 
@@ -939,7 +939,6 @@ int smsm_set_sleep_duration(uint32_t delay)
 int smd_core_init(void)
 {
 	int r;
-	pr_info("smd_core_init()\n");
 
 	/* wait for essential items to be initialized */
 	for (;;) {
@@ -992,15 +991,11 @@ int smd_core_init(void)
 	smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
 #endif
 
-	pr_info("smd_core_init() done\n");
-
 	return 0;
 }
 
 static int __devinit msm_smd_probe(struct platform_device *pdev)
 {
-	pr_info("smd_init()\n");
-
 	/*
 	 * If we haven't waited for the ARM9 to boot up till now,
 	 * then we need to wait here. Otherwise this should just
Signature · 4 lines
1.7.3.2

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.