From: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: <herrmann.der.user@googlemail.com>, <jdelvare@suse.de>,
<lm-sensors@lm-sensors.org>, <linux-kernel@vger.kernel.org>,
<boris.ostrovsky@oracle.com>
Subject: Re: [PATCH 1/2] hwmon, fam15h_power: Make actual power reporting conditional
Date: Tue, 16 Sep 2014 10:56:49 -0500 [thread overview]
Message-ID: <54185DC1.2060306@amd.com> (raw)
In-Reply-To: <20140916155221.GB14725@roeck-us.net>
On 9/16/2014 10:52 AM, Guenter Roeck wrote:
> On Tue, Sep 16, 2014 at 10:38:38AM -0500, Aravind Gopalakrishnan wrote:
>> 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@roeck-us.net>
>> Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.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") &&
> if (attr == &dev_attr_power1_input.attr &&
>
> works just as well and is simpler.
Ok.
>> + (boot_cpu_data.x86 != 0x15 || boot_cpu_data.x86_model > 0xf)) {
>> + return 0;
>> + }
>> +
I just noticed: I don't really need opening/closing parenthesis here.
Shall fix and send V2.
>> + return attr->mode;
>> +}
>> +
>>
Thanks,
-Aravind.
prev parent reply other threads:[~2014-09-16 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-16 15:38 [PATCH 1/2] hwmon, fam15h_power: Make actual power reporting conditional Aravind Gopalakrishnan
2014-09-16 15:52 ` Guenter Roeck
2014-09-16 15:56 ` Aravind Gopalakrishnan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54185DC1.2060306@amd.com \
--to=aravind.gopalakrishnan@amd.com \
--cc=boris.ostrovsky@oracle.com \
--cc=herrmann.der.user@googlemail.com \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox