ppc64: Some sparse fixes
PATCH 1/1 ppc64: Some sparse fixes
Hi !
This is a batch of sparse fixes for things in arch/ppc64/* and include/asm-ppc64/*
More to come of course...
Signed-off-by Benjamin Herrenschmidt <[email protected]>
include/asm-ppc64/io.h +1 -1
@@ -205,7 +205,7 @@#define ioremap_nocache (addr, size) ioremap((addr), (size))extern int iounmap_explicit (volatile void __iomem *addr,unsigned long size);extern void iounmap (volatile void __iomem *addr); -extern void *reserve_phb_iospace (unsigned long size); +extern void __iomem *reserve_phb_iospace (unsigned long size);/** * virt_to_phys - map virtual addresses to physical
arch/ppc64/kernel/nvram.c +1 -1
@@ -711,7 +711,7 @@/* This doesn't actually zero anything, but it sets the event_logged * word to tell that this event is safely in syslog. */ -int nvram_clear_error_log () +int nvram_clear_error_log (void ) {loff_t tmp_index;int clear_word =ERR_FLAG_ALREADY_LOGGED ;
arch/ppc64/kernel/pci.c +2 -2
@@ -576,7 +576,7 @@static void __devinit pci_process_ISA_OF_ranges (struct device_node *isa_node,unsigned long phb_io_base_phys, -void * phb_io_base_virt) +void __iomem * phb_io_base_virt) {struct isa_range *range;unsigned long pci_addr;
@@ -795,7 +795,7 @@if (get_bus_io_range (bus, &start_phys, &start_virt, &size))return 1 ; -if (iounmap_explicit ((void *) start_virt, size)) +if (iounmap_explicit ((void __iomem *) start_virt, size))return 1 ;return 0 ;
arch/ppc64/kernel/pSeries_pci.c +8 -8
@@ -154,8 +154,8 @@static void python_countermeasures (unsigned long addr) { -void *chip_regs; -volatile u32 *tmp, i; +void __iomem *chip_regs; +volatile u32 val;/* Python's register file is 1 MB in size. */ chip_regs =ioremap (addr & ~(0xfffffUL ),0x100000 );
@@ -167,17 +167,17 @@#define PRG_CL_RESET_VALID 0x00010000 - tmp = (u32 *)((unsigned long )chip_regs +0xf6030 ); - -if (*tmp &PRG_CL_RESET_VALID ) { + val =in_be32 (chip_regs +0xf6030 ); +if (val &PRG_CL_RESET_VALID ) {printk (KERN_INFO "Python workaround: " ); - *tmp &= ~PRG_CL_RESET_VALID ; + val &= ~PRG_CL_RESET_VALID ; +out_be32 (chip_regs +0xf6030 , val);/* * We must read it back for changes to * take effect */ - i = *tmp; -printk ("reg0: %x\n" , i); + val =in_be32 (chip_regs +0xf6030 ); +printk ("reg0: %x\n" , val); }iounmap (chip_regs);
arch/ppc64/kernel/rtasd.c +1 -1
@@ -275,7 +275,7 @@* know that we can safely clear the events in NVRAM. * Next we'll sit and wait for something else to log. */ -static ssize_t rtas_log_read (struct file * file,char * buf, +static ssize_t rtas_log_read (struct file * file,char __user * buf,size_t count,loff_t *ppos) {int error;
arch/ppc64/kernel/xics.c +21 -18
@@ -85,7 +85,7 @@ } qirr; }; -static struct xics_ipl *xics_per_cpu[NR_CPUS ]; +static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS ];static int xics_irq_8259_cascade =0 ;static int xics_irq_8259_cascade_real =0 ;
@@ -116,22 +116,22 @@static int pSeries_xirr_info_get (int n_cpu) { -return xics_per_cpu[n_cpu]->xirr.word; +return in_be32 (&xics_per_cpu[n_cpu]->xirr.word); }static void pSeries_xirr_info_set (int n_cpu,int value) { - xics_per_cpu[n_cpu]->xirr.word = value; +out_be32 (&xics_per_cpu[n_cpu]->xirr.word, value); }static void pSeries_cppr_info (int n_cpu,u8 value) { - xics_per_cpu[n_cpu]->xirr.bytes[0 ] = value; +out_8 (&xics_per_cpu[n_cpu]->xirr.bytes[0 ], value); }static void pSeries_qirr_info (int n_cpu,u8 value) { - xics_per_cpu[n_cpu]->qirr.bytes[0 ] = value; +out_8 (&xics_per_cpu[n_cpu]->qirr.bytes[0 ], value); }static xics_ops pSeries_ops = {
@@ -457,7 +457,7 @@struct xics_interrupt_node {unsigned long addr;unsigned long size; - } inodes[NR_CPUS ]; + } intnodes[NR_CPUS ];ppc64_boot_msg (0x20 ,"XICS Init" );
@@ -484,13 +484,13 @@panic ("xics_init_IRQ: can't find interrupt reg property" );while (ilen) { - inodes[indx].addr = (unsigned long long )*ireg++ <<32 ; + intnodes[indx].addr = (unsigned long )*ireg++ <<32 ; ilen -=sizeof (uint); - inodes[indx].addr |= *ireg++; + intnodes[indx].addr |= *ireg++; ilen -=sizeof (uint); - inodes[indx].size = (unsigned long long )*ireg++ <<32 ; + intnodes[indx].size = (unsigned long )*ireg++ <<32 ; ilen -=sizeof (uint); - inodes[indx].size |= *ireg++; + intnodes[indx].size |= *ireg++; ilen -=sizeof (uint); indx++;if (indx >=NR_CPUS )break ;
@@ -505,7 +505,8 @@ np = of_find_node_by_type(np, "cpu")) { ireg = (uint *)get_property (np,"reg" , &ilen);if (ireg && ireg[0 ] ==hard_smp_processor_id ()) { - ireg = (uint *)get_property (np,"ibm,ppc-interrupt-gserver#s" , &ilen); + ireg = (uint *)get_property (np,"ibm,ppc-interrupt-gserver#s" , + &ilen); i = ilen /sizeof (int );if (ireg && i >0 ) { default_server = ireg[0 ];
@@ -516,8 +517,8 @@ }of_node_put (np); - intr_base = inodes[0 ].addr; - intr_size = (ulong )inodes[0 ].size; + intr_base = intnodes[0 ].addr; + intr_size = intnodes[0 ].size; np =of_find_node_by_type (NULL ,"interrupt-controller" );if (!np) {
@@ -538,16 +539,18 @@if (systemcfg->platform ==PLATFORM_PSERIES ) {#ifdef CONFIG_SMP for_each_cpu (i) { +int hard_id; +/* FIXME: Do this dynamically! --RR */ if (!cpu_present (i))continue ; - xics_per_cpu[i] =__ioremap ((ulong )inodes[get_hard_smp_processor_id (i)].addr, - (ulong )inodes[get_hard_smp_processor_id (i)].size, - _PAGE_NO_CACHE); + + hard_id =get_hard_smp_processor_id (i); + xics_per_cpu[i] =ioremap (intnodes[hard_id].addr, + intnodes[hard_id].size); }#else - xics_per_cpu[0 ] =__ioremap ((ulong )intr_base, intr_size, - _PAGE_NO_CACHE); + xics_per_cpu[0 ] =ioremap (intr_base, intr_size);#endif /* CONFIG_SMP */ }else if (systemcfg->platform ==PLATFORM_PSERIES_LPAR ) { ops = &pSeriesLP_ops;
arch/ppc64/mm/init.c +3 -3
@@ -874,14 +874,14 @@local_irq_restore (flags); } -void *reserve_phb_iospace (unsigned long size) +void __iomem *reserve_phb_iospace (unsigned long size) { -void *virt_addr; +void __iomem *virt_addr;if (phbs_io_bot >=IMALLOC_BASE )panic ("reserve_phb_iospace(): phb io space overflow\n" ); - virt_addr = (void *) phbs_io_bot; + virt_addr = (void __iomem *) phbs_io_bot; phbs_io_bot += size;return virt_addr;
arch/ppc64/kernel/udbg.c +46 -46
181 lines not on this page · raw message
include/asm-ppc64/udbg.h +3 -1
@@ -1,6 +1,8 @@#ifndef __UDBG_HDR#define __UDBG_HDR +#include <linux/compiler.h> +/* * c 2001 PPC 64 Team, IBM Corp *
@@ -10,7 +12,7 @@* 2 of the License, or (at your option) any later version. */ -void udbg_init_uart (void *comport,unsigned int speed); +void udbg_init_uart (void __iomem *comport,unsigned int speed);void udbg_putc (unsigned char c);unsigned char udbg_getc (void );int udbg_getc_poll (void );
arch/ppc64/kernel/proc_ppc64.c +22 -11
@@ -33,7 +33,8 @@#include <asm/prom.h> static loff_t page_map_seek (struct file *file,loff_t off,int whence); -static ssize_t page_map_read (struct file *file,char *buf,size_t nbytes,loff_t *ppos); +static ssize_t page_map_read (struct file *file,char __user *buf,size_t nbytes, +loff_t *ppos);static int page_map_mmap (struct file *file,struct vm_area_struct *vma );static struct file_operations page_map_fops = {
@@ -161,7 +162,8 @@return (file->f_pos = new); } -static ssize_t page_map_read (struct file *file,char __user *buf,size_t nbytes,loff_t *ppos) +static ssize_t page_map_read (struct file *file,char __user *buf,size_t nbytes, +loff_t *ppos) {struct proc_dir_entry *dp =PDE (file->f_dentry->d_inode);return simple_read_from_buffer (buf, nbytes, ppos, dp->data, dp->size);
@@ -208,7 +210,8 @@* whole nodes along with their properties. Operations on individual * properties are not implemented (yet). */ -static ssize_t ofdt_write (struct file *file,const char __user *buf,size_t count,loff_t *off) +static ssize_t ofdt_write (struct file *file,const char __user *buf,size_t count, +loff_t *off) {int rv =0 ;char *kbuf;
@@ -302,7 +305,8 @@return rv; } -static struct property *new_property (const char *name,const int length,const unsigned char *value,struct property *last) +static struct property *new_property (const char *name,const int length, +const unsigned char *value,struct property *last) {struct property *new =kmalloc (sizeof (*new),GFP_KERNEL );
@@ -343,7 +347,8 @@* this function does no allocation or copying of the data. Return value * is set to the next name in buf, or NULL on error. */ -static char *parse_next_property (char *buf,char *end,char **name,int *length,unsigned char **value) +static char *parse_next_property (char *buf,char *end,char **name,int *length, +unsigned char **value) {char *tmp;
@@ -351,13 +356,15 @@ tmp =strchr (buf,' ' );if (!tmp) { -printk (KERN_ERR "property parse failed in %s at line %d\n" , __FUNCTION__, __LINE__); +printk (KERN_ERR "property parse failed in %s at line %d\n" , + __FUNCTION__, __LINE__);return NULL ; } *tmp ='\0' ;if (++tmp >= end) { -printk (KERN_ERR "property parse failed in %s at line %d\n" , __FUNCTION__, __LINE__); +printk (KERN_ERR "property parse failed in %s at line %d\n" , + __FUNCTION__, __LINE__);return NULL ; }
@@ -365,11 +372,13 @@ *length =-1 ; *length =simple_strtoul (tmp, &tmp,10 );if (*length ==-1 ) { -printk (KERN_ERR "property parse failed in %s at line %d\n" , __FUNCTION__, __LINE__); +printk (KERN_ERR "property parse failed in %s at line %d\n" , + __FUNCTION__, __LINE__);return NULL ; }if (*tmp !=' ' || ++tmp >= end) { -printk (KERN_ERR "property parse failed in %s at line %d\n" , __FUNCTION__, __LINE__); +printk (KERN_ERR "property parse failed in %s at line %d\n" , + __FUNCTION__, __LINE__);return NULL ; }
@@ -377,11 +386,13 @@ *value = tmp; tmp += *length;if (tmp > end) { -printk (KERN_ERR "property parse failed in %s at line %d\n" , __FUNCTION__, __LINE__); +printk (KERN_ERR "property parse failed in %s at line %d\n" , + __FUNCTION__, __LINE__);return NULL ; }else if (tmp < end && *tmp !=' ' && *tmp !='\0' ) { -printk (KERN_ERR "property parse failed in %s at line %d\n" , __FUNCTION__, __LINE__); +printk (KERN_ERR "property parse failed in %s at line %d\n" , + __FUNCTION__, __LINE__);return NULL ; } tmp++;
arch/ppc64/kernel/vecemu.c +1 -1
@@ -263,7 +263,7 @@unsigned int va, vb, vc, vd;vector128 *vrs; -if (get_user (instr, (unsigned int *) regs->nip)) +if (get_user (instr, (unsigned int __user *) regs->nip))return -EFAULT ;if ((instr >>26 ) !=4 )return -EINVAL ;/* not an altivec instruction */
arch/ppc64/kernel/lparcfg.c +5 -5
@@ -192,7 +192,7 @@* is coming, but at this time is still problematic, so for now this * function will return 0. */ -static unsigned long get_purr () +static unsigned long get_purr (void ) {unsigned long sum_purr =0 ;return sum_purr;
@@ -524,10 +524,10 @@ }struct file_operations lparcfg_fops = { - owner:THIS_MODULE , - read:seq_read, - open:lparcfg_open, - release:single_release, + .owner =THIS_MODULE , + .read = seq_read, + .open = lparcfg_open, + .release = single_release, };int __init lparcfg_init (void )