From: Nicola Corna Date: Thu, 29 Oct 2015 11:34:26 +0000 (+0100) Subject: i2c: add i2c_check_quirks helper function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cfa576db834cacc1bb01bc41b2f61a8b578e67c5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Wolfram Sang --- diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 96970024883f..51028f351d13 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) {