Re: RFC: I2C bus fault recovery and I2C reset

2011-11-27 Thread David Jander

Hi Micheal,

On Fri, 25 Nov 2011 11:27:44 +0100
Michael Lawnick  wrote:
> Am 24.11.2011 12:02, schrieb David Jander:
> > I was debugging an I2C bus connected to a i2c-imx peripheral as master,
> > with several slaves connected to it, when I realized that this driver (and
> > many (all?) others) cannot recover from a bus fault in a graceful manner.
> > If, for instance, one slave device misses one (or more) clock pulses for
> > whatever reason during a slave->master transmission (read), during a
> > 0-data bit, this slave may eventually keep the SDA line active in
> > low-state. Most I2C master peripherals, and particularly i2c-imx will not
> > be able to continue operating. Any operation will just timeout with a
> > "busy bus" error. The simplest and most often used way of recovering from
> > such a situation is "resetting" the I2C bus, by toggling SCL a few times
> > (maximum 9) until SDA is released again. After that a START sequence can
> > successfully reset the state of any slave device.
> > 
> > One can argue whether it may or may not be accepted that this happens under
> > normal circumstances, but it definitely can happen at any moment (heavy EMC
> > interference, bad bus design, long bus, misbehaving slave... you name it),
> > and IMHO a linux-driver should always have the ability to try to recover
> > gracefully from such an event. Whether the system this bus takes part of
> > can tolerate such a situation or not is not up to the driver to decide
> > either... it should just try to recover.
> > 
> > This issue seems to have been discussed before in this thread:
> > 
> > http://article.gmane.org/gmane.linux.drivers.i2c/3010
> > 
> > The proposed solution back then was to issue a reset sequence "by hand"
> > via a sysfs interface. This may be useful for debugging, but IMHO an I2C
> > driver needs to do this automatically.
> 
> ACK
> 
> > For many peripherals in order to support this, a special function would be
> > needed, that reconfigures the SDA/SCL pins as GPIO and manually toggles
> > SCL a few times. This would probably need to be implemented in
> > board-support-/platform code...?
> 
> Needs to be part of recover function which in turn is part of driver code.

In the case of the i.MX I2C peripheral, and probably in the case of a few
others, there is no way of doing this, except for switching I2C i/o pins to
GPIO via the iomux and toggling the GPIO pin that corresponds to SCL "by
hand", while watching the GPIO pin that corresponds to SDA.

I know of no standard kind of IOMUX framework in the kernel that could help
doing this in a generic way Grant?

Due to this, it can become fairly complicated if one wants to do this entirely
in the driver. IMHO, probably the easiest way of implementing this would be
via platform/board specific functions that are called via optional
function-pointers in the platform-data. I don't really like that solution, so
I hope someone can come up with a better one

> > In my specific situation, there was no way of recovering other than
> > power-cycling the device, which is completely unacceptable, specially for
> > an industrial control system. A temporary bus-lockup with automatic
> > recovery via a proper I2C bus reset OTOH, wouldn't have any significant
> > impact even if occurring sporadically.
> > Individually resetting I2C slaves is also not a real solution because it
> > may not be possible to determine which is the I2C slave that misbehaved.
> 
> Most I2C slaves haven't got any reset line.

Even worse that means the bus will never come back, even if you reset the
machine!!! Only a power-cycle would save you.

> > Any idea on how to solve this problem?
> > Should each driver implement support for it and implement optional callback
> > functions in platform-data?
> 
> IMHO this typically is adapter driver's job. It strongly depends on
> particular H/W whether controller can return information on busy/blocked
> bus and whether it is able to manually toggle the clock line. On single
> master systems, the driver code should automatically try to recover when
> not being able to send start flag. On multi master systems the situation
> is more complex.

I agree. There might be a few platforms where there is no solution to this,
other than hardwiring a separate GPIO line to SCL...

Best regards,

-- 
David Jander
Protonic Holland.
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Guan Xuetao
On Mon, 2011-11-28 at 08:13 +0800, Axel Lin wrote:
> This patch converts the drivers in drivers/i2c/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
> 
> Cc: Jean Delvare 
> Cc: Ben Dooks 
> Cc: Jochen Friedrich 
> Cc: Peter Korsgaard 
> Cc: Wolfram Sang 
> Cc: Guan Xuetao 
> Cc: Manuel Lauss 
> Cc: Barry Song <21cn...@gmail.com>
> Cc: Linus Walleij 
> Cc: Yong Zhang 
> Cc: Lucas De Marchi 
> Cc: Grant Likely 
> Cc: Samuel Ortiz 
> Acked-by: Peter Korsgaard 
> Acked-by: Wolfram Sang 
> Acked-by: Jochen Friedrich
> Signed-off-by: Axel Lin 
> ---
For i2c-puv3.c,
Acked-by: Guan Xuetao 

Thanks Axel,
Guan Xuetao

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Guan Xuetao
On Sun, 2011-11-27 at 14:12 +0800, Axel Lin wrote:
> This patch converts the drivers in drivers/i2c/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
> 
> Cc: Jean Delvare 
> Cc: Ben Dooks 
> Cc: Jochen Friedrich 
> Cc: Peter Korsgaard 
> Cc: Wolfram Sang 
> Cc: Guan Xuetao 
> Cc: Manuel Lauss 
> Cc: Barry Song <21cn...@gmail.com>
> Cc: Linus Walleij 
> Cc: Yong Zhang 
> Cc: Lucas De Marchi 
> Cc: Grant Likely 
> Cc: Samuel Ortiz 
> Signed-off-by: Axel Lin 
> ---

For i2c-puv3.c,
Acked-by: Guan Xuetao 

Thanks,

Guan Xuetao

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Axel Lin
This patch converts the drivers in drivers/i2c/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Cc: Jean Delvare 
Cc: Ben Dooks 
Cc: Jochen Friedrich 
Cc: Peter Korsgaard 
Cc: Wolfram Sang 
Cc: Guan Xuetao 
Cc: Manuel Lauss 
Cc: Barry Song <21cn...@gmail.com>
Cc: Linus Walleij 
Cc: Yong Zhang 
Cc: Lucas De Marchi 
Cc: Grant Likely 
Cc: Samuel Ortiz 
Acked-by: Peter Korsgaard 
Acked-by: Wolfram Sang 
Acked-by: Jochen Friedrich
Signed-off-by: Axel Lin 
---
 drivers/i2c/busses/i2c-at91.c |   17 ++---
 drivers/i2c/busses/i2c-au1550.c   |   13 +
 drivers/i2c/busses/i2c-cpm.c  |   13 +
 drivers/i2c/busses/i2c-highlander.c   |   13 +
 drivers/i2c/busses/i2c-ibm_iic.c  |   13 +
 drivers/i2c/busses/i2c-iop3xx.c   |   16 +---
 drivers/i2c/busses/i2c-isch.c |   13 +
 drivers/i2c/busses/i2c-ixp2000.c  |   13 +
 drivers/i2c/busses/i2c-mpc.c  |   13 +
 drivers/i2c/busses/i2c-mv64xxx.c  |   15 +--
 drivers/i2c/busses/i2c-ocores.c   |   17 ++---
 drivers/i2c/busses/i2c-octeon.c   |   16 +---
 drivers/i2c/busses/i2c-pca-platform.c |   14 +-
 drivers/i2c/busses/i2c-pmcmsp.c   |   17 ++---
 drivers/i2c/busses/i2c-powermac.c |   19 ++-
 drivers/i2c/busses/i2c-puv3.c |   16 ++--
 drivers/i2c/busses/i2c-sh7760.c   |   13 +
 drivers/i2c/busses/i2c-simtec.c   |   18 ++
 drivers/i2c/busses/i2c-xiic.c |   18 ++
 19 files changed, 26 insertions(+), 261 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 305c075..1679dee 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -295,9 +295,6 @@ static int at91_i2c_resume(struct platform_device *pdev)
 #define at91_i2c_resumeNULL
 #endif
 
-/* work with "modprobe at91_i2c" from hotplugging or coldplugging */
-MODULE_ALIAS("platform:at91_i2c");
-
 static struct platform_driver at91_i2c_driver = {
.probe  = at91_i2c_probe,
.remove = __devexit_p(at91_i2c_remove),
@@ -309,19 +306,9 @@ static struct platform_driver at91_i2c_driver = {
},
 };
 
-static int __init at91_i2c_init(void)
-{
-   return platform_driver_register(&at91_i2c_driver);
-}
-
-static void __exit at91_i2c_exit(void)
-{
-   platform_driver_unregister(&at91_i2c_driver);
-}
-
-module_init(at91_i2c_init);
-module_exit(at91_i2c_exit);
+module_platform_driver(at91_i2c_driver);
 
 MODULE_AUTHOR("Rick Bronson");
 MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:at91_i2c");
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index f314d7f..582d616 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -426,20 +426,9 @@ static struct platform_driver au1xpsc_smbus_driver = {
.remove = __devexit_p(i2c_au1550_remove),
 };
 
-static int __init i2c_au1550_init(void)
-{
-   return platform_driver_register(&au1xpsc_smbus_driver);
-}
-
-static void __exit i2c_au1550_exit(void)
-{
-   platform_driver_unregister(&au1xpsc_smbus_driver);
-}
+module_platform_driver(au1xpsc_smbus_driver);
 
 MODULE_AUTHOR("Dan Malek, Embedded Edge, LLC.");
 MODULE_DESCRIPTION("SMBus adapter Alchemy pb1550");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:au1xpsc_smbus");
-
-module_init (i2c_au1550_init);
-module_exit (i2c_au1550_exit);
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index b1d9cd2..c1e1096 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -724,18 +724,7 @@ static struct platform_driver cpm_i2c_driver = {
},
 };
 
-static int __init cpm_i2c_init(void)
-{
-   return platform_driver_register(&cpm_i2c_driver);
-}
-
-static void __exit cpm_i2c_exit(void)
-{
-   platform_driver_unregister(&cpm_i2c_driver);
-}
-
-module_init(cpm_i2c_init);
-module_exit(cpm_i2c_exit);
+module_platform_driver(cpm_i2c_driver);
 
 MODULE_AUTHOR("Jochen Friedrich ");
 MODULE_DESCRIPTION("I2C-Bus adapter routines for CPM boards");
diff --git a/drivers/i2c/busses/i2c-highlander.c 
b/drivers/i2c/busses/i2c-highlander.c
index 63bb1cc..2294dea 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -468,18 +468,7 @@ static struct platform_driver highlander_i2c_driver = {
.remove = __devexit_p(highlander_i2c_remove),
 };
 
-static int __init highlander_i2c_init(void)
-{
-   return platform_driver_register(&highlander_i2c_driver);
-}
-
-static void __exit highlander_i2c_exit(void)
-{
-   platform_driver_unregister(&highlander_i2c_driver);
-}
-
-module_init(highlander_i2c_init);
-module_exit(highlander_i2c_exit);
+module_

Re: [PATCH] i2c multiplexer driver for Proliant microserver N36L

2011-11-27 Thread Ben Dooks

On Fri, Nov 25, 2011 at 11:07:21PM +0100, Eddi De Pieri wrote:
> This patch add support to multiplexed smbus for proliant microserver
> N36L and may be applicable to other configuration based on sb8xx
> southbus.
> 
> root@proliant:/usr/src/lm-sensors/eddi# i2cdetect -l
> i2c-0   smbus   SMBus piix4 adapter (SDA0)  SMBus adapter
> i2c-1   smbus   SMBus piix4 adapter (SDA2)  SMBus adapter
> i2c-2   smbus   SMBus piix4 adapter (SDA3)  SMBus adapter
> i2c-3   smbus   SMBus piix4 adapter (SDA4)  SMBus adapter
> root@proliant:/usr/src/lm-sensors/eddi#

patch should go inline so it can be reviewed, thanks.

-- 
Ben Dooks, b...@fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: reorganize muxes to a standard pattern

2011-11-27 Thread Guenter Roeck
On Sun, Nov 27, 2011 at 03:48:47PM -0500, Jean Delvare wrote:
> Hi Wolfram,
> 
> Sorry for the late reply.
> 
> On Sun, 13 Nov 2011 22:41:14 +0100, Wolfram Sang wrote:
> > Analog to ca632f5 (spi: reorganize drivers), introduce a standard pattern
> > for naming the muxes. This is done for the rest of the I2C subsystem 
> > already, so
> > we stay in sync with that.
> > 
> > Signed-off-by: Wolfram Sang 
> > ---
> > 
> > Only build tested.
> > 
> >  drivers/i2c/muxes/Kconfig  |9 -
> >  drivers/i2c/muxes/Makefile |6 +++---
> >  .../i2c/muxes/{gpio-i2cmux.c => i2c-mux-gpio.c}|0
> >  drivers/i2c/muxes/{pca9541.c => i2c-mux-pca9541.c} |0
> >  drivers/i2c/muxes/{pca954x.c => i2c-mux-pca954x.c} |0
> >  5 files changed, 3 insertions(+), 12 deletions(-)
> >  rename drivers/i2c/muxes/{gpio-i2cmux.c => i2c-mux-gpio.c} (100%)
> >  rename drivers/i2c/muxes/{pca9541.c => i2c-mux-pca9541.c} (100%)
> >  rename drivers/i2c/muxes/{pca954x.c => i2c-mux-pca954x.c} (100%)
> 
> You forgot to rename Documentation/i2c/muxes/gpio-i2cmux.
> 
> I thought the naming had been discussed before, but I can't find the
> references, and to be honest the new names please me, so I have no
> reason to decline your proposal. I would have appreciated an ack from
> the driver authors (Cc'd) though. I'll apply your patch as soon as I
> receive an updated version, unless I get an objection before then.
> 

For pca9541.c:

Acked-by: Guenter Roeck 

> > 
> > diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig
> > index 90b7a01..a112d9d 100644
> > --- a/drivers/i2c/muxes/Kconfig
> > +++ b/drivers/i2c/muxes/Kconfig
> > @@ -14,9 +14,6 @@ config I2C_MUX_GPIO
> >   I2C busses connected through a MUX, which is controlled
> >   through GPIO pins.
> >  
> > - This driver can also be built as a module.  If so, the module
> > - will be called gpio-i2cmux.
> > -
> >  config I2C_MUX_PCA9541
> > tristate "NXP PCA9541 I2C Master Selector"
> > depends on EXPERIMENTAL
> > @@ -24,9 +21,6 @@ config I2C_MUX_PCA9541
> >   If you say yes here you get support for the NXP PCA9541
> >   I2C Master Selector.
> >  
> > - This driver can also be built as a module.  If so, the module
> > - will be called pca9541.
> > -
> >  config I2C_MUX_PCA954x
> > tristate "Philips PCA954x I2C Mux/switches"
> > depends on EXPERIMENTAL
> > @@ -34,7 +28,4 @@ config I2C_MUX_PCA954x
> >   If you say yes here you get support for the Philips PCA954x
> >   I2C mux/switch devices.
> >  
> > - This driver can also be built as a module.  If so, the module
> > - will be called pca954x.
> > -
> >  endmenu
> > diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile
> > index 4640436..5826249 100644
> > --- a/drivers/i2c/muxes/Makefile
> > +++ b/drivers/i2c/muxes/Makefile
> > @@ -1,8 +1,8 @@
> >  #
> >  # Makefile for multiplexer I2C chip drivers.
> >  
> > -obj-$(CONFIG_I2C_MUX_GPIO) += gpio-i2cmux.o
> > -obj-$(CONFIG_I2C_MUX_PCA9541)  += pca9541.o
> > -obj-$(CONFIG_I2C_MUX_PCA954x)  += pca954x.o
> > +obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o
> > +obj-$(CONFIG_I2C_MUX_PCA9541)  += i2c-mux-pca9541.o
> > +obj-$(CONFIG_I2C_MUX_PCA954x)  += i2c-mux-pca954x.o
> >  
> >  ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
> > diff --git a/drivers/i2c/muxes/gpio-i2cmux.c 
> > b/drivers/i2c/muxes/i2c-mux-gpio.c
> > similarity index 100%
> > rename from drivers/i2c/muxes/gpio-i2cmux.c
> > rename to drivers/i2c/muxes/i2c-mux-gpio.c
> > diff --git a/drivers/i2c/muxes/pca9541.c 
> > b/drivers/i2c/muxes/i2c-mux-pca9541.c
> > similarity index 100%
> > rename from drivers/i2c/muxes/pca9541.c
> > rename to drivers/i2c/muxes/i2c-mux-pca9541.c
> > diff --git a/drivers/i2c/muxes/pca954x.c 
> > b/drivers/i2c/muxes/i2c-mux-pca954x.c
> > similarity index 100%
> > rename from drivers/i2c/muxes/pca954x.c
> > rename to drivers/i2c/muxes/i2c-mux-pca954x.c
> 
> 
> -- 
> Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: reorganize muxes to a standard pattern

2011-11-27 Thread Peter Korsgaard
> "Jean" == Jean Delvare  writes:

Hi,

 >> rename drivers/i2c/muxes/{gpio-i2cmux.c => i2c-mux-gpio.c} (100%)
 >> rename drivers/i2c/muxes/{pca9541.c => i2c-mux-pca9541.c} (100%)
 >> rename drivers/i2c/muxes/{pca954x.c => i2c-mux-pca954x.c} (100%)

 Jean> You forgot to rename Documentation/i2c/muxes/gpio-i2cmux.

 Jean> I thought the naming had been discussed before, but I can't find the
 Jean> references, and to be honest the new names please me, so I have no
 Jean> reason to decline your proposal. I would have appreciated an ack from
 Jean> the driver authors (Cc'd) though. I'll apply your patch as soon as I
 Jean> receive an updated version, unless I get an objection before then.

Are you referring to this?

http://thread.gmane.org/gmane.linux.drivers.i2c/7171/focus=7244

I originally called it i2c-gpiomux.c, and renamed it to gpio-i2cmux.c on
request of you.

I don't mind the new name though, so:

Acked-by: Peter Korsgaard 

-- 
Bye, Peter Korsgaard
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: reorganize muxes to a standard pattern

2011-11-27 Thread Jean Delvare
Hi Wolfram,

Sorry for the late reply.

On Sun, 13 Nov 2011 22:41:14 +0100, Wolfram Sang wrote:
> Analog to ca632f5 (spi: reorganize drivers), introduce a standard pattern
> for naming the muxes. This is done for the rest of the I2C subsystem already, 
> so
> we stay in sync with that.
> 
> Signed-off-by: Wolfram Sang 
> ---
> 
> Only build tested.
> 
>  drivers/i2c/muxes/Kconfig  |9 -
>  drivers/i2c/muxes/Makefile |6 +++---
>  .../i2c/muxes/{gpio-i2cmux.c => i2c-mux-gpio.c}|0
>  drivers/i2c/muxes/{pca9541.c => i2c-mux-pca9541.c} |0
>  drivers/i2c/muxes/{pca954x.c => i2c-mux-pca954x.c} |0
>  5 files changed, 3 insertions(+), 12 deletions(-)
>  rename drivers/i2c/muxes/{gpio-i2cmux.c => i2c-mux-gpio.c} (100%)
>  rename drivers/i2c/muxes/{pca9541.c => i2c-mux-pca9541.c} (100%)
>  rename drivers/i2c/muxes/{pca954x.c => i2c-mux-pca954x.c} (100%)

You forgot to rename Documentation/i2c/muxes/gpio-i2cmux.

I thought the naming had been discussed before, but I can't find the
references, and to be honest the new names please me, so I have no
reason to decline your proposal. I would have appreciated an ack from
the driver authors (Cc'd) though. I'll apply your patch as soon as I
receive an updated version, unless I get an objection before then.

> 
> diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig
> index 90b7a01..a112d9d 100644
> --- a/drivers/i2c/muxes/Kconfig
> +++ b/drivers/i2c/muxes/Kconfig
> @@ -14,9 +14,6 @@ config I2C_MUX_GPIO
> I2C busses connected through a MUX, which is controlled
> through GPIO pins.
>  
> -   This driver can also be built as a module.  If so, the module
> -   will be called gpio-i2cmux.
> -
>  config I2C_MUX_PCA9541
>   tristate "NXP PCA9541 I2C Master Selector"
>   depends on EXPERIMENTAL
> @@ -24,9 +21,6 @@ config I2C_MUX_PCA9541
> If you say yes here you get support for the NXP PCA9541
> I2C Master Selector.
>  
> -   This driver can also be built as a module.  If so, the module
> -   will be called pca9541.
> -
>  config I2C_MUX_PCA954x
>   tristate "Philips PCA954x I2C Mux/switches"
>   depends on EXPERIMENTAL
> @@ -34,7 +28,4 @@ config I2C_MUX_PCA954x
> If you say yes here you get support for the Philips PCA954x
> I2C mux/switch devices.
>  
> -   This driver can also be built as a module.  If so, the module
> -   will be called pca954x.
> -
>  endmenu
> diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile
> index 4640436..5826249 100644
> --- a/drivers/i2c/muxes/Makefile
> +++ b/drivers/i2c/muxes/Makefile
> @@ -1,8 +1,8 @@
>  #
>  # Makefile for multiplexer I2C chip drivers.
>  
> -obj-$(CONFIG_I2C_MUX_GPIO)   += gpio-i2cmux.o
> -obj-$(CONFIG_I2C_MUX_PCA9541)+= pca9541.o
> -obj-$(CONFIG_I2C_MUX_PCA954x)+= pca954x.o
> +obj-$(CONFIG_I2C_MUX_GPIO)   += i2c-mux-gpio.o
> +obj-$(CONFIG_I2C_MUX_PCA9541)+= i2c-mux-pca9541.o
> +obj-$(CONFIG_I2C_MUX_PCA954x)+= i2c-mux-pca954x.o
>  
>  ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
> diff --git a/drivers/i2c/muxes/gpio-i2cmux.c 
> b/drivers/i2c/muxes/i2c-mux-gpio.c
> similarity index 100%
> rename from drivers/i2c/muxes/gpio-i2cmux.c
> rename to drivers/i2c/muxes/i2c-mux-gpio.c
> diff --git a/drivers/i2c/muxes/pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
> similarity index 100%
> rename from drivers/i2c/muxes/pca9541.c
> rename to drivers/i2c/muxes/i2c-mux-pca9541.c
> diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> similarity index 100%
> rename from drivers/i2c/muxes/pca954x.c
> rename to drivers/i2c/muxes/i2c-mux-pca954x.c


-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Jean Delvare
On Sun, 27 Nov 2011 20:46:48 +0100, Wolfram Sang wrote:
> 
> > > -module_init(gpiomux_init);
> > > -module_exit(gpiomux_exit);
> > > +module_platform_driver(gpiomux_driver);
> > 
> > This one would be better as a separate patch, as it touches a different
> > subdirectory, which I am responsible for.
> 
> ... which has a patch pending[1], hint ;)
> 
> [1] http://comments.gmane.org/gmane.linux.drivers.i2c/9432

Yes, that's one of the reasons why I think a separate patch would be
more appropriate. It might be difficult to avoid patch collisions
otherwise.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Wolfram Sang

> > -module_init(gpiomux_init);
> > -module_exit(gpiomux_exit);
> > +module_platform_driver(gpiomux_driver);
> 
> This one would be better as a separate patch, as it touches a different
> subdirectory, which I am responsible for.

... which has a patch pending[1], hint ;)

[1] http://comments.gmane.org/gmane.linux.drivers.i2c/9432

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Jean Delvare
Hi Axel,

On Sun, 27 Nov 2011 14:12:12 +0800, Axel Lin wrote:
> This patch converts the drivers in drivers/i2c/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
> 
> Cc: Jean Delvare 
> Cc: Ben Dooks 
> Cc: Jochen Friedrich 
> Cc: Peter Korsgaard 
> Cc: Wolfram Sang 
> Cc: Guan Xuetao 
> Cc: Manuel Lauss 
> Cc: Barry Song <21cn...@gmail.com>
> Cc: Linus Walleij 
> Cc: Yong Zhang 
> Cc: Lucas De Marchi 
> Cc: Grant Likely 
> Cc: Samuel Ortiz 
> Signed-off-by: Axel Lin 
> ---
>  drivers/i2c/busses/i2c-at91.c |   17 ++---
>  drivers/i2c/busses/i2c-au1550.c   |   13 +
>  drivers/i2c/busses/i2c-cpm.c  |   13 +
>  drivers/i2c/busses/i2c-highlander.c   |   13 +
>  drivers/i2c/busses/i2c-ibm_iic.c  |   13 +
>  drivers/i2c/busses/i2c-iop3xx.c   |   16 +---
>  drivers/i2c/busses/i2c-isch.c |   13 +
>  drivers/i2c/busses/i2c-ixp2000.c  |   13 +
>  drivers/i2c/busses/i2c-mpc.c  |   13 +
>  drivers/i2c/busses/i2c-mv64xxx.c  |   15 +--
>  drivers/i2c/busses/i2c-ocores.c   |   17 ++---
>  drivers/i2c/busses/i2c-octeon.c   |   16 +---
>  drivers/i2c/busses/i2c-pca-platform.c |   14 +-
>  drivers/i2c/busses/i2c-pmcmsp.c   |   17 ++---
>  drivers/i2c/busses/i2c-powermac.c |   19 ++-
>  drivers/i2c/busses/i2c-puv3.c |   16 ++--
>  drivers/i2c/busses/i2c-sh7760.c   |   13 +
>  drivers/i2c/busses/i2c-simtec.c   |   20 ++--
>  drivers/i2c/busses/i2c-xiic.c |   18 ++
>  drivers/i2c/muxes/gpio-i2cmux.c   |   13 +
>  20 files changed, 27 insertions(+), 275 deletions(-)

Looks overall good. I'd rather let Ben apply it as most affected
drivers are for embedded platforms.

Just two minor comments:

> --- a/drivers/i2c/busses/i2c-simtec.c
> +++ b/drivers/i2c/busses/i2c-simtec.c
> @@ -156,12 +156,6 @@ static int simtec_i2c_remove(struct platform_device *dev)
>   return 0;
>  }
>  
> -
> -/* device driver */

I see no good reason for removing that comment.

> -
> -/* work with hotplug and coldplug */
> -MODULE_ALIAS("platform:simtec-i2c");
> -
>  static struct platform_driver simtec_i2c_driver = {
>   .driver = {
>   .name   = "simtec-i2c",
> @@ -171,19 +165,9 @@ static struct platform_driver simtec_i2c_driver = {
>   .remove = simtec_i2c_remove,
>  };
>  
> -static int __init i2c_adap_simtec_init(void)
> -{
> - return platform_driver_register(&simtec_i2c_driver);
> -}
> -
> -static void __exit i2c_adap_simtec_exit(void)
> -{
> - platform_driver_unregister(&simtec_i2c_driver);
> -}
> -
> -module_init(i2c_adap_simtec_init);
> -module_exit(i2c_adap_simtec_exit);
> +module_platform_driver(simtec_i2c_driver);
>  
>  MODULE_DESCRIPTION("Simtec Generic I2C Bus driver");
>  MODULE_AUTHOR("Ben Dooks ");
>  MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:simtec-i2c");

> (...)
> diff --git a/drivers/i2c/muxes/gpio-i2cmux.c b/drivers/i2c/muxes/gpio-i2cmux.c
> index 7b6ce62..e5fa695 100644
> --- a/drivers/i2c/muxes/gpio-i2cmux.c
> +++ b/drivers/i2c/muxes/gpio-i2cmux.c
> @@ -165,18 +165,7 @@ static struct platform_driver gpiomux_driver = {
>   },
>  };
>  
> -static int __init gpiomux_init(void)
> -{
> - return platform_driver_register(&gpiomux_driver);
> -}
> -
> -static void __exit gpiomux_exit(void)
> -{
> - platform_driver_unregister(&gpiomux_driver);
> -}
> -
> -module_init(gpiomux_init);
> -module_exit(gpiomux_exit);
> +module_platform_driver(gpiomux_driver);

This one would be better as a separate patch, as it touches a different
subdirectory, which I am responsible for.

-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Jochen Friedrich

Am 27.11.2011 07:12, schrieb Axel Lin:


This patch converts the drivers in drivers/i2c/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.


Acked-by: Jochen Friedrich
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Wolfram Sang
On Sun, Nov 27, 2011 at 02:12:12PM +0800, Axel Lin wrote:
> This patch converts the drivers in drivers/i2c/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.

Acked-by: Wolfram Sang 

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature


Re: [PATCH] i2c: convert drivers/i2c/* to use module_platform_driver()

2011-11-27 Thread Peter Korsgaard
> "Axel" == Axel Lin  writes:

 Axel> This patch converts the drivers in drivers/i2c/* to use the
 Axel> module_platform_driver() macro which makes the code smaller and a bit
 Axel> simpler.

 Axel> Cc: Jean Delvare 
 Axel> Cc: Ben Dooks 
 Axel> Cc: Jochen Friedrich 
 Axel> Cc: Peter Korsgaard 
 Axel> Cc: Wolfram Sang 
 Axel> Cc: Guan Xuetao 
 Axel> Cc: Manuel Lauss 
 Axel> Cc: Barry Song <21cn...@gmail.com>
 Axel> Cc: Linus Walleij 
 Axel> Cc: Yong Zhang 
 Axel> Cc: Lucas De Marchi 
 Axel> Cc: Grant Likely 
 Axel> Cc: Samuel Ortiz 
 Axel> Signed-off-by: Axel Lin 

Looks good for i2c-ocores / gpio-i2cmux:

Acked-by: Peter Korsgaard 

-- 
Bye, Peter Korsgaard
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html