lkml.org 
[lkml]   [2009]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cpufreq: fix UP build


On Wed, 8 Jul 2009, Alexander Beregalov wrote:
>
> From: Alexander Beregalov <a.beregalov@gmail.com>
>
> Fix this build error when CONFIG_SMP is not set:
> drivers/cpufreq/cpufreq.c:941: 'managed_policy' undeclared

Grr. DaveJ?

That said, I'd much prefer the fix that does _not_ have this crap in it
(not new to your diff - it's pre-existing crap):

> #ifdef CONFIG_SMP
> struct cpufreq_policy *managed_policy;
> + struct sys_device *cpu_sys_dev;
> #endif

and instead those variables should be declared inside the blocks where
they are used, not at the top.

The rule should always be: make the scope of a variable as small as
possible. Don't declare it at the top and try to "save" a declaration when
it can be used inside multiple blocks as multiple different variables.

Also, that whole function could damn well be split into smaller pieces,
which would make it much more readable than that horrible 250+ line piece
of crap monster-function with #ifdef's inside the code.

Please, somebody?

Linus


\
 
 \ /
  Last update: 2009-10-18 23:28    [W:0.939 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site