]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.0.23/hwmon-max6639-fix-ppr-register-initialization-to-set-both-channels.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 3.0.23 / hwmon-max6639-fix-ppr-register-initialization-to-set-both-channels.patch
CommitLineData
162e698d
GKH
1From 2f2da1ac0ba5b6cc6e1957c4da5ff20e67d8442b Mon Sep 17 00:00:00 2001
2From: Chris D Schimp <silverchris@gmail.com>
3Date: Mon, 20 Feb 2012 17:44:59 -0500
4Subject: hwmon: (max6639) Fix PPR register initialization to set both channels
5
6From: Chris D Schimp <silverchris@gmail.com>
7
8commit 2f2da1ac0ba5b6cc6e1957c4da5ff20e67d8442b upstream.
9
10Initialize PPR register for both channels, and set correct PPR register bits.
11Also remove unnecessary variable initializations.
12
13Signed-off-by: Chris D Schimp <silverchris@gmail.com>
14[guenter.roeck@ericsson.com: Merged two patches into one]
15Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
16Acked-by: Roland Stigge <stigge@antcom.de>
17Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19---
20 drivers/hwmon/max6639.c | 16 +++++++++-------
21 1 file changed, 9 insertions(+), 7 deletions(-)
22
23--- a/drivers/hwmon/max6639.c
24+++ b/drivers/hwmon/max6639.c
25@@ -429,9 +429,9 @@ static int max6639_init_client(struct i2
26 struct max6639_data *data = i2c_get_clientdata(client);
27 struct max6639_platform_data *max6639_info =
28 client->dev.platform_data;
29- int i = 0;
30+ int i;
31 int rpm_range = 1; /* default: 4000 RPM */
32- int err = 0;
33+ int err;
34
35 /* Reset chip to default values, see below for GCONFIG setup */
36 err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG,
37@@ -446,11 +446,6 @@ static int max6639_init_client(struct i2
38 else
39 data->ppr = 2;
40 data->ppr -= 1;
41- err = i2c_smbus_write_byte_data(client,
42- MAX6639_REG_FAN_PPR(i),
43- data->ppr << 5);
44- if (err)
45- goto exit;
46
47 if (max6639_info)
48 rpm_range = rpm_range_to_reg(max6639_info->rpm_range);
49@@ -458,6 +453,13 @@ static int max6639_init_client(struct i2
50
51 for (i = 0; i < 2; i++) {
52
53+ /* Set Fan pulse per revolution */
54+ err = i2c_smbus_write_byte_data(client,
55+ MAX6639_REG_FAN_PPR(i),
56+ data->ppr << 6);
57+ if (err)
58+ goto exit;
59+
60 /* Fans config PWM, RPM */
61 err = i2c_smbus_write_byte_data(client,
62 MAX6639_REG_FAN_CONFIG1(i),