aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2005-03-31 19:49:04 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-03-31 19:49:04 -0800
commit3ad6057315e53384a371b4b00e1c3861c3200276 (patch)
tree5b7f9a057ab94c60dd7c6d127b130087e7b86305
parentf6689a0812bdcbdec8f6886554b4d29579b0d574 (diff)
downloadhistory-3ad6057315e53384a371b4b00e1c3861c3200276.tar.gz
[PATCH] I2C: Move functionality handling from i2c-core to i2c.h
So far, the functionality handling of i2c adapters was done in i2c-core by two exported functions: i2c_get_functionality and i2c_check_functionality. I found that both functions could be reduced to one line each, and propose that we turn them into inline function in the i2c.h header file, much like other i2c helper functions (e.g. i2c_get_clientdata, i2c_set_clientdata and i2c_clientname). The conversion of i2c_get_functionality suppresses a legacy check which shouldn't be needed anymore. Only one driver (s3c2410) was still relying on it, and was fixed some days ago. The conversion lets us get rid of two exports. Not only i2c-core gets smaller (by 458 bytes), but the client drivers using these functions get smaller too (typically by 48 bytes). And of course the new way is likely to be faster too, even if it wasn't my primary objective. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/i2c/i2c-core.c19
-rw-r--r--include/linux/i2c.h10
2 files changed, 8 insertions, 21 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e62a91a45a291e..9011627d7eb030 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1236,22 +1236,6 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags,
}
-/* You should always define `functionality'; the 'else' is just for
- backward compatibility. */
-u32 i2c_get_functionality (struct i2c_adapter *adap)
-{
- if (adap->algo->functionality)
- return adap->algo->functionality(adap);
- else
- return 0xffffffff;
-}
-
-int i2c_check_functionality (struct i2c_adapter *adap, u32 func)
-{
- u32 adap_func = i2c_get_functionality (adap);
- return (func & adap_func) == func;
-}
-
EXPORT_SYMBOL(i2c_add_adapter);
EXPORT_SYMBOL(i2c_del_adapter);
EXPORT_SYMBOL(i2c_add_driver);
@@ -1283,9 +1267,6 @@ EXPORT_SYMBOL(i2c_smbus_write_word_data);
EXPORT_SYMBOL(i2c_smbus_write_block_data);
EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data);
-EXPORT_SYMBOL(i2c_get_functionality);
-EXPORT_SYMBOL(i2c_check_functionality);
-
MODULE_AUTHOR("Simon G. Vogl <simon@tk.uni-linz.ac.at>");
MODULE_DESCRIPTION("I2C-Bus main module");
MODULE_LICENSE("GPL");
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 9f2ae600683c63..ebcd745f4cd6f7 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -368,10 +368,16 @@ extern void i2c_put_adapter(struct i2c_adapter *adap);
/* Return the functionality mask */
-extern u32 i2c_get_functionality (struct i2c_adapter *adap);
+static inline u32 i2c_get_functionality(struct i2c_adapter *adap)
+{
+ return adap->algo->functionality(adap);
+}
/* Return 1 if adapter supports everything we need, 0 if not. */
-extern int i2c_check_functionality (struct i2c_adapter *adap, u32 func);
+static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func)
+{
+ return (func & i2c_get_functionality(adap)) == func;
+}
/*
* I2C Message - used for pure i2c transaction, also from /dev interface