[i2c] patch i2c-__must_check-fixes-i2c-dev.patch added to gregkh-2.6 tree

gregkh at suse.de gregkh at suse.de
Sat Aug 26 01:56:35 CEST 2006


This is a note to let you know that I've just added the patch titled

     Subject: i2c: __must_check fixes, i2c-dev

to my gregkh-2.6 tree.  Its filename is

     i2c-__must_check-fixes-i2c-dev.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From khali at linux-fr.org Tue Aug 15 09:30:32 2006
Date: Tue, 15 Aug 2006 18:30:24 +0200
From: Jean Delvare <khali at linux-fr.org>
To: Linux I2C <i2c at lm-sensors.org>
Cc: Greg KH <greg at kroah.com>
Subject: i2c: __must_check fixes, i2c-dev
Message-Id: <20060815183024.9b833de3.khali at linux-fr.org>

i2c: __must_check fixes (i2c-dev)

Check for error on sysfs file creation.
Check for error on device creation.
Delete sysfs file on device destruction.

I couldn't test this one beyond compilation, as it applies on top of
another patch in Greg's tree [1] which breaks all my systems when I
apply it (my udev isn't recent enough.) Anyone with bleeding edge udev
is welcome to test and report.

[1] http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/i2c/i2c-dev-device.patch

Signed-off-by: Jean Delvare <khali at linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

--- linux-2.6.18-rc4.orig/drivers/i2c/i2c-dev.c	2006-08-15 14:13:16.000000000 +0200
+++ linux-2.6.18-rc4/drivers/i2c/i2c-dev.c	2006-08-15 14:14:59.000000000 +0200
@@ -407,6 +407,7 @@
 static int i2cdev_attach_adapter(struct i2c_adapter *adap)
 {
 	struct i2c_dev *i2c_dev;
+	int res;
 
 	i2c_dev = get_free_i2c_dev(adap);
 	if (IS_ERR(i2c_dev))
@@ -419,14 +420,21 @@
 	i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
 				     MKDEV(I2C_MAJOR, adap->nr),
 				     "i2c-%d", adap->nr);
-	if (!i2c_dev->dev)
+	if (!i2c_dev->dev) {
+		res = -ENODEV;
 		goto error;
-	device_create_file(i2c_dev->dev, &dev_attr_name);
+	}
+	res = device_create_file(i2c_dev->dev, &dev_attr_name);
+	if (res)
+		goto error_destroy;
 	return 0;
+
+error_destroy:
+	device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
 error:
 	return_i2c_dev(i2c_dev);
 	kfree(i2c_dev);
-	return -ENODEV;
+	return res;
 }
 
 static int i2cdev_detach_adapter(struct i2c_adapter *adap)
@@ -437,6 +445,7 @@
 	if (!i2c_dev)
 		return -ENODEV;
 
+	device_remove_file(i2c_dev->dev, &dev_attr_name);
 	return_i2c_dev(i2c_dev);
 	device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
 	kfree(i2c_dev);


-- 
Jean Delvare



Patches currently in gregkh-2.6 which might be from khali at linux-fr.org are

i2c/hwmon-w83627ehf-add-pwm-support.patch
i2c/hwmon-w83627ehf-documentation.patch
i2c/i2c-tps65010-build-fixes.patch
i2c/hwmon-abituguru-timeout-fixes.patch
i2c/i2c-__must_check-fixes-i2c-dev.patch
i2c/i2c-__must_check-fixes.patch
i2c/i2c-algo-bit-kill-mdelay.patch
i2c/i2c-algo-sibyte-cleanups.patch
i2c/i2c-algo-sibyte-merge-in-i2c-sibyte.patch
i2c/i2c-au1550-add-au1200-support.patch
i2c/i2c-au1550-add-smbus-functionality-flag.patch
i2c/i2c-au1550-fix-timeout-problem.patch
i2c/i2c-bus-driver-for-TI-OMAP-boards.patch
i2c/i2c-isa-plan-for-removal.patch
i2c/i2c-dev-cleanups.patch
i2c/i2c-dev-convert-array-to-list.patch
i2c/i2c-dev-drop-template-client.patch
i2c/i2c-dev-device.patch
i2c/i2c-fix-copy-n-paste-in-subsystem-Kconfig.patch
i2c/i2c-matroxfb-c99-struct-init.patch
i2c/i2c-sibyte-drop-kip-walker-address.patch
i2c/i2c-stub-add-chip_addr-param.patch
pci/pci-fix-ich6-quirks.patch



More information about the i2c mailing list