]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: sfp: use device_get_match_data()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 18 Jan 2023 10:21:03 +0000 (10:21 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Jan 2023 02:55:30 +0000 (18:55 -0800)
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>
drivers/net/phy/sfp.c

index aa2f7ebbdebc0805449b0563ce1136b056125318..402dcdd59acb7bce937ba52a8220522dd85567b2 100644 (file)
@@ -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)