Skip to content

Commit

Permalink
dma-debug: use named initializers for dir2name
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Christoph Hellwig committed Jul 19, 2020
1 parent f1565c2 commit 23efed6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kernel/dma/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ static const char *type2name[] = {
[dma_debug_resource] = "resource",
};

static const char *dir2name[4] = { "DMA_BIDIRECTIONAL", "DMA_TO_DEVICE",
"DMA_FROM_DEVICE", "DMA_NONE" };
static const char *dir2name[] = {
[DMA_BIDIRECTIONAL] = "DMA_BIDIRECTIONAL",
[DMA_TO_DEVICE] = "DMA_TO_DEVICE",
[DMA_FROM_DEVICE] = "DMA_FROM_DEVICE",
[DMA_NONE] = "DMA_NONE",
};

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

0 comments on commit 23efed6

Please sign in to comment.