linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net"
  2009-08-18 16:34 [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net" Sudhakar Rajashekhara
@ 2009-08-18  8:19 ` Andrew Morton
  2009-08-18  9:36   ` Sudhakar Rajashekhara
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2009-08-18  8:19 UTC (permalink / raw)
  To: Sudhakar Rajashekhara
  Cc: david-b, dwmw2, davinci-linux-open-source, linux-mtd,
	linux-kernel

On Tue, 18 Aug 2009 12:34:04 -0400 Sudhakar Rajashekhara <sudhakar.raj@ti.com> wrote:

> On TI's da850/omap-l138 EVM, MAC address is stored in SPI flash.
> 
> This patch changes the initialization sequence of the drivers
> by moving mtd and spi ahead of net in drivers/Makefile thereby
> enabling da850/omap-l138 ethernet driver to read the MAC address
> while booting.
> 
> Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> ---
>  drivers/Makefile |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/Makefile b/drivers/Makefile
> index bc4205d..2a1d41f 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -42,6 +42,8 @@ obj-y				+= macintosh/
>  obj-$(CONFIG_IDE)		+= ide/
>  obj-$(CONFIG_SCSI)		+= scsi/
>  obj-$(CONFIG_ATA)		+= ata/
> +obj-$(CONFIG_MTD)		+= mtd/
> +obj-$(CONFIG_SPI)		+= spi/
>  obj-y				+= net/
>  obj-$(CONFIG_ATM)		+= atm/
>  obj-$(CONFIG_FUSION)		+= message/
> @@ -50,8 +52,6 @@ obj-y				+= ieee1394/
>  obj-$(CONFIG_UIO)		+= uio/
>  obj-y				+= cdrom/
>  obj-y				+= auxdisplay/
> -obj-$(CONFIG_MTD)		+= mtd/
> -obj-$(CONFIG_SPI)		+= spi/
>  obj-$(CONFIG_PCCARD)		+= pcmcia/
>  obj-$(CONFIG_DIO)		+= dio/
>  obj-$(CONFIG_SBUS)		+= sbus/

That isn't a particularly maintainable way of fixing this, especially
as there are no comments in that Makefile to prevent someone from
rebreaking it in the future.

A better fix would be to use suitably prioritised initcalls - see
include/linux/init.h around line 187.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net"
  2009-08-18  8:19 ` Andrew Morton
@ 2009-08-18  9:36   ` Sudhakar Rajashekhara
  2009-08-18  9:49     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Sudhakar Rajashekhara @ 2009-08-18  9:36 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: david-b, dwmw2, davinci-linux-open-source, linux-mtd,
	linux-kernel

On Tue, Aug 18, 2009 at 13:49:30, Andrew Morton wrote:
> On Tue, 18 Aug 2009 12:34:04 -0400 Sudhakar Rajashekhara <sudhakar.raj@ti.com> wrote:
> 
> > On TI's da850/omap-l138 EVM, MAC address is stored in SPI flash.
> > 
> > This patch changes the initialization sequence of the drivers
> > by moving mtd and spi ahead of net in drivers/Makefile thereby
> > enabling da850/omap-l138 ethernet driver to read the MAC address
> > while booting.
> > 
> > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > ---
> >  drivers/Makefile |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/Makefile b/drivers/Makefile
> > index bc4205d..2a1d41f 100644
> > --- a/drivers/Makefile
> > +++ b/drivers/Makefile
> > @@ -42,6 +42,8 @@ obj-y				+= macintosh/
> >  obj-$(CONFIG_IDE)		+= ide/
> >  obj-$(CONFIG_SCSI)		+= scsi/
> >  obj-$(CONFIG_ATA)		+= ata/
> > +obj-$(CONFIG_MTD)		+= mtd/
> > +obj-$(CONFIG_SPI)		+= spi/
> >  obj-y				+= net/
> >  obj-$(CONFIG_ATM)		+= atm/
> >  obj-$(CONFIG_FUSION)		+= message/
> > @@ -50,8 +52,6 @@ obj-y				+= ieee1394/
> >  obj-$(CONFIG_UIO)		+= uio/
> >  obj-y				+= cdrom/
> >  obj-y				+= auxdisplay/
> > -obj-$(CONFIG_MTD)		+= mtd/
> > -obj-$(CONFIG_SPI)		+= spi/
> >  obj-$(CONFIG_PCCARD)		+= pcmcia/
> >  obj-$(CONFIG_DIO)		+= dio/
> >  obj-$(CONFIG_SBUS)		+= sbus/
> 
> That isn't a particularly maintainable way of fixing this, especially
> as there are no comments in that Makefile to prevent someone from
> rebreaking it in the future.
> 
> A better fix would be to use suitably prioritised initcalls - see
> include/linux/init.h around line 187.
> 

Currently mtd, spi and net subsystems are initialized with module_init.
If I change the way in which these sub-systems are initialized, then
I'll be breaking the support for these sub-systems to work as modules.

There are some comments in drivers/Makefile which say why particular
sub-systems are ahead of others like:

	...
	...
	# PnP must come after ACPI since it will eventually need to check if acpi
	# was used and do nothing if so
	...
	...
	# char/ comes before serial/ etc so that the VT console is the boot-time
	# default.
	...

I'll add comments in the Makefile stating the need of mtd and spi
ahead of net and re-submit the patch.

Regards, Sudhakar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net"
  2009-08-18  9:36   ` Sudhakar Rajashekhara
@ 2009-08-18  9:49     ` Andrew Morton
  2009-08-18 12:18       ` Sudhakar Rajashekhara
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2009-08-18  9:49 UTC (permalink / raw)
  To: Sudhakar Rajashekhara
  Cc: david-b, dwmw2, davinci-linux-open-source, linux-mtd,
	linux-kernel

On Tue, 18 Aug 2009 15:06:35 +0530 "Sudhakar Rajashekhara" <sudhakar.raj@ti.com> wrote:

> On Tue, Aug 18, 2009 at 13:49:30, Andrew Morton wrote:
> > On Tue, 18 Aug 2009 12:34:04 -0400 Sudhakar Rajashekhara <sudhakar.raj@ti.com> wrote:
> > 
> > > On TI's da850/omap-l138 EVM, MAC address is stored in SPI flash.
> > > 
> > > This patch changes the initialization sequence of the drivers
> > > by moving mtd and spi ahead of net in drivers/Makefile thereby
> > > enabling da850/omap-l138 ethernet driver to read the MAC address
> > > while booting.
> > > 
> > > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > > ---
> > >  drivers/Makefile |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/Makefile b/drivers/Makefile
> > > index bc4205d..2a1d41f 100644
> > > --- a/drivers/Makefile
> > > +++ b/drivers/Makefile
> > > @@ -42,6 +42,8 @@ obj-y				+= macintosh/
> > >  obj-$(CONFIG_IDE)		+= ide/
> > >  obj-$(CONFIG_SCSI)		+= scsi/
> > >  obj-$(CONFIG_ATA)		+= ata/
> > > +obj-$(CONFIG_MTD)		+= mtd/
> > > +obj-$(CONFIG_SPI)		+= spi/
> > >  obj-y				+= net/
> > >  obj-$(CONFIG_ATM)		+= atm/
> > >  obj-$(CONFIG_FUSION)		+= message/
> > > @@ -50,8 +52,6 @@ obj-y				+= ieee1394/
> > >  obj-$(CONFIG_UIO)		+= uio/
> > >  obj-y				+= cdrom/
> > >  obj-y				+= auxdisplay/
> > > -obj-$(CONFIG_MTD)		+= mtd/
> > > -obj-$(CONFIG_SPI)		+= spi/
> > >  obj-$(CONFIG_PCCARD)		+= pcmcia/
> > >  obj-$(CONFIG_DIO)		+= dio/
> > >  obj-$(CONFIG_SBUS)		+= sbus/
> > 
> > That isn't a particularly maintainable way of fixing this, especially
> > as there are no comments in that Makefile to prevent someone from
> > rebreaking it in the future.
> > 
> > A better fix would be to use suitably prioritised initcalls - see
> > include/linux/init.h around line 187.
> > 
> 
> Currently mtd, spi and net subsystems are initialized with module_init.
> If I change the way in which these sub-systems are initialized, then
> I'll be breaking the support for these sub-systems to work as modules.

In what way?

> There are some comments in drivers/Makefile which say why particular
> sub-systems are ahead of others like:
> 
> 	...
> 	...
> 	# PnP must come after ACPI since it will eventually need to check if acpi
> 	# was used and do nothing if so
> 	...
> 	...
> 	# char/ comes before serial/ etc so that the VT console is the boot-time
> 	# default.
> 	...
> 

It would be nice to fix those as well ;)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net"
  2009-08-18  9:49     ` Andrew Morton
@ 2009-08-18 12:18       ` Sudhakar Rajashekhara
  0 siblings, 0 replies; 5+ messages in thread
From: Sudhakar Rajashekhara @ 2009-08-18 12:18 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: david-b, dwmw2, davinci-linux-open-source, linux-mtd,
	linux-kernel

On Tue, Aug 18, 2009 at 15:19:08, Andrew Morton wrote:
> On Tue, 18 Aug 2009 15:06:35 +0530 "Sudhakar Rajashekhara" <sudhakar.raj@ti.com> wrote:
> 
> > On Tue, Aug 18, 2009 at 13:49:30, Andrew Morton wrote:
> > > On Tue, 18 Aug 2009 12:34:04 -0400 Sudhakar Rajashekhara <sudhakar.raj@ti.com> wrote:
> > > 
> > > > On TI's da850/omap-l138 EVM, MAC address is stored in SPI flash.
> > > > 
> > > > This patch changes the initialization sequence of the drivers by 
> > > > moving mtd and spi ahead of net in drivers/Makefile thereby 
> > > > enabling da850/omap-l138 ethernet driver to read the MAC address 
> > > > while booting.
> > > > 
> > > > Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
> > > > ---
> > > >  drivers/Makefile |    4 ++--
> > > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/Makefile b/drivers/Makefile index 
> > > > bc4205d..2a1d41f 100644
> > > > --- a/drivers/Makefile
> > > > +++ b/drivers/Makefile
> > > > @@ -42,6 +42,8 @@ obj-y				+= macintosh/
> > > >  obj-$(CONFIG_IDE)		+= ide/
> > > >  obj-$(CONFIG_SCSI)		+= scsi/
> > > >  obj-$(CONFIG_ATA)		+= ata/
> > > > +obj-$(CONFIG_MTD)		+= mtd/
> > > > +obj-$(CONFIG_SPI)		+= spi/
> > > >  obj-y				+= net/
> > > >  obj-$(CONFIG_ATM)		+= atm/
> > > >  obj-$(CONFIG_FUSION)		+= message/
> > > > @@ -50,8 +52,6 @@ obj-y				+= ieee1394/
> > > >  obj-$(CONFIG_UIO)		+= uio/
> > > >  obj-y				+= cdrom/
> > > >  obj-y				+= auxdisplay/
> > > > -obj-$(CONFIG_MTD)		+= mtd/
> > > > -obj-$(CONFIG_SPI)		+= spi/
> > > >  obj-$(CONFIG_PCCARD)		+= pcmcia/
> > > >  obj-$(CONFIG_DIO)		+= dio/
> > > >  obj-$(CONFIG_SBUS)		+= sbus/
> > > 
> > > That isn't a particularly maintainable way of fixing this, 
> > > especially as there are no comments in that Makefile to prevent 
> > > someone from rebreaking it in the future.
> > > 
> > > A better fix would be to use suitably prioritised initcalls - see 
> > > include/linux/init.h around line 187.
> > > 
> > 
> > Currently mtd, spi and net subsystems are initialized with module_init.
> > If I change the way in which these sub-systems are initialized, then 
> > I'll be breaking the support for these sub-systems to work as modules.
> 
> In what way?
> 

Now I got what you were saying. I was able to get the EMAC driver initialize
later than spi and mtd by using late_initcall. With this change EMAC works
as module as well. The patch looks as below:

===
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 12fd446..5e6652b 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2817,7 +2817,7 @@ static int __init davinci_emac_init(void)
 {
        return platform_driver_register(&davinci_emac_driver);
 }
-module_init(davinci_emac_init);
+late_initcall(davinci_emac_init);

 /**
  * davinci_emac_exit: EMAC driver module exit
===

I'll submit this patch to netdev list.

Thanks,
Sudhakar

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net"
@ 2009-08-18 16:34 Sudhakar Rajashekhara
  2009-08-18  8:19 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Sudhakar Rajashekhara @ 2009-08-18 16:34 UTC (permalink / raw)
  To: linux-mtd
  Cc: david-b, davinci-linux-open-source, Sudhakar Rajashekhara, dwmw2,
	linux-kernel

On TI's da850/omap-l138 EVM, MAC address is stored in SPI flash.

This patch changes the initialization sequence of the drivers
by moving mtd and spi ahead of net in drivers/Makefile thereby
enabling da850/omap-l138 ethernet driver to read the MAC address
while booting.

Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
---
 drivers/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index bc4205d..2a1d41f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -42,6 +42,8 @@ obj-y				+= macintosh/
 obj-$(CONFIG_IDE)		+= ide/
 obj-$(CONFIG_SCSI)		+= scsi/
 obj-$(CONFIG_ATA)		+= ata/
+obj-$(CONFIG_MTD)		+= mtd/
+obj-$(CONFIG_SPI)		+= spi/
 obj-y				+= net/
 obj-$(CONFIG_ATM)		+= atm/
 obj-$(CONFIG_FUSION)		+= message/
@@ -50,8 +52,6 @@ obj-y				+= ieee1394/
 obj-$(CONFIG_UIO)		+= uio/
 obj-y				+= cdrom/
 obj-y				+= auxdisplay/
-obj-$(CONFIG_MTD)		+= mtd/
-obj-$(CONFIG_SPI)		+= spi/
 obj-$(CONFIG_PCCARD)		+= pcmcia/
 obj-$(CONFIG_DIO)		+= dio/
 obj-$(CONFIG_SBUS)		+= sbus/
-- 
1.5.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-18 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 16:34 [PATCH] [MTD] driver/Makefile: Initialize "mtd" and "spi" before "net" Sudhakar Rajashekhara
2009-08-18  8:19 ` Andrew Morton
2009-08-18  9:36   ` Sudhakar Rajashekhara
2009-08-18  9:49     ` Andrew Morton
2009-08-18 12:18       ` Sudhakar Rajashekhara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).