]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
MIPS: Loongson: clean up the coding style
authorWu Zhangjin <wuzj@lemote.com>
Thu, 2 Jul 2009 15:23:03 +0000 (23:23 +0800)
committerRalf Baechle <ralf@linux-mips.org>
Thu, 17 Sep 2009 18:07:46 +0000 (20:07 +0200)
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>
14 files changed:
arch/mips/include/asm/mach-lemote/loongson.h [new file with mode: 0644]
arch/mips/include/asm/mach-lemote/pci.h
arch/mips/lemote/lm2e/bonito-irq.c
arch/mips/lemote/lm2e/cmdline.c
arch/mips/lemote/lm2e/early_printk.c
arch/mips/lemote/lm2e/env.c
arch/mips/lemote/lm2e/init.c
arch/mips/lemote/lm2e/irq.c
arch/mips/lemote/lm2e/mem.c
arch/mips/lemote/lm2e/pci.c
arch/mips/lemote/lm2e/reset.c [deleted file]
arch/mips/lemote/lm2e/setup.c
arch/mips/lemote/lm2e/time.c
arch/mips/pci/fixup-lm2e.c

diff --git a/arch/mips/include/asm/mach-lemote/loongson.h b/arch/mips/include/asm/mach-lemote/loongson.h
new file mode 100644 (file)
index 0000000..76cc2bd
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
+ * Author: Wu Zhangjin <wuzj@lemote.com>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __ASM_MACH_LOONGSON_LOONGSON_H
+#define __ASM_MACH_LOONGSON_LOONGSON_H
+
+#include <linux/io.h>
+#include <linux/init.h>
+
+/* there is an internal bonito64-compatiable northbridge in loongson2e/2f */
+#include <asm/mips-boards/bonito64.h>
+
+/* loongson internal northbridge initialization */
+extern void bonito_irq_init(void);
+
+/* loongson-based machines specific reboot setup */
+extern void mips_reboot_setup(void);
+
+/* environment arguments from bootloader */
+extern unsigned long bus_clock, cpu_clock_freq;
+extern unsigned long memsize, highmemsize;
+
+/* loongson-specific command line, env and memory initialization */
+extern void __init prom_init_memory(void);
+extern void __init prom_init_cmdline(void);
+extern void __init prom_init_env(void);
+
+#endif /* __ASM_MACH_LOONGSON_LOONGSON_H */
index 0307e4935267aeb34dc8a3e715001f791fad39fb..92b2f59d890f735abe6bbfaf4bd985a27b41c0b2 100644 (file)
  * 02139, USA.
  */
 
-#ifndef _LEMOTE_PCI_H_
-#define _LEMOTE_PCI_H_
+#ifndef __ASM_MACH_LEMOTE_PCI_H_
+#define __ASM_MACH_LEMOTE_PCI_H_
+
+extern struct pci_ops bonito64_pci_ops;
 
 #define LOONGSON2E_PCI_MEM_START       0x14000000UL
 #define LOONGSON2E_PCI_MEM_END         0x1fffffffUL
 #define LOONGSON2E_PCI_IO_START                0x00004000UL
 
-#endif /* !_LEMOTE_PCI_H_ */
+#endif /* !__ASM_MACH_LEMOTE_PCI_H_ */
index 8fc3bce7075b1e628de8a8890b89d0421ebe9531..3e31e7ad713e2b4eccbf580c89ecf6715f353a78 100644 (file)
  *  under  the terms of  the GNU General  Public License as published by the
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/types.h>
 #include <linux/interrupt.h>
-#include <linux/irq.h>
-
-#include <asm/mips-boards/bonito64.h>
 
+#include <loongson.h>
 
 static inline void bonito_irq_enable(unsigned int irq)
 {
@@ -66,9 +44,8 @@ void bonito_irq_init(void)
 {
        u32 i;
 
-       for (i = BONITO_IRQ_BASE; i < BONITO_IRQ_BASE + 32; i++) {
+       for (i = BONITO_IRQ_BASE; i < BONITO_IRQ_BASE + 32; i++)
                set_irq_chip_and_handler(i, &bonito_irq_type, handle_level_irq);
-       }
 
        setup_irq(BONITO_IRQ_BASE + 10, &dma_timeout_irqaction);
 }
index 442b93587e861438e2bf7d7e328f6bbcc290247a..75f1b243ee4e4c6cb0aa0faf104159714effc821 100644 (file)
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
-#include <linux/io.h>
-#include <linux/init.h>
-
 #include <asm/bootinfo.h>
 
+#include <loongson.h>
+
 int prom_argc;
 /* pmon passes arguments in 32bit pointers */
 int *_prom_argv;
index 811c7dec1edd9de80cac25ed0583d4758beb1663..3e0a6eaa404140846b0b847e12df4e773a9a7793 100644 (file)
@@ -9,11 +9,9 @@
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
-#include <linux/io.h>
-#include <linux/init.h>
 #include <linux/serial_reg.h>
 
-#include <asm/mips-boards/bonito64.h>
+#include <loongson.h>
 
 #define UART_BASE (BONITO_PCIIO_BASE + 0x3f8)
 
index 9e88409f7a3aa6e976a9660dfbe78241552015b9..b9ef50385541a42545a83e9caf62a464f9b8b81d 100644 (file)
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
-
-#include <linux/io.h>
-#include <linux/init.h>
-
 #include <asm/bootinfo.h>
 
+#include <loongson.h>
+
 unsigned long bus_clock, cpu_clock_freq;
 unsigned long memsize, highmemsize;
 
index 6fe624d697ed5f941093d732d0262dae0f7e525a..3abe927422a3acfe3fea5c07030b5ed1e0c86cf8 100644 (file)
@@ -8,15 +8,11 @@
  * option) any later version.
  */
 
-#include <linux/init.h>
 #include <linux/bootmem.h>
 
 #include <asm/bootinfo.h>
-#include <asm/mips-boards/bonito64.h>
 
-extern void __init prom_init_cmdline(void);
-extern void __init prom_init_env(void);
-extern void __init prom_init_memory(void);
+#include <loongson.h>
 
 void __init prom_init(void)
 {
index 1d0a09f3b832a69d4617f37222209fc1a569cc0b..fb7643a25618ee7c57968277ab10e26bd2ae7a40 100644 (file)
@@ -6,35 +6,14 @@
  *  under  the terms of  the GNU General  Public License as published by the
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
 #include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
-#include <linux/irq.h>
 
 #include <asm/irq_cpu.h>
 #include <asm/i8259.h>
-#include <asm/mipsregs.h>
-#include <asm/mips-boards/bonito64.h>
-
 
+#include <loongson.h>
 /*
  * the first level int-handler will jump here if it is a bonito irq
  */
@@ -67,27 +46,24 @@ static void i8259_irqdispatch(void)
        int irq;
 
        irq = i8259_irq();
-       if (irq >= 0) {
+       if (irq >= 0)
                do_IRQ(irq);
-       } else {
+       else
                spurious_interrupt();
-       }
-
 }
 
 asmlinkage void plat_irq_dispatch(void)
 {
        unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
 
-       if (pending & CAUSEF_IP7) {
+       if (pending & CAUSEF_IP7)
                do_IRQ(MIPS_CPU_IRQ_BASE + 7);
-       } else if (pending & CAUSEF_IP5) {
+       else if (pending & CAUSEF_IP5)
                i8259_irqdispatch();
-       } else if (pending & CAUSEF_IP2) {
+       else if (pending & CAUSEF_IP2)
                bonito_irqdispatch();
-       } else {
+       else
                spurious_interrupt();
-       }
 }
 
 static struct irqaction cascade_irqaction = {
@@ -97,8 +73,6 @@ static struct irqaction cascade_irqaction = {
 
 void __init arch_init_irq(void)
 {
-       extern void bonito_irq_init(void);
-
        /*
         * Clear all of the interrupts while we change the able around a bit.
         * int-handler is not on bootstrap
@@ -128,16 +102,8 @@ void __init arch_init_irq(void)
        init_i8259_irqs();
        bonito_irq_init();
 
-       /*
-       printk("GPIODATA=%x, GPIOIE=%x\n", BONITO_GPIODATA, BONITO_GPIOIE);
-       printk("INTEN=%x, INTSET=%x, INTCLR=%x, INTISR=%x\n",
-                       BONITO_INTEN, BONITO_INTENSET,
-                       BONITO_INTENCLR, BONITO_INTISR);
-       */
-
        /* bonito irq at IP2 */
        setup_irq(MIPS_CPU_IRQ_BASE + 2, &cascade_irqaction);
        /* 8259 irq at IP5 */
        setup_irq(MIPS_CPU_IRQ_BASE + 5, &cascade_irqaction);
-
 }
index f24af70b669bc19197da7b018052fcaf4d51fa73..6a7feb178fa52624ffea8410bab6e0408219981f 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <asm/bootinfo.h>
 
-extern unsigned long memsize, highmemsize;
+#include <loongson.h>
 
 void __init prom_init_memory(void)
 {
index 152efb65bba1f87c2278be47df60fdfad77dee45..bee846e6d8a88708c4ab4d5c8ff98ef26bd7b46c 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * pci.c
- *
  * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
  * Author: Fuxin Zhang, zhangfx@lemote.com
  *
@@ -8,31 +6,11 @@
  *  under  the terms of  the GNU General  Public License as published by the
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
-#include <linux/types.h>
 #include <linux/pci.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <asm/mips-boards/bonito64.h>
-#include <asm/mach-lemote/pci.h>
 
-extern struct pci_ops bonito64_pci_ops;
+#include <pci.h>
+#include <loongson.h>
 
 static struct resource loongson2e_pci_mem_resource = {
        .name   = "LOONGSON2E PCI MEM",
diff --git a/arch/mips/lemote/lm2e/reset.c b/arch/mips/lemote/lm2e/reset.c
deleted file mode 100644 (file)
index 0faa140..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
- * Author: Fuxin Zhang, zhangfx@lemote.com
- * Copyright (C) 2009 Lemote, Inc. & Institute of Computing Technology
- * Author: Zhangjin Wu, wuzj@lemote.com
- */
-#include <linux/init.h>
-#include <linux/pm.h>
-#include <linux/io.h>
-
-#include <asm/reboot.h>
-#include <asm/mips-boards/bonito64.h>
-
-static void loongson2e_restart(char *command)
-{
-       /* do preparation for reboot */
-       BONITO_BONGENCFG &= ~(1 << 2);
-       BONITO_BONGENCFG |= (1 << 2);
-
-       /* reboot via jumping to boot base address */
-       ((void (*)(void))ioremap_nocache(BONITO_BOOT_BASE, 4)) ();
-}
-
-static void loongson2e_halt(void)
-{
-       while (1) ;
-}
-
-static int __init mips_reboot_setup(void)
-{
-       _machine_restart = loongson2e_restart;
-       _machine_halt = loongson2e_halt;
-       pm_power_off = loongson2e_halt;
-
-       return 0;
-}
-
-arch_initcall(mips_reboot_setup);
index 03578cf0ee7ea8437ab2f3ec2255b2f06584f920..66390215973048286d3d84fdbbbae6955723446a 100644 (file)
@@ -1,7 +1,4 @@
 /*
- * BRIEF MODULE DESCRIPTION
- * setup.c - board dependent boot routines
- *
  * Copyright (C) 2007 Lemote Inc. & Insititute of Computing Technology
  * Author: Fuxin Zhang, zhangfx@lemote.com
  *
@@ -9,28 +6,13 @@
  *  under  the terms of  the GNU General  Public License as published by the
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
-#include <linux/init.h>
 #include <linux/module.h>
 
 #include <asm/wbflush.h>
 
+#include <loongson.h>
+
 #ifdef CONFIG_VT
 #include <linux/console.h>
 #include <linux/screen_info.h>
index b9d3f11b6203fc0a25a60cb034be194415dc4bb8..b13d171746546c2b23a22e4b972c4a9d0d52e38f 100644 (file)
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
  */
-
-#include <linux/init.h>
-
 #include <asm/mc146818-time.h>
 #include <asm/time.h>
 
-extern unsigned long cpu_clock_freq;
+#include <loongson.h>
 
 void __init plat_time_init(void)
 {
index e18ae4f574c11131d36e705868e6dc8efd2b2900..0c4c7a81213f81b01dc24ac924320174a0064fa2 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * fixup-lm2e.c
- *
  * Copyright (C) 2004 ICT CAS
  * Author: Li xiaoyu, ICT CAS
  *   lixy@ict.ac.cn
  *  under  the terms of  the GNU General  Public License as published by the
  *  Free Software Foundation;  either version 2 of the  License, or (at your
  *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
 #include <linux/init.h>
 #include <linux/pci.h>