* [PATCH] checks: Update #{size,address}-cells check for 'dma-ranges'
@ 2023-01-12 12:56 Qun-Wei Lin
[not found] ` <20230112125654.13390-1-qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Qun-Wei Lin @ 2023-01-12 12:56 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
casper.li-NuS5LvNUpcJWk0Htik3J/w,
chinwen.chang-NuS5LvNUpcJWk0Htik3J/w,
kuan-ying.lee-NuS5LvNUpcJWk0Htik3J/w,
ivan.tseng-NuS5LvNUpcJWk0Htik3J/w,
ladon.huang-NuS5LvNUpcJWk0Htik3J/w, Qun-Wei Lin
The "dma-ranges" property value is a sequence of
child-address parent-address child-size
The size of each field is determined by taking the child's
"#address-cells" value, the parent's "#address-cells" value,
and the child's "#size-cells" value.
However, in the following example, it gives a false alarm:
+-----------------------------------+---------------------------------------+
| ranges.dts | dma-ranges.dts |
+-----------------------------------+---------------------------------------+
| /dts-v1/; | /dts-v1/; |
| | |
| /{ | /{ |
| #address-cells = <1>; | #address-cells = <1>; |
| | |
| parent { | parent { |
| #address-cells = <1>; | #address-cells = <1>; |
| #size-cells = <1>; | #size-cells = <1>; |
| ranges = <0x0 0xe000 0x1000>; | dma-ranges = <0x0 0xe000 0x1000>; |
| child { | child { |
| ... | ... |
| }; | }; |
| }; | }; |
| }; | }; |
+-----------------------------------+---------------------------------------+
| no warning | Warning (avoid_unnecessary_addr_size) |
+-----------------------------------+---------------------------------------+
Same as "ranges", it should not be reported in this check.
Signed-off-by: Qun-Wei Lin <qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
checks.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/checks.c b/checks.c
index afa8f23..607e0f2 100644
--- a/checks.c
+++ b/checks.c
@@ -1232,7 +1232,7 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
if (!node->parent || node->addr_cells < 0 || node->size_cells < 0)
return;
- if (get_property(node, "ranges") || !node->children)
+ if (get_property(node, "ranges") || get_property(node, "dma-ranges") || !node->children)
return;
for_each_child(node, child) {
@@ -1242,7 +1242,7 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
}
if (!has_reg)
- FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property");
+ FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or child \"reg\" property");
}
WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);
--
2.18.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] checks: Update #{size,address}-cells check for 'dma-ranges'
[not found] ` <20230112125654.13390-1-qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2023-01-12 19:47 ` Rob Herring
[not found] ` <CAL_JsqKkE_Aytd_7WOV3iM+pipjnwDWR7yt=L+xE8+cyjL8b9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-02 6:48 ` David Gibson
1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2023-01-12 19:47 UTC (permalink / raw)
To: Qun-Wei Lin
Cc: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
casper.li-NuS5LvNUpcJWk0Htik3J/w,
chinwen.chang-NuS5LvNUpcJWk0Htik3J/w,
kuan-ying.lee-NuS5LvNUpcJWk0Htik3J/w,
ivan.tseng-NuS5LvNUpcJWk0Htik3J/w,
ladon.huang-NuS5LvNUpcJWk0Htik3J/w
On Thu, Jan 12, 2023 at 6:59 AM Qun-Wei Lin <qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
>
> The "dma-ranges" property value is a sequence of
> child-address parent-address child-size
>
> The size of each field is determined by taking the child's
> "#address-cells" value, the parent's "#address-cells" value,
> and the child's "#size-cells" value.
>
> However, in the following example, it gives a false alarm:
> +-----------------------------------+---------------------------------------+
> | ranges.dts | dma-ranges.dts |
> +-----------------------------------+---------------------------------------+
> | /dts-v1/; | /dts-v1/; |
> | | |
> | /{ | /{ |
> | #address-cells = <1>; | #address-cells = <1>; |
> | | |
> | parent { | parent { |
> | #address-cells = <1>; | #address-cells = <1>; |
> | #size-cells = <1>; | #size-cells = <1>; |
> | ranges = <0x0 0xe000 0x1000>; | dma-ranges = <0x0 0xe000 0x1000>; |
> | child { | child { |
> | ... | ... |
> | }; | }; |
> | }; | }; |
> | }; | }; |
> +-----------------------------------+---------------------------------------+
> | no warning | Warning (avoid_unnecessary_addr_size) |
> +-----------------------------------+---------------------------------------+
>
> Same as "ranges", it should not be reported in this check.
Except that dma-ranges only makes sense if there is a ranges property.
Rob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checks: Update #{size,address}-cells check for 'dma-ranges'
[not found] ` <20230112125654.13390-1-qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2023-01-12 19:47 ` Rob Herring
@ 2023-02-02 6:48 ` David Gibson
1 sibling, 0 replies; 4+ messages in thread
From: David Gibson @ 2023-02-02 6:48 UTC (permalink / raw)
To: Qun-Wei Lin
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
casper.li-NuS5LvNUpcJWk0Htik3J/w,
chinwen.chang-NuS5LvNUpcJWk0Htik3J/w,
kuan-ying.lee-NuS5LvNUpcJWk0Htik3J/w,
ivan.tseng-NuS5LvNUpcJWk0Htik3J/w,
ladon.huang-NuS5LvNUpcJWk0Htik3J/w
[-- Attachment #1: Type: text/plain, Size: 3552 bytes --]
On Thu, Jan 12, 2023 at 08:56:54PM +0800, Qun-Wei Lin wrote:
> The "dma-ranges" property value is a sequence of
> child-address parent-address child-size
>
> The size of each field is determined by taking the child's
> "#address-cells" value, the parent's "#address-cells" value,
> and the child's "#size-cells" value.
>
> However, in the following example, it gives a false alarm:
> +-----------------------------------+---------------------------------------+
> | ranges.dts | dma-ranges.dts |
> +-----------------------------------+---------------------------------------+
> | /dts-v1/; | /dts-v1/; |
> | | |
> | /{ | /{ |
> | #address-cells = <1>; | #address-cells = <1>; |
> | | |
> | parent { | parent { |
> | #address-cells = <1>; | #address-cells = <1>; |
> | #size-cells = <1>; | #size-cells = <1>; |
> | ranges = <0x0 0xe000 0x1000>; | dma-ranges = <0x0 0xe000 0x1000>; |
> | child { | child { |
> | ... | ... |
> | }; | }; |
> | }; | }; |
> | }; | }; |
> +-----------------------------------+---------------------------------------+
> | no warning | Warning (avoid_unnecessary_addr_size) |
> +-----------------------------------+---------------------------------------+
>
> Same as "ranges", it should not be reported in this check.
>
> Signed-off-by: Qun-Wei Lin <qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Applied, thanks. An additional testcase to verify this behaviour
would be appreciated.
> ---
> checks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/checks.c b/checks.c
> index afa8f23..607e0f2 100644
> --- a/checks.c
> +++ b/checks.c
> @@ -1232,7 +1232,7 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
> if (!node->parent || node->addr_cells < 0 || node->size_cells < 0)
> return;
>
> - if (get_property(node, "ranges") || !node->children)
> + if (get_property(node, "ranges") || get_property(node, "dma-ranges") || !node->children)
> return;
>
> for_each_child(node, child) {
> @@ -1242,7 +1242,7 @@ static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *d
> }
>
> if (!has_reg)
> - FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property");
> + FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\", \"dma-ranges\" or child \"reg\" property");
> }
> WARNING(avoid_unnecessary_addr_size, check_avoid_unnecessary_addr_size, NULL, &avoid_default_addr_size);
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] checks: Update #{size,address}-cells check for 'dma-ranges'
[not found] ` <CAL_JsqKkE_Aytd_7WOV3iM+pipjnwDWR7yt=L+xE8+cyjL8b9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2023-02-02 6:49 ` David Gibson
0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2023-02-02 6:49 UTC (permalink / raw)
To: Rob Herring
Cc: Qun-Wei Lin, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
casper.li-NuS5LvNUpcJWk0Htik3J/w,
chinwen.chang-NuS5LvNUpcJWk0Htik3J/w,
kuan-ying.lee-NuS5LvNUpcJWk0Htik3J/w,
ivan.tseng-NuS5LvNUpcJWk0Htik3J/w,
ladon.huang-NuS5LvNUpcJWk0Htik3J/w
[-- Attachment #1: Type: text/plain, Size: 2684 bytes --]
On Thu, Jan 12, 2023 at 01:47:03PM -0600, Rob Herring wrote:
> On Thu, Jan 12, 2023 at 6:59 AM Qun-Wei Lin <qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> >
> > The "dma-ranges" property value is a sequence of
> > child-address parent-address child-size
> >
> > The size of each field is determined by taking the child's
> > "#address-cells" value, the parent's "#address-cells" value,
> > and the child's "#size-cells" value.
> >
> > However, in the following example, it gives a false alarm:
> > +-----------------------------------+---------------------------------------+
> > | ranges.dts | dma-ranges.dts |
> > +-----------------------------------+---------------------------------------+
> > | /dts-v1/; | /dts-v1/; |
> > | | |
> > | /{ | /{ |
> > | #address-cells = <1>; | #address-cells = <1>; |
> > | | |
> > | parent { | parent { |
> > | #address-cells = <1>; | #address-cells = <1>; |
> > | #size-cells = <1>; | #size-cells = <1>; |
> > | ranges = <0x0 0xe000 0x1000>; | dma-ranges = <0x0 0xe000 0x1000>; |
> > | child { | child { |
> > | ... | ... |
> > | }; | }; |
> > | }; | }; |
> > | }; | }; |
> > +-----------------------------------+---------------------------------------+
> > | no warning | Warning (avoid_unnecessary_addr_size) |
> > +-----------------------------------+---------------------------------------+
> >
> > Same as "ranges", it should not be reported in this check.
>
> Except that dma-ranges only makes sense if there is a ranges property.
Hm, does it? It would certainly be an odd situation, but I can
imagine a sort of bus that can DMA, but which has no-addressable
registers on it.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-02 6:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 12:56 [PATCH] checks: Update #{size,address}-cells check for 'dma-ranges' Qun-Wei Lin
[not found] ` <20230112125654.13390-1-qun-wei.lin-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2023-01-12 19:47 ` Rob Herring
[not found] ` <CAL_JsqKkE_Aytd_7WOV3iM+pipjnwDWR7yt=L+xE8+cyjL8b9w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-02-02 6:49 ` David Gibson
2023-02-02 6:48 ` David Gibson
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).