stmmac: use of_device_get_match_data to retrieve of match data
authorJoachim Eastwood <manabian@gmail.com>
Thu, 16 Jul 2015 22:26:05 +0000 (00:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2015 03:45:56 +0000 (20:45 -0700)
By using of_device_get_match_data() the code that retrieve
match data can be simplified quite a bit.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

index f3918c7e7eeb373a6736bb5145c33320acbabc53..89e40ddc0391823399d33b1d9c84dcc47c8c1a6e 100644 (file)
@@ -109,13 +109,11 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
                                  const char **mac)
 {
        struct device_node *np = pdev->dev.of_node;
+       const struct stmmac_of_data *data;
        struct stmmac_dma_cfg *dma_cfg;
-       const struct of_device_id *device;
-       struct device *dev = &pdev->dev;
 
-       device = of_match_device(dev->driver->of_match_table, dev);
-       if (device->data) {
-               const struct stmmac_of_data *data = device->data;
+       data = of_device_get_match_data(&pdev->dev);
+       if (data) {
                plat->has_gmac = data->has_gmac;
                plat->enh_desc = data->enh_desc;
                plat->tx_coe = data->tx_coe;