[PATCH 1/3] CPU frequency scaling addon

Danny Kukawka danny.kukawka at web.de
Sat Aug 12 11:33:09 PDT 2006


On Saturday 12 August 2006 10:31, Richard Hughes wrote:
> On Fri, 2006-08-11 at 19:45 +0200, Holger Macht wrote:
[...]
> Maybe I'm wrong, but I thought general hal CodingStyle was:

from HACKING:
 - Please follow the coding style already used - it's not a must, 
   but it's nice to have consistency.

... that is not a leg break ...

[...]
> > +	if (cpuload.num_cpus != -1) {
> > +		free(cpuload.last_working_time);
> > +		free(cpuload.last_total_time);
> > +		free(cpuload.load);
>
> Really minor, but isn't it HAL code style to do:
>
> free (foo);
>
> rather than,
>
> free(foo);

This also ... there are several places where both styles are used in HAL in 
the same file ...

>
> > +	GString  *speed_file = g_string_new("");
>
> Do you need to use GString here, or could you just use something like
> g_sprintf ()?

Why not? GString is also e.g. used in  hald_dbus.c

[...]
> > +static gboolean ondemand_set_performance(void *data, int performance)
> > +{
> > +	struct ondemand_interface	*iface		   = data;
> > +	GString				*up_threshold_file = g_string_new("");
> > +
> > +	g_string_printf(up_threshold_file, ONDEMAND_UP_THRESHOLD_FILE,
> > iface->base_cpu);
>
> GString?

.. again: why not ...

If code styling is the only "problem" ... great work Holger! 

Danny


More information about the hal mailing list