Skip to content

Commit 007662f

Browse files
robherringgregkh
authored andcommitted
of: address: Store number of bus flag cells rather than bool
[ Upstream commit 88696db08b7efa3b6bb722014ea7429e78f6be32 ] It is more useful to know how many flags cells a bus has rather than whether a bus has flags or not as ultimately the number of cells is the information used. Replace 'has_flags' boolean with 'flag_cells' count. Acked-by: Herve Codina <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]> Stable-dep-of: 7f05e20b989a ("of: address: Preserve the flags portion on 1:1 dma-ranges mapping") Signed-off-by: Sasha Levin <[email protected]>
1 parent 7eb954e commit 007662f

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/of/address.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct of_bus {
5050
u64 (*map)(__be32 *addr, const __be32 *range,
5151
int na, int ns, int pna);
5252
int (*translate)(__be32 *addr, u64 offset, int na);
53-
bool has_flags;
53+
int flag_cells;
5454
unsigned int (*get_flags)(const __be32 *addr);
5555
};
5656

@@ -361,7 +361,7 @@ static struct of_bus of_busses[] = {
361361
.count_cells = of_bus_pci_count_cells,
362362
.map = of_bus_pci_map,
363363
.translate = of_bus_default_flags_translate,
364-
.has_flags = true,
364+
.flag_cells = 1,
365365
.get_flags = of_bus_pci_get_flags,
366366
},
367367
#endif /* CONFIG_PCI */
@@ -373,7 +373,7 @@ static struct of_bus of_busses[] = {
373373
.count_cells = of_bus_isa_count_cells,
374374
.map = of_bus_isa_map,
375375
.translate = of_bus_default_flags_translate,
376-
.has_flags = true,
376+
.flag_cells = 1,
377377
.get_flags = of_bus_isa_get_flags,
378378
},
379379
/* Default with flags cell */
@@ -384,7 +384,7 @@ static struct of_bus of_busses[] = {
384384
.count_cells = of_bus_default_count_cells,
385385
.map = of_bus_default_flags_map,
386386
.translate = of_bus_default_flags_translate,
387-
.has_flags = true,
387+
.flag_cells = 1,
388388
.get_flags = of_bus_default_flags_get_flags,
389389
},
390390
/* Default */
@@ -753,7 +753,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
753753
int na = parser->na;
754754
int ns = parser->ns;
755755
int np = parser->pna + na + ns;
756-
int busflag_na = 0;
756+
int busflag_na = parser->bus->flag_cells;
757757

758758
if (!range)
759759
return NULL;
@@ -763,10 +763,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
763763

764764
range->flags = parser->bus->get_flags(parser->range);
765765

766-
/* A extra cell for resource flags */
767-
if (parser->bus->has_flags)
768-
busflag_na = 1;
769-
770766
range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na);
771767

772768
if (parser->dma)

0 commit comments

Comments
 (0)