Skip to contentSkip to conversation

net: macb: allow deffered probe of the driver

PATCH Applied Nicolae Rosia 3 participants 5 messages Jan 22, 2015 – Jan 27, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: macb: allow deffered probe of the driver

The driver is trying to acquire clocks which maybe are not available yet. Allow the driver to request deffered probe by providing a probe function and registering it with module_platform_driver. [1] This patch is based on 3.19-rc5.

[1] https://lkml.org/lkml/2013/9/23/118

---
 drivers/net/ethernet/cadence/macb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/drivers/net/ethernet/cadence/macb.c
index 3767271..4dfcd66 100644

drivers/net/ethernet/cadence/macb.c +5 -4
@@ -2148,7 +2148,7 @@ static void macb_probe_queues(void __iomem *mem,
 			(*num_queues)++;
 }
 
-static int __init macb_probe(struct platform_device *pdev)
+static int macb_probe(struct platform_device *pdev)
 {
 	struct macb_platform_data *pdata;
 	struct resource *regs;
@@ -2386,7 +2386,7 @@ err_out:
 	return err;
 }
 
-static int __exit macb_remove(struct platform_device *pdev)
+static int macb_remove(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct macb *bp;
@@ -2449,7 +2449,8 @@ static int macb_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume);
 
 static struct platform_driver macb_driver = {
-	.remove		= __exit_p(macb_remove),
+	.probe		= macb_probe,
+	.remove		= macb_remove,
 	.driver		= {
 		.name		= "macb",
 		.of_match_table	= of_match_ptr(macb_dt_ids),
@@ -2457,7 +2458,7 @@ static struct platform_driver macb_driver = {
 	},
 };
 
-module_platform_driver_probe(macb_driver, macb_probe);
+module_platform_driver(macb_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver");
Signature · 1 line
2.1.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Nicolae Rosia

The driver is trying to acquire clocks which maybe are not available yet. Allow the driver to request deffered probe by providing a probe function and registering it with module_platform_driver. [1] This patch is based on 3.19-rc5.

Do you have a use case for this need?

Quoted 3 lines

[1] https://lkml.org/lkml/2013/9/23/118

But anyway, it's not harmful:

Quoted 47 lines
---
 drivers/net/ethernet/cadence/macb.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/cadence/macb.c +5 -4
index 3767271..4dfcd66 100644
@@ -2148,7 +2148,7 @@ static void macb_probe_queues(void __iomem *mem,
 			(*num_queues)++;
 }
 
-static int __init macb_probe(struct platform_device *pdev)
+static int macb_probe(struct platform_device *pdev)
 {
 	struct macb_platform_data *pdata;
 	struct resource *regs;
@@ -2386,7 +2386,7 @@ err_out:
 	return err;
 }
 
-static int __exit macb_remove(struct platform_device *pdev)
+static int macb_remove(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct macb *bp;
@@ -2449,7 +2449,8 @@ static int macb_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(macb_pm_ops, macb_suspend, macb_resume);
 
 static struct platform_driver macb_driver = {
-	.remove		= __exit_p(macb_remove),
+	.probe		= macb_probe,
+	.remove		= macb_remove,
 	.driver		= {
 		.name		= "macb",
 		.of_match_table	= of_match_ptr(macb_dt_ids),
@@ -2457,7 +2458,7 @@ static struct platform_driver macb_driver = {
 	},
 };
 
-module_platform_driver_probe(macb_driver, macb_probe);
+module_platform_driver(macb_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Cadence MACB/GEM Ethernet driver");
Signature · 1 line
Nicolas Ferre
#2 lore raw
Quoted 1 line · Nicolas Ferre

Do you have a use case for this need?

On my setup (Zynq Platform), the required clocks are provided by a module which is loaded after this driver, hence, the clock is not available at initialization time.

Quoted 2 lines

But anyway, it's not harmful:

Thank you.

Best regards,
Nicolae Rosia

#3 lore raw
Quoted 5 lines · Nicolae Rosia
Quoted 1 line · Nicolas Ferre

Do you have a use case for this need?

On my setup (Zynq Platform), the required clocks are provided by a module which is loaded after this driver, hence, the clock is not available at initialization time.

That's what I (actually Boris who I've consulted regarding this) felt. Thanks for having confirmed this.

Quoted 7 lines
Quoted 2 lines

But anyway, it's not harmful:

Thank you.

Best regards,
Nicolae Rosia

Bye,

Signature · 1 line
Nicolas Ferre
maintainer Applied
#4 lore raw
In reply to Nicolae Rosia

From: Nicolae Rosia <[email protected]>
Date: Thu, 22 Jan 2015 17:31:05 +0000

Quoted 9 lines

The driver is trying to acquire clocks which maybe are not available yet. Allow the driver to request deffered probe by providing a probe function and registering it with module_platform_driver. [1] This patch is based on 3.19-rc5.

[1] https://lkml.org/lkml/2013/9/23/118

Applied.