Marc Dietrich wrote at Monday, October 31, 2011 1:59 PM: > This adds device tree support to the nvec driver. By using this method > it is no longer necessary to specify platform data through a board > file. ... > diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c ... > + if (pdata) { > + nvec->gpio = pdata->gpio; > + nvec->i2c_addr = pdata->i2c_addr; > + } else if (nvec->dev->of_node) { > + nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0); > + if (nvec->gpio < 0) { > + dev_err(&pdev->dev, "no gpio specified"); > + goto failed; > + } > + prop = of_get_property(nvec->dev->of_node, "slave-addr", NULL); > + if (!prop) { > + dev_err(&pdev->dev, "no i2c address specified"); > + goto failed; > + } > + nvec->i2c_addr = be32_to_cpup(prop); ----------==========----------==========----------==========----------========== Don't you want to use of_property_read_u32() here to simplify the code slightly? You can also get rid of at least one #include that way. > + } else { > + dev_err(&pdev->dev, "no platform data\n"); > + goto failed; > + } -- nvpublic _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel