Commit 6cc3026e 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:
 "We had various reports of problems with deferred probing in the I2C
  subsystem, so this pull requst is a little bigger than usual.

  Most issues should be addressed now so devices will be found
  correctly.  A few ususal driver bugfixes are in here, too"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: i2c-mux-pinctrl: use deferred probe when adapter not found
  i2c: i2c-arb-gpio-challenge: use deferred probe when adapter not found
  i2c: i2c-mux-gpio: use deferred probing
  i2c: i2c-mux-gpio: don't ignore of_get_named_gpio errors
  i2c: omap: Clear ARDY bit twice
  i2c: Not all adapters have a parent
  i2c: i2c-stu300: replace platform_driver_probe to support deferred probing
  i2c: i2c-mxs: replace platform_driver_probe to support deferred probing
  i2c: i2c-imx: replace platform_driver_probe to support deferred probing
  i2c: i2c-designware-platdrv: replace platform_driver_probe to support deferred probing
parents c786e90b 2737de46
...@@ -270,6 +270,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume); ...@@ -270,6 +270,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
MODULE_ALIAS("platform:i2c_designware"); MODULE_ALIAS("platform:i2c_designware");
static struct platform_driver dw_i2c_driver = { static struct platform_driver dw_i2c_driver = {
.probe = dw_i2c_probe,
.remove = dw_i2c_remove, .remove = dw_i2c_remove,
.driver = { .driver = {
.name = "i2c_designware", .name = "i2c_designware",
...@@ -282,7 +283,7 @@ static struct platform_driver dw_i2c_driver = { ...@@ -282,7 +283,7 @@ static struct platform_driver dw_i2c_driver = {
static int __init dw_i2c_init_driver(void) static int __init dw_i2c_init_driver(void)
{ {
return platform_driver_probe(&dw_i2c_driver, dw_i2c_probe); return platform_driver_register(&dw_i2c_driver);
} }
subsys_initcall(dw_i2c_init_driver); subsys_initcall(dw_i2c_init_driver);
......
...@@ -365,7 +365,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) ...@@ -365,7 +365,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
clk_disable_unprepare(i2c_imx->clk); clk_disable_unprepare(i2c_imx->clk);
} }
static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, static void i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
unsigned int rate) unsigned int rate)
{ {
struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div; struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div;
...@@ -589,7 +589,7 @@ static struct i2c_algorithm i2c_imx_algo = { ...@@ -589,7 +589,7 @@ static struct i2c_algorithm i2c_imx_algo = {
.functionality = i2c_imx_func, .functionality = i2c_imx_func,
}; };
static int __init i2c_imx_probe(struct platform_device *pdev) static int i2c_imx_probe(struct platform_device *pdev)
{ {
const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids, const struct of_device_id *of_id = of_match_device(i2c_imx_dt_ids,
&pdev->dev); &pdev->dev);
...@@ -697,7 +697,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev) ...@@ -697,7 +697,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
return 0; /* Return OK */ return 0; /* Return OK */
} }
static int __exit i2c_imx_remove(struct platform_device *pdev) static int i2c_imx_remove(struct platform_device *pdev)
{ {
struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev); struct imx_i2c_struct *i2c_imx = platform_get_drvdata(pdev);
...@@ -715,7 +715,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev) ...@@ -715,7 +715,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
} }
static struct platform_driver i2c_imx_driver = { static struct platform_driver i2c_imx_driver = {
.remove = __exit_p(i2c_imx_remove), .probe = i2c_imx_probe,
.remove = i2c_imx_remove,
.driver = { .driver = {
.name = DRIVER_NAME, .name = DRIVER_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -726,7 +727,7 @@ static struct platform_driver i2c_imx_driver = { ...@@ -726,7 +727,7 @@ static struct platform_driver i2c_imx_driver = {
static int __init i2c_adap_imx_init(void) static int __init i2c_adap_imx_init(void)
{ {
return platform_driver_probe(&i2c_imx_driver, i2c_imx_probe); return platform_driver_register(&i2c_imx_driver);
} }
subsys_initcall(i2c_adap_imx_init); subsys_initcall(i2c_adap_imx_init);
......
...@@ -780,12 +780,13 @@ static struct platform_driver mxs_i2c_driver = { ...@@ -780,12 +780,13 @@ static struct platform_driver mxs_i2c_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = mxs_i2c_dt_ids, .of_match_table = mxs_i2c_dt_ids,
}, },
.probe = mxs_i2c_probe,
.remove = mxs_i2c_remove, .remove = mxs_i2c_remove,
}; };
static int __init mxs_i2c_init(void) static int __init mxs_i2c_init(void)
{ {
return platform_driver_probe(&mxs_i2c_driver, mxs_i2c_probe); return platform_driver_register(&mxs_i2c_driver);
} }
subsys_initcall(mxs_i2c_init); subsys_initcall(mxs_i2c_init);
......
...@@ -939,6 +939,9 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) ...@@ -939,6 +939,9 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
/* /*
* ProDB0017052: Clear ARDY bit twice * ProDB0017052: Clear ARDY bit twice
*/ */
if (stat & OMAP_I2C_STAT_ARDY)
omap_i2c_ack_stat(dev, OMAP_I2C_STAT_ARDY);
if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK |
OMAP_I2C_STAT_AL)) { OMAP_I2C_STAT_AL)) {
omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_RRDY | omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_RRDY |
......
...@@ -859,8 +859,7 @@ static const struct i2c_algorithm stu300_algo = { ...@@ -859,8 +859,7 @@ static const struct i2c_algorithm stu300_algo = {
.functionality = stu300_func, .functionality = stu300_func,
}; };
static int __init static int stu300_probe(struct platform_device *pdev)
stu300_probe(struct platform_device *pdev)
{ {
struct stu300_dev *dev; struct stu300_dev *dev;
struct i2c_adapter *adap; struct i2c_adapter *adap;
...@@ -966,8 +965,7 @@ static SIMPLE_DEV_PM_OPS(stu300_pm, stu300_suspend, stu300_resume); ...@@ -966,8 +965,7 @@ static SIMPLE_DEV_PM_OPS(stu300_pm, stu300_suspend, stu300_resume);
#define STU300_I2C_PM NULL #define STU300_I2C_PM NULL
#endif #endif
static int __exit static int stu300_remove(struct platform_device *pdev)
stu300_remove(struct platform_device *pdev)
{ {
struct stu300_dev *dev = platform_get_drvdata(pdev); struct stu300_dev *dev = platform_get_drvdata(pdev);
...@@ -989,13 +987,14 @@ static struct platform_driver stu300_i2c_driver = { ...@@ -989,13 +987,14 @@ static struct platform_driver stu300_i2c_driver = {
.pm = STU300_I2C_PM, .pm = STU300_I2C_PM,
.of_match_table = stu300_dt_match, .of_match_table = stu300_dt_match,
}, },
.remove = __exit_p(stu300_remove), .probe = stu300_probe,
.remove = stu300_remove,
}; };
static int __init stu300_init(void) static int __init stu300_init(void)
{ {
return platform_driver_probe(&stu300_i2c_driver, stu300_probe); return platform_driver_register(&stu300_i2c_driver);
} }
static void __exit stu300_exit(void) static void __exit stu300_exit(void)
......
...@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap) ...@@ -1134,6 +1134,9 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap)
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
if (!adap->dev.parent)
return;
handle = ACPI_HANDLE(adap->dev.parent); handle = ACPI_HANDLE(adap->dev.parent);
if (!handle) if (!handle)
return; return;
......
...@@ -200,7 +200,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev) ...@@ -200,7 +200,7 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)
arb->parent = of_find_i2c_adapter_by_node(parent_np); arb->parent = of_find_i2c_adapter_by_node(parent_np);
if (!arb->parent) { if (!arb->parent) {
dev_err(dev, "Cannot find parent bus\n"); dev_err(dev, "Cannot find parent bus\n");
return -EINVAL; return -EPROBE_DEFER;
} }
/* Actually add the mux adapter */ /* Actually add the mux adapter */
......
...@@ -66,7 +66,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux, ...@@ -66,7 +66,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
struct device_node *adapter_np, *child; struct device_node *adapter_np, *child;
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
unsigned *values, *gpios; unsigned *values, *gpios;
int i = 0; int i = 0, ret;
if (!np) if (!np)
return -ENODEV; return -ENODEV;
...@@ -79,7 +79,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux, ...@@ -79,7 +79,7 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
adapter = of_find_i2c_adapter_by_node(adapter_np); adapter = of_find_i2c_adapter_by_node(adapter_np);
if (!adapter) { if (!adapter) {
dev_err(&pdev->dev, "Cannot find parent bus\n"); dev_err(&pdev->dev, "Cannot find parent bus\n");
return -ENODEV; return -EPROBE_DEFER;
} }
mux->data.parent = i2c_adapter_id(adapter); mux->data.parent = i2c_adapter_id(adapter);
put_device(&adapter->dev); put_device(&adapter->dev);
...@@ -116,8 +116,12 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux, ...@@ -116,8 +116,12 @@ static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; i < mux->data.n_gpios; i++) for (i = 0; i < mux->data.n_gpios; i++) {
gpios[i] = of_get_named_gpio(np, "mux-gpios", i); ret = of_get_named_gpio(np, "mux-gpios", i);
if (ret < 0)
return ret;
gpios[i] = ret;
}
mux->data.gpios = gpios; mux->data.gpios = gpios;
...@@ -177,7 +181,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev) ...@@ -177,7 +181,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
if (!parent) { if (!parent) {
dev_err(&pdev->dev, "Parent adapter (%d) not found\n", dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
mux->data.parent); mux->data.parent);
return -ENODEV; return -EPROBE_DEFER;
} }
mux->parent = parent; mux->parent = parent;
......
...@@ -113,7 +113,7 @@ static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux, ...@@ -113,7 +113,7 @@ static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
adapter = of_find_i2c_adapter_by_node(adapter_np); adapter = of_find_i2c_adapter_by_node(adapter_np);
if (!adapter) { if (!adapter) {
dev_err(mux->dev, "Cannot find parent bus\n"); dev_err(mux->dev, "Cannot find parent bus\n");
return -ENODEV; return -EPROBE_DEFER;
} }
mux->pdata->parent_bus_num = i2c_adapter_id(adapter); mux->pdata->parent_bus_num = i2c_adapter_id(adapter);
put_device(&adapter->dev); put_device(&adapter->dev);
...@@ -211,7 +211,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev) ...@@ -211,7 +211,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
if (!mux->parent) { if (!mux->parent) {
dev_err(&pdev->dev, "Parent adapter (%d) not found\n", dev_err(&pdev->dev, "Parent adapter (%d) not found\n",
mux->pdata->parent_bus_num); mux->pdata->parent_bus_num);
ret = -ENODEV; ret = -EPROBE_DEFER;
goto err; goto 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