From patchwork Thu Sep 6 14:07:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 1415101 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 592C6DFFCF for ; Thu, 6 Sep 2012 14:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754839Ab2IFOH6 (ORCPT ); Thu, 6 Sep 2012 10:07:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42759 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753364Ab2IFOH5 (ORCPT ); Thu, 6 Sep 2012 10:07:57 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q86E7t84015744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Sep 2012 10:07:55 -0400 Received: from [10.97.6.171] (vpn1-6-171.gru2.redhat.com [10.97.6.171]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q86E7r1o007667 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 6 Sep 2012 10:07:54 -0400 Message-ID: <5048AE38.6080108@redhat.com> Date: Thu, 06 Sep 2012 11:07:52 -0300 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Sylwester Nawrocki CC: Linux Media Mailing List , Prabhakar Lad Subject: Re: [PATCH 10/12] [media] move i2c files into drivers/media/i2c References: <502AC079.50902@gmail.com> <1345038500-28734-1-git-send-email-mchehab@redhat.com> <1345038500-28734-11-git-send-email-mchehab@redhat.com> <503811EC.8030808@gmail.com> In-Reply-To: <503811EC.8030808@gmail.com> X-Enigmail-Version: 1.4.3 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Em 24-08-2012 20:44, Sylwester Nawrocki escreveu: > From: Sylwester Nawrocki > 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 > --- > 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 Signed-off-by: Mauro Carvalho Chehab Acked-by: Sylwester Nawrocki Acked-by: Prabhakar Lad --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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/