public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: "Henrik Rydberg" <rydberg@euromail.se>
Cc: lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org,
	Alex Murray <murray.alex@gmail.com>
Subject: Re: [PATCH] hwmon: applesmc: Add temperature sensor labels to sysfs interface
Date: Tue, 4 May 2010 12:06:38 +0200	[thread overview]
Message-ID: <20100504120638.70244e8e@hyperion.delvare> (raw)
In-Reply-To: <1272966929-14501-1-git-send-email-rydberg@euromail.se>

Hi Henrik,

On Tue,  4 May 2010 11:55:29 +0200, Henrik Rydberg wrote:
> From: Alex Murray <murray.alex@gmail.com>
> 
> The Apple SMC uses a systematic labeling scheme for the hardware
> temperature sensors. This scheme is currently hidden from
> userland. Since the sensor set, and consequently the numbering,
> differs between models, an extensive database of configurations is
> required for an application such as fan control. This patch adds the
> SMC labels to the hwmon sysfs interface, allowing applications to use
> the sensors more intelligibly.

I like the idea.

> Signed-off-by: Alex Murray <murray.alex@gmail.com>
> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
> ---
>  drivers/hwmon/applesmc.c |  145 +++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 144 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
> index 36a0d62..8be86ef 100644
> --- a/drivers/hwmon/applesmc.c
> +++ b/drivers/hwmon/applesmc.c
> (...)
> @@ -1252,6 +1387,9 @@ static struct attribute *temperature_attributes[] = {
>  static const struct attribute_group temperature_attributes_group =
>  	{ .attrs = temperature_attributes };
>  
> +static const struct attribute_group label_attributes_group = {
> +	.attrs = label_attributes
> +};

Missing blank like.

>  /* Module stuff */
>  
>  /*
> @@ -1568,7 +1706,8 @@ static int __init applesmc_init(void)
>  	for (i = 0;
>  	     temperature_sensors_sets[applesmc_temperature_set][i] != NULL;
>  	     i++) {
> -		if (temperature_attributes[i] == NULL) {
> +		if (temperature_attributes[i] == NULL ||
> +		    label_attributes[i] == NULL) {
>  			printk(KERN_ERR "applesmc: More temperature sensors "
>  				"in temperature_sensors_sets (at least %i)"
>  				"than available sysfs files in "
> @@ -1578,6 +1717,8 @@ static int __init applesmc_init(void)
>  		}
>  		ret = sysfs_create_file(&pdev->dev.kobj,
>  						temperature_attributes[i]);

Missing error handling.

> +		ret = sysfs_create_file(&pdev->dev.kobj,
> +						label_attributes[i]);
>  		if (ret)
>  			goto out_temperature;
>  	}

Other than that, the patch looks good.

-- 
Jean Delvare

  reply	other threads:[~2010-05-04 10:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-04  9:55 [PATCH] hwmon: applesmc: Add temperature sensor labels to sysfs interface Henrik Rydberg
2010-05-04 10:06 ` Jean Delvare [this message]
2010-05-04 11:15   ` Henrik Rydberg
2010-05-04 11:32     ` Jean Delvare

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=20100504120638.70244e8e@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=murray.alex@gmail.com \
    --cc=rydberg@euromail.se \
    /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