Fix a resource leak in tmp103 driver.

Add support for two more processors to fam15h_power driver.
 Also fix a bug in the same driver to only report the power level
 on chips which actually support reporting it.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJUIZ6JAAoJEMsfJm/On5mBD6UQAIZsZr17e5tqBRBQVpT67Uhc
 8bQOL4bdxmkCF9YDCDFZ+R2tbd49T7zzitOdlFFbPv0/t9gQctZzW7YQ+plVh/+w
 eTm40imyh+Le6MDXxqgZdCZR1Y5/J15mTYGdCUQ5ld3p9yuJFbSoI7rxUfIeH5ER
 V7D/TZbf3U3m3kFhz5OalnBFNWMKhImGxOgfd/ulABZgvwbnwZCtersvjlYDHOsI
 5SpBFCLvH0QD6khVGUgAT85XuHZZi+em3mhLAV4gpYO0NQDLotL/JONO5QslFMVQ
 bdNzTX54gRN7xZKp4kQUJllsc25htavVw531Yw9HUo0K9pPcjGruuGpcawm4zruY
 4VNWdULm3MWdkS6LYCCRlKd2zW89ibcP1Ehwf+biD4Ucnx4J7QYeZ5pLl5oSG5Sk
 3w2KSIM627PfL724wvZz2vvOV0CB62wB6TbX5XSHeN7jP+7dH2cTFAJycVfBBZLv
 nCXmvshLqQcjboW/XLrLAfu5r2nRWcZH30uL+D/VSI5o9kGEHj1d9xPu1BiWgpov
 xBe+mDWpHWFC6Qx74BqRwS2sCcLO3IMXXdcIOyV5jLeCHCIwJApypwfqsCeKfGPn
 hKjJqv8bfRhprMEEG2iFqYswTF3BM5QpDHt1LiTE059OWiBhI4z7Qn2VRUV0aDrh
 GAXPYFOhQb0atjYskMJ3
 =i4EB
 -----END PGP SIGNATURE-----

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

Pull hwmon fixes from Guenter Roeck:
 - Fix a resource leak in tmp103 driver
 - Add support for two more processors to fam15h_power driver
 - Also fix a bug in the same driver to only report the power level on
   chips which actually support reporting it

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (tmp103) Fix resource leak bug in tmp103 temperature sensor driver
  hwmon: (fam15h_power) Add support for two more processors
  hwmon: (fam15h_power) Make actual power reporting conditional
This commit is contained in:
Linus Torvalds 2014-09-23 11:53:28 -07:00
commit c1d58658d8
2 changed files with 20 additions and 2 deletions

View File

@ -93,13 +93,29 @@ static ssize_t show_power_crit(struct device *dev,
}
static DEVICE_ATTR(power1_crit, S_IRUGO, show_power_crit, NULL);
static umode_t fam15h_power_is_visible(struct kobject *kobj,
struct attribute *attr,
int index)
{
/* power1_input is only reported for Fam15h, Models 00h-0fh */
if (attr == &dev_attr_power1_input.attr &&
(boot_cpu_data.x86 != 0x15 || boot_cpu_data.x86_model > 0xf))
return 0;
return attr->mode;
}
static struct attribute *fam15h_power_attrs[] = {
&dev_attr_power1_input.attr,
&dev_attr_power1_crit.attr,
NULL
};
ATTRIBUTE_GROUPS(fam15h_power);
static const struct attribute_group fam15h_power_group = {
.attrs = fam15h_power_attrs,
.is_visible = fam15h_power_is_visible,
};
__ATTRIBUTE_GROUPS(fam15h_power);
static bool fam15h_power_is_internal_node0(struct pci_dev *f4)
{
@ -216,7 +232,9 @@ static int fam15h_power_probe(struct pci_dev *pdev,
static const struct pci_device_id fam15h_power_id_table[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) },
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) },
{}
};
MODULE_DEVICE_TABLE(pci, fam15h_power_id_table);

View File

@ -145,7 +145,7 @@ static int tmp103_probe(struct i2c_client *client,
}
i2c_set_clientdata(client, regmap);
hwmon_dev = hwmon_device_register_with_groups(dev, client->name,
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
regmap, tmp103_groups);
return PTR_ERR_OR_ZERO(hwmon_dev);
}