#endif
+#ifdef __NEED_I2C__
+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 21)
#if !(defined RHEL_MAJOR && RHEL_MAJOR == 5 && RHEL_MINOR >= 6)
/* Simplified version for compatibility */
};
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
+static inline s32
+i2c_smbus_read_word_swapped(const struct i2c_client *client, u8 command)
+{
+ s32 value = i2c_smbus_read_word_data(client, command);
+
+ return (value < 0) ? value : swab16(value);
+}
+
+static inline s32
+i2c_smbus_write_word_swapped(const struct i2c_client *client,
+ u8 command, u16 value)
+{
+ return i2c_smbus_write_word_data(client, command, swab16(value));
+}
+#endif
+
/* Red Hat EL5 includes backports of these functions, so we can't redefine
* our own. */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
#endif
#endif
+#endif /* __NEED_I2C__ */
+
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 28)
/*
* Divide positive or negative dividend by positive divisor and round
)
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
-static inline s32
-i2c_smbus_read_word_swapped(const struct i2c_client *client, u8 command)
-{
- s32 value = i2c_smbus_read_word_data(client, command);
-
- return (value < 0) ? value : swab16(value);
-}
-
-static inline s32
-i2c_smbus_write_word_swapped(const struct i2c_client *client,
- u8 command, u16 value)
-{
- return i2c_smbus_write_word_data(client, command, swab16(value));
-}
-#endif
-
#ifndef module_driver
/**
* module_driver() - Helper macro for drivers that don't do anything
module_exit(__driver##_exit);
#endif
+#ifdef __NEED_I2C__
+
#ifndef module_i2c_driver
/**
* module_i2c_driver() - Helper macro for registering a I2C driver
i2c_del_driver)
#endif
+#endif /* __NEED_I2C__ */
+
#ifndef clamp_val
#define clamp_val SENSORS_LIMIT
#endif