Skip to content

Commit d79616b

Browse files
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent 3539089 commit d79616b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/of/address.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static int of_bus_default_flags_match(struct device_node *np)
340340
* Array of bus specific translators
341341
*/
342342

343-
static struct of_bus of_busses[] = {
343+
static const struct of_bus of_busses[] = {
344344
#ifdef CONFIG_PCI
345345
/* PCI */
346346
{
@@ -388,7 +388,7 @@ static struct of_bus of_busses[] = {
388388
},
389389
};
390390

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)
392392
{
393393
int i;
394394

@@ -419,8 +419,8 @@ static int of_empty_ranges_quirk(const struct device_node *np)
419419
return false;
420420
}
421421

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,
424424
int na, int ns, int pna, const char *rprop)
425425
{
426426
const __be32 *ranges;
@@ -505,7 +505,7 @@ static u64 __of_translate_address(struct device_node *node,
505505
{
506506
struct device_node *dev __free(device_node) = of_node_get(node);
507507
struct device_node *parent __free(device_node) = get_parent(dev);
508-
struct of_bus *bus, *pbus;
508+
const struct of_bus *bus, *pbus;
509509
__be32 addr[OF_MAX_ADDR_CELLS];
510510
int na, ns, pna, pns;
511511

@@ -690,7 +690,7 @@ const __be32 *__of_get_address(struct device_node *dev, int index, int bar_no,
690690
const __be32 *prop;
691691
unsigned int psize;
692692
struct device_node *parent __free(device_node) = of_get_parent(dev);
693-
struct of_bus *bus;
693+
const struct of_bus *bus;
694694
int onesize, i, na, ns;
695695

696696
if (parent == NULL)

include/linux/of_address.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct of_bus;
1010

1111
struct of_pci_range_parser {
1212
struct device_node *node;
13-
struct of_bus *bus;
13+
const struct of_bus *bus;
1414
const __be32 *range;
1515
const __be32 *end;
1616
int na;

0 commit comments

Comments
 (0)