From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from services.gcu-squad.org (zoneX.GCU-Squad.org [194.213.125.0]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5DCFFB700E for ; Thu, 14 Jun 2012 21:21:30 +1000 (EST) Date: Thu, 14 Jun 2012 12:42:24 +0200 From: Jean Delvare To: Wolfram Sang Subject: Re: [PATCH] i2c: let the core register devices from devicetree Message-ID: <20120614124224.58a9e823@endymion.delvare> In-Reply-To: <1339622215-4733-1-git-send-email-w.sang@pengutronix.de> References: <1339622215-4733-1-git-send-email-w.sang@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Cc: Viresh Kumar , Mauro Carvalho Chehab , Tony Lindgren , Linus Walleij , Haojian Zhuang , Laxman Dewangan , linux-i2c@vger.kernel.org, Kukjin Kim , Stephen Warren , Barry Song <21cnbao@gmail.com>, Deepak Sikri , Haavard Skinnemoen , Pawel Moll , Wolfram Sang , Sascha Hauer , Rusty Russell , Tang Yuantian , Olof Johansson , Magnus Damm , Lars-Peter Clausen , "Ben Dooks \(embedded platforms\)" , linux-arm-kernel@lists.infradead.org, Jiri Kosina , Kyungmin Park , Karol Lewandowski , Dirk Brandewie , Shawn Guo , linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi Wolfram, On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang wrote: > Currently, every driver has to do it on its own, but it should be done > in the core, like we already do with board_info structs. > > Signed-off-by: Wolfram Sang > --- > > Based on v3.5-rc2. Only build tested, I don't have a OF based device > around at the moment. > (...) > diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c > index a6ad32b..4791833 100644 > --- a/drivers/i2c/i2c-core.c > +++ b/drivers/i2c/i2c-core.c > @@ -39,6 +39,7 @@ > #include > #include > #include > +#include > #include > > #include "i2c-core.h" > @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap) > #endif > > /* create pre-declared device nodes */ > + of_i2c_register_devices(adap); > + > if (adap->nr < __i2c_first_dynamic_bus_num) > i2c_scan_static_board_info(adap); > This was proposed in the past, and rejected because of dependency issues. I don't think the situation changed. of_i2c needs i2c-core for i2c_new_device(), and with the change above, i2c-core needs of_i2c for of_i2c_register_devices(). If either is built as a module, it will fail. This might be the reason why of_spi ended up being merged into drivers/spi according to Grant? I have no objection to the same being done for of_i2c if it makes everybody happy, as long as it does not create additional dependencies (i.e. I2C should not depend on OF.) -- Jean Delvare