diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-25 11:41:18 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-25 11:41:18 -0400 |
| commit | 5a559057b4fa0f60b2772fb590bf13e90af7a57d (patch) | |
| tree | 193391b65af88f56ffc440a37cac29f363e79a8c /drivers | |
| parent | 5e686019df425a4fd8003ce7f6eaccbe537331d8 (diff) | |
| parent | 968591298514167d05b0379377757ddefc76f022 (diff) | |
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
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hwmon/ads7871.c | 38 | ||||
| -rw-r--r-- | drivers/hwmon/coretemp.c | 1 | ||||
| -rw-r--r-- | drivers/hwmon/k8temp.c | 35 |
3 files changed, 51 insertions, 23 deletions
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index b300a2048af1..52319340e182 100644 --- a/drivers/hwmon/ads7871.c +++ b/drivers/hwmon/ads7871.c | |||
| @@ -160,30 +160,12 @@ static const struct attribute_group ads7871_group = { | |||
| 160 | 160 | ||
| 161 | static int __devinit ads7871_probe(struct spi_device *spi) | 161 | static int __devinit ads7871_probe(struct spi_device *spi) |
| 162 | { | 162 | { |
| 163 | int status, ret, err = 0; | 163 | int ret, err; |
| 164 | uint8_t val; | 164 | uint8_t val; |
| 165 | struct ads7871_data *pdata; | 165 | struct ads7871_data *pdata; |
| 166 | 166 | ||
| 167 | dev_dbg(&spi->dev, "probe\n"); | 167 | dev_dbg(&spi->dev, "probe\n"); |
| 168 | 168 | ||
| 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 | |||
| 187 | /* Configure the SPI bus */ | 169 | /* Configure the SPI bus */ |
| 188 | spi->mode = (SPI_MODE_0); | 170 | spi->mode = (SPI_MODE_0); |
| 189 | spi->bits_per_word = 8; | 171 | spi->bits_per_word = 8; |
| @@ -201,6 +183,24 @@ static int __devinit ads7871_probe(struct spi_device *spi) | |||
| 201 | we need to make sure we really have a chip*/ | 183 | we need to make sure we really have a chip*/ |
| 202 | if (val != ret) { | 184 | if (val != ret) { |
| 203 | err = -ENODEV; | 185 | 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); | ||
| 204 | goto error_remove; | 204 | goto error_remove; |
| 205 | } | 205 | } |
| 206 | 206 | ||
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index c070c9714cbe..de8111114f46 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -518,7 +518,6 @@ static struct notifier_block coretemp_cpu_notifier __refdata = { | |||
| 518 | static int __init coretemp_init(void) | 518 | static int __init coretemp_init(void) |
| 519 | { | 519 | { |
| 520 | int i, err = -ENODEV; | 520 | int i, err = -ENODEV; |
| 521 | struct pdev_entry *p, *n; | ||
| 522 | 521 | ||
| 523 | /* quick check if we run Intel */ | 522 | /* quick check if we run Intel */ |
| 524 | if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) | 523 | if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL) |
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c index b9bb3e0ca530..39ead2a4d3c5 100644 --- a/drivers/hwmon/k8temp.c +++ b/drivers/hwmon/k8temp.c | |||
| @@ -143,6 +143,37 @@ static const struct pci_device_id k8temp_ids[] = { | |||
| 143 | 143 | ||
| 144 | MODULE_DEVICE_TABLE(pci, k8temp_ids); | 144 | MODULE_DEVICE_TABLE(pci, k8temp_ids); |
| 145 | 145 | ||
| 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 | |||
| 146 | static int __devinit k8temp_probe(struct pci_dev *pdev, | 177 | static int __devinit k8temp_probe(struct pci_dev *pdev, |
| 147 | const struct pci_device_id *id) | 178 | const struct pci_device_id *id) |
| 148 | { | 179 | { |
| @@ -179,9 +210,7 @@ static int __devinit k8temp_probe(struct pci_dev *pdev, | |||
| 179 | "wrong - check erratum #141\n"); | 210 | "wrong - check erratum #141\n"); |
| 180 | } | 211 | } |
| 181 | 212 | ||
| 182 | if ((model >= 0x69) && | 213 | if (is_rev_g_desktop(model)) { |
| 183 | !(model == 0xc1 || model == 0x6c || model == 0x7c || | ||
| 184 | model == 0x6b || model == 0x6f || model == 0x7f)) { | ||
| 185 | /* | 214 | /* |
| 186 | * RevG desktop CPUs (i.e. no socket S1G1 or | 215 | * RevG desktop CPUs (i.e. no socket S1G1 or |
| 187 | * ASB1 parts) need additional offset, | 216 | * ASB1 parts) need additional offset, |
