[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1303791070-15196-1-git-send-email-namei.unix@gmail.com>
Date: Tue, 26 Apr 2011 12:11:10 +0800
From: Liu Yuan <namei.unix@...il.com>
To: Rusty Russell <rusty@...tcorp.com.au>,
"Michael S. Tsirkin" <mst@...hat.com>
Cc: linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: [PATCH] virtio, ring: Use ALIGN macros in virtio_ring.h
From: Liu Yuan <tailai.ly@...bao.com>
Signed-off-by: Liu Yuan <tailai.ly@...bao.com>
---
include/linux/virtio_ring.h | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index e4d144b..6299050 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -99,15 +99,13 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p,
vr->num = num;
vr->desc = p;
vr->avail = p + num*sizeof(struct vring_desc);
- vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1)
- & ~(align - 1));
+ vr->used = (void *)PTR_ALIGN(&vr->avail->ring[num], align);
}
static inline unsigned vring_size(unsigned int num, unsigned long align)
{
- return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
- + align - 1) & ~(align - 1))
- + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
+ return ((sizeof(struct vring_desc) * num + ALIGN(sizeof(__u16) * (2 + num), align))
+ + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num);
}
#ifdef __KERNEL__
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists