Skip to content

Commit

Permalink
via-rhine: Use of_device_get_match_data to simplify code
Browse files Browse the repository at this point in the history
Retrieve OF match data, it's better and cleaner to use
'of_device_get_match_data' over 'of_match_device'.

Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tang Bin authored and David S. Miller committed Aug 23, 2021
1 parent 609c130 commit b708a96
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/net/ethernet/via/via-rhine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1113,13 +1113,12 @@ static int rhine_init_one_pci(struct pci_dev *pdev,

static int rhine_init_one_platform(struct platform_device *pdev)
{
const struct of_device_id *match;
const u32 *quirks;
int irq;
void __iomem *ioaddr;

match = of_match_device(rhine_of_tbl, &pdev->dev);
if (!match)
quirks = of_device_get_match_data(&pdev->dev);
if (!quirks)
return -EINVAL;

ioaddr = devm_platform_ioremap_resource(pdev, 0);
Expand All @@ -1130,10 +1129,6 @@ static int rhine_init_one_platform(struct platform_device *pdev)
if (!irq)
return -EINVAL;

quirks = match->data;
if (!quirks)
return -EINVAL;

return rhine_init_one_common(&pdev->dev, *quirks,
(long)ioaddr, ioaddr, irq);
}
Expand Down

0 comments on commit b708a96

Please sign in to comment.