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

Configure Feed

Select the types of activity you want to include in your feed.

of/address: Constify of_busses[] array and pointers

The of_busses array is fixed, so it and all struct of_bus pointers can
be const.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20241010-dt-const-v1-7-87a51f558425@kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

+7 -7
+6 -6
drivers/of/address.c
··· 340 340 * Array of bus specific translators 341 341 */ 342 342 343 - static struct of_bus of_busses[] = { 343 + static const struct of_bus of_busses[] = { 344 344 #ifdef CONFIG_PCI 345 345 /* PCI */ 346 346 { ··· 388 388 }, 389 389 }; 390 390 391 - static struct of_bus *of_match_bus(struct device_node *np) 391 + static const struct of_bus *of_match_bus(struct device_node *np) 392 392 { 393 393 int i; 394 394 ··· 419 419 return false; 420 420 } 421 421 422 - static int of_translate_one(struct device_node *parent, struct of_bus *bus, 423 - struct of_bus *pbus, __be32 *addr, 422 + static int of_translate_one(const struct device_node *parent, const struct of_bus *bus, 423 + const struct of_bus *pbus, __be32 *addr, 424 424 int na, int ns, int pna, const char *rprop) 425 425 { 426 426 const __be32 *ranges; ··· 505 505 { 506 506 struct device_node *dev __free(device_node) = of_node_get(node); 507 507 struct device_node *parent __free(device_node) = get_parent(dev); 508 - struct of_bus *bus, *pbus; 508 + const struct of_bus *bus, *pbus; 509 509 __be32 addr[OF_MAX_ADDR_CELLS]; 510 510 int na, ns, pna, pns; 511 511 ··· 690 690 const __be32 *prop; 691 691 unsigned int psize; 692 692 struct device_node *parent __free(device_node) = of_get_parent(dev); 693 - struct of_bus *bus; 693 + const struct of_bus *bus; 694 694 int onesize, i, na, ns; 695 695 696 696 if (parent == NULL)
+1 -1
include/linux/of_address.h
··· 10 10 11 11 struct of_pci_range_parser { 12 12 struct device_node *node; 13 - struct of_bus *bus; 13 + const struct of_bus *bus; 14 14 const __be32 *range; 15 15 const __be32 *end; 16 16 int na;