diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2017-07-23 15:41:45 -0400 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2017-07-24 11:00:34 -0400 |
commit | 56134e3c649b97085df50fe85ae479e3d3a87d7f (patch) | |
tree | f4145ab8742f9d4d1cc3fe2d4c87a10a7ee18bf2 | |
parent | b0d9d92f9ce60cd070a62c136914e6fe9d20d49d (diff) |
of_pci: use of_property_read_u32()
of_get_pci_domain_nr() somehow didn't use of_property_read_u32() though it
was long available, basically open-coding it. Using the modern DT API saves
several LoCs/bytes and also adds some prop sanity checks as a bonus...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Rob Herring <robh@kernel.org>
-rw-r--r-- | drivers/of/of_pci.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 3d4cb7090878..0162e4ba30e2 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c | |||
@@ -105,17 +105,14 @@ EXPORT_SYMBOL_GPL(of_pci_parse_bus_range); | |||
105 | */ | 105 | */ |
106 | int of_get_pci_domain_nr(struct device_node *node) | 106 | int of_get_pci_domain_nr(struct device_node *node) |
107 | { | 107 | { |
108 | const __be32 *value; | 108 | u32 domain; |
109 | int len; | 109 | int error; |
110 | u16 domain; | ||
111 | |||
112 | value = of_get_property(node, "linux,pci-domain", &len); | ||
113 | if (!value || len < sizeof(*value)) | ||
114 | return -EINVAL; | ||
115 | 110 | ||
116 | domain = (u16)be32_to_cpup(value); | 111 | error = of_property_read_u32(node, "linux,pci-domain", &domain); |
112 | if (error) | ||
113 | return error; | ||
117 | 114 | ||
118 | return domain; | 115 | return (u16)domain; |
119 | } | 116 | } |
120 | EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); | 117 | EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); |
121 | 118 | ||