lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 16 Sep 2014 10:38:38 -0500 From: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@....com> To: <herrmann.der.user@...glemail.com>, <linux@...ck-us.net>, <jdelvare@...e.de>, <lm-sensors@...sensors.org>, <linux-kernel@...r.kernel.org> CC: <boris.ostrovsky@...cle.com>, Aravind Gopalakrishnan <Aravind.Gopalakrishnan@....com> Subject: [PATCH 1/2] hwmon, fam15h_power: Make actual power reporting conditional power1_input should only be reported for Fam15h, Models 00h-0fh So, introduce a is_visible function to take care of this. As suggested by Guenter here: http://marc.info/?l=linux-kernel&m=141038145616437&w=2 Suggested-by: Guenter Roeck <linux@...ck-us.net> Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@....com> --- drivers/hwmon/fam15h_power.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 4a7cbfa..5ca24de 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c @@ -93,13 +93,30 @@ 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 (!strcmp(attr->name, "power1_input") && + (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) { -- 2.0.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists