diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 23:55:22 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 07:25:23 -0400 |
commit | c5f841f1780dad7efb7eca092f60742d47f47d25 (patch) | |
tree | 6a27622d96f5327408c75b914c3a54120dc1d866 /drivers | |
parent | 3a35ce7dcefe9e80a00603a195269fbaf6e7d901 (diff) |
virtio: more neatening of virtio_ring macros.
Impact: cleanup
Roel Kluin drew attention to these macros with his patch: here I
neaten them a little further:
1) Add a comment on what START_USE and END_USE are checking,
2) Brackets around _vq in BAD_RING,
3) Neaten formatting for START_USE so it's less than 80 cols.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/virtio/virtio_ring.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 12273bf9b3b2..5c52369ab9bb 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -24,9 +24,15 @@ | |||
24 | #ifdef DEBUG | 24 | #ifdef DEBUG |
25 | /* For development, we want to crash whenever the ring is screwed. */ | 25 | /* For development, we want to crash whenever the ring is screwed. */ |
26 | #define BAD_RING(_vq, fmt...) \ | 26 | #define BAD_RING(_vq, fmt...) \ |
27 | do { dev_err(&_vq->vq.vdev->dev, fmt); BUG(); } while(0) | 27 | do { dev_err(&(_vq)->vq.vdev->dev, fmt); BUG(); } while(0) |
28 | #define START_USE(_vq) \ | 28 | /* Caller is supposed to guarantee no reentry. */ |
29 | do { if ((_vq)->in_use) panic("in_use = %i\n", (_vq)->in_use); (_vq)->in_use = __LINE__; mb(); } while(0) | 29 | #define START_USE(_vq) \ |
30 | do { \ | ||
31 | if ((_vq)->in_use) \ | ||
32 | panic("in_use = %i\n", (_vq)->in_use); \ | ||
33 | (_vq)->in_use = __LINE__; \ | ||
34 | mb(); \ | ||
35 | } while(0) | ||
30 | #define END_USE(_vq) \ | 36 | #define END_USE(_vq) \ |
31 | do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0) | 37 | do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0) |
32 | #else | 38 | #else |