Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@nuts.davemloft.net>2005-02-10 08:33:55 -0800
committerDavid S. Miller <davem@nuts.davemloft.net>2005-02-10 08:33:55 -0800
commit313ef38bdb4e28e0af626ec3c2ea7e77544970c3 (patch)
treec3739e76e32feda96c27129561810a9773aee2c7
parenteeca3f3459cae2a1446b1a9b9b1a2c0805471b21 (diff)
parent8bf955856715e9b428b6633364f5441a6475f5a3 (diff)
Merge nuts.davemloft.net:/disk1/BK/sparcwork-2.6
into nuts.davemloft.net:/disk1/BK/sparc-2.6
-rw-r--r--Documentation/atomic_ops.txt18
-rw-r--r--arch/sparc/kernel/pcic.c42
-rw-r--r--arch/sparc/kernel/ptrace.c12
-rw-r--r--arch/sparc/kernel/signal.c4
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c4
-rw-r--r--arch/sparc/kernel/sys_sparc.c3
-rw-r--r--arch/sparc/lib/atomic32.c3
-rw-r--r--arch/sparc64/kernel/ptrace.c6
-rw-r--r--arch/sparc64/prom/memory.c10
-rw-r--r--drivers/net/sunlance.c135
-rw-r--r--include/asm-sparc/checksum.h8
-rw-r--r--include/asm-sparc/elf.h4
-rw-r--r--include/asm-sparc/floppy.h2
-rw-r--r--include/asm-sparc/io.h12
-rw-r--r--include/asm-sparc/svr4.h6
-rw-r--r--include/asm-sparc/system.h2
-rw-r--r--include/asm-sparc64/fbio.h4
-rw-r--r--include/asm-sparc64/io.h4
18 files changed, 146 insertions, 133 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index 6f8793752022..8eedaa24f5e2 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -119,15 +119,15 @@ If a caller requires memory barrier semantics around an atomic_t
operation which does not return a value, a set of interfaces are
defined which accomplish this:
- void smb_mb__before_atomic_dec(void);
- void smb_mb__after_atomic_dec(void);
- void smb_mb__before_atomic_inc(void);
- void smb_mb__after_atomic_dec(void);
+ void smp_mb__before_atomic_dec(void);
+ void smp_mb__after_atomic_dec(void);
+ void smp_mb__before_atomic_inc(void);
+ void smp_mb__after_atomic_dec(void);
-For example, smb_mb__before_atomic_dec() can be used like so:
+For example, smp_mb__before_atomic_dec() can be used like so:
obj->dead = 1;
- smb_mb__before_atomic_dec();
+ smp_mb__before_atomic_dec();
atomic_dec(&obj->ref_count);
It makes sure that all memory operations preceeding the atomic_dec()
@@ -136,14 +136,14 @@ operation. In the above example, it guarentees that the assignment of
"1" to obj->dead will be globally visible to other cpus before the
atomic counter decrement.
-Without the explicitl smb_mb__before_atomic_dec() call, the
+Without the explicitl smp_mb__before_atomic_dec() call, the
implementation could legally allow the atomic counter update visible
to other cpus before the "obj->dead = 1;" assignment.
The other three interfaces listed are used to provide explicit
ordering with respect to memory operations after an atomic_dec() call
-(smb_mb__after_atomic_dec()) and around atomic_inc() calls
-(smb_mb__{before,after}_atomic_inc()).
+(smp_mb__after_atomic_dec()) and around atomic_inc() calls
+(smp_mb__{before,after}_atomic_inc()).
A missing memory barrier in the cases where they are required by the
atomic_t implementation above can have disasterous results. Here is
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index bff4e7d28ff4..597d3ff6ad68 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -975,60 +975,66 @@ int pcibios_assign_resource(struct pci_dev *pdev, int resource)
* We do not use horroble macroses here because we want to
* advance pointer by sizeof(size).
*/
-void outsb(void * __iomem addr, const void *src, unsigned long count) {
+void outsb(unsigned long addr, const void *src, unsigned long count)
+{
while (count) {
count -= 1;
- writeb(*(const char *)src, addr);
+ outb(*(const char *)src, addr);
src += 1;
- addr += 1;
+ /* addr += 1; */
}
}
-void outsw(void * __iomem addr, const void *src, unsigned long count) {
+void outsw(unsigned long addr, const void *src, unsigned long count)
+{
while (count) {
count -= 2;
- writew(*(const short *)src, addr);
+ outw(*(const short *)src, addr);
src += 2;
- addr += 2;
+ /* addr += 2; */
}
}
-void outsl(void * __iomem addr, const void *src, unsigned long count) {
+void outsl(unsigned long addr, const void *src, unsigned long count)
+{
while (count) {
count -= 4;
- writel(*(const long *)src, addr);
+ outl(*(const long *)src, addr);
src += 4;
- addr += 4;
+ /* addr += 4; */
}
}
-void insb(void * __iomem addr, void *dst, unsigned long count) {
+void insb(unsigned long addr, void *dst, unsigned long count)
+{
while (count) {
count -= 1;
- *(unsigned char *)dst = readb(addr);
+ *(unsigned char *)dst = inb(addr);
dst += 1;
- addr += 1;
+ /* addr += 1; */
}
}
-void insw(void * __iomem addr, void *dst, unsigned long count) {
+void insw(unsigned long addr, void *dst, unsigned long count)
+{
while (count) {
count -= 2;
- *(unsigned short *)dst = readw(addr);
+ *(unsigned short *)dst = inw(addr);
dst += 2;
- addr += 2;
+ /* addr += 2; */
}
}
-void insl(void * __iomem addr, void *dst, unsigned long count) {
+void insl(unsigned long addr, void *dst, unsigned long count)
+{
while (count) {
count -= 4;
/*
* XXX I am sure we are in for an unaligned trap here.
*/
- *(unsigned long *)dst = readl(addr);
+ *(unsigned long *)dst = inl(addr);
dst += 4;
- addr += 4;
+ /* addr += 4; */
}
}
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 62b8fd1dba7f..9cd81b47f0ee 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -48,9 +48,9 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
}
static void
-pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
+pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long __user *addr)
{
- if (put_user(value, (long __user *) addr)) {
+ if (put_user(value, addr)) {
pt_error_return(regs, EFAULT);
return;
}
@@ -61,7 +61,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
}
static void
-pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr)
+pt_os_succ_return (struct pt_regs *regs, unsigned long val, long __user *addr)
{
if (current->personality == PER_SUNOS)
pt_succ_return (regs, val);
@@ -71,7 +71,7 @@ pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr)
/* Fuck me gently with a chainsaw... */
static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset,
- struct task_struct *tsk, long *addr)
+ struct task_struct *tsk, long __user *addr)
{
struct pt_regs *cregs = tsk->thread.kregs;
struct thread_info *t = tsk->thread_info;
@@ -345,14 +345,14 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
if (access_process_vm(child, addr,
&tmp, sizeof(tmp), 0) == sizeof(tmp))
- pt_os_succ_return(regs, tmp, (long *)data);
+ pt_os_succ_return(regs, tmp, (long __user *)data);
else
pt_error_return(regs, EIO);
goto out_tsk;
}
case PTRACE_PEEKUSR:
- read_sunos_user(regs, addr, child, (long *) data);
+ read_sunos_user(regs, addr, child, (long __user *) data);
goto out_tsk;
case PTRACE_POKEUSR:
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 203728dc64cd..ec74a93e6555 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -535,7 +535,7 @@ setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *old
sig_address = NULL;
}
}
- err |= __put_user((long)sig_address, &sframep->sig_address);
+ err |= __put_user((unsigned long)sig_address, &sframep->sig_address);
err |= __put_user(sig_code, &sframep->sig_code);
err |= __put_user(sc, &sframep->sig_scptr);
if (err)
@@ -832,7 +832,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
* to flush the user windows.
*/
for (window = 0; window < tp->w_saved; window++) {
- err |= __put_user((int *) &(gw->win[window]), &gw->winptr[window]);
+ err |= __put_user((int __user *) &(gw->win[window]), &gw->winptr[window]);
err |= __copy_to_user(&gw->win[window],
&tp->reg_window[window],
sizeof(svr4_rwindow_t));
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 49d352b05d72..a7df400e9d48 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -202,6 +202,10 @@ EXPORT_SYMBOL(sbus_ioremap);
#endif
#ifdef CONFIG_PCI
EXPORT_SYMBOL(ebus_chain);
+EXPORT_SYMBOL(insb);
+EXPORT_SYMBOL(outsb);
+EXPORT_SYMBOL(insw);
+EXPORT_SYMBOL(outsw);
EXPORT_SYMBOL(insl);
EXPORT_SYMBOL(outsl);
EXPORT_SYMBOL(pci_alloc_consistent);
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index a17dbc3a1227..09a0db77ec90 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -197,8 +197,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
goto out;
}
case 1: /* iBCS2 emulator entry point */
- err = do_shmat (first, (char __user *) ptr,
- second, (ulong *) third);
+ err = -EINVAL;
goto out;
}
case SHMDT:
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index e28a6af2a0af..19724c5800a7 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -20,8 +20,9 @@ spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
#else /* SMP */
+static spinlock_t dummy = SPIN_LOCK_UNLOCKED;
#define ATOMIC_HASH_SIZE 1
-#define ATOMIC_HASH(a) 0
+#define ATOMIC_HASH(a) (&dummy)
#endif /* SMP */
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 721ab5ba859f..1722dc51b0d8 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -50,7 +50,7 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
}
static inline void
-pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
+pt_succ_return_linux(struct pt_regs *regs, unsigned long value, void __user *addr)
{
if (test_thread_flag(TIF_32BIT)) {
if (put_user(value, (unsigned int __user *) addr)) {
@@ -70,7 +70,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
}
static void
-pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr)
+pt_os_succ_return (struct pt_regs *regs, unsigned long val, void __user *addr)
{
if (current->personality == PER_SUNOS)
pt_succ_return (regs, val);
@@ -226,7 +226,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
if (res < 0)
pt_error_return(regs, -res);
else
- pt_os_succ_return(regs, tmp64, (long *) data);
+ pt_os_succ_return(regs, tmp64, (void __user *) data);
goto flush_and_out;
}
diff --git a/arch/sparc64/prom/memory.c b/arch/sparc64/prom/memory.c
index 224821f621fc..f4a8143e052c 100644
--- a/arch/sparc64/prom/memory.c
+++ b/arch/sparc64/prom/memory.c
@@ -45,9 +45,9 @@ prom_sortmemlist(struct linux_mlist_p1275 *thislist)
unsigned long tmpaddr, tmpsize;
unsigned long lowest;
- for(i=0; thislist[i].theres_more != 0; i++) {
+ for(i=0; thislist[i].theres_more; i++) {
lowest = thislist[i].start_adr;
- for(mitr = i+1; thislist[mitr-1].theres_more != 0; mitr++)
+ for(mitr = i+1; thislist[mitr-1].theres_more; mitr++)
if(thislist[mitr].start_adr < lowest) {
lowest = thislist[mitr].start_adr;
swapi = mitr;
@@ -83,7 +83,7 @@ void __init prom_meminit(void)
prom_phys_avail[iter].theres_more =
&prom_phys_avail[iter+1];
}
- prom_phys_avail[iter-1].theres_more = 0x0;
+ prom_phys_avail[iter-1].theres_more = NULL;
num_regs = prom_getproperty(node, "reg",
(char *) prom_reg_memlist,
@@ -97,7 +97,7 @@ void __init prom_meminit(void)
prom_phys_total[iter].theres_more =
&prom_phys_total[iter+1];
}
- prom_phys_total[iter-1].theres_more = 0x0;
+ prom_phys_total[iter-1].theres_more = NULL;
node = prom_finddevice("/virtual-memory");
num_regs = prom_getproperty(node, "available",
@@ -116,7 +116,7 @@ void __init prom_meminit(void)
prom_prom_taken[iter].theres_more =
&prom_prom_taken[iter+1];
}
- prom_prom_taken[iter-1].theres_more = 0x0;
+ prom_prom_taken[iter-1].theres_more = NULL;
prom_sortmemlist(prom_prom_taken);
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index d2d34594bae7..62d464c7ef51 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -232,7 +232,8 @@ struct lance_init_block {
struct lance_private {
void __iomem *lregs; /* Lance RAP/RDP regs. */
void __iomem *dregs; /* DMA controller regs. */
- struct lance_init_block *init_block;
+ struct lance_init_block __iomem *init_block_iomem;
+ struct lance_init_block *init_block_mem;
spinlock_t lock;
@@ -314,7 +315,7 @@ static void load_csrs(struct lance_private *lp)
static void lance_init_ring_dvma(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
+ struct lance_init_block *ib = lp->init_block_mem;
dma_addr_t aib = lp->init_block_dvma;
__u32 leptr;
int i;
@@ -371,7 +372,7 @@ static void lance_init_ring_dvma(struct net_device *dev)
static void lance_init_ring_pio(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
u32 leptr;
int i;
@@ -501,7 +502,7 @@ static int init_restart_lance(struct lance_private *lp)
static void lance_rx_dvma(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
+ struct lance_init_block *ib = lp->init_block_mem;
struct lance_rx_desc *rd;
u8 bits;
int len, entry = lp->rx_new;
@@ -564,7 +565,7 @@ static void lance_rx_dvma(struct net_device *dev)
static void lance_tx_dvma(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
+ struct lance_init_block *ib = lp->init_block_mem;
int i, j;
spin_lock(&lp->lock);
@@ -674,8 +675,8 @@ static void lance_piocopy_to_skb(struct sk_buff *skb, void __iomem *piobuf, int
static void lance_rx_pio(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
- struct lance_rx_desc *rd;
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
+ struct lance_rx_desc __iomem *rd;
unsigned char bits;
int len, entry;
struct sk_buff *skb;
@@ -736,14 +737,14 @@ static void lance_rx_pio(struct net_device *dev)
static void lance_tx_pio(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
int i, j;
spin_lock(&lp->lock);
j = lp->tx_old;
for (i = j; i != lp->tx_new; i = j) {
- struct lance_tx_desc *td = &ib->btx_ring [i];
+ struct lance_tx_desc __iomem *td = &ib->btx_ring [i];
u8 bits = sbus_readb(&td->tmd1_bits);
/* If we hit a packet not owned by us, stop */
@@ -880,15 +881,13 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static void build_fake_packet(struct lance_private *lp)
{
struct net_device *dev = lp->dev;
- struct lance_init_block *ib = lp->init_block;
- u16 *packet;
- struct ethhdr *eth;
int i, entry;
entry = lp->tx_new & TX_RING_MOD_MASK;
- packet = (u16 *) &(ib->tx_buf[entry][0]);
- eth = (struct ethhdr *) packet;
if (lp->pio_buffer) {
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
+ u16 __iomem *packet = (u16 __iomem *) &(ib->tx_buf[entry][0]);
+ struct ethhdr __iomem *eth = (struct ethhdr __iomem *) packet;
for (i = 0; i < (ETH_ZLEN / sizeof(u16)); i++)
sbus_writew(0, &packet[i]);
for (i = 0; i < 6; i++) {
@@ -899,6 +898,9 @@ static void build_fake_packet(struct lance_private *lp)
sbus_writew(0, &ib->btx_ring[entry].misc);
sbus_writeb(LE_T1_POK|LE_T1_OWN, &ib->btx_ring[entry].tmd1_bits);
} else {
+ struct lance_init_block *ib = lp->init_block_mem;
+ u16 *packet = (u16 *) &(ib->tx_buf[entry][0]);
+ struct ethhdr *eth = (struct ethhdr *) packet;
memset(packet, 0, ETH_ZLEN);
for (i = 0; i < 6; i++) {
eth->h_dest[i] = dev->dev_addr[i];
@@ -916,7 +918,6 @@ struct net_device *last_dev;
static int lance_open(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
int status = 0;
last_dev = dev;
@@ -943,10 +944,12 @@ static int lance_open(struct net_device *dev)
* BTW it is common bug in all lance drivers! --ANK
*/
if (lp->pio_buffer) {
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
sbus_writew(0, &ib->mode);
sbus_writel(0, &ib->filter[0]);
sbus_writel(0, &ib->filter[1]);
} else {
+ struct lance_init_block *ib = lp->init_block_mem;
ib->mode = 0;
ib->filter [0] = 0;
ib->filter [1] = 0;
@@ -1113,7 +1116,6 @@ static void lance_tx_timeout(struct net_device *dev)
static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
int entry, skblen, len;
skblen = skb->len;
@@ -1126,6 +1128,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
entry = lp->tx_new & TX_RING_MOD_MASK;
if (lp->pio_buffer) {
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
sbus_writew((-len) | 0xf000, &ib->btx_ring[entry].length);
sbus_writew(0, &ib->btx_ring[entry].misc);
lance_piocopy_from_skb(&ib->tx_buf[entry][0], skb->data, skblen);
@@ -1133,6 +1136,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
lance_piozero(&ib->tx_buf[entry][skblen], len - skblen);
sbus_writeb(LE_T1_POK | LE_T1_OWN, &ib->btx_ring[entry].tmd1_bits);
} else {
+ struct lance_init_block *ib = lp->init_block_mem;
ib->btx_ring [entry].length = (-len) | 0xf000;
ib->btx_ring [entry].misc = 0;
memcpy((char *)&ib->tx_buf [entry][0], skb->data, skblen);
@@ -1174,33 +1178,31 @@ static struct net_device_stats *lance_get_stats(struct net_device *dev)
static void lance_load_multicast(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
- u16 *mcast_table = (u16 *) &ib->filter;
struct dev_mc_list *dmi = dev->mc_list;
char *addrs;
int i;
u32 crc;
+ u32 val;
/* set all multicast bits */
- if (dev->flags & IFF_ALLMULTI) {
- if (lp->pio_buffer) {
- sbus_writel(0xffffffff, &ib->filter[0]);
- sbus_writel(0xffffffff, &ib->filter[1]);
- } else {
- ib->filter [0] = 0xffffffff;
- ib->filter [1] = 0xffffffff;
- }
- return;
- }
- /* clear the multicast filter */
+ if (dev->flags & IFF_ALLMULTI)
+ val = ~0;
+ else
+ val = 0;
+
if (lp->pio_buffer) {
- sbus_writel(0, &ib->filter[0]);
- sbus_writel(0, &ib->filter[1]);
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
+ sbus_writel(val, &ib->filter[0]);
+ sbus_writel(val, &ib->filter[1]);
} else {
- ib->filter [0] = 0;
- ib->filter [1] = 0;
+ struct lance_init_block *ib = lp->init_block_mem;
+ ib->filter [0] = val;
+ ib->filter [1] = val;
}
+ if (dev->flags & IFF_ALLMULTI)
+ return;
+
/* Add addresses */
for (i = 0; i < dev->mc_count; i++) {
addrs = dmi->dmi_addr;
@@ -1212,10 +1214,14 @@ static void lance_load_multicast(struct net_device *dev)
crc = ether_crc_le(6, addrs);
crc = crc >> 26;
if (lp->pio_buffer) {
+ struct lance_init_block __iomem *ib = lp->init_block_iomem;
+ u16 __iomem *mcast_table = (u16 __iomem *) &ib->filter;
u16 tmp = sbus_readw(&mcast_table[crc>>4]);
tmp |= 1 << (crc & 0xf);
sbus_writew(tmp, &mcast_table[crc>>4]);
} else {
+ struct lance_init_block *ib = lp->init_block_mem;
+ u16 *mcast_table = (u16 *) &ib->filter;
mcast_table [crc >> 4] |= 1 << (crc & 0xf);
}
}
@@ -1224,7 +1230,8 @@ static void lance_load_multicast(struct net_device *dev)
static void lance_set_multicast(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
- struct lance_init_block *ib = lp->init_block;
+ struct lance_init_block *ib_mem = lp->init_block_mem;
+ struct lance_init_block __iomem *ib_iomem = lp->init_block_iomem;
u16 mode;
if (!netif_running(dev))
@@ -1242,21 +1249,21 @@ static void lance_set_multicast(struct net_device *dev)
lp->init_ring(dev);
if (lp->pio_buffer)
- mode = sbus_readw(&ib->mode);
+ mode = sbus_readw(&ib_iomem->mode);
else
- mode = ib->mode;
+ mode = ib_mem->mode;
if (dev->flags & IFF_PROMISC) {
mode |= LE_MO_PROM;
if (lp->pio_buffer)
- sbus_writew(mode, &ib->mode);
+ sbus_writew(mode, &ib_iomem->mode);
else
- ib->mode = mode;
+ ib_mem->mode = mode;
} else {
mode &= ~LE_MO_PROM;
if (lp->pio_buffer)
- sbus_writew(mode, &ib->mode);
+ sbus_writew(mode, &ib_iomem->mode);
else
- ib->mode = mode;
+ ib_mem->mode = mode;
lance_load_multicast(dev);
}
load_csrs(lp);
@@ -1275,16 +1282,14 @@ static void lance_free_hwresources(struct lance_private *lp)
{
if (lp->lregs)
sbus_iounmap(lp->lregs, LANCE_REG_SIZE);
- if (lp->init_block != NULL) {
- if (lp->pio_buffer) {
- sbus_iounmap(lp->init_block,
- sizeof(struct lance_init_block));
- } else {
- sbus_free_consistent(lp->sdev,
- sizeof(struct lance_init_block),
- lp->init_block,
- lp->init_block_dvma);
- }
+ if (lp->init_block_iomem) {
+ sbus_iounmap(lp->init_block_iomem,
+ sizeof(struct lance_init_block));
+ } else if (lp->init_block_mem) {
+ sbus_free_consistent(lp->sdev,
+ sizeof(struct lance_init_block),
+ lp->init_block_mem,
+ lp->init_block_dvma);
}
}
@@ -1326,6 +1331,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
return -ENOMEM;
lp = netdev_priv(dev);
+ memset(lp, 0, sizeof(*lp));
if (sparc_lance_debug && version_printed++ == 0)
printk (KERN_INFO "%s", version);
@@ -1342,17 +1348,22 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
/* Get the IO region */
lp->lregs = sbus_ioremap(&sdev->resource[0], 0,
LANCE_REG_SIZE, lancestr);
- if (lp->lregs == 0UL) {
+ if (!lp->lregs) {
printk(KERN_ERR "SunLance: Cannot map registers.\n");
goto fail;
}
lp->sdev = sdev;
if (lebuffer) {
- lp->init_block =
+ /* sanity check */
+ if (lebuffer->resource[0].start & 7) {
+ printk(KERN_ERR "SunLance: ERROR: Rx and Tx rings not on even boundary.\n");
+ goto fail;
+ }
+ lp->init_block_iomem =
sbus_ioremap(&lebuffer->resource[0], 0,
sizeof(struct lance_init_block), "lebuffer");
- if (lp->init_block == NULL) {
+ if (!lp->init_block_iomem) {
printk(KERN_ERR "SunLance: Cannot map PIO buffer.\n");
goto fail;
}
@@ -1362,11 +1373,10 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
lp->rx = lance_rx_pio;
lp->tx = lance_tx_pio;
} else {
- lp->init_block =
+ lp->init_block_mem =
sbus_alloc_consistent(sdev, sizeof(struct lance_init_block),
&lp->init_block_dvma);
- if (lp->init_block == NULL ||
- lp->init_block_dvma == 0) {
+ if (!lp->init_block_mem || lp->init_block_dvma == 0) {
printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n");
goto fail;
}
@@ -1449,13 +1459,7 @@ no_link_test:
udelay(200);
sbus_writel(csr & ~DMA_RST_ENET, lp->dregs + DMA_CSR);
} else
- lp->dregs = 0;
-
- /* This should never happen. */
- if ((unsigned long)(lp->init_block->brx_ring) & 0x07) {
- printk(KERN_ERR "SunLance: ERROR: Rx and Tx rings not on even boundary.\n");
- goto fail;
- }
+ lp->dregs = NULL;
lp->dev = dev;
SET_MODULE_OWNER(dev);
@@ -1499,8 +1503,7 @@ no_link_test:
return 0;
fail:
- if (lp != NULL)
- lance_free_hwresources(lp);
+ lance_free_hwresources(lp);
free_netdev(dev);
return -ENODEV;
}
@@ -1539,7 +1542,7 @@ static int __init sparc_lance_probe(void)
memset(&sdev, 0, sizeof(sdev));
sdev.reg_addrs[0].phys_addr = sun4_eth_physaddr;
sdev.irqs[0] = 6;
- return sparc_lance_init(&sdev, 0, 0);
+ return sparc_lance_init(&sdev, NULL, NULL);
}
return -ENODEV;
}
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 5a03aab1dd18..286158108974 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -61,7 +61,7 @@ csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len
}
static inline unsigned int
-csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len,
+csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, int len,
unsigned int sum, int *err)
{
if (!access_ok (VERIFY_READ, src, len)) {
@@ -69,7 +69,7 @@ csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int le
memset (dst, 0, len);
return sum;
} else {
- register unsigned int ret asm("o0") = (unsigned int)src;
+ register unsigned long ret asm("o0") = (unsigned long)src;
register char *d asm("o1") = dst;
register int l asm("g1") = len;
register unsigned int s asm("g7") = sum;
@@ -98,8 +98,8 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
*err = -EFAULT;
return sum;
} else {
- register unsigned int ret asm("o0") = (unsigned int)src;
- register char *d asm("o1") = dst;
+ register unsigned long ret asm("o0") = (unsigned long)src;
+ register char __user *d asm("o1") = dst;
register int l asm("g1") = len;
register unsigned int s asm("g7") = sum;
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
index d17864207d07..4a71d7c1eace 100644
--- a/include/asm-sparc/elf.h
+++ b/include/asm-sparc/elf.h
@@ -88,11 +88,11 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
#define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \
do { unsigned long *dest = &(__elf_regs[0]); \
struct pt_regs *src = (__pt_regs); \
- unsigned long *sp; \
+ unsigned long __user *sp; \
memcpy(&dest[0], &src->u_regs[0], \
sizeof(unsigned long) * 16); \
/* Don't try this at home kids... */ \
- sp = (unsigned long *) src->u_regs[14]; \
+ sp = (unsigned long __user *) src->u_regs[14]; \
copy_from_user(&dest[16], sp, \
sizeof(unsigned long) * 16); \
dest[32] = src->psr; \
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
index 5154947c70ef..4507834def1d 100644
--- a/include/asm-sparc/floppy.h
+++ b/include/asm-sparc/floppy.h
@@ -213,7 +213,7 @@ unsigned long pdma_size;
volatile int doing_pdma = 0;
/* This is software state */
-char *pdma_base = 0;
+char *pdma_base = NULL;
unsigned long pdma_areasize;
/* Common routines to all controller types on the Sparc. */
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index 3f8b9924a9b6..f98570f54b53 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -134,12 +134,12 @@ static inline void __writel(u32 l, volatile void __iomem *addr)
#define inl_p(__addr) inl(__addr)
#define outl_p(__l, __addr) outl(__l, __addr)
-void outsb(void * __iomem addr, const void *src, unsigned long cnt);
-void outsw(void * __iomem addr, const void *src, unsigned long cnt);
-void outsl(void * __iomem addr, const void *src, unsigned long cnt);
-void insb(void * __iomem addr, void *dst, unsigned long count);
-void insw(void * __iomem addr, void *dst, unsigned long count);
-void insl(void * __iomem addr, void *dst, unsigned long count);
+void outsb(unsigned long addr, const void *src, unsigned long cnt);
+void outsw(unsigned long addr, const void *src, unsigned long cnt);
+void outsl(unsigned long addr, const void *src, unsigned long cnt);
+void insb(unsigned long addr, void *dst, unsigned long count);
+void insw(unsigned long addr, void *dst, unsigned long count);
+void insl(unsigned long addr, void *dst, unsigned long count);
#define IO_SPACE_LIMIT 0xffffffff
diff --git a/include/asm-sparc/svr4.h b/include/asm-sparc/svr4.h
index 331157291e07..da1f1c980e2d 100644
--- a/include/asm-sparc/svr4.h
+++ b/include/asm-sparc/svr4.h
@@ -49,7 +49,7 @@ typedef struct {
typedef struct {
int count;
- int *winptr [SVR4_MAXWIN]; /* pointer to the windows */
+ int __user *winptr [SVR4_MAXWIN]; /* pointer to the windows */
svr4_rwindow_t win[SVR4_MAXWIN]; /* the windows */
} svr4_gwindows_t;
@@ -72,7 +72,7 @@ typedef struct {
/* Machine dependent context */
typedef struct {
svr4_gregset_t greg; /* registers 0..19 (see top) */
- svr4_gwindows_t *gwin; /* may point to register windows */
+ svr4_gwindows_t __user *gwin; /* may point to register windows */
svr4_fregset_t freg; /* floating point registers */
svr4_xrs_t xrs; /* mhm? */
long pad[19];
@@ -86,7 +86,7 @@ enum svr4_stack_flags {
/* signal stack exection place, unsupported */
typedef struct svr4_stack_t {
- char *sp;
+ char __user *sp;
int size;
int flags;
} svr4_stack_t;
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 4fb0ac34c069..a8e77ad1ea46 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -200,7 +200,7 @@ static inline unsigned long getipl(void)
#define smp_wmb() __asm__ __volatile__("":::"memory")
#define smp_read_barrier_depends() do { } while(0)
-#define nop() __asm__ __volatile__ ("nop");
+#define nop() __asm__ __volatile__ ("nop")
/* This has special calling conventions */
#ifndef CONFIG_SMP
diff --git a/include/asm-sparc64/fbio.h b/include/asm-sparc64/fbio.h
index c6c4da6e139d..500026d9f6e1 100644
--- a/include/asm-sparc64/fbio.h
+++ b/include/asm-sparc64/fbio.h
@@ -102,8 +102,8 @@ struct fbcursor {
struct fbcurpos hot; /* cursor hot spot */
struct fbcmap cmap; /* color map info */
struct fbcurpos size; /* cursor bit map size */
- char *image; /* cursor image bits */
- char *mask; /* cursor mask bits */
+ char __user *image; /* cursor image bits */
+ char __user *mask; /* cursor mask bits */
};
/* set/get cursor attributes/shape */
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index 30276548912f..6661a23b6883 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -417,13 +417,13 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
-static inline int check_signature(unsigned long io_addr,
+static inline int check_signature(void __iomem *io_addr,
const unsigned char *signature,
int length)
{
int retval = 0;
do {
- if (readb((void __iomem *)io_addr) != *signature++)
+ if (readb(io_addr) != *signature++)
goto out;
io_addr++;
} while (--length);