Skip to content

Commit 6a7832e

Browse files
robherringgregkh
authored andcommitted
of: address: Store number of bus flag cells rather than bool
[ Upstream commit 88696db ] 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 <herve.codina@bootlin.com> Link: https://lore.kernel.org/r/20231026135358.3564307-2-robh@kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Stable-dep-of: 7f05e20 ("of: address: Preserve the flags portion on 1:1 dma-ranges mapping") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 1b868ff commit 6a7832e

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

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 */
@@ -751,7 +751,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
751751
int na = parser->na;
752752
int ns = parser->ns;
753753
int np = parser->pna + na + ns;
754-
int busflag_na = 0;
754+
int busflag_na = parser->bus->flag_cells;
755755

756756
if (!range)
757757
return NULL;
@@ -761,10 +761,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
761761

762762
range->flags = parser->bus->get_flags(parser->range);
763763

764-
/* A extra cell for resource flags */
765-
if (parser->bus->has_flags)
766-
busflag_na = 1;
767-
768764
range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na);
769765

770766
if (parser->dma)

0 commit comments

Comments
 (0)