Skip to content

Commit 5a55905

Browse files
committed
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: MAINTAINERS: hwmon/coretemp: Change maintainers hwmon: (k8temp) Differentiate between AM2 and ASB1 hwmon: (ads7871) Fix ads7871_probe error paths hwmon: (coretemp) Fix harmless build warning
2 parents 5e68601 + 9685912 commit 5a55905

File tree

4 files changed

+52
-25
lines changed

4 files changed

+52
-25
lines changed

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,8 +1676,7 @@ F: kernel/cgroup*
16761676
F: mm/*cgroup*
16771677

16781678
CORETEMP HARDWARE MONITORING DRIVER
1679-
M: Rudolf Marek <r.marek@assembler.cz>
1680-
M: Huaxu Wan <huaxu.wan@intel.com>
1679+
M: Fenghua Yu <fenghua.yu@intel.com>
16811680
L: lm-sensors@lm-sensors.org
16821681
S: Maintained
16831682
F: Documentation/hwmon/coretemp

drivers/hwmon/ads7871.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,30 +160,12 @@ static const struct attribute_group ads7871_group = {
160160

161161
static int __devinit ads7871_probe(struct spi_device *spi)
162162
{
163-
int status, ret, err = 0;
163+
int ret, err;
164164
uint8_t val;
165165
struct ads7871_data *pdata;
166166

167167
dev_dbg(&spi->dev, "probe\n");
168168

169-
pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL);
170-
if (!pdata) {
171-
err = -ENOMEM;
172-
goto exit;
173-
}
174-
175-
status = sysfs_create_group(&spi->dev.kobj, &ads7871_group);
176-
if (status < 0)
177-
goto error_free;
178-
179-
pdata->hwmon_dev = hwmon_device_register(&spi->dev);
180-
if (IS_ERR(pdata->hwmon_dev)) {
181-
err = PTR_ERR(pdata->hwmon_dev);
182-
goto error_remove;
183-
}
184-
185-
spi_set_drvdata(spi, pdata);
186-
187169
/* Configure the SPI bus */
188170
spi->mode = (SPI_MODE_0);
189171
spi->bits_per_word = 8;
@@ -201,6 +183,24 @@ static int __devinit ads7871_probe(struct spi_device *spi)
201183
we need to make sure we really have a chip*/
202184
if (val != ret) {
203185
err = -ENODEV;
186+
goto exit;
187+
}
188+
189+
pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL);
190+
if (!pdata) {
191+
err = -ENOMEM;
192+
goto exit;
193+
}
194+
195+
err = sysfs_create_group(&spi->dev.kobj, &ads7871_group);
196+
if (err < 0)
197+
goto error_free;
198+
199+
spi_set_drvdata(spi, pdata);
200+
201+
pdata->hwmon_dev = hwmon_device_register(&spi->dev);
202+
if (IS_ERR(pdata->hwmon_dev)) {
203+
err = PTR_ERR(pdata->hwmon_dev);
204204
goto error_remove;
205205
}
206206

drivers/hwmon/coretemp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ static struct notifier_block coretemp_cpu_notifier __refdata = {
518518
static int __init coretemp_init(void)
519519
{
520520
int i, err = -ENODEV;
521-
struct pdev_entry *p, *n;
522521

523522
/* quick check if we run Intel */
524523
if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)

drivers/hwmon/k8temp.c

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,37 @@ static const struct pci_device_id k8temp_ids[] = {
143143

144144
MODULE_DEVICE_TABLE(pci, k8temp_ids);
145145

146+
static int __devinit is_rev_g_desktop(u8 model)
147+
{
148+
u32 brandidx;
149+
150+
if (model < 0x69)
151+
return 0;
152+
153+
if (model == 0xc1 || model == 0x6c || model == 0x7c)
154+
return 0;
155+
156+
/*
157+
* Differentiate between AM2 and ASB1.
158+
* See "Constructing the processor Name String" in "Revision
159+
* Guide for AMD NPT Family 0Fh Processors" (33610).
160+
*/
161+
brandidx = cpuid_ebx(0x80000001);
162+
brandidx = (brandidx >> 9) & 0x1f;
163+
164+
/* Single core */
165+
if ((model == 0x6f || model == 0x7f) &&
166+
(brandidx == 0x7 || brandidx == 0x9 || brandidx == 0xc))
167+
return 0;
168+
169+
/* Dual core */
170+
if (model == 0x6b &&
171+
(brandidx == 0xb || brandidx == 0xc))
172+
return 0;
173+
174+
return 1;
175+
}
176+
146177
static int __devinit k8temp_probe(struct pci_dev *pdev,
147178
const struct pci_device_id *id)
148179
{
@@ -179,9 +210,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
179210
"wrong - check erratum #141\n");
180211
}
181212

182-
if ((model >= 0x69) &&
183-
!(model == 0xc1 || model == 0x6c || model == 0x7c ||
184-
model == 0x6b || model == 0x6f || model == 0x7f)) {
213+
if (is_rev_g_desktop(model)) {
185214
/*
186215
* RevG desktop CPUs (i.e. no socket S1G1 or
187216
* ASB1 parts) need additional offset,

0 commit comments

Comments
 (0)