linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] firmware/dmi_scan: Cleanups
@ 2013-07-09 15:40 Jean Delvare
  2013-07-09 15:41 ` [PATCH 1/3] firmware/dmi_scan: Drop obsolete comment Jean Delvare
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jean Delvare @ 2013-07-09 15:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Hutchings, Andrew Morton

[PATCH 1/3] firmware/dmi_scan: Drop obsolete comment
[PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings
[PATCH 3/3] firmware/dmi_scan: Constify strings

-- 
Jean Delvare
Suse L3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] firmware/dmi_scan: Drop obsolete comment
  2013-07-09 15:40 [PATCH 0/3] firmware/dmi_scan: Cleanups Jean Delvare
@ 2013-07-09 15:41 ` Jean Delvare
  2013-07-09 15:42 ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
  2013-07-09 15:43 ` [PATCH 3/3] firmware/dmi_scan: Constify strings Jean Delvare
  2 siblings, 0 replies; 11+ messages in thread
From: Jean Delvare @ 2013-07-09 15:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Hutchings, Andrew Morton, Ingo Molnar, Yinghai Lu

This comment predates the introduction of early_ioremap. Since then
the missing calls to dmi_iounmap have been added by Ingo and Yinghai
in commits 0d64484f7ea12ca04211b497e94634c3d27cf3fb and
3212bff370c2f22e4987c6679ba485654cefb178. That was over 5 years ago so
it is about time to drop this now misleading comment.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Yinghai Lu <yinghai@kernel.org>
---
 drivers/firmware/dmi_scan.c |    5 -----
 1 file changed, 5 deletions(-)

--- linux-3.10-rc0.orig/drivers/firmware/dmi_scan.c	2013-05-04 11:16:44.229314442 +0200
+++ linux-3.10-rc0/drivers/firmware/dmi_scan.c	2013-05-04 11:19:17.320935301 +0200
@@ -497,11 +497,6 @@ void __init dmi_scan_machine(void)
 		}
 	}
 	else {
-		/*
-		 * no iounmap() for that ioremap(); it would be a no-op, but
-		 * it's so early in setup that sucker gets confused into doing
-		 * what it shouldn't if we actually call it.
-		 */
 		p = dmi_ioremap(0xF0000, 0x10000);
 		if (p == NULL)
 			goto error;


-- 
Jean Delvare
Suse L3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings
  2013-07-09 15:40 [PATCH 0/3] firmware/dmi_scan: Cleanups Jean Delvare
  2013-07-09 15:41 ` [PATCH 1/3] firmware/dmi_scan: Drop obsolete comment Jean Delvare
@ 2013-07-09 15:42 ` Jean Delvare
  2013-07-09 16:19   ` Joe Perches
  2013-07-09 15:43 ` [PATCH 3/3] firmware/dmi_scan: Constify strings Jean Delvare
  2 siblings, 1 reply; 11+ messages in thread
From: Jean Delvare @ 2013-07-09 15:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Hutchings, Andrew Morton

Fix all errors and trivial warnings reported by checkpatch for file
drivers/firmware/dmi_scan.c.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 drivers/firmware/dmi_scan.c |   47 ++++++++++++++++++++++----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

--- linux-3.11-rc0.orig/drivers/firmware/dmi_scan.c	2013-07-09 15:38:09.687390047 +0200
+++ linux-3.11-rc0/drivers/firmware/dmi_scan.c	2013-07-09 16:08:13.979592957 +0200
@@ -63,7 +63,7 @@ static char * __init dmi_string(const st
 	if (str != NULL)
 		strcpy(str, bp);
 	else
-		printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
+		pr_err("dmi_string: cannot allocate %Zu bytes.\n", len);
 
 	return str;
 }
@@ -140,9 +140,10 @@ int dmi_available;
 /*
  *	Save a DMI string
  */
-static void __init dmi_save_ident(const struct dmi_header *dm, int slot, int string)
+static void __init dmi_save_ident(const struct dmi_header *dm, int slot,
+		int string)
 {
-	const char *d = (const char*) dm;
+	const char *d = (const char *) dm;
 	char *p;
 
 	if (dmi_ident[slot])
@@ -155,9 +156,10 @@ static void __init dmi_save_ident(const
 	dmi_ident[slot] = p;
 }
 
-static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int index)
+static void __init dmi_save_uuid(const struct dmi_header *dm, int slot,
+		int index)
 {
-	const u8 *d = (u8*) dm + index;
+	const u8 *d = (u8 *) dm + index;
 	char *s;
 	int is_ff = 1, is_00 = 1, i;
 
@@ -188,12 +190,13 @@ static void __init dmi_save_uuid(const s
 	else
 		sprintf(s, "%pUB", d);
 
-        dmi_ident[slot] = s;
+	dmi_ident[slot] = s;
 }
 
-static void __init dmi_save_type(const struct dmi_header *dm, int slot, int index)
+static void __init dmi_save_type(const struct dmi_header *dm, int slot,
+		int index)
 {
-	const u8 *d = (u8*) dm + index;
+	const u8 *d = (u8 *) dm + index;
 	char *s;
 
 	if (dmi_ident[slot])
@@ -217,7 +220,7 @@ static void __init dmi_save_one_device(i
 
 	dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
 	if (!dev) {
-		printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
+		pr_err("dmi_save_one_device: out of memory.\n");
 		return;
 	}
 
@@ -256,8 +259,7 @@ static void __init dmi_save_oem_strings_
 
 		dev = dmi_alloc(sizeof(*dev));
 		if (!dev) {
-			printk(KERN_ERR
-			   "dmi_save_oem_strings_devices: out of memory.\n");
+			pr_err("dmi_save_oem_strings_devices: out of memory.\n");
 			break;
 		}
 
@@ -272,11 +274,11 @@ static void __init dmi_save_oem_strings_
 static void __init dmi_save_ipmi_device(const struct dmi_header *dm)
 {
 	struct dmi_device *dev;
-	void * data;
+	void *data;
 
 	data = dmi_alloc(dm->length);
 	if (data == NULL) {
-		printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
+		pr_err("dmi_save_ipmi_device: out of memory.\n");
 		return;
 	}
 
@@ -284,7 +286,7 @@ static void __init dmi_save_ipmi_device(
 
 	dev = dmi_alloc(sizeof(*dev));
 	if (!dev) {
-		printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
+		pr_err("dmi_save_ipmi_device: out of memory.\n");
 		return;
 	}
 
@@ -302,7 +304,7 @@ static void __init dmi_save_dev_onboard(
 
 	onboard_dev = dmi_alloc(sizeof(*onboard_dev) + strlen(name) + 1);
 	if (!onboard_dev) {
-		printk(KERN_ERR "dmi_save_dev_onboard: out of memory.\n");
+		pr_err("dmi_save_dev_onboard: out of memory.\n");
 		return;
 	}
 	onboard_dev->instance = instance;
@@ -320,7 +322,7 @@ static void __init dmi_save_dev_onboard(
 
 static void __init dmi_save_extended_devices(const struct dmi_header *dm)
 {
-	const u8 *d = (u8*) dm + 5;
+	const u8 *d = (u8 *) dm + 5;
 
 	/* Skip disabled device */
 	if ((*d & 0x80) == 0)
@@ -338,7 +340,7 @@ static void __init dmi_save_extended_dev
  */
 static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 {
-	switch(dm->type) {
+	switch (dm->type) {
 	case 0:		/* BIOS Information */
 		dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
 		dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
@@ -495,8 +497,7 @@ void __init dmi_scan_machine(void)
 			dmi_available = 1;
 			goto out;
 		}
-	}
-	else {
+	} else {
 		p = dmi_ioremap(0xF0000, 0x10000);
 		if (p == NULL)
 			goto error;
@@ -514,7 +515,7 @@ void __init dmi_scan_machine(void)
 		dmi_iounmap(p, 0x10000);
 	}
  error:
-	printk(KERN_INFO "DMI not present or invalid.\n");
+	pr_info("DMI not present or invalid.\n");
  out:
 	dmi_initialized = 1;
 }
@@ -650,7 +651,7 @@ int dmi_name_in_serial(const char *str)
 
 /**
  *	dmi_name_in_vendors - Check if string is in the DMI system or board vendor name
- *	@str: 	Case sensitive Name
+ *	@str: Case sensitive Name
  */
 int dmi_name_in_vendors(const char *str)
 {
@@ -677,13 +678,13 @@ EXPORT_SYMBOL(dmi_name_in_vendors);
  *	A new search is initiated by passing %NULL as the @from argument.
  *	If @from is not %NULL, searches continue from next device.
  */
-const struct dmi_device * dmi_find_device(int type, const char *name,
+const struct dmi_device *dmi_find_device(int type, const char *name,
 				    const struct dmi_device *from)
 {
 	const struct list_head *head = from ? &from->list : &dmi_devices;
 	struct list_head *d;
 
-	for(d = head->next; d != &dmi_devices; d = d->next) {
+	for (d = head->next; d != &dmi_devices; d = d->next) {
 		const struct dmi_device *dev =
 			list_entry(d, struct dmi_device, list);
 


-- 
Jean Delvare
Suse L3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3] firmware/dmi_scan: Constify strings
  2013-07-09 15:40 [PATCH 0/3] firmware/dmi_scan: Cleanups Jean Delvare
  2013-07-09 15:41 ` [PATCH 1/3] firmware/dmi_scan: Drop obsolete comment Jean Delvare
  2013-07-09 15:42 ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
@ 2013-07-09 15:43 ` Jean Delvare
  2013-07-09 15:58   ` Joe Perches
  2 siblings, 1 reply; 11+ messages in thread
From: Jean Delvare @ 2013-07-09 15:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ben Hutchings, Andrew Morton

Add const to all DMI string pointers where this is possible. This
fixes a checkpatch warning.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 drivers/firmware/dmi_scan.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- linux-3.10-rc0.orig/drivers/firmware/dmi_scan.c	2013-05-04 11:20:48.321082162 +0200
+++ linux-3.10-rc0/drivers/firmware/dmi_scan.c	2013-05-04 11:20:52.808187924 +0200
@@ -14,7 +14,7 @@
  * of and an antecedent to, SMBIOS, which stands for System
  * Management BIOS.  See further: http://www.dmtf.org/standards
  */
-static char dmi_empty_string[] = "        ";
+static const char dmi_empty_string[] = "        ";
 
 static u16 __initdata dmi_ver;
 /*
@@ -49,7 +49,7 @@ static const char * __init dmi_string_no
 	return "";
 }
 
-static char * __init dmi_string(const struct dmi_header *dm, u8 s)
+static const char * __init dmi_string(const struct dmi_header *dm, u8 s)
 {
 	const char *bp = dmi_string_nosave(dm, s);
 	char *str;
@@ -133,7 +133,7 @@ static int __init dmi_checksum(const u8
 	return sum == 0;
 }
 
-static char *dmi_ident[DMI_STRING_MAX];
+static const char *dmi_ident[DMI_STRING_MAX];
 static LIST_HEAD(dmi_devices);
 int dmi_available;
 
@@ -144,7 +144,7 @@ static void __init dmi_save_ident(const
 		int string)
 {
 	const char *d = (const char *) dm;
-	char *p;
+	const char *p;
 
 	if (dmi_ident[slot])
 		return;
@@ -252,7 +252,7 @@ static void __init dmi_save_oem_strings_
 	struct dmi_device *dev;
 
 	for (i = 1; i <= count; i++) {
-		char *devname = dmi_string(dm, i);
+		const char *devname = dmi_string(dm, i);
 
 		if (devname == dmi_empty_string)
 			continue;


-- 
Jean Delvare
Suse L3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] firmware/dmi_scan: Constify strings
  2013-07-09 15:43 ` [PATCH 3/3] firmware/dmi_scan: Constify strings Jean Delvare
@ 2013-07-09 15:58   ` Joe Perches
  2013-07-09 16:23     ` Jean Delvare
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Perches @ 2013-07-09 15:58 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kernel, Ben Hutchings, Andrew Morton

On Tue, 2013-07-09 at 17:43 +0200, Jean Delvare wrote:
> Add const to all DMI string pointers where this is possible. This
> fixes a checkpatch warning.

That's a nice little improvement.

> +++ linux-3.10-rc0/drivers/firmware/dmi_scan.c	2013-05-04 11:20:52.808187924 +0200
[]
> @@ -252,7 +252,7 @@ static void __init dmi_save_oem_strings_
>  	struct dmi_device *dev;
>  
>  	for (i = 1; i <= count; i++) {
> -		char *devname = dmi_string(dm, i);
> +		const char *devname = dmi_string(dm, i);
>  
>  		if (devname == dmi_empty_string)

btw: that last test sure looks like it would be
     better written as
		if (strcmp(devname, dmi_empty_string) == 0)



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings
  2013-07-09 15:42 ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
@ 2013-07-09 16:19   ` Joe Perches
  2013-07-09 17:13     ` ia64: dmi.h: Make dmi_alloc use kzalloc Joe Perches
  2013-07-10 12:28     ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
  0 siblings, 2 replies; 11+ messages in thread
From: Joe Perches @ 2013-07-09 16:19 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kernel, Ben Hutchings, Andrew Morton

On Tue, 2013-07-09 at 17:42 +0200, Jean Delvare wrote:
> Fix all errors and trivial warnings reported by checkpatch for file
> drivers/firmware/dmi_scan.c.

trivia:

> +++ linux-3.11-rc0/drivers/firmware/dmi_scan.c	2013-07-09 16:08:13.979592957 +0200
> @@ -63,7 +63,7 @@ static char * __init dmi_string(const st
>  	if (str != NULL)
>  		strcpy(str, bp);
>  	else
> -		printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
> +		pr_err("dmi_string: cannot allocate %Zu bytes.\n", len);

If the function name is used in every printk, it might
be better to add

#define pr_fmt(fmt) "%s: " fmt, __func__

before any #include

If not, then I suggest removing the embedded function names
and writing these as
		pr_err("%s: etc...", __func__, etc...);

This eliminates any possible function name mismatch.

> @@ -217,7 +220,7 @@ static void __init dmi_save_one_device(i
>  
>  	dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
>  	if (!dev) {
> -		printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
> +		pr_err("dmi_save_one_device: out of memory.\n");

OOM messages generally aren't useful.

dmi_alloc is either a trivial front-end to kmalloc,
and kmalloc already does a dump_stack() when OOM, or
for x86, dmi_alloc uses extend_brk which BUGs when
unsuccessful.

x86/ia64 do have a slight mismatch in dmi_alloc as
x86 does a memset(0), and ia64 just does kmalloc.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] firmware/dmi_scan: Constify strings
  2013-07-09 15:58   ` Joe Perches
@ 2013-07-09 16:23     ` Jean Delvare
  0 siblings, 0 replies; 11+ messages in thread
From: Jean Delvare @ 2013-07-09 16:23 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Ben Hutchings, Andrew Morton

Hi Joe,

Le Tuesday 09 July 2013 à 08:58 -0700, Joe Perches a écrit :
> On Tue, 2013-07-09 at 17:43 +0200, Jean Delvare wrote:
> > Add const to all DMI string pointers where this is possible. This
> > fixes a checkpatch warning.
> 
> That's a nice little improvement.

Thanks.

> > +++ linux-3.10-rc0/drivers/firmware/dmi_scan.c	2013-05-04 11:20:52.808187924 +0200
> []
> > @@ -252,7 +252,7 @@ static void __init dmi_save_oem_strings_
> >  	struct dmi_device *dev;
> >  
> >  	for (i = 1; i <= count; i++) {
> > -		char *devname = dmi_string(dm, i);
> > +		const char *devname = dmi_string(dm, i);
> >  
> >  		if (devname == dmi_empty_string)
> 
> btw: that last test sure looks like it would be
>      better written as
> 		if (strcmp(devname, dmi_empty_string) == 0)
> 

No, it does not. If you look at the rest of the code, the comparison
makes sense as is.

-- 
Jean Delvare
Suse L3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* ia64: dmi.h: Make dmi_alloc use kzalloc
  2013-07-09 16:19   ` Joe Perches
@ 2013-07-09 17:13     ` Joe Perches
  2013-07-09 20:43       ` Tony Luck
  2013-07-10 12:28     ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
  1 sibling, 1 reply; 11+ messages in thread
From: Joe Perches @ 2013-07-09 17:13 UTC (permalink / raw)
  To: Jean Delvare
  Cc: linux-kernel, Ben Hutchings, Andrew Morton, Tony Luck,
	Fenghua Yu, linux-ia64

x86/ia64 have a slight mismatch in dmi_alloc as
x86 does a memset(0), and ia64 just does kmalloc.

Make the ia64 dmi_alloc match the x86 style.

Signed-off-by: Joe Perches <joe@perches.com>
---
 arch/ia64/include/asm/dmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/ia64/include/asm/dmi.h b/arch/ia64/include/asm/dmi.h
index 1ed4c8f..185d3d1 100644
--- a/arch/ia64/include/asm/dmi.h
+++ b/arch/ia64/include/asm/dmi.h
@@ -7,6 +7,6 @@
 /* Use normal IO mappings for DMI */
 #define dmi_ioremap ioremap
 #define dmi_iounmap(x,l) iounmap(x)
-#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
+#define dmi_alloc(l) kzalloc(l, GFP_ATOMIC)
 
 #endif



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: ia64: dmi.h: Make dmi_alloc use kzalloc
  2013-07-09 17:13     ` ia64: dmi.h: Make dmi_alloc use kzalloc Joe Perches
@ 2013-07-09 20:43       ` Tony Luck
  0 siblings, 0 replies; 11+ messages in thread
From: Tony Luck @ 2013-07-09 20:43 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jean Delvare, linux-kernel, Ben Hutchings, Andrew Morton,
	Fenghua Yu, linux-ia64

On Tue, Jul 9, 2013 at 10:13 AM, Joe Perches <joe@perches.com> wrote:
> x86/ia64 have a slight mismatch in dmi_alloc as
> x86 does a memset(0), and ia64 just does kmalloc.
>
> Make the ia64 dmi_alloc match the x86 style.
>
> Signed-off-by: Joe Perches <joe@perches.com>

Applied. Thanks Joe.

-Tony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings
  2013-07-09 16:19   ` Joe Perches
  2013-07-09 17:13     ` ia64: dmi.h: Make dmi_alloc use kzalloc Joe Perches
@ 2013-07-10 12:28     ` Jean Delvare
  2013-07-10 14:59       ` Joe Perches
  1 sibling, 1 reply; 11+ messages in thread
From: Jean Delvare @ 2013-07-10 12:28 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Ben Hutchings, Andrew Morton

Hi Joe,

Le Tuesday 09 July 2013 à 09:19 -0700, Joe Perches a écrit :
> On Tue, 2013-07-09 at 17:42 +0200, Jean Delvare wrote:
> > Fix all errors and trivial warnings reported by checkpatch for file
> > drivers/firmware/dmi_scan.c.
> 
> trivia:
> 
> > +++ linux-3.11-rc0/drivers/firmware/dmi_scan.c	2013-07-09 16:08:13.979592957 +0200
> > @@ -63,7 +63,7 @@ static char * __init dmi_string(const st
> >  	if (str != NULL)
> >  		strcpy(str, bp);
> >  	else
> > -		printk(KERN_ERR "dmi_string: cannot allocate %Zu bytes.\n", len);
> > +		pr_err("dmi_string: cannot allocate %Zu bytes.\n", len);
> 
> If the function name is used in every printk, it might
> be better to add
> 
> #define pr_fmt(fmt) "%s: " fmt, __func__
> 
> before any #include

No, only error messages include the function name, debug and info
messages do not.

> If not, then I suggest removing the embedded function names
> and writing these as
> 		pr_err("%s: etc...", __func__, etc...);
> 
> This eliminates any possible function name mismatch.

I had considered this too, but stepped back after finding out that this
change would increase the binary size. It's hard to sell such a change
then when it's only fixing a theoretical problem.

> > @@ -217,7 +220,7 @@ static void __init dmi_save_one_device(i
> >  
> >  	dev = dmi_alloc(sizeof(*dev) + strlen(name) + 1);
> >  	if (!dev) {
> > -		printk(KERN_ERR "dmi_save_one_device: out of memory.\n");
> > +		pr_err("dmi_save_one_device: out of memory.\n");
> 
> OOM messages generally aren't useful.
> 
> dmi_alloc is either a trivial front-end to kmalloc,
> and kmalloc already does a dump_stack() when OOM, or
> for x86, dmi_alloc uses extend_brk which BUGs when
> unsuccessful.

Fair enough, I'll send a separate patch for this in a minute.

-- 
Jean Delvare
Suse L3


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings
  2013-07-10 12:28     ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
@ 2013-07-10 14:59       ` Joe Perches
  0 siblings, 0 replies; 11+ messages in thread
From: Joe Perches @ 2013-07-10 14:59 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kernel, Ben Hutchings, Andrew Morton

On Wed, 2013-07-10 at 14:28 +0200, Jean Delvare wrote:
> Hi Joe,

hi Jean.

> Le Tuesday 09 July 2013 à 09:19 -0700, Joe Perches a écrit :
> > On Tue, 2013-07-09 at 17:42 +0200, Jean Delvare wrote:
[]
> > If the function name is used in every printk, it might
> > be better to add
> > #define pr_fmt(fmt) "%s: " fmt, __func__
[]
> > If not, then I suggest removing the embedded function names
> > and writing these as
> > 		pr_err("%s: etc...", __func__, etc...);
> > This eliminates any possible function name mismatch.
> I had considered this too, but stepped back after finding out that this
> change would increase the binary size. It's hard to sell such a change
> then when it's only fixing a theoretical problem.

No worries.

Another tiny consideration is that __func__ is both
generally not particularly useful and could in the
future be consolidated via vsprintf/printk having
some extension that uses __builtin_return_address
and sprint_symbol_no_offset.

cheers, Joe


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-07-10 14:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-09 15:40 [PATCH 0/3] firmware/dmi_scan: Cleanups Jean Delvare
2013-07-09 15:41 ` [PATCH 1/3] firmware/dmi_scan: Drop obsolete comment Jean Delvare
2013-07-09 15:42 ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
2013-07-09 16:19   ` Joe Perches
2013-07-09 17:13     ` ia64: dmi.h: Make dmi_alloc use kzalloc Joe Perches
2013-07-09 20:43       ` Tony Luck
2013-07-10 12:28     ` [PATCH 2/3] firmware/dmi_scan: Fix most checkpatch errors and warnings Jean Delvare
2013-07-10 14:59       ` Joe Perches
2013-07-09 15:43 ` [PATCH 3/3] firmware/dmi_scan: Constify strings Jean Delvare
2013-07-09 15:58   ` Joe Perches
2013-07-09 16:23     ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).