aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c-algo-pca.h
diff options
context:
space:
mode:
authorThomas Kavanagh <tkavanagh@juniper.net>2012-09-20 23:20:46 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-10-06 07:14:36 -0400
commita76e7c6821b5dddf69db9d76ec282819545f5b73 (patch)
treeb86ced7ed1c3187cf1757e0f4b5acd68b423d8a4 /include/linux/i2c-algo-pca.h
parent0c25aefa35c2fb5592895615f77d9f6fa36a849d (diff)
i2c: algo: pca: Fix chip reset function for PCA9665
The parameter passed to pca9665_reset is adap->data (which is bus driver specific), not i2c_algp_pca_data *adap. pca9665_reset expects it to be i2c_algp_pca_data *adap. All other wrappers from the algo call back to the bus driver, which knows to handle its custom data. Only pca9665_reset resides inside the algorithm code and does not know how to handle a custom data structure. This can result in a kernel crash. Fix by re-factoring pca_reset() from a macro to a function handling chip specific code, and only call adap->reset_chip() if the chip is not PCA9665. Signed-off-by: Thomas Kavanagh <tkavanagh@juniper.net> Signed-off-by: Guenter Roeck <groeck@juniper.net> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'include/linux/i2c-algo-pca.h')
-rw-r--r--include/linux/i2c-algo-pca.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h
index 1364d62e2fbe..a3c3ecd59f08 100644
--- a/include/linux/i2c-algo-pca.h
+++ b/include/linux/i2c-algo-pca.h
@@ -62,6 +62,7 @@ struct i2c_algo_pca_data {
62 * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000 62 * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000
63 * For PCA9665, use the frequency you want here. */ 63 * For PCA9665, use the frequency you want here. */
64 unsigned int i2c_clock; 64 unsigned int i2c_clock;
65 unsigned int chip;
65}; 66};
66 67
67int i2c_pca_add_bus(struct i2c_adapter *); 68int i2c_pca_add_bus(struct i2c_adapter *);