Skip to content

Commit 23efed6

Browse files
author
Christoph Hellwig
committed
dma-debug: use named initializers for dir2name
Make dir2name a little more readable and maintainable by using named initializers. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Robin Murphy <[email protected]>
1 parent f1565c2 commit 23efed6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/dma/debug.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,12 @@ static const char *type2name[] = {
144144
[dma_debug_resource] = "resource",
145145
};
146146

147-
static const char *dir2name[4] = { "DMA_BIDIRECTIONAL", "DMA_TO_DEVICE",
148-
"DMA_FROM_DEVICE", "DMA_NONE" };
147+
static const char *dir2name[] = {
148+
[DMA_BIDIRECTIONAL] = "DMA_BIDIRECTIONAL",
149+
[DMA_TO_DEVICE] = "DMA_TO_DEVICE",
150+
[DMA_FROM_DEVICE] = "DMA_FROM_DEVICE",
151+
[DMA_NONE] = "DMA_NONE",
152+
};
149153

150154
/*
151155
* The access to some variables in this macro is racy. We can't use atomic_t

0 commit comments

Comments
 (0)