Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Kozlowski and committed by
Herbert Xu
6b94eb68 cdd7bbce

+2 -6
+2 -6
drivers/char/hw_random/bcm2835-rng.c
··· 142 142 143 143 static int bcm2835_rng_probe(struct platform_device *pdev) 144 144 { 145 - const struct bcm2835_rng_of_data *of_data; 146 145 struct device *dev = &pdev->dev; 147 - const struct of_device_id *rng_id; 148 146 struct bcm2835_rng_priv *priv; 149 147 int err; 150 148 ··· 170 172 priv->rng.cleanup = bcm2835_rng_cleanup; 171 173 172 174 if (dev_of_node(dev)) { 173 - rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node); 174 - if (!rng_id) 175 - return -EINVAL; 175 + const struct bcm2835_rng_of_data *of_data; 176 176 177 177 /* Check for rng init function, execute it */ 178 - of_data = rng_id->data; 178 + of_data = of_device_get_match_data(dev); 179 179 if (of_data) 180 180 priv->mask_interrupts = of_data->mask_interrupts; 181 181 }