Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20231026135358.3564307-2-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>

+5 -9
+5 -9
drivers/of/address.c
··· 45 45 u64 (*map)(__be32 *addr, const __be32 *range, 46 46 int na, int ns, int pna); 47 47 int (*translate)(__be32 *addr, u64 offset, int na); 48 - bool has_flags; 48 + int flag_cells; 49 49 unsigned int (*get_flags)(const __be32 *addr); 50 50 }; 51 51 ··· 370 370 .count_cells = of_bus_pci_count_cells, 371 371 .map = of_bus_pci_map, 372 372 .translate = of_bus_default_flags_translate, 373 - .has_flags = true, 373 + .flag_cells = 1, 374 374 .get_flags = of_bus_pci_get_flags, 375 375 }, 376 376 #endif /* CONFIG_PCI */ ··· 382 382 .count_cells = of_bus_isa_count_cells, 383 383 .map = of_bus_isa_map, 384 384 .translate = of_bus_default_flags_translate, 385 - .has_flags = true, 385 + .flag_cells = 1, 386 386 .get_flags = of_bus_isa_get_flags, 387 387 }, 388 388 /* Default with flags cell */ ··· 393 393 .count_cells = of_bus_default_count_cells, 394 394 .map = of_bus_default_flags_map, 395 395 .translate = of_bus_default_flags_translate, 396 - .has_flags = true, 396 + .flag_cells = 1, 397 397 .get_flags = of_bus_default_flags_get_flags, 398 398 }, 399 399 /* Default */ ··· 826 826 int na = parser->na; 827 827 int ns = parser->ns; 828 828 int np = parser->pna + na + ns; 829 - int busflag_na = 0; 829 + int busflag_na = parser->bus->flag_cells; 830 830 831 831 if (!range) 832 832 return NULL; ··· 835 835 return NULL; 836 836 837 837 range->flags = parser->bus->get_flags(parser->range); 838 - 839 - /* A extra cell for resource flags */ 840 - if (parser->bus->has_flags) 841 - busflag_na = 1; 842 838 843 839 range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); 844 840