aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX4
-rw-r--r--Documentation/SubmittingPatches54
-rw-r--r--Documentation/filesystems/00-INDEX6
-rw-r--r--Documentation/filesystems/nfsroot.txt (renamed from Documentation/nfsroot.txt)0
-rw-r--r--Documentation/filesystems/rpc-cache.txt (renamed from Documentation/rpc-cache.txt)0
-rw-r--r--Documentation/filesystems/seq_file.txt283
-rw-r--r--Documentation/hrtimers/highres.txt2
-rw-r--r--Documentation/kernel-parameters.txt10
-rw-r--r--Documentation/networking/can.txt8
-rw-r--r--Documentation/scheduler/00-INDEX2
-rw-r--r--Documentation/scheduler/sched-rt-group.txt (renamed from Documentation/sched-rt-group.txt)0
-rw-r--r--Documentation/spi/spi-summary15
-rw-r--r--Documentation/spinlocks.txt22
-rw-r--r--Documentation/vm/hugetlbpage.txt7
-rw-r--r--MAINTAINERS14
-rw-r--r--Makefile2
-rw-r--r--arch/avr32/Kconfig1
-rw-r--r--arch/frv/kernel/entry-table.S8
-rw-r--r--arch/frv/kernel/entry.S20
-rw-r--r--arch/frv/kernel/head.inc2
-rw-r--r--arch/frv/kernel/switch_to.S7
-rw-r--r--arch/frv/kernel/traps.c229
-rw-r--r--arch/ia64/Kconfig11
-rw-r--r--arch/ia64/ia32/elfcore32.h14
-rw-r--r--arch/ia64/ia32/sys_ia32.c649
-rw-r--r--arch/ia64/kernel/acpi.c4
-rw-r--r--arch/ia64/kernel/asm-offsets.c6
-rw-r--r--arch/ia64/kernel/efi.c46
-rw-r--r--arch/ia64/kernel/entry.S65
-rw-r--r--arch/ia64/kernel/fsys.S54
-rw-r--r--arch/ia64/kernel/head.S20
-rw-r--r--arch/ia64/kernel/ivt.S69
-rw-r--r--arch/ia64/kernel/mca.c50
-rw-r--r--arch/ia64/kernel/mca_asm.S5
-rw-r--r--arch/ia64/kernel/minstate.h14
-rw-r--r--arch/ia64/kernel/numa.c2
-rw-r--r--arch/ia64/kernel/patch.c8
-rw-r--r--arch/ia64/kernel/process.c30
-rw-r--r--arch/ia64/kernel/ptrace.c1217
-rw-r--r--arch/ia64/kernel/setup.c8
-rw-r--r--arch/ia64/kernel/smp.c82
-rw-r--r--arch/ia64/kernel/time.c78
-rw-r--r--arch/ia64/mm/discontig.c13
-rw-r--r--arch/ia64/mm/numa.c4
-rw-r--r--arch/ia64/mm/tlb.c357
-rw-r--r--arch/ia64/pci/pci.c7
-rw-r--r--arch/mips/au1000/common/platform.c2
-rw-r--r--arch/parisc/kernel/signal.c3
-rw-r--r--arch/sh/boot/compressed/head_32.S1
-rw-r--r--arch/sh/boot/compressed/head_64.S1
-rw-r--r--arch/sh/kernel/process_64.c1
-rw-r--r--arch/sh/kernel/ptrace_64.c1
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c1
-rw-r--r--arch/sh/kernel/sh_ksyms_64.c1
-rw-r--r--arch/sh/kernel/signal_64.c1
-rw-r--r--arch/sh/kernel/traps_32.c1
-rw-r--r--arch/sh/kernel/traps_64.c1
-rw-r--r--arch/sparc/kernel/ptrace.c2
-rw-r--r--arch/sparc64/kernel/ptrace.c148
-rw-r--r--arch/x86/kernel/alternative.c12
-rw-r--r--arch/x86/kernel/process_32.c47
-rw-r--r--arch/x86/kernel/process_64.c47
-rw-r--r--arch/x86/kernel/tls.c4
-rw-r--r--arch/x86/pci/acpi.c17
-rw-r--r--block/Kconfig2
-rw-r--r--block/cfq-iosched.c9
-rw-r--r--drivers/acpi/bus.c7
-rw-r--r--drivers/acpi/processor_core.c2
-rw-r--r--drivers/acpi/thermal.c2
-rw-r--r--drivers/ata/pata_ali.c2
-rw-r--r--drivers/ata/pata_sil680.c2
-rw-r--r--drivers/ata/sata_fsl.c3
-rw-r--r--drivers/ata/sata_svw.c4
-rw-r--r--drivers/block/cciss.c1
-rw-r--r--drivers/block/ub.c38
-rw-r--r--drivers/i2c/busses/i2c-davinci.c17
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c2
-rw-r--r--drivers/i2c/busses/i2c-tiny-usb.c12
-rw-r--r--drivers/ide/mips/au1xxx-ide.c18
-rw-r--r--drivers/ide/pci/it821x.c2
-rw-r--r--drivers/isdn/i4l/isdn_net.c1
-rw-r--r--drivers/leds/leds-ams-delta.c2
-rw-r--r--drivers/leds/leds-atmel-pwm.c3
-rw-r--r--drivers/leds/leds-clevo-mail.c1
-rw-r--r--drivers/leds/leds-cm-x270.c2
-rw-r--r--drivers/leds/leds-cobalt-qube.c3
-rw-r--r--drivers/leds/leds-corgi.c2
-rw-r--r--drivers/leds/leds-gpio.c1
-rw-r--r--drivers/leds/leds-h1940.c2
-rw-r--r--drivers/leds/leds-hp6xx.c4
-rw-r--r--drivers/leds/leds-s3c24xx.c1
-rw-r--r--drivers/leds/leds-spitz.c2
-rw-r--r--drivers/leds/leds-tosa.c2
-rw-r--r--drivers/md/raid5.c51
-rw-r--r--drivers/misc/atmel-ssc.c2
-rw-r--r--drivers/misc/atmel_pwm.c1
-rw-r--r--drivers/misc/hdpuftrs/hdpu_cpustate.c2
-rw-r--r--drivers/misc/hdpuftrs/hdpu_nexus.c2
-rw-r--r--drivers/mmc/host/at91_mci.c1
-rw-r--r--drivers/mmc/host/au1xmmc.c2
-rw-r--r--drivers/mmc/host/imxmmc.c2
-rw-r--r--drivers/mmc/host/omap.c3
-rw-r--r--drivers/mmc/host/pxamci.c2
-rw-r--r--drivers/mmc/host/wbsd.c1
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c1
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c1
-rw-r--r--drivers/net/b44.c52
-rw-r--r--drivers/net/bnx2x.c6
-rw-r--r--drivers/net/ehea/ehea.h3
-rw-r--r--drivers/net/ehea/ehea_main.c24
-rw-r--r--drivers/net/forcedeth.c26
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c3
-rw-r--r--drivers/net/macb.c14
-rw-r--r--drivers/net/netconsole.c5
-rw-r--r--drivers/net/ps3_gelic_wireless.c11
-rw-r--r--drivers/net/sc92031.c1
-rw-r--r--drivers/net/sky2.c1
-rw-r--r--drivers/net/smc91x.c2
-rw-r--r--drivers/net/starfire.c11
-rw-r--r--drivers/net/tg3.c7
-rw-r--r--drivers/net/tokenring/olympic.c15
-rw-r--r--drivers/net/tun.c38
-rw-r--r--drivers/net/ucc_geth.c53
-rw-r--r--drivers/net/virtio_net.c5
-rw-r--r--drivers/net/wan/Kconfig6
-rw-r--r--drivers/net/wireless/b43/dma.c27
-rw-r--r--drivers/net/wireless/b43legacy/dma.c55
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c39
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_tx.c7
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c203
-rw-r--r--drivers/net/wireless/ipw2200.c8
-rw-r--r--drivers/net/wireless/iwlwifi/Kconfig1
-rw-r--r--drivers/net/wireless/libertas/assoc.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/net/wireless/rtl8187_dev.c3
-rw-r--r--drivers/pcmcia/at91_cf.c1
-rw-r--r--drivers/pcmcia/omap_cf.c2
-rw-r--r--drivers/pcmcia/pxa2xx_base.c2
-rw-r--r--drivers/rtc/Kconfig1
-rw-r--r--drivers/rtc/rtc-at32ap700x.c2
-rw-r--r--drivers/rtc/rtc-at91rm9200.c1
-rw-r--r--drivers/rtc/rtc-bfin.c1
-rw-r--r--drivers/rtc/rtc-cmos.c8
-rw-r--r--drivers/rtc/rtc-ds1216.c1
-rw-r--r--drivers/rtc/rtc-ds1511.c3
-rw-r--r--drivers/rtc/rtc-ds1553.c3
-rw-r--r--drivers/rtc/rtc-ds1742.c1
-rw-r--r--drivers/rtc/rtc-ep93xx.c3
-rw-r--r--drivers/rtc/rtc-m48t59.c3
-rw-r--r--drivers/rtc/rtc-m48t86.c1
-rw-r--r--drivers/rtc/rtc-omap.c2
-rw-r--r--drivers/rtc/rtc-rs5c313.c1
-rw-r--r--drivers/rtc/rtc-s3c.c1
-rw-r--r--drivers/rtc/rtc-sa1100.c1
-rw-r--r--drivers/rtc/rtc-sh.c1
-rw-r--r--drivers/rtc/rtc-stk17ta8.c3
-rw-r--r--drivers/rtc/rtc-v3020.c1
-rw-r--r--drivers/rtc/rtc-vr41xx.c3
-rw-r--r--drivers/serial/atmel_serial.c1
-rw-r--r--drivers/serial/bfin_5xx.c2
-rw-r--r--drivers/serial/imx.c2
-rw-r--r--drivers/serial/mcf.c1
-rw-r--r--drivers/serial/mpc52xx_uart.c2
-rw-r--r--drivers/serial/mpsc.c2
-rw-r--r--drivers/serial/netx-serial.c2
-rw-r--r--drivers/serial/pnx8xxx_uart.c1
-rw-r--r--drivers/serial/pxa.c3
-rw-r--r--drivers/serial/s3c2410.c4
-rw-r--r--drivers/serial/sa1100.c2
-rw-r--r--drivers/serial/sc26xx.c2
-rw-r--r--drivers/serial/sh-sci.c1
-rw-r--r--drivers/serial/uartlite.c3
-rw-r--r--drivers/serial/vr41xx_siu.c3
-rw-r--r--drivers/spi/atmel_spi.c1
-rw-r--r--drivers/spi/au1550_spi.c3
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c3
-rw-r--r--drivers/spi/omap2_mcspi.c3
-rw-r--r--drivers/spi/omap_uwire.c4
-rw-r--r--drivers/spi/pxa2xx_spi.c2
-rw-r--r--drivers/spi/spi_bfin5xx.c19
-rw-r--r--drivers/spi/spi_imx.c4
-rw-r--r--drivers/spi/spi_mpc83xx.c5
-rw-r--r--drivers/spi/spi_s3c24xx.c22
-rw-r--r--drivers/spi/spi_s3c24xx_gpio.c2
-rw-r--r--drivers/spi/spi_sh_sci.c1
-rw-r--r--drivers/spi/spi_txx9.c3
-rw-r--r--drivers/spi/xilinx_spi.c3
-rw-r--r--drivers/ssb/driver_mipscore.c13
-rw-r--r--drivers/ssb/driver_pcicore.c2
-rw-r--r--drivers/ssb/main.c20
-rw-r--r--drivers/thermal/thermal.c4
-rw-r--r--drivers/usb/gadget/at91_udc.c1
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c1
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c1
-rw-r--r--drivers/usb/gadget/m66592-udc.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c2
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c2
-rw-r--r--drivers/usb/host/isp116x-hcd.c8
-rw-r--r--drivers/usb/host/ohci-at91.c3
-rw-r--r--drivers/usb/host/ohci-au1xxx.c1
-rw-r--r--drivers/usb/host/ohci-ep93xx.c2
-rw-r--r--drivers/usb/host/ohci-lh7a404.c1
-rw-r--r--drivers/usb/host/ohci-omap.c1
-rw-r--r--drivers/usb/host/ohci-pnx4008.c4
-rw-r--r--drivers/usb/host/ohci-pnx8550.c5
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c1
-rw-r--r--drivers/usb/host/ohci-pxa27x.c3
-rw-r--r--drivers/usb/host/ohci-s3c2410.c1
-rw-r--r--drivers/usb/host/ohci-sh.c1
-rw-r--r--drivers/usb/host/ohci-sm501.c1
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c1
-rw-r--r--drivers/usb/host/u132-hcd.c1
-rw-r--r--drivers/usb/serial/option.c56
-rw-r--r--drivers/usb/serial/usb-serial.c2
-rw-r--r--drivers/usb/storage/unusual_devs.h96
-rw-r--r--drivers/video/fbmem.c1
-rw-r--r--drivers/watchdog/at32ap700x_wdt.c3
-rw-r--r--drivers/watchdog/at91rm9200_wdt.c1
-rw-r--r--drivers/watchdog/davinci_wdt.c2
-rw-r--r--drivers/watchdog/ks8695_wdt.c1
-rw-r--r--drivers/watchdog/mpc83xx_wdt.c2
-rw-r--r--drivers/watchdog/mpcore_wdt.c3
-rw-r--r--drivers/watchdog/mtx-1_wdt.c2
-rw-r--r--drivers/watchdog/mv64x60_wdt.c1
-rw-r--r--drivers/watchdog/omap_wdt.c1
-rw-r--r--drivers/watchdog/pnx4008_wdt.c2
-rw-r--r--drivers/watchdog/s3c2410_wdt.c1
-rw-r--r--drivers/watchdog/txx9wdt.c1
-rw-r--r--fs/Kconfig8
-rw-r--r--fs/afs/main.c2
-rw-r--r--fs/aio.c18
-rw-r--r--fs/ext2/xattr.c2
-rw-r--r--fs/ext3/xattr.c2
-rw-r--r--fs/ext4/xattr.c2
-rw-r--r--fs/hfsplus/dir.c23
-rw-r--r--fs/jffs2/file.c2
-rw-r--r--fs/locks.c48
-rw-r--r--fs/mbcache.c4
-rw-r--r--fs/nfs/file.c4
-rw-r--r--fs/nfs/inode.c1
-rw-r--r--fs/open.c8
-rw-r--r--fs/signalfd.c7
-rw-r--r--fs/splice.c31
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c2
-rw-r--r--fs/xfs/quota/xfs_qm.c6
-rw-r--r--fs/xfs/quota/xfs_qm_bhv.c2
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c4
-rw-r--r--fs/xfs/xfs_attr_leaf.c6
-rw-r--r--fs/xfs/xfs_bmap.c18
-rw-r--r--fs/xfs/xfs_bmap_btree.h2
-rw-r--r--fs/xfs/xfs_dir2.c2
-rw-r--r--fs/xfs/xfs_fsops.c24
-rw-r--r--fs/xfs/xfs_ialloc.c6
-rw-r--r--fs/xfs/xfs_inode.c6
-rw-r--r--fs/xfs/xfs_inode_item.c4
-rw-r--r--fs/xfs/xfs_itable.c2
-rw-r--r--fs/xfs/xfs_log.c14
-rw-r--r--fs/xfs/xfs_log_priv.h4
-rw-r--r--fs/xfs/xfs_log_recover.c16
-rw-r--r--fs/xfs/xfs_mount.c59
-rw-r--r--fs/xfs/xfs_sb.h107
-rw-r--r--fs/xfs/xfs_utils.c6
-rw-r--r--fs/xfs/xfs_vfsops.c9
-rw-r--r--fs/xfs/xfs_vnodeops.c2
-rw-r--r--include/asm-arm/arch-s3c2410/spi.h1
-rw-r--r--include/asm-frv/mem-layout.h2
-rw-r--r--include/asm-frv/pgtable.h19
-rw-r--r--include/asm-frv/spr-regs.h14
-rw-r--r--include/asm-frv/system.h21
-rw-r--r--include/asm-ia64/acpi.h33
-rw-r--r--include/asm-ia64/cputime.h104
-rw-r--r--include/asm-ia64/elf.h31
-rw-r--r--include/asm-ia64/kregs.h3
-rw-r--r--include/asm-ia64/numa.h2
-rw-r--r--include/asm-ia64/sal.h21
-rw-r--r--include/asm-ia64/smp.h3
-rw-r--r--include/asm-ia64/system.h12
-rw-r--r--include/asm-ia64/thread_info.h14
-rw-r--r--include/asm-ia64/tlb.h26
-rw-r--r--include/asm-ia64/tlbflush.h1
-rw-r--r--include/asm-mips/mach-au1x00/au1xxx_ide.h18
-rw-r--r--include/asm-mips/mach-db1x00/db1200.h4
-rw-r--r--include/asm-mips/mach-pb1x00/pb1200.h4
-rw-r--r--include/asm-um/tlb.h1
-rw-r--r--include/asm-x86/linkage.h35
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/if_tun.h39
-rw-r--r--include/linux/iocontext.h4
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/linkage.h20
-rw-r--r--include/linux/mbcache.h2
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/spinlock.h3
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/thermal.h2
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/ulpevent.h2
-rw-r--r--include/net/tcp.h2
-rw-r--r--kernel/cgroup.c1
-rw-r--r--kernel/exit.c4
-rw-r--r--kernel/printk.c17
-rw-r--r--kernel/sched_fair.c6
-rw-r--r--kernel/uid16.c22
-rw-r--r--lib/lzo/lzo1x_decompress.c2
-rw-r--r--mm/memcontrol.c9
-rw-r--r--mm/oom_kill.c4
-rw-r--r--mm/sparse.c10
-rw-r--r--mm/vmstat.c1
-rw-r--r--net/atm/lec.c29
-rw-r--r--net/ax25/ax25_uid.c2
-rw-r--r--net/bridge/br_netfilter.c3
-rw-r--r--net/core/skbuff.c4
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dccp/dccp.h6
-rw-r--r--net/dccp/ipv4.c1
-rw-r--r--net/dccp/output.c1
-rw-r--r--net/dccp/proto.c3
-rw-r--r--net/ethernet/eth.c2
-rw-r--r--net/ieee80211/ieee80211_rx.c43
-rw-r--r--net/ipv4/Kconfig8
-rw-r--r--net/ipv4/inet_timewait_sock.c1
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipconfig.c2
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c2
-rw-r--r--net/ipv4/tcp_input.c143
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv6/addrconf.c19
-rw-r--r--net/ipv6/raw.c6
-rw-r--r--net/mac80211/ieee80211_sta.c43
-rw-r--r--net/mac80211/rx.c7
-rw-r--r--net/netfilter/xt_hashlimit.c23
-rw-r--r--net/rfkill/rfkill.c2
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/rxrpc/rxkad.c2
-rw-r--r--net/sched/cls_u32.c12
-rw-r--r--net/sched/sch_api.c3
-rw-r--r--net/sctp/ipv6.c5
-rw-r--r--net/sctp/outqueue.c3
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/sctp/sm_make_chunk.c29
-rw-r--r--net/sctp/sm_sideeffect.c3
-rw-r--r--net/sctp/sm_statefuns.c23
-rw-r--r--net/sctp/socket.c5
-rw-r--r--net/sctp/ulpevent.c2
-rw-r--r--net/sunrpc/clnt.c4
-rw-r--r--net/sunrpc/xdr.c9
-rw-r--r--net/wireless/nl80211.c2
-rw-r--r--net/xfrm/xfrm_user.c2
-rw-r--r--security/selinux/hooks.c8
-rw-r--r--sound/pci/es1968.c14
356 files changed, 5107 insertions, 1450 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index fc8e7c7d182f..e8fb24671967 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -271,8 +271,6 @@ netlabel/
271 - directory with information on the NetLabel subsystem. 271 - directory with information on the NetLabel subsystem.
272networking/ 272networking/
273 - directory with info on various aspects of networking with Linux. 273 - directory with info on various aspects of networking with Linux.
274nfsroot.txt
275 - short guide on setting up a diskless box with NFS root filesystem.
276nmi_watchdog.txt 274nmi_watchdog.txt
277 - info on NMI watchdog for SMP systems. 275 - info on NMI watchdog for SMP systems.
278nommu-mmap.txt 276nommu-mmap.txt
@@ -321,8 +319,6 @@ robust-futexes.txt
321 - a description of what robust futexes are. 319 - a description of what robust futexes are.
322rocket.txt 320rocket.txt
323 - info on the Comtrol RocketPort multiport serial driver. 321 - info on the Comtrol RocketPort multiport serial driver.
324rpc-cache.txt
325 - introduction to the caching mechanisms in the sunrpc layer.
326rt-mutex-design.txt 322rt-mutex-design.txt
327 - description of the RealTime mutex implementation design. 323 - description of the RealTime mutex implementation design.
328rt-mutex.txt 324rt-mutex.txt
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 47a539c7642d..1fc4e7144dce 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -328,7 +328,7 @@ now, but you can do this to mark internal company procedures or just
328point out some special detail about the sign-off. 328point out some special detail about the sign-off.
329 329
330 330
33113) When to use Acked-by: 33113) When to use Acked-by: and Cc:
332 332
333The Signed-off-by: tag indicates that the signer was involved in the 333The Signed-off-by: tag indicates that the signer was involved in the
334development of the patch, or that he/she was in the patch's delivery path. 334development of the patch, or that he/she was in the patch's delivery path.
@@ -349,11 +349,59 @@ Acked-by: does not necessarily indicate acknowledgement of the entire patch.
349For example, if a patch affects multiple subsystems and has an Acked-by: from 349For example, if a patch affects multiple subsystems and has an Acked-by: from
350one subsystem maintainer then this usually indicates acknowledgement of just 350one subsystem maintainer then this usually indicates acknowledgement of just
351the part which affects that maintainer's code. Judgement should be used here. 351the part which affects that maintainer's code. Judgement should be used here.
352 When in doubt people should refer to the original discussion in the mailing 352When in doubt people should refer to the original discussion in the mailing
353list archives. 353list archives.
354 354
355If a person has had the opportunity to comment on a patch, but has not
356provided such comments, you may optionally add a "Cc:" tag to the patch.
357This is the only tag which might be added without an explicit action by the
358person it names. This tag documents that potentially interested parties
359have been included in the discussion
355 360
35614) The canonical patch format 361
36214) Using Test-by: and Reviewed-by:
363
364A Tested-by: tag indicates that the patch has been successfully tested (in
365some environment) by the person named. This tag informs maintainers that
366some testing has been performed, provides a means to locate testers for
367future patches, and ensures credit for the testers.
368
369Reviewed-by:, instead, indicates that the patch has been reviewed and found
370acceptable according to the Reviewer's Statement:
371
372 Reviewer's statement of oversight
373
374 By offering my Reviewed-by: tag, I state that:
375
376 (a) I have carried out a technical review of this patch to
377 evaluate its appropriateness and readiness for inclusion into
378 the mainline kernel.
379
380 (b) Any problems, concerns, or questions relating to the patch
381 have been communicated back to the submitter. I am satisfied
382 with the submitter's response to my comments.
383
384 (c) While there may be things that could be improved with this
385 submission, I believe that it is, at this time, (1) a
386 worthwhile modification to the kernel, and (2) free of known
387 issues which would argue against its inclusion.
388
389 (d) While I have reviewed the patch and believe it to be sound, I
390 do not (unless explicitly stated elsewhere) make any
391 warranties or guarantees that it will achieve its stated
392 purpose or function properly in any given situation.
393
394A Reviewed-by tag is a statement of opinion that the patch is an
395appropriate modification of the kernel without any remaining serious
396technical issues. Any interested reviewer (who has done the work) can
397offer a Reviewed-by tag for a patch. This tag serves to give credit to
398reviewers and to inform maintainers of the degree of review which has been
399done on the patch. Reviewed-by: tags, when supplied by reviewers known to
400understand the subject area and to perform thorough reviews, will normally
401increase the liklihood of your patch getting into the kernel.
402
403
40415) The canonical patch format
357 405
358The canonical patch subject line is: 406The canonical patch subject line is:
359 407
diff --git a/Documentation/filesystems/00-INDEX b/Documentation/filesystems/00-INDEX
index e68021c08fbd..52cd611277a3 100644
--- a/Documentation/filesystems/00-INDEX
+++ b/Documentation/filesystems/00-INDEX
@@ -66,6 +66,8 @@ mandatory-locking.txt
66 - info on the Linux implementation of Sys V mandatory file locking. 66 - info on the Linux implementation of Sys V mandatory file locking.
67ncpfs.txt 67ncpfs.txt
68 - info on Novell Netware(tm) filesystem using NCP protocol. 68 - info on Novell Netware(tm) filesystem using NCP protocol.
69nfsroot.txt
70 - short guide on setting up a diskless box with NFS root filesystem.
69ntfs.txt 71ntfs.txt
70 - info and mount options for the NTFS filesystem (Windows NT). 72 - info and mount options for the NTFS filesystem (Windows NT).
71ocfs2.txt 73ocfs2.txt
@@ -82,6 +84,10 @@ relay.txt
82 - info on relay, for efficient streaming from kernel to user space. 84 - info on relay, for efficient streaming from kernel to user space.
83romfs.txt 85romfs.txt
84 - description of the ROMFS filesystem. 86 - description of the ROMFS filesystem.
87rpc-cache.txt
88 - introduction to the caching mechanisms in the sunrpc layer.
89seq_file.txt
90 - how to use the seq_file API
85sharedsubtree.txt 91sharedsubtree.txt
86 - a description of shared subtrees for namespaces. 92 - a description of shared subtrees for namespaces.
87smbfs.txt 93smbfs.txt
diff --git a/Documentation/nfsroot.txt b/Documentation/filesystems/nfsroot.txt
index 31b329172343..31b329172343 100644
--- a/Documentation/nfsroot.txt
+++ b/Documentation/filesystems/nfsroot.txt
diff --git a/Documentation/rpc-cache.txt b/Documentation/filesystems/rpc-cache.txt
index 8a382bea6808..8a382bea6808 100644
--- a/Documentation/rpc-cache.txt
+++ b/Documentation/filesystems/rpc-cache.txt
diff --git a/Documentation/filesystems/seq_file.txt b/Documentation/filesystems/seq_file.txt
new file mode 100644
index 000000000000..7fb8e6dc62bf
--- /dev/null
+++ b/Documentation/filesystems/seq_file.txt
@@ -0,0 +1,283 @@
1The seq_file interface
2
3 Copyright 2003 Jonathan Corbet <corbet@lwn.net>
4 This file is originally from the LWN.net Driver Porting series at
5 http://lwn.net/Articles/driver-porting/
6
7
8There are numerous ways for a device driver (or other kernel component) to
9provide information to the user or system administrator. One useful
10technique is the creation of virtual files, in debugfs, /proc or elsewhere.
11Virtual files can provide human-readable output that is easy to get at
12without any special utility programs; they can also make life easier for
13script writers. It is not surprising that the use of virtual files has
14grown over the years.
15
16Creating those files correctly has always been a bit of a challenge,
17however. It is not that hard to make a virtual file which returns a
18string. But life gets trickier if the output is long - anything greater
19than an application is likely to read in a single operation. Handling
20multiple reads (and seeks) requires careful attention to the reader's
21position within the virtual file - that position is, likely as not, in the
22middle of a line of output. The kernel has traditionally had a number of
23implementations that got this wrong.
24
25The 2.6 kernel contains a set of functions (implemented by Alexander Viro)
26which are designed to make it easy for virtual file creators to get it
27right.
28
29The seq_file interface is available via <linux/seq_file.h>. There are
30three aspects to seq_file:
31
32 * An iterator interface which lets a virtual file implementation
33 step through the objects it is presenting.
34
35 * Some utility functions for formatting objects for output without
36 needing to worry about things like output buffers.
37
38 * A set of canned file_operations which implement most operations on
39 the virtual file.
40
41We'll look at the seq_file interface via an extremely simple example: a
42loadable module which creates a file called /proc/sequence. The file, when
43read, simply produces a set of increasing integer values, one per line. The
44sequence will continue until the user loses patience and finds something
45better to do. The file is seekable, in that one can do something like the
46following:
47
48 dd if=/proc/sequence of=out1 count=1
49 dd if=/proc/sequence skip=1 out=out2 count=1
50
51Then concatenate the output files out1 and out2 and get the right
52result. Yes, it is a thoroughly useless module, but the point is to show
53how the mechanism works without getting lost in other details. (Those
54wanting to see the full source for this module can find it at
55http://lwn.net/Articles/22359/).
56
57
58The iterator interface
59
60Modules implementing a virtual file with seq_file must implement a simple
61iterator object that allows stepping through the data of interest.
62Iterators must be able to move to a specific position - like the file they
63implement - but the interpretation of that position is up to the iterator
64itself. A seq_file implementation that is formatting firewall rules, for
65example, could interpret position N as the Nth rule in the chain.
66Positioning can thus be done in whatever way makes the most sense for the
67generator of the data, which need not be aware of how a position translates
68to an offset in the virtual file. The one obvious exception is that a
69position of zero should indicate the beginning of the file.
70
71The /proc/sequence iterator just uses the count of the next number it
72will output as its position.
73
74Four functions must be implemented to make the iterator work. The first,
75called start() takes a position as an argument and returns an iterator
76which will start reading at that position. For our simple sequence example,
77the start() function looks like:
78
79 static void *ct_seq_start(struct seq_file *s, loff_t *pos)
80 {
81 loff_t *spos = kmalloc(sizeof(loff_t), GFP_KERNEL);
82 if (! spos)
83 return NULL;
84 *spos = *pos;
85 return spos;
86 }
87
88The entire data structure for this iterator is a single loff_t value
89holding the current position. There is no upper bound for the sequence
90iterator, but that will not be the case for most other seq_file
91implementations; in most cases the start() function should check for a
92"past end of file" condition and return NULL if need be.
93
94For more complicated applications, the private field of the seq_file
95structure can be used. There is also a special value which can be returned
96by the start() function called SEQ_START_TOKEN; it can be used if you wish
97to instruct your show() function (described below) to print a header at the
98top of the output. SEQ_START_TOKEN should only be used if the offset is
99zero, however.
100
101The next function to implement is called, amazingly, next(); its job is to
102move the iterator forward to the next position in the sequence. The
103example module can simply increment the position by one; more useful
104modules will do what is needed to step through some data structure. The
105next() function returns a new iterator, or NULL if the sequence is
106complete. Here's the example version:
107
108 static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
109 {
110 loff_t *spos = v;
111 *pos = ++*spos;
112 return spos;
113 }
114
115The stop() function is called when iteration is complete; its job, of
116course, is to clean up. If dynamic memory is allocated for the iterator,
117stop() is the place to free it.
118
119 static void ct_seq_stop(struct seq_file *s, void *v)
120 {
121 kfree(v);
122 }
123
124Finally, the show() function should format the object currently pointed to
125by the iterator for output. It should return zero, or an error code if
126something goes wrong. The example module's show() function is:
127
128 static int ct_seq_show(struct seq_file *s, void *v)
129 {
130 loff_t *spos = v;
131 seq_printf(s, "%lld\n", (long long)*spos);
132 return 0;
133 }
134
135We will look at seq_printf() in a moment. But first, the definition of the
136seq_file iterator is finished by creating a seq_operations structure with
137the four functions we have just defined:
138
139 static const struct seq_operations ct_seq_ops = {
140 .start = ct_seq_start,
141 .next = ct_seq_next,
142 .stop = ct_seq_stop,
143 .show = ct_seq_show
144 };
145
146This structure will be needed to tie our iterator to the /proc file in
147a little bit.
148
149It's worth noting that the iterator value returned by start() and
150manipulated by the other functions is considered to be completely opaque by
151the seq_file code. It can thus be anything that is useful in stepping
152through the data to be output. Counters can be useful, but it could also be
153a direct pointer into an array or linked list. Anything goes, as long as
154the programmer is aware that things can happen between calls to the
155iterator function. However, the seq_file code (by design) will not sleep
156between the calls to start() and stop(), so holding a lock during that time
157is a reasonable thing to do. The seq_file code will also avoid taking any
158other locks while the iterator is active.
159
160
161Formatted output
162
163The seq_file code manages positioning within the output created by the
164iterator and getting it into the user's buffer. But, for that to work, that
165output must be passed to the seq_file code. Some utility functions have
166been defined which make this task easy.
167
168Most code will simply use seq_printf(), which works pretty much like
169printk(), but which requires the seq_file pointer as an argument. It is
170common to ignore the return value from seq_printf(), but a function
171producing complicated output may want to check that value and quit if
172something non-zero is returned; an error return means that the seq_file
173buffer has been filled and further output will be discarded.
174
175For straight character output, the following functions may be used:
176
177 int seq_putc(struct seq_file *m, char c);
178 int seq_puts(struct seq_file *m, const char *s);
179 int seq_escape(struct seq_file *m, const char *s, const char *esc);
180
181The first two output a single character and a string, just like one would
182expect. seq_escape() is like seq_puts(), except that any character in s
183which is in the string esc will be represented in octal form in the output.
184
185There is also a function for printing filenames:
186
187 int seq_path(struct seq_file *m, struct path *path, char *esc);
188
189Here, path indicates the file of interest, and esc is a set of characters
190which should be escaped in the output.
191
192
193Making it all work
194
195So far, we have a nice set of functions which can produce output within the
196seq_file system, but we have not yet turned them into a file that a user
197can see. Creating a file within the kernel requires, of course, the
198creation of a set of file_operations which implement the operations on that
199file. The seq_file interface provides a set of canned operations which do
200most of the work. The virtual file author still must implement the open()
201method, however, to hook everything up. The open function is often a single
202line, as in the example module:
203
204 static int ct_open(struct inode *inode, struct file *file)
205 {
206 return seq_open(file, &ct_seq_ops);
207 }
208
209Here, the call to seq_open() takes the seq_operations structure we created
210before, and gets set up to iterate through the virtual file.
211
212On a successful open, seq_open() stores the struct seq_file pointer in
213file->private_data. If you have an application where the same iterator can
214be used for more than one file, you can store an arbitrary pointer in the
215private field of the seq_file structure; that value can then be retrieved
216by the iterator functions.
217
218The other operations of interest - read(), llseek(), and release() - are
219all implemented by the seq_file code itself. So a virtual file's
220file_operations structure will look like:
221
222 static const struct file_operations ct_file_ops = {
223 .owner = THIS_MODULE,
224 .open = ct_open,
225 .read = seq_read,
226 .llseek = seq_lseek,
227 .release = seq_release
228 };
229
230There is also a seq_release_private() which passes the contents of the
231seq_file private field to kfree() before releasing the structure.
232
233The final step is the creation of the /proc file itself. In the example
234code, that is done in the initialization code in the usual way:
235
236 static int ct_init(void)
237 {
238 struct proc_dir_entry *entry;
239
240 entry = create_proc_entry("sequence", 0, NULL);
241 if (entry)
242 entry->proc_fops = &ct_file_ops;
243 return 0;
244 }
245
246 module_init(ct_init);
247
248And that is pretty much it.
249
250
251seq_list
252
253If your file will be iterating through a linked list, you may find these
254routines useful:
255
256 struct list_head *seq_list_start(struct list_head *head,
257 loff_t pos);
258 struct list_head *seq_list_start_head(struct list_head *head,
259 loff_t pos);
260 struct list_head *seq_list_next(void *v, struct list_head *head,
261 loff_t *ppos);
262
263These helpers will interpret pos as a position within the list and iterate
264accordingly. Your start() and next() functions need only invoke the
265seq_list_* helpers with a pointer to the appropriate list_head structure.
266
267
268The extra-simple version
269
270For extremely simple virtual files, there is an even easier interface. A
271module can define only the show() function, which should create all the
272output that the virtual file will contain. The file's open() method then
273calls:
274
275 int single_open(struct file *file,
276 int (*show)(struct seq_file *m, void *p),
277 void *data);
278
279When output time comes, the show() function will be called once. The data
280value given to single_open() can be found in the private field of the
281seq_file structure. When using single_open(), the programmer should use
282single_release() instead of seq_release() in the file_operations structure
283to avoid a memory leak.
diff --git a/Documentation/hrtimers/highres.txt b/Documentation/hrtimers/highres.txt
index ce0e9a91e157..a73ecf5b4bdb 100644
--- a/Documentation/hrtimers/highres.txt
+++ b/Documentation/hrtimers/highres.txt
@@ -98,7 +98,7 @@ System-level global event devices are used for the Linux periodic tick. Per-CPU
98event devices are used to provide local CPU functionality such as process 98event devices are used to provide local CPU functionality such as process
99accounting, profiling, and high resolution timers. 99accounting, profiling, and high resolution timers.
100 100
101The management layer assignes one or more of the folliwing functions to a clock 101The management layer assigns one or more of the following functions to a clock
102event device: 102event device:
103 - system global periodic tick (jiffies update) 103 - system global periodic tick (jiffies update)
104 - cpu local update_process_times 104 - cpu local update_process_times
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 32e9297ef747..5389acf9e075 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -844,7 +844,7 @@ and is between 256 and 4096 characters. It is defined in the file
844 arch/alpha/kernel/core_marvel.c. 844 arch/alpha/kernel/core_marvel.c.
845 845
846 ip= [IP_PNP] 846 ip= [IP_PNP]
847 See Documentation/nfsroot.txt. 847 See Documentation/filesystems/nfsroot.txt.
848 848
849 ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards 849 ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards
850 See comment before ip2_setup() in 850 See comment before ip2_setup() in
@@ -1198,10 +1198,10 @@ and is between 256 and 4096 characters. It is defined in the file
1198 file if at all. 1198 file if at all.
1199 1199
1200 nfsaddrs= [NFS] 1200 nfsaddrs= [NFS]
1201 See Documentation/nfsroot.txt. 1201 See Documentation/filesystems/nfsroot.txt.
1202 1202
1203 nfsroot= [NFS] nfs root filesystem for disk-less boxes. 1203 nfsroot= [NFS] nfs root filesystem for disk-less boxes.
1204 See Documentation/nfsroot.txt. 1204 See Documentation/filesystems/nfsroot.txt.
1205 1205
1206 nfs.callback_tcpport= 1206 nfs.callback_tcpport=
1207 [NFS] set the TCP port on which the NFSv4 callback 1207 [NFS] set the TCP port on which the NFSv4 callback
@@ -1339,6 +1339,10 @@ and is between 256 and 4096 characters. It is defined in the file
1339 1339
1340 nowb [ARM] 1340 nowb [ARM]
1341 1341
1342 nptcg= [IA64] Override max number of concurrent global TLB
1343 purges which is reported from either PAL_VM_SUMMARY or
1344 SAL PALO.
1345
1342 numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA. 1346 numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA.
1343 one of ['zone', 'node', 'default'] can be specified 1347 one of ['zone', 'node', 'default'] can be specified
1344 This can be set from sysctl after boot. 1348 This can be set from sysctl after boot.
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt
index f1b2de170929..641d2afacffa 100644
--- a/Documentation/networking/can.txt
+++ b/Documentation/networking/can.txt
@@ -281,10 +281,10 @@ solution for a couple of reasons:
281 sa_family_t can_family; 281 sa_family_t can_family;
282 int can_ifindex; 282 int can_ifindex;
283 union { 283 union {
284 struct { canid_t rx_id, tx_id; } tp16; 284 /* transport protocol class address info (e.g. ISOTP) */
285 struct { canid_t rx_id, tx_id; } tp20; 285 struct { canid_t rx_id, tx_id; } tp;
286 struct { canid_t rx_id, tx_id; } mcnet; 286
287 struct { canid_t rx_id, tx_id; } isotp; 287 /* reserved for future CAN protocols address information */
288 } can_addr; 288 } can_addr;
289 }; 289 };
290 290
diff --git a/Documentation/scheduler/00-INDEX b/Documentation/scheduler/00-INDEX
index b5f5ca069b2d..fc234d093fbf 100644
--- a/Documentation/scheduler/00-INDEX
+++ b/Documentation/scheduler/00-INDEX
@@ -12,5 +12,7 @@ sched-domains.txt
12 - information on scheduling domains. 12 - information on scheduling domains.
13sched-nice-design.txt 13sched-nice-design.txt
14 - How and why the scheduler's nice levels are implemented. 14 - How and why the scheduler's nice levels are implemented.
15sched-rt-group.txt
16 - real-time group scheduling.
15sched-stats.txt 17sched-stats.txt
16 - information on schedstats (Linux Scheduler Statistics). 18 - information on schedstats (Linux Scheduler Statistics).
diff --git a/Documentation/sched-rt-group.txt b/Documentation/scheduler/sched-rt-group.txt
index 1c6332f4543c..1c6332f4543c 100644
--- a/Documentation/sched-rt-group.txt
+++ b/Documentation/scheduler/sched-rt-group.txt
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index 8861e47e5a2d..6d5f18143c50 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -116,6 +116,13 @@ low order bit. So when a chip's timing diagram shows the clock
116starting low (CPOL=0) and data stabilized for sampling during the 116starting low (CPOL=0) and data stabilized for sampling during the
117trailing clock edge (CPHA=1), that's SPI mode 1. 117trailing clock edge (CPHA=1), that's SPI mode 1.
118 118
119Note that the clock mode is relevant as soon as the chipselect goes
120active. So the master must set the clock to inactive before selecting
121a slave, and the slave can tell the chosen polarity by sampling the
122clock level when its select line goes active. That's why many devices
123support for example both modes 0 and 3: they don't care about polarity,
124and alway clock data in/out on rising clock edges.
125
119 126
120How do these driver programming interfaces work? 127How do these driver programming interfaces work?
121------------------------------------------------ 128------------------------------------------------
@@ -379,8 +386,14 @@ any more such messages.
379 + when bidirectional reads and writes start ... by how its 386 + when bidirectional reads and writes start ... by how its
380 sequence of spi_transfer requests is arranged; 387 sequence of spi_transfer requests is arranged;
381 388
389 + which I/O buffers are used ... each spi_transfer wraps a
390 buffer for each transfer direction, supporting full duplex
391 (two pointers, maybe the same one in both cases) and half
392 duplex (one pointer is NULL) transfers;
393
382 + optionally defining short delays after transfers ... using 394 + optionally defining short delays after transfers ... using
383 the spi_transfer.delay_usecs setting; 395 the spi_transfer.delay_usecs setting (this delay can be the
396 only protocol effect, if the buffer length is zero);
384 397
385 + whether the chipselect becomes inactive after a transfer and 398 + whether the chipselect becomes inactive after a transfer and
386 any delay ... by using the spi_transfer.cs_change flag; 399 any delay ... by using the spi_transfer.cs_change flag;
diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt
index 471e75389778..619699dde593 100644
--- a/Documentation/spinlocks.txt
+++ b/Documentation/spinlocks.txt
@@ -5,6 +5,28 @@ Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or
5__SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static 5__SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static
6initialization. 6initialization.
7 7
8Most of the time, you can simply turn:
9
10 static spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED;
11
12into:
13
14 static DEFINE_SPINLOCK(xxx_lock);
15
16Static structure member variables go from:
17
18 struct foo bar {
19 .lock = SPIN_LOCK_UNLOCKED;
20 };
21
22to:
23
24 struct foo bar {
25 .lock = __SPIN_LOCK_UNLOCKED(bar.lock);
26 };
27
28Declaration of static rw_locks undergo a similar transformation.
29
8Dynamic initialization, when necessary, may be performed as 30Dynamic initialization, when necessary, may be performed as
9demonstrated below. 31demonstrated below.
10 32
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index f962d01bea2a..3102b81bef88 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -88,10 +88,9 @@ hugepages from the buddy allocator, if the normal pool is exhausted. As
88these surplus hugepages go out of use, they are freed back to the buddy 88these surplus hugepages go out of use, they are freed back to the buddy
89allocator. 89allocator.
90 90
91Caveat: Shrinking the pool via nr_hugepages while a surplus is in effect 91Caveat: Shrinking the pool via nr_hugepages such that it becomes less
92will allow the number of surplus huge pages to exceed the overcommit 92than the number of hugepages in use will convert the balance to surplus
93value, as the pool hugepages (which must have been in use for a surplus 93huge pages even if it would exceed the overcommit value. As long as
94hugepages to be allocated) will become surplus hugepages. As long as
95this condition holds, however, no more surplus huge pages will be 94this condition holds, however, no more surplus huge pages will be
96allowed on the system until one of the two sysctls are increased 95allowed on the system until one of the two sysctls are increased
97sufficiently, or the surplus huge pages go out of use and are freed. 96sufficiently, or the surplus huge pages go out of use and are freed.
diff --git a/MAINTAINERS b/MAINTAINERS
index 90dcbbcad91c..e46775868019 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2116,7 +2116,7 @@ M: reinette.chatre@intel.com
2116L: linux-wireless@vger.kernel.org 2116L: linux-wireless@vger.kernel.org
2117L: ipw3945-devel@lists.sourceforge.net 2117L: ipw3945-devel@lists.sourceforge.net
2118W: http://intellinuxwireless.org 2118W: http://intellinuxwireless.org
2119T: git git://git.kernel.org/pub/scm/linux/kernel/git/rchatre/iwlwifi-2.6.git 2119T: git kernel.org:/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6.git
2120S: Supported 2120S: Supported
2121 2121
2122IOC3 ETHERNET DRIVER 2122IOC3 ETHERNET DRIVER
@@ -2197,7 +2197,7 @@ S: Maintained
2197ISDN SUBSYSTEM 2197ISDN SUBSYSTEM
2198P: Karsten Keil 2198P: Karsten Keil
2199M: kkeil@suse.de 2199M: kkeil@suse.de
2200L: isdn4linux@listserv.isdn4linux.de 2200L: isdn4linux@listserv.isdn4linux.de (subscribers-only)
2201W: http://www.isdn4linux.de 2201W: http://www.isdn4linux.de
2202T: git kernel.org:/pub/scm/linux/kernel/kkeil/isdn-2.6.git 2202T: git kernel.org:/pub/scm/linux/kernel/kkeil/isdn-2.6.git
2203S: Maintained 2203S: Maintained
@@ -2205,7 +2205,7 @@ S: Maintained
2205ISDN SUBSYSTEM (Eicon active card driver) 2205ISDN SUBSYSTEM (Eicon active card driver)
2206P: Armin Schindler 2206P: Armin Schindler
2207M: mac@melware.de 2207M: mac@melware.de
2208L: isdn4linux@listserv.isdn4linux.de 2208L: isdn4linux@listserv.isdn4linux.de (subscribers-only)
2209W: http://www.melware.de 2209W: http://www.melware.de
2210S: Maintained 2210S: Maintained
2211 2211
@@ -3280,6 +3280,7 @@ L: linux-wireless@vger.kernel.org
3280L: rt2400-devel@lists.sourceforge.net 3280L: rt2400-devel@lists.sourceforge.net
3281W: http://rt2x00.serialmonkey.com/ 3281W: http://rt2x00.serialmonkey.com/
3282S: Maintained 3282S: Maintained
3283T: git kernel.org:/pub/scm/linux/kernel/git/ivd/rt2x00.git
3283F: drivers/net/wireless/rt2x00/ 3284F: drivers/net/wireless/rt2x00/
3284 3285
3285RAMDISK RAM BLOCK DEVICE DRIVER 3286RAMDISK RAM BLOCK DEVICE DRIVER
@@ -3342,6 +3343,13 @@ L: reiserfs-devel@vger.kernel.org
3342W: http://www.namesys.com 3343W: http://www.namesys.com
3343S: Supported 3344S: Supported
3344 3345
3346RFKILL
3347P: Ivo van Doorn
3348M: IvDoorn@gmail.com
3349L: netdev@vger.kernel.org
3350S: Maintained
3351F: net/rfkill
3352
3345ROCKETPORT DRIVER 3353ROCKETPORT DRIVER
3346P: Comtrol Corp. 3354P: Comtrol Corp.
3347W: http://www.comtrol.com 3355W: http://www.comtrol.com
diff --git a/Makefile b/Makefile
index fec2a12710eb..39516bfad958 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 25 3SUBLEVEL = 25
4EXTRAVERSION = -rc8 4EXTRAVERSION =
5NAME = Funky Weasel is Jiggy wit it 5NAME = Funky Weasel is Jiggy wit it
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index c75d7089f982..28e0caf4156c 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -10,7 +10,6 @@ config AVR32
10 # With EMBEDDED=n, we get lots of stuff automatically selected 10 # With EMBEDDED=n, we get lots of stuff automatically selected
11 # that we usually don't need on AVR32. 11 # that we usually don't need on AVR32.
12 select EMBEDDED 12 select EMBEDDED
13 select HAVE_IDE
14 select HAVE_OPROFILE 13 select HAVE_OPROFILE
15 select HAVE_KPROBES 14 select HAVE_KPROBES
16 help 15 help
diff --git a/arch/frv/kernel/entry-table.S b/arch/frv/kernel/entry-table.S
index d3b9253d862a..bf35f33e48c9 100644
--- a/arch/frv/kernel/entry-table.S
+++ b/arch/frv/kernel/entry-table.S
@@ -316,8 +316,14 @@ __trap_fixup_kernel_data_tlb_miss:
316 .section .trap.vector 316 .section .trap.vector
317 .org TBR_TT_TRAP0 >> 2 317 .org TBR_TT_TRAP0 >> 2
318 .long system_call 318 .long system_call
319 .rept 126 319 .rept 119
320 .long __entry_unsupported_trap 320 .long __entry_unsupported_trap
321 .endr 321 .endr
322
323 # userspace atomic op emulation, traps 120-126
324 .rept 7
325 .long __entry_atomic_op
326 .endr
327
322 .org TBR_TT_BREAK >> 2 328 .org TBR_TT_BREAK >> 2
323 .long __entry_debug_exception 329 .long __entry_debug_exception
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index f36d7f4a7c25..b8a4b94779b1 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -656,6 +656,26 @@ __entry_debug_exception:
656 656
657############################################################################### 657###############################################################################
658# 658#
659# handle atomic operation emulation for userspace
660#
661###############################################################################
662 .globl __entry_atomic_op
663__entry_atomic_op:
664 LEDS 0x6012
665 sethi.p %hi(atomic_operation),gr5
666 setlo %lo(atomic_operation),gr5
667 movsg esfr1,gr8
668 movsg epcr0,gr9
669 movsg esr0,gr10
670
671 # now that we've accessed the exception regs, we can enable exceptions
672 movsg psr,gr4
673 ori gr4,#PSR_ET,gr4
674 movgs gr4,psr
675 jmpl @(gr5,gr0) ; call atomic_operation(esfr1,epcr0,esr0)
676
677###############################################################################
678#
659# handle media exception 679# handle media exception
660# 680#
661############################################################################### 681###############################################################################
diff --git a/arch/frv/kernel/head.inc b/arch/frv/kernel/head.inc
index d424cd2eb213..bff66628b99a 100644
--- a/arch/frv/kernel/head.inc
+++ b/arch/frv/kernel/head.inc
@@ -46,5 +46,5 @@
46#ifdef CONFIG_MMU 46#ifdef CONFIG_MMU
47__sdram_base = 0x00000000 /* base address to which SDRAM relocated */ 47__sdram_base = 0x00000000 /* base address to which SDRAM relocated */
48#else 48#else
49__sdram_base = 0xc0000000 /* base address to which SDRAM relocated */ 49__sdram_base = __page_offset /* base address to which SDRAM relocated */
50#endif 50#endif
diff --git a/arch/frv/kernel/switch_to.S b/arch/frv/kernel/switch_to.S
index b5275fa9cd0d..b06668670fcc 100644
--- a/arch/frv/kernel/switch_to.S
+++ b/arch/frv/kernel/switch_to.S
@@ -102,13 +102,6 @@ __switch_to:
102 movgs gr14,lr 102 movgs gr14,lr
103 bar 103 bar
104 104
105 srli gr15,#28,gr5
106 subicc gr5,#0xc,gr0,icc0
107 beq icc0,#0,111f
108 break
109 nop
110111:
111
112 # jump to __switch_back or ret_from_fork as appropriate 105 # jump to __switch_back or ret_from_fork as appropriate
113 # - move prev to GR8 106 # - move prev to GR8
114 movgs gr4,psr 107 movgs gr4,psr
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 2e6098c85578..7089c2428b3f 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -73,7 +73,7 @@ asmlinkage void illegal_instruction(unsigned long esfr1, unsigned long epcr0, un
73 epcr0, esr0, esfr1); 73 epcr0, esr0, esfr1);
74 74
75 info.si_errno = 0; 75 info.si_errno = 0;
76 info.si_addr = (void *) ((epcr0 & EPCR0_PC) ? (epcr0 & EPCR0_PC) : __frame->pc); 76 info.si_addr = (void *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc);
77 77
78 switch (__frame->tbr & TBR_TT) { 78 switch (__frame->tbr & TBR_TT) {
79 case TBR_TT_ILLEGAL_INSTR: 79 case TBR_TT_ILLEGAL_INSTR:
@@ -102,6 +102,233 @@ asmlinkage void illegal_instruction(unsigned long esfr1, unsigned long epcr0, un
102 102
103/*****************************************************************************/ 103/*****************************************************************************/
104/* 104/*
105 * handle atomic operations with errors
106 * - arguments in gr8, gr9, gr10
107 * - original memory value placed in gr5
108 * - replacement memory value placed in gr9
109 */
110asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0,
111 unsigned long esr0)
112{
113 static DEFINE_SPINLOCK(atomic_op_lock);
114 unsigned long x, y, z, *p;
115 mm_segment_t oldfs;
116 siginfo_t info;
117 int ret;
118
119 y = 0;
120 z = 0;
121
122 oldfs = get_fs();
123 if (!user_mode(__frame))
124 set_fs(KERNEL_DS);
125
126 switch (__frame->tbr & TBR_TT) {
127 /* TIRA gr0,#120
128 * u32 __atomic_user_cmpxchg32(u32 *ptr, u32 test, u32 new)
129 */
130 case TBR_TT_ATOMIC_CMPXCHG32:
131 p = (unsigned long *) __frame->gr8;
132 x = __frame->gr9;
133 y = __frame->gr10;
134
135 for (;;) {
136 ret = get_user(z, p);
137 if (ret < 0)
138 goto error;
139
140 if (z != x)
141 goto done;
142
143 spin_lock_irq(&atomic_op_lock);
144
145 if (__get_user(z, p) == 0) {
146 if (z != x)
147 goto done2;
148
149 if (__put_user(y, p) == 0)
150 goto done2;
151 goto error2;
152 }
153
154 spin_unlock_irq(&atomic_op_lock);
155 }
156
157 /* TIRA gr0,#121
158 * u32 __atomic_kernel_xchg32(void *v, u32 new)
159 */
160 case TBR_TT_ATOMIC_XCHG32:
161 p = (unsigned long *) __frame->gr8;
162 y = __frame->gr9;
163
164 for (;;) {
165 ret = get_user(z, p);
166 if (ret < 0)
167 goto error;
168
169 spin_lock_irq(&atomic_op_lock);
170
171 if (__get_user(z, p) == 0) {
172 if (__put_user(y, p) == 0)
173 goto done2;
174 goto error2;
175 }
176
177 spin_unlock_irq(&atomic_op_lock);
178 }
179
180 /* TIRA gr0,#122
181 * ulong __atomic_kernel_XOR_return(ulong i, ulong *v)
182 */
183 case TBR_TT_ATOMIC_XOR:
184 p = (unsigned long *) __frame->gr8;
185 x = __frame->gr9;
186
187 for (;;) {
188 ret = get_user(z, p);
189 if (ret < 0)
190 goto error;
191
192 spin_lock_irq(&atomic_op_lock);
193
194 if (__get_user(z, p) == 0) {
195 y = x ^ z;
196 if (__put_user(y, p) == 0)
197 goto done2;
198 goto error2;
199 }
200
201 spin_unlock_irq(&atomic_op_lock);
202 }
203
204 /* TIRA gr0,#123
205 * ulong __atomic_kernel_OR_return(ulong i, ulong *v)
206 */
207 case TBR_TT_ATOMIC_OR:
208 p = (unsigned long *) __frame->gr8;
209 x = __frame->gr9;
210
211 for (;;) {
212 ret = get_user(z, p);
213 if (ret < 0)
214 goto error;
215
216 spin_lock_irq(&atomic_op_lock);
217
218 if (__get_user(z, p) == 0) {
219 y = x ^ z;
220 if (__put_user(y, p) == 0)
221 goto done2;
222 goto error2;
223 }
224
225 spin_unlock_irq(&atomic_op_lock);
226 }
227
228 /* TIRA gr0,#124
229 * ulong __atomic_kernel_AND_return(ulong i, ulong *v)
230 */
231 case TBR_TT_ATOMIC_AND:
232 p = (unsigned long *) __frame->gr8;
233 x = __frame->gr9;
234
235 for (;;) {
236 ret = get_user(z, p);
237 if (ret < 0)
238 goto error;
239
240 spin_lock_irq(&atomic_op_lock);
241
242 if (__get_user(z, p) == 0) {
243 y = x & z;
244 if (__put_user(y, p) == 0)
245 goto done2;
246 goto error2;
247 }
248
249 spin_unlock_irq(&atomic_op_lock);
250 }
251
252 /* TIRA gr0,#125
253 * int __atomic_user_sub_return(atomic_t *v, int i)
254 */
255 case TBR_TT_ATOMIC_SUB:
256 p = (unsigned long *) __frame->gr8;
257 x = __frame->gr9;
258
259 for (;;) {
260 ret = get_user(z, p);
261 if (ret < 0)
262 goto error;
263
264 spin_lock_irq(&atomic_op_lock);
265
266 if (__get_user(z, p) == 0) {
267 y = z - x;
268 if (__put_user(y, p) == 0)
269 goto done2;
270 goto error2;
271 }
272
273 spin_unlock_irq(&atomic_op_lock);
274 }
275
276 /* TIRA gr0,#126
277 * int __atomic_user_add_return(atomic_t *v, int i)
278 */
279 case TBR_TT_ATOMIC_ADD:
280 p = (unsigned long *) __frame->gr8;
281 x = __frame->gr9;
282
283 for (;;) {
284 ret = get_user(z, p);
285 if (ret < 0)
286 goto error;
287
288 spin_lock_irq(&atomic_op_lock);
289
290 if (__get_user(z, p) == 0) {
291 y = z + x;
292 if (__put_user(y, p) == 0)
293 goto done2;
294 goto error2;
295 }
296
297 spin_unlock_irq(&atomic_op_lock);
298 }
299
300 default:
301 BUG();
302 }
303
304done2:
305 spin_unlock_irq(&atomic_op_lock);
306done:
307 if (!user_mode(__frame))
308 set_fs(oldfs);
309 __frame->gr5 = z;
310 __frame->gr9 = y;
311 return;
312
313error2:
314 spin_unlock_irq(&atomic_op_lock);
315error:
316 if (!user_mode(__frame))
317 set_fs(oldfs);
318 __frame->pc -= 4;
319
320 die_if_kernel("-- Atomic Op Error --\n");
321
322 info.si_signo = SIGSEGV;
323 info.si_code = SEGV_ACCERR;
324 info.si_errno = 0;
325 info.si_addr = (void *) __frame->pc;
326
327 force_sig_info(info.si_signo, &info, current);
328}
329
330/*****************************************************************************/
331/*
105 * 332 *
106 */ 333 */
107asmlinkage void media_exception(unsigned long msr0, unsigned long msr1) 334asmlinkage void media_exception(unsigned long msr0, unsigned long msr1)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 1b73ffe746d9..ed21737a00c5 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -283,6 +283,17 @@ config FORCE_MAX_ZONEORDER
283 default "17" if HUGETLB_PAGE 283 default "17" if HUGETLB_PAGE
284 default "11" 284 default "11"
285 285
286config VIRT_CPU_ACCOUNTING
287 bool "Deterministic task and CPU time accounting"
288 default n
289 help
290 Select this option to enable more accurate task and CPU time
291 accounting. This is done by reading a CPU counter on each
292 kernel entry and exit and on transitions within the kernel
293 between system, softirq and hardirq state, so there is a
294 small performance impact.
295 If in doubt, say N here.
296
286config SMP 297config SMP
287 bool "Symmetric multi-processing support" 298 bool "Symmetric multi-processing support"
288 help 299 help
diff --git a/arch/ia64/ia32/elfcore32.h b/arch/ia64/ia32/elfcore32.h
index 446c9aac924d..9a3abf58cea3 100644
--- a/arch/ia64/ia32/elfcore32.h
+++ b/arch/ia64/ia32/elfcore32.h
@@ -30,7 +30,19 @@ struct elf_siginfo
30 int si_errno; /* errno */ 30 int si_errno; /* errno */
31}; 31};
32 32
33#define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0) 33#ifdef CONFIG_VIRT_CPU_ACCOUNTING
34/*
35 * Hacks are here since types between compat_timeval (= pair of s32) and
36 * ia64-native timeval (= pair of s64) are not compatible, at least a file
37 * arch/ia64/ia32/../../../fs/binfmt_elf.c will get warnings from compiler on
38 * use of cputime_to_timeval(), which usually an alias of jiffies_to_timeval().
39 */
40#define cputime_to_timeval(a,b) \
41 do { (b)->tv_usec = 0; (b)->tv_sec = (a)/NSEC_PER_SEC; } while(0)
42#else
43#define jiffies_to_timeval(a,b) \
44 do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; } while(0)
45#endif
34 46
35struct elf_prstatus 47struct elf_prstatus
36{ 48{
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index b1bf51fe97b4..7e028ceb93ba 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -38,6 +38,7 @@
38#include <linux/eventpoll.h> 38#include <linux/eventpoll.h>
39#include <linux/personality.h> 39#include <linux/personality.h>
40#include <linux/ptrace.h> 40#include <linux/ptrace.h>
41#include <linux/regset.h>
41#include <linux/stat.h> 42#include <linux/stat.h>
42#include <linux/ipc.h> 43#include <linux/ipc.h>
43#include <linux/capability.h> 44#include <linux/capability.h>
@@ -2387,16 +2388,45 @@ get_free_idx (void)
2387 return -ESRCH; 2388 return -ESRCH;
2388} 2389}
2389 2390
2391static void set_tls_desc(struct task_struct *p, int idx,
2392 const struct ia32_user_desc *info, int n)
2393{
2394 struct thread_struct *t = &p->thread;
2395 struct desc_struct *desc = &t->tls_array[idx - GDT_ENTRY_TLS_MIN];
2396 int cpu;
2397
2398 /*
2399 * We must not get preempted while modifying the TLS.
2400 */
2401 cpu = get_cpu();
2402
2403 while (n-- > 0) {
2404 if (LDT_empty(info)) {
2405 desc->a = 0;
2406 desc->b = 0;
2407 } else {
2408 desc->a = LDT_entry_a(info);
2409 desc->b = LDT_entry_b(info);
2410 }
2411
2412 ++info;
2413 ++desc;
2414 }
2415
2416 if (t == &current->thread)
2417 load_TLS(t, cpu);
2418
2419 put_cpu();
2420}
2421
2390/* 2422/*
2391 * Set a given TLS descriptor: 2423 * Set a given TLS descriptor:
2392 */ 2424 */
2393asmlinkage int 2425asmlinkage int
2394sys32_set_thread_area (struct ia32_user_desc __user *u_info) 2426sys32_set_thread_area (struct ia32_user_desc __user *u_info)
2395{ 2427{
2396 struct thread_struct *t = &current->thread;
2397 struct ia32_user_desc info; 2428 struct ia32_user_desc info;
2398 struct desc_struct *desc; 2429 int idx;
2399 int cpu, idx;
2400 2430
2401 if (copy_from_user(&info, u_info, sizeof(info))) 2431 if (copy_from_user(&info, u_info, sizeof(info)))
2402 return -EFAULT; 2432 return -EFAULT;
@@ -2416,18 +2446,7 @@ sys32_set_thread_area (struct ia32_user_desc __user *u_info)
2416 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) 2446 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
2417 return -EINVAL; 2447 return -EINVAL;
2418 2448
2419 desc = t->tls_array + idx - GDT_ENTRY_TLS_MIN; 2449 set_tls_desc(current, idx, &info, 1);
2420
2421 cpu = smp_processor_id();
2422
2423 if (LDT_empty(&info)) {
2424 desc->a = 0;
2425 desc->b = 0;
2426 } else {
2427 desc->a = LDT_entry_a(&info);
2428 desc->b = LDT_entry_b(&info);
2429 }
2430 load_TLS(t, cpu);
2431 return 0; 2450 return 0;
2432} 2451}
2433 2452
@@ -2451,6 +2470,20 @@ sys32_set_thread_area (struct ia32_user_desc __user *u_info)
2451#define GET_PRESENT(desc) (((desc)->b >> 15) & 1) 2470#define GET_PRESENT(desc) (((desc)->b >> 15) & 1)
2452#define GET_USEABLE(desc) (((desc)->b >> 20) & 1) 2471#define GET_USEABLE(desc) (((desc)->b >> 20) & 1)
2453 2472
2473static void fill_user_desc(struct ia32_user_desc *info, int idx,
2474 const struct desc_struct *desc)
2475{
2476 info->entry_number = idx;
2477 info->base_addr = GET_BASE(desc);
2478 info->limit = GET_LIMIT(desc);
2479 info->seg_32bit = GET_32BIT(desc);
2480 info->contents = GET_CONTENTS(desc);
2481 info->read_exec_only = !GET_WRITABLE(desc);
2482 info->limit_in_pages = GET_LIMIT_PAGES(desc);
2483 info->seg_not_present = !GET_PRESENT(desc);
2484 info->useable = GET_USEABLE(desc);
2485}
2486
2454asmlinkage int 2487asmlinkage int
2455sys32_get_thread_area (struct ia32_user_desc __user *u_info) 2488sys32_get_thread_area (struct ia32_user_desc __user *u_info)
2456{ 2489{
@@ -2464,22 +2497,588 @@ sys32_get_thread_area (struct ia32_user_desc __user *u_info)
2464 return -EINVAL; 2497 return -EINVAL;
2465 2498
2466 desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN; 2499 desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
2467 2500 fill_user_desc(&info, idx, desc);
2468 info.entry_number = idx;
2469 info.base_addr = GET_BASE(desc);
2470 info.limit = GET_LIMIT(desc);
2471 info.seg_32bit = GET_32BIT(desc);
2472 info.contents = GET_CONTENTS(desc);
2473 info.read_exec_only = !GET_WRITABLE(desc);
2474 info.limit_in_pages = GET_LIMIT_PAGES(desc);
2475 info.seg_not_present = !GET_PRESENT(desc);
2476 info.useable = GET_USEABLE(desc);
2477 2501
2478 if (copy_to_user(u_info, &info, sizeof(info))) 2502 if (copy_to_user(u_info, &info, sizeof(info)))
2479 return -EFAULT; 2503 return -EFAULT;
2480 return 0; 2504 return 0;
2481} 2505}
2482 2506
2507struct regset_get {
2508 void *kbuf;
2509 void __user *ubuf;
2510};
2511
2512struct regset_set {
2513 const void *kbuf;
2514 const void __user *ubuf;
2515};
2516
2517struct regset_getset {
2518 struct task_struct *target;
2519 const struct user_regset *regset;
2520 union {
2521 struct regset_get get;
2522 struct regset_set set;
2523 } u;
2524 unsigned int pos;
2525 unsigned int count;
2526 int ret;
2527};
2528
2529static void getfpreg(struct task_struct *task, int regno, int *val)
2530{
2531 switch (regno / sizeof(int)) {
2532 case 0:
2533 *val = task->thread.fcr & 0xffff;
2534 break;
2535 case 1:
2536 *val = task->thread.fsr & 0xffff;
2537 break;
2538 case 2:
2539 *val = (task->thread.fsr>>16) & 0xffff;
2540 break;
2541 case 3:
2542 *val = task->thread.fir;
2543 break;
2544 case 4:
2545 *val = (task->thread.fir>>32) & 0xffff;
2546 break;
2547 case 5:
2548 *val = task->thread.fdr;
2549 break;
2550 case 6:
2551 *val = (task->thread.fdr >> 32) & 0xffff;
2552 break;
2553 }
2554}
2555
2556static void setfpreg(struct task_struct *task, int regno, int val)
2557{
2558 switch (regno / sizeof(int)) {
2559 case 0:
2560 task->thread.fcr = (task->thread.fcr & (~0x1f3f))
2561 | (val & 0x1f3f);
2562 break;
2563 case 1:
2564 task->thread.fsr = (task->thread.fsr & (~0xffff)) | val;
2565 break;
2566 case 2:
2567 task->thread.fsr = (task->thread.fsr & (~0xffff0000))
2568 | (val << 16);
2569 break;
2570 case 3:
2571 task->thread.fir = (task->thread.fir & (~0xffffffff)) | val;
2572 break;
2573 case 5:
2574 task->thread.fdr = (task->thread.fdr & (~0xffffffff)) | val;
2575 break;
2576 }
2577}
2578
2579static void access_fpreg_ia32(int regno, void *reg,
2580 struct pt_regs *pt, struct switch_stack *sw,
2581 int tos, int write)
2582{
2583 void *f;
2584
2585 if ((regno += tos) >= 8)
2586 regno -= 8;
2587 if (regno < 4)
2588 f = &pt->f8 + regno;
2589 else if (regno <= 7)
2590 f = &sw->f12 + (regno - 4);
2591 else {
2592 printk(KERN_ERR "regno must be less than 7 \n");
2593 return;
2594 }
2595
2596 if (write)
2597 memcpy(f, reg, sizeof(struct _fpreg_ia32));
2598 else
2599 memcpy(reg, f, sizeof(struct _fpreg_ia32));
2600}
2601
2602static void do_fpregs_get(struct unw_frame_info *info, void *arg)
2603{
2604 struct regset_getset *dst = arg;
2605 struct task_struct *task = dst->target;
2606 struct pt_regs *pt;
2607 int start, end, tos;
2608 char buf[80];
2609
2610 if (dst->count == 0 || unw_unwind_to_user(info) < 0)
2611 return;
2612 if (dst->pos < 7 * sizeof(int)) {
2613 end = min((dst->pos + dst->count),
2614 (unsigned int)(7 * sizeof(int)));
2615 for (start = dst->pos; start < end; start += sizeof(int))
2616 getfpreg(task, start, (int *)(buf + start));
2617 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
2618 &dst->u.get.kbuf, &dst->u.get.ubuf, buf,
2619 0, 7 * sizeof(int));
2620 if (dst->ret || dst->count == 0)
2621 return;
2622 }
2623 if (dst->pos < sizeof(struct ia32_user_i387_struct)) {
2624 pt = task_pt_regs(task);
2625 tos = (task->thread.fsr >> 11) & 7;
2626 end = min(dst->pos + dst->count,
2627 (unsigned int)(sizeof(struct ia32_user_i387_struct)));
2628 start = (dst->pos - 7 * sizeof(int)) /
2629 sizeof(struct _fpreg_ia32);
2630 end = (end - 7 * sizeof(int)) / sizeof(struct _fpreg_ia32);
2631 for (; start < end; start++)
2632 access_fpreg_ia32(start,
2633 (struct _fpreg_ia32 *)buf + start,
2634 pt, info->sw, tos, 0);
2635 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
2636 &dst->u.get.kbuf, &dst->u.get.ubuf,
2637 buf, 7 * sizeof(int),
2638 sizeof(struct ia32_user_i387_struct));
2639 if (dst->ret || dst->count == 0)
2640 return;
2641 }
2642}
2643
2644static void do_fpregs_set(struct unw_frame_info *info, void *arg)
2645{
2646 struct regset_getset *dst = arg;
2647 struct task_struct *task = dst->target;
2648 struct pt_regs *pt;
2649 char buf[80];
2650 int end, start, tos;
2651
2652 if (dst->count == 0 || unw_unwind_to_user(info) < 0)
2653 return;
2654
2655 if (dst->pos < 7 * sizeof(int)) {
2656 start = dst->pos;
2657 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
2658 &dst->u.set.kbuf, &dst->u.set.ubuf, buf,
2659 0, 7 * sizeof(int));
2660 if (dst->ret)
2661 return;
2662 for (; start < dst->pos; start += sizeof(int))
2663 setfpreg(task, start, *((int *)(buf + start)));
2664 if (dst->count == 0)
2665 return;
2666 }
2667 if (dst->pos < sizeof(struct ia32_user_i387_struct)) {
2668 start = (dst->pos - 7 * sizeof(int)) /
2669 sizeof(struct _fpreg_ia32);
2670 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
2671 &dst->u.set.kbuf, &dst->u.set.ubuf,
2672 buf, 7 * sizeof(int),
2673 sizeof(struct ia32_user_i387_struct));
2674 if (dst->ret)
2675 return;
2676 pt = task_pt_regs(task);
2677 tos = (task->thread.fsr >> 11) & 7;
2678 end = (dst->pos - 7 * sizeof(int)) / sizeof(struct _fpreg_ia32);
2679 for (; start < end; start++)
2680 access_fpreg_ia32(start,
2681 (struct _fpreg_ia32 *)buf + start,
2682 pt, info->sw, tos, 1);
2683 if (dst->count == 0)
2684 return;
2685 }
2686}
2687
2688#define OFFSET(member) ((int)(offsetof(struct ia32_user_fxsr_struct, member)))
2689static void getfpxreg(struct task_struct *task, int start, int end, char *buf)
2690{
2691 int min_val;
2692
2693 min_val = min(end, OFFSET(fop));
2694 while (start < min_val) {
2695 if (start == OFFSET(cwd))
2696 *((short *)buf) = task->thread.fcr & 0xffff;
2697 else if (start == OFFSET(swd))
2698 *((short *)buf) = task->thread.fsr & 0xffff;
2699 else if (start == OFFSET(twd))
2700 *((short *)buf) = (task->thread.fsr>>16) & 0xffff;
2701 buf += 2;
2702 start += 2;
2703 }
2704 /* skip fop element */
2705 if (start == OFFSET(fop)) {
2706 start += 2;
2707 buf += 2;
2708 }
2709 while (start < end) {
2710 if (start == OFFSET(fip))
2711 *((int *)buf) = task->thread.fir;
2712 else if (start == OFFSET(fcs))
2713 *((int *)buf) = (task->thread.fir>>32) & 0xffff;
2714 else if (start == OFFSET(foo))
2715 *((int *)buf) = task->thread.fdr;
2716 else if (start == OFFSET(fos))
2717 *((int *)buf) = (task->thread.fdr>>32) & 0xffff;
2718 else if (start == OFFSET(mxcsr))
2719 *((int *)buf) = ((task->thread.fcr>>32) & 0xff80)
2720 | ((task->thread.fsr>>32) & 0x3f);
2721 buf += 4;
2722 start += 4;
2723 }
2724}
2725
2726static void setfpxreg(struct task_struct *task, int start, int end, char *buf)
2727{
2728 int min_val, num32;
2729 short num;
2730 unsigned long num64;
2731
2732 min_val = min(end, OFFSET(fop));
2733 while (start < min_val) {
2734 num = *((short *)buf);
2735 if (start == OFFSET(cwd)) {
2736 task->thread.fcr = (task->thread.fcr & (~0x1f3f))
2737 | (num & 0x1f3f);
2738 } else if (start == OFFSET(swd)) {
2739 task->thread.fsr = (task->thread.fsr & (~0xffff)) | num;
2740 } else if (start == OFFSET(twd)) {
2741 task->thread.fsr = (task->thread.fsr & (~0xffff0000))
2742 | (((int)num) << 16);
2743 }
2744 buf += 2;
2745 start += 2;
2746 }
2747 /* skip fop element */
2748 if (start == OFFSET(fop)) {
2749 start += 2;
2750 buf += 2;
2751 }
2752 while (start < end) {
2753 num32 = *((int *)buf);
2754 if (start == OFFSET(fip))
2755 task->thread.fir = (task->thread.fir & (~0xffffffff))
2756 | num32;
2757 else if (start == OFFSET(foo))
2758 task->thread.fdr = (task->thread.fdr & (~0xffffffff))
2759 | num32;
2760 else if (start == OFFSET(mxcsr)) {
2761 num64 = num32 & 0xff10;
2762 task->thread.fcr = (task->thread.fcr &
2763 (~0xff1000000000UL)) | (num64<<32);
2764 num64 = num32 & 0x3f;
2765 task->thread.fsr = (task->thread.fsr &
2766 (~0x3f00000000UL)) | (num64<<32);
2767 }
2768 buf += 4;
2769 start += 4;
2770 }
2771}
2772
2773static void do_fpxregs_get(struct unw_frame_info *info, void *arg)
2774{
2775 struct regset_getset *dst = arg;
2776 struct task_struct *task = dst->target;
2777 struct pt_regs *pt;
2778 char buf[128];
2779 int start, end, tos;
2780
2781 if (dst->count == 0 || unw_unwind_to_user(info) < 0)
2782 return;
2783 if (dst->pos < OFFSET(st_space[0])) {
2784 end = min(dst->pos + dst->count, (unsigned int)32);
2785 getfpxreg(task, dst->pos, end, buf);
2786 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
2787 &dst->u.get.kbuf, &dst->u.get.ubuf, buf,
2788 0, OFFSET(st_space[0]));
2789 if (dst->ret || dst->count == 0)
2790 return;
2791 }
2792 if (dst->pos < OFFSET(xmm_space[0])) {
2793 pt = task_pt_regs(task);
2794 tos = (task->thread.fsr >> 11) & 7;
2795 end = min(dst->pos + dst->count,
2796 (unsigned int)OFFSET(xmm_space[0]));
2797 start = (dst->pos - OFFSET(st_space[0])) / 16;
2798 end = (end - OFFSET(st_space[0])) / 16;
2799 for (; start < end; start++)
2800 access_fpreg_ia32(start, buf + 16 * start, pt,
2801 info->sw, tos, 0);
2802 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
2803 &dst->u.get.kbuf, &dst->u.get.ubuf,
2804 buf, OFFSET(st_space[0]), OFFSET(xmm_space[0]));
2805 if (dst->ret || dst->count == 0)
2806 return;
2807 }
2808 if (dst->pos < OFFSET(padding[0]))
2809 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
2810 &dst->u.get.kbuf, &dst->u.get.ubuf,
2811 &info->sw->f16, OFFSET(xmm_space[0]),
2812 OFFSET(padding[0]));
2813}
2814
2815static void do_fpxregs_set(struct unw_frame_info *info, void *arg)
2816{
2817 struct regset_getset *dst = arg;
2818 struct task_struct *task = dst->target;
2819 char buf[128];
2820 int start, end;
2821
2822 if (dst->count == 0 || unw_unwind_to_user(info) < 0)
2823 return;
2824
2825 if (dst->pos < OFFSET(st_space[0])) {
2826 start = dst->pos;
2827 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
2828 &dst->u.set.kbuf, &dst->u.set.ubuf,
2829 buf, 0, OFFSET(st_space[0]));
2830 if (dst->ret)
2831 return;
2832 setfpxreg(task, start, dst->pos, buf);
2833 if (dst->count == 0)
2834 return;
2835 }
2836 if (dst->pos < OFFSET(xmm_space[0])) {
2837 struct pt_regs *pt;
2838 int tos;
2839 pt = task_pt_regs(task);
2840 tos = (task->thread.fsr >> 11) & 7;
2841 start = (dst->pos - OFFSET(st_space[0])) / 16;
2842 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
2843 &dst->u.set.kbuf, &dst->u.set.ubuf,
2844 buf, OFFSET(st_space[0]), OFFSET(xmm_space[0]));
2845 if (dst->ret)
2846 return;
2847 end = (dst->pos - OFFSET(st_space[0])) / 16;
2848 for (; start < end; start++)
2849 access_fpreg_ia32(start, buf + 16 * start, pt, info->sw,
2850 tos, 1);
2851 if (dst->count == 0)
2852 return;
2853 }
2854 if (dst->pos < OFFSET(padding[0]))
2855 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
2856 &dst->u.set.kbuf, &dst->u.set.ubuf,
2857 &info->sw->f16, OFFSET(xmm_space[0]),
2858 OFFSET(padding[0]));
2859}
2860#undef OFFSET
2861
2862static int do_regset_call(void (*call)(struct unw_frame_info *, void *),
2863 struct task_struct *target,
2864 const struct user_regset *regset,
2865 unsigned int pos, unsigned int count,
2866 const void *kbuf, const void __user *ubuf)
2867{
2868 struct regset_getset info = { .target = target, .regset = regset,
2869 .pos = pos, .count = count,
2870 .u.set = { .kbuf = kbuf, .ubuf = ubuf },
2871 .ret = 0 };
2872
2873 if (target == current)
2874 unw_init_running(call, &info);
2875 else {
2876 struct unw_frame_info ufi;
2877 memset(&ufi, 0, sizeof(ufi));
2878 unw_init_from_blocked_task(&ufi, target);
2879 (*call)(&ufi, &info);
2880 }
2881
2882 return info.ret;
2883}
2884
2885static int ia32_fpregs_get(struct task_struct *target,
2886 const struct user_regset *regset,
2887 unsigned int pos, unsigned int count,
2888 void *kbuf, void __user *ubuf)
2889{
2890 return do_regset_call(do_fpregs_get, target, regset, pos, count,
2891 kbuf, ubuf);
2892}
2893
2894static int ia32_fpregs_set(struct task_struct *target,
2895 const struct user_regset *regset,
2896 unsigned int pos, unsigned int count,
2897 const void *kbuf, const void __user *ubuf)
2898{
2899 return do_regset_call(do_fpregs_set, target, regset, pos, count,
2900 kbuf, ubuf);
2901}
2902
2903static int ia32_fpxregs_get(struct task_struct *target,
2904 const struct user_regset *regset,
2905 unsigned int pos, unsigned int count,
2906 void *kbuf, void __user *ubuf)
2907{
2908 return do_regset_call(do_fpxregs_get, target, regset, pos, count,
2909 kbuf, ubuf);
2910}
2911
2912static int ia32_fpxregs_set(struct task_struct *target,
2913 const struct user_regset *regset,
2914 unsigned int pos, unsigned int count,
2915 const void *kbuf, const void __user *ubuf)
2916{
2917 return do_regset_call(do_fpxregs_set, target, regset, pos, count,
2918 kbuf, ubuf);
2919}
2920
2921static int ia32_genregs_get(struct task_struct *target,
2922 const struct user_regset *regset,
2923 unsigned int pos, unsigned int count,
2924 void *kbuf, void __user *ubuf)
2925{
2926 if (kbuf) {
2927 u32 *kp = kbuf;
2928 while (count > 0) {
2929 *kp++ = getreg(target, pos);
2930 pos += 4;
2931 count -= 4;
2932 }
2933 } else {
2934 u32 __user *up = ubuf;
2935 while (count > 0) {
2936 if (__put_user(getreg(target, pos), up++))
2937 return -EFAULT;
2938 pos += 4;
2939 count -= 4;
2940 }
2941 }
2942 return 0;
2943}
2944
2945static int ia32_genregs_set(struct task_struct *target,
2946 const struct user_regset *regset,
2947 unsigned int pos, unsigned int count,
2948 const void *kbuf, const void __user *ubuf)
2949{
2950 int ret = 0;
2951
2952 if (kbuf) {
2953 const u32 *kp = kbuf;
2954 while (!ret && count > 0) {
2955 putreg(target, pos, *kp++);
2956 pos += 4;
2957 count -= 4;
2958 }
2959 } else {
2960 const u32 __user *up = ubuf;
2961 u32 val;
2962 while (!ret && count > 0) {
2963 ret = __get_user(val, up++);
2964 if (!ret)
2965 putreg(target, pos, val);
2966 pos += 4;
2967 count -= 4;
2968 }
2969 }
2970 return ret;
2971}
2972
2973static int ia32_tls_active(struct task_struct *target,
2974 const struct user_regset *regset)
2975{
2976 struct thread_struct *t = &target->thread;
2977 int n = GDT_ENTRY_TLS_ENTRIES;
2978 while (n > 0 && desc_empty(&t->tls_array[n -1]))
2979 --n;
2980 return n;
2981}
2982
2983static int ia32_tls_get(struct task_struct *target,
2984 const struct user_regset *regset, unsigned int pos,
2985 unsigned int count, void *kbuf, void __user *ubuf)
2986{
2987 const struct desc_struct *tls;
2988
2989 if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct ia32_user_desc) ||
2990 (pos % sizeof(struct ia32_user_desc)) != 0 ||
2991 (count % sizeof(struct ia32_user_desc)) != 0)
2992 return -EINVAL;
2993
2994 pos /= sizeof(struct ia32_user_desc);
2995 count /= sizeof(struct ia32_user_desc);
2996
2997 tls = &target->thread.tls_array[pos];
2998
2999 if (kbuf) {
3000 struct ia32_user_desc *info = kbuf;
3001 while (count-- > 0)
3002 fill_user_desc(info++, GDT_ENTRY_TLS_MIN + pos++,
3003 tls++);
3004 } else {
3005 struct ia32_user_desc __user *u_info = ubuf;
3006 while (count-- > 0) {
3007 struct ia32_user_desc info;
3008 fill_user_desc(&info, GDT_ENTRY_TLS_MIN + pos++, tls++);
3009 if (__copy_to_user(u_info++, &info, sizeof(info)))
3010 return -EFAULT;
3011 }
3012 }
3013
3014 return 0;
3015}
3016
3017static int ia32_tls_set(struct task_struct *target,
3018 const struct user_regset *regset, unsigned int pos,
3019 unsigned int count, const void *kbuf, const void __user *ubuf)
3020{
3021 struct ia32_user_desc infobuf[GDT_ENTRY_TLS_ENTRIES];
3022 const struct ia32_user_desc *info;
3023
3024 if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct ia32_user_desc) ||
3025 (pos % sizeof(struct ia32_user_desc)) != 0 ||
3026 (count % sizeof(struct ia32_user_desc)) != 0)
3027 return -EINVAL;
3028
3029 if (kbuf)
3030 info = kbuf;
3031 else if (__copy_from_user(infobuf, ubuf, count))
3032 return -EFAULT;
3033 else
3034 info = infobuf;
3035
3036 set_tls_desc(target,
3037 GDT_ENTRY_TLS_MIN + (pos / sizeof(struct ia32_user_desc)),
3038 info, count / sizeof(struct ia32_user_desc));
3039
3040 return 0;
3041}
3042
3043/*
3044 * This should match arch/i386/kernel/ptrace.c:native_regsets.
3045 * XXX ioperm? vm86?
3046 */
3047static const struct user_regset ia32_regsets[] = {
3048 {
3049 .core_note_type = NT_PRSTATUS,
3050 .n = sizeof(struct user_regs_struct32)/4,
3051 .size = 4, .align = 4,
3052 .get = ia32_genregs_get, .set = ia32_genregs_set
3053 },
3054 {
3055 .core_note_type = NT_PRFPREG,
3056 .n = sizeof(struct ia32_user_i387_struct) / 4,
3057 .size = 4, .align = 4,
3058 .get = ia32_fpregs_get, .set = ia32_fpregs_set
3059 },
3060 {
3061 .core_note_type = NT_PRXFPREG,
3062 .n = sizeof(struct ia32_user_fxsr_struct) / 4,
3063 .size = 4, .align = 4,
3064 .get = ia32_fpxregs_get, .set = ia32_fpxregs_set
3065 },
3066 {
3067 .core_note_type = NT_386_TLS,
3068 .n = GDT_ENTRY_TLS_ENTRIES,
3069 .bias = GDT_ENTRY_TLS_MIN,
3070 .size = sizeof(struct ia32_user_desc),
3071 .align = sizeof(struct ia32_user_desc),
3072 .active = ia32_tls_active,
3073 .get = ia32_tls_get, .set = ia32_tls_set,
3074 },
3075};
3076
3077const struct user_regset_view user_ia32_view = {
3078 .name = "i386", .e_machine = EM_386,
3079 .regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets)
3080};
3081
2483long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 3082long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
2484 __u32 len_low, __u32 len_high, int advice) 3083 __u32 len_low, __u32 len_high, int advice)
2485{ 3084{
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 78f28d825f30..c7467f863c7a 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -423,6 +423,7 @@ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
423#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) 423#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
424#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 424#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
425static struct acpi_table_slit __initdata *slit_table; 425static struct acpi_table_slit __initdata *slit_table;
426cpumask_t early_cpu_possible_map = CPU_MASK_NONE;
426 427
427static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa) 428static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
428{ 429{
@@ -482,6 +483,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
482 (pa->apic_id << 8) | (pa->local_sapic_eid); 483 (pa->apic_id << 8) | (pa->local_sapic_eid);
483 /* nid should be overridden as logical node id later */ 484 /* nid should be overridden as logical node id later */
484 node_cpuid[srat_num_cpus].nid = pxm; 485 node_cpuid[srat_num_cpus].nid = pxm;
486 cpu_set(srat_num_cpus, early_cpu_possible_map);
485 srat_num_cpus++; 487 srat_num_cpus++;
486} 488}
487 489
@@ -559,7 +561,7 @@ void __init acpi_numa_arch_fixup(void)
559 } 561 }
560 562
561 /* set logical node id in cpu structure */ 563 /* set logical node id in cpu structure */
562 for (i = 0; i < srat_num_cpus; i++) 564 for_each_possible_early_cpu(i)
563 node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid); 565 node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
564 566
565 printk(KERN_INFO "Number of logical nodes in system = %d\n", 567 printk(KERN_INFO "Number of logical nodes in system = %d\n",
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index f7bc40dee43d..230a6f92367f 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -43,6 +43,12 @@ void foo(void)
43 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 43 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
44 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 44 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
45 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); 45 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
46#ifdef CONFIG_VIRT_CPU_ACCOUNTING
47 DEFINE(TI_AC_STAMP, offsetof(struct thread_info, ac_stamp));
48 DEFINE(TI_AC_LEAVE, offsetof(struct thread_info, ac_leave));
49 DEFINE(TI_AC_STIME, offsetof(struct thread_info, ac_stime));
50 DEFINE(TI_AC_UTIME, offsetof(struct thread_info, ac_utime));
51#endif
46 52
47 BLANK(); 53 BLANK();
48 54
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 728d7247a1a6..d45f215bc8fc 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -37,6 +37,7 @@
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/processor.h> 38#include <asm/processor.h>
39#include <asm/mca.h> 39#include <asm/mca.h>
40#include <asm/tlbflush.h>
40 41
41#define EFI_DEBUG 0 42#define EFI_DEBUG 0
42 43
@@ -403,6 +404,41 @@ efi_get_pal_addr (void)
403 return NULL; 404 return NULL;
404} 405}
405 406
407
408static u8 __init palo_checksum(u8 *buffer, u32 length)
409{
410 u8 sum = 0;
411 u8 *end = buffer + length;
412
413 while (buffer < end)
414 sum = (u8) (sum + *(buffer++));
415
416 return sum;
417}
418
419/*
420 * Parse and handle PALO table which is published at:
421 * http://www.dig64.org/home/DIG64_PALO_R1_0.pdf
422 */
423static void __init handle_palo(unsigned long palo_phys)
424{
425 struct palo_table *palo = __va(palo_phys);
426 u8 checksum;
427
428 if (strncmp(palo->signature, PALO_SIG, sizeof(PALO_SIG) - 1)) {
429 printk(KERN_INFO "PALO signature incorrect.\n");
430 return;
431 }
432
433 checksum = palo_checksum((u8 *)palo, palo->length);
434 if (checksum) {
435 printk(KERN_INFO "PALO checksum incorrect.\n");
436 return;
437 }
438
439 setup_ptcg_sem(palo->max_tlb_purges, NPTCG_FROM_PALO);
440}
441
406void 442void
407efi_map_pal_code (void) 443efi_map_pal_code (void)
408{ 444{
@@ -432,6 +468,7 @@ efi_init (void)
432 u64 efi_desc_size; 468 u64 efi_desc_size;
433 char *cp, vendor[100] = "unknown"; 469 char *cp, vendor[100] = "unknown";
434 int i; 470 int i;
471 unsigned long palo_phys;
435 472
436 /* 473 /*
437 * It's too early to be able to use the standard kernel command line 474 * It's too early to be able to use the standard kernel command line
@@ -496,6 +533,8 @@ efi_init (void)
496 efi.hcdp = EFI_INVALID_TABLE_ADDR; 533 efi.hcdp = EFI_INVALID_TABLE_ADDR;
497 efi.uga = EFI_INVALID_TABLE_ADDR; 534 efi.uga = EFI_INVALID_TABLE_ADDR;
498 535
536 palo_phys = EFI_INVALID_TABLE_ADDR;
537
499 for (i = 0; i < (int) efi.systab->nr_tables; i++) { 538 for (i = 0; i < (int) efi.systab->nr_tables; i++) {
500 if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) { 539 if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) {
501 efi.mps = config_tables[i].table; 540 efi.mps = config_tables[i].table;
@@ -515,10 +554,17 @@ efi_init (void)
515 } else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) { 554 } else if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) {
516 efi.hcdp = config_tables[i].table; 555 efi.hcdp = config_tables[i].table;
517 printk(" HCDP=0x%lx", config_tables[i].table); 556 printk(" HCDP=0x%lx", config_tables[i].table);
557 } else if (efi_guidcmp(config_tables[i].guid,
558 PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID) == 0) {
559 palo_phys = config_tables[i].table;
560 printk(" PALO=0x%lx", config_tables[i].table);
518 } 561 }
519 } 562 }
520 printk("\n"); 563 printk("\n");
521 564
565 if (palo_phys != EFI_INVALID_TABLE_ADDR)
566 handle_palo(palo_phys);
567
522 runtime = __va(efi.systab->runtime); 568 runtime = __va(efi.systab->runtime);
523 efi.get_time = phys_get_time; 569 efi.get_time = phys_get_time;
524 efi.set_time = phys_set_time; 570 efi.set_time = phys_set_time;
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 3c331c464b40..b0be4a280174 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -710,6 +710,16 @@ ENTRY(ia64_leave_syscall)
710(pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk 710(pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk
711#endif 711#endif
712.work_processed_syscall: 712.work_processed_syscall:
713#ifdef CONFIG_VIRT_CPU_ACCOUNTING
714 adds r2=PT(LOADRS)+16,r12
715(pUStk) mov.m r22=ar.itc // fetch time at leave
716 adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
717 ;;
718(p6) ld4 r31=[r18] // load current_thread_info()->flags
719 ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs"
720 adds r3=PT(AR_BSPSTORE)+16,r12 // deferred
721 ;;
722#else
713 adds r2=PT(LOADRS)+16,r12 723 adds r2=PT(LOADRS)+16,r12
714 adds r3=PT(AR_BSPSTORE)+16,r12 724 adds r3=PT(AR_BSPSTORE)+16,r12
715 adds r18=TI_FLAGS+IA64_TASK_SIZE,r13 725 adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
@@ -718,6 +728,7 @@ ENTRY(ia64_leave_syscall)
718 ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs" 728 ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs"
719 nop.i 0 729 nop.i 0
720 ;; 730 ;;
731#endif
721 mov r16=ar.bsp // M2 get existing backing store pointer 732 mov r16=ar.bsp // M2 get existing backing store pointer
722 ld8 r18=[r2],PT(R9)-PT(B6) // load b6 733 ld8 r18=[r2],PT(R9)-PT(B6) // load b6
723(p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE? 734(p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE?
@@ -737,12 +748,21 @@ ENTRY(ia64_leave_syscall)
737 748
738 ld8 r29=[r2],16 // M0|1 load cr.ipsr 749 ld8 r29=[r2],16 // M0|1 load cr.ipsr
739 ld8 r28=[r3],16 // M0|1 load cr.iip 750 ld8 r28=[r3],16 // M0|1 load cr.iip
751#ifdef CONFIG_VIRT_CPU_ACCOUNTING
752(pUStk) add r14=TI_AC_LEAVE+IA64_TASK_SIZE,r13
753 ;;
754 ld8 r30=[r2],16 // M0|1 load cr.ifs
755 ld8 r25=[r3],16 // M0|1 load ar.unat
756(pUStk) add r15=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
757 ;;
758#else
740 mov r22=r0 // A clear r22 759 mov r22=r0 // A clear r22
741 ;; 760 ;;
742 ld8 r30=[r2],16 // M0|1 load cr.ifs 761 ld8 r30=[r2],16 // M0|1 load cr.ifs
743 ld8 r25=[r3],16 // M0|1 load ar.unat 762 ld8 r25=[r3],16 // M0|1 load ar.unat
744(pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13 763(pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
745 ;; 764 ;;
765#endif
746 ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs 766 ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs
747(pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled 767(pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled
748 nop 0 768 nop 0
@@ -759,7 +779,11 @@ ENTRY(ia64_leave_syscall)
759 ld8.fill r1=[r3],16 // M0|1 load r1 779 ld8.fill r1=[r3],16 // M0|1 load r1
760(pUStk) mov r17=1 // A 780(pUStk) mov r17=1 // A
761 ;; 781 ;;
782#ifdef CONFIG_VIRT_CPU_ACCOUNTING
783(pUStk) st1 [r15]=r17 // M2|3
784#else
762(pUStk) st1 [r14]=r17 // M2|3 785(pUStk) st1 [r14]=r17 // M2|3
786#endif
763 ld8.fill r13=[r3],16 // M0|1 787 ld8.fill r13=[r3],16 // M0|1
764 mov f8=f0 // F clear f8 788 mov f8=f0 // F clear f8
765 ;; 789 ;;
@@ -775,12 +799,22 @@ ENTRY(ia64_leave_syscall)
775 shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition 799 shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition
776 cover // B add current frame into dirty partition & set cr.ifs 800 cover // B add current frame into dirty partition & set cr.ifs
777 ;; 801 ;;
802#ifdef CONFIG_VIRT_CPU_ACCOUNTING
803 mov r19=ar.bsp // M2 get new backing store pointer
804 st8 [r14]=r22 // M save time at leave
805 mov f10=f0 // F clear f10
806
807 mov r22=r0 // A clear r22
808 movl r14=__kernel_syscall_via_epc // X
809 ;;
810#else
778 mov r19=ar.bsp // M2 get new backing store pointer 811 mov r19=ar.bsp // M2 get new backing store pointer
779 mov f10=f0 // F clear f10 812 mov f10=f0 // F clear f10
780 813
781 nop.m 0 814 nop.m 0
782 movl r14=__kernel_syscall_via_epc // X 815 movl r14=__kernel_syscall_via_epc // X
783 ;; 816 ;;
817#endif
784 mov.m ar.csd=r0 // M2 clear ar.csd 818 mov.m ar.csd=r0 // M2 clear ar.csd
785 mov.m ar.ccv=r0 // M2 clear ar.ccv 819 mov.m ar.ccv=r0 // M2 clear ar.ccv
786 mov b7=r14 // I0 clear b7 (hint with __kernel_syscall_via_epc) 820 mov b7=r14 // I0 clear b7 (hint with __kernel_syscall_via_epc)
@@ -913,10 +947,18 @@ GLOBAL_ENTRY(ia64_leave_kernel)
913 adds r16=PT(CR_IPSR)+16,r12 947 adds r16=PT(CR_IPSR)+16,r12
914 adds r17=PT(CR_IIP)+16,r12 948 adds r17=PT(CR_IIP)+16,r12
915 949
950#ifdef CONFIG_VIRT_CPU_ACCOUNTING
951 .pred.rel.mutex pUStk,pKStk
952(pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled
953(pUStk) mov.m r22=ar.itc // M fetch time at leave
954 nop.i 0
955 ;;
956#else
916(pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled 957(pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled
917 nop.i 0 958 nop.i 0
918 nop.i 0 959 nop.i 0
919 ;; 960 ;;
961#endif
920 ld8 r29=[r16],16 // load cr.ipsr 962 ld8 r29=[r16],16 // load cr.ipsr
921 ld8 r28=[r17],16 // load cr.iip 963 ld8 r28=[r17],16 // load cr.iip
922 ;; 964 ;;
@@ -938,15 +980,37 @@ GLOBAL_ENTRY(ia64_leave_kernel)
938 ;; 980 ;;
939 ld8.fill r12=[r16],16 981 ld8.fill r12=[r16],16
940 ld8.fill r13=[r17],16 982 ld8.fill r13=[r17],16
983#ifdef CONFIG_VIRT_CPU_ACCOUNTING
984(pUStk) adds r3=TI_AC_LEAVE+IA64_TASK_SIZE,r18
985#else
941(pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 986(pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18
987#endif
942 ;; 988 ;;
943 ld8 r20=[r16],16 // ar.fpsr 989 ld8 r20=[r16],16 // ar.fpsr
944 ld8.fill r15=[r17],16 990 ld8.fill r15=[r17],16
991#ifdef CONFIG_VIRT_CPU_ACCOUNTING
992(pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 // deferred
993#endif
945 ;; 994 ;;
946 ld8.fill r14=[r16],16 995 ld8.fill r14=[r16],16
947 ld8.fill r2=[r17] 996 ld8.fill r2=[r17]
948(pUStk) mov r17=1 997(pUStk) mov r17=1
949 ;; 998 ;;
999#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1000 // mmi_ : ld8 st1 shr;; mmi_ : st8 st1 shr;;
1001 // mib : mov add br -> mib : ld8 add br
1002 // bbb_ : br nop cover;; mbb_ : mov br cover;;
1003 //
1004 // no one require bsp in r16 if (pKStk) branch is selected.
1005(pUStk) st8 [r3]=r22 // save time at leave
1006(pUStk) st1 [r18]=r17 // restore current->thread.on_ustack
1007 shr.u r18=r19,16 // get byte size of existing "dirty" partition
1008 ;;
1009 ld8.fill r3=[r16] // deferred
1010 LOAD_PHYS_STACK_REG_SIZE(r17)
1011(pKStk) br.cond.dpnt skip_rbs_switch
1012 mov r16=ar.bsp // get existing backing store pointer
1013#else
950 ld8.fill r3=[r16] 1014 ld8.fill r3=[r16]
951(pUStk) st1 [r18]=r17 // restore current->thread.on_ustack 1015(pUStk) st1 [r18]=r17 // restore current->thread.on_ustack
952 shr.u r18=r19,16 // get byte size of existing "dirty" partition 1016 shr.u r18=r19,16 // get byte size of existing "dirty" partition
@@ -954,6 +1018,7 @@ GLOBAL_ENTRY(ia64_leave_kernel)
954 mov r16=ar.bsp // get existing backing store pointer 1018 mov r16=ar.bsp // get existing backing store pointer
955 LOAD_PHYS_STACK_REG_SIZE(r17) 1019 LOAD_PHYS_STACK_REG_SIZE(r17)
956(pKStk) br.cond.dpnt skip_rbs_switch 1020(pKStk) br.cond.dpnt skip_rbs_switch
1021#endif
957 1022
958 /* 1023 /*
959 * Restore user backing store. 1024 * Restore user backing store.
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 3f570e6fcd9c..c1625c7e1779 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -236,27 +236,25 @@ ENTRY(fsys_gettimeofday)
236 // Note that instructions are optimized for McKinley. McKinley can 236 // Note that instructions are optimized for McKinley. McKinley can
237 // process two bundles simultaneously and therefore we continuously 237 // process two bundles simultaneously and therefore we continuously
238 // try to feed the CPU two bundles and then a stop. 238 // try to feed the CPU two bundles and then a stop.
239 // 239
240 // Additional note that code has changed a lot. Optimization is TBD.
241 // Comments begin with "?" are maybe outdated.
242 tnat.nz p6,p0 = r31 // ? branch deferred to fit later bundle
243 mov pr = r30,0xc000 // Set predicates according to function
244 add r2 = TI_FLAGS+IA64_TASK_SIZE,r16 240 add r2 = TI_FLAGS+IA64_TASK_SIZE,r16
241 tnat.nz p6,p0 = r31 // guard against Nat argument
242(p6) br.cond.spnt.few .fail_einval
245 movl r20 = fsyscall_gtod_data // load fsyscall gettimeofday data address 243 movl r20 = fsyscall_gtod_data // load fsyscall gettimeofday data address
246 ;; 244 ;;
245 ld4 r2 = [r2] // process work pending flags
247 movl r29 = itc_jitter_data // itc_jitter 246 movl r29 = itc_jitter_data // itc_jitter
248 add r22 = IA64_GTOD_WALL_TIME_OFFSET,r20 // wall_time 247 add r22 = IA64_GTOD_WALL_TIME_OFFSET,r20 // wall_time
249 ld4 r2 = [r2] // process work pending flags
250 ;;
251(p15) add r22 = IA64_GTOD_MONO_TIME_OFFSET,r20 // monotonic_time
252 add r21 = IA64_CLKSRC_MMIO_OFFSET,r20 248 add r21 = IA64_CLKSRC_MMIO_OFFSET,r20
253 add r19 = IA64_ITC_LASTCYCLE_OFFSET,r29 249 mov pr = r30,0xc000 // Set predicates according to function
250 ;;
254 and r2 = TIF_ALLWORK_MASK,r2 251 and r2 = TIF_ALLWORK_MASK,r2
255(p6) br.cond.spnt.few .fail_einval // ? deferred branch 252 add r19 = IA64_ITC_LASTCYCLE_OFFSET,r29
253(p15) add r22 = IA64_GTOD_MONO_TIME_OFFSET,r20 // monotonic_time
256 ;; 254 ;;
257 add r26 = IA64_CLKSRC_CYCLE_LAST_OFFSET,r20 // clksrc_cycle_last 255 add r26 = IA64_CLKSRC_CYCLE_LAST_OFFSET,r20 // clksrc_cycle_last
258 cmp.ne p6, p0 = 0, r2 // Fallback if work is scheduled 256 cmp.ne p6, p0 = 0, r2 // Fallback if work is scheduled
259(p6) br.cond.spnt.many fsys_fallback_syscall 257(p6) br.cond.spnt.many fsys_fallback_syscall
260 ;; 258 ;;
261 // Begin critical section 259 // Begin critical section
262.time_redo: 260.time_redo:
@@ -284,7 +282,6 @@ ENTRY(fsys_gettimeofday)
284(p8) mov r2 = ar.itc // CPU_TIMER. 36 clocks latency!!! 282(p8) mov r2 = ar.itc // CPU_TIMER. 36 clocks latency!!!
285(p9) ld8 r2 = [r30] // MMIO_TIMER. Could also have latency issues.. 283(p9) ld8 r2 = [r30] // MMIO_TIMER. Could also have latency issues..
286(p13) ld8 r25 = [r19] // get itc_lastcycle value 284(p13) ld8 r25 = [r19] // get itc_lastcycle value
287 ;; // ? could be removed by moving the last add upward
288 ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET // tv_sec 285 ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET // tv_sec
289 ;; 286 ;;
290 ld8 r8 = [r22],-IA64_TIMESPEC_TV_NSEC_OFFSET // tv_nsec 287 ld8 r8 = [r22],-IA64_TIMESPEC_TV_NSEC_OFFSET // tv_nsec
@@ -311,13 +308,12 @@ ENTRY(fsys_gettimeofday)
311EX(.fail_efault, probe.w.fault r31, 3) 308EX(.fail_efault, probe.w.fault r31, 3)
312 xmpy.l f8 = f8,f7 // nsec_per_cyc*(counter-last_counter) 309 xmpy.l f8 = f8,f7 // nsec_per_cyc*(counter-last_counter)
313 ;; 310 ;;
314 // ? simulate tbit.nz.or p7,p0 = r28,0
315 getf.sig r2 = f8 311 getf.sig r2 = f8
316 mf 312 mf
317 ;; 313 ;;
318 ld4 r10 = [r20] // gtod_lock.sequence 314 ld4 r10 = [r20] // gtod_lock.sequence
319 shr.u r2 = r2,r23 // shift by factor 315 shr.u r2 = r2,r23 // shift by factor
320 ;; // ? overloaded 3 bundles! 316 ;;
321 add r8 = r8,r2 // Add xtime.nsecs 317 add r8 = r8,r2 // Add xtime.nsecs
322 cmp4.ne p7,p0 = r28,r10 318 cmp4.ne p7,p0 = r28,r10
323(p7) br.cond.dpnt.few .time_redo // sequence number changed, redo 319(p7) br.cond.dpnt.few .time_redo // sequence number changed, redo
@@ -345,9 +341,9 @@ EX(.fail_efault, probe.w.fault r31, 3)
345EX(.fail_efault, probe.w.fault r23, 3) // This also costs 5 cycles 341EX(.fail_efault, probe.w.fault r23, 3) // This also costs 5 cycles
346(p14) xmpy.hu f8 = f8, f7 // xmpy has 5 cycles latency so use it 342(p14) xmpy.hu f8 = f8, f7 // xmpy has 5 cycles latency so use it
347 ;; 343 ;;
348 mov r8 = r0
349(p14) getf.sig r2 = f8 344(p14) getf.sig r2 = f8
350 ;; 345 ;;
346 mov r8 = r0
351(p14) shr.u r21 = r2, 4 347(p14) shr.u r21 = r2, 4
352 ;; 348 ;;
353EX(.fail_efault, st8 [r31] = r9) 349EX(.fail_efault, st8 [r31] = r9)
@@ -686,7 +682,11 @@ GLOBAL_ENTRY(fsys_bubble_down)
686 nop.i 0 682 nop.i 0
687 ;; 683 ;;
688 mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0 684 mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0
685#ifdef CONFIG_VIRT_CPU_ACCOUNTING
686 mov.m r30=ar.itc // M get cycle for accounting
687#else
689 nop.m 0 688 nop.m 0
689#endif
690 nop.i 0 690 nop.i 0
691 ;; 691 ;;
692 mov r23=ar.bspstore // M2 (12 cyc) save ar.bspstore 692 mov r23=ar.bspstore // M2 (12 cyc) save ar.bspstore
@@ -708,6 +708,28 @@ GLOBAL_ENTRY(fsys_bubble_down)
708 cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1 708 cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1
709 br.call.sptk.many b7=ia64_syscall_setup // B 709 br.call.sptk.many b7=ia64_syscall_setup // B
710 ;; 710 ;;
711#ifdef CONFIG_VIRT_CPU_ACCOUNTING
712 // mov.m r30=ar.itc is called in advance
713 add r16=TI_AC_STAMP+IA64_TASK_SIZE,r2
714 add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r2
715 ;;
716 ld8 r18=[r16],TI_AC_STIME-TI_AC_STAMP // time at last check in kernel
717 ld8 r19=[r17],TI_AC_UTIME-TI_AC_LEAVE // time at leave kernel
718 ;;
719 ld8 r20=[r16],TI_AC_STAMP-TI_AC_STIME // cumulated stime
720 ld8 r21=[r17] // cumulated utime
721 sub r22=r19,r18 // stime before leave kernel
722 ;;
723 st8 [r16]=r30,TI_AC_STIME-TI_AC_STAMP // update stamp
724 sub r18=r30,r19 // elapsed time in user mode
725 ;;
726 add r20=r20,r22 // sum stime
727 add r21=r21,r18 // sum utime
728 ;;
729 st8 [r16]=r20 // update stime
730 st8 [r17]=r21 // update utime
731 ;;
732#endif
711 mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0 733 mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0
712 mov rp=r14 // I0 set the real return addr 734 mov rp=r14 // I0 set the real return addr
713 and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A 735 and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index d3a41d5f8d12..ddeab4e36fd5 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1002,6 +1002,26 @@ GLOBAL_ENTRY(sched_clock)
1002 br.ret.sptk.many rp 1002 br.ret.sptk.many rp
1003END(sched_clock) 1003END(sched_clock)
1004 1004
1005#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1006GLOBAL_ENTRY(cycle_to_cputime)
1007 alloc r16=ar.pfs,1,0,0,0
1008 addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
1009 ;;
1010 ldf8 f8=[r8]
1011 ;;
1012 setf.sig f9=r32
1013 ;;
1014 xmpy.lu f10=f9,f8 // calculate low 64 bits of 128-bit product (4 cyc)
1015 xmpy.hu f11=f9,f8 // calculate high 64 bits of 128-bit product
1016 ;;
1017 getf.sig r8=f10 // (5 cyc)
1018 getf.sig r9=f11
1019 ;;
1020 shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
1021 br.ret.sptk.many rp
1022END(cycle_to_cputime)
1023#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
1024
1005GLOBAL_ENTRY(start_kernel_thread) 1025GLOBAL_ENTRY(start_kernel_thread)
1006 .prologue 1026 .prologue
1007 .save rp, r0 // this is the end of the call-chain 1027 .save rp, r0 // this is the end of the call-chain
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index 34f44d8be00d..6678c49daba3 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -805,8 +805,13 @@ ENTRY(break_fault)
805 805
806(p8) adds r28=16,r28 // A switch cr.iip to next bundle 806(p8) adds r28=16,r28 // A switch cr.iip to next bundle
807(p9) adds r8=1,r8 // A increment ei to next slot 807(p9) adds r8=1,r8 // A increment ei to next slot
808#ifdef CONFIG_VIRT_CPU_ACCOUNTING
809 ;;
810 mov b6=r30 // I0 setup syscall handler branch reg early
811#else
808 nop.i 0 812 nop.i 0
809 ;; 813 ;;
814#endif
810 815
811 mov.m r25=ar.unat // M2 (5 cyc) 816 mov.m r25=ar.unat // M2 (5 cyc)
812 dep r29=r8,r29,41,2 // I0 insert new ei into cr.ipsr 817 dep r29=r8,r29,41,2 // I0 insert new ei into cr.ipsr
@@ -817,7 +822,11 @@ ENTRY(break_fault)
817 // 822 //
818/////////////////////////////////////////////////////////////////////// 823///////////////////////////////////////////////////////////////////////
819 st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag 824 st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag
825#ifdef CONFIG_VIRT_CPU_ACCOUNTING
826 mov.m r30=ar.itc // M get cycle for accounting
827#else
820 mov b6=r30 // I0 setup syscall handler branch reg early 828 mov b6=r30 // I0 setup syscall handler branch reg early
829#endif
821 cmp.eq pKStk,pUStk=r0,r17 // A were we on kernel stacks already? 830 cmp.eq pKStk,pUStk=r0,r17 // A were we on kernel stacks already?
822 831
823 and r9=_TIF_SYSCALL_TRACEAUDIT,r9 // A mask trace or audit 832 and r9=_TIF_SYSCALL_TRACEAUDIT,r9 // A mask trace or audit
@@ -829,6 +838,30 @@ ENTRY(break_fault)
829 cmp.eq p14,p0=r9,r0 // A are syscalls being traced/audited? 838 cmp.eq p14,p0=r9,r0 // A are syscalls being traced/audited?
830 br.call.sptk.many b7=ia64_syscall_setup // B 839 br.call.sptk.many b7=ia64_syscall_setup // B
8311: 8401:
841#ifdef CONFIG_VIRT_CPU_ACCOUNTING
842 // mov.m r30=ar.itc is called in advance, and r13 is current
843 add r16=TI_AC_STAMP+IA64_TASK_SIZE,r13 // A
844 add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r13 // A
845(pKStk) br.cond.spnt .skip_accounting // B unlikely skip
846 ;;
847 ld8 r18=[r16],TI_AC_STIME-TI_AC_STAMP // M get last stamp
848 ld8 r19=[r17],TI_AC_UTIME-TI_AC_LEAVE // M time at leave
849 ;;
850 ld8 r20=[r16],TI_AC_STAMP-TI_AC_STIME // M cumulated stime
851 ld8 r21=[r17] // M cumulated utime
852 sub r22=r19,r18 // A stime before leave
853 ;;
854 st8 [r16]=r30,TI_AC_STIME-TI_AC_STAMP // M update stamp
855 sub r18=r30,r19 // A elapsed time in user
856 ;;
857 add r20=r20,r22 // A sum stime
858 add r21=r21,r18 // A sum utime
859 ;;
860 st8 [r16]=r20 // M update stime
861 st8 [r17]=r21 // M update utime
862 ;;
863.skip_accounting:
864#endif
832 mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0 865 mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0
833 nop 0 866 nop 0
834 bsw.1 // B (6 cyc) regs are saved, switch to bank 1 867 bsw.1 // B (6 cyc) regs are saved, switch to bank 1
@@ -928,6 +961,7 @@ END(interrupt)
928 * - r27: saved ar.rsc 961 * - r27: saved ar.rsc
929 * - r28: saved cr.iip 962 * - r28: saved cr.iip
930 * - r29: saved cr.ipsr 963 * - r29: saved cr.ipsr
964 * - r30: ar.itc for accounting (don't touch)
931 * - r31: saved pr 965 * - r31: saved pr
932 * - b0: original contents (to be saved) 966 * - b0: original contents (to be saved)
933 * On exit: 967 * On exit:
@@ -1090,6 +1124,41 @@ END(dispatch_illegal_op_fault)
1090 DBG_FAULT(16) 1124 DBG_FAULT(16)
1091 FAULT(16) 1125 FAULT(16)
1092 1126
1127#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1128 /*
1129 * There is no particular reason for this code to be here, other than
1130 * that there happens to be space here that would go unused otherwise.
1131 * If this fault ever gets "unreserved", simply moved the following
1132 * code to a more suitable spot...
1133 *
1134 * account_sys_enter is called from SAVE_MIN* macros if accounting is
1135 * enabled and if the macro is entered from user mode.
1136 */
1137ENTRY(account_sys_enter)
1138 // mov.m r20=ar.itc is called in advance, and r13 is current
1139 add r16=TI_AC_STAMP+IA64_TASK_SIZE,r13
1140 add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r13
1141 ;;
1142 ld8 r18=[r16],TI_AC_STIME-TI_AC_STAMP // time at last check in kernel
1143 ld8 r19=[r17],TI_AC_UTIME-TI_AC_LEAVE // time at left from kernel
1144 ;;
1145 ld8 r23=[r16],TI_AC_STAMP-TI_AC_STIME // cumulated stime
1146 ld8 r21=[r17] // cumulated utime
1147 sub r22=r19,r18 // stime before leave kernel
1148 ;;
1149 st8 [r16]=r20,TI_AC_STIME-TI_AC_STAMP // update stamp
1150 sub r18=r20,r19 // elapsed time in user mode
1151 ;;
1152 add r23=r23,r22 // sum stime
1153 add r21=r21,r18 // sum utime
1154 ;;
1155 st8 [r16]=r23 // update stime
1156 st8 [r17]=r21 // update utime
1157 ;;
1158 br.ret.sptk.many rp
1159END(account_sys_enter)
1160#endif
1161
1093 .org ia64_ivt+0x4400 1162 .org ia64_ivt+0x4400
1094///////////////////////////////////////////////////////////////////////////////////////// 1163/////////////////////////////////////////////////////////////////////////////////////////
1095// 0x4400 Entry 17 (size 64 bundles) Reserved 1164// 0x4400 Entry 17 (size 64 bundles) Reserved
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 1ae512910870..e51bced3b0fa 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -98,6 +98,7 @@
98 98
99#include <asm/irq.h> 99#include <asm/irq.h>
100#include <asm/hw_irq.h> 100#include <asm/hw_irq.h>
101#include <asm/tlb.h>
101 102
102#include "mca_drv.h" 103#include "mca_drv.h"
103#include "entry.h" 104#include "entry.h"
@@ -113,6 +114,7 @@ DEFINE_PER_CPU(u64, ia64_mca_data); /* == __per_cpu_mca[smp_processor_id()] */
113DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */ 114DEFINE_PER_CPU(u64, ia64_mca_per_cpu_pte); /* PTE to map per-CPU area */
114DEFINE_PER_CPU(u64, ia64_mca_pal_pte); /* PTE to map PAL code */ 115DEFINE_PER_CPU(u64, ia64_mca_pal_pte); /* PTE to map PAL code */
115DEFINE_PER_CPU(u64, ia64_mca_pal_base); /* vaddr PAL code granule */ 116DEFINE_PER_CPU(u64, ia64_mca_pal_base); /* vaddr PAL code granule */
117DEFINE_PER_CPU(u64, ia64_mca_tr_reload); /* Flag for TR reload */
116 118
117unsigned long __per_cpu_mca[NR_CPUS]; 119unsigned long __per_cpu_mca[NR_CPUS];
118 120
@@ -1184,6 +1186,49 @@ all_in:
1184 return; 1186 return;
1185} 1187}
1186 1188
1189/* mca_insert_tr
1190 *
1191 * Switch rid when TR reload and needed!
1192 * iord: 1: itr, 2: itr;
1193 *
1194*/
1195static void mca_insert_tr(u64 iord)
1196{
1197
1198 int i;
1199 u64 old_rr;
1200 struct ia64_tr_entry *p;
1201 unsigned long psr;
1202 int cpu = smp_processor_id();
1203
1204 psr = ia64_clear_ic();
1205 for (i = IA64_TR_ALLOC_BASE; i < IA64_TR_ALLOC_MAX; i++) {
1206 p = &__per_cpu_idtrs[cpu][iord-1][i];
1207 if (p->pte & 0x1) {
1208 old_rr = ia64_get_rr(p->ifa);
1209 if (old_rr != p->rr) {
1210 ia64_set_rr(p->ifa, p->rr);
1211 ia64_srlz_d();
1212 }
1213 ia64_ptr(iord, p->ifa, p->itir >> 2);
1214 ia64_srlz_i();
1215 if (iord & 0x1) {
1216 ia64_itr(0x1, i, p->ifa, p->pte, p->itir >> 2);
1217 ia64_srlz_i();
1218 }
1219 if (iord & 0x2) {
1220 ia64_itr(0x2, i, p->ifa, p->pte, p->itir >> 2);
1221 ia64_srlz_i();
1222 }
1223 if (old_rr != p->rr) {
1224 ia64_set_rr(p->ifa, old_rr);
1225 ia64_srlz_d();
1226 }
1227 }
1228 }
1229 ia64_set_psr(psr);
1230}
1231
1187/* 1232/*
1188 * ia64_mca_handler 1233 * ia64_mca_handler
1189 * 1234 *
@@ -1270,6 +1315,11 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
1270 ia64_mlogbuf_finish(1); 1315 ia64_mlogbuf_finish(1);
1271 } 1316 }
1272 1317
1318 if (__get_cpu_var(ia64_mca_tr_reload)) {
1319 mca_insert_tr(0x1); /*Reload dynamic itrs*/
1320 mca_insert_tr(0x2); /*Reload dynamic itrs*/
1321 }
1322
1273 if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, (long)&nd, 0, recover) 1323 if (notify_die(DIE_MCA_MONARCH_LEAVE, "MCA", regs, (long)&nd, 0, recover)
1274 == NOTIFY_STOP) 1324 == NOTIFY_STOP)
1275 ia64_mca_spin(__func__); 1325 ia64_mca_spin(__func__);
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index 8bc7d259e0c6..a06d46548ff9 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -219,8 +219,13 @@ ia64_reload_tr:
219 mov r20=IA64_TR_CURRENT_STACK 219 mov r20=IA64_TR_CURRENT_STACK
220 ;; 220 ;;
221 itr.d dtr[r20]=r16 221 itr.d dtr[r20]=r16
222 GET_THIS_PADDR(r2, ia64_mca_tr_reload)
223 mov r18 = 1
222 ;; 224 ;;
223 srlz.d 225 srlz.d
226 ;;
227 st8 [r2] =r18
228 ;;
224 229
225done_tlb_purge_and_reload: 230done_tlb_purge_and_reload:
226 231
diff --git a/arch/ia64/kernel/minstate.h b/arch/ia64/kernel/minstate.h
index c9ac8bada786..7c548ac52bbc 100644
--- a/arch/ia64/kernel/minstate.h
+++ b/arch/ia64/kernel/minstate.h
@@ -3,6 +3,18 @@
3 3
4#include "entry.h" 4#include "entry.h"
5 5
6#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7/* read ar.itc in advance, and use it before leaving bank 0 */
8#define ACCOUNT_GET_STAMP \
9(pUStk) mov.m r20=ar.itc;
10#define ACCOUNT_SYS_ENTER \
11(pUStk) br.call.spnt rp=account_sys_enter \
12 ;;
13#else
14#define ACCOUNT_GET_STAMP
15#define ACCOUNT_SYS_ENTER
16#endif
17
6/* 18/*
7 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves 19 * DO_SAVE_MIN switches to the kernel stacks (if necessary) and saves
8 * the minimum state necessary that allows us to turn psr.ic back 20 * the minimum state necessary that allows us to turn psr.ic back
@@ -122,11 +134,13 @@
122 ;; \ 134 ;; \
123.mem.offset 0,0; st8.spill [r16]=r2,16; \ 135.mem.offset 0,0; st8.spill [r16]=r2,16; \
124.mem.offset 8,0; st8.spill [r17]=r3,16; \ 136.mem.offset 8,0; st8.spill [r17]=r3,16; \
137 ACCOUNT_GET_STAMP \
125 adds r2=IA64_PT_REGS_R16_OFFSET,r1; \ 138 adds r2=IA64_PT_REGS_R16_OFFSET,r1; \
126 ;; \ 139 ;; \
127 EXTRA; \ 140 EXTRA; \
128 movl r1=__gp; /* establish kernel global pointer */ \ 141 movl r1=__gp; /* establish kernel global pointer */ \
129 ;; \ 142 ;; \
143 ACCOUNT_SYS_ENTER \
130 bsw.1; /* switch back to bank 1 (must be last in insn group) */ \ 144 bsw.1; /* switch back to bank 1 (must be last in insn group) */ \
131 ;; 145 ;;
132 146
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index a78b45f5fe2f..c93420c97409 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -73,7 +73,7 @@ void __init build_cpu_to_node_map(void)
73 for(node=0; node < MAX_NUMNODES; node++) 73 for(node=0; node < MAX_NUMNODES; node++)
74 cpus_clear(node_to_cpu_mask[node]); 74 cpus_clear(node_to_cpu_mask[node]);
75 75
76 for(cpu = 0; cpu < NR_CPUS; ++cpu) { 76 for_each_possible_early_cpu(cpu) {
77 node = -1; 77 node = -1;
78 for (i = 0; i < NR_CPUS; ++i) 78 for (i = 0; i < NR_CPUS; ++i)
79 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) { 79 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index 2cb9425e0421..e0dca8743dbb 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -135,10 +135,10 @@ ia64_patch_mckinley_e9 (unsigned long start, unsigned long end)
135 135
136 while (offp < (s32 *) end) { 136 while (offp < (s32 *) end) {
137 wp = (u64 *) ia64_imva((char *) offp + *offp); 137 wp = (u64 *) ia64_imva((char *) offp + *offp);
138 wp[0] = 0x0000000100000000UL; /* nop.m 0; nop.i 0; nop.i 0 */ 138 wp[0] = 0x0000000100000011UL; /* nop.m 0; nop.i 0; br.ret.sptk.many b6 */
139 wp[1] = 0x0004000000000200UL; 139 wp[1] = 0x0084006880000200UL;
140 wp[2] = 0x0000000100000011UL; /* nop.m 0; nop.i 0; br.ret.sptk.many b6 */ 140 wp[2] = 0x0000000100000000UL; /* nop.m 0; nop.i 0; nop.i 0 */
141 wp[3] = 0x0084006880000200UL; 141 wp[3] = 0x0004000000000200UL;
142 ia64_fc(wp); ia64_fc(wp + 2); 142 ia64_fc(wp); ia64_fc(wp + 2);
143 ++offp; 143 ++offp;
144 } 144 }
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 49937a383b23..a5ea817cbcbf 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -625,21 +625,6 @@ do_dump_fpu (struct unw_frame_info *info, void *arg)
625 do_dump_task_fpu(current, info, arg); 625 do_dump_task_fpu(current, info, arg);
626} 626}
627 627
628int
629dump_task_regs(struct task_struct *task, elf_gregset_t *regs)
630{
631 struct unw_frame_info tcore_info;
632
633 if (current == task) {
634 unw_init_running(do_copy_regs, regs);
635 } else {
636 memset(&tcore_info, 0, sizeof(tcore_info));
637 unw_init_from_blocked_task(&tcore_info, task);
638 do_copy_task_regs(task, &tcore_info, regs);
639 }
640 return 1;
641}
642
643void 628void
644ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst) 629ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst)
645{ 630{
@@ -647,21 +632,6 @@ ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst)
647} 632}
648 633
649int 634int
650dump_task_fpu (struct task_struct *task, elf_fpregset_t *dst)
651{
652 struct unw_frame_info tcore_info;
653
654 if (current == task) {
655 unw_init_running(do_dump_fpu, dst);
656 } else {
657 memset(&tcore_info, 0, sizeof(tcore_info));
658 unw_init_from_blocked_task(&tcore_info, task);
659 do_dump_task_fpu(task, &tcore_info, dst);
660 }
661 return 1;
662}
663
664int
665dump_fpu (struct pt_regs *pt, elf_fpregset_t dst) 635dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
666{ 636{
667 unw_init_running(do_dump_fpu, dst); 637 unw_init_running(do_dump_fpu, dst);
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index ab784ec4319d..2a9943b5947f 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -3,6 +3,9 @@
3 * 3 *
4 * Copyright (C) 1999-2005 Hewlett-Packard Co 4 * Copyright (C) 1999-2005 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com> 5 * David Mosberger-Tang <davidm@hpl.hp.com>
6 * Copyright (C) 2006 Intel Co
7 * 2006-08-12 - IA64 Native Utrace implementation support added by
8 * Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
6 * 9 *
7 * Derived from the x86 and Alpha versions. 10 * Derived from the x86 and Alpha versions.
8 */ 11 */
@@ -17,6 +20,8 @@
17#include <linux/security.h> 20#include <linux/security.h>
18#include <linux/audit.h> 21#include <linux/audit.h>
19#include <linux/signal.h> 22#include <linux/signal.h>
23#include <linux/regset.h>
24#include <linux/elf.h>
20 25
21#include <asm/pgtable.h> 26#include <asm/pgtable.h>
22#include <asm/processor.h> 27#include <asm/processor.h>
@@ -740,25 +745,6 @@ ia64_sync_fph (struct task_struct *task)
740 psr->dfh = 1; 745 psr->dfh = 1;
741} 746}
742 747
743static int
744access_fr (struct unw_frame_info *info, int regnum, int hi,
745 unsigned long *data, int write_access)
746{
747 struct ia64_fpreg fpval;
748 int ret;
749
750 ret = unw_get_fr(info, regnum, &fpval);
751 if (ret < 0)
752 return ret;
753
754 if (write_access) {
755 fpval.u.bits[hi] = *data;
756 ret = unw_set_fr(info, regnum, fpval);
757 } else
758 *data = fpval.u.bits[hi];
759 return ret;
760}
761
762/* 748/*
763 * Change the machine-state of CHILD such that it will return via the normal 749 * Change the machine-state of CHILD such that it will return via the normal
764 * kernel exit-path, rather than the syscall-exit path. 750 * kernel exit-path, rather than the syscall-exit path.
@@ -860,309 +846,7 @@ access_nat_bits (struct task_struct *child, struct pt_regs *pt,
860 846
861static int 847static int
862access_uarea (struct task_struct *child, unsigned long addr, 848access_uarea (struct task_struct *child, unsigned long addr,
863 unsigned long *data, int write_access) 849 unsigned long *data, int write_access);
864{
865 unsigned long *ptr, regnum, urbs_end, cfm;
866 struct switch_stack *sw;
867 struct pt_regs *pt;
868# define pt_reg_addr(pt, reg) ((void *) \
869 ((unsigned long) (pt) \
870 + offsetof(struct pt_regs, reg)))
871
872
873 pt = task_pt_regs(child);
874 sw = (struct switch_stack *) (child->thread.ksp + 16);
875
876 if ((addr & 0x7) != 0) {
877 dprintk("ptrace: unaligned register address 0x%lx\n", addr);
878 return -1;
879 }
880
881 if (addr < PT_F127 + 16) {
882 /* accessing fph */
883 if (write_access)
884 ia64_sync_fph(child);
885 else
886 ia64_flush_fph(child);
887 ptr = (unsigned long *)
888 ((unsigned long) &child->thread.fph + addr);
889 } else if ((addr >= PT_F10) && (addr < PT_F11 + 16)) {
890 /* scratch registers untouched by kernel (saved in pt_regs) */
891 ptr = pt_reg_addr(pt, f10) + (addr - PT_F10);
892 } else if (addr >= PT_F12 && addr < PT_F15 + 16) {
893 /*
894 * Scratch registers untouched by kernel (saved in
895 * switch_stack).
896 */
897 ptr = (unsigned long *) ((long) sw
898 + (addr - PT_NAT_BITS - 32));
899 } else if (addr < PT_AR_LC + 8) {
900 /* preserved state: */
901 struct unw_frame_info info;
902 char nat = 0;
903 int ret;
904
905 unw_init_from_blocked_task(&info, child);
906 if (unw_unwind_to_user(&info) < 0)
907 return -1;
908
909 switch (addr) {
910 case PT_NAT_BITS:
911 return access_nat_bits(child, pt, &info,
912 data, write_access);
913
914 case PT_R4: case PT_R5: case PT_R6: case PT_R7:
915 if (write_access) {
916 /* read NaT bit first: */
917 unsigned long dummy;
918
919 ret = unw_get_gr(&info, (addr - PT_R4)/8 + 4,
920 &dummy, &nat);
921 if (ret < 0)
922 return ret;
923 }
924 return unw_access_gr(&info, (addr - PT_R4)/8 + 4, data,
925 &nat, write_access);
926
927 case PT_B1: case PT_B2: case PT_B3:
928 case PT_B4: case PT_B5:
929 return unw_access_br(&info, (addr - PT_B1)/8 + 1, data,
930 write_access);
931
932 case PT_AR_EC:
933 return unw_access_ar(&info, UNW_AR_EC, data,
934 write_access);
935
936 case PT_AR_LC:
937 return unw_access_ar(&info, UNW_AR_LC, data,
938 write_access);
939
940 default:
941 if (addr >= PT_F2 && addr < PT_F5 + 16)
942 return access_fr(&info, (addr - PT_F2)/16 + 2,
943 (addr & 8) != 0, data,
944 write_access);
945 else if (addr >= PT_F16 && addr < PT_F31 + 16)
946 return access_fr(&info,
947 (addr - PT_F16)/16 + 16,
948 (addr & 8) != 0,
949 data, write_access);
950 else {
951 dprintk("ptrace: rejecting access to register "
952 "address 0x%lx\n", addr);
953 return -1;
954 }
955 }
956 } else if (addr < PT_F9+16) {
957 /* scratch state */
958 switch (addr) {
959 case PT_AR_BSP:
960 /*
961 * By convention, we use PT_AR_BSP to refer to
962 * the end of the user-level backing store.
963 * Use ia64_rse_skip_regs(PT_AR_BSP, -CFM.sof)
964 * to get the real value of ar.bsp at the time
965 * the kernel was entered.
966 *
967 * Furthermore, when changing the contents of
968 * PT_AR_BSP (or PT_CFM) while the task is
969 * blocked in a system call, convert the state
970 * so that the non-system-call exit
971 * path is used. This ensures that the proper
972 * state will be picked up when resuming
973 * execution. However, it *also* means that
974 * once we write PT_AR_BSP/PT_CFM, it won't be
975 * possible to modify the syscall arguments of
976 * the pending system call any longer. This
977 * shouldn't be an issue because modifying
978 * PT_AR_BSP/PT_CFM generally implies that
979 * we're either abandoning the pending system
980 * call or that we defer it's re-execution
981 * (e.g., due to GDB doing an inferior
982 * function call).
983 */
984 urbs_end = ia64_get_user_rbs_end(child, pt, &cfm);
985 if (write_access) {
986 if (*data != urbs_end) {
987 if (in_syscall(pt))
988 convert_to_non_syscall(child,
989 pt,
990 cfm);
991 /*
992 * Simulate user-level write
993 * of ar.bsp:
994 */
995 pt->loadrs = 0;
996 pt->ar_bspstore = *data;
997 }
998 } else
999 *data = urbs_end;
1000 return 0;
1001
1002 case PT_CFM:
1003 urbs_end = ia64_get_user_rbs_end(child, pt, &cfm);
1004 if (write_access) {
1005 if (((cfm ^ *data) & PFM_MASK) != 0) {
1006 if (in_syscall(pt))
1007 convert_to_non_syscall(child,
1008 pt,
1009 cfm);
1010 pt->cr_ifs = ((pt->cr_ifs & ~PFM_MASK)
1011 | (*data & PFM_MASK));
1012 }
1013 } else
1014 *data = cfm;
1015 return 0;
1016
1017 case PT_CR_IPSR:
1018 if (write_access) {
1019 unsigned long tmp = *data;
1020 /* psr.ri==3 is a reserved value: SDM 2:25 */
1021 if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
1022 tmp &= ~IA64_PSR_RI;
1023 pt->cr_ipsr = ((tmp & IPSR_MASK)
1024 | (pt->cr_ipsr & ~IPSR_MASK));
1025 } else
1026 *data = (pt->cr_ipsr & IPSR_MASK);
1027 return 0;
1028
1029 case PT_AR_RSC:
1030 if (write_access)
1031 pt->ar_rsc = *data | (3 << 2); /* force PL3 */
1032 else
1033 *data = pt->ar_rsc;
1034 return 0;
1035
1036 case PT_AR_RNAT:
1037 ptr = pt_reg_addr(pt, ar_rnat);
1038 break;
1039 case PT_R1:
1040 ptr = pt_reg_addr(pt, r1);
1041 break;
1042 case PT_R2: case PT_R3:
1043 ptr = pt_reg_addr(pt, r2) + (addr - PT_R2);
1044 break;
1045 case PT_R8: case PT_R9: case PT_R10: case PT_R11:
1046 ptr = pt_reg_addr(pt, r8) + (addr - PT_R8);
1047 break;
1048 case PT_R12: case PT_R13:
1049 ptr = pt_reg_addr(pt, r12) + (addr - PT_R12);
1050 break;
1051 case PT_R14:
1052 ptr = pt_reg_addr(pt, r14);
1053 break;
1054 case PT_R15:
1055 ptr = pt_reg_addr(pt, r15);
1056 break;
1057 case PT_R16: case PT_R17: case PT_R18: case PT_R19:
1058 case PT_R20: case PT_R21: case PT_R22: case PT_R23:
1059 case PT_R24: case PT_R25: case PT_R26: case PT_R27:
1060 case PT_R28: case PT_R29: case PT_R30: case PT_R31:
1061 ptr = pt_reg_addr(pt, r16) + (addr - PT_R16);
1062 break;
1063 case PT_B0:
1064 ptr = pt_reg_addr(pt, b0);
1065 break;
1066 case PT_B6:
1067 ptr = pt_reg_addr(pt, b6);
1068 break;
1069 case PT_B7:
1070 ptr = pt_reg_addr(pt, b7);
1071 break;
1072 case PT_F6: case PT_F6+8: case PT_F7: case PT_F7+8:
1073 case PT_F8: case PT_F8+8: case PT_F9: case PT_F9+8:
1074 ptr = pt_reg_addr(pt, f6) + (addr - PT_F6);
1075 break;
1076 case PT_AR_BSPSTORE:
1077 ptr = pt_reg_addr(pt, ar_bspstore);
1078 break;
1079 case PT_AR_UNAT:
1080 ptr = pt_reg_addr(pt, ar_unat);
1081 break;
1082 case PT_AR_PFS:
1083 ptr = pt_reg_addr(pt, ar_pfs);
1084 break;
1085 case PT_AR_CCV:
1086 ptr = pt_reg_addr(pt, ar_ccv);
1087 break;
1088 case PT_AR_FPSR:
1089 ptr = pt_reg_addr(pt, ar_fpsr);
1090 break;
1091 case PT_CR_IIP:
1092 ptr = pt_reg_addr(pt, cr_iip);
1093 break;
1094 case PT_PR:
1095 ptr = pt_reg_addr(pt, pr);
1096 break;
1097 /* scratch register */
1098
1099 default:
1100 /* disallow accessing anything else... */
1101 dprintk("ptrace: rejecting access to register "
1102 "address 0x%lx\n", addr);
1103 return -1;
1104 }
1105 } else if (addr <= PT_AR_SSD) {
1106 ptr = pt_reg_addr(pt, ar_csd) + (addr - PT_AR_CSD);
1107 } else {
1108 /* access debug registers */
1109
1110 if (addr >= PT_IBR) {
1111 regnum = (addr - PT_IBR) >> 3;
1112 ptr = &child->thread.ibr[0];
1113 } else {
1114 regnum = (addr - PT_DBR) >> 3;
1115 ptr = &child->thread.dbr[0];
1116 }
1117
1118 if (regnum >= 8) {
1119 dprintk("ptrace: rejecting access to register "
1120 "address 0x%lx\n", addr);
1121 return -1;
1122 }
1123#ifdef CONFIG_PERFMON
1124 /*
1125 * Check if debug registers are used by perfmon. This
1126 * test must be done once we know that we can do the
1127 * operation, i.e. the arguments are all valid, but
1128 * before we start modifying the state.
1129 *
1130 * Perfmon needs to keep a count of how many processes
1131 * are trying to modify the debug registers for system
1132 * wide monitoring sessions.
1133 *
1134 * We also include read access here, because they may
1135 * cause the PMU-installed debug register state
1136 * (dbr[], ibr[]) to be reset. The two arrays are also
1137 * used by perfmon, but we do not use
1138 * IA64_THREAD_DBG_VALID. The registers are restored
1139 * by the PMU context switch code.
1140 */
1141 if (pfm_use_debug_registers(child)) return -1;
1142#endif
1143
1144 if (!(child->thread.flags & IA64_THREAD_DBG_VALID)) {
1145 child->thread.flags |= IA64_THREAD_DBG_VALID;
1146 memset(child->thread.dbr, 0,
1147 sizeof(child->thread.dbr));
1148 memset(child->thread.ibr, 0,
1149 sizeof(child->thread.ibr));
1150 }
1151
1152 ptr += regnum;
1153
1154 if ((regnum & 1) && write_access) {
1155 /* don't let the user set kernel-level breakpoints: */
1156 *ptr = *data & ~(7UL << 56);
1157 return 0;
1158 }
1159 }
1160 if (write_access)
1161 *ptr = *data;
1162 else
1163 *data = *ptr;
1164 return 0;
1165}
1166 850
1167static long 851static long
1168ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) 852ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
@@ -1626,3 +1310,892 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
1626 if (test_thread_flag(TIF_RESTORE_RSE)) 1310 if (test_thread_flag(TIF_RESTORE_RSE))
1627 ia64_sync_krbs(); 1311 ia64_sync_krbs();
1628} 1312}
1313
1314/* Utrace implementation starts here */
1315struct regset_get {
1316 void *kbuf;
1317 void __user *ubuf;
1318};
1319
1320struct regset_set {
1321 const void *kbuf;
1322 const void __user *ubuf;
1323};
1324
1325struct regset_getset {
1326 struct task_struct *target;
1327 const struct user_regset *regset;
1328 union {
1329 struct regset_get get;
1330 struct regset_set set;
1331 } u;
1332 unsigned int pos;
1333 unsigned int count;
1334 int ret;
1335};
1336
1337static int
1338access_elf_gpreg(struct task_struct *target, struct unw_frame_info *info,
1339 unsigned long addr, unsigned long *data, int write_access)
1340{
1341 struct pt_regs *pt;
1342 unsigned long *ptr = NULL;
1343 int ret;
1344 char nat = 0;
1345
1346 pt = task_pt_regs(target);
1347 switch (addr) {
1348 case ELF_GR_OFFSET(1):
1349 ptr = &pt->r1;
1350 break;
1351 case ELF_GR_OFFSET(2):
1352 case ELF_GR_OFFSET(3):
1353 ptr = (void *)&pt->r2 + (addr - ELF_GR_OFFSET(2));
1354 break;
1355 case ELF_GR_OFFSET(4) ... ELF_GR_OFFSET(7):
1356 if (write_access) {
1357 /* read NaT bit first: */
1358 unsigned long dummy;
1359
1360 ret = unw_get_gr(info, addr/8, &dummy, &nat);
1361 if (ret < 0)
1362 return ret;
1363 }
1364 return unw_access_gr(info, addr/8, data, &nat, write_access);
1365 case ELF_GR_OFFSET(8) ... ELF_GR_OFFSET(11):
1366 ptr = (void *)&pt->r8 + addr - ELF_GR_OFFSET(8);
1367 break;
1368 case ELF_GR_OFFSET(12):
1369 case ELF_GR_OFFSET(13):
1370 ptr = (void *)&pt->r12 + addr - ELF_GR_OFFSET(12);
1371 break;
1372 case ELF_GR_OFFSET(14):
1373 ptr = &pt->r14;
1374 break;
1375 case ELF_GR_OFFSET(15):
1376 ptr = &pt->r15;
1377 }
1378 if (write_access)
1379 *ptr = *data;
1380 else
1381 *data = *ptr;
1382 return 0;
1383}
1384
1385static int
1386access_elf_breg(struct task_struct *target, struct unw_frame_info *info,
1387 unsigned long addr, unsigned long *data, int write_access)
1388{
1389 struct pt_regs *pt;
1390 unsigned long *ptr = NULL;
1391
1392 pt = task_pt_regs(target);
1393 switch (addr) {
1394 case ELF_BR_OFFSET(0):
1395 ptr = &pt->b0;
1396 break;
1397 case ELF_BR_OFFSET(1) ... ELF_BR_OFFSET(5):
1398 return unw_access_br(info, (addr - ELF_BR_OFFSET(0))/8,
1399 data, write_access);
1400 case ELF_BR_OFFSET(6):
1401 ptr = &pt->b6;
1402 break;
1403 case ELF_BR_OFFSET(7):
1404 ptr = &pt->b7;
1405 }
1406 if (write_access)
1407 *ptr = *data;
1408 else
1409 *data = *ptr;
1410 return 0;
1411}
1412
1413static int
1414access_elf_areg(struct task_struct *target, struct unw_frame_info *info,
1415 unsigned long addr, unsigned long *data, int write_access)
1416{
1417 struct pt_regs *pt;
1418 unsigned long cfm, urbs_end;
1419 unsigned long *ptr = NULL;
1420
1421 pt = task_pt_regs(target);
1422 if (addr >= ELF_AR_RSC_OFFSET && addr <= ELF_AR_SSD_OFFSET) {
1423 switch (addr) {
1424 case ELF_AR_RSC_OFFSET:
1425 /* force PL3 */
1426 if (write_access)
1427 pt->ar_rsc = *data | (3 << 2);
1428 else
1429 *data = pt->ar_rsc;
1430 return 0;
1431 case ELF_AR_BSP_OFFSET:
1432 /*
1433 * By convention, we use PT_AR_BSP to refer to
1434 * the end of the user-level backing store.
1435 * Use ia64_rse_skip_regs(PT_AR_BSP, -CFM.sof)
1436 * to get the real value of ar.bsp at the time
1437 * the kernel was entered.
1438 *
1439 * Furthermore, when changing the contents of
1440 * PT_AR_BSP (or PT_CFM) while the task is
1441 * blocked in a system call, convert the state
1442 * so that the non-system-call exit
1443 * path is used. This ensures that the proper
1444 * state will be picked up when resuming
1445 * execution. However, it *also* means that
1446 * once we write PT_AR_BSP/PT_CFM, it won't be
1447 * possible to modify the syscall arguments of
1448 * the pending system call any longer. This
1449 * shouldn't be an issue because modifying
1450 * PT_AR_BSP/PT_CFM generally implies that
1451 * we're either abandoning the pending system
1452 * call or that we defer it's re-execution
1453 * (e.g., due to GDB doing an inferior
1454 * function call).
1455 */
1456 urbs_end = ia64_get_user_rbs_end(target, pt, &cfm);
1457 if (write_access) {
1458 if (*data != urbs_end) {
1459 if (in_syscall(pt))
1460 convert_to_non_syscall(target,
1461 pt,
1462 cfm);
1463 /*
1464 * Simulate user-level write
1465 * of ar.bsp:
1466 */
1467 pt->loadrs = 0;
1468 pt->ar_bspstore = *data;
1469 }
1470 } else
1471 *data = urbs_end;
1472 return 0;
1473 case ELF_AR_BSPSTORE_OFFSET:
1474 ptr = &pt->ar_bspstore;
1475 break;
1476 case ELF_AR_RNAT_OFFSET:
1477 ptr = &pt->ar_rnat;
1478 break;
1479 case ELF_AR_CCV_OFFSET:
1480 ptr = &pt->ar_ccv;
1481 break;
1482 case ELF_AR_UNAT_OFFSET:
1483 ptr = &pt->ar_unat;
1484 break;
1485 case ELF_AR_FPSR_OFFSET:
1486 ptr = &pt->ar_fpsr;
1487 break;
1488 case ELF_AR_PFS_OFFSET:
1489 ptr = &pt->ar_pfs;
1490 break;
1491 case ELF_AR_LC_OFFSET:
1492 return unw_access_ar(info, UNW_AR_LC, data,
1493 write_access);
1494 case ELF_AR_EC_OFFSET:
1495 return unw_access_ar(info, UNW_AR_EC, data,
1496 write_access);
1497 case ELF_AR_CSD_OFFSET:
1498 ptr = &pt->ar_csd;
1499 break;
1500 case ELF_AR_SSD_OFFSET:
1501 ptr = &pt->ar_ssd;
1502 }
1503 } else if (addr >= ELF_CR_IIP_OFFSET && addr <= ELF_CR_IPSR_OFFSET) {
1504 switch (addr) {
1505 case ELF_CR_IIP_OFFSET:
1506 ptr = &pt->cr_iip;
1507 break;
1508 case ELF_CFM_OFFSET:
1509 urbs_end = ia64_get_user_rbs_end(target, pt, &cfm);
1510 if (write_access) {
1511 if (((cfm ^ *data) & PFM_MASK) != 0) {
1512 if (in_syscall(pt))
1513 convert_to_non_syscall(target,
1514 pt,
1515 cfm);
1516 pt->cr_ifs = ((pt->cr_ifs & ~PFM_MASK)
1517 | (*data & PFM_MASK));
1518 }
1519 } else
1520 *data = cfm;
1521 return 0;
1522 case ELF_CR_IPSR_OFFSET:
1523 if (write_access) {
1524 unsigned long tmp = *data;
1525 /* psr.ri==3 is a reserved value: SDM 2:25 */
1526 if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
1527 tmp &= ~IA64_PSR_RI;
1528 pt->cr_ipsr = ((tmp & IPSR_MASK)
1529 | (pt->cr_ipsr & ~IPSR_MASK));
1530 } else
1531 *data = (pt->cr_ipsr & IPSR_MASK);
1532 return 0;
1533 }
1534 } else if (addr == ELF_NAT_OFFSET)
1535 return access_nat_bits(target, pt, info,
1536 data, write_access);
1537 else if (addr == ELF_PR_OFFSET)
1538 ptr = &pt->pr;
1539 else
1540 return -1;
1541
1542 if (write_access)
1543 *ptr = *data;
1544 else
1545 *data = *ptr;
1546
1547 return 0;
1548}
1549
1550static int
1551access_elf_reg(struct task_struct *target, struct unw_frame_info *info,
1552 unsigned long addr, unsigned long *data, int write_access)
1553{
1554 if (addr >= ELF_GR_OFFSET(1) && addr <= ELF_GR_OFFSET(15))
1555 return access_elf_gpreg(target, info, addr, data, write_access);
1556 else if (addr >= ELF_BR_OFFSET(0) && addr <= ELF_BR_OFFSET(7))
1557 return access_elf_breg(target, info, addr, data, write_access);
1558 else
1559 return access_elf_areg(target, info, addr, data, write_access);
1560}
1561
1562void do_gpregs_get(struct unw_frame_info *info, void *arg)
1563{
1564 struct pt_regs *pt;
1565 struct regset_getset *dst = arg;
1566 elf_greg_t tmp[16];
1567 unsigned int i, index, min_copy;
1568
1569 if (unw_unwind_to_user(info) < 0)
1570 return;
1571
1572 /*
1573 * coredump format:
1574 * r0-r31
1575 * NaT bits (for r0-r31; bit N == 1 iff rN is a NaT)
1576 * predicate registers (p0-p63)
1577 * b0-b7
1578 * ip cfm user-mask
1579 * ar.rsc ar.bsp ar.bspstore ar.rnat
1580 * ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec
1581 */
1582
1583
1584 /* Skip r0 */
1585 if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(1)) {
1586 dst->ret = user_regset_copyout_zero(&dst->pos, &dst->count,
1587 &dst->u.get.kbuf,
1588 &dst->u.get.ubuf,
1589 0, ELF_GR_OFFSET(1));
1590 if (dst->ret || dst->count == 0)
1591 return;
1592 }
1593
1594 /* gr1 - gr15 */
1595 if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(16)) {
1596 index = (dst->pos - ELF_GR_OFFSET(1)) / sizeof(elf_greg_t);
1597 min_copy = ELF_GR_OFFSET(16) > (dst->pos + dst->count) ?
1598 (dst->pos + dst->count) : ELF_GR_OFFSET(16);
1599 for (i = dst->pos; i < min_copy; i += sizeof(elf_greg_t),
1600 index++)
1601 if (access_elf_reg(dst->target, info, i,
1602 &tmp[index], 0) < 0) {
1603 dst->ret = -EIO;
1604 return;
1605 }
1606 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1607 &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1608 ELF_GR_OFFSET(1), ELF_GR_OFFSET(16));
1609 if (dst->ret || dst->count == 0)
1610 return;
1611 }
1612
1613 /* r16-r31 */
1614 if (dst->count > 0 && dst->pos < ELF_NAT_OFFSET) {
1615 pt = task_pt_regs(dst->target);
1616 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1617 &dst->u.get.kbuf, &dst->u.get.ubuf, &pt->r16,
1618 ELF_GR_OFFSET(16), ELF_NAT_OFFSET);
1619 if (dst->ret || dst->count == 0)
1620 return;
1621 }
1622
1623 /* nat, pr, b0 - b7 */
1624 if (dst->count > 0 && dst->pos < ELF_CR_IIP_OFFSET) {
1625 index = (dst->pos - ELF_NAT_OFFSET) / sizeof(elf_greg_t);
1626 min_copy = ELF_CR_IIP_OFFSET > (dst->pos + dst->count) ?
1627 (dst->pos + dst->count) : ELF_CR_IIP_OFFSET;
1628 for (i = dst->pos; i < min_copy; i += sizeof(elf_greg_t),
1629 index++)
1630 if (access_elf_reg(dst->target, info, i,
1631 &tmp[index], 0) < 0) {
1632 dst->ret = -EIO;
1633 return;
1634 }
1635 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1636 &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1637 ELF_NAT_OFFSET, ELF_CR_IIP_OFFSET);
1638 if (dst->ret || dst->count == 0)
1639 return;
1640 }
1641
1642 /* ip cfm psr ar.rsc ar.bsp ar.bspstore ar.rnat
1643 * ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec ar.csd ar.ssd
1644 */
1645 if (dst->count > 0 && dst->pos < (ELF_AR_END_OFFSET)) {
1646 index = (dst->pos - ELF_CR_IIP_OFFSET) / sizeof(elf_greg_t);
1647 min_copy = ELF_AR_END_OFFSET > (dst->pos + dst->count) ?
1648 (dst->pos + dst->count) : ELF_AR_END_OFFSET;
1649 for (i = dst->pos; i < min_copy; i += sizeof(elf_greg_t),
1650 index++)
1651 if (access_elf_reg(dst->target, info, i,
1652 &tmp[index], 0) < 0) {
1653 dst->ret = -EIO;
1654 return;
1655 }
1656 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1657 &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1658 ELF_CR_IIP_OFFSET, ELF_AR_END_OFFSET);
1659 }
1660}
1661
1662void do_gpregs_set(struct unw_frame_info *info, void *arg)
1663{
1664 struct pt_regs *pt;
1665 struct regset_getset *dst = arg;
1666 elf_greg_t tmp[16];
1667 unsigned int i, index;
1668
1669 if (unw_unwind_to_user(info) < 0)
1670 return;
1671
1672 /* Skip r0 */
1673 if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(1)) {
1674 dst->ret = user_regset_copyin_ignore(&dst->pos, &dst->count,
1675 &dst->u.set.kbuf,
1676 &dst->u.set.ubuf,
1677 0, ELF_GR_OFFSET(1));
1678 if (dst->ret || dst->count == 0)
1679 return;
1680 }
1681
1682 /* gr1-gr15 */
1683 if (dst->count > 0 && dst->pos < ELF_GR_OFFSET(16)) {
1684 i = dst->pos;
1685 index = (dst->pos - ELF_GR_OFFSET(1)) / sizeof(elf_greg_t);
1686 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1687 &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1688 ELF_GR_OFFSET(1), ELF_GR_OFFSET(16));
1689 if (dst->ret)
1690 return;
1691 for ( ; i < dst->pos; i += sizeof(elf_greg_t), index++)
1692 if (access_elf_reg(dst->target, info, i,
1693 &tmp[index], 1) < 0) {
1694 dst->ret = -EIO;
1695 return;
1696 }
1697 if (dst->count == 0)
1698 return;
1699 }
1700
1701 /* gr16-gr31 */
1702 if (dst->count > 0 && dst->pos < ELF_NAT_OFFSET) {
1703 pt = task_pt_regs(dst->target);
1704 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1705 &dst->u.set.kbuf, &dst->u.set.ubuf, &pt->r16,
1706 ELF_GR_OFFSET(16), ELF_NAT_OFFSET);
1707 if (dst->ret || dst->count == 0)
1708 return;
1709 }
1710
1711 /* nat, pr, b0 - b7 */
1712 if (dst->count > 0 && dst->pos < ELF_CR_IIP_OFFSET) {
1713 i = dst->pos;
1714 index = (dst->pos - ELF_NAT_OFFSET) / sizeof(elf_greg_t);
1715 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1716 &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1717 ELF_NAT_OFFSET, ELF_CR_IIP_OFFSET);
1718 if (dst->ret)
1719 return;
1720 for (; i < dst->pos; i += sizeof(elf_greg_t), index++)
1721 if (access_elf_reg(dst->target, info, i,
1722 &tmp[index], 1) < 0) {
1723 dst->ret = -EIO;
1724 return;
1725 }
1726 if (dst->count == 0)
1727 return;
1728 }
1729
1730 /* ip cfm psr ar.rsc ar.bsp ar.bspstore ar.rnat
1731 * ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec ar.csd ar.ssd
1732 */
1733 if (dst->count > 0 && dst->pos < (ELF_AR_END_OFFSET)) {
1734 i = dst->pos;
1735 index = (dst->pos - ELF_CR_IIP_OFFSET) / sizeof(elf_greg_t);
1736 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1737 &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1738 ELF_CR_IIP_OFFSET, ELF_AR_END_OFFSET);
1739 if (dst->ret)
1740 return;
1741 for ( ; i < dst->pos; i += sizeof(elf_greg_t), index++)
1742 if (access_elf_reg(dst->target, info, i,
1743 &tmp[index], 1) < 0) {
1744 dst->ret = -EIO;
1745 return;
1746 }
1747 }
1748}
1749
1750#define ELF_FP_OFFSET(i) (i * sizeof(elf_fpreg_t))
1751
1752void do_fpregs_get(struct unw_frame_info *info, void *arg)
1753{
1754 struct regset_getset *dst = arg;
1755 struct task_struct *task = dst->target;
1756 elf_fpreg_t tmp[30];
1757 int index, min_copy, i;
1758
1759 if (unw_unwind_to_user(info) < 0)
1760 return;
1761
1762 /* Skip pos 0 and 1 */
1763 if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(2)) {
1764 dst->ret = user_regset_copyout_zero(&dst->pos, &dst->count,
1765 &dst->u.get.kbuf,
1766 &dst->u.get.ubuf,
1767 0, ELF_FP_OFFSET(2));
1768 if (dst->count == 0 || dst->ret)
1769 return;
1770 }
1771
1772 /* fr2-fr31 */
1773 if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(32)) {
1774 index = (dst->pos - ELF_FP_OFFSET(2)) / sizeof(elf_fpreg_t);
1775
1776 min_copy = min(((unsigned int)ELF_FP_OFFSET(32)),
1777 dst->pos + dst->count);
1778 for (i = dst->pos; i < min_copy; i += sizeof(elf_fpreg_t),
1779 index++)
1780 if (unw_get_fr(info, i / sizeof(elf_fpreg_t),
1781 &tmp[index])) {
1782 dst->ret = -EIO;
1783 return;
1784 }
1785 dst->ret = user_regset_copyout(&dst->pos, &dst->count,
1786 &dst->u.get.kbuf, &dst->u.get.ubuf, tmp,
1787 ELF_FP_OFFSET(2), ELF_FP_OFFSET(32));
1788 if (dst->count == 0 || dst->ret)
1789 return;
1790 }
1791
1792 /* fph */
1793 if (dst->count > 0) {
1794 ia64_flush_fph(dst->target);
1795 if (task->thread.flags & IA64_THREAD_FPH_VALID)
1796 dst->ret = user_regset_copyout(
1797 &dst->pos, &dst->count,
1798 &dst->u.get.kbuf, &dst->u.get.ubuf,
1799 &dst->target->thread.fph,
1800 ELF_FP_OFFSET(32), -1);
1801 else
1802 /* Zero fill instead. */
1803 dst->ret = user_regset_copyout_zero(
1804 &dst->pos, &dst->count,
1805 &dst->u.get.kbuf, &dst->u.get.ubuf,
1806 ELF_FP_OFFSET(32), -1);
1807 }
1808}
1809
1810void do_fpregs_set(struct unw_frame_info *info, void *arg)
1811{
1812 struct regset_getset *dst = arg;
1813 elf_fpreg_t fpreg, tmp[30];
1814 int index, start, end;
1815
1816 if (unw_unwind_to_user(info) < 0)
1817 return;
1818
1819 /* Skip pos 0 and 1 */
1820 if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(2)) {
1821 dst->ret = user_regset_copyin_ignore(&dst->pos, &dst->count,
1822 &dst->u.set.kbuf,
1823 &dst->u.set.ubuf,
1824 0, ELF_FP_OFFSET(2));
1825 if (dst->count == 0 || dst->ret)
1826 return;
1827 }
1828
1829 /* fr2-fr31 */
1830 if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(32)) {
1831 start = dst->pos;
1832 end = min(((unsigned int)ELF_FP_OFFSET(32)),
1833 dst->pos + dst->count);
1834 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1835 &dst->u.set.kbuf, &dst->u.set.ubuf, tmp,
1836 ELF_FP_OFFSET(2), ELF_FP_OFFSET(32));
1837 if (dst->ret)
1838 return;
1839
1840 if (start & 0xF) { /* only write high part */
1841 if (unw_get_fr(info, start / sizeof(elf_fpreg_t),
1842 &fpreg)) {
1843 dst->ret = -EIO;
1844 return;
1845 }
1846 tmp[start / sizeof(elf_fpreg_t) - 2].u.bits[0]
1847 = fpreg.u.bits[0];
1848 start &= ~0xFUL;
1849 }
1850 if (end & 0xF) { /* only write low part */
1851 if (unw_get_fr(info, end / sizeof(elf_fpreg_t),
1852 &fpreg)) {
1853 dst->ret = -EIO;
1854 return;
1855 }
1856 tmp[end / sizeof(elf_fpreg_t) - 2].u.bits[1]
1857 = fpreg.u.bits[1];
1858 end = (end + 0xF) & ~0xFUL;
1859 }
1860
1861 for ( ; start < end ; start += sizeof(elf_fpreg_t)) {
1862 index = start / sizeof(elf_fpreg_t);
1863 if (unw_set_fr(info, index, tmp[index - 2])) {
1864 dst->ret = -EIO;
1865 return;
1866 }
1867 }
1868 if (dst->ret || dst->count == 0)
1869 return;
1870 }
1871
1872 /* fph */
1873 if (dst->count > 0 && dst->pos < ELF_FP_OFFSET(128)) {
1874 ia64_sync_fph(dst->target);
1875 dst->ret = user_regset_copyin(&dst->pos, &dst->count,
1876 &dst->u.set.kbuf,
1877 &dst->u.set.ubuf,
1878 &dst->target->thread.fph,
1879 ELF_FP_OFFSET(32), -1);
1880 }
1881}
1882
1883static int
1884do_regset_call(void (*call)(struct unw_frame_info *, void *),
1885 struct task_struct *target,
1886 const struct user_regset *regset,
1887 unsigned int pos, unsigned int count,
1888 const void *kbuf, const void __user *ubuf)
1889{
1890 struct regset_getset info = { .target = target, .regset = regset,
1891 .pos = pos, .count = count,
1892 .u.set = { .kbuf = kbuf, .ubuf = ubuf },
1893 .ret = 0 };
1894
1895 if (target == current)
1896 unw_init_running(call, &info);
1897 else {
1898 struct unw_frame_info ufi;
1899 memset(&ufi, 0, sizeof(ufi));
1900 unw_init_from_blocked_task(&ufi, target);
1901 (*call)(&ufi, &info);
1902 }
1903
1904 return info.ret;
1905}
1906
1907static int
1908gpregs_get(struct task_struct *target,
1909 const struct user_regset *regset,
1910 unsigned int pos, unsigned int count,
1911 void *kbuf, void __user *ubuf)
1912{
1913 return do_regset_call(do_gpregs_get, target, regset, pos, count,
1914 kbuf, ubuf);
1915}
1916
1917static int gpregs_set(struct task_struct *target,
1918 const struct user_regset *regset,
1919 unsigned int pos, unsigned int count,
1920 const void *kbuf, const void __user *ubuf)
1921{
1922 return do_regset_call(do_gpregs_set, target, regset, pos, count,
1923 kbuf, ubuf);
1924}
1925
1926static void do_gpregs_writeback(struct unw_frame_info *info, void *arg)
1927{
1928 do_sync_rbs(info, ia64_sync_user_rbs);
1929}
1930
1931/*
1932 * This is called to write back the register backing store.
1933 * ptrace does this before it stops, so that a tracer reading the user
1934 * memory after the thread stops will get the current register data.
1935 */
1936static int
1937gpregs_writeback(struct task_struct *target,
1938 const struct user_regset *regset,
1939 int now)
1940{
1941 if (test_and_set_tsk_thread_flag(target, TIF_RESTORE_RSE))
1942 return 0;
1943 tsk_set_notify_resume(target);
1944 return do_regset_call(do_gpregs_writeback, target, regset, 0, 0,
1945 NULL, NULL);
1946}
1947
1948static int
1949fpregs_active(struct task_struct *target, const struct user_regset *regset)
1950{
1951 return (target->thread.flags & IA64_THREAD_FPH_VALID) ? 128 : 32;
1952}
1953
1954static int fpregs_get(struct task_struct *target,
1955 const struct user_regset *regset,
1956 unsigned int pos, unsigned int count,
1957 void *kbuf, void __user *ubuf)
1958{
1959 return do_regset_call(do_fpregs_get, target, regset, pos, count,
1960 kbuf, ubuf);
1961}
1962
1963static int fpregs_set(struct task_struct *target,
1964 const struct user_regset *regset,
1965 unsigned int pos, unsigned int count,
1966 const void *kbuf, const void __user *ubuf)
1967{
1968 return do_regset_call(do_fpregs_set, target, regset, pos, count,
1969 kbuf, ubuf);
1970}
1971
1972static int
1973access_uarea(struct task_struct *child, unsigned long addr,
1974 unsigned long *data, int write_access)
1975{
1976 unsigned int pos = -1; /* an invalid value */
1977 int ret;
1978 unsigned long *ptr, regnum;
1979
1980 if ((addr & 0x7) != 0) {
1981 dprintk("ptrace: unaligned register address 0x%lx\n", addr);
1982 return -1;
1983 }
1984 if ((addr >= PT_NAT_BITS + 8 && addr < PT_F2) ||
1985 (addr >= PT_R7 + 8 && addr < PT_B1) ||
1986 (addr >= PT_AR_LC + 8 && addr < PT_CR_IPSR) ||
1987 (addr >= PT_AR_SSD + 8 && addr < PT_DBR)) {
1988 dprintk("ptrace: rejecting access to register "
1989 "address 0x%lx\n", addr);
1990 return -1;
1991 }
1992
1993 switch (addr) {
1994 case PT_F32 ... (PT_F127 + 15):
1995 pos = addr - PT_F32 + ELF_FP_OFFSET(32);
1996 break;
1997 case PT_F2 ... (PT_F5 + 15):
1998 pos = addr - PT_F2 + ELF_FP_OFFSET(2);
1999 break;
2000 case PT_F10 ... (PT_F31 + 15):
2001 pos = addr - PT_F10 + ELF_FP_OFFSET(10);
2002 break;
2003 case PT_F6 ... (PT_F9 + 15):
2004 pos = addr - PT_F6 + ELF_FP_OFFSET(6);
2005 break;
2006 }
2007
2008 if (pos != -1) {
2009 if (write_access)
2010 ret = fpregs_set(child, NULL, pos,
2011 sizeof(unsigned long), data, NULL);
2012 else
2013 ret = fpregs_get(child, NULL, pos,
2014 sizeof(unsigned long), data, NULL);
2015 if (ret != 0)
2016 return -1;
2017 return 0;
2018 }
2019
2020 switch (addr) {
2021 case PT_NAT_BITS:
2022 pos = ELF_NAT_OFFSET;
2023 break;
2024 case PT_R4 ... PT_R7:
2025 pos = addr - PT_R4 + ELF_GR_OFFSET(4);
2026 break;
2027 case PT_B1 ... PT_B5:
2028 pos = addr - PT_B1 + ELF_BR_OFFSET(1);
2029 break;
2030 case PT_AR_EC:
2031 pos = ELF_AR_EC_OFFSET;
2032 break;
2033 case PT_AR_LC:
2034 pos = ELF_AR_LC_OFFSET;
2035 break;
2036 case PT_CR_IPSR:
2037 pos = ELF_CR_IPSR_OFFSET;
2038 break;
2039 case PT_CR_IIP:
2040 pos = ELF_CR_IIP_OFFSET;
2041 break;
2042 case PT_CFM:
2043 pos = ELF_CFM_OFFSET;
2044 break;
2045 case PT_AR_UNAT:
2046 pos = ELF_AR_UNAT_OFFSET;
2047 break;
2048 case PT_AR_PFS:
2049 pos = ELF_AR_PFS_OFFSET;
2050 break;
2051 case PT_AR_RSC:
2052 pos = ELF_AR_RSC_OFFSET;
2053 break;
2054 case PT_AR_RNAT:
2055 pos = ELF_AR_RNAT_OFFSET;
2056 break;
2057 case PT_AR_BSPSTORE:
2058 pos = ELF_AR_BSPSTORE_OFFSET;
2059 break;
2060 case PT_PR:
2061 pos = ELF_PR_OFFSET;
2062 break;
2063 case PT_B6:
2064 pos = ELF_BR_OFFSET(6);
2065 break;
2066 case PT_AR_BSP:
2067 pos = ELF_AR_BSP_OFFSET;
2068 break;
2069 case PT_R1 ... PT_R3:
2070 pos = addr - PT_R1 + ELF_GR_OFFSET(1);
2071 break;
2072 case PT_R12 ... PT_R15:
2073 pos = addr - PT_R12 + ELF_GR_OFFSET(12);
2074 break;
2075 case PT_R8 ... PT_R11:
2076 pos = addr - PT_R8 + ELF_GR_OFFSET(8);
2077 break;
2078 case PT_R16 ... PT_R31:
2079 pos = addr - PT_R16 + ELF_GR_OFFSET(16);
2080 break;
2081 case PT_AR_CCV:
2082 pos = ELF_AR_CCV_OFFSET;
2083 break;
2084 case PT_AR_FPSR:
2085 pos = ELF_AR_FPSR_OFFSET;
2086 break;
2087 case PT_B0:
2088 pos = ELF_BR_OFFSET(0);
2089 break;
2090 case PT_B7:
2091 pos = ELF_BR_OFFSET(7);
2092 break;
2093 case PT_AR_CSD:
2094 pos = ELF_AR_CSD_OFFSET;
2095 break;
2096 case PT_AR_SSD:
2097 pos = ELF_AR_SSD_OFFSET;
2098 break;
2099 }
2100
2101 if (pos != -1) {
2102 if (write_access)
2103 ret = gpregs_set(child, NULL, pos,
2104 sizeof(unsigned long), data, NULL);
2105 else
2106 ret = gpregs_get(child, NULL, pos,
2107 sizeof(unsigned long), data, NULL);
2108 if (ret != 0)
2109 return -1;
2110 return 0;
2111 }
2112
2113 /* access debug registers */
2114 if (addr >= PT_IBR) {
2115 regnum = (addr - PT_IBR) >> 3;
2116 ptr = &child->thread.ibr[0];
2117 } else {
2118 regnum = (addr - PT_DBR) >> 3;
2119 ptr = &child->thread.dbr[0];
2120 }
2121
2122 if (regnum >= 8) {
2123 dprintk("ptrace: rejecting access to register "
2124 "address 0x%lx\n", addr);
2125 return -1;
2126 }
2127#ifdef CONFIG_PERFMON
2128 /*
2129 * Check if debug registers are used by perfmon. This
2130 * test must be done once we know that we can do the
2131 * operation, i.e. the arguments are all valid, but
2132 * before we start modifying the state.
2133 *
2134 * Perfmon needs to keep a count of how many processes
2135 * are trying to modify the debug registers for system
2136 * wide monitoring sessions.
2137 *
2138 * We also include read access here, because they may
2139 * cause the PMU-installed debug register state
2140 * (dbr[], ibr[]) to be reset. The two arrays are also
2141 * used by perfmon, but we do not use
2142 * IA64_THREAD_DBG_VALID. The registers are restored
2143 * by the PMU context switch code.
2144 */
2145 if (pfm_use_debug_registers(child))
2146 return -1;
2147#endif
2148
2149 if (!(child->thread.flags & IA64_THREAD_DBG_VALID)) {
2150 child->thread.flags |= IA64_THREAD_DBG_VALID;
2151 memset(child->thread.dbr, 0,
2152 sizeof(child->thread.dbr));
2153 memset(child->thread.ibr, 0,
2154 sizeof(child->thread.ibr));
2155 }
2156
2157 ptr += regnum;
2158
2159 if ((regnum & 1) && write_access) {
2160 /* don't let the user set kernel-level breakpoints: */
2161 *ptr = *data & ~(7UL << 56);
2162 return 0;
2163 }
2164 if (write_access)
2165 *ptr = *data;
2166 else
2167 *data = *ptr;
2168 return 0;
2169}
2170
2171static const struct user_regset native_regsets[] = {
2172 {
2173 .core_note_type = NT_PRSTATUS,
2174 .n = ELF_NGREG,
2175 .size = sizeof(elf_greg_t), .align = sizeof(elf_greg_t),
2176 .get = gpregs_get, .set = gpregs_set,
2177 .writeback = gpregs_writeback
2178 },
2179 {
2180 .core_note_type = NT_PRFPREG,
2181 .n = ELF_NFPREG,
2182 .size = sizeof(elf_fpreg_t), .align = sizeof(elf_fpreg_t),
2183 .get = fpregs_get, .set = fpregs_set, .active = fpregs_active
2184 },
2185};
2186
2187static const struct user_regset_view user_ia64_view = {
2188 .name = "ia64",
2189 .e_machine = EM_IA_64,
2190 .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
2191};
2192
2193const struct user_regset_view *task_user_regset_view(struct task_struct *tsk)
2194{
2195#ifdef CONFIG_IA32_SUPPORT
2196 extern const struct user_regset_view user_ia32_view;
2197 if (IS_IA32_PROCESS(task_pt_regs(tsk)))
2198 return &user_ia32_view;
2199#endif
2200 return &user_ia64_view;
2201}
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c85b7dd6ef33..5015ca1275ca 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -59,6 +59,7 @@
59#include <asm/setup.h> 59#include <asm/setup.h>
60#include <asm/smp.h> 60#include <asm/smp.h>
61#include <asm/system.h> 61#include <asm/system.h>
62#include <asm/tlbflush.h>
62#include <asm/unistd.h> 63#include <asm/unistd.h>
63#include <asm/hpsim.h> 64#include <asm/hpsim.h>
64 65
@@ -516,6 +517,8 @@ setup_arch (char **cmdline_p)
516 acpi_table_init(); 517 acpi_table_init();
517# ifdef CONFIG_ACPI_NUMA 518# ifdef CONFIG_ACPI_NUMA
518 acpi_numa_init(); 519 acpi_numa_init();
520 per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ?
521 32 : cpus_weight(early_cpu_possible_map)), additional_cpus);
519# endif 522# endif
520#else 523#else
521# ifdef CONFIG_SMP 524# ifdef CONFIG_SMP
@@ -969,9 +972,10 @@ cpu_init (void)
969#endif 972#endif
970 973
971 /* set ia64_ctx.max_rid to the maximum RID that is supported by all CPUs: */ 974 /* set ia64_ctx.max_rid to the maximum RID that is supported by all CPUs: */
972 if (ia64_pal_vm_summary(NULL, &vmi) == 0) 975 if (ia64_pal_vm_summary(NULL, &vmi) == 0) {
973 max_ctx = (1U << (vmi.pal_vm_info_2_s.rid_size - 3)) - 1; 976 max_ctx = (1U << (vmi.pal_vm_info_2_s.rid_size - 3)) - 1;
974 else { 977 setup_ptcg_sem(vmi.pal_vm_info_2_s.max_purges, NPTCG_FROM_PAL);
978 } else {
975 printk(KERN_WARNING "cpu_init: PAL VM summary failed, assuming 18 RID bits\n"); 979 printk(KERN_WARNING "cpu_init: PAL VM summary failed, assuming 18 RID bits\n");
976 max_ctx = (1U << 15) - 1; /* use architected minimum */ 980 max_ctx = (1U << 15) - 1; /* use architected minimum */
977 } 981 }
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 4e446aa5f4ac..9a9d4c489330 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -213,6 +213,19 @@ send_IPI_allbutself (int op)
213 * Called with preemption disabled. 213 * Called with preemption disabled.
214 */ 214 */
215static inline void 215static inline void
216send_IPI_mask(cpumask_t mask, int op)
217{
218 unsigned int cpu;
219
220 for_each_cpu_mask(cpu, mask) {
221 send_IPI_single(cpu, op);
222 }
223}
224
225/*
226 * Called with preemption disabled.
227 */
228static inline void
216send_IPI_all (int op) 229send_IPI_all (int op)
217{ 230{
218 int i; 231 int i;
@@ -401,6 +414,75 @@ smp_call_function_single (int cpuid, void (*func) (void *info), void *info, int
401} 414}
402EXPORT_SYMBOL(smp_call_function_single); 415EXPORT_SYMBOL(smp_call_function_single);
403 416
417/**
418 * smp_call_function_mask(): Run a function on a set of other CPUs.
419 * <mask> The set of cpus to run on. Must not include the current cpu.
420 * <func> The function to run. This must be fast and non-blocking.
421 * <info> An arbitrary pointer to pass to the function.
422 * <wait> If true, wait (atomically) until function
423 * has completed on other CPUs.
424 *
425 * Returns 0 on success, else a negative status code.
426 *
427 * If @wait is true, then returns once @func has returned; otherwise
428 * it returns just before the target cpu calls @func.
429 *
430 * You must not call this function with disabled interrupts or from a
431 * hardware interrupt handler or from a bottom half handler.
432 */
433int smp_call_function_mask(cpumask_t mask,
434 void (*func)(void *), void *info,
435 int wait)
436{
437 struct call_data_struct data;
438 cpumask_t allbutself;
439 int cpus;
440
441 spin_lock(&call_lock);
442 allbutself = cpu_online_map;
443 cpu_clear(smp_processor_id(), allbutself);
444
445 cpus_and(mask, mask, allbutself);
446 cpus = cpus_weight(mask);
447 if (!cpus) {
448 spin_unlock(&call_lock);
449 return 0;
450 }
451
452 /* Can deadlock when called with interrupts disabled */
453 WARN_ON(irqs_disabled());
454
455 data.func = func;
456 data.info = info;
457 atomic_set(&data.started, 0);
458 data.wait = wait;
459 if (wait)
460 atomic_set(&data.finished, 0);
461
462 call_data = &data;
463 mb(); /* ensure store to call_data precedes setting of IPI_CALL_FUNC*/
464
465 /* Send a message to other CPUs */
466 if (cpus_equal(mask, allbutself))
467 send_IPI_allbutself(IPI_CALL_FUNC);
468 else
469 send_IPI_mask(mask, IPI_CALL_FUNC);
470
471 /* Wait for response */
472 while (atomic_read(&data.started) != cpus)
473 cpu_relax();
474
475 if (wait)
476 while (atomic_read(&data.finished) != cpus)
477 cpu_relax();
478 call_data = NULL;
479
480 spin_unlock(&call_lock);
481 return 0;
482
483}
484EXPORT_SYMBOL(smp_call_function_mask);
485
404/* 486/*
405 * this function sends a 'generic call function' IPI to all other CPUs 487 * this function sends a 'generic call function' IPI to all other CPUs
406 * in the system. 488 * in the system.
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 17fda5293c67..48e15a51782f 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -59,6 +59,84 @@ static struct clocksource clocksource_itc = {
59}; 59};
60static struct clocksource *itc_clocksource; 60static struct clocksource *itc_clocksource;
61 61
62#ifdef CONFIG_VIRT_CPU_ACCOUNTING
63
64#include <linux/kernel_stat.h>
65
66extern cputime_t cycle_to_cputime(u64 cyc);
67
68/*
69 * Called from the context switch with interrupts disabled, to charge all
70 * accumulated times to the current process, and to prepare accounting on
71 * the next process.
72 */
73void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)
74{
75 struct thread_info *pi = task_thread_info(prev);
76 struct thread_info *ni = task_thread_info(next);
77 cputime_t delta_stime, delta_utime;
78 __u64 now;
79
80 now = ia64_get_itc();
81
82 delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp));
83 account_system_time(prev, 0, delta_stime);
84 account_system_time_scaled(prev, delta_stime);
85
86 if (pi->ac_utime) {
87 delta_utime = cycle_to_cputime(pi->ac_utime);
88 account_user_time(prev, delta_utime);
89 account_user_time_scaled(prev, delta_utime);
90 }
91
92 pi->ac_stamp = ni->ac_stamp = now;
93 ni->ac_stime = ni->ac_utime = 0;
94}
95
96/*
97 * Account time for a transition between system, hard irq or soft irq state.
98 * Note that this function is called with interrupts enabled.
99 */
100void account_system_vtime(struct task_struct *tsk)
101{
102 struct thread_info *ti = task_thread_info(tsk);
103 unsigned long flags;
104 cputime_t delta_stime;
105 __u64 now;
106
107 local_irq_save(flags);
108
109 now = ia64_get_itc();
110
111 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp));
112 account_system_time(tsk, 0, delta_stime);
113 account_system_time_scaled(tsk, delta_stime);
114 ti->ac_stime = 0;
115
116 ti->ac_stamp = now;
117
118 local_irq_restore(flags);
119}
120
121/*
122 * Called from the timer interrupt handler to charge accumulated user time
123 * to the current process. Must be called with interrupts disabled.
124 */
125void account_process_tick(struct task_struct *p, int user_tick)
126{
127 struct thread_info *ti = task_thread_info(p);
128 cputime_t delta_utime;
129
130 if (ti->ac_utime) {
131 delta_utime = cycle_to_cputime(ti->ac_utime);
132 account_user_time(p, delta_utime);
133 account_user_time_scaled(p, delta_utime);
134 ti->ac_utime = 0;
135 }
136}
137
138#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
139
62static irqreturn_t 140static irqreturn_t
63timer_interrupt (int irq, void *dev_id) 141timer_interrupt (int irq, void *dev_id)
64{ 142{
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 96d5fbfa44a4..544dc420c65e 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -104,7 +104,7 @@ static int __meminit early_nr_cpus_node(int node)
104{ 104{
105 int cpu, n = 0; 105 int cpu, n = 0;
106 106
107 for (cpu = 0; cpu < NR_CPUS; cpu++) 107 for_each_possible_early_cpu(cpu)
108 if (node == node_cpuid[cpu].nid) 108 if (node == node_cpuid[cpu].nid)
109 n++; 109 n++;
110 110
@@ -124,6 +124,7 @@ static unsigned long __meminit compute_pernodesize(int node)
124 pernodesize += node * L1_CACHE_BYTES; 124 pernodesize += node * L1_CACHE_BYTES;
125 pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t)); 125 pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
126 pernodesize += L1_CACHE_ALIGN(sizeof(struct ia64_node_data)); 126 pernodesize += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
127 pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
127 pernodesize = PAGE_ALIGN(pernodesize); 128 pernodesize = PAGE_ALIGN(pernodesize);
128 return pernodesize; 129 return pernodesize;
129} 130}
@@ -142,7 +143,7 @@ static void *per_cpu_node_setup(void *cpu_data, int node)
142#ifdef CONFIG_SMP 143#ifdef CONFIG_SMP
143 int cpu; 144 int cpu;
144 145
145 for (cpu = 0; cpu < NR_CPUS; cpu++) { 146 for_each_possible_early_cpu(cpu) {
146 if (node == node_cpuid[cpu].nid) { 147 if (node == node_cpuid[cpu].nid) {
147 memcpy(__va(cpu_data), __phys_per_cpu_start, 148 memcpy(__va(cpu_data), __phys_per_cpu_start,
148 __per_cpu_end - __per_cpu_start); 149 __per_cpu_end - __per_cpu_start);
@@ -345,7 +346,7 @@ static void __init initialize_pernode_data(void)
345 346
346#ifdef CONFIG_SMP 347#ifdef CONFIG_SMP
347 /* Set the node_data pointer for each per-cpu struct */ 348 /* Set the node_data pointer for each per-cpu struct */
348 for (cpu = 0; cpu < NR_CPUS; cpu++) { 349 for_each_possible_early_cpu(cpu) {
349 node = node_cpuid[cpu].nid; 350 node = node_cpuid[cpu].nid;
350 per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data; 351 per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data;
351 } 352 }
@@ -493,13 +494,9 @@ void __cpuinit *per_cpu_init(void)
493 int cpu; 494 int cpu;
494 static int first_time = 1; 495 static int first_time = 1;
495 496
496
497 if (smp_processor_id() != 0)
498 return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
499
500 if (first_time) { 497 if (first_time) {
501 first_time = 0; 498 first_time = 0;
502 for (cpu = 0; cpu < NR_CPUS; cpu++) 499 for_each_possible_early_cpu(cpu)
503 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu]; 500 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
504 } 501 }
505 502
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 7807fc5c0422..b73bf1838e57 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -27,7 +27,9 @@
27 */ 27 */
28int num_node_memblks; 28int num_node_memblks;
29struct node_memblk_s node_memblk[NR_NODE_MEMBLKS]; 29struct node_memblk_s node_memblk[NR_NODE_MEMBLKS];
30struct node_cpuid_s node_cpuid[NR_CPUS]; 30struct node_cpuid_s node_cpuid[NR_CPUS] =
31 { [0 ... NR_CPUS-1] = { .phys_id = 0, .nid = NUMA_NO_NODE } };
32
31/* 33/*
32 * This is a matrix with "distances" between nodes, they should be 34 * This is a matrix with "distances" between nodes, they should be
33 * proportional to the memory access latency ratios. 35 * proportional to the memory access latency ratios.
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 655da240d13c..d52ec4e83409 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -11,6 +11,9 @@
11 * Rohit Seth <rohit.seth@intel.com> 11 * Rohit Seth <rohit.seth@intel.com>
12 * Ken Chen <kenneth.w.chen@intel.com> 12 * Ken Chen <kenneth.w.chen@intel.com>
13 * Christophe de Dinechin <ddd@hp.com>: Avoid ptc.e on memory allocation 13 * Christophe de Dinechin <ddd@hp.com>: Avoid ptc.e on memory allocation
14 * Copyright (C) 2007 Intel Corp
15 * Fenghua Yu <fenghua.yu@intel.com>
16 * Add multiple ptc.g/ptc.ga instruction support in global tlb purge.
14 */ 17 */
15#include <linux/module.h> 18#include <linux/module.h>
16#include <linux/init.h> 19#include <linux/init.h>
@@ -26,6 +29,9 @@
26#include <asm/pal.h> 29#include <asm/pal.h>
27#include <asm/tlbflush.h> 30#include <asm/tlbflush.h>
28#include <asm/dma.h> 31#include <asm/dma.h>
32#include <asm/processor.h>
33#include <asm/sal.h>
34#include <asm/tlb.h>
29 35
30static struct { 36static struct {
31 unsigned long mask; /* mask of supported purge page-sizes */ 37 unsigned long mask; /* mask of supported purge page-sizes */
@@ -39,6 +45,10 @@ struct ia64_ctx ia64_ctx = {
39}; 45};
40 46
41DEFINE_PER_CPU(u8, ia64_need_tlb_flush); 47DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
48DEFINE_PER_CPU(u8, ia64_tr_num); /*Number of TR slots in current processor*/
49DEFINE_PER_CPU(u8, ia64_tr_used); /*Max Slot number used by kernel*/
50
51struct ia64_tr_entry __per_cpu_idtrs[NR_CPUS][2][IA64_TR_ALLOC_MAX];
42 52
43/* 53/*
44 * Initializes the ia64_ctx.bitmap array based on max_ctx+1. 54 * Initializes the ia64_ctx.bitmap array based on max_ctx+1.
@@ -84,14 +94,140 @@ wrap_mmu_context (struct mm_struct *mm)
84 local_flush_tlb_all(); 94 local_flush_tlb_all();
85} 95}
86 96
97/*
98 * Implement "spinaphores" ... like counting semaphores, but they
99 * spin instead of sleeping. If there are ever any other users for
100 * this primitive it can be moved up to a spinaphore.h header.
101 */
102struct spinaphore {
103 atomic_t cur;
104};
105
106static inline void spinaphore_init(struct spinaphore *ss, int val)
107{
108 atomic_set(&ss->cur, val);
109}
110
111static inline void down_spin(struct spinaphore *ss)
112{
113 while (unlikely(!atomic_add_unless(&ss->cur, -1, 0)))
114 while (atomic_read(&ss->cur) == 0)
115 cpu_relax();
116}
117
118static inline void up_spin(struct spinaphore *ss)
119{
120 atomic_add(1, &ss->cur);
121}
122
123static struct spinaphore ptcg_sem;
124static u16 nptcg = 1;
125static int need_ptcg_sem = 1;
126static int toolatetochangeptcgsem = 0;
127
128/*
129 * Kernel parameter "nptcg=" overrides max number of concurrent global TLB
130 * purges which is reported from either PAL or SAL PALO.
131 *
132 * We don't have sanity checking for nptcg value. It's the user's responsibility
133 * for valid nptcg value on the platform. Otherwise, kernel may hang in some
134 * cases.
135 */
136static int __init
137set_nptcg(char *str)
138{
139 int value = 0;
140
141 get_option(&str, &value);
142 setup_ptcg_sem(value, NPTCG_FROM_KERNEL_PARAMETER);
143
144 return 1;
145}
146
147__setup("nptcg=", set_nptcg);
148
149/*
150 * Maximum number of simultaneous ptc.g purges in the system can
151 * be defined by PAL_VM_SUMMARY (in which case we should take
152 * the smallest value for any cpu in the system) or by the PAL
153 * override table (in which case we should ignore the value from
154 * PAL_VM_SUMMARY).
155 *
156 * Kernel parameter "nptcg=" overrides maximum number of simultanesous ptc.g
157 * purges defined in either PAL_VM_SUMMARY or PAL override table. In this case,
158 * we should ignore the value from either PAL_VM_SUMMARY or PAL override table.
159 *
160 * Complicating the logic here is the fact that num_possible_cpus()
161 * isn't fully setup until we start bringing cpus online.
162 */
163void
164setup_ptcg_sem(int max_purges, int nptcg_from)
165{
166 static int kp_override;
167 static int palo_override;
168 static int firstcpu = 1;
169
170 if (toolatetochangeptcgsem) {
171 BUG_ON(max_purges < nptcg);
172 return;
173 }
174
175 if (nptcg_from == NPTCG_FROM_KERNEL_PARAMETER) {
176 kp_override = 1;
177 nptcg = max_purges;
178 goto resetsema;
179 }
180 if (kp_override) {
181 need_ptcg_sem = num_possible_cpus() > nptcg;
182 return;
183 }
184
185 if (nptcg_from == NPTCG_FROM_PALO) {
186 palo_override = 1;
187
188 /* In PALO max_purges == 0 really means it! */
189 if (max_purges == 0)
190 panic("Whoa! Platform does not support global TLB purges.\n");
191 nptcg = max_purges;
192 if (nptcg == PALO_MAX_TLB_PURGES) {
193 need_ptcg_sem = 0;
194 return;
195 }
196 goto resetsema;
197 }
198 if (palo_override) {
199 if (nptcg != PALO_MAX_TLB_PURGES)
200 need_ptcg_sem = (num_possible_cpus() > nptcg);
201 return;
202 }
203
204 /* In PAL_VM_SUMMARY max_purges == 0 actually means 1 */
205 if (max_purges == 0) max_purges = 1;
206
207 if (firstcpu) {
208 nptcg = max_purges;
209 firstcpu = 0;
210 }
211 if (max_purges < nptcg)
212 nptcg = max_purges;
213 if (nptcg == PAL_MAX_PURGES) {
214 need_ptcg_sem = 0;
215 return;
216 } else
217 need_ptcg_sem = (num_possible_cpus() > nptcg);
218
219resetsema:
220 spinaphore_init(&ptcg_sem, max_purges);
221}
222
87void 223void
88ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start, 224ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
89 unsigned long end, unsigned long nbits) 225 unsigned long end, unsigned long nbits)
90{ 226{
91 static DEFINE_SPINLOCK(ptcg_lock);
92
93 struct mm_struct *active_mm = current->active_mm; 227 struct mm_struct *active_mm = current->active_mm;
94 228
229 toolatetochangeptcgsem = 1;
230
95 if (mm != active_mm) { 231 if (mm != active_mm) {
96 /* Restore region IDs for mm */ 232 /* Restore region IDs for mm */
97 if (mm && active_mm) { 233 if (mm && active_mm) {
@@ -102,19 +238,20 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
102 } 238 }
103 } 239 }
104 240
105 /* HW requires global serialization of ptc.ga. */ 241 if (need_ptcg_sem)
106 spin_lock(&ptcg_lock); 242 down_spin(&ptcg_sem);
107 { 243
108 do { 244 do {
109 /* 245 /*
110 * Flush ALAT entries also. 246 * Flush ALAT entries also.
111 */ 247 */
112 ia64_ptcga(start, (nbits<<2)); 248 ia64_ptcga(start, (nbits << 2));
113 ia64_srlz_i(); 249 ia64_srlz_i();
114 start += (1UL << nbits); 250 start += (1UL << nbits);
115 } while (start < end); 251 } while (start < end);
116 } 252
117 spin_unlock(&ptcg_lock); 253 if (need_ptcg_sem)
254 up_spin(&ptcg_sem);
118 255
119 if (mm != active_mm) { 256 if (mm != active_mm) {
120 activate_context(active_mm); 257 activate_context(active_mm);
@@ -190,6 +327,9 @@ ia64_tlb_init (void)
190 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */ 327 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */
191 unsigned long tr_pgbits; 328 unsigned long tr_pgbits;
192 long status; 329 long status;
330 pal_vm_info_1_u_t vm_info_1;
331 pal_vm_info_2_u_t vm_info_2;
332 int cpu = smp_processor_id();
193 333
194 if ((status = ia64_pal_vm_page_size(&tr_pgbits, &purge.mask)) != 0) { 334 if ((status = ia64_pal_vm_page_size(&tr_pgbits, &purge.mask)) != 0) {
195 printk(KERN_ERR "PAL_VM_PAGE_SIZE failed with status=%ld; " 335 printk(KERN_ERR "PAL_VM_PAGE_SIZE failed with status=%ld; "
@@ -206,4 +346,191 @@ ia64_tlb_init (void)
206 local_cpu_data->ptce_stride[1] = ptce_info.stride[1]; 346 local_cpu_data->ptce_stride[1] = ptce_info.stride[1];
207 347
208 local_flush_tlb_all(); /* nuke left overs from bootstrapping... */ 348 local_flush_tlb_all(); /* nuke left overs from bootstrapping... */
349 status = ia64_pal_vm_summary(&vm_info_1, &vm_info_2);
350
351 if (status) {
352 printk(KERN_ERR "ia64_pal_vm_summary=%ld\n", status);
353 per_cpu(ia64_tr_num, cpu) = 8;
354 return;
355 }
356 per_cpu(ia64_tr_num, cpu) = vm_info_1.pal_vm_info_1_s.max_itr_entry+1;
357 if (per_cpu(ia64_tr_num, cpu) >
358 (vm_info_1.pal_vm_info_1_s.max_dtr_entry+1))
359 per_cpu(ia64_tr_num, cpu) =
360 vm_info_1.pal_vm_info_1_s.max_dtr_entry+1;
361 if (per_cpu(ia64_tr_num, cpu) > IA64_TR_ALLOC_MAX) {
362 per_cpu(ia64_tr_num, cpu) = IA64_TR_ALLOC_MAX;
363 printk(KERN_DEBUG "TR register number exceeds IA64_TR_ALLOC_MAX!"
364 "IA64_TR_ALLOC_MAX should be extended\n");
365 }
366}
367
368/*
369 * is_tr_overlap
370 *
371 * Check overlap with inserted TRs.
372 */
373static int is_tr_overlap(struct ia64_tr_entry *p, u64 va, u64 log_size)
374{
375 u64 tr_log_size;
376 u64 tr_end;
377 u64 va_rr = ia64_get_rr(va);
378 u64 va_rid = RR_TO_RID(va_rr);
379 u64 va_end = va + (1<<log_size) - 1;
380
381 if (va_rid != RR_TO_RID(p->rr))
382 return 0;
383 tr_log_size = (p->itir & 0xff) >> 2;
384 tr_end = p->ifa + (1<<tr_log_size) - 1;
385
386 if (va > tr_end || p->ifa > va_end)
387 return 0;
388 return 1;
389
390}
391
392/*
393 * ia64_insert_tr in virtual mode. Allocate a TR slot
394 *
395 * target_mask : 0x1 : itr, 0x2 : dtr, 0x3 : idtr
396 *
397 * va : virtual address.
398 * pte : pte entries inserted.
399 * log_size: range to be covered.
400 *
401 * Return value: <0 : error No.
402 *
403 * >=0 : slot number allocated for TR.
404 * Must be called with preemption disabled.
405 */
406int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size)
407{
408 int i, r;
409 unsigned long psr;
410 struct ia64_tr_entry *p;
411 int cpu = smp_processor_id();
412
413 r = -EINVAL;
414 /*Check overlap with existing TR entries*/
415 if (target_mask & 0x1) {
416 p = &__per_cpu_idtrs[cpu][0][0];
417 for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu);
418 i++, p++) {
419 if (p->pte & 0x1)
420 if (is_tr_overlap(p, va, log_size)) {
421 printk(KERN_DEBUG "Overlapped Entry"
422 "Inserted for TR Reigster!!\n");
423 goto out;
424 }
425 }
426 }
427 if (target_mask & 0x2) {
428 p = &__per_cpu_idtrs[cpu][1][0];
429 for (i = IA64_TR_ALLOC_BASE; i <= per_cpu(ia64_tr_used, cpu);
430 i++, p++) {
431 if (p->pte & 0x1)
432 if (is_tr_overlap(p, va, log_size)) {
433 printk(KERN_DEBUG "Overlapped Entry"
434 "Inserted for TR Reigster!!\n");
435 goto out;
436 }
437 }
438 }
439
440 for (i = IA64_TR_ALLOC_BASE; i < per_cpu(ia64_tr_num, cpu); i++) {
441 switch (target_mask & 0x3) {
442 case 1:
443 if (!(__per_cpu_idtrs[cpu][0][i].pte & 0x1))
444 goto found;
445 continue;
446 case 2:
447 if (!(__per_cpu_idtrs[cpu][1][i].pte & 0x1))
448 goto found;
449 continue;
450 case 3:
451 if (!(__per_cpu_idtrs[cpu][0][i].pte & 0x1) &&
452 !(__per_cpu_idtrs[cpu][1][i].pte & 0x1))
453 goto found;
454 continue;
455 default:
456 r = -EINVAL;
457 goto out;
458 }
459 }
460found:
461 if (i >= per_cpu(ia64_tr_num, cpu))
462 return -EBUSY;
463
464 /*Record tr info for mca hander use!*/
465 if (i > per_cpu(ia64_tr_used, cpu))
466 per_cpu(ia64_tr_used, cpu) = i;
467
468 psr = ia64_clear_ic();
469 if (target_mask & 0x1) {
470 ia64_itr(0x1, i, va, pte, log_size);
471 ia64_srlz_i();
472 p = &__per_cpu_idtrs[cpu][0][i];
473 p->ifa = va;
474 p->pte = pte;
475 p->itir = log_size << 2;
476 p->rr = ia64_get_rr(va);
477 }
478 if (target_mask & 0x2) {
479 ia64_itr(0x2, i, va, pte, log_size);
480 ia64_srlz_i();
481 p = &__per_cpu_idtrs[cpu][1][i];
482 p->ifa = va;
483 p->pte = pte;
484 p->itir = log_size << 2;
485 p->rr = ia64_get_rr(va);
486 }
487 ia64_set_psr(psr);
488 r = i;
489out:
490 return r;
491}
492EXPORT_SYMBOL_GPL(ia64_itr_entry);
493
494/*
495 * ia64_purge_tr
496 *
497 * target_mask: 0x1: purge itr, 0x2 : purge dtr, 0x3 purge idtr.
498 * slot: slot number to be freed.
499 *
500 * Must be called with preemption disabled.
501 */
502void ia64_ptr_entry(u64 target_mask, int slot)
503{
504 int cpu = smp_processor_id();
505 int i;
506 struct ia64_tr_entry *p;
507
508 if (slot < IA64_TR_ALLOC_BASE || slot >= per_cpu(ia64_tr_num, cpu))
509 return;
510
511 if (target_mask & 0x1) {
512 p = &__per_cpu_idtrs[cpu][0][slot];
513 if ((p->pte&0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) {
514 p->pte = 0;
515 ia64_ptr(0x1, p->ifa, p->itir>>2);
516 ia64_srlz_i();
517 }
518 }
519
520 if (target_mask & 0x2) {
521 p = &__per_cpu_idtrs[cpu][1][slot];
522 if ((p->pte & 0x1) && is_tr_overlap(p, p->ifa, p->itir>>2)) {
523 p->pte = 0;
524 ia64_ptr(0x2, p->ifa, p->itir>>2);
525 ia64_srlz_i();
526 }
527 }
528
529 for (i = per_cpu(ia64_tr_used, cpu); i >= IA64_TR_ALLOC_BASE; i--) {
530 if ((__per_cpu_idtrs[cpu][0][i].pte & 0x1) ||
531 (__per_cpu_idtrs[cpu][1][i].pte & 0x1))
532 break;
533 }
534 per_cpu(ia64_tr_used, cpu) = i;
209} 535}
536EXPORT_SYMBOL_GPL(ia64_ptr_entry);
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index e282c348dcde..53d0a8ee35d7 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -362,7 +362,12 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
362 info.name = name; 362 info.name = name;
363 acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window, 363 acpi_walk_resources(device->handle, METHOD_NAME__CRS, add_window,
364 &info); 364 &info);
365 365 /*
366 * See arch/x86/pci/acpi.c.
367 * The desired pci bus might already be scanned in a quirk. We
368 * should handle the case here, but it appears that IA64 hasn't
369 * such quirk. So we just ignore the case now.
370 */
366 pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller); 371 pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller);
367 if (pbus) 372 if (pbus)
368 pcibios_setup_root_windows(pbus, controller); 373 pcibios_setup_root_windows(pbus, controller);
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index 841904cdef4d..39d681265297 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -189,7 +189,7 @@ static struct resource au1200_lcd_resources[] = {
189static struct resource au1200_ide0_resources[] = { 189static struct resource au1200_ide0_resources[] = {
190 [0] = { 190 [0] = {
191 .start = AU1XXX_ATA_PHYS_ADDR, 191 .start = AU1XXX_ATA_PHYS_ADDR,
192 .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN, 192 .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN - 1,
193 .flags = IORESOURCE_MEM, 193 .flags = IORESOURCE_MEM,
194 }, 194 },
195 [1] = { 195 [1] = {
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 58fccc96d003..06213d1d6d95 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -534,7 +534,8 @@ insert_restart_trampoline(struct pt_regs *regs)
534 * Flushing one cacheline is cheap. 534 * Flushing one cacheline is cheap.
535 * "sync" on bigger (> 4 way) boxes is not. 535 * "sync" on bigger (> 4 way) boxes is not.
536 */ 536 */
537 flush_icache_range(regs->gr[30], regs->gr[30] + 4); 537 flush_user_dcache_range(regs->gr[30], regs->gr[30] + 4);
538 flush_user_icache_range(regs->gr[30], regs->gr[30] + 4);
538 539
539 regs->gr[31] = regs->gr[30] + 8; 540 regs->gr[31] = regs->gr[30] + 8;
540 /* Preserve original r28. */ 541 /* Preserve original r28. */
diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S
index a8399b013729..06ac31f3be88 100644
--- a/arch/sh/boot/compressed/head_32.S
+++ b/arch/sh/boot/compressed/head_32.S
@@ -7,7 +7,6 @@
7 7
8.text 8.text
9 9
10#include <linux/linkage.h>
11#include <asm/page.h> 10#include <asm/page.h>
12 11
13 .global startup 12 .global startup
diff --git a/arch/sh/boot/compressed/head_64.S b/arch/sh/boot/compressed/head_64.S
index 1d4ecbfc767c..f72c1989f5f2 100644
--- a/arch/sh/boot/compressed/head_64.S
+++ b/arch/sh/boot/compressed/head_64.S
@@ -13,7 +13,6 @@
13 * Modification for compressed loader: 13 * Modification for compressed loader:
14 * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com) 14 * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com)
15 */ 15 */
16#include <linux/linkage.h>
17#include <asm/cache.h> 16#include <asm/cache.h>
18#include <asm/cpu/mmu_context.h> 17#include <asm/cpu/mmu_context.h>
19#include <asm/cpu/registers.h> 18#include <asm/cpu/registers.h>
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index 046999b1d1af..0283d8133075 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -28,6 +28,7 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/mmu_context.h> 30#include <asm/mmu_context.h>
31#include <asm/fpu.h>
31 32
32struct task_struct *last_task_used_math = NULL; 33struct task_struct *last_task_used_math = NULL;
33 34
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index f6fbdfa6876d..d453c47dc522 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -33,6 +33,7 @@
33#include <asm/system.h> 33#include <asm/system.h>
34#include <asm/processor.h> 34#include <asm/processor.h>
35#include <asm/mmu_context.h> 35#include <asm/mmu_context.h>
36#include <asm/fpu.h>
36 37
37/* This mask defines the bits of the SR which the user is not allowed to 38/* This mask defines the bits of the SR which the user is not allowed to
38 change, which are everything except S, Q, M, PR, SZ, FR. */ 39 change, which are everything except S, Q, M, PR, SZ, FR. */
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index d80de3903271..45bb333fd9ec 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -149,3 +149,4 @@ EXPORT_SYMBOL(clear_page);
149EXPORT_SYMBOL(copy_page); 149EXPORT_SYMBOL(copy_page);
150EXPORT_SYMBOL(__clear_user); 150EXPORT_SYMBOL(__clear_user);
151EXPORT_SYMBOL(_ebss); 151EXPORT_SYMBOL(_ebss);
152EXPORT_SYMBOL(empty_zero_page);
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c
index dd38a683de65..b6410ce4bd1d 100644
--- a/arch/sh/kernel/sh_ksyms_64.c
+++ b/arch/sh/kernel/sh_ksyms_64.c
@@ -44,6 +44,7 @@ EXPORT_SYMBOL(__put_user_asm_l);
44EXPORT_SYMBOL(__get_user_asm_l); 44EXPORT_SYMBOL(__get_user_asm_l);
45EXPORT_SYMBOL(copy_page); 45EXPORT_SYMBOL(copy_page);
46EXPORT_SYMBOL(__copy_user); 46EXPORT_SYMBOL(__copy_user);
47EXPORT_SYMBOL(empty_zero_page);
47EXPORT_SYMBOL(memcpy); 48EXPORT_SYMBOL(memcpy);
48EXPORT_SYMBOL(__udelay); 49EXPORT_SYMBOL(__udelay);
49EXPORT_SYMBOL(__ndelay); 50EXPORT_SYMBOL(__ndelay);
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 80bde19d445b..552eb810cd85 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -26,6 +26,7 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/fpu.h>
29 30
30#define REG_RET 9 31#define REG_RET 9
31#define REG_ARG1 2 32#define REG_ARG1 2
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index baa4fa368dce..e08b3bfeb656 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -25,6 +25,7 @@
25#include <linux/limits.h> 25#include <linux/limits.h>
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/fpu.h>
28 29
29#ifdef CONFIG_SH_KGDB 30#ifdef CONFIG_SH_KGDB
30#include <asm/kgdb.h> 31#include <asm/kgdb.h>
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index 1b58a7499087..a85831cbf18b 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -30,6 +30,7 @@
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33#include <asm/fpu.h>
33 34
34#undef DEBUG_EXCEPTION 35#undef DEBUG_EXCEPTION
35#ifdef DEBUG_EXCEPTION 36#ifdef DEBUG_EXCEPTION
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 5b54f11f4e59..7f44ae69b29e 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -325,7 +325,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
325 const struct user_regset_view *view; 325 const struct user_regset_view *view;
326 int ret; 326 int ret;
327 327
328 view = task_user_regset_view(child); 328 view = task_user_regset_view(current);
329 329
330 switch(request) { 330 switch(request) {
331 case PTRACE_GETREGS: { 331 case PTRACE_GETREGS: {
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 7963595c77cc..e9fc0aa2da38 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -114,6 +114,85 @@ void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
114 preempt_enable(); 114 preempt_enable();
115} 115}
116 116
117static int get_from_target(struct task_struct *target, unsigned long uaddr,
118 void *kbuf, int len)
119{
120 if (target == current) {
121 if (copy_from_user(kbuf, (void __user *) uaddr, len))
122 return -EFAULT;
123 } else {
124 int len2 = access_process_vm(target, uaddr, kbuf, len, 0);
125 if (len2 != len)
126 return -EFAULT;
127 }
128 return 0;
129}
130
131static int set_to_target(struct task_struct *target, unsigned long uaddr,
132 void *kbuf, int len)
133{
134 if (target == current) {
135 if (copy_to_user((void __user *) uaddr, kbuf, len))
136 return -EFAULT;
137 } else {
138 int len2 = access_process_vm(target, uaddr, kbuf, len, 1);
139 if (len2 != len)
140 return -EFAULT;
141 }
142 return 0;
143}
144
145static int regwindow64_get(struct task_struct *target,
146 const struct pt_regs *regs,
147 struct reg_window *wbuf)
148{
149 unsigned long rw_addr = regs->u_regs[UREG_I6];
150
151 if (test_tsk_thread_flag(current, TIF_32BIT)) {
152 struct reg_window32 win32;
153 int i;
154
155 if (get_from_target(target, rw_addr, &win32, sizeof(win32)))
156 return -EFAULT;
157 for (i = 0; i < 8; i++)
158 wbuf->locals[i] = win32.locals[i];
159 for (i = 0; i < 8; i++)
160 wbuf->ins[i] = win32.ins[i];
161 } else {
162 rw_addr += STACK_BIAS;
163 if (get_from_target(target, rw_addr, wbuf, sizeof(*wbuf)))
164 return -EFAULT;
165 }
166
167 return 0;
168}
169
170static int regwindow64_set(struct task_struct *target,
171 const struct pt_regs *regs,
172 struct reg_window *wbuf)
173{
174 unsigned long rw_addr = regs->u_regs[UREG_I6];
175
176 if (test_tsk_thread_flag(current, TIF_32BIT)) {
177 struct reg_window32 win32;
178 int i;
179
180 for (i = 0; i < 8; i++)
181 win32.locals[i] = wbuf->locals[i];
182 for (i = 0; i < 8; i++)
183 win32.ins[i] = wbuf->ins[i];
184
185 if (set_to_target(target, rw_addr, &win32, sizeof(win32)))
186 return -EFAULT;
187 } else {
188 rw_addr += STACK_BIAS;
189 if (set_to_target(target, rw_addr, wbuf, sizeof(*wbuf)))
190 return -EFAULT;
191 }
192
193 return 0;
194}
195
117enum sparc_regset { 196enum sparc_regset {
118 REGSET_GENERAL, 197 REGSET_GENERAL,
119 REGSET_FP, 198 REGSET_FP,
@@ -133,25 +212,13 @@ static int genregs64_get(struct task_struct *target,
133 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 212 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
134 regs->u_regs, 213 regs->u_regs,
135 0, 16 * sizeof(u64)); 214 0, 16 * sizeof(u64));
136 if (!ret) { 215 if (!ret && count && pos < (32 * sizeof(u64))) {
137 unsigned long __user *reg_window = (unsigned long __user *) 216 struct reg_window window;
138 (regs->u_regs[UREG_I6] + STACK_BIAS);
139 unsigned long window[16];
140
141 if (target == current) {
142 if (copy_from_user(window, reg_window, sizeof(window)))
143 return -EFAULT;
144 } else {
145 if (access_process_vm(target,
146 (unsigned long) reg_window,
147 window,
148 sizeof(window), 0) !=
149 sizeof(window))
150 return -EFAULT;
151 }
152 217
218 if (regwindow64_get(target, regs, &window))
219 return -EFAULT;
153 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 220 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
154 window, 221 &window,
155 16 * sizeof(u64), 222 16 * sizeof(u64),
156 32 * sizeof(u64)); 223 32 * sizeof(u64));
157 } 224 }
@@ -173,10 +240,11 @@ static int genregs64_get(struct task_struct *target,
173 36 * sizeof(u64)); 240 36 * sizeof(u64));
174 } 241 }
175 242
176 if (!ret) 243 if (!ret) {
177 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, 244 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
178 36 * sizeof(u64), -1); 245 36 * sizeof(u64), -1);
179 246
247 }
180 return ret; 248 return ret;
181} 249}
182 250
@@ -194,42 +262,20 @@ static int genregs64_set(struct task_struct *target,
194 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 262 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
195 regs->u_regs, 263 regs->u_regs,
196 0, 16 * sizeof(u64)); 264 0, 16 * sizeof(u64));
197 if (!ret && count > 0) { 265 if (!ret && count && pos < (32 * sizeof(u64))) {
198 unsigned long __user *reg_window = (unsigned long __user *) 266 struct reg_window window;
199 (regs->u_regs[UREG_I6] + STACK_BIAS);
200 unsigned long window[16];
201 267
202 if (target == current) { 268 if (regwindow64_get(target, regs, &window))
203 if (copy_from_user(window, reg_window, sizeof(window))) 269 return -EFAULT;
204 return -EFAULT;
205 } else {
206 if (access_process_vm(target,
207 (unsigned long) reg_window,
208 window,
209 sizeof(window), 0) !=
210 sizeof(window))
211 return -EFAULT;
212 }
213 270
214 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 271 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
215 window, 272 &window,
216 16 * sizeof(u64), 273 16 * sizeof(u64),
217 32 * sizeof(u64)); 274 32 * sizeof(u64));
218 if (!ret) { 275
219 if (target == current) { 276 if (!ret &&
220 if (copy_to_user(reg_window, window, 277 regwindow64_set(target, regs, &window))
221 sizeof(window))) 278 return -EFAULT;
222 return -EFAULT;
223 } else {
224 if (access_process_vm(target,
225 (unsigned long)
226 reg_window,
227 window,
228 sizeof(window), 1) !=
229 sizeof(window))
230 return -EFAULT;
231 }
232 }
233 } 279 }
234 280
235 if (!ret && count > 0) { 281 if (!ret && count > 0) {
@@ -805,7 +851,7 @@ struct compat_fps {
805long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 851long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
806 compat_ulong_t caddr, compat_ulong_t cdata) 852 compat_ulong_t caddr, compat_ulong_t cdata)
807{ 853{
808 const struct user_regset_view *view = task_user_regset_view(child); 854 const struct user_regset_view *view = task_user_regset_view(current);
809 compat_ulong_t caddr2 = task_pt_regs(current)->u_regs[UREG_I4]; 855 compat_ulong_t caddr2 = task_pt_regs(current)->u_regs[UREG_I4];
810 struct pt_regs32 __user *pregs; 856 struct pt_regs32 __user *pregs;
811 struct compat_fps __user *fps; 857 struct compat_fps __user *fps;
@@ -913,7 +959,7 @@ struct fps {
913 959
914long arch_ptrace(struct task_struct *child, long request, long addr, long data) 960long arch_ptrace(struct task_struct *child, long request, long addr, long data)
915{ 961{
916 const struct user_regset_view *view = task_user_regset_view(child); 962 const struct user_regset_view *view = task_user_regset_view(current);
917 unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4]; 963 unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4];
918 struct pt_regs __user *pregs; 964 struct pt_regs __user *pregs;
919 struct fps __user *fps; 965 struct fps __user *fps;
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 45d79ea890ae..5fed98ca0e1f 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -65,7 +65,8 @@ __setup("noreplace-paravirt", setup_noreplace_paravirt);
65 get them easily into strings. */ 65 get them easily into strings. */
66asm("\t.section .rodata, \"a\"\nintelnops: " 66asm("\t.section .rodata, \"a\"\nintelnops: "
67 GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6 67 GENERIC_NOP1 GENERIC_NOP2 GENERIC_NOP3 GENERIC_NOP4 GENERIC_NOP5 GENERIC_NOP6
68 GENERIC_NOP7 GENERIC_NOP8); 68 GENERIC_NOP7 GENERIC_NOP8
69 "\t.previous");
69extern const unsigned char intelnops[]; 70extern const unsigned char intelnops[];
70static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = { 71static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = {
71 NULL, 72 NULL,
@@ -83,7 +84,8 @@ static const unsigned char *const intel_nops[ASM_NOP_MAX+1] = {
83#ifdef K8_NOP1 84#ifdef K8_NOP1
84asm("\t.section .rodata, \"a\"\nk8nops: " 85asm("\t.section .rodata, \"a\"\nk8nops: "
85 K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6 86 K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6
86 K8_NOP7 K8_NOP8); 87 K8_NOP7 K8_NOP8
88 "\t.previous");
87extern const unsigned char k8nops[]; 89extern const unsigned char k8nops[];
88static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = { 90static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = {
89 NULL, 91 NULL,
@@ -101,7 +103,8 @@ static const unsigned char *const k8_nops[ASM_NOP_MAX+1] = {
101#ifdef K7_NOP1 103#ifdef K7_NOP1
102asm("\t.section .rodata, \"a\"\nk7nops: " 104asm("\t.section .rodata, \"a\"\nk7nops: "
103 K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6 105 K7_NOP1 K7_NOP2 K7_NOP3 K7_NOP4 K7_NOP5 K7_NOP6
104 K7_NOP7 K7_NOP8); 106 K7_NOP7 K7_NOP8
107 "\t.previous");
105extern const unsigned char k7nops[]; 108extern const unsigned char k7nops[];
106static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = { 109static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = {
107 NULL, 110 NULL,
@@ -119,7 +122,8 @@ static const unsigned char *const k7_nops[ASM_NOP_MAX+1] = {
119#ifdef P6_NOP1 122#ifdef P6_NOP1
120asm("\t.section .rodata, \"a\"\np6nops: " 123asm("\t.section .rodata, \"a\"\np6nops: "
121 P6_NOP1 P6_NOP2 P6_NOP3 P6_NOP4 P6_NOP5 P6_NOP6 124 P6_NOP1 P6_NOP2 P6_NOP3 P6_NOP4 P6_NOP5 P6_NOP6
122 P6_NOP7 P6_NOP8); 125 P6_NOP7 P6_NOP8
126 "\t.previous");
123extern const unsigned char p6nops[]; 127extern const unsigned char p6nops[];
124static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = { 128static const unsigned char *const p6_nops[ASM_NOP_MAX+1] = {
125 NULL, 129 NULL,
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index be3c7a299f02..43930e73f657 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -82,7 +82,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
82 */ 82 */
83void (*pm_idle)(void); 83void (*pm_idle)(void);
84EXPORT_SYMBOL(pm_idle); 84EXPORT_SYMBOL(pm_idle);
85static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
86 85
87void disable_hlt(void) 86void disable_hlt(void)
88{ 87{
@@ -190,9 +189,6 @@ void cpu_idle(void)
190 while (!need_resched()) { 189 while (!need_resched()) {
191 void (*idle)(void); 190 void (*idle)(void);
192 191
193 if (__get_cpu_var(cpu_idle_state))
194 __get_cpu_var(cpu_idle_state) = 0;
195
196 check_pgt_cache(); 192 check_pgt_cache();
197 rmb(); 193 rmb();
198 idle = pm_idle; 194 idle = pm_idle;
@@ -220,40 +216,19 @@ static void do_nothing(void *unused)
220{ 216{
221} 217}
222 218
219/*
220 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
221 * pm_idle and update to new pm_idle value. Required while changing pm_idle
222 * handler on SMP systems.
223 *
224 * Caller must have changed pm_idle to the new value before the call. Old
225 * pm_idle value will not be used by any CPU after the return of this function.
226 */
223void cpu_idle_wait(void) 227void cpu_idle_wait(void)
224{ 228{
225 unsigned int cpu, this_cpu = get_cpu(); 229 smp_mb();
226 cpumask_t map, tmp = current->cpus_allowed; 230 /* kick all the CPUs so that they exit out of pm_idle */
227 231 smp_call_function(do_nothing, NULL, 0, 1);
228 set_cpus_allowed(current, cpumask_of_cpu(this_cpu));
229 put_cpu();
230
231 cpus_clear(map);
232 for_each_online_cpu(cpu) {
233 per_cpu(cpu_idle_state, cpu) = 1;
234 cpu_set(cpu, map);
235 }
236
237 __get_cpu_var(cpu_idle_state) = 0;
238
239 wmb();
240 do {
241 ssleep(1);
242 for_each_online_cpu(cpu) {
243 if (cpu_isset(cpu, map) && !per_cpu(cpu_idle_state, cpu))
244 cpu_clear(cpu, map);
245 }
246 cpus_and(map, map, cpu_online_map);
247 /*
248 * We waited 1 sec, if a CPU still did not call idle
249 * it may be because it is in idle and not waking up
250 * because it has nothing to do.
251 * Give all the remaining CPUS a kick.
252 */
253 smp_call_function_mask(map, do_nothing, NULL, 0);
254 } while (!cpus_empty(map));
255
256 set_cpus_allowed(current, tmp);
257} 232}
258EXPORT_SYMBOL_GPL(cpu_idle_wait); 233EXPORT_SYMBOL_GPL(cpu_idle_wait);
259 234
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 3baf9b9f4c87..46c4c546b499 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -63,7 +63,6 @@ EXPORT_SYMBOL(boot_option_idle_override);
63 */ 63 */
64void (*pm_idle)(void); 64void (*pm_idle)(void);
65EXPORT_SYMBOL(pm_idle); 65EXPORT_SYMBOL(pm_idle);
66static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
67 66
68static ATOMIC_NOTIFIER_HEAD(idle_notifier); 67static ATOMIC_NOTIFIER_HEAD(idle_notifier);
69 68
@@ -173,9 +172,6 @@ void cpu_idle(void)
173 while (!need_resched()) { 172 while (!need_resched()) {
174 void (*idle)(void); 173 void (*idle)(void);
175 174
176 if (__get_cpu_var(cpu_idle_state))
177 __get_cpu_var(cpu_idle_state) = 0;
178
179 rmb(); 175 rmb();
180 idle = pm_idle; 176 idle = pm_idle;
181 if (!idle) 177 if (!idle)
@@ -207,40 +203,19 @@ static void do_nothing(void *unused)
207{ 203{
208} 204}
209 205
206/*
207 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
208 * pm_idle and update to new pm_idle value. Required while changing pm_idle
209 * handler on SMP systems.
210 *
211 * Caller must have changed pm_idle to the new value before the call. Old
212 * pm_idle value will not be used by any CPU after the return of this function.
213 */
210void cpu_idle_wait(void) 214void cpu_idle_wait(void)
211{ 215{
212 unsigned int cpu, this_cpu = get_cpu(); 216 smp_mb();
213 cpumask_t map, tmp = current->cpus_allowed; 217 /* kick all the CPUs so that they exit out of pm_idle */
214 218 smp_call_function(do_nothing, NULL, 0, 1);
215 set_cpus_allowed(current, cpumask_of_cpu(this_cpu));
216 put_cpu();
217
218 cpus_clear(map);
219 for_each_online_cpu(cpu) {
220 per_cpu(cpu_idle_state, cpu) = 1;
221 cpu_set(cpu, map);
222 }
223
224 __get_cpu_var(cpu_idle_state) = 0;
225
226 wmb();
227 do {
228 ssleep(1);
229 for_each_online_cpu(cpu) {
230 if (cpu_isset(cpu, map) && !per_cpu(cpu_idle_state, cpu))
231 cpu_clear(cpu, map);
232 }
233 cpus_and(map, map, cpu_online_map);
234 /*
235 * We waited 1 sec, if a CPU still did not call idle
236 * it may be because it is in idle and not waking up
237 * because it has nothing to do.
238 * Give all the remaining CPUS a kick.
239 */
240 smp_call_function_mask(map, do_nothing, 0, 0);
241 } while (!cpus_empty(map));
242
243 set_cpus_allowed(current, tmp);
244} 219}
245EXPORT_SYMBOL_GPL(cpu_idle_wait); 220EXPORT_SYMBOL_GPL(cpu_idle_wait);
246 221
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 022bcaa3b42e..ab6bf375a307 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -92,7 +92,7 @@ int do_set_thread_area(struct task_struct *p, int idx,
92asmlinkage int sys_set_thread_area(struct user_desc __user *u_info) 92asmlinkage int sys_set_thread_area(struct user_desc __user *u_info)
93{ 93{
94 int ret = do_set_thread_area(current, -1, u_info, 1); 94 int ret = do_set_thread_area(current, -1, u_info, 1);
95 prevent_tail_call(ret); 95 asmlinkage_protect(1, ret, u_info);
96 return ret; 96 return ret;
97} 97}
98 98
@@ -142,7 +142,7 @@ int do_get_thread_area(struct task_struct *p, int idx,
142asmlinkage int sys_get_thread_area(struct user_desc __user *u_info) 142asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
143{ 143{
144 int ret = do_get_thread_area(current, -1, u_info); 144 int ret = do_get_thread_area(current, -1, u_info);
145 prevent_tail_call(ret); 145 asmlinkage_protect(1, ret, u_info);
146 return ret; 146 return ret;
147} 147}
148 148
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 0234f2831bf3..378136fb5044 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -219,8 +219,21 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
219 if (pxm >= 0) 219 if (pxm >= 0)
220 sd->node = pxm_to_node(pxm); 220 sd->node = pxm_to_node(pxm);
221#endif 221#endif
222 /*
223 * Maybe the desired pci bus has been already scanned. In such case
224 * it is unnecessary to scan the pci bus with the given domain,busnum.
225 */
226 bus = pci_find_bus(domain, busnum);
227 if (bus) {
228 /*
229 * If the desired bus exits, the content of bus->sysdata will
230 * be replaced by sd.
231 */
232 memcpy(bus->sysdata, sd, sizeof(*sd));
233 kfree(sd);
234 } else
235 bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
222 236
223 bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd);
224 if (!bus) 237 if (!bus)
225 kfree(sd); 238 kfree(sd);
226 239
@@ -228,7 +241,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
228 if (bus != NULL) { 241 if (bus != NULL) {
229 if (pxm >= 0) { 242 if (pxm >= 0) {
230 printk("bus %d -> pxm %d -> node %d\n", 243 printk("bus %d -> pxm %d -> node %d\n",
231 busnum, pxm, sd->node); 244 busnum, pxm, pxm_to_node(pxm));
232 } 245 }
233 } 246 }
234#endif 247#endif
diff --git a/block/Kconfig b/block/Kconfig
index 9bda7bc80307..7db9a411649d 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -38,7 +38,7 @@ config BLK_DEV_IO_TRACE
38 on a block device queue. For more information (and the user space 38 on a block device queue. For more information (and the user space
39 support tools needed), fetch the blktrace app from: 39 support tools needed), fetch the blktrace app from:
40 40
41 git://brick.kernel.dk/data/git/blktrace.git 41 git://git.kernel.dk/blktrace.git
42 42
43config LSF 43config LSF
44 bool "Support for Large Single Files" 44 bool "Support for Large Single Files"
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index f26da2bfcc15..f4e1006c253d 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1214,6 +1214,8 @@ static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1214static void __cfq_exit_single_io_context(struct cfq_data *cfqd, 1214static void __cfq_exit_single_io_context(struct cfq_data *cfqd,
1215 struct cfq_io_context *cic) 1215 struct cfq_io_context *cic)
1216{ 1216{
1217 struct io_context *ioc = cic->ioc;
1218
1217 list_del_init(&cic->queue_list); 1219 list_del_init(&cic->queue_list);
1218 1220
1219 /* 1221 /*
@@ -1223,6 +1225,9 @@ static void __cfq_exit_single_io_context(struct cfq_data *cfqd,
1223 cic->dead_key = (unsigned long) cic->key; 1225 cic->dead_key = (unsigned long) cic->key;
1224 cic->key = NULL; 1226 cic->key = NULL;
1225 1227
1228 if (ioc->ioc_data == cic)
1229 rcu_assign_pointer(ioc->ioc_data, NULL);
1230
1226 if (cic->cfqq[ASYNC]) { 1231 if (cic->cfqq[ASYNC]) {
1227 cfq_exit_cfqq(cfqd, cic->cfqq[ASYNC]); 1232 cfq_exit_cfqq(cfqd, cic->cfqq[ASYNC]);
1228 cic->cfqq[ASYNC] = NULL; 1233 cic->cfqq[ASYNC] = NULL;
@@ -1255,7 +1260,6 @@ static void cfq_exit_single_io_context(struct io_context *ioc,
1255 */ 1260 */
1256static void cfq_exit_io_context(struct io_context *ioc) 1261static void cfq_exit_io_context(struct io_context *ioc)
1257{ 1262{
1258 rcu_assign_pointer(ioc->ioc_data, NULL);
1259 call_for_each_cic(ioc, cfq_exit_single_io_context); 1263 call_for_each_cic(ioc, cfq_exit_single_io_context);
1260} 1264}
1261 1265
@@ -1478,8 +1482,7 @@ cfq_drop_dead_cic(struct cfq_data *cfqd, struct io_context *ioc,
1478 1482
1479 spin_lock_irqsave(&ioc->lock, flags); 1483 spin_lock_irqsave(&ioc->lock, flags);
1480 1484
1481 if (ioc->ioc_data == cic) 1485 BUG_ON(ioc->ioc_data == cic);
1482 rcu_assign_pointer(ioc->ioc_data, NULL);
1483 1486
1484 radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd); 1487 radix_tree_delete(&ioc->radix_root, (unsigned long) cfqd);
1485 hlist_del_rcu(&cic->cic_list); 1488 hlist_del_rcu(&cic->cic_list);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 5b6760e0f957..2d1955c11833 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -373,10 +373,11 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
373 } 373 }
374 374
375 spin_lock_irqsave(&acpi_bus_event_lock, flags); 375 spin_lock_irqsave(&acpi_bus_event_lock, flags);
376 entry = 376 if (!list_empty(&acpi_bus_event_list)) {
377 list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node); 377 entry = list_entry(acpi_bus_event_list.next,
378 if (entry) 378 struct acpi_bus_event, node);
379 list_del(&entry->node); 379 list_del(&entry->node);
380 }
380 spin_unlock_irqrestore(&acpi_bus_event_lock, flags); 381 spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
381 382
382 if (!entry) 383 if (!entry)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 36a68fa114e3..a825b431b64f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -822,7 +822,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
822 } 822 }
823 823
824 processors[pr->id] = NULL; 824 processors[pr->id] = NULL;
825 825 processor_device_array[pr->id] = NULL;
826 kfree(pr); 826 kfree(pr);
827 827
828 return 0; 828 return 0;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index c4e00ac8ea85..1bcecc7dd2ca 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -1125,7 +1125,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
1125 tz->trips.active[i].flags.valid; i++, trips++); 1125 tz->trips.active[i].flags.valid; i++, trips++);
1126 tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone", 1126 tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone",
1127 trips, tz, &acpi_thermal_zone_ops); 1127 trips, tz, &acpi_thermal_zone_ops);
1128 if (!tz->thermal_zone) 1128 if (IS_ERR(tz->thermal_zone))
1129 return -ENODEV; 1129 return -ENODEV;
1130 1130
1131 result = sysfs_create_link(&tz->device->dev.kobj, 1131 result = sysfs_create_link(&tz->device->dev.kobj,
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index ce830fe3a362..511a830b6256 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -36,7 +36,7 @@
36#define DRV_NAME "pata_ali" 36#define DRV_NAME "pata_ali"
37#define DRV_VERSION "0.7.5" 37#define DRV_VERSION "0.7.5"
38 38
39int ali_atapi_dma = 0; 39static int ali_atapi_dma = 0;
40module_param_named(atapi_dma, ali_atapi_dma, int, 0644); 40module_param_named(atapi_dma, ali_atapi_dma, int, 0644);
41MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); 41MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)");
42 42
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 3988e44f4934..7c5b2dd9a1a1 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -270,7 +270,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio)
270 tmpbyte & 1, tmpbyte & 0x30); 270 tmpbyte & 1, tmpbyte & 0x30);
271 271
272 *try_mmio = 0; 272 *try_mmio = 0;
273#ifdef CONFIG_PPC 273#ifdef CONFIG_PPC_MERGE
274 if (machine_is(cell)) 274 if (machine_is(cell))
275 *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5); 275 *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5);
276#endif 276#endif
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 4c1985511548..9d1e3cad4aa9 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -1256,7 +1256,6 @@ static int sata_fsl_probe(struct of_device *ofdev,
1256 void __iomem *ssr_base = NULL; 1256 void __iomem *ssr_base = NULL;
1257 void __iomem *csr_base = NULL; 1257 void __iomem *csr_base = NULL;
1258 struct sata_fsl_host_priv *host_priv = NULL; 1258 struct sata_fsl_host_priv *host_priv = NULL;
1259 struct resource *r;
1260 int irq; 1259 int irq;
1261 struct ata_host *host; 1260 struct ata_host *host;
1262 1261
@@ -1266,8 +1265,6 @@ static int sata_fsl_probe(struct of_device *ofdev,
1266 dev_printk(KERN_INFO, &ofdev->dev, 1265 dev_printk(KERN_INFO, &ofdev->dev,
1267 "Sata FSL Platform/CSB Driver init\n"); 1266 "Sata FSL Platform/CSB Driver init\n");
1268 1267
1269 r = kmalloc(sizeof(struct resource), GFP_KERNEL);
1270
1271 hcr_base = of_iomap(ofdev->node, 0); 1268 hcr_base = of_iomap(ofdev->node, 0);
1272 if (!hcr_base) 1269 if (!hcr_base)
1273 goto error_exit_with_cleanup; 1270 goto error_exit_with_cleanup;
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 840d1c4a7850..019e367b59fc 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -531,8 +531,8 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en
531 * */ 531 * */
532static const struct pci_device_id k2_sata_pci_tbl[] = { 532static const struct pci_device_id k2_sata_pci_tbl[] = {
533 { PCI_VDEVICE(SERVERWORKS, 0x0240), chip_svw4 }, 533 { PCI_VDEVICE(SERVERWORKS, 0x0240), chip_svw4 },
534 { PCI_VDEVICE(SERVERWORKS, 0x0241), chip_svw4 }, 534 { PCI_VDEVICE(SERVERWORKS, 0x0241), chip_svw8 },
535 { PCI_VDEVICE(SERVERWORKS, 0x0242), chip_svw8 }, 535 { PCI_VDEVICE(SERVERWORKS, 0x0242), chip_svw4 },
536 { PCI_VDEVICE(SERVERWORKS, 0x024a), chip_svw4 }, 536 { PCI_VDEVICE(SERVERWORKS, 0x024a), chip_svw4 },
537 { PCI_VDEVICE(SERVERWORKS, 0x024b), chip_svw4 }, 537 { PCI_VDEVICE(SERVERWORKS, 0x024b), chip_svw4 },
538 { PCI_VDEVICE(SERVERWORKS, 0x0410), chip_svw42 }, 538 { PCI_VDEVICE(SERVERWORKS, 0x0410), chip_svw42 },
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 55bd35c0f082..9c9627e8e334 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -50,6 +50,7 @@
50#include <scsi/sg.h> 50#include <scsi/sg.h>
51#include <scsi/scsi_ioctl.h> 51#include <scsi/scsi_ioctl.h>
52#include <linux/cdrom.h> 52#include <linux/cdrom.h>
53#include <linux/scatterlist.h>
53 54
54#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin)) 55#define CCISS_DRIVER_VERSION(maj,min,submin) ((maj<<16)|(min<<8)|(submin))
55#define DRIVER_NAME "HP CISS Driver (v 3.6.14)" 56#define DRIVER_NAME "HP CISS Driver (v 3.6.14)"
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index c452e2d355ee..27bfe72aab59 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -8,6 +8,7 @@
8 * and is not licensed separately. See file COPYING for details. 8 * and is not licensed separately. See file COPYING for details.
9 * 9 *
10 * TODO (sorted by decreasing priority) 10 * TODO (sorted by decreasing priority)
11 * -- Return sense now that rq allows it (we always auto-sense anyway).
11 * -- set readonly flag for CDs, set removable flag for CF readers 12 * -- set readonly flag for CDs, set removable flag for CF readers
12 * -- do inquiry and verify we got a disk and not a tape (for LUN mismatch) 13 * -- do inquiry and verify we got a disk and not a tape (for LUN mismatch)
13 * -- verify the 13 conditions and do bulk resets 14 * -- verify the 13 conditions and do bulk resets
@@ -359,7 +360,8 @@ static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
359static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, 360static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
360 struct ub_scsi_cmd *cmd, struct ub_request *urq); 361 struct ub_scsi_cmd *cmd, struct ub_request *urq);
361static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 362static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
362static void ub_end_rq(struct request *rq, unsigned int status); 363static void ub_end_rq(struct request *rq, unsigned int status,
364 unsigned int cmd_len);
363static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, 365static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
364 struct ub_request *urq, struct ub_scsi_cmd *cmd); 366 struct ub_request *urq, struct ub_scsi_cmd *cmd);
365static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd); 367static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd);
@@ -642,13 +644,13 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
642 644
643 if (atomic_read(&sc->poison)) { 645 if (atomic_read(&sc->poison)) {
644 blkdev_dequeue_request(rq); 646 blkdev_dequeue_request(rq);
645 ub_end_rq(rq, DID_NO_CONNECT << 16); 647 ub_end_rq(rq, DID_NO_CONNECT << 16, blk_rq_bytes(rq));
646 return 0; 648 return 0;
647 } 649 }
648 650
649 if (lun->changed && !blk_pc_request(rq)) { 651 if (lun->changed && !blk_pc_request(rq)) {
650 blkdev_dequeue_request(rq); 652 blkdev_dequeue_request(rq);
651 ub_end_rq(rq, SAM_STAT_CHECK_CONDITION); 653 ub_end_rq(rq, SAM_STAT_CHECK_CONDITION, blk_rq_bytes(rq));
652 return 0; 654 return 0;
653 } 655 }
654 656
@@ -701,7 +703,7 @@ static int ub_request_fn_1(struct ub_lun *lun, struct request *rq)
701 703
702drop: 704drop:
703 ub_put_cmd(lun, cmd); 705 ub_put_cmd(lun, cmd);
704 ub_end_rq(rq, DID_ERROR << 16); 706 ub_end_rq(rq, DID_ERROR << 16, blk_rq_bytes(rq));
705 return 0; 707 return 0;
706} 708}
707 709
@@ -770,6 +772,7 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
770 struct ub_request *urq = cmd->back; 772 struct ub_request *urq = cmd->back;
771 struct request *rq; 773 struct request *rq;
772 unsigned int scsi_status; 774 unsigned int scsi_status;
775 unsigned int cmd_len;
773 776
774 rq = urq->rq; 777 rq = urq->rq;
775 778
@@ -779,8 +782,18 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
779 rq->data_len = 0; 782 rq->data_len = 0;
780 else 783 else
781 rq->data_len -= cmd->act_len; 784 rq->data_len -= cmd->act_len;
785 scsi_status = 0;
786 } else {
787 if (cmd->act_len != cmd->len) {
788 if ((cmd->key == MEDIUM_ERROR ||
789 cmd->key == UNIT_ATTENTION) &&
790 ub_rw_cmd_retry(sc, lun, urq, cmd) == 0)
791 return;
792 scsi_status = SAM_STAT_CHECK_CONDITION;
793 } else {
794 scsi_status = 0;
795 }
782 } 796 }
783 scsi_status = 0;
784 } else { 797 } else {
785 if (blk_pc_request(rq)) { 798 if (blk_pc_request(rq)) {
786 /* UB_SENSE_SIZE is smaller than SCSI_SENSE_BUFFERSIZE */ 799 /* UB_SENSE_SIZE is smaller than SCSI_SENSE_BUFFERSIZE */
@@ -801,14 +814,17 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
801 814
802 urq->rq = NULL; 815 urq->rq = NULL;
803 816
817 cmd_len = cmd->len;
804 ub_put_cmd(lun, cmd); 818 ub_put_cmd(lun, cmd);
805 ub_end_rq(rq, scsi_status); 819 ub_end_rq(rq, scsi_status, cmd_len);
806 blk_start_queue(lun->disk->queue); 820 blk_start_queue(lun->disk->queue);
807} 821}
808 822
809static void ub_end_rq(struct request *rq, unsigned int scsi_status) 823static void ub_end_rq(struct request *rq, unsigned int scsi_status,
824 unsigned int cmd_len)
810{ 825{
811 int error; 826 int error;
827 long rqlen;
812 828
813 if (scsi_status == 0) { 829 if (scsi_status == 0) {
814 error = 0; 830 error = 0;
@@ -816,8 +832,12 @@ static void ub_end_rq(struct request *rq, unsigned int scsi_status)
816 error = -EIO; 832 error = -EIO;
817 rq->errors = scsi_status; 833 rq->errors = scsi_status;
818 } 834 }
819 if (__blk_end_request(rq, error, blk_rq_bytes(rq))) 835 rqlen = blk_rq_bytes(rq); /* Oddly enough, this is the residue. */
820 BUG(); 836 if (__blk_end_request(rq, error, cmd_len)) {
837 printk(KERN_WARNING DRV_NAME
838 ": __blk_end_request blew, %s-cmd total %u rqlen %ld\n",
839 blk_pc_request(rq)? "pc": "fs", cmd_len, rqlen);
840 }
821} 841}
822 842
823static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, 843static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun,
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index cce5a614758d..fde26345a379 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -382,9 +382,8 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
382 break; 382 break;
383 383
384 case DAVINCI_I2C_IVR_ARDY: 384 case DAVINCI_I2C_IVR_ARDY:
385 w = davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG); 385 davinci_i2c_write_reg(dev,
386 MOD_REG_BIT(w, DAVINCI_I2C_STR_ARDY, 1); 386 DAVINCI_I2C_STR_REG, DAVINCI_I2C_STR_ARDY);
387 davinci_i2c_write_reg(dev, DAVINCI_I2C_STR_REG, w);
388 complete(&dev->cmd_complete); 387 complete(&dev->cmd_complete);
389 break; 388 break;
390 389
@@ -397,12 +396,9 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
397 if (dev->buf_len) 396 if (dev->buf_len)
398 continue; 397 continue;
399 398
400 w = davinci_i2c_read_reg(dev,
401 DAVINCI_I2C_STR_REG);
402 MOD_REG_BIT(w, DAVINCI_I2C_IMR_RRDY, 0);
403 davinci_i2c_write_reg(dev, 399 davinci_i2c_write_reg(dev,
404 DAVINCI_I2C_STR_REG, 400 DAVINCI_I2C_STR_REG,
405 w); 401 DAVINCI_I2C_IMR_RRDY);
406 } else 402 } else
407 dev_err(dev->dev, "RDR IRQ while no " 403 dev_err(dev->dev, "RDR IRQ while no "
408 "data requested\n"); 404 "data requested\n");
@@ -428,9 +424,8 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
428 break; 424 break;
429 425
430 case DAVINCI_I2C_IVR_SCD: 426 case DAVINCI_I2C_IVR_SCD:
431 w = davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG); 427 davinci_i2c_write_reg(dev,
432 MOD_REG_BIT(w, DAVINCI_I2C_STR_SCD, 1); 428 DAVINCI_I2C_STR_REG, DAVINCI_I2C_STR_SCD);
433 davinci_i2c_write_reg(dev, DAVINCI_I2C_STR_REG, w);
434 complete(&dev->cmd_complete); 429 complete(&dev->cmd_complete);
435 break; 430 break;
436 431
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 7c7eb0cfeceb..22bb247d0e60 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(iic_force_poll, "Force polling mode");
55 55
56static int iic_force_fast; 56static int iic_force_fast;
57module_param(iic_force_fast, bool, 0); 57module_param(iic_force_fast, bool, 0);
58MODULE_PARM_DESC(iic_fast_poll, "Force fast mode (400 kHz)"); 58MODULE_PARM_DESC(iic_force_fast, "Force fast mode (400 kHz)");
59 59
60#define DBG_LEVEL 0 60#define DBG_LEVEL 0
61 61
diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index cb9abe7565a7..b1c050ff311d 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -131,11 +131,15 @@ static const struct i2c_algorithm usb_algorithm = {
131 131
132/* ----- begin of usb layer ---------------------------------------------- */ 132/* ----- begin of usb layer ---------------------------------------------- */
133 133
134/* The usb i2c interface uses a vid/pid pair donated by */ 134/*
135/* Future Technology Devices International Ltd. */ 135 * Initially the usb i2c interface uses a vid/pid pair donated by
136 * Future Technology Devices International Ltd., later a pair was
137 * bought from EZPrototypes
138 */
136static struct usb_device_id i2c_tiny_usb_table [] = { 139static struct usb_device_id i2c_tiny_usb_table [] = {
137 { USB_DEVICE(0x0403, 0xc631) }, 140 { USB_DEVICE(0x0403, 0xc631) }, /* FTDI */
138 { } /* Terminating entry */ 141 { USB_DEVICE(0x1c40, 0x0534) }, /* EZPrototypes */
142 { } /* Terminating entry */
139}; 143};
140 144
141MODULE_DEVICE_TABLE(usb, i2c_tiny_usb_table); 145MODULE_DEVICE_TABLE(usb, i2c_tiny_usb_table);
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 0f4bf5d72835..85c016bdfd38 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -32,19 +32,12 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/ide.h> 36#include <linux/ide.h>
38#include <linux/sysdev.h> 37#include <linux/scatterlist.h>
39
40#include <linux/dma-mapping.h>
41
42#include "ide-timing.h"
43 38
44#include <asm/io.h>
45#include <asm/mach-au1x00/au1xxx.h> 39#include <asm/mach-au1x00/au1xxx.h>
46#include <asm/mach-au1x00/au1xxx_dbdma.h> 40#include <asm/mach-au1x00/au1xxx_dbdma.h>
47
48#include <asm/mach-au1x00/au1xxx_ide.h> 41#include <asm/mach-au1x00/au1xxx_ide.h>
49 42
50#define DRV_NAME "au1200-ide" 43#define DRV_NAME "au1200-ide"
@@ -56,6 +49,8 @@
56static _auide_hwif auide_hwif; 49static _auide_hwif auide_hwif;
57static int dbdma_init_done; 50static int dbdma_init_done;
58 51
52static int auide_ddma_init(_auide_hwif *auide);
53
59#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA) 54#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA)
60 55
61void auide_insw(unsigned long port, void *addr, u32 count) 56void auide_insw(unsigned long port, void *addr, u32 count)
@@ -591,13 +586,14 @@ static int au_ide_probe(struct device *dev)
591 goto out; 586 goto out;
592 } 587 }
593 588
594 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) { 589 if (!request_mem_region(res->start, res->end - res->start + 1,
590 pdev->name)) {
595 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 591 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
596 ret = -EBUSY; 592 ret = -EBUSY;
597 goto out; 593 goto out;
598 } 594 }
599 595
600 ahwif->regbase = (u32)ioremap(res->start, res->end-res->start); 596 ahwif->regbase = (u32)ioremap(res->start, res->end - res->start + 1);
601 if (ahwif->regbase == 0) { 597 if (ahwif->regbase == 0) {
602 ret = -ENOMEM; 598 ret = -ENOMEM;
603 goto out; 599 goto out;
@@ -682,7 +678,7 @@ static int au_ide_remove(struct device *dev)
682 iounmap((void *)ahwif->regbase); 678 iounmap((void *)ahwif->regbase);
683 679
684 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 680 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
685 release_mem_region(res->start, res->end - res->start); 681 release_mem_region(res->start, res->end - res->start + 1);
686 682
687 return 0; 683 return 0;
688} 684}
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 1597f0cc1bf1..d8a167451fd6 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -667,7 +667,7 @@ static int __init it821x_ide_init(void)
667module_init(it821x_ide_init); 667module_init(it821x_ide_init);
668 668
669module_param_named(noraid, it8212_noraid, int, S_IRUGO); 669module_param_named(noraid, it8212_noraid, int, S_IRUGO);
670MODULE_PARM_DESC(it8212_noraid, "Force card into bypass mode"); 670MODULE_PARM_DESC(noraid, "Force card into bypass mode");
671 671
672MODULE_AUTHOR("Alan Cox"); 672MODULE_AUTHOR("Alan Cox");
673MODULE_DESCRIPTION("PCI driver module for the ITE 821x"); 673MODULE_DESCRIPTION("PCI driver module for the ITE 821x");
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index ced83c202cac..ef1a300068dc 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -2010,6 +2010,7 @@ isdn_net_init(struct net_device *ndev)
2010 ndev->flags = IFF_NOARP|IFF_POINTOPOINT; 2010 ndev->flags = IFF_NOARP|IFF_POINTOPOINT;
2011 ndev->type = ARPHRD_ETHER; 2011 ndev->type = ARPHRD_ETHER;
2012 ndev->addr_len = ETH_ALEN; 2012 ndev->addr_len = ETH_ALEN;
2013 ndev->validate_addr = NULL;
2013 2014
2014 /* for clients with MPPP maybe higher values better */ 2015 /* for clients with MPPP maybe higher values better */
2015 ndev->tx_queue_len = 30; 2016 ndev->tx_queue_len = 30;
diff --git a/drivers/leds/leds-ams-delta.c b/drivers/leds/leds-ams-delta.c
index 9e3077463d84..c37bb0d5a0c5 100644
--- a/drivers/leds/leds-ams-delta.c
+++ b/drivers/leds/leds-ams-delta.c
@@ -140,6 +140,7 @@ static struct platform_driver ams_delta_led_driver = {
140 .resume = ams_delta_led_resume, 140 .resume = ams_delta_led_resume,
141 .driver = { 141 .driver = {
142 .name = "ams-delta-led", 142 .name = "ams-delta-led",
143 .owner = THIS_MODULE,
143 }, 144 },
144}; 145};
145 146
@@ -159,3 +160,4 @@ module_exit(ams_delta_led_exit);
159MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>"); 160MODULE_AUTHOR("Jonathan McDowell <noodles@earth.li>");
160MODULE_DESCRIPTION("Amstrad Delta LED driver"); 161MODULE_DESCRIPTION("Amstrad Delta LED driver");
161MODULE_LICENSE("GPL"); 162MODULE_LICENSE("GPL");
163MODULE_ALIAS("platform:ams-delta-led");
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
index af61f55571fe..28db6c1444ed 100644
--- a/drivers/leds/leds-atmel-pwm.c
+++ b/drivers/leds/leds-atmel-pwm.c
@@ -132,6 +132,9 @@ static int __exit pwmled_remove(struct platform_device *pdev)
132 return 0; 132 return 0;
133} 133}
134 134
135/* work with hotplug and coldplug */
136MODULE_ALIAS("platform:leds-atmel-pwm");
137
135static struct platform_driver pwmled_driver = { 138static struct platform_driver pwmled_driver = {
136 .driver = { 139 .driver = {
137 .name = "leds-atmel-pwm", 140 .name = "leds-atmel-pwm",
diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
index 6c3d33b8e383..5750b08b601f 100644
--- a/drivers/leds/leds-clevo-mail.c
+++ b/drivers/leds/leds-clevo-mail.c
@@ -170,6 +170,7 @@ static struct platform_driver clevo_mail_led_driver = {
170 .resume = clevo_mail_led_resume, 170 .resume = clevo_mail_led_resume,
171 .driver = { 171 .driver = {
172 .name = KBUILD_MODNAME, 172 .name = KBUILD_MODNAME,
173 .owner = THIS_MODULE,
173 }, 174 },
174}; 175};
175 176
diff --git a/drivers/leds/leds-cm-x270.c b/drivers/leds/leds-cm-x270.c
index 9aebef02a974..accc7eddb788 100644
--- a/drivers/leds/leds-cm-x270.c
+++ b/drivers/leds/leds-cm-x270.c
@@ -101,6 +101,7 @@ static struct platform_driver cmx270led_driver = {
101#endif 101#endif
102 .driver = { 102 .driver = {
103 .name = "cm-x270-led", 103 .name = "cm-x270-led",
104 .owner = THIS_MODULE,
104 }, 105 },
105}; 106};
106 107
@@ -120,3 +121,4 @@ module_exit(cmx270led_exit);
120MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); 121MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
121MODULE_DESCRIPTION("CM-x270 LED driver"); 122MODULE_DESCRIPTION("CM-x270 LED driver");
122MODULE_LICENSE("GPL"); 123MODULE_LICENSE("GPL");
124MODULE_ALIAS("platform:cm-x270-led");
diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
index d2b54b53d80a..096881a11b1a 100644
--- a/drivers/leds/leds-cobalt-qube.c
+++ b/drivers/leds/leds-cobalt-qube.c
@@ -75,6 +75,9 @@ static int __devexit cobalt_qube_led_remove(struct platform_device *pdev)
75 return 0; 75 return 0;
76} 76}
77 77
78/* work with hotplug and coldplug */
79MODULE_ALIAS("platform:cobalt-qube-leds");
80
78static struct platform_driver cobalt_qube_led_driver = { 81static struct platform_driver cobalt_qube_led_driver = {
79 .probe = cobalt_qube_led_probe, 82 .probe = cobalt_qube_led_probe,
80 .remove = __devexit_p(cobalt_qube_led_remove), 83 .remove = __devexit_p(cobalt_qube_led_remove),
diff --git a/drivers/leds/leds-corgi.c b/drivers/leds/leds-corgi.c
index e45f6c4b59ba..29e931f89f9c 100644
--- a/drivers/leds/leds-corgi.c
+++ b/drivers/leds/leds-corgi.c
@@ -99,6 +99,7 @@ static struct platform_driver corgiled_driver = {
99#endif 99#endif
100 .driver = { 100 .driver = {
101 .name = "corgi-led", 101 .name = "corgi-led",
102 .owner = THIS_MODULE,
102 }, 103 },
103}; 104};
104 105
@@ -118,3 +119,4 @@ module_exit(corgiled_exit);
118MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>"); 119MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
119MODULE_DESCRIPTION("Corgi LED driver"); 120MODULE_DESCRIPTION("Corgi LED driver");
120MODULE_LICENSE("GPL"); 121MODULE_LICENSE("GPL");
122MODULE_ALIAS("platform:corgi-led");
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 4c0b05852cb6..1aae8b332134 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -199,3 +199,4 @@ module_exit(gpio_led_exit);
199MODULE_AUTHOR("Raphael Assenat <raph@8d.com>"); 199MODULE_AUTHOR("Raphael Assenat <raph@8d.com>");
200MODULE_DESCRIPTION("GPIO LED driver"); 200MODULE_DESCRIPTION("GPIO LED driver");
201MODULE_LICENSE("GPL"); 201MODULE_LICENSE("GPL");
202MODULE_ALIAS("platform:leds-gpio");
diff --git a/drivers/leds/leds-h1940.c b/drivers/leds/leds-h1940.c
index 677c99325be5..6e51c9b61027 100644
--- a/drivers/leds/leds-h1940.c
+++ b/drivers/leds/leds-h1940.c
@@ -139,6 +139,7 @@ static int h1940leds_remove(struct platform_device *pdev)
139static struct platform_driver h1940leds_driver = { 139static struct platform_driver h1940leds_driver = {
140 .driver = { 140 .driver = {
141 .name = "h1940-leds", 141 .name = "h1940-leds",
142 .owner = THIS_MODULE,
142 }, 143 },
143 .probe = h1940leds_probe, 144 .probe = h1940leds_probe,
144 .remove = h1940leds_remove, 145 .remove = h1940leds_remove,
@@ -161,3 +162,4 @@ module_exit(h1940leds_exit);
161MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); 162MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
162MODULE_DESCRIPTION("LED driver for the iPAQ H1940"); 163MODULE_DESCRIPTION("LED driver for the iPAQ H1940");
163MODULE_LICENSE("GPL"); 164MODULE_LICENSE("GPL");
165MODULE_ALIAS("platform:h1940-leds");
diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c
index 82d4ec384797..870f5a3789e8 100644
--- a/drivers/leds/leds-hp6xx.c
+++ b/drivers/leds/leds-hp6xx.c
@@ -90,6 +90,9 @@ static int hp6xxled_remove(struct platform_device *pdev)
90 return 0; 90 return 0;
91} 91}
92 92
93/* work with hotplug and coldplug */
94MODULE_ALIAS("platform:hp6xx-led");
95
93static struct platform_driver hp6xxled_driver = { 96static struct platform_driver hp6xxled_driver = {
94 .probe = hp6xxled_probe, 97 .probe = hp6xxled_probe,
95 .remove = hp6xxled_remove, 98 .remove = hp6xxled_remove,
@@ -99,6 +102,7 @@ static struct platform_driver hp6xxled_driver = {
99#endif 102#endif
100 .driver = { 103 .driver = {
101 .name = "hp6xx-led", 104 .name = "hp6xx-led",
105 .owner = THIS_MODULE,
102 }, 106 },
103}; 107};
104 108
diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c
index 0fd640751294..0d10e119d8f5 100644
--- a/drivers/leds/leds-s3c24xx.c
+++ b/drivers/leds/leds-s3c24xx.c
@@ -160,3 +160,4 @@ module_exit(s3c24xx_led_exit);
160MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 160MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
161MODULE_DESCRIPTION("S3C24XX LED driver"); 161MODULE_DESCRIPTION("S3C24XX LED driver");
162MODULE_LICENSE("GPL"); 162MODULE_LICENSE("GPL");
163MODULE_ALIAS("platform:s3c24xx_led");
diff --git a/drivers/leds/leds-spitz.c b/drivers/leds/leds-spitz.c
index 93e1012b17e6..87007cc362c1 100644
--- a/drivers/leds/leds-spitz.c
+++ b/drivers/leds/leds-spitz.c
@@ -105,6 +105,7 @@ static struct platform_driver spitzled_driver = {
105#endif 105#endif
106 .driver = { 106 .driver = {
107 .name = "spitz-led", 107 .name = "spitz-led",
108 .owner = THIS_MODULE,
108 }, 109 },
109}; 110};
110 111
@@ -124,3 +125,4 @@ module_exit(spitzled_exit);
124MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>"); 125MODULE_AUTHOR("Richard Purdie <rpurdie@openedhand.com>");
125MODULE_DESCRIPTION("Spitz LED driver"); 126MODULE_DESCRIPTION("Spitz LED driver");
126MODULE_LICENSE("GPL"); 127MODULE_LICENSE("GPL");
128MODULE_ALIAS("platform:spitz-led");
diff --git a/drivers/leds/leds-tosa.c b/drivers/leds/leds-tosa.c
index 9e0a188fbb0a..7ebecc41a9be 100644
--- a/drivers/leds/leds-tosa.c
+++ b/drivers/leds/leds-tosa.c
@@ -109,6 +109,7 @@ static struct platform_driver tosaled_driver = {
109 .resume = tosaled_resume, 109 .resume = tosaled_resume,
110 .driver = { 110 .driver = {
111 .name = "tosa-led", 111 .name = "tosa-led",
112 .owner = THIS_MODULE,
112 }, 113 },
113}; 114};
114 115
@@ -128,3 +129,4 @@ module_exit(tosaled_exit);
128MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>"); 129MODULE_AUTHOR("Dirk Opfer <Dirk@Opfer-Online.de>");
129MODULE_DESCRIPTION("Tosa LED driver"); 130MODULE_DESCRIPTION("Tosa LED driver");
130MODULE_LICENSE("GPL"); 131MODULE_LICENSE("GPL");
132MODULE_ALIAS("platform:tosa-led");
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index c574cf5efb5c..b162b839a662 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2348,25 +2348,15 @@ static void handle_issuing_new_write_requests6(raid5_conf_t *conf,
2348static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, 2348static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
2349 struct stripe_head_state *s, int disks) 2349 struct stripe_head_state *s, int disks)
2350{ 2350{
2351 int canceled_check = 0;
2352
2351 set_bit(STRIPE_HANDLE, &sh->state); 2353 set_bit(STRIPE_HANDLE, &sh->state);
2352 /* Take one of the following actions:
2353 * 1/ start a check parity operation if (uptodate == disks)
2354 * 2/ finish a check parity operation and act on the result
2355 * 3/ skip to the writeback section if we previously
2356 * initiated a recovery operation
2357 */
2358 if (s->failed == 0 &&
2359 !test_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending)) {
2360 if (!test_and_set_bit(STRIPE_OP_CHECK, &sh->ops.pending)) {
2361 BUG_ON(s->uptodate != disks);
2362 clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags);
2363 sh->ops.count++;
2364 s->uptodate--;
2365 } else if (
2366 test_and_clear_bit(STRIPE_OP_CHECK, &sh->ops.complete)) {
2367 clear_bit(STRIPE_OP_CHECK, &sh->ops.ack);
2368 clear_bit(STRIPE_OP_CHECK, &sh->ops.pending);
2369 2354
2355 /* complete a check operation */
2356 if (test_and_clear_bit(STRIPE_OP_CHECK, &sh->ops.complete)) {
2357 clear_bit(STRIPE_OP_CHECK, &sh->ops.ack);
2358 clear_bit(STRIPE_OP_CHECK, &sh->ops.pending);
2359 if (s->failed == 0) {
2370 if (sh->ops.zero_sum_result == 0) 2360 if (sh->ops.zero_sum_result == 0)
2371 /* parity is correct (on disc, 2361 /* parity is correct (on disc,
2372 * not in buffer any more) 2362 * not in buffer any more)
@@ -2391,7 +2381,8 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
2391 s->uptodate++; 2381 s->uptodate++;
2392 } 2382 }
2393 } 2383 }
2394 } 2384 } else
2385 canceled_check = 1; /* STRIPE_INSYNC is not set */
2395 } 2386 }
2396 2387
2397 /* check if we can clear a parity disk reconstruct */ 2388 /* check if we can clear a parity disk reconstruct */
@@ -2404,12 +2395,28 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh,
2404 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending); 2395 clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending);
2405 } 2396 }
2406 2397
2398 /* start a new check operation if there are no failures, the stripe is
2399 * not insync, and a repair is not in flight
2400 */
2401 if (s->failed == 0 &&
2402 !test_bit(STRIPE_INSYNC, &sh->state) &&
2403 !test_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending)) {
2404 if (!test_and_set_bit(STRIPE_OP_CHECK, &sh->ops.pending)) {
2405 BUG_ON(s->uptodate != disks);
2406 clear_bit(R5_UPTODATE, &sh->dev[sh->pd_idx].flags);
2407 sh->ops.count++;
2408 s->uptodate--;
2409 }
2410 }
2411
2407 /* Wait for check parity and compute block operations to complete 2412 /* Wait for check parity and compute block operations to complete
2408 * before write-back 2413 * before write-back. If a failure occurred while the check operation
2414 * was in flight we need to cycle this stripe through handle_stripe
2415 * since the parity block may not be uptodate
2409 */ 2416 */
2410 if (!test_bit(STRIPE_INSYNC, &sh->state) && 2417 if (!canceled_check && !test_bit(STRIPE_INSYNC, &sh->state) &&
2411 !test_bit(STRIPE_OP_CHECK, &sh->ops.pending) && 2418 !test_bit(STRIPE_OP_CHECK, &sh->ops.pending) &&
2412 !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending)) { 2419 !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending)) {
2413 struct r5dev *dev; 2420 struct r5dev *dev;
2414 /* either failed parity check, or recovery is happening */ 2421 /* either failed parity check, or recovery is happening */
2415 if (s->failed == 0) 2422 if (s->failed == 0)
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 058ccac700d0..e171650766ce 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -154,6 +154,7 @@ static struct platform_driver ssc_driver = {
154 .remove = __devexit_p(ssc_remove), 154 .remove = __devexit_p(ssc_remove),
155 .driver = { 155 .driver = {
156 .name = "ssc", 156 .name = "ssc",
157 .owner = THIS_MODULE,
157 }, 158 },
158}; 159};
159 160
@@ -172,3 +173,4 @@ module_exit(ssc_exit);
172MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); 173MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>");
173MODULE_DESCRIPTION("SSC driver for Atmel AVR32 and AT91"); 174MODULE_DESCRIPTION("SSC driver for Atmel AVR32 and AT91");
174MODULE_LICENSE("GPL"); 175MODULE_LICENSE("GPL");
176MODULE_ALIAS("platform:ssc");
diff --git a/drivers/misc/atmel_pwm.c b/drivers/misc/atmel_pwm.c
index f8d3b9a76cbd..0d5ce03cdff2 100644
--- a/drivers/misc/atmel_pwm.c
+++ b/drivers/misc/atmel_pwm.c
@@ -407,3 +407,4 @@ module_exit(pwm_exit);
407 407
408MODULE_DESCRIPTION("Driver for AT32/AT91 PWM module"); 408MODULE_DESCRIPTION("Driver for AT32/AT91 PWM module");
409MODULE_LICENSE("GPL"); 409MODULE_LICENSE("GPL");
410MODULE_ALIAS("platform:atmel_pwm");
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
index aa8ce7abe922..302e92418bbe 100644
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -164,6 +164,7 @@ static struct platform_driver hdpu_cpustate_driver = {
164 .remove = hdpu_cpustate_remove, 164 .remove = hdpu_cpustate_remove,
165 .driver = { 165 .driver = {
166 .name = HDPU_CPUSTATE_NAME, 166 .name = HDPU_CPUSTATE_NAME,
167 .owner = THIS_MODULE,
167 }, 168 },
168}; 169};
169 170
@@ -248,3 +249,4 @@ module_exit(cpustate_exit);
248 249
249MODULE_AUTHOR("Brian Waite"); 250MODULE_AUTHOR("Brian Waite");
250MODULE_LICENSE("GPL"); 251MODULE_LICENSE("GPL");
252MODULE_ALIAS("platform:" HDPU_CPUSTATE_NAME);
diff --git a/drivers/misc/hdpuftrs/hdpu_nexus.c b/drivers/misc/hdpuftrs/hdpu_nexus.c
index 2887b2147980..2fa36f7a6eb3 100644
--- a/drivers/misc/hdpuftrs/hdpu_nexus.c
+++ b/drivers/misc/hdpuftrs/hdpu_nexus.c
@@ -55,6 +55,7 @@ static struct platform_driver hdpu_nexus_driver = {
55 .remove = hdpu_nexus_remove, 55 .remove = hdpu_nexus_remove,
56 .driver = { 56 .driver = {
57 .name = HDPU_NEXUS_NAME, 57 .name = HDPU_NEXUS_NAME,
58 .owner = THIS_MODULE,
58 }, 59 },
59}; 60};
60 61
@@ -151,3 +152,4 @@ module_exit(nexus_exit);
151 152
152MODULE_AUTHOR("Brian Waite"); 153MODULE_AUTHOR("Brian Waite");
153MODULE_LICENSE("GPL"); 154MODULE_LICENSE("GPL");
155MODULE_ALIAS("platform:" HDPU_NEXUS_NAME);
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c
index 21acecc9fe3a..a28fc2f68ce2 100644
--- a/drivers/mmc/host/at91_mci.c
+++ b/drivers/mmc/host/at91_mci.c
@@ -1075,3 +1075,4 @@ module_exit(at91_mci_exit);
1075MODULE_DESCRIPTION("AT91 Multimedia Card Interface driver"); 1075MODULE_DESCRIPTION("AT91 Multimedia Card Interface driver");
1076MODULE_AUTHOR("Nick Randell"); 1076MODULE_AUTHOR("Nick Randell");
1077MODULE_LICENSE("GPL"); 1077MODULE_LICENSE("GPL");
1078MODULE_ALIAS("platform:at91_mci");
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index c3926eb3bf43..cc5f7bc546af 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -998,6 +998,7 @@ static struct platform_driver au1xmmc_driver = {
998 .resume = NULL, 998 .resume = NULL,
999 .driver = { 999 .driver = {
1000 .name = DRIVER_NAME, 1000 .name = DRIVER_NAME,
1001 .owner = THIS_MODULE,
1001 }, 1002 },
1002}; 1003};
1003 1004
@@ -1018,5 +1019,6 @@ module_exit(au1xmmc_exit);
1018MODULE_AUTHOR("Advanced Micro Devices, Inc"); 1019MODULE_AUTHOR("Advanced Micro Devices, Inc");
1019MODULE_DESCRIPTION("MMC/SD driver for the Alchemy Au1XXX"); 1020MODULE_DESCRIPTION("MMC/SD driver for the Alchemy Au1XXX");
1020MODULE_LICENSE("GPL"); 1021MODULE_LICENSE("GPL");
1022MODULE_ALIAS("platform:au1xxx-mmc");
1021#endif 1023#endif
1022 1024
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index f2070a19cfa7..95f33e87a99c 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -1128,6 +1128,7 @@ static struct platform_driver imxmci_driver = {
1128 .resume = imxmci_resume, 1128 .resume = imxmci_resume,
1129 .driver = { 1129 .driver = {
1130 .name = DRIVER_NAME, 1130 .name = DRIVER_NAME,
1131 .owner = THIS_MODULE,
1131 } 1132 }
1132}; 1133};
1133 1134
@@ -1147,3 +1148,4 @@ module_exit(imxmci_exit);
1147MODULE_DESCRIPTION("i.MX Multimedia Card Interface Driver"); 1148MODULE_DESCRIPTION("i.MX Multimedia Card Interface Driver");
1148MODULE_AUTHOR("Sascha Hauer, Pengutronix"); 1149MODULE_AUTHOR("Sascha Hauer, Pengutronix");
1149MODULE_LICENSE("GPL"); 1150MODULE_LICENSE("GPL");
1151MODULE_ALIAS("platform:imx-mmc");
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index c9dfeb15b487..90c358b57d1c 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1255,6 +1255,7 @@ static struct platform_driver mmc_omap_driver = {
1255 .resume = mmc_omap_resume, 1255 .resume = mmc_omap_resume,
1256 .driver = { 1256 .driver = {
1257 .name = DRIVER_NAME, 1257 .name = DRIVER_NAME,
1258 .owner = THIS_MODULE,
1258 }, 1259 },
1259}; 1260};
1260 1261
@@ -1273,5 +1274,5 @@ module_exit(mmc_omap_exit);
1273 1274
1274MODULE_DESCRIPTION("OMAP Multimedia Card driver"); 1275MODULE_DESCRIPTION("OMAP Multimedia Card driver");
1275MODULE_LICENSE("GPL"); 1276MODULE_LICENSE("GPL");
1276MODULE_ALIAS(DRIVER_NAME); 1277MODULE_ALIAS("platform:" DRIVER_NAME);
1277MODULE_AUTHOR("Juha Yrjölä"); 1278MODULE_AUTHOR("Juha Yrjölä");
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 1ea8482037bb..65210fca37ed 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -693,6 +693,7 @@ static struct platform_driver pxamci_driver = {
693 .resume = pxamci_resume, 693 .resume = pxamci_resume,
694 .driver = { 694 .driver = {
695 .name = DRIVER_NAME, 695 .name = DRIVER_NAME,
696 .owner = THIS_MODULE,
696 }, 697 },
697}; 698};
698 699
@@ -711,3 +712,4 @@ module_exit(pxamci_exit);
711 712
712MODULE_DESCRIPTION("PXA Multimedia Card Interface Driver"); 713MODULE_DESCRIPTION("PXA Multimedia Card Interface Driver");
713MODULE_LICENSE("GPL"); 714MODULE_LICENSE("GPL");
715MODULE_ALIAS("platform:pxa2xx-mci");
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index 4d5f37421874..be624a049c67 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1948,6 +1948,7 @@ static struct platform_driver wbsd_driver = {
1948 .resume = wbsd_platform_resume, 1948 .resume = wbsd_platform_resume,
1949 .driver = { 1949 .driver = {
1950 .name = DRIVER_NAME, 1950 .name = DRIVER_NAME,
1951 .owner = THIS_MODULE,
1951 }, 1952 },
1952}; 1953};
1953 1954
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index d072e87ce4e2..458d477614d6 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1763,6 +1763,7 @@ static void cfi_amdstd_sync (struct mtd_info *mtd)
1763 1763
1764 default: 1764 default:
1765 /* Not an idle state */ 1765 /* Not an idle state */
1766 set_current_state(TASK_UNINTERRUPTIBLE);
1766 add_wait_queue(&chip->wq, &wait); 1767 add_wait_queue(&chip->wq, &wait);
1767 1768
1768 spin_unlock(chip->mutex); 1769 spin_unlock(chip->mutex);
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index b344ff858b2d..492e2ab27420 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -1015,6 +1015,7 @@ static void cfi_staa_sync (struct mtd_info *mtd)
1015 1015
1016 default: 1016 default:
1017 /* Not an idle state */ 1017 /* Not an idle state */
1018 set_current_state(TASK_UNINTERRUPTIBLE);
1018 add_wait_queue(&chip->wq, &wait); 1019 add_wait_queue(&chip->wq, &wait);
1019 1020
1020 spin_unlock_bh(chip->mutex); 1021 spin_unlock_bh(chip->mutex);
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 25f1337cd02c..59dce6aa0865 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -148,7 +148,7 @@ static inline void b44_sync_dma_desc_for_device(struct ssb_device *sdev,
148 unsigned long offset, 148 unsigned long offset,
149 enum dma_data_direction dir) 149 enum dma_data_direction dir)
150{ 150{
151 dma_sync_single_range_for_device(sdev->dev, dma_base, 151 dma_sync_single_range_for_device(sdev->dma_dev, dma_base,
152 offset & dma_desc_align_mask, 152 offset & dma_desc_align_mask,
153 dma_desc_sync_size, dir); 153 dma_desc_sync_size, dir);
154} 154}
@@ -158,7 +158,7 @@ static inline void b44_sync_dma_desc_for_cpu(struct ssb_device *sdev,
158 unsigned long offset, 158 unsigned long offset,
159 enum dma_data_direction dir) 159 enum dma_data_direction dir)
160{ 160{
161 dma_sync_single_range_for_cpu(sdev->dev, dma_base, 161 dma_sync_single_range_for_cpu(sdev->dma_dev, dma_base,
162 offset & dma_desc_align_mask, 162 offset & dma_desc_align_mask,
163 dma_desc_sync_size, dir); 163 dma_desc_sync_size, dir);
164} 164}
@@ -613,7 +613,7 @@ static void b44_tx(struct b44 *bp)
613 613
614 BUG_ON(skb == NULL); 614 BUG_ON(skb == NULL);
615 615
616 dma_unmap_single(bp->sdev->dev, 616 dma_unmap_single(bp->sdev->dma_dev,
617 rp->mapping, 617 rp->mapping,
618 skb->len, 618 skb->len,
619 DMA_TO_DEVICE); 619 DMA_TO_DEVICE);
@@ -653,7 +653,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
653 if (skb == NULL) 653 if (skb == NULL)
654 return -ENOMEM; 654 return -ENOMEM;
655 655
656 mapping = dma_map_single(bp->sdev->dev, skb->data, 656 mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
657 RX_PKT_BUF_SZ, 657 RX_PKT_BUF_SZ,
658 DMA_FROM_DEVICE); 658 DMA_FROM_DEVICE);
659 659
@@ -663,19 +663,19 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
663 mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) { 663 mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) {
664 /* Sigh... */ 664 /* Sigh... */
665 if (!dma_mapping_error(mapping)) 665 if (!dma_mapping_error(mapping))
666 dma_unmap_single(bp->sdev->dev, mapping, 666 dma_unmap_single(bp->sdev->dma_dev, mapping,
667 RX_PKT_BUF_SZ, DMA_FROM_DEVICE); 667 RX_PKT_BUF_SZ, DMA_FROM_DEVICE);
668 dev_kfree_skb_any(skb); 668 dev_kfree_skb_any(skb);
669 skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA); 669 skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA);
670 if (skb == NULL) 670 if (skb == NULL)
671 return -ENOMEM; 671 return -ENOMEM;
672 mapping = dma_map_single(bp->sdev->dev, skb->data, 672 mapping = dma_map_single(bp->sdev->dma_dev, skb->data,
673 RX_PKT_BUF_SZ, 673 RX_PKT_BUF_SZ,
674 DMA_FROM_DEVICE); 674 DMA_FROM_DEVICE);
675 if (dma_mapping_error(mapping) || 675 if (dma_mapping_error(mapping) ||
676 mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) { 676 mapping + RX_PKT_BUF_SZ > DMA_30BIT_MASK) {
677 if (!dma_mapping_error(mapping)) 677 if (!dma_mapping_error(mapping))
678 dma_unmap_single(bp->sdev->dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE); 678 dma_unmap_single(bp->sdev->dma_dev, mapping, RX_PKT_BUF_SZ,DMA_FROM_DEVICE);
679 dev_kfree_skb_any(skb); 679 dev_kfree_skb_any(skb);
680 return -ENOMEM; 680 return -ENOMEM;
681 } 681 }
@@ -750,7 +750,7 @@ static void b44_recycle_rx(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
750 dest_idx * sizeof(dest_desc), 750 dest_idx * sizeof(dest_desc),
751 DMA_BIDIRECTIONAL); 751 DMA_BIDIRECTIONAL);
752 752
753 dma_sync_single_for_device(bp->sdev->dev, le32_to_cpu(src_desc->addr), 753 dma_sync_single_for_device(bp->sdev->dma_dev, le32_to_cpu(src_desc->addr),
754 RX_PKT_BUF_SZ, 754 RX_PKT_BUF_SZ,
755 DMA_FROM_DEVICE); 755 DMA_FROM_DEVICE);
756} 756}
@@ -772,7 +772,7 @@ static int b44_rx(struct b44 *bp, int budget)
772 struct rx_header *rh; 772 struct rx_header *rh;
773 u16 len; 773 u16 len;
774 774
775 dma_sync_single_for_cpu(bp->sdev->dev, map, 775 dma_sync_single_for_cpu(bp->sdev->dma_dev, map,
776 RX_PKT_BUF_SZ, 776 RX_PKT_BUF_SZ,
777 DMA_FROM_DEVICE); 777 DMA_FROM_DEVICE);
778 rh = (struct rx_header *) skb->data; 778 rh = (struct rx_header *) skb->data;
@@ -806,7 +806,7 @@ static int b44_rx(struct b44 *bp, int budget)
806 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); 806 skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod);
807 if (skb_size < 0) 807 if (skb_size < 0)
808 goto drop_it; 808 goto drop_it;
809 dma_unmap_single(bp->sdev->dev, map, 809 dma_unmap_single(bp->sdev->dma_dev, map,
810 skb_size, DMA_FROM_DEVICE); 810 skb_size, DMA_FROM_DEVICE);
811 /* Leave out rx_header */ 811 /* Leave out rx_header */
812 skb_put(skb, len + RX_PKT_OFFSET); 812 skb_put(skb, len + RX_PKT_OFFSET);
@@ -966,24 +966,24 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
966 goto err_out; 966 goto err_out;
967 } 967 }
968 968
969 mapping = dma_map_single(bp->sdev->dev, skb->data, len, DMA_TO_DEVICE); 969 mapping = dma_map_single(bp->sdev->dma_dev, skb->data, len, DMA_TO_DEVICE);
970 if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { 970 if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) {
971 struct sk_buff *bounce_skb; 971 struct sk_buff *bounce_skb;
972 972
973 /* Chip can't handle DMA to/from >1GB, use bounce buffer */ 973 /* Chip can't handle DMA to/from >1GB, use bounce buffer */
974 if (!dma_mapping_error(mapping)) 974 if (!dma_mapping_error(mapping))
975 dma_unmap_single(bp->sdev->dev, mapping, len, 975 dma_unmap_single(bp->sdev->dma_dev, mapping, len,
976 DMA_TO_DEVICE); 976 DMA_TO_DEVICE);
977 977
978 bounce_skb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA); 978 bounce_skb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA);
979 if (!bounce_skb) 979 if (!bounce_skb)
980 goto err_out; 980 goto err_out;
981 981
982 mapping = dma_map_single(bp->sdev->dev, bounce_skb->data, 982 mapping = dma_map_single(bp->sdev->dma_dev, bounce_skb->data,
983 len, DMA_TO_DEVICE); 983 len, DMA_TO_DEVICE);
984 if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { 984 if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) {
985 if (!dma_mapping_error(mapping)) 985 if (!dma_mapping_error(mapping))
986 dma_unmap_single(bp->sdev->dev, mapping, 986 dma_unmap_single(bp->sdev->dma_dev, mapping,
987 len, DMA_TO_DEVICE); 987 len, DMA_TO_DEVICE);
988 dev_kfree_skb_any(bounce_skb); 988 dev_kfree_skb_any(bounce_skb);
989 goto err_out; 989 goto err_out;
@@ -1082,7 +1082,7 @@ static void b44_free_rings(struct b44 *bp)
1082 1082
1083 if (rp->skb == NULL) 1083 if (rp->skb == NULL)
1084 continue; 1084 continue;
1085 dma_unmap_single(bp->sdev->dev, rp->mapping, RX_PKT_BUF_SZ, 1085 dma_unmap_single(bp->sdev->dma_dev, rp->mapping, RX_PKT_BUF_SZ,
1086 DMA_FROM_DEVICE); 1086 DMA_FROM_DEVICE);
1087 dev_kfree_skb_any(rp->skb); 1087 dev_kfree_skb_any(rp->skb);
1088 rp->skb = NULL; 1088 rp->skb = NULL;
@@ -1094,7 +1094,7 @@ static void b44_free_rings(struct b44 *bp)
1094 1094
1095 if (rp->skb == NULL) 1095 if (rp->skb == NULL)
1096 continue; 1096 continue;
1097 dma_unmap_single(bp->sdev->dev, rp->mapping, rp->skb->len, 1097 dma_unmap_single(bp->sdev->dma_dev, rp->mapping, rp->skb->len,
1098 DMA_TO_DEVICE); 1098 DMA_TO_DEVICE);
1099 dev_kfree_skb_any(rp->skb); 1099 dev_kfree_skb_any(rp->skb);
1100 rp->skb = NULL; 1100 rp->skb = NULL;
@@ -1117,12 +1117,12 @@ static void b44_init_rings(struct b44 *bp)
1117 memset(bp->tx_ring, 0, B44_TX_RING_BYTES); 1117 memset(bp->tx_ring, 0, B44_TX_RING_BYTES);
1118 1118
1119 if (bp->flags & B44_FLAG_RX_RING_HACK) 1119 if (bp->flags & B44_FLAG_RX_RING_HACK)
1120 dma_sync_single_for_device(bp->sdev->dev, bp->rx_ring_dma, 1120 dma_sync_single_for_device(bp->sdev->dma_dev, bp->rx_ring_dma,
1121 DMA_TABLE_BYTES, 1121 DMA_TABLE_BYTES,
1122 DMA_BIDIRECTIONAL); 1122 DMA_BIDIRECTIONAL);
1123 1123
1124 if (bp->flags & B44_FLAG_TX_RING_HACK) 1124 if (bp->flags & B44_FLAG_TX_RING_HACK)
1125 dma_sync_single_for_device(bp->sdev->dev, bp->tx_ring_dma, 1125 dma_sync_single_for_device(bp->sdev->dma_dev, bp->tx_ring_dma,
1126 DMA_TABLE_BYTES, 1126 DMA_TABLE_BYTES,
1127 DMA_TO_DEVICE); 1127 DMA_TO_DEVICE);
1128 1128
@@ -1144,24 +1144,24 @@ static void b44_free_consistent(struct b44 *bp)
1144 bp->tx_buffers = NULL; 1144 bp->tx_buffers = NULL;
1145 if (bp->rx_ring) { 1145 if (bp->rx_ring) {
1146 if (bp->flags & B44_FLAG_RX_RING_HACK) { 1146 if (bp->flags & B44_FLAG_RX_RING_HACK) {
1147 dma_unmap_single(bp->sdev->dev, bp->rx_ring_dma, 1147 dma_unmap_single(bp->sdev->dma_dev, bp->rx_ring_dma,
1148 DMA_TABLE_BYTES, 1148 DMA_TABLE_BYTES,
1149 DMA_BIDIRECTIONAL); 1149 DMA_BIDIRECTIONAL);
1150 kfree(bp->rx_ring); 1150 kfree(bp->rx_ring);
1151 } else 1151 } else
1152 dma_free_coherent(bp->sdev->dev, DMA_TABLE_BYTES, 1152 dma_free_coherent(bp->sdev->dma_dev, DMA_TABLE_BYTES,
1153 bp->rx_ring, bp->rx_ring_dma); 1153 bp->rx_ring, bp->rx_ring_dma);
1154 bp->rx_ring = NULL; 1154 bp->rx_ring = NULL;
1155 bp->flags &= ~B44_FLAG_RX_RING_HACK; 1155 bp->flags &= ~B44_FLAG_RX_RING_HACK;
1156 } 1156 }
1157 if (bp->tx_ring) { 1157 if (bp->tx_ring) {
1158 if (bp->flags & B44_FLAG_TX_RING_HACK) { 1158 if (bp->flags & B44_FLAG_TX_RING_HACK) {
1159 dma_unmap_single(bp->sdev->dev, bp->tx_ring_dma, 1159 dma_unmap_single(bp->sdev->dma_dev, bp->tx_ring_dma,
1160 DMA_TABLE_BYTES, 1160 DMA_TABLE_BYTES,
1161 DMA_TO_DEVICE); 1161 DMA_TO_DEVICE);
1162 kfree(bp->tx_ring); 1162 kfree(bp->tx_ring);
1163 } else 1163 } else
1164 dma_free_coherent(bp->sdev->dev, DMA_TABLE_BYTES, 1164 dma_free_coherent(bp->sdev->dma_dev, DMA_TABLE_BYTES,
1165 bp->tx_ring, bp->tx_ring_dma); 1165 bp->tx_ring, bp->tx_ring_dma);
1166 bp->tx_ring = NULL; 1166 bp->tx_ring = NULL;
1167 bp->flags &= ~B44_FLAG_TX_RING_HACK; 1167 bp->flags &= ~B44_FLAG_TX_RING_HACK;
@@ -1187,7 +1187,7 @@ static int b44_alloc_consistent(struct b44 *bp, gfp_t gfp)
1187 goto out_err; 1187 goto out_err;
1188 1188
1189 size = DMA_TABLE_BYTES; 1189 size = DMA_TABLE_BYTES;
1190 bp->rx_ring = dma_alloc_coherent(bp->sdev->dev, size, &bp->rx_ring_dma, gfp); 1190 bp->rx_ring = dma_alloc_coherent(bp->sdev->dma_dev, size, &bp->rx_ring_dma, gfp);
1191 if (!bp->rx_ring) { 1191 if (!bp->rx_ring) {
1192 /* Allocation may have failed due to pci_alloc_consistent 1192 /* Allocation may have failed due to pci_alloc_consistent
1193 insisting on use of GFP_DMA, which is more restrictive 1193 insisting on use of GFP_DMA, which is more restrictive
@@ -1199,7 +1199,7 @@ static int b44_alloc_consistent(struct b44 *bp, gfp_t gfp)
1199 if (!rx_ring) 1199 if (!rx_ring)
1200 goto out_err; 1200 goto out_err;
1201 1201
1202 rx_ring_dma = dma_map_single(bp->sdev->dev, rx_ring, 1202 rx_ring_dma = dma_map_single(bp->sdev->dma_dev, rx_ring,
1203 DMA_TABLE_BYTES, 1203 DMA_TABLE_BYTES,
1204 DMA_BIDIRECTIONAL); 1204 DMA_BIDIRECTIONAL);
1205 1205
@@ -1214,7 +1214,7 @@ static int b44_alloc_consistent(struct b44 *bp, gfp_t gfp)
1214 bp->flags |= B44_FLAG_RX_RING_HACK; 1214 bp->flags |= B44_FLAG_RX_RING_HACK;
1215 } 1215 }
1216 1216
1217 bp->tx_ring = dma_alloc_coherent(bp->sdev->dev, size, &bp->tx_ring_dma, gfp); 1217 bp->tx_ring = dma_alloc_coherent(bp->sdev->dma_dev, size, &bp->tx_ring_dma, gfp);
1218 if (!bp->tx_ring) { 1218 if (!bp->tx_ring) {
1219 /* Allocation may have failed due to dma_alloc_coherent 1219 /* Allocation may have failed due to dma_alloc_coherent
1220 insisting on use of GFP_DMA, which is more restrictive 1220 insisting on use of GFP_DMA, which is more restrictive
@@ -1226,7 +1226,7 @@ static int b44_alloc_consistent(struct b44 *bp, gfp_t gfp)
1226 if (!tx_ring) 1226 if (!tx_ring)
1227 goto out_err; 1227 goto out_err;
1228 1228
1229 tx_ring_dma = dma_map_single(bp->sdev->dev, tx_ring, 1229 tx_ring_dma = dma_map_single(bp->sdev->dma_dev, tx_ring,
1230 DMA_TABLE_BYTES, 1230 DMA_TABLE_BYTES,
1231 DMA_TO_DEVICE); 1231 DMA_TO_DEVICE);
1232 1232
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c
index de32b3fba322..7bdb5af35951 100644
--- a/drivers/net/bnx2x.c
+++ b/drivers/net/bnx2x.c
@@ -63,8 +63,8 @@
63#include "bnx2x.h" 63#include "bnx2x.h"
64#include "bnx2x_init.h" 64#include "bnx2x_init.h"
65 65
66#define DRV_MODULE_VERSION "1.42.3" 66#define DRV_MODULE_VERSION "1.42.4"
67#define DRV_MODULE_RELDATE "2008/3/9" 67#define DRV_MODULE_RELDATE "2008/4/9"
68#define BNX2X_BC_VER 0x040200 68#define BNX2X_BC_VER 0x040200
69 69
70/* Time in jiffies before concluding the transmitter is hung. */ 70/* Time in jiffies before concluding the transmitter is hung. */
@@ -6153,7 +6153,7 @@ static int bnx2x_function_init(struct bnx2x *bp, int mode)
6153 func, mode); 6153 func, mode);
6154 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 6154 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET,
6155 0xffffffff); 6155 0xffffffff);
6156 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, 6156 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET,
6157 0xfffc); 6157 0xfffc);
6158 bnx2x_init_block(bp, MISC_COMMON_START, MISC_COMMON_END); 6158 bnx2x_init_block(bp, MISC_COMMON_START, MISC_COMMON_END);
6159 6159
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 93b7fb246960..a8d3280923e8 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -40,7 +40,7 @@
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42#define DRV_NAME "ehea" 42#define DRV_NAME "ehea"
43#define DRV_VERSION "EHEA_0089" 43#define DRV_VERSION "EHEA_0090"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
@@ -371,6 +371,7 @@ struct ehea_port_res {
371 struct ehea_q_skb_arr rq2_skba; 371 struct ehea_q_skb_arr rq2_skba;
372 struct ehea_q_skb_arr rq3_skba; 372 struct ehea_q_skb_arr rq3_skba;
373 struct ehea_q_skb_arr sq_skba; 373 struct ehea_q_skb_arr sq_skba;
374 int sq_skba_size;
374 spinlock_t netif_queue; 375 spinlock_t netif_queue;
375 int queue_stopped; 376 int queue_stopped;
376 int swqe_refill_th; 377 int swqe_refill_th;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 07c742dd3f09..f460b623c077 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -349,7 +349,8 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
349 pr->rq1_skba.os_skbs = 0; 349 pr->rq1_skba.os_skbs = 0;
350 350
351 if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) { 351 if (unlikely(test_bit(__EHEA_STOP_XFER, &ehea_driver_flags))) {
352 pr->rq1_skba.index = index; 352 if (nr_of_wqes > 0)
353 pr->rq1_skba.index = index;
353 pr->rq1_skba.os_skbs = fill_wqes; 354 pr->rq1_skba.os_skbs = fill_wqes;
354 return; 355 return;
355 } 356 }
@@ -1464,7 +1465,9 @@ static int ehea_init_port_res(struct ehea_port *port, struct ehea_port_res *pr,
1464 init_attr->act_nr_rwqes_rq2, 1465 init_attr->act_nr_rwqes_rq2,
1465 init_attr->act_nr_rwqes_rq3); 1466 init_attr->act_nr_rwqes_rq3);
1466 1467
1467 ret = ehea_init_q_skba(&pr->sq_skba, init_attr->act_nr_send_wqes + 1); 1468 pr->sq_skba_size = init_attr->act_nr_send_wqes + 1;
1469
1470 ret = ehea_init_q_skba(&pr->sq_skba, pr->sq_skba_size);
1468 ret |= ehea_init_q_skba(&pr->rq1_skba, init_attr->act_nr_rwqes_rq1 + 1); 1471 ret |= ehea_init_q_skba(&pr->rq1_skba, init_attr->act_nr_rwqes_rq1 + 1);
1469 ret |= ehea_init_q_skba(&pr->rq2_skba, init_attr->act_nr_rwqes_rq2 + 1); 1472 ret |= ehea_init_q_skba(&pr->rq2_skba, init_attr->act_nr_rwqes_rq2 + 1);
1470 ret |= ehea_init_q_skba(&pr->rq3_skba, init_attr->act_nr_rwqes_rq3 + 1); 1473 ret |= ehea_init_q_skba(&pr->rq3_skba, init_attr->act_nr_rwqes_rq3 + 1);
@@ -2621,6 +2624,22 @@ void ehea_purge_sq(struct ehea_qp *orig_qp)
2621 } 2624 }
2622} 2625}
2623 2626
2627void ehea_flush_sq(struct ehea_port *port)
2628{
2629 int i;
2630
2631 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
2632 struct ehea_port_res *pr = &port->port_res[i];
2633 int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count;
2634 int k = 0;
2635 while (atomic_read(&pr->swqe_avail) < swqe_max) {
2636 msleep(5);
2637 if (++k == 20)
2638 break;
2639 }
2640 }
2641}
2642
2624int ehea_stop_qps(struct net_device *dev) 2643int ehea_stop_qps(struct net_device *dev)
2625{ 2644{
2626 struct ehea_port *port = netdev_priv(dev); 2645 struct ehea_port *port = netdev_priv(dev);
@@ -2845,6 +2864,7 @@ static void ehea_rereg_mrs(struct work_struct *work)
2845 if (dev->flags & IFF_UP) { 2864 if (dev->flags & IFF_UP) {
2846 down(&port->port_lock); 2865 down(&port->port_lock);
2847 netif_stop_queue(dev); 2866 netif_stop_queue(dev);
2867 ehea_flush_sq(port);
2848 ret = ehea_stop_qps(dev); 2868 ret = ehea_stop_qps(dev);
2849 if (ret) { 2869 if (ret) {
2850 up(&port->port_lock); 2870 up(&port->port_lock);
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 419f533006ab..9f088a47d8b1 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5316,8 +5316,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5316 5316
5317 /* check the workaround bit for correct mac address order */ 5317 /* check the workaround bit for correct mac address order */
5318 txreg = readl(base + NvRegTransmitPoll); 5318 txreg = readl(base + NvRegTransmitPoll);
5319 if ((txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) || 5319 if (id->driver_data & DEV_HAS_CORRECT_MACADDR) {
5320 (id->driver_data & DEV_HAS_CORRECT_MACADDR)) {
5321 /* mac address is already in correct order */ 5320 /* mac address is already in correct order */
5322 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff; 5321 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
5323 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff; 5322 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;
@@ -5325,6 +5324,22 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5325 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff; 5324 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
5326 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff; 5325 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
5327 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff; 5326 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
5327 } else if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) {
5328 /* mac address is already in correct order */
5329 dev->dev_addr[0] = (np->orig_mac[0] >> 0) & 0xff;
5330 dev->dev_addr[1] = (np->orig_mac[0] >> 8) & 0xff;
5331 dev->dev_addr[2] = (np->orig_mac[0] >> 16) & 0xff;
5332 dev->dev_addr[3] = (np->orig_mac[0] >> 24) & 0xff;
5333 dev->dev_addr[4] = (np->orig_mac[1] >> 0) & 0xff;
5334 dev->dev_addr[5] = (np->orig_mac[1] >> 8) & 0xff;
5335 /*
5336 * Set orig mac address back to the reversed version.
5337 * This flag will be cleared during low power transition.
5338 * Therefore, we should always put back the reversed address.
5339 */
5340 np->orig_mac[0] = (dev->dev_addr[5] << 0) + (dev->dev_addr[4] << 8) +
5341 (dev->dev_addr[3] << 16) + (dev->dev_addr[2] << 24);
5342 np->orig_mac[1] = (dev->dev_addr[1] << 0) + (dev->dev_addr[0] << 8);
5328 } else { 5343 } else {
5329 /* need to reverse mac address to correct order */ 5344 /* need to reverse mac address to correct order */
5330 dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff; 5345 dev->dev_addr[0] = (np->orig_mac[1] >> 8) & 0xff;
@@ -5595,7 +5610,9 @@ out:
5595static int nv_resume(struct pci_dev *pdev) 5610static int nv_resume(struct pci_dev *pdev)
5596{ 5611{
5597 struct net_device *dev = pci_get_drvdata(pdev); 5612 struct net_device *dev = pci_get_drvdata(pdev);
5613 u8 __iomem *base = get_hwbase(dev);
5598 int rc = 0; 5614 int rc = 0;
5615 u32 txreg;
5599 5616
5600 if (!netif_running(dev)) 5617 if (!netif_running(dev))
5601 goto out; 5618 goto out;
@@ -5606,6 +5623,11 @@ static int nv_resume(struct pci_dev *pdev)
5606 pci_restore_state(pdev); 5623 pci_restore_state(pdev);
5607 pci_enable_wake(pdev, PCI_D0, 0); 5624 pci_enable_wake(pdev, PCI_D0, 0);
5608 5625
5626 /* restore mac address reverse flag */
5627 txreg = readl(base + NvRegTransmitPoll);
5628 txreg |= NVREG_TRANSMITPOLL_MAC_ADDR_REV;
5629 writel(txreg, base + NvRegTransmitPoll);
5630
5609 rc = nv_open(dev); 5631 rc = nv_open(dev);
5610out: 5632out:
5611 return rc; 5633 return rc;
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index af869cf9ae7d..940e2041ba38 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -835,7 +835,8 @@ static int fs_enet_close(struct net_device *dev)
835 835
836 netif_stop_queue(dev); 836 netif_stop_queue(dev);
837 netif_carrier_off(dev); 837 netif_carrier_off(dev);
838 napi_disable(&fep->napi); 838 if (fep->fpi->use_napi)
839 napi_disable(&fep->napi);
839 phy_stop(fep->phydev); 840 phy_stop(fep->phydev);
840 841
841 spin_lock_irqsave(&fep->lock, flags); 842 spin_lock_irqsave(&fep->lock, flags);
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 1d210ed46130..489c7c3b90d9 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -242,12 +242,12 @@ static int macb_mii_init(struct macb *bp)
242 /* Enable managment port */ 242 /* Enable managment port */
243 macb_writel(bp, NCR, MACB_BIT(MPE)); 243 macb_writel(bp, NCR, MACB_BIT(MPE));
244 244
245 bp->mii_bus.name = "MACB_mii_bus", 245 bp->mii_bus.name = "MACB_mii_bus";
246 bp->mii_bus.read = &macb_mdio_read, 246 bp->mii_bus.read = &macb_mdio_read;
247 bp->mii_bus.write = &macb_mdio_write, 247 bp->mii_bus.write = &macb_mdio_write;
248 bp->mii_bus.reset = &macb_mdio_reset, 248 bp->mii_bus.reset = &macb_mdio_reset;
249 bp->mii_bus.id = bp->pdev->id, 249 bp->mii_bus.id = bp->pdev->id;
250 bp->mii_bus.priv = bp, 250 bp->mii_bus.priv = bp;
251 bp->mii_bus.dev = &bp->dev->dev; 251 bp->mii_bus.dev = &bp->dev->dev;
252 pdata = bp->pdev->dev.platform_data; 252 pdata = bp->pdev->dev.platform_data;
253 253
@@ -1257,6 +1257,8 @@ static int __exit macb_remove(struct platform_device *pdev)
1257 1257
1258 if (dev) { 1258 if (dev) {
1259 bp = netdev_priv(dev); 1259 bp = netdev_priv(dev);
1260 if (bp->phy_dev)
1261 phy_disconnect(bp->phy_dev);
1260 mdiobus_unregister(&bp->mii_bus); 1262 mdiobus_unregister(&bp->mii_bus);
1261 kfree(bp->mii_bus.irq); 1263 kfree(bp->mii_bus.irq);
1262 unregister_netdev(dev); 1264 unregister_netdev(dev);
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 501e451be911..665341e43055 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -730,7 +730,7 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
730 730
731static struct console netconsole = { 731static struct console netconsole = {
732 .name = "netcon", 732 .name = "netcon",
733 .flags = CON_ENABLED | CON_PRINTBUFFER, 733 .flags = CON_ENABLED,
734 .write = write_msg, 734 .write = write_msg,
735}; 735};
736 736
@@ -749,6 +749,9 @@ static int __init init_netconsole(void)
749 err = PTR_ERR(nt); 749 err = PTR_ERR(nt);
750 goto fail; 750 goto fail;
751 } 751 }
752 /* Dump existing printks when we register */
753 netconsole.flags |= CON_PRINTBUFFER;
754
752 spin_lock_irqsave(&target_list_lock, flags); 755 spin_lock_irqsave(&target_list_lock, flags);
753 list_add(&nt->list, &target_list); 756 list_add(&nt->list, &target_list);
754 spin_unlock_irqrestore(&target_list_lock, flags); 757 spin_unlock_irqrestore(&target_list_lock, flags);
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index ddbc6e475e28..c16de5129a71 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -512,13 +512,18 @@ static void gelic_wl_parse_ie(u8 *data, size_t len,
512 data, len); 512 data, len);
513 memset(ie_info, 0, sizeof(struct ie_info)); 513 memset(ie_info, 0, sizeof(struct ie_info));
514 514
515 while (0 < data_left) { 515 while (2 <= data_left) {
516 item_id = *pos++; 516 item_id = *pos++;
517 item_len = *pos++; 517 item_len = *pos++;
518 data_left -= 2;
519
520 if (data_left < item_len)
521 break;
518 522
519 switch (item_id) { 523 switch (item_id) {
520 case MFIE_TYPE_GENERIC: 524 case MFIE_TYPE_GENERIC:
521 if (!memcmp(pos, wpa_oui, OUI_LEN) && 525 if ((OUI_LEN + 1 <= item_len) &&
526 !memcmp(pos, wpa_oui, OUI_LEN) &&
522 pos[OUI_LEN] == 0x01) { 527 pos[OUI_LEN] == 0x01) {
523 ie_info->wpa.data = pos - 2; 528 ie_info->wpa.data = pos - 2;
524 ie_info->wpa.len = item_len + 2; 529 ie_info->wpa.len = item_len + 2;
@@ -535,7 +540,7 @@ static void gelic_wl_parse_ie(u8 *data, size_t len,
535 break; 540 break;
536 } 541 }
537 pos += item_len; 542 pos += item_len;
538 data_left -= item_len + 2; 543 data_left -= item_len;
539 } 544 }
540 pr_debug("%s: wpa=%p,%d wpa2=%p,%d\n", __func__, 545 pr_debug("%s: wpa=%p,%d wpa2=%p,%d\n", __func__,
541 ie_info->wpa.data, ie_info->wpa.len, 546 ie_info->wpa.data, ie_info->wpa.len,
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 37b42394560d..15fcee55284e 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1446,6 +1446,7 @@ static int __devinit sc92031_probe(struct pci_dev *pdev,
1446 } 1446 }
1447 1447
1448 pci_set_drvdata(pdev, dev); 1448 pci_set_drvdata(pdev, dev);
1449 SET_NETDEV_DEV(dev, &pdev->dev);
1449 1450
1450#if SC92031_USE_BAR == 0 1451#if SC92031_USE_BAR == 0
1451 dev->mem_start = pci_resource_start(pdev, SC92031_USE_BAR); 1452 dev->mem_start = pci_resource_start(pdev, SC92031_USE_BAR);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 853bce0ac478..f226bcac7d17 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -154,6 +154,7 @@ static const char *yukon2_name[] = {
154 "EC", /* 0xb6 */ 154 "EC", /* 0xb6 */
155 "FE", /* 0xb7 */ 155 "FE", /* 0xb7 */
156 "FE+", /* 0xb8 */ 156 "FE+", /* 0xb8 */
157 "Supreme", /* 0xb9 */
157}; 158};
158 159
159static void sky2_set_multicast(struct net_device *dev); 160static void sky2_set_multicast(struct net_device *dev);
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 4020e9e955b3..63a54e29d563 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1326,9 +1326,11 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
1326 SMC_SET_INT_MASK(mask); 1326 SMC_SET_INT_MASK(mask);
1327 spin_unlock(&lp->lock); 1327 spin_unlock(&lp->lock);
1328 1328
1329#ifndef CONFIG_NET_POLL_CONTROLLER
1329 if (timeout == MAX_IRQ_LOOPS) 1330 if (timeout == MAX_IRQ_LOOPS)
1330 PRINTK("%s: spurious interrupt (mask = 0x%02x)\n", 1331 PRINTK("%s: spurious interrupt (mask = 0x%02x)\n",
1331 dev->name, mask); 1332 dev->name, mask);
1333#endif
1332 DBG(3, "%s: Interrupt done (%d loops)\n", 1334 DBG(3, "%s: Interrupt done (%d loops)\n",
1333 dev->name, MAX_IRQ_LOOPS - timeout); 1335 dev->name, MAX_IRQ_LOOPS - timeout);
1334 1336
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index c49214feae91..7b7b1717b0d1 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1472,13 +1472,12 @@ static int __netdev_rx(struct net_device *dev, int *quota)
1472#ifndef final_version /* Remove after testing. */ 1472#ifndef final_version /* Remove after testing. */
1473 /* You will want this info for the initial debug. */ 1473 /* You will want this info for the initial debug. */
1474 if (debug > 5) { 1474 if (debug > 5) {
1475 DECLARE_MAC_BUF(mac); 1475 printk(KERN_DEBUG " Rx data " MAC_FMT " " MAC_FMT
1476 DECLARE_MAC_BUF(mac2);
1477
1478 printk(KERN_DEBUG " Rx data %s %s"
1479 " %2.2x%2.2x.\n", 1476 " %2.2x%2.2x.\n",
1480 print_mac(mac, &skb->data[0]), 1477 skb->data[0], skb->data[1], skb->data[2],
1481 print_mac(mac2, &skb->data[6]), 1478 skb->data[3], skb->data[4], skb->data[5],
1479 skb->data[6], skb->data[7], skb->data[8],
1480 skb->data[9], skb->data[10], skb->data[11],
1482 skb->data[12], skb->data[13]); 1481 skb->data[12], skb->data[13]);
1483 } 1482 }
1484#endif 1483#endif
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d4655b2d1f3f..96043c5746d0 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.89" 67#define DRV_MODULE_VERSION "3.90"
68#define DRV_MODULE_RELDATE "April 03, 2008" 68#define DRV_MODULE_RELDATE "April 12, 2008"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -12578,7 +12578,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12578 const struct pci_device_id *ent) 12578 const struct pci_device_id *ent)
12579{ 12579{
12580 static int tg3_version_printed = 0; 12580 static int tg3_version_printed = 0;
12581 unsigned long tg3reg_base, tg3reg_len; 12581 resource_size_t tg3reg_base;
12582 unsigned long tg3reg_len;
12582 struct net_device *dev; 12583 struct net_device *dev;
12583 struct tg3 *tp; 12584 struct tg3 *tp;
12584 int err, pm_cap; 12585 int err, pm_cap;
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index db4ca4f0b846..0ab51a0f35fc 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -1438,13 +1438,18 @@ static void olympic_arb_cmd(struct net_device *dev)
1438 1438
1439 if (olympic_priv->olympic_network_monitor) { 1439 if (olympic_priv->olympic_network_monitor) {
1440 struct trh_hdr *mac_hdr; 1440 struct trh_hdr *mac_hdr;
1441 DECLARE_MAC_BUF(mac);
1442 printk(KERN_WARNING "%s: Received MAC Frame, details: \n",dev->name); 1441 printk(KERN_WARNING "%s: Received MAC Frame, details: \n",dev->name);
1443 mac_hdr = tr_hdr(mac_frame); 1442 mac_hdr = tr_hdr(mac_frame);
1444 printk(KERN_WARNING "%s: MAC Frame Dest. Addr: %s\n", 1443 printk(KERN_WARNING "%s: MAC Frame Dest. Addr: "
1445 dev->name, print_mac(mac, mac_hdr->daddr)); 1444 MAC_FMT " \n", dev->name,
1446 printk(KERN_WARNING "%s: MAC Frame Srce. Addr: %s\n", 1445 mac_hdr->daddr[0], mac_hdr->daddr[1],
1447 dev->name, print_mac(mac, mac_hdr->saddr)); 1446 mac_hdr->daddr[2], mac_hdr->daddr[3],
1447 mac_hdr->daddr[4], mac_hdr->daddr[5]);
1448 printk(KERN_WARNING "%s: MAC Frame Srce. Addr: "
1449 MAC_FMT " \n", dev->name,
1450 mac_hdr->saddr[0], mac_hdr->saddr[1],
1451 mac_hdr->saddr[2], mac_hdr->saddr[3],
1452 mac_hdr->saddr[4], mac_hdr->saddr[5]);
1448 } 1453 }
1449 netif_rx(mac_frame); 1454 netif_rx(mac_frame);
1450 dev->last_rx = jiffies; 1455 dev->last_rx = jiffies;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7b816a032957..5b5d87585d91 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -67,9 +67,42 @@
67#include <asm/system.h> 67#include <asm/system.h>
68#include <asm/uaccess.h> 68#include <asm/uaccess.h>
69 69
70/* Uncomment to enable debugging */
71/* #define TUN_DEBUG 1 */
72
70#ifdef TUN_DEBUG 73#ifdef TUN_DEBUG
71static int debug; 74static int debug;
75
76#define DBG if(tun->debug)printk
77#define DBG1 if(debug==2)printk
78#else
79#define DBG( a... )
80#define DBG1( a... )
81#endif
82
83struct tun_struct {
84 struct list_head list;
85 unsigned long flags;
86 int attached;
87 uid_t owner;
88 gid_t group;
89
90 wait_queue_head_t read_wait;
91 struct sk_buff_head readq;
92
93 struct net_device *dev;
94
95 struct fasync_struct *fasync;
96
97 unsigned long if_flags;
98 u8 dev_addr[ETH_ALEN];
99 u32 chr_filter[2];
100 u32 net_filter[2];
101
102#ifdef TUN_DEBUG
103 int debug;
72#endif 104#endif
105};
73 106
74/* Network device part of the driver */ 107/* Network device part of the driver */
75 108
@@ -253,8 +286,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
253 return -EFAULT; 286 return -EFAULT;
254 } 287 }
255 288
256 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) 289 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) {
257 align = NET_IP_ALIGN; 290 align = NET_IP_ALIGN;
291 if (unlikely(len < ETH_HLEN))
292 return -EINVAL;
293 }
258 294
259 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { 295 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
260 tun->dev->stats.rx_dropped++; 296 tun->dev->stats.rx_dropped++;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8cc316653a39..0ee4c168e4c0 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3833,6 +3833,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3833 struct device_node *phy; 3833 struct device_node *phy;
3834 int err, ucc_num, max_speed = 0; 3834 int err, ucc_num, max_speed = 0;
3835 const phandle *ph; 3835 const phandle *ph;
3836 const u32 *fixed_link;
3836 const unsigned int *prop; 3837 const unsigned int *prop;
3837 const char *sprop; 3838 const char *sprop;
3838 const void *mac_addr; 3839 const void *mac_addr;
@@ -3923,18 +3924,38 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3923 3924
3924 ug_info->uf_info.regs = res.start; 3925 ug_info->uf_info.regs = res.start;
3925 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0); 3926 ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
3927 fixed_link = of_get_property(np, "fixed-link", NULL);
3928 if (fixed_link) {
3929 ug_info->mdio_bus = 0;
3930 ug_info->phy_address = fixed_link[0];
3931 phy = NULL;
3932 } else {
3933 ph = of_get_property(np, "phy-handle", NULL);
3934 phy = of_find_node_by_phandle(*ph);
3926 3935
3927 ph = of_get_property(np, "phy-handle", NULL); 3936 if (phy == NULL)
3928 phy = of_find_node_by_phandle(*ph); 3937 return -ENODEV;
3929 3938
3930 if (phy == NULL) 3939 /* set the PHY address */
3931 return -ENODEV; 3940 prop = of_get_property(phy, "reg", NULL);
3941 if (prop == NULL)
3942 return -1;
3943 ug_info->phy_address = *prop;
3944
3945 /* Set the bus id */
3946 mdio = of_get_parent(phy);
3947
3948 if (mdio == NULL)
3949 return -1;
3932 3950
3933 /* set the PHY address */ 3951 err = of_address_to_resource(mdio, 0, &res);
3934 prop = of_get_property(phy, "reg", NULL); 3952 of_node_put(mdio);
3935 if (prop == NULL) 3953
3936 return -1; 3954 if (err)
3937 ug_info->phy_address = *prop; 3955 return -1;
3956
3957 ug_info->mdio_bus = res.start;
3958 }
3938 3959
3939 /* get the phy interface type, or default to MII */ 3960 /* get the phy interface type, or default to MII */
3940 prop = of_get_property(np, "phy-connection-type", NULL); 3961 prop = of_get_property(np, "phy-connection-type", NULL);
@@ -3979,20 +4000,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3979 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; 4000 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
3980 } 4001 }
3981 4002
3982 /* Set the bus id */
3983 mdio = of_get_parent(phy);
3984
3985 if (mdio == NULL)
3986 return -1;
3987
3988 err = of_address_to_resource(mdio, 0, &res);
3989 of_node_put(mdio);
3990
3991 if (err)
3992 return -1;
3993
3994 ug_info->mdio_bus = res.start;
3995
3996 if (netif_msg_probe(&debug)) 4003 if (netif_msg_probe(&debug))
3997 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n", 4004 printk(KERN_INFO "ucc_geth: UCC%1d at 0x%8x (irq = %d) \n",
3998 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs, 4005 ug_info->uf_info.ucc_num + 1, ug_info->uf_info.regs,
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index d1a200ff5fd2..555b70c8b863 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -234,11 +234,12 @@ static int start_xmit(struct sk_buff *skb, struct net_device *dev)
234 struct scatterlist sg[1+MAX_SKB_FRAGS]; 234 struct scatterlist sg[1+MAX_SKB_FRAGS];
235 struct virtio_net_hdr *hdr; 235 struct virtio_net_hdr *hdr;
236 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest; 236 const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
237 DECLARE_MAC_BUF(mac);
238 237
239 sg_init_table(sg, 1+MAX_SKB_FRAGS); 238 sg_init_table(sg, 1+MAX_SKB_FRAGS);
240 239
241 pr_debug("%s: xmit %p %s\n", dev->name, skb, print_mac(mac, dest)); 240 pr_debug("%s: xmit %p " MAC_FMT "\n", dev->name, skb,
241 dest[0], dest[1], dest[2],
242 dest[3], dest[4], dest[5]);
242 243
243 /* Encode metadata header at front. */ 244 /* Encode metadata header at front. */
244 hdr = skb_vnet_hdr(skb); 245 hdr = skb_vnet_hdr(skb);
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index a3df09ee729f..8005dd16fb4e 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -150,9 +150,13 @@ config HDLC_FR
150 150
151config HDLC_PPP 151config HDLC_PPP
152 tristate "Synchronous Point-to-Point Protocol (PPP) support" 152 tristate "Synchronous Point-to-Point Protocol (PPP) support"
153 depends on HDLC 153 depends on HDLC && BROKEN
154 help 154 help
155 Generic HDLC driver supporting PPP over WAN connections. 155 Generic HDLC driver supporting PPP over WAN connections.
156 This module is currently broken and will cause a kernel panic
157 when a device configured in PPP mode is activated.
158
159 It will be replaced by new PPP implementation in Linux 2.6.26.
156 160
157 If unsure, say N. 161 If unsure, say N.
158 162
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 948eb1fe916b..48e912487b16 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -373,10 +373,10 @@ static inline
373 dma_addr_t dmaaddr; 373 dma_addr_t dmaaddr;
374 374
375 if (tx) { 375 if (tx) {
376 dmaaddr = dma_map_single(ring->dev->dev->dev, 376 dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
377 buf, len, DMA_TO_DEVICE); 377 buf, len, DMA_TO_DEVICE);
378 } else { 378 } else {
379 dmaaddr = dma_map_single(ring->dev->dev->dev, 379 dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
380 buf, len, DMA_FROM_DEVICE); 380 buf, len, DMA_FROM_DEVICE);
381 } 381 }
382 382
@@ -388,9 +388,10 @@ static inline
388 dma_addr_t addr, size_t len, int tx) 388 dma_addr_t addr, size_t len, int tx)
389{ 389{
390 if (tx) { 390 if (tx) {
391 dma_unmap_single(ring->dev->dev->dev, addr, len, DMA_TO_DEVICE); 391 dma_unmap_single(ring->dev->dev->dma_dev,
392 addr, len, DMA_TO_DEVICE);
392 } else { 393 } else {
393 dma_unmap_single(ring->dev->dev->dev, 394 dma_unmap_single(ring->dev->dev->dma_dev,
394 addr, len, DMA_FROM_DEVICE); 395 addr, len, DMA_FROM_DEVICE);
395 } 396 }
396} 397}
@@ -400,7 +401,7 @@ static inline
400 dma_addr_t addr, size_t len) 401 dma_addr_t addr, size_t len)
401{ 402{
402 B43_WARN_ON(ring->tx); 403 B43_WARN_ON(ring->tx);
403 dma_sync_single_for_cpu(ring->dev->dev->dev, 404 dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
404 addr, len, DMA_FROM_DEVICE); 405 addr, len, DMA_FROM_DEVICE);
405} 406}
406 407
@@ -409,7 +410,7 @@ static inline
409 dma_addr_t addr, size_t len) 410 dma_addr_t addr, size_t len)
410{ 411{
411 B43_WARN_ON(ring->tx); 412 B43_WARN_ON(ring->tx);
412 dma_sync_single_for_device(ring->dev->dev->dev, 413 dma_sync_single_for_device(ring->dev->dev->dma_dev,
413 addr, len, DMA_FROM_DEVICE); 414 addr, len, DMA_FROM_DEVICE);
414} 415}
415 416
@@ -425,7 +426,7 @@ static inline
425 426
426static int alloc_ringmemory(struct b43_dmaring *ring) 427static int alloc_ringmemory(struct b43_dmaring *ring)
427{ 428{
428 struct device *dev = ring->dev->dev->dev; 429 struct device *dma_dev = ring->dev->dev->dma_dev;
429 gfp_t flags = GFP_KERNEL; 430 gfp_t flags = GFP_KERNEL;
430 431
431 /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K 432 /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
@@ -439,7 +440,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
439 */ 440 */
440 if (ring->type == B43_DMA_64BIT) 441 if (ring->type == B43_DMA_64BIT)
441 flags |= GFP_DMA; 442 flags |= GFP_DMA;
442 ring->descbase = dma_alloc_coherent(dev, B43_DMA_RINGMEMSIZE, 443 ring->descbase = dma_alloc_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
443 &(ring->dmabase), flags); 444 &(ring->dmabase), flags);
444 if (!ring->descbase) { 445 if (!ring->descbase) {
445 b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); 446 b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
@@ -452,9 +453,9 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
452 453
453static void free_ringmemory(struct b43_dmaring *ring) 454static void free_ringmemory(struct b43_dmaring *ring)
454{ 455{
455 struct device *dev = ring->dev->dev->dev; 456 struct device *dma_dev = ring->dev->dev->dma_dev;
456 457
457 dma_free_coherent(dev, B43_DMA_RINGMEMSIZE, 458 dma_free_coherent(dma_dev, B43_DMA_RINGMEMSIZE,
458 ring->descbase, ring->dmabase); 459 ring->descbase, ring->dmabase);
459} 460}
460 461
@@ -854,7 +855,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
854 goto err_kfree_meta; 855 goto err_kfree_meta;
855 856
856 /* test for ability to dma to txhdr_cache */ 857 /* test for ability to dma to txhdr_cache */
857 dma_test = dma_map_single(dev->dev->dev, 858 dma_test = dma_map_single(dev->dev->dma_dev,
858 ring->txhdr_cache, 859 ring->txhdr_cache,
859 b43_txhdr_size(dev), 860 b43_txhdr_size(dev),
860 DMA_TO_DEVICE); 861 DMA_TO_DEVICE);
@@ -869,7 +870,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
869 if (!ring->txhdr_cache) 870 if (!ring->txhdr_cache)
870 goto err_kfree_meta; 871 goto err_kfree_meta;
871 872
872 dma_test = dma_map_single(dev->dev->dev, 873 dma_test = dma_map_single(dev->dev->dma_dev,
873 ring->txhdr_cache, 874 ring->txhdr_cache,
874 b43_txhdr_size(dev), 875 b43_txhdr_size(dev),
875 DMA_TO_DEVICE); 876 DMA_TO_DEVICE);
@@ -883,7 +884,7 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev,
883 } 884 }
884 } 885 }
885 886
886 dma_unmap_single(dev->dev->dev, 887 dma_unmap_single(dev->dev->dma_dev,
887 dma_test, b43_txhdr_size(dev), 888 dma_test, b43_txhdr_size(dev),
888 DMA_TO_DEVICE); 889 DMA_TO_DEVICE);
889 } 890 }
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index e87b427d5e43..c990f87b107a 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -393,11 +393,11 @@ dma_addr_t map_descbuffer(struct b43legacy_dmaring *ring,
393 dma_addr_t dmaaddr; 393 dma_addr_t dmaaddr;
394 394
395 if (tx) 395 if (tx)
396 dmaaddr = dma_map_single(ring->dev->dev->dev, 396 dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
397 buf, len, 397 buf, len,
398 DMA_TO_DEVICE); 398 DMA_TO_DEVICE);
399 else 399 else
400 dmaaddr = dma_map_single(ring->dev->dev->dev, 400 dmaaddr = dma_map_single(ring->dev->dev->dma_dev,
401 buf, len, 401 buf, len,
402 DMA_FROM_DEVICE); 402 DMA_FROM_DEVICE);
403 403
@@ -411,11 +411,11 @@ void unmap_descbuffer(struct b43legacy_dmaring *ring,
411 int tx) 411 int tx)
412{ 412{
413 if (tx) 413 if (tx)
414 dma_unmap_single(ring->dev->dev->dev, 414 dma_unmap_single(ring->dev->dev->dma_dev,
415 addr, len, 415 addr, len,
416 DMA_TO_DEVICE); 416 DMA_TO_DEVICE);
417 else 417 else
418 dma_unmap_single(ring->dev->dev->dev, 418 dma_unmap_single(ring->dev->dev->dma_dev,
419 addr, len, 419 addr, len,
420 DMA_FROM_DEVICE); 420 DMA_FROM_DEVICE);
421} 421}
@@ -427,7 +427,7 @@ void sync_descbuffer_for_cpu(struct b43legacy_dmaring *ring,
427{ 427{
428 B43legacy_WARN_ON(ring->tx); 428 B43legacy_WARN_ON(ring->tx);
429 429
430 dma_sync_single_for_cpu(ring->dev->dev->dev, 430 dma_sync_single_for_cpu(ring->dev->dev->dma_dev,
431 addr, len, DMA_FROM_DEVICE); 431 addr, len, DMA_FROM_DEVICE);
432} 432}
433 433
@@ -438,7 +438,7 @@ void sync_descbuffer_for_device(struct b43legacy_dmaring *ring,
438{ 438{
439 B43legacy_WARN_ON(ring->tx); 439 B43legacy_WARN_ON(ring->tx);
440 440
441 dma_sync_single_for_device(ring->dev->dev->dev, 441 dma_sync_single_for_device(ring->dev->dev->dma_dev,
442 addr, len, DMA_FROM_DEVICE); 442 addr, len, DMA_FROM_DEVICE);
443} 443}
444 444
@@ -458,9 +458,9 @@ void free_descriptor_buffer(struct b43legacy_dmaring *ring,
458 458
459static int alloc_ringmemory(struct b43legacy_dmaring *ring) 459static int alloc_ringmemory(struct b43legacy_dmaring *ring)
460{ 460{
461 struct device *dev = ring->dev->dev->dev; 461 struct device *dma_dev = ring->dev->dev->dma_dev;
462 462
463 ring->descbase = dma_alloc_coherent(dev, B43legacy_DMA_RINGMEMSIZE, 463 ring->descbase = dma_alloc_coherent(dma_dev, B43legacy_DMA_RINGMEMSIZE,
464 &(ring->dmabase), GFP_KERNEL); 464 &(ring->dmabase), GFP_KERNEL);
465 if (!ring->descbase) { 465 if (!ring->descbase) {
466 b43legacyerr(ring->dev->wl, "DMA ringmemory allocation" 466 b43legacyerr(ring->dev->wl, "DMA ringmemory allocation"
@@ -474,9 +474,9 @@ static int alloc_ringmemory(struct b43legacy_dmaring *ring)
474 474
475static void free_ringmemory(struct b43legacy_dmaring *ring) 475static void free_ringmemory(struct b43legacy_dmaring *ring)
476{ 476{
477 struct device *dev = ring->dev->dev->dev; 477 struct device *dma_dev = ring->dev->dev->dma_dev;
478 478
479 dma_free_coherent(dev, B43legacy_DMA_RINGMEMSIZE, 479 dma_free_coherent(dma_dev, B43legacy_DMA_RINGMEMSIZE,
480 ring->descbase, ring->dmabase); 480 ring->descbase, ring->dmabase);
481} 481}
482 482
@@ -585,8 +585,9 @@ static int b43legacy_dmacontroller_tx_reset(struct b43legacy_wldev *dev,
585 585
586/* Check if a DMA mapping address is invalid. */ 586/* Check if a DMA mapping address is invalid. */
587static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring, 587static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
588 dma_addr_t addr, 588 dma_addr_t addr,
589 size_t buffersize) 589 size_t buffersize,
590 bool dma_to_device)
590{ 591{
591 if (unlikely(dma_mapping_error(addr))) 592 if (unlikely(dma_mapping_error(addr)))
592 return 1; 593 return 1;
@@ -594,11 +595,11 @@ static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
594 switch (ring->type) { 595 switch (ring->type) {
595 case B43legacy_DMA_30BIT: 596 case B43legacy_DMA_30BIT:
596 if ((u64)addr + buffersize > (1ULL << 30)) 597 if ((u64)addr + buffersize > (1ULL << 30))
597 return 1; 598 goto address_error;
598 break; 599 break;
599 case B43legacy_DMA_32BIT: 600 case B43legacy_DMA_32BIT:
600 if ((u64)addr + buffersize > (1ULL << 32)) 601 if ((u64)addr + buffersize > (1ULL << 32))
601 return 1; 602 goto address_error;
602 break; 603 break;
603 case B43legacy_DMA_64BIT: 604 case B43legacy_DMA_64BIT:
604 /* Currently we can't have addresses beyond 64 bits in the kernel. */ 605 /* Currently we can't have addresses beyond 64 bits in the kernel. */
@@ -607,6 +608,12 @@ static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring,
607 608
608 /* The address is OK. */ 609 /* The address is OK. */
609 return 0; 610 return 0;
611
612address_error:
613 /* We can't support this address. Unmap it again. */
614 unmap_descbuffer(ring, addr, buffersize, dma_to_device);
615
616 return 1;
610} 617}
611 618
612static int setup_rx_descbuffer(struct b43legacy_dmaring *ring, 619static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
@@ -626,7 +633,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
626 return -ENOMEM; 633 return -ENOMEM;
627 dmaaddr = map_descbuffer(ring, skb->data, 634 dmaaddr = map_descbuffer(ring, skb->data,
628 ring->rx_buffersize, 0); 635 ring->rx_buffersize, 0);
629 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) { 636 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
630 /* ugh. try to realloc in zone_dma */ 637 /* ugh. try to realloc in zone_dma */
631 gfp_flags |= GFP_DMA; 638 gfp_flags |= GFP_DMA;
632 639
@@ -639,7 +646,7 @@ static int setup_rx_descbuffer(struct b43legacy_dmaring *ring,
639 ring->rx_buffersize, 0); 646 ring->rx_buffersize, 0);
640 } 647 }
641 648
642 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize)) { 649 if (b43legacy_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
643 dev_kfree_skb_any(skb); 650 dev_kfree_skb_any(skb);
644 return -EIO; 651 return -EIO;
645 } 652 }
@@ -886,12 +893,12 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
886 goto err_kfree_meta; 893 goto err_kfree_meta;
887 894
888 /* test for ability to dma to txhdr_cache */ 895 /* test for ability to dma to txhdr_cache */
889 dma_test = dma_map_single(dev->dev->dev, ring->txhdr_cache, 896 dma_test = dma_map_single(dev->dev->dma_dev, ring->txhdr_cache,
890 sizeof(struct b43legacy_txhdr_fw3), 897 sizeof(struct b43legacy_txhdr_fw3),
891 DMA_TO_DEVICE); 898 DMA_TO_DEVICE);
892 899
893 if (b43legacy_dma_mapping_error(ring, dma_test, 900 if (b43legacy_dma_mapping_error(ring, dma_test,
894 sizeof(struct b43legacy_txhdr_fw3))) { 901 sizeof(struct b43legacy_txhdr_fw3), 1)) {
895 /* ugh realloc */ 902 /* ugh realloc */
896 kfree(ring->txhdr_cache); 903 kfree(ring->txhdr_cache);
897 ring->txhdr_cache = kcalloc(nr_slots, 904 ring->txhdr_cache = kcalloc(nr_slots,
@@ -900,17 +907,17 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
900 if (!ring->txhdr_cache) 907 if (!ring->txhdr_cache)
901 goto err_kfree_meta; 908 goto err_kfree_meta;
902 909
903 dma_test = dma_map_single(dev->dev->dev, 910 dma_test = dma_map_single(dev->dev->dma_dev,
904 ring->txhdr_cache, 911 ring->txhdr_cache,
905 sizeof(struct b43legacy_txhdr_fw3), 912 sizeof(struct b43legacy_txhdr_fw3),
906 DMA_TO_DEVICE); 913 DMA_TO_DEVICE);
907 914
908 if (b43legacy_dma_mapping_error(ring, dma_test, 915 if (b43legacy_dma_mapping_error(ring, dma_test,
909 sizeof(struct b43legacy_txhdr_fw3))) 916 sizeof(struct b43legacy_txhdr_fw3), 1))
910 goto err_kfree_txhdr_cache; 917 goto err_kfree_txhdr_cache;
911 } 918 }
912 919
913 dma_unmap_single(dev->dev->dev, 920 dma_unmap_single(dev->dev->dma_dev,
914 dma_test, sizeof(struct b43legacy_txhdr_fw3), 921 dma_test, sizeof(struct b43legacy_txhdr_fw3),
915 DMA_TO_DEVICE); 922 DMA_TO_DEVICE);
916 } 923 }
@@ -1235,7 +1242,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1235 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, 1242 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
1236 sizeof(struct b43legacy_txhdr_fw3), 1); 1243 sizeof(struct b43legacy_txhdr_fw3), 1);
1237 if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr, 1244 if (b43legacy_dma_mapping_error(ring, meta_hdr->dmaaddr,
1238 sizeof(struct b43legacy_txhdr_fw3))) { 1245 sizeof(struct b43legacy_txhdr_fw3), 1)) {
1239 ring->current_slot = old_top_slot; 1246 ring->current_slot = old_top_slot;
1240 ring->used_slots = old_used_slots; 1247 ring->used_slots = old_used_slots;
1241 return -EIO; 1248 return -EIO;
@@ -1254,7 +1261,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1254 1261
1255 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1262 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1256 /* create a bounce buffer in zone_dma on mapping failure. */ 1263 /* create a bounce buffer in zone_dma on mapping failure. */
1257 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) { 1264 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
1258 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); 1265 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
1259 if (!bounce_skb) { 1266 if (!bounce_skb) {
1260 ring->current_slot = old_top_slot; 1267 ring->current_slot = old_top_slot;
@@ -1268,7 +1275,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
1268 skb = bounce_skb; 1275 skb = bounce_skb;
1269 meta->skb = skb; 1276 meta->skb = skb;
1270 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1277 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1271 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len)) { 1278 if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
1272 ring->current_slot = old_top_slot; 1279 ring->current_slot = old_top_slot;
1273 ring->used_slots = old_used_slots; 1280 ring->used_slots = old_used_slots;
1274 err = -EIO; 1281 err = -EIO;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 5f3f34e1dbfd..0f7a6e7bd96a 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -1488,6 +1488,7 @@ static int b43legacy_request_firmware(struct b43legacy_wldev *dev)
1488 } 1488 }
1489 if (!fw->initvals) { 1489 if (!fw->initvals) {
1490 switch (dev->phy.type) { 1490 switch (dev->phy.type) {
1491 case B43legacy_PHYTYPE_B:
1491 case B43legacy_PHYTYPE_G: 1492 case B43legacy_PHYTYPE_G:
1492 if ((rev >= 5) && (rev <= 10)) 1493 if ((rev >= 5) && (rev <= 10))
1493 filename = "b0g0initvals5"; 1494 filename = "b0g0initvals5";
@@ -1505,6 +1506,7 @@ static int b43legacy_request_firmware(struct b43legacy_wldev *dev)
1505 } 1506 }
1506 if (!fw->initvals_band) { 1507 if (!fw->initvals_band) {
1507 switch (dev->phy.type) { 1508 switch (dev->phy.type) {
1509 case B43legacy_PHYTYPE_B:
1508 case B43legacy_PHYTYPE_G: 1510 case B43legacy_PHYTYPE_G:
1509 if ((rev >= 5) && (rev <= 10)) 1511 if ((rev >= 5) && (rev <= 10))
1510 filename = "b0g0bsinitvals5"; 1512 filename = "b0g0bsinitvals5";
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 49978bdb4324..4fd73809602e 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -635,7 +635,6 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
635{ 635{
636 struct ieee80211_hdr_4addr *hdr; 636 struct ieee80211_hdr_4addr *hdr;
637 int res, hdrlen; 637 int res, hdrlen;
638 DECLARE_MAC_BUF(mac);
639 638
640 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 639 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
641 return 0; 640 return 0;
@@ -647,8 +646,10 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
647 strcmp(crypt->ops->name, "TKIP") == 0) { 646 strcmp(crypt->ops->name, "TKIP") == 0) {
648 if (net_ratelimit()) { 647 if (net_ratelimit()) {
649 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 648 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
650 "received packet from %s\n", 649 "received packet from " MAC_FMT "\n",
651 local->dev->name, print_mac(mac, hdr->addr2)); 650 local->dev->name,
651 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
652 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
652 } 653 }
653 return -1; 654 return -1;
654 } 655 }
@@ -657,9 +658,12 @@ hostap_rx_frame_decrypt(local_info_t *local, struct sk_buff *skb,
657 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 658 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
658 atomic_dec(&crypt->refcnt); 659 atomic_dec(&crypt->refcnt);
659 if (res < 0) { 660 if (res < 0) {
660 printk(KERN_DEBUG "%s: decryption failed (SA=%s" 661 printk(KERN_DEBUG "%s: decryption failed (SA=" MAC_FMT
661 ") res=%d\n", 662 ") res=%d\n",
662 local->dev->name, print_mac(mac, hdr->addr2), res); 663 local->dev->name,
664 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
665 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
666 res);
663 local->comm_tallies.rx_discards_wep_undecryptable++; 667 local->comm_tallies.rx_discards_wep_undecryptable++;
664 return -1; 668 return -1;
665 } 669 }
@@ -721,7 +725,6 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
721 struct ieee80211_crypt_data *crypt = NULL; 725 struct ieee80211_crypt_data *crypt = NULL;
722 void *sta = NULL; 726 void *sta = NULL;
723 int keyidx = 0; 727 int keyidx = 0;
724 DECLARE_MAC_BUF(mac);
725 728
726 iface = netdev_priv(dev); 729 iface = netdev_priv(dev);
727 local = iface->local; 730 local = iface->local;
@@ -798,8 +801,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
798 * frames silently instead of filling system log with 801 * frames silently instead of filling system log with
799 * these reports. */ 802 * these reports. */
800 printk(KERN_DEBUG "%s: WEP decryption failed (not set)" 803 printk(KERN_DEBUG "%s: WEP decryption failed (not set)"
801 " (SA=%s)\n", 804 " (SA=" MAC_FMT ")\n",
802 local->dev->name, print_mac(mac, hdr->addr2)); 805 local->dev->name,
806 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
807 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
803#endif 808#endif
804 local->comm_tallies.rx_discards_wep_undecryptable++; 809 local->comm_tallies.rx_discards_wep_undecryptable++;
805 goto rx_dropped; 810 goto rx_dropped;
@@ -813,8 +818,9 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
813 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0) 818 (keyidx = hostap_rx_frame_decrypt(local, skb, crypt)) < 0)
814 { 819 {
815 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 820 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
816 "from %s\n", dev->name, 821 "from " MAC_FMT "\n", dev->name,
817 print_mac(mac, hdr->addr2)); 822 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
823 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
818 /* TODO: could inform hostapd about this so that it 824 /* TODO: could inform hostapd about this so that it
819 * could send auth failure report */ 825 * could send auth failure report */
820 goto rx_dropped; 826 goto rx_dropped;
@@ -982,8 +988,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
982 "unencrypted EAPOL frame\n", local->dev->name); 988 "unencrypted EAPOL frame\n", local->dev->name);
983 } else { 989 } else {
984 printk(KERN_DEBUG "%s: encryption configured, but RX " 990 printk(KERN_DEBUG "%s: encryption configured, but RX "
985 "frame not encrypted (SA=%s)\n", 991 "frame not encrypted (SA=" MAC_FMT ")\n",
986 local->dev->name, print_mac(mac, hdr->addr2)); 992 local->dev->name,
993 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
994 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
987 goto rx_dropped; 995 goto rx_dropped;
988 } 996 }
989 } 997 }
@@ -992,9 +1000,10 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
992 !hostap_is_eapol_frame(local, skb)) { 1000 !hostap_is_eapol_frame(local, skb)) {
993 if (net_ratelimit()) { 1001 if (net_ratelimit()) {
994 printk(KERN_DEBUG "%s: dropped unencrypted RX data " 1002 printk(KERN_DEBUG "%s: dropped unencrypted RX data "
995 "frame from %s" 1003 "frame from " MAC_FMT " (drop_unencrypted=1)\n",
996 " (drop_unencrypted=1)\n", 1004 dev->name,
997 dev->name, print_mac(mac, hdr->addr2)); 1005 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1006 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
998 } 1007 }
999 goto rx_dropped; 1008 goto rx_dropped;
1000 } 1009 }
diff --git a/drivers/net/wireless/hostap/hostap_80211_tx.c b/drivers/net/wireless/hostap/hostap_80211_tx.c
index e7afc3ec3e6d..921c984416f8 100644
--- a/drivers/net/wireless/hostap/hostap_80211_tx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_tx.c
@@ -314,7 +314,6 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
314 struct ieee80211_hdr_4addr *hdr; 314 struct ieee80211_hdr_4addr *hdr;
315 u16 fc; 315 u16 fc;
316 int prefix_len, postfix_len, hdr_len, res; 316 int prefix_len, postfix_len, hdr_len, res;
317 DECLARE_MAC_BUF(mac);
318 317
319 iface = netdev_priv(skb->dev); 318 iface = netdev_priv(skb->dev);
320 local = iface->local; 319 local = iface->local;
@@ -329,8 +328,10 @@ static struct sk_buff * hostap_tx_encrypt(struct sk_buff *skb,
329 hdr = (struct ieee80211_hdr_4addr *) skb->data; 328 hdr = (struct ieee80211_hdr_4addr *) skb->data;
330 if (net_ratelimit()) { 329 if (net_ratelimit()) {
331 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " 330 printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
332 "TX packet to %s\n", 331 "TX packet to " MAC_FMT "\n",
333 local->dev->name, print_mac(mac, hdr->addr1)); 332 local->dev->name,
333 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
334 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
334 } 335 }
335 kfree_skb(skb); 336 kfree_skb(skb);
336 return NULL; 337 return NULL;
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index ad040a3bb8a7..0acd9589c48c 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -632,7 +632,6 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
632 __le16 *pos; 632 __le16 *pos;
633 struct sta_info *sta = NULL; 633 struct sta_info *sta = NULL;
634 char *txt = NULL; 634 char *txt = NULL;
635 DECLARE_MAC_BUF(mac);
636 635
637 if (ap->local->hostapd) { 636 if (ap->local->hostapd) {
638 dev_kfree_skb(skb); 637 dev_kfree_skb(skb);
@@ -684,10 +683,12 @@ static void hostap_ap_tx_cb_auth(struct sk_buff *skb, int ok, void *data)
684 if (sta) 683 if (sta)
685 atomic_dec(&sta->users); 684 atomic_dec(&sta->users);
686 if (txt) { 685 if (txt) {
687 PDEBUG(DEBUG_AP, "%s: %s auth_cb - alg=%d " 686 PDEBUG(DEBUG_AP, "%s: " MAC_FMT " auth_cb - alg=%d "
688 "trans#=%d status=%d - %s\n", 687 "trans#=%d status=%d - %s\n",
689 dev->name, print_mac(mac, hdr->addr1), auth_alg, 688 dev->name,
690 auth_transaction, status, txt); 689 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
690 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
691 auth_alg, auth_transaction, status, txt);
691 } 692 }
692 dev_kfree_skb(skb); 693 dev_kfree_skb(skb);
693} 694}
@@ -703,7 +704,6 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
703 __le16 *pos; 704 __le16 *pos;
704 struct sta_info *sta = NULL; 705 struct sta_info *sta = NULL;
705 char *txt = NULL; 706 char *txt = NULL;
706 DECLARE_MAC_BUF(mac);
707 707
708 if (ap->local->hostapd) { 708 if (ap->local->hostapd) {
709 dev_kfree_skb(skb); 709 dev_kfree_skb(skb);
@@ -754,8 +754,11 @@ static void hostap_ap_tx_cb_assoc(struct sk_buff *skb, int ok, void *data)
754 if (sta) 754 if (sta)
755 atomic_dec(&sta->users); 755 atomic_dec(&sta->users);
756 if (txt) { 756 if (txt) {
757 PDEBUG(DEBUG_AP, "%s: %s assoc_cb - %s\n", 757 PDEBUG(DEBUG_AP, "%s: " MAC_FMT " assoc_cb - %s\n",
758 dev->name, print_mac(mac, hdr->addr1), txt); 758 dev->name,
759 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
760 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
761 txt);
759 } 762 }
760 dev_kfree_skb(skb); 763 dev_kfree_skb(skb);
761} 764}
@@ -767,7 +770,6 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
767 struct ap_data *ap = data; 770 struct ap_data *ap = data;
768 struct ieee80211_hdr_4addr *hdr; 771 struct ieee80211_hdr_4addr *hdr;
769 struct sta_info *sta; 772 struct sta_info *sta;
770 DECLARE_MAC_BUF(mac);
771 773
772 if (skb->len < 24) 774 if (skb->len < 24)
773 goto fail; 775 goto fail;
@@ -779,9 +781,11 @@ static void hostap_ap_tx_cb_poll(struct sk_buff *skb, int ok, void *data)
779 sta->flags &= ~WLAN_STA_PENDING_POLL; 781 sta->flags &= ~WLAN_STA_PENDING_POLL;
780 spin_unlock(&ap->sta_table_lock); 782 spin_unlock(&ap->sta_table_lock);
781 } else { 783 } else {
782 PDEBUG(DEBUG_AP, "%s: STA %s" 784 PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
783 " did not ACK activity poll frame\n", 785 " did not ACK activity poll frame\n",
784 ap->local->dev->name, print_mac(mac, hdr->addr1)); 786 ap->local->dev->name,
787 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
788 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
785 } 789 }
786 790
787 fail: 791 fail:
@@ -1306,7 +1310,6 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1306 struct sta_info *sta = NULL; 1310 struct sta_info *sta = NULL;
1307 struct ieee80211_crypt_data *crypt; 1311 struct ieee80211_crypt_data *crypt;
1308 char *txt = ""; 1312 char *txt = "";
1309 DECLARE_MAC_BUF(mac);
1310 1313
1311 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1314 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1312 1315
@@ -1315,8 +1318,9 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1315 1318
1316 if (len < 6) { 1319 if (len < 6) {
1317 PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload " 1320 PDEBUG(DEBUG_AP, "%s: handle_authen - too short payload "
1318 "(len=%d) from %s\n", dev->name, len, 1321 "(len=%d) from " MAC_FMT "\n", dev->name, len,
1319 print_mac(mac, hdr->addr2)); 1322 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1323 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
1320 return; 1324 return;
1321 } 1325 }
1322 1326
@@ -1381,8 +1385,10 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1381 if (time_after(jiffies, sta->u.ap.last_beacon + 1385 if (time_after(jiffies, sta->u.ap.last_beacon +
1382 (10 * sta->listen_interval * HZ) / 1024)) { 1386 (10 * sta->listen_interval * HZ) / 1024)) {
1383 PDEBUG(DEBUG_AP, "%s: no beacons received for a while," 1387 PDEBUG(DEBUG_AP, "%s: no beacons received for a while,"
1384 " assuming AP %s is now STA\n", 1388 " assuming AP " MAC_FMT " is now STA\n",
1385 dev->name, print_mac(mac, sta->addr)); 1389 dev->name,
1390 sta->addr[0], sta->addr[1], sta->addr[2],
1391 sta->addr[3], sta->addr[4], sta->addr[5]);
1386 sta->ap = 0; 1392 sta->ap = 0;
1387 sta->flags = 0; 1393 sta->flags = 0;
1388 sta->u.sta.challenge = NULL; 1394 sta->u.sta.challenge = NULL;
@@ -1497,10 +1503,13 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
1497 } 1503 }
1498 1504
1499 if (resp) { 1505 if (resp) {
1500 PDEBUG(DEBUG_AP, "%s: %s auth (alg=%d " 1506 PDEBUG(DEBUG_AP, "%s: " MAC_FMT " auth (alg=%d "
1501 "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n", 1507 "trans#=%d stat=%d len=%d fc=%04x) ==> %d (%s)\n",
1502 dev->name, print_mac(mac, hdr->addr2), auth_alg, 1508 dev->name,
1503 auth_transaction, status_code, len, fc, resp, txt); 1509 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1510 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1511 auth_alg, auth_transaction, status_code, len,
1512 fc, resp, txt);
1504 } 1513 }
1505} 1514}
1506 1515
@@ -1519,14 +1528,15 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1519 int send_deauth = 0; 1528 int send_deauth = 0;
1520 char *txt = ""; 1529 char *txt = "";
1521 u8 prev_ap[ETH_ALEN]; 1530 u8 prev_ap[ETH_ALEN];
1522 DECLARE_MAC_BUF(mac);
1523 1531
1524 left = len = skb->len - IEEE80211_MGMT_HDR_LEN; 1532 left = len = skb->len - IEEE80211_MGMT_HDR_LEN;
1525 1533
1526 if (len < (reassoc ? 10 : 4)) { 1534 if (len < (reassoc ? 10 : 4)) {
1527 PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload " 1535 PDEBUG(DEBUG_AP, "%s: handle_assoc - too short payload "
1528 "(len=%d, reassoc=%d) from %s\n", 1536 "(len=%d, reassoc=%d) from " MAC_FMT "\n",
1529 dev->name, len, reassoc, print_mac(mac, hdr->addr2)); 1537 dev->name, len, reassoc,
1538 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1539 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5]);
1530 return; 1540 return;
1531 } 1541 }
1532 1542
@@ -1603,9 +1613,12 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1603 } 1613 }
1604 1614
1605 if (left > 0) { 1615 if (left > 0) {
1606 PDEBUG(DEBUG_AP, "%s: assoc from %s" 1616 PDEBUG(DEBUG_AP, "%s: assoc from " MAC_FMT
1607 " with extra data (%d bytes) [", 1617 " with extra data (%d bytes) [",
1608 dev->name, print_mac(mac, hdr->addr2), left); 1618 dev->name,
1619 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1620 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1621 left);
1609 while (left > 0) { 1622 while (left > 0) {
1610 PDEBUG2(DEBUG_AP, "<%02x>", *u); 1623 PDEBUG2(DEBUG_AP, "<%02x>", *u);
1611 u++; left--; 1624 u++; left--;
@@ -1704,10 +1717,15 @@ static void handle_assoc(local_info_t *local, struct sk_buff *skb,
1704 } 1717 }
1705 1718
1706#if 0 1719#if 0
1707 PDEBUG(DEBUG_AP, "%s: %s %sassoc (len=%d " 1720 PDEBUG(DEBUG_AP, "%s: " MAC_FMT" %sassoc (len=%d "
1708 "prev_ap=%s) => %d(%d) (%s)\n", 1721 "prev_ap=" MAC_FMT") => %d(%d) (%s)\n",
1709 dev->name, print_mac(mac, hdr->addr2), reassoc ? "re" : "", len, 1722 dev->name,
1710 print_mac(mac, prev_ap), resp, send_deauth, txt); 1723 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1724 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1725 reassoc ? "re" : "", len,
1726 prev_ap[0], prev_ap[1], prev_ap[2],
1727 prev_ap[3], prev_ap[4], prev_ap[5],
1728 resp, send_deauth, txt);
1711#endif 1729#endif
1712} 1730}
1713 1731
@@ -1735,9 +1753,11 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1735 pos = (__le16 *) body; 1753 pos = (__le16 *) body;
1736 reason_code = le16_to_cpu(*pos); 1754 reason_code = le16_to_cpu(*pos);
1737 1755
1738 PDEBUG(DEBUG_AP, "%s: deauthentication: %s len=%d, " 1756 PDEBUG(DEBUG_AP, "%s: deauthentication: " MAC_FMT " len=%d, "
1739 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, 1757 "reason_code=%d\n", dev->name,
1740 reason_code); 1758 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1759 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1760 len, reason_code);
1741 1761
1742 spin_lock_bh(&local->ap->sta_table_lock); 1762 spin_lock_bh(&local->ap->sta_table_lock);
1743 sta = ap_get_sta(local->ap, hdr->addr2); 1763 sta = ap_get_sta(local->ap, hdr->addr2);
@@ -1748,9 +1768,11 @@ static void handle_deauth(local_info_t *local, struct sk_buff *skb,
1748 } 1768 }
1749 spin_unlock_bh(&local->ap->sta_table_lock); 1769 spin_unlock_bh(&local->ap->sta_table_lock);
1750 if (sta == NULL) { 1770 if (sta == NULL) {
1751 printk("%s: deauthentication from %s, " 1771 printk("%s: deauthentication from " MAC_FMT ", "
1752 "reason_code=%d, but STA not authenticated\n", dev->name, 1772 "reason_code=%d, but STA not authenticated\n", dev->name,
1753 print_mac(mac, hdr->addr2), reason_code); 1773 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1774 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1775 reason_code);
1754 } 1776 }
1755} 1777}
1756 1778
@@ -1766,7 +1788,6 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1766 u16 reason_code; 1788 u16 reason_code;
1767 __le16 *pos; 1789 __le16 *pos;
1768 struct sta_info *sta = NULL; 1790 struct sta_info *sta = NULL;
1769 DECLARE_MAC_BUF(mac);
1770 1791
1771 len = skb->len - IEEE80211_MGMT_HDR_LEN; 1792 len = skb->len - IEEE80211_MGMT_HDR_LEN;
1772 1793
@@ -1778,9 +1799,11 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1778 pos = (__le16 *) body; 1799 pos = (__le16 *) body;
1779 reason_code = le16_to_cpu(*pos); 1800 reason_code = le16_to_cpu(*pos);
1780 1801
1781 PDEBUG(DEBUG_AP, "%s: disassociation: %s len=%d, " 1802 PDEBUG(DEBUG_AP, "%s: disassociation: " MAC_FMT " len=%d, "
1782 "reason_code=%d\n", dev->name, print_mac(mac, hdr->addr2), len, 1803 "reason_code=%d\n", dev->name,
1783 reason_code); 1804 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1805 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1806 len, reason_code);
1784 1807
1785 spin_lock_bh(&local->ap->sta_table_lock); 1808 spin_lock_bh(&local->ap->sta_table_lock);
1786 sta = ap_get_sta(local->ap, hdr->addr2); 1809 sta = ap_get_sta(local->ap, hdr->addr2);
@@ -1791,9 +1814,12 @@ static void handle_disassoc(local_info_t *local, struct sk_buff *skb,
1791 } 1814 }
1792 spin_unlock_bh(&local->ap->sta_table_lock); 1815 spin_unlock_bh(&local->ap->sta_table_lock);
1793 if (sta == NULL) { 1816 if (sta == NULL) {
1794 printk("%s: disassociation from %s, " 1817 printk("%s: disassociation from " MAC_FMT ", "
1795 "reason_code=%d, but STA not authenticated\n", 1818 "reason_code=%d, but STA not authenticated\n",
1796 dev->name, print_mac(mac, hdr->addr2), reason_code); 1819 dev->name,
1820 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1821 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1822 reason_code);
1797 } 1823 }
1798} 1824}
1799 1825
@@ -1882,16 +1908,20 @@ static void handle_pspoll(local_info_t *local,
1882 struct sta_info *sta; 1908 struct sta_info *sta;
1883 u16 aid; 1909 u16 aid;
1884 struct sk_buff *skb; 1910 struct sk_buff *skb;
1885 DECLARE_MAC_BUF(mac);
1886 1911
1887 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%s" 1912 PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=" MAC_FMT
1888 ", TA=%s PWRMGT=%d\n", 1913 ", TA=" MAC_FMT " PWRMGT=%d\n",
1889 print_mac(mac, hdr->addr1), print_mac(mac, hdr->addr2), 1914 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
1915 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
1916 hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
1917 hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
1890 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM)); 1918 !!(le16_to_cpu(hdr->frame_ctl) & IEEE80211_FCTL_PM));
1891 1919
1892 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 1920 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
1893 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=%s" 1921 PDEBUG(DEBUG_AP, "handle_pspoll - addr1(BSSID)=" MAC_FMT
1894 " not own MAC\n", print_mac(mac, hdr->addr1)); 1922 " not own MAC\n",
1923 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
1924 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
1895 return; 1925 return;
1896 } 1926 }
1897 1927
@@ -1969,7 +1999,6 @@ static void handle_wds_oper_queue(struct work_struct *work)
1969 wds_oper_queue); 1999 wds_oper_queue);
1970 local_info_t *local = ap->local; 2000 local_info_t *local = ap->local;
1971 struct wds_oper_data *entry, *prev; 2001 struct wds_oper_data *entry, *prev;
1972 DECLARE_MAC_BUF(mac);
1973 2002
1974 spin_lock_bh(&local->lock); 2003 spin_lock_bh(&local->lock);
1975 entry = local->ap->wds_oper_entries; 2004 entry = local->ap->wds_oper_entries;
@@ -1978,10 +2007,11 @@ static void handle_wds_oper_queue(struct work_struct *work)
1978 2007
1979 while (entry) { 2008 while (entry) {
1980 PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection " 2009 PDEBUG(DEBUG_AP, "%s: %s automatic WDS connection "
1981 "to AP %s\n", 2010 "to AP " MAC_FMT "\n",
1982 local->dev->name, 2011 local->dev->name,
1983 entry->type == WDS_ADD ? "adding" : "removing", 2012 entry->type == WDS_ADD ? "adding" : "removing",
1984 print_mac(mac, entry->addr)); 2013 entry->addr[0], entry->addr[1], entry->addr[2],
2014 entry->addr[3], entry->addr[4], entry->addr[5]);
1985 if (entry->type == WDS_ADD) 2015 if (entry->type == WDS_ADD)
1986 prism2_wds_add(local, entry->addr, 0); 2016 prism2_wds_add(local, entry->addr, 0);
1987 else if (entry->type == WDS_DEL) 2017 else if (entry->type == WDS_DEL)
@@ -2158,7 +2188,6 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2158#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 2188#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
2159 u16 fc, type, stype; 2189 u16 fc, type, stype;
2160 struct ieee80211_hdr_4addr *hdr; 2190 struct ieee80211_hdr_4addr *hdr;
2161 DECLARE_MAC_BUF(mac);
2162 2191
2163 /* FIX: should give skb->len to handler functions and check that the 2192 /* FIX: should give skb->len to handler functions and check that the
2164 * buffer is long enough */ 2193 * buffer is long enough */
@@ -2187,8 +2216,9 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2187 2216
2188 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 2217 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2189 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=" 2218 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)="
2190 "%s not own MAC\n", 2219 MAC_FMT " not own MAC\n",
2191 print_mac(mac, hdr->addr1)); 2220 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2221 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
2192 goto done; 2222 goto done;
2193 } 2223 }
2194 2224
@@ -2224,14 +2254,18 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
2224 } 2254 }
2225 2255
2226 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) { 2256 if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2227 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%s" 2257 PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=" MAC_FMT
2228 " not own MAC\n", print_mac(mac, hdr->addr1)); 2258 " not own MAC\n",
2259 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2260 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
2229 goto done; 2261 goto done;
2230 } 2262 }
2231 2263
2232 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) { 2264 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) {
2233 PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%s" 2265 PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=" MAC_FMT
2234 " not own MAC\n", print_mac(mac, hdr->addr3)); 2266 " not own MAC\n",
2267 hdr->addr3[0], hdr->addr3[1], hdr->addr3[2],
2268 hdr->addr3[3], hdr->addr3[4], hdr->addr3[5]);
2235 goto done; 2269 goto done;
2236 } 2270 }
2237 2271
@@ -2312,7 +2346,6 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2312 struct sk_buff *skb; 2346 struct sk_buff *skb;
2313 struct ieee80211_hdr_4addr *hdr; 2347 struct ieee80211_hdr_4addr *hdr;
2314 struct hostap_80211_rx_status rx_stats; 2348 struct hostap_80211_rx_status rx_stats;
2315 DECLARE_MAC_BUF(mac);
2316 2349
2317 if (skb_queue_empty(&sta->tx_buf)) 2350 if (skb_queue_empty(&sta->tx_buf))
2318 return; 2351 return;
@@ -2334,7 +2367,9 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
2334 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14)); 2367 hdr->duration_id = cpu_to_le16(sta->aid | BIT(15) | BIT(14));
2335 2368
2336 PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for STA " 2369 PDEBUG(DEBUG_PS2, "%s: Scheduling buffered packet delivery for STA "
2337 "%s\n", local->dev->name, print_mac(mac, sta->addr)); 2370 MAC_FMT "\n", local->dev->name,
2371 sta->addr[0], sta->addr[1], sta->addr[2],
2372 sta->addr[3], sta->addr[4], sta->addr[5]);
2338 2373
2339 skb->dev = local->dev; 2374 skb->dev = local->dev;
2340 2375
@@ -2661,7 +2696,6 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
2661 int ret = sta->tx_rate; 2696 int ret = sta->tx_rate;
2662 struct hostap_interface *iface; 2697 struct hostap_interface *iface;
2663 local_info_t *local; 2698 local_info_t *local;
2664 DECLARE_MAC_BUF(mac);
2665 2699
2666 iface = netdev_priv(dev); 2700 iface = netdev_priv(dev);
2667 local = iface->local; 2701 local = iface->local;
@@ -2689,9 +2723,12 @@ static int ap_update_sta_tx_rate(struct sta_info *sta, struct net_device *dev)
2689 case 3: sta->tx_rate = 110; break; 2723 case 3: sta->tx_rate = 110; break;
2690 default: sta->tx_rate = 0; break; 2724 default: sta->tx_rate = 0; break;
2691 } 2725 }
2692 PDEBUG(DEBUG_AP, "%s: STA %s" 2726 PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
2693 " TX rate raised to %d\n", 2727 " TX rate raised to %d\n",
2694 dev->name, print_mac(mac, sta->addr), sta->tx_rate); 2728 dev->name,
2729 sta->addr[0], sta->addr[1], sta->addr[2],
2730 sta->addr[3], sta->addr[4], sta->addr[5],
2731 sta->tx_rate);
2695 } 2732 }
2696 sta->tx_since_last_failure = 0; 2733 sta->tx_since_last_failure = 0;
2697 } 2734 }
@@ -2709,7 +2746,6 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2709 int set_tim, ret; 2746 int set_tim, ret;
2710 struct ieee80211_hdr_4addr *hdr; 2747 struct ieee80211_hdr_4addr *hdr;
2711 struct hostap_skb_tx_data *meta; 2748 struct hostap_skb_tx_data *meta;
2712 DECLARE_MAC_BUF(mac);
2713 2749
2714 meta = (struct hostap_skb_tx_data *) skb->cb; 2750 meta = (struct hostap_skb_tx_data *) skb->cb;
2715 ret = AP_TX_CONTINUE; 2751 ret = AP_TX_CONTINUE;
@@ -2745,8 +2781,9 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2745 * print out any errors here. */ 2781 * print out any errors here. */
2746 if (net_ratelimit()) { 2782 if (net_ratelimit()) {
2747 printk(KERN_DEBUG "AP: drop packet to non-associated " 2783 printk(KERN_DEBUG "AP: drop packet to non-associated "
2748 "STA %s\n", 2784 "STA " MAC_FMT "\n",
2749 print_mac(mac, hdr->addr1)); 2785 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2786 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5]);
2750 } 2787 }
2751#endif 2788#endif
2752 local->ap->tx_drop_nonassoc++; 2789 local->ap->tx_drop_nonassoc++;
@@ -2784,9 +2821,11 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
2784 } 2821 }
2785 2822
2786 if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) { 2823 if (skb_queue_len(&sta->tx_buf) >= STA_MAX_TX_BUFFER) {
2787 PDEBUG(DEBUG_PS, "%s: No more space in STA (%s" 2824 PDEBUG(DEBUG_PS, "%s: No more space in STA (" MAC_FMT
2788 ")'s PS mode buffer\n", 2825 ")'s PS mode buffer\n",
2789 local->dev->name, print_mac(mac, sta->addr)); 2826 local->dev->name,
2827 sta->addr[0], sta->addr[1], sta->addr[2],
2828 sta->addr[3], sta->addr[4], sta->addr[5]);
2790 /* Make sure that TIM is set for the station (it might not be 2829 /* Make sure that TIM is set for the station (it might not be
2791 * after AP wlan hw reset). */ 2830 * after AP wlan hw reset). */
2792 /* FIX: should fix hw reset to restore bits based on STA 2831 /* FIX: should fix hw reset to restore bits based on STA
@@ -2850,7 +2889,6 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2850 struct sta_info *sta; 2889 struct sta_info *sta;
2851 struct ieee80211_hdr_4addr *hdr; 2890 struct ieee80211_hdr_4addr *hdr;
2852 struct hostap_skb_tx_data *meta; 2891 struct hostap_skb_tx_data *meta;
2853 DECLARE_MAC_BUF(mac);
2854 2892
2855 hdr = (struct ieee80211_hdr_4addr *) skb->data; 2893 hdr = (struct ieee80211_hdr_4addr *) skb->data;
2856 meta = (struct hostap_skb_tx_data *) skb->cb; 2894 meta = (struct hostap_skb_tx_data *) skb->cb;
@@ -2859,9 +2897,12 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2859 sta = ap_get_sta(local->ap, hdr->addr1); 2897 sta = ap_get_sta(local->ap, hdr->addr1);
2860 if (!sta) { 2898 if (!sta) {
2861 spin_unlock(&local->ap->sta_table_lock); 2899 spin_unlock(&local->ap->sta_table_lock);
2862 PDEBUG(DEBUG_AP, "%s: Could not find STA %s" 2900 PDEBUG(DEBUG_AP, "%s: Could not find STA " MAC_FMT
2863 " for this TX error (@%lu)\n", 2901 " for this TX error (@%lu)\n",
2864 local->dev->name, print_mac(mac, hdr->addr1), jiffies); 2902 local->dev->name,
2903 hdr->addr1[0], hdr->addr1[1], hdr->addr1[2],
2904 hdr->addr1[3], hdr->addr1[4], hdr->addr1[5],
2905 jiffies);
2865 return; 2906 return;
2866 } 2907 }
2867 2908
@@ -2888,9 +2929,11 @@ void hostap_handle_sta_tx_exc(local_info_t *local, struct sk_buff *skb)
2888 case 3: sta->tx_rate = 110; break; 2929 case 3: sta->tx_rate = 110; break;
2889 default: sta->tx_rate = 0; break; 2930 default: sta->tx_rate = 0; break;
2890 } 2931 }
2891 PDEBUG(DEBUG_AP, "%s: STA %s" 2932 PDEBUG(DEBUG_AP, "%s: STA " MAC_FMT
2892 " TX rate lowered to %d\n", 2933 " TX rate lowered to %d\n",
2893 local->dev->name, print_mac(mac, sta->addr), 2934 local->dev->name,
2935 sta->addr[0], sta->addr[1], sta->addr[2],
2936 sta->addr[3], sta->addr[4], sta->addr[5],
2894 sta->tx_rate); 2937 sta->tx_rate);
2895 } 2938 }
2896 sta->tx_consecutive_exc = 0; 2939 sta->tx_consecutive_exc = 0;
@@ -2956,7 +2999,6 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2956 struct sta_info *sta; 2999 struct sta_info *sta;
2957 u16 fc, type, stype; 3000 u16 fc, type, stype;
2958 struct ieee80211_hdr_4addr *hdr; 3001 struct ieee80211_hdr_4addr *hdr;
2959 DECLARE_MAC_BUF(mac);
2960 3002
2961 if (local->ap == NULL) 3003 if (local->ap == NULL)
2962 return AP_RX_CONTINUE; 3004 return AP_RX_CONTINUE;
@@ -2988,9 +3030,12 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
2988 } else { 3030 } else {
2989 printk(KERN_DEBUG "%s: dropped received packet" 3031 printk(KERN_DEBUG "%s: dropped received packet"
2990 " from non-associated STA " 3032 " from non-associated STA "
2991 "%s" 3033 MAC_FMT
2992 " (type=0x%02x, subtype=0x%02x)\n", 3034 " (type=0x%02x, subtype=0x%02x)\n",
2993 dev->name, print_mac(mac, hdr->addr2), 3035 dev->name,
3036 hdr->addr2[0], hdr->addr2[1],
3037 hdr->addr2[2], hdr->addr2[3],
3038 hdr->addr2[4], hdr->addr2[5],
2994 type >> 2, stype >> 4); 3039 type >> 2, stype >> 4);
2995 hostap_rx(dev, skb, rx_stats); 3040 hostap_rx(dev, skb, rx_stats);
2996#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 3041#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
@@ -3025,8 +3070,11 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3025 * being associated. */ 3070 * being associated. */
3026 printk(KERN_DEBUG "%s: rejected received nullfunc " 3071 printk(KERN_DEBUG "%s: rejected received nullfunc "
3027 "frame without ToDS from not associated STA " 3072 "frame without ToDS from not associated STA "
3028 "%s\n", 3073 MAC_FMT "\n",
3029 dev->name, print_mac(mac, hdr->addr2)); 3074 dev->name,
3075 hdr->addr2[0], hdr->addr2[1],
3076 hdr->addr2[2], hdr->addr2[3],
3077 hdr->addr2[4], hdr->addr2[5]);
3030 hostap_rx(dev, skb, rx_stats); 3078 hostap_rx(dev, skb, rx_stats);
3031#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ 3079#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
3032 } 3080 }
@@ -3043,9 +3091,12 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
3043 * If BSSID is own, report the dropping of this frame. */ 3091 * If BSSID is own, report the dropping of this frame. */
3044 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) { 3092 if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
3045 printk(KERN_DEBUG "%s: dropped received packet from " 3093 printk(KERN_DEBUG "%s: dropped received packet from "
3046 "%s with no ToDS flag " 3094 MAC_FMT " with no ToDS flag "
3047 "(type=0x%02x, subtype=0x%02x)\n", dev->name, 3095 "(type=0x%02x, subtype=0x%02x)\n", dev->name,
3048 print_mac(mac, hdr->addr2), type >> 2, stype >> 4); 3096 hdr->addr2[0], hdr->addr2[1],
3097 hdr->addr2[2], hdr->addr2[3],
3098 hdr->addr2[4], hdr->addr2[5],
3099 type >> 2, stype >> 4);
3049 hostap_dump_rx_80211(dev->name, skb, rx_stats); 3100 hostap_dump_rx_80211(dev->name, skb, rx_stats);
3050 } 3101 }
3051 ret = AP_RX_DROP; 3102 ret = AP_RX_DROP;
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index a56d9fc6354f..98d6ff69d375 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -10192,7 +10192,6 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10192 u8 id, hdr_len, unicast; 10192 u8 id, hdr_len, unicast;
10193 u16 remaining_bytes; 10193 u16 remaining_bytes;
10194 int fc; 10194 int fc;
10195 DECLARE_MAC_BUF(mac);
10196 10195
10197 hdr_len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); 10196 hdr_len = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
10198 switch (priv->ieee->iw_mode) { 10197 switch (priv->ieee->iw_mode) {
@@ -10203,8 +10202,10 @@ static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb,
10203 id = ipw_add_station(priv, hdr->addr1); 10202 id = ipw_add_station(priv, hdr->addr1);
10204 if (id == IPW_INVALID_STATION) { 10203 if (id == IPW_INVALID_STATION) {
10205 IPW_WARNING("Attempt to send data to " 10204 IPW_WARNING("Attempt to send data to "
10206 "invalid cell: %s\n", 10205 "invalid cell: " MAC_FMT "\n",
10207 print_mac(mac, hdr->addr1)); 10206 hdr->addr1[0], hdr->addr1[1],
10207 hdr->addr1[2], hdr->addr1[3],
10208 hdr->addr1[4], hdr->addr1[5]);
10208 goto drop; 10209 goto drop;
10209 } 10210 }
10210 } 10211 }
@@ -11576,6 +11577,7 @@ static int ipw_prom_alloc(struct ipw_priv *priv)
11576 priv->prom_priv->priv = priv; 11577 priv->prom_priv->priv = priv;
11577 11578
11578 strcpy(priv->prom_net_dev->name, "rtap%d"); 11579 strcpy(priv->prom_net_dev->name, "rtap%d");
11580 memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
11579 11581
11580 priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP; 11582 priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
11581 priv->prom_net_dev->open = ipw_prom_open; 11583 priv->prom_net_dev->open = ipw_prom_open;
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig
index b79a35a40ab6..b54ff712e703 100644
--- a/drivers/net/wireless/iwlwifi/Kconfig
+++ b/drivers/net/wireless/iwlwifi/Kconfig
@@ -35,7 +35,6 @@ config IWL4965_HT
35 bool "Enable 802.11n HT features in iwl4965 driver" 35 bool "Enable 802.11n HT features in iwl4965 driver"
36 depends on EXPERIMENTAL 36 depends on EXPERIMENTAL
37 depends on IWL4965 && IWL4965_QOS 37 depends on IWL4965 && IWL4965_QOS
38 depends on n
39 ---help--- 38 ---help---
40 This option enables IEEE 802.11n High Throughput features 39 This option enables IEEE 802.11n High Throughput features
41 for the iwl4965 driver. 40 for the iwl4965 driver.
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 87e145ffe8f1..6a24ed6067e0 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -541,7 +541,7 @@ void lbs_association_worker(struct work_struct *work)
541 } 541 }
542 542
543 if (find_any_ssid) { 543 if (find_any_ssid) {
544 u8 new_mode; 544 u8 new_mode = assoc_req->mode;
545 545
546 ret = lbs_find_best_network_ssid(priv, assoc_req->ssid, 546 ret = lbs_find_best_network_ssid(priv, assoc_req->ssid,
547 &assoc_req->ssid_len, assoc_req->mode, &new_mode); 547 &assoc_req->ssid_len, assoc_req->mode, &new_mode);
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 93ea212fedd5..ad2e7d53b3da 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -2399,10 +2399,8 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
2399 * beacon frame. 2399 * beacon frame.
2400 */ 2400 */
2401 if (skb_headroom(skb) < TXD_DESC_SIZE) { 2401 if (skb_headroom(skb) < TXD_DESC_SIZE) {
2402 if (pskb_expand_head(skb, TXD_DESC_SIZE, 0, GFP_ATOMIC)) { 2402 if (pskb_expand_head(skb, TXD_DESC_SIZE, 0, GFP_ATOMIC))
2403 dev_kfree_skb(skb);
2404 return -ENOMEM; 2403 return -ENOMEM;
2405 }
2406 } 2404 }
2407 2405
2408 /* 2406 /*
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index f44505994a0e..133b3f39eeb6 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -509,6 +509,8 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
509 return -EOPNOTSUPP; 509 return -EOPNOTSUPP;
510 } 510 }
511 511
512 priv->vif = conf->vif;
513
512 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); 514 rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
513 for (i = 0; i < ETH_ALEN; i++) 515 for (i = 0; i < ETH_ALEN; i++)
514 rtl818x_iowrite8(priv, &priv->map->MAC[i], 516 rtl818x_iowrite8(priv, &priv->map->MAC[i],
@@ -523,6 +525,7 @@ static void rtl8187_remove_interface(struct ieee80211_hw *dev,
523{ 525{
524 struct rtl8187_priv *priv = dev->priv; 526 struct rtl8187_priv *priv = dev->priv;
525 priv->mode = IEEE80211_IF_TYPE_MNTR; 527 priv->mode = IEEE80211_IF_TYPE_MNTR;
528 priv->vif = NULL;
526} 529}
527 530
528static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) 531static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf)
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 385e145e1acc..684968558c19 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -419,3 +419,4 @@ module_exit(at91_cf_exit);
419MODULE_DESCRIPTION("AT91 Compact Flash Driver"); 419MODULE_DESCRIPTION("AT91 Compact Flash Driver");
420MODULE_AUTHOR("David Brownell"); 420MODULE_AUTHOR("David Brownell");
421MODULE_LICENSE("GPL"); 421MODULE_LICENSE("GPL");
422MODULE_ALIAS("platform:at91_cf");
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 2df216b00817..bb6db3a582b2 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -344,6 +344,7 @@ static int omap_cf_resume(struct platform_device *pdev)
344static struct platform_driver omap_cf_driver = { 344static struct platform_driver omap_cf_driver = {
345 .driver = { 345 .driver = {
346 .name = (char *) driver_name, 346 .name = (char *) driver_name,
347 .owner = THIS_MODULE,
347 }, 348 },
348 .remove = __exit_p(omap_cf_remove), 349 .remove = __exit_p(omap_cf_remove),
349 .suspend = omap_cf_suspend, 350 .suspend = omap_cf_suspend,
@@ -368,3 +369,4 @@ module_exit(omap_cf_exit);
368 369
369MODULE_DESCRIPTION("OMAP CF Driver"); 370MODULE_DESCRIPTION("OMAP CF Driver");
370MODULE_LICENSE("GPL"); 371MODULE_LICENSE("GPL");
372MODULE_ALIAS("platform:omap_cf");
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index e439044d88f2..9414163c78e7 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -239,6 +239,7 @@ static struct platform_driver pxa2xx_pcmcia_driver = {
239 .resume = pxa2xx_drv_pcmcia_resume, 239 .resume = pxa2xx_drv_pcmcia_resume,
240 .driver = { 240 .driver = {
241 .name = "pxa2xx-pcmcia", 241 .name = "pxa2xx-pcmcia",
242 .owner = THIS_MODULE,
242 }, 243 },
243}; 244};
244 245
@@ -258,3 +259,4 @@ module_exit(pxa2xx_pcmcia_exit);
258MODULE_AUTHOR("Stefan Eletzhofer <stefan.eletzhofer@inquant.de> and Ian Molton <spyro@f2s.com>"); 259MODULE_AUTHOR("Stefan Eletzhofer <stefan.eletzhofer@inquant.de> and Ian Molton <spyro@f2s.com>");
259MODULE_DESCRIPTION("Linux PCMCIA Card Services: PXA2xx core socket driver"); 260MODULE_DESCRIPTION("Linux PCMCIA Card Services: PXA2xx core socket driver");
260MODULE_LICENSE("GPL"); 261MODULE_LICENSE("GPL");
262MODULE_ALIAS("platform:pxa2xx-pcmcia");
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 9e7de63b26ef..02a4c8cf2b2d 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -252,6 +252,7 @@ config RTC_DRV_TWL92330
252 252
253config RTC_DRV_S35390A 253config RTC_DRV_S35390A
254 tristate "Seiko Instruments S-35390A" 254 tristate "Seiko Instruments S-35390A"
255 select BITREVERSE
255 help 256 help
256 If you say yes here you will get support for the Seiko 257 If you say yes here you will get support for the Seiko
257 Instruments S-35390A. 258 Instruments S-35390A.
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index d3b9b14267ab..42244f14b41c 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -290,7 +290,7 @@ static int __exit at32_rtc_remove(struct platform_device *pdev)
290 return 0; 290 return 0;
291} 291}
292 292
293MODULE_ALIAS("at32ap700x_rtc"); 293MODULE_ALIAS("platform:at32ap700x_rtc");
294 294
295static struct platform_driver at32_rtc_driver = { 295static struct platform_driver at32_rtc_driver = {
296 .remove = __exit_p(at32_rtc_remove), 296 .remove = __exit_p(at32_rtc_remove),
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 33795e5a5595..52abffc86bcd 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -407,3 +407,4 @@ module_exit(at91_rtc_exit);
407MODULE_AUTHOR("Rick Bronson"); 407MODULE_AUTHOR("Rick Bronson");
408MODULE_DESCRIPTION("RTC driver for Atmel AT91RM9200"); 408MODULE_DESCRIPTION("RTC driver for Atmel AT91RM9200");
409MODULE_LICENSE("GPL"); 409MODULE_LICENSE("GPL");
410MODULE_ALIAS("platform:at91_rtc");
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index d90ba860d216..4f28045d9ef2 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -470,3 +470,4 @@ module_exit(bfin_rtc_exit);
470MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver"); 470MODULE_DESCRIPTION("Blackfin On-Chip Real Time Clock Driver");
471MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>"); 471MODULE_AUTHOR("Mike Frysinger <vapier@gentoo.org>");
472MODULE_LICENSE("GPL"); 472MODULE_LICENSE("GPL");
473MODULE_ALIAS("platform:rtc-bfin");
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index f3ee2ad566b4..dcdc142a3441 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -198,9 +198,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
198 198
199 /* Writing 0xff means "don't care" or "match all". */ 199 /* Writing 0xff means "don't care" or "match all". */
200 200
201 mon = t->time.tm_mon; 201 mon = t->time.tm_mon + 1;
202 mon = (mon < 12) ? BIN2BCD(mon) : 0xff; 202 mon = (mon <= 12) ? BIN2BCD(mon) : 0xff;
203 mon++;
204 203
205 mday = t->time.tm_mday; 204 mday = t->time.tm_mday;
206 mday = (mday >= 1 && mday <= 31) ? BIN2BCD(mday) : 0xff; 205 mday = (mday >= 1 && mday <= 31) ? BIN2BCD(mday) : 0xff;
@@ -943,6 +942,9 @@ static void cmos_platform_shutdown(struct platform_device *pdev)
943 cmos_do_shutdown(); 942 cmos_do_shutdown();
944} 943}
945 944
945/* work with hotplug and coldplug */
946MODULE_ALIAS("platform:rtc_cmos");
947
946static struct platform_driver cmos_platform_driver = { 948static struct platform_driver cmos_platform_driver = {
947 .remove = __exit_p(cmos_platform_remove), 949 .remove = __exit_p(cmos_platform_remove),
948 .shutdown = cmos_platform_shutdown, 950 .shutdown = cmos_platform_shutdown,
diff --git a/drivers/rtc/rtc-ds1216.c b/drivers/rtc/rtc-ds1216.c
index 83efb88f8f23..0b17770b032b 100644
--- a/drivers/rtc/rtc-ds1216.c
+++ b/drivers/rtc/rtc-ds1216.c
@@ -221,6 +221,7 @@ MODULE_AUTHOR("Thomas Bogendoerfer <tsbogend@alpha.franken.de>");
221MODULE_DESCRIPTION("DS1216 RTC driver"); 221MODULE_DESCRIPTION("DS1216 RTC driver");
222MODULE_LICENSE("GPL"); 222MODULE_LICENSE("GPL");
223MODULE_VERSION(DRV_VERSION); 223MODULE_VERSION(DRV_VERSION);
224MODULE_ALIAS("platform:rtc-ds1216");
224 225
225module_init(ds1216_rtc_init); 226module_init(ds1216_rtc_init);
226module_exit(ds1216_rtc_exit); 227module_exit(ds1216_rtc_exit);
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index d74b8086fa31..d08912f18ddd 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -626,6 +626,9 @@ ds1511_rtc_remove(struct platform_device *pdev)
626 return 0; 626 return 0;
627} 627}
628 628
629/* work with hotplug and coldplug */
630MODULE_ALIAS("platform:ds1511");
631
629static struct platform_driver ds1511_rtc_driver = { 632static struct platform_driver ds1511_rtc_driver = {
630 .probe = ds1511_rtc_probe, 633 .probe = ds1511_rtc_probe,
631 .remove = __devexit_p(ds1511_rtc_remove), 634 .remove = __devexit_p(ds1511_rtc_remove),
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index d9e848dcd450..a19f11415540 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -391,6 +391,9 @@ static int __devexit ds1553_rtc_remove(struct platform_device *pdev)
391 return 0; 391 return 0;
392} 392}
393 393
394/* work with hotplug and coldplug */
395MODULE_ALIAS("platform:rtc-ds1553");
396
394static struct platform_driver ds1553_rtc_driver = { 397static struct platform_driver ds1553_rtc_driver = {
395 .probe = ds1553_rtc_probe, 398 .probe = ds1553_rtc_probe,
396 .remove = __devexit_p(ds1553_rtc_remove), 399 .remove = __devexit_p(ds1553_rtc_remove),
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 2e73f0b183b2..24d35ede2dbf 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -276,3 +276,4 @@ MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
276MODULE_DESCRIPTION("Dallas DS1742 RTC driver"); 276MODULE_DESCRIPTION("Dallas DS1742 RTC driver");
277MODULE_LICENSE("GPL"); 277MODULE_LICENSE("GPL");
278MODULE_VERSION(DRV_VERSION); 278MODULE_VERSION(DRV_VERSION);
279MODULE_ALIAS("platform:rtc-ds1742");
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index ef4f147f3c0c..1e99325270df 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -132,6 +132,9 @@ static int __devexit ep93xx_rtc_remove(struct platform_device *dev)
132 return 0; 132 return 0;
133} 133}
134 134
135/* work with hotplug and coldplug */
136MODULE_ALIAS("platform:ep93xx-rtc");
137
135static struct platform_driver ep93xx_rtc_platform_driver = { 138static struct platform_driver ep93xx_rtc_platform_driver = {
136 .driver = { 139 .driver = {
137 .name = "ep93xx-rtc", 140 .name = "ep93xx-rtc",
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index cd0bbc0e8038..013e6c103b9c 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -465,6 +465,9 @@ static int __devexit m48t59_rtc_remove(struct platform_device *pdev)
465 return 0; 465 return 0;
466} 466}
467 467
468/* work with hotplug and coldplug */
469MODULE_ALIAS("platform:rtc-m48t59");
470
468static struct platform_driver m48t59_rtc_driver = { 471static struct platform_driver m48t59_rtc_driver = {
469 .driver = { 472 .driver = {
470 .name = "rtc-m48t59", 473 .name = "rtc-m48t59",
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index 8ff4a1221f59..3f7f99a5d96a 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -199,6 +199,7 @@ MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
199MODULE_DESCRIPTION("M48T86 RTC driver"); 199MODULE_DESCRIPTION("M48T86 RTC driver");
200MODULE_LICENSE("GPL"); 200MODULE_LICENSE("GPL");
201MODULE_VERSION(DRV_VERSION); 201MODULE_VERSION(DRV_VERSION);
202MODULE_ALIAS("platform:rtc-m48t86");
202 203
203module_init(m48t86_rtc_init); 204module_init(m48t86_rtc_init);
204module_exit(m48t86_rtc_exit); 205module_exit(m48t86_rtc_exit);
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index a2f84f169588..58f81c774943 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -497,7 +497,7 @@ static void omap_rtc_shutdown(struct platform_device *pdev)
497 rtc_write(0, OMAP_RTC_INTERRUPTS_REG); 497 rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
498} 498}
499 499
500MODULE_ALIAS("omap_rtc"); 500MODULE_ALIAS("platform:omap_rtc");
501static struct platform_driver omap_rtc_driver = { 501static struct platform_driver omap_rtc_driver = {
502 .probe = omap_rtc_probe, 502 .probe = omap_rtc_probe,
503 .remove = __devexit_p(omap_rtc_remove), 503 .remove = __devexit_p(omap_rtc_remove),
diff --git a/drivers/rtc/rtc-rs5c313.c b/drivers/rtc/rtc-rs5c313.c
index 66eb133bf5fd..664e89a817ed 100644
--- a/drivers/rtc/rtc-rs5c313.c
+++ b/drivers/rtc/rtc-rs5c313.c
@@ -421,3 +421,4 @@ MODULE_VERSION(DRV_VERSION);
421MODULE_AUTHOR("kogiidena , Nobuhiro Iwamatsu <iwamatsu@nigauri.org>"); 421MODULE_AUTHOR("kogiidena , Nobuhiro Iwamatsu <iwamatsu@nigauri.org>");
422MODULE_DESCRIPTION("Ricoh RS5C313 RTC device driver"); 422MODULE_DESCRIPTION("Ricoh RS5C313 RTC device driver");
423MODULE_LICENSE("GPL"); 423MODULE_LICENSE("GPL");
424MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 86766f1f2496..9f4d5129a496 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -592,3 +592,4 @@ module_exit(s3c_rtc_exit);
592MODULE_DESCRIPTION("Samsung S3C RTC Driver"); 592MODULE_DESCRIPTION("Samsung S3C RTC Driver");
593MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 593MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
594MODULE_LICENSE("GPL"); 594MODULE_LICENSE("GPL");
595MODULE_ALIAS("platform:s3c2410-rtc");
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index ee253cc45de1..82f62d25f921 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -399,3 +399,4 @@ module_exit(sa1100_rtc_exit);
399MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>"); 399MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
400MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)"); 400MODULE_DESCRIPTION("SA11x0/PXA2xx Realtime Clock Driver (RTC)");
401MODULE_LICENSE("GPL"); 401MODULE_LICENSE("GPL");
402MODULE_ALIAS("platform:sa1100-rtc");
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index c1d6a1880ccf..9e9caa5d7f5f 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -664,3 +664,4 @@ MODULE_DESCRIPTION("SuperH on-chip RTC driver");
664MODULE_VERSION(DRV_VERSION); 664MODULE_VERSION(DRV_VERSION);
665MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, Jamie Lenehan <lenehan@twibble.org>"); 665MODULE_AUTHOR("Paul Mundt <lethal@linux-sh.org>, Jamie Lenehan <lenehan@twibble.org>");
666MODULE_LICENSE("GPL"); 666MODULE_LICENSE("GPL");
667MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index a265da7c6ff8..31d3c8c28588 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -394,6 +394,9 @@ static int __devexit stk17ta8_rtc_remove(struct platform_device *pdev)
394 return 0; 394 return 0;
395} 395}
396 396
397/* work with hotplug and coldplug */
398MODULE_ALIAS("platform:stk17ta8");
399
397static struct platform_driver stk17ta8_rtc_driver = { 400static struct platform_driver stk17ta8_rtc_driver = {
398 .probe = stk17ta8_rtc_probe, 401 .probe = stk17ta8_rtc_probe,
399 .remove = __devexit_p(stk17ta8_rtc_remove), 402 .remove = __devexit_p(stk17ta8_rtc_remove),
diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
index a6b572978dc0..24203a06051a 100644
--- a/drivers/rtc/rtc-v3020.c
+++ b/drivers/rtc/rtc-v3020.c
@@ -264,3 +264,4 @@ module_exit(v3020_exit);
264MODULE_DESCRIPTION("V3020 RTC"); 264MODULE_DESCRIPTION("V3020 RTC");
265MODULE_AUTHOR("Raphael Assenat"); 265MODULE_AUTHOR("Raphael Assenat");
266MODULE_LICENSE("GPL"); 266MODULE_LICENSE("GPL");
267MODULE_ALIAS("platform:v3020");
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index ce2f78de7a80..be9c70d0b193 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -422,6 +422,9 @@ static int __devexit rtc_remove(struct platform_device *pdev)
422 return 0; 422 return 0;
423} 423}
424 424
425/* work with hotplug and coldplug */
426MODULE_ALIAS("platform:RTC");
427
425static struct platform_driver rtc_platform_driver = { 428static struct platform_driver rtc_platform_driver = {
426 .probe = rtc_probe, 429 .probe = rtc_probe,
427 .remove = __devexit_p(rtc_remove), 430 .remove = __devexit_p(rtc_remove),
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 430997e33fc4..55492fa095a2 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1577,3 +1577,4 @@ module_exit(atmel_serial_exit);
1577MODULE_AUTHOR("Rick Bronson"); 1577MODULE_AUTHOR("Rick Bronson");
1578MODULE_DESCRIPTION("Atmel AT91 / AT32 serial port driver"); 1578MODULE_DESCRIPTION("Atmel AT91 / AT32 serial port driver");
1579MODULE_LICENSE("GPL"); 1579MODULE_LICENSE("GPL");
1580MODULE_ALIAS("platform:atmel_usart");
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 0aa345b9a38b..46bb47f37b9a 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -1243,6 +1243,7 @@ static struct platform_driver bfin_serial_driver = {
1243 .resume = bfin_serial_resume, 1243 .resume = bfin_serial_resume,
1244 .driver = { 1244 .driver = {
1245 .name = "bfin-uart", 1245 .name = "bfin-uart",
1246 .owner = THIS_MODULE,
1246 }, 1247 },
1247}; 1248};
1248 1249
@@ -1301,3 +1302,4 @@ MODULE_AUTHOR("Aubrey.Li <aubrey.li@analog.com>");
1301MODULE_DESCRIPTION("Blackfin generic serial port driver"); 1302MODULE_DESCRIPTION("Blackfin generic serial port driver");
1302MODULE_LICENSE("GPL"); 1303MODULE_LICENSE("GPL");
1303MODULE_ALIAS_CHARDEV_MAJOR(BFIN_SERIAL_MAJOR); 1304MODULE_ALIAS_CHARDEV_MAJOR(BFIN_SERIAL_MAJOR);
1305MODULE_ALIAS("platform:bfin-uart");
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 56af1f566a4c..16ba9ac7a566 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -1090,6 +1090,7 @@ static struct platform_driver serial_imx_driver = {
1090 .resume = serial_imx_resume, 1090 .resume = serial_imx_resume,
1091 .driver = { 1091 .driver = {
1092 .name = "imx-uart", 1092 .name = "imx-uart",
1093 .owner = THIS_MODULE,
1093 }, 1094 },
1094}; 1095};
1095 1096
@@ -1124,3 +1125,4 @@ module_exit(imx_serial_exit);
1124MODULE_AUTHOR("Sascha Hauer"); 1125MODULE_AUTHOR("Sascha Hauer");
1125MODULE_DESCRIPTION("IMX generic serial port driver"); 1126MODULE_DESCRIPTION("IMX generic serial port driver");
1126MODULE_LICENSE("GPL"); 1127MODULE_LICENSE("GPL");
1128MODULE_ALIAS("platform:imx-uart");
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index e76fc72c9b36..7e164e0cd211 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -649,5 +649,6 @@ module_exit(mcf_exit);
649MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); 649MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
650MODULE_DESCRIPTION("Freescale ColdFire UART driver"); 650MODULE_DESCRIPTION("Freescale ColdFire UART driver");
651MODULE_LICENSE("GPL"); 651MODULE_LICENSE("GPL");
652MODULE_ALIAS("platform:mcfuart");
652 653
653/****************************************************************************/ 654/****************************************************************************/
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index a638f23c6c61..d93b3578c5e2 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -1188,6 +1188,8 @@ mpc52xx_uart_resume(struct platform_device *dev)
1188} 1188}
1189#endif 1189#endif
1190 1190
1191/* work with hotplug and coldplug */
1192MODULE_ALIAS("platform:mpc52xx-psc");
1191 1193
1192static struct platform_driver mpc52xx_uart_platform_driver = { 1194static struct platform_driver mpc52xx_uart_platform_driver = {
1193 .probe = mpc52xx_uart_probe, 1195 .probe = mpc52xx_uart_probe,
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index cb3a91967742..e8819c43f57d 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -1964,6 +1964,7 @@ static struct platform_driver mpsc_driver = {
1964 .remove = mpsc_drv_remove, 1964 .remove = mpsc_drv_remove,
1965 .driver = { 1965 .driver = {
1966 .name = MPSC_CTLR_NAME, 1966 .name = MPSC_CTLR_NAME,
1967 .owner = THIS_MODULE,
1967 }, 1968 },
1968}; 1969};
1969 1970
@@ -2007,3 +2008,4 @@ MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver $Revision: 1.00 $");
2007MODULE_VERSION(MPSC_VERSION); 2008MODULE_VERSION(MPSC_VERSION);
2008MODULE_LICENSE("GPL"); 2009MODULE_LICENSE("GPL");
2009MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR); 2010MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR);
2011MODULE_ALIAS("platform:" MPSC_CTLR_NAME);
diff --git a/drivers/serial/netx-serial.c b/drivers/serial/netx-serial.c
index b56f7db45031..3123ffeac8ad 100644
--- a/drivers/serial/netx-serial.c
+++ b/drivers/serial/netx-serial.c
@@ -713,6 +713,7 @@ static struct platform_driver serial_netx_driver = {
713 713
714 .driver = { 714 .driver = {
715 .name = DRIVER_NAME, 715 .name = DRIVER_NAME,
716 .owner = THIS_MODULE,
716 }, 717 },
717}; 718};
718 719
@@ -745,3 +746,4 @@ module_exit(netx_serial_exit);
745MODULE_AUTHOR("Sascha Hauer"); 746MODULE_AUTHOR("Sascha Hauer");
746MODULE_DESCRIPTION("NetX serial port driver"); 747MODULE_DESCRIPTION("NetX serial port driver");
747MODULE_LICENSE("GPL"); 748MODULE_LICENSE("GPL");
749MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 8d01c59e8d04..d0e5a79ea635 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -850,3 +850,4 @@ MODULE_AUTHOR("Embedded Alley Solutions, Inc.");
850MODULE_DESCRIPTION("PNX8XXX SoCs serial port driver"); 850MODULE_DESCRIPTION("PNX8XXX SoCs serial port driver");
851MODULE_LICENSE("GPL"); 851MODULE_LICENSE("GPL");
852MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_PNX8XXX_MAJOR); 852MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_PNX8XXX_MAJOR);
853MODULE_ALIAS("platform:pnx8xxx-uart");
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 352fcb8926a6..b4f7ffb7688d 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -833,6 +833,7 @@ static struct platform_driver serial_pxa_driver = {
833 .resume = serial_pxa_resume, 833 .resume = serial_pxa_resume,
834 .driver = { 834 .driver = {
835 .name = "pxa2xx-uart", 835 .name = "pxa2xx-uart",
836 .owner = THIS_MODULE,
836 }, 837 },
837}; 838};
838 839
@@ -861,4 +862,4 @@ module_init(serial_pxa_init);
861module_exit(serial_pxa_exit); 862module_exit(serial_pxa_exit);
862 863
863MODULE_LICENSE("GPL"); 864MODULE_LICENSE("GPL");
864 865MODULE_ALIAS("platform:pxa2xx-uart");
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 45de19366030..4ffa2585429a 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -1935,3 +1935,7 @@ console_initcall(s3c24xx_serial_initconsole);
1935MODULE_LICENSE("GPL"); 1935MODULE_LICENSE("GPL");
1936MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 1936MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
1937MODULE_DESCRIPTION("Samsung S3C2410/S3C2440/S3C2412 Serial port driver"); 1937MODULE_DESCRIPTION("Samsung S3C2410/S3C2440/S3C2412 Serial port driver");
1938MODULE_ALIAS("platform:s3c2400-uart");
1939MODULE_ALIAS("platform:s3c2410-uart");
1940MODULE_ALIAS("platform:s3c2412-uart");
1941MODULE_ALIAS("platform:s3c2440-uart");
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 58a83c27e14b..67b2338913c2 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -884,6 +884,7 @@ static struct platform_driver sa11x0_serial_driver = {
884 .resume = sa1100_serial_resume, 884 .resume = sa1100_serial_resume,
885 .driver = { 885 .driver = {
886 .name = "sa11x0-uart", 886 .name = "sa11x0-uart",
887 .owner = THIS_MODULE,
887 }, 888 },
888}; 889};
889 890
@@ -917,3 +918,4 @@ MODULE_AUTHOR("Deep Blue Solutions Ltd");
917MODULE_DESCRIPTION("SA1100 generic serial port driver $Revision: 1.50 $"); 918MODULE_DESCRIPTION("SA1100 generic serial port driver $Revision: 1.50 $");
918MODULE_LICENSE("GPL"); 919MODULE_LICENSE("GPL");
919MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR); 920MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_SA1100_MAJOR);
921MODULE_ALIAS("platform:sa11x0-uart");
diff --git a/drivers/serial/sc26xx.c b/drivers/serial/sc26xx.c
index a350b6d2a181..ae2a9e2df777 100644
--- a/drivers/serial/sc26xx.c
+++ b/drivers/serial/sc26xx.c
@@ -732,6 +732,7 @@ static struct platform_driver sc26xx_driver = {
732 .remove = __devexit_p(sc26xx_driver_remove), 732 .remove = __devexit_p(sc26xx_driver_remove),
733 .driver = { 733 .driver = {
734 .name = "SC26xx", 734 .name = "SC26xx",
735 .owner = THIS_MODULE,
735 }, 736 },
736}; 737};
737 738
@@ -753,3 +754,4 @@ MODULE_AUTHOR("Thomas Bogendörfer");
753MODULE_DESCRIPTION("SC681/SC2692 serial driver"); 754MODULE_DESCRIPTION("SC681/SC2692 serial driver");
754MODULE_VERSION("1.0"); 755MODULE_VERSION("1.0");
755MODULE_LICENSE("GPL"); 756MODULE_LICENSE("GPL");
757MODULE_ALIAS("platform:SC26xx");
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 9d244d1644e1..eff593080d4f 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1552,3 +1552,4 @@ module_init(sci_init);
1552module_exit(sci_exit); 1552module_exit(sci_exit);
1553 1553
1554MODULE_LICENSE("GPL"); 1554MODULE_LICENSE("GPL");
1555MODULE_ALIAS("platform:sh-sci");
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index 4e06ab6bcb6e..b565d5a37499 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -561,6 +561,9 @@ static int __devexit ulite_remove(struct platform_device *pdev)
561 return ulite_release(&pdev->dev); 561 return ulite_release(&pdev->dev);
562} 562}
563 563
564/* work with hotplug and coldplug */
565MODULE_ALIAS("platform:uartlite");
566
564static struct platform_driver ulite_platform_driver = { 567static struct platform_driver ulite_platform_driver = {
565 .probe = ulite_probe, 568 .probe = ulite_probe,
566 .remove = __devexit_p(ulite_remove), 569 .remove = __devexit_p(ulite_remove),
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index 6fd51b0022ca..98ab649c1ff9 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -960,3 +960,6 @@ static void __exit vr41xx_siu_exit(void)
960 960
961module_init(vr41xx_siu_init); 961module_init(vr41xx_siu_init);
962module_exit(vr41xx_siu_exit); 962module_exit(vr41xx_siu_exit);
963
964MODULE_LICENSE("GPL");
965MODULE_ALIAS("platform:SIU");
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 85687aaf9cab..1749a27be066 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -863,3 +863,4 @@ module_exit(atmel_spi_exit);
863MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver"); 863MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
864MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>"); 864MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
865MODULE_LICENSE("GPL"); 865MODULE_LICENSE("GPL");
866MODULE_ALIAS("platform:atmel_spi");
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/au1550_spi.c
index 41a3d00c4515..072c4a595334 100644
--- a/drivers/spi/au1550_spi.c
+++ b/drivers/spi/au1550_spi.c
@@ -958,6 +958,9 @@ static int __exit au1550_spi_remove(struct platform_device *pdev)
958 return 0; 958 return 0;
959} 959}
960 960
961/* work with hotplug and coldplug */
962MODULE_ALIAS("platform:au1550-spi");
963
961static struct platform_driver au1550_spi_drv = { 964static struct platform_driver au1550_spi_drv = {
962 .remove = __exit_p(au1550_spi_remove), 965 .remove = __exit_p(au1550_spi_remove),
963 .driver = { 966 .driver = {
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index a86315a0c5b8..90729469d481 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -500,6 +500,9 @@ static int __exit mpc52xx_psc_spi_remove(struct platform_device *dev)
500 return mpc52xx_psc_spi_do_remove(&dev->dev); 500 return mpc52xx_psc_spi_do_remove(&dev->dev);
501} 501}
502 502
503/* work with hotplug and coldplug */
504MODULE_ALIAS("platform:mpc52xx-psc-spi");
505
503static struct platform_driver mpc52xx_psc_spi_platform_driver = { 506static struct platform_driver mpc52xx_psc_spi_platform_driver = {
504 .remove = __exit_p(mpc52xx_psc_spi_remove), 507 .remove = __exit_p(mpc52xx_psc_spi_remove),
505 .driver = { 508 .driver = {
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index a6ba11afb03f..b1cc148036c1 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1084,6 +1084,9 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
1084 return 0; 1084 return 0;
1085} 1085}
1086 1086
1087/* work with hotplug and coldplug */
1088MODULE_ALIAS("platform:omap2_mcspi");
1089
1087static struct platform_driver omap2_mcspi_driver = { 1090static struct platform_driver omap2_mcspi_driver = {
1088 .driver = { 1091 .driver = {
1089 .name = "omap2_mcspi", 1092 .name = "omap2_mcspi",
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index 8245b5153f30..5f00bd6500ef 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -537,10 +537,12 @@ static int __exit uwire_remove(struct platform_device *pdev)
537 return status; 537 return status;
538} 538}
539 539
540/* work with hotplug and coldplug */
541MODULE_ALIAS("platform:omap_uwire");
542
540static struct platform_driver uwire_driver = { 543static struct platform_driver uwire_driver = {
541 .driver = { 544 .driver = {
542 .name = "omap_uwire", 545 .name = "omap_uwire",
543 .bus = &platform_bus_type,
544 .owner = THIS_MODULE, 546 .owner = THIS_MODULE,
545 }, 547 },
546 .remove = __exit_p(uwire_remove), 548 .remove = __exit_p(uwire_remove),
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 59deed79e0ab..147e26a78d64 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -44,6 +44,7 @@
44MODULE_AUTHOR("Stephen Street"); 44MODULE_AUTHOR("Stephen Street");
45MODULE_DESCRIPTION("PXA2xx SSP SPI Controller"); 45MODULE_DESCRIPTION("PXA2xx SSP SPI Controller");
46MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
47MODULE_ALIAS("platform:pxa2xx-spi");
47 48
48#define MAX_BUSES 3 49#define MAX_BUSES 3
49 50
@@ -1581,7 +1582,6 @@ static int pxa2xx_spi_resume(struct platform_device *pdev)
1581static struct platform_driver driver = { 1582static struct platform_driver driver = {
1582 .driver = { 1583 .driver = {
1583 .name = "pxa2xx-spi", 1584 .name = "pxa2xx-spi",
1584 .bus = &platform_bus_type,
1585 .owner = THIS_MODULE, 1585 .owner = THIS_MODULE,
1586 }, 1586 },
1587 .remove = pxa2xx_spi_remove, 1587 .remove = pxa2xx_spi_remove,
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index d853fceb6bf0..a9ac1fdb3094 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -713,8 +713,8 @@ static void pump_transfers(unsigned long data)
713 } else { 713 } else {
714 drv_data->len = transfer->len; 714 drv_data->len = transfer->len;
715 } 715 }
716 dev_dbg(&drv_data->pdev->dev, "transfer: ", 716 dev_dbg(&drv_data->pdev->dev,
717 "drv_data->write is %p, chip->write is %p, null_wr is %p\n", 717 "transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n",
718 drv_data->write, chip->write, null_writer); 718 drv_data->write, chip->write, null_writer);
719 719
720 /* speed and width has been set on per message */ 720 /* speed and width has been set on per message */
@@ -1294,6 +1294,12 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
1294 goto out_error_queue_alloc; 1294 goto out_error_queue_alloc;
1295 } 1295 }
1296 1296
1297 status = peripheral_request_list(drv_data->pin_req, DRV_NAME);
1298 if (status != 0) {
1299 dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
1300 goto out_error_queue_alloc;
1301 }
1302
1297 /* Register with the SPI framework */ 1303 /* Register with the SPI framework */
1298 platform_set_drvdata(pdev, drv_data); 1304 platform_set_drvdata(pdev, drv_data);
1299 status = spi_register_master(master); 1305 status = spi_register_master(master);
@@ -1302,12 +1308,6 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
1302 goto out_error_queue_alloc; 1308 goto out_error_queue_alloc;
1303 } 1309 }
1304 1310
1305 status = peripheral_request_list(drv_data->pin_req, DRV_NAME);
1306 if (status != 0) {
1307 dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
1308 goto out_error;
1309 }
1310
1311 dev_info(dev, "%s, Version %s, regs_base@%p, dma channel@%d\n", 1311 dev_info(dev, "%s, Version %s, regs_base@%p, dma channel@%d\n",
1312 DRV_DESC, DRV_VERSION, drv_data->regs_base, 1312 DRV_DESC, DRV_VERSION, drv_data->regs_base,
1313 drv_data->dma_channel); 1313 drv_data->dma_channel);
@@ -1319,7 +1319,6 @@ out_error_no_dma_ch:
1319 iounmap((void *) drv_data->regs_base); 1319 iounmap((void *) drv_data->regs_base);
1320out_error_ioremap: 1320out_error_ioremap:
1321out_error_get_res: 1321out_error_get_res:
1322out_error:
1323 spi_master_put(master); 1322 spi_master_put(master);
1324 1323
1325 return status; 1324 return status;
@@ -1397,7 +1396,7 @@ static int bfin5xx_spi_resume(struct platform_device *pdev)
1397#define bfin5xx_spi_resume NULL 1396#define bfin5xx_spi_resume NULL
1398#endif /* CONFIG_PM */ 1397#endif /* CONFIG_PM */
1399 1398
1400MODULE_ALIAS("bfin-spi-master"); /* for platform bus hotplug */ 1399MODULE_ALIAS("platform:bfin-spi");
1401static struct platform_driver bfin5xx_spi_driver = { 1400static struct platform_driver bfin5xx_spi_driver = {
1402 .driver = { 1401 .driver = {
1403 .name = DRV_NAME, 1402 .name = DRV_NAME,
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 1b0647124933..d4ba640366b6 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -1722,10 +1722,12 @@ static int spi_imx_resume(struct platform_device *pdev)
1722#define spi_imx_resume NULL 1722#define spi_imx_resume NULL
1723#endif /* CONFIG_PM */ 1723#endif /* CONFIG_PM */
1724 1724
1725/* work with hotplug and coldplug */
1726MODULE_ALIAS("platform:spi_imx");
1727
1725static struct platform_driver driver = { 1728static struct platform_driver driver = {
1726 .driver = { 1729 .driver = {
1727 .name = "spi_imx", 1730 .name = "spi_imx",
1728 .bus = &platform_bus_type,
1729 .owner = THIS_MODULE, 1731 .owner = THIS_MODULE,
1730 }, 1732 },
1731 .remove = __exit_p(spi_imx_remove), 1733 .remove = __exit_p(spi_imx_remove),
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 04f7cd9fc261..be15a6213205 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -523,11 +523,12 @@ static int __exit mpc83xx_spi_remove(struct platform_device *dev)
523 return 0; 523 return 0;
524} 524}
525 525
526MODULE_ALIAS("mpc83xx_spi"); /* for platform bus hotplug */ 526MODULE_ALIAS("platform:mpc83xx_spi");
527static struct platform_driver mpc83xx_spi_driver = { 527static struct platform_driver mpc83xx_spi_driver = {
528 .remove = __exit_p(mpc83xx_spi_remove), 528 .remove = __exit_p(mpc83xx_spi_remove),
529 .driver = { 529 .driver = {
530 .name = "mpc83xx_spi", 530 .name = "mpc83xx_spi",
531 .owner = THIS_MODULE,
531 }, 532 },
532}; 533};
533 534
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 6e834b8b9d27..b7476b888197 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -192,8 +192,11 @@ static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
192 hw->len = t->len; 192 hw->len = t->len;
193 hw->count = 0; 193 hw->count = 0;
194 194
195 init_completion(&hw->done);
196
195 /* send the first byte */ 197 /* send the first byte */
196 writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT); 198 writeb(hw_txbyte(hw, 0), hw->regs + S3C2410_SPTDAT);
199
197 wait_for_completion(&hw->done); 200 wait_for_completion(&hw->done);
198 201
199 return hw->count; 202 return hw->count;
@@ -235,6 +238,7 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
235 238
236static int __init s3c24xx_spi_probe(struct platform_device *pdev) 239static int __init s3c24xx_spi_probe(struct platform_device *pdev)
237{ 240{
241 struct s3c2410_spi_info *pdata;
238 struct s3c24xx_spi *hw; 242 struct s3c24xx_spi *hw;
239 struct spi_master *master; 243 struct spi_master *master;
240 struct resource *res; 244 struct resource *res;
@@ -251,10 +255,10 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
251 memset(hw, 0, sizeof(struct s3c24xx_spi)); 255 memset(hw, 0, sizeof(struct s3c24xx_spi));
252 256
253 hw->master = spi_master_get(master); 257 hw->master = spi_master_get(master);
254 hw->pdata = pdev->dev.platform_data; 258 hw->pdata = pdata = pdev->dev.platform_data;
255 hw->dev = &pdev->dev; 259 hw->dev = &pdev->dev;
256 260
257 if (hw->pdata == NULL) { 261 if (pdata == NULL) {
258 dev_err(&pdev->dev, "No platform data supplied\n"); 262 dev_err(&pdev->dev, "No platform data supplied\n");
259 err = -ENOENT; 263 err = -ENOENT;
260 goto err_no_pdata; 264 goto err_no_pdata;
@@ -263,6 +267,10 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
263 platform_set_drvdata(pdev, hw); 267 platform_set_drvdata(pdev, hw);
264 init_completion(&hw->done); 268 init_completion(&hw->done);
265 269
270 /* setup the master state. */
271
272 master->num_chipselect = hw->pdata->num_cs;
273
266 /* setup the state for the bitbang driver */ 274 /* setup the state for the bitbang driver */
267 275
268 hw->bitbang.master = hw->master; 276 hw->bitbang.master = hw->master;
@@ -330,13 +338,13 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
330 338
331 /* setup any gpio we can */ 339 /* setup any gpio we can */
332 340
333 if (!hw->pdata->set_cs) { 341 if (!pdata->set_cs) {
334 hw->set_cs = s3c24xx_spi_gpiocs; 342 hw->set_cs = s3c24xx_spi_gpiocs;
335 343
336 s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); 344 s3c2410_gpio_setpin(pdata->pin_cs, 1);
337 s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); 345 s3c2410_gpio_cfgpin(pdata->pin_cs, S3C2410_GPIO_OUTPUT);
338 } else 346 } else
339 hw->set_cs = hw->pdata->set_cs; 347 hw->set_cs = pdata->set_cs;
340 348
341 /* register our spi controller */ 349 /* register our spi controller */
342 350
@@ -415,7 +423,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev)
415#define s3c24xx_spi_resume NULL 423#define s3c24xx_spi_resume NULL
416#endif 424#endif
417 425
418MODULE_ALIAS("s3c2410_spi"); /* for platform bus hotplug */ 426MODULE_ALIAS("platform:s3c2410-spi");
419static struct platform_driver s3c24xx_spidrv = { 427static struct platform_driver s3c24xx_spidrv = {
420 .remove = __exit_p(s3c24xx_spi_remove), 428 .remove = __exit_p(s3c24xx_spi_remove),
421 .suspend = s3c24xx_spi_suspend, 429 .suspend = s3c24xx_spi_suspend,
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c
index 82ae7d7eca38..e33f6145c560 100644
--- a/drivers/spi/spi_s3c24xx_gpio.c
+++ b/drivers/spi/spi_s3c24xx_gpio.c
@@ -168,6 +168,8 @@ static int s3c2410_spigpio_remove(struct platform_device *dev)
168#define s3c2410_spigpio_suspend NULL 168#define s3c2410_spigpio_suspend NULL
169#define s3c2410_spigpio_resume NULL 169#define s3c2410_spigpio_resume NULL
170 170
171/* work with hotplug and coldplug */
172MODULE_ALIAS("platform:spi_s3c24xx_gpio");
171 173
172static struct platform_driver s3c2410_spigpio_drv = { 174static struct platform_driver s3c2410_spigpio_drv = {
173 .probe = s3c2410_spigpio_probe, 175 .probe = s3c2410_spigpio_probe,
diff --git a/drivers/spi/spi_sh_sci.c b/drivers/spi/spi_sh_sci.c
index 3dbe71b16d60..7d36720eb982 100644
--- a/drivers/spi/spi_sh_sci.c
+++ b/drivers/spi/spi_sh_sci.c
@@ -203,3 +203,4 @@ module_exit(sh_sci_spi_exit);
203MODULE_DESCRIPTION("SH SCI SPI Driver"); 203MODULE_DESCRIPTION("SH SCI SPI Driver");
204MODULE_AUTHOR("Magnus Damm <damm@opensource.se>"); 204MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
205MODULE_LICENSE("GPL"); 205MODULE_LICENSE("GPL");
206MODULE_ALIAS("platform:spi_sh_sci");
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c
index 363ac8e68821..2296f37ea3c6 100644
--- a/drivers/spi/spi_txx9.c
+++ b/drivers/spi/spi_txx9.c
@@ -450,6 +450,9 @@ static int __exit txx9spi_remove(struct platform_device *dev)
450 return 0; 450 return 0;
451} 451}
452 452
453/* work with hotplug and coldplug */
454MODULE_ALIAS("platform:spi_txx9");
455
453static struct platform_driver txx9spi_driver = { 456static struct platform_driver txx9spi_driver = {
454 .remove = __exit_p(txx9spi_remove), 457 .remove = __exit_p(txx9spi_remove),
455 .driver = { 458 .driver = {
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 5d04f520c123..cf6aef34fe25 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -408,6 +408,9 @@ static int __devexit xilinx_spi_remove(struct platform_device *dev)
408 return 0; 408 return 0;
409} 409}
410 410
411/* work with hotplug and coldplug */
412MODULE_ALIAS("platform:" XILINX_SPI_NAME);
413
411static struct platform_driver xilinx_spi_driver = { 414static struct platform_driver xilinx_spi_driver = {
412 .probe = xilinx_spi_probe, 415 .probe = xilinx_spi_probe,
413 .remove = __devexit_p(xilinx_spi_remove), 416 .remove = __devexit_p(xilinx_spi_remove),
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index 3d3dd32bf3ab..a9e7eb45b2e7 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -109,12 +109,13 @@ static void set_irq(struct ssb_device *dev, unsigned int irq)
109 clear_irq(bus, oldirq); 109 clear_irq(bus, oldirq);
110 110
111 /* assign the new one */ 111 /* assign the new one */
112 if (irq == 0) 112 if (irq == 0) {
113 ssb_write32(mdev, SSB_INTVEC, ((1 << irqflag) & ssb_read32(mdev, SSB_INTVEC))); 113 ssb_write32(mdev, SSB_INTVEC, ((1 << irqflag) | ssb_read32(mdev, SSB_INTVEC)));
114 114 } else {
115 irqflag <<= ipsflag_irq_shift[irq]; 115 irqflag <<= ipsflag_irq_shift[irq];
116 irqflag |= (ssb_read32(mdev, SSB_IPSFLAG) & ~ipsflag_irq_mask[irq]); 116 irqflag |= (ssb_read32(mdev, SSB_IPSFLAG) & ~ipsflag_irq_mask[irq]);
117 ssb_write32(mdev, SSB_IPSFLAG, irqflag); 117 ssb_write32(mdev, SSB_IPSFLAG, irqflag);
118 }
118} 119}
119 120
120static void ssb_mips_serial_init(struct ssb_mipscore *mcore) 121static void ssb_mips_serial_init(struct ssb_mipscore *mcore)
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 74b9a8aea52b..5d777f211699 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -551,7 +551,7 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
551 } else { 551 } else {
552 tmp = ssb_read32(dev, SSB_TPSFLAG); 552 tmp = ssb_read32(dev, SSB_TPSFLAG);
553 tmp &= SSB_TPSFLAG_BPFLAG; 553 tmp &= SSB_TPSFLAG_BPFLAG;
554 intvec |= tmp; 554 intvec |= (1 << tmp);
555 } 555 }
556 ssb_write32(pdev, SSB_INTVEC, intvec); 556 ssb_write32(pdev, SSB_INTVEC, intvec);
557 } 557 }
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index bedb2b4ee9d2..8003a9e55ac4 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -436,15 +436,18 @@ static int ssb_devices_register(struct ssb_bus *bus)
436#ifdef CONFIG_SSB_PCIHOST 436#ifdef CONFIG_SSB_PCIHOST
437 sdev->irq = bus->host_pci->irq; 437 sdev->irq = bus->host_pci->irq;
438 dev->parent = &bus->host_pci->dev; 438 dev->parent = &bus->host_pci->dev;
439 sdev->dma_dev = &bus->host_pci->dev;
439#endif 440#endif
440 break; 441 break;
441 case SSB_BUSTYPE_PCMCIA: 442 case SSB_BUSTYPE_PCMCIA:
442#ifdef CONFIG_SSB_PCMCIAHOST 443#ifdef CONFIG_SSB_PCMCIAHOST
443 sdev->irq = bus->host_pcmcia->irq.AssignedIRQ; 444 sdev->irq = bus->host_pcmcia->irq.AssignedIRQ;
444 dev->parent = &bus->host_pcmcia->dev; 445 dev->parent = &bus->host_pcmcia->dev;
446 sdev->dma_dev = &bus->host_pcmcia->dev;
445#endif 447#endif
446 break; 448 break;
447 case SSB_BUSTYPE_SSB: 449 case SSB_BUSTYPE_SSB:
450 sdev->dma_dev = dev;
448 break; 451 break;
449 } 452 }
450 453
@@ -1018,15 +1021,14 @@ EXPORT_SYMBOL(ssb_dma_translation);
1018 1021
1019int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask) 1022int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask)
1020{ 1023{
1021 struct device *dev = ssb_dev->dev; 1024 struct device *dma_dev = ssb_dev->dma_dev;
1022 1025
1023#ifdef CONFIG_SSB_PCIHOST 1026#ifdef CONFIG_SSB_PCIHOST
1024 if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI && 1027 if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI)
1025 !dma_supported(dev, mask)) 1028 return dma_set_mask(dma_dev, mask);
1026 return -EIO;
1027#endif 1029#endif
1028 dev->coherent_dma_mask = mask; 1030 dma_dev->coherent_dma_mask = mask;
1029 dev->dma_mask = &dev->coherent_dma_mask; 1031 dma_dev->dma_mask = &dma_dev->coherent_dma_mask;
1030 1032
1031 return 0; 1033 return 0;
1032} 1034}
@@ -1044,6 +1046,12 @@ int ssb_bus_may_powerdown(struct ssb_bus *bus)
1044 goto out; 1046 goto out;
1045 1047
1046 cc = &bus->chipco; 1048 cc = &bus->chipco;
1049
1050 if (!cc->dev)
1051 goto out;
1052 if (cc->dev->id.revision < 5)
1053 goto out;
1054
1047 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_SLOW); 1055 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_SLOW);
1048 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0); 1056 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0);
1049 if (err) 1057 if (err)
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index 8b86e53ccf7a..7f79bbf652d7 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -196,6 +196,10 @@ static struct device_attribute trip_point_attrs[] = {
196 __ATTR(trip_point_8_temp, 0444, trip_point_temp_show, NULL), 196 __ATTR(trip_point_8_temp, 0444, trip_point_temp_show, NULL),
197 __ATTR(trip_point_9_type, 0444, trip_point_type_show, NULL), 197 __ATTR(trip_point_9_type, 0444, trip_point_type_show, NULL),
198 __ATTR(trip_point_9_temp, 0444, trip_point_temp_show, NULL), 198 __ATTR(trip_point_9_temp, 0444, trip_point_temp_show, NULL),
199 __ATTR(trip_point_10_type, 0444, trip_point_type_show, NULL),
200 __ATTR(trip_point_10_temp, 0444, trip_point_temp_show, NULL),
201 __ATTR(trip_point_11_type, 0444, trip_point_type_show, NULL),
202 __ATTR(trip_point_11_temp, 0444, trip_point_temp_show, NULL),
199}; 203};
200 204
201#define TRIP_POINT_ATTR_ADD(_dev, _index, result) \ 205#define TRIP_POINT_ATTR_ADD(_dev, _index, result) \
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index a83e8b798ec9..fd15ced899d8 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1884,3 +1884,4 @@ module_exit(udc_exit_module);
1884MODULE_DESCRIPTION("AT91 udc driver"); 1884MODULE_DESCRIPTION("AT91 udc driver");
1885MODULE_AUTHOR("Thomas Rathbone, David Brownell"); 1885MODULE_AUTHOR("Thomas Rathbone, David Brownell");
1886MODULE_LICENSE("GPL"); 1886MODULE_LICENSE("GPL");
1887MODULE_ALIAS("platform:at91_udc");
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index af8b2a3a2d4a..b0db4c31d018 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -2054,6 +2054,7 @@ static struct platform_driver udc_driver = {
2054 .remove = __exit_p(usba_udc_remove), 2054 .remove = __exit_p(usba_udc_remove),
2055 .driver = { 2055 .driver = {
2056 .name = "atmel_usba_udc", 2056 .name = "atmel_usba_udc",
2057 .owner = THIS_MODULE,
2057 }, 2058 },
2058}; 2059};
2059 2060
@@ -2072,3 +2073,4 @@ module_exit(udc_exit);
2072MODULE_DESCRIPTION("Atmel USBA UDC driver"); 2073MODULE_DESCRIPTION("Atmel USBA UDC driver");
2073MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>"); 2074MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
2074MODULE_LICENSE("GPL"); 2075MODULE_LICENSE("GPL");
2076MODULE_ALIAS("platform:atmel_usba_udc");
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 63e8fa3a69e1..254012ad2b91 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -2475,3 +2475,4 @@ module_exit(udc_exit);
2475MODULE_DESCRIPTION(DRIVER_DESC); 2475MODULE_DESCRIPTION(DRIVER_DESC);
2476MODULE_AUTHOR(DRIVER_AUTHOR); 2476MODULE_AUTHOR(DRIVER_AUTHOR);
2477MODULE_LICENSE("GPL"); 2477MODULE_LICENSE("GPL");
2478MODULE_ALIAS("platform:fsl-usb2-udc");
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 37243ef7104e..078f72467671 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -2146,3 +2146,4 @@ module_exit(udc_exit);
2146MODULE_DESCRIPTION(DRIVER_DESC); 2146MODULE_DESCRIPTION(DRIVER_DESC);
2147MODULE_AUTHOR("Mikko Lahteenmaki, Bo Henriksen"); 2147MODULE_AUTHOR("Mikko Lahteenmaki, Bo Henriksen");
2148MODULE_LICENSE("GPL"); 2148MODULE_LICENSE("GPL");
2149MODULE_ALIAS("platform:lh7a40x_udc");
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 835948f0715a..ee6b35fa870f 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -35,6 +35,7 @@
35MODULE_DESCRIPTION("M66592 USB gadget driver"); 35MODULE_DESCRIPTION("M66592 USB gadget driver");
36MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
37MODULE_AUTHOR("Yoshihiro Shimoda"); 37MODULE_AUTHOR("Yoshihiro Shimoda");
38MODULE_ALIAS("platform:m66592_udc");
38 39
39#define DRIVER_VERSION "18 Oct 2007" 40#define DRIVER_VERSION "18 Oct 2007"
40 41
@@ -1671,6 +1672,7 @@ static struct platform_driver m66592_driver = {
1671 .remove = __exit_p(m66592_remove), 1672 .remove = __exit_p(m66592_remove),
1672 .driver = { 1673 .driver = {
1673 .name = (char *) udc_name, 1674 .name = (char *) udc_name,
1675 .owner = THIS_MODULE,
1674 }, 1676 },
1675}; 1677};
1676 1678
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index e6d68bda428a..ee1e9a314cd1 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -3109,4 +3109,4 @@ module_exit(udc_exit);
3109 3109
3110MODULE_DESCRIPTION(DRIVER_DESC); 3110MODULE_DESCRIPTION(DRIVER_DESC);
3111MODULE_LICENSE("GPL"); 3111MODULE_LICENSE("GPL");
3112 3112MODULE_ALIAS("platform:omap_udc");
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 096c41cc40d1..c00cd8b9d3d1 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2380,4 +2380,4 @@ module_exit(udc_exit);
2380MODULE_DESCRIPTION(DRIVER_DESC); 2380MODULE_DESCRIPTION(DRIVER_DESC);
2381MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); 2381MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell");
2382MODULE_LICENSE("GPL"); 2382MODULE_LICENSE("GPL");
2383 2383MODULE_ALIAS("platform:pxa2xx-udc");
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index aadc4204d6f9..6b1ef488043b 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -2047,3 +2047,5 @@ MODULE_AUTHOR(DRIVER_AUTHOR);
2047MODULE_DESCRIPTION(DRIVER_DESC); 2047MODULE_DESCRIPTION(DRIVER_DESC);
2048MODULE_VERSION(DRIVER_VERSION); 2048MODULE_VERSION(DRIVER_VERSION);
2049MODULE_LICENSE("GPL"); 2049MODULE_LICENSE("GPL");
2050MODULE_ALIAS("platform:s3c2410-usbgadget");
2051MODULE_ALIAS("platform:s3c2440-usbgadget");
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index d7071c855758..203a3359a648 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1684,14 +1684,18 @@ static int isp116x_resume(struct platform_device *dev)
1684 1684
1685#endif 1685#endif
1686 1686
1687/* work with hotplug and coldplug */
1688MODULE_ALIAS("platform:isp116x-hcd");
1689
1687static struct platform_driver isp116x_driver = { 1690static struct platform_driver isp116x_driver = {
1688 .probe = isp116x_probe, 1691 .probe = isp116x_probe,
1689 .remove = isp116x_remove, 1692 .remove = isp116x_remove,
1690 .suspend = isp116x_suspend, 1693 .suspend = isp116x_suspend,
1691 .resume = isp116x_resume, 1694 .resume = isp116x_resume,
1692 .driver = { 1695 .driver = {
1693 .name = (char *)hcd_name, 1696 .name = (char *)hcd_name,
1694 }, 1697 .owner = THIS_MODULE,
1698 },
1695}; 1699};
1696 1700
1697/*-----------------------------------------------------------------*/ 1701/*-----------------------------------------------------------------*/
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 126fcbdd6408..d72dc07dda01 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -355,7 +355,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
355#define ohci_hcd_at91_drv_resume NULL 355#define ohci_hcd_at91_drv_resume NULL
356#endif 356#endif
357 357
358MODULE_ALIAS("at91_ohci"); 358MODULE_ALIAS("platform:at91_ohci");
359 359
360static struct platform_driver ohci_hcd_at91_driver = { 360static struct platform_driver ohci_hcd_at91_driver = {
361 .probe = ohci_hcd_at91_drv_probe, 361 .probe = ohci_hcd_at91_drv_probe,
@@ -368,4 +368,3 @@ static struct platform_driver ohci_hcd_at91_driver = {
368 .owner = THIS_MODULE, 368 .owner = THIS_MODULE,
369 }, 369 },
370}; 370};
371
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 663a0600b6e7..f90fe0c7373f 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -345,3 +345,4 @@ static struct platform_driver ohci_hcd_au1xxx_driver = {
345 }, 345 },
346}; 346};
347 347
348MODULE_ALIAS("platform:au1xxx-ohci");
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index a68ce9d3c525..156e93a9d0df 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -211,6 +211,8 @@ static struct platform_driver ohci_hcd_ep93xx_driver = {
211#endif 211#endif
212 .driver = { 212 .driver = {
213 .name = "ep93xx-ohci", 213 .name = "ep93xx-ohci",
214 .owner = THIS_MODULE,
214 }, 215 },
215}; 216};
216 217
218MODULE_ALIAS("platform:ep93xx-ohci");
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 4a043abd85ea..13c12ed22252 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -251,3 +251,4 @@ static struct platform_driver ohci_hcd_lh7a404_driver = {
251 }, 251 },
252}; 252};
253 253
254MODULE_ALIAS("platform:lh7a404-ohci");
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 74e1f4be10bb..7bfca1ed1b58 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -544,3 +544,4 @@ static struct platform_driver ohci_hcd_omap_driver = {
544 }, 544 },
545}; 545};
546 546
547MODULE_ALIAS("platform:ohci");
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 6c52c66b659f..28b458f20cc3 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -456,9 +456,13 @@ static int usb_hcd_pnx4008_remove(struct platform_device *pdev)
456 return 0; 456 return 0;
457} 457}
458 458
459/* work with hotplug and coldplug */
460MODULE_ALIAS("platform:usb-ohci");
461
459static struct platform_driver usb_hcd_pnx4008_driver = { 462static struct platform_driver usb_hcd_pnx4008_driver = {
460 .driver = { 463 .driver = {
461 .name = "usb-ohci", 464 .name = "usb-ohci",
465 .owner = THIS_MODULE,
462 }, 466 },
463 .probe = usb_hcd_pnx4008_probe, 467 .probe = usb_hcd_pnx4008_probe,
464 .remove = usb_hcd_pnx4008_remove, 468 .remove = usb_hcd_pnx4008_remove,
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
index 85fdfd2a7ad0..605d59cba28e 100644
--- a/drivers/usb/host/ohci-pnx8550.c
+++ b/drivers/usb/host/ohci-pnx8550.c
@@ -230,11 +230,12 @@ static int ohci_hcd_pnx8550_drv_remove(struct platform_device *pdev)
230 return 0; 230 return 0;
231} 231}
232 232
233MODULE_ALIAS("pnx8550-ohci"); 233MODULE_ALIAS("platform:pnx8550-ohci");
234 234
235static struct platform_driver ohci_hcd_pnx8550_driver = { 235static struct platform_driver ohci_hcd_pnx8550_driver = {
236 .driver = { 236 .driver = {
237 .name = "pnx8550-ohci", 237 .name = "pnx8550-ohci",
238 .owner = THIS_MODULE,
238 }, 239 },
239 .probe = ohci_hcd_pnx8550_drv_probe, 240 .probe = ohci_hcd_pnx8550_drv_probe,
240 .remove = ohci_hcd_pnx8550_drv_remove, 241 .remove = ohci_hcd_pnx8550_drv_remove,
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index f95be1896b0d..523c30125577 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -213,3 +213,4 @@ static struct platform_driver ohci_hcd_ppc_soc_driver = {
213 }, 213 },
214}; 214};
215 215
216MODULE_ALIAS("platform:ppc-soc-ohci");
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index ff9a79843471..8ad9b3b604b5 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -364,6 +364,8 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev)
364} 364}
365#endif 365#endif
366 366
367/* work with hotplug and coldplug */
368MODULE_ALIAS("platform:pxa27x-ohci");
367 369
368static struct platform_driver ohci_hcd_pxa27x_driver = { 370static struct platform_driver ohci_hcd_pxa27x_driver = {
369 .probe = ohci_hcd_pxa27x_drv_probe, 371 .probe = ohci_hcd_pxa27x_drv_probe,
@@ -375,6 +377,7 @@ static struct platform_driver ohci_hcd_pxa27x_driver = {
375#endif 377#endif
376 .driver = { 378 .driver = {
377 .name = "pxa27x-ohci", 379 .name = "pxa27x-ohci",
380 .owner = THIS_MODULE,
378 }, 381 },
379}; 382};
380 383
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 44b79e8a6e25..ead4772f0f27 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -501,3 +501,4 @@ static struct platform_driver ohci_hcd_s3c2410_driver = {
501 }, 501 },
502}; 502};
503 503
504MODULE_ALIAS("platform:s3c2410-ohci");
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
index 5309ac039e15..e7ee607278fe 100644
--- a/drivers/usb/host/ohci-sh.c
+++ b/drivers/usb/host/ohci-sh.c
@@ -141,3 +141,4 @@ static struct platform_driver ohci_hcd_sh_driver = {
141 }, 141 },
142}; 142};
143 143
144MODULE_ALIAS("platform:sh_ohci");
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index a97070142869..4ea92762fb28 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -262,3 +262,4 @@ static struct platform_driver ohci_hcd_sm501_driver = {
262 .name = "sm501-usb", 262 .name = "sm501-usb",
263 }, 263 },
264}; 264};
265MODULE_ALIAS("platform:sm501-usb");
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 0ce2fc5e396b..9f80e5285575 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -44,6 +44,7 @@
44MODULE_DESCRIPTION("R8A66597 USB Host Controller Driver"); 44MODULE_DESCRIPTION("R8A66597 USB Host Controller Driver");
45MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
46MODULE_AUTHOR("Yoshihiro Shimoda"); 46MODULE_AUTHOR("Yoshihiro Shimoda");
47MODULE_ALIAS("platform:r8a66597_hcd");
47 48
48#define DRIVER_VERSION "29 May 2007" 49#define DRIVER_VERSION "29 May 2007"
49 50
@@ -2219,6 +2220,7 @@ static struct platform_driver r8a66597_driver = {
2219 .resume = r8a66597_resume, 2220 .resume = r8a66597_resume,
2220 .driver = { 2221 .driver = {
2221 .name = (char *) hcd_name, 2222 .name = (char *) hcd_name,
2223 .owner = THIS_MODULE,
2222 }, 2224 },
2223}; 2225};
2224 2226
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 59be276ccd9d..629bca0ebe8f 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -58,6 +58,7 @@
58 58
59MODULE_DESCRIPTION("SL811HS USB Host Controller Driver"); 59MODULE_DESCRIPTION("SL811HS USB Host Controller Driver");
60MODULE_LICENSE("GPL"); 60MODULE_LICENSE("GPL");
61MODULE_ALIAS("platform:sl811-hcd");
61 62
62#define DRIVER_VERSION "19 May 2005" 63#define DRIVER_VERSION "19 May 2005"
63 64
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 3033d6945202..8e117a795e93 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -3316,3 +3316,4 @@ static void __exit u132_hcd_exit(void)
3316 3316
3317module_exit(u132_hcd_exit); 3317module_exit(u132_hcd_exit);
3318MODULE_LICENSE("GPL"); 3318MODULE_LICENSE("GPL");
3319MODULE_ALIAS("platform:u132_hcd");
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index a396fbbdc9c2..d101025a4c63 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -109,6 +109,22 @@ static int option_send_setup(struct usb_serial_port *port);
109#define HUAWEI_PRODUCT_E600 0x1001 109#define HUAWEI_PRODUCT_E600 0x1001
110#define HUAWEI_PRODUCT_E220 0x1003 110#define HUAWEI_PRODUCT_E220 0x1003
111#define HUAWEI_PRODUCT_E220BIS 0x1004 111#define HUAWEI_PRODUCT_E220BIS 0x1004
112#define HUAWEI_PRODUCT_E1401 0x1401
113#define HUAWEI_PRODUCT_E1403 0x1403
114#define HUAWEI_PRODUCT_E1405 0x1405
115#define HUAWEI_PRODUCT_E1406 0x1406
116#define HUAWEI_PRODUCT_E1408 0x1408
117#define HUAWEI_PRODUCT_E1409 0x1409
118#define HUAWEI_PRODUCT_E1410 0x1410
119#define HUAWEI_PRODUCT_E1411 0x1411
120#define HUAWEI_PRODUCT_E1412 0x1412
121#define HUAWEI_PRODUCT_E1413 0x1413
122#define HUAWEI_PRODUCT_E1414 0x1414
123#define HUAWEI_PRODUCT_E1415 0x1415
124#define HUAWEI_PRODUCT_E1416 0x1416
125#define HUAWEI_PRODUCT_E1417 0x1417
126#define HUAWEI_PRODUCT_E1418 0x1418
127#define HUAWEI_PRODUCT_E1419 0x1419
112 128
113#define NOVATELWIRELESS_VENDOR_ID 0x1410 129#define NOVATELWIRELESS_VENDOR_ID 0x1410
114 130
@@ -129,6 +145,7 @@ static int option_send_setup(struct usb_serial_port *port);
129#define NOVATELWIRELESS_PRODUCT_EV620 0x2100 145#define NOVATELWIRELESS_PRODUCT_EV620 0x2100
130#define NOVATELWIRELESS_PRODUCT_ES720 0x2110 146#define NOVATELWIRELESS_PRODUCT_ES720 0x2110
131#define NOVATELWIRELESS_PRODUCT_E725 0x2120 147#define NOVATELWIRELESS_PRODUCT_E725 0x2120
148#define NOVATELWIRELESS_PRODUCT_ES620 0x2130
132#define NOVATELWIRELESS_PRODUCT_EU730 0x2400 149#define NOVATELWIRELESS_PRODUCT_EU730 0x2400
133#define NOVATELWIRELESS_PRODUCT_EU740 0x2410 150#define NOVATELWIRELESS_PRODUCT_EU740 0x2410
134#define NOVATELWIRELESS_PRODUCT_EU870D 0x2420 151#define NOVATELWIRELESS_PRODUCT_EU870D 0x2420
@@ -137,6 +154,8 @@ static int option_send_setup(struct usb_serial_port *port);
137#define NOVATELWIRELESS_PRODUCT_MC727 0x4100 154#define NOVATELWIRELESS_PRODUCT_MC727 0x4100
138#define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 155#define NOVATELWIRELESS_PRODUCT_MC950D 0x4400
139 156
157#define NOVATELWIRELESS_PRODUCT_U727 0x5010
158
140/* FUTURE NOVATEL PRODUCTS */ 159/* FUTURE NOVATEL PRODUCTS */
141#define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000 160#define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000
142#define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000 161#define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000
@@ -147,6 +166,12 @@ static int option_send_setup(struct usb_serial_port *port);
147#define NOVATELWIRELESS_PRODUCT_EMBEDDED_2 0x8001 166#define NOVATELWIRELESS_PRODUCT_EMBEDDED_2 0x8001
148#define NOVATELWIRELESS_PRODUCT_GLOBAL_2 0x9001 167#define NOVATELWIRELESS_PRODUCT_GLOBAL_2 0x9001
149 168
169/* AMOI PRODUCTS */
170#define AMOI_VENDOR_ID 0x1614
171#define AMOI_PRODUCT_H01 0x0800
172#define AMOI_PRODUCT_H01A 0x7002
173#define AMOI_PRODUCT_H02 0x0802
174
150#define DELL_VENDOR_ID 0x413C 175#define DELL_VENDOR_ID 0x413C
151 176
152#define KYOCERA_VENDOR_ID 0x0c88 177#define KYOCERA_VENDOR_ID 0x0c88
@@ -163,8 +188,13 @@ static int option_send_setup(struct usb_serial_port *port);
163#define BANDRICH_PRODUCT_C100_1 0x1002 188#define BANDRICH_PRODUCT_C100_1 0x1002
164#define BANDRICH_PRODUCT_C100_2 0x1003 189#define BANDRICH_PRODUCT_C100_2 0x1003
165 190
191#define AMOI_VENDOR_ID 0x1614
192#define AMOI_PRODUCT_9508 0x0800
193
166#define QUALCOMM_VENDOR_ID 0x05C6 194#define QUALCOMM_VENDOR_ID 0x05C6
167 195
196#define MAXON_VENDOR_ID 0x16d8
197
168static struct usb_device_id option_ids[] = { 198static struct usb_device_id option_ids[] = {
169 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 199 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
170 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 200 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -204,6 +234,23 @@ static struct usb_device_id option_ids[] = {
204 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 234 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
205 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, 235 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
206 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, 236 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
237 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401) },
238 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403) },
239 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405) },
240 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406) },
241 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408) },
242 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409) },
243 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410) },
244 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411) },
245 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412) },
246 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413) },
247 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414) },
248 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415) },
249 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416) },
250 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417) },
251 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418) },
252 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419) },
253 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
207 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */ 254 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */
208 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */ 255 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, /* Novatel Merlin V620/S620 */
209 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, /* Novatel Merlin EX720/V740/X720 */ 256 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, /* Novatel Merlin EX720/V740/X720 */
@@ -216,13 +263,13 @@ static struct usb_device_id option_ids[] = {
216 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, /* Novatel EV620/ES620 CDMA/EV-DO */ 263 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EV620) }, /* Novatel EV620/ES620 CDMA/EV-DO */
217 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, /* Novatel ES620/ES720/U720/USB720 */ 264 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES720) }, /* Novatel ES620/ES720/U720/USB720 */
218 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, /* Novatel E725/E726 */ 265 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E725) }, /* Novatel E725/E726 */
219 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ 266 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_ES620) }, /* Novatel Merlin ES620 SM Bus */
220 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, /* Novatel EU730 and Vodafone EU740 */ 267 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU730) }, /* Novatel EU730 and Vodafone EU740 */
221 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, /* Novatel non-Vodafone EU740 */ 268 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU740) }, /* Novatel non-Vodafone EU740 */
222 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */ 269 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */
223 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */ 270 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */
224 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ 271 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */
225 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x5010) }, /* Novatel U727 */ 272 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel U727 */
226 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */ 273 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */
227 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */ 274 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */
228 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */ 275 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */
@@ -232,6 +279,10 @@ static struct usb_device_id option_ids[] = {
232 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */ 279 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */
233 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */ 280 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */
234 281
282 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
283 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
284 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) },
285
235 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ 286 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
236 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 287 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
237 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 288 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
@@ -249,6 +300,7 @@ static struct usb_device_id option_ids[] = {
249 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, 300 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
250 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, 301 { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
251 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ 302 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
303 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
252 { } /* Terminating entry */ 304 { } /* Terminating entry */
253}; 305};
254MODULE_DEVICE_TABLE(usb, option_ids); 306MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 3ce98e8d7bce..2138ba8aeb69 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -854,6 +854,7 @@ int usb_serial_probe(struct usb_interface *interface,
854 serial->num_interrupt_in = num_interrupt_in; 854 serial->num_interrupt_in = num_interrupt_in;
855 serial->num_interrupt_out = num_interrupt_out; 855 serial->num_interrupt_out = num_interrupt_out;
856 856
857#if 0
857 /* check that the device meets the driver's requirements */ 858 /* check that the device meets the driver's requirements */
858 if ((type->num_interrupt_in != NUM_DONT_CARE && 859 if ((type->num_interrupt_in != NUM_DONT_CARE &&
859 type->num_interrupt_in != num_interrupt_in) 860 type->num_interrupt_in != num_interrupt_in)
@@ -867,6 +868,7 @@ int usb_serial_probe(struct usb_interface *interface,
867 kfree(serial); 868 kfree(serial);
868 return -EIO; 869 return -EIO;
869 } 870 }
871#endif
870 872
871 /* found all that we need */ 873 /* found all that we need */
872 dev_info(&interface->dev, "%s converter detected\n", 874 dev_info(&interface->dev, "%s converter detected\n",
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index e5219a56947c..91252075e6e1 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1530,16 +1530,104 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100,
1530 US_SC_DEVICE, US_PR_DEVICE, NULL, 1530 US_SC_DEVICE, US_PR_DEVICE, NULL,
1531 US_FL_IGNORE_RESIDUE ), 1531 US_FL_IGNORE_RESIDUE ),
1532 1532
1533/* Reported by fangxiaozhi <fangxiaozhi60675@huawei.com> 1533/* Reported by fangxiaozhi <huananhu@huawei.com>
1534 * and by linlei <linlei83@huawei.com> 1534 * This brings the HUAWEI data card devices into multi-port mode
1535 * Patch reworked by Johann Wilhelm <johann.wilhelm@student.tugraz.at>
1536 * This brings the HUAWEI E220 devices into multi-port mode
1537 */ 1535 */
1536UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000,
1537 "HUAWEI MOBILE",
1538 "Mass Storage",
1539 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1540 0),
1538UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000, 1541UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
1539 "HUAWEI MOBILE", 1542 "HUAWEI MOBILE",
1540 "Mass Storage", 1543 "Mass Storage",
1541 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init, 1544 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1542 0), 1545 0),
1546UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000,
1547 "HUAWEI MOBILE",
1548 "Mass Storage",
1549 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1550 0),
1551UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000,
1552 "HUAWEI MOBILE",
1553 "Mass Storage",
1554 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1555 0),
1556UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000,
1557 "HUAWEI MOBILE",
1558 "Mass Storage",
1559 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1560 0),
1561UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000,
1562 "HUAWEI MOBILE",
1563 "Mass Storage",
1564 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1565 0),
1566UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000,
1567 "HUAWEI MOBILE",
1568 "Mass Storage",
1569 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1570 0),
1571UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000,
1572 "HUAWEI MOBILE",
1573 "Mass Storage",
1574 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1575 0),
1576UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000,
1577 "HUAWEI MOBILE",
1578 "Mass Storage",
1579 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1580 0),
1581UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000,
1582 "HUAWEI MOBILE",
1583 "Mass Storage",
1584 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1585 0),
1586UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000,
1587 "HUAWEI MOBILE",
1588 "Mass Storage",
1589 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1590 0),
1591UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000,
1592 "HUAWEI MOBILE",
1593 "Mass Storage",
1594 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1595 0),
1596UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000,
1597 "HUAWEI MOBILE",
1598 "Mass Storage",
1599 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1600 0),
1601UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000,
1602 "HUAWEI MOBILE",
1603 "Mass Storage",
1604 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1605 0),
1606UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000,
1607 "HUAWEI MOBILE",
1608 "Mass Storage",
1609 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1610 0),
1611UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000,
1612 "HUAWEI MOBILE",
1613 "Mass Storage",
1614 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1615 0),
1616UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000,
1617 "HUAWEI MOBILE",
1618 "Mass Storage",
1619 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1620 0),
1621UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000,
1622 "HUAWEI MOBILE",
1623 "Mass Storage",
1624 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1625 0),
1626UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000,
1627 "HUAWEI MOBILE",
1628 "Mass Storage",
1629 US_SC_DEVICE, US_PR_DEVICE, usb_stor_huawei_e220_init,
1630 0),
1543 1631
1544/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ 1632/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
1545UNUSUAL_DEV( 0x132b, 0x000b, 0x0001, 0x0001, 1633UNUSUAL_DEV( 0x132b, 0x000b, 0x0001, 0x0001,
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 1194f5e060ea..01072f4b3e8f 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1521,6 +1521,7 @@ module_init(fbmem_init);
1521static void __exit 1521static void __exit
1522fbmem_exit(void) 1522fbmem_exit(void)
1523{ 1523{
1524 remove_proc_entry("fb", NULL);
1524 class_destroy(fb_class); 1525 class_destroy(fb_class);
1525 unregister_chrdev(FB_MAJOR, "fb"); 1526 unregister_chrdev(FB_MAJOR, "fb");
1526} 1527}
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index fb5ed6478f78..ae0fca5e8749 100644
--- a/drivers/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
@@ -418,6 +418,9 @@ static int at32_wdt_resume(struct platform_device *pdev)
418#define at32_wdt_resume NULL 418#define at32_wdt_resume NULL
419#endif 419#endif
420 420
421/* work with hotplug and coldplug */
422MODULE_ALIAS("platform:at32_wdt");
423
421static struct platform_driver at32_wdt_driver = { 424static struct platform_driver at32_wdt_driver = {
422 .remove = __exit_p(at32_wdt_remove), 425 .remove = __exit_p(at32_wdt_remove),
423 .suspend = at32_wdt_suspend, 426 .suspend = at32_wdt_suspend,
diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
index a684b1e87372..9ff9a9565320 100644
--- a/drivers/watchdog/at91rm9200_wdt.c
+++ b/drivers/watchdog/at91rm9200_wdt.c
@@ -286,3 +286,4 @@ MODULE_AUTHOR("Andrew Victor");
286MODULE_DESCRIPTION("Watchdog driver for Atmel AT91RM9200"); 286MODULE_DESCRIPTION("Watchdog driver for Atmel AT91RM9200");
287MODULE_LICENSE("GPL"); 287MODULE_LICENSE("GPL");
288MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 288MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
289MODULE_ALIAS("platform:at91_wdt");
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index a61cbd48dc07..1782c79eff06 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -248,6 +248,7 @@ static int davinci_wdt_remove(struct platform_device *pdev)
248static struct platform_driver platform_wdt_driver = { 248static struct platform_driver platform_wdt_driver = {
249 .driver = { 249 .driver = {
250 .name = "watchdog", 250 .name = "watchdog",
251 .owner = THIS_MODULE,
251 }, 252 },
252 .probe = davinci_wdt_probe, 253 .probe = davinci_wdt_probe,
253 .remove = davinci_wdt_remove, 254 .remove = davinci_wdt_remove,
@@ -277,3 +278,4 @@ MODULE_PARM_DESC(heartbeat,
277 278
278MODULE_LICENSE("GPL"); 279MODULE_LICENSE("GPL");
279MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 280MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
281MODULE_ALIAS("platform:watchdog");
diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index e3a29c302309..df5a6b811ccd 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -306,3 +306,4 @@ MODULE_AUTHOR("Andrew Victor");
306MODULE_DESCRIPTION("Watchdog driver for KS8695"); 306MODULE_DESCRIPTION("Watchdog driver for KS8695");
307MODULE_LICENSE("GPL"); 307MODULE_LICENSE("GPL");
308MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 308MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
309MODULE_ALIAS("platform:ks8695_wdt");
diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index 6369f569517f..b16c5cd972eb 100644
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
@@ -206,6 +206,7 @@ static struct platform_driver mpc83xx_wdt_driver = {
206 .remove = __devexit_p(mpc83xx_wdt_remove), 206 .remove = __devexit_p(mpc83xx_wdt_remove),
207 .driver = { 207 .driver = {
208 .name = "mpc83xx_wdt", 208 .name = "mpc83xx_wdt",
209 .owner = THIS_MODULE,
209 }, 210 },
210}; 211};
211 212
@@ -226,3 +227,4 @@ MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
226MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor"); 227MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor");
227MODULE_LICENSE("GPL"); 228MODULE_LICENSE("GPL");
228MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 229MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
230MODULE_ALIAS("platform:mpc83xx_wdt");
diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 0d2b27735419..009573b81496 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -392,6 +392,9 @@ static int __devexit mpcore_wdt_remove(struct platform_device *dev)
392 return 0; 392 return 0;
393} 393}
394 394
395/* work with hotplug and coldplug */
396MODULE_ALIAS("platform:mpcore_wdt");
397
395static struct platform_driver mpcore_wdt_driver = { 398static struct platform_driver mpcore_wdt_driver = {
396 .probe = mpcore_wdt_probe, 399 .probe = mpcore_wdt_probe,
397 .remove = __devexit_p(mpcore_wdt_remove), 400 .remove = __devexit_p(mpcore_wdt_remove),
diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index 10b89f2703bd..a8e67383784e 100644
--- a/drivers/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
@@ -243,6 +243,7 @@ static struct platform_driver mtx1_wdt = {
243 .probe = mtx1_wdt_probe, 243 .probe = mtx1_wdt_probe,
244 .remove = mtx1_wdt_remove, 244 .remove = mtx1_wdt_remove,
245 .driver.name = "mtx1-wdt", 245 .driver.name = "mtx1-wdt",
246 .driver.owner = THIS_MODULE,
246}; 247};
247 248
248static int __init mtx1_wdt_init(void) 249static int __init mtx1_wdt_init(void)
@@ -262,3 +263,4 @@ MODULE_AUTHOR("Michael Stickel, Florian Fainelli");
262MODULE_DESCRIPTION("Driver for the MTX-1 watchdog"); 263MODULE_DESCRIPTION("Driver for the MTX-1 watchdog");
263MODULE_LICENSE("GPL"); 264MODULE_LICENSE("GPL");
264MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 265MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
266MODULE_ALIAS("platform:mtx1-wdt");
diff --git a/drivers/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c
index 0365c317f7e1..b59ca3273967 100644
--- a/drivers/watchdog/mv64x60_wdt.c
+++ b/drivers/watchdog/mv64x60_wdt.c
@@ -324,3 +324,4 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
324MODULE_DESCRIPTION("MV64x60 watchdog driver"); 324MODULE_DESCRIPTION("MV64x60 watchdog driver");
325MODULE_LICENSE("GPL"); 325MODULE_LICENSE("GPL");
326MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 326MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
327MODULE_ALIAS("platform:" MV64x60_WDT_NAME);
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 635ca454f56b..74bc39aa1ce8 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -387,3 +387,4 @@ module_exit(omap_wdt_exit);
387MODULE_AUTHOR("George G. Davis"); 387MODULE_AUTHOR("George G. Davis");
388MODULE_LICENSE("GPL"); 388MODULE_LICENSE("GPL");
389MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 389MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
390MODULE_ALIAS("platform:omap_wdt");
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index b04aa096a10a..6b8483d3c783 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -321,6 +321,7 @@ static int pnx4008_wdt_remove(struct platform_device *pdev)
321static struct platform_driver platform_wdt_driver = { 321static struct platform_driver platform_wdt_driver = {
322 .driver = { 322 .driver = {
323 .name = "watchdog", 323 .name = "watchdog",
324 .owner = THIS_MODULE,
324 }, 325 },
325 .probe = pnx4008_wdt_probe, 326 .probe = pnx4008_wdt_probe,
326 .remove = pnx4008_wdt_remove, 327 .remove = pnx4008_wdt_remove,
@@ -354,3 +355,4 @@ MODULE_PARM_DESC(nowayout,
354 355
355MODULE_LICENSE("GPL"); 356MODULE_LICENSE("GPL");
356MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 357MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
358MODULE_ALIAS("platform:watchdog");
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 7645e8812156..98532c0e0689 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -561,3 +561,4 @@ MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, "
561MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver"); 561MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver");
562MODULE_LICENSE("GPL"); 562MODULE_LICENSE("GPL");
563MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 563MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
564MODULE_ALIAS("platform:s3c2410-wdt");
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c
index 328b3c7211ef..57cefef27ce3 100644
--- a/drivers/watchdog/txx9wdt.c
+++ b/drivers/watchdog/txx9wdt.c
@@ -274,3 +274,4 @@ module_exit(watchdog_exit);
274MODULE_DESCRIPTION("TXx9 Watchdog Driver"); 274MODULE_DESCRIPTION("TXx9 Watchdog Driver");
275MODULE_LICENSE("GPL"); 275MODULE_LICENSE("GPL");
276MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 276MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
277MODULE_ALIAS("platform:txx9wdt");
diff --git a/fs/Kconfig b/fs/Kconfig
index d7312825592b..c509123bea49 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1744,10 +1744,10 @@ config ROOT_NFS
1744 If you want your Linux box to mount its whole root file system (the 1744 If you want your Linux box to mount its whole root file system (the
1745 one containing the directory /) from some other computer over the 1745 one containing the directory /) from some other computer over the
1746 net via NFS (presumably because your box doesn't have a hard disk), 1746 net via NFS (presumably because your box doesn't have a hard disk),
1747 say Y. Read <file:Documentation/nfsroot.txt> for details. It is 1747 say Y. Read <file:Documentation/filesystems/nfsroot.txt> for
1748 likely that in this case, you also want to say Y to "Kernel level IP 1748 details. It is likely that in this case, you also want to say Y to
1749 autoconfiguration" so that your box can discover its network address 1749 "Kernel level IP autoconfiguration" so that your box can discover
1750 at boot time. 1750 its network address at boot time.
1751 1751
1752 Most people say N here. 1752 Most people say N here.
1753 1753
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 0f60f6b35769..2d3e5d4fb9f7 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -22,7 +22,7 @@ MODULE_LICENSE("GPL");
22 22
23unsigned afs_debug; 23unsigned afs_debug;
24module_param_named(debug, afs_debug, uint, S_IWUSR | S_IRUGO); 24module_param_named(debug, afs_debug, uint, S_IWUSR | S_IRUGO);
25MODULE_PARM_DESC(afs_debug, "AFS debugging mask"); 25MODULE_PARM_DESC(debug, "AFS debugging mask");
26 26
27static char *rootcell; 27static char *rootcell;
28 28
diff --git a/fs/aio.c b/fs/aio.c
index 6af921940622..228368610dfa 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -936,14 +936,6 @@ int aio_complete(struct kiocb *iocb, long res, long res2)
936 return 1; 936 return 1;
937 } 937 }
938 938
939 /*
940 * Check if the user asked us to deliver the result through an
941 * eventfd. The eventfd_signal() function is safe to be called
942 * from IRQ context.
943 */
944 if (!IS_ERR(iocb->ki_eventfd))
945 eventfd_signal(iocb->ki_eventfd, 1);
946
947 info = &ctx->ring_info; 939 info = &ctx->ring_info;
948 940
949 /* add a completion event to the ring buffer. 941 /* add a completion event to the ring buffer.
@@ -992,6 +984,15 @@ int aio_complete(struct kiocb *iocb, long res, long res2)
992 kunmap_atomic(ring, KM_IRQ1); 984 kunmap_atomic(ring, KM_IRQ1);
993 985
994 pr_debug("added to ring %p at [%lu]\n", iocb, tail); 986 pr_debug("added to ring %p at [%lu]\n", iocb, tail);
987
988 /*
989 * Check if the user asked us to deliver the result through an
990 * eventfd. The eventfd_signal() function is safe to be called
991 * from IRQ context.
992 */
993 if (!IS_ERR(iocb->ki_eventfd))
994 eventfd_signal(iocb->ki_eventfd, 1);
995
995put_rq: 996put_rq:
996 /* everything turned out well, dispose of the aiocb. */ 997 /* everything turned out well, dispose of the aiocb. */
997 ret = __aio_put_req(ctx, iocb); 998 ret = __aio_put_req(ctx, iocb);
@@ -1790,6 +1791,7 @@ asmlinkage long sys_io_getevents(aio_context_t ctx_id,
1790 put_ioctx(ioctx); 1791 put_ioctx(ioctx);
1791 } 1792 }
1792 1793
1794 asmlinkage_protect(5, ret, ctx_id, min_nr, nr, events, timeout);
1793 return ret; 1795 return ret;
1794} 1796}
1795 1797
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 3e8683dbb13f..a99d46f3b26e 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -835,7 +835,7 @@ ext2_xattr_cache_insert(struct buffer_head *bh)
835 struct mb_cache_entry *ce; 835 struct mb_cache_entry *ce;
836 int error; 836 int error;
837 837
838 ce = mb_cache_entry_alloc(ext2_xattr_cache); 838 ce = mb_cache_entry_alloc(ext2_xattr_cache, GFP_NOFS);
839 if (!ce) 839 if (!ce)
840 return -ENOMEM; 840 return -ENOMEM;
841 error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash); 841 error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash);
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index a6ea4d6a8bb2..42856541e9a5 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1126,7 +1126,7 @@ ext3_xattr_cache_insert(struct buffer_head *bh)
1126 struct mb_cache_entry *ce; 1126 struct mb_cache_entry *ce;
1127 int error; 1127 int error;
1128 1128
1129 ce = mb_cache_entry_alloc(ext3_xattr_cache); 1129 ce = mb_cache_entry_alloc(ext3_xattr_cache, GFP_NOFS);
1130 if (!ce) { 1130 if (!ce) {
1131 ea_bdebug(bh, "out of memory"); 1131 ea_bdebug(bh, "out of memory");
1132 return; 1132 return;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index d7962139c010..e9054c1c7d93 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1386,7 +1386,7 @@ ext4_xattr_cache_insert(struct buffer_head *bh)
1386 struct mb_cache_entry *ce; 1386 struct mb_cache_entry *ce;
1387 int error; 1387 int error;
1388 1388
1389 ce = mb_cache_entry_alloc(ext4_xattr_cache); 1389 ce = mb_cache_entry_alloc(ext4_xattr_cache, GFP_NOFS);
1390 if (!ce) { 1390 if (!ce) {
1391 ea_bdebug(bh, "out of memory"); 1391 ea_bdebug(bh, "out of memory");
1392 return; 1392 return;
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 29683645fa0a..5f4023678251 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -340,16 +340,23 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
340 340
341 if (inode->i_nlink > 0) 341 if (inode->i_nlink > 0)
342 drop_nlink(inode); 342 drop_nlink(inode);
343 hfsplus_delete_inode(inode); 343 if (inode->i_ino == cnid)
344 if (inode->i_ino != cnid && !inode->i_nlink) { 344 clear_nlink(inode);
345 if (!atomic_read(&HFSPLUS_I(inode).opencnt)) { 345 if (!inode->i_nlink) {
346 res = hfsplus_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL); 346 if (inode->i_ino != cnid) {
347 if (!res) 347 HFSPLUS_SB(sb).file_count--;
348 hfsplus_delete_inode(inode); 348 if (!atomic_read(&HFSPLUS_I(inode).opencnt)) {
349 res = hfsplus_delete_cat(inode->i_ino,
350 HFSPLUS_SB(sb).hidden_dir,
351 NULL);
352 if (!res)
353 hfsplus_delete_inode(inode);
354 } else
355 inode->i_flags |= S_DEAD;
349 } else 356 } else
350 inode->i_flags |= S_DEAD; 357 hfsplus_delete_inode(inode);
351 } else 358 } else
352 clear_nlink(inode); 359 HFSPLUS_SB(sb).file_count--;
353 inode->i_ctime = CURRENT_TIME_SEC; 360 inode->i_ctime = CURRENT_TIME_SEC;
354 mark_inode_dirty(inode); 361 mark_inode_dirty(inode);
355 362
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index f9c5dd6f4b64..dcc2734e0b5d 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -129,7 +129,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
129 struct inode *inode = mapping->host; 129 struct inode *inode = mapping->host;
130 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); 130 struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
131 pgoff_t index = pos >> PAGE_CACHE_SHIFT; 131 pgoff_t index = pos >> PAGE_CACHE_SHIFT;
132 uint32_t pageofs = pos & (PAGE_CACHE_SIZE - 1); 132 uint32_t pageofs = index << PAGE_CACHE_SHIFT;
133 int ret = 0; 133 int ret = 0;
134 134
135 pg = __grab_cache_page(mapping, index); 135 pg = __grab_cache_page(mapping, index);
diff --git a/fs/locks.c b/fs/locks.c
index d83fab1b77b5..43c0af21a0c5 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1801,17 +1801,21 @@ again:
1801 if (error) 1801 if (error)
1802 goto out; 1802 goto out;
1803 1803
1804 for (;;) { 1804 if (filp->f_op && filp->f_op->lock != NULL)
1805 error = vfs_lock_file(filp, cmd, file_lock, NULL); 1805 error = filp->f_op->lock(filp, cmd, file_lock);
1806 if (error != -EAGAIN || cmd == F_SETLK) 1806 else {
1807 break; 1807 for (;;) {
1808 error = wait_event_interruptible(file_lock->fl_wait, 1808 error = posix_lock_file(filp, file_lock, NULL);
1809 !file_lock->fl_next); 1809 if (error != -EAGAIN || cmd == F_SETLK)
1810 if (!error) 1810 break;
1811 continue; 1811 error = wait_event_interruptible(file_lock->fl_wait,
1812 !file_lock->fl_next);
1813 if (!error)
1814 continue;
1812 1815
1813 locks_delete_block(file_lock); 1816 locks_delete_block(file_lock);
1814 break; 1817 break;
1818 }
1815 } 1819 }
1816 1820
1817 /* 1821 /*
@@ -1925,17 +1929,21 @@ again:
1925 if (error) 1929 if (error)
1926 goto out; 1930 goto out;
1927 1931
1928 for (;;) { 1932 if (filp->f_op && filp->f_op->lock != NULL)
1929 error = vfs_lock_file(filp, cmd, file_lock, NULL); 1933 error = filp->f_op->lock(filp, cmd, file_lock);
1930 if (error != -EAGAIN || cmd == F_SETLK64) 1934 else {
1931 break; 1935 for (;;) {
1932 error = wait_event_interruptible(file_lock->fl_wait, 1936 error = posix_lock_file(filp, file_lock, NULL);
1933 !file_lock->fl_next); 1937 if (error != -EAGAIN || cmd == F_SETLK64)
1934 if (!error) 1938 break;
1935 continue; 1939 error = wait_event_interruptible(file_lock->fl_wait,
1940 !file_lock->fl_next);
1941 if (!error)
1942 continue;
1936 1943
1937 locks_delete_block(file_lock); 1944 locks_delete_block(file_lock);
1938 break; 1945 break;
1946 }
1939 } 1947 }
1940 1948
1941 /* 1949 /*
diff --git a/fs/mbcache.c b/fs/mbcache.c
index eb31b73e7d69..ec88ff3d04a9 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -399,11 +399,11 @@ mb_cache_destroy(struct mb_cache *cache)
399 * if no more memory was available. 399 * if no more memory was available.
400 */ 400 */
401struct mb_cache_entry * 401struct mb_cache_entry *
402mb_cache_entry_alloc(struct mb_cache *cache) 402mb_cache_entry_alloc(struct mb_cache *cache, gfp_t gfp_flags)
403{ 403{
404 struct mb_cache_entry *ce; 404 struct mb_cache_entry *ce;
405 405
406 ce = kmem_cache_alloc(cache->c_entry_cache, GFP_KERNEL); 406 ce = kmem_cache_alloc(cache->c_entry_cache, gfp_flags);
407 if (ce) { 407 if (ce) {
408 atomic_inc(&cache->c_entry_count); 408 atomic_inc(&cache->c_entry_count);
409 INIT_LIST_HEAD(&ce->e_lru_list); 409 INIT_LIST_HEAD(&ce->e_lru_list);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index ef57a5ae5904..5d2e9d9a4e28 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -64,7 +64,11 @@ const struct file_operations nfs_file_operations = {
64 .write = do_sync_write, 64 .write = do_sync_write,
65 .aio_read = nfs_file_read, 65 .aio_read = nfs_file_read,
66 .aio_write = nfs_file_write, 66 .aio_write = nfs_file_write,
67#ifdef CONFIG_MMU
67 .mmap = nfs_file_mmap, 68 .mmap = nfs_file_mmap,
69#else
70 .mmap = generic_file_mmap,
71#endif
68 .open = nfs_file_open, 72 .open = nfs_file_open,
69 .flush = nfs_file_flush, 73 .flush = nfs_file_flush,
70 .release = nfs_file_release, 74 .release = nfs_file_release,
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index a4c7cf2bff3a..6f88d7c77ac9 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -506,6 +506,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
506 ctx->cred = get_rpccred(cred); 506 ctx->cred = get_rpccred(cred);
507 ctx->state = NULL; 507 ctx->state = NULL;
508 ctx->lockowner = current->files; 508 ctx->lockowner = current->files;
509 ctx->flags = 0;
509 ctx->error = 0; 510 ctx->error = 0;
510 ctx->dir_cookie = 0; 511 ctx->dir_cookie = 0;
511 atomic_set(&ctx->count, 1); 512 atomic_set(&ctx->count, 1);
diff --git a/fs/open.c b/fs/open.c
index a4b12022edaa..3fa4e4ffce4c 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -335,7 +335,7 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
335{ 335{
336 long ret = do_sys_ftruncate(fd, length, 1); 336 long ret = do_sys_ftruncate(fd, length, 1);
337 /* avoid REGPARM breakage on x86: */ 337 /* avoid REGPARM breakage on x86: */
338 prevent_tail_call(ret); 338 asmlinkage_protect(2, ret, fd, length);
339 return ret; 339 return ret;
340} 340}
341 341
@@ -350,7 +350,7 @@ asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
350{ 350{
351 long ret = do_sys_ftruncate(fd, length, 0); 351 long ret = do_sys_ftruncate(fd, length, 0);
352 /* avoid REGPARM breakage on x86: */ 352 /* avoid REGPARM breakage on x86: */
353 prevent_tail_call(ret); 353 asmlinkage_protect(2, ret, fd, length);
354 return ret; 354 return ret;
355} 355}
356#endif 356#endif
@@ -1067,7 +1067,7 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1067 1067
1068 ret = do_sys_open(AT_FDCWD, filename, flags, mode); 1068 ret = do_sys_open(AT_FDCWD, filename, flags, mode);
1069 /* avoid REGPARM breakage on x86: */ 1069 /* avoid REGPARM breakage on x86: */
1070 prevent_tail_call(ret); 1070 asmlinkage_protect(3, ret, filename, flags, mode);
1071 return ret; 1071 return ret;
1072} 1072}
1073 1073
@@ -1081,7 +1081,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1081 1081
1082 ret = do_sys_open(dfd, filename, flags, mode); 1082 ret = do_sys_open(dfd, filename, flags, mode);
1083 /* avoid REGPARM breakage on x86: */ 1083 /* avoid REGPARM breakage on x86: */
1084 prevent_tail_call(ret); 1084 asmlinkage_protect(4, ret, dfd, filename, flags, mode);
1085 return ret; 1085 return ret;
1086} 1086}
1087 1087
diff --git a/fs/signalfd.c b/fs/signalfd.c
index cb2b63ae0bf4..8ead0db35933 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -111,9 +111,14 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo,
111 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid); 111 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
112 err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr); 112 err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
113 break; 113 break;
114 default: /* this is just in case for now ... */ 114 default:
115 /*
116 * This case catches also the signals queued by sigqueue().
117 */
115 err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid); 118 err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
116 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid); 119 err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
120 err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
121 err |= __put_user(kinfo->si_int, &uinfo->ssi_int);
117 break; 122 break;
118 } 123 }
119 124
diff --git a/fs/splice.c b/fs/splice.c
index a861bb318ac8..eeb1a86a7014 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -370,8 +370,10 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
370 * for an in-flight io page 370 * for an in-flight io page
371 */ 371 */
372 if (flags & SPLICE_F_NONBLOCK) { 372 if (flags & SPLICE_F_NONBLOCK) {
373 if (TestSetPageLocked(page)) 373 if (TestSetPageLocked(page)) {
374 error = -EAGAIN;
374 break; 375 break;
376 }
375 } else 377 } else
376 lock_page(page); 378 lock_page(page);
377 379
@@ -479,9 +481,8 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
479 struct pipe_inode_info *pipe, size_t len, 481 struct pipe_inode_info *pipe, size_t len,
480 unsigned int flags) 482 unsigned int flags)
481{ 483{
482 ssize_t spliced;
483 int ret;
484 loff_t isize, left; 484 loff_t isize, left;
485 int ret;
485 486
486 isize = i_size_read(in->f_mapping->host); 487 isize = i_size_read(in->f_mapping->host);
487 if (unlikely(*ppos >= isize)) 488 if (unlikely(*ppos >= isize))
@@ -491,29 +492,9 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
491 if (unlikely(left < len)) 492 if (unlikely(left < len))
492 len = left; 493 len = left;
493 494
494 ret = 0; 495 ret = __generic_file_splice_read(in, ppos, pipe, len, flags);
495 spliced = 0; 496 if (ret > 0)
496 while (len && !spliced) {
497 ret = __generic_file_splice_read(in, ppos, pipe, len, flags);
498
499 if (ret < 0)
500 break;
501 else if (!ret) {
502 if (spliced)
503 break;
504 if (flags & SPLICE_F_NONBLOCK) {
505 ret = -EAGAIN;
506 break;
507 }
508 }
509
510 *ppos += ret; 497 *ppos += ret;
511 len -= ret;
512 spliced += ret;
513 }
514
515 if (spliced)
516 return spliced;
517 498
518 return ret; 499 return ret;
519} 500}
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index a9952e490ac9..f34bd010eb51 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -732,7 +732,7 @@ xfs_ioctl(
732 * Only allow the sys admin to reserve space unless 732 * Only allow the sys admin to reserve space unless
733 * unwritten extents are enabled. 733 * unwritten extents are enabled.
734 */ 734 */
735 if (!XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb) && 735 if (!xfs_sb_version_hasextflgbit(&mp->m_sb) &&
736 !capable(CAP_SYS_ADMIN)) 736 !capable(CAP_SYS_ADMIN))
737 return -EPERM; 737 return -EPERM;
738 738
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 1f3da5b8657b..8e9c5ae6504d 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1405,13 +1405,13 @@ xfs_qm_qino_alloc(
1405#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY) 1405#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
1406 unsigned oldv = mp->m_sb.sb_versionnum; 1406 unsigned oldv = mp->m_sb.sb_versionnum;
1407#endif 1407#endif
1408 ASSERT(!XFS_SB_VERSION_HASQUOTA(&mp->m_sb)); 1408 ASSERT(!xfs_sb_version_hasquota(&mp->m_sb));
1409 ASSERT((sbfields & (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | 1409 ASSERT((sbfields & (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO |
1410 XFS_SB_GQUOTINO | XFS_SB_QFLAGS)) == 1410 XFS_SB_GQUOTINO | XFS_SB_QFLAGS)) ==
1411 (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | 1411 (XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO |
1412 XFS_SB_GQUOTINO | XFS_SB_QFLAGS)); 1412 XFS_SB_GQUOTINO | XFS_SB_QFLAGS));
1413 1413
1414 XFS_SB_VERSION_ADDQUOTA(&mp->m_sb); 1414 xfs_sb_version_addquota(&mp->m_sb);
1415 mp->m_sb.sb_uquotino = NULLFSINO; 1415 mp->m_sb.sb_uquotino = NULLFSINO;
1416 mp->m_sb.sb_gquotino = NULLFSINO; 1416 mp->m_sb.sb_gquotino = NULLFSINO;
1417 1417
@@ -1954,7 +1954,7 @@ xfs_qm_init_quotainos(
1954 /* 1954 /*
1955 * Get the uquota and gquota inodes 1955 * Get the uquota and gquota inodes
1956 */ 1956 */
1957 if (XFS_SB_VERSION_HASQUOTA(&mp->m_sb)) { 1957 if (xfs_sb_version_hasquota(&mp->m_sb)) {
1958 if (XFS_IS_UQUOTA_ON(mp) && 1958 if (XFS_IS_UQUOTA_ON(mp) &&
1959 mp->m_sb.sb_uquotino != NULLFSINO) { 1959 mp->m_sb.sb_uquotino != NULLFSINO) {
1960 ASSERT(mp->m_sb.sb_uquotino > 0); 1960 ASSERT(mp->m_sb.sb_uquotino > 0);
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c
index 97bb32937585..f4f6c4c861d7 100644
--- a/fs/xfs/quota/xfs_qm_bhv.c
+++ b/fs/xfs/quota/xfs_qm_bhv.c
@@ -118,7 +118,7 @@ xfs_qm_newmount(
118 *quotaflags = 0; 118 *quotaflags = 0;
119 *needquotamount = B_FALSE; 119 *needquotamount = B_FALSE;
120 120
121 quotaondisk = XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && 121 quotaondisk = xfs_sb_version_hasquota(&mp->m_sb) &&
122 (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT); 122 (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT);
123 123
124 if (quotaondisk) { 124 if (quotaondisk) {
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 2cc5886cfe85..d2b8be7e75f9 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -377,7 +377,7 @@ xfs_qm_scall_trunc_qfiles(
377 if (!capable(CAP_SYS_ADMIN)) 377 if (!capable(CAP_SYS_ADMIN))
378 return XFS_ERROR(EPERM); 378 return XFS_ERROR(EPERM);
379 error = 0; 379 error = 0;
380 if (!XFS_SB_VERSION_HASQUOTA(&mp->m_sb) || flags == 0) { 380 if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
381 qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags); 381 qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags);
382 return XFS_ERROR(EINVAL); 382 return XFS_ERROR(EINVAL);
383 } 383 }
@@ -522,7 +522,7 @@ xfs_qm_scall_getqstat(
522 memset(out, 0, sizeof(fs_quota_stat_t)); 522 memset(out, 0, sizeof(fs_quota_stat_t));
523 523
524 out->qs_version = FS_QSTAT_VERSION; 524 out->qs_version = FS_QSTAT_VERSION;
525 if (! XFS_SB_VERSION_HASQUOTA(&mp->m_sb)) { 525 if (!xfs_sb_version_hasquota(&mp->m_sb)) {
526 out->qs_uquota.qfs_ino = NULLFSINO; 526 out->qs_uquota.qfs_ino = NULLFSINO;
527 out->qs_gquota.qfs_ino = NULLFSINO; 527 out->qs_gquota.qfs_ino = NULLFSINO;
528 return (0); 528 return (0);
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c
index b08e2a2a8add..96ba6aa4ed8c 100644
--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -227,10 +227,10 @@ STATIC void
227xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp) 227xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
228{ 228{
229 if ((mp->m_flags & XFS_MOUNT_ATTR2) && 229 if ((mp->m_flags & XFS_MOUNT_ATTR2) &&
230 !(XFS_SB_VERSION_HASATTR2(&mp->m_sb))) { 230 !(xfs_sb_version_hasattr2(&mp->m_sb))) {
231 spin_lock(&mp->m_sb_lock); 231 spin_lock(&mp->m_sb_lock);
232 if (!XFS_SB_VERSION_HASATTR2(&mp->m_sb)) { 232 if (!xfs_sb_version_hasattr2(&mp->m_sb)) {
233 XFS_SB_VERSION_ADDATTR2(&mp->m_sb); 233 xfs_sb_version_addattr2(&mp->m_sb);
234 spin_unlock(&mp->m_sb_lock); 234 spin_unlock(&mp->m_sb_lock);
235 xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2); 235 xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
236 } else 236 } else
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 1c0a5a585a82..2def273855a2 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4047,17 +4047,17 @@ xfs_bmap_add_attrfork(
4047 xfs_trans_log_inode(tp, ip, logflags); 4047 xfs_trans_log_inode(tp, ip, logflags);
4048 if (error) 4048 if (error)
4049 goto error2; 4049 goto error2;
4050 if (!XFS_SB_VERSION_HASATTR(&mp->m_sb) || 4050 if (!xfs_sb_version_hasattr(&mp->m_sb) ||
4051 (!XFS_SB_VERSION_HASATTR2(&mp->m_sb) && version == 2)) { 4051 (!xfs_sb_version_hasattr2(&mp->m_sb) && version == 2)) {
4052 __int64_t sbfields = 0; 4052 __int64_t sbfields = 0;
4053 4053
4054 spin_lock(&mp->m_sb_lock); 4054 spin_lock(&mp->m_sb_lock);
4055 if (!XFS_SB_VERSION_HASATTR(&mp->m_sb)) { 4055 if (!xfs_sb_version_hasattr(&mp->m_sb)) {
4056 XFS_SB_VERSION_ADDATTR(&mp->m_sb); 4056 xfs_sb_version_addattr(&mp->m_sb);
4057 sbfields |= XFS_SB_VERSIONNUM; 4057 sbfields |= XFS_SB_VERSIONNUM;
4058 } 4058 }
4059 if (!XFS_SB_VERSION_HASATTR2(&mp->m_sb) && version == 2) { 4059 if (!xfs_sb_version_hasattr2(&mp->m_sb) && version == 2) {
4060 XFS_SB_VERSION_ADDATTR2(&mp->m_sb); 4060 xfs_sb_version_addattr2(&mp->m_sb);
4061 sbfields |= (XFS_SB_VERSIONNUM | XFS_SB_FEATURES2); 4061 sbfields |= (XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
4062 } 4062 }
4063 if (sbfields) { 4063 if (sbfields) {
@@ -5043,7 +5043,7 @@ xfs_bmapi(
5043 * A wasdelay extent has been initialized, so 5043 * A wasdelay extent has been initialized, so
5044 * shouldn't be flagged as unwritten. 5044 * shouldn't be flagged as unwritten.
5045 */ 5045 */
5046 if (wr && XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { 5046 if (wr && xfs_sb_version_hasextflgbit(&mp->m_sb)) {
5047 if (!wasdelay && (flags & XFS_BMAPI_PREALLOC)) 5047 if (!wasdelay && (flags & XFS_BMAPI_PREALLOC))
5048 got.br_state = XFS_EXT_UNWRITTEN; 5048 got.br_state = XFS_EXT_UNWRITTEN;
5049 } 5049 }
@@ -5483,7 +5483,7 @@ xfs_bunmapi(
5483 * get rid of part of a realtime extent. 5483 * get rid of part of a realtime extent.
5484 */ 5484 */
5485 if (del.br_state == XFS_EXT_UNWRITTEN || 5485 if (del.br_state == XFS_EXT_UNWRITTEN ||
5486 !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { 5486 !xfs_sb_version_hasextflgbit(&mp->m_sb)) {
5487 /* 5487 /*
5488 * This piece is unwritten, or we're not 5488 * This piece is unwritten, or we're not
5489 * using unwritten extents. Skip over it. 5489 * using unwritten extents. Skip over it.
@@ -5535,7 +5535,7 @@ xfs_bunmapi(
5535 } else if ((del.br_startoff == start && 5535 } else if ((del.br_startoff == start &&
5536 (del.br_state == XFS_EXT_UNWRITTEN || 5536 (del.br_state == XFS_EXT_UNWRITTEN ||
5537 xfs_trans_get_block_res(tp) == 0)) || 5537 xfs_trans_get_block_res(tp) == 0)) ||
5538 !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { 5538 !xfs_sb_version_hasextflgbit(&mp->m_sb)) {
5539 /* 5539 /*
5540 * Can't make it unwritten. There isn't 5540 * Can't make it unwritten. There isn't
5541 * a full extent here so just skip it. 5541 * a full extent here so just skip it.
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 2d950e975918..cd0d4b4bb816 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -120,7 +120,7 @@ typedef enum {
120 * Extent state and extent format macros. 120 * Extent state and extent format macros.
121 */ 121 */
122#define XFS_EXTFMT_INODE(x) \ 122#define XFS_EXTFMT_INODE(x) \
123 (XFS_SB_VERSION_HASEXTFLGBIT(&((x)->i_mount->m_sb)) ? \ 123 (xfs_sb_version_hasextflgbit(&((x)->i_mount->m_sb)) ? \
124 XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE) 124 XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
125#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN) 125#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
126 126
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index be7c4251fa61..e92e73f0e6af 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -49,7 +49,7 @@ void
49xfs_dir_mount( 49xfs_dir_mount(
50 xfs_mount_t *mp) 50 xfs_mount_t *mp)
51{ 51{
52 ASSERT(XFS_SB_VERSION_HASDIRV2(&mp->m_sb)); 52 ASSERT(xfs_sb_version_hasdirv2(&mp->m_sb));
53 ASSERT((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <= 53 ASSERT((1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog)) <=
54 XFS_MAX_BLOCKSIZE); 54 XFS_MAX_BLOCKSIZE);
55 mp->m_dirblksize = 1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog); 55 mp->m_dirblksize = 1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog);
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index eadc1591c795..d3a0f538d6a6 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -77,36 +77,36 @@ xfs_fs_geometry(
77 if (new_version >= 3) { 77 if (new_version >= 3) {
78 geo->version = XFS_FSOP_GEOM_VERSION; 78 geo->version = XFS_FSOP_GEOM_VERSION;
79 geo->flags = 79 geo->flags =
80 (XFS_SB_VERSION_HASATTR(&mp->m_sb) ? 80 (xfs_sb_version_hasattr(&mp->m_sb) ?
81 XFS_FSOP_GEOM_FLAGS_ATTR : 0) | 81 XFS_FSOP_GEOM_FLAGS_ATTR : 0) |
82 (XFS_SB_VERSION_HASNLINK(&mp->m_sb) ? 82 (xfs_sb_version_hasnlink(&mp->m_sb) ?
83 XFS_FSOP_GEOM_FLAGS_NLINK : 0) | 83 XFS_FSOP_GEOM_FLAGS_NLINK : 0) |
84 (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) ? 84 (xfs_sb_version_hasquota(&mp->m_sb) ?
85 XFS_FSOP_GEOM_FLAGS_QUOTA : 0) | 85 XFS_FSOP_GEOM_FLAGS_QUOTA : 0) |
86 (XFS_SB_VERSION_HASALIGN(&mp->m_sb) ? 86 (xfs_sb_version_hasalign(&mp->m_sb) ?
87 XFS_FSOP_GEOM_FLAGS_IALIGN : 0) | 87 XFS_FSOP_GEOM_FLAGS_IALIGN : 0) |
88 (XFS_SB_VERSION_HASDALIGN(&mp->m_sb) ? 88 (xfs_sb_version_hasdalign(&mp->m_sb) ?
89 XFS_FSOP_GEOM_FLAGS_DALIGN : 0) | 89 XFS_FSOP_GEOM_FLAGS_DALIGN : 0) |
90 (XFS_SB_VERSION_HASSHARED(&mp->m_sb) ? 90 (xfs_sb_version_hasshared(&mp->m_sb) ?
91 XFS_FSOP_GEOM_FLAGS_SHARED : 0) | 91 XFS_FSOP_GEOM_FLAGS_SHARED : 0) |
92 (XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb) ? 92 (xfs_sb_version_hasextflgbit(&mp->m_sb) ?
93 XFS_FSOP_GEOM_FLAGS_EXTFLG : 0) | 93 XFS_FSOP_GEOM_FLAGS_EXTFLG : 0) |
94 (XFS_SB_VERSION_HASDIRV2(&mp->m_sb) ? 94 (xfs_sb_version_hasdirv2(&mp->m_sb) ?
95 XFS_FSOP_GEOM_FLAGS_DIRV2 : 0) | 95 XFS_FSOP_GEOM_FLAGS_DIRV2 : 0) |
96 (XFS_SB_VERSION_HASSECTOR(&mp->m_sb) ? 96 (xfs_sb_version_hassector(&mp->m_sb) ?
97 XFS_FSOP_GEOM_FLAGS_SECTOR : 0) | 97 XFS_FSOP_GEOM_FLAGS_SECTOR : 0) |
98 (xfs_sb_version_haslazysbcount(&mp->m_sb) ? 98 (xfs_sb_version_haslazysbcount(&mp->m_sb) ?
99 XFS_FSOP_GEOM_FLAGS_LAZYSB : 0) | 99 XFS_FSOP_GEOM_FLAGS_LAZYSB : 0) |
100 (XFS_SB_VERSION_HASATTR2(&mp->m_sb) ? 100 (xfs_sb_version_hasattr2(&mp->m_sb) ?
101 XFS_FSOP_GEOM_FLAGS_ATTR2 : 0); 101 XFS_FSOP_GEOM_FLAGS_ATTR2 : 0);
102 geo->logsectsize = XFS_SB_VERSION_HASSECTOR(&mp->m_sb) ? 102 geo->logsectsize = xfs_sb_version_hassector(&mp->m_sb) ?
103 mp->m_sb.sb_logsectsize : BBSIZE; 103 mp->m_sb.sb_logsectsize : BBSIZE;
104 geo->rtsectsize = mp->m_sb.sb_blocksize; 104 geo->rtsectsize = mp->m_sb.sb_blocksize;
105 geo->dirblocksize = mp->m_dirblksize; 105 geo->dirblocksize = mp->m_dirblksize;
106 } 106 }
107 if (new_version >= 4) { 107 if (new_version >= 4) {
108 geo->flags |= 108 geo->flags |=
109 (XFS_SB_VERSION_HASLOGV2(&mp->m_sb) ? 109 (xfs_sb_version_haslogv2(&mp->m_sb) ?
110 XFS_FSOP_GEOM_FLAGS_LOGV2 : 0); 110 XFS_FSOP_GEOM_FLAGS_LOGV2 : 0);
111 geo->logsunit = mp->m_sb.sb_logsunit; 111 geo->logsunit = mp->m_sb.sb_logsunit;
112 } 112 }
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index db9d5fa600af..5a146cb22980 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -191,7 +191,7 @@ xfs_ialloc_ag_alloc(
191 ASSERT(!(args.mp->m_flags & XFS_MOUNT_NOALIGN)); 191 ASSERT(!(args.mp->m_flags & XFS_MOUNT_NOALIGN));
192 args.alignment = args.mp->m_dalign; 192 args.alignment = args.mp->m_dalign;
193 isaligned = 1; 193 isaligned = 1;
194 } else if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) && 194 } else if (xfs_sb_version_hasalign(&args.mp->m_sb) &&
195 args.mp->m_sb.sb_inoalignmt >= 195 args.mp->m_sb.sb_inoalignmt >=
196 XFS_B_TO_FSBT(args.mp, 196 XFS_B_TO_FSBT(args.mp,
197 XFS_INODE_CLUSTER_SIZE(args.mp))) 197 XFS_INODE_CLUSTER_SIZE(args.mp)))
@@ -230,7 +230,7 @@ xfs_ialloc_ag_alloc(
230 args.agbno = be32_to_cpu(agi->agi_root); 230 args.agbno = be32_to_cpu(agi->agi_root);
231 args.fsbno = XFS_AGB_TO_FSB(args.mp, 231 args.fsbno = XFS_AGB_TO_FSB(args.mp,
232 be32_to_cpu(agi->agi_seqno), args.agbno); 232 be32_to_cpu(agi->agi_seqno), args.agbno);
233 if (XFS_SB_VERSION_HASALIGN(&args.mp->m_sb) && 233 if (xfs_sb_version_hasalign(&args.mp->m_sb) &&
234 args.mp->m_sb.sb_inoalignmt >= 234 args.mp->m_sb.sb_inoalignmt >=
235 XFS_B_TO_FSBT(args.mp, XFS_INODE_CLUSTER_SIZE(args.mp))) 235 XFS_B_TO_FSBT(args.mp, XFS_INODE_CLUSTER_SIZE(args.mp)))
236 args.alignment = args.mp->m_sb.sb_inoalignmt; 236 args.alignment = args.mp->m_sb.sb_inoalignmt;
@@ -271,7 +271,7 @@ xfs_ialloc_ag_alloc(
271 * use the old version so that old kernels will continue to be 271 * use the old version so that old kernels will continue to be
272 * able to use the file system. 272 * able to use the file system.
273 */ 273 */
274 if (XFS_SB_VERSION_HASNLINK(&args.mp->m_sb)) 274 if (xfs_sb_version_hasnlink(&args.mp->m_sb))
275 version = XFS_DINODE_VERSION_2; 275 version = XFS_DINODE_VERSION_2;
276 else 276 else
277 version = XFS_DINODE_VERSION_1; 277 version = XFS_DINODE_VERSION_1;
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index a550546a7083..f43a6e01d68f 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1147,7 +1147,7 @@ xfs_ialloc(
1147 * the inode version number now. This way we only do the conversion 1147 * the inode version number now. This way we only do the conversion
1148 * here rather than here and in the flush/logging code. 1148 * here rather than here and in the flush/logging code.
1149 */ 1149 */
1150 if (XFS_SB_VERSION_HASNLINK(&tp->t_mountp->m_sb) && 1150 if (xfs_sb_version_hasnlink(&tp->t_mountp->m_sb) &&
1151 ip->i_d.di_version == XFS_DINODE_VERSION_1) { 1151 ip->i_d.di_version == XFS_DINODE_VERSION_1) {
1152 ip->i_d.di_version = XFS_DINODE_VERSION_2; 1152 ip->i_d.di_version = XFS_DINODE_VERSION_2;
1153 /* 1153 /*
@@ -3434,9 +3434,9 @@ xfs_iflush_int(
3434 * has been updated, then make the conversion permanent. 3434 * has been updated, then make the conversion permanent.
3435 */ 3435 */
3436 ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1 || 3436 ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1 ||
3437 XFS_SB_VERSION_HASNLINK(&mp->m_sb)); 3437 xfs_sb_version_hasnlink(&mp->m_sb));
3438 if (ip->i_d.di_version == XFS_DINODE_VERSION_1) { 3438 if (ip->i_d.di_version == XFS_DINODE_VERSION_1) {
3439 if (!XFS_SB_VERSION_HASNLINK(&mp->m_sb)) { 3439 if (!xfs_sb_version_hasnlink(&mp->m_sb)) {
3440 /* 3440 /*
3441 * Convert it back. 3441 * Convert it back.
3442 */ 3442 */
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 034ca7202295..2c775b4ae9e6 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -296,9 +296,9 @@ xfs_inode_item_format(
296 */ 296 */
297 mp = ip->i_mount; 297 mp = ip->i_mount;
298 ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1 || 298 ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1 ||
299 XFS_SB_VERSION_HASNLINK(&mp->m_sb)); 299 xfs_sb_version_hasnlink(&mp->m_sb));
300 if (ip->i_d.di_version == XFS_DINODE_VERSION_1) { 300 if (ip->i_d.di_version == XFS_DINODE_VERSION_1) {
301 if (!XFS_SB_VERSION_HASNLINK(&mp->m_sb)) { 301 if (!xfs_sb_version_hasnlink(&mp->m_sb)) {
302 /* 302 /*
303 * Convert it back. 303 * Convert it back.
304 */ 304 */
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index 658aab6b1bbf..f615e04364f4 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -45,7 +45,7 @@ xfs_internal_inum(
45 xfs_ino_t ino) 45 xfs_ino_t ino)
46{ 46{
47 return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || 47 return (ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino ||
48 (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && 48 (xfs_sb_version_hasquota(&mp->m_sb) &&
49 (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino))); 49 (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino)));
50} 50}
51 51
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index a75edca1860f..31f2b04f2c97 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1090,7 +1090,7 @@ xlog_get_iclog_buffer_size(xfs_mount_t *mp,
1090 size >>= 1; 1090 size >>= 1;
1091 } 1091 }
1092 1092
1093 if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) { 1093 if (xfs_sb_version_haslogv2(&mp->m_sb)) {
1094 /* # headers = size / 32K 1094 /* # headers = size / 32K
1095 * one header holds cycles from 32K of data 1095 * one header holds cycles from 32K of data
1096 */ 1096 */
@@ -1186,13 +1186,13 @@ xlog_alloc_log(xfs_mount_t *mp,
1186 log->l_grant_reserve_cycle = 1; 1186 log->l_grant_reserve_cycle = 1;
1187 log->l_grant_write_cycle = 1; 1187 log->l_grant_write_cycle = 1;
1188 1188
1189 if (XFS_SB_VERSION_HASSECTOR(&mp->m_sb)) { 1189 if (xfs_sb_version_hassector(&mp->m_sb)) {
1190 log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT; 1190 log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
1191 ASSERT(log->l_sectbb_log <= mp->m_sectbb_log); 1191 ASSERT(log->l_sectbb_log <= mp->m_sectbb_log);
1192 /* for larger sector sizes, must have v2 or external log */ 1192 /* for larger sector sizes, must have v2 or external log */
1193 ASSERT(log->l_sectbb_log == 0 || 1193 ASSERT(log->l_sectbb_log == 0 ||
1194 log->l_logBBstart == 0 || 1194 log->l_logBBstart == 0 ||
1195 XFS_SB_VERSION_HASLOGV2(&mp->m_sb)); 1195 xfs_sb_version_haslogv2(&mp->m_sb));
1196 ASSERT(mp->m_sb.sb_logsectlog >= BBSHIFT); 1196 ASSERT(mp->m_sb.sb_logsectlog >= BBSHIFT);
1197 } 1197 }
1198 log->l_sectbb_mask = (1 << log->l_sectbb_log) - 1; 1198 log->l_sectbb_mask = (1 << log->l_sectbb_log) - 1;
@@ -1247,7 +1247,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1247 memset(head, 0, sizeof(xlog_rec_header_t)); 1247 memset(head, 0, sizeof(xlog_rec_header_t));
1248 head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM); 1248 head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
1249 head->h_version = cpu_to_be32( 1249 head->h_version = cpu_to_be32(
1250 XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) ? 2 : 1); 1250 xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? 2 : 1);
1251 head->h_size = cpu_to_be32(log->l_iclog_size); 1251 head->h_size = cpu_to_be32(log->l_iclog_size);
1252 /* new fields */ 1252 /* new fields */
1253 head->h_fmt = cpu_to_be32(XLOG_FMT); 1253 head->h_fmt = cpu_to_be32(XLOG_FMT);
@@ -1402,7 +1402,7 @@ xlog_sync(xlog_t *log,
1402 int roundoff; /* roundoff to BB or stripe */ 1402 int roundoff; /* roundoff to BB or stripe */
1403 int split = 0; /* split write into two regions */ 1403 int split = 0; /* split write into two regions */
1404 int error; 1404 int error;
1405 int v2 = XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb); 1405 int v2 = xfs_sb_version_haslogv2(&log->l_mp->m_sb);
1406 1406
1407 XFS_STATS_INC(xs_log_writes); 1407 XFS_STATS_INC(xs_log_writes);
1408 ASSERT(iclog->ic_refcnt == 0); 1408 ASSERT(iclog->ic_refcnt == 0);
@@ -2881,7 +2881,7 @@ xlog_state_switch_iclogs(xlog_t *log,
2881 log->l_curr_block += BTOBB(eventual_size)+BTOBB(log->l_iclog_hsize); 2881 log->l_curr_block += BTOBB(eventual_size)+BTOBB(log->l_iclog_hsize);
2882 2882
2883 /* Round up to next log-sunit */ 2883 /* Round up to next log-sunit */
2884 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) && 2884 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb) &&
2885 log->l_mp->m_sb.sb_logsunit > 1) { 2885 log->l_mp->m_sb.sb_logsunit > 1) {
2886 __uint32_t sunit_bb = BTOBB(log->l_mp->m_sb.sb_logsunit); 2886 __uint32_t sunit_bb = BTOBB(log->l_mp->m_sb.sb_logsunit);
2887 log->l_curr_block = roundup(log->l_curr_block, sunit_bb); 2887 log->l_curr_block = roundup(log->l_curr_block, sunit_bb);
@@ -3334,7 +3334,7 @@ xlog_ticket_get(xlog_t *log,
3334 unit_bytes += sizeof(xlog_op_header_t) * num_headers; 3334 unit_bytes += sizeof(xlog_op_header_t) * num_headers;
3335 3335
3336 /* for roundoff padding for transaction data and one for commit record */ 3336 /* for roundoff padding for transaction data and one for commit record */
3337 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) && 3337 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb) &&
3338 log->l_mp->m_sb.sb_logsunit > 1) { 3338 log->l_mp->m_sb.sb_logsunit > 1) {
3339 /* log su roundoff */ 3339 /* log su roundoff */
3340 unit_bytes += 2*log->l_mp->m_sb.sb_logsunit; 3340 unit_bytes += 2*log->l_mp->m_sb.sb_logsunit;
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index e008233ee249..c6244cc733c0 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -49,10 +49,10 @@ struct xfs_mount;
49#define XLOG_HEADER_SIZE 512 49#define XLOG_HEADER_SIZE 512
50 50
51#define XLOG_REC_SHIFT(log) \ 51#define XLOG_REC_SHIFT(log) \
52 BTOBB(1 << (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) ? \ 52 BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
53 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) 53 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
54#define XLOG_TOTAL_REC_SHIFT(log) \ 54#define XLOG_TOTAL_REC_SHIFT(log) \
55 BTOBB(XLOG_MAX_ICLOGS << (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) ? \ 55 BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \
56 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) 56 XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
57 57
58 58
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index b82d5d4d2462..b2b70eba282c 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -478,7 +478,7 @@ xlog_find_verify_log_record(
478 * reset last_blk. Only when last_blk points in the middle of a log 478 * reset last_blk. Only when last_blk points in the middle of a log
479 * record do we update last_blk. 479 * record do we update last_blk.
480 */ 480 */
481 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { 481 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
482 uint h_size = be32_to_cpu(head->h_size); 482 uint h_size = be32_to_cpu(head->h_size);
483 483
484 xhdrs = h_size / XLOG_HEADER_CYCLE_SIZE; 484 xhdrs = h_size / XLOG_HEADER_CYCLE_SIZE;
@@ -888,7 +888,7 @@ xlog_find_tail(
888 * unmount record if there is one, so we pass the lsn of the 888 * unmount record if there is one, so we pass the lsn of the
889 * unmount record rather than the block after it. 889 * unmount record rather than the block after it.
890 */ 890 */
891 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { 891 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
892 int h_size = be32_to_cpu(rhead->h_size); 892 int h_size = be32_to_cpu(rhead->h_size);
893 int h_version = be32_to_cpu(rhead->h_version); 893 int h_version = be32_to_cpu(rhead->h_version);
894 894
@@ -1101,7 +1101,7 @@ xlog_add_record(
1101 recp->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM); 1101 recp->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
1102 recp->h_cycle = cpu_to_be32(cycle); 1102 recp->h_cycle = cpu_to_be32(cycle);
1103 recp->h_version = cpu_to_be32( 1103 recp->h_version = cpu_to_be32(
1104 XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb) ? 2 : 1); 1104 xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? 2 : 1);
1105 recp->h_lsn = cpu_to_be64(xlog_assign_lsn(cycle, block)); 1105 recp->h_lsn = cpu_to_be64(xlog_assign_lsn(cycle, block));
1106 recp->h_tail_lsn = cpu_to_be64(xlog_assign_lsn(tail_cycle, tail_block)); 1106 recp->h_tail_lsn = cpu_to_be64(xlog_assign_lsn(tail_cycle, tail_block));
1107 recp->h_fmt = cpu_to_be32(XLOG_FMT); 1107 recp->h_fmt = cpu_to_be32(XLOG_FMT);
@@ -3348,7 +3348,7 @@ xlog_pack_data(
3348 dp += BBSIZE; 3348 dp += BBSIZE;
3349 } 3349 }
3350 3350
3351 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { 3351 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
3352 xhdr = (xlog_in_core_2_t *)&iclog->ic_header; 3352 xhdr = (xlog_in_core_2_t *)&iclog->ic_header;
3353 for ( ; i < BTOBB(size); i++) { 3353 for ( ; i < BTOBB(size); i++) {
3354 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); 3354 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
@@ -3388,7 +3388,7 @@ xlog_unpack_data_checksum(
3388 be32_to_cpu(rhead->h_chksum), chksum); 3388 be32_to_cpu(rhead->h_chksum), chksum);
3389 cmn_err(CE_DEBUG, 3389 cmn_err(CE_DEBUG,
3390"XFS: Disregard message if filesystem was created with non-DEBUG kernel"); 3390"XFS: Disregard message if filesystem was created with non-DEBUG kernel");
3391 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { 3391 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
3392 cmn_err(CE_DEBUG, 3392 cmn_err(CE_DEBUG,
3393 "XFS: LogR this is a LogV2 filesystem\n"); 3393 "XFS: LogR this is a LogV2 filesystem\n");
3394 } 3394 }
@@ -3415,7 +3415,7 @@ xlog_unpack_data(
3415 dp += BBSIZE; 3415 dp += BBSIZE;
3416 } 3416 }
3417 3417
3418 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { 3418 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
3419 xhdr = (xlog_in_core_2_t *)rhead; 3419 xhdr = (xlog_in_core_2_t *)rhead;
3420 for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) { 3420 for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) {
3421 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); 3421 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
@@ -3494,7 +3494,7 @@ xlog_do_recovery_pass(
3494 * Read the header of the tail block and get the iclog buffer size from 3494 * Read the header of the tail block and get the iclog buffer size from
3495 * h_size. Use this to tell how many sectors make up the log header. 3495 * h_size. Use this to tell how many sectors make up the log header.
3496 */ 3496 */
3497 if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) { 3497 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
3498 /* 3498 /*
3499 * When using variable length iclogs, read first sector of 3499 * When using variable length iclogs, read first sector of
3500 * iclog header and extract the header size from it. Get a 3500 * iclog header and extract the header size from it. Get a
@@ -3838,7 +3838,7 @@ xlog_do_recover(
3838 sbp = &log->l_mp->m_sb; 3838 sbp = &log->l_mp->m_sb;
3839 xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(bp)); 3839 xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(bp));
3840 ASSERT(sbp->sb_magicnum == XFS_SB_MAGIC); 3840 ASSERT(sbp->sb_magicnum == XFS_SB_MAGIC);
3841 ASSERT(XFS_SB_GOOD_VERSION(sbp)); 3841 ASSERT(xfs_sb_good_version(sbp));
3842 xfs_buf_relse(bp); 3842 xfs_buf_relse(bp);
3843 3843
3844 /* We've re-read the superblock so re-initialize per-cpu counters */ 3844 /* We've re-read the superblock so re-initialize per-cpu counters */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 6409b3762995..8ed164eb9544 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -44,7 +44,7 @@
44#include "xfs_quota.h" 44#include "xfs_quota.h"
45#include "xfs_fsops.h" 45#include "xfs_fsops.h"
46 46
47STATIC void xfs_mount_log_sbunit(xfs_mount_t *, __int64_t); 47STATIC void xfs_mount_log_sb(xfs_mount_t *, __int64_t);
48STATIC int xfs_uuid_mount(xfs_mount_t *); 48STATIC int xfs_uuid_mount(xfs_mount_t *);
49STATIC void xfs_uuid_unmount(xfs_mount_t *mp); 49STATIC void xfs_uuid_unmount(xfs_mount_t *mp);
50STATIC void xfs_unmountfs_wait(xfs_mount_t *); 50STATIC void xfs_unmountfs_wait(xfs_mount_t *);
@@ -119,6 +119,7 @@ static const struct {
119 { offsetof(xfs_sb_t, sb_logsectsize),0 }, 119 { offsetof(xfs_sb_t, sb_logsectsize),0 },
120 { offsetof(xfs_sb_t, sb_logsunit), 0 }, 120 { offsetof(xfs_sb_t, sb_logsunit), 0 },
121 { offsetof(xfs_sb_t, sb_features2), 0 }, 121 { offsetof(xfs_sb_t, sb_features2), 0 },
122 { offsetof(xfs_sb_t, sb_bad_features2), 0 },
122 { sizeof(xfs_sb_t), 0 } 123 { sizeof(xfs_sb_t), 0 }
123}; 124};
124 125
@@ -225,7 +226,7 @@ xfs_mount_validate_sb(
225 return XFS_ERROR(EWRONGFS); 226 return XFS_ERROR(EWRONGFS);
226 } 227 }
227 228
228 if (!XFS_SB_GOOD_VERSION(sbp)) { 229 if (!xfs_sb_good_version(sbp)) {
229 xfs_fs_mount_cmn_err(flags, "bad version"); 230 xfs_fs_mount_cmn_err(flags, "bad version");
230 return XFS_ERROR(EWRONGFS); 231 return XFS_ERROR(EWRONGFS);
231 } 232 }
@@ -300,7 +301,7 @@ xfs_mount_validate_sb(
300 /* 301 /*
301 * Version 1 directory format has never worked on Linux. 302 * Version 1 directory format has never worked on Linux.
302 */ 303 */
303 if (unlikely(!XFS_SB_VERSION_HASDIRV2(sbp))) { 304 if (unlikely(!xfs_sb_version_hasdirv2(sbp))) {
304 xfs_fs_mount_cmn_err(flags, 305 xfs_fs_mount_cmn_err(flags,
305 "file system using version 1 directory format"); 306 "file system using version 1 directory format");
306 return XFS_ERROR(ENOSYS); 307 return XFS_ERROR(ENOSYS);
@@ -449,6 +450,7 @@ xfs_sb_from_disk(
449 to->sb_logsectsize = be16_to_cpu(from->sb_logsectsize); 450 to->sb_logsectsize = be16_to_cpu(from->sb_logsectsize);
450 to->sb_logsunit = be32_to_cpu(from->sb_logsunit); 451 to->sb_logsunit = be32_to_cpu(from->sb_logsunit);
451 to->sb_features2 = be32_to_cpu(from->sb_features2); 452 to->sb_features2 = be32_to_cpu(from->sb_features2);
453 to->sb_bad_features2 = be32_to_cpu(from->sb_bad_features2);
452} 454}
453 455
454/* 456/*
@@ -781,7 +783,7 @@ xfs_update_alignment(xfs_mount_t *mp, int mfsi_flags, __uint64_t *update_flags)
781 * Update superblock with new values 783 * Update superblock with new values
782 * and log changes 784 * and log changes
783 */ 785 */
784 if (XFS_SB_VERSION_HASDALIGN(sbp)) { 786 if (xfs_sb_version_hasdalign(sbp)) {
785 if (sbp->sb_unit != mp->m_dalign) { 787 if (sbp->sb_unit != mp->m_dalign) {
786 sbp->sb_unit = mp->m_dalign; 788 sbp->sb_unit = mp->m_dalign;
787 *update_flags |= XFS_SB_UNIT; 789 *update_flags |= XFS_SB_UNIT;
@@ -792,7 +794,7 @@ xfs_update_alignment(xfs_mount_t *mp, int mfsi_flags, __uint64_t *update_flags)
792 } 794 }
793 } 795 }
794 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && 796 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
795 XFS_SB_VERSION_HASDALIGN(&mp->m_sb)) { 797 xfs_sb_version_hasdalign(&mp->m_sb)) {
796 mp->m_dalign = sbp->sb_unit; 798 mp->m_dalign = sbp->sb_unit;
797 mp->m_swidth = sbp->sb_width; 799 mp->m_swidth = sbp->sb_width;
798 } 800 }
@@ -869,7 +871,7 @@ xfs_set_rw_sizes(xfs_mount_t *mp)
869STATIC void 871STATIC void
870xfs_set_inoalignment(xfs_mount_t *mp) 872xfs_set_inoalignment(xfs_mount_t *mp)
871{ 873{
872 if (XFS_SB_VERSION_HASALIGN(&mp->m_sb) && 874 if (xfs_sb_version_hasalign(&mp->m_sb) &&
873 mp->m_sb.sb_inoalignmt >= 875 mp->m_sb.sb_inoalignmt >=
874 XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size)) 876 XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
875 mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1; 877 mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
@@ -970,6 +972,38 @@ xfs_mountfs(
970 xfs_mount_common(mp, sbp); 972 xfs_mount_common(mp, sbp);
971 973
972 /* 974 /*
975 * Check for a mismatched features2 values. Older kernels
976 * read & wrote into the wrong sb offset for sb_features2
977 * on some platforms due to xfs_sb_t not being 64bit size aligned
978 * when sb_features2 was added, which made older superblock
979 * reading/writing routines swap it as a 64-bit value.
980 *
981 * For backwards compatibility, we make both slots equal.
982 *
983 * If we detect a mismatched field, we OR the set bits into the
984 * existing features2 field in case it has already been modified; we
985 * don't want to lose any features. We then update the bad location
986 * with the ORed value so that older kernels will see any features2
987 * flags, and mark the two fields as needing updates once the
988 * transaction subsystem is online.
989 */
990 if (xfs_sb_has_mismatched_features2(sbp)) {
991 cmn_err(CE_WARN,
992 "XFS: correcting sb_features alignment problem");
993 sbp->sb_features2 |= sbp->sb_bad_features2;
994 sbp->sb_bad_features2 = sbp->sb_features2;
995 update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2;
996
997 /*
998 * Re-check for ATTR2 in case it was found in bad_features2
999 * slot.
1000 */
1001 if (xfs_sb_version_hasattr2(&mp->m_sb))
1002 mp->m_flags |= XFS_MOUNT_ATTR2;
1003
1004 }
1005
1006 /*
973 * Check if sb_agblocks is aligned at stripe boundary 1007 * Check if sb_agblocks is aligned at stripe boundary
974 * If sb_agblocks is NOT aligned turn off m_dalign since 1008 * If sb_agblocks is NOT aligned turn off m_dalign since
975 * allocator alignment is within an ag, therefore ag has 1009 * allocator alignment is within an ag, therefore ag has
@@ -1159,11 +1193,10 @@ xfs_mountfs(
1159 } 1193 }
1160 1194
1161 /* 1195 /*
1162 * If fs is not mounted readonly, then update the superblock 1196 * If fs is not mounted readonly, then update the superblock changes.
1163 * unit and width changes.
1164 */ 1197 */
1165 if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) 1198 if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY))
1166 xfs_mount_log_sbunit(mp, update_flags); 1199 xfs_mount_log_sb(mp, update_flags);
1167 1200
1168 /* 1201 /*
1169 * Initialise the XFS quota management subsystem for this mount 1202 * Initialise the XFS quota management subsystem for this mount
@@ -1875,16 +1908,18 @@ xfs_uuid_unmount(
1875 1908
1876/* 1909/*
1877 * Used to log changes to the superblock unit and width fields which could 1910 * Used to log changes to the superblock unit and width fields which could
1878 * be altered by the mount options. Only the first superblock is updated. 1911 * be altered by the mount options, as well as any potential sb_features2
1912 * fixup. Only the first superblock is updated.
1879 */ 1913 */
1880STATIC void 1914STATIC void
1881xfs_mount_log_sbunit( 1915xfs_mount_log_sb(
1882 xfs_mount_t *mp, 1916 xfs_mount_t *mp,
1883 __int64_t fields) 1917 __int64_t fields)
1884{ 1918{
1885 xfs_trans_t *tp; 1919 xfs_trans_t *tp;
1886 1920
1887 ASSERT(fields & (XFS_SB_UNIT|XFS_SB_WIDTH|XFS_SB_UUID)); 1921 ASSERT(fields & (XFS_SB_UNIT | XFS_SB_WIDTH | XFS_SB_UUID |
1922 XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2));
1888 1923
1889 tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT); 1924 tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT);
1890 if (xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, 1925 if (xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index 94660b1a6ccc..d904efe7f871 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -89,6 +89,7 @@ struct xfs_mount;
89 89
90/* 90/*
91 * Superblock - in core version. Must match the ondisk version below. 91 * Superblock - in core version. Must match the ondisk version below.
92 * Must be padded to 64 bit alignment.
92 */ 93 */
93typedef struct xfs_sb { 94typedef struct xfs_sb {
94 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ 95 __uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
@@ -145,10 +146,21 @@ typedef struct xfs_sb {
145 __uint16_t sb_logsectsize; /* sector size for the log, bytes */ 146 __uint16_t sb_logsectsize; /* sector size for the log, bytes */
146 __uint32_t sb_logsunit; /* stripe unit size for the log */ 147 __uint32_t sb_logsunit; /* stripe unit size for the log */
147 __uint32_t sb_features2; /* additional feature bits */ 148 __uint32_t sb_features2; /* additional feature bits */
149
150 /*
151 * bad features2 field as a result of failing to pad the sb
152 * structure to 64 bits. Some machines will be using this field
153 * for features2 bits. Easiest just to mark it bad and not use
154 * it for anything else.
155 */
156 __uint32_t sb_bad_features2;
157
158 /* must be padded to 64 bit alignment */
148} xfs_sb_t; 159} xfs_sb_t;
149 160
150/* 161/*
151 * Superblock - on disk version. Must match the in core version below. 162 * Superblock - on disk version. Must match the in core version above.
163 * Must be padded to 64 bit alignment.
152 */ 164 */
153typedef struct xfs_dsb { 165typedef struct xfs_dsb {
154 __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */ 166 __be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
@@ -205,6 +217,15 @@ typedef struct xfs_dsb {
205 __be16 sb_logsectsize; /* sector size for the log, bytes */ 217 __be16 sb_logsectsize; /* sector size for the log, bytes */
206 __be32 sb_logsunit; /* stripe unit size for the log */ 218 __be32 sb_logsunit; /* stripe unit size for the log */
207 __be32 sb_features2; /* additional feature bits */ 219 __be32 sb_features2; /* additional feature bits */
220 /*
221 * bad features2 field as a result of failing to pad the sb
222 * structure to 64 bits. Some machines will be using this field
223 * for features2 bits. Easiest just to mark it bad and not use
224 * it for anything else.
225 */
226 __be32 sb_bad_features2;
227
228 /* must be padded to 64 bit alignment */
208} xfs_dsb_t; 229} xfs_dsb_t;
209 230
210/* 231/*
@@ -223,7 +244,7 @@ typedef enum {
223 XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN, 244 XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
224 XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG, 245 XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
225 XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT, 246 XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
226 XFS_SBS_FEATURES2, 247 XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2,
227 XFS_SBS_FIELDCOUNT 248 XFS_SBS_FIELDCOUNT
228} xfs_sb_field_t; 249} xfs_sb_field_t;
229 250
@@ -248,13 +269,15 @@ typedef enum {
248#define XFS_SB_IFREE XFS_SB_MVAL(IFREE) 269#define XFS_SB_IFREE XFS_SB_MVAL(IFREE)
249#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS) 270#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)
250#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2) 271#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)
272#define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2)
251#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT) 273#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
252#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1) 274#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
253#define XFS_SB_MOD_BITS \ 275#define XFS_SB_MOD_BITS \
254 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \ 276 (XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
255 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \ 277 XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
256 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \ 278 XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
257 XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2) 279 XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
280 XFS_SB_BAD_FEATURES2)
258 281
259 282
260/* 283/*
@@ -271,7 +294,6 @@ typedef enum {
271 294
272#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) 295#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
273 296
274#define XFS_SB_GOOD_VERSION(sbp) xfs_sb_good_version(sbp)
275#ifdef __KERNEL__ 297#ifdef __KERNEL__
276static inline int xfs_sb_good_version(xfs_sb_t *sbp) 298static inline int xfs_sb_good_version(xfs_sb_t *sbp)
277{ 299{
@@ -297,7 +319,15 @@ static inline int xfs_sb_good_version(xfs_sb_t *sbp)
297} 319}
298#endif /* __KERNEL__ */ 320#endif /* __KERNEL__ */
299 321
300#define XFS_SB_VERSION_TONEW(v) xfs_sb_version_tonew(v) 322/*
323 * Detect a mismatched features2 field. Older kernels read/wrote
324 * this into the wrong slot, so to be safe we keep them in sync.
325 */
326static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp)
327{
328 return (sbp->sb_bad_features2 != sbp->sb_features2);
329}
330
301static inline unsigned xfs_sb_version_tonew(unsigned v) 331static inline unsigned xfs_sb_version_tonew(unsigned v)
302{ 332{
303 return ((((v) == XFS_SB_VERSION_1) ? \ 333 return ((((v) == XFS_SB_VERSION_1) ? \
@@ -308,7 +338,6 @@ static inline unsigned xfs_sb_version_tonew(unsigned v)
308 XFS_SB_VERSION_4); 338 XFS_SB_VERSION_4);
309} 339}
310 340
311#define XFS_SB_VERSION_TOOLD(v) xfs_sb_version_toold(v)
312static inline unsigned xfs_sb_version_toold(unsigned v) 341static inline unsigned xfs_sb_version_toold(unsigned v)
313{ 342{
314 return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \ 343 return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
@@ -320,7 +349,6 @@ static inline unsigned xfs_sb_version_toold(unsigned v)
320 XFS_SB_VERSION_1))); 349 XFS_SB_VERSION_1)));
321} 350}
322 351
323#define XFS_SB_VERSION_HASATTR(sbp) xfs_sb_version_hasattr(sbp)
324static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp) 352static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
325{ 353{
326 return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \ 354 return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
@@ -329,7 +357,6 @@ static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
329 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT)); 357 ((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
330} 358}
331 359
332#define XFS_SB_VERSION_ADDATTR(sbp) xfs_sb_version_addattr(sbp)
333static inline void xfs_sb_version_addattr(xfs_sb_t *sbp) 360static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
334{ 361{
335 (sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \ 362 (sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
@@ -339,7 +366,6 @@ static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
339 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT))); 366 (XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)));
340} 367}
341 368
342#define XFS_SB_VERSION_HASNLINK(sbp) xfs_sb_version_hasnlink(sbp)
343static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp) 369static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
344{ 370{
345 return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \ 371 return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
@@ -347,7 +373,6 @@ static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
347 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT)); 373 ((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
348} 374}
349 375
350#define XFS_SB_VERSION_ADDNLINK(sbp) xfs_sb_version_addnlink(sbp)
351static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp) 376static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
352{ 377{
353 (sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \ 378 (sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
@@ -355,115 +380,63 @@ static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
355 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT)); 380 ((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT));
356} 381}
357 382
358#define XFS_SB_VERSION_HASQUOTA(sbp) xfs_sb_version_hasquota(sbp)
359static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp) 383static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
360{ 384{
361 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 385 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
362 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT); 386 ((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
363} 387}
364 388
365#define XFS_SB_VERSION_ADDQUOTA(sbp) xfs_sb_version_addquota(sbp)
366static inline void xfs_sb_version_addquota(xfs_sb_t *sbp) 389static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
367{ 390{
368 (sbp)->sb_versionnum = \ 391 (sbp)->sb_versionnum = \
369 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \ 392 (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
370 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \ 393 ((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
371 (XFS_SB_VERSION_TONEW((sbp)->sb_versionnum) | \ 394 (xfs_sb_version_tonew((sbp)->sb_versionnum) | \
372 XFS_SB_VERSION_QUOTABIT)); 395 XFS_SB_VERSION_QUOTABIT));
373} 396}
374 397
375#define XFS_SB_VERSION_HASALIGN(sbp) xfs_sb_version_hasalign(sbp)
376static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp) 398static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
377{ 399{
378 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 400 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
379 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT); 401 ((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT);
380} 402}
381 403
382#define XFS_SB_VERSION_SUBALIGN(sbp) xfs_sb_version_subalign(sbp)
383static inline void xfs_sb_version_subalign(xfs_sb_t *sbp)
384{
385 (sbp)->sb_versionnum = \
386 XFS_SB_VERSION_TOOLD((sbp)->sb_versionnum & ~XFS_SB_VERSION_ALIGNBIT);
387}
388
389#define XFS_SB_VERSION_HASDALIGN(sbp) xfs_sb_version_hasdalign(sbp)
390static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp) 404static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
391{ 405{
392 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 406 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
393 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT); 407 ((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
394} 408}
395 409
396#define XFS_SB_VERSION_ADDDALIGN(sbp) xfs_sb_version_adddalign(sbp)
397static inline int xfs_sb_version_adddalign(xfs_sb_t *sbp)
398{
399 return (sbp)->sb_versionnum = \
400 ((sbp)->sb_versionnum | XFS_SB_VERSION_DALIGNBIT);
401}
402
403#define XFS_SB_VERSION_HASSHARED(sbp) xfs_sb_version_hasshared(sbp)
404static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp) 410static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
405{ 411{
406 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 412 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
407 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT); 413 ((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
408} 414}
409 415
410#define XFS_SB_VERSION_ADDSHARED(sbp) xfs_sb_version_addshared(sbp)
411static inline int xfs_sb_version_addshared(xfs_sb_t *sbp)
412{
413 return (sbp)->sb_versionnum = \
414 ((sbp)->sb_versionnum | XFS_SB_VERSION_SHAREDBIT);
415}
416
417#define XFS_SB_VERSION_SUBSHARED(sbp) xfs_sb_version_subshared(sbp)
418static inline int xfs_sb_version_subshared(xfs_sb_t *sbp)
419{
420 return (sbp)->sb_versionnum = \
421 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_SHAREDBIT);
422}
423
424#define XFS_SB_VERSION_HASDIRV2(sbp) xfs_sb_version_hasdirv2(sbp)
425static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp) 416static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
426{ 417{
427 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 418 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
428 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT); 419 ((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT);
429} 420}
430 421
431#define XFS_SB_VERSION_HASLOGV2(sbp) xfs_sb_version_haslogv2(sbp)
432static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp) 422static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
433{ 423{
434 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 424 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
435 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT); 425 ((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
436} 426}
437 427
438#define XFS_SB_VERSION_HASEXTFLGBIT(sbp) xfs_sb_version_hasextflgbit(sbp)
439static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp) 428static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
440{ 429{
441 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 430 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
442 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT); 431 ((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
443} 432}
444 433
445#define XFS_SB_VERSION_ADDEXTFLGBIT(sbp) xfs_sb_version_addextflgbit(sbp)
446static inline int xfs_sb_version_addextflgbit(xfs_sb_t *sbp)
447{
448 return (sbp)->sb_versionnum = \
449 ((sbp)->sb_versionnum | XFS_SB_VERSION_EXTFLGBIT);
450}
451
452#define XFS_SB_VERSION_SUBEXTFLGBIT(sbp) xfs_sb_version_subextflgbit(sbp)
453static inline int xfs_sb_version_subextflgbit(xfs_sb_t *sbp)
454{
455 return (sbp)->sb_versionnum = \
456 ((sbp)->sb_versionnum & ~XFS_SB_VERSION_EXTFLGBIT);
457}
458
459#define XFS_SB_VERSION_HASSECTOR(sbp) xfs_sb_version_hassector(sbp)
460static inline int xfs_sb_version_hassector(xfs_sb_t *sbp) 434static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
461{ 435{
462 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 436 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
463 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT); 437 ((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
464} 438}
465 439
466#define XFS_SB_VERSION_HASMOREBITS(sbp) xfs_sb_version_hasmorebits(sbp)
467static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp) 440static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
468{ 441{
469 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \ 442 return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
@@ -476,24 +449,22 @@ static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
476 * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro: 449 * For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro:
477 * 450 *
478 * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp) 451 * SB_VERSION_HASFUNBIT(xfs_sb_t *sbp)
479 * ((XFS_SB_VERSION_HASMOREBITS(sbp) && 452 * ((xfs_sb_version_hasmorebits(sbp) &&
480 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT) 453 * ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
481 */ 454 */
482 455
483static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp) 456static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp)
484{ 457{
485 return (XFS_SB_VERSION_HASMOREBITS(sbp) && \ 458 return (xfs_sb_version_hasmorebits(sbp) && \
486 ((sbp)->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT)); 459 ((sbp)->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
487} 460}
488 461
489#define XFS_SB_VERSION_HASATTR2(sbp) xfs_sb_version_hasattr2(sbp)
490static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp) 462static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
491{ 463{
492 return (XFS_SB_VERSION_HASMOREBITS(sbp)) && \ 464 return (xfs_sb_version_hasmorebits(sbp)) && \
493 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT); 465 ((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT);
494} 466}
495 467
496#define XFS_SB_VERSION_ADDATTR2(sbp) xfs_sb_version_addattr2(sbp)
497static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp) 468static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
498{ 469{
499 ((sbp)->sb_versionnum = \ 470 ((sbp)->sb_versionnum = \
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c
index 45d740df53b7..18a85e746680 100644
--- a/fs/xfs/xfs_utils.c
+++ b/fs/xfs/xfs_utils.c
@@ -339,10 +339,10 @@ xfs_bump_ino_vers2(
339 ip->i_d.di_onlink = 0; 339 ip->i_d.di_onlink = 0;
340 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); 340 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
341 mp = tp->t_mountp; 341 mp = tp->t_mountp;
342 if (!XFS_SB_VERSION_HASNLINK(&mp->m_sb)) { 342 if (!xfs_sb_version_hasnlink(&mp->m_sb)) {
343 spin_lock(&mp->m_sb_lock); 343 spin_lock(&mp->m_sb_lock);
344 if (!XFS_SB_VERSION_HASNLINK(&mp->m_sb)) { 344 if (!xfs_sb_version_hasnlink(&mp->m_sb)) {
345 XFS_SB_VERSION_ADDNLINK(&mp->m_sb); 345 xfs_sb_version_addnlink(&mp->m_sb);
346 spin_unlock(&mp->m_sb_lock); 346 spin_unlock(&mp->m_sb_lock);
347 xfs_mod_sb(tp, XFS_SB_VERSIONNUM); 347 xfs_mod_sb(tp, XFS_SB_VERSIONNUM);
348 } else { 348 } else {
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 7321304a69cc..7094caff13cf 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -330,7 +330,7 @@ xfs_finish_flags(
330 int ronly = (mp->m_flags & XFS_MOUNT_RDONLY); 330 int ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
331 331
332 /* Fail a mount where the logbuf is smaller then the log stripe */ 332 /* Fail a mount where the logbuf is smaller then the log stripe */
333 if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) { 333 if (xfs_sb_version_haslogv2(&mp->m_sb)) {
334 if ((ap->logbufsize <= 0) && 334 if ((ap->logbufsize <= 0) &&
335 (mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE)) { 335 (mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE)) {
336 mp->m_logbsize = mp->m_sb.sb_logsunit; 336 mp->m_logbsize = mp->m_sb.sb_logsunit;
@@ -349,9 +349,8 @@ xfs_finish_flags(
349 } 349 }
350 } 350 }
351 351
352 if (XFS_SB_VERSION_HASATTR2(&mp->m_sb)) { 352 if (xfs_sb_version_hasattr2(&mp->m_sb))
353 mp->m_flags |= XFS_MOUNT_ATTR2; 353 mp->m_flags |= XFS_MOUNT_ATTR2;
354 }
355 354
356 /* 355 /*
357 * prohibit r/w mounts of read-only filesystems 356 * prohibit r/w mounts of read-only filesystems
@@ -366,7 +365,7 @@ xfs_finish_flags(
366 * check for shared mount. 365 * check for shared mount.
367 */ 366 */
368 if (ap->flags & XFSMNT_SHARED) { 367 if (ap->flags & XFSMNT_SHARED) {
369 if (!XFS_SB_VERSION_HASSHARED(&mp->m_sb)) 368 if (!xfs_sb_version_hasshared(&mp->m_sb))
370 return XFS_ERROR(EINVAL); 369 return XFS_ERROR(EINVAL);
371 370
372 /* 371 /*
@@ -512,7 +511,7 @@ xfs_mount(
512 if (!error && logdev && logdev != ddev) { 511 if (!error && logdev && logdev != ddev) {
513 unsigned int log_sector_size = BBSIZE; 512 unsigned int log_sector_size = BBSIZE;
514 513
515 if (XFS_SB_VERSION_HASSECTOR(&mp->m_sb)) 514 if (xfs_sb_version_hassector(&mp->m_sb))
516 log_sector_size = mp->m_sb.sb_logsectsize; 515 log_sector_size = mp->m_sb.sb_logsectsize;
517 error = xfs_setsize_buftarg(mp->m_logdev_targp, 516 error = xfs_setsize_buftarg(mp->m_logdev_targp,
518 mp->m_sb.sb_blocksize, 517 mp->m_sb.sb_blocksize,
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 51305242ff8c..64c5953feca4 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -4132,7 +4132,7 @@ xfs_free_file_space(
4132 * actually need to zero the extent edges. Otherwise xfs_bunmapi 4132 * actually need to zero the extent edges. Otherwise xfs_bunmapi
4133 * will take care of it for us. 4133 * will take care of it for us.
4134 */ 4134 */
4135 if (rt && !XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb)) { 4135 if (rt && !xfs_sb_version_hasextflgbit(&mp->m_sb)) {
4136 nimap = 1; 4136 nimap = 1;
4137 error = xfs_bmapi(NULL, ip, startoffset_fsb, 4137 error = xfs_bmapi(NULL, ip, startoffset_fsb,
4138 1, 0, NULL, 0, &imap, &nimap, NULL, NULL); 4138 1, 0, NULL, 0, &imap, &nimap, NULL, NULL);
diff --git a/include/asm-arm/arch-s3c2410/spi.h b/include/asm-arm/arch-s3c2410/spi.h
index 7ca0ed97a6d0..352d33860b63 100644
--- a/include/asm-arm/arch-s3c2410/spi.h
+++ b/include/asm-arm/arch-s3c2410/spi.h
@@ -15,6 +15,7 @@
15 15
16struct s3c2410_spi_info { 16struct s3c2410_spi_info {
17 unsigned long pin_cs; /* simple gpio cs */ 17 unsigned long pin_cs; /* simple gpio cs */
18 unsigned int num_cs; /* total chipselects */
18 19
19 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); 20 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
20}; 21};
diff --git a/include/asm-frv/mem-layout.h b/include/asm-frv/mem-layout.h
index 83532252b8be..734a1d0583b6 100644
--- a/include/asm-frv/mem-layout.h
+++ b/include/asm-frv/mem-layout.h
@@ -60,7 +60,7 @@
60 */ 60 */
61#define BRK_BASE __UL(2 * 1024 * 1024 + PAGE_SIZE) 61#define BRK_BASE __UL(2 * 1024 * 1024 + PAGE_SIZE)
62#define STACK_TOP __UL(2 * 1024 * 1024) 62#define STACK_TOP __UL(2 * 1024 * 1024)
63#define STACK_TOP_MAX STACK_TOP 63#define STACK_TOP_MAX __UL(0xc0000000)
64 64
65/* userspace process size */ 65/* userspace process size */
66#ifdef CONFIG_MMU 66#ifdef CONFIG_MMU
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 6c0682ed5fc9..4e219046fe42 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -507,13 +507,22 @@ static inline int pte_file(pte_t pte)
507 */ 507 */
508static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte) 508static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
509{ 509{
510 struct mm_struct *mm;
510 unsigned long ampr; 511 unsigned long ampr;
511 pgd_t *pge = pgd_offset(current->mm, address);
512 pud_t *pue = pud_offset(pge, address);
513 pmd_t *pme = pmd_offset(pue, address);
514 512
515 ampr = pme->ste[0] & 0xffffff00; 513 mm = current->mm;
516 ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | xAMPRx_V; 514 if (mm) {
515 pgd_t *pge = pgd_offset(mm, address);
516 pud_t *pue = pud_offset(pge, address);
517 pmd_t *pme = pmd_offset(pue, address);
518
519 ampr = pme->ste[0] & 0xffffff00;
520 ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C |
521 xAMPRx_V;
522 } else {
523 address = ULONG_MAX;
524 ampr = 0;
525 }
517 526
518 asm volatile("movgs %0,scr0\n" 527 asm volatile("movgs %0,scr0\n"
519 "movgs %0,scr1\n" 528 "movgs %0,scr1\n"
diff --git a/include/asm-frv/spr-regs.h b/include/asm-frv/spr-regs.h
index c2a541ef828d..01e6af5e99b8 100644
--- a/include/asm-frv/spr-regs.h
+++ b/include/asm-frv/spr-regs.h
@@ -99,9 +99,23 @@
99#define TBR_TT_TRAP1 (0x81 << 4) 99#define TBR_TT_TRAP1 (0x81 << 4)
100#define TBR_TT_TRAP2 (0x82 << 4) 100#define TBR_TT_TRAP2 (0x82 << 4)
101#define TBR_TT_TRAP3 (0x83 << 4) 101#define TBR_TT_TRAP3 (0x83 << 4)
102#define TBR_TT_TRAP120 (0xf8 << 4)
103#define TBR_TT_TRAP121 (0xf9 << 4)
104#define TBR_TT_TRAP122 (0xfa << 4)
105#define TBR_TT_TRAP123 (0xfb << 4)
106#define TBR_TT_TRAP124 (0xfc << 4)
107#define TBR_TT_TRAP125 (0xfd << 4)
102#define TBR_TT_TRAP126 (0xfe << 4) 108#define TBR_TT_TRAP126 (0xfe << 4)
103#define TBR_TT_BREAK (0xff << 4) 109#define TBR_TT_BREAK (0xff << 4)
104 110
111#define TBR_TT_ATOMIC_CMPXCHG32 TBR_TT_TRAP120
112#define TBR_TT_ATOMIC_XCHG32 TBR_TT_TRAP121
113#define TBR_TT_ATOMIC_XOR TBR_TT_TRAP122
114#define TBR_TT_ATOMIC_OR TBR_TT_TRAP123
115#define TBR_TT_ATOMIC_AND TBR_TT_TRAP124
116#define TBR_TT_ATOMIC_SUB TBR_TT_TRAP125
117#define TBR_TT_ATOMIC_ADD TBR_TT_TRAP126
118
105#define __get_TBR() ({ unsigned long x; asm volatile("movsg tbr,%0" : "=r"(x)); x; }) 119#define __get_TBR() ({ unsigned long x; asm volatile("movsg tbr,%0" : "=r"(x)); x; })
106 120
107/* 121/*
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index 2c57f4734746..30a67a9da11a 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -179,14 +179,23 @@ do { \
179#define mb() asm volatile ("membar" : : :"memory") 179#define mb() asm volatile ("membar" : : :"memory")
180#define rmb() asm volatile ("membar" : : :"memory") 180#define rmb() asm volatile ("membar" : : :"memory")
181#define wmb() asm volatile ("membar" : : :"memory") 181#define wmb() asm volatile ("membar" : : :"memory")
182#define set_mb(var, value) do { var = value; mb(); } while (0) 182#define read_barrier_depends() barrier()
183 183
184#define smp_mb() mb() 184#ifdef CONFIG_SMP
185#define smp_rmb() rmb() 185#define smp_mb() mb()
186#define smp_wmb() wmb() 186#define smp_rmb() rmb()
187 187#define smp_wmb() wmb()
188#define read_barrier_depends() do {} while(0)
189#define smp_read_barrier_depends() read_barrier_depends() 188#define smp_read_barrier_depends() read_barrier_depends()
189#define set_mb(var, value) \
190 do { xchg(&var, (value)); } while (0)
191#else
192#define smp_mb() barrier()
193#define smp_rmb() barrier()
194#define smp_wmb() barrier()
195#define smp_read_barrier_depends() do {} while(0)
196#define set_mb(var, value) \
197 do { var = (value); barrier(); } while (0)
198#endif
190 199
191#define HARD_RESET_NOW() \ 200#define HARD_RESET_NOW() \
192do { \ 201do { \
diff --git a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h
index cd1cc39b5599..fcfad326f4c7 100644
--- a/include/asm-ia64/acpi.h
+++ b/include/asm-ia64/acpi.h
@@ -35,6 +35,7 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/numa.h> 36#include <linux/numa.h>
37#include <asm/system.h> 37#include <asm/system.h>
38#include <asm/numa.h>
38 39
39#define COMPILER_DEPENDENT_INT64 long 40#define COMPILER_DEPENDENT_INT64 long
40#define COMPILER_DEPENDENT_UINT64 unsigned long 41#define COMPILER_DEPENDENT_UINT64 unsigned long
@@ -115,7 +116,11 @@ extern unsigned int is_cpu_cpei_target(unsigned int cpu);
115extern void set_cpei_target_cpu(unsigned int cpu); 116extern void set_cpei_target_cpu(unsigned int cpu);
116extern unsigned int get_cpei_target_cpu(void); 117extern unsigned int get_cpei_target_cpu(void);
117extern void prefill_possible_map(void); 118extern void prefill_possible_map(void);
119#ifdef CONFIG_ACPI_HOTPLUG_CPU
118extern int additional_cpus; 120extern int additional_cpus;
121#else
122#define additional_cpus 0
123#endif
119 124
120#ifdef CONFIG_ACPI_NUMA 125#ifdef CONFIG_ACPI_NUMA
121#if MAX_NUMNODES > 256 126#if MAX_NUMNODES > 256
@@ -129,6 +134,34 @@ extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
129 134
130#define acpi_unlazy_tlb(x) 135#define acpi_unlazy_tlb(x)
131 136
137#ifdef CONFIG_ACPI_NUMA
138extern cpumask_t early_cpu_possible_map;
139#define for_each_possible_early_cpu(cpu) \
140 for_each_cpu_mask((cpu), early_cpu_possible_map)
141
142static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
143{
144 int low_cpu, high_cpu;
145 int cpu;
146 int next_nid = 0;
147
148 low_cpu = cpus_weight(early_cpu_possible_map);
149
150 high_cpu = max(low_cpu, min_cpus);
151 high_cpu = min(high_cpu + reserve_cpus, NR_CPUS);
152
153 for (cpu = low_cpu; cpu < high_cpu; cpu++) {
154 cpu_set(cpu, early_cpu_possible_map);
155 if (node_cpuid[cpu].nid == NUMA_NO_NODE) {
156 node_cpuid[cpu].nid = next_nid;
157 next_nid++;
158 if (next_nid >= num_online_nodes())
159 next_nid = 0;
160 }
161 }
162}
163#endif /* CONFIG_ACPI_NUMA */
164
132#endif /*__KERNEL__*/ 165#endif /*__KERNEL__*/
133 166
134#endif /*_ASM_ACPI_H*/ 167#endif /*_ASM_ACPI_H*/
diff --git a/include/asm-ia64/cputime.h b/include/asm-ia64/cputime.h
index 72400a78002a..f9abdec6577a 100644
--- a/include/asm-ia64/cputime.h
+++ b/include/asm-ia64/cputime.h
@@ -1,6 +1,110 @@
1/*
2 * include/asm-ia64/cputime.h:
3 * Definitions for measuring cputime on ia64 machines.
4 *
5 * Based on <asm-powerpc/cputime.h>.
6 *
7 * Copyright (C) 2007 FUJITSU LIMITED
8 * Copyright (C) 2007 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 *
15 * If we have CONFIG_VIRT_CPU_ACCOUNTING, we measure cpu time in nsec.
16 * Otherwise we measure cpu time in jiffies using the generic definitions.
17 */
18
1#ifndef __IA64_CPUTIME_H 19#ifndef __IA64_CPUTIME_H
2#define __IA64_CPUTIME_H 20#define __IA64_CPUTIME_H
3 21
22#ifndef CONFIG_VIRT_CPU_ACCOUNTING
4#include <asm-generic/cputime.h> 23#include <asm-generic/cputime.h>
24#else
25
26#include <linux/time.h>
27#include <linux/jiffies.h>
28#include <asm/processor.h>
29
30typedef u64 cputime_t;
31typedef u64 cputime64_t;
32
33#define cputime_zero ((cputime_t)0)
34#define cputime_max ((~((cputime_t)0) >> 1) - 1)
35#define cputime_add(__a, __b) ((__a) + (__b))
36#define cputime_sub(__a, __b) ((__a) - (__b))
37#define cputime_div(__a, __n) ((__a) / (__n))
38#define cputime_halve(__a) ((__a) >> 1)
39#define cputime_eq(__a, __b) ((__a) == (__b))
40#define cputime_gt(__a, __b) ((__a) > (__b))
41#define cputime_ge(__a, __b) ((__a) >= (__b))
42#define cputime_lt(__a, __b) ((__a) < (__b))
43#define cputime_le(__a, __b) ((__a) <= (__b))
44
45#define cputime64_zero ((cputime64_t)0)
46#define cputime64_add(__a, __b) ((__a) + (__b))
47#define cputime64_sub(__a, __b) ((__a) - (__b))
48#define cputime_to_cputime64(__ct) (__ct)
49
50/*
51 * Convert cputime <-> jiffies (HZ)
52 */
53#define cputime_to_jiffies(__ct) ((__ct) / (NSEC_PER_SEC / HZ))
54#define jiffies_to_cputime(__jif) ((__jif) * (NSEC_PER_SEC / HZ))
55#define cputime64_to_jiffies64(__ct) ((__ct) / (NSEC_PER_SEC / HZ))
56#define jiffies64_to_cputime64(__jif) ((__jif) * (NSEC_PER_SEC / HZ))
57
58/*
59 * Convert cputime <-> milliseconds
60 */
61#define cputime_to_msecs(__ct) ((__ct) / NSEC_PER_MSEC)
62#define msecs_to_cputime(__msecs) ((__msecs) * NSEC_PER_MSEC)
63
64/*
65 * Convert cputime <-> seconds
66 */
67#define cputime_to_secs(__ct) ((__ct) / NSEC_PER_SEC)
68#define secs_to_cputime(__secs) ((__secs) * NSEC_PER_SEC)
69
70/*
71 * Convert cputime <-> timespec (nsec)
72 */
73static inline cputime_t timespec_to_cputime(const struct timespec *val)
74{
75 cputime_t ret = val->tv_sec * NSEC_PER_SEC;
76 return (ret + val->tv_nsec);
77}
78static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
79{
80 val->tv_sec = ct / NSEC_PER_SEC;
81 val->tv_nsec = ct % NSEC_PER_SEC;
82}
83
84/*
85 * Convert cputime <-> timeval (msec)
86 */
87static inline cputime_t timeval_to_cputime(struct timeval *val)
88{
89 cputime_t ret = val->tv_sec * NSEC_PER_SEC;
90 return (ret + val->tv_usec * NSEC_PER_USEC);
91}
92static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
93{
94 val->tv_sec = ct / NSEC_PER_SEC;
95 val->tv_usec = (ct % NSEC_PER_SEC) / NSEC_PER_USEC;
96}
97
98/*
99 * Convert cputime <-> clock (USER_HZ)
100 */
101#define cputime_to_clock_t(__ct) ((__ct) / (NSEC_PER_SEC / USER_HZ))
102#define clock_t_to_cputime(__x) ((__x) * (NSEC_PER_SEC / USER_HZ))
103
104/*
105 * Convert cputime64 to clock.
106 */
107#define cputime64_to_clock_t(__ct) cputime_to_clock_t((cputime_t)__ct)
5 108
109#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
6#endif /* __IA64_CPUTIME_H */ 110#endif /* __IA64_CPUTIME_H */
diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h
index f8e83eca67a2..5e0c1a6bce8d 100644
--- a/include/asm-ia64/elf.h
+++ b/include/asm-ia64/elf.h
@@ -26,6 +26,7 @@
26#define ELF_ARCH EM_IA_64 26#define ELF_ARCH EM_IA_64
27 27
28#define USE_ELF_CORE_DUMP 28#define USE_ELF_CORE_DUMP
29#define CORE_DUMP_USE_REGSET
29 30
30/* Least-significant four bits of ELF header's e_flags are OS-specific. The bits are 31/* Least-significant four bits of ELF header's e_flags are OS-specific. The bits are
31 interpreted as follows by Linux: */ 32 interpreted as follows by Linux: */
@@ -154,6 +155,30 @@ extern void ia64_init_addr_space (void);
154#define ELF_NGREG 128 /* we really need just 72 but let's leave some headroom... */ 155#define ELF_NGREG 128 /* we really need just 72 but let's leave some headroom... */
155#define ELF_NFPREG 128 /* f0 and f1 could be omitted, but so what... */ 156#define ELF_NFPREG 128 /* f0 and f1 could be omitted, but so what... */
156 157
158/* elf_gregset_t register offsets */
159#define ELF_GR_0_OFFSET 0
160#define ELF_NAT_OFFSET (32 * sizeof(elf_greg_t))
161#define ELF_PR_OFFSET (33 * sizeof(elf_greg_t))
162#define ELF_BR_0_OFFSET (34 * sizeof(elf_greg_t))
163#define ELF_CR_IIP_OFFSET (42 * sizeof(elf_greg_t))
164#define ELF_CFM_OFFSET (43 * sizeof(elf_greg_t))
165#define ELF_CR_IPSR_OFFSET (44 * sizeof(elf_greg_t))
166#define ELF_GR_OFFSET(i) (ELF_GR_0_OFFSET + i * sizeof(elf_greg_t))
167#define ELF_BR_OFFSET(i) (ELF_BR_0_OFFSET + i * sizeof(elf_greg_t))
168#define ELF_AR_RSC_OFFSET (45 * sizeof(elf_greg_t))
169#define ELF_AR_BSP_OFFSET (46 * sizeof(elf_greg_t))
170#define ELF_AR_BSPSTORE_OFFSET (47 * sizeof(elf_greg_t))
171#define ELF_AR_RNAT_OFFSET (48 * sizeof(elf_greg_t))
172#define ELF_AR_CCV_OFFSET (49 * sizeof(elf_greg_t))
173#define ELF_AR_UNAT_OFFSET (50 * sizeof(elf_greg_t))
174#define ELF_AR_FPSR_OFFSET (51 * sizeof(elf_greg_t))
175#define ELF_AR_PFS_OFFSET (52 * sizeof(elf_greg_t))
176#define ELF_AR_LC_OFFSET (53 * sizeof(elf_greg_t))
177#define ELF_AR_EC_OFFSET (54 * sizeof(elf_greg_t))
178#define ELF_AR_CSD_OFFSET (55 * sizeof(elf_greg_t))
179#define ELF_AR_SSD_OFFSET (56 * sizeof(elf_greg_t))
180#define ELF_AR_END_OFFSET (57 * sizeof(elf_greg_t))
181
157typedef unsigned long elf_fpxregset_t; 182typedef unsigned long elf_fpxregset_t;
158 183
159typedef unsigned long elf_greg_t; 184typedef unsigned long elf_greg_t;
@@ -183,12 +208,6 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
183 208
184struct task_struct; 209struct task_struct;
185 210
186extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
187extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
188
189#define ELF_CORE_COPY_TASK_REGS(tsk, elf_gregs) dump_task_regs(tsk, elf_gregs)
190#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
191
192#define GATE_EHDR ((const struct elfhdr *) GATE_ADDR) 211#define GATE_EHDR ((const struct elfhdr *) GATE_ADDR)
193 212
194/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ 213/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
diff --git a/include/asm-ia64/kregs.h b/include/asm-ia64/kregs.h
index 7e55a584975c..aefcdfee7f23 100644
--- a/include/asm-ia64/kregs.h
+++ b/include/asm-ia64/kregs.h
@@ -31,6 +31,9 @@
31#define IA64_TR_PALCODE 1 /* itr1: maps PALcode as required by EFI */ 31#define IA64_TR_PALCODE 1 /* itr1: maps PALcode as required by EFI */
32#define IA64_TR_CURRENT_STACK 1 /* dtr1: maps kernel's memory- & register-stacks */ 32#define IA64_TR_CURRENT_STACK 1 /* dtr1: maps kernel's memory- & register-stacks */
33 33
34#define IA64_TR_ALLOC_BASE 2 /* itr&dtr: Base of dynamic TR resource*/
35#define IA64_TR_ALLOC_MAX 32 /* Max number for dynamic use*/
36
34/* Processor status register bits: */ 37/* Processor status register bits: */
35#define IA64_PSR_BE_BIT 1 38#define IA64_PSR_BE_BIT 1
36#define IA64_PSR_UP_BIT 2 39#define IA64_PSR_UP_BIT 2
diff --git a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
index 6a8a27cfae3e..3499ff57bf42 100644
--- a/include/asm-ia64/numa.h
+++ b/include/asm-ia64/numa.h
@@ -22,6 +22,8 @@
22 22
23#include <asm/mmzone.h> 23#include <asm/mmzone.h>
24 24
25#define NUMA_NO_NODE -1
26
25extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned; 27extern u16 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
26extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; 28extern cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
27extern pg_data_t *pgdat_list[MAX_NUMNODES]; 29extern pg_data_t *pgdat_list[MAX_NUMNODES];
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index f4904db3b057..89594b442f83 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -296,6 +296,9 @@ enum {
296 EFI_GUID(0xe429faf8, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81) 296 EFI_GUID(0xe429faf8, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
297#define SAL_PLAT_BUS_ERR_SECT_GUID \ 297#define SAL_PLAT_BUS_ERR_SECT_GUID \
298 EFI_GUID(0xe429faf9, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81) 298 EFI_GUID(0xe429faf9, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
299#define PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID \
300 EFI_GUID(0x6cb0a200, 0x893a, 0x11da, 0x96, 0xd2, 0x0, 0x10, 0x83, 0xff, \
301 0xca, 0x4d)
299 302
300#define MAX_CACHE_ERRORS 6 303#define MAX_CACHE_ERRORS 6
301#define MAX_TLB_ERRORS 6 304#define MAX_TLB_ERRORS 6
@@ -879,6 +882,24 @@ extern void ia64_jump_to_sal(struct sal_to_os_boot *);
879 882
880extern void ia64_sal_handler_init(void *entry_point, void *gpval); 883extern void ia64_sal_handler_init(void *entry_point, void *gpval);
881 884
885#define PALO_MAX_TLB_PURGES 0xFFFF
886#define PALO_SIG "PALO"
887
888struct palo_table {
889 u8 signature[4]; /* Should be "PALO" */
890 u32 length;
891 u8 minor_revision;
892 u8 major_revision;
893 u8 checksum;
894 u8 reserved1[5];
895 u16 max_tlb_purges;
896 u8 reserved2[6];
897};
898
899#define NPTCG_FROM_PAL 0
900#define NPTCG_FROM_PALO 1
901#define NPTCG_FROM_KERNEL_PARAMETER 2
902
882#endif /* __ASSEMBLY__ */ 903#endif /* __ASSEMBLY__ */
883 904
884#endif /* _ASM_IA64_SAL_H */ 905#endif /* _ASM_IA64_SAL_H */
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 4fa733dd417a..ec5f355fb7e3 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -38,6 +38,9 @@ ia64_get_lid (void)
38 return lid.f.id << 8 | lid.f.eid; 38 return lid.f.id << 8 | lid.f.eid;
39} 39}
40 40
41extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
42 void *info, int wait);
43
41#define hard_smp_processor_id() ia64_get_lid() 44#define hard_smp_processor_id() ia64_get_lid()
42 45
43#ifdef CONFIG_SMP 46#ifdef CONFIG_SMP
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index 595112bca3cc..dff8128fa58e 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -210,6 +210,13 @@ struct task_struct;
210extern void ia64_save_extra (struct task_struct *task); 210extern void ia64_save_extra (struct task_struct *task);
211extern void ia64_load_extra (struct task_struct *task); 211extern void ia64_load_extra (struct task_struct *task);
212 212
213#ifdef CONFIG_VIRT_CPU_ACCOUNTING
214extern void ia64_account_on_switch (struct task_struct *prev, struct task_struct *next);
215# define IA64_ACCOUNT_ON_SWITCH(p,n) ia64_account_on_switch(p,n)
216#else
217# define IA64_ACCOUNT_ON_SWITCH(p,n)
218#endif
219
213#ifdef CONFIG_PERFMON 220#ifdef CONFIG_PERFMON
214 DECLARE_PER_CPU(unsigned long, pfm_syst_info); 221 DECLARE_PER_CPU(unsigned long, pfm_syst_info);
215# define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info) & 0x1) 222# define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info) & 0x1)
@@ -222,6 +229,7 @@ extern void ia64_load_extra (struct task_struct *task);
222 || IS_IA32_PROCESS(task_pt_regs(t)) || PERFMON_IS_SYSWIDE()) 229 || IS_IA32_PROCESS(task_pt_regs(t)) || PERFMON_IS_SYSWIDE())
223 230
224#define __switch_to(prev,next,last) do { \ 231#define __switch_to(prev,next,last) do { \
232 IA64_ACCOUNT_ON_SWITCH(prev, next); \
225 if (IA64_HAS_EXTRA_STATE(prev)) \ 233 if (IA64_HAS_EXTRA_STATE(prev)) \
226 ia64_save_extra(prev); \ 234 ia64_save_extra(prev); \
227 if (IA64_HAS_EXTRA_STATE(next)) \ 235 if (IA64_HAS_EXTRA_STATE(next)) \
@@ -266,6 +274,10 @@ void cpu_idle_wait(void);
266 274
267void default_idle(void); 275void default_idle(void);
268 276
277#ifdef CONFIG_VIRT_CPU_ACCOUNTING
278extern void account_system_vtime(struct task_struct *);
279#endif
280
269#endif /* __KERNEL__ */ 281#endif /* __KERNEL__ */
270 282
271#endif /* __ASSEMBLY__ */ 283#endif /* __ASSEMBLY__ */
diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h
index 93d83cbe0c8c..6da8069a0f77 100644
--- a/include/asm-ia64/thread_info.h
+++ b/include/asm-ia64/thread_info.h
@@ -31,6 +31,12 @@ struct thread_info {
31 mm_segment_t addr_limit; /* user-level address space limit */ 31 mm_segment_t addr_limit; /* user-level address space limit */
32 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */ 32 int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
33 struct restart_block restart_block; 33 struct restart_block restart_block;
34#ifdef CONFIG_VIRT_CPU_ACCOUNTING
35 __u64 ac_stamp;
36 __u64 ac_leave;
37 __u64 ac_stime;
38 __u64 ac_utime;
39#endif
34}; 40};
35 41
36#define THREAD_SIZE KERNEL_STACK_SIZE 42#define THREAD_SIZE KERNEL_STACK_SIZE
@@ -62,9 +68,17 @@ struct thread_info {
62#define task_stack_page(tsk) ((void *)(tsk)) 68#define task_stack_page(tsk) ((void *)(tsk))
63 69
64#define __HAVE_THREAD_FUNCTIONS 70#define __HAVE_THREAD_FUNCTIONS
71#ifdef CONFIG_VIRT_CPU_ACCOUNTING
72#define setup_thread_stack(p, org) \
73 *task_thread_info(p) = *task_thread_info(org); \
74 task_thread_info(p)->ac_stime = 0; \
75 task_thread_info(p)->ac_utime = 0; \
76 task_thread_info(p)->task = (p);
77#else
65#define setup_thread_stack(p, org) \ 78#define setup_thread_stack(p, org) \
66 *task_thread_info(p) = *task_thread_info(org); \ 79 *task_thread_info(p) = *task_thread_info(org); \
67 task_thread_info(p)->task = (p); 80 task_thread_info(p)->task = (p);
81#endif
68#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET) 82#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
69 83
70#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR 84#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
diff --git a/include/asm-ia64/tlb.h b/include/asm-ia64/tlb.h
index 26edcb750f9f..20d8a39680c2 100644
--- a/include/asm-ia64/tlb.h
+++ b/include/asm-ia64/tlb.h
@@ -64,6 +64,32 @@ struct mmu_gather {
64 struct page *pages[FREE_PTE_NR]; 64 struct page *pages[FREE_PTE_NR];
65}; 65};
66 66
67struct ia64_tr_entry {
68 u64 ifa;
69 u64 itir;
70 u64 pte;
71 u64 rr;
72}; /*Record for tr entry!*/
73
74extern int ia64_itr_entry(u64 target_mask, u64 va, u64 pte, u64 log_size);
75extern void ia64_ptr_entry(u64 target_mask, int slot);
76
77extern struct ia64_tr_entry __per_cpu_idtrs[NR_CPUS][2][IA64_TR_ALLOC_MAX];
78
79/*
80 region register macros
81*/
82#define RR_TO_VE(val) (((val) >> 0) & 0x0000000000000001)
83#define RR_VE(val) (((val) & 0x0000000000000001) << 0)
84#define RR_VE_MASK 0x0000000000000001L
85#define RR_VE_SHIFT 0
86#define RR_TO_PS(val) (((val) >> 2) & 0x000000000000003f)
87#define RR_PS(val) (((val) & 0x000000000000003f) << 2)
88#define RR_PS_MASK 0x00000000000000fcL
89#define RR_PS_SHIFT 2
90#define RR_RID_MASK 0x00000000ffffff00L
91#define RR_TO_RID(val) ((val >> 8) & 0xffffff)
92
67/* Users of the generic TLB shootdown code must declare this storage space. */ 93/* Users of the generic TLB shootdown code must declare this storage space. */
68DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); 94DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
69 95
diff --git a/include/asm-ia64/tlbflush.h b/include/asm-ia64/tlbflush.h
index 7774a1cac0cc..3be25dfed164 100644
--- a/include/asm-ia64/tlbflush.h
+++ b/include/asm-ia64/tlbflush.h
@@ -17,6 +17,7 @@
17 * Now for some TLB flushing routines. This is the kind of stuff that 17 * Now for some TLB flushing routines. This is the kind of stuff that
18 * can be very expensive, so try to avoid them whenever possible. 18 * can be very expensive, so try to avoid them whenever possible.
19 */ 19 */
20extern void setup_ptcg_sem(int max_purges, int from_palo);
20 21
21/* 22/*
22 * Flush everything (kernel mapping may also have changed due to 23 * Flush everything (kernel mapping may also have changed due to
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h
index e4fe26c160ba..89655c0cdcd6 100644
--- a/include/asm-mips/mach-au1x00/au1xxx_ide.h
+++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h
@@ -122,24 +122,6 @@ static const struct drive_list_entry dma_black_list [] = {
122}; 122};
123#endif 123#endif
124 124
125/* function prototyping */
126u8 auide_inb(unsigned long port);
127u16 auide_inw(unsigned long port);
128u32 auide_inl(unsigned long port);
129void auide_insw(unsigned long port, void *addr, u32 count);
130void auide_insl(unsigned long port, void *addr, u32 count);
131void auide_outb(u8 addr, unsigned long port);
132void auide_outbsync(ide_drive_t *drive, u8 addr, unsigned long port);
133void auide_outw(u16 addr, unsigned long port);
134void auide_outl(u32 addr, unsigned long port);
135void auide_outsw(unsigned long port, void *addr, u32 count);
136void auide_outsl(unsigned long port, void *addr, u32 count);
137static void auide_tune_drive(ide_drive_t *drive, byte pio);
138static int auide_tune_chipset(ide_drive_t *drive, u8 speed);
139static int auide_ddma_init( _auide_hwif *auide );
140static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif);
141int __init auide_probe(void);
142
143/******************************************************************************* 125/*******************************************************************************
144* PIO Mode timing calculation : * 126* PIO Mode timing calculation : *
145* * 127* *
diff --git a/include/asm-mips/mach-db1x00/db1200.h b/include/asm-mips/mach-db1x00/db1200.h
index a6bdac61ab49..d2e28e64932e 100644
--- a/include/asm-mips/mach-db1x00/db1200.h
+++ b/include/asm-mips/mach-db1x00/db1200.h
@@ -173,8 +173,8 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
173#define AU1XXX_SMC91111_IRQ DB1200_ETH_INT 173#define AU1XXX_SMC91111_IRQ DB1200_ETH_INT
174 174
175#define AU1XXX_ATA_PHYS_ADDR (0x18800000) 175#define AU1XXX_ATA_PHYS_ADDR (0x18800000)
176#define AU1XXX_ATA_PHYS_LEN (0x100) 176#define AU1XXX_ATA_REG_OFFSET (5)
177#define AU1XXX_ATA_REG_OFFSET (5) 177#define AU1XXX_ATA_PHYS_LEN (16 << AU1XXX_ATA_REG_OFFSET)
178#define AU1XXX_ATA_INT DB1200_IDE_INT 178#define AU1XXX_ATA_INT DB1200_IDE_INT
179#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1; 179#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1;
180#define AU1XXX_ATA_RQSIZE 128 180#define AU1XXX_ATA_RQSIZE 128
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
index 72213e3d02c7..edaa489b58f1 100644
--- a/include/asm-mips/mach-pb1x00/pb1200.h
+++ b/include/asm-mips/mach-pb1x00/pb1200.h
@@ -186,8 +186,8 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
186#define AU1XXX_SMC91111_IRQ PB1200_ETH_INT 186#define AU1XXX_SMC91111_IRQ PB1200_ETH_INT
187 187
188#define AU1XXX_ATA_PHYS_ADDR (0x0C800000) 188#define AU1XXX_ATA_PHYS_ADDR (0x0C800000)
189#define AU1XXX_ATA_PHYS_LEN (0x100) 189#define AU1XXX_ATA_REG_OFFSET (5)
190#define AU1XXX_ATA_REG_OFFSET (5) 190#define AU1XXX_ATA_PHYS_LEN (16 << AU1XXX_ATA_REG_OFFSET)
191#define AU1XXX_ATA_INT PB1200_IDE_INT 191#define AU1XXX_ATA_INT PB1200_IDE_INT
192#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1; 192#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1;
193#define AU1XXX_ATA_RQSIZE 128 193#define AU1XXX_ATA_RQSIZE 128
diff --git a/include/asm-um/tlb.h b/include/asm-um/tlb.h
index 39fc475df6c9..5240fa1c5e08 100644
--- a/include/asm-um/tlb.h
+++ b/include/asm-um/tlb.h
@@ -1,6 +1,7 @@
1#ifndef __UM_TLB_H 1#ifndef __UM_TLB_H
2#define __UM_TLB_H 2#define __UM_TLB_H
3 3
4#include <linux/pagemap.h>
4#include <linux/swap.h> 5#include <linux/swap.h>
5#include <asm/percpu.h> 6#include <asm/percpu.h>
6#include <asm/pgalloc.h> 7#include <asm/pgalloc.h>
diff --git a/include/asm-x86/linkage.h b/include/asm-x86/linkage.h
index 31739c7d66a9..c048353f4b85 100644
--- a/include/asm-x86/linkage.h
+++ b/include/asm-x86/linkage.h
@@ -8,12 +8,45 @@
8 8
9#ifdef CONFIG_X86_32 9#ifdef CONFIG_X86_32
10#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) 10#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
11#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret))
12/* 11/*
13 * For 32-bit UML - mark functions implemented in assembly that use 12 * For 32-bit UML - mark functions implemented in assembly that use
14 * regparm input parameters: 13 * regparm input parameters:
15 */ 14 */
16#define asmregparm __attribute__((regparm(3))) 15#define asmregparm __attribute__((regparm(3)))
16
17/*
18 * Make sure the compiler doesn't do anything stupid with the
19 * arguments on the stack - they are owned by the *caller*, not
20 * the callee. This just fools gcc into not spilling into them,
21 * and keeps it from doing tailcall recursion and/or using the
22 * stack slots for temporaries, since they are live and "used"
23 * all the way to the end of the function.
24 *
25 * NOTE! On x86-64, all the arguments are in registers, so this
26 * only matters on a 32-bit kernel.
27 */
28#define asmlinkage_protect(n, ret, args...) \
29 __asmlinkage_protect##n(ret, ##args)
30#define __asmlinkage_protect_n(ret, args...) \
31 __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
32#define __asmlinkage_protect0(ret) \
33 __asmlinkage_protect_n(ret)
34#define __asmlinkage_protect1(ret, arg1) \
35 __asmlinkage_protect_n(ret, "g" (arg1))
36#define __asmlinkage_protect2(ret, arg1, arg2) \
37 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2))
38#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
39 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3))
40#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
41 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
42 "g" (arg4))
43#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
44 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
45 "g" (arg4), "g" (arg5))
46#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
47 __asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
48 "g" (arg4), "g" (arg5), "g" (arg6))
49
17#endif 50#endif
18 51
19#ifdef CONFIG_X86_ALIGNMENT_16 52#ifdef CONFIG_X86_ALIGNMENT_16
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 9cdd12a9e843..cedbbd806bf6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -86,6 +86,7 @@ header-y += if_plip.h
86header-y += if_ppp.h 86header-y += if_ppp.h
87header-y += if_slip.h 87header-y += if_slip.h
88header-y += if_strip.h 88header-y += if_strip.h
89header-y += if_tun.h
89header-y += if_tunnel.h 90header-y += if_tunnel.h
90header-y += in6.h 91header-y += in6.h
91header-y += in_route.h 92header-y += in_route.h
@@ -229,7 +230,6 @@ unifdef-y += if_link.h
229unifdef-y += if_pppol2tp.h 230unifdef-y += if_pppol2tp.h
230unifdef-y += if_pppox.h 231unifdef-y += if_pppox.h
231unifdef-y += if_tr.h 232unifdef-y += if_tr.h
232unifdef-y += if_tun.h
233unifdef-y += if_vlan.h 233unifdef-y += if_vlan.h
234unifdef-y += if_wanpipe.h 234unifdef-y += if_wanpipe.h
235unifdef-y += igmp.h 235unifdef-y += igmp.h
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 72f1c5f47be3..8c71fe2fb1f5 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -18,47 +18,8 @@
18#ifndef __IF_TUN_H 18#ifndef __IF_TUN_H
19#define __IF_TUN_H 19#define __IF_TUN_H
20 20
21/* Uncomment to enable debugging */
22/* #define TUN_DEBUG 1 */
23
24#include <linux/types.h> 21#include <linux/types.h>
25 22
26#ifdef __KERNEL__
27
28#ifdef TUN_DEBUG
29#define DBG if(tun->debug)printk
30#define DBG1 if(debug==2)printk
31#else
32#define DBG( a... )
33#define DBG1( a... )
34#endif
35
36struct tun_struct {
37 struct list_head list;
38 unsigned long flags;
39 int attached;
40 uid_t owner;
41 gid_t group;
42
43 wait_queue_head_t read_wait;
44 struct sk_buff_head readq;
45
46 struct net_device *dev;
47
48 struct fasync_struct *fasync;
49
50 unsigned long if_flags;
51 u8 dev_addr[ETH_ALEN];
52 u32 chr_filter[2];
53 u32 net_filter[2];
54
55#ifdef TUN_DEBUG
56 int debug;
57#endif
58};
59
60#endif /* __KERNEL__ */
61
62/* Read queue size */ 23/* Read queue size */
63#define TUN_READQ_SIZE 500 24#define TUN_READQ_SIZE 500
64 25
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index cac4b364cd40..2b7a1187cb29 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -91,8 +91,10 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
91 * if ref count is zero, don't allow sharing (ioc is going away, it's 91 * if ref count is zero, don't allow sharing (ioc is going away, it's
92 * a race). 92 * a race).
93 */ 93 */
94 if (ioc && atomic_inc_not_zero(&ioc->refcount)) 94 if (ioc && atomic_inc_not_zero(&ioc->refcount)) {
95 atomic_inc(&ioc->nr_tasks);
95 return ioc; 96 return ioc;
97 }
96 98
97 return NULL; 99 return NULL;
98} 100}
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 4aaefc349a4b..134c8e5cf07c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,7 +53,7 @@ struct ipv6_opt_hdr {
53 /* 53 /*
54 * TLV encoded option data follows. 54 * TLV encoded option data follows.
55 */ 55 */
56}; 56} __attribute__ ((packed)); /* required for some archs */
57 57
58#define ipv6_destopt_hdr ipv6_opt_hdr 58#define ipv6_destopt_hdr ipv6_opt_hdr
59#define ipv6_hopopt_hdr ipv6_opt_hdr 59#define ipv6_hopopt_hdr ipv6_opt_hdr
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 0592936344c4..2119610b24f8 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -17,8 +17,24 @@
17# define asmregparm 17# define asmregparm
18#endif 18#endif
19 19
20#ifndef prevent_tail_call 20/*
21# define prevent_tail_call(ret) do { } while (0) 21 * This is used by architectures to keep arguments on the stack
22 * untouched by the compiler by keeping them live until the end.
23 * The argument stack may be owned by the assembly-language
24 * caller, not the callee, and gcc doesn't always understand
25 * that.
26 *
27 * We have the return value, and a maximum of six arguments.
28 *
29 * This should always be followed by a "return ret" for the
30 * protection to work (ie no more work that the compiler might
31 * end up needing stack temporaries for).
32 */
33/* Assembly files may be compiled with -traditional .. */
34#ifndef __ASSEMBLY__
35#ifndef asmlinkage_protect
36# define asmlinkage_protect(n, ret, args...) do { } while (0)
37#endif
22#endif 38#endif
23 39
24#ifndef __ALIGN 40#ifndef __ALIGN
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 99e044b4efc6..a09b84e4fdb4 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -34,7 +34,7 @@ void mb_cache_destroy(struct mb_cache *);
34 34
35/* Functions on cache entries */ 35/* Functions on cache entries */
36 36
37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *); 37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, 38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
39 sector_t, unsigned int[]); 39 sector_t, unsigned int[]);
40void mb_cache_entry_release(struct mb_cache_entry *); 40void mb_cache_entry_release(struct mb_cache_entry *);
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 29dd55838e84..b2f05c230f4b 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -175,7 +175,7 @@ static inline void pnp_set_card_drvdata(struct pnp_card_link *pcard, void *data)
175struct pnp_dev { 175struct pnp_dev {
176 struct device dev; /* Driver Model device interface */ 176 struct device dev; /* Driver Model device interface */
177 u64 dma_mask; 177 u64 dma_mask;
178 unsigned char number; /* used as an index, must be unique */ 178 unsigned int number; /* used as an index, must be unique */
179 int status; 179 int status;
180 180
181 struct list_head global_list; /* node in global list of devices */ 181 struct list_head global_list; /* node in global list of devices */
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 576a5f77d3bd..1129ee0a7180 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -341,6 +341,9 @@ static inline void double_spin_unlock(spinlock_t *l1, spinlock_t *l2,
341 * atomic_dec_and_lock - lock on reaching reference count zero 341 * atomic_dec_and_lock - lock on reaching reference count zero
342 * @atomic: the atomic counter 342 * @atomic: the atomic counter
343 * @lock: the spinlock in question 343 * @lock: the spinlock in question
344 *
345 * Decrements @atomic by 1. If the result is 0, returns true and locks
346 * @lock. Returns false for all other cases.
344 */ 347 */
345extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock); 348extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
346#define atomic_dec_and_lock(atomic, lock) \ 349#define atomic_dec_and_lock(atomic, lock) \
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 20add65215af..db53defde5ee 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -129,6 +129,10 @@ struct ssb_device {
129 const struct ssb_bus_ops *ops; 129 const struct ssb_bus_ops *ops;
130 130
131 struct device *dev; 131 struct device *dev;
132 /* Pointer to the device that has to be used for
133 * any DMA related operation. */
134 struct device *dma_dev;
135
132 struct ssb_bus *bus; 136 struct ssb_bus *bus;
133 struct ssb_device_id id; 137 struct ssb_device_id id;
134 138
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 818ca1cf0b6d..90c1c191ea69 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -50,7 +50,7 @@ struct thermal_cooling_device_ops {
50}; 50};
51 51
52#define THERMAL_TRIPS_NONE -1 52#define THERMAL_TRIPS_NONE -1
53#define THERMAL_MAX_TRIPS 10 53#define THERMAL_MAX_TRIPS 12
54#define THERMAL_NAME_LENGTH 20 54#define THERMAL_NAME_LENGTH 20
55struct thermal_cooling_device { 55struct thermal_cooling_device {
56 int id; 56 int id;
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index ba33db053854..7040a782c656 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -47,7 +47,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
47 } while (0) 47 } while (0)
48 48
49#define IP6_ECN_flow_xmit(sk, label) do { \ 49#define IP6_ECN_flow_xmit(sk, label) do { \
50 if (INET_ECN_is_capable(inet_sk(sk)->tos)) \ 50 if (INET_ECN_is_capable(inet6_sk(sk)->tclass)) \
51 (label) |= htonl(INET_ECN_ECT_0 << 20); \ 51 (label) |= htonl(INET_ECN_ECT_0 << 20); \
52 } while (0) 52 } while (0)
53 53
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 10ae2da6f93b..35b1e83fb96a 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -104,6 +104,7 @@ typedef enum {
104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ 104 SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */
105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ 105 SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */
106 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ 106 SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */
107 SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */
107 SCTP_CMD_LAST 108 SCTP_CMD_LAST
108} sctp_verb_t; 109} sctp_verb_t;
109 110
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 9bcfc12275e8..7ea12e8e6676 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -67,7 +67,7 @@ struct sctp_ulpevent {
67}; 67};
68 68
69/* Retrieve the skb this event sits inside of. */ 69/* Retrieve the skb this event sits inside of. */
70static inline struct sk_buff *sctp_event2skb(struct sctp_ulpevent *ev) 70static inline struct sk_buff *sctp_event2skb(const struct sctp_ulpevent *ev)
71{ 71{
72 return container_of((void *)ev, struct sk_buff, cb); 72 return container_of((void *)ev, struct sk_buff, cb);
73} 73}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7de4ea3a04d9..4fd3eb2f8ec2 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -752,6 +752,8 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
752 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out; 752 return tp->packets_out - tcp_left_out(tp) + tp->retrans_out;
753} 753}
754 754
755extern int tcp_limit_reno_sacked(struct tcp_sock *tp);
756
755/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 757/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
756 * The exception is rate halving phase, when cwnd is decreasing towards 758 * The exception is rate halving phase, when cwnd is decreasing towards
757 * ssthresh. 759 * ssthresh.
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 62f1a5231fe9..2727f9238359 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2569,6 +2569,7 @@ static int proc_cgroup_show(struct seq_file *m, void *v)
2569 /* Skip this hierarchy if it has no active subsystems */ 2569 /* Skip this hierarchy if it has no active subsystems */
2570 if (!root->actual_subsys_bits) 2570 if (!root->actual_subsys_bits)
2571 continue; 2571 continue;
2572 seq_printf(m, "%lu:", root->subsys_bits);
2572 for_each_subsys(root, ss) 2573 for_each_subsys(root, ss)
2573 seq_printf(m, "%s%s", count++ ? "," : "", ss->name); 2574 seq_printf(m, "%s%s", count++ ? "," : "", ss->name);
2574 seq_putc(m, ':'); 2575 seq_putc(m, ':');
diff --git a/kernel/exit.c b/kernel/exit.c
index 53872bf993fa..073005b1cfb2 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1608,7 +1608,7 @@ asmlinkage long sys_waitid(int which, pid_t upid,
1608 put_pid(pid); 1608 put_pid(pid);
1609 1609
1610 /* avoid REGPARM breakage on x86: */ 1610 /* avoid REGPARM breakage on x86: */
1611 prevent_tail_call(ret); 1611 asmlinkage_protect(5, ret, which, upid, infop, options, ru);
1612 return ret; 1612 return ret;
1613} 1613}
1614 1614
@@ -1640,7 +1640,7 @@ asmlinkage long sys_wait4(pid_t upid, int __user *stat_addr,
1640 put_pid(pid); 1640 put_pid(pid);
1641 1641
1642 /* avoid REGPARM breakage on x86: */ 1642 /* avoid REGPARM breakage on x86: */
1643 prevent_tail_call(ret); 1643 asmlinkage_protect(4, ret, upid, stat_addr, options, ru);
1644 return ret; 1644 return ret;
1645} 1645}
1646 1646
diff --git a/kernel/printk.c b/kernel/printk.c
index c46a20a19a15..bdd4ea8c3f2b 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -643,8 +643,21 @@ static int acquire_console_semaphore_for_printk(unsigned int cpu)
643{ 643{
644 int retval = 0; 644 int retval = 0;
645 645
646 if (can_use_console(cpu)) 646 if (!try_acquire_console_sem()) {
647 retval = !try_acquire_console_sem(); 647 retval = 1;
648
649 /*
650 * If we can't use the console, we need to release
651 * the console semaphore by hand to avoid flushing
652 * the buffer. We need to hold the console semaphore
653 * in order to do this test safely.
654 */
655 if (!can_use_console(cpu)) {
656 console_locked = 0;
657 up(&console_sem);
658 retval = 0;
659 }
660 }
648 printk_cpu = UINT_MAX; 661 printk_cpu = UINT_MAX;
649 spin_unlock(&logbuf_lock); 662 spin_unlock(&logbuf_lock);
650 return retval; 663 return retval;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 86a93376282c..0080968d3e4a 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -510,10 +510,8 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
510 510
511 if (!initial) { 511 if (!initial) {
512 /* sleeps upto a single latency don't count. */ 512 /* sleeps upto a single latency don't count. */
513 if (sched_feat(NEW_FAIR_SLEEPERS)) { 513 if (sched_feat(NEW_FAIR_SLEEPERS))
514 vruntime -= calc_delta_fair(sysctl_sched_latency, 514 vruntime -= sysctl_sched_latency;
515 &cfs_rq->load);
516 }
517 515
518 /* ensure we never gain time by being placed backwards. */ 516 /* ensure we never gain time by being placed backwards. */
519 vruntime = max_vruntime(se->vruntime, vruntime); 517 vruntime = max_vruntime(se->vruntime, vruntime);
diff --git a/kernel/uid16.c b/kernel/uid16.c
index dd308ba4e03b..3e41c1673e2f 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -21,7 +21,7 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gi
21{ 21{
22 long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); 22 long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
23 /* avoid REGPARM breakage on x86: */ 23 /* avoid REGPARM breakage on x86: */
24 prevent_tail_call(ret); 24 asmlinkage_protect(3, ret, filename, user, group);
25 return ret; 25 return ret;
26} 26}
27 27
@@ -29,7 +29,7 @@ asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_g
29{ 29{
30 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); 30 long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
31 /* avoid REGPARM breakage on x86: */ 31 /* avoid REGPARM breakage on x86: */
32 prevent_tail_call(ret); 32 asmlinkage_protect(3, ret, filename, user, group);
33 return ret; 33 return ret;
34} 34}
35 35
@@ -37,7 +37,7 @@ asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
37{ 37{
38 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); 38 long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
39 /* avoid REGPARM breakage on x86: */ 39 /* avoid REGPARM breakage on x86: */
40 prevent_tail_call(ret); 40 asmlinkage_protect(3, ret, fd, user, group);
41 return ret; 41 return ret;
42} 42}
43 43
@@ -45,7 +45,7 @@ asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
45{ 45{
46 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); 46 long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
47 /* avoid REGPARM breakage on x86: */ 47 /* avoid REGPARM breakage on x86: */
48 prevent_tail_call(ret); 48 asmlinkage_protect(2, ret, rgid, egid);
49 return ret; 49 return ret;
50} 50}
51 51
@@ -53,7 +53,7 @@ asmlinkage long sys_setgid16(old_gid_t gid)
53{ 53{
54 long ret = sys_setgid(low2highgid(gid)); 54 long ret = sys_setgid(low2highgid(gid));
55 /* avoid REGPARM breakage on x86: */ 55 /* avoid REGPARM breakage on x86: */
56 prevent_tail_call(ret); 56 asmlinkage_protect(1, ret, gid);
57 return ret; 57 return ret;
58} 58}
59 59
@@ -61,7 +61,7 @@ asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
61{ 61{
62 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); 62 long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
63 /* avoid REGPARM breakage on x86: */ 63 /* avoid REGPARM breakage on x86: */
64 prevent_tail_call(ret); 64 asmlinkage_protect(2, ret, ruid, euid);
65 return ret; 65 return ret;
66} 66}
67 67
@@ -69,7 +69,7 @@ asmlinkage long sys_setuid16(old_uid_t uid)
69{ 69{
70 long ret = sys_setuid(low2highuid(uid)); 70 long ret = sys_setuid(low2highuid(uid));
71 /* avoid REGPARM breakage on x86: */ 71 /* avoid REGPARM breakage on x86: */
72 prevent_tail_call(ret); 72 asmlinkage_protect(1, ret, uid);
73 return ret; 73 return ret;
74} 74}
75 75
@@ -78,7 +78,7 @@ asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid)
78 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), 78 long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
79 low2highuid(suid)); 79 low2highuid(suid));
80 /* avoid REGPARM breakage on x86: */ 80 /* avoid REGPARM breakage on x86: */
81 prevent_tail_call(ret); 81 asmlinkage_protect(3, ret, ruid, euid, suid);
82 return ret; 82 return ret;
83} 83}
84 84
@@ -98,7 +98,7 @@ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid)
98 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), 98 long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
99 low2highgid(sgid)); 99 low2highgid(sgid));
100 /* avoid REGPARM breakage on x86: */ 100 /* avoid REGPARM breakage on x86: */
101 prevent_tail_call(ret); 101 asmlinkage_protect(3, ret, rgid, egid, sgid);
102 return ret; 102 return ret;
103} 103}
104 104
@@ -117,7 +117,7 @@ asmlinkage long sys_setfsuid16(old_uid_t uid)
117{ 117{
118 long ret = sys_setfsuid(low2highuid(uid)); 118 long ret = sys_setfsuid(low2highuid(uid));
119 /* avoid REGPARM breakage on x86: */ 119 /* avoid REGPARM breakage on x86: */
120 prevent_tail_call(ret); 120 asmlinkage_protect(1, ret, uid);
121 return ret; 121 return ret;
122} 122}
123 123
@@ -125,7 +125,7 @@ asmlinkage long sys_setfsgid16(old_gid_t gid)
125{ 125{
126 long ret = sys_setfsgid(low2highgid(gid)); 126 long ret = sys_setfsgid(low2highgid(gid));
127 /* avoid REGPARM breakage on x86: */ 127 /* avoid REGPARM breakage on x86: */
128 prevent_tail_call(ret); 128 asmlinkage_protect(1, ret, gid);
129 return ret; 129 return ret;
130} 130}
131 131
diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c
index 9dc7056e5520..77f0f9b775a9 100644
--- a/lib/lzo/lzo1x_decompress.c
+++ b/lib/lzo/lzo1x_decompress.c
@@ -158,7 +158,7 @@ match:
158 t += 7 + *ip++; 158 t += 7 + *ip++;
159 } 159 }
160 m_pos -= le16_to_cpu(get_unaligned( 160 m_pos -= le16_to_cpu(get_unaligned(
161 (const unsigned short *)ip) >> 2); 161 (const unsigned short *)ip)) >> 2;
162 ip += 2; 162 ip += 2;
163 if (m_pos == op) 163 if (m_pos == op)
164 goto eof_found; 164 goto eof_found;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 23b5fa4cabd8..2e0bfc93484b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -978,7 +978,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
978{ 978{
979 struct mem_cgroup_per_node *pn; 979 struct mem_cgroup_per_node *pn;
980 struct mem_cgroup_per_zone *mz; 980 struct mem_cgroup_per_zone *mz;
981 int zone; 981 int zone, tmp = node;
982 /* 982 /*
983 * This routine is called against possible nodes. 983 * This routine is called against possible nodes.
984 * But it's BUG to call kmalloc() against offline node. 984 * But it's BUG to call kmalloc() against offline node.
@@ -987,10 +987,9 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
987 * never be onlined. It's better to use memory hotplug callback 987 * never be onlined. It's better to use memory hotplug callback
988 * function. 988 * function.
989 */ 989 */
990 if (node_state(node, N_HIGH_MEMORY)) 990 if (!node_state(node, N_NORMAL_MEMORY))
991 pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node); 991 tmp = -1;
992 else 992 pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, tmp);
993 pn = kmalloc(sizeof(*pn), GFP_KERNEL);
994 if (!pn) 993 if (!pn)
995 return 1; 994 return 1;
996 995
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index f255eda693b0..beb592fe9389 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -423,7 +423,7 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask)
423 struct task_struct *p; 423 struct task_struct *p;
424 424
425 cgroup_lock(); 425 cgroup_lock();
426 rcu_read_lock(); 426 read_lock(&tasklist_lock);
427retry: 427retry:
428 p = select_bad_process(&points, mem); 428 p = select_bad_process(&points, mem);
429 if (PTR_ERR(p) == -1UL) 429 if (PTR_ERR(p) == -1UL)
@@ -436,7 +436,7 @@ retry:
436 "Memory cgroup out of memory")) 436 "Memory cgroup out of memory"))
437 goto retry; 437 goto retry;
438out: 438out:
439 rcu_read_unlock(); 439 read_unlock(&tasklist_lock);
440 cgroup_unlock(); 440 cgroup_unlock();
441} 441}
442#endif 442#endif
diff --git a/mm/sparse.c b/mm/sparse.c
index f6a43c09c322..98d6b39c3472 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -149,8 +149,18 @@ static inline int sparse_early_nid(struct mem_section *section)
149/* Record a memory area against a node. */ 149/* Record a memory area against a node. */
150void __init memory_present(int nid, unsigned long start, unsigned long end) 150void __init memory_present(int nid, unsigned long start, unsigned long end)
151{ 151{
152 unsigned long max_arch_pfn = 1UL << (MAX_PHYSMEM_BITS-PAGE_SHIFT);
152 unsigned long pfn; 153 unsigned long pfn;
153 154
155 /*
156 * Sanity checks - do not allow an architecture to pass
157 * in larger pfns than the maximum scope of sparsemem:
158 */
159 if (start >= max_arch_pfn)
160 return;
161 if (end >= max_arch_pfn)
162 end = max_arch_pfn;
163
154 start &= PAGE_SECTION_MASK; 164 start &= PAGE_SECTION_MASK;
155 for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) { 165 for (pfn = start; pfn < end; pfn += PAGES_PER_SECTION) {
156 unsigned long section = pfn_to_section_nr(pfn); 166 unsigned long section = pfn_to_section_nr(pfn);
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 422d960ffcd8..7c7286e9506d 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -388,6 +388,7 @@ static char * const migratetype_names[MIGRATE_TYPES] = {
388 "Reclaimable", 388 "Reclaimable",
389 "Movable", 389 "Movable",
390 "Reserve", 390 "Reserve",
391 "Isolate",
391}; 392};
392 393
393static void *frag_start(struct seq_file *m, loff_t *pos) 394static void *frag_start(struct seq_file *m, loff_t *pos)
diff --git a/net/atm/lec.c b/net/atm/lec.c
index a2efa7ff41f1..3235c57615e4 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -266,7 +266,6 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
266 char buf[300]; 266 char buf[300];
267 int i = 0; 267 int i = 0;
268#endif /* DUMP_PACKETS >0 */ 268#endif /* DUMP_PACKETS >0 */
269 DECLARE_MAC_BUF(mac);
270 269
271 pr_debug("lec_start_xmit called\n"); 270 pr_debug("lec_start_xmit called\n");
272 if (!priv->lecd) { 271 if (!priv->lecd) {
@@ -374,15 +373,19 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
374 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) { 373 if (entry && (entry->tx_wait.qlen < LEC_UNRES_QUE_LEN)) {
375 pr_debug("%s:lec_start_xmit: queuing packet, ", 374 pr_debug("%s:lec_start_xmit: queuing packet, ",
376 dev->name); 375 dev->name);
377 pr_debug("MAC address %s\n", 376 pr_debug("MAC address " MAC_FMT "\n",
378 print_mac(mac, lec_h->h_dest)); 377 lec_h->h_dest[0], lec_h->h_dest[1],
378 lec_h->h_dest[2], lec_h->h_dest[3],
379 lec_h->h_dest[4], lec_h->h_dest[5]);
379 skb_queue_tail(&entry->tx_wait, skb); 380 skb_queue_tail(&entry->tx_wait, skb);
380 } else { 381 } else {
381 pr_debug 382 pr_debug
382 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ", 383 ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
383 dev->name); 384 dev->name);
384 pr_debug("MAC address %s\n", 385 pr_debug("MAC address " MAC_FMT "\n",
385 print_mac(mac, lec_h->h_dest)); 386 lec_h->h_dest[0], lec_h->h_dest[1],
387 lec_h->h_dest[2], lec_h->h_dest[3],
388 lec_h->h_dest[4], lec_h->h_dest[5]);
386 priv->stats.tx_dropped++; 389 priv->stats.tx_dropped++;
387 dev_kfree_skb(skb); 390 dev_kfree_skb(skb);
388 } 391 }
@@ -394,8 +397,10 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
394 397
395 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) { 398 while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
396 pr_debug("lec.c: emptying tx queue, "); 399 pr_debug("lec.c: emptying tx queue, ");
397 pr_debug("MAC address %s\n", 400 pr_debug("MAC address " MAC_FMT "\n",
398 print_mac(mac, lec_h->h_dest)); 401 lec_h->h_dest[0], lec_h->h_dest[1],
402 lec_h->h_dest[2], lec_h->h_dest[3],
403 lec_h->h_dest[4], lec_h->h_dest[5]);
399 lec_send(vcc, skb2, priv); 404 lec_send(vcc, skb2, priv);
400 } 405 }
401 406
@@ -449,7 +454,6 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
449 struct lec_arp_table *entry; 454 struct lec_arp_table *entry;
450 int i; 455 int i;
451 char *tmp; /* FIXME */ 456 char *tmp; /* FIXME */
452 DECLARE_MAC_BUF(mac);
453 457
454 atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc); 458 atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
455 mesg = (struct atmlec_msg *)skb->data; 459 mesg = (struct atmlec_msg *)skb->data;
@@ -536,9 +540,14 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
536 struct net_bridge_fdb_entry *f; 540 struct net_bridge_fdb_entry *f;
537 541
538 pr_debug 542 pr_debug
539 ("%s: bridge zeppelin asks about %s\n", 543 ("%s: bridge zeppelin asks about " MAC_FMT "\n",
540 dev->name, 544 dev->name,
541 print_mac(mac, mesg->content.proxy.mac_addr)); 545 mesg->content.proxy.mac_addr[0],
546 mesg->content.proxy.mac_addr[1],
547 mesg->content.proxy.mac_addr[2],
548 mesg->content.proxy.mac_addr[3],
549 mesg->content.proxy.mac_addr[4],
550 mesg->content.proxy.mac_addr[5]);
542 551
543 if (br_fdb_get_hook == NULL || dev->br_port == NULL) 552 if (br_fdb_get_hook == NULL || dev->br_port == NULL)
544 break; 553 break;
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 5f4eb73fb9d3..57aeba729bae 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -218,9 +218,11 @@ void __exit ax25_uid_free(void)
218 struct hlist_node *node; 218 struct hlist_node *node;
219 219
220 write_lock(&ax25_uid_lock); 220 write_lock(&ax25_uid_lock);
221again:
221 ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) { 222 ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) {
222 hlist_del_init(&ax25_uid->uid_node); 223 hlist_del_init(&ax25_uid->uid_node);
223 ax25_uid_put(ax25_uid); 224 ax25_uid_put(ax25_uid);
225 goto again;
224 } 226 }
225 write_unlock(&ax25_uid_lock); 227 write_unlock(&ax25_uid_lock);
226} 228}
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 1c0efd8ad9f3..af7e8be8d8d2 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -110,7 +110,8 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
110 * ipt_REJECT needs it. Future netfilter modules might 110 * ipt_REJECT needs it. Future netfilter modules might
111 * require us to fill additional fields. */ 111 * require us to fill additional fields. */
112static struct net_device __fake_net_device = { 112static struct net_device __fake_net_device = {
113 .hard_header_len = ETH_HLEN 113 .hard_header_len = ETH_HLEN,
114 .nd_net = &init_net,
114}; 115};
115 116
116static struct rtable __fake_rtable = { 117static struct rtable __fake_rtable = {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 0d0fd28a9041..608701339620 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2131,8 +2131,8 @@ EXPORT_SYMBOL_GPL(skb_pull_rcsum);
2131 * @features: features for the output path (see dev->features) 2131 * @features: features for the output path (see dev->features)
2132 * 2132 *
2133 * This function performs segmentation on the given skb. It returns 2133 * This function performs segmentation on the given skb. It returns
2134 * the segment at the given position. It returns NULL if there are 2134 * a pointer to the first in a list of new skbs for the segments.
2135 * no more segments to generate, or when an error is encountered. 2135 * In case of error it returns ERR_PTR(err).
2136 */ 2136 */
2137struct sk_buff *skb_segment(struct sk_buff *skb, int features) 2137struct sk_buff *skb_segment(struct sk_buff *skb, int features)
2138{ 2138{
diff --git a/net/core/sock.c b/net/core/sock.c
index 2654c147c004..7a0567b4b2c9 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1725,7 +1725,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
1725 sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT; 1725 sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
1726 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; 1726 sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
1727 1727
1728 sk->sk_stamp = ktime_set(-1L, -1L); 1728 sk->sk_stamp = ktime_set(-1L, 0);
1729 1729
1730 atomic_set(&sk->sk_refcnt, 1); 1730 atomic_set(&sk->sk_refcnt, 1);
1731 atomic_set(&sk->sk_drops, 0); 1731 atomic_set(&sk->sk_drops, 0);
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 287a62bc2e0f..ba2ef94a2302 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -325,6 +325,12 @@ static inline int dccp_bad_service_code(const struct sock *sk,
325 * This is used for transmission as well as for reception. 325 * This is used for transmission as well as for reception.
326 */ 326 */
327struct dccp_skb_cb { 327struct dccp_skb_cb {
328 union {
329 struct inet_skb_parm h4;
330#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
331 struct inet6_skb_parm h6;
332#endif
333 } header;
328 __u8 dccpd_type:4; 334 __u8 dccpd_type:4;
329 __u8 dccpd_ccval:4; 335 __u8 dccpd_ccval:4;
330 __u8 dccpd_reset_code, 336 __u8 dccpd_reset_code,
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 474075adbde4..b33704415555 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -489,7 +489,6 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req,
489 489
490 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr, 490 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr,
491 ireq->rmt_addr); 491 ireq->rmt_addr);
492 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
493 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, 492 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
494 ireq->rmt_addr, 493 ireq->rmt_addr,
495 ireq->opt); 494 ireq->opt);
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 3b763db3d863..3d7d628d870d 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -126,7 +126,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
126 126
127 DCCP_INC_STATS(DCCP_MIB_OUTSEGS); 127 DCCP_INC_STATS(DCCP_MIB_OUTSEGS);
128 128
129 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
130 err = icsk->icsk_af_ops->queue_xmit(skb, 0); 129 err = icsk->icsk_af_ops->queue_xmit(skb, 0);
131 return net_xmit_eval(err); 130 return net_xmit_eval(err);
132 } 131 }
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index e3f5d37b84be..c91d3c1fd30d 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1057,6 +1057,9 @@ static int __init dccp_init(void)
1057 int ehash_order, bhash_order, i; 1057 int ehash_order, bhash_order, i;
1058 int rc = -ENOBUFS; 1058 int rc = -ENOBUFS;
1059 1059
1060 BUILD_BUG_ON(sizeof(struct dccp_skb_cb) >
1061 FIELD_SIZEOF(struct sk_buff, cb));
1062
1060 dccp_hashinfo.bind_bucket_cachep = 1063 dccp_hashinfo.bind_bucket_cachep =
1061 kmem_cache_create("dccp_bind_bucket", 1064 kmem_cache_create("dccp_bind_bucket",
1062 sizeof(struct inet_bind_bucket), 0, 1065 sizeof(struct inet_bind_bucket), 0,
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index a7b417523e9b..a80839b02e3f 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -301,7 +301,7 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu)
301static int eth_validate_addr(struct net_device *dev) 301static int eth_validate_addr(struct net_device *dev)
302{ 302{
303 if (!is_valid_ether_addr(dev->dev_addr)) 303 if (!is_valid_ether_addr(dev->dev_addr))
304 return -EINVAL; 304 return -EADDRNOTAVAIL;
305 305
306 return 0; 306 return 0;
307} 307}
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index 1e3f87c8c012..200ee1e63728 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -271,7 +271,6 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
271{ 271{
272 struct ieee80211_hdr_3addr *hdr; 272 struct ieee80211_hdr_3addr *hdr;
273 int res, hdrlen; 273 int res, hdrlen;
274 DECLARE_MAC_BUF(mac);
275 274
276 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL) 275 if (crypt == NULL || crypt->ops->decrypt_mpdu == NULL)
277 return 0; 276 return 0;
@@ -283,8 +282,12 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
283 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv); 282 res = crypt->ops->decrypt_mpdu(skb, hdrlen, crypt->priv);
284 atomic_dec(&crypt->refcnt); 283 atomic_dec(&crypt->refcnt);
285 if (res < 0) { 284 if (res < 0) {
286 IEEE80211_DEBUG_DROP("decryption failed (SA=%s" 285 IEEE80211_DEBUG_DROP("decryption failed (SA=" MAC_FMT
287 ") res=%d\n", print_mac(mac, hdr->addr2), res); 286 ") res=%d\n",
287 hdr->addr2[0], hdr->addr2[1],
288 hdr->addr2[2], hdr->addr2[3],
289 hdr->addr2[4], hdr->addr2[5],
290 res);
288 if (res == -2) 291 if (res == -2)
289 IEEE80211_DEBUG_DROP("Decryption failed ICV " 292 IEEE80211_DEBUG_DROP("Decryption failed ICV "
290 "mismatch (key %d)\n", 293 "mismatch (key %d)\n",
@@ -304,7 +307,6 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
304{ 307{
305 struct ieee80211_hdr_3addr *hdr; 308 struct ieee80211_hdr_3addr *hdr;
306 int res, hdrlen; 309 int res, hdrlen;
307 DECLARE_MAC_BUF(mac);
308 310
309 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL) 311 if (crypt == NULL || crypt->ops->decrypt_msdu == NULL)
310 return 0; 312 return 0;
@@ -317,8 +319,12 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee,
317 atomic_dec(&crypt->refcnt); 319 atomic_dec(&crypt->refcnt);
318 if (res < 0) { 320 if (res < 0) {
319 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" 321 printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
320 " (SA=%s keyidx=%d)\n", 322 " (SA=" MAC_FMT " keyidx=%d)\n",
321 ieee->dev->name, print_mac(mac, hdr->addr2), keyidx); 323 ieee->dev->name,
324 hdr->addr2[0], hdr->addr2[1],
325 hdr->addr2[2], hdr->addr2[3],
326 hdr->addr2[4], hdr->addr2[5],
327 keyidx);
322 return -1; 328 return -1;
323 } 329 }
324 330
@@ -462,8 +468,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
462 * frames silently instead of filling system log with 468 * frames silently instead of filling system log with
463 * these reports. */ 469 * these reports. */
464 IEEE80211_DEBUG_DROP("Decryption failed (not set)" 470 IEEE80211_DEBUG_DROP("Decryption failed (not set)"
465 " (SA=%s)\n", 471 " (SA=" MAC_FMT ")\n",
466 print_mac(mac, hdr->addr2)); 472 hdr->addr2[0], hdr->addr2[1],
473 hdr->addr2[2], hdr->addr2[3],
474 hdr->addr2[4], hdr->addr2[5]);
467 ieee->ieee_stats.rx_discards_undecryptable++; 475 ieee->ieee_stats.rx_discards_undecryptable++;
468 goto rx_dropped; 476 goto rx_dropped;
469 } 477 }
@@ -474,8 +482,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
474 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt && 482 fc & IEEE80211_FCTL_PROTECTED && ieee->host_decrypt &&
475 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) { 483 (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0) {
476 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth " 484 printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
477 "from %s\n", dev->name, 485 "from " MAC_FMT "\n", dev->name,
478 print_mac(mac, hdr->addr2)); 486 hdr->addr2[0], hdr->addr2[1],
487 hdr->addr2[2], hdr->addr2[3],
488 hdr->addr2[4], hdr->addr2[5]);
479 /* TODO: could inform hostapd about this so that it 489 /* TODO: could inform hostapd about this so that it
480 * could send auth failure report */ 490 * could send auth failure report */
481 goto rx_dropped; 491 goto rx_dropped;
@@ -653,8 +663,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
653 * configured */ 663 * configured */
654 } else { 664 } else {
655 IEEE80211_DEBUG_DROP("encryption configured, but RX " 665 IEEE80211_DEBUG_DROP("encryption configured, but RX "
656 "frame not encrypted (SA=%s" 666 "frame not encrypted (SA="
657 ")\n", print_mac(mac, hdr->addr2)); 667 MAC_FMT ")\n",
668 hdr->addr2[0], hdr->addr2[1],
669 hdr->addr2[2], hdr->addr2[3],
670 hdr->addr2[4], hdr->addr2[5]);
658 goto rx_dropped; 671 goto rx_dropped;
659 } 672 }
660 } 673 }
@@ -662,9 +675,11 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
662 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep && 675 if (crypt && !(fc & IEEE80211_FCTL_PROTECTED) && !ieee->open_wep &&
663 !ieee80211_is_eapol_frame(ieee, skb)) { 676 !ieee80211_is_eapol_frame(ieee, skb)) {
664 IEEE80211_DEBUG_DROP("dropped unencrypted RX data " 677 IEEE80211_DEBUG_DROP("dropped unencrypted RX data "
665 "frame from %s" 678 "frame from " MAC_FMT
666 " (drop_unencrypted=1)\n", 679 " (drop_unencrypted=1)\n",
667 print_mac(mac, hdr->addr2)); 680 hdr->addr2[0], hdr->addr2[1],
681 hdr->addr2[2], hdr->addr2[3],
682 hdr->addr2[4], hdr->addr2[5]);
668 goto rx_dropped; 683 goto rx_dropped;
669 } 684 }
670 685
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 9c7e5ffb223d..4670683b4688 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -160,7 +160,7 @@ config IP_PNP_DHCP
160 160
161 If unsure, say Y. Note that if you want to use DHCP, a DHCP server 161 If unsure, say Y. Note that if you want to use DHCP, a DHCP server
162 must be operating on your network. Read 162 must be operating on your network. Read
163 <file:Documentation/nfsroot.txt> for details. 163 <file:Documentation/filesystems/nfsroot.txt> for details.
164 164
165config IP_PNP_BOOTP 165config IP_PNP_BOOTP
166 bool "IP: BOOTP support" 166 bool "IP: BOOTP support"
@@ -175,7 +175,7 @@ config IP_PNP_BOOTP
175 does BOOTP itself, providing all necessary information on the kernel 175 does BOOTP itself, providing all necessary information on the kernel
176 command line, you can say N here. If unsure, say Y. Note that if you 176 command line, you can say N here. If unsure, say Y. Note that if you
177 want to use BOOTP, a BOOTP server must be operating on your network. 177 want to use BOOTP, a BOOTP server must be operating on your network.
178 Read <file:Documentation/nfsroot.txt> for details. 178 Read <file:Documentation/filesystems/nfsroot.txt> for details.
179 179
180config IP_PNP_RARP 180config IP_PNP_RARP
181 bool "IP: RARP support" 181 bool "IP: RARP support"
@@ -187,8 +187,8 @@ config IP_PNP_RARP
187 discovered automatically at boot time using the RARP protocol (an 187 discovered automatically at boot time using the RARP protocol (an
188 older protocol which is being obsoleted by BOOTP and DHCP), say Y 188 older protocol which is being obsoleted by BOOTP and DHCP), say Y
189 here. Note that if you want to use RARP, a RARP server must be 189 here. Note that if you want to use RARP, a RARP server must be
190 operating on your network. Read <file:Documentation/nfsroot.txt> for 190 operating on your network. Read
191 details. 191 <file:Documentation/filesystems/nfsroot.txt> for details.
192 192
193# not yet ready.. 193# not yet ready..
194# bool ' IP: ARP support' CONFIG_IP_PNP_ARP 194# bool ' IP: ARP support' CONFIG_IP_PNP_ARP
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 876169f3a528..717c411a5c6b 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -124,6 +124,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat
124 tw->tw_hash = sk->sk_hash; 124 tw->tw_hash = sk->sk_hash;
125 tw->tw_ipv6only = 0; 125 tw->tw_ipv6only = 0;
126 tw->tw_prot = sk->sk_prot_creator; 126 tw->tw_prot = sk->sk_prot_creator;
127 tw->tw_net = sk->sk_net;
127 atomic_set(&tw->tw_refcnt, 1); 128 atomic_set(&tw->tw_refcnt, 1);
128 inet_twsk_dead_node_init(tw); 129 inet_twsk_dead_node_init(tw);
129 __module_get(tw->tw_prot->owner); 130 __module_get(tw->tw_prot->owner);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index f72457b4b0a7..c2921d01e925 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1132,7 +1132,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname,
1132 } 1132 }
1133 release_sock(sk); 1133 release_sock(sk);
1134 1134
1135 if (len < sizeof(int) && len > 0 && val>=0 && val<255) { 1135 if (len < sizeof(int) && len > 0 && val>=0 && val<=255) {
1136 unsigned char ucval = (unsigned char)val; 1136 unsigned char ucval = (unsigned char)val;
1137 len = 1; 1137 len = 1;
1138 if (put_user(len, optlen)) 1138 if (put_user(len, optlen))
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 7c992fbbc2c3..4824fe8996bf 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1411,7 +1411,7 @@ late_initcall(ip_auto_config);
1411 1411
1412/* 1412/*
1413 * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel 1413 * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel
1414 * command line parameter. See Documentation/nfsroot.txt. 1414 * command line parameter. See Documentation/filesystems/nfsroot.txt.
1415 */ 1415 */
1416static int __init ic_proto_name(char *name) 1416static int __init ic_proto_name(char *name)
1417{ 1417{
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 52926c8e3cc1..a12dd329e208 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -82,8 +82,8 @@ clusterip_config_put(struct clusterip_config *c)
82static inline void 82static inline void
83clusterip_config_entry_put(struct clusterip_config *c) 83clusterip_config_entry_put(struct clusterip_config *c)
84{ 84{
85 write_lock_bh(&clusterip_lock);
85 if (atomic_dec_and_test(&c->entries)) { 86 if (atomic_dec_and_test(&c->entries)) {
86 write_lock_bh(&clusterip_lock);
87 list_del(&c->list); 87 list_del(&c->list);
88 write_unlock_bh(&clusterip_lock); 88 write_unlock_bh(&clusterip_lock);
89 89
@@ -96,7 +96,9 @@ clusterip_config_entry_put(struct clusterip_config *c)
96#ifdef CONFIG_PROC_FS 96#ifdef CONFIG_PROC_FS
97 remove_proc_entry(c->pde->name, c->pde->parent); 97 remove_proc_entry(c->pde->name, c->pde->parent);
98#endif 98#endif
99 return;
99 } 100 }
101 write_unlock_bh(&clusterip_lock);
100} 102}
101 103
102static struct clusterip_config * 104static struct clusterip_config *
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 0d5fa3a54d04..36b4e3bb056f 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -629,6 +629,8 @@ static int __init nf_nat_init(void)
629 size_t i; 629 size_t i;
630 int ret; 630 int ret;
631 631
632 need_ipv4_conntrack();
633
632 ret = nf_ct_extend_register(&nat_extend); 634 ret = nf_ct_extend_register(&nat_extend);
633 if (ret < 0) { 635 if (ret < 0) {
634 printk(KERN_ERR "nf_nat_core: Unable to register extension\n"); 636 printk(KERN_ERR "nf_nat_core: Unable to register extension\n");
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7facdb0f6960..bbb7d88a16b4 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1625,13 +1625,11 @@ out:
1625 return flag; 1625 return flag;
1626} 1626}
1627 1627
1628/* If we receive more dupacks than we expected counting segments 1628/* Limits sacked_out so that sum with lost_out isn't ever larger than
1629 * in assumption of absent reordering, interpret this as reordering. 1629 * packets_out. Returns zero if sacked_out adjustement wasn't necessary.
1630 * The only another reason could be bug in receiver TCP.
1631 */ 1630 */
1632static void tcp_check_reno_reordering(struct sock *sk, const int addend) 1631int tcp_limit_reno_sacked(struct tcp_sock *tp)
1633{ 1632{
1634 struct tcp_sock *tp = tcp_sk(sk);
1635 u32 holes; 1633 u32 holes;
1636 1634
1637 holes = max(tp->lost_out, 1U); 1635 holes = max(tp->lost_out, 1U);
@@ -1639,8 +1637,20 @@ static void tcp_check_reno_reordering(struct sock *sk, const int addend)
1639 1637
1640 if ((tp->sacked_out + holes) > tp->packets_out) { 1638 if ((tp->sacked_out + holes) > tp->packets_out) {
1641 tp->sacked_out = tp->packets_out - holes; 1639 tp->sacked_out = tp->packets_out - holes;
1642 tcp_update_reordering(sk, tp->packets_out + addend, 0); 1640 return 1;
1643 } 1641 }
1642 return 0;
1643}
1644
1645/* If we receive more dupacks than we expected counting segments
1646 * in assumption of absent reordering, interpret this as reordering.
1647 * The only another reason could be bug in receiver TCP.
1648 */
1649static void tcp_check_reno_reordering(struct sock *sk, const int addend)
1650{
1651 struct tcp_sock *tp = tcp_sk(sk);
1652 if (tcp_limit_reno_sacked(tp))
1653 tcp_update_reordering(sk, tp->packets_out + addend, 0);
1644} 1654}
1645 1655
1646/* Emulate SACKs for SACKless connection: account for a new dupack. */ 1656/* Emulate SACKs for SACKless connection: account for a new dupack. */
@@ -1681,11 +1691,16 @@ static inline void tcp_reset_reno_sack(struct tcp_sock *tp)
1681int tcp_use_frto(struct sock *sk) 1691int tcp_use_frto(struct sock *sk)
1682{ 1692{
1683 const struct tcp_sock *tp = tcp_sk(sk); 1693 const struct tcp_sock *tp = tcp_sk(sk);
1694 const struct inet_connection_sock *icsk = inet_csk(sk);
1684 struct sk_buff *skb; 1695 struct sk_buff *skb;
1685 1696
1686 if (!sysctl_tcp_frto) 1697 if (!sysctl_tcp_frto)
1687 return 0; 1698 return 0;
1688 1699
1700 /* MTU probe and F-RTO won't really play nicely along currently */
1701 if (icsk->icsk_mtup.probe_size)
1702 return 0;
1703
1689 if (IsSackFrto()) 1704 if (IsSackFrto())
1690 return 1; 1705 return 1;
1691 1706
@@ -2134,11 +2149,13 @@ static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb)
2134/* Mark head of queue up as lost. With RFC3517 SACK, the packets is 2149/* Mark head of queue up as lost. With RFC3517 SACK, the packets is
2135 * is against sacked "cnt", otherwise it's against facked "cnt" 2150 * is against sacked "cnt", otherwise it's against facked "cnt"
2136 */ 2151 */
2137static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit) 2152static void tcp_mark_head_lost(struct sock *sk, int packets)
2138{ 2153{
2139 struct tcp_sock *tp = tcp_sk(sk); 2154 struct tcp_sock *tp = tcp_sk(sk);
2140 struct sk_buff *skb; 2155 struct sk_buff *skb;
2141 int cnt; 2156 int cnt, oldcnt;
2157 int err;
2158 unsigned int mss;
2142 2159
2143 BUG_TRAP(packets <= tp->packets_out); 2160 BUG_TRAP(packets <= tp->packets_out);
2144 if (tp->lost_skb_hint) { 2161 if (tp->lost_skb_hint) {
@@ -2157,13 +2174,25 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit)
2157 tp->lost_skb_hint = skb; 2174 tp->lost_skb_hint = skb;
2158 tp->lost_cnt_hint = cnt; 2175 tp->lost_cnt_hint = cnt;
2159 2176
2177 if (after(TCP_SKB_CB(skb)->end_seq, tp->high_seq))
2178 break;
2179
2180 oldcnt = cnt;
2160 if (tcp_is_fack(tp) || tcp_is_reno(tp) || 2181 if (tcp_is_fack(tp) || tcp_is_reno(tp) ||
2161 (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) 2182 (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
2162 cnt += tcp_skb_pcount(skb); 2183 cnt += tcp_skb_pcount(skb);
2163 2184
2164 if (((!fast_rexmit || (tp->lost_out > 0)) && (cnt > packets)) || 2185 if (cnt > packets) {
2165 after(TCP_SKB_CB(skb)->end_seq, tp->high_seq)) 2186 if (tcp_is_sack(tp) || (oldcnt >= packets))
2166 break; 2187 break;
2188
2189 mss = skb_shinfo(skb)->gso_size;
2190 err = tcp_fragment(sk, skb, (packets - oldcnt) * mss, mss);
2191 if (err < 0)
2192 break;
2193 cnt = packets;
2194 }
2195
2167 if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) { 2196 if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) {
2168 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; 2197 TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
2169 tp->lost_out += tcp_skb_pcount(skb); 2198 tp->lost_out += tcp_skb_pcount(skb);
@@ -2180,17 +2209,17 @@ static void tcp_update_scoreboard(struct sock *sk, int fast_rexmit)
2180 struct tcp_sock *tp = tcp_sk(sk); 2209 struct tcp_sock *tp = tcp_sk(sk);
2181 2210
2182 if (tcp_is_reno(tp)) { 2211 if (tcp_is_reno(tp)) {
2183 tcp_mark_head_lost(sk, 1, fast_rexmit); 2212 tcp_mark_head_lost(sk, 1);
2184 } else if (tcp_is_fack(tp)) { 2213 } else if (tcp_is_fack(tp)) {
2185 int lost = tp->fackets_out - tp->reordering; 2214 int lost = tp->fackets_out - tp->reordering;
2186 if (lost <= 0) 2215 if (lost <= 0)
2187 lost = 1; 2216 lost = 1;
2188 tcp_mark_head_lost(sk, lost, fast_rexmit); 2217 tcp_mark_head_lost(sk, lost);
2189 } else { 2218 } else {
2190 int sacked_upto = tp->sacked_out - tp->reordering; 2219 int sacked_upto = tp->sacked_out - tp->reordering;
2191 if (sacked_upto < 0) 2220 if (sacked_upto < fast_rexmit)
2192 sacked_upto = 0; 2221 sacked_upto = fast_rexmit;
2193 tcp_mark_head_lost(sk, sacked_upto, fast_rexmit); 2222 tcp_mark_head_lost(sk, sacked_upto);
2194 } 2223 }
2195 2224
2196 /* New heuristics: it is possible only after we switched 2225 /* New heuristics: it is possible only after we switched
@@ -2524,7 +2553,7 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag)
2524 before(tp->snd_una, tp->high_seq) && 2553 before(tp->snd_una, tp->high_seq) &&
2525 icsk->icsk_ca_state != TCP_CA_Open && 2554 icsk->icsk_ca_state != TCP_CA_Open &&
2526 tp->fackets_out > tp->reordering) { 2555 tp->fackets_out > tp->reordering) {
2527 tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering, 0); 2556 tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering);
2528 NET_INC_STATS_BH(LINUX_MIB_TCPLOSS); 2557 NET_INC_STATS_BH(LINUX_MIB_TCPLOSS);
2529 } 2558 }
2530 2559
@@ -2586,6 +2615,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag)
2586 case TCP_CA_Loss: 2615 case TCP_CA_Loss:
2587 if (flag & FLAG_DATA_ACKED) 2616 if (flag & FLAG_DATA_ACKED)
2588 icsk->icsk_retransmits = 0; 2617 icsk->icsk_retransmits = 0;
2618 if (tcp_is_reno(tp) && flag & FLAG_SND_UNA_ADVANCED)
2619 tcp_reset_reno_sack(tp);
2589 if (!tcp_try_undo_loss(sk)) { 2620 if (!tcp_try_undo_loss(sk)) {
2590 tcp_moderate_cwnd(tp); 2621 tcp_moderate_cwnd(tp);
2591 tcp_xmit_retransmit_queue(sk); 2622 tcp_xmit_retransmit_queue(sk);
@@ -3810,8 +3841,28 @@ static void tcp_ofo_queue(struct sock *sk)
3810 } 3841 }
3811} 3842}
3812 3843
3844static int tcp_prune_ofo_queue(struct sock *sk);
3813static int tcp_prune_queue(struct sock *sk); 3845static int tcp_prune_queue(struct sock *sk);
3814 3846
3847static inline int tcp_try_rmem_schedule(struct sock *sk, unsigned int size)
3848{
3849 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf ||
3850 !sk_rmem_schedule(sk, size)) {
3851
3852 if (tcp_prune_queue(sk) < 0)
3853 return -1;
3854
3855 if (!sk_rmem_schedule(sk, size)) {
3856 if (!tcp_prune_ofo_queue(sk))
3857 return -1;
3858
3859 if (!sk_rmem_schedule(sk, size))
3860 return -1;
3861 }
3862 }
3863 return 0;
3864}
3865
3815static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) 3866static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
3816{ 3867{
3817 struct tcphdr *th = tcp_hdr(skb); 3868 struct tcphdr *th = tcp_hdr(skb);
@@ -3861,12 +3912,9 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
3861 if (eaten <= 0) { 3912 if (eaten <= 0) {
3862queue_and_out: 3913queue_and_out:
3863 if (eaten < 0 && 3914 if (eaten < 0 &&
3864 (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || 3915 tcp_try_rmem_schedule(sk, skb->truesize))
3865 !sk_rmem_schedule(sk, skb->truesize))) { 3916 goto drop;
3866 if (tcp_prune_queue(sk) < 0 || 3917
3867 !sk_rmem_schedule(sk, skb->truesize))
3868 goto drop;
3869 }
3870 skb_set_owner_r(skb, sk); 3918 skb_set_owner_r(skb, sk);
3871 __skb_queue_tail(&sk->sk_receive_queue, skb); 3919 __skb_queue_tail(&sk->sk_receive_queue, skb);
3872 } 3920 }
@@ -3935,12 +3983,8 @@ drop:
3935 3983
3936 TCP_ECN_check_ce(tp, skb); 3984 TCP_ECN_check_ce(tp, skb);
3937 3985
3938 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf || 3986 if (tcp_try_rmem_schedule(sk, skb->truesize))
3939 !sk_rmem_schedule(sk, skb->truesize)) { 3987 goto drop;
3940 if (tcp_prune_queue(sk) < 0 ||
3941 !sk_rmem_schedule(sk, skb->truesize))
3942 goto drop;
3943 }
3944 3988
3945 /* Disable header prediction. */ 3989 /* Disable header prediction. */
3946 tp->pred_flags = 0; 3990 tp->pred_flags = 0;
@@ -4167,6 +4211,32 @@ static void tcp_collapse_ofo_queue(struct sock *sk)
4167 } 4211 }
4168} 4212}
4169 4213
4214/*
4215 * Purge the out-of-order queue.
4216 * Return true if queue was pruned.
4217 */
4218static int tcp_prune_ofo_queue(struct sock *sk)
4219{
4220 struct tcp_sock *tp = tcp_sk(sk);
4221 int res = 0;
4222
4223 if (!skb_queue_empty(&tp->out_of_order_queue)) {
4224 NET_INC_STATS_BH(LINUX_MIB_OFOPRUNED);
4225 __skb_queue_purge(&tp->out_of_order_queue);
4226
4227 /* Reset SACK state. A conforming SACK implementation will
4228 * do the same at a timeout based retransmit. When a connection
4229 * is in a sad state like this, we care only about integrity
4230 * of the connection not performance.
4231 */
4232 if (tp->rx_opt.sack_ok)
4233 tcp_sack_reset(&tp->rx_opt);
4234 sk_mem_reclaim(sk);
4235 res = 1;
4236 }
4237 return res;
4238}
4239
4170/* Reduce allocated memory if we can, trying to get 4240/* Reduce allocated memory if we can, trying to get
4171 * the socket within its memory limits again. 4241 * the socket within its memory limits again.
4172 * 4242 *
@@ -4200,20 +4270,7 @@ static int tcp_prune_queue(struct sock *sk)
4200 /* Collapsing did not help, destructive actions follow. 4270 /* Collapsing did not help, destructive actions follow.
4201 * This must not ever occur. */ 4271 * This must not ever occur. */
4202 4272
4203 /* First, purge the out_of_order queue. */ 4273 tcp_prune_ofo_queue(sk);
4204 if (!skb_queue_empty(&tp->out_of_order_queue)) {
4205 NET_INC_STATS_BH(LINUX_MIB_OFOPRUNED);
4206 __skb_queue_purge(&tp->out_of_order_queue);
4207
4208 /* Reset SACK state. A conforming SACK implementation will
4209 * do the same at a timeout based retransmit. When a connection
4210 * is in a sad state like this, we care only about integrity
4211 * of the connection not performance.
4212 */
4213 if (tcp_is_sack(tp))
4214 tcp_sack_reset(&tp->rx_opt);
4215 sk_mem_reclaim(sk);
4216 }
4217 4274
4218 if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf) 4275 if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf)
4219 return 0; 4276 return 0;
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 72b9350006fe..d29ef79c00ca 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1808,6 +1808,9 @@ void tcp_simple_retransmit(struct sock *sk)
1808 if (!lost) 1808 if (!lost)
1809 return; 1809 return;
1810 1810
1811 if (tcp_is_reno(tp))
1812 tcp_limit_reno_sacked(tp);
1813
1811 tcp_verify_left_out(tp); 1814 tcp_verify_left_out(tp);
1812 1815
1813 /* Don't muck with the congestion window here. 1816 /* Don't muck with the congestion window here.
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a65935a9afd9..e08955baedff 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -371,25 +371,26 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
371 */ 371 */
372 in6_dev_hold(ndev); 372 in6_dev_hold(ndev);
373 373
374#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
375 if (dev->type == ARPHRD_SIT && (dev->priv_flags & IFF_ISATAP)) {
376 printk(KERN_INFO
377 "%s: Disabled Multicast RS\n",
378 dev->name);
379 ndev->cnf.rtr_solicits = 0;
380 }
381#endif
382
374#ifdef CONFIG_IPV6_PRIVACY 383#ifdef CONFIG_IPV6_PRIVACY
375 setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev); 384 setup_timer(&ndev->regen_timer, ipv6_regen_rndid, (unsigned long)ndev);
376 if ((dev->flags&IFF_LOOPBACK) || 385 if ((dev->flags&IFF_LOOPBACK) ||
377 dev->type == ARPHRD_TUNNEL || 386 dev->type == ARPHRD_TUNNEL ||
378#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE) 387 dev->type == ARPHRD_TUNNEL6 ||
379 dev->type == ARPHRD_SIT || 388 dev->type == ARPHRD_SIT ||
380#endif
381 dev->type == ARPHRD_NONE) { 389 dev->type == ARPHRD_NONE) {
382 printk(KERN_INFO 390 printk(KERN_INFO
383 "%s: Disabled Privacy Extensions\n", 391 "%s: Disabled Privacy Extensions\n",
384 dev->name); 392 dev->name);
385 ndev->cnf.use_tempaddr = -1; 393 ndev->cnf.use_tempaddr = -1;
386
387 if (dev->type == ARPHRD_SIT && (dev->priv_flags & IFF_ISATAP)) {
388 printk(KERN_INFO
389 "%s: Disabled Multicast RS\n",
390 dev->name);
391 ndev->cnf.rtr_solicits = 0;
392 }
393 } else { 394 } else {
394 in6_dev_hold(ndev); 395 in6_dev_hold(ndev);
395 ipv6_regen_rndid((unsigned long) ndev); 396 ipv6_regen_rndid((unsigned long) ndev);
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 8897ccf8086a..0a6fbc1d1a50 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -372,8 +372,10 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
372 read_lock(&raw_v6_hashinfo.lock); 372 read_lock(&raw_v6_hashinfo.lock);
373 sk = sk_head(&raw_v6_hashinfo.ht[hash]); 373 sk = sk_head(&raw_v6_hashinfo.ht[hash]);
374 if (sk != NULL) { 374 if (sk != NULL) {
375 saddr = &ipv6_hdr(skb)->saddr; 375 struct ipv6hdr *hdr = (struct ipv6hdr *) skb->data;
376 daddr = &ipv6_hdr(skb)->daddr; 376
377 saddr = &hdr->saddr;
378 daddr = &hdr->daddr;
377 net = skb->dev->nd_net; 379 net = skb->dev->nd_net;
378 380
379 while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr, 381 while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr,
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index e0c72d04584b..c1706855460a 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -312,14 +312,12 @@ static void ieee80211_sta_wmm_params(struct net_device *dev,
312 } 312 }
313} 313}
314 314
315 315static u32 ieee80211_handle_protect_preamb(struct ieee80211_sub_if_data *sdata,
316static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata, 316 bool use_protection,
317 u8 erp_value) 317 bool use_short_preamble)
318{ 318{
319 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf; 319 struct ieee80211_bss_conf *bss_conf = &sdata->bss_conf;
320 struct ieee80211_if_sta *ifsta = &sdata->u.sta; 320 struct ieee80211_if_sta *ifsta = &sdata->u.sta;
321 bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0;
322 bool use_short_preamble = (erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0;
323 DECLARE_MAC_BUF(mac); 321 DECLARE_MAC_BUF(mac);
324 u32 changed = 0; 322 u32 changed = 0;
325 323
@@ -350,6 +348,32 @@ static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
350 return changed; 348 return changed;
351} 349}
352 350
351static u32 ieee80211_handle_erp_ie(struct ieee80211_sub_if_data *sdata,
352 u8 erp_value)
353{
354 bool use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0;
355 bool use_short_preamble = (erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0;
356
357 return ieee80211_handle_protect_preamb(sdata,
358 use_protection, use_short_preamble);
359}
360
361static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
362 struct ieee80211_sta_bss *bss)
363{
364 u32 changed = 0;
365
366 if (bss->has_erp_value)
367 changed |= ieee80211_handle_erp_ie(sdata, bss->erp_value);
368 else {
369 u16 capab = bss->capability;
370 changed |= ieee80211_handle_protect_preamb(sdata, false,
371 (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0);
372 }
373
374 return changed;
375}
376
353int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, 377int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
354 struct ieee80211_ht_info *ht_info) 378 struct ieee80211_ht_info *ht_info)
355{ 379{
@@ -468,9 +492,7 @@ static void ieee80211_set_associated(struct net_device *dev,
468 local->hw.conf.channel, 492 local->hw.conf.channel,
469 ifsta->ssid, ifsta->ssid_len); 493 ifsta->ssid, ifsta->ssid_len);
470 if (bss) { 494 if (bss) {
471 if (bss->has_erp_value) 495 changed |= ieee80211_handle_bss_capability(sdata, bss);
472 changed |= ieee80211_handle_erp_ie(
473 sdata, bss->erp_value);
474 ieee80211_rx_bss_put(dev, bss); 496 ieee80211_rx_bss_put(dev, bss);
475 } 497 }
476 498
@@ -2116,6 +2138,11 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
2116 2138
2117 if (elems.erp_info && elems.erp_info_len >= 1) 2139 if (elems.erp_info && elems.erp_info_len >= 1)
2118 changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]); 2140 changed |= ieee80211_handle_erp_ie(sdata, elems.erp_info[0]);
2141 else {
2142 u16 capab = le16_to_cpu(mgmt->u.beacon.capab_info);
2143 changed |= ieee80211_handle_protect_preamb(sdata, false,
2144 (capab & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0);
2145 }
2119 2146
2120 if (elems.ht_cap_elem && elems.ht_info_elem && 2147 if (elems.ht_cap_elem && elems.ht_info_elem &&
2121 elems.wmm_param && local->ops->conf_ht && 2148 elems.wmm_param && local->ops->conf_ht &&
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 535407d07fa4..a8a40aba846b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1050,12 +1050,9 @@ ieee80211_drop_unencrypted(struct ieee80211_txrx_data *rx)
1050 if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) && 1050 if (unlikely(!(rx->fc & IEEE80211_FCTL_PROTECTED) &&
1051 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && 1051 (rx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA &&
1052 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC && 1052 (rx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_NULLFUNC &&
1053 (rx->key || rx->sdata->drop_unencrypted))) { 1053 (rx->key || rx->sdata->drop_unencrypted)))
1054 if (net_ratelimit())
1055 printk(KERN_DEBUG "%s: RX non-WEP frame, but expected "
1056 "encryption\n", rx->dev->name);
1057 return -EACCES; 1054 return -EACCES;
1058 } 1055
1059 return 0; 1056 return 0;
1060} 1057}
1061 1058
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index dc29007c52cd..40d344b21453 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -466,38 +466,25 @@ static inline void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now)
466 466
467static inline __be32 maskl(__be32 a, unsigned int l) 467static inline __be32 maskl(__be32 a, unsigned int l)
468{ 468{
469 return htonl(ntohl(a) & ~(~(u_int32_t)0 >> l)); 469 return l ? htonl(ntohl(a) & ~0 << (32 - l)) : 0;
470} 470}
471 471
472#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 472#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
473static void hashlimit_ipv6_mask(__be32 *i, unsigned int p) 473static void hashlimit_ipv6_mask(__be32 *i, unsigned int p)
474{ 474{
475 switch (p) { 475 switch (p) {
476 case 0: 476 case 0 ... 31:
477 i[0] = i[1] = 0;
478 i[2] = i[3] = 0;
479 break;
480 case 1 ... 31:
481 i[0] = maskl(i[0], p); 477 i[0] = maskl(i[0], p);
482 i[1] = i[2] = i[3] = 0; 478 i[1] = i[2] = i[3] = 0;
483 break; 479 break;
484 case 32: 480 case 32 ... 63:
485 i[1] = i[2] = i[3] = 0;
486 break;
487 case 33 ... 63:
488 i[1] = maskl(i[1], p - 32); 481 i[1] = maskl(i[1], p - 32);
489 i[2] = i[3] = 0; 482 i[2] = i[3] = 0;
490 break; 483 break;
491 case 64: 484 case 64 ... 95:
492 i[2] = i[3] = 0;
493 break;
494 case 65 ... 95:
495 i[2] = maskl(i[2], p - 64); 485 i[2] = maskl(i[2], p - 64);
496 i[3] = 0; 486 i[3] = 0;
497 case 96: 487 case 96 ... 127:
498 i[3] = 0;
499 break;
500 case 97 ... 127:
501 i[3] = maskl(i[3], p - 96); 488 i[3] = maskl(i[3], p - 96);
502 break; 489 break;
503 case 128: 490 case 128:
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 140a0a8c6b02..4e10a95de832 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -92,7 +92,7 @@ void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
92 rfkill_states[type] = state; 92 rfkill_states[type] = state;
93 93
94 list_for_each_entry(rfkill, &rfkill_list, node) { 94 list_for_each_entry(rfkill, &rfkill_list, node) {
95 if (!rfkill->user_claim) 95 if ((!rfkill->user_claim) && (rfkill->type == type))
96 rfkill_toggle_radio(rfkill, state); 96 rfkill_toggle_radio(rfkill, state);
97 } 97 }
98 98
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 2d0c29c837f7..4b2682feeedc 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -27,7 +27,7 @@ MODULE_ALIAS_NETPROTO(PF_RXRPC);
27 27
28unsigned rxrpc_debug; // = RXRPC_DEBUG_KPROTO; 28unsigned rxrpc_debug; // = RXRPC_DEBUG_KPROTO;
29module_param_named(debug, rxrpc_debug, uint, S_IWUSR | S_IRUGO); 29module_param_named(debug, rxrpc_debug, uint, S_IWUSR | S_IRUGO);
30MODULE_PARM_DESC(rxrpc_debug, "RxRPC debugging mask"); 30MODULE_PARM_DESC(debug, "RxRPC debugging mask");
31 31
32static int sysctl_rxrpc_max_qlen __read_mostly = 10; 32static int sysctl_rxrpc_max_qlen __read_mostly = 10;
33 33
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index d1c296f2d617..6d38a81b336d 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -31,7 +31,7 @@
31 31
32unsigned rxrpc_debug; 32unsigned rxrpc_debug;
33module_param_named(debug, rxrpc_debug, uint, S_IWUSR | S_IRUGO); 33module_param_named(debug, rxrpc_debug, uint, S_IWUSR | S_IRUGO);
34MODULE_PARM_DESC(rxrpc_debug, "rxkad debugging mask"); 34MODULE_PARM_DESC(debug, "rxkad debugging mask");
35 35
36struct rxkad_level1_hdr { 36struct rxkad_level1_hdr {
37 __be32 data_size; /* true data size (excluding padding) */ 37 __be32 data_size; /* true data size (excluding padding) */
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index c5c16b4b6e98..4d755444c449 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -411,8 +411,10 @@ static void u32_destroy(struct tcf_proto *tp)
411 } 411 }
412 } 412 }
413 413
414 for (ht=tp_c->hlist; ht; ht = ht->next) 414 for (ht = tp_c->hlist; ht; ht = ht->next) {
415 ht->refcnt--;
415 u32_clear_hnode(tp, ht); 416 u32_clear_hnode(tp, ht);
417 }
416 418
417 while ((ht = tp_c->hlist) != NULL) { 419 while ((ht = tp_c->hlist) != NULL) {
418 tp_c->hlist = ht->next; 420 tp_c->hlist = ht->next;
@@ -441,8 +443,12 @@ static int u32_delete(struct tcf_proto *tp, unsigned long arg)
441 if (tp->root == ht) 443 if (tp->root == ht)
442 return -EINVAL; 444 return -EINVAL;
443 445
444 if (--ht->refcnt == 0) 446 if (ht->refcnt == 1) {
447 ht->refcnt--;
445 u32_destroy_hnode(tp, ht); 448 u32_destroy_hnode(tp, ht);
449 } else {
450 return -EBUSY;
451 }
446 452
447 return 0; 453 return 0;
448} 454}
@@ -568,7 +574,7 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
568 if (ht == NULL) 574 if (ht == NULL)
569 return -ENOBUFS; 575 return -ENOBUFS;
570 ht->tp_c = tp_c; 576 ht->tp_c = tp_c;
571 ht->refcnt = 0; 577 ht->refcnt = 1;
572 ht->divisor = divisor; 578 ht->divisor = divisor;
573 ht->handle = handle; 579 ht->handle = handle;
574 ht->prio = tp->prio; 580 ht->prio = tp->prio;
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 7e3c048ba9b1..fc8708a0a25e 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -386,6 +386,9 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
386 if (n == 0) 386 if (n == 0)
387 return; 387 return;
388 while ((parentid = sch->parent)) { 388 while ((parentid = sch->parent)) {
389 if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS))
390 return;
391
389 sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid)); 392 sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
390 if (sch == NULL) { 393 if (sch == NULL) {
391 WARN_ON(parentid != TC_H_ROOT); 394 WARN_ON(parentid != TC_H_ROOT);
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index b1e05d719f9b..85f1495e0edc 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -110,8 +110,9 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
110 spin_lock_bh(&sctp_local_addr_lock); 110 spin_lock_bh(&sctp_local_addr_lock);
111 list_for_each_entry_safe(addr, temp, 111 list_for_each_entry_safe(addr, temp,
112 &sctp_local_addr_list, list) { 112 &sctp_local_addr_list, list) {
113 if (ipv6_addr_equal(&addr->a.v6.sin6_addr, 113 if (addr->a.sa.sa_family == AF_INET6 &&
114 &ifa->addr)) { 114 ipv6_addr_equal(&addr->a.v6.sin6_addr,
115 &ifa->addr)) {
115 found = 1; 116 found = 1;
116 addr->valid = 0; 117 addr->valid = 0;
117 list_del_rcu(&addr->list); 118 list_del_rcu(&addr->list);
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 1bb3c5c35d2a..c0714469233c 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -793,6 +793,9 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
793 break; 793 break;
794 794
795 case SCTP_CID_ABORT: 795 case SCTP_CID_ABORT:
796 if (sctp_test_T_bit(chunk)) {
797 packet->vtag = asoc->c.my_vtag;
798 }
796 case SCTP_CID_SACK: 799 case SCTP_CID_SACK:
797 case SCTP_CID_HEARTBEAT: 800 case SCTP_CID_HEARTBEAT:
798 case SCTP_CID_HEARTBEAT_ACK: 801 case SCTP_CID_HEARTBEAT_ACK:
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f90091a1b9ce..c2dd65d9f38d 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -647,7 +647,9 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
647 spin_lock_bh(&sctp_local_addr_lock); 647 spin_lock_bh(&sctp_local_addr_lock);
648 list_for_each_entry_safe(addr, temp, 648 list_for_each_entry_safe(addr, temp,
649 &sctp_local_addr_list, list) { 649 &sctp_local_addr_list, list) {
650 if (addr->a.v4.sin_addr.s_addr == ifa->ifa_local) { 650 if (addr->a.sa.sa_family == AF_INET &&
651 addr->a.v4.sin_addr.s_addr ==
652 ifa->ifa_local) {
651 found = 1; 653 found = 1;
652 addr->valid = 0; 654 addr->valid = 0;
653 list_del_rcu(&addr->list); 655 list_del_rcu(&addr->list);
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 578630e8e00d..36ebb392472e 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1982,7 +1982,10 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
1982 struct sctp_chunk *chunk, 1982 struct sctp_chunk *chunk,
1983 struct sctp_chunk **err_chunk) 1983 struct sctp_chunk **err_chunk)
1984{ 1984{
1985 struct sctp_hmac_algo_param *hmacs;
1985 int retval = SCTP_IERROR_NO_ERROR; 1986 int retval = SCTP_IERROR_NO_ERROR;
1987 __u16 n_elt, id = 0;
1988 int i;
1986 1989
1987 /* FIXME - This routine is not looking at each parameter per the 1990 /* FIXME - This routine is not looking at each parameter per the
1988 * chunk type, i.e., unrecognized parameters should be further 1991 * chunk type, i.e., unrecognized parameters should be further
@@ -2056,9 +2059,29 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
2056 break; 2059 break;
2057 2060
2058 case SCTP_PARAM_HMAC_ALGO: 2061 case SCTP_PARAM_HMAC_ALGO:
2059 if (sctp_auth_enable) 2062 if (!sctp_auth_enable)
2060 break; 2063 goto fallthrough;
2061 /* Fall Through */ 2064
2065 hmacs = (struct sctp_hmac_algo_param *)param.p;
2066 n_elt = (ntohs(param.p->length) - sizeof(sctp_paramhdr_t)) >> 1;
2067
2068 /* SCTP-AUTH: Section 6.1
2069 * The HMAC algorithm based on SHA-1 MUST be supported and
2070 * included in the HMAC-ALGO parameter.
2071 */
2072 for (i = 0; i < n_elt; i++) {
2073 id = ntohs(hmacs->hmac_ids[i]);
2074
2075 if (id == SCTP_AUTH_HMAC_ID_SHA1)
2076 break;
2077 }
2078
2079 if (id != SCTP_AUTH_HMAC_ID_SHA1) {
2080 sctp_process_inv_paramlength(asoc, param.p, chunk,
2081 err_chunk);
2082 retval = SCTP_IERROR_ABORT;
2083 }
2084 break;
2062fallthrough: 2085fallthrough:
2063 default: 2086 default:
2064 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n", 2087 SCTP_DEBUG_PRINTK("Unrecognized param: %d for chunk %d.\n",
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 28eb38eb6083..a4763fd24fd8 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1536,6 +1536,9 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1536 error = sctp_auth_asoc_init_active_key(asoc, 1536 error = sctp_auth_asoc_init_active_key(asoc,
1537 GFP_ATOMIC); 1537 GFP_ATOMIC);
1538 break; 1538 break;
1539 case SCTP_CMD_UPDATE_INITTAG:
1540 asoc->peer.i.init_tag = cmd->obj.u32;
1541 break;
1539 1542
1540 default: 1543 default:
1541 printk(KERN_WARNING "Impossible command: %u, %p\n", 1544 printk(KERN_WARNING "Impossible command: %u, %p\n",
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f2ed6473feef..07194c2a32df 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4144,6 +4144,24 @@ static sctp_disposition_t sctp_sf_abort_violation(
4144 goto nomem; 4144 goto nomem;
4145 4145
4146 if (asoc) { 4146 if (asoc) {
4147 /* Treat INIT-ACK as a special case during COOKIE-WAIT. */
4148 if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK &&
4149 !asoc->peer.i.init_tag) {
4150 sctp_initack_chunk_t *initack;
4151
4152 initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
4153 if (!sctp_chunk_length_valid(chunk,
4154 sizeof(sctp_initack_chunk_t)))
4155 abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T;
4156 else {
4157 unsigned int inittag;
4158
4159 inittag = ntohl(initack->init_hdr.init_tag);
4160 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_INITTAG,
4161 SCTP_U32(inittag));
4162 }
4163 }
4164
4147 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); 4165 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4148 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS); 4166 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
4149 4167
@@ -4349,6 +4367,7 @@ sctp_disposition_t sctp_sf_do_prm_asoc(const struct sctp_endpoint *ep,
4349 sctp_cmd_seq_t *commands) 4367 sctp_cmd_seq_t *commands)
4350{ 4368{
4351 struct sctp_chunk *repl; 4369 struct sctp_chunk *repl;
4370 struct sctp_association* my_asoc;
4352 4371
4353 /* The comment below says that we enter COOKIE-WAIT AFTER 4372 /* The comment below says that we enter COOKIE-WAIT AFTER
4354 * sending the INIT, but that doesn't actually work in our 4373 * sending the INIT, but that doesn't actually work in our
@@ -4372,8 +4391,8 @@ sctp_disposition_t sctp_sf_do_prm_asoc(const struct sctp_endpoint *ep,
4372 /* Cast away the const modifier, as we want to just 4391 /* Cast away the const modifier, as we want to just
4373 * rerun it through as a sideffect. 4392 * rerun it through as a sideffect.
4374 */ 4393 */
4375 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, 4394 my_asoc = (struct sctp_association *)asoc;
4376 SCTP_ASOC((struct sctp_association *) asoc)); 4395 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(my_asoc));
4377 4396
4378 /* Choose transport for INIT. */ 4397 /* Choose transport for INIT. */
4379 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_CHOOSE_TRANSPORT, 4398 sctp_add_cmd_sf(commands, SCTP_CMD_INIT_CHOOSE_TRANSPORT,
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d994d822900d..998e63a31311 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5868,11 +5868,12 @@ SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *msg,
5868 sctp_cmsgs_t *cmsgs) 5868 sctp_cmsgs_t *cmsgs)
5869{ 5869{
5870 struct cmsghdr *cmsg; 5870 struct cmsghdr *cmsg;
5871 struct msghdr *my_msg = (struct msghdr *)msg;
5871 5872
5872 for (cmsg = CMSG_FIRSTHDR(msg); 5873 for (cmsg = CMSG_FIRSTHDR(msg);
5873 cmsg != NULL; 5874 cmsg != NULL;
5874 cmsg = CMSG_NXTHDR((struct msghdr*)msg, cmsg)) { 5875 cmsg = CMSG_NXTHDR(my_msg, cmsg)) {
5875 if (!CMSG_OK(msg, cmsg)) 5876 if (!CMSG_OK(my_msg, cmsg))
5876 return -EINVAL; 5877 return -EINVAL;
5877 5878
5878 /* Should we parse this header or ignore? */ 5879 /* Should we parse this header or ignore? */
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index b43f1f110f87..ce6cda6b6994 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -859,7 +859,7 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
859 union sctp_notification *notification; 859 union sctp_notification *notification;
860 struct sk_buff *skb; 860 struct sk_buff *skb;
861 861
862 skb = sctp_event2skb((struct sctp_ulpevent *)event); 862 skb = sctp_event2skb(event);
863 notification = (union sctp_notification *) skb->data; 863 notification = (union sctp_notification *) skb->data;
864 return notification->sn_header.sn_type; 864 return notification->sn_header.sn_type;
865} 865}
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 8c6a7f1a25e9..8834d68972cb 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -261,10 +261,6 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
261 }; 261 };
262 char servername[48]; 262 char servername[48];
263 263
264 xprt = xprt_create_transport(&xprtargs);
265 if (IS_ERR(xprt))
266 return (struct rpc_clnt *)xprt;
267
268 /* 264 /*
269 * If the caller chooses not to specify a hostname, whip 265 * If the caller chooses not to specify a hostname, whip
270 * up a string representation of the passed-in address. 266 * up a string representation of the passed-in address.
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 995c3fdc16c2..79a55d56cc98 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -244,7 +244,7 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
244 pgto = pages + (pgbase >> PAGE_CACHE_SHIFT); 244 pgto = pages + (pgbase >> PAGE_CACHE_SHIFT);
245 pgbase &= ~PAGE_CACHE_MASK; 245 pgbase &= ~PAGE_CACHE_MASK;
246 246
247 do { 247 for (;;) {
248 copy = PAGE_CACHE_SIZE - pgbase; 248 copy = PAGE_CACHE_SIZE - pgbase;
249 if (copy > len) 249 if (copy > len)
250 copy = len; 250 copy = len;
@@ -253,6 +253,10 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
253 memcpy(vto + pgbase, p, copy); 253 memcpy(vto + pgbase, p, copy);
254 kunmap_atomic(vto, KM_USER0); 254 kunmap_atomic(vto, KM_USER0);
255 255
256 len -= copy;
257 if (len == 0)
258 break;
259
256 pgbase += copy; 260 pgbase += copy;
257 if (pgbase == PAGE_CACHE_SIZE) { 261 if (pgbase == PAGE_CACHE_SIZE) {
258 flush_dcache_page(*pgto); 262 flush_dcache_page(*pgto);
@@ -260,8 +264,7 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
260 pgto++; 264 pgto++;
261 } 265 }
262 p += copy; 266 p += copy;
263 267 }
264 } while ((len -= copy) != 0);
265 flush_dcache_page(*pgto); 268 flush_dcache_page(*pgto);
266} 269}
267 270
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e3a214f63f91..f68a5c8f2147 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -945,7 +945,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
945 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); 945 nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
946 params.listen_interval = 946 params.listen_interval =
947 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); 947 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]);
948 params.listen_interval = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); 948 params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]);
949 949
950 if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], 950 if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS],
951 &params.station_flags)) 951 &params.station_flags))
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 5d96f2728dc6..019d21de19b3 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -288,7 +288,7 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
288 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); 288 memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr));
289 x->props.flags = p->flags; 289 x->props.flags = p->flags;
290 290
291 if (x->props.mode == XFRM_MODE_TRANSPORT) 291 if (!x->sel.family)
292 x->sel.family = p->family; 292 x->sel.family = p->family;
293 293
294} 294}
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 89bb6d36c0a7..d39b59cf8a08 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -760,13 +760,13 @@ static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
760 * this early in the boot process. */ 760 * this early in the boot process. */
761 BUG_ON(!ss_initialized); 761 BUG_ON(!ss_initialized);
762 762
763 /* this might go away sometime down the line if there is a new user
764 * of clone, but for now, nfs better not get here... */
765 BUG_ON(newsbsec->initialized);
766
767 /* how can we clone if the old one wasn't set up?? */ 763 /* how can we clone if the old one wasn't set up?? */
768 BUG_ON(!oldsbsec->initialized); 764 BUG_ON(!oldsbsec->initialized);
769 765
766 /* if fs is reusing a sb, just let its options stand... */
767 if (newsbsec->initialized)
768 return;
769
770 mutex_lock(&newsbsec->lock); 770 mutex_lock(&newsbsec->lock);
771 771
772 newsbsec->flags = oldsbsec->flags; 772 newsbsec->flags = oldsbsec->flags;
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 25ccfce45759..7d911a18c082 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -617,6 +617,18 @@ static int snd_es1968_ac97_wait(struct es1968 *chip)
617 return 1; /* timeout */ 617 return 1; /* timeout */
618} 618}
619 619
620static int snd_es1968_ac97_wait_poll(struct es1968 *chip)
621{
622 int timeout = 100000;
623
624 while (timeout-- > 0) {
625 if (!(inb(chip->io_port + ESM_AC97_INDEX) & 1))
626 return 0;
627 }
628 snd_printd("es1968: ac97 timeout\n");
629 return 1; /* timeout */
630}
631
620static void snd_es1968_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val) 632static void snd_es1968_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short val)
621{ 633{
622 struct es1968 *chip = ac97->private_data; 634 struct es1968 *chip = ac97->private_data;
@@ -645,7 +657,7 @@ static unsigned short snd_es1968_ac97_read(struct snd_ac97 *ac97, unsigned short
645 outb(reg | 0x80, chip->io_port + ESM_AC97_INDEX); 657 outb(reg | 0x80, chip->io_port + ESM_AC97_INDEX);
646 /*msleep(1);*/ 658 /*msleep(1);*/
647 659
648 if (! snd_es1968_ac97_wait(chip)) { 660 if (!snd_es1968_ac97_wait_poll(chip)) {
649 data = inw(chip->io_port + ESM_AC97_DATA); 661 data = inw(chip->io_port + ESM_AC97_DATA);
650 /*msleep(1);*/ 662 /*msleep(1);*/
651 } 663 }