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

drivers: net: davinci_mdio: Use of_device_get_match_data()

Use the more modern API to get the match data out of the of match table.
This saves some code, lines, and nicely avoids referencing the match
table when it is undefined with configurations where CONFIG_OF=n.

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: <linux-omap@vger.kernel.org>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210123034428.2841052-3-swboyd@chromium.org

authored by

Stephen Boyd and committed by
Rob Herring
0e658fdd a38f3fbc

+4 -8
+4 -8
drivers/net/ethernet/ti/davinci_mdio.c
··· 358 358 } 359 359 360 360 if (IS_ENABLED(CONFIG_OF) && dev->of_node) { 361 - const struct of_device_id *of_id; 361 + const struct davinci_mdio_of_param *of_mdio_data; 362 362 363 363 ret = davinci_mdio_probe_dt(&data->pdata, pdev); 364 364 if (ret) 365 365 return ret; 366 366 snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s", pdev->name); 367 367 368 - of_id = of_match_device(davinci_mdio_of_mtable, &pdev->dev); 369 - if (of_id) { 370 - const struct davinci_mdio_of_param *of_mdio_data; 371 - 372 - of_mdio_data = of_id->data; 373 - if (of_mdio_data) 374 - autosuspend_delay_ms = 368 + of_mdio_data = of_device_get_match_data(&pdev->dev); 369 + if (of_mdio_data) { 370 + autosuspend_delay_ms = 375 371 of_mdio_data->autosuspend_delay_ms; 376 372 } 377 373 } else {