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
This commit is contained in:
commit
5a559057b4
|
@ -1676,8 +1676,7 @@ F: kernel/cgroup*
|
|||
F: mm/*cgroup*
|
||||
|
||||
CORETEMP HARDWARE MONITORING DRIVER
|
||||
M: Rudolf Marek <r.marek@assembler.cz>
|
||||
M: Huaxu Wan <huaxu.wan@intel.com>
|
||||
M: Fenghua Yu <fenghua.yu@intel.com>
|
||||
L: lm-sensors@lm-sensors.org
|
||||
S: Maintained
|
||||
F: Documentation/hwmon/coretemp
|
||||
|
|
|
@ -160,30 +160,12 @@ static const struct attribute_group ads7871_group = {
|
|||
|
||||
static int __devinit ads7871_probe(struct spi_device *spi)
|
||||
{
|
||||
int status, ret, err = 0;
|
||||
int ret, err;
|
||||
uint8_t val;
|
||||
struct ads7871_data *pdata;
|
||||
|
||||
dev_dbg(&spi->dev, "probe\n");
|
||||
|
||||
pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL);
|
||||
if (!pdata) {
|
||||
err = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
status = sysfs_create_group(&spi->dev.kobj, &ads7871_group);
|
||||
if (status < 0)
|
||||
goto error_free;
|
||||
|
||||
pdata->hwmon_dev = hwmon_device_register(&spi->dev);
|
||||
if (IS_ERR(pdata->hwmon_dev)) {
|
||||
err = PTR_ERR(pdata->hwmon_dev);
|
||||
goto error_remove;
|
||||
}
|
||||
|
||||
spi_set_drvdata(spi, pdata);
|
||||
|
||||
/* Configure the SPI bus */
|
||||
spi->mode = (SPI_MODE_0);
|
||||
spi->bits_per_word = 8;
|
||||
|
@ -201,6 +183,24 @@ static int __devinit ads7871_probe(struct spi_device *spi)
|
|||
we need to make sure we really have a chip*/
|
||||
if (val != ret) {
|
||||
err = -ENODEV;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdata = kzalloc(sizeof(struct ads7871_data), GFP_KERNEL);
|
||||
if (!pdata) {
|
||||
err = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
err = sysfs_create_group(&spi->dev.kobj, &ads7871_group);
|
||||
if (err < 0)
|
||||
goto error_free;
|
||||
|
||||
spi_set_drvdata(spi, pdata);
|
||||
|
||||
pdata->hwmon_dev = hwmon_device_register(&spi->dev);
|
||||
if (IS_ERR(pdata->hwmon_dev)) {
|
||||
err = PTR_ERR(pdata->hwmon_dev);
|
||||
goto error_remove;
|
||||
}
|
||||
|
||||
|
|
|
@ -518,7 +518,6 @@ static struct notifier_block coretemp_cpu_notifier __refdata = {
|
|||
static int __init coretemp_init(void)
|
||||
{
|
||||
int i, err = -ENODEV;
|
||||
struct pdev_entry *p, *n;
|
||||
|
||||
/* quick check if we run Intel */
|
||||
if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
|
||||
|
|
|
@ -143,6 +143,37 @@ static const struct pci_device_id k8temp_ids[] = {
|
|||
|
||||
MODULE_DEVICE_TABLE(pci, k8temp_ids);
|
||||
|
||||
static int __devinit is_rev_g_desktop(u8 model)
|
||||
{
|
||||
u32 brandidx;
|
||||
|
||||
if (model < 0x69)
|
||||
return 0;
|
||||
|
||||
if (model == 0xc1 || model == 0x6c || model == 0x7c)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Differentiate between AM2 and ASB1.
|
||||
* See "Constructing the processor Name String" in "Revision
|
||||
* Guide for AMD NPT Family 0Fh Processors" (33610).
|
||||
*/
|
||||
brandidx = cpuid_ebx(0x80000001);
|
||||
brandidx = (brandidx >> 9) & 0x1f;
|
||||
|
||||
/* Single core */
|
||||
if ((model == 0x6f || model == 0x7f) &&
|
||||
(brandidx == 0x7 || brandidx == 0x9 || brandidx == 0xc))
|
||||
return 0;
|
||||
|
||||
/* Dual core */
|
||||
if (model == 0x6b &&
|
||||
(brandidx == 0xb || brandidx == 0xc))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int __devinit k8temp_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
|
@ -179,9 +210,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
|
|||
"wrong - check erratum #141\n");
|
||||
}
|
||||
|
||||
if ((model >= 0x69) &&
|
||||
!(model == 0xc1 || model == 0x6c || model == 0x7c ||
|
||||
model == 0x6b || model == 0x6f || model == 0x7f)) {
|
||||
if (is_rev_g_desktop(model)) {
|
||||
/*
|
||||
* RevG desktop CPUs (i.e. no socket S1G1 or
|
||||
* ASB1 parts) need additional offset,
|
||||
|
|
Loading…
Reference in New Issue