patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / i2c / chips / asb100.c
index 355972c..f93b6f6 100644 (file)
@@ -609,7 +609,7 @@ static DEVICE_ATTR(fan1_pwm_enable, S_IRUGO | S_IWUSR,
  */
 static int asb100_attach_adapter(struct i2c_adapter *adapter)
 {
-       if (!(adapter->class & I2C_ADAP_CLASS_SMBUS))
+       if (!(adapter->class & I2C_CLASS_HWMON))
                return 0;
        return i2c_detect(adapter, &addr_data, asb100_detect);
 }
@@ -855,7 +855,13 @@ static int asb100_detach_client(struct i2c_client *client)
                return err;
        }
 
-       kfree(i2c_get_clientdata(client));
+       if (i2c_get_clientdata(client)==NULL) {
+               /* subclients */
+               kfree(client);
+       } else {
+               /* main client */
+               kfree(i2c_get_clientdata(client));
+       }
 
        return 0;
 }