Commit 66ede1f9 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: phy: sfp: make the i2c-bus dt property mandatory

This patch makes the i2c-bus property mandatory when using a device
tree. If the sfp i2c bus isn't described it's impossible to guess the
protocol to use for a given module, and the sfp module would then not
work in most cases.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a1f5d1f0
...@@ -976,6 +976,7 @@ static int sfp_probe(struct platform_device *pdev) ...@@ -976,6 +976,7 @@ static int sfp_probe(struct platform_device *pdev)
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
const struct of_device_id *id; const struct of_device_id *id;
struct i2c_adapter *i2c;
struct device_node *np; struct device_node *np;
id = of_match_node(sfp_of_match, node); id = of_match_node(sfp_of_match, node);
...@@ -985,19 +986,20 @@ static int sfp_probe(struct platform_device *pdev) ...@@ -985,19 +986,20 @@ static int sfp_probe(struct platform_device *pdev)
sff = sfp->type = id->data; sff = sfp->type = id->data;
np = of_parse_phandle(node, "i2c-bus", 0); np = of_parse_phandle(node, "i2c-bus", 0);
if (np) { if (!np) {
struct i2c_adapter *i2c; dev_err(sfp->dev, "missing 'i2c-bus' property\n");
return -ENODEV;
i2c = of_find_i2c_adapter_by_node(np); }
of_node_put(np);
if (!i2c) i2c = of_find_i2c_adapter_by_node(np);
return -EPROBE_DEFER; of_node_put(np);
if (!i2c)
err = sfp_i2c_configure(sfp, i2c); return -EPROBE_DEFER;
if (err < 0) {
i2c_put_adapter(i2c); err = sfp_i2c_configure(sfp, i2c);
return err; if (err < 0) {
} i2c_put_adapter(i2c);
return err;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment