Skip to content

Commit

Permalink
spi/xilinx: Use of_property_read_u32 for reading value from node
Browse files Browse the repository at this point in the history
It simplifies driver probing.

Signed-off-by: Michal Simek <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Michal Simek authored and broonie committed Jul 15, 2013
1 parent ad3fdbc commit be3acdf
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions drivers/spi/spi-xilinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,9 @@ static int xilinx_spi_probe(struct platform_device *pdev)
if (pdata) {
num_cs = pdata->num_chipselect;
bits_per_word = pdata->bits_per_word;
}

if (pdev->dev.of_node) {
const __be32 *prop;
int len;

/* number of slave select bits is required */
prop = of_get_property(pdev->dev.of_node, "xlnx,num-ss-bits",
&len);
if (prop && len >= sizeof(*prop))
num_cs = __be32_to_cpup(prop);
} else {
of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits",
&num_cs);
}

if (!num_cs) {
Expand Down

0 comments on commit be3acdf

Please sign in to comment.