提交 b71dda81 编写于 作者: R Russell King (Oracle) 提交者: Jakub Kicinski

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: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 ff31a0c4
...@@ -2685,19 +2685,11 @@ static int sfp_probe(struct platform_device *pdev) ...@@ -2685,19 +2685,11 @@ static int sfp_probe(struct platform_device *pdev)
if (err < 0) if (err < 0)
return err; return err;
sff = sfp->type = &sfp_data; sff = device_get_match_data(sfp->dev);
if (!sff)
sff = &sfp_data;
if (pdev->dev.of_node) { sfp->type = sff;
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;
}
err = sfp_i2c_get(sfp); err = sfp_i2c_get(sfp);
if (err) if (err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册