History

of/address: Rework of_pci_range parsing for non-PCI buses

The only PCI specific part of of_pci_range_parser_one() is the handling of the 3rd address cell. Rework it to work on regular 1 and 2 cell addresses. Use defines and a union to avoid a treewide renaming of the parsing helpers and struct.

Rob Herring committed 6 years ago

Commit bc5e5221 parent c67f3df2 files · +30 −15Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/of_address.h+9−3
@@ -10,20 +10,27 @@ struct of_pci_range_parser { · 9 unmodified lines
1010 struct device_node *node;
1111 const __be32 *range;
1212 const __be32 *end;
13− int np;
13+ int na;
14+ int ns;
1415 int pna;
1516 bool dma;
1617 };
18+#define of_range_parser of_pci_range_parser
1719
1820 struct of_pci_range {
19− u64 pci_addr;
21+ union {
22+ u64 pci_addr;
23+ u64 bus_addr;
24+ };
2025 u64 cpu_addr;
2126 u64 size;
2227 u32 flags;
2328 };
29+#define of_range of_pci_range
2430
2531 #define for_each_of_pci_range(parser, range) \
2632 for (; of_pci_range_parser_one(parser, range);)
33+#define for_each_of_range for_each_of_pci_range
2734
2835 /* Translate a DMA address from device space to CPU space */
2936 extern u64 of_translate_dma_address(struct device_node *dev,
@@ -142,4 +149,3 @@ static inline int of_pci_range_to_resource(struct of_pci_range *range, · 112 unmodified lines
142149 #endif /* CONFIG_OF_ADDRESS && CONFIG_PCI */
143150
144151 #endif /* __OF_ADDRESS_H */
145−