Skip to content

Commit

Permalink
ASoC: jz4740: Use of_device_get_match_data()
Browse files Browse the repository at this point in the history
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 <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: <alsa-devel@alsa-project.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20191004214334.149976-8-swboyd@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Stephen Boyd authored and Mark Brown committed Oct 7, 2019
1 parent 01400bf commit 67ad656
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sound/soc/jz4740/jz4740-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 67ad656

Please sign in to comment.