Re: [RFC] staging: csr: remove usage of CsrSnprintf and use snprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 16, 2012 at 04:24:49AM +0530, Devendra Naga wrote:
> This change tries to achieve the removal of the csr driver defined snprintf
> and uses the kernel defined snprintf.
> 
> After this change i got following build warnings, which are solved in this patch
> 
> warnings generated:
> 
> drivers/staging/csr/io.c:929:13: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘u32’
> drivers/staging/csr/io.c:929:13: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 5 has type ‘u32’
> drivers/staging/csr/csr_wifi_hip_udi.c: In function ‘unifi_print_status’:
> drivers/staging/csr/csr_wifi_hip_udi.c:78:27: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘u32’
> drivers/staging/csr/csr_wifi_hip_udi.c:151:27: warning: format ‘%u’ expects type ‘unsigned int’, but argument 5 has type ‘long int’
> drivers/staging/csr/csr_wifi_hip_udi.c:257:27: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘u32’
> drivers/staging/csr/csr_wifi_hip_udi.c:257:27: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 5 has type ‘u32’
> drivers/staging/csr/csr_wifi_hip_udi.c:261:27: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘u32’
> 
> Signed-off-by: Devendra Naga <develkernel412222@xxxxxxxxx>
> ---
>  This change is tested through compiling only, didn't tested on the hardware

This change is fine so far as it goes.

UNIFI_SNPRINTF_RET() is a disgusting macro.  If you wanted to remove
it at the same time that would be fine.

Use scnprintf().  The snprintf() function returns the number of
bytes which would have been written and the scnprintf() function
returns the number of bytes which actually were written.  It would
be something like:

	int len = 0;

	len += scnprintf(p + len, size - len, "Chip ID %u\n", ...);
	len += scnprintf(p + len, size - len, "Chip Version %04X\n", ...);

etc.

regards,
dan carpenter


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux