diff options
author | Hans J. Koch <hjk@linutronix.de> | 2008-09-18 17:53:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-16 12:24:53 -0400 |
commit | e2b39df119712ea5184562a6a14696a5cea8ef18 (patch) | |
tree | b855a7b4e8893df122c96c69976d37a1a563492e /drivers/uio/uio.c | |
parent | 99178b036c97293a65004ff5ec5cff9f833aaecd (diff) |
UIO: Add alignment warnings for uio-mem
This patch adds an "offset" attribute for UIO mappings. It shows the
difference between the actual start address of the memory and the start
address of the page.
Signed-off-by: Hans J. Koch <hjk@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/uio/uio.c')
-rw-r--r-- | drivers/uio/uio.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 9ac22c7c3854..557e73ef5884 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -67,6 +67,11 @@ static ssize_t map_size_show(struct uio_mem *mem, char *buf) | |||
67 | return sprintf(buf, "0x%lx\n", mem->size); | 67 | return sprintf(buf, "0x%lx\n", mem->size); |
68 | } | 68 | } |
69 | 69 | ||
70 | static ssize_t map_offset_show(struct uio_mem *mem, char *buf) | ||
71 | { | ||
72 | return sprintf(buf, "0x%lx\n", mem->addr & ~PAGE_MASK); | ||
73 | } | ||
74 | |||
70 | struct uio_sysfs_entry { | 75 | struct uio_sysfs_entry { |
71 | struct attribute attr; | 76 | struct attribute attr; |
72 | ssize_t (*show)(struct uio_mem *, char *); | 77 | ssize_t (*show)(struct uio_mem *, char *); |
@@ -77,10 +82,13 @@ static struct uio_sysfs_entry addr_attribute = | |||
77 | __ATTR(addr, S_IRUGO, map_addr_show, NULL); | 82 | __ATTR(addr, S_IRUGO, map_addr_show, NULL); |
78 | static struct uio_sysfs_entry size_attribute = | 83 | static struct uio_sysfs_entry size_attribute = |
79 | __ATTR(size, S_IRUGO, map_size_show, NULL); | 84 | __ATTR(size, S_IRUGO, map_size_show, NULL); |
85 | static struct uio_sysfs_entry offset_attribute = | ||
86 | __ATTR(offset, S_IRUGO, map_offset_show, NULL); | ||
80 | 87 | ||
81 | static struct attribute *attrs[] = { | 88 | static struct attribute *attrs[] = { |
82 | &addr_attribute.attr, | 89 | &addr_attribute.attr, |
83 | &size_attribute.attr, | 90 | &size_attribute.attr, |
91 | &offset_attribute.attr, | ||
84 | NULL, /* need to NULL terminate the list of attributes */ | 92 | NULL, /* need to NULL terminate the list of attributes */ |
85 | }; | 93 | }; |
86 | 94 | ||