Skip to contentSkip to conversation

x86: Cosmetic cleanup

PATCH Superseded Graeme Russ 1 participant 18 messages Nov 6, 2011 – Nov 12, 2011 x86

lore
Share & tools
lore
#0 lore raw

cover x86: Cosmetic cleanup

Mostly cosmetic (first patch is slight tweak that has no real functional impact) fixes to the x86 arch. I've included checkpatch outputs for each of the pure cosmetic patches (patches 2 through 5)

Graeme Russ (5):
x86: Call hang() on unrecoverable exception
cosmetic: checkpatch cleanup arch/x86/cpu/*.c
cosmetic: checkpatch cleanup arch/x86/cpu/sc520/*.c
cosmetic: checkpatch cleanup of arch/x86/lib/*.c
cosmetic: checkpatch cleanup of board/eNET/*.c

 arch/x86/cpu/cpu.c               |   22 ++++----
 arch/x86/cpu/interrupts.c        |   49 ++++++++--------
 arch/x86/cpu/sc520/sc520.c       |    2 +-
 arch/x86/cpu/sc520/sc520_pci.c   |   16 +++---
 arch/x86/cpu/sc520/sc520_ssi.c   |   43 +++++++-------
 arch/x86/cpu/sc520/sc520_timer.c |    4 +-
 arch/x86/lib/bios_setup.c        |   50 +++++++---------
 arch/x86/lib/board.c             |   85 ++++++++++++---------------
 arch/x86/lib/bootm.c             |   23 ++++----
 arch/x86/lib/interrupts.c        |   20 +++---
 arch/x86/lib/pcat_interrupts.c   |    2 +-
 arch/x86/lib/pcat_timer.c        |   37 ++++++------
 arch/x86/lib/pci.c               |   63 ++++++++++---------
 arch/x86/lib/pci_type1.c         |    6 +-
 arch/x86/lib/realmode.c          |   16 +++---
 arch/x86/lib/timer.c             |   16 +++---
 arch/x86/lib/video.c             |    6 +-
 arch/x86/lib/video_bios.c        |  122 +++++++++++++++++++++++---------------
 arch/x86/lib/zimage.c            |   73 ++++++++++++-----------
 board/eNET/eNET.c                |    8 +-
 board/eNET/eNET_pci.c            |   19 +++---
 21 files changed, 349 insertions(+), 333 deletions(-)

--
1.7.5.2.317.g391b14

#1 lore raw

PATCH 1/5 x86: Call hang() on unrecoverable exception

---
 arch/x86/cpu/interrupts.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
arch/x86/cpu/interrupts.c +10 -10
index c6e72ea..89f39d2 100644
@@ -255,7 +255,7 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x00:
 		printf("Divide Error (Division by zero)\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x01:
 		printf("Debug Interrupt (Single step)\n");
@@ -272,32 +272,32 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x04:
 		printf("Overflow\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x05:
 		printf("BOUND Range Exceeded\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x06:
 		printf("Invalid Opcode (UnDefined Opcode)\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x07:
 		printf("Device Not Available (No Math Coprocessor)\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x08:
 		printf("Double fault\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x09:
 		printf("Co-processor segment overrun\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0a:
 		printf("Invalid TSS\n");
@@ -306,12 +306,12 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x0b:
 		printf("Segment Not Present\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0c:
 		printf("Stack Segment Fault\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0d:
 		printf("General Protection\n");
@@ -320,7 +320,7 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x0e:
 		printf("Page fault\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0f:
 		printf("Floating-Point Error (Math Fault)\n");

--
1.7.5.2.317.g391b14

#4 lore raw

PATCH 2/5 cosmetic: checkpatch cleanup arch/x86/cpu/*.c

In reply to Graeme Russ

---
./checkpatch.pl --no-tree -f arch/x86/cpu/*.c
total: 0 errors, 0 warnings, 157 lines checked

arch/x86/cpu/cpu.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 675 lines checked

arch/x86/cpu/interrupts.c has no obvious style problems and is ready for submission.

 arch/x86/cpu/cpu.c        |   22 +++++++++++-----------
 arch/x86/cpu/interrupts.c |   29 +++++++++++++++--------------
 2 files changed, 26 insertions(+), 25 deletions(-)
arch/x86/cpu/cpu.c +11 -11
index cac12c0..48d2f7a 100644
@@ -52,7 +52,7 @@
 struct gdt_ptr {
 	u16 len;
 	u32 ptr;
-} __attribute__((packed));
+} __packed;
 
 static void reload_gdt(void)
 {
@@ -115,14 +115,14 @@ int x86_cpu_init_r(void)
 	reload_gdt();
 
 	/* Initialize core interrupt and exception functionality of CPU */
-	cpu_init_interrupts ();
+	cpu_init_interrupts();
 	return 0;
 }
 int cpu_init_r(void) __attribute__((weak, alias("x86_cpu_init_r")));
 
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	printf ("resetting ...\n");
+	printf("resetting ...\n");
 
 	/* wait 50 ms */
 	udelay(50000);
@@ -133,7 +133,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
-void  flush_cache (unsigned long dummy1, unsigned long dummy2)
+void  flush_cache(unsigned long dummy1, unsigned long dummy2)
 {
 	asm("wbinvd\n");
 }
@@ -142,16 +142,16 @@ void __attribute__ ((regparm(0))) generate_gpf(void);
 
 /* segment 0x70 is an arbitrary segment which does not exist */
 asm(".globl generate_gpf\n"
-    ".hidden generate_gpf\n"
-    ".type generate_gpf, @function\n"
-    "generate_gpf:\n"
-    "ljmp   $0x70, $0x47114711\n");
+	".hidden generate_gpf\n"
+	".type generate_gpf, @function\n"
+	"generate_gpf:\n"
+	"ljmp   $0x70, $0x47114711\n");
 
 void __reset_cpu(ulong addr)
 {
 	printf("Resetting using x86 Triple Fault\n");
-	set_vector(13, generate_gpf);  /* general protection fault handler */
-	set_vector(8, generate_gpf);   /* double fault handler */
-	generate_gpf();                /* start the show */
+	set_vector(13, generate_gpf);	/* general protection fault handler */
+	set_vector(8, generate_gpf);	/* double fault handler */
+	generate_gpf();			/* start the show */
 }
 void reset_cpu(ulong addr) __attribute__((weak, alias("__reset_cpu")));
arch/x86/cpu/interrupts.c +15 -14
index 89f39d2..07e945c 100644
@@ -83,22 +83,22 @@ static inline unsigned long get_debugreg(int regno)
 
 	switch (regno) {
 	case 0:
-		asm("mov %%db0, %0" :"=r" (val));
+		asm("mov %%db0, %0" : "=r" (val));
 		break;
 	case 1:
-		asm("mov %%db1, %0" :"=r" (val));
+		asm("mov %%db1, %0" : "=r" (val));
 		break;
 	case 2:
-		asm("mov %%db2, %0" :"=r" (val));
+		asm("mov %%db2, %0" : "=r" (val));
 		break;
 	case 3:
-		asm("mov %%db3, %0" :"=r" (val));
+		asm("mov %%db3, %0" : "=r" (val));
 		break;
 	case 6:
-		asm("mov %%db6, %0" :"=r" (val));
+		asm("mov %%db6, %0" : "=r" (val));
 		break;
 	case 7:
-		asm("mov %%db7, %0" :"=r" (val));
+		asm("mov %%db7, %0" : "=r" (val));
 		break;
 	default:
 		val = 0;
@@ -120,7 +120,8 @@ void dump_regs(struct irq_regs *regs)
 	printf("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
 		regs->esi, regs->edi, regs->ebp, regs->esp);
 	printf(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
-	       (u16)regs->xds, (u16)regs->xes, (u16)regs->xfs, (u16)regs->xgs, (u16)regs->xss);
+	       (u16)regs->xds, (u16)regs->xes, (u16)regs->xfs,
+	       (u16)regs->xgs, (u16)regs->xss);
 
 	cr0 = read_cr0();
 	cr2 = read_cr2();
@@ -164,13 +165,13 @@ struct idt_entry {
 	u8	res;
 	u8	access;
 	u16	base_high;
-} __attribute__ ((packed));
+} __packed;
 
 struct desc_ptr {
 	unsigned short size;
 	unsigned long address;
 	unsigned short segment;
-} __attribute__((packed));
+} __packed;
 
 struct idt_entry idt[256];
 
@@ -178,7 +179,7 @@ struct desc_ptr idt_ptr;
 
 static inline void load_idt(const struct desc_ptr *dtr)
 {
-	asm volatile("cs lidt %0"::"m" (*dtr));
+	asm volatile("cs lidt %0" : : "m" (*dtr));
 }
 
 void set_vector(u8 intnum, void *routine)
@@ -187,8 +188,8 @@ void set_vector(u8 intnum, void *routine)
 	idt[intnum].base_low = (u16)((u32)(routine) & 0xffff);
 }
 
-void irq_0(void);
-void irq_1(void);
+static void irq_0(void);
+static void irq_1(void);
 
 int cpu_init_interrupts(void)
 {
@@ -201,7 +202,7 @@ int cpu_init_interrupts(void)
 	disable_interrupts();
 
 	/* Setup the IDT */
-	for (i=0;i<256;i++) {
+	for (i = 0; i < 256; i++) {
 		idt[i].access = 0x8e;
 		idt[i].res = 0;
 		idt[i].selector = 0x10;
@@ -238,7 +239,7 @@ int disable_interrupts(void)
 
 	asm volatile ("pushfl ; popl %0 ; cli\n" : "=g" (flags) : );
 
-	return flags & X86_EFLAGS_IF; /* IE flags is bit 9 */
+	return flags & X86_EFLAGS_IF;
 }
 
 /* IRQ Low-Level Service Routine */

--
1.7.5.2.317.g391b14

#7 lore raw

PATCH 3/5 cosmetic: checkpatch cleanup arch/x86/cpu/sc520/*.c

In reply to Graeme Russ

---
./checkpatch.pl --no-tree -f arch/x86/cpu/sc520/*.c
total: 0 errors, 0 warnings, 66 lines checked

arch/x86/cpu/sc520/sc520.c has no obvious style problems and is ready for submission.
WARNING: line over 80 characters
#84: FILE: x86/cpu/sc520/sc520_pci.c:84:
+ if (readb(&sc520_mmcr->pci_int_map[i]) == sc520_irq[irq].priority)

WARNING: line over 80 characters
#90: FILE: x86/cpu/sc520/sc520_pci.c:90:
+ if (readb(&sc520_mmcr->gp_int_map[i]) == sc520_irq[irq].priority)

total: 0 errors, 2 warnings, 140 lines checked

arch/x86/cpu/sc520/sc520_pci.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 40 lines checked

arch/x86/cpu/sc520/sc520_reset.c has no obvious style problems and is ready for submission.
ERROR: need consistent spacing around '%' (ctx:WxV)
#433: FILE: x86/cpu/sc520/sc520_sdram.c:433:
+ movl %eax, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #433: FILE: x86/cpu/sc520/sc520_sdram.c:433:
+ movl %eax, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #434: FILE: x86/cpu/sc520/sc520_sdram.c:434:
+ shrl $0x1, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #435: FILE: x86/cpu/sc520/sc520_sdram.c:435:
+ movl $0x1, %edi
^

ERROR: spaces required around that ':' (ctx:VxE)
#436: FILE: x86/cpu/sc520/sc520_sdram.c:436:
+memtest0:

         ^

ERROR: need consistent spacing around '%' (ctx:WxV) #440: FILE: x86/cpu/sc520/sc520_sdram.c:440:
+ shrl $0x1, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #441: FILE: x86/cpu/sc520/sc520_sdram.c:441:
+ andl %ecx, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #441: FILE: x86/cpu/sc520/sc520_sdram.c:441:
+ andl %ecx, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #443: FILE: x86/cpu/sc520/sc520_sdram.c:443:
+ shll $0x1, %edi
^

ERROR: spaces required around that ':' (ctx:VxE)
#446: FILE: x86/cpu/sc520/sc520_sdram.c:446:
+set_ecc:

        ^

ERROR: need consistent spacing around '%' (ctx:WxV) #448: FILE: x86/cpu/sc520/sc520_sdram.c:448:
+ movl %eax, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #448: FILE: x86/cpu/sc520/sc520_sdram.c:448:
+ movl %eax, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #449: FILE: x86/cpu/sc520/sc520_sdram.c:449:
+ xorl %esi, %esi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #449: FILE: x86/cpu/sc520/sc520_sdram.c:449:
+ xorl %esi, %esi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #450: FILE: x86/cpu/sc520/sc520_sdram.c:450:
+ xorl %edi, %edi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #450: FILE: x86/cpu/sc520/sc520_sdram.c:450:
+ xorl %edi, %edi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #451: FILE: x86/cpu/sc520/sc520_sdram.c:451:
+ xorl %eax, %eax
^

ERROR: need consistent spacing around '%' (ctx:WxV) #451: FILE: x86/cpu/sc520/sc520_sdram.c:451:
+ xorl %eax, %eax
^

ERROR: need consistent spacing around '%' (ctx:WxV) #452: FILE: x86/cpu/sc520/sc520_sdram.c:452:
+ shrl $0x2, %ecx
^

ERROR: need consistent spacing around '%' (ctx:WxV) #457: FILE: x86/cpu/sc520/sc520_sdram.c:457:
+ movb $0x11, %al
^

ERROR: need consistent spacing around '%' (ctx:WxV) #458: FILE: x86/cpu/sc520/sc520_sdram.c:458:
+ movl $DBCTL, %edi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #459: FILE: x86/cpu/sc520/sc520_sdram.c:459:
+ movb %al, (%edi)
^

ERROR: need consistent spacing around '%' (ctx:WxV) #462: FILE: x86/cpu/sc520/sc520_sdram.c:462:
+ movl $ECCINT, %edi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #463: FILE: x86/cpu/sc520/sc520_sdram.c:463:
+ movb $0x10, %al
^

ERROR: need consistent spacing around '%' (ctx:WxV) #464: FILE: x86/cpu/sc520/sc520_sdram.c:464:
+ movb %al, (%edi)
^

ERROR: need consistent spacing around '%' (ctx:WxV) #467: FILE: x86/cpu/sc520/sc520_sdram.c:467:
+ movl $ECCCTL, %edi
^

ERROR: need consistent spacing around '%' (ctx:WxV) #468: FILE: x86/cpu/sc520/sc520_sdram.c:468:
+ movb $0x05, %al
^

ERROR: need consistent spacing around '%' (ctx:WxV) #469: FILE: x86/cpu/sc520/sc520_sdram.c:469:
+ movb %al,(%edi)
^

ERROR: space required after that ',' (ctx:VxV)
#469: FILE: x86/cpu/sc520/sc520_sdram.c:469:
+ movb %al,(%edi)
^

ERROR: spaces required around that ':' (ctx:VxE)
#471: FILE: x86/cpu/sc520/sc520_sdram.c:471:
+out:

    ^

total: 30 errors, 0 warnings, 532 lines checked

arch/x86/cpu/sc520/sc520_sdram.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 93 lines checked

arch/x86/cpu/sc520/sc520_ssi.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 90 lines checked

arch/x86/cpu/sc520/sc520_timer.c has no obvious style problems and is ready for submission.

 arch/x86/cpu/sc520/sc520.c       |    2 +-
 arch/x86/cpu/sc520/sc520_pci.c   |   16 +++++++-------
 arch/x86/cpu/sc520/sc520_ssi.c   |   43 +++++++++++++++++++------------------
 arch/x86/cpu/sc520/sc520_timer.c |    4 +-
 4 files changed, 33 insertions(+), 32 deletions(-)
arch/x86/cpu/sc520/sc520.c +1 -1
index 4892c01..3fe85e7 100644
@@ -49,7 +49,7 @@ int cpu_init_f(void)
 	asm("movl	$0x2000, %%ecx\n"
 	    "0:		pushl %%ecx\n"
 	    "popl	%%ecx\n"
-	    "loop 0b\n": : : "ecx");
+	    "loop 0b\n" : : : "ecx");
 
 	return x86_cpu_init_f();
 }
arch/x86/cpu/sc520/sc520_pci.c +8 -8
index e26793a..70155a1 100644
@@ -70,25 +70,23 @@ int pci_sc520_set_irq(int pci_pin, int irq)
 
 	debug("set_irq(): map INT%c to IRQ%d\n", pci_pin + 'A', irq);
 
-	if (irq < 0 || irq > 15) {
+	if (irq < 0 || irq > 15)
 		return -1; /* illegal irq */
-	}
 
-	if (pci_pin < 0 || pci_pin > 15) {
+	if (pci_pin < 0 || pci_pin > 15)
 		return -1; /* illegal pci int pin */
-	}
 
 	/* first disable any non-pci interrupt source that use
 	 * this level */
 
 	/* PCI interrupt mapping (A through D)*/
-	for (i=0; i<=3 ;i++) {
+	for (i = 0; i <= 3 ; i++) {
 		if (readb(&sc520_mmcr->pci_int_map[i]) == sc520_irq[irq].priority)
 			writeb(SC520_IRQ_DISABLED, &sc520_mmcr->pci_int_map[i]);
 	}
 
 	/* GP IRQ interrupt mapping */
-	for (i=0; i<=10 ;i++) {
+	for (i = 0; i <= 10 ; i++) {
 		if (readb(&sc520_mmcr->gp_int_map[i]) == sc520_irq[irq].priority)
 			writeb(SC520_IRQ_DISABLED, &sc520_mmcr->gp_int_map[i]);
 	}
@@ -102,10 +100,12 @@ int pci_sc520_set_irq(int pci_pin, int irq)
 	if (pci_pin < 4) {
 		/* PCI INTA-INTD */
 		/* route the interrupt */
-		writeb(sc520_irq[irq].priority, &sc520_mmcr->pci_int_map[pci_pin]);
+		writeb(sc520_irq[irq].priority,
+				&sc520_mmcr->pci_int_map[pci_pin]);
 	} else {
 		/* GPIRQ0-GPIRQ10 used for additional PCI INTS */
-		writeb(sc520_irq[irq].priority, &sc520_mmcr->gp_int_map[pci_pin - 4]);
+		writeb(sc520_irq[irq].priority,
+				&sc520_mmcr->gp_int_map[pci_pin - 4]);
 
 		/* also set the polarity in this case */
 		tmpw = readw(&sc520_mmcr->intpinpol);
arch/x86/cpu/sc520/sc520_ssi.c +22 -21

83 lines not on this page · raw message

arch/x86/cpu/sc520/sc520_timer.c +2 -2
index 05bc9c1..495a694 100644
@@ -38,7 +38,7 @@ void sc520_timer_isr(void)
 int timer_init(void)
 {
 	/* Register the SC520 specific timer interrupt handler */
-	register_timer_isr (sc520_timer_isr);
+	register_timer_isr(sc520_timer_isr);
 
 	/* Install interrupt handler for GP Timer 1 */
 	irq_install_handler (0, timer_isr, NULL);
@@ -62,7 +62,7 @@ int timer_init(void)
 	writew(100, &sc520_mmcr->gptmr1maxcmpa);
 	writew(0xe009, &sc520_mmcr->gptmr1ctl);
 
-	unmask_irq (0);
+	unmask_irq(0);
 
 	/* Clear the GP Timer 1 status register to get the show rolling*/
 	writeb(0x02, &sc520_mmcr->gptmrsta);

--
1.7.5.2.317.g391b14

#10 lore raw

PATCH 4/5 cosmetic: checkpatch cleanup of arch/x86/lib/*.c

In reply to Graeme Russ

---
./checkpatch.pl --no-tree -f arch/x86/lib/*.c
WARNING: externs should be avoided in .c files
#47: FILE: x86/lib/bios_setup.c:47:
+extern ulong __bios_start;

WARNING: externs should be avoided in .c files
#48: FILE: x86/lib/bios_setup.c:48:
+extern ulong __bios_size;

WARNING: externs should be avoided in .c files
#53: FILE: x86/lib/bios_setup.c:53:
+extern u16 ram_in_64kb_chunks;

WARNING: externs should be avoided in .c files
#54: FILE: x86/lib/bios_setup.c:54:
+extern u16 bios_equipment;

WARNING: externs should be avoided in .c files
#55: FILE: x86/lib/bios_setup.c:55:
+extern u8 pci_last_bus;

WARNING: externs should be avoided in .c files
#57: FILE: x86/lib/bios_setup.c:57:
+extern void *rm_int00;

WARNING: externs should be avoided in .c files
#58: FILE: x86/lib/bios_setup.c:58:
+extern void *rm_int01;

WARNING: externs should be avoided in .c files
#59: FILE: x86/lib/bios_setup.c:59:
+extern void *rm_int02;

WARNING: externs should be avoided in .c files
#60: FILE: x86/lib/bios_setup.c:60:
+extern void *rm_int03;

WARNING: externs should be avoided in .c files
#61: FILE: x86/lib/bios_setup.c:61:
+extern void *rm_int04;

WARNING: externs should be avoided in .c files
#62: FILE: x86/lib/bios_setup.c:62:
+extern void *rm_int05;

WARNING: externs should be avoided in .c files
#63: FILE: x86/lib/bios_setup.c:63:
+extern void *rm_int06;

WARNING: externs should be avoided in .c files
#64: FILE: x86/lib/bios_setup.c:64:
+extern void *rm_int07;

WARNING: externs should be avoided in .c files
#65: FILE: x86/lib/bios_setup.c:65:
+extern void *rm_int08;

WARNING: externs should be avoided in .c files
#66: FILE: x86/lib/bios_setup.c:66:
+extern void *rm_int09;

WARNING: externs should be avoided in .c files
#67: FILE: x86/lib/bios_setup.c:67:
+extern void *rm_int0a;

WARNING: externs should be avoided in .c files
#68: FILE: x86/lib/bios_setup.c:68:
+extern void *rm_int0b;

WARNING: externs should be avoided in .c files
#69: FILE: x86/lib/bios_setup.c:69:
+extern void *rm_int0c;

WARNING: externs should be avoided in .c files
#70: FILE: x86/lib/bios_setup.c:70:
+extern void *rm_int0d;

WARNING: externs should be avoided in .c files
#71: FILE: x86/lib/bios_setup.c:71:
+extern void *rm_int0e;

WARNING: externs should be avoided in .c files
#72: FILE: x86/lib/bios_setup.c:72:
+extern void *rm_int0f;

WARNING: externs should be avoided in .c files
#73: FILE: x86/lib/bios_setup.c:73:
+extern void *rm_int10;

WARNING: externs should be avoided in .c files
#74: FILE: x86/lib/bios_setup.c:74:
+extern void *rm_int11;

WARNING: externs should be avoided in .c files
#75: FILE: x86/lib/bios_setup.c:75:
+extern void *rm_int12;

WARNING: externs should be avoided in .c files
#76: FILE: x86/lib/bios_setup.c:76:
+extern void *rm_int13;

WARNING: externs should be avoided in .c files
#77: FILE: x86/lib/bios_setup.c:77:
+extern void *rm_int14;

WARNING: externs should be avoided in .c files
#78: FILE: x86/lib/bios_setup.c:78:
+extern void *rm_int15;

WARNING: externs should be avoided in .c files
#79: FILE: x86/lib/bios_setup.c:79:
+extern void *rm_int16;

WARNING: externs should be avoided in .c files
#80: FILE: x86/lib/bios_setup.c:80:
+extern void *rm_int17;

WARNING: externs should be avoided in .c files
#81: FILE: x86/lib/bios_setup.c:81:
+extern void *rm_int18;

WARNING: externs should be avoided in .c files
#82: FILE: x86/lib/bios_setup.c:82:
+extern void *rm_int19;

WARNING: externs should be avoided in .c files
#83: FILE: x86/lib/bios_setup.c:83:
+extern void *rm_int1a;

WARNING: externs should be avoided in .c files
#84: FILE: x86/lib/bios_setup.c:84:
+extern void *rm_int1b;

WARNING: externs should be avoided in .c files
#85: FILE: x86/lib/bios_setup.c:85:
+extern void *rm_int1c;

WARNING: externs should be avoided in .c files
#86: FILE: x86/lib/bios_setup.c:86:
+extern void *rm_int1d;

WARNING: externs should be avoided in .c files
#87: FILE: x86/lib/bios_setup.c:87:
+extern void *rm_int1e;

WARNING: externs should be avoided in .c files
#88: FILE: x86/lib/bios_setup.c:88:
+extern void *rm_int1f;

WARNING: externs should be avoided in .c files
#89: FILE: x86/lib/bios_setup.c:89:
+extern void *rm_def_int;

WARNING: externs should be avoided in .c files
#91: FILE: x86/lib/bios_setup.c:91:
+extern void *realmode_reset;

WARNING: externs should be avoided in .c files
#92: FILE: x86/lib/bios_setup.c:92:
+extern void *realmode_pci_bios_call_entry;

total: 0 errors, 40 warnings, 233 lines checked

arch/x86/lib/bios_setup.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
WARNING: externs should be avoided in .c files
#61: FILE: x86/lib/board.c:61:
+extern ulong __text_start;

WARNING: externs should be avoided in .c files
#62: FILE: x86/lib/board.c:62:
+extern ulong __data_end;

WARNING: externs should be avoided in .c files
#63: FILE: x86/lib/board.c:63:
+extern ulong __rel_dyn_start;

WARNING: externs should be avoided in .c files
#64: FILE: x86/lib/board.c:64:
+extern ulong __rel_dyn_end;

WARNING: externs should be avoided in .c files
#65: FILE: x86/lib/board.c:65:
+extern ulong __bss_start;

WARNING: externs should be avoided in .c files
#66: FILE: x86/lib/board.c:66:
+extern ulong __bss_end;

WARNING: line over 80 characters
#222: FILE: x86/lib/board.c:222:
+ if (*(Elf32_Addr *)(re_src->r_offset + gd->reloc_off) >= CONFIG_SYS_TEXT_BASE)

WARNING: line over 80 characters
#223: FILE: x86/lib/board.c:223:
+ *(Elf32_Addr *)(re_src->r_offset + gd->reloc_off) += gd->reloc_off;

WARNING: line over 80 characters
#424: FILE: x86/lib/board.c:424:
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, char * const argv[])

total: 0 errors, 9 warnings, 455 lines checked

arch/x86/lib/board.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 98 lines checked

arch/x86/lib/bootm.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 161 lines checked

arch/x86/lib/interrupts.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 132 lines checked

arch/x86/lib/pcat_interrupts.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 106 lines checked

arch/x86/lib/pcat_timer.c has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 153 lines checked

arch/x86/lib/pci.c has no obvious style problems and is ready for submission.
ERROR: Macros with complex values should be enclosed in parenthesis #32: FILE: x86/lib/pci_type1.c:32:
+#define cfg_read(val, addr, op) *val = op((int)(addr))

total: 1 errors, 0 warnings, 66 lines checked

arch/x86/lib/pci_type1.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
WARNING: externs should be avoided in .c files
#31: FILE: x86/lib/realmode.c:31:
+extern ulong __realmode_start;

WARNING: externs should be avoided in .c files
#32: FILE: x86/lib/realmode.c:32:
+extern ulong __realmode_size;

WARNING: externs should be avoided in .c files
#33: FILE: x86/lib/realmode.c:33:
+extern char realmode_enter;

total: 0 errors, 3 warnings, 96 lines checked

arch/x86/lib/realmode.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 100 lines checked

arch/x86/lib/timer.c has no obvious style problems and is ready for submission.
WARNING: externs should be avoided in .c files
#45: FILE: x86/lib/video_bios.c:45:
+extern u32 num_pci_bios_present;

WARNING: externs should be avoided in .c files
#46: FILE: x86/lib/video_bios.c:46:
+extern u32 num_pci_bios_find_device;

WARNING: externs should be avoided in .c files
#47: FILE: x86/lib/video_bios.c:47:
+extern u32 num_pci_bios_find_class;

WARNING: externs should be avoided in .c files
#48: FILE: x86/lib/video_bios.c:48:
+extern u32 num_pci_bios_generate_special_cycle;

WARNING: externs should be avoided in .c files
#49: FILE: x86/lib/video_bios.c:49:
+extern u32 num_pci_bios_read_cfg_byte;

WARNING: externs should be avoided in .c files
#50: FILE: x86/lib/video_bios.c:50:
+extern u32 num_pci_bios_read_cfg_word;

WARNING: externs should be avoided in .c files
#51: FILE: x86/lib/video_bios.c:51:
+extern u32 num_pci_bios_read_cfg_dword;

WARNING: externs should be avoided in .c files
#52: FILE: x86/lib/video_bios.c:52:
+extern u32 num_pci_bios_write_cfg_byte;

WARNING: externs should be avoided in .c files
#53: FILE: x86/lib/video_bios.c:53:
+extern u32 num_pci_bios_write_cfg_word;

WARNING: externs should be avoided in .c files
#54: FILE: x86/lib/video_bios.c:54:
+extern u32 num_pci_bios_write_cfg_dword;

WARNING: externs should be avoided in .c files
#55: FILE: x86/lib/video_bios.c:55:
+extern u32 num_pci_bios_get_irq_routing;

WARNING: externs should be avoided in .c files
#56: FILE: x86/lib/video_bios.c:56:
+extern u32 num_pci_bios_set_irq;

WARNING: externs should be avoided in .c files
#57: FILE: x86/lib/video_bios.c:57:
+extern u32 num_pci_bios_unknown_function;

WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #98: FILE: x86/lib/video_bios.c:98:
+static struct pci_device_id supported[] = {

WARNING: line over 80 characters
#146: FILE: x86/lib/video_bios.c:146:
+ if (pci_enable_legacy_video_ports(pci_bus_to_hose(PCI_BUS(devbusfn)))) {

total: 0 errors, 15 warnings, 248 lines checked

arch/x86/lib/video_bios.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 229 lines checked

arch/x86/lib/video.c has no obvious style problems and is ready for submission.
WARNING: line over 80 characters
#91: FILE: x86/lib/zimage.c:91:
+ struct setup_header *hdr = (struct setup_header *)(image + SETUP_SECTS_OFF);

WARNING: line over 80 characters
#97: FILE: x86/lib/zimage.c:97:
+ printf("Error: Invalid Boot Flag (found 0x%04x, expected 0x%04x)\n",

WARNING: line over 80 characters
#146: FILE: x86/lib/zimage.c:146:
+ *(u16 *)(setup_base + CMD_LINE_OFFSET_OFF) = COMMAND_LINE_OFFSET;

WARNING: line over 80 characters
#177: FILE: x86/lib/zimage.c:177:
+ (setup_base + (hdr->kernel_version + 0x200)));

WARNING: line over 80 characters
#179: FILE: x86/lib/zimage.c:179:
+ printf("Setup Sectors < 15 - Cannot print kernel version.\n");

WARNING: line over 80 characters
#182: FILE: x86/lib/zimage.c:182:
+ printf("Initial RAM disk at linear address 0x%08lx, size %ld bytes\n",

WARNING: line over 80 characters
#200: FILE: x86/lib/zimage.c:200:
+ *(u16 *)(setup_base + CMD_LINE_OFFSET_OFF) = COMMAND_LINE_OFFSET;

WARNING: line over 80 characters
#213: FILE: x86/lib/zimage.c:213:
+ printf("Error: bzImage kernel too big! (size: %ld, max: %d)\n",

WARNING: line over 80 characters
#227: FILE: x86/lib/zimage.c:227:
+ printf("Loading %czImage@address 0x%08x (%ld bytes)\n", big_image ? 'b' : ' ',

WARNING: line over 80 characters
#247: FILE: x86/lib/zimage.c:247:
+ enter_realmode(((u32)setup_base+SETUP_START_OFFSET)>>4, 0, &regs, &regs);

WARNING: consider using kstrto* in preference to simple_strtoul #269: FILE: x86/lib/zimage.c:269:
+ bzImage_addr = (void *)simple_strtoul(s, NULL, 16);

WARNING: consider using kstrto* in preference to simple_strtoul #273: FILE: x86/lib/zimage.c:273:
+ bzImage_size = simple_strtoul(argv[2], NULL, 16);

WARNING: line over 80 characters
#281: FILE: x86/lib/zimage.c:281:
+ printf("## Transferring control to Linux (at address %08x) ...\n",

total: 0 errors, 13 warnings, 298 lines checked

arch/x86/lib/zimage.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

 arch/x86/lib/bios_setup.c      |   50 +++++++----------
 arch/x86/lib/board.c           |   85 ++++++++++++---------------
 arch/x86/lib/bootm.c           |   23 ++++----
 arch/x86/lib/interrupts.c      |   20 +++---
 arch/x86/lib/pcat_interrupts.c |    2 +-
 arch/x86/lib/pcat_timer.c      |   37 ++++++------
 arch/x86/lib/pci.c             |   63 +++++++++++----------
 arch/x86/lib/pci_type1.c       |    6 +-
 arch/x86/lib/realmode.c        |   16 +++---
 arch/x86/lib/timer.c           |   16 +++---
 arch/x86/lib/video.c           |    6 +-
 arch/x86/lib/video_bios.c      |  122 ++++++++++++++++++++++++----------------
 arch/x86/lib/zimage.c          |   73 ++++++++++++-----------
 13 files changed, 267 insertions(+), 252 deletions(-)
arch/x86/lib/bios_setup.c +21 -29
index 9bf7e58..31c0d7b 100644
@@ -39,10 +39,10 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define NUMVECTS	256
 
-#define BIOS_DATA        ((char*)0x400)
-#define BIOS_DATA_SIZE   256
-#define BIOS_BASE        ((char*)0xf0000)
-#define BIOS_CS          0xf000
+#define BIOS_DATA	((char *)0x400)
+#define BIOS_DATA_SIZE	256
+#define BIOS_BASE	((char *)0xf0000)
+#define BIOS_CS		0xf000
 
 extern ulong __bios_start;
 extern ulong __bios_size;
@@ -93,15 +93,14 @@ extern void *realmode_pci_bios_call_entry;
 
 static int set_jmp_vector(int entry_point, void *target)
 {
-	if (entry_point & ~0xffff) {
+	if (entry_point & ~0xffff)
 		return -1;
-	}
 
-	if (((u32)target-0xf0000) & ~0xffff) {
+	if (((u32)target - 0xf0000) & ~0xffff)
 		return -1;
-	}
+
 	printf("set_jmp_vector: 0xf000:%04x -> %p\n",
-	       entry_point, target);
+			entry_point, target);
 
 	/* jmp opcode */
 	writeb(0xea, 0xf0000 + entry_point);
@@ -115,51 +114,45 @@ static int set_jmp_vector(int entry_point, void *target)
 	return 0;
 }
 
-
-/*
- ************************************************************
- * Install an interrupt vector
- ************************************************************
- */
-
+/* Install an interrupt vector */
 static void setvector(int vector, u16 segment, void *handler)
 {
-	u16 *ptr = (u16*)(vector*4);
-	ptr[0] = ((u32)handler - (segment << 4))&0xffff;
+	u16 *ptr = (u16 *)(vector * 4);
+	ptr[0] = ((u32)handler - (segment << 4)) & 0xffff;
 	ptr[1] = segment;
 
 #if 0
 	printf("setvector: int%02x -> %04x:%04x\n",
-	       vector, ptr[1], ptr[0]);
+			vector, ptr[1], ptr[0]);
 #endif
 }
 
-#define RELOC_16_LONG(seg, off) *(u32*)(seg << 4 | (u32)&off)
-#define RELOC_16_WORD(seg, off) *(u16*)(seg << 4 | (u32)&off)
-#define RELOC_16_BYTE(seg, off) *(u8*)(seg << 4 | (u32)&off)
+#define RELOC_16_LONG(seg, off) (*(u32 *)(seg << 4 | (u32)&off))
+#define RELOC_16_WORD(seg, off) (*(u16 *)(seg << 4 | (u32)&off))
+#define RELOC_16_BYTE(seg, off) (*(u8 *)(seg << 4 | (u32)&off))
 
 int bios_setup(void)
 {
 	ulong bios_start = (ulong)&__bios_start + gd->reloc_off;
 	ulong bios_size = (ulong)&__bios_size;
 
-	static int done=0;
+	static int done;
 	int vector;
 #ifdef CONFIG_PCI
 	struct pci_controller *pri_hose;
 #endif
-	if (done) {
+	if (done)
 		return 0;
-	}
+
 	done = 1;
 
 	if (bios_size > 65536) {
 		printf("BIOS too large (%ld bytes, max is 65536)\n",
-		       bios_size);
+				bios_size);
 		return -1;
 	}
 
-	memcpy(BIOS_BASE, (void*)bios_start, bios_size);
+	memcpy(BIOS_BASE, (void *)bios_start, bios_size);
 
 	/* clear bda */
 	memset(BIOS_DATA, 0, BIOS_DATA_SIZE);
@@ -178,9 +171,8 @@ int bios_setup(void)
 
 
 	/* setup realmode interrupt vectors */
-	for (vector = 0; vector < NUMVECTS; vector++) {
+	for (vector = 0; vector < NUMVECTS; vector++)
 		setvector(vector, BIOS_CS, &rm_def_int);
-	}
 
 	setvector(0x00, BIOS_CS, &rm_int00);
 	setvector(0x01, BIOS_CS, &rm_int01);
arch/x86/lib/board.c +38 -47

199 lines not on this page · raw message

arch/x86/lib/bootm.c +12 -11
index a21a21f..836803c 100644
@@ -32,7 +32,8 @@
 #include <asm/zimage.h>
 
 /*cmd_boot.c*/
-int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char * const argv[],
+		bootm_headers_t *images)
 {
 	void		*base_ptr;
 	ulong		os_data, os_len;
@@ -48,41 +49,41 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 
 	if (images->legacy_hdr_valid) {
 		hdr = images->legacy_hdr_os;
-		if (image_check_type (hdr, IH_TYPE_MULTI)) {
+		if (image_check_type(hdr, IH_TYPE_MULTI)) {
 			/* if multi-part image, we need to get first subimage */
-			image_multi_getimg (hdr, 0, &os_data, &os_len);
+			image_multi_getimg(hdr, 0, &os_data, &os_len);
 		} else {
 			/* otherwise get image data */
-			os_data = image_get_data (hdr);
-			os_len = image_get_data_size (hdr);
+			os_data = image_get_data(hdr);
+			os_len = image_get_data_size(hdr);
 		}
 #if defined(CONFIG_FIT)
 	} else if (images->fit_uname_os) {
-		ret = fit_image_get_data (images->fit_hdr_os,
+		ret = fit_image_get_data(images->fit_hdr_os,
 					images->fit_noffset_os, &data, &len);
 		if (ret) {
-			puts ("Can't get image data/size!\n");
+			puts("Can't get image data/size!\n");
 			goto error;
 		}
 		os_data = (ulong)data;
 		os_len = (ulong)len;
 #endif
 	} else {
-		puts ("Could not find kernel image!\n");
+		puts("Could not find kernel image!\n");
 		goto error;
 	}
 
-	base_ptr = load_zimage ((void*)os_data, os_len,
+	base_ptr = load_zimage((void *)os_data, os_len,
 			images->rd_start, images->rd_end - images->rd_start, 0);
 
 	if (NULL == base_ptr) {
-		printf ("## Kernel loading failed ...\n");
+		printf("## Kernel loading failed ...\n");
 		goto error;
 
 	}
 
 #ifdef DEBUG
-	printf ("## Transferring control to Linux (at address %08x) ...\n",
+	printf("## Transferring control to Linux (at address %08x) ...\n",
 		(u32)base_ptr);
 #endif
 
arch/x86/lib/interrupts.c +10 -10
index 04a9c79..76fbe9d 100644
@@ -56,8 +56,8 @@ struct irq_action {
 };
 
 static struct irq_action irq_handlers[CONFIG_SYS_NUM_IRQS] = { {0} };
-static int spurious_irq_cnt = 0;
-static int spurious_irq = 0;
+static int spurious_irq_cnt;
+static int spurious_irq;
 
 void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 {
@@ -70,10 +70,10 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 
 	if (irq_handlers[irq].handler != NULL)
 		printf("irq_install_handler: 0x%08lx replacing 0x%08lx\n",
-		       (ulong) handler,
-		       (ulong) irq_handlers[irq].handler);
+				(ulong) handler,
+				(ulong) irq_handlers[irq].handler);
 
-	status = disable_interrupts ();
+	status = disable_interrupts();
 
 	irq_handlers[irq].handler = handler;
 	irq_handlers[irq].arg = arg;
@@ -96,7 +96,7 @@ void irq_free_handler(int irq)
 		return;
 	}
 
-	status = disable_interrupts ();
+	status = disable_interrupts();
 
 	mask_irq(irq);
 
@@ -141,14 +141,14 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int irq;
 
 	printf("Spurious IRQ: %u, last unknown IRQ: %d\n",
-	       spurious_irq_cnt, spurious_irq);
+			spurious_irq_cnt, spurious_irq);
 
-	printf ("Interrupt-Information:\n");
-	printf ("Nr  Routine   Arg       Count\n");
+	printf("Interrupt-Information:\n");
+	printf("Nr  Routine   Arg       Count\n");
 
 	for (irq = 0; irq <= CONFIG_SYS_NUM_IRQS; irq++) {
 		if (irq_handlers[irq].handler != NULL) {
-			printf ("%02d  %08lx  %08lx  %d\n",
+			printf("%02d  %08lx  %08lx  %d\n",
 					irq,
 					(ulong)irq_handlers[irq].handler,
 					(ulong)irq_handlers[irq].arg,
arch/x86/lib/pcat_interrupts.c +1 -1
index 2caae20..5dac498 100644
@@ -76,7 +76,7 @@ int interrupt_init(void)
 	 * Enable cascaded interrupts by unmasking the cascade IRQ pin of
 	 * the master PIC
 	 */
-	unmask_irq (2);
+	unmask_irq(2);
 
 	enable_interrupts();
 
arch/x86/lib/pcat_timer.c +18 -19
index f2a5422..6b3db69 100644
@@ -30,7 +30,7 @@
 #define TIMER0_VALUE 0x04aa /* 1kHz 1.9318MHz / 1000 */
 #define TIMER2_VALUE 0x0a8e /* 440Hz */
 
-static int timer_init_done = 0;
+static int timer_init_done;
 
 int timer_init(void)
 {
@@ -42,18 +42,18 @@ int timer_init(void)
 	 * (to stasrt a beep: write 3 to port 0x61,
 	 * to stop it again: write 0)
 	 */
-	outb (PIT_CMD_CTR0 | PIT_CMD_BOTH | PIT_CMD_MODE2,
-	      PIT_BASE + PIT_COMMAND);
-	outb (TIMER0_VALUE & 0xff, PIT_BASE + PIT_T0);
-	outb (TIMER0_VALUE >> 8, PIT_BASE + PIT_T0);
+	outb(PIT_CMD_CTR0 | PIT_CMD_BOTH | PIT_CMD_MODE2,
+			PIT_BASE + PIT_COMMAND);
+	outb(TIMER0_VALUE & 0xff, PIT_BASE + PIT_T0);
+	outb(TIMER0_VALUE >> 8, PIT_BASE + PIT_T0);
 
-	outb (PIT_CMD_CTR2 | PIT_CMD_BOTH | PIT_CMD_MODE3,
-	      PIT_BASE + PIT_COMMAND);
-	outb (TIMER2_VALUE & 0xff, PIT_BASE + PIT_T2);
-	outb (TIMER2_VALUE >> 8, PIT_BASE + PIT_T2);
+	outb(PIT_CMD_CTR2 | PIT_CMD_BOTH | PIT_CMD_MODE3,
+			PIT_BASE + PIT_COMMAND);
+	outb(TIMER2_VALUE & 0xff, PIT_BASE + PIT_T2);
+	outb(TIMER2_VALUE >> 8, PIT_BASE + PIT_T2);
 
-	irq_install_handler (0, timer_isr, NULL);
-	unmask_irq (0);
+	irq_install_handler(0, timer_isr, NULL);
+	unmask_irq(0);
 
 	timer_init_done = 1;
 
@@ -64,21 +64,20 @@ static u16 read_pit(void)
 {
 	u8 low;
 
-	outb (PIT_CMD_LATCH, PIT_BASE + PIT_COMMAND);
-	low = inb (PIT_BASE + PIT_T0);
+	outb(PIT_CMD_LATCH, PIT_BASE + PIT_COMMAND);
+	low = inb(PIT_BASE + PIT_T0);
 
-	return ((inb (PIT_BASE + PIT_T0) << 8) | low);
+	return (inb(PIT_BASE + PIT_T0) << 8) | low;
 }
 
 /* this is not very exact */
-void __udelay (unsigned long usec)
+void __udelay(unsigned long usec)
 {
 	int counter;
 	int wraps;
 
-	if (timer_init_done)
-	{
-		counter = read_pit ();
+	if (timer_init_done) {
+		counter = read_pit();
 		wraps = usec / 1000;
 		usec = usec % 1000;
 
@@ -92,7 +91,7 @@ void __udelay (unsigned long usec)
 		}
 
 		while (1) {
-			int new_count = read_pit ();
+			int new_count = read_pit();
 
 			if (((new_count < usec) && !wraps) || wraps < 0)
 				break;
arch/x86/lib/pci.c +33 -30

113 lines not on this page · raw message

arch/x86/lib/pci_type1.c +3 -3
index da1d356..3430076 100644
@@ -51,7 +51,7 @@ TYPE1_PCI_OP(write, byte, u8, outb, 3)
 TYPE1_PCI_OP(write, word, u16, outw, 2)
 TYPE1_PCI_OP(write, dword, u32, outl, 0)
 
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
+void pci_setup_type1(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
 {
 	pci_set_ops(hose,
 		    type1_read_config_byte,
@@ -61,6 +61,6 @@ void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
 		    type1_write_config_word,
 		    type1_write_config_dword);
 
-	hose->cfg_addr = (unsigned int *) cfg_addr;
-	hose->cfg_data = (unsigned char *) cfg_data;
+	hose->cfg_addr = (unsigned int *)cfg_addr;
+	hose->cfg_data = (unsigned char *)cfg_data;
 }
arch/x86/lib/realmode.c +8 -8
index 6aa0f23..dbb67a4 100644
@@ -26,7 +26,7 @@
 #include <asm/ptrace.h>
 #include <asm/realmode.h>
 
-#define REALMODE_MAILBOX ((char*)0xe00)
+#define REALMODE_MAILBOX ((char *)0xe00)
 
 extern ulong __realmode_start;
 extern ulong __realmode_size;
@@ -63,15 +63,14 @@ int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out)
 
 	in->eip = off;
 	in->xcs = seg;
-	if (3>(in->esp & 0xffff)) {
+	if ((in->esp & 0xffff) < 4)
 		printf("Warning: entering realmode with sp < 4 will fail\n");
-	}
 
 	memcpy(REALMODE_MAILBOX, in, sizeof(struct pt_regs));
 	asm("wbinvd\n");
 
 	__asm__ volatile (
-		 "lcall $0x20,%0\n"  : :  "i" (&realmode_enter) );
+		 "lcall $0x20,%0\n" : : "i" (&realmode_enter));
 
 	asm("wbinvd\n");
 	memcpy(out, REALMODE_MAILBOX, sizeof(struct pt_regs));
@@ -79,9 +78,10 @@ int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out)
 	return out->eax;
 }
 
-
-/* This code is supposed to access a realmode interrupt
- * it does currently not work for me */
+/*
+ * This code is supposed to access a realmode interrupt
+ * it does currently not work for me
+ */
 int enter_realmode_int(u8 lvl, struct pt_regs *in, struct pt_regs *out)
 {
 	/* place two instructions at 0x700 */
@@ -92,5 +92,5 @@ int enter_realmode_int(u8 lvl, struct pt_regs *in, struct pt_regs *out)
 
 	enter_realmode(0x00, 0x700, in, out);
 
-	return out->eflags&1;
+	return out->eflags & 0x00000001;
 }
arch/x86/lib/timer.c +8 -8
index 8b1bde7..fd7032e 100644
@@ -35,15 +35,15 @@ struct timer_isr_function {
 	timer_fnc_t *isr_func;
 };
 
-static struct timer_isr_function *first_timer_isr = NULL;
-static volatile unsigned long system_ticks = 0;
+static struct timer_isr_function *first_timer_isr;
+static unsigned long system_ticks;
 
 /*
  * register_timer_isr() allows multiple architecture and board specific
  * functions to be called every millisecond. Keep the execution time of
  * each function as low as possible
  */
-int register_timer_isr (timer_fnc_t *isr_func)
+int register_timer_isr(timer_fnc_t *isr_func)
 {
 	struct timer_isr_function *new_func;
 	struct timer_isr_function *temp;
@@ -61,7 +61,7 @@ int register_timer_isr (timer_fnc_t *isr_func)
 	 *  Don't allow timer interrupts while the
 	 *  linked list is being modified
 	 */
-	flag = disable_interrupts ();
+	flag = disable_interrupts();
 
 	if (first_timer_isr == NULL) {
 		first_timer_isr = new_func;
@@ -73,7 +73,7 @@ int register_timer_isr (timer_fnc_t *isr_func)
 	}
 
 	if (flag)
-		enable_interrupts ();
+		enable_interrupts();
 
 	return 0;
 }
@@ -89,12 +89,12 @@ void timer_isr(void *unused)
 
 	/* Execute each registered function */
 	while (temp != NULL) {
-		temp->isr_func ();
+		temp->isr_func();
 		temp = temp->next;
 	}
 }
 
-ulong get_timer (ulong base)
+ulong get_timer(ulong base)
 {
-	return (system_ticks - base);
+	return system_ticks - base;
 }
arch/x86/lib/video.c +3 -3
index 0efcf3f..3d6b24d 100644
@@ -123,7 +123,7 @@ static void __video_putc(const char c, int *x, int *y)
 
 static void video_putc(const char c)
 {
-	int x,y,pos;
+	int x, y, pos;
 
 	x = orig_x;
 	y = orig_y;
@@ -142,7 +142,7 @@ static void video_putc(const char c)
 
 static void video_puts(const char *s)
 {
-	int x,y,pos;
+	int x, y, pos;
 	char c;
 
 	x = orig_x;
@@ -187,7 +187,7 @@ int video_init(void)
 	printf("pos %x %d %d\n", pos, orig_x, orig_y);
 #endif
 	if (orig_y > lines)
-		orig_x = orig_y =0;
+		orig_x = orig_y = 0;
 
 	memset(&vga_dev, 0, sizeof(vga_dev));
 	strcpy(vga_dev.name, "vga");
arch/x86/lib/video_bios.c +74 -48

226 lines not on this page · raw message

arch/x86/lib/zimage.c +38 -35

153 lines not on this page · raw message

--
1.7.5.2.317.g391b14

#13 lore raw

PATCH 5/5 cosmetic: checkpatch cleanup of board/eNET/*.c

In reply to Graeme Russ

---
./checkpatch.pl --no-tree -f board/eNET/*.c
total: 0 errors, 0 warnings, 289 lines checked

board/eNET/eNET.c has no obvious style problems and is ready for submission.
WARNING: labels should not be indented
#89: FILE: eNET/eNET_pci.c:89:
+ fixup_irq: pci_enet_fixup_irq,

total: 0 errors, 1 warnings, 128 lines checked

board/eNET/eNET_pci.c has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

---
 board/eNET/eNET.c     |    8 ++++----
 board/eNET/eNET_pci.c |   19 +++++++++----------
 2 files changed, 13 insertions(+), 14 deletions(-)
board/eNET/eNET.c +4 -4
index c4ed820..429fe1b 100644
@@ -223,7 +223,7 @@ void setup_pcat_compatibility()
 	 *  active low polarity on PIC interrupt pins,
 	 *  active high polarity on all other irq pins
 	 */
-	writew(0x0000,&sc520_mmcr->intpinpol);
+	writew(0x0000, &sc520_mmcr->intpinpol);
 
 	/*
 	 * PIT 0 -> IRQ0
@@ -252,7 +252,7 @@ void setup_pcat_compatibility()
 
 void enet_timer_isr(void)
 {
-	static long enet_ticks = 0;
+	static long enet_ticks;
 
 	enet_ticks++;
 
@@ -281,9 +281,9 @@ void hw_watchdog_reset(void)
 
 void enet_toggle_run_led(void)
 {
-	unsigned char leds_state= inb(LED_LATCH_ADDRESS);
+	unsigned char leds_state = inb(LED_LATCH_ADDRESS);
 	if (leds_state & LED_RUN_BITMASK)
-		outb(leds_state &~ LED_RUN_BITMASK, LED_LATCH_ADDRESS);
+		outb(leds_state & ~LED_RUN_BITMASK, LED_LATCH_ADDRESS);
 	else
 		outb(leds_state | LED_RUN_BITMASK, LED_LATCH_ADDRESS);
 }
board/eNET/eNET_pci.c +9 -10
index 29d13d2..5af4ef7 100644
@@ -38,7 +38,7 @@ static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 		CONFIG_SYS_THIRD_PCI_IRQ,
 		CONFIG_SYS_FORTH_PCI_IRQ
 	};
-	static int next_irq_index=0;
+	static int next_irq_index;
 
 	uchar tmp_pin;
 	int pin;
@@ -47,9 +47,8 @@ static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 	pin = tmp_pin;
 
 	pin -= 1; /* PCI config space use 1-based numbering */
-	if (pin == -1) {
+	if (pin == -1)
 		return; /* device use no irq */
-	}
 
 	/* map device number +  pin to a pin on the sc520 */
 	switch (PCI_DEV(dev)) {
@@ -69,19 +68,19 @@ static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 
 	if (sc520_pci_ints[pin] == -1) {
 		/* re-route one interrupt for us */
-		if (next_irq_index > 3) {
+		if (next_irq_index > 3)
 			return;
-		}
-		if (pci_sc520_set_irq(pin, irq_list[next_irq_index])) {
+
+		if (pci_sc520_set_irq(pin, irq_list[next_irq_index]))
 			return;
-		}
+
 		next_irq_index++;
 	}
 
-	if (-1 != sc520_pci_ints[pin]) {
-	pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE,
+	if (-1 != sc520_pci_ints[pin])
+		pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE,
 					   sc520_pci_ints[pin]);
-	}
+
 	printf("fixup_irq: device %d pin %c irq %d\n",
 	       PCI_DEV(dev), 'A' + pin, sc520_pci_ints[pin]);
 }
Signature · 1 line
1.7.5.2.317.g391b14
#16 lore raw

v2 cover x86: Various cosmetic and minor code fixups

In reply to Graeme Russ

NOTE: Due to the way this patchset started life as a two-part series, the threading may seem odd - Each patch is In-reply-to: the original patch from the original corresponding series...

This series is the amalgamation of the 7 part 'Various x86 fixups' and 5 part 'x86: Cosmetic cleanup' patch sets

This series make x86 *.c files checkpatch clean except for:

- x86/cpu/interrupts.c has two function declarations which are picked up as 'extern' - They should ideally be 'static', but the definition of these functions are in macro'd inline assembler, so the compiler complains that the functions are not defined is made static
- x86/lib/zimage.c has lines (just) over 80 characters caused by printf() strings which, IMHO, would have reduced readability if split
- x86/lib/zimage.c has lines (just) over 80 characters which could be fixed by converting the x86 zImage/bzImage header offsets into a structure - This is a big change prone to the introduction of bugs and will, therefore, be done later after the current x86 backlog stabilises
- x86/lib/zimage.c has "consider using kstrto* in preference to simple_strtoul" warnings

Of the patches, patch 4 (cosmetic: checkpatch cleanup of arch/x86/lib/*.c) has 23 checkpatch warnings all associated with asm statements which checkpatch does not know how to deal with, and 3 'line over 80 characters' warnings in x86/lib/zimage.c (see above)

Graeme Russ (12):
x86: Call hang() on unrecoverable exception
cosmetic: checkpatch cleanup of arch/x86/cpu/*.c
cosmetic: checkpatch cleanup of arch/x86/cpu/sc520/*.c
cosmetic: checkpatch cleanup of arch/x86/lib/*.c
cosmetic: checkpatch cleanup of board/eNET/*.c
x86: Punt cold- and warm-boot flags
sc520: Create arch asm-offsets
x86: Add multiboot header
x86: Provide more configuration granularity
x86: Ensure IDT and GDT remain 16-byte aligned post relocation
x86: Misc PCI touchups
x86: Misc cleanups

 arch/x86/cpu/cpu.c                      |   22 ++--
 arch/x86/cpu/interrupts.c               |   53 +++++----
 arch/x86/cpu/sc520/asm-offsets.c        |   45 +++++++
 arch/x86/cpu/sc520/sc520.c              |    2 +-
 arch/x86/cpu/sc520/sc520_car.S          |    3 +-
 arch/x86/cpu/sc520/sc520_pci.c          |   28 +++--
 arch/x86/cpu/sc520/sc520_sdram.c        |   53 --------
 arch/x86/cpu/sc520/sc520_ssi.c          |   43 ++++----
 arch/x86/cpu/sc520/sc520_timer.c        |    4 +-
 arch/x86/cpu/start.S                    |   30 ++++-
 arch/x86/cpu/start16.S                  |    3 -
 arch/x86/include/asm/arch-sc520/sc520.h |   26 ----
 arch/x86/include/asm/global_data.h      |   21 ----
 arch/x86/include/asm/pci.h              |    5 +-
 arch/x86/include/asm/realmode.h         |    4 +
 arch/x86/include/asm/u-boot-x86.h       |    8 ++
 arch/x86/lib/Makefile                   |   18 ++--
 arch/x86/lib/bios.h                     |  201 ++++++++++++++++++++++---------
 arch/x86/lib/bios_pci.S                 |   92 ++++++++++-----
 arch/x86/lib/bios_setup.c               |   93 +++------------
 arch/x86/lib/board.c                    |  140 ++++++++++++----------
 arch/x86/lib/bootm.c                    |   27 +++--
 arch/x86/lib/interrupts.c               |   20 ++--
 arch/x86/lib/pcat_interrupts.c          |    2 +-
 arch/x86/lib/pcat_timer.c               |   37 +++---
 arch/x86/lib/pci.c                      |   99 +++++++++++-----
 arch/x86/lib/pci_type1.c                |   13 ++-
 arch/x86/lib/realmode.c                 |   20 ++--
 arch/x86/lib/timer.c                    |   16 ++--
 arch/x86/lib/video.c                    |    6 +-
 arch/x86/lib/video_bios.c               |  130 ++++++++------------
 arch/x86/lib/zimage.c                   |   94 ++++++++-------
 board/eNET/eNET.c                       |    8 +-
 board/eNET/eNET_pci.c                   |   19 ++--
 board/eNET/eNET_start16.S               |    5 +-
 common/cmd_bdinfo.c                     |    3 +-
 include/configs/eNET.h                  |    5 +
 37 files changed, 739 insertions(+), 659 deletions(-)
 create mode 100644 arch/x86/cpu/sc520/asm-offsets.c

--
1.7.5.2.317.g391b14

#2 lore raw

PATCH v2 1/12 x86: Call hang() on unrecoverable exception

In reply to Graeme Russ

---
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/interrupts.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
arch/x86/cpu/interrupts.c +10 -10
index c6e72ea..89f39d2 100644
@@ -255,7 +255,7 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x00:
 		printf("Divide Error (Division by zero)\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x01:
 		printf("Debug Interrupt (Single step)\n");
@@ -272,32 +272,32 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x04:
 		printf("Overflow\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x05:
 		printf("BOUND Range Exceeded\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x06:
 		printf("Invalid Opcode (UnDefined Opcode)\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x07:
 		printf("Device Not Available (No Math Coprocessor)\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x08:
 		printf("Double fault\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x09:
 		printf("Co-processor segment overrun\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0a:
 		printf("Invalid TSS\n");
@@ -306,12 +306,12 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x0b:
 		printf("Segment Not Present\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0c:
 		printf("Stack Segment Fault\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0d:
 		printf("General Protection\n");
@@ -320,7 +320,7 @@ void irq_llsr(struct irq_regs *regs)
 	case 0x0e:
 		printf("Page fault\n");
 		dump_regs(regs);
-		while(1);
+		hang();
 		break;
 	case 0x0f:
 		printf("Floating-Point Error (Math Fault)\n");

--
1.7.5.2.317.g391b14

#5 lore raw

PATCH v2 2/12 cosmetic: checkpatch cleanup of arch/x86/cpu/*.c

In reply to Graeme Russ

---
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/cpu.c        |   22 +++++++++++-----------
 arch/x86/cpu/interrupts.c |   31 +++++++++++++++++++------------
 2 files changed, 30 insertions(+), 23 deletions(-)
arch/x86/cpu/cpu.c +11 -11
index cac12c0..48d2f7a 100644
@@ -52,7 +52,7 @@
 struct gdt_ptr {
 	u16 len;
 	u32 ptr;
-} __attribute__((packed));
+} __packed;
 
 static void reload_gdt(void)
 {
@@ -115,14 +115,14 @@ int x86_cpu_init_r(void)
 	reload_gdt();
 
 	/* Initialize core interrupt and exception functionality of CPU */
-	cpu_init_interrupts ();
+	cpu_init_interrupts();
 	return 0;
 }
 int cpu_init_r(void) __attribute__((weak, alias("x86_cpu_init_r")));
 
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-	printf ("resetting ...\n");
+	printf("resetting ...\n");
 
 	/* wait 50 ms */
 	udelay(50000);
@@ -133,7 +133,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
-void  flush_cache (unsigned long dummy1, unsigned long dummy2)
+void  flush_cache(unsigned long dummy1, unsigned long dummy2)
 {
 	asm("wbinvd\n");
 }
@@ -142,16 +142,16 @@ void __attribute__ ((regparm(0))) generate_gpf(void);
 
 /* segment 0x70 is an arbitrary segment which does not exist */
 asm(".globl generate_gpf\n"
-    ".hidden generate_gpf\n"
-    ".type generate_gpf, @function\n"
-    "generate_gpf:\n"
-    "ljmp   $0x70, $0x47114711\n");
+	".hidden generate_gpf\n"
+	".type generate_gpf, @function\n"
+	"generate_gpf:\n"
+	"ljmp   $0x70, $0x47114711\n");
 
 void __reset_cpu(ulong addr)
 {
 	printf("Resetting using x86 Triple Fault\n");
-	set_vector(13, generate_gpf);  /* general protection fault handler */
-	set_vector(8, generate_gpf);   /* double fault handler */
-	generate_gpf();                /* start the show */
+	set_vector(13, generate_gpf);	/* general protection fault handler */
+	set_vector(8, generate_gpf);	/* double fault handler */
+	generate_gpf();			/* start the show */
 }
 void reset_cpu(ulong addr) __attribute__((weak, alias("__reset_cpu")));
arch/x86/cpu/interrupts.c +19 -12
index 89f39d2..e007511 100644
@@ -31,6 +31,7 @@
 #include <asm/interrupt.h>
 #include <asm/io.h>
 #include <asm/processor-flags.h>
+#include <linux/compiler.h>
 
 #define DECLARE_INTERRUPT(x) \
 	".globl irq_"#x"\n" \
@@ -83,22 +84,22 @@ static inline unsigned long get_debugreg(int regno)
 
 	switch (regno) {
 	case 0:
-		asm("mov %%db0, %0" :"=r" (val));
+		asm("mov %%db0, %0" : "=r" (val));
 		break;
 	case 1:
-		asm("mov %%db1, %0" :"=r" (val));
+		asm("mov %%db1, %0" : "=r" (val));
 		break;
 	case 2:
-		asm("mov %%db2, %0" :"=r" (val));
+		asm("mov %%db2, %0" : "=r" (val));
 		break;
 	case 3:
-		asm("mov %%db3, %0" :"=r" (val));
+		asm("mov %%db3, %0" : "=r" (val));
 		break;
 	case 6:
-		asm("mov %%db6, %0" :"=r" (val));
+		asm("mov %%db6, %0" : "=r" (val));
 		break;
 	case 7:
-		asm("mov %%db7, %0" :"=r" (val));
+		asm("mov %%db7, %0" : "=r" (val));
 		break;
 	default:
 		val = 0;
@@ -120,7 +121,8 @@ void dump_regs(struct irq_regs *regs)
 	printf("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
 		regs->esi, regs->edi, regs->ebp, regs->esp);
 	printf(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
-	       (u16)regs->xds, (u16)regs->xes, (u16)regs->xfs, (u16)regs->xgs, (u16)regs->xss);
+	       (u16)regs->xds, (u16)regs->xes, (u16)regs->xfs,
+	       (u16)regs->xgs, (u16)regs->xss);
 
 	cr0 = read_cr0();
 	cr2 = read_cr2();
@@ -164,13 +166,13 @@ struct idt_entry {
 	u8	res;
 	u8	access;
 	u16	base_high;
-} __attribute__ ((packed));
+} __packed;
 
 struct desc_ptr {
 	unsigned short size;
 	unsigned long address;
 	unsigned short segment;
-} __attribute__((packed));
+} __packed;
 
 struct idt_entry idt[256];
 
@@ -178,7 +180,7 @@ struct desc_ptr idt_ptr;
 
 static inline void load_idt(const struct desc_ptr *dtr)
 {
-	asm volatile("cs lidt %0"::"m" (*dtr));
+	asm volatile("cs lidt %0" : : "m" (*dtr));
 }
 
 void set_vector(u8 intnum, void *routine)
@@ -187,6 +189,11 @@ void set_vector(u8 intnum, void *routine)
 	idt[intnum].base_low = (u16)((u32)(routine) & 0xffff);
 }
 
+/*
+ * Ideally these would be defined static to avoid a checkpatch warning, but
+ * the compiler cannot see them in the inline asm and complains that they
+ * aren't defined
+ */
 void irq_0(void);
 void irq_1(void);
 
@@ -201,7 +208,7 @@ int cpu_init_interrupts(void)
 	disable_interrupts();
 
 	/* Setup the IDT */
-	for (i=0;i<256;i++) {
+	for (i = 0; i < 256; i++) {
 		idt[i].access = 0x8e;
 		idt[i].res = 0;
 		idt[i].selector = 0x10;
@@ -238,7 +245,7 @@ int disable_interrupts(void)
 
 	asm volatile ("pushfl ; popl %0 ; cli\n" : "=g" (flags) : );
 
-	return flags & X86_EFLAGS_IF; /* IE flags is bit 9 */
+	return flags & X86_EFLAGS_IF;
 }
 
 /* IRQ Low-Level Service Routine */

--
1.7.5.2.317.g391b14

#8 lore raw

PATCH v2 3/12 cosmetic: checkpatch cleanup of arch/x86/cpu/sc520/*.c

In reply to Graeme Russ

---
Changes for v2:
- Consolidated patch series
- Fixed remaining checkpatch warnings
- Removed references to CONFIG_SYS_SDRAM_ECC_ENABLE - This was never used and never will be (sc520 is now end-of-life) and was generating checkpatch errors because of the inline assembler

 arch/x86/cpu/sc520/sc520.c       |    2 +-
 arch/x86/cpu/sc520/sc520_pci.c   |   24 ++++++++++-------
 arch/x86/cpu/sc520/sc520_sdram.c |   53 --------------------------------------
 arch/x86/cpu/sc520/sc520_ssi.c   |   43 +++++++++++++++---------------
 arch/x86/cpu/sc520/sc520_timer.c |    4 +-
 5 files changed, 39 insertions(+), 87 deletions(-)
arch/x86/cpu/sc520/sc520.c +1 -1
index 4892c01..3fe85e7 100644
@@ -49,7 +49,7 @@ int cpu_init_f(void)
 	asm("movl	$0x2000, %%ecx\n"
 	    "0:		pushl %%ecx\n"
 	    "popl	%%ecx\n"
-	    "loop 0b\n": : : "ecx");
+	    "loop 0b\n" : : : "ecx");
 
 	return x86_cpu_init_f();
 }
arch/x86/cpu/sc520/sc520_pci.c +14 -10
index e26793a..a13798f 100644
@@ -70,26 +70,28 @@ int pci_sc520_set_irq(int pci_pin, int irq)
 
 	debug("set_irq(): map INT%c to IRQ%d\n", pci_pin + 'A', irq);
 
-	if (irq < 0 || irq > 15) {
+	if (irq < 0 || irq > 15)
 		return -1; /* illegal irq */
-	}
 
-	if (pci_pin < 0 || pci_pin > 15) {
+	if (pci_pin < 0 || pci_pin > 15)
 		return -1; /* illegal pci int pin */
-	}
 
 	/* first disable any non-pci interrupt source that use
 	 * this level */
 
 	/* PCI interrupt mapping (A through D)*/
-	for (i=0; i<=3 ;i++) {
-		if (readb(&sc520_mmcr->pci_int_map[i]) == sc520_irq[irq].priority)
+	for (i = 0; i <= 3 ; i++) {
+		tmpb = readb(&sc520_mmcr->pci_int_map[i]);
+
+		if (tmpb == sc520_irq[irq].priority)
 			writeb(SC520_IRQ_DISABLED, &sc520_mmcr->pci_int_map[i]);
 	}
 
 	/* GP IRQ interrupt mapping */
-	for (i=0; i<=10 ;i++) {
-		if (readb(&sc520_mmcr->gp_int_map[i]) == sc520_irq[irq].priority)
+	for (i = 0; i <= 10 ; i++) {
+		tmpb = readb(&sc520_mmcr->gp_int_map[i]);
+
+		if (tmpb == sc520_irq[irq].priority)
 			writeb(SC520_IRQ_DISABLED, &sc520_mmcr->gp_int_map[i]);
 	}
 
@@ -102,10 +104,12 @@ int pci_sc520_set_irq(int pci_pin, int irq)
 	if (pci_pin < 4) {
 		/* PCI INTA-INTD */
 		/* route the interrupt */
-		writeb(sc520_irq[irq].priority, &sc520_mmcr->pci_int_map[pci_pin]);
+		writeb(sc520_irq[irq].priority,
+				&sc520_mmcr->pci_int_map[pci_pin]);
 	} else {
 		/* GPIRQ0-GPIRQ10 used for additional PCI INTS */
-		writeb(sc520_irq[irq].priority, &sc520_mmcr->gp_int_map[pci_pin - 4]);
+		writeb(sc520_irq[irq].priority,
+				&sc520_mmcr->gp_int_map[pci_pin - 4]);
 
 		/* also set the polarity in this case */
 		tmpw = readw(&sc520_mmcr->intpinpol);
arch/x86/cpu/sc520/sc520_sdram.c +0 -53

71 lines not on this page · raw message

arch/x86/cpu/sc520/sc520_ssi.c +22 -21

83 lines not on this page · raw message

arch/x86/cpu/sc520/sc520_timer.c +2 -2
index 05bc9c1..495a694 100644
@@ -38,7 +38,7 @@ void sc520_timer_isr(void)
 int timer_init(void)
 {
 	/* Register the SC520 specific timer interrupt handler */
-	register_timer_isr (sc520_timer_isr);
+	register_timer_isr(sc520_timer_isr);
 
 	/* Install interrupt handler for GP Timer 1 */
 	irq_install_handler (0, timer_isr, NULL);
@@ -62,7 +62,7 @@ int timer_init(void)
 	writew(100, &sc520_mmcr->gptmr1maxcmpa);
 	writew(0xe009, &sc520_mmcr->gptmr1ctl);
 
-	unmask_irq (0);
+	unmask_irq(0);
 
 	/* Clear the GP Timer 1 status register to get the show rolling*/
 	writeb(0x02, &sc520_mmcr->gptmrsta);

--
1.7.5.2.317.g391b14

#11 lore raw

PATCH v2 4/12 cosmetic: checkpatch cleanup of arch/x86/lib/*.c

In reply to Graeme Russ

---
Changes for v2:
- Consolidated patch series
- Fixed more warnings

This patch has 23 checkpatch errors all associated with asm statements which checkpatch does not know how to deal with

This patch has 3 checkpatch warnings, all of which are 'line over 80 characters' which:

- One is caused by printf() strings which, IMHO, would have reduced readability if split

- Two are due to calculations which could be shortened by converting the x86 zImage/bzImage header offsets into a structure (which should be done on principle anyway) - This is a big change prone to the introduction of bugs and will, therefore, be done later after the current x86 backlog stabilises

 arch/x86/include/asm/pci.h        |    3 +
 arch/x86/include/asm/realmode.h   |    4 +
 arch/x86/include/asm/u-boot-x86.h |    8 ++
 arch/x86/lib/bios.h               |  201 ++++++++++++++++++++++++++-----------
 arch/x86/lib/bios_pci.S           |   92 ++++++++++++------
 arch/x86/lib/bios_setup.c         |   93 +++--------------
 arch/x86/lib/board.c              |  114 ++++++++++-----------
 arch/x86/lib/bootm.c              |   23 ++--
 arch/x86/lib/interrupts.c         |   20 ++--
 arch/x86/lib/pcat_interrupts.c    |    2 +-
 arch/x86/lib/pcat_timer.c         |   37 ++++----
 arch/x86/lib/pci.c                |   63 ++++++------
 arch/x86/lib/pci_type1.c          |    9 +-
 arch/x86/lib/realmode.c           |   20 ++--
 arch/x86/lib/timer.c              |   16 ++--
 arch/x86/lib/video.c              |    6 +-
 arch/x86/lib/video_bios.c         |  143 +++++++++++++++------------
 arch/x86/lib/zimage.c             |   94 ++++++++++--------
 18 files changed, 516 insertions(+), 432 deletions(-)
arch/x86/include/asm/pci.h +3 -0
index 85f60d7..c09078e 100644
@@ -26,6 +26,9 @@
 #ifndef _PCI_I386_H_
 #define _PCI_I386_H_	1
 
+#define DEFINE_PCI_DEVICE_TABLE(_table) \
+	const struct pci_device_id _table[]
+
 void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data);
 int pci_enable_legacy_video_ports(struct pci_controller* hose);
 int pci_shadow_rom(pci_dev_t dev, unsigned char *dest);
arch/x86/include/asm/realmode.h +4 -0
index c62310e..0f12a89 100644
@@ -25,6 +25,10 @@
 #define __ASM_REALMODE_H_
 #include <asm/ptrace.h>
 
+extern ulong __realmode_start;
+extern ulong __realmode_size;
+extern char realmode_enter;
+
 int bios_setup(void);
 int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out);
 int enter_realmode_int(u8 lvl, struct pt_regs *in, struct pt_regs *out);
arch/x86/include/asm/u-boot-x86.h +8 -0
index d3e2f4c..755f88a 100644
@@ -24,6 +24,14 @@
 #ifndef _U_BOOT_I386_H_
 #define _U_BOOT_I386_H_	1
 
+/* Exports from the Linker Script */
+extern ulong __text_start;
+extern ulong __data_end;
+extern ulong __rel_dyn_start;
+extern ulong __rel_dyn_end;
+extern ulong __bss_start;
+extern ulong __bss_end;
+
 /* cpu/.../cpu.c */
 int x86_cpu_init_r(void);
 int cpu_init_r(void);
arch/x86/lib/bios.h +141 -60

210 lines not on this page · raw message

arch/x86/lib/bios_pci.S +63 -29

196 lines not on this page · raw message

arch/x86/lib/bios_setup.c +15 -78

149 lines not on this page · raw message

arch/x86/lib/board.c +55 -59

241 lines not on this page · raw message

arch/x86/lib/bootm.c +12 -11
index a21a21f..836803c 100644
@@ -32,7 +32,8 @@
 #include <asm/zimage.h>
 
 /*cmd_boot.c*/
-int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char * const argv[],
+		bootm_headers_t *images)
 {
 	void		*base_ptr;
 	ulong		os_data, os_len;
@@ -48,41 +49,41 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima
 
 	if (images->legacy_hdr_valid) {
 		hdr = images->legacy_hdr_os;
-		if (image_check_type (hdr, IH_TYPE_MULTI)) {
+		if (image_check_type(hdr, IH_TYPE_MULTI)) {
 			/* if multi-part image, we need to get first subimage */
-			image_multi_getimg (hdr, 0, &os_data, &os_len);
+			image_multi_getimg(hdr, 0, &os_data, &os_len);
 		} else {
 			/* otherwise get image data */
-			os_data = image_get_data (hdr);
-			os_len = image_get_data_size (hdr);
+			os_data = image_get_data(hdr);
+			os_len = image_get_data_size(hdr);
 		}
 #if defined(CONFIG_FIT)
 	} else if (images->fit_uname_os) {
-		ret = fit_image_get_data (images->fit_hdr_os,
+		ret = fit_image_get_data(images->fit_hdr_os,
 					images->fit_noffset_os, &data, &len);
 		if (ret) {
-			puts ("Can't get image data/size!\n");
+			puts("Can't get image data/size!\n");
 			goto error;
 		}
 		os_data = (ulong)data;
 		os_len = (ulong)len;
 #endif
 	} else {
-		puts ("Could not find kernel image!\n");
+		puts("Could not find kernel image!\n");
 		goto error;
 	}
 
-	base_ptr = load_zimage ((void*)os_data, os_len,
+	base_ptr = load_zimage((void *)os_data, os_len,
 			images->rd_start, images->rd_end - images->rd_start, 0);
 
 	if (NULL == base_ptr) {
-		printf ("## Kernel loading failed ...\n");
+		printf("## Kernel loading failed ...\n");
 		goto error;
 
 	}
 
 #ifdef DEBUG
-	printf ("## Transferring control to Linux (at address %08x) ...\n",
+	printf("## Transferring control to Linux (at address %08x) ...\n",
 		(u32)base_ptr);
 #endif
 
arch/x86/lib/interrupts.c +10 -10
index 04a9c79..76fbe9d 100644
@@ -56,8 +56,8 @@ struct irq_action {
 };
 
 static struct irq_action irq_handlers[CONFIG_SYS_NUM_IRQS] = { {0} };
-static int spurious_irq_cnt = 0;
-static int spurious_irq = 0;
+static int spurious_irq_cnt;
+static int spurious_irq;
 
 void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 {
@@ -70,10 +70,10 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 
 	if (irq_handlers[irq].handler != NULL)
 		printf("irq_install_handler: 0x%08lx replacing 0x%08lx\n",
-		       (ulong) handler,
-		       (ulong) irq_handlers[irq].handler);
+				(ulong) handler,
+				(ulong) irq_handlers[irq].handler);
 
-	status = disable_interrupts ();
+	status = disable_interrupts();
 
 	irq_handlers[irq].handler = handler;
 	irq_handlers[irq].arg = arg;
@@ -96,7 +96,7 @@ void irq_free_handler(int irq)
 		return;
 	}
 
-	status = disable_interrupts ();
+	status = disable_interrupts();
 
 	mask_irq(irq);
 
@@ -141,14 +141,14 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int irq;
 
 	printf("Spurious IRQ: %u, last unknown IRQ: %d\n",
-	       spurious_irq_cnt, spurious_irq);
+			spurious_irq_cnt, spurious_irq);
 
-	printf ("Interrupt-Information:\n");
-	printf ("Nr  Routine   Arg       Count\n");
+	printf("Interrupt-Information:\n");
+	printf("Nr  Routine   Arg       Count\n");
 
 	for (irq = 0; irq <= CONFIG_SYS_NUM_IRQS; irq++) {
 		if (irq_handlers[irq].handler != NULL) {
-			printf ("%02d  %08lx  %08lx  %d\n",
+			printf("%02d  %08lx  %08lx  %d\n",
 					irq,
 					(ulong)irq_handlers[irq].handler,
 					(ulong)irq_handlers[irq].arg,
arch/x86/lib/pcat_interrupts.c +1 -1
index 2caae20..5dac498 100644
@@ -76,7 +76,7 @@ int interrupt_init(void)
 	 * Enable cascaded interrupts by unmasking the cascade IRQ pin of
 	 * the master PIC
 	 */
-	unmask_irq (2);
+	unmask_irq(2);
 
 	enable_interrupts();
 
arch/x86/lib/pcat_timer.c +18 -19
index f2a5422..6b3db69 100644
@@ -30,7 +30,7 @@
 #define TIMER0_VALUE 0x04aa /* 1kHz 1.9318MHz / 1000 */
 #define TIMER2_VALUE 0x0a8e /* 440Hz */
 
-static int timer_init_done = 0;
+static int timer_init_done;
 
 int timer_init(void)
 {
@@ -42,18 +42,18 @@ int timer_init(void)
 	 * (to stasrt a beep: write 3 to port 0x61,
 	 * to stop it again: write 0)
 	 */
-	outb (PIT_CMD_CTR0 | PIT_CMD_BOTH | PIT_CMD_MODE2,
-	      PIT_BASE + PIT_COMMAND);
-	outb (TIMER0_VALUE & 0xff, PIT_BASE + PIT_T0);
-	outb (TIMER0_VALUE >> 8, PIT_BASE + PIT_T0);
+	outb(PIT_CMD_CTR0 | PIT_CMD_BOTH | PIT_CMD_MODE2,
+			PIT_BASE + PIT_COMMAND);
+	outb(TIMER0_VALUE & 0xff, PIT_BASE + PIT_T0);
+	outb(TIMER0_VALUE >> 8, PIT_BASE + PIT_T0);
 
-	outb (PIT_CMD_CTR2 | PIT_CMD_BOTH | PIT_CMD_MODE3,
-	      PIT_BASE + PIT_COMMAND);
-	outb (TIMER2_VALUE & 0xff, PIT_BASE + PIT_T2);
-	outb (TIMER2_VALUE >> 8, PIT_BASE + PIT_T2);
+	outb(PIT_CMD_CTR2 | PIT_CMD_BOTH | PIT_CMD_MODE3,
+			PIT_BASE + PIT_COMMAND);
+	outb(TIMER2_VALUE & 0xff, PIT_BASE + PIT_T2);
+	outb(TIMER2_VALUE >> 8, PIT_BASE + PIT_T2);
 
-	irq_install_handler (0, timer_isr, NULL);
-	unmask_irq (0);
+	irq_install_handler(0, timer_isr, NULL);
+	unmask_irq(0);
 
 	timer_init_done = 1;
 
@@ -64,21 +64,20 @@ static u16 read_pit(void)
 {
 	u8 low;
 
-	outb (PIT_CMD_LATCH, PIT_BASE + PIT_COMMAND);
-	low = inb (PIT_BASE + PIT_T0);
+	outb(PIT_CMD_LATCH, PIT_BASE + PIT_COMMAND);
+	low = inb(PIT_BASE + PIT_T0);
 
-	return ((inb (PIT_BASE + PIT_T0) << 8) | low);
+	return (inb(PIT_BASE + PIT_T0) << 8) | low;
 }
 
 /* this is not very exact */
-void __udelay (unsigned long usec)
+void __udelay(unsigned long usec)
 {
 	int counter;
 	int wraps;
 
-	if (timer_init_done)
-	{
-		counter = read_pit ();
+	if (timer_init_done) {
+		counter = read_pit();
 		wraps = usec / 1000;
 		usec = usec % 1000;
 
@@ -92,7 +91,7 @@ void __udelay (unsigned long usec)
 		}
 
 		while (1) {
-			int new_count = read_pit ();
+			int new_count = read_pit();
 
 			if (((new_count < usec) && !wraps) || wraps < 0)
 				break;
arch/x86/lib/pci.c +33 -30

113 lines not on this page · raw message

arch/x86/lib/pci_type1.c +4 -5
index da1d356..6fc4df4 100644
@@ -29,7 +29,7 @@
 #include <asm/io.h>
 #include <pci.h>
 
-#define cfg_read(val, addr, op)	*val = op((int)(addr))
+#define cfg_read(val, addr, op)		(*val = op((int)(addr)))
 #define cfg_write(val, addr, op)	op((val), (int)(addr))
 
 #define TYPE1_PCI_OP(rw, size, type, op, mask)				\
@@ -42,7 +42,6 @@ type1_##rw##_config_##size(struct pci_controller *hose,			\
 	return 0;							\
 }
 
-
 TYPE1_PCI_OP(read, byte, u8 *, inb, 3)
 TYPE1_PCI_OP(read, word, u16 *, inw, 2)
 TYPE1_PCI_OP(read, dword, u32 *, inl, 0)
@@ -51,7 +50,7 @@ TYPE1_PCI_OP(write, byte, u8, outb, 3)
 TYPE1_PCI_OP(write, word, u16, outw, 2)
 TYPE1_PCI_OP(write, dword, u32, outl, 0)
 
-void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
+void pci_setup_type1(struct pci_controller *hose, u32 cfg_addr, u32 cfg_data)
 {
 	pci_set_ops(hose,
 		    type1_read_config_byte,
@@ -61,6 +60,6 @@ void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
 		    type1_write_config_word,
 		    type1_write_config_dword);
 
-	hose->cfg_addr = (unsigned int *) cfg_addr;
-	hose->cfg_data = (unsigned char *) cfg_data;
+	hose->cfg_addr = (unsigned int *)cfg_addr;
+	hose->cfg_data = (unsigned char *)cfg_data;
 }
arch/x86/lib/realmode.c +8 -12
index 6aa0f23..5a525ee 100644
@@ -26,11 +26,7 @@
 #include <asm/ptrace.h>
 #include <asm/realmode.h>
 
-#define REALMODE_MAILBOX ((char*)0xe00)
-
-extern ulong __realmode_start;
-extern ulong __realmode_size;
-extern char realmode_enter;
+#define REALMODE_MAILBOX ((char *)0xe00)
 
 int realmode_setup(void)
 {
@@ -63,15 +59,14 @@ int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out)
 
 	in->eip = off;
 	in->xcs = seg;
-	if (3>(in->esp & 0xffff)) {
+	if ((in->esp & 0xffff) < 4)
 		printf("Warning: entering realmode with sp < 4 will fail\n");
-	}
 
 	memcpy(REALMODE_MAILBOX, in, sizeof(struct pt_regs));
 	asm("wbinvd\n");
 
 	__asm__ volatile (
-		 "lcall $0x20,%0\n"  : :  "i" (&realmode_enter) );
+		 "lcall $0x20,%0\n" : : "i" (&realmode_enter));
 
 	asm("wbinvd\n");
 	memcpy(out, REALMODE_MAILBOX, sizeof(struct pt_regs));
@@ -79,9 +74,10 @@ int enter_realmode(u16 seg, u16 off, struct pt_regs *in, struct pt_regs *out)
 	return out->eax;
 }
 
-
-/* This code is supposed to access a realmode interrupt
- * it does currently not work for me */
+/*
+ * This code is supposed to access a realmode interrupt
+ * it does currently not work for me
+ */
 int enter_realmode_int(u8 lvl, struct pt_regs *in, struct pt_regs *out)
 {
 	/* place two instructions at 0x700 */
@@ -92,5 +88,5 @@ int enter_realmode_int(u8 lvl, struct pt_regs *in, struct pt_regs *out)
 
 	enter_realmode(0x00, 0x700, in, out);
 
-	return out->eflags&1;
+	return out->eflags & 0x00000001;
 }
arch/x86/lib/timer.c +8 -8
index 8b1bde7..fd7032e 100644
@@ -35,15 +35,15 @@ struct timer_isr_function {
 	timer_fnc_t *isr_func;
 };
 
-static struct timer_isr_function *first_timer_isr = NULL;
-static volatile unsigned long system_ticks = 0;
+static struct timer_isr_function *first_timer_isr;
+static unsigned long system_ticks;
 
 /*
  * register_timer_isr() allows multiple architecture and board specific
  * functions to be called every millisecond. Keep the execution time of
  * each function as low as possible
  */
-int register_timer_isr (timer_fnc_t *isr_func)
+int register_timer_isr(timer_fnc_t *isr_func)
 {
 	struct timer_isr_function *new_func;
 	struct timer_isr_function *temp;
@@ -61,7 +61,7 @@ int register_timer_isr (timer_fnc_t *isr_func)
 	 *  Don't allow timer interrupts while the
 	 *  linked list is being modified
 	 */
-	flag = disable_interrupts ();
+	flag = disable_interrupts();
 
 	if (first_timer_isr == NULL) {
 		first_timer_isr = new_func;
@@ -73,7 +73,7 @@ int register_timer_isr (timer_fnc_t *isr_func)
 	}
 
 	if (flag)
-		enable_interrupts ();
+		enable_interrupts();
 
 	return 0;
 }
@@ -89,12 +89,12 @@ void timer_isr(void *unused)
 
 	/* Execute each registered function */
 	while (temp != NULL) {
-		temp->isr_func ();
+		temp->isr_func();
 		temp = temp->next;
 	}
 }
 
-ulong get_timer (ulong base)
+ulong get_timer(ulong base)
 {
-	return (system_ticks - base);
+	return system_ticks - base;
 }
arch/x86/lib/video.c +3 -3
index 0efcf3f..3d6b24d 100644
@@ -123,7 +123,7 @@ static void __video_putc(const char c, int *x, int *y)
 
 static void video_putc(const char c)
 {
-	int x,y,pos;
+	int x, y, pos;
 
 	x = orig_x;
 	y = orig_y;
@@ -142,7 +142,7 @@ static void video_putc(const char c)
 
 static void video_puts(const char *s)
 {
-	int x,y,pos;
+	int x, y, pos;
 	char c;
 
 	x = orig_x;
@@ -187,7 +187,7 @@ int video_init(void)
 	printf("pos %x %d %d\n", pos, orig_x, orig_y);
 #endif
 	if (orig_y > lines)
-		orig_x = orig_y =0;
+		orig_x = orig_y = 0;
 
 	memset(&vga_dev, 0, sizeof(vga_dev));
 	strcpy(vga_dev.name, "vga");
arch/x86/lib/video_bios.c +79 -64

255 lines not on this page · raw message

arch/x86/lib/zimage.c +51 -43

188 lines not on this page · raw message

--
1.7.5.2.317.g391b14

#14 lore raw

PATCH v2 5/12 cosmetic: checkpatch cleanup of board/eNET/*.c

In reply to Graeme Russ

---
Changes for v2:
- Consolidated patch series

 board/eNET/eNET.c     |    8 ++++----
 board/eNET/eNET_pci.c |   19 +++++++++----------
 2 files changed, 13 insertions(+), 14 deletions(-)
board/eNET/eNET.c +4 -4
index c4ed820..429fe1b 100644
@@ -223,7 +223,7 @@ void setup_pcat_compatibility()
 	 *  active low polarity on PIC interrupt pins,
 	 *  active high polarity on all other irq pins
 	 */
-	writew(0x0000,&sc520_mmcr->intpinpol);
+	writew(0x0000, &sc520_mmcr->intpinpol);
 
 	/*
 	 * PIT 0 -> IRQ0
@@ -252,7 +252,7 @@ void setup_pcat_compatibility()
 
 void enet_timer_isr(void)
 {
-	static long enet_ticks = 0;
+	static long enet_ticks;
 
 	enet_ticks++;
 
@@ -281,9 +281,9 @@ void hw_watchdog_reset(void)
 
 void enet_toggle_run_led(void)
 {
-	unsigned char leds_state= inb(LED_LATCH_ADDRESS);
+	unsigned char leds_state = inb(LED_LATCH_ADDRESS);
 	if (leds_state & LED_RUN_BITMASK)
-		outb(leds_state &~ LED_RUN_BITMASK, LED_LATCH_ADDRESS);
+		outb(leds_state & ~LED_RUN_BITMASK, LED_LATCH_ADDRESS);
 	else
 		outb(leds_state | LED_RUN_BITMASK, LED_LATCH_ADDRESS);
 }
board/eNET/eNET_pci.c +9 -10
index 29d13d2..5af4ef7 100644
@@ -38,7 +38,7 @@ static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 		CONFIG_SYS_THIRD_PCI_IRQ,
 		CONFIG_SYS_FORTH_PCI_IRQ
 	};
-	static int next_irq_index=0;
+	static int next_irq_index;
 
 	uchar tmp_pin;
 	int pin;
@@ -47,9 +47,8 @@ static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 	pin = tmp_pin;
 
 	pin -= 1; /* PCI config space use 1-based numbering */
-	if (pin == -1) {
+	if (pin == -1)
 		return; /* device use no irq */
-	}
 
 	/* map device number +  pin to a pin on the sc520 */
 	switch (PCI_DEV(dev)) {
@@ -69,19 +68,19 @@ static void pci_enet_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 
 	if (sc520_pci_ints[pin] == -1) {
 		/* re-route one interrupt for us */
-		if (next_irq_index > 3) {
+		if (next_irq_index > 3)
 			return;
-		}
-		if (pci_sc520_set_irq(pin, irq_list[next_irq_index])) {
+
+		if (pci_sc520_set_irq(pin, irq_list[next_irq_index]))
 			return;
-		}
+
 		next_irq_index++;
 	}
 
-	if (-1 != sc520_pci_ints[pin]) {
-	pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE,
+	if (-1 != sc520_pci_ints[pin])
+		pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE,
 					   sc520_pci_ints[pin]);
-	}
+
 	printf("fixup_irq: device %d pin %c irq %d\n",
 	       PCI_DEV(dev), 'A' + pin, sc520_pci_ints[pin]);
 }

--
1.7.5.2.317.g391b14

#17 lore raw

v2 cover x86: Various cosmetic and minor code fixups

In reply to Graeme Russ
Quoted 4 lines

Of the patches, patch 4 (cosmetic: checkpatch cleanup of arch/x86/lib/*.c) has 23 checkpatch warnings all associated with asm statements which checkpatch does not know how to deal with, and 3 'line over 80 characters' warnings in x86/lib/zimage.c (see above)

Oops, I meant to say all except #4 are checkpatch clean...

Regards,

Graeme

#3 lore raw

PATCH v2 1/12 x86: Call hang() on unrecoverable exception

In reply to Graeme Russ
Quoted 7 lines · Graeme Russ

---
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/interrupts.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#6 lore raw

PATCH v2 2/12 cosmetic: checkpatch cleanup of arch/x86/cpu/*.c

In reply to Graeme Russ
Quoted 8 lines · Graeme Russ

---
Changes for v2:
- Consolidated patch series

 arch/x86/cpu/cpu.c        |   22 +++++++++++-----------
 arch/x86/cpu/interrupts.c |   31 +++++++++++++++++++------------
 2 files changed, 30 insertions(+), 23 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#9 lore raw

PATCH v2 3/12 cosmetic: checkpatch cleanup of arch/x86/cpu/sc520/*.c

In reply to Graeme Russ
Quoted 9 lines · Graeme Russ

---
Changes for v2:
- Consolidated patch series
- Fixed remaining checkpatch warnings
- Removed references to CONFIG_SYS_SDRAM_ECC_ENABLE - This was never used and never will be (sc520 is now end-of-life) and was generating checkpatch errors because of the inline assembler

Quoted 6 lines
 arch/x86/cpu/sc520/sc520.c       |    2 +-
 arch/x86/cpu/sc520/sc520_pci.c   |   24 ++++++++++-------
 arch/x86/cpu/sc520/sc520_sdram.c |   53 --------------------------------------
 arch/x86/cpu/sc520/sc520_ssi.c   |   43 +++++++++++++++---------------
 arch/x86/cpu/sc520/sc520_timer.c |    4 +-
 5 files changed, 39 insertions(+), 87 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#12 lore raw

PATCH v2 4/12 cosmetic: checkpatch cleanup of arch/x86/lib/*.c

In reply to Graeme Russ
Quoted 32 lines · Graeme Russ

---
Changes for v2:
- Consolidated patch series
- Fixed more warnings

This patch has 23 checkpatch errors all associated with asm statements which checkpatch does not know how to deal with

This patch has 3 checkpatch warnings, all of which are 'line over 80 characters' which:

- One is caused by printf() strings which, IMHO, would have reduced readability if split

- Two are due to calculations which could be shortened by converting the x86 zImage/bzImage header offsets into a structure (which should be done on principle anyway) - This is a big change prone to the introduction of bugs and will, therefore, be done later after the current x86 backlog stabilises

 arch/x86/include/asm/pci.h        |    3 +
 arch/x86/include/asm/realmode.h   |    4 +
 arch/x86/include/asm/u-boot-x86.h |    8 ++
 arch/x86/lib/bios.h               |  201 ++++++++++++++++++++++++++-----------
 arch/x86/lib/bios_pci.S           |   92 ++++++++++++------
 arch/x86/lib/bios_setup.c         |   93 +++--------------
 arch/x86/lib/board.c              |  114 ++++++++++-----------
 arch/x86/lib/bootm.c              |   23 ++--
 arch/x86/lib/interrupts.c         |   20 ++--
 arch/x86/lib/pcat_interrupts.c    |    2 +-
 arch/x86/lib/pcat_timer.c         |   37 ++++----
Quoted 8 lines
 arch/x86/lib/pci.c                |   63 ++++++------
 arch/x86/lib/pci_type1.c          |    9 +-
 arch/x86/lib/realmode.c           |   20 ++--
 arch/x86/lib/timer.c              |   16 ++--
 arch/x86/lib/video.c              |    6 +-
 arch/x86/lib/video_bios.c         |  143 +++++++++++++++------------
 arch/x86/lib/zimage.c             |   94 ++++++++++--------
 18 files changed, 516 insertions(+), 432 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme

#15 lore raw

PATCH v2 5/12 cosmetic: checkpatch cleanup of board/eNET/*.c

In reply to Graeme Russ
Quoted 8 lines · Graeme Russ

---
Changes for v2:
- Consolidated patch series

 board/eNET/eNET.c     |    8 ++++----
 board/eNET/eNET_pci.c |   19 +++++++++----------
 2 files changed, 13 insertions(+), 14 deletions(-)

Applied to u-boot-x86

Thanks,

Graeme