All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] printk prefix cleanups.
@ 2002-02-12  6:26 Zwane Mwaikambo
  2002-02-12  6:46 ` Jeff Garzik
  2002-02-12  9:50 ` Horst von Brand
  0 siblings, 2 replies; 7+ messages in thread
From: Zwane Mwaikambo @ 2002-02-12  6:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Kernel Janitors, Linux Kernel

Here is a simple patch which reduces resultant binary size by 1.2k for 
this particular module (opl3sa2). Perhaps we should consider adding this 
on the janitor TODO list for cleaning up other printks.

Regards,
	Zwane Mwaikambo

--- linux-2.4.18-pre8-zm1/drivers/sound/opl3sa2.c.orig	Mon Feb 11 02:25:50 2002
+++ linux-2.4.18-pre8-zm1/drivers/sound/opl3sa2.c	Mon Feb 11 02:40:59 2002
@@ -71,6 +71,7 @@
 #include "mpu401.h"
 
 #define OPL3SA2_MODULE_NAME	"opl3sa2"
+#define OPL3SA2_PFX		OPL3SA2_MODULE_NAME ": "
 
 /* Useful control port indexes: */
 #define OPL3SA2_PM	     0x01
@@ -616,7 +617,7 @@
 			AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_LINE);
 		}
 		else {
-			printk(KERN_ERR "opl3sa2: MSS mixer not installed?\n");
+			printk(KERN_ERR OPL3SA2_PFX "MSS mixer not installed?\n");
 		}
 	}
 }
@@ -639,7 +640,7 @@
 	 * Try and allocate our I/O port range.
 	 */
 	if(!request_region(hw_config->io_base, 2, OPL3SA2_MODULE_NAME)) {
-		printk(KERN_ERR "opl3sa2: Control I/O port %#x not free\n",
+		printk(KERN_ERR OPL3SA2_PFX "Control I/O port %#x not free\n",
 		       hw_config->io_base);
 		return 0;
 	}
@@ -652,7 +653,7 @@
 	opl3sa2_write(hw_config->io_base, OPL3SA2_MISC, misc ^ 0x07);
 	opl3sa2_read(hw_config->io_base, OPL3SA2_MISC, &tmp);
 	if(tmp != misc) {
-		printk(KERN_ERR "opl3sa2: Control I/O port %#x is not a YMF7xx chipset!\n",
+		printk(KERN_ERR OPL3SA2_PFX "Control I/O port %#x is not a YMF7xx chipset!\n",
 		       hw_config->io_base);
 		return 0;
 	}
@@ -665,7 +666,7 @@
 	opl3sa2_read(hw_config->io_base, OPL3SA2_MIC, &tmp);
 	if((tmp & 0x9f) != 0x8a) {
 		printk(KERN_ERR
-		       "opl3sa2: Control I/O port %#x is not a YMF7xx chipset!\n",
+		       OPL3SA2_PFX "Control I/O port %#x is not a YMF7xx chipset!\n",
 		       hw_config->io_base);
 		return 0;
 	}
@@ -678,33 +679,33 @@
 	 * of the miscellaneous register.
 	 */
 	version = misc & 0x07;
-	printk(KERN_DEBUG "opl3sa2: chipset version = %#x\n", version);
+	printk(KERN_DEBUG OPL3SA2_PFX "chipset version = %#x\n", version);
 	switch(version) {
 		case 0:
 			chipset[card] = CHIPSET_UNKNOWN;
 			tag = '?'; /* silence compiler warning */
 			printk(KERN_ERR
-			       "opl3sa2: Unknown Yamaha audio controller version\n");
+			       OPL3SA2_PFX "Unknown Yamaha audio controller version\n");
 			break;
 
 		case VERSION_YMF711:
 			chipset[card] = CHIPSET_OPL3SA2;
 			tag = '2';
-			printk(KERN_INFO "opl3sa2: Found OPL3-SA2 (YMF711)\n");
+			printk(KERN_INFO OPL3SA2_PFX "Found OPL3-SA2 (YMF711)\n");
 			break;
 
 		case VERSION_YMF715:
 			chipset[card] = CHIPSET_OPL3SA3;
 			tag = '3';
 			printk(KERN_INFO
-			       "opl3sa2: Found OPL3-SA3 (YMF715 or YMF719)\n");
+			       OPL3SA2_PFX "Found OPL3-SA3 (YMF715 or YMF719)\n");
 			break;
 
 		case VERSION_YMF715B:
 			chipset[card] = CHIPSET_OPL3SA3;
 			tag = '3';
 			printk(KERN_INFO
-			       "opl3sa2: Found OPL3-SA3 (YMF715B or YMF719B)\n");
+			       OPL3SA2_PFX "Found OPL3-SA3 (YMF715B or YMF719B)\n");
 			break;
 
 		case VERSION_YMF715E:
@@ -712,7 +713,7 @@
 			chipset[card] = CHIPSET_OPL3SA3;
 			tag = '3';
 			printk(KERN_INFO
-			       "opl3sa2: Found OPL3-SA3 (YMF715E or YMF719E)\n");
+			       OPL3SA2_PFX "Found OPL3-SA3 (YMF715E or YMF719E)\n");
 			break;
 	}
 
@@ -765,7 +766,7 @@
 							  sizeof(struct mixer_operations),
 							  devc);
 		if(opl3sa2_mixer[card] < 0) {
-			printk(KERN_ERR "opl3sa2: Could not install %s master mixer\n",
+			printk(KERN_ERR OPL3SA2_PFX "Could not install %s master mixer\n",
 				 mixer_operations->name);
 		}
 		else
@@ -803,7 +804,7 @@
 		opl3sa2_write(hw_config->io_base, OPL3SA2_SYS_CTRL, sys_ctrl);
 	}
 	else {
-		printk(KERN_ERR "opl3sa2: not setting ymode, it must be one of 0,1,2,3\n");
+		printk(KERN_ERR OPL3SA2_PFX "not setting ymode, it must be one of 0,1,2,3\n");
 	}
 }
 
@@ -818,7 +819,7 @@
 		opl3sa2_write(hw_config->io_base, OPL3SA2_MISC, misc);
 	}
 	else {
-		printk(KERN_ERR "opl3sa2: not setting loopback, it must be either 0 or 1\n");
+		printk(KERN_ERR OPL3SA2_PFX "not setting loopback, it must be either 0 or 1\n");
 	}
 }
 
@@ -868,7 +869,7 @@
 	 */
 	ret = dev->prepare(dev);
 	if(ret && ret != -EBUSY) {
-		printk(KERN_ERR "opl3sa2: ISA PnP found device that could not be autoconfigured.\n");
+		printk(KERN_ERR OPL3SA2_PFX "ISA PnP found device that could not be autoconfigured.\n");
 		return -ENODEV;
 	}
 	if(ret == -EBUSY) {
@@ -876,13 +877,13 @@
 	}
 	else {
 		if(dev->activate(dev) < 0) {
-			printk(KERN_WARNING "opl3sa2: ISA PnP activate failed\n");
+			printk(KERN_WARNING OPL3SA2_PFX "ISA PnP activate failed\n");
 			opl3sa2_activated[card] = 0;
 			return -ENODEV;
 		}
 
 		printk(KERN_DEBUG
-		       "opl3sa2: Activated ISA PnP card %d (active=%d)\n",
+		       OPL3SA2_PFX "Activated ISA PnP card %d (active=%d)\n",
 		       card, dev->active);
 
 	}
@@ -1022,11 +1023,11 @@
 						  &cfg_mpu[card],
 						  card) < 0) {
 			if(!opl3sa2_cards_num)
-				printk(KERN_INFO "opl3sa2: No PnP cards found\n");
+				printk(KERN_INFO OPL3SA2_PFX "No PnP cards found\n");
 			if(io == -1)
 				break;
 			isapnp=0;
-			printk(KERN_INFO "opl3sa2: Search for a card at 0x%d.\n", io);
+			printk(KERN_INFO OPL3SA2_PFX "Search for a card at 0x%d.\n", io);
 			/* Fall through */
 		}
 #endif
@@ -1036,7 +1037,7 @@
 			if(io == -1 || irq == -1 || dma == -1 ||
 			   dma2 == -1 || mss_io == -1) {
 				printk(KERN_ERR
-				       "opl3sa2: io, mss_io, irq, dma, and dma2 must be set\n");
+				       OPL3SA2_PFX "io, mss_io, irq, dma, and dma2 must be set\n");
 				return -EINVAL;
 			}
 
@@ -1078,7 +1079,7 @@
 			 */
 			if(opl3sa2_cards_num) {
 				printk(KERN_WARNING
-				       "opl3sa2: There was a problem probing one "
+				       OPL3SA2_PFX "There was a problem probing one "
 				       " of the ISA PNP cards, continuing\n");
 				opl3sa2_cards_num--;
 				continue;
@@ -1104,7 +1105,7 @@
 		if(ymode != -1) {
 			if(chipset[card] == CHIPSET_OPL3SA2) {
 				printk(KERN_ERR
-				       "opl3sa2: ymode not supported on OPL3-SA2\n");
+				       OPL3SA2_PFX "ymode not supported on OPL3-SA2\n");
 			}
 			else {
 				opl3sa2_set_ymode(&cfg[card], ymode);
@@ -1126,7 +1127,7 @@
 	}
 
 	if(isapnp) {
-		printk(KERN_NOTICE "opl3sa2: %d PnP card(s) found.\n", opl3sa2_cards_num);
+		printk(KERN_NOTICE OPL3SA2_PFX "%d PnP card(s) found.\n", opl3sa2_cards_num);
 	}
 
 	return 0;
@@ -1155,7 +1156,7 @@
 			opl3sa2_dev[card]->deactivate(opl3sa2_dev[card]);
 
 			printk(KERN_DEBUG
-			       "opl3sa2: Deactivated ISA PnP card %d (active=%d)\n",
+			       OPL3SA2_PFX "Deactivated ISA PnP card %d (active=%d)\n",
 			       card, opl3sa2_dev[card]->active);
 		}
 #endif


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

* Re: [PATCH] printk prefix cleanups.
  2002-02-12  6:26 [PATCH] printk prefix cleanups Zwane Mwaikambo
@ 2002-02-12  6:46 ` Jeff Garzik
  2002-02-12  9:50 ` Horst von Brand
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2002-02-12  6:46 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Arnaldo Carvalho de Melo, Kernel Janitors, Linux Kernel

Zwane Mwaikambo wrote:
> 
> Here is a simple patch which reduces resultant binary size by 1.2k for
> this particular module (opl3sa2). Perhaps we should consider adding this
> on the janitor TODO list for cleaning up other printks.
> 
> Regards,
>         Zwane Mwaikambo
> 
> --- linux-2.4.18-pre8-zm1/drivers/sound/opl3sa2.c.orig  Mon Feb 11 02:25:50 2002
> +++ linux-2.4.18-pre8-zm1/drivers/sound/opl3sa2.c       Mon Feb 11 02:40:59 2002
> @@ -71,6 +71,7 @@
>  #include "mpu401.h"
> 
>  #define OPL3SA2_MODULE_NAME    "opl3sa2"
> +#define OPL3SA2_PFX            OPL3SA2_MODULE_NAME ": "
> 
>  /* Useful control port indexes: */
>  #define OPL3SA2_PM          0x01
> @@ -616,7 +617,7 @@
>                         AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_LINE);
>                 }
>                 else {
> -                       printk(KERN_ERR "opl3sa2: MSS mixer not installed?\n");
> +                       printk(KERN_ERR OPL3SA2_PFX "MSS mixer not installed?\n");
>                 }
>         }
>  }
> @@ -639,7 +640,7 @@
>          * Try and allocate our I/O port range.
>          */
>         if(!request_region(hw_config->io_base, 2, OPL3SA2_MODULE_NAME)) {
> -               printk(KERN_ERR "opl3sa2: Control I/O port %#x not free\n",
> +               printk(KERN_ERR OPL3SA2_PFX "Control I/O port %#x not free\n",

This reduces -binary- size, as shown by /usr/bin/size?  Strings should
be merged, which makes this strange...

Anyway, I might be able to claim to be the first user of 'PFX'.  You
will note that it does not have a prefix... on purpose.  The idea is to
save typing a repetitive and changing-for-each-driver string.

Just use 'PFX' in the source code, like you find in other drivers.

	Jeff




-- 
Jeff Garzik      | "I went through my candy like hot oatmeal
Building 1024    |  through an internally-buttered weasel."
MandrakeSoft     |             - goats.com

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

* Re: [PATCH] printk prefix cleanups.
       [not found] <mailman.1013495822.30629.linux-kernel2news@redhat.com>
@ 2002-02-12  7:18 ` Pete Zaitcev
  2002-02-12  7:26   ` Zwane Mwaikambo
  0 siblings, 1 reply; 7+ messages in thread
From: Pete Zaitcev @ 2002-02-12  7:18 UTC (permalink / raw)
  To: zwane; +Cc: Kernel Janitors, Linux Kernel

> Here is a simple patch which reduces resultant binary size by 1.2k for 
> this particular module (opl3sa2). [...]

>  #define OPL3SA2_MODULE_NAME	"opl3sa2"
> +#define OPL3SA2_PFX		OPL3SA2_MODULE_NAME ": "
 
> -			printk(KERN_ERR "opl3sa2: MSS mixer not installed?\n");
> +			printk(KERN_ERR OPL3SA2_PFX "MSS mixer not installed?\n");

I do not believe that it shortens binaries. Care to quote
size(1) output and /proc/modules with and without the patch?

-- Pete

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

* Re: [PATCH] printk prefix cleanups.
  2002-02-12  7:18 ` Pete Zaitcev
@ 2002-02-12  7:26   ` Zwane Mwaikambo
  2002-02-12  7:37     ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: Zwane Mwaikambo @ 2002-02-12  7:26 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: Kernel Janitors, Linux Kernel, Jeff Garzik

On Tue, 12 Feb 2002, Pete Zaitcev wrote:

> > Here is a simple patch which reduces resultant binary size by 1.2k for 
> > this particular module (opl3sa2). [...]
> 
> >  #define OPL3SA2_MODULE_NAME	"opl3sa2"
> > +#define OPL3SA2_PFX		OPL3SA2_MODULE_NAME ": "
>  
> > -			printk(KERN_ERR "opl3sa2: MSS mixer not installed?\n");
> > +			printk(KERN_ERR OPL3SA2_PFX "MSS mixer not installed?\n");
> 
> I do not believe that it shortens binaries. Care to quote
> size(1) output and /proc/modules with and without the patch?

It does _not_ reduce the memory footprint, that i knew before doing the 
patch, the only thing it does do is reduce the resultant binary's 
filesize. Surely thats worth it just for the space saving? size(1) reports 
the same sizes for both patched and unpatched.

Regards,
	Zwane Mwaikambo



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

* Re: [PATCH] printk prefix cleanups.
  2002-02-12  7:26   ` Zwane Mwaikambo
@ 2002-02-12  7:37     ` Jeff Garzik
  2002-02-12  7:46       ` Zwane Mwaikambo
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Garzik @ 2002-02-12  7:37 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Pete Zaitcev, Kernel Janitors, Linux Kernel

Zwane Mwaikambo wrote:
> 
> On Tue, 12 Feb 2002, Pete Zaitcev wrote:
> 
> > > Here is a simple patch which reduces resultant binary size by 1.2k for
> > > this particular module (opl3sa2). [...]
> >
> > >  #define OPL3SA2_MODULE_NAME        "opl3sa2"
> > > +#define OPL3SA2_PFX                OPL3SA2_MODULE_NAME ": "
> >
> > > -                   printk(KERN_ERR "opl3sa2: MSS mixer not installed?\n");
> > > +                   printk(KERN_ERR OPL3SA2_PFX "MSS mixer not installed?\n");
> >
> > I do not believe that it shortens binaries. Care to quote
> > size(1) output and /proc/modules with and without the patch?
> 
> It does _not_ reduce the memory footprint, that i knew before doing the
> patch, the only thing it does do is reduce the resultant binary's
> filesize. Surely thats worth it just for the space saving? size(1) reports
> the same sizes for both patched and unpatched.

If size(1) reports the same size, then no.

But I would still support a patch that added just 'PFX' to the driver...

	Jeff


-- 
Jeff Garzik      | "I went through my candy like hot oatmeal
Building 1024    |  through an internally-buttered weasel."
MandrakeSoft     |             - goats.com

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

* Re: [PATCH] printk prefix cleanups.
  2002-02-12  7:37     ` Jeff Garzik
@ 2002-02-12  7:46       ` Zwane Mwaikambo
  0 siblings, 0 replies; 7+ messages in thread
From: Zwane Mwaikambo @ 2002-02-12  7:46 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Pete Zaitcev, Kernel Janitors, Linux Kernel

On Tue, 12 Feb 2002, Jeff Garzik wrote:
> If size(1) reports the same size, then no.
> 
> But I would still support a patch that added just 'PFX' to the driver...

Damn LKML is a tough sell! I'll submit something a bit later on to add 
PFX.

Cheers,
	Zwane Mwaikambo



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

* Re: [PATCH] printk prefix cleanups.
  2002-02-12  6:26 [PATCH] printk prefix cleanups Zwane Mwaikambo
  2002-02-12  6:46 ` Jeff Garzik
@ 2002-02-12  9:50 ` Horst von Brand
  1 sibling, 0 replies; 7+ messages in thread
From: Horst von Brand @ 2002-02-12  9:50 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Arnaldo Carvalho de Melo, Kernel Janitors, Linux Kernel

Zwane Mwaikambo <zwane@linux.realnet.co.sz> said:
> Here is a simple patch which reduces resultant binary size by 1.2k for 
> this particular module (opl3sa2). Perhaps we should consider adding this 
> on the janitor TODO list for cleaning up other printks.

I don't see how changing "opl3sa2: stuff" to "opl3sa2" ": " "stuff" (which
is what you want to get after preprocesing, and which gcc will happily
concatenate to give exactly the former before doing anything else) can
change the size in any way...
-- 
Horst von Brand			     http://counter.li.org # 22616

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

end of thread, other threads:[~2002-02-12  9:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-12  6:26 [PATCH] printk prefix cleanups Zwane Mwaikambo
2002-02-12  6:46 ` Jeff Garzik
2002-02-12  9:50 ` Horst von Brand
     [not found] <mailman.1013495822.30629.linux-kernel2news@redhat.com>
2002-02-12  7:18 ` Pete Zaitcev
2002-02-12  7:26   ` Zwane Mwaikambo
2002-02-12  7:37     ` Jeff Garzik
2002-02-12  7:46       ` Zwane Mwaikambo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.