linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Prabhakar Lad <prabhakar.csengg@gmail.com>
Subject: Re: [PATCH 10/12] [media] move i2c files into drivers/media/i2c
Date: Thu, 06 Sep 2012 11:07:52 -0300	[thread overview]
Message-ID: <5048AE38.6080108@redhat.com> (raw)
In-Reply-To: <503811EC.8030808@gmail.com>

Em 24-08-2012 20:44, Sylwester Nawrocki escreveu:
> From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
> Date: Sat, 25 Aug 2012 01:23:14 +0200
> Subject: [PATCH] [media] Fix link order of the V4L2 bridge and I2C modules
> 
> All I2C modules must be linked first to ensure proper module
> initialization order. With platform devices linked before I2C
> modules I2C subdev registration fails as the subdev drivers
> are not yet initialized during bridge driver's probing.
> 
> This fixes regression introduced with commmit cb7a01ac324bf2ee2,
> "[media] move i2c files into drivers/media/i2c".
> 
> Signed-off-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
> ---
>  drivers/media/Makefile |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/Makefile b/drivers/media/Makefile
> index b0b0193..92a8bcf 100644
> --- a/drivers/media/Makefile
> +++ b/drivers/media/Makefile
> @@ -8,8 +8,9 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
>    obj-$(CONFIG_MEDIA_SUPPORT) += media.o
>  endif
>  
> -obj-y += tuners/ common/ rc/ platform/
> -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
> +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
> +obj-y += common/ rc/ i2c/
> +obj-y += tuners/ platform/ pci/ usb/ mmc/ firewire/ parport/
>  
> -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
> +obj-$(CONFIG_VIDEO_DEV) += radio/
>  obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/
> -- 1.7.4.1

Hmm... This change seems incomplete on my eyes: tuners and dvb-frontends
are also I2C drivers. So, while this fixes the issue for platform drivers,
other drivers will still suffer this issue, at least on drivers that doesn't
depend on drivers located outside the media subsystem[1]

[1] thankfully, staging compiles after media, so the drivers there
shouldn't be affected. Also, drivers that use alsa won't be affected, as
alsa core (with is compiled after media) uses subsys_initcall().

IMO, the correct fix is the one below. Could you please test it?

Regards,
Mauro

-

[media] Fix init order for I2C drivers

Based on a patch from Sylvester Nawrocki

This fixes regression introduced with commmit cb7a01ac324bf2ee2,
"[media] move i2c files into drivers/media/i2c".

The linked order affect what drivers will be initialized first, when
they're built-in at Kernel. While there are macros that allow changing
the init order, like subsys_initcall(), late_initcall() & friends,
when all drivers  linked belong to the same subsystem, it is easier
to change the order at the Makefile.

All I2C modules must be linked before any drivers that actually use it,
in order to ensure proper module initialization order.

Also, the core drivers should be initialized before the drivers that use
them.

This patch reorders the drivers init, in order to fulfill the above
requirements.

Reported-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index b0b0193..620f275 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -4,12 +4,30 @@
 
 media-objs	:= media-device.o media-devnode.o media-entity.o
 
+#
+# I2C drivers should come before other drivers, otherwise they'll fail
+# when compiled as builtin drivers
+#
+obj-y += i2c/ tuners/
+obj-$(CONFIG_DVB_CORE)  += dvb-frontends/
+
+#
+# Now, let's link-in the media core
+#
 ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
   obj-$(CONFIG_MEDIA_SUPPORT) += media.o
 endif
 
-obj-y += tuners/ common/ rc/ platform/
-obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
+obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
+obj-$(CONFIG_DVB_CORE)  += dvb-core/
+
+# There are both core and drivers at RC subtree - merge before drivers
+obj-y += rc/
+
+#
+# Finally, merge the drivers that require the core
+#
+
+obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ parport/
+obj-$(CONFIG_VIDEO_DEV) += radio/
 
-obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
-obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/



  reply	other threads:[~2012-09-06 14:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 20:55 [PATCH 00/12] media tree reorganization part 2 (second version) Mauro Carvalho Chehab
2012-08-14 20:55 ` [PATCH 05/12] [media] move analog PCI saa7146 drivers to its own dir Mauro Carvalho Chehab
2012-08-14 20:55 ` =?true?q?=5BPATCH=2006/12=5D=20=5Bmedia=5D=20move=20the=20remaining=20PCI=20devices=20to=20drivers/media/pci?= Mauro Carvalho Chehab
2012-08-14 20:55 ` [PATCH 07/12] [media] move parallel port/isa video drivers to drivers/media/parport/ Mauro Carvalho Chehab
2012-08-14 20:55 ` [PATCH 08/12] [media] mmc/Kconfig: Improve driver name for siano mmc/sdio driver Mauro Carvalho Chehab
2012-08-14 20:55 ` [PATCH 09/12] [media] reorganize the API core items Mauro Carvalho Chehab
2012-08-14 21:17 ` [PATCH 00/12] media tree reorganization part 2 (second version) Sylwester Nawrocki
2012-08-15 13:48   ` Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 01/12] [media] rename most media/video usb drivers to media/usb Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 02/12] [media] move the remaining USB drivers to drivers/media/usb Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 03/12] [media] bt8xx: move analog TV part to be together with DTV one Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 04/12] [media] rename most media/video pci drivers to media/pci Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 05/12] [media] move analog PCI saa7146 drivers to its own dir Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 06/12] [media] move the remaining PCI devices to drivers/media/pci Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 07/12] [media] move parallel port/isa video drivers to drivers/media/parport/ Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 08/12] [media] mmc/Kconfig: Improve driver name for siano mmc/sdio driver Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 09/12] [media] reorganize the API core items Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 10/12] [media] move i2c files into drivers/media/i2c Mauro Carvalho Chehab
2012-08-24 23:44       ` Sylwester Nawrocki
2012-09-06 14:07         ` Mauro Carvalho Chehab [this message]
2012-09-06 20:35           ` Sylwester Nawrocki
2012-09-07  4:33           ` Prabhakar Lad
2012-08-15 13:48     ` [PATCH 11/12] [media] move soc_camera i2c drivers into its own dir Mauro Carvalho Chehab
2012-08-15 13:48     ` [PATCH 12/12] [media] rename drivers/media/video to platform Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5048AE38.6080108@redhat.com \
    --to=mchehab@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=sylvester.nawrocki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).