提交 56134e3c 编写于 作者: S Sergei Shtylyov 提交者: Rob Herring

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: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: NRob Herring <robh@kernel.org>
上级 b0d9d92f
......@@ -105,17 +105,14 @@ EXPORT_SYMBOL_GPL(of_pci_parse_bus_range);
*/
int of_get_pci_domain_nr(struct device_node *node)
{
const __be32 *value;
int len;
u16 domain;
value = of_get_property(node, "linux,pci-domain", &len);
if (!value || len < sizeof(*value))
return -EINVAL;
u32 domain;
int error;
domain = (u16)be32_to_cpup(value);
error = of_property_read_u32(node, "linux,pci-domain", &domain);
if (error)
return error;
return domain;
return (u16)domain;
}
EXPORT_SYMBOL_GPL(of_get_pci_domain_nr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册