mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] x86_64 mixed code/declaration fixes
Date: Tue, 21 Oct 2003 16:26:02 -0700	[thread overview]
Message-ID: <20031021162602.B32703@osdlab.pdx.osdl.net> (raw)

Hi Andi,

I noticed you cleaned up at least include/asm-x86_64/uaccess.h, so
perhaps you'd take some more patches to surpress these warnings? ;-)
Patch is against current 2.6.0-test8-bk.

thanks,
-chris

 ia32/syscall32.c   |    3 ++-
 kernel/aperture.c  |   27 +++++++++++++++++----------
 kernel/bluesmoke.c |    8 +++++---
 kernel/nmi.c       |    4 ++--
 kernel/pci-gart.c  |   15 +++++++--------
 kernel/setup.c     |    2 +-
 kernel/smp.c       |    3 ++-
 lib/csum-partial.c |    5 +++--
 mm/fault.c         |    9 ++++++---
 mm/ioremap.c       |   10 ++++++----
 10 files changed, 51 insertions(+), 35 deletions(-)

===== arch/x86_64/ia32/syscall32.c 1.4 vs edited =====
--- 1.4/arch/x86_64/ia32/syscall32.c	Fri May 23 03:22:07 2003
+++ edited/arch/x86_64/ia32/syscall32.c	Tue Oct 21 15:33:29 2003
@@ -30,10 +30,11 @@
 int map_syscall32(struct mm_struct *mm, unsigned long address) 
 { 
 	pte_t *pte;
+	pmd_t *pmd;
 	int err = 0;
 	down_read(&mm->mmap_sem);
 	spin_lock(&mm->page_table_lock); 
-	pmd_t *pmd = pmd_alloc(mm, pgd_offset(mm, address), address); 
+	pmd = pmd_alloc(mm, pgd_offset(mm, address), address); 
 	if (pmd && (pte = pte_alloc_map(mm, pmd, address)) != NULL) { 
 		if (pte_none(*pte)) { 
 			set_pte(pte, 
===== arch/x86_64/kernel/aperture.c 1.5 vs edited =====
--- 1.5/arch/x86_64/kernel/aperture.c	Fri Aug  8 18:31:35 2003
+++ edited/arch/x86_64/kernel/aperture.c	Tue Oct 21 16:10:35 2003
@@ -87,13 +87,15 @@
 /* Find a PCI capability */ 
 static __u32 __init find_cap(int num, int slot, int func, int cap) 
 { 
+	u8 pos;
+	int bytes;
 	if (!(read_pci_config_16(num,slot,func,PCI_STATUS) & PCI_STATUS_CAP_LIST))
 		return 0;
-	u8 pos = read_pci_config_byte(num,slot,func,PCI_CAPABILITY_LIST);
-	int bytes;
+	pos = read_pci_config_byte(num,slot,func,PCI_CAPABILITY_LIST);
 	for (bytes = 0; bytes < 48 && pos >= 0x40; bytes++) { 
+		u8 id;
 		pos &= ~3; 
-		u8 id = read_pci_config_byte(num,slot,func,pos+PCI_CAP_LIST_ID); 
+		id = read_pci_config_byte(num,slot,func,pos+PCI_CAP_LIST_ID); 
 		if (id == 0xff)
 			break;
 		if (id == cap) 
@@ -106,26 +108,30 @@
 /* Read a standard AGPv3 bridge header */
 static __u32 __init read_agp(int num, int slot, int func, int cap, u32 *order)
 { 
-	printk("AGP bridge at %02x:%02x:%02x\n", num, slot, func); 
 	u32 apsizereg = read_pci_config_16(num,slot,func, cap + 0x14);
+	u32 apsize, aper_low, aper_hi;
+	int nbits;
+	u64 aper;
+
+	printk("AGP bridge at %02x:%02x:%02x\n", num, slot, func); 
 
 	if (apsizereg == 0xffffffff) {
 		printk("APSIZE in AGP bridge unreadable\n");
 		return 0;
 	}
 
-	u32 apsize = apsizereg & 0xfff;
+	apsize = apsizereg & 0xfff;
 	/* Some BIOS use weird encodings not in the AGPv3 table. */
 	if (apsize & 0xff) 
 		apsize |= 0xf00; 
-	int nbits = hweight16(apsize);
+	nbits = hweight16(apsize);
 	*order = 7 - nbits;
 	if ((int)*order < 0) /* < 32MB */
 		*order = 0;
 	
-	u32 aper_low = read_pci_config(num,slot,func, 0x10); 
-	u32 aper_hi = read_pci_config(num,slot,func,0x14); 
-	u64 aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32); 
+	aper_low = read_pci_config(num,slot,func, 0x10); 
+	aper_hi = read_pci_config(num,slot,func,0x14); 
+	aper = (aper_low & ~((1<<22)-1)) | ((u64)aper_hi << 32); 
 
 	printk("Aperture from AGP @ %Lx size %u MB (APSIZE %x)\n", 
 	       aper, 32 << *order, apsizereg);
@@ -155,6 +161,7 @@
 		for (slot = 0; slot < 32; slot++) { 
 			for (func = 0; func < 8; func++) { 
 				u32 class, cap;
+				u8 type;
 				class = read_pci_config(num,slot,func,
 							PCI_CLASS_REVISION);
 				if (class == 0xffffffff)
@@ -172,7 +179,7 @@
 				} 
 				
 				/* No multi-function device? */
-				u8 type = read_pci_config_byte(num,slot,func,
+				type = read_pci_config_byte(num,slot,func,
 							       PCI_HEADER_TYPE);
 				if (!(type & 0x80))
 					break;
===== arch/x86_64/kernel/bluesmoke.c 1.14 vs edited =====
--- 1.14/arch/x86_64/kernel/bluesmoke.c	Fri Jul 11 04:34:21 2003
+++ edited/arch/x86_64/kernel/bluesmoke.c	Tue Oct 21 14:57:45 2003
@@ -200,11 +200,14 @@
 static void check_k8_nb(int header)
 {
 	struct pci_dev *nb;
+	u32 statuslow, statushigh;
+	unsigned short errcode;
+	int i;
+
 	nb = find_k8_nb(); 
 	if (nb == NULL)
 		return;
 
-	u32 statuslow, statushigh;
 	pci_read_config_dword(nb, 0x48, &statuslow);
 	pci_read_config_dword(nb, 0x4c, &statushigh);
 	if (!(statushigh & (1<<31)))
@@ -215,7 +218,7 @@
 	printk(KERN_ERR "Northbridge status %08x%08x\n",
 	       statushigh,statuslow); 
 
-	unsigned short errcode = statuslow & 0xffff;	
+	errcode = statuslow & 0xffff;	
 	switch (errcode >> 8) { 
 	case 0: 					
 		printk(KERN_ERR "    GART TLB error %s %s\n", 
@@ -249,7 +252,6 @@
 	/* should only print when it was a HyperTransport related error. */
 	printk(KERN_ERR "    link number %x\n", (statushigh >> 4) & 3);
 
-	int i;
 	for (i = 0; i < 32; i++) 
 		if (highbits[i] && (statushigh & (1<<i)))
 			printk(KERN_ERR "    %s\n", highbits[i]); 
===== arch/x86_64/kernel/nmi.c 1.17 vs edited =====
--- 1.17/arch/x86_64/kernel/nmi.c	Fri Sep 26 06:53:38 2003
+++ edited/arch/x86_64/kernel/nmi.c	Tue Oct 21 15:05:11 2003
@@ -311,10 +311,10 @@
 
 void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason)
 {
+	int sum, cpu = safe_smp_processor_id();
+
 	if (nmi_watchdog_disabled)
 		return;
-
-	int sum, cpu = safe_smp_processor_id();
 
 	sum = read_pda(apic_timer_irqs);
 	if (last_irq_sums[cpu] == sum) {
===== arch/x86_64/kernel/pci-gart.c 1.22 vs edited =====
--- 1.22/arch/x86_64/kernel/pci-gart.c	Thu Sep 11 16:32:36 2003
+++ edited/arch/x86_64/kernel/pci-gart.c	Tue Oct 21 15:10:43 2003
@@ -112,11 +112,11 @@
 
 static void free_iommu(unsigned long offset, int size)
 { 
+	unsigned long flags;
 	if (size == 1) { 
 		clear_bit(offset, iommu_gart_bitmap); 
 		return;
 	}
-	unsigned long flags;
 	spin_lock_irqsave(&iommu_bitmap_lock, flags);
 	__clear_bit_string(iommu_gart_bitmap, offset, size);
 	spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
@@ -319,6 +319,7 @@
 { 
 	unsigned long npages = to_pages(phys_mem, size);
 	unsigned long iommu_page = alloc_iommu(npages);
+	int i;
 	if (iommu_page == -1) {
 		if (!nonforced_iommu(dev, phys_mem, size))
 			return phys_mem; 
@@ -328,7 +329,6 @@
 		return bad_dma_address;
 	}
 
-	int i;
 	for (i = 0; i < npages; i++) {
 		iommu_gatt_base[iommu_page + i] = GPTE_ENCODE(phys_mem);
 		SET_LEAK(iommu_page + i);
@@ -386,15 +386,16 @@
 		      struct scatterlist *sout, unsigned long pages)
 {
 	unsigned long iommu_start = alloc_iommu(pages);
-	if (iommu_start == -1)
-		return -1;
-
 	unsigned long iommu_page = iommu_start; 
 	int i;
 	
+	if (iommu_start == -1)
+		return -1;
+
 	for (i = start; i < stopat; i++) {
 		struct scatterlist *s = &sg[i];
 		unsigned long start_addr = s->dma_address;
+		unsigned long addr = start_addr;
 		BUG_ON(i > 0 && s->offset);
 		if (i == start) {
 			*sout = *s; 
@@ -403,7 +404,6 @@
 		} else { 
 			sout->length += s->length; 
 		}
-		unsigned long addr = start_addr;
 		while (addr < start_addr + s->length) { 
 			iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr); 
 			SET_LEAK(iommu_page);
@@ -503,13 +503,12 @@
 		      size_t size, int direction)
 {
 	unsigned long iommu_page; 
-	int npages;
+	int npages, i;
 	if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || 
 	    dma_addr > iommu_bus_base + iommu_size)
 		return;
 	iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT;	
 	npages = to_pages(dma_addr, size);
-	int i;
 	for (i = 0; i < npages; i++) { 
 		iommu_gatt_base[iommu_page + i] = 0; 
 		CLEAR_LEAK(iommu_page + i);
===== arch/x86_64/kernel/setup.c 1.24 vs edited =====
--- 1.24/arch/x86_64/kernel/setup.c	Tue Oct  7 16:33:05 2003
+++ edited/arch/x86_64/kernel/setup.c	Tue Oct 21 14:55:34 2003
@@ -332,6 +332,7 @@
 void __init setup_arch(char **cmdline_p)
 {
 	unsigned long low_mem_size;
+	unsigned long kernel_end;
 
  	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
  	drive_info = DRIVE_INFO;
@@ -380,7 +381,6 @@
 				(table_end - table_start) << PAGE_SHIFT);
 
 	/* reserve kernel */
-	unsigned long kernel_end;
 	kernel_end = round_up(__pa_symbol(&_end),PAGE_SIZE);
 	reserve_bootmem_generic(HIGH_MEMORY, kernel_end - HIGH_MEMORY);
 
===== arch/x86_64/kernel/smp.c 1.17 vs edited =====
--- 1.17/arch/x86_64/kernel/smp.c	Mon Aug 18 19:46:23 2003
+++ edited/arch/x86_64/kernel/smp.c	Tue Oct 21 14:59:03 2003
@@ -496,13 +496,14 @@
 	int offset = 0, cpu;
 
 	for (offset = 0; next_cpu(offset, cpu_online_map) < NR_CPUS; offset = cpu + 1) {
+		unsigned long estack;
 		cpu = next_cpu(offset, cpu_online_map);
 
 		if (sp >= (u64)cpu_pda[cpu].irqstackptr - IRQSTACKSIZE && 
 		    sp <= (u64)cpu_pda[cpu].irqstackptr)
 			return cpu;
 
-		unsigned long estack = init_tss[cpu].ist[0] - EXCEPTION_STKSZ;
+		estack = init_tss[cpu].ist[0] - EXCEPTION_STKSZ;
 		if (sp >= estack && sp <= estack+(1<<(PAGE_SHIFT+EXCEPTION_STK_ORDER)))
 			return cpu;			
 	}
===== arch/x86_64/lib/csum-partial.c 1.4 vs edited =====
--- 1.4/arch/x86_64/lib/csum-partial.c	Tue Oct  7 19:53:42 2003
+++ edited/arch/x86_64/lib/csum-partial.c	Tue Oct 21 15:35:50 2003
@@ -48,6 +48,8 @@
 	}
 	count = len >> 1;		/* nr of 16-bit words.. */
 	if (count) {
+		unsigned long zero = 0; 
+		unsigned count64;
 		if (2 & (unsigned long) buff) {
 			result += *(unsigned short *)buff;
 			count--;
@@ -65,8 +67,7 @@
 			count >>= 1;	/* nr of 64-bit words.. */
 
 			/* main loop using 64byte blocks */
-				unsigned long zero = 0; 
-			unsigned count64 = count >> 3; 
+			count64 = count >> 3; 
 			while (count64) { 
 				asm("addq 0*8(%[src]),%[res]\n\t"
 				    "adcq 1*8(%[src]),%[res]\n\t"
===== arch/x86_64/mm/fault.c 1.15 vs edited =====
--- 1.15/arch/x86_64/mm/fault.c	Thu Sep 25 19:27:11 2003
+++ edited/arch/x86_64/mm/fault.c	Tue Oct 21 15:23:02 2003
@@ -143,6 +143,9 @@
 
 void dump_pagetable(unsigned long address)
 {
+	pgd_t *pgd;
+	pmd_t *pmd;
+	pte_t *pte;
 	pml4_t *pml4;
 	asm("movq %%cr3,%0" : "=r" (pml4));
 
@@ -152,17 +155,17 @@
 	if (bad_address(pml4)) goto bad;
 	if (!pml4_present(*pml4)) goto ret; 
 
-	pgd_t *pgd = __pgd_offset_k((pgd_t *)pml4_page(*pml4), address); 
+	pgd = __pgd_offset_k((pgd_t *)pml4_page(*pml4), address); 
 	if (bad_address(pgd)) goto bad;
 	printk("PGD %lx ", pgd_val(*pgd)); 
 	if (!pgd_present(*pgd))	goto ret;
 
-	pmd_t *pmd = pmd_offset(pgd, address); 
+	pmd = pmd_offset(pgd, address); 
 	if (bad_address(pmd)) goto bad;
 	printk("PMD %lx ", pmd_val(*pmd));
 	if (!pmd_present(*pmd))	goto ret;	 
 
-	pte_t *pte = pte_offset_kernel(pmd, address);
+	pte = pte_offset_kernel(pmd, address);
 	if (bad_address(pte)) goto bad;
 	printk("PTE %lx", pte_val(*pte)); 
 ret:
===== arch/x86_64/mm/ioremap.c 1.11 vs edited =====
--- 1.11/arch/x86_64/mm/ioremap.c	Thu Oct  2 00:11:59 2003
+++ edited/arch/x86_64/mm/ioremap.c	Tue Oct 21 15:32:49 2003
@@ -138,10 +138,12 @@
 		t_end = t_addr + (size - 1);
 	   
 #ifndef CONFIG_DISCONTIGMEM	 
- 		struct page *page;
-		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
-			if(!PageReserved(page))
-				return NULL;
+		{
+ 			struct page *page;
+			for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
+				if(!PageReserved(page))
+					return NULL;
+		}
 #endif
 	}
 

                 reply	other threads:[~2003-10-21 23:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031021162602.B32703@osdlab.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®