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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 17 Jun 2008 17:54:48 +0200
From:	Pavel Machek <pavel@...e.cz>
To:	Matthew Garrett <mjg59@...f.ucam.org>
Cc:	rui.zhang@...el.com, linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Clean up thermal API

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@...hat.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
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ