Skip to contentSkip to conversation

cx88: fix printk arg. type

PATCH In review Randy.Dunlap 5 participants 8 messages Nov 16, 2004 – Nov 17, 2004 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cx88: fix printk arg. type

drivers/media/video/cx88/cx88-blackbird.c:366: warning: long int format, size_t arg (arg 3)

diffstat:=

  drivers/media/video/cx88/cx88-blackbird.c |    2 +-
  1 files changed, 1 insertion(+), 1 deletion(-)
drivers/media/video/cx88/cx88-blackbird.c renamed from drivers/media/video/cx88/cx88-blackbird.c~cx88_types +1 -1
diff -Naurp ./drivers/media/video/cx88/cx88-blackbird.c~cx88_types ./drivers/media/video/cx88/cx88-blackbird.c
@@ -363,7 +363,7 @@ static int blackbird_load_firmware(struc
 	}
 
 	if (firmware->size != BLACKBIRD_FIRM_IMAGE_SIZE) {
-		dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
+		dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",
 			firmware->size, BLACKBIRD_FIRM_IMAGE_SIZE);
 		return -1;
 	}
#1 lore raw

drivers/media/video/cx88/cx88-blackbird.c static int blackbird_load_firmware(struc · line 366

Quoted 2 lines
drivers/media/video/cx88/cx88-blackbird.c renamed from drivers/media/video/cx88/cx88-blackbird.c~cx88_types +1 -1
-		dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
+		dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",

Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel printk specific thingy? Or is this standardized somewhere? So I could use that in userspace code as well maybe?

Gerd

Signature · 1 line
#define printk(args...) fprintf(stderr, ## args)
#2 lore raw
Quoted 7 lines · Gerd Knorr

drivers/media/video/cx88/cx88-blackbird.c static int blackbird_load_firmware(struc · line 366

Quoted 2 lines
drivers/media/video/cx88/cx88-blackbird.c renamed from drivers/media/video/cx88/cx88-blackbird.c~cx88_types +1 -1
-		dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
+		dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",

Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel printk specific thingy? Or is this standardized somewhere? So I could use that in userspace code as well maybe?

Kernel supports/allows 'Z' or 'z'.
C99 spec defines 'z' only as a size_t format length modifier:

z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument.

Anyway, I agree with Al. Will you please change it to 'z' instead of 'Z'?

Thanks,

Signature · 1 line
~Randy
#6 lore raw
In reply to Gerd Knorr
Quoted 6 lines · Gerd Knorr

drivers/media/video/cx88/cx88-blackbird.c static int blackbird_load_firmware(struc · line 366

Quoted 2 lines
drivers/media/video/cx88/cx88-blackbird.c renamed from drivers/media/video/cx88/cx88-blackbird.c~cx88_types +1 -1
-		dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
+		dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",

Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel printk specific thingy? Or is this standardized somewhere? So I could use that in userspace code as well maybe?

btw Gerd, did you see the patch I sent to the video4linux mailing list last sunday? It includes some small fixes to make things much closer to working (some +1/-1 type fixes). After that patch, the main open issue is syncing the video scaling and audio muting settings between the two video devices/chips (2388 and 23416) -> The cx23416 needs to be set to the same (/related) video scaling settings as the 2388, and the 2388 audio must be unmuted for the mpeg stream to contain audio.

And of course then it needs some ioctl for the mpeg codec settings.

Jelle.

Quoted 2 lines

Gerd

#3 lore raw
In reply to Randy.Dunlap
Quoted 1 line

C99 spec defines 'z' only as a size_t format length modifier:

Thanks.

Quoted 2 lines

Anyway, I agree with Al. Will you please change it to 'z' instead of 'Z'?

Done.

Gerd

Signature · 1 line
#define printk(args...) fprintf(stderr, ## args)
#7 lore raw
In reply to Gerd Knorr
Quoted 6 lines · Gerd Knorr

drivers/media/video/cx88/cx88-blackbird.c static int blackbird_load_firmware(struc · line 366

Quoted 2 lines
drivers/media/video/cx88/cx88-blackbird.c renamed from drivers/media/video/cx88/cx88-blackbird.c~cx88_types +1 -1
-		dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
+		dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",

Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel printk specific thingy? Or is this standardized somewhere? So I could use that in userspace code as well maybe?

'Z' is an obsolete equivalent of standard 'z'. That one is portable and it is, indeed, available in userland (libc6 and anything C99-compliant). To quote the manpage:

z A following integer conversion corresponds to a size_t or
ssize_t argument. (Linux libc5 has Z with this meaning. Don't use it.)

t A following integer conversion corresponds to a ptrdiff_t argu-
ment.

Please, do s/Zd/zd/.

One more thing: folks, please stop using crap like "%08x", (int)pointer. It's not only non-portable (consider 64bit boxen), it's extra work for no good reason. "%p" is standard and will do the right thing with less PITA.

#4 lore raw
In reply to Randy.Dunlap
Quoted 13 lines · Randy.Dunlap
Quoted 7 lines · Gerd Knorr

drivers/media/video/cx88/cx88-blackbird.c static int blackbird_load_firmware(struc · line 366

Quoted 2 lines
drivers/media/video/cx88/cx88-blackbird.c renamed from drivers/media/video/cx88/cx88-blackbird.c~cx88_types +1 -1
-		dprintk(0, "ERROR: Firmware size mismatch (have %ld, expected %d)\n",
+		dprintk(0, "ERROR: Firmware size mismatch (have %Zd, expected %d)\n",

Thanks, merged to cvs. I like that 'Z'. Or is that just a linux-kernel printk specific thingy? Or is this standardized somewhere? So I could use that in userspace code as well maybe?

Kernel supports/allows 'Z' or 'z'.
C99 spec defines 'z' only as a size_t format length modifier:

Quoted 7 lines

z Specifies that a following d, i, o, u, x, or X conversion
specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument.

Anyway, I agree with Al. Will you please change it to 'z' instead of 'Z'?

gcc-2.95.x generates warnings for `z', but is happy with 'Z'.

But I seem to be the only person who uses 2.95, and I patched my version to stop that warning anyway, so...

#5 lore raw
Quoted 9 lines · Andrew Morton
Quoted 7 lines · Randy.Dunlap

Gerd Knorr wrote:

Kernel supports/allows 'Z' or 'z'.
C99 spec defines 'z' only as a size_t format length modifier:

z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument.

Quoted 8 lines
Quoted 2 lines

Anyway, I agree with Al. Will you please change it to 'z' instead of 'Z'?

gcc-2.95.x generates warnings for `z', but is happy with 'Z'.

But I seem to be the only person who uses 2.95, and I patched my version to stop that warning anyway, so...

Argh, I had forgotten that one....

Signature · 1 line
~Randy