Re: How to printk unsigned long long variable?
From: jidong xiao
Date: Fri Jun 15 2007 - 12:18:23 EST
dma_mask should be a pointer, I mean, the element in struct device, see below,
struct device {
struct list_head node; /* node in sibling list */
struct list_head bus_list; /* node in bus's list */
struct list_head driver_list;
struct list_head children;
struct device * parent;
struct kobject kobj;
char bus_id[BUS_ID_SIZE]; /* position on parent bus */
struct bus_type * bus; /* type of bus device is on */
struct device_driver *driver; /* which driver has allocated this
device */
void *driver_data; /* data private to the driver */
void *platform_data; /* Platform specific data (e.g. ACPI,
BIOS data relevant to device) */
struct dev_pm_info power;
u32 detach_state; /* State to enter when device is
detached from its driver. */
u64 *dma_mask; /* dma mask (if dma'able device) */
u64 coherent_dma_mask;/* Like dma_mask, but for
alloc_coherent mappings as
not all hardware supports
64 bit addresses for consistent
allocations such descriptors. */
struct list_head dma_pools; /* dma pools (if dma'ble) */
struct dma_coherent_mem *dma_mem; /* internal for coherent mem
override */
void (*release)(struct device * dev);
};
Regards
Jason Xiao
On 6/16/07, Roland Dreier <rdreier@xxxxxxxxx> wrote:
> 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/