dma-debug: use named initializers for dir2name
PATCH 1/1 dma-debug: use named initializers for dir2name
Make dir2name a little more readable and maintainable by using named initializers.
--- kernel/dma/debug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/dma/debug.c +6 -2
@@ -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[4 ] = { + [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
Signature · 6 lines
2.27.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 13 lines · Christoph Hellwig
Make dir2name a little more readable and maintainable by using named initializers.
Signed-off-by Christoph Hellwig <[email protected]>--- kernel/dma/debug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)kernel/dma/debug.c +0
-0
kernel/dma/debug.c static const char *type2name[] = { · line 147
Quoted 6 lines
kernel/dma/debug.c +1
-2@@ -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[4 ] = {
Nit: I think you can probably drop the explicit array size here.
Otherwise, very welcome clarity!
kernel/dma/debug.c static const char *type2name[] = { · line 155
Quoted 9 lines
kernel/dma/debug.c +5
-0+ [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
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 7 lines · Robin Murphy
Quoted 1 line
+static const char *dir2name[4] = {
Nit: I think you can probably drop the explicit array size here.
Otherwise, very welcome clarity!
Reviewed-by Robin Murphy <[email protected]>
Applied with the explicit array size removed.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu