X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=drivers%2Fspi%2Fspi-oc-tiny.c;h=b5911282a61116c47b0237071df40261831f94ab;hb=3bea6a4c7895fc94965a219a8da9bcf753667901;hp=76656a77ec1213d1db70d6ee98d546bc0f760da9;hpb=0ec28c37c21a2b4393692e832e11a7573ac545e2;p=firefly-linux-kernel-4.4.55.git diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c index 76656a77ec12..b5911282a611 100644 --- a/drivers/spi/spi-oc-tiny.c +++ b/drivers/spi/spi-oc-tiny.c @@ -207,8 +207,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev) struct tiny_spi *hw = platform_get_drvdata(pdev); struct device_node *np = pdev->dev.of_node; unsigned int i; - const __be32 *val; - int len; + u32 val; if (!np) return 0; @@ -226,13 +225,10 @@ static int tiny_spi_of_probe(struct platform_device *pdev) return -ENODEV; } hw->bitbang.master->dev.of_node = pdev->dev.of_node; - val = of_get_property(pdev->dev.of_node, - "clock-frequency", &len); - if (val && len >= sizeof(__be32)) - hw->freq = be32_to_cpup(val); - val = of_get_property(pdev->dev.of_node, "baud-width", &len); - if (val && len >= sizeof(__be32)) - hw->baudwidth = be32_to_cpup(val); + if (!of_property_read_u32(np, "clock-frequency", &val)) + hw->freq = val; + if (!of_property_read_u32(np, "baud-width", &val)) + hw->baudwidth = val; return 0; } #else /* !CONFIG_OF */