aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:48 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:48 -0400
commit2ae61de90545fe3dadae8119181c430d89a8627b (patch)
tree9a2aa7cc29674089dd9cc202050d61c95f559407 /drivers/hwmon/w83795.c
parent0d7237bfd13a0a8df270654223c15a16b368a3bd (diff)
hwmon: (w83795) Delay reading limit registers
Wait until we need the limit register values, instead of pre-reading them. This saves 544 ms on modprobe on my test system. Obviously this time is added when first running "sensors" or any other monitoring application, but I think it is better than slowing down the boot. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 511bced1ee9..6464a52b134 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -371,6 +371,7 @@ struct w83795_data {
371 u8 beeps[6]; /* Register value */ 371 u8 beeps[6]; /* Register value */
372 372
373 char valid; 373 char valid;
374 char valid_limits;
374}; 375};
375 376
376/* 377/*
@@ -498,6 +499,8 @@ static void w83795_update_limits(struct i2c_client *client)
498 /* Read beep settings */ 499 /* Read beep settings */
499 for (i = 0; i < ARRAY_SIZE(data->beeps); i++) 500 for (i = 0; i < ARRAY_SIZE(data->beeps); i++)
500 data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i)); 501 data->beeps[i] = w83795_read(client, W83795_REG_BEEP(i));
502
503 data->valid_limits = 1;
501} 504}
502 505
503static void w83795_update_pwm_config(struct i2c_client *client) 506static void w83795_update_pwm_config(struct i2c_client *client)
@@ -564,6 +567,9 @@ static struct w83795_data *w83795_update_device(struct device *dev)
564 567
565 mutex_lock(&data->update_lock); 568 mutex_lock(&data->update_lock);
566 569
570 if (!data->valid_limits)
571 w83795_update_limits(client);
572
567 if (!(time_after(jiffies, data->last_updated + HZ * 2) 573 if (!(time_after(jiffies, data->last_updated + HZ * 2)
568 || !data->valid)) 574 || !data->valid))
569 goto END; 575 goto END;
@@ -2017,7 +2023,6 @@ static int w83795_probe(struct i2c_client *client,
2017 } 2023 }
2018 2024
2019 data->has_gain = w83795_read(client, W83795_REG_VMIGB_CTRL) & 0x0f; 2025 data->has_gain = w83795_read(client, W83795_REG_VMIGB_CTRL) & 0x0f;
2020 w83795_update_limits(client);
2021 2026
2022 /* pwm and smart fan */ 2027 /* pwm and smart fan */
2023 if (data->chip_type == w83795g) 2028 if (data->chip_type == w83795g)