Commit 243bfd2c authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Here are some bugfixes from I2C, especially removing a wrongly
  displayed error message for all i2c muxes"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: xgene: Set ACPI_COMPANION_I2C
  i2c: mv64xxx: don't override deferred probing when getting irq
  i2c: mux: only print failure message on error
  i2c: mux: reg: rename label to indicate what it does
  i2c: mux: reg: put away the parent i2c adapter on probe failure
parents b23afd38 83345d51
...@@ -819,7 +819,6 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, ...@@ -819,7 +819,6 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
drv_data->irq = irq_of_parse_and_map(np, 0);
drv_data->rstc = devm_reset_control_get_optional(dev, NULL); drv_data->rstc = devm_reset_control_get_optional(dev, NULL);
if (IS_ERR(drv_data->rstc)) { if (IS_ERR(drv_data->rstc)) {
...@@ -902,10 +901,11 @@ mv64xxx_i2c_probe(struct platform_device *pd) ...@@ -902,10 +901,11 @@ mv64xxx_i2c_probe(struct platform_device *pd)
if (!IS_ERR(drv_data->clk)) if (!IS_ERR(drv_data->clk))
clk_prepare_enable(drv_data->clk); clk_prepare_enable(drv_data->clk);
drv_data->irq = platform_get_irq(pd, 0);
if (pdata) { if (pdata) {
drv_data->freq_m = pdata->freq_m; drv_data->freq_m = pdata->freq_m;
drv_data->freq_n = pdata->freq_n; drv_data->freq_n = pdata->freq_n;
drv_data->irq = platform_get_irq(pd, 0);
drv_data->adapter.timeout = msecs_to_jiffies(pdata->timeout); drv_data->adapter.timeout = msecs_to_jiffies(pdata->timeout);
drv_data->offload_enabled = false; drv_data->offload_enabled = false;
memcpy(&drv_data->reg_offsets, &mv64xxx_i2c_regs_mv64xxx, sizeof(drv_data->reg_offsets)); memcpy(&drv_data->reg_offsets, &mv64xxx_i2c_regs_mv64xxx, sizeof(drv_data->reg_offsets));
...@@ -915,7 +915,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) ...@@ -915,7 +915,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
goto exit_clk; goto exit_clk;
} }
if (drv_data->irq < 0) { if (drv_data->irq < 0) {
rc = -ENXIO; rc = drv_data->irq;
goto exit_reset; goto exit_reset;
} }
......
...@@ -416,6 +416,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) ...@@ -416,6 +416,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
adapter->class = I2C_CLASS_HWMON; adapter->class = I2C_CLASS_HWMON;
adapter->dev.parent = &pdev->dev; adapter->dev.parent = &pdev->dev;
adapter->dev.of_node = pdev->dev.of_node; adapter->dev.of_node = pdev->dev.of_node;
ACPI_COMPANION_SET(&adapter->dev, ACPI_COMPANION(&pdev->dev));
i2c_set_adapdata(adapter, ctx); i2c_set_adapdata(adapter, ctx);
rc = i2c_add_adapter(adapter); rc = i2c_add_adapter(adapter);
if (rc) { if (rc) {
......
...@@ -395,18 +395,20 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, ...@@ -395,18 +395,20 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
if (force_nr) { if (force_nr) {
priv->adap.nr = force_nr; priv->adap.nr = force_nr;
ret = i2c_add_numbered_adapter(&priv->adap); ret = i2c_add_numbered_adapter(&priv->adap);
if (ret < 0) {
dev_err(&parent->dev, dev_err(&parent->dev,
"failed to add mux-adapter %u as bus %u (error=%d)\n", "failed to add mux-adapter %u as bus %u (error=%d)\n",
chan_id, force_nr, ret); chan_id, force_nr, ret);
goto err_free_priv;
}
} else { } else {
ret = i2c_add_adapter(&priv->adap); ret = i2c_add_adapter(&priv->adap);
if (ret < 0) {
dev_err(&parent->dev, dev_err(&parent->dev,
"failed to add mux-adapter %u (error=%d)\n", "failed to add mux-adapter %u (error=%d)\n",
chan_id, ret); chan_id, ret);
goto err_free_priv;
} }
if (ret < 0) {
kfree(priv);
return ret;
} }
WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj, WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
...@@ -422,6 +424,10 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, ...@@ -422,6 +424,10 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
muxc->adapter[muxc->num_adapters++] = &priv->adap; muxc->adapter[muxc->num_adapters++] = &priv->adap;
return 0; return 0;
err_free_priv:
kfree(priv);
return ret;
} }
EXPORT_SYMBOL_GPL(i2c_mux_add_adapter); EXPORT_SYMBOL_GPL(i2c_mux_add_adapter);
......
...@@ -196,20 +196,25 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) ...@@ -196,20 +196,25 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mux->data.reg_size = resource_size(res); mux->data.reg_size = resource_size(res);
mux->data.reg = devm_ioremap_resource(&pdev->dev, res); mux->data.reg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(mux->data.reg)) if (IS_ERR(mux->data.reg)) {
return PTR_ERR(mux->data.reg); ret = PTR_ERR(mux->data.reg);
goto err_put_parent;
}
} }
if (mux->data.reg_size != 4 && mux->data.reg_size != 2 && if (mux->data.reg_size != 4 && mux->data.reg_size != 2 &&
mux->data.reg_size != 1) { mux->data.reg_size != 1) {
dev_err(&pdev->dev, "Invalid register size\n"); dev_err(&pdev->dev, "Invalid register size\n");
return -EINVAL; ret = -EINVAL;
goto err_put_parent;
} }
muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, 0, 0, muxc = i2c_mux_alloc(parent, &pdev->dev, mux->data.n_values, 0, 0,
i2c_mux_reg_select, NULL); i2c_mux_reg_select, NULL);
if (!muxc) if (!muxc) {
return -ENOMEM; ret = -ENOMEM;
goto err_put_parent;
}
muxc->priv = mux; muxc->priv = mux;
platform_set_drvdata(pdev, muxc); platform_set_drvdata(pdev, muxc);
...@@ -223,7 +228,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) ...@@ -223,7 +228,7 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class); ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class);
if (ret) if (ret)
goto add_adapter_failed; goto err_del_mux_adapters;
} }
dev_dbg(&pdev->dev, "%d port mux on %s adapter\n", dev_dbg(&pdev->dev, "%d port mux on %s adapter\n",
...@@ -231,8 +236,10 @@ static int i2c_mux_reg_probe(struct platform_device *pdev) ...@@ -231,8 +236,10 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
return 0; return 0;
add_adapter_failed: err_del_mux_adapters:
i2c_mux_del_adapters(muxc); i2c_mux_del_adapters(muxc);
err_put_parent:
i2c_put_adapter(parent);
return ret; return ret;
} }
......
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