Commit 5e983ff654ca3df3007b5b558b5271bb4622afa4

Authored by Wu Zhangjin
Committed by Ralf Baechle
1 parent bd92aa013e

MIPS: Loongson: clean up the coding style

With the help of script/checkpatch.pl, i have cleaned up the coding
style.

1. remove un-needed header files and tune some comments.
2. remove some un-needed { }

add a new header file loongson.h:

3. move some common header files to loongson.h
4. move some common extern declartions to loongson.h

and this new header file is needed for future loongson2f support.

Signed-off-by: Wu Zhangjin <wuzj@lemote.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

Showing 14 changed files with 62 additions and 194 deletions Side-by-side Diff

arch/mips/include/asm/mach-lemote/loongson.h
  1 +/*
  2 + * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
  3 + * Author: Wu Zhangjin <wuzj@lemote.com>
  4 + *
  5 + * This program is free software; you can redistribute it and/or modify it
  6 + * under the terms of the GNU General Public License as published by the
  7 + * Free Software Foundation; either version 2 of the License, or (at your
  8 + * option) any later version.
  9 + *
  10 + */
  11 +
  12 +#ifndef __ASM_MACH_LOONGSON_LOONGSON_H
  13 +#define __ASM_MACH_LOONGSON_LOONGSON_H
  14 +
  15 +#include <linux/io.h>
  16 +#include <linux/init.h>
  17 +
  18 +/* there is an internal bonito64-compatiable northbridge in loongson2e/2f */
  19 +#include <asm/mips-boards/bonito64.h>
  20 +
  21 +/* loongson internal northbridge initialization */
  22 +extern void bonito_irq_init(void);
  23 +
  24 +/* loongson-based machines specific reboot setup */
  25 +extern void mips_reboot_setup(void);
  26 +
  27 +/* environment arguments from bootloader */
  28 +extern unsigned long bus_clock, cpu_clock_freq;
  29 +extern unsigned long memsize, highmemsize;
  30 +
  31 +/* loongson-specific command line, env and memory initialization */
  32 +extern void __init prom_init_memory(void);
  33 +extern void __init prom_init_cmdline(void);
  34 +extern void __init prom_init_env(void);
  35 +
  36 +#endif /* __ASM_MACH_LOONGSON_LOONGSON_H */
arch/mips/include/asm/mach-lemote/pci.h
... ... @@ -19,12 +19,14 @@
19 19 * 02139, USA.
20 20 */
21 21  
22   -#ifndef _LEMOTE_PCI_H_
23   -#define _LEMOTE_PCI_H_
  22 +#ifndef __ASM_MACH_LEMOTE_PCI_H_
  23 +#define __ASM_MACH_LEMOTE_PCI_H_
24 24  
  25 +extern struct pci_ops bonito64_pci_ops;
  26 +
25 27 #define LOONGSON2E_PCI_MEM_START 0x14000000UL
26 28 #define LOONGSON2E_PCI_MEM_END 0x1fffffffUL
27 29 #define LOONGSON2E_PCI_IO_START 0x00004000UL
28 30  
29   -#endif /* !_LEMOTE_PCI_H_ */
  31 +#endif /* !__ASM_MACH_LEMOTE_PCI_H_ */
arch/mips/lemote/lm2e/bonito-irq.c
... ... @@ -10,33 +10,11 @@
10 10 * under the terms of the GNU General Public License as published by the
11 11 * Free Software Foundation; either version 2 of the License, or (at your
12 12 * option) any later version.
13   - *
14   - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15   - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16   - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17   - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18   - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19   - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20   - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21   - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22   - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23   - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24   - *
25   - * You should have received a copy of the GNU General Public License along
26   - * with this program; if not, write to the Free Software Foundation, Inc.,
27   - * 675 Mass Ave, Cambridge, MA 02139, USA.
28   - *
29 13 */
30   -#include <linux/errno.h>
31   -#include <linux/init.h>
32   -#include <linux/io.h>
33   -#include <linux/types.h>
34 14 #include <linux/interrupt.h>
35   -#include <linux/irq.h>
36 15  
37   -#include <asm/mips-boards/bonito64.h>
  16 +#include <loongson.h>
38 17  
39   -
40 18 static inline void bonito_irq_enable(unsigned int irq)
41 19 {
42 20 BONITO_INTENSET = (1 << (irq - BONITO_IRQ_BASE));
43 21  
... ... @@ -66,9 +44,8 @@
66 44 {
67 45 u32 i;
68 46  
69   - for (i = BONITO_IRQ_BASE; i < BONITO_IRQ_BASE + 32; i++) {
  47 + for (i = BONITO_IRQ_BASE; i < BONITO_IRQ_BASE + 32; i++)
70 48 set_irq_chip_and_handler(i, &bonito_irq_type, handle_level_irq);
71   - }
72 49  
73 50 setup_irq(BONITO_IRQ_BASE + 10, &dma_timeout_irqaction);
74 51 }
arch/mips/lemote/lm2e/cmdline.c
... ... @@ -17,10 +17,9 @@
17 17 * Free Software Foundation; either version 2 of the License, or (at your
18 18 * option) any later version.
19 19 */
20   -#include <linux/io.h>
21   -#include <linux/init.h>
22   -
23 20 #include <asm/bootinfo.h>
  21 +
  22 +#include <loongson.h>
24 23  
25 24 int prom_argc;
26 25 /* pmon passes arguments in 32bit pointers */
arch/mips/lemote/lm2e/early_printk.c
... ... @@ -9,11 +9,9 @@
9 9 * Free Software Foundation; either version 2 of the License, or (at your
10 10 * option) any later version.
11 11 */
12   -#include <linux/io.h>
13   -#include <linux/init.h>
14 12 #include <linux/serial_reg.h>
15 13  
16   -#include <asm/mips-boards/bonito64.h>
  14 +#include <loongson.h>
17 15  
18 16 #define UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
19 17  
arch/mips/lemote/lm2e/env.c
... ... @@ -17,11 +17,9 @@
17 17 * Free Software Foundation; either version 2 of the License, or (at your
18 18 * option) any later version.
19 19 */
20   -
21   -#include <linux/io.h>
22   -#include <linux/init.h>
23   -
24 20 #include <asm/bootinfo.h>
  21 +
  22 +#include <loongson.h>
25 23  
26 24 unsigned long bus_clock, cpu_clock_freq;
27 25 unsigned long memsize, highmemsize;
arch/mips/lemote/lm2e/init.c
... ... @@ -8,15 +8,11 @@
8 8 * option) any later version.
9 9 */
10 10  
11   -#include <linux/init.h>
12 11 #include <linux/bootmem.h>
13 12  
14 13 #include <asm/bootinfo.h>
15   -#include <asm/mips-boards/bonito64.h>
16 14  
17   -extern void __init prom_init_cmdline(void);
18   -extern void __init prom_init_env(void);
19   -extern void __init prom_init_memory(void);
  15 +#include <loongson.h>
20 16  
21 17 void __init prom_init(void)
22 18 {
arch/mips/lemote/lm2e/irq.c
... ... @@ -6,35 +6,14 @@
6 6 * under the terms of the GNU General Public License as published by the
7 7 * Free Software Foundation; either version 2 of the License, or (at your
8 8 * option) any later version.
9   - *
10   - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11   - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12   - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13   - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14   - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15   - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16   - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17   - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18   - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19   - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20   - *
21   - * You should have received a copy of the GNU General Public License along
22   - * with this program; if not, write to the Free Software Foundation, Inc.,
23   - * 675 Mass Ave, Cambridge, MA 02139, USA.
24   - *
25 9 */
26 10 #include <linux/delay.h>
27   -#include <linux/io.h>
28   -#include <linux/init.h>
29 11 #include <linux/interrupt.h>
30   -#include <linux/irq.h>
31 12  
32 13 #include <asm/irq_cpu.h>
33 14 #include <asm/i8259.h>
34   -#include <asm/mipsregs.h>
35   -#include <asm/mips-boards/bonito64.h>
36 15  
37   -
  16 +#include <loongson.h>
38 17 /*
39 18 * the first level int-handler will jump here if it is a bonito irq
40 19 */
41 20  
42 21  
43 22  
44 23  
45 24  
46 25  
47 26  
... ... @@ -67,27 +46,24 @@
67 46 int irq;
68 47  
69 48 irq = i8259_irq();
70   - if (irq >= 0) {
  49 + if (irq >= 0)
71 50 do_IRQ(irq);
72   - } else {
  51 + else
73 52 spurious_interrupt();
74   - }
75   -
76 53 }
77 54  
78 55 asmlinkage void plat_irq_dispatch(void)
79 56 {
80 57 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
81 58  
82   - if (pending & CAUSEF_IP7) {
  59 + if (pending & CAUSEF_IP7)
83 60 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
84   - } else if (pending & CAUSEF_IP5) {
  61 + else if (pending & CAUSEF_IP5)
85 62 i8259_irqdispatch();
86   - } else if (pending & CAUSEF_IP2) {
  63 + else if (pending & CAUSEF_IP2)
87 64 bonito_irqdispatch();
88   - } else {
  65 + else
89 66 spurious_interrupt();
90   - }
91 67 }
92 68  
93 69 static struct irqaction cascade_irqaction = {
... ... @@ -97,8 +73,6 @@
97 73  
98 74 void __init arch_init_irq(void)
99 75 {
100   - extern void bonito_irq_init(void);
101   -
102 76 /*
103 77 * Clear all of the interrupts while we change the able around a bit.
104 78 * int-handler is not on bootstrap
105 79  
... ... @@ -128,17 +102,9 @@
128 102 init_i8259_irqs();
129 103 bonito_irq_init();
130 104  
131   - /*
132   - printk("GPIODATA=%x, GPIOIE=%x\n", BONITO_GPIODATA, BONITO_GPIOIE);
133   - printk("INTEN=%x, INTSET=%x, INTCLR=%x, INTISR=%x\n",
134   - BONITO_INTEN, BONITO_INTENSET,
135   - BONITO_INTENCLR, BONITO_INTISR);
136   - */
137   -
138 105 /* bonito irq at IP2 */
139 106 setup_irq(MIPS_CPU_IRQ_BASE + 2, &cascade_irqaction);
140 107 /* 8259 irq at IP5 */
141 108 setup_irq(MIPS_CPU_IRQ_BASE + 5, &cascade_irqaction);
142   -
143 109 }
arch/mips/lemote/lm2e/mem.c
... ... @@ -10,7 +10,7 @@
10 10  
11 11 #include <asm/bootinfo.h>
12 12  
13   -extern unsigned long memsize, highmemsize;
  13 +#include <loongson.h>
14 14  
15 15 void __init prom_init_memory(void)
16 16 {
arch/mips/lemote/lm2e/pci.c
1 1 /*
2   - * pci.c
3   - *
4 2 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
5 3 * Author: Fuxin Zhang, zhangfx@lemote.com
6 4 *
7 5  
8 6  
9 7  
... ... @@ -8,31 +6,11 @@
8 6 * under the terms of the GNU General Public License as published by the
9 7 * Free Software Foundation; either version 2 of the License, or (at your
10 8 * option) any later version.
11   - *
12   - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13   - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14   - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15   - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16   - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17   - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18   - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19   - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20   - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21   - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22   - *
23   - * You should have received a copy of the GNU General Public License along
24   - * with this program; if not, write to the Free Software Foundation, Inc.,
25   - * 675 Mass Ave, Cambridge, MA 02139, USA.
26   - *
27 9 */
28   -#include <linux/types.h>
29 10 #include <linux/pci.h>
30   -#include <linux/kernel.h>
31   -#include <linux/init.h>
32   -#include <asm/mips-boards/bonito64.h>
33   -#include <asm/mach-lemote/pci.h>
34 11  
35   -extern struct pci_ops bonito64_pci_ops;
  12 +#include <pci.h>
  13 +#include <loongson.h>
36 14  
37 15 static struct resource loongson2e_pci_mem_resource = {
38 16 .name = "LOONGSON2E PCI MEM",
arch/mips/lemote/lm2e/reset.c
1   -/*
2   - * This program is free software; you can redistribute it and/or modify it
3   - * under the terms of the GNU General Public License as published by the
4   - * Free Software Foundation; either version 2 of the License, or (at your
5   - * option) any later version.
6   - *
7   - * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8   - * Author: Fuxin Zhang, zhangfx@lemote.com
9   - * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
10   - * Author: Zhangjin Wu, wuzj@lemote.com
11   - */
12   -#include <linux/init.h>
13   -#include <linux/pm.h>
14   -#include <linux/io.h>
15   -
16   -#include <asm/reboot.h>
17   -#include <asm/mips-boards/bonito64.h>
18   -
19   -static void loongson2e_restart(char *command)
20   -{
21   - /* do preparation for reboot */
22   - BONITO_BONGENCFG &= ~(1 << 2);
23   - BONITO_BONGENCFG |= (1 << 2);
24   -
25   - /* reboot via jumping to boot base address */
26   - ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
27   -}
28   -
29   -static void loongson2e_halt(void)
30   -{
31   - while (1) ;
32   -}
33   -
34   -static int __init mips_reboot_setup(void)
35   -{
36   - _machine_restart = loongson2e_restart;
37   - _machine_halt = loongson2e_halt;
38   - pm_power_off = loongson2e_halt;
39   -
40   - return 0;
41   -}
42   -
43   -arch_initcall(mips_reboot_setup);
arch/mips/lemote/lm2e/setup.c
1 1 /*
2   - * BRIEF MODULE DESCRIPTION
3   - * setup.c - board dependent boot routines
4   - *
5 2 * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
6 3 * Author: Fuxin Zhang, zhangfx@lemote.com
7 4 *
8 5  
9 6  
... ... @@ -9,27 +6,12 @@
9 6 * under the terms of the GNU General Public License as published by the
10 7 * Free Software Foundation; either version 2 of the License, or (at your
11 8 * option) any later version.
12   - *
13   - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14   - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15   - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16   - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17   - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18   - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19   - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20   - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21   - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22   - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23   - *
24   - * You should have received a copy of the GNU General Public License along
25   - * with this program; if not, write to the Free Software Foundation, Inc.,
26   - * 675 Mass Ave, Cambridge, MA 02139, USA.
27   - *
28 9 */
29   -#include <linux/init.h>
30 10 #include <linux/module.h>
31 11  
32 12 #include <asm/wbflush.h>
  13 +
  14 +#include <loongson.h>
33 15  
34 16 #ifdef CONFIG_VT
35 17 #include <linux/console.h>
arch/mips/lemote/lm2e/time.c
... ... @@ -10,13 +10,10 @@
10 10 * Free Software Foundation; either version 2 of the License, or (at your
11 11 * option) any later version.
12 12 */
13   -
14   -#include <linux/init.h>
15   -
16 13 #include <asm/mc146818-time.h>
17 14 #include <asm/time.h>
18 15  
19   -extern unsigned long cpu_clock_freq;
  16 +#include <loongson.h>
20 17  
21 18 void __init plat_time_init(void)
22 19 {
arch/mips/pci/fixup-lm2e.c
1 1 /*
2   - * fixup-lm2e.c
3   - *
4 2 * Copyright (C) 2004 ICT CAS
5 3 * Author: Li xiaoyu, ICT CAS
6 4 * lixy@ict.ac.cn
... ... @@ -12,22 +10,6 @@
12 10 * under the terms of the GNU General Public License as published by the
13 11 * Free Software Foundation; either version 2 of the License, or (at your
14 12 * option) any later version.
15   - *
16   - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17   - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18   - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19   - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20   - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21   - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22   - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23   - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24   - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25   - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26   - *
27   - * You should have received a copy of the GNU General Public License along
28   - * with this program; if not, write to the Free Software Foundation, Inc.,
29   - * 675 Mass Ave, Cambridge, MA 02139, USA.
30   - *
31 13 */
32 14 #include <linux/init.h>
33 15 #include <linux/pci.h>