Re: [PATCH 1/2] x86: mtrr cleanup for converting continuous to discrete layout v8

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <yhlu.kernel@...>
Cc: Andrew Morton <akpm@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Gabriel C <nix.or.die@...>, Mika Fischer <mika.fischer@...>, linux-kernel@vger.kernel.org <linux-kernel@...>
Date: Tuesday, April 29, 2008 - 9:07 am

a few minor cleanliness observations:


this should be a single:

 #ifdef CONFIG_MTRR_SANITIZER
 static int mtrr_cleanup_enabled = CONFIG_MTRR_SANITIZER_DEFAULT;
 #endif

block.


small explaination (comment) about what the limit means.


looks cleaner this way:

  static int __init
  add_range(struct res_range *range, int nr_range, unsigned long start,
            unsigned long end, int merge)


perhaps factor out the loop into a separate function and avoid the goto.


should be:

 static void __init
 subtract_range(struct res_range *range, unsigned long start,
                unsigned long end)


can be:

	int i, j;


stale newline.


should be some sort of more readable in_range() check?



s/unsigned address_bits/unsigned int address_bits/

also move range_sizek on a separate line.

plus we tend to align structures this way:


(to put the types and field names into a visually more consistent form)


should be:

 static void __init
 set_var_mtrr(unsigned int reg, unsigned long basek, unsigned long sizek,
              unsigned char type, unsigned address_bits)


s/unsigned/unsigned int

hm, will this work on 64-bit? Above-4G is controlled via separate 
mechanisms though so i guess it does.


use alignment macros instead.


put extra newline between variable definition and code.


initialization looks nicer with vertical alignment, i.e.:



the ++ is a hard to notice side-effect of the loop. It's cleaner to 
separate it out or to have a for() loop for it.


try to use a 'christmas tree' ordering of variables, i.e.:



superfluous newline.

all in one, this is a very useful and nice feature.

	Ingo
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] x86: mtrr cleanup for converting continuous to d..., Eric W. Biederman, (Tue Apr 29, 3:00 pm)
Re: [PATCH] x86: mtrr cleanup for converting continuous to d..., Eric W. Biederman, (Tue Apr 29, 4:29 pm)
Re: [PATCH] x86: mtrr cleanup for converting continuous to d..., Eric W. Biederman, (Tue Apr 29, 6:14 pm)
Re: [PATCH] x86: mtrr cleanup for converting continuous to d..., Eric W. Biederman, (Tue Apr 29, 9:16 pm)
Re: [PATCH 1/2] x86: mtrr cleanup for converting continuous ..., Ingo Molnar, (Tue Apr 29, 9:07 am)