mirror of https://github.com/torvalds/linux.git
hwrng: bcm2835 - Simplify with of_device_get_match_data()
Driver's probe function matches against driver's of_device_id table, where each entry has non-NULL match data, so of_match_node() can be simplified with of_device_get_match_data(). Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
cdd7bbce7b
commit
6b94eb68ad
|
|
@ -142,9 +142,7 @@ MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match);
|
||||||
|
|
||||||
static int bcm2835_rng_probe(struct platform_device *pdev)
|
static int bcm2835_rng_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct bcm2835_rng_of_data *of_data;
|
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
const struct of_device_id *rng_id;
|
|
||||||
struct bcm2835_rng_priv *priv;
|
struct bcm2835_rng_priv *priv;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -172,12 +170,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
|
||||||
priv->rng.cleanup = bcm2835_rng_cleanup;
|
priv->rng.cleanup = bcm2835_rng_cleanup;
|
||||||
|
|
||||||
if (dev_of_node(dev)) {
|
if (dev_of_node(dev)) {
|
||||||
rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node);
|
const struct bcm2835_rng_of_data *of_data;
|
||||||
if (!rng_id)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/* Check for rng init function, execute it */
|
/* Check for rng init function, execute it */
|
||||||
of_data = rng_id->data;
|
of_data = of_device_get_match_data(dev);
|
||||||
if (of_data)
|
if (of_data)
|
||||||
priv->mask_interrupts = of_data->mask_interrupts;
|
priv->mask_interrupts = of_data->mask_interrupts;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue