Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.osdl.org>2003-10-15 18:28:21 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-10-15 18:28:21 -0700
commita2ec0df550baab8844297d75fa55536ee041353e (patch)
treeb75789d971456cf3bf50dec09a39067a97bd5384
parentd810953c6e328292e066bb085b5c7b94f1595c5b (diff)
parentd66f7b39f20869dccf8c8ca0dc328b352f1831e3 (diff)
Merge http://ppc.bkbits.net/for-linus-ppc64
into home.osdl.org:/home/torvalds/v2.5/linux
-rw-r--r--arch/i386/kernel/mpparse.c10
-rw-r--r--arch/sparc64/defconfig1
-rw-r--r--drivers/block/Makefile1
-rw-r--r--drivers/block/initrd.c100
-rw-r--r--drivers/cdrom/sjcd.c22
-rw-r--r--drivers/char/applicom.c12
-rw-r--r--drivers/ide/ide-floppy.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c25
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c2
-rw-r--r--drivers/net/net_init.c3
-rw-r--r--drivers/net/sunhme.c2
-rw-r--r--fs/Kconfig4
-rw-r--r--fs/ext2/acl.c2
-rw-r--r--fs/ext3/acl.c2
-rw-r--r--fs/ext3/inode.c17
-rw-r--r--fs/inode.c2
-rw-r--r--fs/reiserfs/procfs.c7
-rw-r--r--include/asm-i386/mach-numaq/mach_mpparse.h13
-rw-r--r--include/asm-sparc/atomic.h18
-rw-r--r--include/asm-sparc/bitops.h132
-rw-r--r--include/asm-sparc/checksum.h62
-rw-r--r--include/asm-sparc/io.h97
-rw-r--r--include/asm-sparc/irq.h47
-rw-r--r--include/asm-sparc/pgtsun4.h25
-rw-r--r--include/asm-sparc/pgtsun4c.h25
-rw-r--r--include/asm-sparc/processor.h8
-rw-r--r--include/asm-sparc/ross.h64
-rw-r--r--include/asm-sparc/swift.h60
-rw-r--r--include/asm-sparc/system.h5
-rw-r--r--include/asm-sparc/tsunami.h16
-rw-r--r--include/asm-sparc/turbosparc.h46
-rw-r--r--include/asm-sparc/vac-ops.h34
-rw-r--r--include/asm-sparc/viking.h97
-rw-r--r--include/linux/netdevice.h6
-rw-r--r--init/do_mounts_initrd.c28
-rw-r--r--init/initramfs.c103
-rw-r--r--kernel/sched.c2
-rw-r--r--mm/swapfile.c4
-rw-r--r--net/bridge/netfilter/ebt_among.c2
-rw-r--r--net/core/dev.c7
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/ipip.c3
-rw-r--r--net/ipv4/tcp_ipv4.c46
-rw-r--r--net/ipv6/ip6_tunnel.c3
-rw-r--r--net/ipv6/sit.c3
-rwxr-xr-xscripts/makeman108
-rwxr-xr-xscripts/split-man2
-rw-r--r--security/selinux/include/security.h1
-rw-r--r--security/selinux/selinuxfs.c44
-rw-r--r--security/selinux/ss/policydb.h1
51 files changed, 768 insertions, 564 deletions
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index f33d06c3b89f..ac55df3baae0 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -337,6 +337,16 @@ static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, \
}
}
}
+
+static inline void mps_oem_check(struct mp_config_table *mpc, char *oem,
+ char *productid)
+{
+ if (strncmp(oem, "IBM NUMA", 8))
+ printk("Warning! May not be a NUMA-Q system!\n");
+ if (mpc->mpc_oemptr)
+ smp_read_mpc_oem((struct mp_config_oemtable *) mpc->mpc_oemptr,
+ mpc->mpc_oemsize);
+}
#endif /* CONFIG_X86_NUMAQ */
/*
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 85525ddaedd4..11d67ea1fd28 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -570,6 +570,7 @@ CONFIG_BRIDGE_EBT_BROUTE=m
CONFIG_BRIDGE_EBT_T_FILTER=m
CONFIG_BRIDGE_EBT_T_NAT=m
CONFIG_BRIDGE_EBT_802_3=m
+CONFIG_BRIDGE_EBT_AMONG=m
CONFIG_BRIDGE_EBT_ARP=m
CONFIG_BRIDGE_EBT_IP=m
CONFIG_BRIDGE_EBT_LIMIT=m
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index cf72f7cfb806..bc301c82e3a6 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -28,7 +28,6 @@ obj-$(CONFIG_ATARI_ACSI) += acsi.o
obj-$(CONFIG_ATARI_SLM) += acsi_slm.o
obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o
obj-$(CONFIG_BLK_DEV_RAM) += rd.o
-obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
obj-$(CONFIG_BLK_DEV_LOOP) += loop.o
obj-$(CONFIG_BLK_DEV_PS2) += ps2esdi.o
obj-$(CONFIG_BLK_DEV_XD) += xd.o
diff --git a/drivers/block/initrd.c b/drivers/block/initrd.c
deleted file mode 100644
index 41a7725ea474..000000000000
--- a/drivers/block/initrd.c
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#include <linux/blkdev.h>
-#include <linux/genhd.h>
-#include <linux/initrd.h>
-#include <linux/init.h>
-#include <linux/major.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <asm/uaccess.h>
-
-
-unsigned long initrd_start, initrd_end;
-int initrd_below_start_ok;
-
-static int initrd_users;
-static spinlock_t initrd_users_lock = SPIN_LOCK_UNLOCKED;
-
-static struct gendisk *initrd_disk;
-
-static ssize_t initrd_read(struct file *file, char *buf,
- size_t count, loff_t *ppos)
-{
- int left = initrd_end - initrd_start - *ppos;
-
- if (count > left)
- count = left;
- if (count == 0)
- return 0;
- if (copy_to_user(buf, (char *)initrd_start + *ppos, count))
- return -EFAULT;
-
- *ppos += count;
- return count;
-}
-
-static int initrd_release(struct inode *inode,struct file *file)
-{
-
- blkdev_put(inode->i_bdev, BDEV_FILE);
-
- spin_lock(&initrd_users_lock);
- if (!--initrd_users) {
- spin_unlock(&initrd_users_lock);
- del_gendisk(initrd_disk);
- free_initrd_mem(initrd_start, initrd_end);
- initrd_start = 0;
- } else
- spin_unlock(&initrd_users_lock);
-
- return 0;
-}
-
-static struct file_operations initrd_fops = {
- .read = initrd_read,
- .release = initrd_release,
-};
-
-static int initrd_open(struct inode *inode, struct file *filp)
-{
- if (!initrd_start)
- return -ENODEV;
-
- spin_lock(&initrd_users_lock);
- initrd_users++;
- spin_unlock(&initrd_users_lock);
-
- filp->f_op = &initrd_fops;
- return 0;
-}
-
-static struct block_device_operations initrd_bdops = {
- .owner = THIS_MODULE,
- .open = initrd_open,
-};
-
-static int __init initrd_init(void)
-{
- initrd_disk = alloc_disk(1);
- if (!initrd_disk)
- return -ENOMEM;
-
- initrd_disk->major = RAMDISK_MAJOR;
- initrd_disk->first_minor = INITRD_MINOR;
- initrd_disk->fops = &initrd_bdops;
-
- sprintf(initrd_disk->disk_name, "initrd");
- sprintf(initrd_disk->devfs_name, "rd/initrd");
-
- set_capacity(initrd_disk, (initrd_end-initrd_start+511) >> 9);
- add_disk(initrd_disk);
- return 0;
-}
-
-static void __exit initrd_exit(void)
-{
- put_disk(initrd_disk);
-}
-
-module_init(initrd_init);
-module_exit(initrd_exit);
diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
index 1c8362764e1a..77456e187718 100644
--- a/drivers/cdrom/sjcd.c
+++ b/drivers/cdrom/sjcd.c
@@ -842,8 +842,9 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
CDROM_AUDIO_NO_STATUS;
}
- copy_from_user(&sjcd_msf, (void *) arg,
- sizeof(sjcd_msf));
+ if (copy_from_user(&sjcd_msf, (void *) arg,
+ sizeof(sjcd_msf)))
+ return (-EFAULT);
sjcd_playing.start.min =
bin2bcd(sjcd_msf.cdmsf_min0);
@@ -893,9 +894,9 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
sizeof(toc_entry))) == 0) {
struct sjcd_hw_disk_info *tp;
- copy_from_user(&toc_entry, (void *) arg,
- sizeof(toc_entry));
-
+ if (copy_from_user(&toc_entry, (void *) arg,
+ sizeof(toc_entry)))
+ return (-EFAULT);
if (toc_entry.cdte_track == CDROM_LEADOUT)
tp = &sjcd_table_of_contents[0];
else if (toc_entry.cdte_track <
@@ -948,8 +949,10 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
sizeof(subchnl))) == 0) {
struct sjcd_hw_qinfo q_info;
- copy_from_user(&subchnl, (void *) arg,
- sizeof(subchnl));
+ if (copy_from_user(&subchnl, (void *) arg,
+ sizeof(subchnl)))
+ return (-EFAULT);
+
if (sjcd_get_q_info(&q_info) < 0)
return (-EIO);
@@ -1005,8 +1008,9 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
sizeof(vol_ctrl))) == 0) {
unsigned char dummy[4];
- copy_from_user(&vol_ctrl, (void *) arg,
- sizeof(vol_ctrl));
+ if (copy_from_user(&vol_ctrl, (void *) arg,
+ sizeof(vol_ctrl)))
+ return (-EFAULT);
sjcd_send_4_cmd(SCMD_SET_VOLUME,
vol_ctrl.channel0, 0xFF,
vol_ctrl.channel1, 0xFF);
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 23e81fbe829d..3a084522e8fa 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -214,6 +214,7 @@ int __init applicom_init(void)
if (!RamIO) {
printk(KERN_INFO "ac.o: Failed to ioremap PCI memory space at 0x%lx\n", dev->resource[0].start);
+ pci_disable_device(dev);
return -EIO;
}
@@ -225,12 +226,14 @@ int __init applicom_init(void)
(unsigned long)RamIO,0))) {
printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n");
iounmap(RamIO);
+ pci_disable_device(dev);
continue;
}
if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) {
printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
iounmap(RamIO);
+ pci_disable_device(dev);
apbs[boardno - 1].RamIO = 0;
continue;
}
@@ -257,12 +260,6 @@ int __init applicom_init(void)
/* Now try the specified ISA cards */
-#warning "LEAK"
- RamIO = ioremap(mem, LEN_RAM_IO * MAX_ISA_BOARD);
-
- if (!RamIO)
- printk(KERN_INFO "ac.o: Failed to ioremap ISA memory space at 0x%lx\n", mem);
-
for (i = 0; i < MAX_ISA_BOARD; i++) {
RamIO = ioremap(mem + (LEN_RAM_IO * i), LEN_RAM_IO);
@@ -285,7 +282,8 @@ int __init applicom_init(void)
iounmap((void *) RamIO);
apbs[boardno - 1].RamIO = 0;
}
- apbs[boardno - 1].irq = irq;
+ else
+ apbs[boardno - 1].irq = irq;
}
else
apbs[boardno - 1].irq = 0;
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index b664be3904b6..55cef4b31d1c 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -1796,7 +1796,7 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy)
* we'll leave the limitation below for the 2.2.x tree.
*/
- if (strcmp(drive->id->model, "IOMEGA ZIP 100 ATAPI") == 0) {
+ if (strstr(drive->id->model, "IOMEGA ZIP") != NULL) {
set_bit(IDEFLOPPY_ZIP_DRIVE, &floppy->flags);
/* This value will be visible in the /proc/ide/hdx/settings */
floppy->ticks = IDEFLOPPY_TICKS_DELAY;
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index 31418d49301a..cb40533fa587 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -1,4 +1,4 @@
-/* $Id: divasmain.c,v 1.43 2003/09/22 08:57:31 schindler Exp $
+/* $Id: divasmain.c,v 1.46 2003/10/10 12:28:14 armin Exp $
*
* Low level driver for Eicon DIVA Server ISDN cards.
*
@@ -41,7 +41,7 @@
#include "diva_dma.h"
#include "diva_pci.h"
-static char *main_revision = "$Revision: 1.43 $";
+static char *main_revision = "$Revision: 1.46 $";
static int major;
@@ -69,7 +69,7 @@ extern int divasfunc_init(int dbgmask);
extern void divasfunc_exit(void);
typedef struct _diva_os_thread_dpc {
- struct tasklet_struct divas_task;
+ struct work_struct divas_task;
struct work_struct trap_script_task;
diva_os_soft_isr_t *psoft_isr;
int card_failed;
@@ -552,7 +552,7 @@ void diva_os_remove_irq(void *context, byte irq)
/* --------------------------------------------------------------------------
DPC framework implementation
-------------------------------------------------------------------------- */
-static void diva_os_dpc_proc(unsigned long context)
+static void diva_os_dpc_proc(void *context)
{
diva_os_thread_dpc_t *psoft_isr = (diva_os_thread_dpc_t *) context;
diva_os_soft_isr_t *pisr = psoft_isr->psoft_isr;
@@ -575,8 +575,7 @@ int diva_os_initialize_soft_isr(diva_os_soft_isr_t * psoft_isr,
psoft_isr->callback_context = callback_context;
pdpc->psoft_isr = psoft_isr;
INIT_WORK(&pdpc->trap_script_task, diva_adapter_trapped, pdpc);
- tasklet_init(&pdpc->divas_task, diva_os_dpc_proc,
- (unsigned long) pdpc);
+ INIT_WORK(&pdpc->divas_task, diva_os_dpc_proc, pdpc);
return (0);
}
@@ -587,7 +586,7 @@ int diva_os_schedule_soft_isr(diva_os_soft_isr_t * psoft_isr)
diva_os_thread_dpc_t *pdpc =
(diva_os_thread_dpc_t *) psoft_isr->object;
- tasklet_schedule(&pdpc->divas_task);
+ schedule_work(&pdpc->divas_task);
}
return (1);
@@ -595,26 +594,18 @@ int diva_os_schedule_soft_isr(diva_os_soft_isr_t * psoft_isr)
int diva_os_cancel_soft_isr(diva_os_soft_isr_t * psoft_isr)
{
- if (psoft_isr && psoft_isr->object) {
- diva_os_thread_dpc_t *pdpc =
- (diva_os_thread_dpc_t *) psoft_isr->object;
- tasklet_kill(&pdpc->divas_task);
- }
+ flush_scheduled_work();
return (0);
}
void diva_os_remove_soft_isr(diva_os_soft_isr_t * psoft_isr)
{
if (psoft_isr && psoft_isr->object) {
- diva_os_thread_dpc_t *pdpc =
- (diva_os_thread_dpc_t *) psoft_isr->object;
void *mem;
- tasklet_kill(&pdpc->divas_task);
-
+ flush_scheduled_work();
mem = psoft_isr->object;
psoft_isr->object = 0;
- flush_scheduled_work();
diva_os_free(0, mem);
}
}
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 0fef080576c9..f1b1ae6b3c3c 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -95,7 +95,7 @@ struct list_head saa7134_devlist;
unsigned int saa7134_devcount;
#define dprintk(fmt, arg...) if (core_debug) \
- printk(KERN_DEBUG "%s/core: " fmt, dev->name, ## arg)
+ printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg)
/* ------------------------------------------------------------------ */
/* debug help functions */
diff --git a/drivers/net/net_init.c b/drivers/net/net_init.c
index 968af8bf1929..0a5706e6c41d 100644
--- a/drivers/net/net_init.c
+++ b/drivers/net/net_init.c
@@ -148,11 +148,14 @@ static struct net_device *init_netdev(struct net_device *dev, int sizeof_priv,
if (dev->name[0] == '\0' || dev->name[0] == ' ') {
strcpy(dev->name, mask);
+ rtnl_lock();
if (dev_alloc_name(dev, mask)<0) {
+ rtnl_unlock();
if (new_device)
kfree(dev);
return NULL;
}
+ rtnl_unlock();
}
netdev_boot_setup_check(dev);
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index e499df6accc8..d348c55a9a8a 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -2996,7 +2996,7 @@ use_random:
dev_addr[0] = 0x08;
dev_addr[1] = 0x00;
dev_addr[2] = 0x20;
- get_random_bytes(dev_addr, 3);
+ get_random_bytes(&dev_addr[3], 3);
return;
}
#endif /* !(__sparc__) */
diff --git a/fs/Kconfig b/fs/Kconfig
index e61c963af94e..9cd68069d6d6 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -204,7 +204,7 @@ config REISERFS_FS
In general, ReiserFS is as fast as ext2, but is very efficient with
large directories and small files. Additional patches are needed
- for NFS and quotas, please see <http://www.reiserfs.org/> for links.
+ for NFS and quotas, please see <http://www.namesys.com/> for links.
It is more easily extended to have features currently found in
database and keyword search systems than block allocation based file
@@ -212,7 +212,7 @@ config REISERFS_FS
plugins consistent with our motto ``It takes more than a license to
make source code open.''
- Read <http://www.reiserfs.org/> to learn more about reiserfs.
+ Read <http://www.namesys.com/> to learn more about reiserfs.
Sponsored by Threshold Networks, Emusic.com, and Bigstorage.com.
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 0df165f8ee01..12cad78987fd 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -19,7 +19,7 @@ static struct posix_acl *
ext2_acl_from_disk(const void *value, size_t size)
{
const char *end = (char *)value + size;
- size_t n, count;
+ int n, count;
struct posix_acl *acl;
if (!value)
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index 53051432b4bf..2ae72c1a7e86 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -20,7 +20,7 @@ static struct posix_acl *
ext3_acl_from_disk(const void *value, size_t size)
{
const char *end = (char *)value + size;
- size_t n, count;
+ int n, count;
struct posix_acl *acl;
if (!value)
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 1144f75b0662..02a877d32232 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -769,7 +769,6 @@ ext3_get_block_handle(handle_t *handle, struct inode *inode, sector_t iblock,
int boundary = 0;
int depth = ext3_block_to_path(inode, iblock, offsets, &boundary);
struct ext3_inode_info *ei = EXT3_I(inode);
- loff_t new_size;
J_ASSERT(handle != NULL || create == 0);
@@ -834,23 +833,17 @@ out:
if (!err)
err = ext3_splice_branch(handle, inode, iblock, chain,
partial, left);
+ /* i_disksize growing is protected by truncate_sem
+ * don't forget to protect it if you're about to implement
+ * concurrent ext3_get_block() -bzzz */
+ if (!err && extend_disksize && inode->i_size > ei->i_disksize)
+ ei->i_disksize = inode->i_size;
up(&ei->truncate_sem);
if (err == -EAGAIN)
goto changed;
if (err)
goto cleanup;
- if (extend_disksize) {
- /*
- * This is not racy against ext3_truncate's modification of
- * i_disksize because VM/VFS ensures that the file cannot be
- * extended while truncate is in progress. It is racy between
- * multiple parallel instances of get_block, but we have BKL.
- */
- new_size = inode->i_size;
- if (new_size > ei->i_disksize)
- ei->i_disksize = new_size;
- }
set_buffer_new(bh_result);
goto got_it;
diff --git a/fs/inode.c b/fs/inode.c
index 76d7881f2b60..4ba2baca5b0c 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -453,7 +453,7 @@ static void prune_icache(int nr_to_scan)
dispose_list(&freeable);
up(&iprune_sem);
- if (current_is_kswapd)
+ if (current_is_kswapd())
mod_page_state(kswapd_inodesteal, reap);
else
mod_page_state(pginodesteal, reap);
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index 90074d247eb6..377d12003f21 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -478,14 +478,15 @@ static void *r_start(struct seq_file *m, loff_t *pos)
static void *r_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
+ if (v)
+ deactivate_super(v);
return NULL;
}
static void r_stop(struct seq_file *m, void *v)
{
- struct proc_dir_entry *de = m->private;
- struct super_block *s = de->data;
- deactivate_super(s);
+ if (v)
+ deactivate_super(v);
}
static int r_show(struct seq_file *m, void *v)
diff --git a/include/asm-i386/mach-numaq/mach_mpparse.h b/include/asm-i386/mach-numaq/mach_mpparse.h
index 41c7d08d973d..51bbac8fc0c2 100644
--- a/include/asm-i386/mach-numaq/mach_mpparse.h
+++ b/include/asm-i386/mach-numaq/mach_mpparse.h
@@ -1,9 +1,6 @@
#ifndef __ASM_MACH_MPPARSE_H
#define __ASM_MACH_MPPARSE_H
-static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable,
- unsigned short oemsize);
-
static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
struct mpc_config_translation *translation)
{
@@ -24,16 +21,6 @@ static inline void mpc_oem_pci_bus(struct mpc_config_bus *m,
quad_local_to_mp_bus_id[quad][local] = m->mpc_busid;
}
-static inline void mps_oem_check(struct mp_config_table *mpc, char *oem,
- char *productid)
-{
- if (strncmp(oem, "IBM NUMA", 8))
- printk("Warning! May not be a NUMA-Q system!\n");
- if (mpc->mpc_oemptr)
- smp_read_mpc_oem((struct mp_config_oemtable *) mpc->mpc_oemptr,
- mpc->mpc_oemsize);
-}
-
/* Hook from generic ACPI tables.c */
static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
index aa298155a8d3..f42ba9526265 100644
--- a/include/asm-sparc/atomic.h
+++ b/include/asm-sparc/atomic.h
@@ -48,10 +48,13 @@ static __inline__ int atomic_read(const atomic_t *v)
#define atomic_set(v, i) (((v)->counter) = ((i) << 8))
#endif
-static __inline__ int __atomic_add(int i, atomic_t *v)
+static inline int __atomic_add(int i, atomic_t *v)
{
register volatile int *ptr asm("g1");
register int increment asm("g2");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g7");
ptr = &v->counter;
increment = i;
@@ -60,17 +63,20 @@ static __inline__ int __atomic_add(int i, atomic_t *v)
"mov %%o7, %%g4\n\t"
"call ___atomic_add\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (increment)
+ : "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
: "0" (increment), "r" (ptr)
- : "g3", "g4", "g7", "memory", "cc");
+ : "memory", "cc");
return increment;
}
-static __inline__ int __atomic_sub(int i, atomic_t *v)
+static inline int __atomic_sub(int i, atomic_t *v)
{
register volatile int *ptr asm("g1");
register int increment asm("g2");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g7");
ptr = &v->counter;
increment = i;
@@ -79,9 +85,9 @@ static __inline__ int __atomic_sub(int i, atomic_t *v)
"mov %%o7, %%g4\n\t"
"call ___atomic_sub\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (increment)
+ : "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
: "0" (increment), "r" (ptr)
- : "g3", "g4", "g7", "memory", "cc");
+ : "memory", "cc");
return increment;
}
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index 4340bddccabb..a0e09a70ff78 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -20,10 +20,14 @@
* within the first byte. Sparc is BIG-Endian. Unless noted otherwise
* all bit-ops return 0 if bit was previously clear and != 0 otherwise.
*/
-static __inline__ int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
+static inline int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
{
register unsigned long mask asm("g2");
register unsigned long *ADDR asm("g1");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g5");
+ register int tmp4 asm("g7");
ADDR = ((unsigned long *) addr) + (nr >> 5);
mask = 1 << (nr & 31);
@@ -32,17 +36,21 @@ static __inline__ int test_and_set_bit(unsigned long nr, volatile unsigned long
"mov %%o7, %%g4\n\t"
"call ___set_bit\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (mask)
+ : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
: "0" (mask), "r" (ADDR)
- : "g3", "g4", "g5", "g7", "memory", "cc");
+ : "memory", "cc");
return mask != 0;
}
-static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr)
+static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
{
register unsigned long mask asm("g2");
register unsigned long *ADDR asm("g1");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g5");
+ register int tmp4 asm("g7");
ADDR = ((unsigned long *) addr) + (nr >> 5);
mask = 1 << (nr & 31);
@@ -51,15 +59,19 @@ static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr)
"mov %%o7, %%g4\n\t"
"call ___set_bit\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (mask)
+ : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
: "0" (mask), "r" (ADDR)
- : "g3", "g4", "g5", "g7", "cc");
+ : "memory", "cc");
}
-static __inline__ int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
+static inline int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
{
register unsigned long mask asm("g2");
register unsigned long *ADDR asm("g1");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g5");
+ register int tmp4 asm("g7");
ADDR = ((unsigned long *) addr) + (nr >> 5);
mask = 1 << (nr & 31);
@@ -68,17 +80,21 @@ static __inline__ int test_and_clear_bit(unsigned long nr, volatile unsigned lon
"mov %%o7, %%g4\n\t"
"call ___clear_bit\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (mask)
+ : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
: "0" (mask), "r" (ADDR)
- : "g3", "g4", "g5", "g7", "memory", "cc");
+ : "memory", "cc");
return mask != 0;
}
-static __inline__ void clear_bit(unsigned long nr, volatile unsigned long *addr)
+static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
{
register unsigned long mask asm("g2");
register unsigned long *ADDR asm("g1");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g5");
+ register int tmp4 asm("g7");
ADDR = ((unsigned long *) addr) + (nr >> 5);
mask = 1 << (nr & 31);
@@ -87,15 +103,19 @@ static __inline__ void clear_bit(unsigned long nr, volatile unsigned long *addr)
"mov %%o7, %%g4\n\t"
"call ___clear_bit\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (mask)
+ : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
: "0" (mask), "r" (ADDR)
- : "g3", "g4", "g5", "g7", "cc");
+ : "memory", "cc");
}
-static __inline__ int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
+static inline int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
{
register unsigned long mask asm("g2");
register unsigned long *ADDR asm("g1");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g5");
+ register int tmp4 asm("g7");
ADDR = ((unsigned long *) addr) + (nr >> 5);
mask = 1 << (nr & 31);
@@ -104,17 +124,21 @@ static __inline__ int test_and_change_bit(unsigned long nr, volatile unsigned lo
"mov %%o7, %%g4\n\t"
"call ___change_bit\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (mask)
+ : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
: "0" (mask), "r" (ADDR)
- : "g3", "g4", "g5", "g7", "memory", "cc");
+ : "memory", "cc");
return mask != 0;
}
-static __inline__ void change_bit(unsigned long nr, volatile unsigned long *addr)
+static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
{
register unsigned long mask asm("g2");
register unsigned long *ADDR asm("g1");
+ register int tmp1 asm("g3");
+ register int tmp2 asm("g4");
+ register int tmp3 asm("g5");
+ register int tmp4 asm("g7");
ADDR = ((unsigned long *) addr) + (nr >> 5);
mask = 1 << (nr & 31);
@@ -123,15 +147,15 @@ static __inline__ void change_bit(unsigned long nr, volatile unsigned long *addr
"mov %%o7, %%g4\n\t"
"call ___change_bit\n\t"
" add %%o7, 8, %%o7\n"
- : "=&r" (mask)
+ : "=&r" (mask), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3), "=r" (tmp4)
: "0" (mask), "r" (ADDR)
- : "g3", "g4", "g5", "g7", "cc");
+ : "memory", "cc");
}
/*
* non-atomic versions
*/
-static __inline__ void __set_bit(int nr, volatile unsigned long *addr)
+static inline void __set_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = 1UL << (nr & 0x1f);
unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
@@ -139,7 +163,7 @@ static __inline__ void __set_bit(int nr, volatile unsigned long *addr)
*p |= mask;
}
-static __inline__ void __clear_bit(int nr, volatile unsigned long *addr)
+static inline void __clear_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = 1UL << (nr & 0x1f);
unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
@@ -147,7 +171,7 @@ static __inline__ void __clear_bit(int nr, volatile unsigned long *addr)
*p &= ~mask;
}
-static __inline__ void __change_bit(int nr, volatile unsigned long *addr)
+static inline void __change_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = 1UL << (nr & 0x1f);
unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
@@ -155,7 +179,7 @@ static __inline__ void __change_bit(int nr, volatile unsigned long *addr)
*p ^= mask;
}
-static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr)
+static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = 1UL << (nr & 0x1f);
unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
@@ -165,7 +189,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr)
return (old & mask) != 0;
}
-static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr)
+static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = 1UL << (nr & 0x1f);
unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
@@ -175,7 +199,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr)
return (old & mask) != 0;
}
-static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr)
+static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
{
unsigned long mask = 1UL << (nr & 0x1f);
unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
@@ -189,13 +213,13 @@ static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr
#define smp_mb__after_clear_bit() do { } while(0)
/* The following routine need not be atomic. */
-static __inline__ int test_bit(int nr, __const__ volatile unsigned long *addr)
+static inline int test_bit(int nr, __const__ volatile unsigned long *addr)
{
return (1UL & (((unsigned long *)addr)[nr >> 5] >> (nr & 31))) != 0UL;
}
/* The easy/cheese version for now. */
-static __inline__ unsigned long ffz(unsigned long word)
+static inline unsigned long ffz(unsigned long word)
{
unsigned long result = 0;
@@ -212,7 +236,7 @@ static __inline__ unsigned long ffz(unsigned long word)
*
* Undefined if no bit exists, so code should check against 0 first.
*/
-static __inline__ int __ffs(unsigned long word)
+static inline int __ffs(unsigned long word)
{
int num = 0;
@@ -243,7 +267,7 @@ static __inline__ int __ffs(unsigned long word)
* unlikely to be set. It's guaranteed that at least one of the 140
* bits is cleared.
*/
-static __inline__ int sched_find_first_bit(unsigned long *b)
+static inline int sched_find_first_bit(unsigned long *b)
{
if (unlikely(b[0]))
@@ -262,7 +286,7 @@ static __inline__ int sched_find_first_bit(unsigned long *b)
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs).
*/
-static __inline__ int ffs(int x)
+static inline int ffs(int x)
{
if (!x)
return 0;
@@ -288,7 +312,7 @@ static __inline__ int ffs(int x)
* 'size' bits, starting the search at bit 'offset'. This is largely based
* on Linus's ALPHA routines, which are pretty portable BTW.
*/
-static __inline__ unsigned long find_next_zero_bit(unsigned long *addr,
+static inline unsigned long find_next_zero_bit(unsigned long *addr,
unsigned long size, unsigned long offset)
{
unsigned long *p = addr + (offset >> 5);
@@ -342,7 +366,7 @@ found_middle:
*
* Scheduler induced bitop, do not use.
*/
-static __inline__ int find_next_bit(unsigned long *addr, int size, int offset)
+static inline int find_next_bit(unsigned long *addr, int size, int offset)
{
unsigned long *p = addr + (offset >> 5);
int num = offset & ~0x1f;
@@ -362,7 +386,7 @@ static __inline__ int find_next_bit(unsigned long *addr, int size, int offset)
/*
*/
-static __inline__ int test_le_bit(int nr, __const__ unsigned long * addr)
+static inline int test_le_bit(int nr, __const__ unsigned long * addr)
{
__const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
return (ADDR[nr >> 3] >> (nr & 7)) & 1;
@@ -371,7 +395,7 @@ static __inline__ int test_le_bit(int nr, __const__ unsigned long * addr)
/*
* non-atomic versions
*/
-static __inline__ void __set_le_bit(int nr, unsigned long *addr)
+static inline void __set_le_bit(int nr, unsigned long *addr)
{
unsigned char *ADDR = (unsigned char *)addr;
@@ -379,7 +403,7 @@ static __inline__ void __set_le_bit(int nr, unsigned long *addr)
*ADDR |= 1 << (nr & 0x07);
}
-static __inline__ void __clear_le_bit(int nr, unsigned long *addr)
+static inline void __clear_le_bit(int nr, unsigned long *addr)
{
unsigned char *ADDR = (unsigned char *)addr;
@@ -387,7 +411,7 @@ static __inline__ void __clear_le_bit(int nr, unsigned long *addr)
*ADDR &= ~(1 << (nr & 0x07));
}
-static __inline__ int __test_and_set_le_bit(int nr, unsigned long *addr)
+static inline int __test_and_set_le_bit(int nr, unsigned long *addr)
{
int mask, retval;
unsigned char *ADDR = (unsigned char *)addr;
@@ -399,7 +423,7 @@ static __inline__ int __test_and_set_le_bit(int nr, unsigned long *addr)
return retval;
}
-static __inline__ int __test_and_clear_le_bit(int nr, unsigned long *addr)
+static inline int __test_and_clear_le_bit(int nr, unsigned long *addr)
{
int mask, retval;
unsigned char *ADDR = (unsigned char *)addr;
@@ -411,7 +435,7 @@ static __inline__ int __test_and_clear_le_bit(int nr, unsigned long *addr)
return retval;
}
-static __inline__ unsigned long find_next_zero_le_bit(unsigned long *addr,
+static inline unsigned long find_next_zero_le_bit(unsigned long *addr,
unsigned long size, unsigned long offset)
{
unsigned long *p = addr + (offset >> 5);
@@ -455,14 +479,16 @@ found_middle:
#define find_first_zero_le_bit(addr, size) \
find_next_zero_le_bit((addr), (size), 0)
-#define ext2_set_bit __test_and_set_le_bit
-#define ext2_clear_bit __test_and_clear_le_bit
+#define ext2_set_bit(nr,addr) \
+ __test_and_set_le_bit((nr),(unsigned long *)(addr))
+#define ext2_clear_bit(nr,addr) \
+ __test_and_clear_le_bit((nr),(unsigned long *)(addr))
#define ext2_set_bit_atomic(lock, nr, addr) \
({ \
int ret; \
spin_lock(lock); \
- ret = ext2_set_bit((nr), (addr)); \
+ ret = ext2_set_bit((nr), (unsigned long *)(addr)); \
spin_unlock(lock); \
ret; \
})
@@ -471,21 +497,29 @@ found_middle:
({ \
int ret; \
spin_lock(lock); \
- ret = ext2_clear_bit((nr), (addr)); \
+ ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \
spin_unlock(lock); \
ret; \
})
-#define ext2_test_bit test_le_bit
-#define ext2_find_first_zero_bit find_first_zero_le_bit
-#define ext2_find_next_zero_bit find_next_zero_le_bit
+#define ext2_test_bit(nr,addr) \
+ test_le_bit((nr),(unsigned long *)(addr))
+#define ext2_find_first_zero_bit(addr, size) \
+ find_first_zero_le_bit((unsigned long *)(addr), (size))
+#define ext2_find_next_zero_bit(addr, size, off) \
+ find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
/* Bitmap functions for the minix filesystem. */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr) test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
+#define minix_test_and_set_bit(nr,addr) \
+ test_and_set_bit((nr),(unsigned long *)(addr))
+#define minix_set_bit(nr,addr) \
+ set_bit((nr),(unsigned long *)(addr))
+#define minix_test_and_clear_bit(nr,addr) \
+ test_and_clear_bit((nr),(unsigned long *)(addr))
+#define minix_test_bit(nr,addr) \
+ test_bit((nr),(unsigned long *)(addr))
+#define minix_find_first_zero_bit(addr,size) \
+ find_first_zero_bit((unsigned long *)(addr),(size))
#endif /* __KERNEL__ */
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index eb027804f829..9dd5a7bfcb87 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -42,23 +42,26 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
extern unsigned int __csum_partial_copy_sparc_generic (const char *, char *);
-extern __inline__ unsigned int
+static inline unsigned int
csum_partial_copy_nocheck (const char *src, char *dst, int len,
unsigned int sum)
{
register unsigned int ret asm("o0") = (unsigned int)src;
register char *d asm("o1") = dst;
register int l asm("g1") = len;
-
+
__asm__ __volatile__ (
"call " C_LABEL_STR(__csum_partial_copy_sparc_generic) "\n\t"
- " mov %4, %%g7\n"
- : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (sum) :
- "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g4", "g5", "g7");
+ " mov %6, %%g7\n"
+ : "=&r" (ret), "=&r" (d), "=&r" (l)
+ : "0" (ret), "1" (d), "2" (l), "r" (sum)
+ : "o2", "o3", "o4", "o5", "o7",
+ "g2", "g3", "g4", "g5", "g7",
+ "memory", "cc");
return ret;
}
-extern __inline__ unsigned int
+static inline unsigned int
csum_partial_copy_from_user(const char *src, char *dst, int len,
unsigned int sum, int *err)
{
@@ -79,14 +82,16 @@ csum_partial_copy_from_user(const char *src, char *dst, int len,
".previous\n"
"1:\n\t"
"call " C_LABEL_STR(__csum_partial_copy_sparc_generic) "\n\t"
- " st %5, [%%sp + 64]\n"
- : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err) :
- "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g4", "g5", "g7");
+ " st %8, [%%sp + 64]\n"
+ : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s)
+ : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err)
+ : "o2", "o3", "o4", "o5", "o7", "g2", "g3", "g4", "g5",
+ "cc", "memory");
return ret;
}
}
-extern __inline__ unsigned int
+static inline unsigned int
csum_partial_copy_to_user(const char *src, char *dst, int len,
unsigned int sum, int *err)
{
@@ -106,9 +111,12 @@ csum_partial_copy_to_user(const char *src, char *dst, int len,
".previous\n"
"1:\n\t"
"call " C_LABEL_STR(__csum_partial_copy_sparc_generic) "\n\t"
- " st %5, [%%sp + 64]\n"
- : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err) :
- "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g4", "g5", "g7");
+ " st %8, [%%sp + 64]\n"
+ : "=&r" (ret), "=&r" (d), "=&r" (l), "=&r" (s)
+ : "0" (ret), "1" (d), "2" (l), "3" (s), "r" (err)
+ : "o2", "o3", "o4", "o5", "o7",
+ "g2", "g3", "g4", "g5",
+ "cc", "memory");
return ret;
}
}
@@ -119,8 +127,8 @@ csum_partial_copy_to_user(const char *src, char *dst, int len,
/* ihl is always 5 or greater, almost always is 5, and iph is word aligned
* the majority of the time.
*/
-extern __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph,
- unsigned int ihl)
+static inline unsigned short ip_fast_csum(const unsigned char *iph,
+ unsigned int ihl)
{
unsigned short sum;
@@ -157,7 +165,7 @@ extern __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph,
}
/* Fold a partial checksum without adding pseudo headers. */
-extern __inline__ unsigned int csum_fold(unsigned int sum)
+static inline unsigned int csum_fold(unsigned int sum)
{
unsigned int tmp;
@@ -171,11 +179,11 @@ extern __inline__ unsigned int csum_fold(unsigned int sum)
return sum;
}
-extern __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
- unsigned long daddr,
- unsigned int len,
- unsigned short proto,
- unsigned int sum)
+static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
+ unsigned long daddr,
+ unsigned int len,
+ unsigned short proto,
+ unsigned int sum)
{
__asm__ __volatile__("addcc\t%1, %0, %0\n\t"
"addxcc\t%2, %0, %0\n\t"
@@ -203,11 +211,11 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
#define _HAVE_ARCH_IPV6_CSUM
-static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
- struct in6_addr *daddr,
- __u32 len,
- unsigned short proto,
- unsigned int sum)
+static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+ struct in6_addr *daddr,
+ __u32 len,
+ unsigned short proto,
+ unsigned int sum)
{
__asm__ __volatile__ (
"addcc %3, %4, %%g4\n\t"
@@ -238,7 +246,7 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
}
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
-extern __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len)
+static inline unsigned short ip_compute_csum(unsigned char * buff, int len)
{
return csum_fold(csum_partial(buff, len, 0));
}
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
index f3fdacf95ba5..72c304cad644 100644
--- a/include/asm-sparc/io.h
+++ b/include/asm-sparc/io.h
@@ -13,12 +13,12 @@
#define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
-static __inline__ u32 flip_dword (u32 d)
+static inline u32 flip_dword (u32 d)
{
return ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff);
}
-static __inline__ u16 flip_word (u16 d)
+static inline u16 flip_word (u16 d)
{
return ((d&0xff) << 8) | ((d>>8)&0xff);
}
@@ -36,43 +36,73 @@ static __inline__ u16 flip_word (u16 d)
* The offshot is, we must cast readb et. al. arguments with a #define.
*/
-static __inline__ u8 __raw_readb(unsigned long addr)
+static inline u8 __raw_readb(unsigned long addr)
{
return *(volatile u8 *)addr;
}
-static __inline__ u16 __raw_readw(unsigned long addr)
+static inline u16 __raw_readw(unsigned long addr)
{
return *(volatile u16 *)addr;
}
-static __inline__ u32 __raw_readl(unsigned long addr)
+static inline u32 __raw_readl(unsigned long addr)
{
return *(volatile u32 *)addr;
}
-static __inline__ void __raw_writeb(u8 b, unsigned long addr)
+static inline void __raw_writeb(u8 b, unsigned long addr)
{
*(volatile u8 *)addr = b;
}
-static __inline__ void __raw_writew(u16 b, unsigned long addr)
+static inline void __raw_writew(u16 b, unsigned long addr)
{
*(volatile u16 *)addr = b;
}
-static __inline__ void __raw_writel(u32 b, unsigned long addr)
+static inline void __raw_writel(u32 b, unsigned long addr)
{
*(volatile u32 *)addr = b;
}
-#define readb(addr) (*(volatile u8 *)(addr))
-#define readw(addr) flip_word(*(volatile u16 *)(addr))
-#define readl(addr) flip_dword(*(volatile u32 *)(addr))
+static inline u8 __readb(unsigned long addr)
+{
+ return *(volatile u8 *)addr;
+}
+
+static inline u16 __readw(unsigned long addr)
+{
+ return flip_word(*(volatile u16 *)addr);
+}
+
+static inline u32 __readl(unsigned long addr)
+{
+ return flip_dword(*(volatile u32 *)addr);
+}
+
+static inline void __writeb(u8 b, unsigned long addr)
+{
+ *(volatile u8 *)addr = b;
+}
+
+static inline void __writew(u16 b, unsigned long addr)
+{
+ *(volatile u16 *)addr = flip_word(b);
+}
+
+static inline void __writel(u32 b, unsigned long addr)
+{
+ *(volatile u32 *)addr = flip_dword(b);
+}
+
+#define readb(addr) __readb((unsigned long)(addr))
+#define readw(addr) __readw((unsigned long)(addr))
+#define readl(addr) __readl((unsigned long)(addr))
-#define writeb(b, a) (*(volatile u8 *)(a) = b)
-#define writew(b, a) (*(volatile u16 *)(a) = flip_word(b))
-#define writel(b, a) (*(volatile u32 *)(a) = flip_dword(b))
+#define writeb(b, addr) __writeb((b),(unsigned long)(addr))
+#define writew(b, addr) __writew((b),(unsigned long)(addr))
+#define writel(b, addr) __writel((b),(unsigned long)(addr))
/*
* I/O space operations
@@ -91,17 +121,22 @@ static __inline__ void __raw_writel(u32 b, unsigned long addr)
* mapped somewhere into virtual kernel space and we
* can use inb/outb again.
*/
-#define inb_local(addr) readb(addr)
-#define inb(addr) readb(addr)
-#define inw(addr) readw(addr)
-#define inl(addr) readl(addr)
-#define inb_p(addr) readb(addr)
-
-#define outb_local(b, addr) writeb(b, addr)
-#define outb(b, addr) writeb(b, addr)
-#define outw(b, addr) writew(b, addr)
-#define outl(b, addr) writel(b, addr)
-#define outb_p(b, addr) writeb(b, addr)
+#define inb_local(addr) __readb(addr)
+#define inb(addr) __readb(addr)
+#define inw(addr) __readw(addr)
+#define inl(addr) __readl(addr)
+
+#define outb_local(b, addr) __writeb(b, addr)
+#define outb(b, addr) __writeb(b, addr)
+#define outw(b, addr) __writew(b, addr)
+#define outl(b, addr) __writel(b, addr)
+
+#define inb_p inb
+#define outb_p outb
+#define inw_p inw
+#define outw_p outw
+#define inl_p inl
+#define outl_p outl
extern void outsb(unsigned long addr, const void *src, unsigned long cnt);
extern void outsw(unsigned long addr, const void *src, unsigned long cnt);
@@ -118,32 +153,32 @@ extern void insl(unsigned long addr, void *dst, unsigned long count);
* SBus has only one, memory mapped, I/O space.
* We do not need to flip bytes for SBus of course.
*/
-static __inline__ u8 _sbus_readb(unsigned long addr)
+static inline u8 _sbus_readb(unsigned long addr)
{
return *(volatile u8 *)addr;
}
-static __inline__ u16 _sbus_readw(unsigned long addr)
+static inline u16 _sbus_readw(unsigned long addr)
{
return *(volatile u16 *)addr;
}
-static __inline__ u32 _sbus_readl(unsigned long addr)
+static inline u32 _sbus_readl(unsigned long addr)
{
return *(volatile u32 *)addr;
}
-static __inline__ void _sbus_writeb(u8 b, unsigned long addr)
+static inline void _sbus_writeb(u8 b, unsigned long addr)
{
*(volatile u8 *)addr = b;
}
-static __inline__ void _sbus_writew(u16 b, unsigned long addr)
+static inline void _sbus_writew(u16 b, unsigned long addr)
{
*(volatile u16 *)addr = b;
}
-static __inline__ void _sbus_writel(u32 b, unsigned long addr)
+static inline void _sbus_writel(u32 b, unsigned long addr)
{
*(volatile u32 *)addr = b;
}
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index c1d81aaf072a..5423905ffb40 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -39,14 +39,45 @@ BTFIXUPDEF_CALL(void, clear_clock_irq, void)
BTFIXUPDEF_CALL(void, clear_profile_irq, int)
BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
-#define disable_irq_nosync disable_irq
-#define disable_irq(irq) BTFIXUP_CALL(disable_irq)(irq)
-#define enable_irq(irq) BTFIXUP_CALL(enable_irq)(irq)
-#define disable_pil_irq(irq) BTFIXUP_CALL(disable_pil_irq)(irq)
-#define enable_pil_irq(irq) BTFIXUP_CALL(enable_pil_irq)(irq)
-#define clear_clock_irq() BTFIXUP_CALL(clear_clock_irq)()
-#define clear_profile_irq(cpu) BTFIXUP_CALL(clear_profile_irq)(cpu)
-#define load_profile_irq(cpu,limit) BTFIXUP_CALL(load_profile_irq)(cpu,limit)
+static inline void disable_irq_nosync(unsigned int irq)
+{
+ BTFIXUP_CALL(disable_irq)(irq);
+}
+
+static inline void disable_irq(unsigned int irq)
+{
+ BTFIXUP_CALL(disable_irq)(irq);
+}
+
+static inline void enable_irq(unsigned int irq)
+{
+ BTFIXUP_CALL(enable_irq)(irq);
+}
+
+static inline void disable_pil_irq(unsigned int irq)
+{
+ BTFIXUP_CALL(disable_pil_irq)(irq);
+}
+
+static inline void enable_pil_irq(unsigned int irq)
+{
+ BTFIXUP_CALL(enable_pil_irq)(irq);
+}
+
+static inline void clear_clock_irq(void)
+{
+ BTFIXUP_CALL(clear_clock_irq)();
+}
+
+static inline void clear_profile_irq(int irq)
+{
+ BTFIXUP_CALL(clear_profile_irq)(irq);
+}
+
+static inline void load_profile_irq(int cpu, int limit)
+{
+ BTFIXUP_CALL(load_profile_irq)(cpu, limit);
+}
extern void (*sparc_init_timers)(irqreturn_t (*lvl10_irq)(int, void *, struct pt_regs *));
extern void claim_ticker14(irqreturn_t (*irq_handler)(int, void *, struct pt_regs *),
diff --git a/include/asm-sparc/pgtsun4.h b/include/asm-sparc/pgtsun4.h
index 1c6efda336c7..67a7d27dd16e 100644
--- a/include/asm-sparc/pgtsun4.h
+++ b/include/asm-sparc/pgtsun4.h
@@ -76,7 +76,7 @@
#ifndef __ASSEMBLY__
-extern __inline__ unsigned long sun4c_get_synchronous_error(void)
+static inline unsigned long sun4c_get_synchronous_error(void)
{
unsigned long sync_err;
@@ -86,7 +86,7 @@ extern __inline__ unsigned long sun4c_get_synchronous_error(void)
return sync_err;
}
-extern __inline__ unsigned long sun4c_get_synchronous_address(void)
+static inline unsigned long sun4c_get_synchronous_address(void)
{
unsigned long sync_addr;
@@ -97,7 +97,7 @@ extern __inline__ unsigned long sun4c_get_synchronous_address(void)
}
/* SUN4 pte, segmap, and context manipulation */
-extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr)
+static inline unsigned long sun4c_get_segmap(unsigned long addr)
{
register unsigned long entry;
@@ -107,14 +107,15 @@ extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr)
return entry;
}
-extern __inline__ void sun4c_put_segmap(unsigned long addr, unsigned long entry)
+static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry)
{
__asm__ __volatile__("\n\tstha %1, [%0] %2; nop; nop; nop;\n\t" : :
"r" (addr), "r" (entry),
- "i" (ASI_SEGMAP));
+ "i" (ASI_SEGMAP)
+ : "memory");
}
-extern __inline__ unsigned long sun4c_get_pte(unsigned long addr)
+static inline unsigned long sun4c_get_pte(unsigned long addr)
{
register unsigned long entry;
@@ -124,14 +125,15 @@ extern __inline__ unsigned long sun4c_get_pte(unsigned long addr)
return entry;
}
-extern __inline__ void sun4c_put_pte(unsigned long addr, unsigned long entry)
+static inline void sun4c_put_pte(unsigned long addr, unsigned long entry)
{
__asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : :
"r" (addr),
- "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE));
+ "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE)
+ : "memory");
}
-extern __inline__ int sun4c_get_context(void)
+static inline int sun4c_get_context(void)
{
register int ctx;
@@ -142,10 +144,11 @@ extern __inline__ int sun4c_get_context(void)
return ctx;
}
-extern __inline__ int sun4c_set_context(int ctx)
+static inline int sun4c_set_context(int ctx)
{
__asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : :
- "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL));
+ "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL)
+ : "memory");
return ctx;
}
diff --git a/include/asm-sparc/pgtsun4c.h b/include/asm-sparc/pgtsun4c.h
index efc081004262..306aaa1c42cb 100644
--- a/include/asm-sparc/pgtsun4c.h
+++ b/include/asm-sparc/pgtsun4c.h
@@ -76,7 +76,7 @@
#ifndef __ASSEMBLY__
-extern __inline__ unsigned long sun4c_get_synchronous_error(void)
+static inline unsigned long sun4c_get_synchronous_error(void)
{
unsigned long sync_err;
@@ -86,7 +86,7 @@ extern __inline__ unsigned long sun4c_get_synchronous_error(void)
return sync_err;
}
-extern __inline__ unsigned long sun4c_get_synchronous_address(void)
+static inline unsigned long sun4c_get_synchronous_address(void)
{
unsigned long sync_addr;
@@ -97,7 +97,7 @@ extern __inline__ unsigned long sun4c_get_synchronous_address(void)
}
/* SUN4C pte, segmap, and context manipulation */
-extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr)
+static inline unsigned long sun4c_get_segmap(unsigned long addr)
{
register unsigned long entry;
@@ -108,15 +108,16 @@ extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr)
return entry;
}
-extern __inline__ void sun4c_put_segmap(unsigned long addr, unsigned long entry)
+static inline void sun4c_put_segmap(unsigned long addr, unsigned long entry)
{
__asm__ __volatile__("\n\tstba %1, [%0] %2; nop; nop; nop;\n\t" : :
"r" (addr), "r" (entry),
- "i" (ASI_SEGMAP));
+ "i" (ASI_SEGMAP)
+ : "memory");
}
-extern __inline__ unsigned long sun4c_get_pte(unsigned long addr)
+static inline unsigned long sun4c_get_pte(unsigned long addr)
{
register unsigned long entry;
@@ -126,14 +127,15 @@ extern __inline__ unsigned long sun4c_get_pte(unsigned long addr)
return entry;
}
-extern __inline__ void sun4c_put_pte(unsigned long addr, unsigned long entry)
+static inline void sun4c_put_pte(unsigned long addr, unsigned long entry)
{
__asm__ __volatile__("\n\tsta %1, [%0] %2; nop; nop; nop;\n\t" : :
"r" (addr),
- "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE));
+ "r" ((entry & ~(_SUN4C_PAGE_PRESENT))), "i" (ASI_PTE)
+ : "memory");
}
-extern __inline__ int sun4c_get_context(void)
+static inline int sun4c_get_context(void)
{
register int ctx;
@@ -144,10 +146,11 @@ extern __inline__ int sun4c_get_context(void)
return ctx;
}
-extern __inline__ int sun4c_set_context(int ctx)
+static inline int sun4c_set_context(int ctx)
{
__asm__ __volatile__("\n\tstba %0, [%1] %2; nop; nop; nop;\n\t" : :
- "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL));
+ "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL)
+ : "memory");
return ctx;
}
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index 3f3bf3ca874c..2ae0e6bb9a53 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -130,8 +130,12 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc,
"std\t%%g0, [%0 + %3 + 0x30]\n\t"
"st\t%1, [%0 + %3 + 0x38]\n\t"
"st\t%%g0, [%0 + %3 + 0x3c]"
- : : "r" (regs), "r" (sp - sizeof(struct reg_window)), "r" (zero),
- "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])));
+ : /* no outputs */
+ : "r" (regs),
+ "r" (sp - sizeof(struct reg_window)),
+ "r" (zero),
+ "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
+ : "memory");
}
/* Free all resources held by a thread. */
diff --git a/include/asm-sparc/ross.h b/include/asm-sparc/ross.h
index 42c5381eb732..f2c14b5080ed 100644
--- a/include/asm-sparc/ross.h
+++ b/include/asm-sparc/ross.h
@@ -96,27 +96,29 @@
#ifndef __ASSEMBLY__
-extern __inline__ unsigned int get_ross_icr(void)
+static inline unsigned int get_ross_icr(void)
{
unsigned int icreg;
__asm__ __volatile__(".word 0x8347c000\n\t" /* rd %iccr, %g1 */
- "mov %%g1, %0\n\t" :
- "=r" (icreg) : :
- "g1", "memory");
+ "mov %%g1, %0\n\t"
+ : "=r" (icreg)
+ : /* no inputs */
+ : "g1", "memory");
return icreg;
}
-extern __inline__ void put_ross_icr(unsigned int icreg)
+static inline void put_ross_icr(unsigned int icreg)
{
__asm__ __volatile__("or %%g0, %0, %%g1\n\t"
".word 0xbf806000\n\t" /* wr %g1, 0x0, %iccr */
"nop\n\t"
"nop\n\t"
- "nop\n\t" : :
- "r" (icreg) :
- "g1", "memory");
+ "nop\n\t"
+ : /* no outputs */
+ : "r" (icreg)
+ : "g1", "memory");
return;
}
@@ -124,52 +126,62 @@ extern __inline__ void put_ross_icr(unsigned int icreg)
/* HyperSparc specific cache flushing. */
/* This is for the on-chip instruction cache. */
-extern __inline__ void hyper_flush_whole_icache(void)
+static inline void hyper_flush_whole_icache(void)
{
- __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
- "i" (ASI_M_FLUSH_IWHOLE));
+ __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
+ : /* no outputs */
+ : "i" (ASI_M_FLUSH_IWHOLE)
+ : "memory");
return;
}
extern int vac_cache_size;
extern int vac_line_size;
-extern __inline__ void hyper_clear_all_tags(void)
+static inline void hyper_clear_all_tags(void)
{
unsigned long addr;
for(addr = 0; addr < vac_cache_size; addr += vac_line_size)
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_DATAC_TAG));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_DATAC_TAG)
+ : "memory");
}
-extern __inline__ void hyper_flush_unconditional_combined(void)
+static inline void hyper_flush_unconditional_combined(void)
{
unsigned long addr;
- for(addr = 0; addr < vac_cache_size; addr += vac_line_size)
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_FLUSH_CTX));
+ for (addr = 0; addr < vac_cache_size; addr += vac_line_size)
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_FLUSH_CTX)
+ : "memory");
}
-extern __inline__ void hyper_flush_cache_user(void)
+static inline void hyper_flush_cache_user(void)
{
unsigned long addr;
- for(addr = 0; addr < vac_cache_size; addr += vac_line_size)
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_FLUSH_USER));
+ for (addr = 0; addr < vac_cache_size; addr += vac_line_size)
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_FLUSH_USER)
+ : "memory");
}
-extern __inline__ void hyper_flush_cache_page(unsigned long page)
+static inline void hyper_flush_cache_page(unsigned long page)
{
unsigned long end;
page &= PAGE_MASK;
end = page + PAGE_SIZE;
- while(page < end) {
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (page), "i" (ASI_M_FLUSH_PAGE));
+ while (page < end) {
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (page), "i" (ASI_M_FLUSH_PAGE)
+ : "memory");
page += vac_line_size;
}
}
diff --git a/include/asm-sparc/swift.h b/include/asm-sparc/swift.h
index c3e2ffe2d7a5..e535061bf755 100644
--- a/include/asm-sparc/swift.h
+++ b/include/asm-sparc/swift.h
@@ -27,68 +27,80 @@
#define SWIFT_EN 0x00000001 /* MMU enable */
/* Bits [13:5] select one of 512 instruction cache tags */
-extern __inline__ void swift_inv_insn_tag(unsigned long addr)
+static inline void swift_inv_insn_tag(unsigned long addr)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_TXTC_TAG));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_TXTC_TAG)
+ : "memory");
}
/* Bits [12:4] select one of 512 data cache tags */
-extern __inline__ void swift_inv_data_tag(unsigned long addr)
+static inline void swift_inv_data_tag(unsigned long addr)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_DATAC_TAG));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_DATAC_TAG)
+ : "memory");
}
-extern __inline__ void swift_flush_dcache(void)
+static inline void swift_flush_dcache(void)
{
unsigned long addr;
- for(addr = 0; addr < 0x2000; addr += 0x10)
+ for (addr = 0; addr < 0x2000; addr += 0x10)
swift_inv_data_tag(addr);
}
-extern __inline__ void swift_flush_icache(void)
+static inline void swift_flush_icache(void)
{
unsigned long addr;
- for(addr = 0; addr < 0x4000; addr += 0x20)
+ for (addr = 0; addr < 0x4000; addr += 0x20)
swift_inv_insn_tag(addr);
}
-extern __inline__ void swift_idflash_clear(void)
+static inline void swift_idflash_clear(void)
{
unsigned long addr;
- for(addr = 0; addr < 0x2000; addr += 0x10) {
+ for (addr = 0; addr < 0x2000; addr += 0x10) {
swift_inv_insn_tag(addr<<1);
swift_inv_data_tag(addr);
}
}
/* Swift is so broken, it isn't even safe to use the following. */
-extern __inline__ void swift_flush_page(unsigned long page)
+static inline void swift_flush_page(unsigned long page)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (page), "i" (ASI_M_FLUSH_PAGE));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (page), "i" (ASI_M_FLUSH_PAGE)
+ : "memory");
}
-extern __inline__ void swift_flush_segment(unsigned long addr)
+static inline void swift_flush_segment(unsigned long addr)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_FLUSH_SEG));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_FLUSH_SEG)
+ : "memory");
}
-extern __inline__ void swift_flush_region(unsigned long addr)
+static inline void swift_flush_region(unsigned long addr)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_FLUSH_REGION));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_FLUSH_REGION)
+ : "memory");
}
-extern __inline__ void swift_flush_context(void)
+static inline void swift_flush_context(void)
{
- __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
- "i" (ASI_M_FLUSH_CTX));
+ __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
+ : /* no outputs */
+ : "i" (ASI_M_FLUSH_CTX)
+ : "memory");
}
#endif /* !(_SPARC_SWIFT_H) */
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 86162b780635..b53cf2c6897e 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -220,7 +220,7 @@ extern __inline__ unsigned long swap_pil(unsigned long __new_psr)
"wr %0, %2, %%psr\n\t"
"nop; nop; nop;\n"
"1:\n"
- : "=r" (retval)
+ : "=&r" (retval)
: "r" (__new_psr), "i" (PSR_PIL)
: "g1", "g2", "memory", "cc");
@@ -298,7 +298,8 @@ extern __inline__ unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned
#ifdef CONFIG_SMP
__asm__ __volatile__("swap [%2], %0"
: "=&r" (val)
- : "0" (val), "r" (m));
+ : "0" (val), "r" (m)
+ : "memory");
return val;
#else
register unsigned long *ptr asm("g1");
diff --git a/include/asm-sparc/tsunami.h b/include/asm-sparc/tsunami.h
index 384ea6e68203..887add5c466b 100644
--- a/include/asm-sparc/tsunami.h
+++ b/include/asm-sparc/tsunami.h
@@ -45,16 +45,20 @@
#define TSUNAMI_NF 0x00000002
#define TSUNAMI_ME 0x00000001
-extern __inline__ void tsunami_flush_icache(void)
+static inline void tsunami_flush_icache(void)
{
- __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
- "i" (ASI_M_IC_FLCLEAR) : "memory");
+ __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
+ : /* no outputs */
+ : "i" (ASI_M_IC_FLCLEAR)
+ : "memory");
}
-extern __inline__ void tsunami_flush_dcache(void)
+static inline void tsunami_flush_dcache(void)
{
- __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
- "i" (ASI_M_DC_FLCLEAR) : "memory");
+ __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
+ : /* no outputs */
+ : "i" (ASI_M_DC_FLCLEAR)
+ : "memory");
}
#endif /* !(_SPARC_TSUNAMI_H) */
diff --git a/include/asm-sparc/turbosparc.h b/include/asm-sparc/turbosparc.h
index 5078d901bda6..31d2350a5818 100644
--- a/include/asm-sparc/turbosparc.h
+++ b/include/asm-sparc/turbosparc.h
@@ -59,60 +59,64 @@
#ifndef __ASSEMBLY__
/* Bits [13:5] select one of 512 instruction cache tags */
-extern __inline__ void turbosparc_inv_insn_tag(unsigned long addr)
+static inline void turbosparc_inv_insn_tag(unsigned long addr)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_TXTC_TAG));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_TXTC_TAG)
+ : "memory");
}
/* Bits [13:5] select one of 512 data cache tags */
-extern __inline__ void turbosparc_inv_data_tag(unsigned long addr)
+static inline void turbosparc_inv_data_tag(unsigned long addr)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (addr), "i" (ASI_M_DATAC_TAG));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (addr), "i" (ASI_M_DATAC_TAG)
+ : "memory");
}
-extern __inline__ void turbosparc_flush_icache(void)
+static inline void turbosparc_flush_icache(void)
{
unsigned long addr;
- for(addr = 0; addr < 0x4000; addr += 0x20)
+ for (addr = 0; addr < 0x4000; addr += 0x20)
turbosparc_inv_insn_tag(addr);
}
-extern __inline__ void turbosparc_flush_dcache(void)
+static inline void turbosparc_flush_dcache(void)
{
unsigned long addr;
- for(addr = 0; addr < 0x4000; addr += 0x20)
+ for (addr = 0; addr < 0x4000; addr += 0x20)
turbosparc_inv_data_tag(addr);
}
-extern __inline__ void turbosparc_idflash_clear(void)
+static inline void turbosparc_idflash_clear(void)
{
unsigned long addr;
- for(addr = 0; addr < 0x4000; addr += 0x20) {
+ for (addr = 0; addr < 0x4000; addr += 0x20) {
turbosparc_inv_insn_tag(addr);
turbosparc_inv_data_tag(addr);
}
}
-extern __inline__ void turbosparc_set_ccreg(unsigned long regval)
+static inline void turbosparc_set_ccreg(unsigned long regval)
{
- __asm__ __volatile__("sta %0, [%1] %2\n\t" : :
- "r" (regval), "r" (0x600),
- "i" (ASI_M_MMUREGS));
+ __asm__ __volatile__("sta %0, [%1] %2\n\t"
+ : /* no outputs */
+ : "r" (regval), "r" (0x600), "i" (ASI_M_MMUREGS)
+ : "memory");
}
-extern __inline__ unsigned long turbosparc_get_ccreg(void)
+static inline unsigned long turbosparc_get_ccreg(void)
{
unsigned long regval;
- __asm__ __volatile__("lda [%1] %2, %0\n\t" :
- "=r" (regval) :
- "r" (0x600),
- "i" (ASI_M_MMUREGS));
+ __asm__ __volatile__("lda [%1] %2, %0\n\t"
+ : "=r" (regval)
+ : "r" (0x600), "i" (ASI_M_MMUREGS));
return regval;
}
diff --git a/include/asm-sparc/vac-ops.h b/include/asm-sparc/vac-ops.h
index 7b991e82423d..9e0172323042 100644
--- a/include/asm-sparc/vac-ops.h
+++ b/include/asm-sparc/vac-ops.h
@@ -108,27 +108,29 @@ struct sun4c_vac_props {
extern struct sun4c_vac_props sun4c_vacinfo;
/* sun4c_enable_vac() enables the sun4c virtual address cache. */
-extern __inline__ void sun4c_enable_vac(void)
+static inline void sun4c_enable_vac(void)
{
- __asm__ __volatile__("lduba [%0] %1, %%g1\n\t"
- "or %%g1, %2, %%g1\n\t"
- "stba %%g1, [%0] %1\n\t" : :
- "r" ((unsigned int) AC_SENABLE),
- "i" (ASI_CONTROL), "i" (SENABLE_CACHE) :
- "g1");
- sun4c_vacinfo.on = 1;
+ __asm__ __volatile__("lduba [%0] %1, %%g1\n\t"
+ "or %%g1, %2, %%g1\n\t"
+ "stba %%g1, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" ((unsigned int) AC_SENABLE),
+ "i" (ASI_CONTROL), "i" (SENABLE_CACHE)
+ : "g1", "memory");
+ sun4c_vacinfo.on = 1;
}
/* sun4c_disable_vac() disables the virtual address cache. */
-extern __inline__ void sun4c_disable_vac(void)
+static inline void sun4c_disable_vac(void)
{
- __asm__ __volatile__("lduba [%0] %1, %%g1\n\t"
- "andn %%g1, %2, %%g1\n\t"
- "stba %%g1, [%0] %1\n\t" : :
- "r" ((unsigned int) AC_SENABLE),
- "i" (ASI_CONTROL), "i" (SENABLE_CACHE) :
- "g1");
- sun4c_vacinfo.on = 0;
+ __asm__ __volatile__("lduba [%0] %1, %%g1\n\t"
+ "andn %%g1, %2, %%g1\n\t"
+ "stba %%g1, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" ((unsigned int) AC_SENABLE),
+ "i" (ASI_CONTROL), "i" (SENABLE_CACHE)
+ : "g1", "memory");
+ sun4c_vacinfo.on = 0;
}
#endif /* !(_SPARC_VAC_OPS_H) */
diff --git a/include/asm-sparc/viking.h b/include/asm-sparc/viking.h
index 0312a2d557a9..3742cfa07663 100644
--- a/include/asm-sparc/viking.h
+++ b/include/asm-sparc/viking.h
@@ -110,48 +110,57 @@
#ifndef __ASSEMBLY__
-extern __inline__ void viking_flush_icache(void)
+static inline void viking_flush_icache(void)
{
- __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
- "i" (ASI_M_IC_FLCLEAR));
+ __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
+ : /* no outputs */
+ : "i" (ASI_M_IC_FLCLEAR)
+ : "memory");
}
-extern __inline__ void viking_flush_dcache(void)
+static inline void viking_flush_dcache(void)
{
- __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t" : :
- "i" (ASI_M_DC_FLCLEAR));
+ __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
+ : /* no outputs */
+ : "i" (ASI_M_DC_FLCLEAR)
+ : "memory");
}
-extern __inline__ void viking_unlock_icache(void)
+static inline void viking_unlock_icache(void)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (0x80000000), "i" (ASI_M_IC_FLCLEAR));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (0x80000000), "i" (ASI_M_IC_FLCLEAR)
+ : "memory");
}
-extern __inline__ void viking_unlock_dcache(void)
+static inline void viking_unlock_dcache(void)
{
- __asm__ __volatile__("sta %%g0, [%0] %1\n\t" : :
- "r" (0x80000000), "i" (ASI_M_DC_FLCLEAR));
+ __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
+ : /* no outputs */
+ : "r" (0x80000000), "i" (ASI_M_DC_FLCLEAR)
+ : "memory");
}
-extern __inline__ void viking_set_bpreg(unsigned long regval)
+static inline void viking_set_bpreg(unsigned long regval)
{
- __asm__ __volatile__("sta %0, [%%g0] %1\n\t" : :
- "r" (regval),
- "i" (ASI_M_ACTION));
+ __asm__ __volatile__("sta %0, [%%g0] %1\n\t"
+ : /* no outputs */
+ : "r" (regval), "i" (ASI_M_ACTION)
+ : "memory");
}
-extern __inline__ unsigned long viking_get_bpreg(void)
+static inline unsigned long viking_get_bpreg(void)
{
unsigned long regval;
- __asm__ __volatile__("lda [%%g0] %1, %0\n\t" :
- "=r" (regval) :
- "i" (ASI_M_ACTION));
+ __asm__ __volatile__("lda [%%g0] %1, %0\n\t"
+ : "=r" (regval)
+ : "i" (ASI_M_ACTION));
return regval;
}
-extern __inline__ void viking_get_dcache_ptag(int set, int block,
+static inline void viking_get_dcache_ptag(int set, int block,
unsigned long *data)
{
unsigned long ptag = ((set & 0x7f) << 5) | ((block & 0x3) << 26) |
@@ -160,15 +169,15 @@ extern __inline__ void viking_get_dcache_ptag(int set, int block,
__asm__ __volatile__ ("ldda [%2] %3, %%g2\n\t"
"or %%g0, %%g2, %0\n\t"
- "or %%g0, %%g3, %1\n\t" :
- "=r" (info), "=r" (page) :
- "r" (ptag), "i" (ASI_M_DATAC_TAG) :
- "g2", "g3");
+ "or %%g0, %%g3, %1\n\t"
+ : "=r" (info), "=r" (page)
+ : "r" (ptag), "i" (ASI_M_DATAC_TAG)
+ : "g2", "g3");
data[0] = info;
data[1] = page;
}
-extern __inline__ void viking_mxcc_turn_off_parity(unsigned long *mregp,
+static inline void viking_mxcc_turn_off_parity(unsigned long *mregp,
unsigned long *mxcc_cregp)
{
unsigned long mreg = *mregp;
@@ -190,30 +199,32 @@ extern __inline__ void viking_mxcc_turn_off_parity(unsigned long *mregp,
"2:\n\t"
"sta %0, [%%g0] %3\n\t"
"sta %1, [%2] %4\n"
- "1:\n\t" : :
- "r" (mreg), "r" (mxcc_creg),
- "r" (MXCC_CREG), "i" (ASI_M_MMUREGS),
- "i" (ASI_M_MXCC) : "g2", "cc");
+ "1:\n\t"
+ : /* no output */
+ : "r" (mreg), "r" (mxcc_creg),
+ "r" (MXCC_CREG), "i" (ASI_M_MMUREGS),
+ "i" (ASI_M_MXCC)
+ : "g2", "memory", "cc");
*mregp = mreg;
*mxcc_cregp = mxcc_creg;
}
-extern __inline__ unsigned long viking_hwprobe(unsigned long vaddr)
+static inline unsigned long viking_hwprobe(unsigned long vaddr)
{
unsigned long val;
vaddr &= PAGE_MASK;
/* Probe all MMU entries. */
- __asm__ __volatile__("lda [%1] %2, %0\n\t" :
- "=r" (val) :
- "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE));
+ __asm__ __volatile__("lda [%1] %2, %0\n\t"
+ : "=r" (val)
+ : "r" (vaddr | 0x400), "i" (ASI_M_FLUSH_PROBE));
if (!val)
return 0;
/* Probe region. */
- __asm__ __volatile__("lda [%1] %2, %0\n\t" :
- "=r" (val) :
- "r" (vaddr | 0x200), "i" (ASI_M_FLUSH_PROBE));
+ __asm__ __volatile__("lda [%1] %2, %0\n\t"
+ : "=r" (val)
+ : "r" (vaddr | 0x200), "i" (ASI_M_FLUSH_PROBE));
if ((val & SRMMU_ET_MASK) == SRMMU_ET_PTE) {
vaddr &= ~SRMMU_PGDIR_MASK;
vaddr >>= PAGE_SHIFT;
@@ -221,9 +232,9 @@ extern __inline__ unsigned long viking_hwprobe(unsigned long vaddr)
}
/* Probe segment. */
- __asm__ __volatile__("lda [%1] %2, %0\n\t" :
- "=r" (val) :
- "r" (vaddr | 0x100), "i" (ASI_M_FLUSH_PROBE));
+ __asm__ __volatile__("lda [%1] %2, %0\n\t"
+ : "=r" (val)
+ : "r" (vaddr | 0x100), "i" (ASI_M_FLUSH_PROBE));
if ((val & SRMMU_ET_MASK) == SRMMU_ET_PTE) {
vaddr &= ~SRMMU_PMD_MASK;
vaddr >>= PAGE_SHIFT;
@@ -231,9 +242,9 @@ extern __inline__ unsigned long viking_hwprobe(unsigned long vaddr)
}
/* Probe page. */
- __asm__ __volatile__("lda [%1] %2, %0\n\t" :
- "=r" (val) :
- "r" (vaddr), "i" (ASI_M_FLUSH_PROBE));
+ __asm__ __volatile__("lda [%1] %2, %0\n\t"
+ : "=r" (val)
+ : "r" (vaddr), "i" (ASI_M_FLUSH_PROBE));
return val;
}
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 03936a77f3da..2a53de551b53 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -511,7 +511,11 @@ extern struct net_device *__dev_get_by_flags(unsigned short flags,
unsigned short mask);
extern struct net_device *dev_get_by_name(const char *name);
extern struct net_device *__dev_get_by_name(const char *name);
-extern struct net_device *dev_alloc(const char *name, int *err);
+extern struct net_device *__dev_alloc(const char *name, int *err);
+static inline __deprecated struct net_device *dev_alloc(const char *name, int *err)
+{
+ return __dev_alloc(name, err);
+}
extern int dev_alloc_name(struct net_device *dev, const char *name);
extern int dev_open(struct net_device *dev);
extern int dev_close(struct net_device *dev);
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index a800891d2139..9a0ab579ae4f 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -9,6 +9,8 @@
#include "do_mounts.h"
+unsigned long initrd_start, initrd_end;
+int initrd_below_start_ok;
unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */
static int __initdata old_fd, root_fd;
static int __initdata mount_initrd = 1;
@@ -99,18 +101,20 @@ static void __init handle_initrd(void)
int __init initrd_load(void)
{
- if (!mount_initrd)
- return 0;
-
- create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, 0), NULL);
- create_dev("/dev/initrd", MKDEV(RAMDISK_MAJOR, INITRD_MINOR), NULL);
- /* Load the initrd data into /dev/ram0. Execute it as initrd unless
- * /dev/ram0 is supposed to be our actual root device, in
- * that case the ram disk is just set up here, and gets
- * mounted in the normal path. */
- if (rd_load_image("/dev/initrd") && ROOT_DEV != Root_RAM0) {
- handle_initrd();
- return 1;
+ if (mount_initrd) {
+ create_dev("/dev/ram", Root_RAM0, NULL);
+ /*
+ * Load the initrd data into /dev/ram0. Execute it as initrd
+ * unless /dev/ram0 is supposed to be our actual root device,
+ * in that case the ram disk is just set up here, and gets
+ * mounted in the normal path.
+ */
+ if (rd_load_image("/dev/initrd") && ROOT_DEV != Root_RAM0) {
+ sys_unlink("/dev/initrd");
+ handle_initrd();
+ return 1;
+ }
}
+ sys_unlink("/dev/initrd");
return 0;
}
diff --git a/init/initramfs.c b/init/initramfs.c
index 5a9f5b3b05f7..42eda038009f 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -8,9 +8,11 @@
#include <linux/delay.h>
#include <linux/string.h>
+static __initdata char *message;
static void __init error(char *x)
{
- panic("populate_root: %s\n", x);
+ if (!message)
+ message = x;
}
static void __init *malloc(int size)
@@ -63,7 +65,7 @@ static char __init *find_link(int major, int minor, int ino, char *name)
}
q = (struct hash *)malloc(sizeof(struct hash));
if (!q)
- error("can't allocate link hash entry");
+ panic("can't allocate link hash entry");
q->ino = ino;
q->minor = minor;
q->major = major;
@@ -119,7 +121,7 @@ static void __init parse_header(char *s)
/* FSM */
-enum state {
+static __initdata enum state {
Start,
Collect,
GotHeader,
@@ -130,9 +132,11 @@ enum state {
Reset
} state, next_state;
-char *victim;
-unsigned count;
-loff_t this_header, next_header;
+static __initdata char *victim;
+static __initdata unsigned count;
+static __initdata loff_t this_header, next_header;
+
+static __initdata int dry_run;
static inline void eat(unsigned n)
{
@@ -185,23 +189,30 @@ static int __init do_collect(void)
static int __init do_header(void)
{
+ if (memcmp(collected, "070701", 6)) {
+ error("no cpio magic");
+ return 1;
+ }
parse_header(collected);
next_header = this_header + N_ALIGN(name_len) + body_len;
next_header = (next_header + 3) & ~3;
+ if (dry_run) {
+ read_into(name_buf, N_ALIGN(name_len), GotName);
+ return 0;
+ }
+ state = SkipIt;
if (name_len <= 0 || name_len > PATH_MAX)
- state = SkipIt;
- else if (S_ISLNK(mode)) {
+ return 0;
+ if (S_ISLNK(mode)) {
if (body_len > PATH_MAX)
- state = SkipIt;
- else {
- collect = collected = symlink_buf;
- remains = N_ALIGN(name_len) + body_len;
- next_state = GotSymlink;
- state = Collect;
- }
- } else if (body_len && !S_ISREG(mode))
- state = SkipIt;
- else
+ return 0;
+ collect = collected = symlink_buf;
+ remains = N_ALIGN(name_len) + body_len;
+ next_state = GotSymlink;
+ state = Collect;
+ return 0;
+ }
+ if (S_ISREG(mode) || !body_len)
read_into(name_buf, N_ALIGN(name_len), GotName);
return 0;
}
@@ -248,6 +259,8 @@ static int __init do_name(void)
next_state = Reset;
return 0;
}
+ if (dry_run)
+ return 0;
if (S_ISREG(mode)) {
if (maybe_link() >= 0) {
wfd = sys_open(collected, O_WRONLY|O_CREAT, mode);
@@ -268,8 +281,7 @@ static int __init do_name(void)
sys_chown(collected, uid, gid);
sys_chmod(collected, mode);
}
- } else
- panic("populate_root: bogus mode: %o\n", mode);
+ }
return 0;
}
@@ -323,13 +335,14 @@ static int __init write_buffer(char *buf, unsigned len)
static void __init flush_buffer(char *buf, unsigned len)
{
int written;
- while ((written = write_buffer(buf, len)) < len) {
+ if (message)
+ return;
+ while ((written = write_buffer(buf, len)) < len && !message) {
char c = buf[written];
if (c == '0') {
buf += written;
len -= written;
state = Start;
- continue;
} else
error("junk in compressed archive");
}
@@ -408,18 +421,20 @@ static void __init flush_window(void)
outcnt = 0;
}
-static void __init unpack_to_rootfs(char *buf, unsigned len)
+char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
{
int written;
+ dry_run = check_only;
header_buf = malloc(110);
symlink_buf = malloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1);
name_buf = malloc(N_ALIGN(PATH_MAX));
window = malloc(WSIZE);
if (!window || !header_buf || !symlink_buf || !name_buf)
- error("can't allocate buffers");
+ panic("can't allocate buffers");
state = Start;
this_header = 0;
- while (len) {
+ message = NULL;
+ while (!message && len) {
loff_t saved_offset = this_header;
if (*buf == '0' && !(this_header & 3)) {
state = Start;
@@ -427,7 +442,8 @@ static void __init unpack_to_rootfs(char *buf, unsigned len)
buf += written;
len -= written;
continue;
- } else if (!*buf) {
+ }
+ if (!*buf) {
buf++;
len--;
this_header++;
@@ -442,7 +458,7 @@ static void __init unpack_to_rootfs(char *buf, unsigned len)
crc = (ulg)0xffffffffL; /* shift register contents */
makecrc();
if (gunzip())
- error("ungzip failed");
+ message = "ungzip failed";
if (state != Reset)
error("junk in gzipped archive");
this_header = saved_offset + inptr;
@@ -453,12 +469,41 @@ static void __init unpack_to_rootfs(char *buf, unsigned len)
free(name_buf);
free(symlink_buf);
free(header_buf);
+ return message;
}
extern char __initramfs_start, __initramfs_end;
+#ifdef CONFIG_BLK_DEV_INITRD
+#include <linux/initrd.h>
+#endif
void __init populate_rootfs(void)
{
- unpack_to_rootfs(&__initramfs_start,
- &__initramfs_end - &__initramfs_start);
+ char *err = unpack_to_rootfs(&__initramfs_start,
+ &__initramfs_end - &__initramfs_start, 0);
+ if (err)
+ panic(err);
+#ifdef CONFIG_BLK_DEV_INITRD
+ if (initrd_start) {
+ int fd;
+ printk(KERN_INFO "checking if image is initramfs...");
+ err = unpack_to_rootfs((char *)initrd_start,
+ initrd_end - initrd_start, 1);
+ if (!err) {
+ printk(" it is\n");
+ unpack_to_rootfs((char *)initrd_start,
+ initrd_end - initrd_start, 0);
+ free_initrd_mem(initrd_start, initrd_end);
+ return;
+ }
+ printk("it isn't (%s); looks like an initrd\n", err);
+ fd = sys_open("/dev/initrd", O_WRONLY|O_CREAT, 700);
+ if (fd >= 0) {
+ sys_write(fd, (char *)initrd_start,
+ initrd_end - initrd_start);
+ sys_close(fd);
+ free_initrd_mem(initrd_start, initrd_end);
+ }
+ }
+#endif
}
diff --git a/kernel/sched.c b/kernel/sched.c
index 3b83f89088ea..afdac563aed8 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2849,7 +2849,7 @@ void __might_sleep(char *file, int line)
static unsigned long prev_jiffy; /* ratelimiting */
if (in_atomic() || irqs_disabled()) {
- if (time_before(jiffies, prev_jiffy + HZ))
+ if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
return;
prev_jiffy = jiffies;
printk(KERN_ERR "Debug: sleeping function called from invalid"
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 8d252bdb4db3..6c23241ad9b3 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1318,6 +1318,10 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
/*
* Read the swap header.
*/
+ if (!mapping->a_ops->readpage) {
+ error = -EINVAL;
+ goto bad_swap;
+ }
page = read_cache_page(mapping, 0,
(filler_t *)mapping->a_ops->readpage, swap_file);
if (IS_ERR(page)) {
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 181788ec95f7..727311dfd884 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -175,7 +175,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
if (datalen != EBT_ALIGN(expected_length)) {
printk(KERN_WARNING
"ebtables: among: wrong size: %d"
- "against expected %d, rounded to %d\n",
+ "against expected %d, rounded to %Zd\n",
datalen, expected_length,
EBT_ALIGN(expected_length));
return -EINVAL;
diff --git a/net/core/dev.c b/net/core/dev.c
index b04cd42647a3..74d7342e045f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -646,11 +646,12 @@ int dev_alloc_name(struct net_device *dev, const char *name)
* failed. The cause of an error is returned as a negative errno code
* in the variable @err points to.
*
- * The caller must hold the @dev_base or RTNL locks when doing this in
+ * This call is deprecated in favor of alloc_netdev because
+ * the caller must hold the @dev_base or RTNL locks when doing this in
* order to avoid duplicate name allocations.
*/
-struct net_device *dev_alloc(const char *name, int *err)
+struct net_device *__dev_alloc(const char *name, int *err)
{
struct net_device *dev = kmalloc(sizeof(*dev), GFP_KERNEL);
@@ -2997,7 +2998,7 @@ EXPORT_SYMBOL(__dev_remove_pack);
EXPORT_SYMBOL(__skb_linearize);
EXPORT_SYMBOL(call_netdevice_notifiers);
EXPORT_SYMBOL(dev_add_pack);
-EXPORT_SYMBOL(dev_alloc);
+EXPORT_SYMBOL(__dev_alloc);
EXPORT_SYMBOL(dev_alloc_name);
EXPORT_SYMBOL(dev_close);
EXPORT_SYMBOL(dev_get_by_flags);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2ee1097dedf4..04f4d3f86f79 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -37,6 +37,7 @@
#include <net/arp.h>
#include <net/checksum.h>
#include <net/inet_ecn.h>
+#include <net/xfrm.h>
#ifdef CONFIG_IPV6
#include <net/ipv6.h>
@@ -600,6 +601,9 @@ int ipgre_rcv(struct sk_buff *skb)
read_lock(&ipgre_lock);
if ((tunnel = ipgre_tunnel_lookup(iph->saddr, iph->daddr, key)) != NULL) {
+ secpath_put(skb->sp);
+ skb->sp = NULL;
+
skb->mac.raw = skb->nh.raw;
skb->nh.raw = __pskb_pull(skb, offset);
memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index bb3b555f3672..44f1dff39fab 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -493,7 +493,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
goto slow_path;
/* Correct socket ownership. */
- if (frag->sk == NULL)
+ if (frag->sk == NULL && skb->sk)
goto slow_path;
/* Partially cloned skb? */
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 027b474c1c76..20da2d5ca625 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -483,6 +483,9 @@ static int ipip_rcv(struct sk_buff *skb)
return 0;
}
+ secpath_put(skb->sp);
+ skb->sp = NULL;
+
skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data;
memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 67ec90ce3d05..357727193da8 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -178,9 +178,15 @@ void tcp_bind_hash(struct sock *sk, struct tcp_bind_bucket *tb,
tcp_sk(sk)->bind_hash = tb;
}
+static inline const u32 tcp_v4_rcv_saddr(const struct sock *sk)
+{
+ return likely(sk->sk_state != TCP_TIME_WAIT) ?
+ inet_sk(sk)->rcv_saddr : tcptw_sk(sk)->tw_rcv_saddr;
+}
+
static inline int tcp_bind_conflict(struct sock *sk, struct tcp_bind_bucket *tb)
{
- struct inet_opt *inet = inet_sk(sk);
+ const u32 sk_rcv_saddr = tcp_v4_rcv_saddr(sk);
struct sock *sk2;
struct hlist_node *node;
int reuse = sk->sk_reuse;
@@ -193,9 +199,9 @@ static inline int tcp_bind_conflict(struct sock *sk, struct tcp_bind_bucket *tb)
sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
if (!reuse || !sk2->sk_reuse ||
sk2->sk_state == TCP_LISTEN) {
- struct inet_opt *inet2 = inet_sk(sk2);
- if (!inet2->rcv_saddr || !inet->rcv_saddr ||
- inet2->rcv_saddr == inet->rcv_saddr)
+ const u32 sk2_rcv_saddr = tcp_v4_rcv_saddr(sk2);
+ if (!sk2_rcv_saddr || !sk_rcv_saddr ||
+ sk2_rcv_saddr == sk_rcv_saddr)
break;
}
}
@@ -2145,7 +2151,6 @@ static void *listening_get_first(struct seq_file *seq)
if (!sk)
continue;
- ++st->num;
if (sk->sk_family == st->family) {
rc = sk;
goto out;
@@ -2159,7 +2164,7 @@ static void *listening_get_first(struct seq_file *seq)
for (st->sbucket = 0; st->sbucket < TCP_SYNQ_HSIZE;
++st->sbucket) {
for (req = tp->listen_opt->syn_table[st->sbucket];
- req; req = req->dl_next, ++st->num) {
+ req; req = req->dl_next) {
if (req->class->family != st->family)
continue;
rc = req;
@@ -2181,6 +2186,8 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
struct sock *sk = cur;
struct tcp_iter_state* st = seq->private;
+ ++st->num;
+
if (st->state == TCP_SEQ_STATE_OPENREQ) {
struct open_request *req = cur;
@@ -2188,7 +2195,6 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
req = req->dl_next;
while (1) {
while (req) {
- ++st->num;
if (req->class->family == st->family) {
cur = req;
goto out;
@@ -2235,10 +2241,11 @@ static void *listening_get_idx(struct seq_file *seq, loff_t *pos)
{
void *rc = listening_get_first(seq);
- if (rc)
- while (*pos && (rc = listening_get_next(seq, rc)))
- --*pos;
- return *pos ? NULL : rc;
+ while (rc && *pos) {
+ rc = listening_get_next(seq, rc);
+ --*pos;
+ }
+ return rc;
}
static void *established_get_first(struct seq_file *seq)
@@ -2254,7 +2261,6 @@ static void *established_get_first(struct seq_file *seq)
read_lock(&tcp_ehash[st->bucket].lock);
sk_for_each(sk, node, &tcp_ehash[st->bucket].chain) {
if (sk->sk_family != st->family) {
- ++st->num;
continue;
}
rc = sk;
@@ -2264,7 +2270,6 @@ static void *established_get_first(struct seq_file *seq)
tw_for_each(tw, node,
&tcp_ehash[st->bucket + tcp_ehash_size].chain) {
if (tw->tw_family != st->family) {
- ++st->num;
continue;
}
rc = tw;
@@ -2284,12 +2289,13 @@ static void *established_get_next(struct seq_file *seq, void *cur)
struct hlist_node *node;
struct tcp_iter_state* st = seq->private;
+ ++st->num;
+
if (st->state == TCP_SEQ_STATE_TIME_WAIT) {
tw = cur;
tw = tw_next(tw);
get_tw:
while (tw && tw->tw_family != st->family) {
- ++st->num;
tw = tw_next(tw);
}
if (tw) {
@@ -2311,7 +2317,6 @@ get_tw:
sk_for_each_from(sk, node) {
if (sk->sk_family == st->family)
goto found;
- ++st->num;
}
st->state = TCP_SEQ_STATE_TIME_WAIT;
@@ -2327,10 +2332,11 @@ static void *established_get_idx(struct seq_file *seq, loff_t pos)
{
void *rc = established_get_first(seq);
- if (rc)
- while (pos && (rc = established_get_next(seq, rc)))
- --pos;
- return pos ? NULL : rc;
+ while (rc && pos) {
+ rc = established_get_next(seq, rc);
+ --pos;
+ }
+ return rc;
}
static void *tcp_get_idx(struct seq_file *seq, loff_t pos)
@@ -2354,6 +2360,8 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos)
static void *tcp_seq_start(struct seq_file *seq, loff_t *pos)
{
+ struct tcp_iter_state* st = seq->private;
+ st->num = 0;
return *pos ? tcp_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 892329bf334c..e80ccbf02797 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -47,6 +47,7 @@
#include <net/ip6_route.h>
#include <net/addrconf.h>
#include <net/ip6_tunnel.h>
+#include <net/xfrm.h>
MODULE_AUTHOR("Ville Nuorvala");
MODULE_DESCRIPTION("IPv6-in-IPv6 tunnel");
@@ -514,6 +515,8 @@ int ip6ip6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
read_unlock(&ip6ip6_lock);
goto discard;
}
+ secpath_put(skb->sp);
+ skb->sp = NULL;
skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data;
skb->protocol = htons(ETH_P_IPV6);
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 9d003767bb9f..565572b1047f 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -49,6 +49,7 @@
#include <net/icmp.h>
#include <net/ipip.h>
#include <net/inet_ecn.h>
+#include <net/xfrm.h>
/*
This version of net/ipv6/sit.c is cloned of net/ipv4/ip_gre.c
@@ -376,6 +377,8 @@ static int ipip6_rcv(struct sk_buff *skb)
read_lock(&ipip6_lock);
if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
+ secpath_put(skb->sp);
+ skb->sp = NULL;
skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data;
memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
diff --git a/scripts/makeman b/scripts/makeman
index 07b96e25ebc0..db3af647ee17 100755
--- a/scripts/makeman
+++ b/scripts/makeman
@@ -12,7 +12,7 @@ use strict;
## $3 -- the filename which contained the sgmldoc output
## (I need this so I know which manpages to convert)
-my($LISTING, $GENERATED, $INPUT, $OUTPUT, $front, $mode, $filename);
+my($LISTING, $GENERATED, $INPUT, $OUTPUT, $front, $mode, $filename, $tmpdir);
if($ARGV[0] eq ""){
die "Usage: makeman [convert | install] <dir> <file>\n";
@@ -22,6 +22,13 @@ if( ! -d "$ARGV[1]" ){
die "Output directory \"$ARGV[1]\" does not exist\n";
}
+if($ENV{"TMPDIR"} ne ""){
+ $tmpdir = $ENV{"TMPDIR"};
+}
+else{
+ $tmpdir = "/tmp";
+}
+
if($ARGV[0] eq "convert"){
open LISTING, "grep \"<refentrytitle>\" $ARGV[2] |";
while(<LISTING>){
@@ -40,29 +47,38 @@ if($ARGV[0] eq "convert"){
open INPUT, "< $ARGV[1]/$filename.sgml";
$front = "";
$mode = 0;
- while(<INPUT>){
- if(/.*ENDFRONTTAG.*/){
- $mode = 0;
- }
+ # The modes used here are:
+ # mode = 0
+ # <!-- BEGINFRONTTAG -->
+ # <!-- <bookinfo> mode = 1
+ # <!-- <legalnotice> mode = 2
+ # <!-- ...GPL or whatever...
+ # <!-- </legalnotice> mode = 4
+ # <!-- </bookinfo> mode = 3
+ # <!-- ENDFRONTTAG -->
+ #
+ # ...doco...
+
+ # I know that some of the if statements in this while loop are in a funny
+ # order, but that is deliberate...
+ while(<INPUT>){
if($mode > 0){
s/<!-- //;
s/ -->//;
- s/<bookinfo>//;
- s/<\/bookinfo>//;
- s/<docinfo>//;
- s<\/docinfo>//;
- s/^[ \t]*//;
+ s/<docinfo>//i;
+ s<\/docinfo>//i;
+ s/^[ \t]*//i;
}
if($mode == 2){
- if(/<para>/){
+ if(/<para>/i){
}
- elsif(/<\/para>/){
+ elsif(/<\/para>/i){
$front = "$front.\\\" \n";
}
- elsif(/<\/legalnotice>/){
- $mode = 1;
+ elsif(/<\/legalnotice>/i){
+ $mode = 4;
}
elsif(/^[ \t]*$/){
}
@@ -72,69 +88,79 @@ if($ARGV[0] eq "convert"){
}
if($mode == 1){
- if(/<title>(.*)<\/title>/){
+ if(/<title>(.*)<\/title>/i){
$front = "$front.\\\" This documentation was generated from the book titled \"$1\", which is part of the Linux kernel source.\n.\\\" \n";
}
- elsif(/<legalnotice>/){
+ elsif(/<legalnotice>/i){
$front = "$front.\\\" This documentation comes with the following legal notice:\n.\\\" \n";
$mode = 2;
}
- elsif(/<author>/){
+ elsif(/<author>/i){
$front = "$front.\\\" Documentation by: ";
}
- elsif(/<firstname>(.*)<\/firstname>/){
+ elsif(/<firstname>(.*)<\/firstname>/i){
$front = "$front$1 ";
}
- elsif(/<surname>(.*)<\/surname>/){
+ elsif(/<surname>(.*)<\/surname>/i){
$front = "$front$1 ";
}
- elsif(/<email>(.*)<\/email>/){
+ elsif(/<email>(.*)<\/email>/i){
$front = "$front($1)";
}
- elsif(/\/author>/){
+ elsif(/\/author>/i){
$front = "$front\n";
}
- elsif(/<copyright>/){
+ elsif(/<copyright>/i){
$front = "$front.\\\" Documentation copyright: ";
}
- elsif(/<holder>(.*)<\/holder>/){
+ elsif(/<holder>(.*)<\/holder>/i){
$front = "$front$1 ";
}
- elsif(/<year>(.*)<\/year>/){
+ elsif(/<year>(.*)<\/year>/i){
$front = "$front$1 ";
}
- elsif(/\/copyright>/){
+ elsif(/\/copyright>/i){
$front = "$front\n";
}
elsif(/^[ \t]*$/
- || /<affiliation>/
- || /<\/affiliation>/
- || /<address>/
- || /<\/address>/
- || /<authorgroup>/
- || /<\/authorgroup>/
- || /<\/legalnotice>/
- || /<date>/
- || /<\/date>/
- || /<edition>/
- || /<\/edition>/){
+ || /<affiliation>/i
+ || /<\/affiliation>/i
+ || /<address>/i
+ || /<\/address>/i
+ || /<authorgroup>/i
+ || /<\/authorgroup>/i
+ || /<\/legalnotice>/i
+ || /<date>/i
+ || /<\/date>/i
+ || /<edition>/i
+ || /<\/edition>/i
+ || /<pubdate>/i
+ || /<\/pubdate>/i){
}
else{
print "Unknown tag in manpage conversion: $_";
}
}
- if(/.*BEGINFRONTTAG.*/){
- $mode = 1;
+ if($mode == 0){
+ if(/<bookinfo>/i){
+ $mode = 1;
+ }
+ }
+
+ if($mode == 4){
+ if(/<\/bookinfo>/i){
+ $mode = 3;
+ }
}
}
close INPUT;
- system("cd $ARGV[1]; docbook2man $filename.sgml; mv $filename.9 /tmp/$$.9\n");
- open GENERATED, "< /tmp/$$.9";
+ system("cd $ARGV[1]; docbook2man $filename.sgml; mv $filename.9 $tmpdir/$$.9\n");
+ open GENERATED, "< $tmpdir/$$.9";
open OUTPUT, "> $ARGV[1]/$filename.9";
print OUTPUT "$front";
@@ -146,7 +172,7 @@ if($ARGV[0] eq "convert"){
close GENERATED;
system("gzip -f $ARGV[1]/$filename.9\n");
- unlink("/tmp/$filename.9");
+ unlink("$tmpdir/$$.9");
}
}
elsif($ARGV[0] eq "install"){
diff --git a/scripts/split-man b/scripts/split-man
index 7970935a1dee..03897fe6a75d 100755
--- a/scripts/split-man
+++ b/scripts/split-man
@@ -52,7 +52,7 @@ while(<SGML>){
open REF, "> $ARGV[1]/$filename.sgml" or
die "Couldn't open output file \"$ARGV[1]/$filename.sgml\": $!\n";
print REF <<EOF;
-<!DOCTYPE refentry PUBLIC "-//Davenport//DTD DocBook V3.0//EN">
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
<!-- BEGINFRONTTAG: The following is front matter for the parent book -->
$front
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index 15b92012851e..3d595091dba0 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -13,6 +13,7 @@
#define SECCLASS_NULL 0x0000 /* no class */
#define SELINUX_MAGIC 0xf97cff8c
+#define POLICYDB_VERSION 15
#ifdef CONFIG_SECURITY_SELINUX_BOOTPARAM
extern int selinux_enabled;
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 0c0ea83d0456..482513614d97 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -37,7 +37,8 @@ enum sel_inos {
SEL_ACCESS, /* compute access decision */
SEL_CREATE, /* compute create labeling decision */
SEL_RELABEL, /* compute relabeling decision */
- SEL_USER /* compute reachable user contexts */
+ SEL_USER, /* compute reachable user contexts */
+ SEL_POLICYVERS /* return policy version for this kernel */
};
static ssize_t sel_read_enforce(struct file *filp, char *buf,
@@ -125,6 +126,46 @@ static struct file_operations sel_enforce_ops = {
.write = sel_write_enforce,
};
+static ssize_t sel_read_policyvers(struct file *filp, char *buf,
+ size_t count, loff_t *ppos)
+{
+ char *page;
+ ssize_t length;
+ ssize_t end;
+
+ if (count < 0 || count > PAGE_SIZE)
+ return -EINVAL;
+ if (!(page = (char*)__get_free_page(GFP_KERNEL)))
+ return -ENOMEM;
+ memset(page, 0, PAGE_SIZE);
+
+ length = snprintf(page, PAGE_SIZE, "%u", POLICYDB_VERSION);
+ if (length < 0) {
+ free_page((unsigned long)page);
+ return length;
+ }
+
+ if (*ppos >= length) {
+ free_page((unsigned long)page);
+ return 0;
+ }
+ if (count + *ppos > length)
+ count = length - *ppos;
+ end = count + *ppos;
+ if (copy_to_user(buf, (char *) page + *ppos, count)) {
+ count = -EFAULT;
+ goto out;
+ }
+ *ppos = end;
+out:
+ free_page((unsigned long)page);
+ return count;
+}
+
+static struct file_operations sel_policyvers_ops = {
+ .read = sel_read_policyvers,
+};
+
static ssize_t sel_write_load(struct file * file, const char * buf,
size_t count, loff_t *ppos)
@@ -568,6 +609,7 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
[SEL_CREATE] = {"create", &transaction_ops, S_IRUGO|S_IWUGO},
[SEL_RELABEL] = {"relabel", &transaction_ops, S_IRUGO|S_IWUGO},
[SEL_USER] = {"user", &transaction_ops, S_IRUGO|S_IWUGO},
+ [SEL_POLICYVERS] = {"policyvers", &sel_policyvers_ops, S_IRUGO},
/* last one */ {""}
};
return simple_fill_super(sb, SELINUX_MAGIC, selinux_files);
diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h
index b6c2a4ea9e82..9e4394b1332f 100644
--- a/security/selinux/ss/policydb.h
+++ b/security/selinux/ss/policydb.h
@@ -225,7 +225,6 @@ extern int policydb_read(struct policydb *p, void *fp);
#define PERM_SYMTAB_SIZE 32
-#define POLICYDB_VERSION 15
#define POLICYDB_CONFIG_MLS 1
#define OBJECT_R "object_r"