Commit 88696db0 authored by Rob Herring's avatar Rob Herring

of: address: Store number of bus flag cells rather than bool

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: default avatarHerve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20231026135358.3564307-2-robh@kernel.orgSigned-off-by: default avatarRob Herring <robh@kernel.org>
parent 4d9ec5f0
...@@ -45,7 +45,7 @@ struct of_bus { ...@@ -45,7 +45,7 @@ struct of_bus {
u64 (*map)(__be32 *addr, const __be32 *range, u64 (*map)(__be32 *addr, const __be32 *range,
int na, int ns, int pna); int na, int ns, int pna);
int (*translate)(__be32 *addr, u64 offset, int na); int (*translate)(__be32 *addr, u64 offset, int na);
bool has_flags; int flag_cells;
unsigned int (*get_flags)(const __be32 *addr); unsigned int (*get_flags)(const __be32 *addr);
}; };
...@@ -370,7 +370,7 @@ static struct of_bus of_busses[] = { ...@@ -370,7 +370,7 @@ static struct of_bus of_busses[] = {
.count_cells = of_bus_pci_count_cells, .count_cells = of_bus_pci_count_cells,
.map = of_bus_pci_map, .map = of_bus_pci_map,
.translate = of_bus_default_flags_translate, .translate = of_bus_default_flags_translate,
.has_flags = true, .flag_cells = 1,
.get_flags = of_bus_pci_get_flags, .get_flags = of_bus_pci_get_flags,
}, },
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
...@@ -382,7 +382,7 @@ static struct of_bus of_busses[] = { ...@@ -382,7 +382,7 @@ static struct of_bus of_busses[] = {
.count_cells = of_bus_isa_count_cells, .count_cells = of_bus_isa_count_cells,
.map = of_bus_isa_map, .map = of_bus_isa_map,
.translate = of_bus_default_flags_translate, .translate = of_bus_default_flags_translate,
.has_flags = true, .flag_cells = 1,
.get_flags = of_bus_isa_get_flags, .get_flags = of_bus_isa_get_flags,
}, },
/* Default with flags cell */ /* Default with flags cell */
...@@ -393,7 +393,7 @@ static struct of_bus of_busses[] = { ...@@ -393,7 +393,7 @@ static struct of_bus of_busses[] = {
.count_cells = of_bus_default_count_cells, .count_cells = of_bus_default_count_cells,
.map = of_bus_default_flags_map, .map = of_bus_default_flags_map,
.translate = of_bus_default_flags_translate, .translate = of_bus_default_flags_translate,
.has_flags = true, .flag_cells = 1,
.get_flags = of_bus_default_flags_get_flags, .get_flags = of_bus_default_flags_get_flags,
}, },
/* Default */ /* Default */
...@@ -826,7 +826,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, ...@@ -826,7 +826,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
int na = parser->na; int na = parser->na;
int ns = parser->ns; int ns = parser->ns;
int np = parser->pna + na + ns; int np = parser->pna + na + ns;
int busflag_na = 0; int busflag_na = parser->bus->flag_cells;
if (!range) if (!range)
return NULL; return NULL;
...@@ -836,10 +836,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, ...@@ -836,10 +836,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
range->flags = parser->bus->get_flags(parser->range); range->flags = parser->bus->get_flags(parser->range);
/* A extra cell for resource flags */
if (parser->bus->has_flags)
busflag_na = 1;
range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na);
if (parser->dma) if (parser->dma)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment