From: Gerd Knorr <kraxel@bytesex.org>

The patch below adds power management support to the i2c bus.  It adds just
two small functions which call down to the devices power management
functions if they are present, so the i2c device drivers will receive the
suspend and resume events.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/i2c/i2c-core.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)

diff -puN drivers/i2c/i2c-core.c~i2c-bus-power-management-support drivers/i2c/i2c-core.c
--- 25/drivers/i2c/i2c-core.c~i2c-bus-power-management-support	Fri Oct  8 13:51:43 2004
+++ 25-akpm/drivers/i2c/i2c-core.c	Fri Oct  8 13:51:43 2004
@@ -517,9 +517,29 @@ static int i2c_device_match(struct devic
 	return 1;
 }
 
+static int i2c_bus_suspend(struct device * dev, u32 state)
+{
+	int rc = 0;
+
+	if (dev->driver && dev->driver->suspend)
+		rc = dev->driver->suspend(dev,state,0);
+	return rc;
+}
+
+static int i2c_bus_resume(struct device * dev)
+{
+	int rc = 0;
+	
+	if (dev->driver && dev->driver->resume)
+		rc = dev->driver->resume(dev,0);
+	return rc;
+}
+
 struct bus_type i2c_bus_type = {
 	.name =		"i2c",
 	.match =	i2c_device_match,
+	.suspend =      i2c_bus_suspend,
+	.resume =       i2c_bus_resume,
 };
 
 static int __init i2c_init(void)
_