Skip to contentSkip to conversation

__FUNCTION__ string concatenation

PATCH In review Clemens Buchacher 3 participants 8 messages Jul 5, 2004 – Sep 22, 2004

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

PATCH 1/1 __FUNCTION__ string concatenation

I've replaced the __FUNCTION__ string concatenation with the %s placeholder and a printf parameter in drivers/net/wireless/prism65/islpci_mgt.h, as suggested in the TODO list.

I don't have the hardware to do a run-time check. It should not pose any problems though.

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/07/04 22:08:37+02:00 [email protected]
# __FUNCTION__ string concatenation is deprecated
#

# drivers/net/wireless/prism54/islpci_mgt.h
#   2004/07/03 17:18:20+02:00 [email protected] +1 -1
#   __FUNCTION__ string concatenation is deprecated
# 
diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h
--- a/drivers/net/wireless/prism54/islpci_mgt.h	2004-07-05 13:33:10 +02:00
+++ b/drivers/net/wireless/prism54/islpci_mgt.h	2004-07-05 13:33:10 +02:00
@@ -31,7 +31,7 @@
 #define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
 #define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
-#define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> " __FUNCTION__ "()\n", devname)
+#define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> %s()\n", devname, __FUNCTION__)

extern int pc_debug;
#define init_wds 0 /* help compiler optimize away dead code */

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

PATCH 1/1 __FUNCTION__ string concatenation

Description: __FUNCTION__ string concatenation is deprecated

Diff against linux-2.6 up to [email protected] (04/09/18 20:30:01)

 arch/mips/au1000/common/usbdev.c |    4 ++--
 drivers/net/gt96100eth.c         |   10 +++++-----
 sound/oss/au1000.c               |    2 +-
 sound/oss/ite8172.c              |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

Status: untested

# sound/oss/ite8172.c
#   2004/09/20 14:52:26+02:00 [email protected] +1 -1
#   __FUNCTION__ string concatenation is deprecated
# 
# sound/oss/au1000.c
#   2004/09/20 14:52:26+02:00 [email protected] +1 -1
#   __FUNCTION__ string concatenation is deprecated
# 
# drivers/net/gt96100eth.c
#   2004/09/20 14:52:26+02:00 [email protected] +5 -5
#   __FUNCTION__ string concatenation is deprecated
# 
# arch/mips/au1000/common/usbdev.c
#   2004/09/20 14:52:26+02:00 [email protected] +2 -2
#   __FUNCTION__ string concatenation is deprecated
# 
diff -Nru a/arch/mips/au1000/common/usbdev.c b/arch/mips/au1000/common/usbdev.c
--- a/arch/mips/au1000/common/usbdev.c	2004-09-20 15:14:54 +02:00
+++ b/arch/mips/au1000/common/usbdev.c	2004-09-20 15:14:54 +02:00
@@ -351,7 +351,7 @@
 {
 	u32 cs;

- warn(__FUNCTION__);
+ warn("%s", __FUNCTION__);

cs = au_readl(ep->reg->ctrl_stat) | USBDEV_CS_STALL; au_writel(cs, ep->reg->ctrl_stat);
@@ -363,7 +363,7 @@
{
u32 cs;

- warn(__FUNCTION__);
+ warn("%s", __FUNCTION__);

cs = au_readl(ep->reg->ctrl_stat) & ~USBDEV_CS_STALL; au_writel(cs, ep->reg->ctrl_stat);

drivers/net/gt96100eth.c +5 -5
diff -Nru a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c
@@ -73,7 +73,7 @@
 static void dump_skb(int dbg_lvl, struct net_device *dev,
 		     struct sk_buff *skb);
 static void dump_hw_addr(int dbg_lvl, struct net_device *dev,
-			 const char* pfx, unsigned char* addr_str);
+			 const char* pfx, const char* func, unsigned char* addr_str);
 static void update_stats(struct gt96100_private *gp);
 static void abort(struct net_device *dev, u32 abort_bits);
 static void hard_stop(struct net_device *dev);
@@ -336,13 +336,13 @@
 
 static void
 dump_hw_addr(int dbg_lvl, struct net_device *dev, const char* pfx,
-	     unsigned char* addr_str)
+	     const char* func, unsigned char* addr_str)
 {
 	int i;
 	char buf[100], octet[5];
     
 	if (dbg_lvl <= GT96100_DEBUG) {
-		strcpy(buf, pfx);
+		sprintf(buf, pfx, func);
 		for (i = 0; i < 6; i++) {
 			sprintf(octet, "%2.2x%s",
 				addr_str[i], i<5 ? ":" : "\n");
@@ -710,7 +710,7 @@
 
 	info("%s found at 0x%x, irq %d\n",
 	     chip_name(gp->chip_rev), gtif->iobase, gtif->irq);
-	dump_hw_addr(0, dev, "HW Address ", dev->dev_addr);
+	dump_hw_addr(0, dev, "%s: HW Address ", __FUNCTION__, dev->dev_addr);
 	info("%s chip revision=%d\n", chip_name(gp->chip_rev), gp->chip_rev);
 	info("%s ethernet port %d\n", chip_name(gp->chip_rev), gp->port_num);
 	info("external PHY ID1=0x%04x, ID2=0x%04x\n", phy_id1, phy_id2);
@@ -1490,7 +1490,7 @@
 		gt96100_add_hash_entry(dev, dev->dev_addr);
 
 		for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) {
-			dump_hw_addr(2, dev, __FUNCTION__ ": addr=",
+			dump_hw_addr(2, dev, "%s: addr=", __FUNCTION__,
 				     mcptr->dmi_addr);
 			gt96100_add_hash_entry(dev, mcptr->dmi_addr);
 		}
sound/oss/au1000.c +1 -1
diff -Nru a/sound/oss/au1000.c b/sound/oss/au1000.c
@@ -1317,7 +1317,7 @@
 	unsigned long   size;
 	int ret = 0;
 
-	dbg(__FUNCTION__);
+	dbg("%s", __FUNCTION__);
     
 	lock_kernel();
 	down(&s->sem);
sound/oss/ite8172.c +1 -1
diff -Nru a/sound/oss/ite8172.c b/sound/oss/ite8172.c
@@ -1847,7 +1847,7 @@
 	struct it8172_state *s = (struct it8172_state *)file->private_data;
 
 #ifdef IT8172_VERBOSE_DEBUG
-	dbg(__FUNCTION__);
+	dbg("%s", __FUNCTION__);
 #endif
 	lock_kernel();
 	if (file->f_mode & FMODE_WRITE)

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

PATCH 1/1 __FUNCTION__ string concatenation

In reply to Clemens Buchacher

Description: __FUNCTION__ string concatenation is deprecated

Diff against linux-2.6 up to [email protected] (04/09/18 20:30:01)

 drivers/net/wireless/prism54/islpci_mgt.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Status: compile time tested

# drivers/net/wireless/prism54/islpci_mgt.h
#   2004/09/20 14:52:26+02:00 [email protected] +1 -1
#   __FUNCTION__ string concatenation is deprecated
diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h
--- a/drivers/net/wireless/prism54/islpci_mgt.h	2004-09-20 15:14:54 +02:00
+++ b/drivers/net/wireless/prism54/islpci_mgt.h	2004-09-20 15:14:54 +02:00
@@ -31,7 +31,7 @@
 #define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
 #define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
-#define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> " __FUNCTION__ "()\n", devname)
+#define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> %s()\n", devname, __FUNCTION__)

extern int pc_debug;
#define init_wds 0 /* help compiler optimize away dead code */

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

PATCH 1/1 __FUNCTION__ string concatenation

In reply to Clemens Buchacher

Description: __FUNCTION__ string concatenation is deprecated

Diff against linux-2.6 up to [email protected] (04/09/18 20:30:01)

 arch/mips/au1000/db1x00/mirage_ts.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Status: untested

# arch/mips/au1000/db1x00/mirage_ts.c
#   2004/09/20 14:52:26+02:00 [email protected] +1 -1
#   __FUNCTION__ string concatenation is deprecated
diff -Nru a/arch/mips/au1000/db1x00/mirage_ts.c b/arch/mips/au1000/db1x00/mirage_ts.c
--- a/arch/mips/au1000/db1x00/mirage_ts.c	2004-09-20 15:14:54 +02:00
+++ b/arch/mips/au1000/db1x00/mirage_ts.c	2004-09-20 15:14:54 +02:00
@@ -68,7 +68,7 @@
 #define err(format, arg...) printk(KERN_ERR TS_NAME ": " format "\n" , ## arg)
 #define info(format, arg...) printk(KERN_INFO TS_NAME ": " format "\n" , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING TS_NAME ": " format "\n" , ## arg)
-#define DPRINTK(format, arg...) printk(__FUNCTION__ ": " format "\n" , ## arg)
+#define DPRINTK(format, arg...) printk("%s: " format "\n", __FUNCTION__ , ## arg)

#define PEN_DOWN_IRQ AU1000_GPIO_7

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Clemens Buchacher

On Mon, 20 Sep 2004, Clemens Buchacher wrote:
..

drivers/net/wireless/prism54/islpci_mgt.h line 34

Quoted 9 lines

diff -Nru a/drivers/net/wireless/prism54/islpci_mgt.h b/drivers/net/wireless/prism54/islpci_mgt.h

drivers/net/wireless/prism54/islpci_mgt.h +1 -1
@@ -31,7 +31,7 @@
 #define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
 #define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
 
-#define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> " __FUNCTION__ "()\n", devname)
+#define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> %s()\n", devname, __FUNCTION__)

TRACE() is used nowhere, there is a better one, which completly removes it in latest kj tree.

Quoted 8 lines
drivers/net/wireless/prism54/islpci_mgt.h +0 -0
 extern int pc_debug;
 #define init_wds 0	/* help compiler optimize away dead code */
 

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#5 lore raw
In reply to Clemens Buchacher
Quoted 10 lines · Clemens Buchacher

Description: __FUNCTION__ string concatenation is deprecated

Diff against linux-2.6 up to [email protected] (04/09/18 20:30:01)

 arch/mips/au1000/common/usbdev.c |    4 ++--
 drivers/net/gt96100eth.c         |   10 +++++-----
 sound/oss/au1000.c               |    2 +-
 sound/oss/ite8172.c              |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)
Quoted 4 lines

Status: untested

would be cool to get those in 4 separeted mails and compile tested.

see also "the perfect patch" by akpm
-> http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt

thanks
a++

--
maks
kernel janitor http://janitor.kernelnewbies.org/

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#6 lore raw
In reply to Clemens Buchacher
Quoted 10 lines · maximilian attems
Quoted 8 lines · Clemens Buchacher
 arch/mips/au1000/common/usbdev.c |    4 ++--
 drivers/net/gt96100eth.c         |   10 +++++-----
 sound/oss/au1000.c               |    2 +-
 sound/oss/ite8172.c              |    2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

Status: untested

would be cool to get those in 4 separeted mails and compile tested.

Unfortunately, the whole MIPS tree seems to be in no condition to compile. It would probably be a better idea to apply this patch to the linux-mips branch.

I will do that as soon as I can free enough bandwidth to pull from linux-mips.bkbits.net.

Clemens

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#7 lore raw
In reply to Clemens Buchacher

Hi Clemens, thanks a bunch for doing this work!
I have access to these MIPS boards so I can test
these drivers soon.

Steve

Quoted 20 lines · Clemens Buchacher
Quoted 9 lines · maximilian attems
Quoted 6 lines · Clemens Buchacher
arch/mips/au1000/common/usbdev.c |    4 ++--
drivers/net/gt96100eth.c         |   10 +++++-----
sound/oss/au1000.c               |    2 +-
sound/oss/ite8172.c              |    2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
Quoted 7 lines
Quoted 4 lines

Status: untested

would be cool to get those in 4 separeted mails and compile tested.

Quoted 9 lines

Unfortunately, the whole MIPS tree seems to be in no condition to compile. It would probably be a better idea to apply this patch to the linux-mips branch.

I will do that as soon as I can free enough bandwidth to pull from linux-mips.bkbits.net.

Clemens

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors