diff options
author | Nicola Corna <nicola@corna.info> | 2015-10-29 12:34:26 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2015-11-30 18:37:27 +0100 |
commit | cfa576db834cacc1bb01bc41b2f61a8b578e67c5 (patch) | |
tree | adcba35e7c8756f30b5d6aad52211189b901ca05 /include/linux/i2c.h | |
parent | 4dbfb5f4401f845903679afbfeb4b97b47bb2331 (diff) | |
download | op-kernel-dev-cfa576db834cacc1bb01bc41b2f61a8b578e67c5.zip op-kernel-dev-cfa576db834cacc1bb01bc41b2f61a8b578e67c5.tar.gz |
i2c: add i2c_check_quirks helper function
This patch adds a i2c_check_quirks helper function to check the quirk flags
of an i2c adapter, in a similar way to i2c_check_functionality.
Signed-off-by: Nicola Corna <nicola@corna.info>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 96970024..51028f3 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -617,6 +617,20 @@ static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func) return (func & i2c_get_functionality(adap)) == func; } +/** + * i2c_check_quirks() - Function for checking the quirk flags in an i2c adapter + * @adap: i2c adapter + * @quirks: quirk flags + * + * Return: true if the adapter has all the specified quirk flags, false if not + */ +static inline bool i2c_check_quirks(struct i2c_adapter *adap, u64 quirks) +{ + if (!adap->quirks) + return false; + return (adap->quirks->flags & quirks) == quirks; +} + /* Return the adapter number for a specific adapter */ static inline int i2c_adapter_id(struct i2c_adapter *adap) { |