linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: rui.zhang@intel.com, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Clean up thermal API
Date: Tue, 17 Jun 2008 17:54:48 +0200	[thread overview]
Message-ID: <20080617155448.GA4891@ucw.cz> (raw)
In-Reply-To: <20080611100647.GA20013@srcf.ucam.org>

Hi!

> The thermal layer passes temperatures around as strings. This is fine 
> for sysfs, but makes it hard to use them for other purposes in-kernel. 
> Change them to longs and do the string conversion in the sysfs-specific 
> code.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>

Looks mostly ok to me.


> -static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
> +static int thermal_get_temp(struct thermal_zone_device *thermal, 
> +			    unsigned long *temp)

Hmm, it would be cool to create typedef unsigned long milicelsius, so
that this is self-documenting and possibly sparse-checkable.



> @@ -898,7 +899,8 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
>  	if (result)
>  		return result;
>  
> -	return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature));
> +	*temp = KELVIN_TO_MILLICELSIUS(tz->temperature);
> +	return 0;
>  }

Hmmm, if we did interface in miliKelvins, we would be able to do
-errno trick :-).


>  	if (!tz->ops->get_temp)
>  		return -EPERM;
>  
> -	return tz->ops->get_temp(tz, buf);
> +	ret = tz->ops->get_temp(tz,&temperature);

missing space after , .

> +	if (ret)
> +		return ret;
> +
> +	return sprintf(buf,"%ld\n",temperature);
>  }

More mising spaces.

> +	if (ret)
> +		return ret;
> +
> +	return sprintf (buf, "%ld\n", temperature);
>  }

And some extra spaces here: 'sprintf('.

							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2008-06-17 18:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-11 10:06 [PATCH] Clean up thermal API Matthew Garrett
2008-06-11 16:42 ` [PATCH] More cleanup of the " Matthew Garrett
2008-06-11 16:58   ` [RFC] Implement thermal limiting in generic thermal class Matthew Garrett
2008-06-12  2:25     ` Zhang Rui
2008-06-12  9:28       ` Matthew Garrett
2008-06-12  1:29   ` [PATCH] More cleanup of the thermal API Zhang Rui
2008-06-12  1:26 ` [PATCH] Clean up " Zhang Rui
2008-06-16  8:55 ` [PATCH v2] " Matthew Garrett
2008-06-16  9:26   ` [Patch v2] Implement thermal limiting in the generic thermal class Matthew Garrett
2008-06-17 18:53     ` Pavel Machek
2008-06-18  9:28       ` Zhang, Rui
2008-06-18  9:56         ` Matthew Garrett
2008-06-17 15:54 ` Pavel Machek [this message]
2008-06-17 15:59 ` [PATCH] Clean up thermal API Pavel Machek

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=20080617155448.GA4891@ucw.cz \
    --to=pavel@suse.cz \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=rui.zhang@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).