Re: [PATCH] I2C update for 2.6.9

From: Greg KH
Date: Tue Oct 19 2004 - 19:53:26 EST


ChangeSet 1.2078, 2004/10/19 16:19:10-07:00, kraxel@xxxxxxxxxxx

[PATCH] I2C: i2c bus power management support

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.

From: Gerd Knorr <kraxel@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>


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


diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c 2004-10-19 16:53:27 -07:00
+++ b/drivers/i2c/i2c-core.c 2004-10-19 16:53:27 -07:00
@@ -517,9 +517,29 @@
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)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/