diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-01-30 07:32:31 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:31 -0500 |
commit | 8eed92605334f1cd8fd025631f6a61522746b124 (patch) | |
tree | 87fe2e938ef39db99a19dc6d7df95c4e29225d46 /arch/x86/kernel/bootflag.c | |
parent | ff3cf856120743c7386e8f6ab9f08e068886ce5c (diff) |
x86: coding style cleanup for kernel/bootflag.c
This patch eliminates checkpatch.pl complaints on bootflag.c
No code changed:
text data bss dec hex filename
321 8 0 329 149 bootflag.o.before
321 8 0 329 149 bootflag.o.after
md5:
9c1b474bcf25ddc1724a29c19880043f bootflag.o.before.asm
9c1b474bcf25ddc1724a29c19880043f bootflag.o.after.asm
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/bootflag.c')
-rw-r--r-- | arch/x86/kernel/bootflag.c | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/arch/x86/kernel/bootflag.c b/arch/x86/kernel/bootflag.c index 0b9860530a6b..30f25a75fe28 100644 --- a/arch/x86/kernel/bootflag.c +++ b/arch/x86/kernel/bootflag.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Implement 'Simple Boot Flag Specification 2.0' | 2 | * Implement 'Simple Boot Flag Specification 2.0' |
3 | */ | 3 | */ |
4 | |||
5 | |||
6 | #include <linux/types.h> | 4 | #include <linux/types.h> |
7 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
8 | #include <linux/init.h> | 6 | #include <linux/init.h> |
@@ -14,40 +12,38 @@ | |||
14 | 12 | ||
15 | #include <linux/mc146818rtc.h> | 13 | #include <linux/mc146818rtc.h> |
16 | 14 | ||
17 | |||
18 | #define SBF_RESERVED (0x78) | 15 | #define SBF_RESERVED (0x78) |
19 | #define SBF_PNPOS (1<<0) | 16 | #define SBF_PNPOS (1<<0) |
20 | #define SBF_BOOTING (1<<1) | 17 | #define SBF_BOOTING (1<<1) |
21 | #define SBF_DIAG (1<<2) | 18 | #define SBF_DIAG (1<<2) |
22 | #define SBF_PARITY (1<<7) | 19 | #define SBF_PARITY (1<<7) |
23 | 20 | ||
24 | |||
25 | int sbf_port __initdata = -1; /* set via acpi_boot_init() */ | 21 | int sbf_port __initdata = -1; /* set via acpi_boot_init() */ |
26 | 22 | ||
27 | |||
28 | static int __init parity(u8 v) | 23 | static int __init parity(u8 v) |
29 | { | 24 | { |
30 | int x = 0; | 25 | int x = 0; |
31 | int i; | 26 | int i; |
32 | 27 | ||
33 | for(i=0;i<8;i++) | 28 | for (i = 0; i < 8; i++) { |
34 | { | 29 | x ^= (v & 1); |
35 | x^=(v&1); | 30 | v >>= 1; |
36 | v>>=1; | ||
37 | } | 31 | } |
32 | |||
38 | return x; | 33 | return x; |
39 | } | 34 | } |
40 | 35 | ||
41 | static void __init sbf_write(u8 v) | 36 | static void __init sbf_write(u8 v) |
42 | { | 37 | { |
43 | unsigned long flags; | 38 | unsigned long flags; |
44 | if(sbf_port != -1) | 39 | |
45 | { | 40 | if (sbf_port != -1) { |
46 | v &= ~SBF_PARITY; | 41 | v &= ~SBF_PARITY; |
47 | if(!parity(v)) | 42 | if (!parity(v)) |
48 | v|=SBF_PARITY; | 43 | v |= SBF_PARITY; |
49 | 44 | ||
50 | printk(KERN_INFO "Simple Boot Flag at 0x%x set to 0x%x\n", sbf_port, v); | 45 | printk(KERN_INFO "Simple Boot Flag at 0x%x set to 0x%x\n", |
46 | sbf_port, v); | ||
51 | 47 | ||
52 | spin_lock_irqsave(&rtc_lock, flags); | 48 | spin_lock_irqsave(&rtc_lock, flags); |
53 | CMOS_WRITE(v, sbf_port); | 49 | CMOS_WRITE(v, sbf_port); |
@@ -57,33 +53,41 @@ static void __init sbf_write(u8 v) | |||
57 | 53 | ||
58 | static u8 __init sbf_read(void) | 54 | static u8 __init sbf_read(void) |
59 | { | 55 | { |
60 | u8 v; | ||
61 | unsigned long flags; | 56 | unsigned long flags; |
62 | if(sbf_port == -1) | 57 | u8 v; |
58 | |||
59 | if (sbf_port == -1) | ||
63 | return 0; | 60 | return 0; |
61 | |||
64 | spin_lock_irqsave(&rtc_lock, flags); | 62 | spin_lock_irqsave(&rtc_lock, flags); |
65 | v = CMOS_READ(sbf_port); | 63 | v = CMOS_READ(sbf_port); |
66 | spin_unlock_irqrestore(&rtc_lock, flags); | 64 | spin_unlock_irqrestore(&rtc_lock, flags); |
65 | |||
67 | return v; | 66 | return v; |
68 | } | 67 | } |
69 | 68 | ||
70 | static int __init sbf_value_valid(u8 v) | 69 | static int __init sbf_value_valid(u8 v) |
71 | { | 70 | { |
72 | if(v&SBF_RESERVED) /* Reserved bits */ | 71 | if (v & SBF_RESERVED) /* Reserved bits */ |
73 | return 0; | 72 | return 0; |
74 | if(!parity(v)) | 73 | if (!parity(v)) |
75 | return 0; | 74 | return 0; |
75 | |||
76 | return 1; | 76 | return 1; |
77 | } | 77 | } |
78 | 78 | ||
79 | static int __init sbf_init(void) | 79 | static int __init sbf_init(void) |
80 | { | 80 | { |
81 | u8 v; | 81 | u8 v; |
82 | if(sbf_port == -1) | 82 | |
83 | if (sbf_port == -1) | ||
83 | return 0; | 84 | return 0; |
85 | |||
84 | v = sbf_read(); | 86 | v = sbf_read(); |
85 | if(!sbf_value_valid(v)) | 87 | if (!sbf_value_valid(v)) { |
86 | printk(KERN_WARNING "Simple Boot Flag value 0x%x read from CMOS RAM was invalid\n",v); | 88 | printk(KERN_WARNING "Simple Boot Flag value 0x%x read from " |
89 | "CMOS RAM was invalid\n", v); | ||
90 | } | ||
87 | 91 | ||
88 | v &= ~SBF_RESERVED; | 92 | v &= ~SBF_RESERVED; |
89 | v &= ~SBF_BOOTING; | 93 | v &= ~SBF_BOOTING; |
@@ -92,7 +96,7 @@ static int __init sbf_init(void) | |||
92 | v |= SBF_PNPOS; | 96 | v |= SBF_PNPOS; |
93 | #endif | 97 | #endif |
94 | sbf_write(v); | 98 | sbf_write(v); |
99 | |||
95 | return 0; | 100 | return 0; |
96 | } | 101 | } |
97 | |||
98 | module_init(sbf_init); | 102 | module_init(sbf_init); |