Re: How to printk unsigned long long variable?

From: Roland Dreier
Date: Fri Jun 15 2007 - 12:14:56 EST


> Is this right?

> dev->dev.dma_mask = bus->controller->dma_mask;
> printk(KERN_ERR "hey,jason,see,dma_mask is
> %llu\n",*(dev->dev.dma_mask));

No, why do you have the '*' -- dma_mask isn't a pointer, is it?

You probably want:

printk(KERN_ERR "hey,jason,see,dma_mask is %llx\n",
(unsigned long long) dev->dev.dma_mask);

(I would use a "%llx" format because masks are much clearer in hex).
The cast to unsigned long long is there because u64 is just unsigned
long on some 64-bit platforms, so you get a warning about the format
not matching on some architectures without the cast.

- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/