Skip to content

Commit b708a96

Browse files
Tang Bindavem330
authored andcommitted
via-rhine: Use of_device_get_match_data to simplify code
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 609c130 commit b708a96

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/net/ethernet/via/via-rhine.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,13 +1113,12 @@ static int rhine_init_one_pci(struct pci_dev *pdev,
11131113

11141114
static int rhine_init_one_platform(struct platform_device *pdev)
11151115
{
1116-
const struct of_device_id *match;
11171116
const u32 *quirks;
11181117
int irq;
11191118
void __iomem *ioaddr;
11201119

1121-
match = of_match_device(rhine_of_tbl, &pdev->dev);
1122-
if (!match)
1120+
quirks = of_device_get_match_data(&pdev->dev);
1121+
if (!quirks)
11231122
return -EINVAL;
11241123

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

1133-
quirks = match->data;
1134-
if (!quirks)
1135-
return -EINVAL;
1136-
11371132
return rhine_init_one_common(&pdev->dev, *quirks,
11381133
(long)ioaddr, ioaddr, irq);
11391134
}

0 commit comments

Comments
 (0)