2013-10-08 20:35:55

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 0/9] fix deferred probing issue of platform_driver_probe

We had some issues with deferred probing in the I2C subsystem. This series
attempts to fix a part of it. From the patch description:

===

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

===

I think it makes sense to remove platform_driver_probe from bus masters like
i2c and spi (especially since they are dependant on pinctrl these days). This
is what this series does. I had a look at dma drivers as well, but there are
more things to be considered, so delayed for now.

Please comment. If no objections are raised, I'd like to bring at least the I2C
patches into v3.12, so deferred devices will then be correctly probed. The
series is based on 3.12-rc4 and was compile-tested. It is available at

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git platform_driver_probe_drop

Regards,

Wolfram


Wolfram Sang (9):
i2c: i2c-designware-platdrv: replace platform_driver_probe to support
deferred probing
i2c: i2c-imx: replace platform_driver_probe to support deferred
probing
i2c: i2c-mxs: replace platform_driver_probe to support deferred
probing
i2c: i2c-stu300: replace platform_driver_probe to support deferred
probing
spi: spi-au1550: replace platform_driver_probe to support deferred
probing
spi: spi-bfin5xx: replace platform_driver_probe to support deferred
probing
spi: spi-omap-uwire: replace platform_driver_probe to support deferred
probing
spi: spi-s3c64xx: replace platform_driver_probe to support deferred
probing
spi: spi-txx9: replace platform_driver_probe to support deferred
probing

drivers/i2c/busses/i2c-designware-platdrv.c | 5 +++--
drivers/i2c/busses/i2c-imx.c | 11 ++++++-----
drivers/i2c/busses/i2c-mxs.c | 3 ++-
drivers/i2c/busses/i2c-stu300.c | 11 +++++------
drivers/spi/spi-au1550.c | 3 ++-
drivers/spi/spi-bfin5xx.c | 5 +++--
drivers/spi/spi-omap-uwire.c | 5 +++--
drivers/spi/spi-s3c64xx.c | 3 ++-
drivers/spi/spi-txx9.c | 3 ++-
9 files changed, 28 insertions(+), 21 deletions(-)

--
1.8.4.rc3


2013-10-08 20:36:07

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 9/9] spi: spi-txx9: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/spi/spi-txx9.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c
index 7c6d157..c67a1b8 100644
--- a/drivers/spi/spi-txx9.c
+++ b/drivers/spi/spi-txx9.c
@@ -440,6 +440,7 @@ static int txx9spi_remove(struct platform_device *dev)
MODULE_ALIAS("platform:spi_txx9");

static struct platform_driver txx9spi_driver = {
+ .probe = txx9spi_probe,
.remove = txx9spi_remove,
.driver = {
.name = "spi_txx9",
@@ -449,7 +450,7 @@ static struct platform_driver txx9spi_driver = {

static int __init txx9spi_init(void)
{
- return platform_driver_probe(&txx9spi_driver, txx9spi_probe);
+ return platform_driver_register(&txx9spi_driver);
}
subsys_initcall(txx9spi_init);

--
1.8.4.rc3

2013-10-08 20:36:14

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 8/9] spi: spi-s3c64xx: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/spi/spi-s3c64xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 512b889..3df81c6 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1633,6 +1633,7 @@ static struct platform_driver s3c64xx_spi_driver = {
.pm = &s3c64xx_spi_pm,
.of_match_table = of_match_ptr(s3c64xx_spi_dt_match),
},
+ .probe = s3c64xx_spi_probe,
.remove = s3c64xx_spi_remove,
.id_table = s3c64xx_spi_driver_ids,
};
@@ -1640,7 +1641,7 @@ MODULE_ALIAS("platform:s3c64xx-spi");

static int __init s3c64xx_spi_init(void)
{
- return platform_driver_probe(&s3c64xx_spi_driver, s3c64xx_spi_probe);
+ return platform_driver_register(&s3c64xx_spi_driver);
}
subsys_initcall(s3c64xx_spi_init);

--
1.8.4.rc3

2013-10-08 20:36:41

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 7/9] spi: spi-omap-uwire: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/spi/spi-omap-uwire.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c
index a6a8f09..9313fd3 100644
--- a/drivers/spi/spi-omap-uwire.c
+++ b/drivers/spi/spi-omap-uwire.c
@@ -557,7 +557,8 @@ static struct platform_driver uwire_driver = {
.name = "omap_uwire",
.owner = THIS_MODULE,
},
- .remove = uwire_remove,
+ .probe = uwire_probe,
+ .remove = uwire_remove,
// suspend ... unuse ck
// resume ... use ck
};
@@ -579,7 +580,7 @@ static int __init omap_uwire_init(void)
omap_writel(val | 0x00AAA000, OMAP7XX_IO_CONF_9);
}

- return platform_driver_probe(&uwire_driver, uwire_probe);
+ return platform_driver_register(&uwire_driver);
}

static void __exit omap_uwire_exit(void)
--
1.8.4.rc3

2013-10-08 20:36:43

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 5/9] spi: spi-au1550: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/spi/spi-au1550.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c
index 1d00d9b3..313dd49 100644
--- a/drivers/spi/spi-au1550.c
+++ b/drivers/spi/spi-au1550.c
@@ -985,6 +985,7 @@ static int au1550_spi_remove(struct platform_device *pdev)
MODULE_ALIAS("platform:au1550-spi");

static struct platform_driver au1550_spi_drv = {
+ .probe = au1550_spi_probe,
.remove = au1550_spi_remove,
.driver = {
.name = "au1550-spi",
@@ -1004,7 +1005,7 @@ static int __init au1550_spi_init(void)
printk(KERN_ERR "au1550-spi: cannot add memory"
"dbdma device\n");
}
- return platform_driver_probe(&au1550_spi_drv, au1550_spi_probe);
+ return platform_driver_register(&au1550_spi_drv);
}
module_init(au1550_spi_init);

--
1.8.4.rc3

2013-10-08 20:36:00

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 1/9] i2c: i2c-designware-platdrv: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Zhangfei Gao <[email protected]>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 4c1b605..0aa0113 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -270,7 +270,8 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
MODULE_ALIAS("platform:i2c_designware");

static struct platform_driver dw_i2c_driver = {
- .remove = dw_i2c_remove,
+ .probe = dw_i2c_probe,
+ .remove = dw_i2c_remove,
.driver = {
.name = "i2c_designware",
.owner = THIS_MODULE,
@@ -282,7 +283,7 @@ static struct platform_driver dw_i2c_driver = {

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);

--
1.8.4.rc3

2013-10-08 20:37:20

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 6/9] spi: spi-bfin5xx: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
---
drivers/spi/spi-bfin5xx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index 45bdf73..a563bd5 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -1462,12 +1462,13 @@ static struct platform_driver bfin_spi_driver = {
},
.suspend = bfin_spi_suspend,
.resume = bfin_spi_resume,
- .remove = bfin_spi_remove,
+ .probe = bfin_spi_probe,
+ .remove = bfin_spi_remove,
};

static int __init bfin_spi_init(void)
{
- return platform_driver_probe(&bfin_spi_driver, bfin_spi_probe);
+ return platform_driver_register(&bfin_spi_driver);
}
subsys_initcall(bfin_spi_init);

--
1.8.4.rc3

2013-10-08 20:38:20

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 3/9] i2c: i2c-mxs: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Marek Vasut <[email protected]>
---
drivers/i2c/busses/i2c-mxs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index f4a0167..b7c8577 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -780,12 +780,13 @@ static struct platform_driver mxs_i2c_driver = {
.owner = THIS_MODULE,
.of_match_table = mxs_i2c_dt_ids,
},
+ .probe = mxs_i2c_probe,
.remove = mxs_i2c_remove,
};

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);

--
1.8.4.rc3

2013-10-08 20:38:24

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 2/9] i2c: i2c-imx: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: [email protected]
---
drivers/i2c/busses/i2c-imx.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index ccf4665..1d7efa3 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -365,7 +365,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
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)
{
struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div;
@@ -589,7 +589,7 @@ static struct i2c_algorithm i2c_imx_algo = {
.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,
&pdev->dev);
@@ -697,7 +697,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
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);

@@ -715,7 +715,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
}

static struct platform_driver i2c_imx_driver = {
- .remove = __exit_p(i2c_imx_remove),
+ .probe = i2c_imx_probe,
+ .remove = i2c_imx_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
@@ -726,7 +727,7 @@ static struct platform_driver i2c_imx_driver = {

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);

--
1.8.4.rc3

2013-10-08 20:38:17

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH 4/9] i2c: i2c-stu300: replace platform_driver_probe to support deferred probing

Subsystems like pinctrl and gpio rightfully make use of deferred probing at
core level. Now, deferred drivers won't be retried if they don't have a .probe
function specified in the driver struct. Fix this driver to have that, so the
devices it supports won't get lost in a deferred probe.

Signed-off-by: Wolfram Sang <[email protected]>
Cc: Linus Walleij <[email protected]>
---
drivers/i2c/busses/i2c-stu300.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index f8f6f2e..04a17b9 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -859,8 +859,7 @@ static const struct i2c_algorithm stu300_algo = {
.functionality = stu300_func,
};

-static int __init
-stu300_probe(struct platform_device *pdev)
+static int stu300_probe(struct platform_device *pdev)
{
struct stu300_dev *dev;
struct i2c_adapter *adap;
@@ -966,8 +965,7 @@ static SIMPLE_DEV_PM_OPS(stu300_pm, stu300_suspend, stu300_resume);
#define STU300_I2C_PM NULL
#endif

-static int __exit
-stu300_remove(struct platform_device *pdev)
+static int stu300_remove(struct platform_device *pdev)
{
struct stu300_dev *dev = platform_get_drvdata(pdev);

@@ -989,13 +987,14 @@ static struct platform_driver stu300_i2c_driver = {
.pm = STU300_I2C_PM,
.of_match_table = stu300_dt_match,
},
- .remove = __exit_p(stu300_remove),
+ .probe = stu300_probe,
+ .remove = stu300_remove,

};

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)
--
1.8.4.rc3

2013-10-08 20:58:59

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH 3/9] i2c: i2c-mxs: replace platform_driver_probe to support deferred probing

Dear Wolfram Sang,

> Subsystems like pinctrl and gpio rightfully make use of deferred probing at
> core level. Now, deferred drivers won't be retried if they don't have a
> .probe function specified in the driver struct. Fix this driver to have
> that, so the devices it supports won't get lost in a deferred probe.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Marek Vasut <[email protected]>

Certainly makes sense,

Acked-by: Marek Vasut <[email protected]>

Thanks!

Best regards,
Marek Vasut

2013-10-09 07:34:31

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 2/9] i2c: i2c-imx: replace platform_driver_probe to support deferred probing

On Tue, Oct 08, 2013 at 10:35:34PM +0200, Wolfram Sang wrote:
> Subsystems like pinctrl and gpio rightfully make use of deferred probing at
> core level. Now, deferred drivers won't be retried if they don't have a .probe
> function specified in the driver struct. Fix this driver to have that, so the
> devices it supports won't get lost in a deferred probe.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: [email protected]
Acked-by: Uwe Kleine-K?nig <[email protected]>

Thanks
Uwe

> ---
> drivers/i2c/busses/i2c-imx.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index ccf4665..1d7efa3 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -365,7 +365,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
> 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)
> {
> struct imx_i2c_clk_pair *i2c_clk_div = i2c_imx->hwdata->clk_div;
> @@ -589,7 +589,7 @@ static struct i2c_algorithm i2c_imx_algo = {
> .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,
> &pdev->dev);
> @@ -697,7 +697,7 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
> 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);
>
> @@ -715,7 +715,8 @@ static int __exit i2c_imx_remove(struct platform_device *pdev)
> }
>
> static struct platform_driver i2c_imx_driver = {
> - .remove = __exit_p(i2c_imx_remove),
> + .probe = i2c_imx_probe,
> + .remove = i2c_imx_remove,
> .driver = {
> .name = DRIVER_NAME,
> .owner = THIS_MODULE,
> @@ -726,7 +727,7 @@ static struct platform_driver i2c_imx_driver = {
>
> 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);
>
> --
> 1.8.4.rc3
>
>

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |

2013-10-09 11:00:06

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 5/9] spi: spi-au1550: replace platform_driver_probe to support deferred probing

On Tue, Oct 08, 2013 at 10:35:37PM +0200, Wolfram Sang wrote:
> Subsystems like pinctrl and gpio rightfully make use of deferred probing at
> core level. Now, deferred drivers won't be retried if they don't have a .probe
> function specified in the driver struct. Fix this driver to have that, so the
> devices it supports won't get lost in a deferred probe.

Applied 5-9, thanks - if there's patches 1-4 you'll need to resend them.


Attachments:
(No filename) (433.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-10-09 13:38:00

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 4/9] i2c: i2c-stu300: replace platform_driver_probe to support deferred probing

On Tue, Oct 8, 2013 at 10:35 PM, Wolfram Sang <[email protected]> wrote:

> Subsystems like pinctrl and gpio rightfully make use of deferred probing at
> core level. Now, deferred drivers won't be retried if they don't have a .probe
> function specified in the driver struct. Fix this driver to have that, so the
> devices it supports won't get lost in a deferred probe.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Linus Walleij <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2013-10-14 01:09:05

by Zhangfei Gao

[permalink] [raw]
Subject: Re: [PATCH 1/9] i2c: i2c-designware-platdrv: replace platform_driver_probe to support deferred probing

On Wed, Oct 9, 2013 at 4:35 AM, Wolfram Sang <[email protected]> wrote:
> Subsystems like pinctrl and gpio rightfully make use of deferred probing at
> core level. Now, deferred drivers won't be retried if they don't have a .probe
> function specified in the driver struct. Fix this driver to have that, so the
> devices it supports won't get lost in a deferred probe.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Zhangfei Gao <[email protected]>

Acked-by: Zhangfei Gao <[email protected]>

Thanks