Skip to contentSkip to conversation

dynamic_printk: add line feed to printk

PATCH In review Wu Fengguang 5 participants 8 messages Dec 10, 2008 – Dec 12, 2008 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dynamic_printk: add line feed to printk

Append '\n' to two printk messages.
Also cleanup the code to reduce one level of indentation.

Cc Jason Baron <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 lib/dynamic_printk.c |   58 ++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 32 deletions(-)
lib/dynamic_printk.c +26 -32
@@ -277,40 +277,34 @@ static ssize_t pr_debug_write(struct fil
 				dynamic_enabled = DYNAMIC_ENABLED_NONE;
 			}
 			err = 0;
-		} else {
-			if (elem) {
-				if (value && (elem->enable == 0)) {
-					dynamic_printk_enabled |=
-							(1LL << elem->hash1);
-					dynamic_printk_enabled2 |=
-							(1LL << elem->hash2);
-					elem->enable = 1;
-					num_enabled++;
-					dynamic_enabled = DYNAMIC_ENABLED_SOME;
-					err = 0;
-					printk(KERN_DEBUG
-					       "debugging enabled for module %s",
-					       elem->name);
-				} else if (!value && (elem->enable == 1)) {
-					elem->enable = 0;
-					num_enabled--;
-					if (disabled_hash(elem->hash1, true))
-						dynamic_printk_enabled &=
+		} else if (elem) {
+			if (value && (elem->enable == 0)) {
+				dynamic_printk_enabled |= (1LL << elem->hash1);
+				dynamic_printk_enabled2 |= (1LL << elem->hash2);
+				elem->enable = 1;
+				num_enabled++;
+				dynamic_enabled = DYNAMIC_ENABLED_SOME;
+				err = 0;
+				printk(KERN_DEBUG
+					"debugging enabled for module %s\n",
+					elem->name);
+			} else if (!value && (elem->enable == 1)) {
+				elem->enable = 0;
+				num_enabled--;
+				if (disabled_hash(elem->hash1, true))
+					dynamic_printk_enabled &=
 							~(1LL << elem->hash1);
-					if (disabled_hash(elem->hash2, false))
-						dynamic_printk_enabled2 &=
+				if (disabled_hash(elem->hash2, false))
+					dynamic_printk_enabled2 &=
 							~(1LL << elem->hash2);
-					if (num_enabled)
-						dynamic_enabled =
-							DYNAMIC_ENABLED_SOME;
-					else
-						dynamic_enabled =
-							DYNAMIC_ENABLED_NONE;
-					err = 0;
-					printk(KERN_DEBUG
-					       "debugging disabled for module "
-					       "%s", elem->name);
-				}
+				if (num_enabled)
+					dynamic_enabled = DYNAMIC_ENABLED_SOME;
+				else
+					dynamic_enabled = DYNAMIC_ENABLED_NONE;
+				err = 0;
+				printk(KERN_DEBUG
+					"debugging disabled for module %s\n",
+					elem->name);
 			}
 		}
 	}
#1 lore raw

Hi,

Quoted 1 line

Append '\n' to two printk messages.

I already sent a patch for that and Greg picked it up.

Quoted 1 line

Also cleanup the code to reduce one level of indentation.

Please re-base that one against Greg's latest tree that includes my patch.

Regards

Marcel

#2 lore raw
Quoted 5 lines · Marcel Holtmann

Hi,

Quoted 1 line

Append '\n' to two printk messages.

I already sent a patch for that and Greg picked it up.

No I didn't find it in the usb-2.6 tree:

git pull git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git

Quoted 1 line

From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* branch HEAD -> FETCH_HEAD
Already up-to-date.

Quoted 4 lines
Quoted 1 line

Also cleanup the code to reduce one level of indentation.

Please re-base that one against Greg's latest tree that includes my patch.

Sorry, it's me :)

Thanks,
Fengguang

#4 lore raw
In reply to Wu Fengguang
Quoted 5 lines · Wu Fengguang
Quoted 4 lines · Marcel Holtmann

Hi,

Quoted 1 line

Append '\n' to two printk messages.

Quoted 8 lines
Quoted 1 line

I already sent a patch for that and Greg picked it up.

No I didn't find it in the usb-2.6 tree:

git pull git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git

Quoted 1 line

From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* branch HEAD -> FETCH_HEAD
Already up-to-date.

That's not the "usb" tree, if you read the description, it should be clear.

My tree is in quilt, please see the MAINTAINERS file for details.

thanks,

greg k-h

#5 lore raw
Quoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Wu Fengguang
Quoted 5 lines · Marcel Holtmann

Hi,

Quoted 1 line

Append '\n' to two printk messages.

I already sent a patch for that and Greg picked it up.

No I didn't find it in the usb-2.6 tree:

Quoted 7 lines
Quoted 4 lines

git pull git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git

Quoted 1 line

From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* branch HEAD -> FETCH_HEAD
Already up-to-date.

That's not the "usb" tree, if you read the description, it should be clear.

Yup, it reads "junk tree, please ignore". When I first found it in git.kernel.org, I chose to trust the name 'usb-2.6' instead of its description...

Quoted 1 line

My tree is in quilt, please see the MAINTAINERS file for details.

Got it. Below is the updated patch based on Marcel's one.

Thanks,
Fengguang
---
dynamic_printk: reduce one level of indentation

Cleanup pr_debug_write() to reduce one level of indentation.

Cc Marcel Holtmann <[email protected]>
Cc Jason Baron <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 lib/dynamic_printk.c |   58 ++++++++++++++++++-----------------------
 1 file changed, 26 insertions(+), 32 deletions(-)
lib/dynamic_printk.c +26 -32
@@ -277,40 +277,34 @@ static ssize_t pr_debug_write(struct fil
 				dynamic_enabled = DYNAMIC_ENABLED_NONE;
 			}
 			err = 0;
-		} else {
-			if (elem) {
-				if (value && (elem->enable == 0)) {
-					dynamic_printk_enabled |=
-							(1LL << elem->hash1);
-					dynamic_printk_enabled2 |=
-							(1LL << elem->hash2);
-					elem->enable = 1;
-					num_enabled++;
-					dynamic_enabled = DYNAMIC_ENABLED_SOME;
-					err = 0;
-					printk(KERN_DEBUG
-					       "debugging enabled for module %s\n",
-					       elem->name);
-				} else if (!value && (elem->enable == 1)) {
-					elem->enable = 0;
-					num_enabled--;
-					if (disabled_hash(elem->hash1, true))
-						dynamic_printk_enabled &=
+		} else if (elem) {
+			if (value && (elem->enable == 0)) {
+				dynamic_printk_enabled |= (1LL << elem->hash1);
+				dynamic_printk_enabled2 |= (1LL << elem->hash2);
+				elem->enable = 1;
+				num_enabled++;
+				dynamic_enabled = DYNAMIC_ENABLED_SOME;
+				err = 0;
+				printk(KERN_DEBUG
+					"debugging enabled for module %s\n",
+					elem->name);
+			} else if (!value && (elem->enable == 1)) {
+				elem->enable = 0;
+				num_enabled--;
+				if (disabled_hash(elem->hash1, true))
+					dynamic_printk_enabled &=
 							~(1LL << elem->hash1);
-					if (disabled_hash(elem->hash2, false))
-						dynamic_printk_enabled2 &=
+				if (disabled_hash(elem->hash2, false))
+					dynamic_printk_enabled2 &=
 							~(1LL << elem->hash2);
-					if (num_enabled)
-						dynamic_enabled =
-							DYNAMIC_ENABLED_SOME;
-					else
-						dynamic_enabled =
-							DYNAMIC_ENABLED_NONE;
-					err = 0;
-					printk(KERN_DEBUG
-					       "debugging disabled for module "
-					       "%s\n", elem->name);
-				}
+				if (num_enabled)
+					dynamic_enabled = DYNAMIC_ENABLED_SOME;
+				else
+					dynamic_enabled = DYNAMIC_ENABLED_NONE;
+				err = 0;
+				printk(KERN_DEBUG
+					"debugging disabled for module %s\n",
+					elem->name);
 			}
 		}
 	}
Acked-by
#6 lore raw
Quoted 7 lines · Wu Fengguang

Got it. Below is the updated patch based on Marcel's one.

Thanks,
Fengguang
---
dynamic_printk: reduce one level of indentation

Quoted 6 lines

Cleanup pr_debug_write() to reduce one level of indentation.

Cc Marcel Holtmann <[email protected]>
Cc Jason Baron <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

thanks for the cleanup.

#7 lore raw
In reply to Wu Fengguang
Quoted 16 lines · Wu Fengguang
Quoted 15 lines · Greg Kroah-Hartman
Quoted 13 lines · Wu Fengguang
Quoted 5 lines · Marcel Holtmann

Hi,

Quoted 1 line

Append '\n' to two printk messages.

I already sent a patch for that and Greg picked it up.

No I didn't find it in the usb-2.6 tree:

git pull git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git

Quoted 1 line

From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* branch HEAD -> FETCH_HEAD
Already up-to-date.

Quoted 6 lines
Quoted 2 lines

That's not the "usb" tree, if you read the description, it should be clear.

Yup, it reads "junk tree, please ignore". When I first found it in git.kernel.org, I chose to trust the name 'usb-2.6' instead of its description...

Heh, as if I just added that description for the fun of it :)

Quoted 3 lines
Quoted 1 line

My tree is in quilt, please see the MAINTAINERS file for details.

Got it. Below is the updated patch based on Marcel's one.

Thanks, I'll queue it up.

grg k-h