diff options
Diffstat (limited to 'drivers/macintosh/windfarm_max6690_sensor.c')
-rw-r--r-- | drivers/macintosh/windfarm_max6690_sensor.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c index 5f03aab9fb5d..e207a90d6b27 100644 --- a/drivers/macintosh/windfarm_max6690_sensor.c +++ b/drivers/macintosh/windfarm_max6690_sensor.c | |||
@@ -77,18 +77,28 @@ static struct wf_sensor_ops wf_max6690_ops = { | |||
77 | .owner = THIS_MODULE, | 77 | .owner = THIS_MODULE, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr) | 80 | static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr, |
81 | const char *loc) | ||
81 | { | 82 | { |
82 | struct wf_6690_sensor *max; | 83 | struct wf_6690_sensor *max; |
83 | char *name = "backside-temp"; | 84 | char *name; |
84 | 85 | ||
85 | max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL); | 86 | max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL); |
86 | if (max == NULL) { | 87 | if (max == NULL) { |
87 | printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: " | 88 | printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: " |
88 | "no memory\n", name); | 89 | "no memory\n", loc); |
89 | return; | 90 | return; |
90 | } | 91 | } |
91 | 92 | ||
93 | if (!strcmp(loc, "BACKSIDE")) | ||
94 | name = "backside-temp"; | ||
95 | else if (!strcmp(loc, "NB Ambient")) | ||
96 | name = "north-bridge-temp"; | ||
97 | else if (!strcmp(loc, "GPU Ambient")) | ||
98 | name = "gpu-temp"; | ||
99 | else | ||
100 | goto fail; | ||
101 | |||
92 | max->sens.ops = &wf_max6690_ops; | 102 | max->sens.ops = &wf_max6690_ops; |
93 | max->sens.name = name; | 103 | max->sens.name = name; |
94 | max->i2c.addr = addr >> 1; | 104 | max->i2c.addr = addr >> 1; |
@@ -138,9 +148,7 @@ static int wf_max6690_attach(struct i2c_adapter *adapter) | |||
138 | if (loc == NULL || addr == 0) | 148 | if (loc == NULL || addr == 0) |
139 | continue; | 149 | continue; |
140 | printk("found max6690, loc=%s addr=0x%02x\n", loc, addr); | 150 | printk("found max6690, loc=%s addr=0x%02x\n", loc, addr); |
141 | if (strcmp(loc, "BACKSIDE")) | 151 | wf_max6690_create(adapter, addr, loc); |
142 | continue; | ||
143 | wf_max6690_create(adapter, addr); | ||
144 | } | 152 | } |
145 | 153 | ||
146 | return 0; | 154 | return 0; |