Commit e5b1d9cc authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (i5k_amb) Drop i5k_channel_pci_id
  hwmon: (ntc_thermistor) Simplify if sequence
parents f385b697 b4cb0d4d
...@@ -114,7 +114,6 @@ struct i5k_amb_data { ...@@ -114,7 +114,6 @@ struct i5k_amb_data {
void __iomem *amb_mmio; void __iomem *amb_mmio;
struct i5k_device_attribute *attrs; struct i5k_device_attribute *attrs;
unsigned int num_attrs; unsigned int num_attrs;
unsigned long chipset_id;
}; };
static ssize_t show_name(struct device *dev, struct device_attribute *devattr, static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
...@@ -444,8 +443,6 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data, ...@@ -444,8 +443,6 @@ static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data,
goto out; goto out;
} }
data->chipset_id = devid;
res = 0; res = 0;
out: out:
pci_dev_put(pcidev); pci_dev_put(pcidev);
...@@ -478,23 +475,13 @@ static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id) ...@@ -478,23 +475,13 @@ static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
return res; return res;
} }
static unsigned long i5k_channel_pci_id(struct i5k_amb_data *data, static struct {
unsigned long channel) unsigned long err;
{ unsigned long fbd0;
switch (data->chipset_id) { } chipset_ids[] __devinitdata = {
case PCI_DEVICE_ID_INTEL_5000_ERR: { PCI_DEVICE_ID_INTEL_5000_ERR, PCI_DEVICE_ID_INTEL_5000_FBD0 },
return PCI_DEVICE_ID_INTEL_5000_FBD0 + channel; { PCI_DEVICE_ID_INTEL_5400_ERR, PCI_DEVICE_ID_INTEL_5400_FBD0 },
case PCI_DEVICE_ID_INTEL_5400_ERR: { 0, 0 }
return PCI_DEVICE_ID_INTEL_5400_FBD0 + channel;
default:
BUG();
}
}
static unsigned long chipset_ids[] = {
PCI_DEVICE_ID_INTEL_5000_ERR,
PCI_DEVICE_ID_INTEL_5400_ERR,
0
}; };
#ifdef MODULE #ifdef MODULE
...@@ -510,8 +497,7 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev) ...@@ -510,8 +497,7 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev)
{ {
struct i5k_amb_data *data; struct i5k_amb_data *data;
struct resource *reso; struct resource *reso;
int i; int i, res;
int res = -ENODEV;
data = kzalloc(sizeof(*data), GFP_KERNEL); data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
...@@ -520,22 +506,22 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev) ...@@ -520,22 +506,22 @@ static int __devinit i5k_amb_probe(struct platform_device *pdev)
/* Figure out where the AMB registers live */ /* Figure out where the AMB registers live */
i = 0; i = 0;
do { do {
res = i5k_find_amb_registers(data, chipset_ids[i]); res = i5k_find_amb_registers(data, chipset_ids[i].err);
if (res == 0)
break;
i++; i++;
} while (res && chipset_ids[i]); } while (chipset_ids[i].err);
if (res) if (res)
goto err; goto err;
/* Copy the DIMM presence map for the first two channels */ /* Copy the DIMM presence map for the first two channels */
res = i5k_channel_probe(&data->amb_present[0], res = i5k_channel_probe(&data->amb_present[0], chipset_ids[i].fbd0);
i5k_channel_pci_id(data, 0));
if (res) if (res)
goto err; goto err;
/* Copy the DIMM presence map for the optional second two channels */ /* Copy the DIMM presence map for the optional second two channels */
i5k_channel_probe(&data->amb_present[2], i5k_channel_probe(&data->amb_present[2], chipset_ids[i].fbd0 + 1);
i5k_channel_pci_id(data, 1));
/* Set up resource regions */ /* Set up resource regions */
reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME); reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
......
...@@ -211,8 +211,7 @@ static int lookup_comp(struct ntc_data *data, ...@@ -211,8 +211,7 @@ static int lookup_comp(struct ntc_data *data,
if (data->comp[mid].ohm <= ohm) { if (data->comp[mid].ohm <= ohm) {
*i_low = mid; *i_low = mid;
*i_high = mid - 1; *i_high = mid - 1;
} } else {
if (data->comp[mid].ohm > ohm) {
*i_low = mid + 1; *i_low = mid + 1;
*i_high = mid; *i_high = mid;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment