Skip to content

Commit 88696db

Browse files
committed
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: Herve Codina <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 4d9ec5f commit 88696db

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
@@ -45,7 +45,7 @@ struct of_bus {
4545
u64 (*map)(__be32 *addr, const __be32 *range,
4646
int na, int ns, int pna);
4747
int (*translate)(__be32 *addr, u64 offset, int na);
48-
bool has_flags;
48+
int flag_cells;
4949
unsigned int (*get_flags)(const __be32 *addr);
5050
};
5151

@@ -370,7 +370,7 @@ static struct of_bus of_busses[] = {
370370
.count_cells = of_bus_pci_count_cells,
371371
.map = of_bus_pci_map,
372372
.translate = of_bus_default_flags_translate,
373-
.has_flags = true,
373+
.flag_cells = 1,
374374
.get_flags = of_bus_pci_get_flags,
375375
},
376376
#endif /* CONFIG_PCI */
@@ -382,7 +382,7 @@ static struct of_bus of_busses[] = {
382382
.count_cells = of_bus_isa_count_cells,
383383
.map = of_bus_isa_map,
384384
.translate = of_bus_default_flags_translate,
385-
.has_flags = true,
385+
.flag_cells = 1,
386386
.get_flags = of_bus_isa_get_flags,
387387
},
388388
/* Default with flags cell */
@@ -393,7 +393,7 @@ static struct of_bus of_busses[] = {
393393
.count_cells = of_bus_default_count_cells,
394394
.map = of_bus_default_flags_map,
395395
.translate = of_bus_default_flags_translate,
396-
.has_flags = true,
396+
.flag_cells = 1,
397397
.get_flags = of_bus_default_flags_get_flags,
398398
},
399399
/* Default */
@@ -826,7 +826,7 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
826826
int na = parser->na;
827827
int ns = parser->ns;
828828
int np = parser->pna + na + ns;
829-
int busflag_na = 0;
829+
int busflag_na = parser->bus->flag_cells;
830830

831831
if (!range)
832832
return NULL;
@@ -836,10 +836,6 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
836836

837837
range->flags = parser->bus->get_flags(parser->range);
838838

839-
/* A extra cell for resource flags */
840-
if (parser->bus->has_flags)
841-
busflag_na = 1;
842-
843839
range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na);
844840

845841
if (parser->dma)

0 commit comments

Comments
 (0)