Re: [PATCH] i2c driver fixes for 2.6.4

From: Greg KH
Date: Mon Mar 15 2004 - 19:56:10 EST


ChangeSet 1.1597.1.12, 2004/03/03 10:09:09-08:00, greg@xxxxxxxxx

[PATCH] I2C: show adapter name in i2c-dev class directory to make it easier for userspace tools.


drivers/i2c/i2c-dev.c | 8 ++++++++
1 files changed, 8 insertions(+)


diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c Mon Mar 15 14:35:31 2004
+++ b/drivers/i2c/i2c-dev.c Mon Mar 15 14:35:31 2004
@@ -124,6 +124,13 @@
}
static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);

+static ssize_t show_adapter_name(struct class_device *class_dev, char *buf)
+{
+ struct i2c_dev *i2c_dev = to_i2c_dev(class_dev);
+ return sprintf(buf, "%s\n", i2c_dev->adap->name);
+}
+static CLASS_DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL);
+
static ssize_t i2cdev_read (struct file *file, char __user *buf, size_t count,
loff_t *offset)
{
@@ -459,6 +466,7 @@
if (retval)
goto error;
class_device_create_file(&i2c_dev->class_dev, &class_device_attr_dev);
+ class_device_create_file(&i2c_dev->class_dev, &class_device_attr_name);
return 0;
error:
return_i2c_dev(i2c_dev);

-
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/