From: Stephen Boyd Date: Fri, 4 Oct 2019 21:43:31 +0000 (-0700) Subject: ASoC: jz4740: Use of_device_get_match_data() X-Git-Tag: v5.10.7~3493^2~20^2~311 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67ad656bdd703157154d0db5bf1b35a5a86073b9;p=platform%2Fkernel%2Flinux-rpi.git ASoC: jz4740: Use of_device_get_match_data() This probe function is only called if the device is backed by a DT node, so switch this call to of_device_get_match_data() to reduce code size and simplify a bit. This also avoids needing to reference a potentially undefined variable because of_device_get_match_data() doesn't need to know anything beyond the struct device to find the match table. Cc: Arnd Bergmann Cc: Geert Uytterhoeven Cc: Paul Cercueil Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Rob Herring Cc: Frank Rowand Cc: Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20191004214334.149976-8-swboyd@chromium.org Signed-off-by: Mark Brown --- diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index 13408de..d2dab4d 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -503,9 +503,8 @@ static int jz4740_i2s_dev_probe(struct platform_device *pdev) if (!i2s) return -ENOMEM; - match = of_match_device(jz4740_of_matches, &pdev->dev); - if (match) - i2s->version = (enum jz47xx_i2s_version)match->data; + i2s->version = + (enum jz47xx_i2s_version)of_device_get_match_data(&pdev->dev); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); i2s->base = devm_ioremap_resource(&pdev->dev, mem);