]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
virtio: more neatening of virtio_ring macros.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Mar 2009 03:55:22 +0000 (21:55 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Mar 2009 11:25:23 +0000 (21:55 +1030)
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>
drivers/virtio/virtio_ring.c

index 12273bf9b3b2f79de78e7612bf9c805a9af32a6e..5c52369ab9bb81115376ec3e8b959908bdbe8d8f 100644 (file)
 #ifdef DEBUG
 /* For development, we want to crash whenever the ring is screwed. */
 #define BAD_RING(_vq, fmt...)                  \
-       do { dev_err(&_vq->vq.vdev->dev, fmt); BUG(); } while(0)
-#define START_USE(_vq) \
-       do { if ((_vq)->in_use) panic("in_use = %i\n", (_vq)->in_use); (_vq)->in_use = __LINE__; mb(); } while(0)
+       do { dev_err(&(_vq)->vq.vdev->dev, fmt); BUG(); } while(0)
+/* Caller is supposed to guarantee no reentry. */
+#define START_USE(_vq)                                         \
+       do {                                                    \
+               if ((_vq)->in_use)                              \
+                       panic("in_use = %i\n", (_vq)->in_use);  \
+               (_vq)->in_use = __LINE__;                       \
+               mb();                                           \
+       } while(0)
 #define END_USE(_vq) \
        do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0)
 #else