diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2023-01-18 11:21:03 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-01-20 03:55:30 +0100 |
commit | b71dda81123f4158d4c9d079123c5b460af7a526 (patch) | |
tree | 94027256dd9ef89154d0d01f1be1c92ef1f16454 /drivers/net/phy/sfp.c | |
parent | net: sfp: use i2c_get_adapter_by_fwnode() (diff) | |
download | linux-b71dda81123f4158d4c9d079123c5b460af7a526.tar.xz linux-b71dda81123f4158d4c9d079123c5b460af7a526.zip |
net: sfp: use device_get_match_data()
Rather than using of_match_node() to get the matching of_device_id
to then retrieve the match data, use device_get_match_data() instead
to avoid firmware specific functions, and free the driver from having
firmware specific code.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/phy/sfp.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index aa2f7ebbdebc..402dcdd59acb 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -2685,19 +2685,11 @@ static int sfp_probe(struct platform_device *pdev) if (err < 0) return err; - sff = sfp->type = &sfp_data; + sff = device_get_match_data(sfp->dev); + if (!sff) + sff = &sfp_data; - if (pdev->dev.of_node) { - const struct of_device_id *id; - - id = of_match_node(sfp_of_match, pdev->dev.of_node); - if (WARN_ON(!id)) - return -EINVAL; - - sff = sfp->type = id->data; - } else if (!has_acpi_companion(&pdev->dev)) { - return -EINVAL; - } + sfp->type = sff; err = sfp_i2c_get(sfp); if (err) |