浏览代码

usb: gadget: s3c2410_udc: Remove static char buffer, use vsprintf extension %pV

Using unnecessary static char buffers isn't good.
Use the %pV extension instead.

Miscellanea:

o the dprintk return value is unused, make it void
o add __printf format and argument verification

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Joe Perches 10 年之前
父节点
当前提交
d74c23d36e
共有 1 个文件被更改,包括 13 次插入15 次删除
  1. 13 15
      drivers/usb/gadget/udc/s3c2410_udc.c

+ 13 - 15
drivers/usb/gadget/udc/s3c2410_udc.c

@@ -92,40 +92,38 @@ static struct s3c2410_udc_mach_info *udc_info;
 
 
 static uint32_t s3c2410_ticks = 0;
 static uint32_t s3c2410_ticks = 0;
 
 
-static int dprintk(int level, const char *fmt, ...)
+__printf(2, 3)
+static void dprintk(int level, const char *fmt, ...)
 {
 {
-	static char printk_buf[1024];
 	static long prevticks;
 	static long prevticks;
 	static int invocation;
 	static int invocation;
+	struct va_format vaf;
 	va_list args;
 	va_list args;
-	int len;
 
 
 	if (level > USB_S3C2410_DEBUG_LEVEL)
 	if (level > USB_S3C2410_DEBUG_LEVEL)
-		return 0;
+		return;
+
+	va_start(args, fmt);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
 
 
 	if (s3c2410_ticks != prevticks) {
 	if (s3c2410_ticks != prevticks) {
 		prevticks = s3c2410_ticks;
 		prevticks = s3c2410_ticks;
 		invocation = 0;
 		invocation = 0;
 	}
 	}
 
 
-	len = scnprintf(printk_buf,
-			sizeof(printk_buf), "%1lu.%02d USB: ",
-			prevticks, invocation++);
+	pr_debug("%1lu.%02d USB: %pV", prevticks, invocation++, &vaf);
 
 
-	va_start(args, fmt);
-	len = vscnprintf(printk_buf+len,
-			sizeof(printk_buf)-len, fmt, args);
 	va_end(args);
 	va_end(args);
-
-	pr_debug("%s", printk_buf);
-	return len;
 }
 }
 #else
 #else
-static int dprintk(int level, const char *fmt, ...)
+__printf(2, 3)
+static void dprintk(int level, const char *fmt, ...)
 {
 {
-	return 0;
 }
 }
 #endif
 #endif
+
 static int s3c2410_udc_debugfs_seq_show(struct seq_file *m, void *p)
 static int s3c2410_udc_debugfs_seq_show(struct seq_file *m, void *p)
 {
 {
 	u32 addr_reg, pwr_reg, ep_int_reg, usb_int_reg;
 	u32 addr_reg, pwr_reg, ep_int_reg, usb_int_reg;