Skip to content

Commit 6b94eb6

Browse files
krzkherbertx
authored andcommitted
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>
1 parent cdd7bbc commit 6b94eb6

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

drivers/char/hw_random/bcm2835-rng.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ MODULE_DEVICE_TABLE(of, bcm2835_rng_of_match);
142142

143143
static int bcm2835_rng_probe(struct platform_device *pdev)
144144
{
145-
const struct bcm2835_rng_of_data *of_data;
146145
struct device *dev = &pdev->dev;
147-
const struct of_device_id *rng_id;
148146
struct bcm2835_rng_priv *priv;
149147
int err;
150148

@@ -172,12 +170,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
172170
priv->rng.cleanup = bcm2835_rng_cleanup;
173171

174172
if (dev_of_node(dev)) {
175-
rng_id = of_match_node(bcm2835_rng_of_match, dev->of_node);
176-
if (!rng_id)
177-
return -EINVAL;
173+
const struct bcm2835_rng_of_data *of_data;
178174

179175
/* Check for rng init function, execute it */
180-
of_data = rng_id->data;
176+
of_data = of_device_get_match_data(dev);
181177
if (of_data)
182178
priv->mask_interrupts = of_data->mask_interrupts;
183179
}

0 commit comments

Comments
 (0)