Personally, I like this less.. I don't think the previous #define
DMA_ADDR_T_FMT (or whatever it was) is that bad, considering the options.
Once we set the precedent of having little 'char
* form_some_random_type()' functions, they will show up all over the
place.
I need something like this for the MTD patch I've got that supports 64
bit buswidths on 32 bit machines and needs to printk the data on error.
I found that #define CFI_FMT '%lx' or whatever to be more
straightforward, and easier to understand.
> + */
> +char *form_dma_addr_t(char *buf, dma_addr_t a)
> +{
> + char *fmt; /* Funny code to prevent a printf warning */
> +
> + if (sizeof(dma_addr_t) == sizeof(long))
> + fmt = "%lx";
> + else
> + fmt = "%Lx";
> +
> + sprintf(buf, fmt, a);
> + return buf;
> +}
-- Troy Benjegerdes | master of mispeeling | 'da hozer' | hozer@drgw.net -----"If this message isn't misspelled, I didn't write it" -- Me ----- "Why do musicians compose symphonies and poets write poems? They do it because life wouldn't have any meaning for them if they didn't. That's why I draw cartoons. It's my life." -- Charles Schulz - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/