* [PATCH] dma-debug: use named initializers for dir2name
@ 2020-07-16 15:01 Christoph Hellwig
2020-07-16 16:12 ` Robin Murphy
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-07-16 15:01 UTC (permalink / raw)
To: iommu
Make dir2name a little more readable and maintainable by using
named initializers.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
kernel/dma/debug.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
index 36c962a86bf25d..41e720c3ab20c5 100644
--- a/kernel/dma/debug.c
+++ b/kernel/dma/debug.c
@@ -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
--
2.27.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dma-debug: use named initializers for dir2name
2020-07-16 15:01 [PATCH] dma-debug: use named initializers for dir2name Christoph Hellwig
@ 2020-07-16 16:12 ` Robin Murphy
2020-07-20 6:23 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Robin Murphy @ 2020-07-16 16:12 UTC (permalink / raw)
To: Christoph Hellwig, iommu
On 2020-07-16 16:01, Christoph Hellwig wrote:
> Make dir2name a little more readable and maintainable by using
> named initializers.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> kernel/dma/debug.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c
> index 36c962a86bf25d..41e720c3ab20c5 100644
> --- a/kernel/dma/debug.c
> +++ b/kernel/dma/debug.c
> @@ -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!
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> + [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
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dma-debug: use named initializers for dir2name
2020-07-16 16:12 ` Robin Murphy
@ 2020-07-20 6:23 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-07-20 6:23 UTC (permalink / raw)
To: Robin Murphy; +Cc: iommu, Christoph Hellwig
On Thu, Jul 16, 2020 at 05:12:30PM +0100, Robin Murphy wrote:
>> +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 <robin.murphy@arm.com>
Applied with the explicit array size removed.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-20 6:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 15:01 [PATCH] dma-debug: use named initializers for dir2name Christoph Hellwig
2020-07-16 16:12 ` Robin Murphy
2020-07-20 6:23 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).