aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-09-09 07:55:53 -0400
committerMark Brown <broonie@kernel.org>2015-09-16 14:16:01 -0400
commit45a3e771085d16c95eb54f8009d795941b21fb28 (patch)
treefe045c8d7c666ffda951fb3b17323444a05bb991
parent6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff)
spi: oc-tiny: Use of_property_read_u32 instead of open-coding it
Use of_property_read_u32 instead of of_get_property with return value checks and endianness conversion. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-oc-tiny.c14
1 files changed, 5 insertions, 9 deletions
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)
207 struct tiny_spi *hw = platform_get_drvdata(pdev); 207 struct tiny_spi *hw = platform_get_drvdata(pdev);
208 struct device_node *np = pdev->dev.of_node; 208 struct device_node *np = pdev->dev.of_node;
209 unsigned int i; 209 unsigned int i;
210 const __be32 *val; 210 u32 val;
211 int len;
212 211
213 if (!np) 212 if (!np)
214 return 0; 213 return 0;
@@ -226,13 +225,10 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
226 return -ENODEV; 225 return -ENODEV;
227 } 226 }
228 hw->bitbang.master->dev.of_node = pdev->dev.of_node; 227 hw->bitbang.master->dev.of_node = pdev->dev.of_node;
229 val = of_get_property(pdev->dev.of_node, 228 if (!of_property_read_u32(np, "clock-frequency", &val))
230 "clock-frequency", &len); 229 hw->freq = val;
231 if (val && len >= sizeof(__be32)) 230 if (!of_property_read_u32(np, "baud-width", &val))
232 hw->freq = be32_to_cpup(val); 231 hw->baudwidth = val;
233 val = of_get_property(pdev->dev.of_node, "baud-width", &len);
234 if (val && len >= sizeof(__be32))
235 hw->baudwidth = be32_to_cpup(val);
236 return 0; 232 return 0;
237} 233}
238#else /* !CONFIG_OF */ 234#else /* !CONFIG_OF */