diff mbox

[2/3] mmc: atmel-mci: stop using specific initcall

Message ID 1416478075-17059-2-git-send-email-ludovic.desroches@atmel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ludovic Desroches Nov. 20, 2014, 10:07 a.m. UTC
No more use late initcall to manage probing order. Use probe deferring
if needed. Then use module_platform_driver and clean init/exit
attributes.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/atmel-mci.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

Comments

Arnd Bergmann Nov. 20, 2014, 11:10 a.m. UTC | #1
On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote:
> No more use late initcall to manage probing order. Use probe deferring
> if needed. Then use module_platform_driver and clean init/exit
> attributes.
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> 

Do we need this backported into stable kernels? It seems that
the __init/__exit annotations will break things if you ever
tried to unbind the device or run into deferred probing on
earlier kernels.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ludovic Desroches Nov. 20, 2014, 2:01 p.m. UTC | #2
On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote:
> On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote:
> > No more use late initcall to manage probing order. Use probe deferring
> > if needed. Then use module_platform_driver and clean init/exit
> > attributes.
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > 
> 
> Do we need this backported into stable kernels? It seems that
> the __init/__exit annotations will break things if you ever
> tried to unbind the device or run into deferred probing on
> earlier kernels.

Well, it is a bit complicated, if we backport it, then the mci driver
could be probed before the dma controller. Requesting dma chan will fail
and it will switch to pio mode.

So it has to be backported with the probe deferring. The issue is
that probe deferring patch is based on other patches removing non-dt
support which become useless only ine 3.19.


Ludovic
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Nov. 20, 2014, 2:13 p.m. UTC | #3
On Thursday 20 November 2014 15:01:25 Ludovic Desroches wrote:
> On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote:
> > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote:
> > > No more use late initcall to manage probing order. Use probe deferring
> > > if needed. Then use module_platform_driver and clean init/exit
> > > attributes.
> > > 
> > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > > 
> > 
> > Do we need this backported into stable kernels? It seems that
> > the __init/__exit annotations will break things if you ever
> > tried to unbind the device or run into deferred probing on
> > earlier kernels.
> 
> Well, it is a bit complicated, if we backport it, then the mci driver
> could be probed before the dma controller. Requesting dma chan will fail
> and it will switch to pio mode.
> 
> So it has to be backported with the probe deferring. The issue is
> that probe deferring patch is based on other patches removing non-dt
> support which become useless only ine 3.19.
> 

Should we just have the __init/__exit removal in backports then?

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ludovic Desroches Nov. 20, 2014, 2:18 p.m. UTC | #4
On Thu, Nov 20, 2014 at 03:13:30PM +0100, Arnd Bergmann wrote:
> On Thursday 20 November 2014 15:01:25 Ludovic Desroches wrote:
> > On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote:
> > > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote:
> > > > No more use late initcall to manage probing order. Use probe deferring
> > > > if needed. Then use module_platform_driver and clean init/exit
> > > > attributes.
> > > > 
> > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > > > 
> > > 
> > > Do we need this backported into stable kernels? It seems that
> > > the __init/__exit annotations will break things if you ever
> > > tried to unbind the device or run into deferred probing on
> > > earlier kernels.
> > 
> > Well, it is a bit complicated, if we backport it, then the mci driver
> > could be probed before the dma controller. Requesting dma chan will fail
> > and it will switch to pio mode.
> > 
> > So it has to be backported with the probe deferring. The issue is
> > that probe deferring patch is based on other patches removing non-dt
> > support which become useless only ine 3.19.
> > 
> 
> Should we just have the __init/__exit removal in backports then?

Yes. Do you want me to split this patch in order to have ony one for
__init/__exit removal and another one for late_initcall removal?


Ludovic
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arnd Bergmann Nov. 20, 2014, 3:25 p.m. UTC | #5
On Thursday 20 November 2014 15:18:55 Ludovic Desroches wrote:
> On Thu, Nov 20, 2014 at 03:13:30PM +0100, Arnd Bergmann wrote:
> > On Thursday 20 November 2014 15:01:25 Ludovic Desroches wrote:
> > > On Thu, Nov 20, 2014 at 12:10:25PM +0100, Arnd Bergmann wrote:
> > > > On Thursday 20 November 2014 11:07:54 Ludovic Desroches wrote:
> > > > > No more use late initcall to manage probing order. Use probe deferring
> > > > > if needed. Then use module_platform_driver and clean init/exit
> > > > > attributes.
> > > > > 
> > > > > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> > > > > 
> > > > 
> > > > Do we need this backported into stable kernels? It seems that
> > > > the __init/__exit annotations will break things if you ever
> > > > tried to unbind the device or run into deferred probing on
> > > > earlier kernels.
> > > 
> > > Well, it is a bit complicated, if we backport it, then the mci driver
> > > could be probed before the dma controller. Requesting dma chan will fail
> > > and it will switch to pio mode.
> > > 
> > > So it has to be backported with the probe deferring. The issue is
> > > that probe deferring patch is based on other patches removing non-dt
> > > support which become useless only ine 3.19.
> > > 
> > 
> > Should we just have the __init/__exit removal in backports then?
> 
> Yes. Do you want me to split this patch in order to have ony one for
> __init/__exit removal and another one for late_initcall removal?
> 
> 

Yes, I think that would be best.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index b9226b3..9b85c4e 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2137,7 +2137,7 @@  static irqreturn_t atmci_detect_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static int __init atmci_init_slot(struct atmel_mci *host,
+static int atmci_init_slot(struct atmel_mci *host,
 		struct mci_slot_pdata *slot_data, unsigned int id,
 		u32 sdc_reg, u32 sdio_irq)
 {
@@ -2344,7 +2344,7 @@  static void __init atmci_get_cap(struct atmel_mci *host)
 	}
 }
 
-static int __init atmci_probe(struct platform_device *pdev)
+static int atmci_probe(struct platform_device *pdev)
 {
 	struct mci_platform_data	*pdata;
 	struct atmel_mci		*host;
@@ -2480,7 +2480,7 @@  err_init_slot:
 	return ret;
 }
 
-static int __exit atmci_remove(struct platform_device *pdev)
+static int atmci_remove(struct platform_device *pdev)
 {
 	struct atmel_mci	*host = platform_get_drvdata(pdev);
 	unsigned int		i;
@@ -2510,25 +2510,14 @@  static int __exit atmci_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver atmci_driver = {
-	.remove		= __exit_p(atmci_remove),
+	.probe		= atmci_probe,
+	.remove		= atmci_remove,
 	.driver		= {
 		.name		= "atmel_mci",
 		.of_match_table	= of_match_ptr(atmci_dt_ids),
 	},
 };
-
-static int __init atmci_init(void)
-{
-	return platform_driver_probe(&atmci_driver, atmci_probe);
-}
-
-static void __exit atmci_exit(void)
-{
-	platform_driver_unregister(&atmci_driver);
-}
-
-late_initcall(atmci_init); /* try to load after dma driver when built-in */
-module_exit(atmci_exit);
+module_platform_driver(atmci_driver);
 
 MODULE_DESCRIPTION("Atmel Multimedia Card Interface driver");
 MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");