aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus/zl6100.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-03-07 06:58:55 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-07 12:48:43 -0500
commit7ad6307ad6968ce25cecf209d4822d4c722be030 (patch)
tree0ee31e81c7da73a4ef7708dc05ae34bc03c0d7f5 /drivers/hwmon/pmbus/zl6100.c
parent7cb3c44fb1f7999e4c53b6a52de6bc25da6de079 (diff)
hwmon: (zl6100) Maintain delay parameter in driver instance data
A global delay parameter has the side effect of being overwritten with 0 if a single ZL2004 or ZL6105 is instantiated. If other chips supported by the same driver are in the system, this will result in access errors for those chips. To solve the problem, keep a per-instance copy of the delay parameter, and do not change the original parameter. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: stable@vger.kernel.org # 3.1+ Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/pmbus/zl6100.c')
-rw-r--r--drivers/hwmon/pmbus/zl6100.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/hwmon/pmbus/zl6100.c b/drivers/hwmon/pmbus/zl6100.c
index 48c7b4a716ae..880b90cf4d32 100644
--- a/drivers/hwmon/pmbus/zl6100.c
+++ b/drivers/hwmon/pmbus/zl6100.c
@@ -33,6 +33,7 @@ enum chips { zl2004, zl2005, zl2006, zl2008, zl2105, zl2106, zl6100, zl6105 };
33struct zl6100_data { 33struct zl6100_data {
34 int id; 34 int id;
35 ktime_t access; /* chip access time */ 35 ktime_t access; /* chip access time */
36 int delay; /* Delay between chip accesses in uS */
36 struct pmbus_driver_info info; 37 struct pmbus_driver_info info;
37}; 38};
38 39
@@ -52,10 +53,10 @@ MODULE_PARM_DESC(delay, "Delay between chip accesses in uS");
52/* Some chips need a delay between accesses */ 53/* Some chips need a delay between accesses */
53static inline void zl6100_wait(const struct zl6100_data *data) 54static inline void zl6100_wait(const struct zl6100_data *data)
54{ 55{
55 if (delay) { 56 if (data->delay) {
56 s64 delta = ktime_us_delta(ktime_get(), data->access); 57 s64 delta = ktime_us_delta(ktime_get(), data->access);
57 if (delta < delay) 58 if (delta < data->delay)
58 udelay(delay - delta); 59 udelay(data->delay - delta);
59 } 60 }
60} 61}
61 62
@@ -207,8 +208,9 @@ static int zl6100_probe(struct i2c_client *client,
207 * can be cleared later for additional chips if tests show that it 208 * can be cleared later for additional chips if tests show that it
208 * is not needed (in other words, better be safe than sorry). 209 * is not needed (in other words, better be safe than sorry).
209 */ 210 */
211 data->delay = delay;
210 if (data->id == zl2004 || data->id == zl6105) 212 if (data->id == zl2004 || data->id == zl6105)
211 delay = 0; 213 data->delay = 0;
212 214
213 /* 215 /*
214 * Since there was a direct I2C device access above, wait before 216 * Since there was a direct I2C device access above, wait before