public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Ryan Mallon <ryan@bluewatersys.com>
Cc: David Brownell <david-b@pacbell.net>,
	Uli Luckas <u.luckas@road.de>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	i2c@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH, RFC] Earlier I2C initialization
Date: Wed, 11 Jun 2008 09:40:39 +0200	[thread overview]
Message-ID: <20080611094039.287ac136@hyperion.delvare> (raw)
In-Reply-To: <484F42AC.9030709@bluewatersys.com>

Hi Ryan,

On Wed, 11 Jun 2008 15:12:44 +1200, Ryan Mallon wrote:
> Jean Delvare wrote:
> > Why don't you simply initialize the drivers in question with
> > subsys_initcall()? That's what i2c-pnx, i2c-omap, i2c-davinci and
> > tps65010 are doing at the moment.
>
> I still think its a bit nasty marking a driver as subsys_initcall 
> just because one particular setup needs it to be that way. We will
> eventually end up with half of the busses/drivers in i2c marked
> as subsys_initcall for random boards :-).
> 
> How about this patch instead, which replaces module_init and 
> subsys_initcalls in drivers/i2c with a new macro called
> i2c_module_init. If CONFIG_I2C_EARLY is set then it will #define
> to subsys_initcall, otherwise it becomes module_init. This way
> boards that need i2c early can just select CONFIG_I2C_EARLY and
> get all of i2c at subsys_initcall time. The link order should
> guarantee that everything still comes up in the correct order in
> the i2c driver subsystem.
> 
> I have tested this on an ARM ep93xx board with a bit-bashed
> i2c bus, a ds1339 rtc, and two max7311 IO expanders (using 
> the pca953x) both with and without CONFIG_I2C_EARLY_INIT selected.
> Of course it would need much more testing to verify it :-)

Making this a compile time option means that you need different kernels
for different machines, that's highly inconvenient. Or you end up using
the I2C_EARLY_INIT one for all systems, but then why have a
configuration option for it in the first place?

Which problem are you trying to solve? Is there any actual drawback to
abusing subsys_initcall() for the handful of i2c bus drivers which may
need to come up early?

>  drivers/i2c/Kconfig                    |    3 +++
>  drivers/i2c/busses/i2c-acorn.c         |    2 +-
>  drivers/i2c/busses/i2c-ali1535.c       |    2 +-
>  drivers/i2c/busses/i2c-ali1563.c       |    2 +-
>  drivers/i2c/busses/i2c-ali15x3.c       |    2 +-
>  drivers/i2c/busses/i2c-amd756-s4882.c  |    2 +-
>  drivers/i2c/busses/i2c-amd756.c        |    2 +-
>  drivers/i2c/busses/i2c-amd8111.c       |    2 +-
>  drivers/i2c/busses/i2c-at91.c          |    2 +-
>  drivers/i2c/busses/i2c-au1550.c        |    2 +-
>  drivers/i2c/busses/i2c-bfin-twi.c      |    2 +-
>  drivers/i2c/busses/i2c-davinci.c       |    2 +-
>  drivers/i2c/busses/i2c-elektor.c       |    2 +-
>  drivers/i2c/busses/i2c-gpio.c          |    2 +-
>  drivers/i2c/busses/i2c-hydra.c         |    2 +-
>  drivers/i2c/busses/i2c-i801.c          |    2 +-
>  drivers/i2c/busses/i2c-i810.c          |    2 +-
>  drivers/i2c/busses/i2c-ibm_iic.c       |    2 +-
>  drivers/i2c/busses/i2c-iop3xx.c        |    2 +-
>  drivers/i2c/busses/i2c-ixp2000.c       |    2 +-
>  drivers/i2c/busses/i2c-mpc.c           |    2 +-
>  drivers/i2c/busses/i2c-mv64xxx.c       |    2 +-
>  drivers/i2c/busses/i2c-nforce2.c       |    2 +-
>  drivers/i2c/busses/i2c-ocores.c        |    2 +-
>  drivers/i2c/busses/i2c-omap.c          |    2 +-
>  drivers/i2c/busses/i2c-parport-light.c |    2 +-
>  drivers/i2c/busses/i2c-parport.c       |    2 +-
>  drivers/i2c/busses/i2c-pasemi.c        |    2 +-
>  drivers/i2c/busses/i2c-pca-isa.c       |    2 +-
>  drivers/i2c/busses/i2c-pca-platform.c  |    2 +-
>  drivers/i2c/busses/i2c-piix4.c         |    2 +-
>  drivers/i2c/busses/i2c-pmcmsp.c        |    2 +-
>  drivers/i2c/busses/i2c-pnx.c           |    2 +-
>  drivers/i2c/busses/i2c-powermac.c      |    2 +-
>  drivers/i2c/busses/i2c-prosavage.c     |    2 +-
>  drivers/i2c/busses/i2c-pxa.c           |    2 +-
>  drivers/i2c/busses/i2c-s3c2410.c       |    2 +-
>  drivers/i2c/busses/i2c-savage4.c       |    2 +-
>  drivers/i2c/busses/i2c-sh7760.c        |    2 +-
>  drivers/i2c/busses/i2c-sh_mobile.c     |    2 +-
>  drivers/i2c/busses/i2c-sibyte.c        |    2 +-
>  drivers/i2c/busses/i2c-simtec.c        |    2 +-
>  drivers/i2c/busses/i2c-sis5595.c       |    2 +-
>  drivers/i2c/busses/i2c-sis630.c        |    2 +-
>  drivers/i2c/busses/i2c-sis96x.c        |    2 +-
>  drivers/i2c/busses/i2c-stub.c          |    2 +-
>  drivers/i2c/busses/i2c-taos-evm.c      |    2 +-
>  drivers/i2c/busses/i2c-tiny-usb.c      |    2 +-
>  drivers/i2c/busses/i2c-versatile.c     |    2 +-
>  drivers/i2c/busses/i2c-via.c           |    2 +-
>  drivers/i2c/busses/i2c-viapro.c        |    2 +-
>  drivers/i2c/busses/i2c-voodoo3.c       |    2 +-
>  drivers/i2c/busses/scx200_acb.c        |    2 +-
>  drivers/i2c/busses/scx200_i2c.c        |    2 +-

Bus drivers i2c-ali1535, i2c-ali1563, i2c-ali15x3, i2c-amd756-s4882,
i2c-amd756, i2c-amd8111, i2c-i801, i2c-nforce2, i2c-piix4, i2c-sis5595,
i2c-sis630, i2c-sis96x, i2c-via and i2c-viapro are for PC machines,
where I2C is never needed early.

Bus drivers i2c-i810, i2c-prosavage and i2c-savage4 are gone, no need
to touch them.

Bus drivers i2c-parport-light, i2c-parport, i2c-taos-evm and
i2c-tiny-usb are for external adapters, so initializing them early
isn't going to work... They depend on parport, serio and usb,
respectively.

i2c-stub is a software only driver for testing purposes, initializing
it early is pointless (it's really only useful as a module.)

>  drivers/i2c/chips/ds1682.c             |    2 +-
>  drivers/i2c/chips/eeprom.c             |    2 +-
>  drivers/i2c/chips/isp1301_omap.c       |    2 +-
>  drivers/i2c/chips/max6875.c            |    2 +-
>  drivers/i2c/chips/menelaus.c           |    2 +-
>  drivers/i2c/chips/pca9539.c            |    2 +-
>  drivers/i2c/chips/pcf8574.c            |    2 +-
>  drivers/i2c/chips/pcf8575.c            |    2 +-
>  drivers/i2c/chips/pcf8591.c            |    2 +-
>  drivers/i2c/chips/tps65010.c           |    2 +-
>  drivers/i2c/chips/tsl2550.c            |    2 +-

Most of these chip drivers only expose sysfs interfaces. Having them
initializing early is pointless. Only a few power management drivers
may be needed early: isp1301_omap, menelaus, tps65010.

>  drivers/i2c/i2c-dev.c                  |    2 +-

User-space interface, never needed early.

>  include/linux/i2c.h                    |    6 ++++++
>  67 files changed, 74 insertions(+), 65 deletions(-)

At the very least, you should only touch the drivers which you know
need to be touched, rather than all drivers "just in case". But I don't
think this is the way to go anyway, unless you can point out an actual
problem with using subsys_initcall() unconditionally.

-- 
Jean Delvare

  reply	other threads:[~2008-06-11  7:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200806091541.43899.u.luckas@road.de>
     [not found] ` <20080609135739.GE30971@flint.arm.linux.org.uk>
     [not found]   ` <484D947D.1090900@bluewatersys.com>
     [not found]     ` <484D947D.1090900-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
2008-06-09 20:59       ` Earlier I2C initialization David Brownell
     [not found]         ` <200806091359.12791.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-06-09 21:27           ` [PATCH, RFC] " Ryan Mallon
2008-06-10  6:57             ` Jean Delvare
2008-06-10 20:55               ` David Brownell
     [not found]                 ` <200806101355.07792.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-06-11  8:11                   ` Jean Delvare
2008-06-11  9:00                     ` Russell King - ARM Linux
     [not found]                       ` <20080611090016.GA5338-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2008-06-11  9:14                         ` Jean Delvare
     [not found]                     ` <48503432.6010105@bluewatersys.com>
     [not found]                       ` <48503432.6010105-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
2008-06-11 12:05                         ` Jean Delvare
2008-06-11 18:31                     ` David Brownell
2008-06-12 18:44                       ` Jean Delvare
2008-06-12 19:57                         ` David Brownell
2008-06-24 17:06                           ` Jean Delvare
     [not found]                     ` <20080611101130.1a667abe-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-11 20:23                       ` Ryan Mallon
2008-06-10 21:33               ` Ryan Mallon
2008-06-10  9:46                 ` Uli Luckas
2008-06-11  3:12               ` Ryan Mallon
2008-06-11  7:40                 ` Jean Delvare [this message]
     [not found]                   ` <485031D5.3020606@bluewatersys.com>
     [not found]                     ` <485031D5.3020606-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
2008-06-11 12:18                       ` Jean Delvare
2008-06-11 20:27                         ` David Brownell
2008-06-11 20:54                           ` Jean Delvare
2008-06-11 21:24                             ` Ryan Mallon
     [not found]                               ` <485042A6.3030705-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
2008-06-24 16:39                                 ` Jean Delvare
2008-06-26 21:12                                   ` Ryan Mallon
2008-06-27 10:41                                     ` Jean Delvare
2008-06-29 20:34                                       ` Ryan Mallon
2008-06-11 21:31                             ` Maciej W. Rozycki
2008-06-12 20:21                               ` David Brownell
     [not found]                   ` <20080611094039.287ac136-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-11 20:13                     ` Ryan Mallon

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=20080611094039.287ac136@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=david-b@pacbell.net \
    --cc=i2c@lm-sensors.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=ryan@bluewatersys.com \
    --cc=u.luckas@road.de \
    /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