mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Alexander Beregalov <a.beregalov@gmail.com>
Cc: linux-kernel@vger.kernel.org, mathieu.desnoyers@polymtl.ca,
	davej@redhat.com
Subject: Re: [PATCH] cpufreq: fix UP build
Date: Wed, 8 Jul 2009 11:08:12 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0907081103560.3352@localhost.localdomain> (raw)
In-Reply-To: <1247075867-11355-1-git-send-email-a.beregalov@gmail.com>



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

  reply	other threads:[~2009-07-08 18:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08 17:57 Alexander Beregalov
2009-07-08 18:08 ` Linus Torvalds [this message]
2009-07-08 18:17   ` Dave Jones
2009-07-08 20:17   ` Dave Jones
2009-07-08 18:15 ` Dave Jones

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=alpine.LFD.2.01.0907081103560.3352@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=a.beregalov@gmail.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    /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

all inboxes | Powered by JetHome®