aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt4
-rw-r--r--MAINTAINERS21
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/include/asm/bitops.h2
-rw-r--r--arch/alpha/kernel/Makefile20
-rw-r--r--arch/alpha/kernel/ns87312.c38
-rw-r--r--arch/alpha/kernel/pc873xx.c88
-rw-r--r--arch/alpha/kernel/pc873xx.h35
-rw-r--r--arch/alpha/kernel/pci-sysfs.c3
-rw-r--r--arch/alpha/kernel/sys_sio.c23
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c1
-rw-r--r--arch/powerpc/Kconfig.debug7
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/boot/addRamDisk.c311
-rw-r--r--arch/powerpc/boot/dts/lite5200.dts28
-rw-r--r--arch/powerpc/boot/dts/lite5200b.dts5
-rw-r--r--arch/powerpc/configs/40x/acadia_defconfig3
-rw-r--r--arch/powerpc/configs/40x/ep405_defconfig3
-rw-r--r--arch/powerpc/configs/40x/hcu4_defconfig3
-rw-r--r--arch/powerpc/configs/40x/kilauea_defconfig3
-rw-r--r--arch/powerpc/configs/40x/makalu_defconfig3
-rw-r--r--arch/powerpc/configs/40x/virtex_defconfig3
-rw-r--r--arch/powerpc/configs/40x/walnut_defconfig3
-rw-r--r--arch/powerpc/configs/44x/arches_defconfig3
-rw-r--r--arch/powerpc/configs/44x/bamboo_defconfig3
-rw-r--r--arch/powerpc/configs/44x/canyonlands_defconfig3
-rw-r--r--arch/powerpc/configs/44x/ebony_defconfig3
-rw-r--r--arch/powerpc/configs/44x/eiger_defconfig3
-rw-r--r--arch/powerpc/configs/44x/katmai_defconfig3
-rw-r--r--arch/powerpc/configs/44x/rainier_defconfig3
-rw-r--r--arch/powerpc/configs/44x/redwood_defconfig3
-rw-r--r--arch/powerpc/configs/44x/sam440ep_defconfig3
-rw-r--r--arch/powerpc/configs/44x/sequoia_defconfig3
-rw-r--r--arch/powerpc/configs/44x/taishan_defconfig3
-rw-r--r--arch/powerpc/configs/44x/virtex5_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/cm5200_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/lite5200b_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/motionpro_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/pcm030_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/tqm5200_defconfig3
-rw-r--r--arch/powerpc/configs/86xx/gef_ppc9a_defconfig3
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc310_defconfig3
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc610_defconfig3
-rw-r--r--arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig3
-rw-r--r--arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig3
-rw-r--r--arch/powerpc/configs/86xx/sbc8641d_defconfig3
-rw-r--r--arch/powerpc/configs/adder875_defconfig3
-rw-r--r--arch/powerpc/configs/amigaone_defconfig3
-rw-r--r--arch/powerpc/configs/c2k_defconfig3
-rw-r--r--arch/powerpc/configs/cell_defconfig3
-rw-r--r--arch/powerpc/configs/celleb_defconfig3
-rw-r--r--arch/powerpc/configs/chrp32_defconfig3
-rw-r--r--arch/powerpc/configs/ep8248e_defconfig3
-rw-r--r--arch/powerpc/configs/ep88xc_defconfig3
-rw-r--r--arch/powerpc/configs/g5_defconfig3
-rw-r--r--arch/powerpc/configs/gamecube_defconfig3
-rw-r--r--arch/powerpc/configs/holly_defconfig1
-rw-r--r--arch/powerpc/configs/iseries_defconfig3
-rw-r--r--arch/powerpc/configs/linkstation_defconfig3
-rw-r--r--arch/powerpc/configs/maple_defconfig3
-rw-r--r--arch/powerpc/configs/mgcoge_defconfig3
-rw-r--r--arch/powerpc/configs/mgsuvd_defconfig3
-rw-r--r--arch/powerpc/configs/mpc512x_defconfig3
-rw-r--r--arch/powerpc/configs/mpc5200_defconfig3
-rw-r--r--arch/powerpc/configs/mpc7448_hpc2_defconfig3
-rw-r--r--arch/powerpc/configs/pasemi_defconfig3
-rw-r--r--arch/powerpc/configs/pmac32_defconfig3
-rw-r--r--arch/powerpc/configs/ppc40x_defconfig3
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig3
-rw-r--r--arch/powerpc/configs/ppc64_defconfig3
-rw-r--r--arch/powerpc/configs/ppc64e_defconfig3
-rw-r--r--arch/powerpc/configs/pq2fads_defconfig3
-rw-r--r--arch/powerpc/configs/prpmc2800_defconfig3
-rw-r--r--arch/powerpc/configs/pseries_defconfig3
-rw-r--r--arch/powerpc/configs/storcenter_defconfig3
-rw-r--r--arch/powerpc/configs/wii_defconfig3
-rw-r--r--arch/powerpc/include/asm/irq.h6
-rw-r--r--arch/powerpc/include/asm/kdump.h11
-rw-r--r--arch/powerpc/kernel/irq.c12
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c18
-rw-r--r--arch/powerpc/kernel/misc_32.S2
-rw-r--r--arch/powerpc/kernel/misc_64.S2
-rw-r--r--arch/powerpc/kernel/process.c5
-rw-r--r--arch/powerpc/kernel/rtas_flash.c39
-rw-r--r--arch/powerpc/kernel/setup_32.c4
-rw-r--r--arch/powerpc/kernel/setup_64.c4
-rw-r--r--arch/powerpc/mm/pgtable_32.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pm.c11
-rw-r--r--arch/powerpc/sysdev/mpic.c2
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c1
-rw-r--r--arch/sh/drivers/pci/pci.c2
-rw-r--r--arch/sh/mm/pmb.c2
-rw-r--r--arch/um/include/asm/arch_hweight.h6
-rw-r--r--arch/x86/boot/video-vga.c3
-rw-r--r--arch/x86/include/asm/io_apic.h4
-rw-r--r--arch/x86/include/asm/percpu.h2
-rw-r--r--arch/x86/include/asm/pgtable_32_types.h2
-rw-r--r--arch/x86/include/asm/system.h2
-rw-r--r--arch/x86/kernel/acpi/boot.c8
-rw-r--r--arch/x86/kernel/apic/io_apic.c12
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c1
-rw-r--r--arch/x86/kernel/e820.c2
-rw-r--r--arch/x86/kernel/mpparse.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c15
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kernel/sfi.c2
-rw-r--r--arch/x86/mm/pat.c2
-rw-r--r--arch/x86/mm/pat_rbtree.c1
-rw-r--r--drivers/acpi/acpi_pad.c36
-rw-r--r--drivers/acpi/acpica/acconfig.h4
-rw-r--r--drivers/acpi/acpica/acevents.h4
-rw-r--r--drivers/acpi/acpica/acglobal.h8
-rw-r--r--drivers/acpi/acpica/achware.h6
-rw-r--r--drivers/acpi/acpica/evgpe.c115
-rw-r--r--drivers/acpi/acpica/evgpeblk.c14
-rw-r--r--drivers/acpi/acpica/evxface.c7
-rw-r--r--drivers/acpi/acpica/evxfevnt.c59
-rw-r--r--drivers/acpi/acpica/exsystem.c8
-rw-r--r--drivers/acpi/acpica/hwgpe.c94
-rw-r--r--drivers/acpi/acpica/hwvalid.c12
-rw-r--r--drivers/acpi/acpica/nsinit.c9
-rw-r--r--drivers/acpi/apei/apei-base.c1
-rw-r--r--drivers/acpi/atomicio.c1
-rw-r--r--drivers/acpi/blacklist.c8
-rw-r--r--drivers/acpi/button.c4
-rw-r--r--drivers/acpi/fan.c3
-rw-r--r--drivers/acpi/processor_driver.c5
-rw-r--r--drivers/acpi/sleep.c34
-rw-r--r--drivers/acpi/system.c6
-rw-r--r--drivers/acpi/wakeup.c20
-rw-r--r--drivers/char/sysrq.c8
-rw-r--r--drivers/char/tpm/tpm.h1
-rw-r--r--drivers/clocksource/sh_cmt.c2
-rw-r--r--drivers/hwmon/i5k_amb.c6
-rw-r--r--drivers/hwmon/k10temp.c14
-rw-r--r--drivers/hwmon/k8temp.c2
-rw-r--r--drivers/input/keyboard/Kconfig2
-rw-r--r--drivers/input/misc/pcf8574_keypad.c2
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/input/tablet/wacom_wac.c9
-rw-r--r--drivers/input/touchscreen/ad7877.c7
-rw-r--r--drivers/isdn/gigaset/asyncdata.c44
-rw-r--r--drivers/isdn/gigaset/capi.c405
-rw-r--r--drivers/isdn/gigaset/common.c36
-rw-r--r--drivers/isdn/gigaset/ev-layer.c4
-rw-r--r--drivers/isdn/gigaset/gigaset.h38
-rw-r--r--drivers/isdn/gigaset/i4l.c21
-rw-r--r--drivers/isdn/gigaset/isocdata.c72
-rw-r--r--drivers/isdn/hysdn/hysdn_net.c3
-rw-r--r--drivers/md/md.c38
-rw-r--r--drivers/md/md.h3
-rw-r--r--drivers/md/raid0.c21
-rw-r--r--drivers/md/raid0.h3
-rw-r--r--drivers/md/raid10.c46
-rw-r--r--drivers/md/raid10.h5
-rw-r--r--drivers/md/raid5.c150
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/bnx2.c11
-rw-r--r--drivers/net/cnic.c55
-rw-r--r--drivers/net/cpmac.c3
-rw-r--r--drivers/net/e1000/e1000_main.c17
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c9
-rw-r--r--drivers/net/enic/vnic_dev.c2
-rw-r--r--drivers/net/gianfar.c25
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c37
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_phy.c2
-rw-r--r--drivers/net/lib82596.c2
-rw-r--r--drivers/net/mipsnet.c2
-rw-r--r--drivers/net/netxen/netxen_nic_ctx.c3
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c4
-rw-r--r--drivers/net/netxen/netxen_nic_init.c13
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c18
-rw-r--r--drivers/net/phy/lxt.c1
-rw-r--r--drivers/net/sky2.c19
-rw-r--r--drivers/net/tulip/de2104x.c5
-rw-r--r--drivers/net/ucc_geth.c2
-rw-r--r--drivers/net/usb/hso.c1
-rw-r--r--drivers/net/vxge/vxge-main.c29
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c1
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c15
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c13
-rw-r--r--drivers/net/wireless/hostap/hostap_wlan.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c9
-rw-r--r--drivers/net/wireless/libertas_tf/main.c2
-rw-r--r--drivers/net/wireless/p54/p54pci.c2
-rw-r--r--drivers/pci/intel-iommu.c14
-rw-r--r--drivers/pci/pci.c1
-rw-r--r--drivers/pci/pcie/pme/pcie_pme.c19
-rw-r--r--drivers/rtc/rtc-davinci.c1
-rw-r--r--drivers/serial/serial_cs.c1
-rw-r--r--drivers/staging/tm6000/tm6000-alsa.c1
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c1
-rw-r--r--drivers/staging/tm6000/tm6000-core.c1
-rw-r--r--drivers/staging/tm6000/tm6000-dvb.c1
-rw-r--r--drivers/video/omap/lcdc.c14
-rw-r--r--drivers/video/omap/rfbi.c5
-rw-r--r--drivers/virtio/virtio_pci.c3
-rw-r--r--drivers/virtio/virtio_ring.c2
-rw-r--r--drivers/watchdog/at32ap700x_wdt.c16
-rw-r--r--drivers/watchdog/imx2_wdt.c1
-rw-r--r--fs/cifs/cifsfs.c16
-rw-r--r--fs/cifs/cifsproto.h1
-rw-r--r--fs/cifs/dir.c76
-rw-r--r--fs/cifs/file.c100
-rw-r--r--fs/cifs/inode.c4
-rw-r--r--fs/cifs/sess.c10
-rw-r--r--fs/ext2/acl.c1
-rw-r--r--fs/ext3/acl.c1
-rw-r--r--fs/nfs/client.c122
-rw-r--r--fs/nfs/getroot.c2
-rw-r--r--fs/nfs/nfs4xdr.c4
-rw-r--r--fs/nfs/super.c22
-rw-r--r--fs/ocfs2/reservations.c1
-rw-r--r--fs/proc/proc_devtree.c3
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acpixf.h1
-rw-r--r--include/acpi/actypes.h3
-rw-r--r--include/linux/cgroup.h20
-rw-r--r--include/linux/suspend.h26
-rw-r--r--include/linux/tracepoint.h1
-rw-r--r--include/net/snmp.h2
-rw-r--r--init/main.c4
-rw-r--r--kernel/irq/manage.c3
-rw-r--r--kernel/power/Kconfig9
-rw-r--r--kernel/power/Makefile2
-rw-r--r--kernel/power/nvs.c (renamed from kernel/power/hibernate_nvs.c)24
-rw-r--r--kernel/power/suspend.c6
-rw-r--r--kernel/sched.c133
-rw-r--r--kernel/sched_fair.c2
-rw-r--r--kernel/time/tick-sched.c5
-rw-r--r--kernel/trace/trace_event_perf.c4
-rw-r--r--lib/idr.c4
-rw-r--r--mm/percpu.c36
-rw-r--r--net/bluetooth/bnep/netdev.c2
-rw-r--r--net/bridge/br_fdb.c6
-rw-r--r--net/bridge/br_forward.c4
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/ipv4/ip_output.c9
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/mac80211/work.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_conn.c4
-rw-r--r--net/sched/sch_teql.c1
-rw-r--r--net/sunrpc/xprtsock.c38
-rw-r--r--net/xfrm/xfrm_policy.c3
-rw-r--r--scripts/mod/modpost.c2
-rw-r--r--security/keys/keyctl.c4
-rw-r--r--sound/pci/asihpi/hpi6205.c22
-rw-r--r--sound/pci/hda/patch_realtek.c35
-rw-r--r--sound/soc/davinci/davinci-mcasp.c2
-rw-r--r--sound/soc/fsl/mpc5200_dma.h2
-rw-r--r--sound/usb/clock.c12
-rw-r--r--sound/usb/endpoint.c1
-rw-r--r--sound/usb/format.c104
-rw-r--r--sound/usb/helper.h4
-rw-r--r--sound/usb/mixer.c19
-rw-r--r--tools/perf/builtin-record.c2
-rw-r--r--tools/perf/util/event.c4
-rw-r--r--tools/perf/util/newt.c15
-rw-r--r--tools/perf/util/session.c11
-rw-r--r--tools/perf/util/session.h2
-rw-r--r--tools/perf/util/thread.h5
268 files changed, 2055 insertions, 1693 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 1808f1157f30..82d6aeb5228f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2048,7 +2048,9 @@ and is between 256 and 4096 characters. It is defined in the file
2048 WARNING: Forcing ASPM on may cause system lockups. 2048 WARNING: Forcing ASPM on may cause system lockups.
2049 2049
2050 pcie_pme= [PCIE,PM] Native PCIe PME signaling options: 2050 pcie_pme= [PCIE,PM] Native PCIe PME signaling options:
2051 off Do not use native PCIe PME signaling. 2051 Format: {auto|force}[,nomsi]
2052 auto Use native PCIe PME signaling if the BIOS allows the
2053 kernel to control PCIe config registers of root ports.
2052 force Use native PCIe PME signaling even if the BIOS refuses 2054 force Use native PCIe PME signaling even if the BIOS refuses
2053 to allow the kernel to control the relevant PCIe config 2055 to allow the kernel to control the relevant PCIe config
2054 registers. 2056 registers.
diff --git a/MAINTAINERS b/MAINTAINERS
index b7ae5fb9f8bc..f9730fa0b24c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1581,7 +1581,7 @@ F: include/linux/coda*.h
1581 1581
1582COMMON INTERNET FILE SYSTEM (CIFS) 1582COMMON INTERNET FILE SYSTEM (CIFS)
1583M: Steve French <sfrench@samba.org> 1583M: Steve French <sfrench@samba.org>
1584L: linux-cifs-client@lists.samba.org (moderated for non-subscribers) 1584L: linux-cifs@vger.kernel.org
1585L: samba-technical@lists.samba.org (moderated for non-subscribers) 1585L: samba-technical@lists.samba.org (moderated for non-subscribers)
1586W: http://linux-cifs.samba.org/ 1586W: http://linux-cifs.samba.org/
1587Q: http://patchwork.ozlabs.org/project/linux-cifs-client/list/ 1587Q: http://patchwork.ozlabs.org/project/linux-cifs-client/list/
@@ -2887,6 +2887,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
2887S: Maintained 2887S: Maintained
2888F: drivers/input/ 2888F: drivers/input/
2889 2889
2890INPUT MULTITOUCH (MT) PROTOCOL
2891M: Henrik Rydberg <rydberg@euromail.se>
2892L: linux-input@vger.kernel.org
2893S: Maintained
2894F: Documentation/input/multi-touch-protocol.txt
2895K: \b(ABS|SYN)_MT_
2896
2890INTEL IDLE DRIVER 2897INTEL IDLE DRIVER
2891M: Len Brown <lenb@kernel.org> 2898M: Len Brown <lenb@kernel.org>
2892L: linux-pm@lists.linux-foundation.org 2899L: linux-pm@lists.linux-foundation.org
@@ -2978,20 +2985,14 @@ F: drivers/net/ixgb/
2978F: drivers/net/ixgbe/ 2985F: drivers/net/ixgbe/
2979 2986
2980INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT 2987INTEL PRO/WIRELESS 2100 NETWORK CONNECTION SUPPORT
2981M: Reinette Chatre <reinette.chatre@intel.com>
2982M: Intel Linux Wireless <ilw@linux.intel.com>
2983L: linux-wireless@vger.kernel.org 2988L: linux-wireless@vger.kernel.org
2984W: http://ipw2100.sourceforge.net 2989S: Orphan
2985S: Odd Fixes
2986F: Documentation/networking/README.ipw2100 2990F: Documentation/networking/README.ipw2100
2987F: drivers/net/wireless/ipw2x00/ipw2100.* 2991F: drivers/net/wireless/ipw2x00/ipw2100.*
2988 2992
2989INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT 2993INTEL PRO/WIRELESS 2915ABG NETWORK CONNECTION SUPPORT
2990M: Reinette Chatre <reinette.chatre@intel.com>
2991M: Intel Linux Wireless <ilw@linux.intel.com>
2992L: linux-wireless@vger.kernel.org 2994L: linux-wireless@vger.kernel.org
2993W: http://ipw2200.sourceforge.net 2995S: Orphan
2994S: Odd Fixes
2995F: Documentation/networking/README.ipw2200 2996F: Documentation/networking/README.ipw2200
2996F: drivers/net/wireless/ipw2x00/ipw2200.* 2997F: drivers/net/wireless/ipw2x00/ipw2200.*
2997 2998
@@ -4205,6 +4206,7 @@ OPEN FIRMWARE AND FLATTENED DEVICE TREE
4205M: Grant Likely <grant.likely@secretlab.ca> 4206M: Grant Likely <grant.likely@secretlab.ca>
4206L: devicetree-discuss@lists.ozlabs.org 4207L: devicetree-discuss@lists.ozlabs.org
4207W: http://fdt.secretlab.ca 4208W: http://fdt.secretlab.ca
4209T: git git://git.secretlab.ca/git/linux-2.6.git
4208S: Maintained 4210S: Maintained
4209F: drivers/of 4211F: drivers/of
4210F: include/linux/of*.h 4212F: include/linux/of*.h
@@ -5377,6 +5379,7 @@ M: David Brownell <dbrownell@users.sourceforge.net>
5377M: Grant Likely <grant.likely@secretlab.ca> 5379M: Grant Likely <grant.likely@secretlab.ca>
5378L: spi-devel-general@lists.sourceforge.net 5380L: spi-devel-general@lists.sourceforge.net
5379Q: http://patchwork.kernel.org/project/spi-devel-general/list/ 5381Q: http://patchwork.kernel.org/project/spi-devel-general/list/
5382T: git git://git.secretlab.ca/git/linux-2.6.git
5380S: Maintained 5383S: Maintained
5381F: Documentation/spi/ 5384F: Documentation/spi/
5382F: drivers/spi/ 5385F: drivers/spi/
diff --git a/Makefile b/Makefile
index 865718f4bcea..f6c206a5b01a 100644
--- a/Makefile
+++ b/Makefile
@@ -944,7 +944,7 @@ ifdef CONFIG_LOCALVERSION_AUTO
944 localver-extra = $(scm-identifier) 944 localver-extra = $(scm-identifier)
945else 945else
946 ifneq ($(scm-identifier),) 946 ifneq ($(scm-identifier),)
947 ifeq ($(LOCALVERSION),) 947 ifeq ("$(origin LOCALVERSION)", "undefined")
948 localver-extra = + 948 localver-extra = +
949 endif 949 endif
950 endif 950 endif
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h
index 1dce24bc455a..adfab8a21dfe 100644
--- a/arch/alpha/include/asm/bitops.h
+++ b/arch/alpha/include/asm/bitops.h
@@ -410,7 +410,7 @@ static inline unsigned long __arch_hweight64(unsigned long w)
410 return __kernel_ctpop(w); 410 return __kernel_ctpop(w);
411} 411}
412 412
413static inline unsigned int __arch_weight32(unsigned int w) 413static inline unsigned int __arch_hweight32(unsigned int w)
414{ 414{
415 return __arch_hweight64(w); 415 return __arch_hweight64(w);
416} 416}
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index 7739a62440a7..5a62fb46ef20 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -35,7 +35,7 @@ endif
35 35
36obj-y += irq_pyxis.o irq_i8259.o irq_srm.o 36obj-y += irq_pyxis.o irq_i8259.o irq_srm.o
37obj-y += err_ev6.o 37obj-y += err_ev6.o
38obj-y += es1888.o smc37c669.o smc37c93x.o ns87312.o gct.o 38obj-y += es1888.o smc37c669.o smc37c93x.o pc873xx.o gct.o
39obj-y += srmcons.o 39obj-y += srmcons.o
40 40
41else 41else
@@ -63,11 +63,11 @@ obj-$(CONFIG_ALPHA_WILDFIRE) += core_wildfire.o
63# Board support 63# Board support
64obj-$(CONFIG_ALPHA_ALCOR) += sys_alcor.o irq_i8259.o irq_srm.o 64obj-$(CONFIG_ALPHA_ALCOR) += sys_alcor.o irq_i8259.o irq_srm.o
65obj-$(CONFIG_ALPHA_CABRIOLET) += sys_cabriolet.o irq_i8259.o irq_srm.o \ 65obj-$(CONFIG_ALPHA_CABRIOLET) += sys_cabriolet.o irq_i8259.o irq_srm.o \
66 ns87312.o 66 pc873xx.o
67obj-$(CONFIG_ALPHA_EB164) += sys_cabriolet.o irq_i8259.o irq_srm.o \ 67obj-$(CONFIG_ALPHA_EB164) += sys_cabriolet.o irq_i8259.o irq_srm.o \
68 ns87312.o 68 pc873xx.o
69obj-$(CONFIG_ALPHA_EB66P) += sys_cabriolet.o irq_i8259.o irq_srm.o \ 69obj-$(CONFIG_ALPHA_EB66P) += sys_cabriolet.o irq_i8259.o irq_srm.o \
70 ns87312.o 70 pc873xx.o
71obj-$(CONFIG_ALPHA_LX164) += sys_cabriolet.o irq_i8259.o irq_srm.o \ 71obj-$(CONFIG_ALPHA_LX164) += sys_cabriolet.o irq_i8259.o irq_srm.o \
72 smc37c93x.o 72 smc37c93x.o
73obj-$(CONFIG_ALPHA_PC164) += sys_cabriolet.o irq_i8259.o irq_srm.o \ 73obj-$(CONFIG_ALPHA_PC164) += sys_cabriolet.o irq_i8259.o irq_srm.o \
@@ -90,14 +90,14 @@ obj-$(CONFIG_ALPHA_RUFFIAN) += sys_ruffian.o irq_pyxis.o irq_i8259.o
90obj-$(CONFIG_ALPHA_RX164) += sys_rx164.o irq_i8259.o 90obj-$(CONFIG_ALPHA_RX164) += sys_rx164.o irq_i8259.o
91obj-$(CONFIG_ALPHA_SABLE) += sys_sable.o 91obj-$(CONFIG_ALPHA_SABLE) += sys_sable.o
92obj-$(CONFIG_ALPHA_LYNX) += sys_sable.o 92obj-$(CONFIG_ALPHA_LYNX) += sys_sable.o
93obj-$(CONFIG_ALPHA_BOOK1) += sys_sio.o irq_i8259.o irq_srm.o ns87312.o 93obj-$(CONFIG_ALPHA_BOOK1) += sys_sio.o irq_i8259.o irq_srm.o pc873xx.o
94obj-$(CONFIG_ALPHA_AVANTI) += sys_sio.o irq_i8259.o irq_srm.o ns87312.o 94obj-$(CONFIG_ALPHA_AVANTI) += sys_sio.o irq_i8259.o irq_srm.o pc873xx.o
95obj-$(CONFIG_ALPHA_NONAME) += sys_sio.o irq_i8259.o irq_srm.o ns87312.o 95obj-$(CONFIG_ALPHA_NONAME) += sys_sio.o irq_i8259.o irq_srm.o pc873xx.o
96obj-$(CONFIG_ALPHA_P2K) += sys_sio.o irq_i8259.o irq_srm.o ns87312.o 96obj-$(CONFIG_ALPHA_P2K) += sys_sio.o irq_i8259.o irq_srm.o pc873xx.o
97obj-$(CONFIG_ALPHA_XL) += sys_sio.o irq_i8259.o irq_srm.o ns87312.o 97obj-$(CONFIG_ALPHA_XL) += sys_sio.o irq_i8259.o irq_srm.o pc873xx.o
98obj-$(CONFIG_ALPHA_SX164) += sys_sx164.o irq_pyxis.o irq_i8259.o \ 98obj-$(CONFIG_ALPHA_SX164) += sys_sx164.o irq_pyxis.o irq_i8259.o \
99 irq_srm.o smc37c669.o 99 irq_srm.o smc37c669.o
100obj-$(CONFIG_ALPHA_TAKARA) += sys_takara.o irq_i8259.o ns87312.o 100obj-$(CONFIG_ALPHA_TAKARA) += sys_takara.o irq_i8259.o pc873xx.o
101obj-$(CONFIG_ALPHA_WILDFIRE) += sys_wildfire.o irq_i8259.o 101obj-$(CONFIG_ALPHA_WILDFIRE) += sys_wildfire.o irq_i8259.o
102 102
103# Error support 103# Error support
diff --git a/arch/alpha/kernel/ns87312.c b/arch/alpha/kernel/ns87312.c
deleted file mode 100644
index 342b56d24c20..000000000000
--- a/arch/alpha/kernel/ns87312.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * linux/arch/alpha/kernel/ns87312.c
3 */
4
5#include <linux/init.h>
6#include <asm/io.h>
7#include "proto.h"
8
9
10/*
11 * The SRM console *disables* the IDE interface, this code ensures it's
12 * enabled.
13 *
14 * This code bangs on a control register of the 87312 Super I/O chip
15 * that implements parallel port/serial ports/IDE/FDI. Depending on
16 * the motherboard, the Super I/O chip can be configured through a
17 * pair of registers that are located either at I/O ports 0x26e/0x26f
18 * or 0x398/0x399. Unfortunately, autodetecting which base address is
19 * in use works only once (right after a reset). The Super I/O chip
20 * has the additional quirk that configuration register data must be
21 * written twice (I believe this is a safety feature to prevent
22 * accidental modification---fun, isn't it?).
23 */
24
25void __init
26ns87312_enable_ide(long ide_base)
27{
28 int data;
29 unsigned long flags;
30
31 local_irq_save(flags);
32 outb(0, ide_base); /* set the index register for reg #0 */
33 data = inb(ide_base+1); /* read the current contents */
34 outb(0, ide_base); /* set the index register for reg #0 */
35 outb(data | 0x40, ide_base+1); /* turn on IDE */
36 outb(data | 0x40, ide_base+1); /* turn on IDE, really! */
37 local_irq_restore(flags);
38}
diff --git a/arch/alpha/kernel/pc873xx.c b/arch/alpha/kernel/pc873xx.c
new file mode 100644
index 000000000000..27dcbff85613
--- /dev/null
+++ b/arch/alpha/kernel/pc873xx.c
@@ -0,0 +1,88 @@
1#include <linux/ioport.h>
2#include <asm/io.h>
3
4#include "pc873xx.h"
5
6static unsigned pc873xx_probelist[] = {0x398, 0x26e, 0};
7
8static char *pc873xx_names[] = {
9 "PC87303", "PC87306", "PC87312", "PC87332", "PC87334"
10};
11
12static unsigned int base, model;
13
14
15unsigned int __init pc873xx_get_base()
16{
17 return base;
18}
19
20char *__init pc873xx_get_model()
21{
22 return pc873xx_names[model];
23}
24
25static unsigned char __init pc873xx_read(unsigned int base, int reg)
26{
27 outb(reg, base);
28 return inb(base + 1);
29}
30
31static void __init pc873xx_write(unsigned int base, int reg, unsigned char data)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36 outb(reg, base);
37 outb(data, base + 1);
38 outb(data, base + 1); /* Must be written twice */
39 local_irq_restore(flags);
40}
41
42int __init pc873xx_probe(void)
43{
44 int val, index = 0;
45
46 while ((base = pc873xx_probelist[index++])) {
47
48 if (request_region(base, 2, "Super IO PC873xx") == NULL)
49 continue;
50
51 val = pc873xx_read(base, REG_SID);
52 if ((val & 0xf0) == 0x10) {
53 model = PC87332;
54 break;
55 } else if ((val & 0xf8) == 0x70) {
56 model = PC87306;
57 break;
58 } else if ((val & 0xf8) == 0x50) {
59 model = PC87334;
60 break;
61 } else if ((val & 0xf8) == 0x40) {
62 model = PC87303;
63 break;
64 }
65
66 release_region(base, 2);
67 }
68
69 return (base == 0) ? -1 : 1;
70}
71
72void __init pc873xx_enable_epp19(void)
73{
74 unsigned char data;
75
76 printk(KERN_INFO "PC873xx enabling EPP v1.9\n");
77 data = pc873xx_read(base, REG_PCR);
78 pc873xx_write(base, REG_PCR, (data & 0xFC) | 0x02);
79}
80
81void __init pc873xx_enable_ide(void)
82{
83 unsigned char data;
84
85 printk(KERN_INFO "PC873xx enabling IDE interrupt\n");
86 data = pc873xx_read(base, REG_FER);
87 pc873xx_write(base, REG_FER, data | 0x40);
88}
diff --git a/arch/alpha/kernel/pc873xx.h b/arch/alpha/kernel/pc873xx.h
new file mode 100644
index 000000000000..25e16956fe3e
--- /dev/null
+++ b/arch/alpha/kernel/pc873xx.h
@@ -0,0 +1,35 @@
1
2#ifndef _PC873xx_H_
3#define _PC873xx_H_
4
5/*
6 * Control Register Values
7 */
8#define REG_FER 0x00
9#define REG_FAR 0x01
10#define REG_PTR 0x02
11#define REG_FCR 0x03
12#define REG_PCR 0x04
13#define REG_KRR 0x05
14#define REG_PMC 0x06
15#define REG_TUP 0x07
16#define REG_SID 0x08
17#define REG_ASC 0x09
18#define REG_IRC 0x0e
19
20/*
21 * Model numbers
22 */
23#define PC87303 0
24#define PC87306 1
25#define PC87312 2
26#define PC87332 3
27#define PC87334 4
28
29int pc873xx_probe(void);
30unsigned int pc873xx_get_base(void);
31char *pc873xx_get_model(void);
32void pc873xx_enable_epp19(void);
33void pc873xx_enable_ide(void);
34
35#endif
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index a5fffc882c72..738fc824e2ea 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -53,7 +53,6 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
53 53
54/** 54/**
55 * pci_mmap_resource - map a PCI resource into user memory space 55 * pci_mmap_resource - map a PCI resource into user memory space
56 * @filp: open sysfs file
57 * @kobj: kobject for mapping 56 * @kobj: kobject for mapping
58 * @attr: struct bin_attribute for the file being mapped 57 * @attr: struct bin_attribute for the file being mapped
59 * @vma: struct vm_area_struct passed into the mmap 58 * @vma: struct vm_area_struct passed into the mmap
@@ -61,7 +60,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
61 * 60 *
62 * Use the bus mapping routines to map a PCI resource into userspace. 61 * Use the bus mapping routines to map a PCI resource into userspace.
63 */ 62 */
64static int pci_mmap_resource(struct file *filp, struct kobject *kobj, 63static int pci_mmap_resource(struct kobject *kobj,
65 struct bin_attribute *attr, 64 struct bin_attribute *attr,
66 struct vm_area_struct *vma, int sparse) 65 struct vm_area_struct *vma, int sparse)
67{ 66{
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index d4327e461c22..85b4aea01ef8 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -34,6 +34,7 @@
34#include "irq_impl.h" 34#include "irq_impl.h"
35#include "pci_impl.h" 35#include "pci_impl.h"
36#include "machvec_impl.h" 36#include "machvec_impl.h"
37#include "pc873xx.h"
37 38
38#if defined(ALPHA_RESTORE_SRM_SETUP) 39#if defined(ALPHA_RESTORE_SRM_SETUP)
39/* Save LCA configuration data as the console had it set up. */ 40/* Save LCA configuration data as the console had it set up. */
@@ -208,7 +209,27 @@ noname_init_pci(void)
208 common_init_pci(); 209 common_init_pci();
209 sio_pci_route(); 210 sio_pci_route();
210 sio_fixup_irq_levels(sio_collect_irq_levels()); 211 sio_fixup_irq_levels(sio_collect_irq_levels());
211 ns87312_enable_ide(0x26e); 212
213 if (pc873xx_probe() == -1) {
214 printk(KERN_ERR "Probing for PC873xx Super IO chip failed.\n");
215 } else {
216 printk(KERN_INFO "Found %s Super IO chip at 0x%x\n",
217 pc873xx_get_model(), pc873xx_get_base());
218
219 /* Enabling things in the Super IO chip doesn't actually
220 * configure and enable things, the legacy drivers still
221 * need to do the actual configuration and enabling.
222 * This only unblocks them.
223 */
224
225#if !defined(CONFIG_ALPHA_AVANTI)
226 /* Don't bother on the Avanti family.
227 * None of them had on-board IDE.
228 */
229 pc873xx_enable_ide();
230#endif
231 pc873xx_enable_epp19();
232 }
212} 233}
213 234
214static inline void __init 235static inline void __init
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index e6f73030d5f0..9b11eedba65f 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -2,6 +2,7 @@
2 * Versatile Express Core Tile Cortex A9x4 Support 2 * Versatile Express Core Tile Cortex A9x4 Support
3 */ 3 */
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/gfp.h>
5#include <linux/device.h> 6#include <linux/device.h>
6#include <linux/dma-mapping.h> 7#include <linux/dma-mapping.h>
7#include <linux/platform_device.h> 8#include <linux/platform_device.h>
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 53696da4518f..2d38a50e66ba 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -135,13 +135,6 @@ config DEBUGGER
135 depends on KGDB || XMON 135 depends on KGDB || XMON
136 default y 136 default y
137 137
138config IRQSTACKS
139 bool "Use separate kernel stacks when processing interrupts"
140 help
141 If you say Y here the kernel will use separate kernel stacks
142 for handling hard and soft interrupts. This can help avoid
143 overflowing the process kernel stacks.
144
145config VIRQ_DEBUG 138config VIRQ_DEBUG
146 bool "Expose hardware/virtual IRQ mapping via debugfs" 139 bool "Expose hardware/virtual IRQ mapping via debugfs"
147 depends on DEBUG_FS 140 depends on DEBUG_FS
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index ad0df7d0a643..fae8192c8fcc 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -141,7 +141,7 @@ $(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S FORCE
141$(obj)/wrapper.a: $(obj-wlib) FORCE 141$(obj)/wrapper.a: $(obj-wlib) FORCE
142 $(call if_changed,bootar) 142 $(call if_changed,bootar)
143 143
144hostprogs-y := addnote addRamDisk hack-coff mktree 144hostprogs-y := addnote hack-coff mktree
145 145
146targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a) 146targets += $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
147extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \ 147extra-y := $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
diff --git a/arch/powerpc/boot/addRamDisk.c b/arch/powerpc/boot/addRamDisk.c
deleted file mode 100644
index 893f446cbd22..000000000000
--- a/arch/powerpc/boot/addRamDisk.c
+++ /dev/null
@@ -1,311 +0,0 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <netinet/in.h>
4#include <unistd.h>
5#include <sys/types.h>
6#include <sys/stat.h>
7#include <string.h>
8#include <elf.h>
9
10#define ElfHeaderSize (64 * 1024)
11#define ElfPages (ElfHeaderSize / 4096)
12#define KERNELBASE (0xc000000000000000)
13#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
14
15struct addr_range {
16 unsigned long long addr;
17 unsigned long memsize;
18 unsigned long offset;
19};
20
21static int check_elf64(void *p, int size, struct addr_range *r)
22{
23 Elf64_Ehdr *elf64 = p;
24 Elf64_Phdr *elf64ph;
25
26 if (elf64->e_ident[EI_MAG0] != ELFMAG0 ||
27 elf64->e_ident[EI_MAG1] != ELFMAG1 ||
28 elf64->e_ident[EI_MAG2] != ELFMAG2 ||
29 elf64->e_ident[EI_MAG3] != ELFMAG3 ||
30 elf64->e_ident[EI_CLASS] != ELFCLASS64 ||
31 elf64->e_ident[EI_DATA] != ELFDATA2MSB ||
32 elf64->e_type != ET_EXEC || elf64->e_machine != EM_PPC64)
33 return 0;
34
35 if ((elf64->e_phoff + sizeof(Elf64_Phdr)) > size)
36 return 0;
37
38 elf64ph = (Elf64_Phdr *) ((unsigned long)elf64 +
39 (unsigned long)elf64->e_phoff);
40
41 r->memsize = (unsigned long)elf64ph->p_memsz;
42 r->offset = (unsigned long)elf64ph->p_offset;
43 r->addr = (unsigned long long)elf64ph->p_vaddr;
44
45#ifdef DEBUG
46 printf("PPC64 ELF file, ph:\n");
47 printf("p_type 0x%08x\n", elf64ph->p_type);
48 printf("p_flags 0x%08x\n", elf64ph->p_flags);
49 printf("p_offset 0x%016llx\n", elf64ph->p_offset);
50 printf("p_vaddr 0x%016llx\n", elf64ph->p_vaddr);
51 printf("p_paddr 0x%016llx\n", elf64ph->p_paddr);
52 printf("p_filesz 0x%016llx\n", elf64ph->p_filesz);
53 printf("p_memsz 0x%016llx\n", elf64ph->p_memsz);
54 printf("p_align 0x%016llx\n", elf64ph->p_align);
55 printf("... skipping 0x%08lx bytes of ELF header\n",
56 (unsigned long)elf64ph->p_offset);
57#endif
58
59 return 64;
60}
61static void get4k(FILE *file, char *buf )
62{
63 unsigned j;
64 unsigned num = fread(buf, 1, 4096, file);
65 for ( j=num; j<4096; ++j )
66 buf[j] = 0;
67}
68
69static void put4k(FILE *file, char *buf )
70{
71 fwrite(buf, 1, 4096, file);
72}
73
74static void death(const char *msg, FILE *fdesc, const char *fname)
75{
76 fprintf(stderr, msg);
77 fclose(fdesc);
78 unlink(fname);
79 exit(1);
80}
81
82int main(int argc, char **argv)
83{
84 char inbuf[4096];
85 struct addr_range vmlinux;
86 FILE *ramDisk;
87 FILE *inputVmlinux;
88 FILE *outputVmlinux;
89
90 char *rd_name, *lx_name, *out_name;
91
92 size_t i;
93 unsigned long ramFileLen;
94 unsigned long ramLen;
95 unsigned long roundR;
96 unsigned long offset_end;
97
98 unsigned long kernelLen;
99 unsigned long actualKernelLen;
100 unsigned long round;
101 unsigned long roundedKernelLen;
102 unsigned long ramStartOffs;
103 unsigned long ramPages;
104 unsigned long roundedKernelPages;
105 unsigned long hvReleaseData;
106 u_int32_t eyeCatcher = 0xc8a5d9c4;
107 unsigned long naca;
108 unsigned long xRamDisk;
109 unsigned long xRamDiskSize;
110 long padPages;
111
112
113 if (argc < 2) {
114 fprintf(stderr, "Name of RAM disk file missing.\n");
115 exit(1);
116 }
117 rd_name = argv[1];
118
119 if (argc < 3) {
120 fprintf(stderr, "Name of vmlinux file missing.\n");
121 exit(1);
122 }
123 lx_name = argv[2];
124
125 if (argc < 4) {
126 fprintf(stderr, "Name of vmlinux output file missing.\n");
127 exit(1);
128 }
129 out_name = argv[3];
130
131
132 ramDisk = fopen(rd_name, "r");
133 if ( ! ramDisk ) {
134 fprintf(stderr, "RAM disk file \"%s\" failed to open.\n", rd_name);
135 exit(1);
136 }
137
138 inputVmlinux = fopen(lx_name, "r");
139 if ( ! inputVmlinux ) {
140 fprintf(stderr, "vmlinux file \"%s\" failed to open.\n", lx_name);
141 exit(1);
142 }
143
144 outputVmlinux = fopen(out_name, "w+");
145 if ( ! outputVmlinux ) {
146 fprintf(stderr, "output vmlinux file \"%s\" failed to open.\n", out_name);
147 exit(1);
148 }
149
150 i = fread(inbuf, 1, sizeof(inbuf), inputVmlinux);
151 if (i != sizeof(inbuf)) {
152 fprintf(stderr, "can not read vmlinux file %s: %u\n", lx_name, i);
153 exit(1);
154 }
155
156 i = check_elf64(inbuf, sizeof(inbuf), &vmlinux);
157 if (i == 0) {
158 fprintf(stderr, "You must have a linux kernel specified as argv[2]\n");
159 exit(1);
160 }
161
162 /* Input Vmlinux file */
163 fseek(inputVmlinux, 0, SEEK_END);
164 kernelLen = ftell(inputVmlinux);
165 fseek(inputVmlinux, 0, SEEK_SET);
166 printf("kernel file size = %lu\n", kernelLen);
167
168 actualKernelLen = kernelLen - ElfHeaderSize;
169
170 printf("actual kernel length (minus ELF header) = %lu\n", actualKernelLen);
171
172 round = actualKernelLen % 4096;
173 roundedKernelLen = actualKernelLen;
174 if ( round )
175 roundedKernelLen += (4096 - round);
176 printf("Vmlinux length rounded up to a 4k multiple = %ld/0x%lx \n", roundedKernelLen, roundedKernelLen);
177 roundedKernelPages = roundedKernelLen / 4096;
178 printf("Vmlinux pages to copy = %ld/0x%lx \n", roundedKernelPages, roundedKernelPages);
179
180 offset_end = _ALIGN_UP(vmlinux.memsize, 4096);
181 /* calc how many pages we need to insert between the vmlinux and the start of the ram disk */
182 padPages = offset_end/4096 - roundedKernelPages;
183
184 /* Check and see if the vmlinux is already larger than _end in System.map */
185 if (padPages < 0) {
186 /* vmlinux is larger than _end - adjust the offset to the start of the embedded ram disk */
187 offset_end = roundedKernelLen;
188 printf("vmlinux is larger than _end indicates it needs to be - offset_end = %lx \n", offset_end);
189 padPages = 0;
190 printf("will insert %lx pages between the vmlinux and the start of the ram disk \n", padPages);
191 }
192 else {
193 /* _end is larger than vmlinux - use the offset to _end that we calculated from the system map */
194 printf("vmlinux is smaller than _end indicates is needed - offset_end = %lx \n", offset_end);
195 printf("will insert %lx pages between the vmlinux and the start of the ram disk \n", padPages);
196 }
197
198
199
200 /* Input Ram Disk file */
201 // Set the offset that the ram disk will be started at.
202 ramStartOffs = offset_end; /* determined from the input vmlinux file and the system map */
203 printf("Ram Disk will start at offset = 0x%lx \n", ramStartOffs);
204
205 fseek(ramDisk, 0, SEEK_END);
206 ramFileLen = ftell(ramDisk);
207 fseek(ramDisk, 0, SEEK_SET);
208 printf("%s file size = %ld/0x%lx \n", rd_name, ramFileLen, ramFileLen);
209
210 ramLen = ramFileLen;
211
212 roundR = 4096 - (ramLen % 4096);
213 if ( roundR ) {
214 printf("Rounding RAM disk file up to a multiple of 4096, adding %ld/0x%lx \n", roundR, roundR);
215 ramLen += roundR;
216 }
217
218 printf("Rounded RAM disk size is %ld/0x%lx \n", ramLen, ramLen);
219 ramPages = ramLen / 4096;
220 printf("RAM disk pages to copy = %ld/0x%lx\n", ramPages, ramPages);
221
222
223
224 // Copy 64K ELF header
225 for (i=0; i<(ElfPages); ++i) {
226 get4k( inputVmlinux, inbuf );
227 put4k( outputVmlinux, inbuf );
228 }
229
230 /* Copy the vmlinux (as full pages). */
231 fseek(inputVmlinux, ElfHeaderSize, SEEK_SET);
232 for ( i=0; i<roundedKernelPages; ++i ) {
233 get4k( inputVmlinux, inbuf );
234 put4k( outputVmlinux, inbuf );
235 }
236
237 /* Insert pad pages (if appropriate) that are needed between */
238 /* | the end of the vmlinux and the ram disk. */
239 for (i=0; i<padPages; ++i) {
240 memset(inbuf, 0, 4096);
241 put4k(outputVmlinux, inbuf);
242 }
243
244 /* Copy the ram disk (as full pages). */
245 for ( i=0; i<ramPages; ++i ) {
246 get4k( ramDisk, inbuf );
247 put4k( outputVmlinux, inbuf );
248 }
249
250 /* Close the input files */
251 fclose(ramDisk);
252 fclose(inputVmlinux);
253 /* And flush the written output file */
254 fflush(outputVmlinux);
255
256
257
258 /* Fixup the new vmlinux to contain the ram disk starting offset (xRamDisk) and the ram disk size (xRamDiskSize) */
259 /* fseek to the hvReleaseData pointer */
260 fseek(outputVmlinux, ElfHeaderSize + 0x24, SEEK_SET);
261 if (fread(&hvReleaseData, 4, 1, outputVmlinux) != 1) {
262 death("Could not read hvReleaseData pointer\n", outputVmlinux, out_name);
263 }
264 hvReleaseData = ntohl(hvReleaseData); /* Convert to native int */
265 printf("hvReleaseData is at %08lx\n", hvReleaseData);
266
267 /* fseek to the hvReleaseData */
268 fseek(outputVmlinux, ElfHeaderSize + hvReleaseData, SEEK_SET);
269 if (fread(inbuf, 0x40, 1, outputVmlinux) != 1) {
270 death("Could not read hvReleaseData\n", outputVmlinux, out_name);
271 }
272 /* Check hvReleaseData sanity */
273 if (memcmp(inbuf, &eyeCatcher, 4) != 0) {
274 death("hvReleaseData is invalid\n", outputVmlinux, out_name);
275 }
276 /* Get the naca pointer */
277 naca = ntohl(*((u_int32_t*) &inbuf[0x0C])) - KERNELBASE;
278 printf("Naca is at offset 0x%lx \n", naca);
279
280 /* fseek to the naca */
281 fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
282 if (fread(inbuf, 0x18, 1, outputVmlinux) != 1) {
283 death("Could not read naca\n", outputVmlinux, out_name);
284 }
285 xRamDisk = ntohl(*((u_int32_t *) &inbuf[0x0c]));
286 xRamDiskSize = ntohl(*((u_int32_t *) &inbuf[0x14]));
287 /* Make sure a RAM disk isn't already present */
288 if ((xRamDisk != 0) || (xRamDiskSize != 0)) {
289 death("RAM disk is already attached to this kernel\n", outputVmlinux, out_name);
290 }
291 /* Fill in the values */
292 *((u_int32_t *) &inbuf[0x0c]) = htonl(ramStartOffs);
293 *((u_int32_t *) &inbuf[0x14]) = htonl(ramPages);
294
295 /* Write out the new naca */
296 fflush(outputVmlinux);
297 fseek(outputVmlinux, ElfHeaderSize + naca, SEEK_SET);
298 if (fwrite(inbuf, 0x18, 1, outputVmlinux) != 1) {
299 death("Could not write naca\n", outputVmlinux, out_name);
300 }
301 printf("Ram Disk of 0x%lx pages is attached to the kernel at offset 0x%08lx\n",
302 ramPages, ramStartOffs);
303
304 /* Done */
305 fclose(outputVmlinux);
306 /* Set permission to executable */
307 chmod(out_name, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
308
309 return 0;
310}
311
diff --git a/arch/powerpc/boot/dts/lite5200.dts b/arch/powerpc/boot/dts/lite5200.dts
index 82ff2b13bc37..179a1785d645 100644
--- a/arch/powerpc/boot/dts/lite5200.dts
+++ b/arch/powerpc/boot/dts/lite5200.dts
@@ -134,12 +134,16 @@
134 compatible = "fsl,mpc5200-gpio"; 134 compatible = "fsl,mpc5200-gpio";
135 reg = <0xb00 0x40>; 135 reg = <0xb00 0x40>;
136 interrupts = <1 7 0>; 136 interrupts = <1 7 0>;
137 gpio-controller;
138 #gpio-cells = <2>;
137 }; 139 };
138 140
139 gpio@c00 { 141 gpio@c00 {
140 compatible = "fsl,mpc5200-gpio-wkup"; 142 compatible = "fsl,mpc5200-gpio-wkup";
141 reg = <0xc00 0x40>; 143 reg = <0xc00 0x40>;
142 interrupts = <1 8 0 0 3 0>; 144 interrupts = <1 8 0 0 3 0>;
145 gpio-controller;
146 #gpio-cells = <2>;
143 }; 147 };
144 148
145 spi@f00 { 149 spi@f00 {
@@ -230,8 +234,8 @@
230 reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts 234 reg = <0x3000 0x400>; // fec range, since we need to setup fec interrupts
231 interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co. 235 interrupts = <2 5 0>; // these are for "mii command finished", not link changes & co.
232 236
233 phy0: ethernet-phy@1 { 237 phy0: ethernet-phy@0 {
234 reg = <1>; 238 reg = <0>;
235 }; 239 };
236 }; 240 };
237 241
@@ -255,7 +259,13 @@
255 compatible = "fsl,mpc5200-i2c","fsl-i2c"; 259 compatible = "fsl,mpc5200-i2c","fsl-i2c";
256 reg = <0x3d40 0x40>; 260 reg = <0x3d40 0x40>;
257 interrupts = <2 16 0>; 261 interrupts = <2 16 0>;
262
263 eeprom@50 {
264 compatible = "atmel,24c02";
265 reg = <0x50>;
266 };
258 }; 267 };
268
259 sram@8000 { 269 sram@8000 {
260 compatible = "fsl,mpc5200-sram"; 270 compatible = "fsl,mpc5200-sram";
261 reg = <0x8000 0x4000>; 271 reg = <0x8000 0x4000>;
@@ -281,4 +291,18 @@
281 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000 291 0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
282 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>; 292 0x01000000 0 0x00000000 0xb0000000 0 0x01000000>;
283 }; 293 };
294
295 localbus {
296 compatible = "fsl,mpc5200-lpb","simple-bus";
297 #address-cells = <2>;
298 #size-cells = <1>;
299
300 ranges = <0 0 0xff000000 0x01000000>;
301
302 flash@0,0 {
303 compatible = "amd,am29lv652d", "cfi-flash";
304 reg = <0 0 0x01000000>;
305 bank-width = <1>;
306 };
307 };
284}; 308};
diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
index e45a63be3a86..59702ace900f 100644
--- a/arch/powerpc/boot/dts/lite5200b.dts
+++ b/arch/powerpc/boot/dts/lite5200b.dts
@@ -259,6 +259,11 @@
259 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c"; 259 compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
260 reg = <0x3d40 0x40>; 260 reg = <0x3d40 0x40>;
261 interrupts = <2 16 0>; 261 interrupts = <2 16 0>;
262
263 eeprom@50 {
264 compatible = "atmel,24c02";
265 reg = <0x50>;
266 };
262 }; 267 };
263 268
264 sram@8000 { 269 sram@8000 {
diff --git a/arch/powerpc/configs/40x/acadia_defconfig b/arch/powerpc/configs/40x/acadia_defconfig
index 8e95f8d227b9..4aa17b676a3f 100644
--- a/arch/powerpc/configs/40x/acadia_defconfig
+++ b/arch/powerpc/configs/40x/acadia_defconfig
@@ -98,8 +98,7 @@ CONFIG_GROUP_SCHED=y
98CONFIG_USER_SCHED=y 98CONFIG_USER_SCHED=y
99# CONFIG_CGROUP_SCHED is not set 99# CONFIG_CGROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/40x/ep405_defconfig b/arch/powerpc/configs/40x/ep405_defconfig
index 918f23fd2b18..9a5f1ab777ed 100644
--- a/arch/powerpc/configs/40x/ep405_defconfig
+++ b/arch/powerpc/configs/40x/ep405_defconfig
@@ -98,8 +98,7 @@ CONFIG_FAIR_GROUP_SCHED=y
98CONFIG_USER_SCHED=y 98CONFIG_USER_SCHED=y
99# CONFIG_CGROUP_SCHED is not set 99# CONFIG_CGROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/40x/hcu4_defconfig b/arch/powerpc/configs/40x/hcu4_defconfig
index f87ef0382280..0b452135d1d4 100644
--- a/arch/powerpc/configs/40x/hcu4_defconfig
+++ b/arch/powerpc/configs/40x/hcu4_defconfig
@@ -98,8 +98,7 @@ CONFIG_FAIR_GROUP_SCHED=y
98CONFIG_USER_SCHED=y 98CONFIG_USER_SCHED=y
99# CONFIG_CGROUP_SCHED is not set 99# CONFIG_CGROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/40x/kilauea_defconfig b/arch/powerpc/configs/40x/kilauea_defconfig
index 19fbcb075376..4d2de0bed60e 100644
--- a/arch/powerpc/configs/40x/kilauea_defconfig
+++ b/arch/powerpc/configs/40x/kilauea_defconfig
@@ -98,8 +98,7 @@ CONFIG_GROUP_SCHED=y
98CONFIG_USER_SCHED=y 98CONFIG_USER_SCHED=y
99# CONFIG_CGROUP_SCHED is not set 99# CONFIG_CGROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/40x/makalu_defconfig b/arch/powerpc/configs/40x/makalu_defconfig
index eb41cd695979..a1f3f505e4a7 100644
--- a/arch/powerpc/configs/40x/makalu_defconfig
+++ b/arch/powerpc/configs/40x/makalu_defconfig
@@ -98,8 +98,7 @@ CONFIG_GROUP_SCHED=y
98CONFIG_USER_SCHED=y 98CONFIG_USER_SCHED=y
99# CONFIG_CGROUP_SCHED is not set 99# CONFIG_CGROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/40x/virtex_defconfig b/arch/powerpc/configs/40x/virtex_defconfig
index 416e79ac0711..c76313577140 100644
--- a/arch/powerpc/configs/40x/virtex_defconfig
+++ b/arch/powerpc/configs/40x/virtex_defconfig
@@ -77,8 +77,7 @@ CONFIG_IKCONFIG_PROC=y
77CONFIG_LOG_BUF_SHIFT=14 77CONFIG_LOG_BUF_SHIFT=14
78# CONFIG_GROUP_SCHED is not set 78# CONFIG_GROUP_SCHED is not set
79# CONFIG_CGROUPS is not set 79# CONFIG_CGROUPS is not set
80CONFIG_SYSFS_DEPRECATED=y 80# CONFIG_SYSFS_DEPRECATED_V2 is not set
81CONFIG_SYSFS_DEPRECATED_V2=y
82# CONFIG_RELAY is not set 81# CONFIG_RELAY is not set
83CONFIG_NAMESPACES=y 82CONFIG_NAMESPACES=y
84# CONFIG_UTS_NS is not set 83# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/40x/walnut_defconfig b/arch/powerpc/configs/40x/walnut_defconfig
index bfff0eae39d2..6597b2f1d1a8 100644
--- a/arch/powerpc/configs/40x/walnut_defconfig
+++ b/arch/powerpc/configs/40x/walnut_defconfig
@@ -98,8 +98,7 @@ CONFIG_FAIR_GROUP_SCHED=y
98CONFIG_USER_SCHED=y 98CONFIG_USER_SCHED=y
99# CONFIG_CGROUP_SCHED is not set 99# CONFIG_CGROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/arches_defconfig b/arch/powerpc/configs/44x/arches_defconfig
index 1f6d0490e28d..2d3dfb55fbed 100644
--- a/arch/powerpc/configs/44x/arches_defconfig
+++ b/arch/powerpc/configs/44x/arches_defconfig
@@ -98,8 +98,7 @@ CONFIG_RCU_FANOUT=32
98CONFIG_LOG_BUF_SHIFT=14 98CONFIG_LOG_BUF_SHIFT=14
99# CONFIG_GROUP_SCHED is not set 99# CONFIG_GROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/bamboo_defconfig b/arch/powerpc/configs/44x/bamboo_defconfig
index 788faac6c27a..51a00c46df19 100644
--- a/arch/powerpc/configs/44x/bamboo_defconfig
+++ b/arch/powerpc/configs/44x/bamboo_defconfig
@@ -102,8 +102,7 @@ CONFIG_FAIR_GROUP_SCHED=y
102CONFIG_USER_SCHED=y 102CONFIG_USER_SCHED=y
103# CONFIG_CGROUP_SCHED is not set 103# CONFIG_CGROUP_SCHED is not set
104# CONFIG_CGROUPS is not set 104# CONFIG_CGROUPS is not set
105CONFIG_SYSFS_DEPRECATED=y 105# CONFIG_SYSFS_DEPRECATED_V2 is not set
106CONFIG_SYSFS_DEPRECATED_V2=y
107# CONFIG_RELAY is not set 106# CONFIG_RELAY is not set
108# CONFIG_NAMESPACES is not set 107# CONFIG_NAMESPACES is not set
109CONFIG_BLK_DEV_INITRD=y 108CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/canyonlands_defconfig b/arch/powerpc/configs/44x/canyonlands_defconfig
index 4ef8bcab61f8..1028b1bfb602 100644
--- a/arch/powerpc/configs/44x/canyonlands_defconfig
+++ b/arch/powerpc/configs/44x/canyonlands_defconfig
@@ -98,8 +98,7 @@ CONFIG_RCU_FANOUT=32
98CONFIG_LOG_BUF_SHIFT=14 98CONFIG_LOG_BUF_SHIFT=14
99# CONFIG_GROUP_SCHED is not set 99# CONFIG_GROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/ebony_defconfig b/arch/powerpc/configs/44x/ebony_defconfig
index ca17b1496e32..69f5633cbd4f 100644
--- a/arch/powerpc/configs/44x/ebony_defconfig
+++ b/arch/powerpc/configs/44x/ebony_defconfig
@@ -101,8 +101,7 @@ CONFIG_FAIR_GROUP_SCHED=y
101CONFIG_USER_SCHED=y 101CONFIG_USER_SCHED=y
102# CONFIG_CGROUP_SCHED is not set 102# CONFIG_CGROUP_SCHED is not set
103# CONFIG_CGROUPS is not set 103# CONFIG_CGROUPS is not set
104CONFIG_SYSFS_DEPRECATED=y 104# CONFIG_SYSFS_DEPRECATED_V2 is not set
105CONFIG_SYSFS_DEPRECATED_V2=y
106# CONFIG_RELAY is not set 105# CONFIG_RELAY is not set
107# CONFIG_NAMESPACES is not set 106# CONFIG_NAMESPACES is not set
108CONFIG_BLK_DEV_INITRD=y 107CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/eiger_defconfig b/arch/powerpc/configs/44x/eiger_defconfig
index e3149bade0b2..dcd859c8b4a6 100644
--- a/arch/powerpc/configs/44x/eiger_defconfig
+++ b/arch/powerpc/configs/44x/eiger_defconfig
@@ -98,8 +98,7 @@ CONFIG_RCU_FANOUT=32
98CONFIG_LOG_BUF_SHIFT=14 98CONFIG_LOG_BUF_SHIFT=14
99# CONFIG_GROUP_SCHED is not set 99# CONFIG_GROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/katmai_defconfig b/arch/powerpc/configs/44x/katmai_defconfig
index af244e1d255e..a2c24d1e051e 100644
--- a/arch/powerpc/configs/44x/katmai_defconfig
+++ b/arch/powerpc/configs/44x/katmai_defconfig
@@ -97,8 +97,7 @@ CONFIG_RCU_FANOUT=32
97CONFIG_LOG_BUF_SHIFT=14 97CONFIG_LOG_BUF_SHIFT=14
98# CONFIG_GROUP_SCHED is not set 98# CONFIG_GROUP_SCHED is not set
99# CONFIG_CGROUPS is not set 99# CONFIG_CGROUPS is not set
100CONFIG_SYSFS_DEPRECATED=y 100# CONFIG_SYSFS_DEPRECATED_V2 is not set
101CONFIG_SYSFS_DEPRECATED_V2=y
102# CONFIG_RELAY is not set 101# CONFIG_RELAY is not set
103# CONFIG_NAMESPACES is not set 102# CONFIG_NAMESPACES is not set
104CONFIG_BLK_DEV_INITRD=y 103CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/rainier_defconfig b/arch/powerpc/configs/44x/rainier_defconfig
index 8fed3b26af2e..3bb55b57077e 100644
--- a/arch/powerpc/configs/44x/rainier_defconfig
+++ b/arch/powerpc/configs/44x/rainier_defconfig
@@ -101,8 +101,7 @@ CONFIG_FAIR_GROUP_SCHED=y
101CONFIG_USER_SCHED=y 101CONFIG_USER_SCHED=y
102# CONFIG_CGROUP_SCHED is not set 102# CONFIG_CGROUP_SCHED is not set
103# CONFIG_CGROUPS is not set 103# CONFIG_CGROUPS is not set
104CONFIG_SYSFS_DEPRECATED=y 104# CONFIG_SYSFS_DEPRECATED_V2 is not set
105CONFIG_SYSFS_DEPRECATED_V2=y
106# CONFIG_RELAY is not set 105# CONFIG_RELAY is not set
107# CONFIG_NAMESPACES is not set 106# CONFIG_NAMESPACES is not set
108CONFIG_BLK_DEV_INITRD=y 107CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/redwood_defconfig b/arch/powerpc/configs/44x/redwood_defconfig
index a67ec91a28c3..684f40dc8a41 100644
--- a/arch/powerpc/configs/44x/redwood_defconfig
+++ b/arch/powerpc/configs/44x/redwood_defconfig
@@ -98,8 +98,7 @@ CONFIG_RCU_FANOUT=32
98CONFIG_LOG_BUF_SHIFT=14 98CONFIG_LOG_BUF_SHIFT=14
99# CONFIG_GROUP_SCHED is not set 99# CONFIG_GROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/sam440ep_defconfig b/arch/powerpc/configs/44x/sam440ep_defconfig
index 886cb6aa6432..e202924e6173 100644
--- a/arch/powerpc/configs/44x/sam440ep_defconfig
+++ b/arch/powerpc/configs/44x/sam440ep_defconfig
@@ -103,8 +103,7 @@ CONFIG_FAIR_GROUP_SCHED=y
103CONFIG_USER_SCHED=y 103CONFIG_USER_SCHED=y
104# CONFIG_CGROUP_SCHED is not set 104# CONFIG_CGROUP_SCHED is not set
105# CONFIG_CGROUPS is not set 105# CONFIG_CGROUPS is not set
106CONFIG_SYSFS_DEPRECATED=y 106# CONFIG_SYSFS_DEPRECATED_V2 is not set
107CONFIG_SYSFS_DEPRECATED_V2=y
108# CONFIG_RELAY is not set 107# CONFIG_RELAY is not set
109# CONFIG_NAMESPACES is not set 108# CONFIG_NAMESPACES is not set
110CONFIG_BLK_DEV_INITRD=y 109CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/sequoia_defconfig b/arch/powerpc/configs/44x/sequoia_defconfig
index 1b2f41dbcafb..c348a4662a9e 100644
--- a/arch/powerpc/configs/44x/sequoia_defconfig
+++ b/arch/powerpc/configs/44x/sequoia_defconfig
@@ -102,8 +102,7 @@ CONFIG_GROUP_SCHED=y
102CONFIG_USER_SCHED=y 102CONFIG_USER_SCHED=y
103# CONFIG_CGROUP_SCHED is not set 103# CONFIG_CGROUP_SCHED is not set
104# CONFIG_CGROUPS is not set 104# CONFIG_CGROUPS is not set
105CONFIG_SYSFS_DEPRECATED=y 105# CONFIG_SYSFS_DEPRECATED_V2 is not set
106CONFIG_SYSFS_DEPRECATED_V2=y
107# CONFIG_RELAY is not set 106# CONFIG_RELAY is not set
108# CONFIG_NAMESPACES is not set 107# CONFIG_NAMESPACES is not set
109CONFIG_BLK_DEV_INITRD=y 108CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/taishan_defconfig b/arch/powerpc/configs/44x/taishan_defconfig
index 12041d355b8c..f4cb7e84cb83 100644
--- a/arch/powerpc/configs/44x/taishan_defconfig
+++ b/arch/powerpc/configs/44x/taishan_defconfig
@@ -101,8 +101,7 @@ CONFIG_FAIR_GROUP_SCHED=y
101CONFIG_USER_SCHED=y 101CONFIG_USER_SCHED=y
102# CONFIG_CGROUP_SCHED is not set 102# CONFIG_CGROUP_SCHED is not set
103# CONFIG_CGROUPS is not set 103# CONFIG_CGROUPS is not set
104CONFIG_SYSFS_DEPRECATED=y 104# CONFIG_SYSFS_DEPRECATED_V2 is not set
105CONFIG_SYSFS_DEPRECATED_V2=y
106# CONFIG_RELAY is not set 105# CONFIG_RELAY is not set
107# CONFIG_NAMESPACES is not set 106# CONFIG_NAMESPACES is not set
108CONFIG_BLK_DEV_INITRD=y 107CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/44x/virtex5_defconfig b/arch/powerpc/configs/44x/virtex5_defconfig
index 2518b8568c70..c7ead0ec00bc 100644
--- a/arch/powerpc/configs/44x/virtex5_defconfig
+++ b/arch/powerpc/configs/44x/virtex5_defconfig
@@ -80,8 +80,7 @@ CONFIG_IKCONFIG_PROC=y
80CONFIG_LOG_BUF_SHIFT=14 80CONFIG_LOG_BUF_SHIFT=14
81# CONFIG_GROUP_SCHED is not set 81# CONFIG_GROUP_SCHED is not set
82# CONFIG_CGROUPS is not set 82# CONFIG_CGROUPS is not set
83CONFIG_SYSFS_DEPRECATED=y 83# CONFIG_SYSFS_DEPRECATED_V2 is not set
84CONFIG_SYSFS_DEPRECATED_V2=y
85# CONFIG_RELAY is not set 84# CONFIG_RELAY is not set
86CONFIG_NAMESPACES=y 85CONFIG_NAMESPACES=y
87# CONFIG_UTS_NS is not set 86# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/52xx/cm5200_defconfig b/arch/powerpc/configs/52xx/cm5200_defconfig
index 218d49b36a0c..7664c83c17c2 100644
--- a/arch/powerpc/configs/52xx/cm5200_defconfig
+++ b/arch/powerpc/configs/52xx/cm5200_defconfig
@@ -95,8 +95,7 @@ CONFIG_RCU_FANOUT=32
95# CONFIG_IKCONFIG is not set 95# CONFIG_IKCONFIG is not set
96CONFIG_LOG_BUF_SHIFT=14 96CONFIG_LOG_BUF_SHIFT=14
97# CONFIG_CGROUPS is not set 97# CONFIG_CGROUPS is not set
98CONFIG_SYSFS_DEPRECATED=y 98# CONFIG_SYSFS_DEPRECATED_V2 is not set
99CONFIG_SYSFS_DEPRECATED_V2=y
100# CONFIG_RELAY is not set 99# CONFIG_RELAY is not set
101# CONFIG_NAMESPACES is not set 100# CONFIG_NAMESPACES is not set
102CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/52xx/lite5200b_defconfig b/arch/powerpc/configs/52xx/lite5200b_defconfig
index 90492ff25232..eac7c17eef34 100644
--- a/arch/powerpc/configs/52xx/lite5200b_defconfig
+++ b/arch/powerpc/configs/52xx/lite5200b_defconfig
@@ -96,8 +96,7 @@ CONFIG_RCU_FANOUT=32
96# CONFIG_IKCONFIG is not set 96# CONFIG_IKCONFIG is not set
97CONFIG_LOG_BUF_SHIFT=14 97CONFIG_LOG_BUF_SHIFT=14
98# CONFIG_CGROUPS is not set 98# CONFIG_CGROUPS is not set
99CONFIG_SYSFS_DEPRECATED=y 99# CONFIG_SYSFS_DEPRECATED_V2 is not set
100CONFIG_SYSFS_DEPRECATED_V2=y
101# CONFIG_RELAY is not set 100# CONFIG_RELAY is not set
102# CONFIG_NAMESPACES is not set 101# CONFIG_NAMESPACES is not set
103CONFIG_BLK_DEV_INITRD=y 102CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/52xx/motionpro_defconfig b/arch/powerpc/configs/52xx/motionpro_defconfig
index dffc8cac825f..27afb6ecdf61 100644
--- a/arch/powerpc/configs/52xx/motionpro_defconfig
+++ b/arch/powerpc/configs/52xx/motionpro_defconfig
@@ -95,8 +95,7 @@ CONFIG_RCU_FANOUT=32
95# CONFIG_IKCONFIG is not set 95# CONFIG_IKCONFIG is not set
96CONFIG_LOG_BUF_SHIFT=14 96CONFIG_LOG_BUF_SHIFT=14
97# CONFIG_CGROUPS is not set 97# CONFIG_CGROUPS is not set
98CONFIG_SYSFS_DEPRECATED=y 98# CONFIG_SYSFS_DEPRECATED_V2 is not set
99CONFIG_SYSFS_DEPRECATED_V2=y
100# CONFIG_RELAY is not set 99# CONFIG_RELAY is not set
101# CONFIG_NAMESPACES is not set 100# CONFIG_NAMESPACES is not set
102CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/52xx/pcm030_defconfig b/arch/powerpc/configs/52xx/pcm030_defconfig
index 3cb2a522046a..5fe39ddb4e14 100644
--- a/arch/powerpc/configs/52xx/pcm030_defconfig
+++ b/arch/powerpc/configs/52xx/pcm030_defconfig
@@ -98,8 +98,7 @@ CONFIG_IKCONFIG=y
98CONFIG_IKCONFIG_PROC=y 98CONFIG_IKCONFIG_PROC=y
99CONFIG_LOG_BUF_SHIFT=14 99CONFIG_LOG_BUF_SHIFT=14
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105# CONFIG_BLK_DEV_INITRD is not set 104# CONFIG_BLK_DEV_INITRD is not set
diff --git a/arch/powerpc/configs/52xx/tqm5200_defconfig b/arch/powerpc/configs/52xx/tqm5200_defconfig
index 96181c62abfa..a108b84c0074 100644
--- a/arch/powerpc/configs/52xx/tqm5200_defconfig
+++ b/arch/powerpc/configs/52xx/tqm5200_defconfig
@@ -95,8 +95,7 @@ CONFIG_RCU_FANOUT=32
95# CONFIG_IKCONFIG is not set 95# CONFIG_IKCONFIG is not set
96CONFIG_LOG_BUF_SHIFT=14 96CONFIG_LOG_BUF_SHIFT=14
97# CONFIG_CGROUPS is not set 97# CONFIG_CGROUPS is not set
98CONFIG_SYSFS_DEPRECATED=y 98# CONFIG_SYSFS_DEPRECATED_V2 is not set
99CONFIG_SYSFS_DEPRECATED_V2=y
100# CONFIG_RELAY is not set 99# CONFIG_RELAY is not set
101# CONFIG_NAMESPACES is not set 100# CONFIG_NAMESPACES is not set
102CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
index 183c59c6d896..b728a7d64250 100644
--- a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
+++ b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
@@ -103,8 +103,7 @@ CONFIG_IKCONFIG=y
103CONFIG_IKCONFIG_PROC=y 103CONFIG_IKCONFIG_PROC=y
104CONFIG_LOG_BUF_SHIFT=14 104CONFIG_LOG_BUF_SHIFT=14
105# CONFIG_CGROUPS is not set 105# CONFIG_CGROUPS is not set
106CONFIG_SYSFS_DEPRECATED=y 106# CONFIG_SYSFS_DEPRECATED_V2 is not set
107CONFIG_SYSFS_DEPRECATED_V2=y
108CONFIG_RELAY=y 107CONFIG_RELAY=y
109# CONFIG_NAMESPACES is not set 108# CONFIG_NAMESPACES is not set
110CONFIG_BLK_DEV_INITRD=y 109CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/86xx/gef_sbc310_defconfig b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
index 1524d948a2ba..8e738de5f6a5 100644
--- a/arch/powerpc/configs/86xx/gef_sbc310_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
@@ -103,8 +103,7 @@ CONFIG_IKCONFIG=y
103CONFIG_IKCONFIG_PROC=y 103CONFIG_IKCONFIG_PROC=y
104CONFIG_LOG_BUF_SHIFT=14 104CONFIG_LOG_BUF_SHIFT=14
105# CONFIG_CGROUPS is not set 105# CONFIG_CGROUPS is not set
106CONFIG_SYSFS_DEPRECATED=y 106# CONFIG_SYSFS_DEPRECATED_V2 is not set
107CONFIG_SYSFS_DEPRECATED_V2=y
108CONFIG_RELAY=y 107CONFIG_RELAY=y
109# CONFIG_NAMESPACES is not set 108# CONFIG_NAMESPACES is not set
110CONFIG_BLK_DEV_INITRD=y 109CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
index 767c204c0603..59bf9e27d7f2 100644
--- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
@@ -103,8 +103,7 @@ CONFIG_IKCONFIG=y
103CONFIG_IKCONFIG_PROC=y 103CONFIG_IKCONFIG_PROC=y
104CONFIG_LOG_BUF_SHIFT=14 104CONFIG_LOG_BUF_SHIFT=14
105# CONFIG_CGROUPS is not set 105# CONFIG_CGROUPS is not set
106CONFIG_SYSFS_DEPRECATED=y 106# CONFIG_SYSFS_DEPRECATED_V2 is not set
107CONFIG_SYSFS_DEPRECATED_V2=y
108CONFIG_RELAY=y 107CONFIG_RELAY=y
109# CONFIG_NAMESPACES is not set 108# CONFIG_NAMESPACES is not set
110CONFIG_BLK_DEV_INITRD=y 109CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
index 55b9e4e867ac..4e8b01e73245 100644
--- a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
@@ -98,8 +98,7 @@ CONFIG_IKCONFIG=y
98CONFIG_IKCONFIG_PROC=y 98CONFIG_IKCONFIG_PROC=y
99CONFIG_LOG_BUF_SHIFT=14 99CONFIG_LOG_BUF_SHIFT=14
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104# CONFIG_NAMESPACES is not set 103# CONFIG_NAMESPACES is not set
105CONFIG_BLK_DEV_INITRD=y 104CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig b/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
index 1be38eb05783..20fde6374aad 100644
--- a/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
@@ -103,8 +103,7 @@ CONFIG_IKCONFIG=y
103CONFIG_IKCONFIG_PROC=y 103CONFIG_IKCONFIG_PROC=y
104CONFIG_LOG_BUF_SHIFT=14 104CONFIG_LOG_BUF_SHIFT=14
105# CONFIG_CGROUPS is not set 105# CONFIG_CGROUPS is not set
106CONFIG_SYSFS_DEPRECATED=y 106# CONFIG_SYSFS_DEPRECATED_V2 is not set
107CONFIG_SYSFS_DEPRECATED_V2=y
108# CONFIG_RELAY is not set 107# CONFIG_RELAY is not set
109# CONFIG_NAMESPACES is not set 108# CONFIG_NAMESPACES is not set
110CONFIG_BLK_DEV_INITRD=y 109CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/86xx/sbc8641d_defconfig b/arch/powerpc/configs/86xx/sbc8641d_defconfig
index a63009457323..74f714d85936 100644
--- a/arch/powerpc/configs/86xx/sbc8641d_defconfig
+++ b/arch/powerpc/configs/86xx/sbc8641d_defconfig
@@ -102,8 +102,7 @@ CONFIG_IKCONFIG=y
102CONFIG_IKCONFIG_PROC=y 102CONFIG_IKCONFIG_PROC=y
103CONFIG_LOG_BUF_SHIFT=14 103CONFIG_LOG_BUF_SHIFT=14
104# CONFIG_CGROUPS is not set 104# CONFIG_CGROUPS is not set
105CONFIG_SYSFS_DEPRECATED=y 105# CONFIG_SYSFS_DEPRECATED_V2 is not set
106CONFIG_SYSFS_DEPRECATED_V2=y
107CONFIG_RELAY=y 106CONFIG_RELAY=y
108# CONFIG_NAMESPACES is not set 107# CONFIG_NAMESPACES is not set
109CONFIG_BLK_DEV_INITRD=y 108CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/adder875_defconfig b/arch/powerpc/configs/adder875_defconfig
index 9f89d5c9c0be..a670cee255b9 100644
--- a/arch/powerpc/configs/adder875_defconfig
+++ b/arch/powerpc/configs/adder875_defconfig
@@ -92,8 +92,7 @@ CONFIG_RCU_FANOUT=32
92# CONFIG_IKCONFIG is not set 92# CONFIG_IKCONFIG is not set
93CONFIG_LOG_BUF_SHIFT=14 93CONFIG_LOG_BUF_SHIFT=14
94# CONFIG_CGROUPS is not set 94# CONFIG_CGROUPS is not set
95CONFIG_SYSFS_DEPRECATED=y 95# CONFIG_SYSFS_DEPRECATED_V2 is not set
96CONFIG_SYSFS_DEPRECATED_V2=y
97# CONFIG_RELAY is not set 96# CONFIG_RELAY is not set
98# CONFIG_NAMESPACES is not set 97# CONFIG_NAMESPACES is not set
99# CONFIG_BLK_DEV_INITRD is not set 98# CONFIG_BLK_DEV_INITRD is not set
diff --git a/arch/powerpc/configs/amigaone_defconfig b/arch/powerpc/configs/amigaone_defconfig
index b63cc38df6b1..851287e78fc3 100644
--- a/arch/powerpc/configs/amigaone_defconfig
+++ b/arch/powerpc/configs/amigaone_defconfig
@@ -87,8 +87,7 @@ CONFIG_IKCONFIG_PROC=y
87CONFIG_LOG_BUF_SHIFT=15 87CONFIG_LOG_BUF_SHIFT=15
88# CONFIG_GROUP_SCHED is not set 88# CONFIG_GROUP_SCHED is not set
89# CONFIG_CGROUPS is not set 89# CONFIG_CGROUPS is not set
90CONFIG_SYSFS_DEPRECATED=y 90# CONFIG_SYSFS_DEPRECATED_V2 is not set
91CONFIG_SYSFS_DEPRECATED_V2=y
92# CONFIG_RELAY is not set 91# CONFIG_RELAY is not set
93CONFIG_NAMESPACES=y 92CONFIG_NAMESPACES=y
94# CONFIG_UTS_NS is not set 93# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/c2k_defconfig b/arch/powerpc/configs/c2k_defconfig
index 4ab6074db3cf..b429a655b541 100644
--- a/arch/powerpc/configs/c2k_defconfig
+++ b/arch/powerpc/configs/c2k_defconfig
@@ -102,8 +102,7 @@ CONFIG_RCU_FANOUT=32
102# CONFIG_IKCONFIG is not set 102# CONFIG_IKCONFIG is not set
103CONFIG_LOG_BUF_SHIFT=17 103CONFIG_LOG_BUF_SHIFT=17
104# CONFIG_CGROUPS is not set 104# CONFIG_CGROUPS is not set
105CONFIG_SYSFS_DEPRECATED=y 105# CONFIG_SYSFS_DEPRECATED_V2 is not set
106CONFIG_SYSFS_DEPRECATED_V2=y
107# CONFIG_RELAY is not set 106# CONFIG_RELAY is not set
108CONFIG_NAMESPACES=y 107CONFIG_NAMESPACES=y
109# CONFIG_UTS_NS is not set 108# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index c6d2baa7aaeb..943371954317 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -83,8 +83,7 @@ CONFIG_CPUSETS=y
83# CONFIG_CGROUP_SCHED is not set 83# CONFIG_CGROUP_SCHED is not set
84# CONFIG_CGROUP_CPUACCT is not set 84# CONFIG_CGROUP_CPUACCT is not set
85# CONFIG_RESOURCE_COUNTERS is not set 85# CONFIG_RESOURCE_COUNTERS is not set
86CONFIG_SYSFS_DEPRECATED=y 86# CONFIG_SYSFS_DEPRECATED_V2 is not set
87CONFIG_SYSFS_DEPRECATED_V2=y
88CONFIG_PROC_PID_CPUSET=y 87CONFIG_PROC_PID_CPUSET=y
89# CONFIG_RELAY is not set 88# CONFIG_RELAY is not set
90CONFIG_NAMESPACES=y 89CONFIG_NAMESPACES=y
diff --git a/arch/powerpc/configs/celleb_defconfig b/arch/powerpc/configs/celleb_defconfig
index d2123779512a..6be6c09eba6d 100644
--- a/arch/powerpc/configs/celleb_defconfig
+++ b/arch/powerpc/configs/celleb_defconfig
@@ -78,8 +78,7 @@ CONFIG_LOG_BUF_SHIFT=15
78# CONFIG_GROUP_SCHED is not set 78# CONFIG_GROUP_SCHED is not set
79# CONFIG_USER_SCHED is not set 79# CONFIG_USER_SCHED is not set
80# CONFIG_CGROUP_SCHED is not set 80# CONFIG_CGROUP_SCHED is not set
81CONFIG_SYSFS_DEPRECATED=y 81# CONFIG_SYSFS_DEPRECATED_V2 is not set
82CONFIG_SYSFS_DEPRECATED_V2=y
83# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
84CONFIG_NAMESPACES=y 83CONFIG_NAMESPACES=y
85# CONFIG_UTS_NS is not set 84# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/chrp32_defconfig b/arch/powerpc/configs/chrp32_defconfig
index 5094a65a4493..2fdab660fce3 100644
--- a/arch/powerpc/configs/chrp32_defconfig
+++ b/arch/powerpc/configs/chrp32_defconfig
@@ -77,8 +77,7 @@ CONFIG_IKCONFIG_PROC=y
77CONFIG_LOG_BUF_SHIFT=15 77CONFIG_LOG_BUF_SHIFT=15
78# CONFIG_CGROUPS is not set 78# CONFIG_CGROUPS is not set
79# CONFIG_GROUP_SCHED is not set 79# CONFIG_GROUP_SCHED is not set
80CONFIG_SYSFS_DEPRECATED=y 80# CONFIG_SYSFS_DEPRECATED_V2 is not set
81CONFIG_SYSFS_DEPRECATED_V2=y
82# CONFIG_RELAY is not set 81# CONFIG_RELAY is not set
83CONFIG_NAMESPACES=y 82CONFIG_NAMESPACES=y
84# CONFIG_UTS_NS is not set 83# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/ep8248e_defconfig b/arch/powerpc/configs/ep8248e_defconfig
index 81e904e9f392..6b708395a7c6 100644
--- a/arch/powerpc/configs/ep8248e_defconfig
+++ b/arch/powerpc/configs/ep8248e_defconfig
@@ -96,8 +96,7 @@ CONFIG_IKCONFIG=y
96CONFIG_IKCONFIG_PROC=y 96CONFIG_IKCONFIG_PROC=y
97CONFIG_LOG_BUF_SHIFT=14 97CONFIG_LOG_BUF_SHIFT=14
98# CONFIG_CGROUPS is not set 98# CONFIG_CGROUPS is not set
99CONFIG_SYSFS_DEPRECATED=y 99# CONFIG_SYSFS_DEPRECATED_V2 is not set
100CONFIG_SYSFS_DEPRECATED_V2=y
101# CONFIG_RELAY is not set 100# CONFIG_RELAY is not set
102# CONFIG_NAMESPACES is not set 101# CONFIG_NAMESPACES is not set
103# CONFIG_BLK_DEV_INITRD is not set 102# CONFIG_BLK_DEV_INITRD is not set
diff --git a/arch/powerpc/configs/ep88xc_defconfig b/arch/powerpc/configs/ep88xc_defconfig
index c5af46ef5f40..1cee889dd9ec 100644
--- a/arch/powerpc/configs/ep88xc_defconfig
+++ b/arch/powerpc/configs/ep88xc_defconfig
@@ -91,8 +91,7 @@ CONFIG_RCU_FANOUT=32
91# CONFIG_IKCONFIG is not set 91# CONFIG_IKCONFIG is not set
92CONFIG_LOG_BUF_SHIFT=14 92CONFIG_LOG_BUF_SHIFT=14
93# CONFIG_CGROUPS is not set 93# CONFIG_CGROUPS is not set
94CONFIG_SYSFS_DEPRECATED=y 94# CONFIG_SYSFS_DEPRECATED_V2 is not set
95CONFIG_SYSFS_DEPRECATED_V2=y
96# CONFIG_RELAY is not set 95# CONFIG_RELAY is not set
97# CONFIG_NAMESPACES is not set 96# CONFIG_NAMESPACES is not set
98# CONFIG_BLK_DEV_INITRD is not set 97# CONFIG_BLK_DEV_INITRD is not set
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 826a65d3f002..57d3ffa3026a 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -82,8 +82,7 @@ CONFIG_IKCONFIG_PROC=y
82CONFIG_LOG_BUF_SHIFT=17 82CONFIG_LOG_BUF_SHIFT=17
83# CONFIG_CGROUPS is not set 83# CONFIG_CGROUPS is not set
84# CONFIG_GROUP_SCHED is not set 84# CONFIG_GROUP_SCHED is not set
85CONFIG_SYSFS_DEPRECATED=y 85# CONFIG_SYSFS_DEPRECATED_V2 is not set
86CONFIG_SYSFS_DEPRECATED_V2=y
87# CONFIG_RELAY is not set 86# CONFIG_RELAY is not set
88CONFIG_NAMESPACES=y 87CONFIG_NAMESPACES=y
89# CONFIG_UTS_NS is not set 88# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/gamecube_defconfig b/arch/powerpc/configs/gamecube_defconfig
index 942e1193e9e4..1c2dbf07ac35 100644
--- a/arch/powerpc/configs/gamecube_defconfig
+++ b/arch/powerpc/configs/gamecube_defconfig
@@ -101,8 +101,7 @@ CONFIG_FAIR_GROUP_SCHED=y
101CONFIG_USER_SCHED=y 101CONFIG_USER_SCHED=y
102# CONFIG_CGROUP_SCHED is not set 102# CONFIG_CGROUP_SCHED is not set
103# CONFIG_CGROUPS is not set 103# CONFIG_CGROUPS is not set
104CONFIG_SYSFS_DEPRECATED=y 104# CONFIG_SYSFS_DEPRECATED_V2 is not set
105CONFIG_SYSFS_DEPRECATED_V2=y
106# CONFIG_RELAY is not set 105# CONFIG_RELAY is not set
107# CONFIG_NAMESPACES is not set 106# CONFIG_NAMESPACES is not set
108CONFIG_BLK_DEV_INITRD=y 107CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/holly_defconfig b/arch/powerpc/configs/holly_defconfig
index a211a79959ca..a60d61bee48d 100644
--- a/arch/powerpc/configs/holly_defconfig
+++ b/arch/powerpc/configs/holly_defconfig
@@ -73,7 +73,6 @@ CONFIG_SYSVIPC_SYSCTL=y
73CONFIG_LOG_BUF_SHIFT=14 73CONFIG_LOG_BUF_SHIFT=14
74# CONFIG_CGROUPS is not set 74# CONFIG_CGROUPS is not set
75# CONFIG_FAIR_GROUP_SCHED is not set 75# CONFIG_FAIR_GROUP_SCHED is not set
76CONFIG_SYSFS_DEPRECATED=y
77# CONFIG_RELAY is not set 76# CONFIG_RELAY is not set
78CONFIG_BLK_DEV_INITRD=y 77CONFIG_BLK_DEV_INITRD=y
79CONFIG_INITRAMFS_SOURCE="" 78CONFIG_INITRAMFS_SOURCE=""
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig
index 76982c51a4c7..151c8e14f3ab 100644
--- a/arch/powerpc/configs/iseries_defconfig
+++ b/arch/powerpc/configs/iseries_defconfig
@@ -81,8 +81,7 @@ CONFIG_IKCONFIG_PROC=y
81CONFIG_LOG_BUF_SHIFT=17 81CONFIG_LOG_BUF_SHIFT=17
82# CONFIG_CGROUPS is not set 82# CONFIG_CGROUPS is not set
83# CONFIG_GROUP_SCHED is not set 83# CONFIG_GROUP_SCHED is not set
84CONFIG_SYSFS_DEPRECATED=y 84# CONFIG_SYSFS_DEPRECATED_V2 is not set
85CONFIG_SYSFS_DEPRECATED_V2=y
86# CONFIG_RELAY is not set 85# CONFIG_RELAY is not set
87CONFIG_NAMESPACES=y 86CONFIG_NAMESPACES=y
88# CONFIG_UTS_NS is not set 87# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/linkstation_defconfig b/arch/powerpc/configs/linkstation_defconfig
index 588a2add393f..8ecacf74d3e5 100644
--- a/arch/powerpc/configs/linkstation_defconfig
+++ b/arch/powerpc/configs/linkstation_defconfig
@@ -97,8 +97,7 @@ CONFIG_IKCONFIG=y
97CONFIG_IKCONFIG_PROC=y 97CONFIG_IKCONFIG_PROC=y
98CONFIG_LOG_BUF_SHIFT=14 98CONFIG_LOG_BUF_SHIFT=14
99# CONFIG_CGROUPS is not set 99# CONFIG_CGROUPS is not set
100CONFIG_SYSFS_DEPRECATED=y 100# CONFIG_SYSFS_DEPRECATED_V2 is not set
101CONFIG_SYSFS_DEPRECATED_V2=y
102# CONFIG_RELAY is not set 101# CONFIG_RELAY is not set
103CONFIG_NAMESPACES=y 102CONFIG_NAMESPACES=y
104# CONFIG_UTS_NS is not set 103# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig
index 8b244003b9e1..dc50eec58e78 100644
--- a/arch/powerpc/configs/maple_defconfig
+++ b/arch/powerpc/configs/maple_defconfig
@@ -78,8 +78,7 @@ CONFIG_IKCONFIG_PROC=y
78CONFIG_LOG_BUF_SHIFT=17 78CONFIG_LOG_BUF_SHIFT=17
79# CONFIG_CGROUPS is not set 79# CONFIG_CGROUPS is not set
80# CONFIG_GROUP_SCHED is not set 80# CONFIG_GROUP_SCHED is not set
81CONFIG_SYSFS_DEPRECATED=y 81# CONFIG_SYSFS_DEPRECATED_V2 is not set
82CONFIG_SYSFS_DEPRECATED_V2=y
83# CONFIG_RELAY is not set 82# CONFIG_RELAY is not set
84CONFIG_NAMESPACES=y 83CONFIG_NAMESPACES=y
85# CONFIG_UTS_NS is not set 84# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/mgcoge_defconfig b/arch/powerpc/configs/mgcoge_defconfig
index 0cbd56fe2e1e..b36ebb7e843e 100644
--- a/arch/powerpc/configs/mgcoge_defconfig
+++ b/arch/powerpc/configs/mgcoge_defconfig
@@ -96,8 +96,7 @@ CONFIG_IKCONFIG=y
96CONFIG_IKCONFIG_PROC=y 96CONFIG_IKCONFIG_PROC=y
97CONFIG_LOG_BUF_SHIFT=14 97CONFIG_LOG_BUF_SHIFT=14
98# CONFIG_CGROUPS is not set 98# CONFIG_CGROUPS is not set
99CONFIG_SYSFS_DEPRECATED=y 99# CONFIG_SYSFS_DEPRECATED_V2 is not set
100CONFIG_SYSFS_DEPRECATED_V2=y
101# CONFIG_RELAY is not set 100# CONFIG_RELAY is not set
102# CONFIG_NAMESPACES is not set 101# CONFIG_NAMESPACES is not set
103CONFIG_BLK_DEV_INITRD=y 102CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/mgsuvd_defconfig b/arch/powerpc/configs/mgsuvd_defconfig
index c1be26151021..0dd5015ea81d 100644
--- a/arch/powerpc/configs/mgsuvd_defconfig
+++ b/arch/powerpc/configs/mgsuvd_defconfig
@@ -90,8 +90,7 @@ CONFIG_RCU_FANOUT=32
90# CONFIG_IKCONFIG is not set 90# CONFIG_IKCONFIG is not set
91CONFIG_LOG_BUF_SHIFT=17 91CONFIG_LOG_BUF_SHIFT=17
92# CONFIG_CGROUPS is not set 92# CONFIG_CGROUPS is not set
93CONFIG_SYSFS_DEPRECATED=y 93# CONFIG_SYSFS_DEPRECATED_V2 is not set
94CONFIG_SYSFS_DEPRECATED_V2=y
95# CONFIG_RELAY is not set 94# CONFIG_RELAY is not set
96# CONFIG_NAMESPACES is not set 95# CONFIG_NAMESPACES is not set
97CONFIG_BLK_DEV_INITRD=y 96CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/mpc512x_defconfig b/arch/powerpc/configs/mpc512x_defconfig
index a04727295d46..aa2654e6edeb 100644
--- a/arch/powerpc/configs/mpc512x_defconfig
+++ b/arch/powerpc/configs/mpc512x_defconfig
@@ -97,8 +97,7 @@ CONFIG_RCU_FANOUT=32
97CONFIG_LOG_BUF_SHIFT=16 97CONFIG_LOG_BUF_SHIFT=16
98# CONFIG_GROUP_SCHED is not set 98# CONFIG_GROUP_SCHED is not set
99# CONFIG_CGROUPS is not set 99# CONFIG_CGROUPS is not set
100CONFIG_SYSFS_DEPRECATED=y 100# CONFIG_SYSFS_DEPRECATED_V2 is not set
101CONFIG_SYSFS_DEPRECATED_V2=y
102# CONFIG_RELAY is not set 101# CONFIG_RELAY is not set
103CONFIG_NAMESPACES=y 102CONFIG_NAMESPACES=y
104# CONFIG_UTS_NS is not set 103# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/mpc5200_defconfig b/arch/powerpc/configs/mpc5200_defconfig
index 7012ac0134f0..f875ec21c91c 100644
--- a/arch/powerpc/configs/mpc5200_defconfig
+++ b/arch/powerpc/configs/mpc5200_defconfig
@@ -97,8 +97,7 @@ CONFIG_RCU_FANOUT=32
97# CONFIG_IKCONFIG is not set 97# CONFIG_IKCONFIG is not set
98CONFIG_LOG_BUF_SHIFT=14 98CONFIG_LOG_BUF_SHIFT=14
99# CONFIG_CGROUPS is not set 99# CONFIG_CGROUPS is not set
100CONFIG_SYSFS_DEPRECATED=y 100# CONFIG_SYSFS_DEPRECATED_V2 is not set
101CONFIG_SYSFS_DEPRECATED_V2=y
102# CONFIG_RELAY is not set 101# CONFIG_RELAY is not set
103CONFIG_NAMESPACES=y 102CONFIG_NAMESPACES=y
104# CONFIG_UTS_NS is not set 103# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/mpc7448_hpc2_defconfig b/arch/powerpc/configs/mpc7448_hpc2_defconfig
index 27c63ceeb45a..b1e88fe1d9fb 100644
--- a/arch/powerpc/configs/mpc7448_hpc2_defconfig
+++ b/arch/powerpc/configs/mpc7448_hpc2_defconfig
@@ -95,8 +95,7 @@ CONFIG_RCU_FANOUT=32
95# CONFIG_IKCONFIG is not set 95# CONFIG_IKCONFIG is not set
96CONFIG_LOG_BUF_SHIFT=14 96CONFIG_LOG_BUF_SHIFT=14
97# CONFIG_CGROUPS is not set 97# CONFIG_CGROUPS is not set
98CONFIG_SYSFS_DEPRECATED=y 98# CONFIG_SYSFS_DEPRECATED_V2 is not set
99CONFIG_SYSFS_DEPRECATED_V2=y
100# CONFIG_RELAY is not set 99# CONFIG_RELAY is not set
101# CONFIG_NAMESPACES is not set 100# CONFIG_NAMESPACES is not set
102CONFIG_BLK_DEV_INITRD=y 101CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
index 20ba0cfff8ba..74a7216183e8 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -98,8 +98,7 @@ CONFIG_RCU_FANOUT=64
98CONFIG_LOG_BUF_SHIFT=17 98CONFIG_LOG_BUF_SHIFT=17
99# CONFIG_GROUP_SCHED is not set 99# CONFIG_GROUP_SCHED is not set
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104CONFIG_NAMESPACES=y 103CONFIG_NAMESPACES=y
105# CONFIG_UTS_NS is not set 104# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index ea8870a34482..753bb7912e28 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -93,8 +93,7 @@ CONFIG_IKCONFIG_PROC=y
93CONFIG_LOG_BUF_SHIFT=14 93CONFIG_LOG_BUF_SHIFT=14
94# CONFIG_GROUP_SCHED is not set 94# CONFIG_GROUP_SCHED is not set
95# CONFIG_CGROUPS is not set 95# CONFIG_CGROUPS is not set
96CONFIG_SYSFS_DEPRECATED=y 96# CONFIG_SYSFS_DEPRECATED_V2 is not set
97CONFIG_SYSFS_DEPRECATED_V2=y
98# CONFIG_RELAY is not set 97# CONFIG_RELAY is not set
99CONFIG_NAMESPACES=y 98CONFIG_NAMESPACES=y
100# CONFIG_UTS_NS is not set 99# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/ppc40x_defconfig b/arch/powerpc/configs/ppc40x_defconfig
index 35b60683cde5..afb4d1bb2ba9 100644
--- a/arch/powerpc/configs/ppc40x_defconfig
+++ b/arch/powerpc/configs/ppc40x_defconfig
@@ -99,8 +99,7 @@ CONFIG_FAIR_GROUP_SCHED=y
99CONFIG_USER_SCHED=y 99CONFIG_USER_SCHED=y
100# CONFIG_CGROUP_SCHED is not set 100# CONFIG_CGROUP_SCHED is not set
101# CONFIG_CGROUPS is not set 101# CONFIG_CGROUPS is not set
102CONFIG_SYSFS_DEPRECATED=y 102# CONFIG_SYSFS_DEPRECATED_V2 is not set
103CONFIG_SYSFS_DEPRECATED_V2=y
104# CONFIG_RELAY is not set 103# CONFIG_RELAY is not set
105# CONFIG_NAMESPACES is not set 104# CONFIG_NAMESPACES is not set
106CONFIG_BLK_DEV_INITRD=y 105CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
index 46f5c47e9f85..bd3d23fb4dd3 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -103,8 +103,7 @@ CONFIG_FAIR_GROUP_SCHED=y
103CONFIG_USER_SCHED=y 103CONFIG_USER_SCHED=y
104# CONFIG_CGROUP_SCHED is not set 104# CONFIG_CGROUP_SCHED is not set
105# CONFIG_CGROUPS is not set 105# CONFIG_CGROUPS is not set
106CONFIG_SYSFS_DEPRECATED=y 106# CONFIG_SYSFS_DEPRECATED_V2 is not set
107CONFIG_SYSFS_DEPRECATED_V2=y
108# CONFIG_RELAY is not set 107# CONFIG_RELAY is not set
109# CONFIG_NAMESPACES is not set 108# CONFIG_NAMESPACES is not set
110CONFIG_BLK_DEV_INITRD=y 109CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index dad617e2a88c..369f4e02c5dd 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -93,8 +93,7 @@ CONFIG_CPUSETS=y
93# CONFIG_GROUP_SCHED is not set 93# CONFIG_GROUP_SCHED is not set
94# CONFIG_CGROUP_CPUACCT is not set 94# CONFIG_CGROUP_CPUACCT is not set
95# CONFIG_RESOURCE_COUNTERS is not set 95# CONFIG_RESOURCE_COUNTERS is not set
96CONFIG_SYSFS_DEPRECATED=y 96# CONFIG_SYSFS_DEPRECATED_V2 is not set
97CONFIG_SYSFS_DEPRECATED_V2=y
98CONFIG_PROC_PID_CPUSET=y 97CONFIG_PROC_PID_CPUSET=y
99CONFIG_RELAY=y 98CONFIG_RELAY=y
100CONFIG_NAMESPACES=y 99CONFIG_NAMESPACES=y
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig
index 8195f1650cbf..403e82e2e83c 100644
--- a/arch/powerpc/configs/ppc64e_defconfig
+++ b/arch/powerpc/configs/ppc64e_defconfig
@@ -107,8 +107,7 @@ CONFIG_CPUSETS=y
107CONFIG_PROC_PID_CPUSET=y 107CONFIG_PROC_PID_CPUSET=y
108# CONFIG_CGROUP_CPUACCT is not set 108# CONFIG_CGROUP_CPUACCT is not set
109# CONFIG_RESOURCE_COUNTERS is not set 109# CONFIG_RESOURCE_COUNTERS is not set
110CONFIG_SYSFS_DEPRECATED=y 110# CONFIG_SYSFS_DEPRECATED_V2 is not set
111CONFIG_SYSFS_DEPRECATED_V2=y
112CONFIG_RELAY=y 111CONFIG_RELAY=y
113CONFIG_NAMESPACES=y 112CONFIG_NAMESPACES=y
114# CONFIG_UTS_NS is not set 113# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/pq2fads_defconfig b/arch/powerpc/configs/pq2fads_defconfig
index 68c175ea427a..12c8ee8dd12b 100644
--- a/arch/powerpc/configs/pq2fads_defconfig
+++ b/arch/powerpc/configs/pq2fads_defconfig
@@ -96,8 +96,7 @@ CONFIG_IKCONFIG=y
96CONFIG_IKCONFIG_PROC=y 96CONFIG_IKCONFIG_PROC=y
97CONFIG_LOG_BUF_SHIFT=14 97CONFIG_LOG_BUF_SHIFT=14
98# CONFIG_CGROUPS is not set 98# CONFIG_CGROUPS is not set
99CONFIG_SYSFS_DEPRECATED=y 99# CONFIG_SYSFS_DEPRECATED_V2 is not set
100CONFIG_SYSFS_DEPRECATED_V2=y
101# CONFIG_RELAY is not set 100# CONFIG_RELAY is not set
102# CONFIG_NAMESPACES is not set 101# CONFIG_NAMESPACES is not set
103CONFIG_BLK_DEV_INITRD=y 102CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/configs/prpmc2800_defconfig b/arch/powerpc/configs/prpmc2800_defconfig
index 93f4505b5ac2..a18f597c6e5f 100644
--- a/arch/powerpc/configs/prpmc2800_defconfig
+++ b/arch/powerpc/configs/prpmc2800_defconfig
@@ -98,8 +98,7 @@ CONFIG_RCU_FANOUT=32
98# CONFIG_IKCONFIG is not set 98# CONFIG_IKCONFIG is not set
99CONFIG_LOG_BUF_SHIFT=14 99CONFIG_LOG_BUF_SHIFT=14
100# CONFIG_CGROUPS is not set 100# CONFIG_CGROUPS is not set
101CONFIG_SYSFS_DEPRECATED=y 101# CONFIG_SYSFS_DEPRECATED_V2 is not set
102CONFIG_SYSFS_DEPRECATED_V2=y
103# CONFIG_RELAY is not set 102# CONFIG_RELAY is not set
104CONFIG_NAMESPACES=y 103CONFIG_NAMESPACES=y
105# CONFIG_UTS_NS is not set 104# CONFIG_UTS_NS is not set
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 16a14589bd40..16ae717d1958 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -92,8 +92,7 @@ CONFIG_CPUSETS=y
92# CONFIG_GROUP_SCHED is not set 92# CONFIG_GROUP_SCHED is not set
93CONFIG_CGROUP_CPUACCT=y 93CONFIG_CGROUP_CPUACCT=y
94# CONFIG_RESOURCE_COUNTERS is not set 94# CONFIG_RESOURCE_COUNTERS is not set
95CONFIG_SYSFS_DEPRECATED=y 95# CONFIG_SYSFS_DEPRECATED_V2 is not set
96CONFIG_SYSFS_DEPRECATED_V2=y
97CONFIG_PROC_PID_CPUSET=y 96CONFIG_PROC_PID_CPUSET=y
98CONFIG_RELAY=y 97CONFIG_RELAY=y
99CONFIG_NAMESPACES=y 98CONFIG_NAMESPACES=y
diff --git a/arch/powerpc/configs/storcenter_defconfig b/arch/powerpc/configs/storcenter_defconfig
index b1625801526e..01be0e207f40 100644
--- a/arch/powerpc/configs/storcenter_defconfig
+++ b/arch/powerpc/configs/storcenter_defconfig
@@ -95,8 +95,7 @@ CONFIG_RCU_FANOUT=32
95# CONFIG_IKCONFIG is not set 95# CONFIG_IKCONFIG is not set
96CONFIG_LOG_BUF_SHIFT=14 96CONFIG_LOG_BUF_SHIFT=14
97# CONFIG_CGROUPS is not set 97# CONFIG_CGROUPS is not set
98CONFIG_SYSFS_DEPRECATED=y 98# CONFIG_SYSFS_DEPRECATED_V2 is not set
99CONFIG_SYSFS_DEPRECATED_V2=y
100# CONFIG_RELAY is not set 99# CONFIG_RELAY is not set
101# CONFIG_NAMESPACES is not set 100# CONFIG_NAMESPACES is not set
102# CONFIG_BLK_DEV_INITRD is not set 101# CONFIG_BLK_DEV_INITRD is not set
diff --git a/arch/powerpc/configs/wii_defconfig b/arch/powerpc/configs/wii_defconfig
index c386828c639a..ee054f8118be 100644
--- a/arch/powerpc/configs/wii_defconfig
+++ b/arch/powerpc/configs/wii_defconfig
@@ -102,8 +102,7 @@ CONFIG_FAIR_GROUP_SCHED=y
102CONFIG_USER_SCHED=y 102CONFIG_USER_SCHED=y
103# CONFIG_CGROUP_SCHED is not set 103# CONFIG_CGROUP_SCHED is not set
104# CONFIG_CGROUPS is not set 104# CONFIG_CGROUPS is not set
105CONFIG_SYSFS_DEPRECATED=y 105# CONFIG_SYSFS_DEPRECATED_V2 is not set
106CONFIG_SYSFS_DEPRECATED_V2=y
107CONFIG_RELAY=y 106CONFIG_RELAY=y
108# CONFIG_NAMESPACES is not set 107# CONFIG_NAMESPACES is not set
109CONFIG_BLK_DEV_INITRD=y 108CONFIG_BLK_DEV_INITRD=y
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index e054baef1845..ecba37a91749 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -358,7 +358,6 @@ extern void exc_lvl_ctx_init(void);
358#define exc_lvl_ctx_init() 358#define exc_lvl_ctx_init()
359#endif 359#endif
360 360
361#ifdef CONFIG_IRQSTACKS
362/* 361/*
363 * Per-cpu stacks for handling hard and soft interrupts. 362 * Per-cpu stacks for handling hard and soft interrupts.
364 */ 363 */
@@ -369,11 +368,6 @@ extern void irq_ctx_init(void);
369extern void call_do_softirq(struct thread_info *tp); 368extern void call_do_softirq(struct thread_info *tp);
370extern int call_handle_irq(int irq, void *p1, 369extern int call_handle_irq(int irq, void *p1,
371 struct thread_info *tp, void *func); 370 struct thread_info *tp, void *func);
372#else
373#define irq_ctx_init()
374
375#endif /* CONFIG_IRQSTACKS */
376
377extern void do_IRQ(struct pt_regs *regs); 371extern void do_IRQ(struct pt_regs *regs);
378 372
379#endif /* _ASM_IRQ_H */ 373#endif /* _ASM_IRQ_H */
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h
index 5ebfe5d3c61f..6857af58b02e 100644
--- a/arch/powerpc/include/asm/kdump.h
+++ b/arch/powerpc/include/asm/kdump.h
@@ -3,8 +3,17 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5 5
6/* Kdump kernel runs at 32 MB, change at your peril. */ 6/*
7 * If CONFIG_RELOCATABLE is enabled we can place the kdump kernel anywhere.
8 * To keep enough space in the RMO for the first stage kernel on 64bit, we
9 * place it at 64MB. If CONFIG_RELOCATABLE is not enabled we must place
10 * the second stage at 32MB.
11 */
12#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_PPC64)
13#define KDUMP_KERNELBASE 0x4000000
14#else
7#define KDUMP_KERNELBASE 0x2000000 15#define KDUMP_KERNELBASE 0x2000000
16#endif
8 17
9/* How many bytes to reserve at zero for kdump. The reserve limit should 18/* How many bytes to reserve at zero for kdump. The reserve limit should
10 * be greater or equal to the trampoline's end address. 19 * be greater or equal to the trampoline's end address.
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 30817d9b20cb..3333bbdd23ef 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -317,7 +317,6 @@ void fixup_irqs(const struct cpumask *map)
317} 317}
318#endif 318#endif
319 319
320#ifdef CONFIG_IRQSTACKS
321static inline void handle_one_irq(unsigned int irq) 320static inline void handle_one_irq(unsigned int irq)
322{ 321{
323 struct thread_info *curtp, *irqtp; 322 struct thread_info *curtp, *irqtp;
@@ -358,12 +357,6 @@ static inline void handle_one_irq(unsigned int irq)
358 if (irqtp->flags) 357 if (irqtp->flags)
359 set_bits(irqtp->flags, &curtp->flags); 358 set_bits(irqtp->flags, &curtp->flags);
360} 359}
361#else
362static inline void handle_one_irq(unsigned int irq)
363{
364 generic_handle_irq(irq);
365}
366#endif
367 360
368static inline void check_stack_overflow(void) 361static inline void check_stack_overflow(void)
369{ 362{
@@ -455,7 +448,6 @@ void exc_lvl_ctx_init(void)
455} 448}
456#endif 449#endif
457 450
458#ifdef CONFIG_IRQSTACKS
459struct thread_info *softirq_ctx[NR_CPUS] __read_mostly; 451struct thread_info *softirq_ctx[NR_CPUS] __read_mostly;
460struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly; 452struct thread_info *hardirq_ctx[NR_CPUS] __read_mostly;
461 453
@@ -492,10 +484,6 @@ static inline void do_softirq_onstack(void)
492 irqtp->task = NULL; 484 irqtp->task = NULL;
493} 485}
494 486
495#else
496#define do_softirq_onstack() __do_softirq()
497#endif /* CONFIG_IRQSTACKS */
498
499void do_softirq(void) 487void do_softirq(void)
500{ 488{
501 unsigned long flags; 489 unsigned long flags;
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 26f9900f773c..ed31a29c4ff7 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -182,28 +182,12 @@ static void kexec_prepare_cpus_wait(int wait_state)
182 182
183 my_cpu = get_cpu(); 183 my_cpu = get_cpu();
184 /* Make sure each CPU has atleast made it to the state we need */ 184 /* Make sure each CPU has atleast made it to the state we need */
185 for (i=0; i < NR_CPUS; i++) { 185 for_each_online_cpu(i) {
186 if (i == my_cpu) 186 if (i == my_cpu)
187 continue; 187 continue;
188 188
189 while (paca[i].kexec_state < wait_state) { 189 while (paca[i].kexec_state < wait_state) {
190 barrier(); 190 barrier();
191 if (!cpu_possible(i)) {
192 printk("kexec: cpu %d hw_cpu_id %d is not"
193 " possible, ignoring\n",
194 i, paca[i].hw_cpu_id);
195 break;
196 }
197 if (!cpu_online(i)) {
198 /* Fixme: this can be spinning in
199 * pSeries_secondary_wait with a paca
200 * waiting for it to go online.
201 */
202 printk("kexec: cpu %d hw_cpu_id %d is not"
203 " online, ignoring\n",
204 i, paca[i].hw_cpu_id);
205 break;
206 }
207 if (i != notified) { 191 if (i != notified) {
208 printk( "kexec: waiting for cpu %d (physical" 192 printk( "kexec: waiting for cpu %d (physical"
209 " %d) to enter %i state\n", 193 " %d) to enter %i state\n",
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index dc66d52dcff5..6bbd7a604d24 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -33,7 +33,6 @@
33 33
34 .text 34 .text
35 35
36#ifdef CONFIG_IRQSTACKS
37_GLOBAL(call_do_softirq) 36_GLOBAL(call_do_softirq)
38 mflr r0 37 mflr r0
39 stw r0,4(r1) 38 stw r0,4(r1)
@@ -56,7 +55,6 @@ _GLOBAL(call_handle_irq)
56 lwz r0,4(r1) 55 lwz r0,4(r1)
57 mtlr r0 56 mtlr r0
58 blr 57 blr
59#endif /* CONFIG_IRQSTACKS */
60 58
61/* 59/*
62 * This returns the high 64 bits of the product of two 64-bit numbers. 60 * This returns the high 64 bits of the product of two 64-bit numbers.
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index a2b18dffa03e..e5144906a56d 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -28,7 +28,6 @@
28 28
29 .text 29 .text
30 30
31#ifdef CONFIG_IRQSTACKS
32_GLOBAL(call_do_softirq) 31_GLOBAL(call_do_softirq)
33 mflr r0 32 mflr r0
34 std r0,16(r1) 33 std r0,16(r1)
@@ -52,7 +51,6 @@ _GLOBAL(call_handle_irq)
52 ld r0,16(r1) 51 ld r0,16(r1)
53 mtlr r0 52 mtlr r0
54 blr 53 blr
55#endif /* CONFIG_IRQSTACKS */
56 54
57 .section ".toc","aw" 55 .section ".toc","aw"
58PPC64_CACHES: 56PPC64_CACHES:
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 9d255b4f0a0e..773424df828a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1005,7 +1005,6 @@ out:
1005 return error; 1005 return error;
1006} 1006}
1007 1007
1008#ifdef CONFIG_IRQSTACKS
1009static inline int valid_irq_stack(unsigned long sp, struct task_struct *p, 1008static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
1010 unsigned long nbytes) 1009 unsigned long nbytes)
1011{ 1010{
@@ -1030,10 +1029,6 @@ static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
1030 return 0; 1029 return 0;
1031} 1030}
1032 1031
1033#else
1034#define valid_irq_stack(sp, p, nb) 0
1035#endif /* CONFIG_IRQSTACKS */
1036
1037int validate_sp(unsigned long sp, struct task_struct *p, 1032int validate_sp(unsigned long sp, struct task_struct *p,
1038 unsigned long nbytes) 1033 unsigned long nbytes)
1039{ 1034{
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index bfc2abafac44..67a84d8f118d 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -94,12 +94,8 @@ struct flash_block_list {
94 struct flash_block_list *next; 94 struct flash_block_list *next;
95 struct flash_block blocks[FLASH_BLOCKS_PER_NODE]; 95 struct flash_block blocks[FLASH_BLOCKS_PER_NODE];
96}; 96};
97struct flash_block_list_header { /* just the header of flash_block_list */
98 unsigned long num_blocks;
99 struct flash_block_list *next;
100};
101 97
102static struct flash_block_list_header rtas_firmware_flash_list = {0, NULL}; 98static struct flash_block_list *rtas_firmware_flash_list;
103 99
104/* Use slab cache to guarantee 4k alignment */ 100/* Use slab cache to guarantee 4k alignment */
105static struct kmem_cache *flash_block_cache = NULL; 101static struct kmem_cache *flash_block_cache = NULL;
@@ -108,13 +104,14 @@ static struct kmem_cache *flash_block_cache = NULL;
108 104
109/* Local copy of the flash block list. 105/* Local copy of the flash block list.
110 * We only allow one open of the flash proc file and create this 106 * We only allow one open of the flash proc file and create this
111 * list as we go. This list will be put in the 107 * list as we go. The rtas_firmware_flash_list varable will be
112 * rtas_firmware_flash_list var once it is fully read. 108 * set once the data is fully read.
113 * 109 *
114 * For convenience as we build the list we use virtual addrs, 110 * For convenience as we build the list we use virtual addrs,
115 * we do not fill in the version number, and the length field 111 * we do not fill in the version number, and the length field
116 * is treated as the number of entries currently in the block 112 * is treated as the number of entries currently in the block
117 * (i.e. not a byte count). This is all fixed on release. 113 * (i.e. not a byte count). This is all fixed when calling
114 * the flash routine.
118 */ 115 */
119 116
120/* Status int must be first member of struct */ 117/* Status int must be first member of struct */
@@ -201,16 +198,16 @@ static int rtas_flash_release(struct inode *inode, struct file *file)
201 if (uf->flist) { 198 if (uf->flist) {
202 /* File was opened in write mode for a new flash attempt */ 199 /* File was opened in write mode for a new flash attempt */
203 /* Clear saved list */ 200 /* Clear saved list */
204 if (rtas_firmware_flash_list.next) { 201 if (rtas_firmware_flash_list) {
205 free_flash_list(rtas_firmware_flash_list.next); 202 free_flash_list(rtas_firmware_flash_list);
206 rtas_firmware_flash_list.next = NULL; 203 rtas_firmware_flash_list = NULL;
207 } 204 }
208 205
209 if (uf->status != FLASH_AUTH) 206 if (uf->status != FLASH_AUTH)
210 uf->status = flash_list_valid(uf->flist); 207 uf->status = flash_list_valid(uf->flist);
211 208
212 if (uf->status == FLASH_IMG_READY) 209 if (uf->status == FLASH_IMG_READY)
213 rtas_firmware_flash_list.next = uf->flist; 210 rtas_firmware_flash_list = uf->flist;
214 else 211 else
215 free_flash_list(uf->flist); 212 free_flash_list(uf->flist);
216 213
@@ -593,7 +590,7 @@ static void rtas_flash_firmware(int reboot_type)
593 unsigned long rtas_block_list; 590 unsigned long rtas_block_list;
594 int i, status, update_token; 591 int i, status, update_token;
595 592
596 if (rtas_firmware_flash_list.next == NULL) 593 if (rtas_firmware_flash_list == NULL)
597 return; /* nothing to do */ 594 return; /* nothing to do */
598 595
599 if (reboot_type != SYS_RESTART) { 596 if (reboot_type != SYS_RESTART) {
@@ -610,20 +607,25 @@ static void rtas_flash_firmware(int reboot_type)
610 return; 607 return;
611 } 608 }
612 609
613 /* NOTE: the "first" block list is a global var with no data 610 /*
614 * blocks in the kernel data segment. We do this because 611 * NOTE: the "first" block must be under 4GB, so we create
615 * we want to ensure this block_list addr is under 4GB. 612 * an entry with no data blocks in the reserved buffer in
613 * the kernel data segment.
616 */ 614 */
617 rtas_firmware_flash_list.num_blocks = 0; 615 spin_lock(&rtas_data_buf_lock);
618 flist = (struct flash_block_list *)&rtas_firmware_flash_list; 616 flist = (struct flash_block_list *)&rtas_data_buf[0];
617 flist->num_blocks = 0;
618 flist->next = rtas_firmware_flash_list;
619 rtas_block_list = virt_to_abs(flist); 619 rtas_block_list = virt_to_abs(flist);
620 if (rtas_block_list >= 4UL*1024*1024*1024) { 620 if (rtas_block_list >= 4UL*1024*1024*1024) {
621 printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); 621 printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n");
622 spin_unlock(&rtas_data_buf_lock);
622 return; 623 return;
623 } 624 }
624 625
625 printk(KERN_ALERT "FLASH: preparing saved firmware image for flash\n"); 626 printk(KERN_ALERT "FLASH: preparing saved firmware image for flash\n");
626 /* Update the block_list in place. */ 627 /* Update the block_list in place. */
628 rtas_firmware_flash_list = NULL; /* too hard to backout on error */
627 image_size = 0; 629 image_size = 0;
628 for (f = flist; f; f = next) { 630 for (f = flist; f; f = next) {
629 /* Translate data addrs to absolute */ 631 /* Translate data addrs to absolute */
@@ -664,6 +666,7 @@ static void rtas_flash_firmware(int reboot_type)
664 printk(KERN_ALERT "FLASH: unknown flash return code %d\n", status); 666 printk(KERN_ALERT "FLASH: unknown flash return code %d\n", status);
665 break; 667 break;
666 } 668 }
669 spin_unlock(&rtas_data_buf_lock);
667} 670}
668 671
669static void remove_flash_pde(struct proc_dir_entry *dp) 672static void remove_flash_pde(struct proc_dir_entry *dp)
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 8f58986c2ad9..7d84b210f168 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -241,7 +241,6 @@ int __init ppc_init(void)
241 241
242arch_initcall(ppc_init); 242arch_initcall(ppc_init);
243 243
244#ifdef CONFIG_IRQSTACKS
245static void __init irqstack_early_init(void) 244static void __init irqstack_early_init(void)
246{ 245{
247 unsigned int i; 246 unsigned int i;
@@ -255,9 +254,6 @@ static void __init irqstack_early_init(void)
255 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE)); 254 __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
256 } 255 }
257} 256}
258#else
259#define irqstack_early_init()
260#endif
261 257
262#if defined(CONFIG_BOOKE) || defined(CONFIG_40x) 258#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
263static void __init exc_lvl_early_init(void) 259static void __init exc_lvl_early_init(void)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f3fb5a79de52..643dcac40fcb 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -432,7 +432,6 @@ static u64 slb0_limit(void)
432 return 1UL << SID_SHIFT; 432 return 1UL << SID_SHIFT;
433} 433}
434 434
435#ifdef CONFIG_IRQSTACKS
436static void __init irqstack_early_init(void) 435static void __init irqstack_early_init(void)
437{ 436{
438 u64 limit = slb0_limit(); 437 u64 limit = slb0_limit();
@@ -451,9 +450,6 @@ static void __init irqstack_early_init(void)
451 THREAD_SIZE, limit)); 450 THREAD_SIZE, limit));
452 } 451 }
453} 452}
454#else
455#define irqstack_early_init()
456#endif
457 453
458#ifdef CONFIG_PPC_BOOK3E 454#ifdef CONFIG_PPC_BOOK3E
459static void __init exc_lvl_early_init(void) 455static void __init exc_lvl_early_init(void)
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 9fc02dc72ce9..34347b2e7e31 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -115,11 +115,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
115{ 115{
116 struct page *ptepage; 116 struct page *ptepage;
117 117
118#ifdef CONFIG_HIGHPTE
119 gfp_t flags = GFP_KERNEL | __GFP_HIGHMEM | __GFP_REPEAT | __GFP_ZERO;
120#else
121 gfp_t flags = GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO; 118 gfp_t flags = GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO;
122#endif
123 119
124 ptepage = alloc_pages(flags, 0); 120 ptepage = alloc_pages(flags, 0);
125 if (!ptepage) 121 if (!ptepage)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
index a55b0b6813ed..76722532bd95 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
@@ -64,10 +64,19 @@ int mpc52xx_pm_prepare(void)
64 { .type = "builtin", .compatible = "mpc5200", }, /* efika */ 64 { .type = "builtin", .compatible = "mpc5200", }, /* efika */
65 {} 65 {}
66 }; 66 };
67 struct resource res;
67 68
68 /* map the whole register space */ 69 /* map the whole register space */
69 np = of_find_matching_node(NULL, immr_ids); 70 np = of_find_matching_node(NULL, immr_ids);
70 mbar = of_iomap(np, 0); 71
72 if (of_address_to_resource(np, 0, &res)) {
73 pr_err("mpc52xx_pm_prepare(): could not get IMMR address\n");
74 of_node_put(np);
75 return -ENOSYS;
76 }
77
78 mbar = ioremap(res.start, 0xc000); /* we should map whole region including SRAM */
79
71 of_node_put(np); 80 of_node_put(np);
72 if (!mbar) { 81 if (!mbar) {
73 pr_err("mpc52xx_pm_prepare(): could not map registers\n"); 82 pr_err("mpc52xx_pm_prepare(): could not map registers\n");
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 2102487612a4..20b73c025a45 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1666,7 +1666,7 @@ static int mpic_resume(struct sys_device *dev)
1666 mpic->save_data[i].dest); 1666 mpic->save_data[i].dest);
1667 1667
1668#ifdef CONFIG_MPIC_U3_HT_IRQS 1668#ifdef CONFIG_MPIC_U3_HT_IRQS
1669 { 1669 if (mpic->fixups) {
1670 struct mpic_irq_fixup *fixup = &mpic->fixups[i]; 1670 struct mpic_irq_fixup *fixup = &mpic->fixups[i];
1671 1671
1672 if (fixup->base) { 1672 if (fixup->base) {
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index be1d114d3a43..1d7b495a7db4 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -25,7 +25,6 @@
25#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
26#include <linux/spi/sh_msiof.h> 26#include <linux/spi/sh_msiof.h>
27#include <linux/spi/mmc_spi.h> 27#include <linux/spi/mmc_spi.h>
28#include <linux/mmc/host.h>
29#include <linux/input.h> 28#include <linux/input.h>
30#include <linux/input/sh_keysc.h> 29#include <linux/input/sh_keysc.h>
31#include <video/sh_mobile_lcdc.h> 30#include <video/sh_mobile_lcdc.h>
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 953af139e230..1e9598d2bbf4 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -139,8 +139,6 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev,
139 for (i = 0; i < PCI_NUM_RESOURCES; i++) { 139 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
140 if (!dev->resource[i].start) 140 if (!dev->resource[i].start)
141 continue; 141 continue;
142 if (dev->resource[i].flags & IORESOURCE_PCI_FIXED)
143 continue;
144 if (dev->resource[i].flags & IORESOURCE_IO) 142 if (dev->resource[i].flags & IORESOURCE_IO)
145 offset = hose->io_offset; 143 offset = hose->io_offset;
146 else if (dev->resource[i].flags & IORESOURCE_MEM) 144 else if (dev->resource[i].flags & IORESOURCE_MEM)
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 18623ba751b3..6379091a1647 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -770,7 +770,7 @@ static void __init pmb_resize(void)
770 spin_unlock_irqrestore(&pmbe->lock, flags); 770 spin_unlock_irqrestore(&pmbe->lock, flags);
771 } 771 }
772 772
773 read_lock(&pmb_rwlock); 773 read_unlock(&pmb_rwlock);
774} 774}
775#endif 775#endif
776 776
diff --git a/arch/um/include/asm/arch_hweight.h b/arch/um/include/asm/arch_hweight.h
new file mode 100644
index 000000000000..c656cf443f4a
--- /dev/null
+++ b/arch/um/include/asm/arch_hweight.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_UM_HWEIGHT_H
2#define _ASM_UM_HWEIGHT_H
3
4#include <asm-generic/bitops/arch_hweight.h>
5
6#endif
diff --git a/arch/x86/boot/video-vga.c b/arch/x86/boot/video-vga.c
index ed7aeff786b2..45bc9402aa49 100644
--- a/arch/x86/boot/video-vga.c
+++ b/arch/x86/boot/video-vga.c
@@ -41,13 +41,12 @@ static __videocard video_vga;
41static u8 vga_set_basic_mode(void) 41static u8 vga_set_basic_mode(void)
42{ 42{
43 struct biosregs ireg, oreg; 43 struct biosregs ireg, oreg;
44 u16 ax;
45 u8 mode; 44 u8 mode;
46 45
47 initregs(&ireg); 46 initregs(&ireg);
48 47
49 /* Query current mode */ 48 /* Query current mode */
50 ax = 0x0f00; 49 ireg.ax = 0x0f00;
51 intcall(0x10, &ireg, &oreg); 50 intcall(0x10, &ireg, &oreg);
52 mode = oreg.al; 51 mode = oreg.al;
53 52
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index 63cb4096c3dc..9cb2edb87c2f 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -183,7 +183,7 @@ struct mp_ioapic_gsi{
183 u32 gsi_end; 183 u32 gsi_end;
184}; 184};
185extern struct mp_ioapic_gsi mp_gsi_routing[]; 185extern struct mp_ioapic_gsi mp_gsi_routing[];
186extern u32 gsi_end; 186extern u32 gsi_top;
187int mp_find_ioapic(u32 gsi); 187int mp_find_ioapic(u32 gsi);
188int mp_find_ioapic_pin(int ioapic, u32 gsi); 188int mp_find_ioapic_pin(int ioapic, u32 gsi);
189void __init mp_register_ioapic(int id, u32 address, u32 gsi_base); 189void __init mp_register_ioapic(int id, u32 address, u32 gsi_base);
@@ -197,7 +197,7 @@ static const int timer_through_8259 = 0;
197static inline void ioapic_init_mappings(void) { } 197static inline void ioapic_init_mappings(void) { }
198static inline void ioapic_insert_resources(void) { } 198static inline void ioapic_insert_resources(void) { }
199static inline void probe_nr_irqs_gsi(void) { } 199static inline void probe_nr_irqs_gsi(void) { }
200#define gsi_end (NR_IRQS_LEGACY - 1) 200#define gsi_top (NR_IRQS_LEGACY)
201static inline int mp_find_ioapic(u32 gsi) { return 0; } 201static inline int mp_find_ioapic(u32 gsi) { return 0; }
202 202
203struct io_apic_irq_attr; 203struct io_apic_irq_attr;
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 0797e748d280..cd28f9ad910d 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -77,6 +77,7 @@ do { \
77 if (0) { \ 77 if (0) { \
78 pto_T__ pto_tmp__; \ 78 pto_T__ pto_tmp__; \
79 pto_tmp__ = (val); \ 79 pto_tmp__ = (val); \
80 (void)pto_tmp__; \
80 } \ 81 } \
81 switch (sizeof(var)) { \ 82 switch (sizeof(var)) { \
82 case 1: \ 83 case 1: \
@@ -115,6 +116,7 @@ do { \
115 if (0) { \ 116 if (0) { \
116 pao_T__ pao_tmp__; \ 117 pao_T__ pao_tmp__; \
117 pao_tmp__ = (val); \ 118 pao_tmp__ = (val); \
119 (void)pao_tmp__; \
118 } \ 120 } \
119 switch (sizeof(var)) { \ 121 switch (sizeof(var)) { \
120 case 1: \ 122 case 1: \
diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h
index 5e67c1532314..ed5903be26fe 100644
--- a/arch/x86/include/asm/pgtable_32_types.h
+++ b/arch/x86/include/asm/pgtable_32_types.h
@@ -26,7 +26,7 @@
26 */ 26 */
27#define VMALLOC_OFFSET (8 * 1024 * 1024) 27#define VMALLOC_OFFSET (8 * 1024 * 1024)
28 28
29#ifndef __ASSEMBLER__ 29#ifndef __ASSEMBLY__
30extern bool __vmalloc_start_set; /* set once high_memory is set */ 30extern bool __vmalloc_start_set; /* set once high_memory is set */
31#endif 31#endif
32 32
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index b8fe48ee2ed9..e7f4d33c55ed 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -451,7 +451,7 @@ void stop_this_cpu(void *dummy);
451 * 451 *
452 * (Could use an alternative three way for this if there was one.) 452 * (Could use an alternative three way for this if there was one.)
453 */ 453 */
454static inline void rdtsc_barrier(void) 454static __always_inline void rdtsc_barrier(void)
455{ 455{
456 alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC); 456 alternative(ASM_NOP3, "mfence", X86_FEATURE_MFENCE_RDTSC);
457 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); 457 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 60cc4058ed5f..c05872aa3ce0 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -118,7 +118,7 @@ static unsigned int gsi_to_irq(unsigned int gsi)
118 if (gsi >= NR_IRQS_LEGACY) 118 if (gsi >= NR_IRQS_LEGACY)
119 irq = gsi; 119 irq = gsi;
120 else 120 else
121 irq = gsi_end + 1 + gsi; 121 irq = gsi_top + gsi;
122 122
123 return irq; 123 return irq;
124} 124}
@@ -129,10 +129,10 @@ static u32 irq_to_gsi(int irq)
129 129
130 if (irq < NR_IRQS_LEGACY) 130 if (irq < NR_IRQS_LEGACY)
131 gsi = isa_irq_to_gsi[irq]; 131 gsi = isa_irq_to_gsi[irq];
132 else if (irq <= gsi_end) 132 else if (irq < gsi_top)
133 gsi = irq; 133 gsi = irq;
134 else if (irq <= (gsi_end + NR_IRQS_LEGACY)) 134 else if (irq < (gsi_top + NR_IRQS_LEGACY))
135 gsi = irq - gsi_end; 135 gsi = irq - gsi_top;
136 else 136 else
137 gsi = 0xffffffff; 137 gsi = 0xffffffff;
138 138
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 33f3563a2a52..e41ed24ab26d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -89,8 +89,8 @@ int nr_ioapics;
89/* IO APIC gsi routing info */ 89/* IO APIC gsi routing info */
90struct mp_ioapic_gsi mp_gsi_routing[MAX_IO_APICS]; 90struct mp_ioapic_gsi mp_gsi_routing[MAX_IO_APICS];
91 91
92/* The last gsi number used */ 92/* The one past the highest gsi number used */
93u32 gsi_end; 93u32 gsi_top;
94 94
95/* MP IRQ source entries */ 95/* MP IRQ source entries */
96struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES]; 96struct mpc_intsrc mp_irqs[MAX_IRQ_SOURCES];
@@ -1035,7 +1035,7 @@ static int pin_2_irq(int idx, int apic, int pin)
1035 if (gsi >= NR_IRQS_LEGACY) 1035 if (gsi >= NR_IRQS_LEGACY)
1036 irq = gsi; 1036 irq = gsi;
1037 else 1037 else
1038 irq = gsi_end + 1 + gsi; 1038 irq = gsi_top + gsi;
1039 } 1039 }
1040 1040
1041#ifdef CONFIG_X86_32 1041#ifdef CONFIG_X86_32
@@ -3853,7 +3853,7 @@ void __init probe_nr_irqs_gsi(void)
3853{ 3853{
3854 int nr; 3854 int nr;
3855 3855
3856 nr = gsi_end + 1 + NR_IRQS_LEGACY; 3856 nr = gsi_top + NR_IRQS_LEGACY;
3857 if (nr > nr_irqs_gsi) 3857 if (nr > nr_irqs_gsi)
3858 nr_irqs_gsi = nr; 3858 nr_irqs_gsi = nr;
3859 3859
@@ -4294,8 +4294,8 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
4294 */ 4294 */
4295 nr_ioapic_registers[idx] = entries; 4295 nr_ioapic_registers[idx] = entries;
4296 4296
4297 if (mp_gsi_routing[idx].gsi_end > gsi_end) 4297 if (mp_gsi_routing[idx].gsi_end >= gsi_top)
4298 gsi_end = mp_gsi_routing[idx].gsi_end; 4298 gsi_top = mp_gsi_routing[idx].gsi_end + 1;
4299 4299
4300 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " 4300 printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, "
4301 "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, 4301 "GSI %d-%d\n", idx, mp_ioapics[idx].apicid,
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index fdbc652d3feb..214ac860ebe0 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -72,6 +72,7 @@ static struct event_constraint intel_westmere_event_constraints[] =
72 INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */ 72 INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
73 INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */ 73 INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
74 INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */ 74 INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
75 INTEL_EVENT_CONSTRAINT(0xb3, 0x1), /* SNOOPQ_REQUEST_OUTSTANDING */
75 EVENT_CONSTRAINT_END 76 EVENT_CONSTRAINT_END
76}; 77};
77 78
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 7bca3c6a02fb..0d6fc71bedb1 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -729,7 +729,7 @@ static int __init e820_mark_nvs_memory(void)
729 struct e820entry *ei = &e820.map[i]; 729 struct e820entry *ei = &e820.map[i];
730 730
731 if (ei->type == E820_NVS) 731 if (ei->type == E820_NVS)
732 hibernate_nvs_register(ei->addr, ei->size); 732 suspend_nvs_register(ei->addr, ei->size);
733 } 733 }
734 734
735 return 0; 735 return 0;
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 5ae5d2426edf..d86dbf7e54be 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -123,7 +123,7 @@ static void __init MP_ioapic_info(struct mpc_ioapic *m)
123 printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n", 123 printk(KERN_INFO "I/O APIC #%d Version %d at 0x%X.\n",
124 m->apicid, m->apicver, m->apicaddr); 124 m->apicid, m->apicver, m->apicaddr);
125 125
126 mp_register_ioapic(m->apicid, m->apicaddr, gsi_end + 1); 126 mp_register_ioapic(m->apicid, m->apicaddr, gsi_top);
127} 127}
128 128
129static void print_MP_intsrc_info(struct mpc_intsrc *m) 129static void print_MP_intsrc_info(struct mpc_intsrc *m)
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index fb99f7edb341..0b96b5589f08 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -103,11 +103,16 @@ int use_calgary __read_mostly = 0;
103#define PMR_SOFTSTOPFAULT 0x40000000 103#define PMR_SOFTSTOPFAULT 0x40000000
104#define PMR_HARDSTOP 0x20000000 104#define PMR_HARDSTOP 0x20000000
105 105
106#define MAX_NUM_OF_PHBS 8 /* how many PHBs in total? */ 106/*
107#define MAX_NUM_CHASSIS 8 /* max number of chassis */ 107 * The maximum PHB bus number.
108/* MAX_PHB_BUS_NUM is the maximal possible dev->bus->number */ 108 * x3950M2 (rare): 8 chassis, 48 PHBs per chassis = 384
109#define MAX_PHB_BUS_NUM (MAX_NUM_OF_PHBS * MAX_NUM_CHASSIS * 2) 109 * x3950M2: 4 chassis, 48 PHBs per chassis = 192
110#define PHBS_PER_CALGARY 4 110 * x3950 (PCIE): 8 chassis, 32 PHBs per chassis = 256
111 * x3950 (PCIX): 8 chassis, 16 PHBs per chassis = 128
112 */
113#define MAX_PHB_BUS_NUM 384
114
115#define PHBS_PER_CALGARY 4
111 116
112/* register offsets in Calgary's internal register space */ 117/* register offsets in Calgary's internal register space */
113static const unsigned long tar_offsets[] = { 118static const unsigned long tar_offsets[] = {
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 8e1aac86b50c..e3af342fe83a 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -228,6 +228,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
228 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T5400"), 228 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T5400"),
229 }, 229 },
230 }, 230 },
231 { /* Handle problems with rebooting on Dell T7400's */
232 .callback = set_bios_reboot,
233 .ident = "Dell Precision T7400",
234 .matches = {
235 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
236 DMI_MATCH(DMI_PRODUCT_NAME, "Precision WorkStation T7400"),
237 },
238 },
231 { /* Handle problems with rebooting on HP laptops */ 239 { /* Handle problems with rebooting on HP laptops */
232 .callback = set_bios_reboot, 240 .callback = set_bios_reboot,
233 .ident = "HP Compaq Laptop", 241 .ident = "HP Compaq Laptop",
diff --git a/arch/x86/kernel/sfi.c b/arch/x86/kernel/sfi.c
index 7ded57896c0a..cb22acf3ed09 100644
--- a/arch/x86/kernel/sfi.c
+++ b/arch/x86/kernel/sfi.c
@@ -93,7 +93,7 @@ static int __init sfi_parse_ioapic(struct sfi_table_header *table)
93 pentry = (struct sfi_apic_table_entry *)sb->pentry; 93 pentry = (struct sfi_apic_table_entry *)sb->pentry;
94 94
95 for (i = 0; i < num; i++) { 95 for (i = 0; i < num; i++) {
96 mp_register_ioapic(i, pentry->phys_addr, gsi_end + 1); 96 mp_register_ioapic(i, pentry->phys_addr, gsi_top);
97 pentry++; 97 pentry++;
98 } 98 }
99 99
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index acc15b23b743..64121a18b8cb 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -302,7 +302,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
302 return -EINVAL; 302 return -EINVAL;
303 } 303 }
304 304
305 new = kmalloc(sizeof(struct memtype), GFP_KERNEL); 305 new = kzalloc(sizeof(struct memtype), GFP_KERNEL);
306 if (!new) 306 if (!new)
307 return -ENOMEM; 307 return -ENOMEM;
308 308
diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
index f537087bb740..f20eeec85a86 100644
--- a/arch/x86/mm/pat_rbtree.c
+++ b/arch/x86/mm/pat_rbtree.c
@@ -226,6 +226,7 @@ int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type)
226 if (ret_type) 226 if (ret_type)
227 new->type = *ret_type; 227 new->type = *ret_type;
228 228
229 new->subtree_max_end = new->end;
229 memtype_rb_insert(&memtype_rbroot, new); 230 memtype_rb_insert(&memtype_rbroot, new);
230 } 231 }
231 return err; 232 return err;
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index d269a8f3329c..446aced33aff 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -46,6 +46,8 @@ static unsigned long power_saving_mwait_eax;
46 46
47static unsigned char tsc_detected_unstable; 47static unsigned char tsc_detected_unstable;
48static unsigned char tsc_marked_unstable; 48static unsigned char tsc_marked_unstable;
49static unsigned char lapic_detected_unstable;
50static unsigned char lapic_marked_unstable;
49 51
50static void power_saving_mwait_init(void) 52static void power_saving_mwait_init(void)
51{ 53{
@@ -75,9 +77,6 @@ static void power_saving_mwait_init(void)
75 power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) | 77 power_saving_mwait_eax = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
76 (highest_subcstate - 1); 78 (highest_subcstate - 1);
77 79
78 for_each_online_cpu(i)
79 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &i);
80
81#if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86) 80#if defined(CONFIG_GENERIC_TIME) && defined(CONFIG_X86)
82 switch (boot_cpu_data.x86_vendor) { 81 switch (boot_cpu_data.x86_vendor) {
83 case X86_VENDOR_AMD: 82 case X86_VENDOR_AMD:
@@ -86,13 +85,15 @@ static void power_saving_mwait_init(void)
86 * AMD Fam10h TSC will tick in all 85 * AMD Fam10h TSC will tick in all
87 * C/P/S0/S1 states when this bit is set. 86 * C/P/S0/S1 states when this bit is set.
88 */ 87 */
89 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 88 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
90 return; 89 tsc_detected_unstable = 1;
91 90 if (!boot_cpu_has(X86_FEATURE_ARAT))
92 /*FALL THROUGH*/ 91 lapic_detected_unstable = 1;
92 break;
93 default: 93 default:
94 /* TSC could halt in idle */ 94 /* TSC & LAPIC could halt in idle */
95 tsc_detected_unstable = 1; 95 tsc_detected_unstable = 1;
96 lapic_detected_unstable = 1;
96 } 97 }
97#endif 98#endif
98} 99}
@@ -180,10 +181,20 @@ static int power_saving_thread(void *data)
180 mark_tsc_unstable("TSC halts in idle"); 181 mark_tsc_unstable("TSC halts in idle");
181 tsc_marked_unstable = 1; 182 tsc_marked_unstable = 1;
182 } 183 }
184 if (lapic_detected_unstable && !lapic_marked_unstable) {
185 int i;
186 /* LAPIC could halt in idle, so notify users */
187 for_each_online_cpu(i)
188 clockevents_notify(
189 CLOCK_EVT_NOTIFY_BROADCAST_ON,
190 &i);
191 lapic_marked_unstable = 1;
192 }
183 local_irq_disable(); 193 local_irq_disable();
184 cpu = smp_processor_id(); 194 cpu = smp_processor_id();
185 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, 195 if (lapic_marked_unstable)
186 &cpu); 196 clockevents_notify(
197 CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
187 stop_critical_timings(); 198 stop_critical_timings();
188 199
189 __monitor((void *)&current_thread_info()->flags, 0, 0); 200 __monitor((void *)&current_thread_info()->flags, 0, 0);
@@ -192,8 +203,9 @@ static int power_saving_thread(void *data)
192 __mwait(power_saving_mwait_eax, 1); 203 __mwait(power_saving_mwait_eax, 1);
193 204
194 start_critical_timings(); 205 start_critical_timings();
195 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, 206 if (lapic_marked_unstable)
196 &cpu); 207 clockevents_notify(
208 CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
197 local_irq_enable(); 209 local_irq_enable();
198 210
199 if (jiffies > expire_time) { 211 if (jiffies > expire_time) {
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h
index 33181ad350d5..b17d8de9f6ff 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -119,6 +119,10 @@
119 119
120#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF 120#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF
121 121
122/* Maximum sleep allowed via Sleep() operator */
123
124#define ACPI_MAX_SLEEP 20000 /* Two seconds */
125
122/****************************************************************************** 126/******************************************************************************
123 * 127 *
124 * ACPI Specification constants (Do not change unless the specification changes) 128 * ACPI Specification constants (Do not change unless the specification changes)
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 64d1e5c2d4ae..c3f43daa8be3 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -80,10 +80,6 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
80acpi_status 80acpi_status
81acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info); 81acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info);
82 82
83acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
84
85acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
86
87struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, 83struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
88 u32 gpe_number); 84 u32 gpe_number);
89 85
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 9070f1fe8f17..899d68afc3c5 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -125,6 +125,14 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
125 */ 125 */
126u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE); 126u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE);
127 127
128/*
129 * Optionally truncate I/O addresses to 16 bits. Provides compatibility
130 * with other ACPI implementations. NOTE: During ACPICA initialization,
131 * this value is set to TRUE if any Windows OSI strings have been
132 * requested by the BIOS.
133 */
134u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);
135
128/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */ 136/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
129 137
130struct acpi_table_fadt acpi_gbl_FADT; 138struct acpi_table_fadt acpi_gbl_FADT;
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index 5900f135dc6d..32391588e163 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -90,7 +90,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width);
90/* 90/*
91 * hwgpe - GPE support 91 * hwgpe - GPE support
92 */ 92 */
93acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info); 93u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
94 struct acpi_gpe_register_info *gpe_register_info);
95
96acpi_status
97acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action);
94 98
95acpi_status 99acpi_status
96acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info); 100acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info);
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index a221ad404167..7c2c336006a1 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -69,7 +69,7 @@ acpi_status
69acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) 69acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info)
70{ 70{
71 struct acpi_gpe_register_info *gpe_register_info; 71 struct acpi_gpe_register_info *gpe_register_info;
72 u8 register_bit; 72 u32 register_bit;
73 73
74 ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); 74 ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks);
75 75
@@ -78,9 +78,8 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info)
78 return_ACPI_STATUS(AE_NOT_EXIST); 78 return_ACPI_STATUS(AE_NOT_EXIST);
79 } 79 }
80 80
81 register_bit = (u8) 81 register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
82 (1 << 82 gpe_register_info);
83 (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
84 83
85 /* Clear the wake/run bits up front */ 84 /* Clear the wake/run bits up front */
86 85
@@ -100,106 +99,6 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info)
100 return_ACPI_STATUS(AE_OK); 99 return_ACPI_STATUS(AE_OK);
101} 100}
102 101
103/*******************************************************************************
104 *
105 * FUNCTION: acpi_ev_enable_gpe
106 *
107 * PARAMETERS: gpe_event_info - GPE to enable
108 *
109 * RETURN: Status
110 *
111 * DESCRIPTION: Hardware-enable a GPE. Always enables the GPE, regardless
112 * of type or number of references.
113 *
114 * Note: The GPE lock should be already acquired when this function is called.
115 *
116 ******************************************************************************/
117
118acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
119{
120 acpi_status status;
121
122
123 ACPI_FUNCTION_TRACE(ev_enable_gpe);
124
125
126 /*
127 * We will only allow a GPE to be enabled if it has either an
128 * associated method (_Lxx/_Exx) or a handler. Otherwise, the
129 * GPE will be immediately disabled by acpi_ev_gpe_dispatch the
130 * first time it fires.
131 */
132 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
133 return_ACPI_STATUS(AE_NO_HANDLER);
134 }
135
136 /* Ensure the HW enable masks are current */
137
138 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
139 if (ACPI_FAILURE(status)) {
140 return_ACPI_STATUS(status);
141 }
142
143 /* Clear the GPE (of stale events) */
144
145 status = acpi_hw_clear_gpe(gpe_event_info);
146 if (ACPI_FAILURE(status)) {
147 return_ACPI_STATUS(status);
148 }
149
150 /* Enable the requested GPE */
151
152 status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
153 return_ACPI_STATUS(status);
154}
155
156/*******************************************************************************
157 *
158 * FUNCTION: acpi_ev_disable_gpe
159 *
160 * PARAMETERS: gpe_event_info - GPE to disable
161 *
162 * RETURN: Status
163 *
164 * DESCRIPTION: Hardware-disable a GPE. Always disables the requested GPE,
165 * regardless of the type or number of references.
166 *
167 * Note: The GPE lock should be already acquired when this function is called.
168 *
169 ******************************************************************************/
170
171acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
172{
173 acpi_status status;
174
175 ACPI_FUNCTION_TRACE(ev_disable_gpe);
176
177
178 /*
179 * Note: Always disable the GPE, even if we think that that it is already
180 * disabled. It is possible that the AML or some other code has enabled
181 * the GPE behind our back.
182 */
183
184 /* Ensure the HW enable masks are current */
185
186 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
187 if (ACPI_FAILURE(status)) {
188 return_ACPI_STATUS(status);
189 }
190
191 /*
192 * Always H/W disable this GPE, even if we don't know the GPE type.
193 * Simply clear the enable bit for this particular GPE, but do not
194 * write out the current GPE enable mask since this may inadvertently
195 * enable GPEs too early. An example is a rogue GPE that has arrived
196 * during ACPICA initialization - possibly because AML or other code
197 * has enabled the GPE.
198 */
199 status = acpi_hw_low_disable_gpe(gpe_event_info);
200 return_ACPI_STATUS(status);
201}
202
203 102
204/******************************************************************************* 103/*******************************************************************************
205 * 104 *
@@ -451,10 +350,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
451 return_VOID; 350 return_VOID;
452 } 351 }
453 352
454 /* Update the GPE register masks for return to enabled state */
455
456 (void)acpi_ev_update_gpe_enable_masks(gpe_event_info);
457
458 /* 353 /*
459 * Take a snapshot of the GPE info for this level - we copy the info to 354 * Take a snapshot of the GPE info for this level - we copy the info to
460 * prevent a race condition with remove_handler/remove_block. 355 * prevent a race condition with remove_handler/remove_block.
@@ -607,7 +502,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
607 * Disable the GPE, so it doesn't keep firing before the method has a 502 * Disable the GPE, so it doesn't keep firing before the method has a
608 * chance to run (it runs asynchronously with interrupts enabled). 503 * chance to run (it runs asynchronously with interrupts enabled).
609 */ 504 */
610 status = acpi_ev_disable_gpe(gpe_event_info); 505 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
611 if (ACPI_FAILURE(status)) { 506 if (ACPI_FAILURE(status)) {
612 ACPI_EXCEPTION((AE_INFO, status, 507 ACPI_EXCEPTION((AE_INFO, status,
613 "Unable to disable GPE[0x%2X]", 508 "Unable to disable GPE[0x%2X]",
@@ -644,7 +539,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
644 * Disable the GPE. The GPE will remain disabled a handler 539 * Disable the GPE. The GPE will remain disabled a handler
645 * is installed or ACPICA is restarted. 540 * is installed or ACPICA is restarted.
646 */ 541 */
647 status = acpi_ev_disable_gpe(gpe_event_info); 542 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
648 if (ACPI_FAILURE(status)) { 543 if (ACPI_FAILURE(status)) {
649 ACPI_EXCEPTION((AE_INFO, status, 544 ACPI_EXCEPTION((AE_INFO, status,
650 "Unable to disable GPE[0x%2X]", 545 "Unable to disable GPE[0x%2X]",
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 7c28f2d9fd35..341a38ce8aa6 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -500,6 +500,19 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
500 500
501 gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; 501 gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j;
502 gpe_event_info = &gpe_block->event_info[gpe_index]; 502 gpe_event_info = &gpe_block->event_info[gpe_index];
503 gpe_number = gpe_index + gpe_block->block_base_number;
504
505 /*
506 * If the GPE has already been enabled for runtime
507 * signaling, make sure it remains enabled, but do not
508 * increment its reference counter.
509 */
510 if (gpe_event_info->runtime_count) {
511 acpi_set_gpe(gpe_device, gpe_number,
512 ACPI_GPE_ENABLE);
513 gpe_enabled_count++;
514 continue;
515 }
503 516
504 if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { 517 if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
505 wake_gpe_count++; 518 wake_gpe_count++;
@@ -516,7 +529,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
516 529
517 /* Enable this GPE */ 530 /* Enable this GPE */
518 531
519 gpe_number = gpe_index + gpe_block->block_base_number;
520 status = acpi_enable_gpe(gpe_device, gpe_number, 532 status = acpi_enable_gpe(gpe_device, gpe_number,
521 ACPI_GPE_TYPE_RUNTIME); 533 ACPI_GPE_TYPE_RUNTIME);
522 if (ACPI_FAILURE(status)) { 534 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index cc825023012a..4a531cdf7942 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -719,13 +719,6 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
719 handler->context = context; 719 handler->context = context;
720 handler->method_node = gpe_event_info->dispatch.method_node; 720 handler->method_node = gpe_event_info->dispatch.method_node;
721 721
722 /* Disable the GPE before installing the handler */
723
724 status = acpi_ev_disable_gpe(gpe_event_info);
725 if (ACPI_FAILURE (status)) {
726 goto unlock_and_exit;
727 }
728
729 /* Install the handler */ 722 /* Install the handler */
730 723
731 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 724 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index d5a5efc043bf..d97b8dce1668 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -210,6 +210,44 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event)
210 210
211/******************************************************************************* 211/*******************************************************************************
212 * 212 *
213 * FUNCTION: acpi_clear_and_enable_gpe
214 *
215 * PARAMETERS: gpe_event_info - GPE to enable
216 *
217 * RETURN: Status
218 *
219 * DESCRIPTION: Clear the given GPE from stale events and enable it.
220 *
221 ******************************************************************************/
222static acpi_status
223acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
224{
225 acpi_status status;
226
227 /*
228 * We will only allow a GPE to be enabled if it has either an
229 * associated method (_Lxx/_Exx) or a handler. Otherwise, the
230 * GPE will be immediately disabled by acpi_ev_gpe_dispatch the
231 * first time it fires.
232 */
233 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
234 return_ACPI_STATUS(AE_NO_HANDLER);
235 }
236
237 /* Clear the GPE (of stale events) */
238 status = acpi_hw_clear_gpe(gpe_event_info);
239 if (ACPI_FAILURE(status)) {
240 return_ACPI_STATUS(status);
241 }
242
243 /* Enable the requested GPE */
244 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
245
246 return_ACPI_STATUS(status);
247}
248
249/*******************************************************************************
250 *
213 * FUNCTION: acpi_set_gpe 251 * FUNCTION: acpi_set_gpe
214 * 252 *
215 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 253 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
@@ -249,11 +287,11 @@ acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
249 287
250 switch (action) { 288 switch (action) {
251 case ACPI_GPE_ENABLE: 289 case ACPI_GPE_ENABLE:
252 status = acpi_ev_enable_gpe(gpe_event_info); 290 status = acpi_clear_and_enable_gpe(gpe_event_info);
253 break; 291 break;
254 292
255 case ACPI_GPE_DISABLE: 293 case ACPI_GPE_DISABLE:
256 status = acpi_ev_disable_gpe(gpe_event_info); 294 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE);
257 break; 295 break;
258 296
259 default: 297 default:
@@ -316,7 +354,11 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type)
316 354
317 gpe_event_info->runtime_count++; 355 gpe_event_info->runtime_count++;
318 if (gpe_event_info->runtime_count == 1) { 356 if (gpe_event_info->runtime_count == 1) {
319 status = acpi_ev_enable_gpe(gpe_event_info); 357 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
358 if (ACPI_SUCCESS(status)) {
359 status = acpi_clear_and_enable_gpe(gpe_event_info);
360 }
361
320 if (ACPI_FAILURE(status)) { 362 if (ACPI_FAILURE(status)) {
321 gpe_event_info->runtime_count--; 363 gpe_event_info->runtime_count--;
322 goto unlock_and_exit; 364 goto unlock_and_exit;
@@ -343,7 +385,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type)
343 */ 385 */
344 gpe_event_info->wakeup_count++; 386 gpe_event_info->wakeup_count++;
345 if (gpe_event_info->wakeup_count == 1) { 387 if (gpe_event_info->wakeup_count == 1) {
346 (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); 388 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
347 } 389 }
348 } 390 }
349 391
@@ -403,7 +445,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type
403 445
404 gpe_event_info->runtime_count--; 446 gpe_event_info->runtime_count--;
405 if (!gpe_event_info->runtime_count) { 447 if (!gpe_event_info->runtime_count) {
406 status = acpi_ev_disable_gpe(gpe_event_info); 448 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
449 if (ACPI_SUCCESS(status)) {
450 status = acpi_hw_low_set_gpe(gpe_event_info,
451 ACPI_GPE_DISABLE);
452 }
453
407 if (ACPI_FAILURE(status)) { 454 if (ACPI_FAILURE(status)) {
408 gpe_event_info->runtime_count++; 455 gpe_event_info->runtime_count++;
409 goto unlock_and_exit; 456 goto unlock_and_exit;
@@ -424,7 +471,7 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 gpe_type
424 471
425 gpe_event_info->wakeup_count--; 472 gpe_event_info->wakeup_count--;
426 if (!gpe_event_info->wakeup_count) { 473 if (!gpe_event_info->wakeup_count) {
427 (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); 474 status = acpi_ev_update_gpe_enable_masks(gpe_event_info);
428 } 475 }
429 } 476 }
430 477
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index 6d32e09327f1..675aaa91a770 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -201,6 +201,14 @@ acpi_status acpi_ex_system_do_sleep(u64 how_long)
201 201
202 acpi_ex_relinquish_interpreter(); 202 acpi_ex_relinquish_interpreter();
203 203
204 /*
205 * For compatibility with other ACPI implementations and to prevent
206 * accidental deep sleeps, limit the sleep time to something reasonable.
207 */
208 if (how_long > ACPI_MAX_SLEEP) {
209 how_long = ACPI_MAX_SLEEP;
210 }
211
204 acpi_os_sleep(how_long); 212 acpi_os_sleep(how_long);
205 213
206 /* And now we must get the interpreter again */ 214 /* And now we must get the interpreter again */
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index bd72319a38f0..3450309c2786 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -57,21 +57,47 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
57 57
58/****************************************************************************** 58/******************************************************************************
59 * 59 *
60 * FUNCTION: acpi_hw_low_disable_gpe 60 * FUNCTION: acpi_hw_gpe_register_bit
61 *
62 * PARAMETERS: gpe_event_info - Info block for the GPE
63 * gpe_register_info - Info block for the GPE register
64 *
65 * RETURN: Status
66 *
67 * DESCRIPTION: Compute GPE enable mask with one bit corresponding to the given
68 * GPE set.
69 *
70 ******************************************************************************/
71
72u32 acpi_hw_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info,
73 struct acpi_gpe_register_info *gpe_register_info)
74{
75 return (u32)1 << (gpe_event_info->gpe_number -
76 gpe_register_info->base_gpe_number);
77}
78
79/******************************************************************************
80 *
81 * FUNCTION: acpi_hw_low_set_gpe
61 * 82 *
62 * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled 83 * PARAMETERS: gpe_event_info - Info block for the GPE to be disabled
84 * action - Enable or disable
63 * 85 *
64 * RETURN: Status 86 * RETURN: Status
65 * 87 *
66 * DESCRIPTION: Disable a single GPE in the enable register. 88 * DESCRIPTION: Enable or disable a single GPE in its enable register.
67 * 89 *
68 ******************************************************************************/ 90 ******************************************************************************/
69 91
70acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) 92acpi_status
93acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 action)
71{ 94{
72 struct acpi_gpe_register_info *gpe_register_info; 95 struct acpi_gpe_register_info *gpe_register_info;
73 acpi_status status; 96 acpi_status status;
74 u32 enable_mask; 97 u32 enable_mask;
98 u32 register_bit;
99
100 ACPI_FUNCTION_ENTRY();
75 101
76 /* Get the info block for the entire GPE register */ 102 /* Get the info block for the entire GPE register */
77 103
@@ -87,11 +113,27 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
87 return (status); 113 return (status);
88 } 114 }
89 115
90 /* Clear just the bit that corresponds to this GPE */ 116 /* Set ot clear just the bit that corresponds to this GPE */
91 117
92 ACPI_CLEAR_BIT(enable_mask, ((u32)1 << 118 register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
93 (gpe_event_info->gpe_number - 119 gpe_register_info);
94 gpe_register_info->base_gpe_number))); 120 switch (action) {
121 case ACPI_GPE_COND_ENABLE:
122 if (!(register_bit & gpe_register_info->enable_for_run))
123 return (AE_BAD_PARAMETER);
124
125 case ACPI_GPE_ENABLE:
126 ACPI_SET_BIT(enable_mask, register_bit);
127 break;
128
129 case ACPI_GPE_DISABLE:
130 ACPI_CLEAR_BIT(enable_mask, register_bit);
131 break;
132
133 default:
134 ACPI_ERROR((AE_INFO, "Invalid action\n"));
135 return (AE_BAD_PARAMETER);
136 }
95 137
96 /* Write the updated enable mask */ 138 /* Write the updated enable mask */
97 139
@@ -116,23 +158,11 @@ acpi_status acpi_hw_low_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
116acpi_status 158acpi_status
117acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info) 159acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
118{ 160{
119 struct acpi_gpe_register_info *gpe_register_info;
120 acpi_status status; 161 acpi_status status;
121 162
122 ACPI_FUNCTION_ENTRY(); 163 ACPI_FUNCTION_ENTRY();
123 164
124 /* Get the info block for the entire GPE register */ 165 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_COND_ENABLE);
125
126 gpe_register_info = gpe_event_info->register_info;
127 if (!gpe_register_info) {
128 return (AE_NOT_EXIST);
129 }
130
131 /* Write the entire GPE (runtime) enable register */
132
133 status = acpi_hw_write(gpe_register_info->enable_for_run,
134 &gpe_register_info->enable_address);
135
136 return (status); 166 return (status);
137} 167}
138 168
@@ -150,21 +180,28 @@ acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info * gpe_event_info)
150 180
151acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) 181acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
152{ 182{
183 struct acpi_gpe_register_info *gpe_register_info;
153 acpi_status status; 184 acpi_status status;
154 u8 register_bit; 185 u32 register_bit;
155 186
156 ACPI_FUNCTION_ENTRY(); 187 ACPI_FUNCTION_ENTRY();
157 188
158 register_bit = (u8)(1 << 189 /* Get the info block for the entire GPE register */
159 (gpe_event_info->gpe_number - 190
160 gpe_event_info->register_info->base_gpe_number)); 191 gpe_register_info = gpe_event_info->register_info;
192 if (!gpe_register_info) {
193 return (AE_NOT_EXIST);
194 }
195
196 register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
197 gpe_register_info);
161 198
162 /* 199 /*
163 * Write a one to the appropriate bit in the status register to 200 * Write a one to the appropriate bit in the status register to
164 * clear this GPE. 201 * clear this GPE.
165 */ 202 */
166 status = acpi_hw_write(register_bit, 203 status = acpi_hw_write(register_bit,
167 &gpe_event_info->register_info->status_address); 204 &gpe_register_info->status_address);
168 205
169 return (status); 206 return (status);
170} 207}
@@ -187,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
187 acpi_event_status * event_status) 224 acpi_event_status * event_status)
188{ 225{
189 u32 in_byte; 226 u32 in_byte;
190 u8 register_bit; 227 u32 register_bit;
191 struct acpi_gpe_register_info *gpe_register_info; 228 struct acpi_gpe_register_info *gpe_register_info;
192 acpi_status status; 229 acpi_status status;
193 acpi_event_status local_event_status = 0; 230 acpi_event_status local_event_status = 0;
@@ -204,9 +241,8 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
204 241
205 /* Get the register bitmask for this GPE */ 242 /* Get the register bitmask for this GPE */
206 243
207 register_bit = (u8)(1 << 244 register_bit = acpi_hw_gpe_register_bit(gpe_event_info,
208 (gpe_event_info->gpe_number - 245 gpe_register_info);
209 gpe_event_info->register_info->base_gpe_number));
210 246
211 /* GPE currently enabled? (enabled for runtime?) */ 247 /* GPE currently enabled? (enabled for runtime?) */
212 248
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index c10d587c1641..e1d9c777b213 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -222,6 +222,12 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
222 u32 one_byte; 222 u32 one_byte;
223 u32 i; 223 u32 i;
224 224
225 /* Truncate address to 16 bits if requested */
226
227 if (acpi_gbl_truncate_io_addresses) {
228 address &= ACPI_UINT16_MAX;
229 }
230
225 /* Validate the entire request and perform the I/O */ 231 /* Validate the entire request and perform the I/O */
226 232
227 status = acpi_hw_validate_io_request(address, width); 233 status = acpi_hw_validate_io_request(address, width);
@@ -279,6 +285,12 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
279 acpi_status status; 285 acpi_status status;
280 u32 i; 286 u32 i;
281 287
288 /* Truncate address to 16 bits if requested */
289
290 if (acpi_gbl_truncate_io_addresses) {
291 address &= ACPI_UINT16_MAX;
292 }
293
282 /* Validate the entire request and perform the I/O */ 294 /* Validate the entire request and perform the I/O */
283 295
284 status = acpi_hw_validate_io_request(address, width); 296 status = acpi_hw_validate_io_request(address, width);
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 9bd6f050f299..4e5272c313e0 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -193,6 +193,15 @@ acpi_status acpi_ns_initialize_devices(void)
193 acpi_ns_init_one_device, NULL, &info, 193 acpi_ns_init_one_device, NULL, &info,
194 NULL); 194 NULL);
195 195
196 /*
197 * Any _OSI requests should be completed by now. If the BIOS has
198 * requested any Windows OSI strings, we will always truncate
199 * I/O addresses to 16 bits -- for Windows compatibility.
200 */
201 if (acpi_gbl_osi_data >= ACPI_OSI_WIN_2000) {
202 acpi_gbl_truncate_io_addresses = TRUE;
203 }
204
196 ACPI_FREE(info.evaluate_info); 205 ACPI_FREE(info.evaluate_info);
197 if (ACPI_FAILURE(status)) { 206 if (ACPI_FAILURE(status)) {
198 goto error_exit; 207 goto error_exit;
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index db3946e9c66b..216e1e948ff6 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -34,6 +34,7 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/acpi.h> 36#include <linux/acpi.h>
37#include <linux/slab.h>
37#include <linux/io.h> 38#include <linux/io.h>
38#include <linux/kref.h> 39#include <linux/kref.h>
39#include <linux/rculist.h> 40#include <linux/rculist.h>
diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 814b19249616..8f8bd736d4ff 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -31,6 +31,7 @@
31#include <linux/kref.h> 31#include <linux/kref.h>
32#include <linux/rculist.h> 32#include <linux/rculist.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/slab.h>
34#include <acpi/atomicio.h> 35#include <acpi/atomicio.h>
35 36
36#define ACPI_PFX "ACPI: " 37#define ACPI_PFX "ACPI: "
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 2815df66f6f7..01381be05e96 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -218,6 +218,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
218 }, 218 },
219 }, 219 },
220 { 220 {
221 .callback = dmi_disable_osi_vista,
222 .ident = "VGN-NS50B_L",
223 .matches = {
224 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
225 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"),
226 },
227 },
228 {
221 .callback = dmi_disable_osi_win7, 229 .callback = dmi_disable_osi_win7,
222 .ident = "ASUS K50IJ", 230 .ident = "ASUS K50IJ",
223 .matches = { 231 .matches = {
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index fd51c4ab4829..7d857dabdde4 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -425,7 +425,7 @@ static int acpi_button_add(struct acpi_device *device)
425 /* Button's GPE is run-wake GPE */ 425 /* Button's GPE is run-wake GPE */
426 acpi_enable_gpe(device->wakeup.gpe_device, 426 acpi_enable_gpe(device->wakeup.gpe_device,
427 device->wakeup.gpe_number, 427 device->wakeup.gpe_number,
428 ACPI_GPE_TYPE_WAKE_RUN); 428 ACPI_GPE_TYPE_RUNTIME);
429 device->wakeup.run_wake_count++; 429 device->wakeup.run_wake_count++;
430 device->wakeup.state.enabled = 1; 430 device->wakeup.state.enabled = 1;
431 } 431 }
@@ -449,7 +449,7 @@ static int acpi_button_remove(struct acpi_device *device, int type)
449 if (device->wakeup.flags.valid) { 449 if (device->wakeup.flags.valid) {
450 acpi_disable_gpe(device->wakeup.gpe_device, 450 acpi_disable_gpe(device->wakeup.gpe_device,
451 device->wakeup.gpe_number, 451 device->wakeup.gpe_number,
452 ACPI_GPE_TYPE_WAKE_RUN); 452 ACPI_GPE_TYPE_RUNTIME);
453 device->wakeup.run_wake_count--; 453 device->wakeup.run_wake_count--;
454 device->wakeup.state.enabled = 0; 454 device->wakeup.state.enabled = 0;
455 } 455 }
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index acf2ab249842..8a3b840c0bb2 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -347,7 +347,6 @@ static int __init acpi_fan_init(void)
347{ 347{
348 int result = 0; 348 int result = 0;
349 349
350
351#ifdef CONFIG_ACPI_PROCFS 350#ifdef CONFIG_ACPI_PROCFS
352 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir); 351 acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
353 if (!acpi_fan_dir) 352 if (!acpi_fan_dir)
@@ -356,7 +355,9 @@ static int __init acpi_fan_init(void)
356 355
357 result = acpi_bus_register_driver(&acpi_fan_driver); 356 result = acpi_bus_register_driver(&acpi_fan_driver);
358 if (result < 0) { 357 if (result < 0) {
358#ifdef CONFIG_ACPI_PROCFS
359 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir); 359 remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
360#endif
360 return -ENODEV; 361 return -ENODEV;
361 } 362 }
362 363
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index b1034a9ada4e..38ea0cc6dc49 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -581,6 +581,11 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
581 return 0; 581 return 0;
582 } 582 }
583 583
584#ifdef CONFIG_SMP
585 if (pr->id >= setup_max_cpus && pr->id != 0)
586 return 0;
587#endif
588
584 BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); 589 BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
585 590
586 /* 591 /*
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 3fb4bdea7e06..5b7c52e4a00f 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -114,6 +114,8 @@ static int __acpi_pm_prepare(void)
114{ 114{
115 int error = acpi_sleep_prepare(acpi_target_sleep_state); 115 int error = acpi_sleep_prepare(acpi_target_sleep_state);
116 116
117 suspend_nvs_save();
118
117 if (error) 119 if (error)
118 acpi_target_sleep_state = ACPI_STATE_S0; 120 acpi_target_sleep_state = ACPI_STATE_S0;
119 return error; 121 return error;
@@ -143,6 +145,9 @@ static void acpi_pm_finish(void)
143{ 145{
144 u32 acpi_state = acpi_target_sleep_state; 146 u32 acpi_state = acpi_target_sleep_state;
145 147
148 suspend_nvs_free();
149 acpi_ec_unblock_transactions();
150
146 if (acpi_state == ACPI_STATE_S0) 151 if (acpi_state == ACPI_STATE_S0)
147 return; 152 return;
148 153
@@ -192,6 +197,11 @@ static int acpi_suspend_begin(suspend_state_t pm_state)
192 u32 acpi_state = acpi_suspend_states[pm_state]; 197 u32 acpi_state = acpi_suspend_states[pm_state];
193 int error = 0; 198 int error = 0;
194 199
200 error = suspend_nvs_alloc();
201
202 if (error)
203 return error;
204
195 if (sleep_states[acpi_state]) { 205 if (sleep_states[acpi_state]) {
196 acpi_target_sleep_state = acpi_state; 206 acpi_target_sleep_state = acpi_state;
197 acpi_sleep_tts_switch(acpi_target_sleep_state); 207 acpi_sleep_tts_switch(acpi_target_sleep_state);
@@ -269,12 +279,13 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
269 if (acpi_state == ACPI_STATE_S3) 279 if (acpi_state == ACPI_STATE_S3)
270 acpi_restore_state_mem(); 280 acpi_restore_state_mem();
271 281
282 suspend_nvs_restore();
283
272 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 284 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
273} 285}
274 286
275static void acpi_suspend_finish(void) 287static void acpi_suspend_finish(void)
276{ 288{
277 acpi_ec_unblock_transactions();
278 acpi_pm_finish(); 289 acpi_pm_finish();
279} 290}
280 291
@@ -404,7 +415,7 @@ static int acpi_hibernation_begin(void)
404{ 415{
405 int error; 416 int error;
406 417
407 error = s4_no_nvs ? 0 : hibernate_nvs_alloc(); 418 error = s4_no_nvs ? 0 : suspend_nvs_alloc();
408 if (!error) { 419 if (!error) {
409 acpi_target_sleep_state = ACPI_STATE_S4; 420 acpi_target_sleep_state = ACPI_STATE_S4;
410 acpi_sleep_tts_switch(acpi_target_sleep_state); 421 acpi_sleep_tts_switch(acpi_target_sleep_state);
@@ -418,7 +429,7 @@ static int acpi_hibernation_pre_snapshot(void)
418 int error = acpi_pm_prepare(); 429 int error = acpi_pm_prepare();
419 430
420 if (!error) 431 if (!error)
421 hibernate_nvs_save(); 432 suspend_nvs_save();
422 433
423 return error; 434 return error;
424} 435}
@@ -441,13 +452,6 @@ static int acpi_hibernation_enter(void)
441 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 452 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
442} 453}
443 454
444static void acpi_hibernation_finish(void)
445{
446 hibernate_nvs_free();
447 acpi_ec_unblock_transactions();
448 acpi_pm_finish();
449}
450
451static void acpi_hibernation_leave(void) 455static void acpi_hibernation_leave(void)
452{ 456{
453 /* 457 /*
@@ -464,7 +468,7 @@ static void acpi_hibernation_leave(void)
464 panic("ACPI S4 hardware signature mismatch"); 468 panic("ACPI S4 hardware signature mismatch");
465 } 469 }
466 /* Restore the NVS memory area */ 470 /* Restore the NVS memory area */
467 hibernate_nvs_restore(); 471 suspend_nvs_restore();
468 /* Allow EC transactions to happen. */ 472 /* Allow EC transactions to happen. */
469 acpi_ec_unblock_transactions_early(); 473 acpi_ec_unblock_transactions_early();
470} 474}
@@ -479,7 +483,7 @@ static struct platform_hibernation_ops acpi_hibernation_ops = {
479 .begin = acpi_hibernation_begin, 483 .begin = acpi_hibernation_begin,
480 .end = acpi_pm_end, 484 .end = acpi_pm_end,
481 .pre_snapshot = acpi_hibernation_pre_snapshot, 485 .pre_snapshot = acpi_hibernation_pre_snapshot,
482 .finish = acpi_hibernation_finish, 486 .finish = acpi_pm_finish,
483 .prepare = acpi_pm_prepare, 487 .prepare = acpi_pm_prepare,
484 .enter = acpi_hibernation_enter, 488 .enter = acpi_hibernation_enter,
485 .leave = acpi_hibernation_leave, 489 .leave = acpi_hibernation_leave,
@@ -507,7 +511,7 @@ static int acpi_hibernation_begin_old(void)
507 511
508 if (!error) { 512 if (!error) {
509 if (!s4_no_nvs) 513 if (!s4_no_nvs)
510 error = hibernate_nvs_alloc(); 514 error = suspend_nvs_alloc();
511 if (!error) 515 if (!error)
512 acpi_target_sleep_state = ACPI_STATE_S4; 516 acpi_target_sleep_state = ACPI_STATE_S4;
513 } 517 }
@@ -517,7 +521,7 @@ static int acpi_hibernation_begin_old(void)
517static int acpi_hibernation_pre_snapshot_old(void) 521static int acpi_hibernation_pre_snapshot_old(void)
518{ 522{
519 acpi_pm_freeze(); 523 acpi_pm_freeze();
520 hibernate_nvs_save(); 524 suspend_nvs_save();
521 return 0; 525 return 0;
522} 526}
523 527
@@ -529,8 +533,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = {
529 .begin = acpi_hibernation_begin_old, 533 .begin = acpi_hibernation_begin_old,
530 .end = acpi_pm_end, 534 .end = acpi_pm_end,
531 .pre_snapshot = acpi_hibernation_pre_snapshot_old, 535 .pre_snapshot = acpi_hibernation_pre_snapshot_old,
532 .finish = acpi_hibernation_finish,
533 .prepare = acpi_pm_freeze, 536 .prepare = acpi_pm_freeze,
537 .finish = acpi_pm_finish,
534 .enter = acpi_hibernation_enter, 538 .enter = acpi_hibernation_enter,
535 .leave = acpi_hibernation_leave, 539 .leave = acpi_hibernation_leave,
536 .pre_restore = acpi_pm_freeze, 540 .pre_restore = acpi_pm_freeze,
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index c79e789ed03a..f8db50a0941c 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -388,10 +388,12 @@ static ssize_t counter_set(struct kobject *kobj,
388 if (index < num_gpes) { 388 if (index < num_gpes) {
389 if (!strcmp(buf, "disable\n") && 389 if (!strcmp(buf, "disable\n") &&
390 (status & ACPI_EVENT_FLAG_ENABLED)) 390 (status & ACPI_EVENT_FLAG_ENABLED))
391 result = acpi_set_gpe(handle, index, ACPI_GPE_DISABLE); 391 result = acpi_disable_gpe(handle, index,
392 ACPI_GPE_TYPE_RUNTIME);
392 else if (!strcmp(buf, "enable\n") && 393 else if (!strcmp(buf, "enable\n") &&
393 !(status & ACPI_EVENT_FLAG_ENABLED)) 394 !(status & ACPI_EVENT_FLAG_ENABLED))
394 result = acpi_set_gpe(handle, index, ACPI_GPE_ENABLE); 395 result = acpi_enable_gpe(handle, index,
396 ACPI_GPE_TYPE_RUNTIME);
395 else if (!strcmp(buf, "clear\n") && 397 else if (!strcmp(buf, "clear\n") &&
396 (status & ACPI_EVENT_FLAG_SET)) 398 (status & ACPI_EVENT_FLAG_SET))
397 result = acpi_clear_gpe(handle, index); 399 result = acpi_clear_gpe(handle, index);
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c
index 4b9d339a6e28..388747a7ef4f 100644
--- a/drivers/acpi/wakeup.c
+++ b/drivers/acpi/wakeup.c
@@ -64,16 +64,13 @@ void acpi_enable_wakeup_device(u8 sleep_state)
64 struct acpi_device *dev = 64 struct acpi_device *dev =
65 container_of(node, struct acpi_device, wakeup_list); 65 container_of(node, struct acpi_device, wakeup_list);
66 66
67 if (!dev->wakeup.flags.valid) 67 if (!dev->wakeup.flags.valid || !dev->wakeup.state.enabled
68 continue;
69
70 if ((!dev->wakeup.state.enabled && !dev->wakeup.prepare_count)
71 || sleep_state > (u32) dev->wakeup.sleep_state) 68 || sleep_state > (u32) dev->wakeup.sleep_state)
72 continue; 69 continue;
73 70
74 /* The wake-up power should have been enabled already. */ 71 /* The wake-up power should have been enabled already. */
75 acpi_set_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number, 72 acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
76 ACPI_GPE_ENABLE); 73 ACPI_GPE_TYPE_WAKE);
77 } 74 }
78} 75}
79 76
@@ -96,6 +93,8 @@ void acpi_disable_wakeup_device(u8 sleep_state)
96 || (sleep_state > (u32) dev->wakeup.sleep_state)) 93 || (sleep_state > (u32) dev->wakeup.sleep_state))
97 continue; 94 continue;
98 95
96 acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
97 ACPI_GPE_TYPE_WAKE);
99 acpi_disable_wakeup_device_power(dev); 98 acpi_disable_wakeup_device_power(dev);
100 } 99 }
101} 100}
@@ -109,13 +108,8 @@ int __init acpi_wakeup_device_init(void)
109 struct acpi_device *dev = container_of(node, 108 struct acpi_device *dev = container_of(node,
110 struct acpi_device, 109 struct acpi_device,
111 wakeup_list); 110 wakeup_list);
112 /* In case user doesn't load button driver */ 111 if (dev->wakeup.flags.always_enabled)
113 if (!dev->wakeup.flags.always_enabled || 112 dev->wakeup.state.enabled = 1;
114 dev->wakeup.state.enabled)
115 continue;
116 acpi_enable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
117 ACPI_GPE_TYPE_WAKE);
118 dev->wakeup.state.enabled = 1;
119 } 113 }
120 mutex_unlock(&acpi_device_lock); 114 mutex_unlock(&acpi_device_lock);
121 return 0; 115 return 0;
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 5d15630a5830..5d64e3acb000 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -580,8 +580,12 @@ static bool sysrq_filter(struct input_handle *handle, unsigned int type,
580 case KEY_RIGHTALT: 580 case KEY_RIGHTALT:
581 if (value) 581 if (value)
582 sysrq_alt = code; 582 sysrq_alt = code;
583 else if (sysrq_down && code == sysrq_alt_use) 583 else {
584 sysrq_down = false; 584 if (sysrq_down && code == sysrq_alt_use)
585 sysrq_down = false;
586
587 sysrq_alt = 0;
588 }
585 break; 589 break;
586 590
587 case KEY_SYSRQ: 591 case KEY_SYSRQ:
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 8e00b4ddd083..792868d24f2a 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -224,6 +224,7 @@ struct tpm_readpubek_params_out {
224 u8 algorithm[4]; 224 u8 algorithm[4];
225 u8 encscheme[2]; 225 u8 encscheme[2];
226 u8 sigscheme[2]; 226 u8 sigscheme[2];
227 __be32 paramsize;
227 u8 parameters[12]; /*assuming RSA*/ 228 u8 parameters[12]; /*assuming RSA*/
228 __be32 keysize; 229 __be32 keysize;
229 u8 modulus[256]; 230 u8 modulus[256];
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index f3d3898898ed..717305d30444 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -449,7 +449,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p,
449 clk_disable(p->clk); 449 clk_disable(p->clk);
450 450
451 /* TODO: calculate good shift from rate and counter bit width */ 451 /* TODO: calculate good shift from rate and counter bit width */
452 cs->shift = 10; 452 cs->shift = 0;
453 cs->mult = clocksource_hz2mult(p->rate, cs->shift); 453 cs->mult = clocksource_hz2mult(p->rate, cs->shift);
454 454
455 dev_info(&p->pdev->dev, "used as clock source\n"); 455 dev_info(&p->pdev->dev, "used as clock source\n");
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index e880e2c3871d..937983407e2a 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -289,6 +289,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
289 iattr->s_attr.dev_attr.attr.mode = S_IRUGO; 289 iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
290 iattr->s_attr.dev_attr.show = show_label; 290 iattr->s_attr.dev_attr.show = show_label;
291 iattr->s_attr.index = k; 291 iattr->s_attr.index = k;
292 sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
292 res = device_create_file(&pdev->dev, 293 res = device_create_file(&pdev->dev,
293 &iattr->s_attr.dev_attr); 294 &iattr->s_attr.dev_attr);
294 if (res) 295 if (res)
@@ -303,6 +304,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
303 iattr->s_attr.dev_attr.attr.mode = S_IRUGO; 304 iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
304 iattr->s_attr.dev_attr.show = show_amb_temp; 305 iattr->s_attr.dev_attr.show = show_amb_temp;
305 iattr->s_attr.index = k; 306 iattr->s_attr.index = k;
307 sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
306 res = device_create_file(&pdev->dev, 308 res = device_create_file(&pdev->dev,
307 &iattr->s_attr.dev_attr); 309 &iattr->s_attr.dev_attr);
308 if (res) 310 if (res)
@@ -318,6 +320,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
318 iattr->s_attr.dev_attr.show = show_amb_min; 320 iattr->s_attr.dev_attr.show = show_amb_min;
319 iattr->s_attr.dev_attr.store = store_amb_min; 321 iattr->s_attr.dev_attr.store = store_amb_min;
320 iattr->s_attr.index = k; 322 iattr->s_attr.index = k;
323 sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
321 res = device_create_file(&pdev->dev, 324 res = device_create_file(&pdev->dev,
322 &iattr->s_attr.dev_attr); 325 &iattr->s_attr.dev_attr);
323 if (res) 326 if (res)
@@ -333,6 +336,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
333 iattr->s_attr.dev_attr.show = show_amb_mid; 336 iattr->s_attr.dev_attr.show = show_amb_mid;
334 iattr->s_attr.dev_attr.store = store_amb_mid; 337 iattr->s_attr.dev_attr.store = store_amb_mid;
335 iattr->s_attr.index = k; 338 iattr->s_attr.index = k;
339 sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
336 res = device_create_file(&pdev->dev, 340 res = device_create_file(&pdev->dev,
337 &iattr->s_attr.dev_attr); 341 &iattr->s_attr.dev_attr);
338 if (res) 342 if (res)
@@ -348,6 +352,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
348 iattr->s_attr.dev_attr.show = show_amb_max; 352 iattr->s_attr.dev_attr.show = show_amb_max;
349 iattr->s_attr.dev_attr.store = store_amb_max; 353 iattr->s_attr.dev_attr.store = store_amb_max;
350 iattr->s_attr.index = k; 354 iattr->s_attr.index = k;
355 sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
351 res = device_create_file(&pdev->dev, 356 res = device_create_file(&pdev->dev,
352 &iattr->s_attr.dev_attr); 357 &iattr->s_attr.dev_attr);
353 if (res) 358 if (res)
@@ -362,6 +367,7 @@ static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
362 iattr->s_attr.dev_attr.attr.mode = S_IRUGO; 367 iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
363 iattr->s_attr.dev_attr.show = show_amb_alarm; 368 iattr->s_attr.dev_attr.show = show_amb_alarm;
364 iattr->s_attr.index = k; 369 iattr->s_attr.index = k;
370 sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
365 res = device_create_file(&pdev->dev, 371 res = device_create_file(&pdev->dev,
366 &iattr->s_attr.dev_attr); 372 &iattr->s_attr.dev_attr);
367 if (res) 373 if (res)
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
index 099a2138cdf6..da5a2404cd3e 100644
--- a/drivers/hwmon/k10temp.c
+++ b/drivers/hwmon/k10temp.c
@@ -112,11 +112,21 @@ static bool __devinit has_erratum_319(struct pci_dev *pdev)
112 if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3) 112 if (pkg_type != CPUID_PKGTYPE_AM2R2_AM3)
113 return false; 113 return false;
114 114
115 /* Differentiate between AM2+ (bad) and AM3 (good) */ 115 /* DDR3 memory implies socket AM3, which is good */
116 pci_bus_read_config_dword(pdev->bus, 116 pci_bus_read_config_dword(pdev->bus,
117 PCI_DEVFN(PCI_SLOT(pdev->devfn), 2), 117 PCI_DEVFN(PCI_SLOT(pdev->devfn), 2),
118 REG_DCT0_CONFIG_HIGH, &reg_dram_cfg); 118 REG_DCT0_CONFIG_HIGH, &reg_dram_cfg);
119 return !(reg_dram_cfg & DDR3_MODE); 119 if (reg_dram_cfg & DDR3_MODE)
120 return false;
121
122 /*
123 * Unfortunately it is possible to run a socket AM3 CPU with DDR2
124 * memory. We blacklist all the cores which do exist in socket AM2+
125 * format. It still isn't perfect, as RB-C2 cores exist in both AM2+
126 * and AM3 formats, but that's the best we can do.
127 */
128 return boot_cpu_data.x86_model < 4 ||
129 (boot_cpu_data.x86_model == 4 && boot_cpu_data.x86_mask <= 2);
120} 130}
121 131
122static int __devinit k10temp_probe(struct pci_dev *pdev, 132static int __devinit k10temp_probe(struct pci_dev *pdev,
diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index 0ceb6d6200a3..f26acdb11681 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -120,7 +120,7 @@ static ssize_t show_temp(struct device *dev,
120 int temp; 120 int temp;
121 struct k8temp_data *data = k8temp_update_device(dev); 121 struct k8temp_data *data = k8temp_update_device(dev);
122 122
123 if (data->swap_core_select) 123 if (data->swap_core_select && (data->sensorsp & SEL_CORE))
124 core = core ? 0 : 1; 124 core = core ? 0 : 1;
125 125
126 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset; 126 temp = TEMP_FROM_REG(data->temp[core][place]) + data->temp_offset;
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index d8fa5d724c57..0f9a4785d798 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -69,7 +69,7 @@ config KEYBOARD_ATARI
69 module will be called atakbd. 69 module will be called atakbd.
70 70
71config KEYBOARD_ATKBD 71config KEYBOARD_ATKBD
72 tristate "AT keyboard" if EMBEDDED || !X86 72 tristate "AT keyboard" if EMBEDDED || !X86 || X86_MRST
73 default y 73 default y
74 select SERIO 74 select SERIO
75 select SERIO_LIBPS2 75 select SERIO_LIBPS2
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
index 0ac47d2898ec..4b42ffc0532a 100644
--- a/drivers/input/misc/pcf8574_keypad.c
+++ b/drivers/input/misc/pcf8574_keypad.c
@@ -69,7 +69,7 @@ static irqreturn_t pcf8574_kp_irq_handler(int irq, void *dev_id)
69 unsigned char nextstate = read_state(lp); 69 unsigned char nextstate = read_state(lp);
70 70
71 if (lp->laststate != nextstate) { 71 if (lp->laststate != nextstate) {
72 int key_down = nextstate <= ARRAY_SIZE(lp->btncode); 72 int key_down = nextstate < ARRAY_SIZE(lp->btncode);
73 unsigned short keycode = key_down ? 73 unsigned short keycode = key_down ?
74 lp->btncode[nextstate] : lp->btncode[lp->laststate]; 74 lp->btncode[nextstate] : lp->btncode[lp->laststate];
75 75
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 3bfe8fafc6ad..256b9e9394dc 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -22,7 +22,7 @@ config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \ 24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \
25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN 25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !X86_MRST
26 help 26 help
27 i8042 is the chip over which the standard AT keyboard and PS/2 27 i8042 is the chip over which the standard AT keyboard and PS/2
28 mouse are connected to the computer. If you use these devices, 28 mouse are connected to the computer. If you use these devices,
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index d564af58175c..415f6306105d 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -284,12 +284,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
284 (data[4] << 20) + (data[5] << 12) + 284 (data[4] << 20) + (data[5] << 12) +
285 (data[6] << 4) + (data[7] >> 4); 285 (data[6] << 4) + (data[7] >> 4);
286 286
287 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4); 287 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) |
288 ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12);
288 289
289 switch (wacom->id[idx]) { 290 switch (wacom->id[idx] & 0xfffff) {
290 case 0x812: /* Inking pen */ 291 case 0x812: /* Inking pen */
291 case 0x801: /* Intuos3 Inking pen */ 292 case 0x801: /* Intuos3 Inking pen */
292 case 0x20802: /* Intuos4 Classic Pen */ 293 case 0x20802: /* Intuos4 Inking Pen */
293 case 0x012: 294 case 0x012:
294 wacom->tool[idx] = BTN_TOOL_PENCIL; 295 wacom->tool[idx] = BTN_TOOL_PENCIL;
295 break; 296 break;
@@ -513,7 +514,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
513 input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); 514 input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
514 input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); 515 input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
515 516
516 if ((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) | 517 if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) |
517 data[2] | (data[3] & 0x1f) | data[4] | data[8] | 518 data[2] | (data[3] & 0x1f) | data[4] | data[8] |
518 (data[7] & 0x01)) { 519 (data[7] & 0x01)) {
519 input_report_key(input, wacom->tool[1], 1); 520 input_report_key(input, wacom->tool[1], 1);
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 0d2d7e54b465..5f0221cffef9 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -679,6 +679,13 @@ static int __devinit ad7877_probe(struct spi_device *spi)
679 return -EINVAL; 679 return -EINVAL;
680 } 680 }
681 681
682 spi->bits_per_word = 16;
683 err = spi_setup(spi);
684 if (err) {
685 dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n");
686 return err;
687 }
688
682 ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL); 689 ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL);
683 input_dev = input_allocate_device(); 690 input_dev = input_allocate_device();
684 if (!ts || !input_dev) { 691 if (!ts || !input_dev) {
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c
index c5016bd2d94f..c3b1dc3a13a0 100644
--- a/drivers/isdn/gigaset/asyncdata.c
+++ b/drivers/isdn/gigaset/asyncdata.c
@@ -126,26 +126,6 @@ static unsigned lock_loop(unsigned numbytes, struct inbuf_t *inbuf)
126 return numbytes; 126 return numbytes;
127} 127}
128 128
129/* set up next receive skb for data mode
130 */
131static void new_rcv_skb(struct bc_state *bcs)
132{
133 struct cardstate *cs = bcs->cs;
134 unsigned short hw_hdr_len = cs->hw_hdr_len;
135
136 if (bcs->ignore) {
137 bcs->skb = NULL;
138 return;
139 }
140
141 bcs->skb = dev_alloc_skb(SBUFSIZE + hw_hdr_len);
142 if (bcs->skb == NULL) {
143 dev_warn(cs->dev, "could not allocate new skb\n");
144 return;
145 }
146 skb_reserve(bcs->skb, hw_hdr_len);
147}
148
149/* process a block of received bytes in HDLC data mode 129/* process a block of received bytes in HDLC data mode
150 * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC) 130 * (mstate != MS_LOCKED && !(inputstate & INS_command) && proto2 == L2_HDLC)
151 * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes. 131 * Collect HDLC frames, undoing byte stuffing and watching for DLE escapes.
@@ -159,8 +139,8 @@ static unsigned hdlc_loop(unsigned numbytes, struct inbuf_t *inbuf)
159 struct cardstate *cs = inbuf->cs; 139 struct cardstate *cs = inbuf->cs;
160 struct bc_state *bcs = cs->bcs; 140 struct bc_state *bcs = cs->bcs;
161 int inputstate = bcs->inputstate; 141 int inputstate = bcs->inputstate;
162 __u16 fcs = bcs->fcs; 142 __u16 fcs = bcs->rx_fcs;
163 struct sk_buff *skb = bcs->skb; 143 struct sk_buff *skb = bcs->rx_skb;
164 unsigned char *src = inbuf->data + inbuf->head; 144 unsigned char *src = inbuf->data + inbuf->head;
165 unsigned procbytes = 0; 145 unsigned procbytes = 0;
166 unsigned char c; 146 unsigned char c;
@@ -245,8 +225,7 @@ byte_stuff:
245 225
246 /* prepare reception of next frame */ 226 /* prepare reception of next frame */
247 inputstate &= ~INS_have_data; 227 inputstate &= ~INS_have_data;
248 new_rcv_skb(bcs); 228 skb = gigaset_new_rx_skb(bcs);
249 skb = bcs->skb;
250 } else { 229 } else {
251 /* empty frame (7E 7E) */ 230 /* empty frame (7E 7E) */
252#ifdef CONFIG_GIGASET_DEBUG 231#ifdef CONFIG_GIGASET_DEBUG
@@ -255,8 +234,7 @@ byte_stuff:
255 if (!skb) { 234 if (!skb) {
256 /* skipped (?) */ 235 /* skipped (?) */
257 gigaset_isdn_rcv_err(bcs); 236 gigaset_isdn_rcv_err(bcs);
258 new_rcv_skb(bcs); 237 skb = gigaset_new_rx_skb(bcs);
259 skb = bcs->skb;
260 } 238 }
261 } 239 }
262 240
@@ -279,11 +257,11 @@ byte_stuff:
279#endif 257#endif
280 inputstate |= INS_have_data; 258 inputstate |= INS_have_data;
281 if (skb) { 259 if (skb) {
282 if (skb->len == SBUFSIZE) { 260 if (skb->len >= bcs->rx_bufsize) {
283 dev_warn(cs->dev, "received packet too long\n"); 261 dev_warn(cs->dev, "received packet too long\n");
284 dev_kfree_skb_any(skb); 262 dev_kfree_skb_any(skb);
285 /* skip remainder of packet */ 263 /* skip remainder of packet */
286 bcs->skb = skb = NULL; 264 bcs->rx_skb = skb = NULL;
287 } else { 265 } else {
288 *__skb_put(skb, 1) = c; 266 *__skb_put(skb, 1) = c;
289 fcs = crc_ccitt_byte(fcs, c); 267 fcs = crc_ccitt_byte(fcs, c);
@@ -292,7 +270,7 @@ byte_stuff:
292 } 270 }
293 271
294 bcs->inputstate = inputstate; 272 bcs->inputstate = inputstate;
295 bcs->fcs = fcs; 273 bcs->rx_fcs = fcs;
296 return procbytes; 274 return procbytes;
297} 275}
298 276
@@ -308,18 +286,18 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf)
308 struct cardstate *cs = inbuf->cs; 286 struct cardstate *cs = inbuf->cs;
309 struct bc_state *bcs = cs->bcs; 287 struct bc_state *bcs = cs->bcs;
310 int inputstate = bcs->inputstate; 288 int inputstate = bcs->inputstate;
311 struct sk_buff *skb = bcs->skb; 289 struct sk_buff *skb = bcs->rx_skb;
312 unsigned char *src = inbuf->data + inbuf->head; 290 unsigned char *src = inbuf->data + inbuf->head;
313 unsigned procbytes = 0; 291 unsigned procbytes = 0;
314 unsigned char c; 292 unsigned char c;
315 293
316 if (!skb) { 294 if (!skb) {
317 /* skip this block */ 295 /* skip this block */
318 new_rcv_skb(bcs); 296 gigaset_new_rx_skb(bcs);
319 return numbytes; 297 return numbytes;
320 } 298 }
321 299
322 while (procbytes < numbytes && skb->len < SBUFSIZE) { 300 while (procbytes < numbytes && skb->len < bcs->rx_bufsize) {
323 c = *src++; 301 c = *src++;
324 procbytes++; 302 procbytes++;
325 303
@@ -343,7 +321,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf)
343 if (inputstate & INS_have_data) { 321 if (inputstate & INS_have_data) {
344 gigaset_skb_rcvd(bcs, skb); 322 gigaset_skb_rcvd(bcs, skb);
345 inputstate &= ~INS_have_data; 323 inputstate &= ~INS_have_data;
346 new_rcv_skb(bcs); 324 gigaset_new_rx_skb(bcs);
347 } 325 }
348 326
349 bcs->inputstate = inputstate; 327 bcs->inputstate = inputstate;
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 8f78f15c8ef7..6fbe8999c419 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -70,7 +70,7 @@
70#define MAX_NUMBER_DIGITS 20 70#define MAX_NUMBER_DIGITS 20
71#define MAX_FMT_IE_LEN 20 71#define MAX_FMT_IE_LEN 20
72 72
73/* values for gigaset_capi_appl.connected */ 73/* values for bcs->apconnstate */
74#define APCONN_NONE 0 /* inactive/listening */ 74#define APCONN_NONE 0 /* inactive/listening */
75#define APCONN_SETUP 1 /* connecting */ 75#define APCONN_SETUP 1 /* connecting */
76#define APCONN_ACTIVE 2 /* B channel up */ 76#define APCONN_ACTIVE 2 /* B channel up */
@@ -80,10 +80,10 @@ struct gigaset_capi_appl {
80 struct list_head ctrlist; 80 struct list_head ctrlist;
81 struct gigaset_capi_appl *bcnext; 81 struct gigaset_capi_appl *bcnext;
82 u16 id; 82 u16 id;
83 struct capi_register_params rp;
83 u16 nextMessageNumber; 84 u16 nextMessageNumber;
84 u32 listenInfoMask; 85 u32 listenInfoMask;
85 u32 listenCIPmask; 86 u32 listenCIPmask;
86 int connected;
87}; 87};
88 88
89/* CAPI specific controller data structure */ 89/* CAPI specific controller data structure */
@@ -319,6 +319,39 @@ static const char *format_ie(const char *ie)
319 return result; 319 return result;
320} 320}
321 321
322/*
323 * emit DATA_B3_CONF message
324 */
325static void send_data_b3_conf(struct cardstate *cs, struct capi_ctr *ctr,
326 u16 appl, u16 msgid, int channel,
327 u16 handle, u16 info)
328{
329 struct sk_buff *cskb;
330 u8 *msg;
331
332 cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC);
333 if (!cskb) {
334 dev_err(cs->dev, "%s: out of memory\n", __func__);
335 return;
336 }
337 /* frequent message, avoid _cmsg overhead */
338 msg = __skb_put(cskb, CAPI_DATA_B3_CONF_LEN);
339 CAPIMSG_SETLEN(msg, CAPI_DATA_B3_CONF_LEN);
340 CAPIMSG_SETAPPID(msg, appl);
341 CAPIMSG_SETCOMMAND(msg, CAPI_DATA_B3);
342 CAPIMSG_SETSUBCOMMAND(msg, CAPI_CONF);
343 CAPIMSG_SETMSGID(msg, msgid);
344 CAPIMSG_SETCONTROLLER(msg, ctr->cnr);
345 CAPIMSG_SETPLCI_PART(msg, channel);
346 CAPIMSG_SETNCCI_PART(msg, 1);
347 CAPIMSG_SETHANDLE_CONF(msg, handle);
348 CAPIMSG_SETINFO_CONF(msg, info);
349
350 /* emit message */
351 dump_rawmsg(DEBUG_MCMD, __func__, msg);
352 capi_ctr_handle_message(ctr, appl, cskb);
353}
354
322 355
323/* 356/*
324 * driver interface functions 357 * driver interface functions
@@ -339,7 +372,6 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb)
339 struct gigaset_capi_ctr *iif = cs->iif; 372 struct gigaset_capi_ctr *iif = cs->iif;
340 struct gigaset_capi_appl *ap = bcs->ap; 373 struct gigaset_capi_appl *ap = bcs->ap;
341 unsigned char *req = skb_mac_header(dskb); 374 unsigned char *req = skb_mac_header(dskb);
342 struct sk_buff *cskb;
343 u16 flags; 375 u16 flags;
344 376
345 /* update statistics */ 377 /* update statistics */
@@ -351,39 +383,22 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *dskb)
351 } 383 }
352 384
353 /* don't send further B3 messages if disconnected */ 385 /* don't send further B3 messages if disconnected */
354 if (ap->connected < APCONN_ACTIVE) { 386 if (bcs->apconnstate < APCONN_ACTIVE) {
355 gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack"); 387 gig_dbg(DEBUG_LLDATA, "disconnected, discarding ack");
356 return; 388 return;
357 } 389 }
358 390
359 /* ToDo: honor unset "delivery confirmation" bit */ 391 /*
392 * send DATA_B3_CONF if "delivery confirmation" bit was set in request;
393 * otherwise it has already been sent by do_data_b3_req()
394 */
360 flags = CAPIMSG_FLAGS(req); 395 flags = CAPIMSG_FLAGS(req);
361 396 if (flags & CAPI_FLAGS_DELIVERY_CONFIRMATION)
362 /* build DATA_B3_CONF message */ 397 send_data_b3_conf(cs, &iif->ctr, ap->id, CAPIMSG_MSGID(req),
363 cskb = alloc_skb(CAPI_DATA_B3_CONF_LEN, GFP_ATOMIC); 398 bcs->channel + 1, CAPIMSG_HANDLE_REQ(req),
364 if (!cskb) { 399 (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION) ?
365 dev_err(cs->dev, "%s: out of memory\n", __func__); 400 CapiFlagsNotSupportedByProtocol :
366 return; 401 CAPI_NOERROR);
367 }
368 /* frequent message, avoid _cmsg overhead */
369 CAPIMSG_SETLEN(cskb->data, CAPI_DATA_B3_CONF_LEN);
370 CAPIMSG_SETAPPID(cskb->data, ap->id);
371 CAPIMSG_SETCOMMAND(cskb->data, CAPI_DATA_B3);
372 CAPIMSG_SETSUBCOMMAND(cskb->data, CAPI_CONF);
373 CAPIMSG_SETMSGID(cskb->data, CAPIMSG_MSGID(req));
374 CAPIMSG_SETCONTROLLER(cskb->data, iif->ctr.cnr);
375 CAPIMSG_SETPLCI_PART(cskb->data, bcs->channel + 1);
376 CAPIMSG_SETNCCI_PART(cskb->data, 1);
377 CAPIMSG_SETHANDLE_CONF(cskb->data, CAPIMSG_HANDLE_REQ(req));
378 if (flags & ~CAPI_FLAGS_DELIVERY_CONFIRMATION)
379 CAPIMSG_SETINFO_CONF(cskb->data,
380 CapiFlagsNotSupportedByProtocol);
381 else
382 CAPIMSG_SETINFO_CONF(cskb->data, CAPI_NOERROR);
383
384 /* emit message */
385 dump_rawmsg(DEBUG_LLDATA, "DATA_B3_CONF", cskb->data);
386 capi_ctr_handle_message(&iif->ctr, ap->id, cskb);
387} 402}
388EXPORT_SYMBOL_GPL(gigaset_skb_sent); 403EXPORT_SYMBOL_GPL(gigaset_skb_sent);
389 404
@@ -412,7 +427,7 @@ void gigaset_skb_rcvd(struct bc_state *bcs, struct sk_buff *skb)
412 } 427 }
413 428
414 /* don't send further B3 messages if disconnected */ 429 /* don't send further B3 messages if disconnected */
415 if (ap->connected < APCONN_ACTIVE) { 430 if (bcs->apconnstate < APCONN_ACTIVE) {
416 gig_dbg(DEBUG_LLDATA, "disconnected, discarding data"); 431 gig_dbg(DEBUG_LLDATA, "disconnected, discarding data");
417 dev_kfree_skb_any(skb); 432 dev_kfree_skb_any(skb);
418 return; 433 return;
@@ -484,6 +499,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
484 u32 actCIPmask; 499 u32 actCIPmask;
485 struct sk_buff *skb; 500 struct sk_buff *skb;
486 unsigned int msgsize; 501 unsigned int msgsize;
502 unsigned long flags;
487 int i; 503 int i;
488 504
489 /* 505 /*
@@ -608,7 +624,14 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
608 format_ie(iif->hcmsg.CalledPartyNumber)); 624 format_ie(iif->hcmsg.CalledPartyNumber));
609 625
610 /* scan application list for matching listeners */ 626 /* scan application list for matching listeners */
611 bcs->ap = NULL; 627 spin_lock_irqsave(&bcs->aplock, flags);
628 if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE) {
629 dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n",
630 __func__, bcs->ap, bcs->apconnstate);
631 bcs->ap = NULL;
632 bcs->apconnstate = APCONN_NONE;
633 }
634 spin_unlock_irqrestore(&bcs->aplock, flags);
612 actCIPmask = 1 | (1 << iif->hcmsg.CIPValue); 635 actCIPmask = 1 | (1 << iif->hcmsg.CIPValue);
613 list_for_each_entry(ap, &iif->appls, ctrlist) 636 list_for_each_entry(ap, &iif->appls, ctrlist)
614 if (actCIPmask & ap->listenCIPmask) { 637 if (actCIPmask & ap->listenCIPmask) {
@@ -626,10 +649,12 @@ int gigaset_isdn_icall(struct at_state_t *at_state)
626 dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); 649 dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg);
627 650
628 /* add to listeners on this B channel, update state */ 651 /* add to listeners on this B channel, update state */
652 spin_lock_irqsave(&bcs->aplock, flags);
629 ap->bcnext = bcs->ap; 653 ap->bcnext = bcs->ap;
630 bcs->ap = ap; 654 bcs->ap = ap;
631 bcs->chstate |= CHS_NOTIFY_LL; 655 bcs->chstate |= CHS_NOTIFY_LL;
632 ap->connected = APCONN_SETUP; 656 bcs->apconnstate = APCONN_SETUP;
657 spin_unlock_irqrestore(&bcs->aplock, flags);
633 658
634 /* emit message */ 659 /* emit message */
635 capi_ctr_handle_message(&iif->ctr, ap->id, skb); 660 capi_ctr_handle_message(&iif->ctr, ap->id, skb);
@@ -654,7 +679,7 @@ static void send_disconnect_ind(struct bc_state *bcs,
654 struct gigaset_capi_ctr *iif = cs->iif; 679 struct gigaset_capi_ctr *iif = cs->iif;
655 struct sk_buff *skb; 680 struct sk_buff *skb;
656 681
657 if (ap->connected == APCONN_NONE) 682 if (bcs->apconnstate == APCONN_NONE)
658 return; 683 return;
659 684
660 capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND, 685 capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT, CAPI_IND,
@@ -668,7 +693,6 @@ static void send_disconnect_ind(struct bc_state *bcs,
668 } 693 }
669 capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN)); 694 capi_cmsg2message(&iif->hcmsg, __skb_put(skb, CAPI_DISCONNECT_IND_LEN));
670 dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); 695 dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg);
671 ap->connected = APCONN_NONE;
672 capi_ctr_handle_message(&iif->ctr, ap->id, skb); 696 capi_ctr_handle_message(&iif->ctr, ap->id, skb);
673} 697}
674 698
@@ -685,9 +709,9 @@ static void send_disconnect_b3_ind(struct bc_state *bcs,
685 struct sk_buff *skb; 709 struct sk_buff *skb;
686 710
687 /* nothing to do if no logical connection active */ 711 /* nothing to do if no logical connection active */
688 if (ap->connected < APCONN_ACTIVE) 712 if (bcs->apconnstate < APCONN_ACTIVE)
689 return; 713 return;
690 ap->connected = APCONN_SETUP; 714 bcs->apconnstate = APCONN_SETUP;
691 715
692 capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND, 716 capi_cmsg_header(&iif->hcmsg, ap->id, CAPI_DISCONNECT_B3, CAPI_IND,
693 ap->nextMessageNumber++, 717 ap->nextMessageNumber++,
@@ -714,14 +738,25 @@ void gigaset_isdn_connD(struct bc_state *bcs)
714{ 738{
715 struct cardstate *cs = bcs->cs; 739 struct cardstate *cs = bcs->cs;
716 struct gigaset_capi_ctr *iif = cs->iif; 740 struct gigaset_capi_ctr *iif = cs->iif;
717 struct gigaset_capi_appl *ap = bcs->ap; 741 struct gigaset_capi_appl *ap;
718 struct sk_buff *skb; 742 struct sk_buff *skb;
719 unsigned int msgsize; 743 unsigned int msgsize;
744 unsigned long flags;
720 745
746 spin_lock_irqsave(&bcs->aplock, flags);
747 ap = bcs->ap;
721 if (!ap) { 748 if (!ap) {
749 spin_unlock_irqrestore(&bcs->aplock, flags);
722 dev_err(cs->dev, "%s: no application\n", __func__); 750 dev_err(cs->dev, "%s: no application\n", __func__);
723 return; 751 return;
724 } 752 }
753 if (bcs->apconnstate == APCONN_NONE) {
754 spin_unlock_irqrestore(&bcs->aplock, flags);
755 dev_warn(cs->dev, "%s: application %u not connected\n",
756 __func__, ap->id);
757 return;
758 }
759 spin_unlock_irqrestore(&bcs->aplock, flags);
725 while (ap->bcnext) { 760 while (ap->bcnext) {
726 /* this should never happen */ 761 /* this should never happen */
727 dev_warn(cs->dev, "%s: dropping extra application %u\n", 762 dev_warn(cs->dev, "%s: dropping extra application %u\n",
@@ -730,11 +765,6 @@ void gigaset_isdn_connD(struct bc_state *bcs)
730 CapiCallGivenToOtherApplication); 765 CapiCallGivenToOtherApplication);
731 ap->bcnext = ap->bcnext->bcnext; 766 ap->bcnext = ap->bcnext->bcnext;
732 } 767 }
733 if (ap->connected == APCONN_NONE) {
734 dev_warn(cs->dev, "%s: application %u not connected\n",
735 __func__, ap->id);
736 return;
737 }
738 768
739 /* prepare CONNECT_ACTIVE_IND message 769 /* prepare CONNECT_ACTIVE_IND message
740 * Note: LLC not supported by device 770 * Note: LLC not supported by device
@@ -772,17 +802,24 @@ void gigaset_isdn_connD(struct bc_state *bcs)
772void gigaset_isdn_hupD(struct bc_state *bcs) 802void gigaset_isdn_hupD(struct bc_state *bcs)
773{ 803{
774 struct gigaset_capi_appl *ap; 804 struct gigaset_capi_appl *ap;
805 unsigned long flags;
775 806
776 /* 807 /*
777 * ToDo: pass on reason code reported by device 808 * ToDo: pass on reason code reported by device
778 * (requires ev-layer state machine extension to collect 809 * (requires ev-layer state machine extension to collect
779 * ZCAU device reply) 810 * ZCAU device reply)
780 */ 811 */
781 for (ap = bcs->ap; ap != NULL; ap = ap->bcnext) { 812 spin_lock_irqsave(&bcs->aplock, flags);
813 while (bcs->ap != NULL) {
814 ap = bcs->ap;
815 bcs->ap = ap->bcnext;
816 spin_unlock_irqrestore(&bcs->aplock, flags);
782 send_disconnect_b3_ind(bcs, ap); 817 send_disconnect_b3_ind(bcs, ap);
783 send_disconnect_ind(bcs, ap, 0); 818 send_disconnect_ind(bcs, ap, 0);
819 spin_lock_irqsave(&bcs->aplock, flags);
784 } 820 }
785 bcs->ap = NULL; 821 bcs->apconnstate = APCONN_NONE;
822 spin_unlock_irqrestore(&bcs->aplock, flags);
786} 823}
787 824
788/** 825/**
@@ -796,24 +833,21 @@ void gigaset_isdn_connB(struct bc_state *bcs)
796{ 833{
797 struct cardstate *cs = bcs->cs; 834 struct cardstate *cs = bcs->cs;
798 struct gigaset_capi_ctr *iif = cs->iif; 835 struct gigaset_capi_ctr *iif = cs->iif;
799 struct gigaset_capi_appl *ap = bcs->ap; 836 struct gigaset_capi_appl *ap;
800 struct sk_buff *skb; 837 struct sk_buff *skb;
838 unsigned long flags;
801 unsigned int msgsize; 839 unsigned int msgsize;
802 u8 command; 840 u8 command;
803 841
842 spin_lock_irqsave(&bcs->aplock, flags);
843 ap = bcs->ap;
804 if (!ap) { 844 if (!ap) {
845 spin_unlock_irqrestore(&bcs->aplock, flags);
805 dev_err(cs->dev, "%s: no application\n", __func__); 846 dev_err(cs->dev, "%s: no application\n", __func__);
806 return; 847 return;
807 } 848 }
808 while (ap->bcnext) { 849 if (!bcs->apconnstate) {
809 /* this should never happen */ 850 spin_unlock_irqrestore(&bcs->aplock, flags);
810 dev_warn(cs->dev, "%s: dropping extra application %u\n",
811 __func__, ap->bcnext->id);
812 send_disconnect_ind(bcs, ap->bcnext,
813 CapiCallGivenToOtherApplication);
814 ap->bcnext = ap->bcnext->bcnext;
815 }
816 if (!ap->connected) {
817 dev_warn(cs->dev, "%s: application %u not connected\n", 851 dev_warn(cs->dev, "%s: application %u not connected\n",
818 __func__, ap->id); 852 __func__, ap->id);
819 return; 853 return;
@@ -825,13 +859,26 @@ void gigaset_isdn_connB(struct bc_state *bcs)
825 * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP 859 * CONNECT_B3_ACTIVE_IND in reply to CONNECT_B3_RESP
826 * Parameters in both cases always: NCCI = 1, NCPI empty 860 * Parameters in both cases always: NCCI = 1, NCPI empty
827 */ 861 */
828 if (ap->connected >= APCONN_ACTIVE) { 862 if (bcs->apconnstate >= APCONN_ACTIVE) {
829 command = CAPI_CONNECT_B3_ACTIVE; 863 command = CAPI_CONNECT_B3_ACTIVE;
830 msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN; 864 msgsize = CAPI_CONNECT_B3_ACTIVE_IND_BASELEN;
831 } else { 865 } else {
832 command = CAPI_CONNECT_B3; 866 command = CAPI_CONNECT_B3;
833 msgsize = CAPI_CONNECT_B3_IND_BASELEN; 867 msgsize = CAPI_CONNECT_B3_IND_BASELEN;
834 } 868 }
869 bcs->apconnstate = APCONN_ACTIVE;
870
871 spin_unlock_irqrestore(&bcs->aplock, flags);
872
873 while (ap->bcnext) {
874 /* this should never happen */
875 dev_warn(cs->dev, "%s: dropping extra application %u\n",
876 __func__, ap->bcnext->id);
877 send_disconnect_ind(bcs, ap->bcnext,
878 CapiCallGivenToOtherApplication);
879 ap->bcnext = ap->bcnext->bcnext;
880 }
881
835 capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND, 882 capi_cmsg_header(&iif->hcmsg, ap->id, command, CAPI_IND,
836 ap->nextMessageNumber++, 883 ap->nextMessageNumber++,
837 iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16)); 884 iif->ctr.cnr | ((bcs->channel + 1) << 8) | (1 << 16));
@@ -842,7 +889,6 @@ void gigaset_isdn_connB(struct bc_state *bcs)
842 } 889 }
843 capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize)); 890 capi_cmsg2message(&iif->hcmsg, __skb_put(skb, msgsize));
844 dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg); 891 dump_cmsg(DEBUG_CMD, __func__, &iif->hcmsg);
845 ap->connected = APCONN_ACTIVE;
846 capi_ctr_handle_message(&iif->ctr, ap->id, skb); 892 capi_ctr_handle_message(&iif->ctr, ap->id, skb);
847} 893}
848 894
@@ -945,8 +991,64 @@ static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl,
945 return; 991 return;
946 } 992 }
947 ap->id = appl; 993 ap->id = appl;
994 ap->rp = *rp;
948 995
949 list_add(&ap->ctrlist, &iif->appls); 996 list_add(&ap->ctrlist, &iif->appls);
997 dev_info(cs->dev, "application %u registered\n", ap->id);
998}
999
1000/*
1001 * remove CAPI application from channel
1002 * helper function to keep indentation levels down and stay in 80 columns
1003 */
1004
1005static inline void remove_appl_from_channel(struct bc_state *bcs,
1006 struct gigaset_capi_appl *ap)
1007{
1008 struct cardstate *cs = bcs->cs;
1009 struct gigaset_capi_appl *bcap;
1010 unsigned long flags;
1011 int prevconnstate;
1012
1013 spin_lock_irqsave(&bcs->aplock, flags);
1014 bcap = bcs->ap;
1015 if (bcap == NULL) {
1016 spin_unlock_irqrestore(&bcs->aplock, flags);
1017 return;
1018 }
1019
1020 /* check first application on channel */
1021 if (bcap == ap) {
1022 bcs->ap = ap->bcnext;
1023 if (bcs->ap != NULL) {
1024 spin_unlock_irqrestore(&bcs->aplock, flags);
1025 return;
1026 }
1027
1028 /* none left, clear channel state */
1029 prevconnstate = bcs->apconnstate;
1030 bcs->apconnstate = APCONN_NONE;
1031 spin_unlock_irqrestore(&bcs->aplock, flags);
1032
1033 if (prevconnstate == APCONN_ACTIVE) {
1034 dev_notice(cs->dev, "%s: hanging up channel %u\n",
1035 __func__, bcs->channel);
1036 gigaset_add_event(cs, &bcs->at_state,
1037 EV_HUP, NULL, 0, NULL);
1038 gigaset_schedule_event(cs);
1039 }
1040 return;
1041 }
1042
1043 /* check remaining list */
1044 do {
1045 if (bcap->bcnext == ap) {
1046 bcap->bcnext = bcap->bcnext->bcnext;
1047 return;
1048 }
1049 bcap = bcap->bcnext;
1050 } while (bcap != NULL);
1051 spin_unlock_irqrestore(&bcs->aplock, flags);
950} 1052}
951 1053
952/* 1054/*
@@ -958,19 +1060,19 @@ static void gigaset_release_appl(struct capi_ctr *ctr, u16 appl)
958 = container_of(ctr, struct gigaset_capi_ctr, ctr); 1060 = container_of(ctr, struct gigaset_capi_ctr, ctr);
959 struct cardstate *cs = iif->ctr.driverdata; 1061 struct cardstate *cs = iif->ctr.driverdata;
960 struct gigaset_capi_appl *ap, *tmp; 1062 struct gigaset_capi_appl *ap, *tmp;
1063 unsigned ch;
961 1064
962 list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist) 1065 list_for_each_entry_safe(ap, tmp, &iif->appls, ctrlist)
963 if (ap->id == appl) { 1066 if (ap->id == appl) {
964 if (ap->connected != APCONN_NONE) { 1067 /* remove from any channels */
965 dev_err(cs->dev, 1068 for (ch = 0; ch < cs->channels; ch++)
966 "%s: application %u still connected\n", 1069 remove_appl_from_channel(&cs->bcs[ch], ap);
967 __func__, ap->id); 1070
968 /* ToDo: clear active connection */ 1071 /* remove from registration list */
969 }
970 list_del(&ap->ctrlist); 1072 list_del(&ap->ctrlist);
971 kfree(ap); 1073 kfree(ap);
1074 dev_info(cs->dev, "application %u released\n", appl);
972 } 1075 }
973
974} 1076}
975 1077
976/* 1078/*
@@ -1149,7 +1251,8 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
1149 char **commands; 1251 char **commands;
1150 char *s; 1252 char *s;
1151 u8 *pp; 1253 u8 *pp;
1152 int i, l; 1254 unsigned long flags;
1255 int i, l, lbc, lhlc;
1153 u16 info; 1256 u16 info;
1154 1257
1155 /* decode message */ 1258 /* decode message */
@@ -1164,8 +1267,18 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
1164 send_conf(iif, ap, skb, CapiNoPlciAvailable); 1267 send_conf(iif, ap, skb, CapiNoPlciAvailable);
1165 return; 1268 return;
1166 } 1269 }
1270 spin_lock_irqsave(&bcs->aplock, flags);
1271 if (bcs->ap != NULL || bcs->apconnstate != APCONN_NONE)
1272 dev_warn(cs->dev, "%s: channel not properly cleared (%p/%d)\n",
1273 __func__, bcs->ap, bcs->apconnstate);
1167 ap->bcnext = NULL; 1274 ap->bcnext = NULL;
1168 bcs->ap = ap; 1275 bcs->ap = ap;
1276 bcs->apconnstate = APCONN_SETUP;
1277 spin_unlock_irqrestore(&bcs->aplock, flags);
1278
1279 bcs->rx_bufsize = ap->rp.datablklen;
1280 dev_kfree_skb(bcs->rx_skb);
1281 gigaset_new_rx_skb(bcs);
1169 cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; 1282 cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8;
1170 1283
1171 /* build command table */ 1284 /* build command table */
@@ -1273,42 +1386,59 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
1273 goto error; 1386 goto error;
1274 } 1387 }
1275 1388
1276 /* check/encode parameter: BC */ 1389 /*
1277 if (cmsg->BC && cmsg->BC[0]) { 1390 * check/encode parameters: BC & HLC
1278 /* explicit BC overrides CIP */ 1391 * must be encoded together as device doesn't accept HLC separately
1279 l = 2*cmsg->BC[0] + 7; 1392 * explicit parameters override values derived from CIP
1393 */
1394
1395 /* determine lengths */
1396 if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */
1397 lbc = 2*cmsg->BC[0];
1398 else if (cip2bchlc[cmsg->CIPValue].bc) /* BC derived from CIP */
1399 lbc = strlen(cip2bchlc[cmsg->CIPValue].bc);
1400 else /* no BC */
1401 lbc = 0;
1402 if (cmsg->HLC && cmsg->HLC[0]) /* HLC specified explicitly */
1403 lhlc = 2*cmsg->HLC[0];
1404 else if (cip2bchlc[cmsg->CIPValue].hlc) /* HLC derived from CIP */
1405 lhlc = strlen(cip2bchlc[cmsg->CIPValue].hlc);
1406 else /* no HLC */
1407 lhlc = 0;
1408
1409 if (lbc) {
1410 /* have BC: allocate and assemble command string */
1411 l = lbc + 7; /* "^SBC=" + value + "\r" + null byte */
1412 if (lhlc)
1413 l += lhlc + 7; /* ";^SHLC=" + value */
1280 commands[AT_BC] = kmalloc(l, GFP_KERNEL); 1414 commands[AT_BC] = kmalloc(l, GFP_KERNEL);
1281 if (!commands[AT_BC]) 1415 if (!commands[AT_BC])
1282 goto oom; 1416 goto oom;
1283 strcpy(commands[AT_BC], "^SBC="); 1417 strcpy(commands[AT_BC], "^SBC=");
1284 decode_ie(cmsg->BC, commands[AT_BC]+5); 1418 if (cmsg->BC && cmsg->BC[0]) /* BC specified explicitly */
1419 decode_ie(cmsg->BC, commands[AT_BC] + 5);
1420 else /* BC derived from CIP */
1421 strcpy(commands[AT_BC] + 5,
1422 cip2bchlc[cmsg->CIPValue].bc);
1423 if (lhlc) {
1424 strcpy(commands[AT_BC] + lbc + 5, ";^SHLC=");
1425 if (cmsg->HLC && cmsg->HLC[0])
1426 /* HLC specified explicitly */
1427 decode_ie(cmsg->HLC,
1428 commands[AT_BC] + lbc + 12);
1429 else /* HLC derived from CIP */
1430 strcpy(commands[AT_BC] + lbc + 12,
1431 cip2bchlc[cmsg->CIPValue].hlc);
1432 }
1285 strcpy(commands[AT_BC] + l - 2, "\r"); 1433 strcpy(commands[AT_BC] + l - 2, "\r");
1286 } else if (cip2bchlc[cmsg->CIPValue].bc) { 1434 } else {
1287 l = strlen(cip2bchlc[cmsg->CIPValue].bc) + 7; 1435 /* no BC */
1288 commands[AT_BC] = kmalloc(l, GFP_KERNEL); 1436 if (lhlc) {
1289 if (!commands[AT_BC]) 1437 dev_notice(cs->dev, "%s: cannot set HLC without BC\n",
1290 goto oom; 1438 "CONNECT_REQ");
1291 snprintf(commands[AT_BC], l, "^SBC=%s\r", 1439 info = CapiIllMessageParmCoding; /* ? */
1292 cip2bchlc[cmsg->CIPValue].bc); 1440 goto error;
1293 } 1441 }
1294
1295 /* check/encode parameter: HLC */
1296 if (cmsg->HLC && cmsg->HLC[0]) {
1297 /* explicit HLC overrides CIP */
1298 l = 2*cmsg->HLC[0] + 7;
1299 commands[AT_HLC] = kmalloc(l, GFP_KERNEL);
1300 if (!commands[AT_HLC])
1301 goto oom;
1302 strcpy(commands[AT_HLC], "^SHLC=");
1303 decode_ie(cmsg->HLC, commands[AT_HLC]+5);
1304 strcpy(commands[AT_HLC] + l - 2, "\r");
1305 } else if (cip2bchlc[cmsg->CIPValue].hlc) {
1306 l = strlen(cip2bchlc[cmsg->CIPValue].hlc) + 7;
1307 commands[AT_HLC] = kmalloc(l, GFP_KERNEL);
1308 if (!commands[AT_HLC])
1309 goto oom;
1310 snprintf(commands[AT_HLC], l, "^SHLC=%s\r",
1311 cip2bchlc[cmsg->CIPValue].hlc);
1312 } 1442 }
1313 1443
1314 /* check/encode parameter: B Protocol */ 1444 /* check/encode parameter: B Protocol */
@@ -1322,13 +1452,13 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
1322 bcs->proto2 = L2_HDLC; 1452 bcs->proto2 = L2_HDLC;
1323 break; 1453 break;
1324 case 1: 1454 case 1:
1325 bcs->proto2 = L2_BITSYNC; 1455 bcs->proto2 = L2_VOICE;
1326 break; 1456 break;
1327 default: 1457 default:
1328 dev_warn(cs->dev, 1458 dev_warn(cs->dev,
1329 "B1 Protocol %u unsupported, using Transparent\n", 1459 "B1 Protocol %u unsupported, using Transparent\n",
1330 cmsg->B1protocol); 1460 cmsg->B1protocol);
1331 bcs->proto2 = L2_BITSYNC; 1461 bcs->proto2 = L2_VOICE;
1332 } 1462 }
1333 if (cmsg->B2protocol != 1) 1463 if (cmsg->B2protocol != 1)
1334 dev_warn(cs->dev, 1464 dev_warn(cs->dev,
@@ -1382,7 +1512,6 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
1382 goto error; 1512 goto error;
1383 } 1513 }
1384 gigaset_schedule_event(cs); 1514 gigaset_schedule_event(cs);
1385 ap->connected = APCONN_SETUP;
1386 send_conf(iif, ap, skb, CapiSuccess); 1515 send_conf(iif, ap, skb, CapiSuccess);
1387 return; 1516 return;
1388 1517
@@ -1410,6 +1539,7 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
1410 _cmsg *cmsg = &iif->acmsg; 1539 _cmsg *cmsg = &iif->acmsg;
1411 struct bc_state *bcs; 1540 struct bc_state *bcs;
1412 struct gigaset_capi_appl *oap; 1541 struct gigaset_capi_appl *oap;
1542 unsigned long flags;
1413 int channel; 1543 int channel;
1414 1544
1415 /* decode message */ 1545 /* decode message */
@@ -1429,12 +1559,24 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
1429 switch (cmsg->Reject) { 1559 switch (cmsg->Reject) {
1430 case 0: /* Accept */ 1560 case 0: /* Accept */
1431 /* drop all competing applications, keep only this one */ 1561 /* drop all competing applications, keep only this one */
1432 for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) 1562 spin_lock_irqsave(&bcs->aplock, flags);
1433 if (oap != ap) 1563 while (bcs->ap != NULL) {
1564 oap = bcs->ap;
1565 bcs->ap = oap->bcnext;
1566 if (oap != ap) {
1567 spin_unlock_irqrestore(&bcs->aplock, flags);
1434 send_disconnect_ind(bcs, oap, 1568 send_disconnect_ind(bcs, oap,
1435 CapiCallGivenToOtherApplication); 1569 CapiCallGivenToOtherApplication);
1570 spin_lock_irqsave(&bcs->aplock, flags);
1571 }
1572 }
1436 ap->bcnext = NULL; 1573 ap->bcnext = NULL;
1437 bcs->ap = ap; 1574 bcs->ap = ap;
1575 spin_unlock_irqrestore(&bcs->aplock, flags);
1576
1577 bcs->rx_bufsize = ap->rp.datablklen;
1578 dev_kfree_skb(bcs->rx_skb);
1579 gigaset_new_rx_skb(bcs);
1438 bcs->chstate |= CHS_NOTIFY_LL; 1580 bcs->chstate |= CHS_NOTIFY_LL;
1439 1581
1440 /* check/encode B channel protocol */ 1582 /* check/encode B channel protocol */
@@ -1448,13 +1590,13 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
1448 bcs->proto2 = L2_HDLC; 1590 bcs->proto2 = L2_HDLC;
1449 break; 1591 break;
1450 case 1: 1592 case 1:
1451 bcs->proto2 = L2_BITSYNC; 1593 bcs->proto2 = L2_VOICE;
1452 break; 1594 break;
1453 default: 1595 default:
1454 dev_warn(cs->dev, 1596 dev_warn(cs->dev,
1455 "B1 Protocol %u unsupported, using Transparent\n", 1597 "B1 Protocol %u unsupported, using Transparent\n",
1456 cmsg->B1protocol); 1598 cmsg->B1protocol);
1457 bcs->proto2 = L2_BITSYNC; 1599 bcs->proto2 = L2_VOICE;
1458 } 1600 }
1459 if (cmsg->B2protocol != 1) 1601 if (cmsg->B2protocol != 1)
1460 dev_warn(cs->dev, 1602 dev_warn(cs->dev,
@@ -1502,31 +1644,45 @@ static void do_connect_resp(struct gigaset_capi_ctr *iif,
1502 send_disconnect_ind(bcs, ap, 0); 1644 send_disconnect_ind(bcs, ap, 0);
1503 1645
1504 /* remove it from the list of listening apps */ 1646 /* remove it from the list of listening apps */
1647 spin_lock_irqsave(&bcs->aplock, flags);
1505 if (bcs->ap == ap) { 1648 if (bcs->ap == ap) {
1506 bcs->ap = ap->bcnext; 1649 bcs->ap = ap->bcnext;
1507 if (bcs->ap == NULL) 1650 if (bcs->ap == NULL) {
1508 /* last one: stop ev-layer hupD notifications */ 1651 /* last one: stop ev-layer hupD notifications */
1652 bcs->apconnstate = APCONN_NONE;
1509 bcs->chstate &= ~CHS_NOTIFY_LL; 1653 bcs->chstate &= ~CHS_NOTIFY_LL;
1654 }
1655 spin_unlock_irqrestore(&bcs->aplock, flags);
1510 return; 1656 return;
1511 } 1657 }
1512 for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) { 1658 for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) {
1513 if (oap->bcnext == ap) { 1659 if (oap->bcnext == ap) {
1514 oap->bcnext = oap->bcnext->bcnext; 1660 oap->bcnext = oap->bcnext->bcnext;
1661 spin_unlock_irqrestore(&bcs->aplock, flags);
1515 return; 1662 return;
1516 } 1663 }
1517 } 1664 }
1665 spin_unlock_irqrestore(&bcs->aplock, flags);
1518 dev_err(cs->dev, "%s: application %u not found\n", 1666 dev_err(cs->dev, "%s: application %u not found\n",
1519 __func__, ap->id); 1667 __func__, ap->id);
1520 return; 1668 return;
1521 1669
1522 default: /* Reject */ 1670 default: /* Reject */
1523 /* drop all competing applications, keep only this one */ 1671 /* drop all competing applications, keep only this one */
1524 for (oap = bcs->ap; oap != NULL; oap = oap->bcnext) 1672 spin_lock_irqsave(&bcs->aplock, flags);
1525 if (oap != ap) 1673 while (bcs->ap != NULL) {
1674 oap = bcs->ap;
1675 bcs->ap = oap->bcnext;
1676 if (oap != ap) {
1677 spin_unlock_irqrestore(&bcs->aplock, flags);
1526 send_disconnect_ind(bcs, oap, 1678 send_disconnect_ind(bcs, oap,
1527 CapiCallGivenToOtherApplication); 1679 CapiCallGivenToOtherApplication);
1680 spin_lock_irqsave(&bcs->aplock, flags);
1681 }
1682 }
1528 ap->bcnext = NULL; 1683 ap->bcnext = NULL;
1529 bcs->ap = ap; 1684 bcs->ap = ap;
1685 spin_unlock_irqrestore(&bcs->aplock, flags);
1530 1686
1531 /* reject call - will trigger DISCONNECT_IND for this app */ 1687 /* reject call - will trigger DISCONNECT_IND for this app */
1532 dev_info(cs->dev, "%s: Reject=%x\n", 1688 dev_info(cs->dev, "%s: Reject=%x\n",
@@ -1549,6 +1705,7 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif,
1549{ 1705{
1550 struct cardstate *cs = iif->ctr.driverdata; 1706 struct cardstate *cs = iif->ctr.driverdata;
1551 _cmsg *cmsg = &iif->acmsg; 1707 _cmsg *cmsg = &iif->acmsg;
1708 struct bc_state *bcs;
1552 int channel; 1709 int channel;
1553 1710
1554 /* decode message */ 1711 /* decode message */
@@ -1563,9 +1720,10 @@ static void do_connect_b3_req(struct gigaset_capi_ctr *iif,
1563 send_conf(iif, ap, skb, CapiIllContrPlciNcci); 1720 send_conf(iif, ap, skb, CapiIllContrPlciNcci);
1564 return; 1721 return;
1565 } 1722 }
1723 bcs = &cs->bcs[channel-1];
1566 1724
1567 /* mark logical connection active */ 1725 /* mark logical connection active */
1568 ap->connected = APCONN_ACTIVE; 1726 bcs->apconnstate = APCONN_ACTIVE;
1569 1727
1570 /* build NCCI: always 1 (one B3 connection only) */ 1728 /* build NCCI: always 1 (one B3 connection only) */
1571 cmsg->adr.adrNCCI |= 1 << 16; 1729 cmsg->adr.adrNCCI |= 1 << 16;
@@ -1611,7 +1769,7 @@ static void do_connect_b3_resp(struct gigaset_capi_ctr *iif,
1611 1769
1612 if (cmsg->Reject) { 1770 if (cmsg->Reject) {
1613 /* Reject: clear B3 connect received flag */ 1771 /* Reject: clear B3 connect received flag */
1614 ap->connected = APCONN_SETUP; 1772 bcs->apconnstate = APCONN_SETUP;
1615 1773
1616 /* trigger hangup, causing eventual DISCONNECT_IND */ 1774 /* trigger hangup, causing eventual DISCONNECT_IND */
1617 if (!gigaset_add_event(cs, &bcs->at_state, 1775 if (!gigaset_add_event(cs, &bcs->at_state,
@@ -1683,11 +1841,11 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
1683 } 1841 }
1684 1842
1685 /* skip if DISCONNECT_IND already sent */ 1843 /* skip if DISCONNECT_IND already sent */
1686 if (!ap->connected) 1844 if (!bcs->apconnstate)
1687 return; 1845 return;
1688 1846
1689 /* check for active logical connection */ 1847 /* check for active logical connection */
1690 if (ap->connected >= APCONN_ACTIVE) { 1848 if (bcs->apconnstate >= APCONN_ACTIVE) {
1691 /* 1849 /*
1692 * emit DISCONNECT_B3_IND with cause 0x3301 1850 * emit DISCONNECT_B3_IND with cause 0x3301
1693 * use separate cmsg structure, as the content of iif->acmsg 1851 * use separate cmsg structure, as the content of iif->acmsg
@@ -1736,6 +1894,7 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif,
1736{ 1894{
1737 struct cardstate *cs = iif->ctr.driverdata; 1895 struct cardstate *cs = iif->ctr.driverdata;
1738 _cmsg *cmsg = &iif->acmsg; 1896 _cmsg *cmsg = &iif->acmsg;
1897 struct bc_state *bcs;
1739 int channel; 1898 int channel;
1740 1899
1741 /* decode message */ 1900 /* decode message */
@@ -1751,17 +1910,17 @@ static void do_disconnect_b3_req(struct gigaset_capi_ctr *iif,
1751 send_conf(iif, ap, skb, CapiIllContrPlciNcci); 1910 send_conf(iif, ap, skb, CapiIllContrPlciNcci);
1752 return; 1911 return;
1753 } 1912 }
1913 bcs = &cs->bcs[channel-1];
1754 1914
1755 /* reject if logical connection not active */ 1915 /* reject if logical connection not active */
1756 if (ap->connected < APCONN_ACTIVE) { 1916 if (bcs->apconnstate < APCONN_ACTIVE) {
1757 send_conf(iif, ap, skb, 1917 send_conf(iif, ap, skb,
1758 CapiMessageNotSupportedInCurrentState); 1918 CapiMessageNotSupportedInCurrentState);
1759 return; 1919 return;
1760 } 1920 }
1761 1921
1762 /* trigger hangup, causing eventual DISCONNECT_B3_IND */ 1922 /* trigger hangup, causing eventual DISCONNECT_B3_IND */
1763 if (!gigaset_add_event(cs, &cs->bcs[channel-1].at_state, 1923 if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) {
1764 EV_HUP, NULL, 0, NULL)) {
1765 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); 1924 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
1766 return; 1925 return;
1767 } 1926 }
@@ -1782,11 +1941,14 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif,
1782 struct sk_buff *skb) 1941 struct sk_buff *skb)
1783{ 1942{
1784 struct cardstate *cs = iif->ctr.driverdata; 1943 struct cardstate *cs = iif->ctr.driverdata;
1944 struct bc_state *bcs;
1785 int channel = CAPIMSG_PLCI_PART(skb->data); 1945 int channel = CAPIMSG_PLCI_PART(skb->data);
1786 u16 ncci = CAPIMSG_NCCI_PART(skb->data); 1946 u16 ncci = CAPIMSG_NCCI_PART(skb->data);
1787 u16 msglen = CAPIMSG_LEN(skb->data); 1947 u16 msglen = CAPIMSG_LEN(skb->data);
1788 u16 datalen = CAPIMSG_DATALEN(skb->data); 1948 u16 datalen = CAPIMSG_DATALEN(skb->data);
1789 u16 flags = CAPIMSG_FLAGS(skb->data); 1949 u16 flags = CAPIMSG_FLAGS(skb->data);
1950 u16 msgid = CAPIMSG_MSGID(skb->data);
1951 u16 handle = CAPIMSG_HANDLE_REQ(skb->data);
1790 1952
1791 /* frequent message, avoid _cmsg overhead */ 1953 /* frequent message, avoid _cmsg overhead */
1792 dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data); 1954 dump_rawmsg(DEBUG_LLDATA, "DATA_B3_REQ", skb->data);
@@ -1802,6 +1964,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif,
1802 send_conf(iif, ap, skb, CapiIllContrPlciNcci); 1964 send_conf(iif, ap, skb, CapiIllContrPlciNcci);
1803 return; 1965 return;
1804 } 1966 }
1967 bcs = &cs->bcs[channel-1];
1805 if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64) 1968 if (msglen != CAPI_DATA_B3_REQ_LEN && msglen != CAPI_DATA_B3_REQ_LEN64)
1806 dev_notice(cs->dev, "%s: unexpected length %d\n", 1969 dev_notice(cs->dev, "%s: unexpected length %d\n",
1807 "DATA_B3_REQ", msglen); 1970 "DATA_B3_REQ", msglen);
@@ -1821,7 +1984,7 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif,
1821 } 1984 }
1822 1985
1823 /* reject if logical connection not active */ 1986 /* reject if logical connection not active */
1824 if (ap->connected < APCONN_ACTIVE) { 1987 if (bcs->apconnstate < APCONN_ACTIVE) {
1825 send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState); 1988 send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState);
1826 return; 1989 return;
1827 } 1990 }
@@ -1832,17 +1995,19 @@ static void do_data_b3_req(struct gigaset_capi_ctr *iif,
1832 skb_pull(skb, msglen); 1995 skb_pull(skb, msglen);
1833 1996
1834 /* pass to device-specific module */ 1997 /* pass to device-specific module */
1835 if (cs->ops->send_skb(&cs->bcs[channel-1], skb) < 0) { 1998 if (cs->ops->send_skb(bcs, skb) < 0) {
1836 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); 1999 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
1837 return; 2000 return;
1838 } 2001 }
1839 2002
1840 /* DATA_B3_CONF reply will be sent by gigaset_skb_sent() */
1841
1842 /* 2003 /*
1843 * ToDo: honor unset "delivery confirmation" bit 2004 * DATA_B3_CONF will be sent by gigaset_skb_sent() only if "delivery
1844 * (send DATA_B3_CONF immediately?) 2005 * confirmation" bit is set; otherwise we have to send it now
1845 */ 2006 */
2007 if (!(flags & CAPI_FLAGS_DELIVERY_CONFIRMATION))
2008 send_data_b3_conf(cs, &iif->ctr, ap->id, msgid, channel, handle,
2009 flags ? CapiFlagsNotSupportedByProtocol
2010 : CAPI_NOERROR);
1846} 2011}
1847 2012
1848/* 2013/*
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index f6f45f221920..5d4befb81057 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -399,8 +399,8 @@ static void gigaset_freebcs(struct bc_state *bcs)
399 gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel); 399 gig_dbg(DEBUG_INIT, "clearing bcs[%d]->at_state", bcs->channel);
400 clear_at_state(&bcs->at_state); 400 clear_at_state(&bcs->at_state);
401 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel); 401 gig_dbg(DEBUG_INIT, "freeing bcs[%d]->skb", bcs->channel);
402 dev_kfree_skb(bcs->skb); 402 dev_kfree_skb(bcs->rx_skb);
403 bcs->skb = NULL; 403 bcs->rx_skb = NULL;
404 404
405 for (i = 0; i < AT_NUM; ++i) { 405 for (i = 0; i < AT_NUM; ++i) {
406 kfree(bcs->commands[i]); 406 kfree(bcs->commands[i]);
@@ -634,19 +634,10 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
634 bcs->emptycount = 0; 634 bcs->emptycount = 0;
635#endif 635#endif
636 636
637 gig_dbg(DEBUG_INIT, "allocating bcs[%d]->skb", channel); 637 bcs->rx_bufsize = 0;
638 bcs->fcs = PPP_INITFCS; 638 bcs->rx_skb = NULL;
639 bcs->rx_fcs = PPP_INITFCS;
639 bcs->inputstate = 0; 640 bcs->inputstate = 0;
640 if (cs->ignoreframes) {
641 bcs->skb = NULL;
642 } else {
643 bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len);
644 if (bcs->skb != NULL)
645 skb_reserve(bcs->skb, cs->hw_hdr_len);
646 else
647 pr_err("out of memory\n");
648 }
649
650 bcs->channel = channel; 641 bcs->channel = channel;
651 bcs->cs = cs; 642 bcs->cs = cs;
652 643
@@ -658,16 +649,15 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
658 for (i = 0; i < AT_NUM; ++i) 649 for (i = 0; i < AT_NUM; ++i)
659 bcs->commands[i] = NULL; 650 bcs->commands[i] = NULL;
660 651
652 spin_lock_init(&bcs->aplock);
653 bcs->ap = NULL;
654 bcs->apconnstate = 0;
655
661 gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel); 656 gig_dbg(DEBUG_INIT, " setting up bcs[%d]->hw", channel);
662 if (cs->ops->initbcshw(bcs)) 657 if (cs->ops->initbcshw(bcs))
663 return bcs; 658 return bcs;
664 659
665 gig_dbg(DEBUG_INIT, " failed"); 660 gig_dbg(DEBUG_INIT, " failed");
666
667 gig_dbg(DEBUG_INIT, " freeing bcs[%d]->skb", channel);
668 dev_kfree_skb(bcs->skb);
669 bcs->skb = NULL;
670
671 return NULL; 661 return NULL;
672} 662}
673 663
@@ -839,14 +829,12 @@ void gigaset_bcs_reinit(struct bc_state *bcs)
839 bcs->emptycount = 0; 829 bcs->emptycount = 0;
840#endif 830#endif
841 831
842 bcs->fcs = PPP_INITFCS; 832 bcs->rx_fcs = PPP_INITFCS;
843 bcs->chstate = 0; 833 bcs->chstate = 0;
844 834
845 bcs->ignore = cs->ignoreframes; 835 bcs->ignore = cs->ignoreframes;
846 if (bcs->ignore) { 836 dev_kfree_skb(bcs->rx_skb);
847 dev_kfree_skb(bcs->skb); 837 bcs->rx_skb = NULL;
848 bcs->skb = NULL;
849 }
850 838
851 cs->ops->reinitbcshw(bcs); 839 cs->ops->reinitbcshw(bcs);
852} 840}
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 206c380c5235..ceaef9a04a42 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -282,9 +282,7 @@ struct reply_t gigaset_tab_cid[] =
282/* dial */ 282/* dial */
283{EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} }, 283{EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} },
284{RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} }, 284{RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} },
285{RSP_OK, 601, 601, -1, 602, 5, {ACT_CMD+AT_HLC} }, 285{RSP_OK, 601, 601, -1, 603, 5, {ACT_CMD+AT_PROTO} },
286{RSP_NULL, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} },
287{RSP_OK, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} },
288{RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} }, 286{RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} },
289{RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} }, 287{RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} },
290{RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, 288{RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 05947f9c1849..8738b0821fc9 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -45,10 +45,6 @@
45#define MAX_EVENTS 64 /* size of event queue */ 45#define MAX_EVENTS 64 /* size of event queue */
46 46
47#define RBUFSIZE 8192 47#define RBUFSIZE 8192
48#define SBUFSIZE 4096 /* sk_buff payload size */
49
50#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
51#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
52 48
53/* compile time options */ 49/* compile time options */
54#define GIG_MAJOR 0 50#define GIG_MAJOR 0
@@ -190,10 +186,9 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
190#define AT_BC 3 186#define AT_BC 3
191#define AT_PROTO 4 187#define AT_PROTO 4
192#define AT_TYPE 5 188#define AT_TYPE 5
193#define AT_HLC 6 189#define AT_CLIP 6
194#define AT_CLIP 7
195/* total number */ 190/* total number */
196#define AT_NUM 8 191#define AT_NUM 7
197 192
198/* variables in struct at_state_t */ 193/* variables in struct at_state_t */
199#define VAR_ZSAU 0 194#define VAR_ZSAU 0
@@ -380,8 +375,10 @@ struct bc_state {
380 375
381 struct at_state_t at_state; 376 struct at_state_t at_state;
382 377
383 __u16 fcs; 378 /* receive buffer */
384 struct sk_buff *skb; 379 unsigned rx_bufsize; /* max size accepted by application */
380 struct sk_buff *rx_skb;
381 __u16 rx_fcs;
385 int inputstate; /* see INS_XXXX */ 382 int inputstate; /* see INS_XXXX */
386 383
387 int channel; 384 int channel;
@@ -406,7 +403,9 @@ struct bc_state {
406 struct bas_bc_state *bas; /* usb hardware driver (base) */ 403 struct bas_bc_state *bas; /* usb hardware driver (base) */
407 } hw; 404 } hw;
408 405
409 void *ap; /* LL application structure */ 406 void *ap; /* associated LL application */
407 int apconnstate; /* LL application connection state */
408 spinlock_t aplock;
410}; 409};
411 410
412struct cardstate { 411struct cardstate {
@@ -801,8 +800,23 @@ static inline void gigaset_bchannel_up(struct bc_state *bcs)
801 gigaset_schedule_event(bcs->cs); 800 gigaset_schedule_event(bcs->cs);
802} 801}
803 802
804/* handling routines for sk_buff */ 803/* set up next receive skb for data mode */
805/* ============================= */ 804static inline struct sk_buff *gigaset_new_rx_skb(struct bc_state *bcs)
805{
806 struct cardstate *cs = bcs->cs;
807 unsigned short hw_hdr_len = cs->hw_hdr_len;
808
809 if (bcs->ignore) {
810 bcs->rx_skb = NULL;
811 } else {
812 bcs->rx_skb = dev_alloc_skb(bcs->rx_bufsize + hw_hdr_len);
813 if (bcs->rx_skb == NULL)
814 dev_warn(cs->dev, "could not allocate skb\n");
815 else
816 skb_reserve(bcs->rx_skb, hw_hdr_len);
817 }
818 return bcs->rx_skb;
819}
806 820
807/* append received bytes to inbuf */ 821/* append received bytes to inbuf */
808int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, 822int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index c22e5ace8276..f01c3c2e2e46 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -16,7 +16,10 @@
16#include "gigaset.h" 16#include "gigaset.h"
17#include <linux/isdnif.h> 17#include <linux/isdnif.h>
18 18
19#define SBUFSIZE 4096 /* sk_buff payload size */
20#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
19#define HW_HDR_LEN 2 /* Header size used to store ack info */ 21#define HW_HDR_LEN 2 /* Header size used to store ack info */
22#define MAX_BUF_SIZE (SBUFSIZE - HW_HDR_LEN) /* max data packet from LL */
20 23
21/* == Handling of I4L IO =====================================================*/ 24/* == Handling of I4L IO =====================================================*/
22 25
@@ -231,6 +234,15 @@ static int command_from_LL(isdn_ctrl *cntrl)
231 dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n"); 234 dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n");
232 return -EBUSY; 235 return -EBUSY;
233 } 236 }
237 switch (bcs->proto2) {
238 case L2_HDLC:
239 bcs->rx_bufsize = SBUFSIZE;
240 break;
241 default: /* assume transparent */
242 bcs->rx_bufsize = TRANSBUFSIZE;
243 }
244 dev_kfree_skb(bcs->rx_skb);
245 gigaset_new_rx_skb(bcs);
234 246
235 commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC); 247 commands = kzalloc(AT_NUM*(sizeof *commands), GFP_ATOMIC);
236 if (!commands) { 248 if (!commands) {
@@ -314,6 +326,15 @@ static int command_from_LL(isdn_ctrl *cntrl)
314 return -EINVAL; 326 return -EINVAL;
315 } 327 }
316 bcs = cs->bcs + ch; 328 bcs = cs->bcs + ch;
329 switch (bcs->proto2) {
330 case L2_HDLC:
331 bcs->rx_bufsize = SBUFSIZE;
332 break;
333 default: /* assume transparent */
334 bcs->rx_bufsize = TRANSBUFSIZE;
335 }
336 dev_kfree_skb(bcs->rx_skb);
337 gigaset_new_rx_skb(bcs);
317 if (!gigaset_add_event(cs, &bcs->at_state, 338 if (!gigaset_add_event(cs, &bcs->at_state,
318 EV_ACCEPT, NULL, 0, NULL)) 339 EV_ACCEPT, NULL, 0, NULL))
319 return -ENOMEM; 340 return -ENOMEM;
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 16fd3bd48883..2dfd346fc889 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -500,19 +500,18 @@ int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len)
500 */ 500 */
501static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) 501static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
502{ 502{
503 bcs->fcs = crc_ccitt_byte(bcs->fcs, c); 503 bcs->rx_fcs = crc_ccitt_byte(bcs->rx_fcs, c);
504 if (unlikely(bcs->skb == NULL)) { 504 if (bcs->rx_skb == NULL)
505 /* skipping */ 505 /* skipping */
506 return; 506 return;
507 } 507 if (bcs->rx_skb->len >= bcs->rx_bufsize) {
508 if (unlikely(bcs->skb->len == SBUFSIZE)) {
509 dev_warn(bcs->cs->dev, "received oversized packet discarded\n"); 508 dev_warn(bcs->cs->dev, "received oversized packet discarded\n");
510 bcs->hw.bas->giants++; 509 bcs->hw.bas->giants++;
511 dev_kfree_skb_any(bcs->skb); 510 dev_kfree_skb_any(bcs->rx_skb);
512 bcs->skb = NULL; 511 bcs->rx_skb = NULL;
513 return; 512 return;
514 } 513 }
515 *__skb_put(bcs->skb, 1) = c; 514 *__skb_put(bcs->rx_skb, 1) = c;
516} 515}
517 516
518/* hdlc_flush 517/* hdlc_flush
@@ -521,18 +520,13 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs)
521static inline void hdlc_flush(struct bc_state *bcs) 520static inline void hdlc_flush(struct bc_state *bcs)
522{ 521{
523 /* clear skb or allocate new if not skipping */ 522 /* clear skb or allocate new if not skipping */
524 if (likely(bcs->skb != NULL)) 523 if (bcs->rx_skb != NULL)
525 skb_trim(bcs->skb, 0); 524 skb_trim(bcs->rx_skb, 0);
526 else if (!bcs->ignore) { 525 else
527 bcs->skb = dev_alloc_skb(SBUFSIZE + bcs->cs->hw_hdr_len); 526 gigaset_new_rx_skb(bcs);
528 if (bcs->skb)
529 skb_reserve(bcs->skb, bcs->cs->hw_hdr_len);
530 else
531 dev_err(bcs->cs->dev, "could not allocate skb\n");
532 }
533 527
534 /* reset packet state */ 528 /* reset packet state */
535 bcs->fcs = PPP_INITFCS; 529 bcs->rx_fcs = PPP_INITFCS;
536} 530}
537 531
538/* hdlc_done 532/* hdlc_done
@@ -549,7 +543,7 @@ static inline void hdlc_done(struct bc_state *bcs)
549 hdlc_flush(bcs); 543 hdlc_flush(bcs);
550 return; 544 return;
551 } 545 }
552 procskb = bcs->skb; 546 procskb = bcs->rx_skb;
553 if (procskb == NULL) { 547 if (procskb == NULL) {
554 /* previous error */ 548 /* previous error */
555 gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__); 549 gig_dbg(DEBUG_ISO, "%s: skb=NULL", __func__);
@@ -560,8 +554,8 @@ static inline void hdlc_done(struct bc_state *bcs)
560 bcs->hw.bas->runts++; 554 bcs->hw.bas->runts++;
561 dev_kfree_skb_any(procskb); 555 dev_kfree_skb_any(procskb);
562 gigaset_isdn_rcv_err(bcs); 556 gigaset_isdn_rcv_err(bcs);
563 } else if (bcs->fcs != PPP_GOODFCS) { 557 } else if (bcs->rx_fcs != PPP_GOODFCS) {
564 dev_notice(cs->dev, "frame check error (0x%04x)\n", bcs->fcs); 558 dev_notice(cs->dev, "frame check error\n");
565 bcs->hw.bas->fcserrs++; 559 bcs->hw.bas->fcserrs++;
566 dev_kfree_skb_any(procskb); 560 dev_kfree_skb_any(procskb);
567 gigaset_isdn_rcv_err(bcs); 561 gigaset_isdn_rcv_err(bcs);
@@ -574,13 +568,8 @@ static inline void hdlc_done(struct bc_state *bcs)
574 bcs->hw.bas->goodbytes += len; 568 bcs->hw.bas->goodbytes += len;
575 gigaset_skb_rcvd(bcs, procskb); 569 gigaset_skb_rcvd(bcs, procskb);
576 } 570 }
577 571 gigaset_new_rx_skb(bcs);
578 bcs->skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); 572 bcs->rx_fcs = PPP_INITFCS;
579 if (bcs->skb)
580 skb_reserve(bcs->skb, cs->hw_hdr_len);
581 else
582 dev_err(cs->dev, "could not allocate skb\n");
583 bcs->fcs = PPP_INITFCS;
584} 573}
585 574
586/* hdlc_frag 575/* hdlc_frag
@@ -597,8 +586,8 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
597 dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits); 586 dev_notice(bcs->cs->dev, "received partial byte (%d bits)\n", inbits);
598 bcs->hw.bas->alignerrs++; 587 bcs->hw.bas->alignerrs++;
599 gigaset_isdn_rcv_err(bcs); 588 gigaset_isdn_rcv_err(bcs);
600 __skb_trim(bcs->skb, 0); 589 __skb_trim(bcs->rx_skb, 0);
601 bcs->fcs = PPP_INITFCS; 590 bcs->rx_fcs = PPP_INITFCS;
602} 591}
603 592
604/* bit counts lookup table for HDLC bit unstuffing 593/* bit counts lookup table for HDLC bit unstuffing
@@ -847,7 +836,6 @@ static inline void hdlc_unpack(unsigned char *src, unsigned count,
847static inline void trans_receive(unsigned char *src, unsigned count, 836static inline void trans_receive(unsigned char *src, unsigned count,
848 struct bc_state *bcs) 837 struct bc_state *bcs)
849{ 838{
850 struct cardstate *cs = bcs->cs;
851 struct sk_buff *skb; 839 struct sk_buff *skb;
852 int dobytes; 840 int dobytes;
853 unsigned char *dst; 841 unsigned char *dst;
@@ -857,17 +845,11 @@ static inline void trans_receive(unsigned char *src, unsigned count,
857 hdlc_flush(bcs); 845 hdlc_flush(bcs);
858 return; 846 return;
859 } 847 }
860 skb = bcs->skb; 848 skb = bcs->rx_skb;
861 if (unlikely(skb == NULL)) { 849 if (skb == NULL)
862 bcs->skb = skb = dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); 850 skb = gigaset_new_rx_skb(bcs);
863 if (!skb) {
864 dev_err(cs->dev, "could not allocate skb\n");
865 return;
866 }
867 skb_reserve(skb, cs->hw_hdr_len);
868 }
869 bcs->hw.bas->goodbytes += skb->len; 851 bcs->hw.bas->goodbytes += skb->len;
870 dobytes = TRANSBUFSIZE - skb->len; 852 dobytes = bcs->rx_bufsize - skb->len;
871 while (count > 0) { 853 while (count > 0) {
872 dst = skb_put(skb, count < dobytes ? count : dobytes); 854 dst = skb_put(skb, count < dobytes ? count : dobytes);
873 while (count > 0 && dobytes > 0) { 855 while (count > 0 && dobytes > 0) {
@@ -879,14 +861,10 @@ static inline void trans_receive(unsigned char *src, unsigned count,
879 dump_bytes(DEBUG_STREAM_DUMP, 861 dump_bytes(DEBUG_STREAM_DUMP,
880 "rcv data", skb->data, skb->len); 862 "rcv data", skb->data, skb->len);
881 gigaset_skb_rcvd(bcs, skb); 863 gigaset_skb_rcvd(bcs, skb);
882 bcs->skb = skb = 864 skb = gigaset_new_rx_skb(bcs);
883 dev_alloc_skb(SBUFSIZE + cs->hw_hdr_len); 865 if (skb == NULL)
884 if (!skb) {
885 dev_err(cs->dev, "could not allocate skb\n");
886 return; 866 return;
887 } 867 dobytes = bcs->rx_bufsize;
888 skb_reserve(skb, cs->hw_hdr_len);
889 dobytes = TRANSBUFSIZE;
890 } 868 }
891 } 869 }
892} 870}
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c
index 72eb92647c1b..feec8d89d719 100644
--- a/drivers/isdn/hysdn/hysdn_net.c
+++ b/drivers/isdn/hysdn/hysdn_net.c
@@ -187,12 +187,13 @@ void
187hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) 187hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len)
188{ 188{
189 struct net_local *lp = card->netif; 189 struct net_local *lp = card->netif;
190 struct net_device *dev = lp->dev; 190 struct net_device *dev;
191 struct sk_buff *skb; 191 struct sk_buff *skb;
192 192
193 if (!lp) 193 if (!lp)
194 return; /* non existing device */ 194 return; /* non existing device */
195 195
196 dev = lp->dev;
196 dev->stats.rx_bytes += len; 197 dev->stats.rx_bytes += len;
197 198
198 skb = dev_alloc_skb(len); 199 skb = dev_alloc_skb(len);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 46b3a044eadf..cb20d0b0555a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2087,6 +2087,7 @@ static void sync_sbs(mddev_t * mddev, int nospares)
2087 /* First make sure individual recovery_offsets are correct */ 2087 /* First make sure individual recovery_offsets are correct */
2088 list_for_each_entry(rdev, &mddev->disks, same_set) { 2088 list_for_each_entry(rdev, &mddev->disks, same_set) {
2089 if (rdev->raid_disk >= 0 && 2089 if (rdev->raid_disk >= 0 &&
2090 mddev->delta_disks >= 0 &&
2090 !test_bit(In_sync, &rdev->flags) && 2091 !test_bit(In_sync, &rdev->flags) &&
2091 mddev->curr_resync_completed > rdev->recovery_offset) 2092 mddev->curr_resync_completed > rdev->recovery_offset)
2092 rdev->recovery_offset = mddev->curr_resync_completed; 2093 rdev->recovery_offset = mddev->curr_resync_completed;
@@ -3001,6 +3002,9 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
3001 return -EINVAL; 3002 return -EINVAL;
3002 } 3003 }
3003 3004
3005 list_for_each_entry(rdev, &mddev->disks, same_set)
3006 rdev->new_raid_disk = rdev->raid_disk;
3007
3004 /* ->takeover must set new_* and/or delta_disks 3008 /* ->takeover must set new_* and/or delta_disks
3005 * if it succeeds, and may set them when it fails. 3009 * if it succeeds, and may set them when it fails.
3006 */ 3010 */
@@ -3051,13 +3055,35 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
3051 mddev->safemode = 0; 3055 mddev->safemode = 0;
3052 } 3056 }
3053 3057
3054 module_put(mddev->pers->owner); 3058 list_for_each_entry(rdev, &mddev->disks, same_set) {
3055 /* Invalidate devices that are now superfluous */ 3059 char nm[20];
3056 list_for_each_entry(rdev, &mddev->disks, same_set) 3060 if (rdev->raid_disk < 0)
3057 if (rdev->raid_disk >= mddev->raid_disks) { 3061 continue;
3058 rdev->raid_disk = -1; 3062 if (rdev->new_raid_disk > mddev->raid_disks)
3063 rdev->new_raid_disk = -1;
3064 if (rdev->new_raid_disk == rdev->raid_disk)
3065 continue;
3066 sprintf(nm, "rd%d", rdev->raid_disk);
3067 sysfs_remove_link(&mddev->kobj, nm);
3068 }
3069 list_for_each_entry(rdev, &mddev->disks, same_set) {
3070 if (rdev->raid_disk < 0)
3071 continue;
3072 if (rdev->new_raid_disk == rdev->raid_disk)
3073 continue;
3074 rdev->raid_disk = rdev->new_raid_disk;
3075 if (rdev->raid_disk < 0)
3059 clear_bit(In_sync, &rdev->flags); 3076 clear_bit(In_sync, &rdev->flags);
3077 else {
3078 char nm[20];
3079 sprintf(nm, "rd%d", rdev->raid_disk);
3080 if(sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
3081 printk("md: cannot register %s for %s after level change\n",
3082 nm, mdname(mddev));
3060 } 3083 }
3084 }
3085
3086 module_put(mddev->pers->owner);
3061 mddev->pers = pers; 3087 mddev->pers = pers;
3062 mddev->private = priv; 3088 mddev->private = priv;
3063 strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel)); 3089 strlcpy(mddev->clevel, pers->name, sizeof(mddev->clevel));
@@ -5895,6 +5921,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
5895 atomic_inc(&mddev->openers); 5921 atomic_inc(&mddev->openers);
5896 mutex_unlock(&mddev->open_mutex); 5922 mutex_unlock(&mddev->open_mutex);
5897 5923
5924 check_disk_size_change(mddev->gendisk, bdev);
5898 out: 5925 out:
5899 return err; 5926 return err;
5900} 5927}
@@ -6846,6 +6873,7 @@ void md_do_sync(mddev_t *mddev)
6846 rcu_read_lock(); 6873 rcu_read_lock();
6847 list_for_each_entry_rcu(rdev, &mddev->disks, same_set) 6874 list_for_each_entry_rcu(rdev, &mddev->disks, same_set)
6848 if (rdev->raid_disk >= 0 && 6875 if (rdev->raid_disk >= 0 &&
6876 mddev->delta_disks >= 0 &&
6849 !test_bit(Faulty, &rdev->flags) && 6877 !test_bit(Faulty, &rdev->flags) &&
6850 !test_bit(In_sync, &rdev->flags) && 6878 !test_bit(In_sync, &rdev->flags) &&
6851 rdev->recovery_offset < mddev->curr_resync) 6879 rdev->recovery_offset < mddev->curr_resync)
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 7ab5ea155452..10597bfec000 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -78,6 +78,9 @@ struct mdk_rdev_s
78 78
79 int desc_nr; /* descriptor index in the superblock */ 79 int desc_nr; /* descriptor index in the superblock */
80 int raid_disk; /* role of device in array */ 80 int raid_disk; /* role of device in array */
81 int new_raid_disk; /* role that the device will have in
82 * the array after a level-change completes.
83 */
81 int saved_raid_disk; /* role that device used to have in the 84 int saved_raid_disk; /* role that device used to have in the
82 * array and could again if we did a partial 85 * array and could again if we did a partial
83 * resync from the bitmap 86 * resync from the bitmap
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index e70f004c99e8..563abed5a2cb 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -173,9 +173,11 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
173 list_for_each_entry(rdev1, &mddev->disks, same_set) { 173 list_for_each_entry(rdev1, &mddev->disks, same_set) {
174 int j = rdev1->raid_disk; 174 int j = rdev1->raid_disk;
175 175
176 if (mddev->level == 10) 176 if (mddev->level == 10) {
177 /* taking over a raid10-n2 array */ 177 /* taking over a raid10-n2 array */
178 j /= 2; 178 j /= 2;
179 rdev1->new_raid_disk = j;
180 }
179 181
180 if (j < 0 || j >= mddev->raid_disks) { 182 if (j < 0 || j >= mddev->raid_disks) {
181 printk(KERN_ERR "md/raid0:%s: bad disk number %d - " 183 printk(KERN_ERR "md/raid0:%s: bad disk number %d - "
@@ -361,12 +363,6 @@ static int raid0_run(mddev_t *mddev)
361 mddev->private = conf; 363 mddev->private = conf;
362 } 364 }
363 conf = mddev->private; 365 conf = mddev->private;
364 if (conf->scale_raid_disks) {
365 int i;
366 for (i=0; i < conf->strip_zone[0].nb_dev; i++)
367 conf->devlist[i]->raid_disk /= conf->scale_raid_disks;
368 /* FIXME update sysfs rd links */
369 }
370 366
371 /* calculate array device size */ 367 /* calculate array device size */
372 md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); 368 md_set_array_sectors(mddev, raid0_size(mddev, 0, 0));
@@ -573,7 +569,7 @@ static void raid0_status(struct seq_file *seq, mddev_t *mddev)
573 return; 569 return;
574} 570}
575 571
576static void *raid0_takeover_raid5(mddev_t *mddev) 572static void *raid0_takeover_raid45(mddev_t *mddev)
577{ 573{
578 mdk_rdev_t *rdev; 574 mdk_rdev_t *rdev;
579 raid0_conf_t *priv_conf; 575 raid0_conf_t *priv_conf;
@@ -596,6 +592,7 @@ static void *raid0_takeover_raid5(mddev_t *mddev)
596 592
597 /* Set new parameters */ 593 /* Set new parameters */
598 mddev->new_level = 0; 594 mddev->new_level = 0;
595 mddev->new_layout = 0;
599 mddev->new_chunk_sectors = mddev->chunk_sectors; 596 mddev->new_chunk_sectors = mddev->chunk_sectors;
600 mddev->raid_disks--; 597 mddev->raid_disks--;
601 mddev->delta_disks = -1; 598 mddev->delta_disks = -1;
@@ -635,6 +632,7 @@ static void *raid0_takeover_raid10(mddev_t *mddev)
635 632
636 /* Set new parameters */ 633 /* Set new parameters */
637 mddev->new_level = 0; 634 mddev->new_level = 0;
635 mddev->new_layout = 0;
638 mddev->new_chunk_sectors = mddev->chunk_sectors; 636 mddev->new_chunk_sectors = mddev->chunk_sectors;
639 mddev->delta_disks = - mddev->raid_disks / 2; 637 mddev->delta_disks = - mddev->raid_disks / 2;
640 mddev->raid_disks += mddev->delta_disks; 638 mddev->raid_disks += mddev->delta_disks;
@@ -643,19 +641,22 @@ static void *raid0_takeover_raid10(mddev_t *mddev)
643 mddev->recovery_cp = MaxSector; 641 mddev->recovery_cp = MaxSector;
644 642
645 create_strip_zones(mddev, &priv_conf); 643 create_strip_zones(mddev, &priv_conf);
646 priv_conf->scale_raid_disks = 2;
647 return priv_conf; 644 return priv_conf;
648} 645}
649 646
650static void *raid0_takeover(mddev_t *mddev) 647static void *raid0_takeover(mddev_t *mddev)
651{ 648{
652 /* raid0 can take over: 649 /* raid0 can take over:
650 * raid4 - if all data disks are active.
653 * raid5 - providing it is Raid4 layout and one disk is faulty 651 * raid5 - providing it is Raid4 layout and one disk is faulty
654 * raid10 - assuming we have all necessary active disks 652 * raid10 - assuming we have all necessary active disks
655 */ 653 */
654 if (mddev->level == 4)
655 return raid0_takeover_raid45(mddev);
656
656 if (mddev->level == 5) { 657 if (mddev->level == 5) {
657 if (mddev->layout == ALGORITHM_PARITY_N) 658 if (mddev->layout == ALGORITHM_PARITY_N)
658 return raid0_takeover_raid5(mddev); 659 return raid0_takeover_raid45(mddev);
659 660
660 printk(KERN_ERR "md/raid0:%s: Raid can only takeover Raid5 with layout: %d\n", 661 printk(KERN_ERR "md/raid0:%s: Raid can only takeover Raid5 with layout: %d\n",
661 mdname(mddev), ALGORITHM_PARITY_N); 662 mdname(mddev), ALGORITHM_PARITY_N);
diff --git a/drivers/md/raid0.h b/drivers/md/raid0.h
index d724e664ca4d..91f8e876ee64 100644
--- a/drivers/md/raid0.h
+++ b/drivers/md/raid0.h
@@ -13,9 +13,6 @@ struct raid0_private_data
13 struct strip_zone *strip_zone; 13 struct strip_zone *strip_zone;
14 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ 14 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
15 int nr_strip_zones; 15 int nr_strip_zones;
16 int scale_raid_disks; /* divide rdev->raid_disks by this in run()
17 * to handle conversion from raid10
18 */
19}; 16};
20 17
21typedef struct raid0_private_data raid0_conf_t; 18typedef struct raid0_private_data raid0_conf_t;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 03724992cdf2..42e64e4e5e25 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1482,14 +1482,14 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
1482 int sectors = r10_bio->sectors; 1482 int sectors = r10_bio->sectors;
1483 mdk_rdev_t*rdev; 1483 mdk_rdev_t*rdev;
1484 int max_read_errors = atomic_read(&mddev->max_corr_read_errors); 1484 int max_read_errors = atomic_read(&mddev->max_corr_read_errors);
1485 int d = r10_bio->devs[r10_bio->read_slot].devnum;
1485 1486
1486 rcu_read_lock(); 1487 rcu_read_lock();
1487 { 1488 rdev = rcu_dereference(conf->mirrors[d].rdev);
1488 int d = r10_bio->devs[r10_bio->read_slot].devnum; 1489 if (rdev) { /* If rdev is not NULL */
1489 char b[BDEVNAME_SIZE]; 1490 char b[BDEVNAME_SIZE];
1490 int cur_read_error_count = 0; 1491 int cur_read_error_count = 0;
1491 1492
1492 rdev = rcu_dereference(conf->mirrors[d].rdev);
1493 bdevname(rdev->bdev, b); 1493 bdevname(rdev->bdev, b);
1494 1494
1495 if (test_bit(Faulty, &rdev->flags)) { 1495 if (test_bit(Faulty, &rdev->flags)) {
@@ -1530,7 +1530,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
1530 1530
1531 rcu_read_lock(); 1531 rcu_read_lock();
1532 do { 1532 do {
1533 int d = r10_bio->devs[sl].devnum; 1533 d = r10_bio->devs[sl].devnum;
1534 rdev = rcu_dereference(conf->mirrors[d].rdev); 1534 rdev = rcu_dereference(conf->mirrors[d].rdev);
1535 if (rdev && 1535 if (rdev &&
1536 test_bit(In_sync, &rdev->flags)) { 1536 test_bit(In_sync, &rdev->flags)) {
@@ -1564,7 +1564,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
1564 rcu_read_lock(); 1564 rcu_read_lock();
1565 while (sl != r10_bio->read_slot) { 1565 while (sl != r10_bio->read_slot) {
1566 char b[BDEVNAME_SIZE]; 1566 char b[BDEVNAME_SIZE];
1567 int d; 1567
1568 if (sl==0) 1568 if (sl==0)
1569 sl = conf->copies; 1569 sl = conf->copies;
1570 sl--; 1570 sl--;
@@ -1601,7 +1601,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
1601 } 1601 }
1602 sl = start; 1602 sl = start;
1603 while (sl != r10_bio->read_slot) { 1603 while (sl != r10_bio->read_slot) {
1604 int d; 1604
1605 if (sl==0) 1605 if (sl==0)
1606 sl = conf->copies; 1606 sl = conf->copies;
1607 sl--; 1607 sl--;
@@ -2161,22 +2161,22 @@ static conf_t *setup_conf(mddev_t *mddev)
2161 sector_t stride, size; 2161 sector_t stride, size;
2162 int err = -EINVAL; 2162 int err = -EINVAL;
2163 2163
2164 if (mddev->chunk_sectors < (PAGE_SIZE >> 9) || 2164 if (mddev->new_chunk_sectors < (PAGE_SIZE >> 9) ||
2165 !is_power_of_2(mddev->chunk_sectors)) { 2165 !is_power_of_2(mddev->new_chunk_sectors)) {
2166 printk(KERN_ERR "md/raid10:%s: chunk size must be " 2166 printk(KERN_ERR "md/raid10:%s: chunk size must be "
2167 "at least PAGE_SIZE(%ld) and be a power of 2.\n", 2167 "at least PAGE_SIZE(%ld) and be a power of 2.\n",
2168 mdname(mddev), PAGE_SIZE); 2168 mdname(mddev), PAGE_SIZE);
2169 goto out; 2169 goto out;
2170 } 2170 }
2171 2171
2172 nc = mddev->layout & 255; 2172 nc = mddev->new_layout & 255;
2173 fc = (mddev->layout >> 8) & 255; 2173 fc = (mddev->new_layout >> 8) & 255;
2174 fo = mddev->layout & (1<<16); 2174 fo = mddev->new_layout & (1<<16);
2175 2175
2176 if ((nc*fc) <2 || (nc*fc) > mddev->raid_disks || 2176 if ((nc*fc) <2 || (nc*fc) > mddev->raid_disks ||
2177 (mddev->layout >> 17)) { 2177 (mddev->new_layout >> 17)) {
2178 printk(KERN_ERR "md/raid10:%s: unsupported raid10 layout: 0x%8x\n", 2178 printk(KERN_ERR "md/raid10:%s: unsupported raid10 layout: 0x%8x\n",
2179 mdname(mddev), mddev->layout); 2179 mdname(mddev), mddev->new_layout);
2180 goto out; 2180 goto out;
2181 } 2181 }
2182 2182
@@ -2241,7 +2241,6 @@ static conf_t *setup_conf(mddev_t *mddev)
2241 if (!conf->thread) 2241 if (!conf->thread)
2242 goto out; 2242 goto out;
2243 2243
2244 conf->scale_disks = 0;
2245 conf->mddev = mddev; 2244 conf->mddev = mddev;
2246 return conf; 2245 return conf;
2247 2246
@@ -2300,11 +2299,6 @@ static int run(mddev_t *mddev)
2300 if (disk_idx >= conf->raid_disks 2299 if (disk_idx >= conf->raid_disks
2301 || disk_idx < 0) 2300 || disk_idx < 0)
2302 continue; 2301 continue;
2303 if (conf->scale_disks) {
2304 disk_idx *= conf->scale_disks;
2305 rdev->raid_disk = disk_idx;
2306 /* MOVE 'rd%d' link !! */
2307 }
2308 disk = conf->mirrors + disk_idx; 2302 disk = conf->mirrors + disk_idx;
2309 2303
2310 disk->rdev = rdev; 2304 disk->rdev = rdev;
@@ -2435,26 +2429,22 @@ static void *raid10_takeover_raid0(mddev_t *mddev)
2435 return ERR_PTR(-EINVAL); 2429 return ERR_PTR(-EINVAL);
2436 } 2430 }
2437 2431
2438 /* Update slot numbers to obtain
2439 * degraded raid10 with missing mirrors
2440 */
2441 list_for_each_entry(rdev, &mddev->disks, same_set) {
2442 rdev->raid_disk *= 2;
2443 }
2444
2445 /* Set new parameters */ 2432 /* Set new parameters */
2446 mddev->new_level = 10; 2433 mddev->new_level = 10;
2447 /* new layout: far_copies = 1, near_copies = 2 */ 2434 /* new layout: far_copies = 1, near_copies = 2 */
2448 mddev->new_layout = (1<<8) + 2; 2435 mddev->new_layout = (1<<8) + 2;
2449 mddev->new_chunk_sectors = mddev->chunk_sectors; 2436 mddev->new_chunk_sectors = mddev->chunk_sectors;
2450 mddev->delta_disks = mddev->raid_disks; 2437 mddev->delta_disks = mddev->raid_disks;
2451 mddev->degraded = mddev->raid_disks;
2452 mddev->raid_disks *= 2; 2438 mddev->raid_disks *= 2;
2453 /* make sure it will be not marked as dirty */ 2439 /* make sure it will be not marked as dirty */
2454 mddev->recovery_cp = MaxSector; 2440 mddev->recovery_cp = MaxSector;
2455 2441
2456 conf = setup_conf(mddev); 2442 conf = setup_conf(mddev);
2457 conf->scale_disks = 2; 2443 if (!IS_ERR(conf))
2444 list_for_each_entry(rdev, &mddev->disks, same_set)
2445 if (rdev->raid_disk >= 0)
2446 rdev->new_raid_disk = rdev->raid_disk * 2;
2447
2458 return conf; 2448 return conf;
2459} 2449}
2460 2450
diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h
index 3824a087e17c..2316ac2e8e21 100644
--- a/drivers/md/raid10.h
+++ b/drivers/md/raid10.h
@@ -38,11 +38,6 @@ struct r10_private_data_s {
38 int chunk_shift; /* shift from chunks to sectors */ 38 int chunk_shift; /* shift from chunks to sectors */
39 sector_t chunk_mask; 39 sector_t chunk_mask;
40 40
41 int scale_disks; /* When starting array, multiply
42 * each ->raid_disk by this.
43 * Need for raid0->raid10 migration
44 */
45
46 struct list_head retry_list; 41 struct list_head retry_list;
47 /* queue pending writes and submit them on unplug */ 42 /* queue pending writes and submit them on unplug */
48 struct bio_list pending_bio_list; 43 struct bio_list pending_bio_list;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index d2c0f94fa37d..96c690279fc6 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -277,12 +277,13 @@ out:
277 return sh; 277 return sh;
278} 278}
279 279
280static void shrink_buffers(struct stripe_head *sh, int num) 280static void shrink_buffers(struct stripe_head *sh)
281{ 281{
282 struct page *p; 282 struct page *p;
283 int i; 283 int i;
284 int num = sh->raid_conf->pool_size;
284 285
285 for (i=0; i<num ; i++) { 286 for (i = 0; i < num ; i++) {
286 p = sh->dev[i].page; 287 p = sh->dev[i].page;
287 if (!p) 288 if (!p)
288 continue; 289 continue;
@@ -291,11 +292,12 @@ static void shrink_buffers(struct stripe_head *sh, int num)
291 } 292 }
292} 293}
293 294
294static int grow_buffers(struct stripe_head *sh, int num) 295static int grow_buffers(struct stripe_head *sh)
295{ 296{
296 int i; 297 int i;
298 int num = sh->raid_conf->pool_size;
297 299
298 for (i=0; i<num; i++) { 300 for (i = 0; i < num; i++) {
299 struct page *page; 301 struct page *page;
300 302
301 if (!(page = alloc_page(GFP_KERNEL))) { 303 if (!(page = alloc_page(GFP_KERNEL))) {
@@ -364,6 +366,73 @@ static struct stripe_head *__find_stripe(raid5_conf_t *conf, sector_t sector,
364 return NULL; 366 return NULL;
365} 367}
366 368
369/*
370 * Need to check if array has failed when deciding whether to:
371 * - start an array
372 * - remove non-faulty devices
373 * - add a spare
374 * - allow a reshape
375 * This determination is simple when no reshape is happening.
376 * However if there is a reshape, we need to carefully check
377 * both the before and after sections.
378 * This is because some failed devices may only affect one
379 * of the two sections, and some non-in_sync devices may
380 * be insync in the section most affected by failed devices.
381 */
382static int has_failed(raid5_conf_t *conf)
383{
384 int degraded;
385 int i;
386 if (conf->mddev->reshape_position == MaxSector)
387 return conf->mddev->degraded > conf->max_degraded;
388
389 rcu_read_lock();
390 degraded = 0;
391 for (i = 0; i < conf->previous_raid_disks; i++) {
392 mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev);
393 if (!rdev || test_bit(Faulty, &rdev->flags))
394 degraded++;
395 else if (test_bit(In_sync, &rdev->flags))
396 ;
397 else
398 /* not in-sync or faulty.
399 * If the reshape increases the number of devices,
400 * this is being recovered by the reshape, so
401 * this 'previous' section is not in_sync.
402 * If the number of devices is being reduced however,
403 * the device can only be part of the array if
404 * we are reverting a reshape, so this section will
405 * be in-sync.
406 */
407 if (conf->raid_disks >= conf->previous_raid_disks)
408 degraded++;
409 }
410 rcu_read_unlock();
411 if (degraded > conf->max_degraded)
412 return 1;
413 rcu_read_lock();
414 degraded = 0;
415 for (i = 0; i < conf->raid_disks; i++) {
416 mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev);
417 if (!rdev || test_bit(Faulty, &rdev->flags))
418 degraded++;
419 else if (test_bit(In_sync, &rdev->flags))
420 ;
421 else
422 /* not in-sync or faulty.
423 * If reshape increases the number of devices, this
424 * section has already been recovered, else it
425 * almost certainly hasn't.
426 */
427 if (conf->raid_disks <= conf->previous_raid_disks)
428 degraded++;
429 }
430 rcu_read_unlock();
431 if (degraded > conf->max_degraded)
432 return 1;
433 return 0;
434}
435
367static void unplug_slaves(mddev_t *mddev); 436static void unplug_slaves(mddev_t *mddev);
368static void raid5_unplug_device(struct request_queue *q); 437static void raid5_unplug_device(struct request_queue *q);
369 438
@@ -1240,19 +1309,18 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request)
1240static int grow_one_stripe(raid5_conf_t *conf) 1309static int grow_one_stripe(raid5_conf_t *conf)
1241{ 1310{
1242 struct stripe_head *sh; 1311 struct stripe_head *sh;
1243 int disks = max(conf->raid_disks, conf->previous_raid_disks);
1244 sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL); 1312 sh = kmem_cache_alloc(conf->slab_cache, GFP_KERNEL);
1245 if (!sh) 1313 if (!sh)
1246 return 0; 1314 return 0;
1247 memset(sh, 0, sizeof(*sh) + (disks-1)*sizeof(struct r5dev)); 1315 memset(sh, 0, sizeof(*sh) + (conf->pool_size-1)*sizeof(struct r5dev));
1248 sh->raid_conf = conf; 1316 sh->raid_conf = conf;
1249 spin_lock_init(&sh->lock); 1317 spin_lock_init(&sh->lock);
1250 #ifdef CONFIG_MULTICORE_RAID456 1318 #ifdef CONFIG_MULTICORE_RAID456
1251 init_waitqueue_head(&sh->ops.wait_for_ops); 1319 init_waitqueue_head(&sh->ops.wait_for_ops);
1252 #endif 1320 #endif
1253 1321
1254 if (grow_buffers(sh, disks)) { 1322 if (grow_buffers(sh)) {
1255 shrink_buffers(sh, disks); 1323 shrink_buffers(sh);
1256 kmem_cache_free(conf->slab_cache, sh); 1324 kmem_cache_free(conf->slab_cache, sh);
1257 return 0; 1325 return 0;
1258 } 1326 }
@@ -1468,7 +1536,7 @@ static int drop_one_stripe(raid5_conf_t *conf)
1468 if (!sh) 1536 if (!sh)
1469 return 0; 1537 return 0;
1470 BUG_ON(atomic_read(&sh->count)); 1538 BUG_ON(atomic_read(&sh->count));
1471 shrink_buffers(sh, conf->pool_size); 1539 shrink_buffers(sh);
1472 kmem_cache_free(conf->slab_cache, sh); 1540 kmem_cache_free(conf->slab_cache, sh);
1473 atomic_dec(&conf->active_stripes); 1541 atomic_dec(&conf->active_stripes);
1474 return 1; 1542 return 1;
@@ -2963,7 +3031,6 @@ static void handle_stripe5(struct stripe_head *sh)
2963 mdk_rdev_t *rdev; 3031 mdk_rdev_t *rdev;
2964 3032
2965 dev = &sh->dev[i]; 3033 dev = &sh->dev[i];
2966 clear_bit(R5_Insync, &dev->flags);
2967 3034
2968 pr_debug("check %d: state 0x%lx toread %p read %p write %p " 3035 pr_debug("check %d: state 0x%lx toread %p read %p write %p "
2969 "written %p\n", i, dev->flags, dev->toread, dev->read, 3036 "written %p\n", i, dev->flags, dev->toread, dev->read,
@@ -3000,17 +3067,27 @@ static void handle_stripe5(struct stripe_head *sh)
3000 blocked_rdev = rdev; 3067 blocked_rdev = rdev;
3001 atomic_inc(&rdev->nr_pending); 3068 atomic_inc(&rdev->nr_pending);
3002 } 3069 }
3003 if (!rdev || !test_bit(In_sync, &rdev->flags)) { 3070 clear_bit(R5_Insync, &dev->flags);
3071 if (!rdev)
3072 /* Not in-sync */;
3073 else if (test_bit(In_sync, &rdev->flags))
3074 set_bit(R5_Insync, &dev->flags);
3075 else {
3076 /* could be in-sync depending on recovery/reshape status */
3077 if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset)
3078 set_bit(R5_Insync, &dev->flags);
3079 }
3080 if (!test_bit(R5_Insync, &dev->flags)) {
3004 /* The ReadError flag will just be confusing now */ 3081 /* The ReadError flag will just be confusing now */
3005 clear_bit(R5_ReadError, &dev->flags); 3082 clear_bit(R5_ReadError, &dev->flags);
3006 clear_bit(R5_ReWrite, &dev->flags); 3083 clear_bit(R5_ReWrite, &dev->flags);
3007 } 3084 }
3008 if (!rdev || !test_bit(In_sync, &rdev->flags) 3085 if (test_bit(R5_ReadError, &dev->flags))
3009 || test_bit(R5_ReadError, &dev->flags)) { 3086 clear_bit(R5_Insync, &dev->flags);
3087 if (!test_bit(R5_Insync, &dev->flags)) {
3010 s.failed++; 3088 s.failed++;
3011 s.failed_num = i; 3089 s.failed_num = i;
3012 } else 3090 }
3013 set_bit(R5_Insync, &dev->flags);
3014 } 3091 }
3015 rcu_read_unlock(); 3092 rcu_read_unlock();
3016 3093
@@ -3244,7 +3321,6 @@ static void handle_stripe6(struct stripe_head *sh)
3244 for (i=disks; i--; ) { 3321 for (i=disks; i--; ) {
3245 mdk_rdev_t *rdev; 3322 mdk_rdev_t *rdev;
3246 dev = &sh->dev[i]; 3323 dev = &sh->dev[i];
3247 clear_bit(R5_Insync, &dev->flags);
3248 3324
3249 pr_debug("check %d: state 0x%lx read %p write %p written %p\n", 3325 pr_debug("check %d: state 0x%lx read %p write %p written %p\n",
3250 i, dev->flags, dev->toread, dev->towrite, dev->written); 3326 i, dev->flags, dev->toread, dev->towrite, dev->written);
@@ -3282,18 +3358,28 @@ static void handle_stripe6(struct stripe_head *sh)
3282 blocked_rdev = rdev; 3358 blocked_rdev = rdev;
3283 atomic_inc(&rdev->nr_pending); 3359 atomic_inc(&rdev->nr_pending);
3284 } 3360 }
3285 if (!rdev || !test_bit(In_sync, &rdev->flags)) { 3361 clear_bit(R5_Insync, &dev->flags);
3362 if (!rdev)
3363 /* Not in-sync */;
3364 else if (test_bit(In_sync, &rdev->flags))
3365 set_bit(R5_Insync, &dev->flags);
3366 else {
3367 /* in sync if before recovery_offset */
3368 if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset)
3369 set_bit(R5_Insync, &dev->flags);
3370 }
3371 if (!test_bit(R5_Insync, &dev->flags)) {
3286 /* The ReadError flag will just be confusing now */ 3372 /* The ReadError flag will just be confusing now */
3287 clear_bit(R5_ReadError, &dev->flags); 3373 clear_bit(R5_ReadError, &dev->flags);
3288 clear_bit(R5_ReWrite, &dev->flags); 3374 clear_bit(R5_ReWrite, &dev->flags);
3289 } 3375 }
3290 if (!rdev || !test_bit(In_sync, &rdev->flags) 3376 if (test_bit(R5_ReadError, &dev->flags))
3291 || test_bit(R5_ReadError, &dev->flags)) { 3377 clear_bit(R5_Insync, &dev->flags);
3378 if (!test_bit(R5_Insync, &dev->flags)) {
3292 if (s.failed < 2) 3379 if (s.failed < 2)
3293 r6s.failed_num[s.failed] = i; 3380 r6s.failed_num[s.failed] = i;
3294 s.failed++; 3381 s.failed++;
3295 } else 3382 }
3296 set_bit(R5_Insync, &dev->flags);
3297 } 3383 }
3298 rcu_read_unlock(); 3384 rcu_read_unlock();
3299 3385
@@ -4971,8 +5057,10 @@ static int run(mddev_t *mddev)
4971 list_for_each_entry(rdev, &mddev->disks, same_set) { 5057 list_for_each_entry(rdev, &mddev->disks, same_set) {
4972 if (rdev->raid_disk < 0) 5058 if (rdev->raid_disk < 0)
4973 continue; 5059 continue;
4974 if (test_bit(In_sync, &rdev->flags)) 5060 if (test_bit(In_sync, &rdev->flags)) {
4975 working_disks++; 5061 working_disks++;
5062 continue;
5063 }
4976 /* This disc is not fully in-sync. However if it 5064 /* This disc is not fully in-sync. However if it
4977 * just stored parity (beyond the recovery_offset), 5065 * just stored parity (beyond the recovery_offset),
4978 * when we don't need to be concerned about the 5066 * when we don't need to be concerned about the
@@ -5005,7 +5093,7 @@ static int run(mddev_t *mddev)
5005 mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks) 5093 mddev->degraded = (max(conf->raid_disks, conf->previous_raid_disks)
5006 - working_disks); 5094 - working_disks);
5007 5095
5008 if (mddev->degraded > conf->max_degraded) { 5096 if (has_failed(conf)) {
5009 printk(KERN_ERR "md/raid:%s: not enough operational devices" 5097 printk(KERN_ERR "md/raid:%s: not enough operational devices"
5010 " (%d/%d failed)\n", 5098 " (%d/%d failed)\n",
5011 mdname(mddev), mddev->degraded, conf->raid_disks); 5099 mdname(mddev), mddev->degraded, conf->raid_disks);
@@ -5207,6 +5295,7 @@ static int raid5_spare_active(mddev_t *mddev)
5207 for (i = 0; i < conf->raid_disks; i++) { 5295 for (i = 0; i < conf->raid_disks; i++) {
5208 tmp = conf->disks + i; 5296 tmp = conf->disks + i;
5209 if (tmp->rdev 5297 if (tmp->rdev
5298 && tmp->rdev->recovery_offset == MaxSector
5210 && !test_bit(Faulty, &tmp->rdev->flags) 5299 && !test_bit(Faulty, &tmp->rdev->flags)
5211 && !test_and_set_bit(In_sync, &tmp->rdev->flags)) { 5300 && !test_and_set_bit(In_sync, &tmp->rdev->flags)) {
5212 unsigned long flags; 5301 unsigned long flags;
@@ -5242,7 +5331,7 @@ static int raid5_remove_disk(mddev_t *mddev, int number)
5242 * isn't possible. 5331 * isn't possible.
5243 */ 5332 */
5244 if (!test_bit(Faulty, &rdev->flags) && 5333 if (!test_bit(Faulty, &rdev->flags) &&
5245 mddev->degraded <= conf->max_degraded && 5334 !has_failed(conf) &&
5246 number < conf->raid_disks) { 5335 number < conf->raid_disks) {
5247 err = -EBUSY; 5336 err = -EBUSY;
5248 goto abort; 5337 goto abort;
@@ -5270,7 +5359,7 @@ static int raid5_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
5270 int first = 0; 5359 int first = 0;
5271 int last = conf->raid_disks - 1; 5360 int last = conf->raid_disks - 1;
5272 5361
5273 if (mddev->degraded > conf->max_degraded) 5362 if (has_failed(conf))
5274 /* no point adding a device */ 5363 /* no point adding a device */
5275 return -EINVAL; 5364 return -EINVAL;
5276 5365
@@ -5362,7 +5451,7 @@ static int check_reshape(mddev_t *mddev)
5362 if (mddev->bitmap) 5451 if (mddev->bitmap)
5363 /* Cannot grow a bitmap yet */ 5452 /* Cannot grow a bitmap yet */
5364 return -EBUSY; 5453 return -EBUSY;
5365 if (mddev->degraded > conf->max_degraded) 5454 if (has_failed(conf))
5366 return -EINVAL; 5455 return -EINVAL;
5367 if (mddev->delta_disks < 0) { 5456 if (mddev->delta_disks < 0) {
5368 /* We might be able to shrink, but the devices must 5457 /* We might be able to shrink, but the devices must
@@ -5437,8 +5526,13 @@ static int raid5_start_reshape(mddev_t *mddev)
5437 5526
5438 /* Add some new drives, as many as will fit. 5527 /* Add some new drives, as many as will fit.
5439 * We know there are enough to make the newly sized array work. 5528 * We know there are enough to make the newly sized array work.
5529 * Don't add devices if we are reducing the number of
5530 * devices in the array. This is because it is not possible
5531 * to correctly record the "partially reconstructed" state of
5532 * such devices during the reshape and confusion could result.
5440 */ 5533 */
5441 list_for_each_entry(rdev, &mddev->disks, same_set) 5534 if (mddev->delta_disks >= 0)
5535 list_for_each_entry(rdev, &mddev->disks, same_set)
5442 if (rdev->raid_disk < 0 && 5536 if (rdev->raid_disk < 0 &&
5443 !test_bit(Faulty, &rdev->flags)) { 5537 !test_bit(Faulty, &rdev->flags)) {
5444 if (raid5_add_disk(mddev, rdev) == 0) { 5538 if (raid5_add_disk(mddev, rdev) == 0) {
@@ -5460,7 +5554,7 @@ static int raid5_start_reshape(mddev_t *mddev)
5460 } 5554 }
5461 5555
5462 /* When a reshape changes the number of devices, ->degraded 5556 /* When a reshape changes the number of devices, ->degraded
5463 * is measured against the large of the pre and post number of 5557 * is measured against the larger of the pre and post number of
5464 * devices.*/ 5558 * devices.*/
5465 if (mddev->delta_disks > 0) { 5559 if (mddev->delta_disks > 0) {
5466 spin_lock_irqsave(&conf->device_lock, flags); 5560 spin_lock_irqsave(&conf->device_lock, flags);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 2decc597bda7..ce2fcdd4ab90 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2754,6 +2754,7 @@ config MYRI10GE_DCA
2754config NETXEN_NIC 2754config NETXEN_NIC
2755 tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC" 2755 tristate "NetXen Multi port (1/10) Gigabit Ethernet NIC"
2756 depends on PCI 2756 depends on PCI
2757 select FW_LOADER
2757 help 2758 help
2758 This enables the support for NetXen's Gigabit Ethernet card. 2759 This enables the support for NetXen's Gigabit Ethernet card.
2759 2760
@@ -2819,6 +2820,7 @@ config BNX2X
2819config QLCNIC 2820config QLCNIC
2820 tristate "QLOGIC QLCNIC 1/10Gb Converged Ethernet NIC Support" 2821 tristate "QLOGIC QLCNIC 1/10Gb Converged Ethernet NIC Support"
2821 depends on PCI 2822 depends on PCI
2823 select FW_LOADER
2822 help 2824 help
2823 This driver supports QLogic QLE8240 and QLE8242 Converged Ethernet 2825 This driver supports QLogic QLE8240 and QLE8242 Converged Ethernet
2824 devices. 2826 devices.
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 949d7a9dcf92..117432222a09 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3073,7 +3073,6 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3073 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; 3073 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
3074 struct l2_fhdr *rx_hdr; 3074 struct l2_fhdr *rx_hdr;
3075 int rx_pkt = 0, pg_ring_used = 0; 3075 int rx_pkt = 0, pg_ring_used = 0;
3076 struct pci_dev *pdev = bp->pdev;
3077 3076
3078 hw_cons = bnx2_get_hw_rx_cons(bnapi); 3077 hw_cons = bnx2_get_hw_rx_cons(bnapi);
3079 sw_cons = rxr->rx_cons; 3078 sw_cons = rxr->rx_cons;
@@ -3099,12 +3098,10 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3099 skb = rx_buf->skb; 3098 skb = rx_buf->skb;
3100 prefetchw(skb); 3099 prefetchw(skb);
3101 3100
3102 if (!get_dma_ops(&pdev->dev)->sync_single_for_cpu) { 3101 next_rx_buf =
3103 next_rx_buf = 3102 &rxr->rx_buf_ring[RX_RING_IDX(NEXT_RX_BD(sw_cons))];
3104 &rxr->rx_buf_ring[ 3103 prefetch(next_rx_buf->desc);
3105 RX_RING_IDX(NEXT_RX_BD(sw_cons))]; 3104
3106 prefetch(next_rx_buf->desc);
3107 }
3108 rx_buf->skb = NULL; 3105 rx_buf->skb = NULL;
3109 3106
3110 dma_addr = dma_unmap_addr(rx_buf, mapping); 3107 dma_addr = dma_unmap_addr(rx_buf, mapping);
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index fe925663d39a..80471269977a 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -3919,8 +3919,9 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev)
3919 HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS; 3919 HC_INDEX_DEF_C_ETH_ISCSI_CQ_CONS;
3920 context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID; 3920 context->cstorm_st_context.status_block_id = BNX2X_DEF_SB_ID;
3921 3921
3922 context->xstorm_st_context.statistics_data = (cli | 3922 if (cli < MAX_X_STAT_COUNTER_ID)
3923 XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE); 3923 context->xstorm_st_context.statistics_data = cli |
3924 XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE;
3924 3925
3925 context->xstorm_ag_context.cdu_reserved = 3926 context->xstorm_ag_context.cdu_reserved =
3926 CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func), 3927 CDU_RSRVD_VALUE_TYPE_A(BNX2X_HW_CID(BNX2X_ISCSI_L2_CID, func),
@@ -3928,10 +3929,12 @@ static void cnic_init_bnx2x_tx_ring(struct cnic_dev *dev)
3928 ETH_CONNECTION_TYPE); 3929 ETH_CONNECTION_TYPE);
3929 3930
3930 /* reset xstorm per client statistics */ 3931 /* reset xstorm per client statistics */
3931 val = BAR_XSTRORM_INTMEM + 3932 if (cli < MAX_X_STAT_COUNTER_ID) {
3932 XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); 3933 val = BAR_XSTRORM_INTMEM +
3933 for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) 3934 XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
3934 CNIC_WR(dev, val + i * 4, 0); 3935 for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++)
3936 CNIC_WR(dev, val + i * 4, 0);
3937 }
3935 3938
3936 cp->tx_cons_ptr = 3939 cp->tx_cons_ptr =
3937 &cp->bnx2x_def_status_blk->c_def_status_block.index_values[ 3940 &cp->bnx2x_def_status_blk->c_def_status_block.index_values[
@@ -3978,9 +3981,11 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
3978 BNX2X_ISCSI_RX_SB_INDEX_NUM; 3981 BNX2X_ISCSI_RX_SB_INDEX_NUM;
3979 context->ustorm_st_context.common.clientId = cli; 3982 context->ustorm_st_context.common.clientId = cli;
3980 context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID; 3983 context->ustorm_st_context.common.status_block_id = BNX2X_DEF_SB_ID;
3981 context->ustorm_st_context.common.flags = 3984 if (cli < MAX_U_STAT_COUNTER_ID) {
3982 USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS; 3985 context->ustorm_st_context.common.flags =
3983 context->ustorm_st_context.common.statistics_counter_id = cli; 3986 USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS;
3987 context->ustorm_st_context.common.statistics_counter_id = cli;
3988 }
3984 context->ustorm_st_context.common.mc_alignment_log_size = 0; 3989 context->ustorm_st_context.common.mc_alignment_log_size = 0;
3985 context->ustorm_st_context.common.bd_buff_size = 3990 context->ustorm_st_context.common.bd_buff_size =
3986 cp->l2_single_buf_size; 3991 cp->l2_single_buf_size;
@@ -4011,10 +4016,13 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
4011 4016
4012 /* client tstorm info */ 4017 /* client tstorm info */
4013 tstorm_client.mtu = cp->l2_single_buf_size - 14; 4018 tstorm_client.mtu = cp->l2_single_buf_size - 14;
4014 tstorm_client.config_flags = 4019 tstorm_client.config_flags = TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE;
4015 (TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE | 4020
4016 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE); 4021 if (cli < MAX_T_STAT_COUNTER_ID) {
4017 tstorm_client.statistics_counter_id = cli; 4022 tstorm_client.config_flags |=
4023 TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE;
4024 tstorm_client.statistics_counter_id = cli;
4025 }
4018 4026
4019 CNIC_WR(dev, BAR_TSTRORM_INTMEM + 4027 CNIC_WR(dev, BAR_TSTRORM_INTMEM +
4020 TSTORM_CLIENT_CONFIG_OFFSET(port, cli), 4028 TSTORM_CLIENT_CONFIG_OFFSET(port, cli),
@@ -4024,16 +4032,21 @@ static void cnic_init_bnx2x_rx_ring(struct cnic_dev *dev)
4024 ((u32 *)&tstorm_client)[1]); 4032 ((u32 *)&tstorm_client)[1]);
4025 4033
4026 /* reset tstorm per client statistics */ 4034 /* reset tstorm per client statistics */
4027 val = BAR_TSTRORM_INTMEM + 4035 if (cli < MAX_T_STAT_COUNTER_ID) {
4028 TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); 4036
4029 for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) 4037 val = BAR_TSTRORM_INTMEM +
4030 CNIC_WR(dev, val + i * 4, 0); 4038 TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
4039 for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++)
4040 CNIC_WR(dev, val + i * 4, 0);
4041 }
4031 4042
4032 /* reset ustorm per client statistics */ 4043 /* reset ustorm per client statistics */
4033 val = BAR_USTRORM_INTMEM + 4044 if (cli < MAX_U_STAT_COUNTER_ID) {
4034 USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli); 4045 val = BAR_USTRORM_INTMEM +
4035 for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++) 4046 USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cli);
4036 CNIC_WR(dev, val + i * 4, 0); 4047 for (i = 0; i < sizeof(struct ustorm_per_client_stats) / 4; i++)
4048 CNIC_WR(dev, val + i * 4, 0);
4049 }
4037 4050
4038 cp->rx_cons_ptr = 4051 cp->rx_cons_ptr =
4039 &cp->bnx2x_def_status_blk->u_def_status_block.index_values[ 4052 &cp->bnx2x_def_status_blk->u_def_status_block.index_values[
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 3c58db595285..23786ee34bed 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -1181,7 +1181,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1181 if (netif_msg_drv(priv)) 1181 if (netif_msg_drv(priv))
1182 printk(KERN_ERR "%s: Could not attach to PHY\n", 1182 printk(KERN_ERR "%s: Could not attach to PHY\n",
1183 dev->name); 1183 dev->name);
1184 return PTR_ERR(priv->phy); 1184 rc = PTR_ERR(priv->phy);
1185 goto fail;
1185 } 1186 }
1186 1187
1187 if ((rc = register_netdev(dev))) { 1188 if ((rc = register_netdev(dev))) {
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ebdea0891665..68a80893dce1 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1047,15 +1047,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1047 goto err_register; 1047 goto err_register;
1048 1048
1049 /* print bus type/speed/width info */ 1049 /* print bus type/speed/width info */
1050 e_info("(PCI%s:%s:%s) ", 1050 e_info("(PCI%s:%dMHz:%d-bit) %pM\n",
1051 ((hw->bus_type == e1000_bus_type_pcix) ? "-X" : ""), 1051 ((hw->bus_type == e1000_bus_type_pcix) ? "-X" : ""),
1052 ((hw->bus_speed == e1000_bus_speed_133) ? "133MHz" : 1052 ((hw->bus_speed == e1000_bus_speed_133) ? 133 :
1053 (hw->bus_speed == e1000_bus_speed_120) ? "120MHz" : 1053 (hw->bus_speed == e1000_bus_speed_120) ? 120 :
1054 (hw->bus_speed == e1000_bus_speed_100) ? "100MHz" : 1054 (hw->bus_speed == e1000_bus_speed_100) ? 100 :
1055 (hw->bus_speed == e1000_bus_speed_66) ? "66MHz" : "33MHz"), 1055 (hw->bus_speed == e1000_bus_speed_66) ? 66 : 33),
1056 ((hw->bus_width == e1000_bus_width_64) ? "64-bit" : "32-bit")); 1056 ((hw->bus_width == e1000_bus_width_64) ? 64 : 32),
1057 1057 netdev->dev_addr);
1058 e_info("%pM\n", netdev->dev_addr);
1059 1058
1060 /* carrier off reporting is important to ethtool even BEFORE open */ 1059 /* carrier off reporting is important to ethtool even BEFORE open */
1061 netif_carrier_off(netdev); 1060 netif_carrier_off(netdev);
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 0630980a2722..0060e422f171 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_0103" 43#define DRV_VERSION "EHEA_0105"
44 44
45/* eHEA capability flags */ 45/* eHEA capability flags */
46#define DLPAR_PORT_ADD_REM 1 46#define DLPAR_PORT_ADD_REM 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index f547894ff48f..8b92acb448c2 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -867,6 +867,7 @@ static int ehea_poll(struct napi_struct *napi, int budget)
867 ehea_reset_cq_ep(pr->send_cq); 867 ehea_reset_cq_ep(pr->send_cq);
868 ehea_reset_cq_n1(pr->recv_cq); 868 ehea_reset_cq_n1(pr->recv_cq);
869 ehea_reset_cq_n1(pr->send_cq); 869 ehea_reset_cq_n1(pr->send_cq);
870 rmb();
870 cqe = ehea_poll_rq1(pr->qp, &wqe_index); 871 cqe = ehea_poll_rq1(pr->qp, &wqe_index);
871 cqe_skb = ehea_poll_cq(pr->send_cq); 872 cqe_skb = ehea_poll_cq(pr->send_cq);
872 873
@@ -2859,6 +2860,7 @@ static void ehea_reset_port(struct work_struct *work)
2859 container_of(work, struct ehea_port, reset_task); 2860 container_of(work, struct ehea_port, reset_task);
2860 struct net_device *dev = port->netdev; 2861 struct net_device *dev = port->netdev;
2861 2862
2863 mutex_lock(&dlpar_mem_lock);
2862 port->resets++; 2864 port->resets++;
2863 mutex_lock(&port->port_lock); 2865 mutex_lock(&port->port_lock);
2864 netif_stop_queue(dev); 2866 netif_stop_queue(dev);
@@ -2881,6 +2883,7 @@ static void ehea_reset_port(struct work_struct *work)
2881 netif_wake_queue(dev); 2883 netif_wake_queue(dev);
2882out: 2884out:
2883 mutex_unlock(&port->port_lock); 2885 mutex_unlock(&port->port_lock);
2886 mutex_unlock(&dlpar_mem_lock);
2884} 2887}
2885 2888
2886static void ehea_rereg_mrs(struct work_struct *work) 2889static void ehea_rereg_mrs(struct work_struct *work)
@@ -3542,10 +3545,7 @@ static int ehea_mem_notifier(struct notifier_block *nb,
3542 int ret = NOTIFY_BAD; 3545 int ret = NOTIFY_BAD;
3543 struct memory_notify *arg = data; 3546 struct memory_notify *arg = data;
3544 3547
3545 if (!mutex_trylock(&dlpar_mem_lock)) { 3548 mutex_lock(&dlpar_mem_lock);
3546 ehea_info("ehea_mem_notifier must not be called parallelized");
3547 goto out;
3548 }
3549 3549
3550 switch (action) { 3550 switch (action) {
3551 case MEM_CANCEL_OFFLINE: 3551 case MEM_CANCEL_OFFLINE:
@@ -3574,7 +3574,6 @@ static int ehea_mem_notifier(struct notifier_block *nb,
3574 3574
3575out_unlock: 3575out_unlock:
3576 mutex_unlock(&dlpar_mem_lock); 3576 mutex_unlock(&dlpar_mem_lock);
3577out:
3578 return ret; 3577 return ret;
3579} 3578}
3580 3579
diff --git a/drivers/net/enic/vnic_dev.c b/drivers/net/enic/vnic_dev.c
index 2b3e16db5c82..e0d33281ec98 100644
--- a/drivers/net/enic/vnic_dev.c
+++ b/drivers/net/enic/vnic_dev.c
@@ -709,7 +709,7 @@ int vnic_dev_init_prov(struct vnic_dev *vdev, u8 *buf, u32 len)
709{ 709{
710 u64 a0, a1 = len; 710 u64 a0, a1 = len;
711 int wait = 1000; 711 int wait = 1000;
712 u64 prov_pa; 712 dma_addr_t prov_pa;
713 void *prov_buf; 713 void *prov_buf;
714 int ret; 714 int ret;
715 715
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 46c69cd06553..28b53d1cd4f1 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -381,10 +381,14 @@ static void gfar_init_mac(struct net_device *ndev)
381 /* Insert receive time stamps into padding alignment bytes */ 381 /* Insert receive time stamps into padding alignment bytes */
382 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) { 382 if (priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER) {
383 rctrl &= ~RCTRL_PAL_MASK; 383 rctrl &= ~RCTRL_PAL_MASK;
384 rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE | RCTRL_PADDING(8); 384 rctrl |= RCTRL_PADDING(8);
385 priv->padding = 8; 385 priv->padding = 8;
386 } 386 }
387 387
388 /* Enable HW time stamping if requested from user space */
389 if (priv->hwts_rx_en)
390 rctrl |= RCTRL_PRSDEP_INIT | RCTRL_TS_ENABLE;
391
388 /* keep vlan related bits if it's enabled */ 392 /* keep vlan related bits if it's enabled */
389 if (priv->vlgrp) { 393 if (priv->vlgrp) {
390 rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT; 394 rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
@@ -747,7 +751,8 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
747 FSL_GIANFAR_DEV_HAS_CSUM | 751 FSL_GIANFAR_DEV_HAS_CSUM |
748 FSL_GIANFAR_DEV_HAS_VLAN | 752 FSL_GIANFAR_DEV_HAS_VLAN |
749 FSL_GIANFAR_DEV_HAS_MAGIC_PACKET | 753 FSL_GIANFAR_DEV_HAS_MAGIC_PACKET |
750 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; 754 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH |
755 FSL_GIANFAR_DEV_HAS_TIMER;
751 756
752 ctype = of_get_property(np, "phy-connection-type", NULL); 757 ctype = of_get_property(np, "phy-connection-type", NULL);
753 758
@@ -805,12 +810,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev,
805 810
806 switch (config.rx_filter) { 811 switch (config.rx_filter) {
807 case HWTSTAMP_FILTER_NONE: 812 case HWTSTAMP_FILTER_NONE:
808 priv->hwts_rx_en = 0; 813 if (priv->hwts_rx_en) {
814 stop_gfar(netdev);
815 priv->hwts_rx_en = 0;
816 startup_gfar(netdev);
817 }
809 break; 818 break;
810 default: 819 default:
811 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER)) 820 if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_TIMER))
812 return -ERANGE; 821 return -ERANGE;
813 priv->hwts_rx_en = 1; 822 if (!priv->hwts_rx_en) {
823 stop_gfar(netdev);
824 priv->hwts_rx_en = 1;
825 startup_gfar(netdev);
826 }
814 config.rx_filter = HWTSTAMP_FILTER_ALL; 827 config.rx_filter = HWTSTAMP_FILTER_ALL;
815 break; 828 break;
816 } 829 }
@@ -2642,6 +2655,10 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
2642 dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, 2655 dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr,
2643 priv->rx_buffer_size, DMA_FROM_DEVICE); 2656 priv->rx_buffer_size, DMA_FROM_DEVICE);
2644 2657
2658 if (unlikely(!(bdp->status & RXBD_ERR) &&
2659 bdp->length > priv->rx_buffer_size))
2660 bdp->status = RXBD_LARGE;
2661
2645 /* We drop the frame if we failed to allocate a new buffer */ 2662 /* We drop the frame if we failed to allocate a new buffer */
2646 if (unlikely(!newskb || !(bdp->status & RXBD_LAST) || 2663 if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
2647 bdp->status & RXBD_ERR)) { 2664 bdp->status & RXBD_ERR)) {
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index c50a7541ffec..3a93a81872b8 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -2077,25 +2077,6 @@ static int ixgbe_get_coalesce(struct net_device *netdev,
2077 return 0; 2077 return 0;
2078} 2078}
2079 2079
2080/*
2081 * this function must be called before setting the new value of
2082 * rx_itr_setting
2083 */
2084static bool ixgbe_reenable_rsc(struct ixgbe_adapter *adapter,
2085 struct ethtool_coalesce *ec)
2086{
2087 /* check the old value and enable RSC if necessary */
2088 if ((adapter->rx_itr_setting == 0) &&
2089 (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) {
2090 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
2091 adapter->netdev->features |= NETIF_F_LRO;
2092 DPRINTK(PROBE, INFO, "rx-usecs set to %d, re-enabling RSC\n",
2093 ec->rx_coalesce_usecs);
2094 return true;
2095 }
2096 return false;
2097}
2098
2099static int ixgbe_set_coalesce(struct net_device *netdev, 2080static int ixgbe_set_coalesce(struct net_device *netdev,
2100 struct ethtool_coalesce *ec) 2081 struct ethtool_coalesce *ec)
2101{ 2082{
@@ -2124,9 +2105,6 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
2124 (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE)) 2105 (1000000/ec->rx_coalesce_usecs < IXGBE_MIN_INT_RATE))
2125 return -EINVAL; 2106 return -EINVAL;
2126 2107
2127 /* check the old value and enable RSC if necessary */
2128 need_reset = ixgbe_reenable_rsc(adapter, ec);
2129
2130 /* store the value in ints/second */ 2108 /* store the value in ints/second */
2131 adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs; 2109 adapter->rx_eitr_param = 1000000/ec->rx_coalesce_usecs;
2132 2110
@@ -2135,9 +2113,6 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
2135 /* clear the lower bit as its used for dynamic state */ 2113 /* clear the lower bit as its used for dynamic state */
2136 adapter->rx_itr_setting &= ~1; 2114 adapter->rx_itr_setting &= ~1;
2137 } else if (ec->rx_coalesce_usecs == 1) { 2115 } else if (ec->rx_coalesce_usecs == 1) {
2138 /* check the old value and enable RSC if necessary */
2139 need_reset = ixgbe_reenable_rsc(adapter, ec);
2140
2141 /* 1 means dynamic mode */ 2116 /* 1 means dynamic mode */
2142 adapter->rx_eitr_param = 20000; 2117 adapter->rx_eitr_param = 20000;
2143 adapter->rx_itr_setting = 1; 2118 adapter->rx_itr_setting = 1;
@@ -2157,10 +2132,11 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
2157 */ 2132 */
2158 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { 2133 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
2159 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED; 2134 adapter->flags2 &= ~IXGBE_FLAG2_RSC_ENABLED;
2160 netdev->features &= ~NETIF_F_LRO; 2135 if (netdev->features & NETIF_F_LRO) {
2161 DPRINTK(PROBE, INFO, 2136 netdev->features &= ~NETIF_F_LRO;
2162 "rx-usecs set to 0, disabling RSC\n"); 2137 DPRINTK(PROBE, INFO, "rx-usecs set to 0, "
2163 2138 "disabling LRO/RSC\n");
2139 }
2164 need_reset = true; 2140 need_reset = true;
2165 } 2141 }
2166 } 2142 }
@@ -2255,6 +2231,9 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
2255 } 2231 }
2256 } else if (!adapter->rx_itr_setting) { 2232 } else if (!adapter->rx_itr_setting) {
2257 netdev->features &= ~ETH_FLAG_LRO; 2233 netdev->features &= ~ETH_FLAG_LRO;
2234 if (data & ETH_FLAG_LRO)
2235 DPRINTK(PROBE, INFO, "rx-usecs set to 0, "
2236 "LRO/RSC cannot be enabled.\n");
2258 } 2237 }
2259 } 2238 }
2260 2239
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index b2af2f67f604..ce30c62a97f7 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -5282,6 +5282,10 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)
5282 u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; 5282 u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot;
5283 u64 non_eop_descs = 0, restart_queue = 0; 5283 u64 non_eop_descs = 0, restart_queue = 0;
5284 5284
5285 if (test_bit(__IXGBE_DOWN, &adapter->state) ||
5286 test_bit(__IXGBE_RESETTING, &adapter->state))
5287 return;
5288
5285 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { 5289 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
5286 u64 rsc_count = 0; 5290 u64 rsc_count = 0;
5287 u64 rsc_flush = 0; 5291 u64 rsc_flush = 0;
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c
index 09e1911ff510..48325a5beff2 100644
--- a/drivers/net/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ixgbe/ixgbe_phy.c
@@ -575,6 +575,8 @@ s32 ixgbe_identify_sfp_module_generic(struct ixgbe_hw *hw)
575 * 4 SFP_DA_CORE1 - 82599-specific 575 * 4 SFP_DA_CORE1 - 82599-specific
576 * 5 SFP_SR/LR_CORE0 - 82599-specific 576 * 5 SFP_SR/LR_CORE0 - 82599-specific
577 * 6 SFP_SR/LR_CORE1 - 82599-specific 577 * 6 SFP_SR/LR_CORE1 - 82599-specific
578 * 7 SFP_act_lmt_DA_CORE0 - 82599-specific
579 * 8 SFP_act_lmt_DA_CORE1 - 82599-specific
578 */ 580 */
579 if (hw->mac.type == ixgbe_mac_82598EB) { 581 if (hw->mac.type == ixgbe_mac_82598EB) {
580 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE) 582 if (cable_tech & IXGBE_SFF_DA_PASSIVE_CABLE)
diff --git a/drivers/net/lib82596.c b/drivers/net/lib82596.c
index ce5d6e909218..c27f4291b350 100644
--- a/drivers/net/lib82596.c
+++ b/drivers/net/lib82596.c
@@ -1343,7 +1343,7 @@ static void set_multicast_list(struct net_device *dev)
1343 DEB(DEB_MULTI, 1343 DEB(DEB_MULTI,
1344 printk(KERN_DEBUG 1344 printk(KERN_DEBUG
1345 "%s: set multicast list, %d entries, promisc %s, allmulti %s\n", 1345 "%s: set multicast list, %d entries, promisc %s, allmulti %s\n",
1346 dev->name, dev->mc_count, 1346 dev->name, netdev_mc_count(dev),
1347 dev->flags & IFF_PROMISC ? "ON" : "OFF", 1347 dev->flags & IFF_PROMISC ? "ON" : "OFF",
1348 dev->flags & IFF_ALLMULTI ? "ON" : "OFF")); 1348 dev->flags & IFF_ALLMULTI ? "ON" : "OFF"));
1349 1349
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index 8e9704f5c122..869f0ea43a5b 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -247,7 +247,7 @@ static const struct net_device_ops mipsnet_netdev_ops = {
247 .ndo_set_mac_address = eth_mac_addr, 247 .ndo_set_mac_address = eth_mac_addr,
248}; 248};
249 249
250static int __init mipsnet_probe(struct platform_device *dev) 250static int __devinit mipsnet_probe(struct platform_device *dev)
251{ 251{
252 struct net_device *netdev; 252 struct net_device *netdev;
253 int err; 253 int err;
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c
index f26e54716c88..3a41b6a84a68 100644
--- a/drivers/net/netxen/netxen_nic_ctx.c
+++ b/drivers/net/netxen/netxen_nic_ctx.c
@@ -629,7 +629,8 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter)
629 if (addr == NULL) { 629 if (addr == NULL) {
630 dev_err(&pdev->dev, "%s: failed to allocate tx desc ring\n", 630 dev_err(&pdev->dev, "%s: failed to allocate tx desc ring\n",
631 netdev->name); 631 netdev->name);
632 return -ENOMEM; 632 err = -ENOMEM;
633 goto err_out_free;
633 } 634 }
634 635
635 tx_ring->desc_head = (struct cmd_desc_type0 *)addr; 636 tx_ring->desc_head = (struct cmd_desc_type0 *)addr;
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 5c496f8d7c49..29d7b93d0493 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1159,9 +1159,6 @@ netxen_nic_pci_set_crbwindow_2M(struct netxen_adapter *adapter, ulong off)
1159 1159
1160 window = CRB_HI(off); 1160 window = CRB_HI(off);
1161 1161
1162 if (adapter->ahw.crb_win == window)
1163 return;
1164
1165 writel(window, addr); 1162 writel(window, addr);
1166 if (readl(addr) != window) { 1163 if (readl(addr) != window) {
1167 if (printk_ratelimit()) 1164 if (printk_ratelimit())
@@ -1169,7 +1166,6 @@ netxen_nic_pci_set_crbwindow_2M(struct netxen_adapter *adapter, ulong off)
1169 "failed to set CRB window to %d off 0x%lx\n", 1166 "failed to set CRB window to %d off 0x%lx\n",
1170 window, off); 1167 window, off);
1171 } 1168 }
1172 adapter->ahw.crb_win = window;
1173} 1169}
1174 1170
1175static void __iomem * 1171static void __iomem *
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 045a7c8f5bdf..c865dda2adf1 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -218,7 +218,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
218 if (cmd_buf_arr == NULL) { 218 if (cmd_buf_arr == NULL) {
219 dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n", 219 dev_err(&pdev->dev, "%s: failed to allocate cmd buffer ring\n",
220 netdev->name); 220 netdev->name);
221 return -ENOMEM; 221 goto err_out;
222 } 222 }
223 memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring)); 223 memset(cmd_buf_arr, 0, TX_BUFF_RINGSIZE(tx_ring));
224 tx_ring->cmd_buf_arr = cmd_buf_arr; 224 tx_ring->cmd_buf_arr = cmd_buf_arr;
@@ -230,7 +230,7 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter)
230 if (rds_ring == NULL) { 230 if (rds_ring == NULL) {
231 dev_err(&pdev->dev, "%s: failed to allocate rds ring struct\n", 231 dev_err(&pdev->dev, "%s: failed to allocate rds ring struct\n",
232 netdev->name); 232 netdev->name);
233 return -ENOMEM; 233 goto err_out;
234 } 234 }
235 recv_ctx->rds_rings = rds_ring; 235 recv_ctx->rds_rings = rds_ring;
236 236
@@ -1805,9 +1805,10 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1805 netxen_ctx_msg msg = 0; 1805 netxen_ctx_msg msg = 0;
1806 struct list_head *head; 1806 struct list_head *head;
1807 1807
1808 spin_lock(&rds_ring->lock);
1809
1808 producer = rds_ring->producer; 1810 producer = rds_ring->producer;
1809 1811
1810 spin_lock(&rds_ring->lock);
1811 head = &rds_ring->free_list; 1812 head = &rds_ring->free_list;
1812 while (!list_empty(head)) { 1813 while (!list_empty(head)) {
1813 1814
@@ -1829,7 +1830,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1829 1830
1830 producer = get_next_index(producer, rds_ring->num_desc); 1831 producer = get_next_index(producer, rds_ring->num_desc);
1831 } 1832 }
1832 spin_unlock(&rds_ring->lock);
1833 1833
1834 if (count) { 1834 if (count) {
1835 rds_ring->producer = producer; 1835 rds_ring->producer = producer;
@@ -1853,6 +1853,8 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
1853 NETXEN_RCV_PRODUCER_OFFSET), msg); 1853 NETXEN_RCV_PRODUCER_OFFSET), msg);
1854 } 1854 }
1855 } 1855 }
1856
1857 spin_unlock(&rds_ring->lock);
1856} 1858}
1857 1859
1858static void 1860static void
@@ -1864,10 +1866,11 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter,
1864 int producer, count = 0; 1866 int producer, count = 0;
1865 struct list_head *head; 1867 struct list_head *head;
1866 1868
1867 producer = rds_ring->producer;
1868 if (!spin_trylock(&rds_ring->lock)) 1869 if (!spin_trylock(&rds_ring->lock))
1869 return; 1870 return;
1870 1871
1872 producer = rds_ring->producer;
1873
1871 head = &rds_ring->free_list; 1874 head = &rds_ring->free_list;
1872 while (!list_empty(head)) { 1875 while (!list_empty(head)) {
1873 1876
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 6f77a768ba88..bfdef72c5d5e 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1727,6 +1727,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1727 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"), 1727 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"),
1728 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"), 1728 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"),
1729 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"), 1729 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"),
1730 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "TOSHIBA", "Modem/LAN Card", 0xb4585a1a, 0x53f922f8, "cis/PCMLM28.cis"),
1730 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"), 1731 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"),
1731 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), 1732 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"),
1732 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"), 1733 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "cis/DP83903.cis"),
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 64e6a84bbbbe..307cd1721e91 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1505,12 +1505,20 @@ irq_done:
1505 writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR); 1505 writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR);
1506 writeb(cor, smc->base + MOT_LAN + CISREG_COR); 1506 writeb(cor, smc->base + MOT_LAN + CISREG_COR);
1507 } 1507 }
1508#ifdef DOES_NOT_WORK 1508
1509 if (smc->base != NULL) { /* Megahertz MFC's */ 1509 if ((smc->base != NULL) && /* Megahertz MFC's */
1510 readb(smc->base+MEGAHERTZ_ISR); 1510 (smc->manfid == MANFID_MEGAHERTZ) &&
1511 readb(smc->base+MEGAHERTZ_ISR); 1511 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) {
1512
1513 u_char tmp;
1514 tmp = readb(smc->base+MEGAHERTZ_ISR);
1515 tmp = readb(smc->base+MEGAHERTZ_ISR);
1516
1517 /* Retrigger interrupt if needed */
1518 writeb(tmp, smc->base + MEGAHERTZ_ISR);
1519 writeb(tmp, smc->base + MEGAHERTZ_ISR);
1512 } 1520 }
1513#endif 1521
1514 spin_unlock(&smc->lock); 1522 spin_unlock(&smc->lock);
1515 return IRQ_RETVAL(handled); 1523 return IRQ_RETVAL(handled);
1516} 1524}
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c
index dbd003453737..29c39ff85de5 100644
--- a/drivers/net/phy/lxt.c
+++ b/drivers/net/phy/lxt.c
@@ -226,6 +226,7 @@ module_exit(lxt_exit);
226static struct mdio_device_id lxt_tbl[] = { 226static struct mdio_device_id lxt_tbl[] = {
227 { 0x78100000, 0xfffffff0 }, 227 { 0x78100000, 0xfffffff0 },
228 { 0x001378e0, 0xfffffff0 }, 228 { 0x001378e0, 0xfffffff0 },
229 { 0x00137a10, 0xfffffff0 },
229 { } 230 { }
230}; 231};
231 232
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 2111c7bbf578..7985165e84fc 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -717,11 +717,24 @@ static void sky2_phy_power_down(struct sky2_hw *hw, unsigned port)
717 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); 717 sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
718} 718}
719 719
720/* Enable Rx/Tx */
721static void sky2_enable_rx_tx(struct sky2_port *sky2)
722{
723 struct sky2_hw *hw = sky2->hw;
724 unsigned port = sky2->port;
725 u16 reg;
726
727 reg = gma_read16(hw, port, GM_GP_CTRL);
728 reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
729 gma_write16(hw, port, GM_GP_CTRL, reg);
730}
731
720/* Force a renegotiation */ 732/* Force a renegotiation */
721static void sky2_phy_reinit(struct sky2_port *sky2) 733static void sky2_phy_reinit(struct sky2_port *sky2)
722{ 734{
723 spin_lock_bh(&sky2->phy_lock); 735 spin_lock_bh(&sky2->phy_lock);
724 sky2_phy_init(sky2->hw, sky2->port); 736 sky2_phy_init(sky2->hw, sky2->port);
737 sky2_enable_rx_tx(sky2);
725 spin_unlock_bh(&sky2->phy_lock); 738 spin_unlock_bh(&sky2->phy_lock);
726} 739}
727 740
@@ -2040,7 +2053,6 @@ static void sky2_link_up(struct sky2_port *sky2)
2040{ 2053{
2041 struct sky2_hw *hw = sky2->hw; 2054 struct sky2_hw *hw = sky2->hw;
2042 unsigned port = sky2->port; 2055 unsigned port = sky2->port;
2043 u16 reg;
2044 static const char *fc_name[] = { 2056 static const char *fc_name[] = {
2045 [FC_NONE] = "none", 2057 [FC_NONE] = "none",
2046 [FC_TX] = "tx", 2058 [FC_TX] = "tx",
@@ -2048,10 +2060,7 @@ static void sky2_link_up(struct sky2_port *sky2)
2048 [FC_BOTH] = "both", 2060 [FC_BOTH] = "both",
2049 }; 2061 };
2050 2062
2051 /* enable Rx/Tx */ 2063 sky2_enable_rx_tx(sky2);
2052 reg = gma_read16(hw, port, GM_GP_CTRL);
2053 reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA;
2054 gma_write16(hw, port, GM_GP_CTRL, reg);
2055 2064
2056 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); 2065 gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK);
2057 2066
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
index c0e70006374e..06b552fca63d 100644
--- a/drivers/net/tulip/de2104x.c
+++ b/drivers/net/tulip/de2104x.c
@@ -367,8 +367,8 @@ static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x6F3F, 0x6F3D, };
367static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; 367static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
368 368
369 369
370#define dr32(reg) readl(de->regs + (reg)) 370#define dr32(reg) ioread32(de->regs + (reg))
371#define dw32(reg,val) writel((val), de->regs + (reg)) 371#define dw32(reg, val) iowrite32((val), de->regs + (reg))
372 372
373 373
374static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, 374static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
@@ -1706,6 +1706,7 @@ static void __devinit de21040_get_mac_address (struct de_private *de)
1706 int value, boguscnt = 100000; 1706 int value, boguscnt = 100000;
1707 do { 1707 do {
1708 value = dr32(ROMCmd); 1708 value = dr32(ROMCmd);
1709 rmb();
1709 } while (value < 0 && --boguscnt > 0); 1710 } while (value < 0 && --boguscnt > 0);
1710 de->dev->dev_addr[i] = value; 1711 de->dev->dev_addr[i] = value;
1711 udelay(1); 1712 udelay(1);
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 4a34833b85dd..807470e156af 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3215,6 +3215,8 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3215 __func__, __LINE__, (u32) skb); 3215 __func__, __LINE__, (u32) skb);
3216 if (skb) { 3216 if (skb) {
3217 skb->data = skb->head + NET_SKB_PAD; 3217 skb->data = skb->head + NET_SKB_PAD;
3218 skb->len = 0;
3219 skb_reset_tail_pointer(skb);
3218 __skb_queue_head(&ugeth->rx_recycle, skb); 3220 __skb_queue_head(&ugeth->rx_recycle, skb);
3219 } 3221 }
3220 3222
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 0a3c41faea9c..4dd23513c5af 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1334,7 +1334,6 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
1334 /* check for port already opened, if not set the termios */ 1334 /* check for port already opened, if not set the termios */
1335 serial->open_count++; 1335 serial->open_count++;
1336 if (serial->open_count == 1) { 1336 if (serial->open_count == 1) {
1337 tty->low_latency = 1;
1338 serial->rx_state = RX_IDLE; 1337 serial->rx_state = RX_IDLE;
1339 /* Force default termio settings */ 1338 /* Force default termio settings */
1340 _hso_serial_set_termios(tty, NULL); 1339 _hso_serial_set_termios(tty, NULL);
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index b504bd561362..d14e207de1df 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -2262,7 +2262,8 @@ start:
2262 vxge_debug_init(VXGE_ERR, 2262 vxge_debug_init(VXGE_ERR,
2263 "%s: memory allocation failed", 2263 "%s: memory allocation failed",
2264 VXGE_DRIVER_NAME); 2264 VXGE_DRIVER_NAME);
2265 return -ENOMEM; 2265 ret = -ENOMEM;
2266 goto alloc_entries_failed;
2266 } 2267 }
2267 2268
2268 vdev->vxge_entries = 2269 vdev->vxge_entries =
@@ -2271,8 +2272,8 @@ start:
2271 if (!vdev->vxge_entries) { 2272 if (!vdev->vxge_entries) {
2272 vxge_debug_init(VXGE_ERR, "%s: memory allocation failed", 2273 vxge_debug_init(VXGE_ERR, "%s: memory allocation failed",
2273 VXGE_DRIVER_NAME); 2274 VXGE_DRIVER_NAME);
2274 kfree(vdev->entries); 2275 ret = -ENOMEM;
2275 return -ENOMEM; 2276 goto alloc_vxge_entries_failed;
2276 } 2277 }
2277 2278
2278 for (i = 0, j = 0; i < vdev->no_of_vpath; i++) { 2279 for (i = 0, j = 0; i < vdev->no_of_vpath; i++) {
@@ -2303,22 +2304,32 @@ start:
2303 vxge_debug_init(VXGE_ERR, 2304 vxge_debug_init(VXGE_ERR,
2304 "%s: MSI-X enable failed for %d vectors, ret: %d", 2305 "%s: MSI-X enable failed for %d vectors, ret: %d",
2305 VXGE_DRIVER_NAME, vdev->intr_cnt, ret); 2306 VXGE_DRIVER_NAME, vdev->intr_cnt, ret);
2307 if ((max_config_vpath != VXGE_USE_DEFAULT) || (ret < 3)) {
2308 ret = -ENODEV;
2309 goto enable_msix_failed;
2310 }
2311
2306 kfree(vdev->entries); 2312 kfree(vdev->entries);
2307 kfree(vdev->vxge_entries); 2313 kfree(vdev->vxge_entries);
2308 vdev->entries = NULL; 2314 vdev->entries = NULL;
2309 vdev->vxge_entries = NULL; 2315 vdev->vxge_entries = NULL;
2310
2311 if ((max_config_vpath != VXGE_USE_DEFAULT) || (ret < 3))
2312 return -ENODEV;
2313 /* Try with less no of vector by reducing no of vpaths count */ 2316 /* Try with less no of vector by reducing no of vpaths count */
2314 temp = (ret - 1)/2; 2317 temp = (ret - 1)/2;
2315 vxge_close_vpaths(vdev, temp); 2318 vxge_close_vpaths(vdev, temp);
2316 vdev->no_of_vpath = temp; 2319 vdev->no_of_vpath = temp;
2317 goto start; 2320 goto start;
2318 } else if (ret < 0) 2321 } else if (ret < 0) {
2319 return -ENODEV; 2322 ret = -ENODEV;
2320 2323 goto enable_msix_failed;
2324 }
2321 return 0; 2325 return 0;
2326
2327enable_msix_failed:
2328 kfree(vdev->vxge_entries);
2329alloc_vxge_entries_failed:
2330 kfree(vdev->entries);
2331alloc_entries_failed:
2332 return ret;
2322} 2333}
2323 2334
2324static int vxge_enable_msix(struct vxgedev *vdev) 2335static int vxge_enable_msix(struct vxgedev *vdev)
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index e0c244b02f05..31c008042bfe 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -126,6 +126,7 @@ int ath5k_hw_attach(struct ath5k_softc *sc)
126 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; 126 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
127 ah->ah_noise_floor = -95; /* until first NF calibration is run */ 127 ah->ah_noise_floor = -95; /* until first NF calibration is run */
128 sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO; 128 sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO;
129 ah->ah_current_channel = &sc->channels[0];
129 130
130 /* 131 /*
131 * Find the mac version 132 * Find the mac version
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index db72461c486b..29b31a694b59 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -594,6 +594,7 @@ static int prism2_config(struct pcmcia_device *link)
594 local_info_t *local; 594 local_info_t *local;
595 int ret = 1; 595 int ret = 1;
596 struct hostap_cs_priv *hw_priv; 596 struct hostap_cs_priv *hw_priv;
597 unsigned long flags;
597 598
598 PDEBUG(DEBUG_FLOW, "prism2_config()\n"); 599 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
599 600
@@ -625,9 +626,15 @@ static int prism2_config(struct pcmcia_device *link)
625 local->hw_priv = hw_priv; 626 local->hw_priv = hw_priv;
626 hw_priv->link = link; 627 hw_priv->link = link;
627 628
629 /*
630 * Make sure the IRQ handler cannot proceed until at least
631 * dev->base_addr is initialized.
632 */
633 spin_lock_irqsave(&local->irq_init_lock, flags);
634
628 ret = pcmcia_request_irq(link, prism2_interrupt); 635 ret = pcmcia_request_irq(link, prism2_interrupt);
629 if (ret) 636 if (ret)
630 goto failed; 637 goto failed_unlock;
631 638
632 /* 639 /*
633 * This actually configures the PCMCIA socket -- setting up 640 * This actually configures the PCMCIA socket -- setting up
@@ -636,11 +643,13 @@ static int prism2_config(struct pcmcia_device *link)
636 */ 643 */
637 ret = pcmcia_request_configuration(link, &link->conf); 644 ret = pcmcia_request_configuration(link, &link->conf);
638 if (ret) 645 if (ret)
639 goto failed; 646 goto failed_unlock;
640 647
641 dev->irq = link->irq; 648 dev->irq = link->irq;
642 dev->base_addr = link->io.BasePort1; 649 dev->base_addr = link->io.BasePort1;
643 650
651 spin_unlock_irqrestore(&local->irq_init_lock, flags);
652
644 /* Finally, report what we've done */ 653 /* Finally, report what we've done */
645 printk(KERN_INFO "%s: index 0x%02x: ", 654 printk(KERN_INFO "%s: index 0x%02x: ",
646 dev_info, link->conf.ConfigIndex); 655 dev_info, link->conf.ConfigIndex);
@@ -667,6 +676,8 @@ static int prism2_config(struct pcmcia_device *link)
667 676
668 return ret; 677 return ret;
669 678
679 failed_unlock:
680 spin_unlock_irqrestore(&local->irq_init_lock, flags);
670 failed: 681 failed:
671 kfree(hw_priv); 682 kfree(hw_priv);
672 prism2_release((u_long)link); 683 prism2_release((u_long)link);
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index ff9b5c882184..2f999fc94f60 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -2621,6 +2621,18 @@ static irqreturn_t prism2_interrupt(int irq, void *dev_id)
2621 iface = netdev_priv(dev); 2621 iface = netdev_priv(dev);
2622 local = iface->local; 2622 local = iface->local;
2623 2623
2624 /* Detect early interrupt before driver is fully configued */
2625 spin_lock(&local->irq_init_lock);
2626 if (!dev->base_addr) {
2627 if (net_ratelimit()) {
2628 printk(KERN_DEBUG "%s: Interrupt, but dev not configured\n",
2629 dev->name);
2630 }
2631 spin_unlock(&local->irq_init_lock);
2632 return IRQ_HANDLED;
2633 }
2634 spin_unlock(&local->irq_init_lock);
2635
2624 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0); 2636 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 0);
2625 2637
2626 if (local->func->card_present && !local->func->card_present(local)) { 2638 if (local->func->card_present && !local->func->card_present(local)) {
@@ -3138,6 +3150,7 @@ prism2_init_local_data(struct prism2_helper_functions *funcs, int card_idx,
3138 spin_lock_init(&local->cmdlock); 3150 spin_lock_init(&local->cmdlock);
3139 spin_lock_init(&local->baplock); 3151 spin_lock_init(&local->baplock);
3140 spin_lock_init(&local->lock); 3152 spin_lock_init(&local->lock);
3153 spin_lock_init(&local->irq_init_lock);
3141 mutex_init(&local->rid_bap_mtx); 3154 mutex_init(&local->rid_bap_mtx);
3142 3155
3143 if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES) 3156 if (card_idx < 0 || card_idx >= MAX_PARM_DEVICES)
diff --git a/drivers/net/wireless/hostap/hostap_wlan.h b/drivers/net/wireless/hostap/hostap_wlan.h
index 3d238917af07..1ba33be98b25 100644
--- a/drivers/net/wireless/hostap/hostap_wlan.h
+++ b/drivers/net/wireless/hostap/hostap_wlan.h
@@ -654,7 +654,7 @@ struct local_info {
654 rwlock_t iface_lock; /* hostap_interfaces read lock; use write lock 654 rwlock_t iface_lock; /* hostap_interfaces read lock; use write lock
655 * when removing entries from the list. 655 * when removing entries from the list.
656 * TX and RX paths can use read lock. */ 656 * TX and RX paths can use read lock. */
657 spinlock_t cmdlock, baplock, lock; 657 spinlock_t cmdlock, baplock, lock, irq_init_lock;
658 struct mutex rid_bap_mtx; 658 struct mutex rid_bap_mtx;
659 u16 infofid; /* MAC buffer id for info frame */ 659 u16 infofid; /* MAC buffer id for info frame */
660 /* txfid, intransmitfid, next_txtid, and next_alloc are protected by 660 /* txfid, intransmitfid, next_txtid, and next_alloc are protected by
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index a732f1094e5d..7d614c4d3c62 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -1299,6 +1299,11 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
1299 sta_id = ba_resp->sta_id; 1299 sta_id = ba_resp->sta_id;
1300 tid = ba_resp->tid; 1300 tid = ba_resp->tid;
1301 agg = &priv->stations[sta_id].tid[tid].agg; 1301 agg = &priv->stations[sta_id].tid[tid].agg;
1302 if (unlikely(agg->txq_id != scd_flow)) {
1303 IWL_ERR(priv, "BA scd_flow %d does not match txq_id %d\n",
1304 scd_flow, agg->txq_id);
1305 return;
1306 }
1302 1307
1303 /* Find index just before block-ack window */ 1308 /* Find index just before block-ack window */
1304 index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd); 1309 index = iwl_queue_dec_wrap(ba_resp_scd_ssn & 0xff, txq->q.n_bd);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 7726e67044c0..24aff654fa9c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3391,10 +3391,12 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
3391 int ret; 3391 int ret;
3392 u8 sta_id; 3392 u8 sta_id;
3393 3393
3394 sta_priv->common.sta_id = IWL_INVALID_STATION;
3395
3396 IWL_DEBUG_INFO(priv, "received request to add station %pM\n", 3394 IWL_DEBUG_INFO(priv, "received request to add station %pM\n",
3397 sta->addr); 3395 sta->addr);
3396 mutex_lock(&priv->mutex);
3397 IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
3398 sta->addr);
3399 sta_priv->common.sta_id = IWL_INVALID_STATION;
3398 3400
3399 atomic_set(&sta_priv->pending_frames, 0); 3401 atomic_set(&sta_priv->pending_frames, 0);
3400 if (vif->type == NL80211_IFTYPE_AP) 3402 if (vif->type == NL80211_IFTYPE_AP)
@@ -3406,6 +3408,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
3406 IWL_ERR(priv, "Unable to add station %pM (%d)\n", 3408 IWL_ERR(priv, "Unable to add station %pM (%d)\n",
3407 sta->addr, ret); 3409 sta->addr, ret);
3408 /* Should we return success if return code is EEXIST ? */ 3410 /* Should we return success if return code is EEXIST ? */
3411 mutex_unlock(&priv->mutex);
3409 return ret; 3412 return ret;
3410 } 3413 }
3411 3414
@@ -3415,6 +3418,7 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
3415 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 3418 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
3416 sta->addr); 3419 sta->addr);
3417 iwl_rs_rate_init(priv, sta, sta_id); 3420 iwl_rs_rate_init(priv, sta, sta_id);
3421 mutex_unlock(&priv->mutex);
3418 3422
3419 return 0; 3423 return 0;
3420} 3424}
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 5d3f51ff2f0d..386c5f96eff8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -491,6 +491,7 @@ void iwl_bg_abort_scan(struct work_struct *work)
491 491
492 mutex_lock(&priv->mutex); 492 mutex_lock(&priv->mutex);
493 493
494 cancel_delayed_work_sync(&priv->scan_check);
494 set_bit(STATUS_SCAN_ABORTING, &priv->status); 495 set_bit(STATUS_SCAN_ABORTING, &priv->status);
495 iwl_send_scan_abort(priv); 496 iwl_send_scan_abort(priv);
496 497
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 83a26361a9b5..c27c13fbb1ae 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -1373,10 +1373,14 @@ int iwl_mac_sta_remove(struct ieee80211_hw *hw,
1373 1373
1374 IWL_DEBUG_INFO(priv, "received request to remove station %pM\n", 1374 IWL_DEBUG_INFO(priv, "received request to remove station %pM\n",
1375 sta->addr); 1375 sta->addr);
1376 mutex_lock(&priv->mutex);
1377 IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
1378 sta->addr);
1376 ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr); 1379 ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr);
1377 if (ret) 1380 if (ret)
1378 IWL_ERR(priv, "Error removing station %pM\n", 1381 IWL_ERR(priv, "Error removing station %pM\n",
1379 sta->addr); 1382 sta->addr);
1383 mutex_unlock(&priv->mutex);
1380 return ret; 1384 return ret;
1381} 1385}
1382EXPORT_SYMBOL(iwl_mac_sta_remove); 1386EXPORT_SYMBOL(iwl_mac_sta_remove);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 6c353cacc8d6..a27872de4106 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3437,10 +3437,13 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
3437 bool is_ap = vif->type == NL80211_IFTYPE_STATION; 3437 bool is_ap = vif->type == NL80211_IFTYPE_STATION;
3438 u8 sta_id; 3438 u8 sta_id;
3439 3439
3440 sta_priv->common.sta_id = IWL_INVALID_STATION;
3441
3442 IWL_DEBUG_INFO(priv, "received request to add station %pM\n", 3440 IWL_DEBUG_INFO(priv, "received request to add station %pM\n",
3443 sta->addr); 3441 sta->addr);
3442 mutex_lock(&priv->mutex);
3443 IWL_DEBUG_INFO(priv, "proceeding to add station %pM\n",
3444 sta->addr);
3445 sta_priv->common.sta_id = IWL_INVALID_STATION;
3446
3444 3447
3445 ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap, 3448 ret = iwl_add_station_common(priv, sta->addr, is_ap, &sta->ht_cap,
3446 &sta_id); 3449 &sta_id);
@@ -3448,6 +3451,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
3448 IWL_ERR(priv, "Unable to add station %pM (%d)\n", 3451 IWL_ERR(priv, "Unable to add station %pM (%d)\n",
3449 sta->addr, ret); 3452 sta->addr, ret);
3450 /* Should we return success if return code is EEXIST ? */ 3453 /* Should we return success if return code is EEXIST ? */
3454 mutex_unlock(&priv->mutex);
3451 return ret; 3455 return ret;
3452 } 3456 }
3453 3457
@@ -3457,6 +3461,7 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw,
3457 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n", 3461 IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
3458 sta->addr); 3462 sta->addr);
3459 iwl3945_rs_rate_init(priv, sta, sta_id); 3463 iwl3945_rs_rate_init(priv, sta, sta_id);
3464 mutex_unlock(&priv->mutex);
3460 3465
3461 return 0; 3466 return 0;
3462} 3467}
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index 6a04c2157f73..817fffc0de4b 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -549,7 +549,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
549 549
550 prxpd = (struct rxpd *) skb->data; 550 prxpd = (struct rxpd *) skb->data;
551 551
552 stats.flag = 0; 552 memset(&stats, 0, sizeof(stats));
553 if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) 553 if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
554 stats.flag |= RX_FLAG_FAILED_FCS_CRC; 554 stats.flag |= RX_FLAG_FAILED_FCS_CRC;
555 stats.freq = priv->cur_freq; 555 stats.freq = priv->cur_freq;
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 07c4528f6e6b..a5ea89cde8c4 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -41,6 +41,8 @@ static DEFINE_PCI_DEVICE_TABLE(p54p_table) = {
41 { PCI_DEVICE(0x1260, 0x3877) }, 41 { PCI_DEVICE(0x1260, 0x3877) },
42 /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */ 42 /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */
43 { PCI_DEVICE(0x1260, 0x3886) }, 43 { PCI_DEVICE(0x1260, 0x3886) },
44 /* Intersil PRISM Xbow Wireless LAN adapter (Symbol AP-300) */
45 { PCI_DEVICE(0x1260, 0xffff) },
44 { }, 46 { },
45}; 47};
46 48
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 796828fce34c..c9171be74564 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -340,7 +340,7 @@ int dmar_disabled = 0;
340int dmar_disabled = 1; 340int dmar_disabled = 1;
341#endif /*CONFIG_DMAR_DEFAULT_ON*/ 341#endif /*CONFIG_DMAR_DEFAULT_ON*/
342 342
343static int __initdata dmar_map_gfx = 1; 343static int dmar_map_gfx = 1;
344static int dmar_forcedac; 344static int dmar_forcedac;
345static int intel_iommu_strict; 345static int intel_iommu_strict;
346 346
@@ -1874,14 +1874,15 @@ static struct dmar_domain *get_domain_for_dev(struct pci_dev *pdev, int gaw)
1874 } 1874 }
1875 } 1875 }
1876 if (found) { 1876 if (found) {
1877 spin_unlock_irqrestore(&device_domain_lock, flags);
1877 free_devinfo_mem(info); 1878 free_devinfo_mem(info);
1878 domain_exit(domain); 1879 domain_exit(domain);
1879 domain = found; 1880 domain = found;
1880 } else { 1881 } else {
1881 list_add(&info->link, &domain->devices); 1882 list_add(&info->link, &domain->devices);
1882 list_add(&info->global, &device_domain_list); 1883 list_add(&info->global, &device_domain_list);
1884 spin_unlock_irqrestore(&device_domain_lock, flags);
1883 } 1885 }
1884 spin_unlock_irqrestore(&device_domain_lock, flags);
1885 } 1886 }
1886 1887
1887found_domain: 1888found_domain:
@@ -3603,7 +3604,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
3603 pte = dmar_domain->pgd; 3604 pte = dmar_domain->pgd;
3604 if (dma_pte_present(pte)) { 3605 if (dma_pte_present(pte)) {
3605 free_pgtable_page(dmar_domain->pgd); 3606 free_pgtable_page(dmar_domain->pgd);
3606 dmar_domain->pgd = (struct dma_pte *)dma_pte_addr(pte); 3607 dmar_domain->pgd = (struct dma_pte *)
3608 phys_to_virt(dma_pte_addr(pte));
3607 } 3609 }
3608 dmar_domain->agaw--; 3610 dmar_domain->agaw--;
3609 } 3611 }
@@ -3719,6 +3721,12 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
3719 */ 3721 */
3720 printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); 3722 printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");
3721 rwbf_quirk = 1; 3723 rwbf_quirk = 1;
3724
3725 /* https://bugzilla.redhat.com/show_bug.cgi?id=538163 */
3726 if (dev->revision == 0x07) {
3727 printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n");
3728 dmar_map_gfx = 0;
3729 }
3722} 3730}
3723 3731
3724DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); 3732DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 60f30e7f1c8c..740fb4ea9669 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2292,6 +2292,7 @@ void pci_msi_off(struct pci_dev *dev)
2292 pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); 2292 pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control);
2293 } 2293 }
2294} 2294}
2295EXPORT_SYMBOL_GPL(pci_msi_off);
2295 2296
2296#ifndef HAVE_ARCH_PCI_SET_DMA_MAX_SEGMENT_SIZE 2297#ifndef HAVE_ARCH_PCI_SET_DMA_MAX_SEGMENT_SIZE
2297int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size) 2298int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size)
diff --git a/drivers/pci/pcie/pme/pcie_pme.c b/drivers/pci/pcie/pme/pcie_pme.c
index aac285a16b62..d672a0a63816 100644
--- a/drivers/pci/pcie/pme/pcie_pme.c
+++ b/drivers/pci/pcie/pme/pcie_pme.c
@@ -34,7 +34,7 @@
34 * being registered. Consequently, the interrupt-based PCIe PME signaling will 34 * being registered. Consequently, the interrupt-based PCIe PME signaling will
35 * not be used by any PCIe root ports in that case. 35 * not be used by any PCIe root ports in that case.
36 */ 36 */
37static bool pcie_pme_disabled; 37static bool pcie_pme_disabled = true;
38 38
39/* 39/*
40 * The PCI Express Base Specification 2.0, Section 6.1.8, states the following: 40 * The PCI Express Base Specification 2.0, Section 6.1.8, states the following:
@@ -64,12 +64,19 @@ bool pcie_pme_msi_disabled;
64 64
65static int __init pcie_pme_setup(char *str) 65static int __init pcie_pme_setup(char *str)
66{ 66{
67 if (!strcmp(str, "off")) 67 if (!strncmp(str, "auto", 4))
68 pcie_pme_disabled = true; 68 pcie_pme_disabled = false;
69 else if (!strcmp(str, "force")) 69 else if (!strncmp(str, "force", 5))
70 pcie_pme_force_enable = true; 70 pcie_pme_force_enable = true;
71 else if (!strcmp(str, "nomsi")) 71
72 pcie_pme_msi_disabled = true; 72 str = strchr(str, ',');
73 if (str) {
74 str++;
75 str += strspn(str, " \t");
76 if (*str && !strcmp(str, "nomsi"))
77 pcie_pme_msi_disabled = true;
78 }
79
73 return 1; 80 return 1;
74} 81}
75__setup("pcie_pme=", pcie_pme_setup); 82__setup("pcie_pme=", pcie_pme_setup);
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
index 92a8f6cacda9..34647fc1ee98 100644
--- a/drivers/rtc/rtc-davinci.c
+++ b/drivers/rtc/rtc-davinci.c
@@ -29,6 +29,7 @@
29#include <linux/bcd.h> 29#include <linux/bcd.h>
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/slab.h>
32 33
33/* 34/*
34 * The DaVinci RTC is a simple RTC with the following 35 * The DaVinci RTC is a simple RTC with the following
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 526307368f8b..ab17c08ddc03 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -821,6 +821,7 @@ static struct pcmcia_device_id serial_ids[] = {
821 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"), 821 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "cis/PCMLM28.cis"),
822 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"), 822 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "cis/PCMLM28.cis"),
823 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"), 823 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "cis/PCMLM28.cis"),
824 PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "TOSHIBA", "Modem/LAN Card", 0xb4585a1a, 0x53f922f8, "cis/PCMLM28.cis"),
824 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"), 825 PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "cis/DP83903.cis"),
825 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"), 826 PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "cis/DP83903.cis"),
826 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "cis/3CCFEM556.cis"), 827 PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "cis/3CCFEM556.cis"),
diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index ce081cd44ad4..273e26ede650 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -15,6 +15,7 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/usb.h> 17#include <linux/usb.h>
18#include <linux/slab.h>
18 19
19#include <asm/delay.h> 20#include <asm/delay.h>
20#include <sound/core.h> 21#include <sound/core.h>
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index cedd9044022f..6a9ae40c7c6d 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -24,6 +24,7 @@
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/usb.h> 25#include <linux/usb.h>
26#include <linux/version.h> 26#include <linux/version.h>
27#include <linux/slab.h>
27#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
28#include <media/tuner.h> 29#include <media/tuner.h>
29#include <media/tvaudio.h> 30#include <media/tvaudio.h>
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c
index 27f3f551b545..c3690e3580da 100644
--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/slab.h>
25#include <linux/usb.h> 26#include <linux/usb.h>
26#include <linux/i2c.h> 27#include <linux/i2c.h>
27#include "tm6000.h" 28#include "tm6000.h"
diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c
index 261e66acbe46..86c1c8b5f25a 100644
--- a/drivers/staging/tm6000/tm6000-dvb.c
+++ b/drivers/staging/tm6000/tm6000-dvb.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/slab.h>
21#include <linux/usb.h> 22#include <linux/usb.h>
22 23
23#include "tm6000.h" 24#include "tm6000.h"
diff --git a/drivers/video/omap/lcdc.c b/drivers/video/omap/lcdc.c
index 43ab7d8b66b2..7767338f8b14 100644
--- a/drivers/video/omap/lcdc.c
+++ b/drivers/video/omap/lcdc.c
@@ -572,22 +572,12 @@ static enum omapfb_update_mode omap_lcdc_get_update_mode(void)
572/* PM code called only in internal controller mode */ 572/* PM code called only in internal controller mode */
573static void omap_lcdc_suspend(void) 573static void omap_lcdc_suspend(void)
574{ 574{
575 if (lcdc.update_mode == OMAPFB_AUTO_UPDATE) { 575 omap_lcdc_set_update_mode(OMAPFB_UPDATE_DISABLED);
576 disable_controller();
577 omap_stop_lcd_dma();
578 }
579} 576}
580 577
581static void omap_lcdc_resume(void) 578static void omap_lcdc_resume(void)
582{ 579{
583 if (lcdc.update_mode == OMAPFB_AUTO_UPDATE) { 580 omap_lcdc_set_update_mode(OMAPFB_AUTO_UPDATE);
584 setup_regs();
585 load_palette();
586 setup_lcd_dma();
587 set_load_mode(OMAP_LCDC_LOAD_FRAME);
588 enable_irqs(OMAP_LCDC_IRQ_DONE);
589 enable_controller();
590 }
591} 581}
592 582
593static void omap_lcdc_get_caps(int plane, struct omapfb_caps *caps) 583static void omap_lcdc_get_caps(int plane, struct omapfb_caps *caps)
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index 1162603c72e5..eada9f12efc7 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/platform_device.h>
29 30
30#include "omapfb.h" 31#include "omapfb.h"
31#include "dispc.h" 32#include "dispc.h"
@@ -83,13 +84,13 @@ static inline u32 rfbi_read_reg(int idx)
83 84
84static int rfbi_get_clocks(void) 85static int rfbi_get_clocks(void)
85{ 86{
86 rfbi.dss_ick = clk_get(&dispc.fbdev->dssdev->dev, "ick"); 87 rfbi.dss_ick = clk_get(&rfbi.fbdev->dssdev->dev, "ick");
87 if (IS_ERR(rfbi.dss_ick)) { 88 if (IS_ERR(rfbi.dss_ick)) {
88 dev_err(rfbi.fbdev->dev, "can't get ick\n"); 89 dev_err(rfbi.fbdev->dev, "can't get ick\n");
89 return PTR_ERR(rfbi.dss_ick); 90 return PTR_ERR(rfbi.dss_ick);
90 } 91 }
91 92
92 rfbi.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck"); 93 rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "dss1_fck");
93 if (IS_ERR(rfbi.dss1_fck)) { 94 if (IS_ERR(rfbi.dss1_fck)) {
94 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n"); 95 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
95 clk_put(rfbi.dss_ick); 96 clk_put(rfbi.dss_ick);
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 95896f387927..ef8d9d558fc7 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -636,6 +636,9 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
636 INIT_LIST_HEAD(&vp_dev->virtqueues); 636 INIT_LIST_HEAD(&vp_dev->virtqueues);
637 spin_lock_init(&vp_dev->lock); 637 spin_lock_init(&vp_dev->lock);
638 638
639 /* Disable MSI/MSIX to bring device to a known good state. */
640 pci_msi_off(pci_dev);
641
639 /* enable the device */ 642 /* enable the device */
640 err = pci_enable_device(pci_dev); 643 err = pci_enable_device(pci_dev);
641 if (err) 644 if (err)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1ca88908723b..afe7e21dd0ae 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -119,7 +119,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
119 119
120 desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); 120 desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp);
121 if (!desc) 121 if (!desc)
122 return vq->vring.num; 122 return -ENOMEM;
123 123
124 /* Transfer entries from the sg list into the indirect page */ 124 /* Transfer entries from the sg list into the indirect page */
125 for (i = 0; i < out; i++) { 125 for (i = 0; i < out; i++) {
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index 1cddf92cb9a6..750bc5281d79 100644
--- a/drivers/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
@@ -346,9 +346,13 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
346 } else { 346 } else {
347 wdt->users = 0; 347 wdt->users = 0;
348 } 348 }
349 wdt->miscdev.minor = WATCHDOG_MINOR; 349
350 wdt->miscdev.name = "watchdog"; 350 wdt->miscdev.minor = WATCHDOG_MINOR;
351 wdt->miscdev.fops = &at32_wdt_fops; 351 wdt->miscdev.name = "watchdog";
352 wdt->miscdev.fops = &at32_wdt_fops;
353 wdt->miscdev.parent = &pdev->dev;
354
355 platform_set_drvdata(pdev, wdt);
352 356
353 if (at32_wdt_settimeout(timeout)) { 357 if (at32_wdt_settimeout(timeout)) {
354 at32_wdt_settimeout(TIMEOUT_DEFAULT); 358 at32_wdt_settimeout(TIMEOUT_DEFAULT);
@@ -360,17 +364,17 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
360 ret = misc_register(&wdt->miscdev); 364 ret = misc_register(&wdt->miscdev);
361 if (ret) { 365 if (ret) {
362 dev_dbg(&pdev->dev, "failed to register wdt miscdev\n"); 366 dev_dbg(&pdev->dev, "failed to register wdt miscdev\n");
363 goto err_iounmap; 367 goto err_register;
364 } 368 }
365 369
366 platform_set_drvdata(pdev, wdt);
367 wdt->miscdev.parent = &pdev->dev;
368 dev_info(&pdev->dev, 370 dev_info(&pdev->dev,
369 "AT32AP700X WDT at 0x%p, timeout %d sec (nowayout=%d)\n", 371 "AT32AP700X WDT at 0x%p, timeout %d sec (nowayout=%d)\n",
370 wdt->regs, wdt->timeout, nowayout); 372 wdt->regs, wdt->timeout, nowayout);
371 373
372 return 0; 374 return 0;
373 375
376err_register:
377 platform_set_drvdata(pdev, NULL);
374err_iounmap: 378err_iounmap:
375 iounmap(wdt->regs); 379 iounmap(wdt->regs);
376err_free: 380err_free:
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index ea25885781bb..2ee7dac55a3c 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -330,7 +330,6 @@ static void imx2_wdt_shutdown(struct platform_device *pdev)
330} 330}
331 331
332static struct platform_driver imx2_wdt_driver = { 332static struct platform_driver imx2_wdt_driver = {
333 .probe = imx2_wdt_probe,
334 .remove = __exit_p(imx2_wdt_remove), 333 .remove = __exit_p(imx2_wdt_remove),
335 .shutdown = imx2_wdt_shutdown, 334 .shutdown = imx2_wdt_shutdown,
336 .driver = { 335 .driver = {
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 78c02eb4cb1f..484e52bb40bb 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -473,14 +473,24 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data)
473 return 0; 473 return 0;
474} 474}
475 475
476void cifs_drop_inode(struct inode *inode)
477{
478 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
479
480 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
481 return generic_drop_inode(inode);
482
483 return generic_delete_inode(inode);
484}
485
476static const struct super_operations cifs_super_ops = { 486static const struct super_operations cifs_super_ops = {
477 .put_super = cifs_put_super, 487 .put_super = cifs_put_super,
478 .statfs = cifs_statfs, 488 .statfs = cifs_statfs,
479 .alloc_inode = cifs_alloc_inode, 489 .alloc_inode = cifs_alloc_inode,
480 .destroy_inode = cifs_destroy_inode, 490 .destroy_inode = cifs_destroy_inode,
481/* .drop_inode = generic_delete_inode, 491 .drop_inode = cifs_drop_inode,
482 .delete_inode = cifs_delete_inode, */ /* Do not need above two 492/* .delete_inode = cifs_delete_inode, */ /* Do not need above
483 functions unless later we add lazy close of inodes or unless the 493 function unless later we add lazy close of inodes or unless the
484 kernel forgets to call us with the same number of releases (closes) 494 kernel forgets to call us with the same number of releases (closes)
485 as opens */ 495 as opens */
486 .show_options = cifs_show_options, 496 .show_options = cifs_show_options,
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index fb1657e0fdb8..fb6318b81509 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -106,7 +106,6 @@ extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode,
106 __u16 fileHandle, struct file *file, 106 __u16 fileHandle, struct file *file,
107 struct vfsmount *mnt, unsigned int oflags); 107 struct vfsmount *mnt, unsigned int oflags);
108extern int cifs_posix_open(char *full_path, struct inode **pinode, 108extern int cifs_posix_open(char *full_path, struct inode **pinode,
109 struct vfsmount *mnt,
110 struct super_block *sb, 109 struct super_block *sb,
111 int mode, int oflags, 110 int mode, int oflags,
112 __u32 *poplock, __u16 *pnetfid, int xid); 111 __u32 *poplock, __u16 *pnetfid, int xid);
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 391816b461ca..e7ae78b66fa1 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/namei.h> 26#include <linux/namei.h>
27#include <linux/mount.h> 27#include <linux/mount.h>
28#include <linux/file.h>
28#include "cifsfs.h" 29#include "cifsfs.h"
29#include "cifspdu.h" 30#include "cifspdu.h"
30#include "cifsglob.h" 31#include "cifsglob.h"
@@ -184,12 +185,13 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
184 } 185 }
185 write_unlock(&GlobalSMBSeslock); 186 write_unlock(&GlobalSMBSeslock);
186 187
188 file->private_data = pCifsFile;
189
187 return pCifsFile; 190 return pCifsFile;
188} 191}
189 192
190int cifs_posix_open(char *full_path, struct inode **pinode, 193int cifs_posix_open(char *full_path, struct inode **pinode,
191 struct vfsmount *mnt, struct super_block *sb, 194 struct super_block *sb, int mode, int oflags,
192 int mode, int oflags,
193 __u32 *poplock, __u16 *pnetfid, int xid) 195 __u32 *poplock, __u16 *pnetfid, int xid)
194{ 196{
195 int rc; 197 int rc;
@@ -258,19 +260,6 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
258 cifs_fattr_to_inode(*pinode, &fattr); 260 cifs_fattr_to_inode(*pinode, &fattr);
259 } 261 }
260 262
261 /*
262 * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to
263 * file->private_data.
264 */
265 if (mnt) {
266 struct cifsFileInfo *pfile_info;
267
268 pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt,
269 oflags);
270 if (pfile_info == NULL)
271 rc = -ENOMEM;
272 }
273
274posix_open_ret: 263posix_open_ret:
275 kfree(presp_data); 264 kfree(presp_data);
276 return rc; 265 return rc;
@@ -298,7 +287,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
298 int create_options = CREATE_NOT_DIR; 287 int create_options = CREATE_NOT_DIR;
299 __u32 oplock = 0; 288 __u32 oplock = 0;
300 int oflags; 289 int oflags;
301 bool posix_create = false;
302 /* 290 /*
303 * BB below access is probably too much for mknod to request 291 * BB below access is probably too much for mknod to request
304 * but we have to do query and setpathinfo so requesting 292 * but we have to do query and setpathinfo so requesting
@@ -339,7 +327,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
339 (CIFS_UNIX_POSIX_PATH_OPS_CAP & 327 (CIFS_UNIX_POSIX_PATH_OPS_CAP &
340 le64_to_cpu(tcon->fsUnixInfo.Capability))) { 328 le64_to_cpu(tcon->fsUnixInfo.Capability))) {
341 rc = cifs_posix_open(full_path, &newinode, 329 rc = cifs_posix_open(full_path, &newinode,
342 nd ? nd->path.mnt : NULL,
343 inode->i_sb, mode, oflags, &oplock, &fileHandle, xid); 330 inode->i_sb, mode, oflags, &oplock, &fileHandle, xid);
344 /* EIO could indicate that (posix open) operation is not 331 /* EIO could indicate that (posix open) operation is not
345 supported, despite what server claimed in capability 332 supported, despite what server claimed in capability
@@ -347,7 +334,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
347 handled in posix open */ 334 handled in posix open */
348 335
349 if (rc == 0) { 336 if (rc == 0) {
350 posix_create = true;
351 if (newinode == NULL) /* query inode info */ 337 if (newinode == NULL) /* query inode info */
352 goto cifs_create_get_file_info; 338 goto cifs_create_get_file_info;
353 else /* success, no need to query */ 339 else /* success, no need to query */
@@ -478,21 +464,28 @@ cifs_create_set_dentry:
478 else 464 else
479 cFYI(1, "Create worked, get_inode_info failed rc = %d", rc); 465 cFYI(1, "Create worked, get_inode_info failed rc = %d", rc);
480 466
481 /* nfsd case - nfs srv does not set nd */ 467 if (newinode && nd && (nd->flags & LOOKUP_OPEN)) {
482 if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) {
483 /* mknod case - do not leave file open */
484 CIFSSMBClose(xid, tcon, fileHandle);
485 } else if (!(posix_create) && (newinode)) {
486 struct cifsFileInfo *pfile_info; 468 struct cifsFileInfo *pfile_info;
487 /* 469 struct file *filp;
488 * cifs_fill_filedata() takes care of setting cifsFileInfo 470
489 * pointer to file->private_data. 471 filp = lookup_instantiate_filp(nd, direntry, generic_file_open);
490 */ 472 if (IS_ERR(filp)) {
491 pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL, 473 rc = PTR_ERR(filp);
474 CIFSSMBClose(xid, tcon, fileHandle);
475 goto cifs_create_out;
476 }
477
478 pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp,
492 nd->path.mnt, oflags); 479 nd->path.mnt, oflags);
493 if (pfile_info == NULL) 480 if (pfile_info == NULL) {
481 fput(filp);
482 CIFSSMBClose(xid, tcon, fileHandle);
494 rc = -ENOMEM; 483 rc = -ENOMEM;
484 }
485 } else {
486 CIFSSMBClose(xid, tcon, fileHandle);
495 } 487 }
488
496cifs_create_out: 489cifs_create_out:
497 kfree(buf); 490 kfree(buf);
498 kfree(full_path); 491 kfree(full_path);
@@ -636,6 +629,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
636 bool posix_open = false; 629 bool posix_open = false;
637 struct cifs_sb_info *cifs_sb; 630 struct cifs_sb_info *cifs_sb;
638 struct cifsTconInfo *pTcon; 631 struct cifsTconInfo *pTcon;
632 struct cifsFileInfo *cfile;
639 struct inode *newInode = NULL; 633 struct inode *newInode = NULL;
640 char *full_path = NULL; 634 char *full_path = NULL;
641 struct file *filp; 635 struct file *filp;
@@ -703,7 +697,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
703 if (nd && !(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && 697 if (nd && !(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) &&
704 (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open && 698 (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open &&
705 (nd->intent.open.flags & O_CREAT)) { 699 (nd->intent.open.flags & O_CREAT)) {
706 rc = cifs_posix_open(full_path, &newInode, nd->path.mnt, 700 rc = cifs_posix_open(full_path, &newInode,
707 parent_dir_inode->i_sb, 701 parent_dir_inode->i_sb,
708 nd->intent.open.create_mode, 702 nd->intent.open.create_mode,
709 nd->intent.open.flags, &oplock, 703 nd->intent.open.flags, &oplock,
@@ -733,8 +727,25 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
733 else 727 else
734 direntry->d_op = &cifs_dentry_ops; 728 direntry->d_op = &cifs_dentry_ops;
735 d_add(direntry, newInode); 729 d_add(direntry, newInode);
736 if (posix_open) 730 if (posix_open) {
737 filp = lookup_instantiate_filp(nd, direntry, NULL); 731 filp = lookup_instantiate_filp(nd, direntry,
732 generic_file_open);
733 if (IS_ERR(filp)) {
734 rc = PTR_ERR(filp);
735 CIFSSMBClose(xid, pTcon, fileHandle);
736 goto lookup_out;
737 }
738
739 cfile = cifs_new_fileinfo(newInode, fileHandle, filp,
740 nd->path.mnt,
741 nd->intent.open.flags);
742 if (cfile == NULL) {
743 fput(filp);
744 CIFSSMBClose(xid, pTcon, fileHandle);
745 rc = -ENOMEM;
746 goto lookup_out;
747 }
748 }
738 /* since paths are not looked up by component - the parent 749 /* since paths are not looked up by component - the parent
739 directories are presumed to be good here */ 750 directories are presumed to be good here */
740 renew_parental_timestamps(direntry); 751 renew_parental_timestamps(direntry);
@@ -755,6 +766,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
755 is a common return code */ 766 is a common return code */
756 } 767 }
757 768
769lookup_out:
758 kfree(full_path); 770 kfree(full_path);
759 FreeXid(xid); 771 FreeXid(xid);
760 return ERR_PTR(rc); 772 return ERR_PTR(rc);
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 75541af4b3db..409e4f523e61 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -162,44 +162,12 @@ psx_client_can_cache:
162 return 0; 162 return 0;
163} 163}
164 164
165static struct cifsFileInfo *
166cifs_fill_filedata(struct file *file)
167{
168 struct list_head *tmp;
169 struct cifsFileInfo *pCifsFile = NULL;
170 struct cifsInodeInfo *pCifsInode = NULL;
171
172 /* search inode for this file and fill in file->private_data */
173 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
174 read_lock(&GlobalSMBSeslock);
175 list_for_each(tmp, &pCifsInode->openFileList) {
176 pCifsFile = list_entry(tmp, struct cifsFileInfo, flist);
177 if ((pCifsFile->pfile == NULL) &&
178 (pCifsFile->pid == current->tgid)) {
179 /* mode set in cifs_create */
180
181 /* needed for writepage */
182 pCifsFile->pfile = file;
183 file->private_data = pCifsFile;
184 break;
185 }
186 }
187 read_unlock(&GlobalSMBSeslock);
188
189 if (file->private_data != NULL) {
190 return pCifsFile;
191 } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL))
192 cERROR(1, "could not find file instance for "
193 "new file %p", file);
194 return NULL;
195}
196
197/* all arguments to this function must be checked for validity in caller */ 165/* all arguments to this function must be checked for validity in caller */
198static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, 166static inline int cifs_open_inode_helper(struct inode *inode,
199 struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile,
200 struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf, 167 struct cifsTconInfo *pTcon, int *oplock, FILE_ALL_INFO *buf,
201 char *full_path, int xid) 168 char *full_path, int xid)
202{ 169{
170 struct cifsInodeInfo *pCifsInode = CIFS_I(inode);
203 struct timespec temp; 171 struct timespec temp;
204 int rc; 172 int rc;
205 173
@@ -213,36 +181,35 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
213 /* if not oplocked, invalidate inode pages if mtime or file 181 /* if not oplocked, invalidate inode pages if mtime or file
214 size changed */ 182 size changed */
215 temp = cifs_NTtimeToUnix(buf->LastWriteTime); 183 temp = cifs_NTtimeToUnix(buf->LastWriteTime);
216 if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) && 184 if (timespec_equal(&inode->i_mtime, &temp) &&
217 (file->f_path.dentry->d_inode->i_size == 185 (inode->i_size ==
218 (loff_t)le64_to_cpu(buf->EndOfFile))) { 186 (loff_t)le64_to_cpu(buf->EndOfFile))) {
219 cFYI(1, "inode unchanged on server"); 187 cFYI(1, "inode unchanged on server");
220 } else { 188 } else {
221 if (file->f_path.dentry->d_inode->i_mapping) { 189 if (inode->i_mapping) {
222 /* BB no need to lock inode until after invalidate 190 /* BB no need to lock inode until after invalidate
223 since namei code should already have it locked? */ 191 since namei code should already have it locked? */
224 rc = filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping); 192 rc = filemap_write_and_wait(inode->i_mapping);
225 if (rc != 0) 193 if (rc != 0)
226 CIFS_I(file->f_path.dentry->d_inode)->write_behind_rc = rc; 194 pCifsInode->write_behind_rc = rc;
227 } 195 }
228 cFYI(1, "invalidating remote inode since open detected it " 196 cFYI(1, "invalidating remote inode since open detected it "
229 "changed"); 197 "changed");
230 invalidate_remote_inode(file->f_path.dentry->d_inode); 198 invalidate_remote_inode(inode);
231 } 199 }
232 200
233client_can_cache: 201client_can_cache:
234 if (pTcon->unix_ext) 202 if (pTcon->unix_ext)
235 rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode, 203 rc = cifs_get_inode_info_unix(&inode, full_path, inode->i_sb,
236 full_path, inode->i_sb, xid); 204 xid);
237 else 205 else
238 rc = cifs_get_inode_info(&file->f_path.dentry->d_inode, 206 rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
239 full_path, buf, inode->i_sb, xid, NULL); 207 xid, NULL);
240 208
241 if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { 209 if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
242 pCifsInode->clientCanCacheAll = true; 210 pCifsInode->clientCanCacheAll = true;
243 pCifsInode->clientCanCacheRead = true; 211 pCifsInode->clientCanCacheRead = true;
244 cFYI(1, "Exclusive Oplock granted on inode %p", 212 cFYI(1, "Exclusive Oplock granted on inode %p", inode);
245 file->f_path.dentry->d_inode);
246 } else if ((*oplock & 0xF) == OPLOCK_READ) 213 } else if ((*oplock & 0xF) == OPLOCK_READ)
247 pCifsInode->clientCanCacheRead = true; 214 pCifsInode->clientCanCacheRead = true;
248 215
@@ -256,7 +223,7 @@ int cifs_open(struct inode *inode, struct file *file)
256 __u32 oplock; 223 __u32 oplock;
257 struct cifs_sb_info *cifs_sb; 224 struct cifs_sb_info *cifs_sb;
258 struct cifsTconInfo *tcon; 225 struct cifsTconInfo *tcon;
259 struct cifsFileInfo *pCifsFile; 226 struct cifsFileInfo *pCifsFile = NULL;
260 struct cifsInodeInfo *pCifsInode; 227 struct cifsInodeInfo *pCifsInode;
261 char *full_path = NULL; 228 char *full_path = NULL;
262 int desiredAccess; 229 int desiredAccess;
@@ -270,12 +237,6 @@ int cifs_open(struct inode *inode, struct file *file)
270 tcon = cifs_sb->tcon; 237 tcon = cifs_sb->tcon;
271 238
272 pCifsInode = CIFS_I(file->f_path.dentry->d_inode); 239 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
273 pCifsFile = cifs_fill_filedata(file);
274 if (pCifsFile) {
275 rc = 0;
276 FreeXid(xid);
277 return rc;
278 }
279 240
280 full_path = build_path_from_dentry(file->f_path.dentry); 241 full_path = build_path_from_dentry(file->f_path.dentry);
281 if (full_path == NULL) { 242 if (full_path == NULL) {
@@ -299,8 +260,7 @@ int cifs_open(struct inode *inode, struct file *file)
299 int oflags = (int) cifs_posix_convert_flags(file->f_flags); 260 int oflags = (int) cifs_posix_convert_flags(file->f_flags);
300 oflags |= SMB_O_CREAT; 261 oflags |= SMB_O_CREAT;
301 /* can not refresh inode info since size could be stale */ 262 /* can not refresh inode info since size could be stale */
302 rc = cifs_posix_open(full_path, &inode, file->f_path.mnt, 263 rc = cifs_posix_open(full_path, &inode, inode->i_sb,
303 inode->i_sb,
304 cifs_sb->mnt_file_mode /* ignored */, 264 cifs_sb->mnt_file_mode /* ignored */,
305 oflags, &oplock, &netfid, xid); 265 oflags, &oplock, &netfid, xid);
306 if (rc == 0) { 266 if (rc == 0) {
@@ -308,9 +268,20 @@ int cifs_open(struct inode *inode, struct file *file)
308 /* no need for special case handling of setting mode 268 /* no need for special case handling of setting mode
309 on read only files needed here */ 269 on read only files needed here */
310 270
311 pCifsFile = cifs_fill_filedata(file); 271 rc = cifs_posix_open_inode_helper(inode, file,
312 cifs_posix_open_inode_helper(inode, file, pCifsInode, 272 pCifsInode, oplock, netfid);
313 oplock, netfid); 273 if (rc != 0) {
274 CIFSSMBClose(xid, tcon, netfid);
275 goto out;
276 }
277
278 pCifsFile = cifs_new_fileinfo(inode, netfid, file,
279 file->f_path.mnt,
280 oflags);
281 if (pCifsFile == NULL) {
282 CIFSSMBClose(xid, tcon, netfid);
283 rc = -ENOMEM;
284 }
314 goto out; 285 goto out;
315 } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { 286 } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
316 if (tcon->ses->serverNOS) 287 if (tcon->ses->serverNOS)
@@ -391,17 +362,17 @@ int cifs_open(struct inode *inode, struct file *file)
391 goto out; 362 goto out;
392 } 363 }
393 364
365 rc = cifs_open_inode_helper(inode, tcon, &oplock, buf, full_path, xid);
366 if (rc != 0)
367 goto out;
368
394 pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, 369 pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt,
395 file->f_flags); 370 file->f_flags);
396 file->private_data = pCifsFile; 371 if (pCifsFile == NULL) {
397 if (file->private_data == NULL) {
398 rc = -ENOMEM; 372 rc = -ENOMEM;
399 goto out; 373 goto out;
400 } 374 }
401 375
402 rc = cifs_open_inode_helper(inode, file, pCifsInode, pCifsFile, tcon,
403 &oplock, buf, full_path, xid);
404
405 if (oplock & CIFS_CREATE_ACTION) { 376 if (oplock & CIFS_CREATE_ACTION) {
406 /* time to set mode which we can not set earlier due to 377 /* time to set mode which we can not set earlier due to
407 problems creating new read-only files */ 378 problems creating new read-only files */
@@ -513,8 +484,7 @@ reopen_error_exit:
513 le64_to_cpu(tcon->fsUnixInfo.Capability))) { 484 le64_to_cpu(tcon->fsUnixInfo.Capability))) {
514 int oflags = (int) cifs_posix_convert_flags(file->f_flags); 485 int oflags = (int) cifs_posix_convert_flags(file->f_flags);
515 /* can not refresh inode info since size could be stale */ 486 /* can not refresh inode info since size could be stale */
516 rc = cifs_posix_open(full_path, NULL, file->f_path.mnt, 487 rc = cifs_posix_open(full_path, NULL, inode->i_sb,
517 inode->i_sb,
518 cifs_sb->mnt_file_mode /* ignored */, 488 cifs_sb->mnt_file_mode /* ignored */,
519 oflags, &oplock, &netfid, xid); 489 oflags, &oplock, &netfid, xid);
520 if (rc == 0) { 490 if (rc == 0) {
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 62b324f26a56..6f0683c68952 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1401,6 +1401,10 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
1401 if (rc == 0 || rc != -ETXTBSY) 1401 if (rc == 0 || rc != -ETXTBSY)
1402 return rc; 1402 return rc;
1403 1403
1404 /* open-file renames don't work across directories */
1405 if (to_dentry->d_parent != from_dentry->d_parent)
1406 return rc;
1407
1404 /* open the file to be renamed -- we need DELETE perms */ 1408 /* open the file to be renamed -- we need DELETE perms */
1405 rc = CIFSSMBOpen(xid, pTcon, fromPath, FILE_OPEN, DELETE, 1409 rc = CIFSSMBOpen(xid, pTcon, fromPath, FILE_OPEN, DELETE,
1406 CREATE_NOT_DIR, &srcfid, &oplock, NULL, 1410 CREATE_NOT_DIR, &srcfid, &oplock, NULL,
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 7707389bdf2c..0a57cb7db5dd 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -730,15 +730,7 @@ ssetup_ntlmssp_authenticate:
730 730
731 /* calculate session key */ 731 /* calculate session key */
732 setup_ntlmv2_rsp(ses, v2_sess_key, nls_cp); 732 setup_ntlmv2_rsp(ses, v2_sess_key, nls_cp);
733 if (first_time) /* should this be moved into common code 733 /* FIXME: calculate MAC key */
734 with similar ntlmv2 path? */
735 /* cifs_calculate_ntlmv2_mac_key(ses->server->mac_signing_key,
736 response BB FIXME, v2_sess_key); */
737
738 /* copy session key */
739
740 /* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE);
741 bcc_ptr += LM2_SESS_KEY_SIZE; */
742 memcpy(bcc_ptr, (char *)v2_sess_key, 734 memcpy(bcc_ptr, (char *)v2_sess_key,
743 sizeof(struct ntlmv2_resp)); 735 sizeof(struct ntlmv2_resp));
744 bcc_ptr += sizeof(struct ntlmv2_resp); 736 bcc_ptr += sizeof(struct ntlmv2_resp);
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index ca7e2a0ed98a..2bcc0431bada 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -200,6 +200,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
200 return error; 200 return error;
201 else { 201 else {
202 inode->i_mode = mode; 202 inode->i_mode = mode;
203 inode->i_ctime = CURRENT_TIME_SEC;
203 mark_inode_dirty(inode); 204 mark_inode_dirty(inode);
204 if (error == 0) 205 if (error == 0)
205 acl = NULL; 206 acl = NULL;
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index 01552abbca3c..8a11fe212183 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -205,6 +205,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
205 return error; 205 return error;
206 else { 206 else {
207 inode->i_mode = mode; 207 inode->i_mode = mode;
208 inode->i_ctime = CURRENT_TIME_SEC;
208 ext3_mark_inode_dirty(handle, inode); 209 ext3_mark_inode_dirty(handle, inode);
209 if (error == 0) 210 if (error == 0)
210 acl = NULL; 211 acl = NULL;
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 7ec9b34a59f8..d25b5257b7a1 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1286,6 +1286,55 @@ static void nfs4_session_set_rwsize(struct nfs_server *server)
1286#endif /* CONFIG_NFS_V4_1 */ 1286#endif /* CONFIG_NFS_V4_1 */
1287} 1287}
1288 1288
1289static int nfs4_server_common_setup(struct nfs_server *server,
1290 struct nfs_fh *mntfh)
1291{
1292 struct nfs_fattr *fattr;
1293 int error;
1294
1295 BUG_ON(!server->nfs_client);
1296 BUG_ON(!server->nfs_client->rpc_ops);
1297 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1298
1299 fattr = nfs_alloc_fattr();
1300 if (fattr == NULL)
1301 return -ENOMEM;
1302
1303 /* We must ensure the session is initialised first */
1304 error = nfs4_init_session(server);
1305 if (error < 0)
1306 goto out;
1307
1308 /* Probe the root fh to retrieve its FSID and filehandle */
1309 error = nfs4_get_rootfh(server, mntfh);
1310 if (error < 0)
1311 goto out;
1312
1313 dprintk("Server FSID: %llx:%llx\n",
1314 (unsigned long long) server->fsid.major,
1315 (unsigned long long) server->fsid.minor);
1316 dprintk("Mount FH: %d\n", mntfh->size);
1317
1318 nfs4_session_set_rwsize(server);
1319
1320 error = nfs_probe_fsinfo(server, mntfh, fattr);
1321 if (error < 0)
1322 goto out;
1323
1324 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN)
1325 server->namelen = NFS4_MAXNAMLEN;
1326
1327 spin_lock(&nfs_client_lock);
1328 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
1329 list_add_tail(&server->master_link, &nfs_volume_list);
1330 spin_unlock(&nfs_client_lock);
1331
1332 server->mount_time = jiffies;
1333out:
1334 nfs_free_fattr(fattr);
1335 return error;
1336}
1337
1289/* 1338/*
1290 * Create a version 4 volume record 1339 * Create a version 4 volume record
1291 */ 1340 */
@@ -1346,7 +1395,6 @@ error:
1346struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data, 1395struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
1347 struct nfs_fh *mntfh) 1396 struct nfs_fh *mntfh)
1348{ 1397{
1349 struct nfs_fattr *fattr;
1350 struct nfs_server *server; 1398 struct nfs_server *server;
1351 int error; 1399 int error;
1352 1400
@@ -1356,55 +1404,19 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
1356 if (!server) 1404 if (!server)
1357 return ERR_PTR(-ENOMEM); 1405 return ERR_PTR(-ENOMEM);
1358 1406
1359 error = -ENOMEM;
1360 fattr = nfs_alloc_fattr();
1361 if (fattr == NULL)
1362 goto error;
1363
1364 /* set up the general RPC client */ 1407 /* set up the general RPC client */
1365 error = nfs4_init_server(server, data); 1408 error = nfs4_init_server(server, data);
1366 if (error < 0) 1409 if (error < 0)
1367 goto error; 1410 goto error;
1368 1411
1369 BUG_ON(!server->nfs_client); 1412 error = nfs4_server_common_setup(server, mntfh);
1370 BUG_ON(!server->nfs_client->rpc_ops);
1371 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1372
1373 error = nfs4_init_session(server);
1374 if (error < 0)
1375 goto error;
1376
1377 /* Probe the root fh to retrieve its FSID */
1378 error = nfs4_get_rootfh(server, mntfh);
1379 if (error < 0) 1413 if (error < 0)
1380 goto error; 1414 goto error;
1381 1415
1382 dprintk("Server FSID: %llx:%llx\n",
1383 (unsigned long long) server->fsid.major,
1384 (unsigned long long) server->fsid.minor);
1385 dprintk("Mount FH: %d\n", mntfh->size);
1386
1387 nfs4_session_set_rwsize(server);
1388
1389 error = nfs_probe_fsinfo(server, mntfh, fattr);
1390 if (error < 0)
1391 goto error;
1392
1393 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN)
1394 server->namelen = NFS4_MAXNAMLEN;
1395
1396 spin_lock(&nfs_client_lock);
1397 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
1398 list_add_tail(&server->master_link, &nfs_volume_list);
1399 spin_unlock(&nfs_client_lock);
1400
1401 server->mount_time = jiffies;
1402 dprintk("<-- nfs4_create_server() = %p\n", server); 1416 dprintk("<-- nfs4_create_server() = %p\n", server);
1403 nfs_free_fattr(fattr);
1404 return server; 1417 return server;
1405 1418
1406error: 1419error:
1407 nfs_free_fattr(fattr);
1408 nfs_free_server(server); 1420 nfs_free_server(server);
1409 dprintk("<-- nfs4_create_server() = error %d\n", error); 1421 dprintk("<-- nfs4_create_server() = error %d\n", error);
1410 return ERR_PTR(error); 1422 return ERR_PTR(error);
@@ -1418,7 +1430,6 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1418{ 1430{
1419 struct nfs_client *parent_client; 1431 struct nfs_client *parent_client;
1420 struct nfs_server *server, *parent_server; 1432 struct nfs_server *server, *parent_server;
1421 struct nfs_fattr *fattr;
1422 int error; 1433 int error;
1423 1434
1424 dprintk("--> nfs4_create_referral_server()\n"); 1435 dprintk("--> nfs4_create_referral_server()\n");
@@ -1427,11 +1438,6 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1427 if (!server) 1438 if (!server)
1428 return ERR_PTR(-ENOMEM); 1439 return ERR_PTR(-ENOMEM);
1429 1440
1430 error = -ENOMEM;
1431 fattr = nfs_alloc_fattr();
1432 if (fattr == NULL)
1433 goto error;
1434
1435 parent_server = NFS_SB(data->sb); 1441 parent_server = NFS_SB(data->sb);
1436 parent_client = parent_server->nfs_client; 1442 parent_client = parent_server->nfs_client;
1437 1443
@@ -1456,40 +1462,14 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1456 if (error < 0) 1462 if (error < 0)
1457 goto error; 1463 goto error;
1458 1464
1459 BUG_ON(!server->nfs_client); 1465 error = nfs4_server_common_setup(server, mntfh);
1460 BUG_ON(!server->nfs_client->rpc_ops);
1461 BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops);
1462
1463 /* Probe the root fh to retrieve its FSID and filehandle */
1464 error = nfs4_get_rootfh(server, mntfh);
1465 if (error < 0)
1466 goto error;
1467
1468 /* probe the filesystem info for this server filesystem */
1469 error = nfs_probe_fsinfo(server, mntfh, fattr);
1470 if (error < 0) 1466 if (error < 0)
1471 goto error; 1467 goto error;
1472 1468
1473 if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN)
1474 server->namelen = NFS4_MAXNAMLEN;
1475
1476 dprintk("Referral FSID: %llx:%llx\n",
1477 (unsigned long long) server->fsid.major,
1478 (unsigned long long) server->fsid.minor);
1479
1480 spin_lock(&nfs_client_lock);
1481 list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
1482 list_add_tail(&server->master_link, &nfs_volume_list);
1483 spin_unlock(&nfs_client_lock);
1484
1485 server->mount_time = jiffies;
1486
1487 nfs_free_fattr(fattr);
1488 dprintk("<-- nfs_create_referral_server() = %p\n", server); 1469 dprintk("<-- nfs_create_referral_server() = %p\n", server);
1489 return server; 1470 return server;
1490 1471
1491error: 1472error:
1492 nfs_free_fattr(fattr);
1493 nfs_free_server(server); 1473 nfs_free_server(server);
1494 dprintk("<-- nfs4_create_referral_server() = error %d\n", error); 1474 dprintk("<-- nfs4_create_referral_server() = error %d\n", error);
1495 return ERR_PTR(error); 1475 return ERR_PTR(error);
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 7428f7d6273b..a70e446e1605 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -146,7 +146,7 @@ int nfs4_get_rootfh(struct nfs_server *server, struct nfs_fh *mntfh)
146 goto out; 146 goto out;
147 } 147 }
148 148
149 if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_MODE) 149 if (!(fsinfo.fattr->valid & NFS_ATTR_FATTR_TYPE)
150 || !S_ISDIR(fsinfo.fattr->mode)) { 150 || !S_ISDIR(fsinfo.fattr->mode)) {
151 printk(KERN_ERR "nfs4_get_rootfh:" 151 printk(KERN_ERR "nfs4_get_rootfh:"
152 " getroot encountered non-directory\n"); 152 " getroot encountered non-directory\n");
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 6bdef28efa33..65c8dae4b267 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -862,8 +862,8 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const
862 bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; 862 bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET;
863 *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); 863 *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
864 *p++ = cpu_to_be32(0); 864 *p++ = cpu_to_be32(0);
865 *p++ = cpu_to_be32(iap->ia_mtime.tv_sec); 865 *p++ = cpu_to_be32(iap->ia_atime.tv_sec);
866 *p++ = cpu_to_be32(iap->ia_mtime.tv_nsec); 866 *p++ = cpu_to_be32(iap->ia_atime.tv_nsec);
867 } 867 }
868 else if (iap->ia_valid & ATTR_ATIME) { 868 else if (iap->ia_valid & ATTR_ATIME) {
869 bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; 869 bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 04214fc5c304..f9df16de4a56 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -570,6 +570,22 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
570 nfs_show_mountd_netid(m, nfss, showdefaults); 570 nfs_show_mountd_netid(m, nfss, showdefaults);
571} 571}
572 572
573#ifdef CONFIG_NFS_V4
574static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
575 int showdefaults)
576{
577 struct nfs_client *clp = nfss->nfs_client;
578
579 seq_printf(m, ",clientaddr=%s", clp->cl_ipaddr);
580 seq_printf(m, ",minorversion=%u", clp->cl_minorversion);
581}
582#else
583static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
584 int showdefaults)
585{
586}
587#endif
588
573/* 589/*
574 * Describe the mount options in force on this server representation 590 * Describe the mount options in force on this server representation
575 */ 591 */
@@ -631,11 +647,9 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
631 647
632 if (version != 4) 648 if (version != 4)
633 nfs_show_mountd_options(m, nfss, showdefaults); 649 nfs_show_mountd_options(m, nfss, showdefaults);
650 else
651 nfs_show_nfsv4_options(m, nfss, showdefaults);
634 652
635#ifdef CONFIG_NFS_V4
636 if (clp->rpc_ops->version == 4)
637 seq_printf(m, ",clientaddr=%s", clp->cl_ipaddr);
638#endif
639 if (nfss->options & NFS_OPTION_FSCACHE) 653 if (nfss->options & NFS_OPTION_FSCACHE)
640 seq_printf(m, ",fsc"); 654 seq_printf(m, ",fsc");
641} 655}
diff --git a/fs/ocfs2/reservations.c b/fs/ocfs2/reservations.c
index 40650021fc24..d8b6e4259b80 100644
--- a/fs/ocfs2/reservations.c
+++ b/fs/ocfs2/reservations.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/fs.h> 27#include <linux/fs.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/slab.h>
30#include <linux/highmem.h> 29#include <linux/highmem.h>
31#include <linux/bitops.h> 30#include <linux/bitops.h>
32#include <linux/list.h> 31#include <linux/list.h>
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index ce94801f48ca..d9396a4fc7ff 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -209,6 +209,9 @@ void proc_device_tree_add_node(struct device_node *np,
209 for (pp = np->properties; pp != NULL; pp = pp->next) { 209 for (pp = np->properties; pp != NULL; pp = pp->next) {
210 p = pp->name; 210 p = pp->name;
211 211
212 if (strchr(p, '/'))
213 continue;
214
212 if (duplicate_name(de, p)) 215 if (duplicate_name(de, p))
213 p = fixup_name(np, de, p); 216 p = fixup_name(np, de, p);
214 217
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 5958d7845bd5..17714beb868e 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -212,7 +212,7 @@ char const *acpi_gbl_exception_names_env[] = {
212 "AE_NO_GLOBAL_LOCK", 212 "AE_NO_GLOBAL_LOCK",
213 "AE_ABORT_METHOD", 213 "AE_ABORT_METHOD",
214 "AE_SAME_HANDLER", 214 "AE_SAME_HANDLER",
215 "AE_WAKE_ONLY_GPE", 215 "AE_NO_HANDLER",
216 "AE_OWNER_ID_LIMIT" 216 "AE_OWNER_ID_LIMIT"
217}; 217};
218 218
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 0e4ab1fe5966..1371cc997393 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -69,6 +69,7 @@ extern acpi_name acpi_gbl_trace_method_name;
69extern u32 acpi_gbl_trace_flags; 69extern u32 acpi_gbl_trace_flags;
70extern u8 acpi_gbl_enable_aml_debug_object; 70extern u8 acpi_gbl_enable_aml_debug_object;
71extern u8 acpi_gbl_copy_dsdt_locally; 71extern u8 acpi_gbl_copy_dsdt_locally;
72extern u8 acpi_gbl_truncate_io_addresses;
72 73
73extern u32 acpi_current_gpe_count; 74extern u32 acpi_current_gpe_count;
74extern struct acpi_table_fadt acpi_gbl_FADT; 75extern struct acpi_table_fadt acpi_gbl_FADT;
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index bade172cad47..d55f4a7b824d 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -663,10 +663,11 @@ typedef u32 acpi_event_status;
663#define ACPI_GPE_MAX 0xFF 663#define ACPI_GPE_MAX 0xFF
664#define ACPI_NUM_GPE 256 664#define ACPI_NUM_GPE 256
665 665
666/* Actions for acpi_set_gpe */ 666/* Actions for acpi_set_gpe and acpi_hw_low_set_gpe */
667 667
668#define ACPI_GPE_ENABLE 0 668#define ACPI_GPE_ENABLE 0
669#define ACPI_GPE_DISABLE 1 669#define ACPI_GPE_DISABLE 1
670#define ACPI_GPE_COND_ENABLE 2
670 671
671/* gpe_types for acpi_enable_gpe and acpi_disable_gpe */ 672/* gpe_types for acpi_enable_gpe and acpi_disable_gpe */
672 673
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 0c621604baa1..e3d00fdb858d 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -525,13 +525,21 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
525 return cgrp->subsys[subsys_id]; 525 return cgrp->subsys[subsys_id];
526} 526}
527 527
528static inline struct cgroup_subsys_state *task_subsys_state( 528/*
529 struct task_struct *task, int subsys_id) 529 * function to get the cgroup_subsys_state which allows for extra
530 * rcu_dereference_check() conditions, such as locks used during the
531 * cgroup_subsys::attach() methods.
532 */
533#define task_subsys_state_check(task, subsys_id, __c) \
534 rcu_dereference_check(task->cgroups->subsys[subsys_id], \
535 rcu_read_lock_held() || \
536 lockdep_is_held(&task->alloc_lock) || \
537 cgroup_lock_is_held() || (__c))
538
539static inline struct cgroup_subsys_state *
540task_subsys_state(struct task_struct *task, int subsys_id)
530{ 541{
531 return rcu_dereference_check(task->cgroups->subsys[subsys_id], 542 return task_subsys_state_check(task, subsys_id, false);
532 rcu_read_lock_held() ||
533 lockdep_is_held(&task->alloc_lock) ||
534 cgroup_lock_is_held());
535} 543}
536 544
537static inline struct cgroup* task_cgroup(struct task_struct *task, 545static inline struct cgroup* task_cgroup(struct task_struct *task,
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 5e781d824e6d..bc7d6bb4cd8e 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -256,22 +256,22 @@ static inline int hibernate(void) { return -ENOSYS; }
256static inline bool system_entering_hibernation(void) { return false; } 256static inline bool system_entering_hibernation(void) { return false; }
257#endif /* CONFIG_HIBERNATION */ 257#endif /* CONFIG_HIBERNATION */
258 258
259#ifdef CONFIG_HIBERNATION_NVS 259#ifdef CONFIG_SUSPEND_NVS
260extern int hibernate_nvs_register(unsigned long start, unsigned long size); 260extern int suspend_nvs_register(unsigned long start, unsigned long size);
261extern int hibernate_nvs_alloc(void); 261extern int suspend_nvs_alloc(void);
262extern void hibernate_nvs_free(void); 262extern void suspend_nvs_free(void);
263extern void hibernate_nvs_save(void); 263extern void suspend_nvs_save(void);
264extern void hibernate_nvs_restore(void); 264extern void suspend_nvs_restore(void);
265#else /* CONFIG_HIBERNATION_NVS */ 265#else /* CONFIG_SUSPEND_NVS */
266static inline int hibernate_nvs_register(unsigned long a, unsigned long b) 266static inline int suspend_nvs_register(unsigned long a, unsigned long b)
267{ 267{
268 return 0; 268 return 0;
269} 269}
270static inline int hibernate_nvs_alloc(void) { return 0; } 270static inline int suspend_nvs_alloc(void) { return 0; }
271static inline void hibernate_nvs_free(void) {} 271static inline void suspend_nvs_free(void) {}
272static inline void hibernate_nvs_save(void) {} 272static inline void suspend_nvs_save(void) {}
273static inline void hibernate_nvs_restore(void) {} 273static inline void suspend_nvs_restore(void) {}
274#endif /* CONFIG_HIBERNATION_NVS */ 274#endif /* CONFIG_SUSPEND_NVS */
275 275
276#ifdef CONFIG_PM_SLEEP 276#ifdef CONFIG_PM_SLEEP
277void save_processor_state(void); 277void save_processor_state(void);
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 9a59d1f98cd4..103d1b61aacb 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -14,6 +14,7 @@
14 * See the file COPYING for more details. 14 * See the file COPYING for more details.
15 */ 15 */
16 16
17#include <linux/errno.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
19 20
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 92456f1035f5..899003d18db9 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -134,7 +134,7 @@ struct linux_xfrm_mib {
134#define SNMP_ADD_STATS_USER(mib, field, addend) \ 134#define SNMP_ADD_STATS_USER(mib, field, addend) \
135 this_cpu_add(mib[1]->mibs[field], addend) 135 this_cpu_add(mib[1]->mibs[field], addend)
136#define SNMP_ADD_STATS(mib, field, addend) \ 136#define SNMP_ADD_STATS(mib, field, addend) \
137 this_cpu_add(mib[0]->mibs[field], addend) 137 this_cpu_add(mib[!in_softirq()]->mibs[field], addend)
138/* 138/*
139 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 139 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
140 * to make @ptr a non-percpu pointer. 140 * to make @ptr a non-percpu pointer.
diff --git a/init/main.c b/init/main.c
index e2a2bf3a169f..e407a05adc29 100644
--- a/init/main.c
+++ b/init/main.c
@@ -123,7 +123,9 @@ static char *ramdisk_execute_command;
123 123
124#ifdef CONFIG_SMP 124#ifdef CONFIG_SMP
125/* Setup configured maximum number of CPUs to activate */ 125/* Setup configured maximum number of CPUs to activate */
126unsigned int __initdata setup_max_cpus = NR_CPUS; 126unsigned int setup_max_cpus = NR_CPUS;
127EXPORT_SYMBOL(setup_max_cpus);
128
127 129
128/* 130/*
129 * Setup routine for controlling SMP activation 131 * Setup routine for controlling SMP activation
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 3164ba7ce151..e1497481fe8a 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -456,6 +456,9 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
456 /* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */ 456 /* note that IRQF_TRIGGER_MASK == IRQ_TYPE_SENSE_MASK */
457 desc->status &= ~(IRQ_LEVEL | IRQ_TYPE_SENSE_MASK); 457 desc->status &= ~(IRQ_LEVEL | IRQ_TYPE_SENSE_MASK);
458 desc->status |= flags; 458 desc->status |= flags;
459
460 if (chip != desc->chip)
461 irq_chip_set_defaults(desc->chip);
459 } 462 }
460 463
461 return ret; 464 return ret;
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 5c36ea9d55d2..ca6066a6952e 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -99,9 +99,13 @@ config PM_SLEEP_ADVANCED_DEBUG
99 depends on PM_ADVANCED_DEBUG 99 depends on PM_ADVANCED_DEBUG
100 default n 100 default n
101 101
102config SUSPEND_NVS
103 bool
104
102config SUSPEND 105config SUSPEND
103 bool "Suspend to RAM and standby" 106 bool "Suspend to RAM and standby"
104 depends on PM && ARCH_SUSPEND_POSSIBLE 107 depends on PM && ARCH_SUSPEND_POSSIBLE
108 select SUSPEND_NVS if HAS_IOMEM
105 default y 109 default y
106 ---help--- 110 ---help---
107 Allow the system to enter sleep states in which main memory is 111 Allow the system to enter sleep states in which main memory is
@@ -130,13 +134,10 @@ config SUSPEND_FREEZER
130 134
131 Turning OFF this setting is NOT recommended! If in doubt, say Y. 135 Turning OFF this setting is NOT recommended! If in doubt, say Y.
132 136
133config HIBERNATION_NVS
134 bool
135
136config HIBERNATION 137config HIBERNATION
137 bool "Hibernation (aka 'suspend to disk')" 138 bool "Hibernation (aka 'suspend to disk')"
138 depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE 139 depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
139 select HIBERNATION_NVS if HAS_IOMEM 140 select SUSPEND_NVS if HAS_IOMEM
140 ---help--- 141 ---help---
141 Enable the suspend to disk (STD) functionality, which is usually 142 Enable the suspend to disk (STD) functionality, which is usually
142 called "hibernation" in user interfaces. STD checkpoints the 143 called "hibernation" in user interfaces. STD checkpoints the
diff --git a/kernel/power/Makefile b/kernel/power/Makefile
index 524e058dcf06..f9063c6b185d 100644
--- a/kernel/power/Makefile
+++ b/kernel/power/Makefile
@@ -10,6 +10,6 @@ obj-$(CONFIG_SUSPEND) += suspend.o
10obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o 10obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o
11obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \ 11obj-$(CONFIG_HIBERNATION) += hibernate.o snapshot.o swap.o user.o \
12 block_io.o 12 block_io.o
13obj-$(CONFIG_HIBERNATION_NVS) += hibernate_nvs.o 13obj-$(CONFIG_SUSPEND_NVS) += nvs.o
14 14
15obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o 15obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o
diff --git a/kernel/power/hibernate_nvs.c b/kernel/power/nvs.c
index fdcad9ed5a7b..1836db60bbb6 100644
--- a/kernel/power/hibernate_nvs.c
+++ b/kernel/power/nvs.c
@@ -15,7 +15,7 @@
15 15
16/* 16/*
17 * Platforms, like ACPI, may want us to save some memory used by them during 17 * Platforms, like ACPI, may want us to save some memory used by them during
18 * hibernation and to restore the contents of this memory during the subsequent 18 * suspend and to restore the contents of this memory during the subsequent
19 * resume. The code below implements a mechanism allowing us to do that. 19 * resume. The code below implements a mechanism allowing us to do that.
20 */ 20 */
21 21
@@ -30,7 +30,7 @@ struct nvs_page {
30static LIST_HEAD(nvs_list); 30static LIST_HEAD(nvs_list);
31 31
32/** 32/**
33 * hibernate_nvs_register - register platform NVS memory region to save 33 * suspend_nvs_register - register platform NVS memory region to save
34 * @start - physical address of the region 34 * @start - physical address of the region
35 * @size - size of the region 35 * @size - size of the region
36 * 36 *
@@ -38,7 +38,7 @@ static LIST_HEAD(nvs_list);
38 * things so that the data from page-aligned addresses in this region will 38 * things so that the data from page-aligned addresses in this region will
39 * be copied into separate RAM pages. 39 * be copied into separate RAM pages.
40 */ 40 */
41int hibernate_nvs_register(unsigned long start, unsigned long size) 41int suspend_nvs_register(unsigned long start, unsigned long size)
42{ 42{
43 struct nvs_page *entry, *next; 43 struct nvs_page *entry, *next;
44 44
@@ -68,9 +68,9 @@ int hibernate_nvs_register(unsigned long start, unsigned long size)
68} 68}
69 69
70/** 70/**
71 * hibernate_nvs_free - free data pages allocated for saving NVS regions 71 * suspend_nvs_free - free data pages allocated for saving NVS regions
72 */ 72 */
73void hibernate_nvs_free(void) 73void suspend_nvs_free(void)
74{ 74{
75 struct nvs_page *entry; 75 struct nvs_page *entry;
76 76
@@ -86,16 +86,16 @@ void hibernate_nvs_free(void)
86} 86}
87 87
88/** 88/**
89 * hibernate_nvs_alloc - allocate memory necessary for saving NVS regions 89 * suspend_nvs_alloc - allocate memory necessary for saving NVS regions
90 */ 90 */
91int hibernate_nvs_alloc(void) 91int suspend_nvs_alloc(void)
92{ 92{
93 struct nvs_page *entry; 93 struct nvs_page *entry;
94 94
95 list_for_each_entry(entry, &nvs_list, node) { 95 list_for_each_entry(entry, &nvs_list, node) {
96 entry->data = (void *)__get_free_page(GFP_KERNEL); 96 entry->data = (void *)__get_free_page(GFP_KERNEL);
97 if (!entry->data) { 97 if (!entry->data) {
98 hibernate_nvs_free(); 98 suspend_nvs_free();
99 return -ENOMEM; 99 return -ENOMEM;
100 } 100 }
101 } 101 }
@@ -103,9 +103,9 @@ int hibernate_nvs_alloc(void)
103} 103}
104 104
105/** 105/**
106 * hibernate_nvs_save - save NVS memory regions 106 * suspend_nvs_save - save NVS memory regions
107 */ 107 */
108void hibernate_nvs_save(void) 108void suspend_nvs_save(void)
109{ 109{
110 struct nvs_page *entry; 110 struct nvs_page *entry;
111 111
@@ -119,12 +119,12 @@ void hibernate_nvs_save(void)
119} 119}
120 120
121/** 121/**
122 * hibernate_nvs_restore - restore NVS memory regions 122 * suspend_nvs_restore - restore NVS memory regions
123 * 123 *
124 * This function is going to be called with interrupts disabled, so it 124 * This function is going to be called with interrupts disabled, so it
125 * cannot iounmap the virtual addresses used to access the NVS region. 125 * cannot iounmap the virtual addresses used to access the NVS region.
126 */ 126 */
127void hibernate_nvs_restore(void) 127void suspend_nvs_restore(void)
128{ 128{
129 struct nvs_page *entry; 129 struct nvs_page *entry;
130 130
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 56e7dbb8b996..f37cb7dd4402 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -16,6 +16,12 @@
16#include <linux/cpu.h> 16#include <linux/cpu.h>
17#include <linux/syscalls.h> 17#include <linux/syscalls.h>
18#include <linux/gfp.h> 18#include <linux/gfp.h>
19#include <linux/io.h>
20#include <linux/kernel.h>
21#include <linux/list.h>
22#include <linux/mm.h>
23#include <linux/slab.h>
24#include <linux/suspend.h>
19 25
20#include "power.h" 26#include "power.h"
21 27
diff --git a/kernel/sched.c b/kernel/sched.c
index 3c5d34a4e932..8c473adbf223 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -306,52 +306,6 @@ static int init_task_group_load = INIT_TASK_GROUP_LOAD;
306 */ 306 */
307struct task_group init_task_group; 307struct task_group init_task_group;
308 308
309/* return group to which a task belongs */
310static inline struct task_group *task_group(struct task_struct *p)
311{
312 struct task_group *tg;
313
314#ifdef CONFIG_CGROUP_SCHED
315 tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
316 struct task_group, css);
317#else
318 tg = &init_task_group;
319#endif
320 return tg;
321}
322
323/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
324static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
325{
326 /*
327 * Strictly speaking this rcu_read_lock() is not needed since the
328 * task_group is tied to the cgroup, which in turn can never go away
329 * as long as there are tasks attached to it.
330 *
331 * However since task_group() uses task_subsys_state() which is an
332 * rcu_dereference() user, this quiets CONFIG_PROVE_RCU.
333 */
334 rcu_read_lock();
335#ifdef CONFIG_FAIR_GROUP_SCHED
336 p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
337 p->se.parent = task_group(p)->se[cpu];
338#endif
339
340#ifdef CONFIG_RT_GROUP_SCHED
341 p->rt.rt_rq = task_group(p)->rt_rq[cpu];
342 p->rt.parent = task_group(p)->rt_se[cpu];
343#endif
344 rcu_read_unlock();
345}
346
347#else
348
349static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
350static inline struct task_group *task_group(struct task_struct *p)
351{
352 return NULL;
353}
354
355#endif /* CONFIG_CGROUP_SCHED */ 309#endif /* CONFIG_CGROUP_SCHED */
356 310
357/* CFS-related fields in a runqueue */ 311/* CFS-related fields in a runqueue */
@@ -644,6 +598,49 @@ static inline int cpu_of(struct rq *rq)
644#define cpu_curr(cpu) (cpu_rq(cpu)->curr) 598#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
645#define raw_rq() (&__raw_get_cpu_var(runqueues)) 599#define raw_rq() (&__raw_get_cpu_var(runqueues))
646 600
601#ifdef CONFIG_CGROUP_SCHED
602
603/*
604 * Return the group to which this tasks belongs.
605 *
606 * We use task_subsys_state_check() and extend the RCU verification
607 * with lockdep_is_held(&task_rq(p)->lock) because cpu_cgroup_attach()
608 * holds that lock for each task it moves into the cgroup. Therefore
609 * by holding that lock, we pin the task to the current cgroup.
610 */
611static inline struct task_group *task_group(struct task_struct *p)
612{
613 struct cgroup_subsys_state *css;
614
615 css = task_subsys_state_check(p, cpu_cgroup_subsys_id,
616 lockdep_is_held(&task_rq(p)->lock));
617 return container_of(css, struct task_group, css);
618}
619
620/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
621static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
622{
623#ifdef CONFIG_FAIR_GROUP_SCHED
624 p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
625 p->se.parent = task_group(p)->se[cpu];
626#endif
627
628#ifdef CONFIG_RT_GROUP_SCHED
629 p->rt.rt_rq = task_group(p)->rt_rq[cpu];
630 p->rt.parent = task_group(p)->rt_se[cpu];
631#endif
632}
633
634#else /* CONFIG_CGROUP_SCHED */
635
636static inline void set_task_rq(struct task_struct *p, unsigned int cpu) { }
637static inline struct task_group *task_group(struct task_struct *p)
638{
639 return NULL;
640}
641
642#endif /* CONFIG_CGROUP_SCHED */
643
647inline void update_rq_clock(struct rq *rq) 644inline void update_rq_clock(struct rq *rq)
648{ 645{
649 if (!rq->skip_clock_update) 646 if (!rq->skip_clock_update)
@@ -1257,6 +1254,12 @@ static void sched_avg_update(struct rq *rq)
1257 s64 period = sched_avg_period(); 1254 s64 period = sched_avg_period();
1258 1255
1259 while ((s64)(rq->clock - rq->age_stamp) > period) { 1256 while ((s64)(rq->clock - rq->age_stamp) > period) {
1257 /*
1258 * Inline assembly required to prevent the compiler
1259 * optimising this loop into a divmod call.
1260 * See __iter_div_u64_rem() for another example of this.
1261 */
1262 asm("" : "+rm" (rq->age_stamp));
1260 rq->age_stamp += period; 1263 rq->age_stamp += period;
1261 rq->rt_avg /= 2; 1264 rq->rt_avg /= 2;
1262 } 1265 }
@@ -1660,9 +1663,6 @@ static void update_shares(struct sched_domain *sd)
1660 1663
1661static void update_h_load(long cpu) 1664static void update_h_load(long cpu)
1662{ 1665{
1663 if (root_task_group_empty())
1664 return;
1665
1666 walk_tg_tree(tg_load_down, tg_nop, (void *)cpu); 1666 walk_tg_tree(tg_load_down, tg_nop, (void *)cpu);
1667} 1667}
1668 1668
@@ -2494,7 +2494,16 @@ void sched_fork(struct task_struct *p, int clone_flags)
2494 if (p->sched_class->task_fork) 2494 if (p->sched_class->task_fork)
2495 p->sched_class->task_fork(p); 2495 p->sched_class->task_fork(p);
2496 2496
2497 /*
2498 * The child is not yet in the pid-hash so no cgroup attach races,
2499 * and the cgroup is pinned to this child due to cgroup_fork()
2500 * is ran before sched_fork().
2501 *
2502 * Silence PROVE_RCU.
2503 */
2504 rcu_read_lock();
2497 set_task_cpu(p, cpu); 2505 set_task_cpu(p, cpu);
2506 rcu_read_unlock();
2498 2507
2499#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 2508#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
2500 if (likely(sched_info_on())) 2509 if (likely(sched_info_on()))
@@ -4465,16 +4474,6 @@ recheck:
4465 } 4474 }
4466 4475
4467 if (user) { 4476 if (user) {
4468#ifdef CONFIG_RT_GROUP_SCHED
4469 /*
4470 * Do not allow realtime tasks into groups that have no runtime
4471 * assigned.
4472 */
4473 if (rt_bandwidth_enabled() && rt_policy(policy) &&
4474 task_group(p)->rt_bandwidth.rt_runtime == 0)
4475 return -EPERM;
4476#endif
4477
4478 retval = security_task_setscheduler(p, policy, param); 4477 retval = security_task_setscheduler(p, policy, param);
4479 if (retval) 4478 if (retval)
4480 return retval; 4479 return retval;
@@ -4490,6 +4489,22 @@ recheck:
4490 * runqueue lock must be held. 4489 * runqueue lock must be held.
4491 */ 4490 */
4492 rq = __task_rq_lock(p); 4491 rq = __task_rq_lock(p);
4492
4493#ifdef CONFIG_RT_GROUP_SCHED
4494 if (user) {
4495 /*
4496 * Do not allow realtime tasks into groups that have no runtime
4497 * assigned.
4498 */
4499 if (rt_bandwidth_enabled() && rt_policy(policy) &&
4500 task_group(p)->rt_bandwidth.rt_runtime == 0) {
4501 __task_rq_unlock(rq);
4502 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
4503 return -EPERM;
4504 }
4505 }
4506#endif
4507
4493 /* recheck policy now with rq lock held */ 4508 /* recheck policy now with rq lock held */
4494 if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) { 4509 if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
4495 policy = oldpolicy = -1; 4510 policy = oldpolicy = -1;
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index eed35eded602..a878b5332daa 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1240,6 +1240,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
1240 * effect of the currently running task from the load 1240 * effect of the currently running task from the load
1241 * of the current CPU: 1241 * of the current CPU:
1242 */ 1242 */
1243 rcu_read_lock();
1243 if (sync) { 1244 if (sync) {
1244 tg = task_group(current); 1245 tg = task_group(current);
1245 weight = current->se.load.weight; 1246 weight = current->se.load.weight;
@@ -1275,6 +1276,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p, int sync)
1275 balanced = this_eff_load <= prev_eff_load; 1276 balanced = this_eff_load <= prev_eff_load;
1276 } else 1277 } else
1277 balanced = true; 1278 balanced = true;
1279 rcu_read_unlock();
1278 1280
1279 /* 1281 /*
1280 * If the currently running task will sleep within 1282 * If the currently running task will sleep within
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 1d7b9bc1c034..783fbadf2202 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -315,9 +315,6 @@ void tick_nohz_stop_sched_tick(int inidle)
315 goto end; 315 goto end;
316 } 316 }
317 317
318 if (nohz_ratelimit(cpu))
319 goto end;
320
321 ts->idle_calls++; 318 ts->idle_calls++;
322 /* Read jiffies and the time when jiffies were updated last */ 319 /* Read jiffies and the time when jiffies were updated last */
323 do { 320 do {
@@ -328,7 +325,7 @@ void tick_nohz_stop_sched_tick(int inidle)
328 } while (read_seqretry(&xtime_lock, seq)); 325 } while (read_seqretry(&xtime_lock, seq));
329 326
330 if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) || 327 if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
331 arch_needs_cpu(cpu)) { 328 arch_needs_cpu(cpu) || nohz_ratelimit(cpu)) {
332 next_jiffies = last_jiffies + 1; 329 next_jiffies = last_jiffies + 1;
333 delta_jiffies = 1; 330 delta_jiffies = 1;
334 } else { 331 } else {
diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c
index 4799d7047eb0..6053982dc302 100644
--- a/kernel/trace/trace_event_perf.c
+++ b/kernel/trace/trace_event_perf.c
@@ -94,7 +94,9 @@ int perf_trace_init(struct perf_event *p_event)
94 mutex_lock(&event_mutex); 94 mutex_lock(&event_mutex);
95 list_for_each_entry(tp_event, &ftrace_events, list) { 95 list_for_each_entry(tp_event, &ftrace_events, list) {
96 if (tp_event->event.type == event_id && 96 if (tp_event->event.type == event_id &&
97 tp_event->class && tp_event->class->perf_probe && 97 tp_event->class &&
98 (tp_event->class->perf_probe ||
99 tp_event->class->reg) &&
98 try_module_get(tp_event->mod)) { 100 try_module_get(tp_event->mod)) {
99 ret = perf_trace_event_init(tp_event, p_event); 101 ret = perf_trace_event_init(tp_event, p_event);
100 break; 102 break;
diff --git a/lib/idr.c b/lib/idr.c
index c1a206901761..7f1a4f0acf50 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -602,7 +602,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
602 /* find first ent */ 602 /* find first ent */
603 n = idp->layers * IDR_BITS; 603 n = idp->layers * IDR_BITS;
604 max = 1 << n; 604 max = 1 << n;
605 p = rcu_dereference(idp->top); 605 p = rcu_dereference_raw(idp->top);
606 if (!p) 606 if (!p)
607 return NULL; 607 return NULL;
608 608
@@ -610,7 +610,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
610 while (n > 0 && p) { 610 while (n > 0 && p) {
611 n -= IDR_BITS; 611 n -= IDR_BITS;
612 *paa++ = p; 612 *paa++ = p;
613 p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]); 613 p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]);
614 } 614 }
615 615
616 if (p) { 616 if (p) {
diff --git a/mm/percpu.c b/mm/percpu.c
index 39f7dfd59585..6470e7710231 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -229,8 +229,8 @@ static int __maybe_unused pcpu_page_idx(unsigned int cpu, int page_idx)
229 return pcpu_unit_map[cpu] * pcpu_unit_pages + page_idx; 229 return pcpu_unit_map[cpu] * pcpu_unit_pages + page_idx;
230} 230}
231 231
232static unsigned long __maybe_unused pcpu_chunk_addr(struct pcpu_chunk *chunk, 232static unsigned long pcpu_chunk_addr(struct pcpu_chunk *chunk,
233 unsigned int cpu, int page_idx) 233 unsigned int cpu, int page_idx)
234{ 234{
235 return (unsigned long)chunk->base_addr + pcpu_unit_offsets[cpu] + 235 return (unsigned long)chunk->base_addr + pcpu_unit_offsets[cpu] +
236 (page_idx << PAGE_SHIFT); 236 (page_idx << PAGE_SHIFT);
@@ -978,7 +978,32 @@ bool is_kernel_percpu_address(unsigned long addr)
978 */ 978 */
979phys_addr_t per_cpu_ptr_to_phys(void *addr) 979phys_addr_t per_cpu_ptr_to_phys(void *addr)
980{ 980{
981 if (pcpu_addr_in_first_chunk(addr)) { 981 void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr);
982 bool in_first_chunk = false;
983 unsigned long first_start, first_end;
984 unsigned int cpu;
985
986 /*
987 * The following test on first_start/end isn't strictly
988 * necessary but will speed up lookups of addresses which
989 * aren't in the first chunk.
990 */
991 first_start = pcpu_chunk_addr(pcpu_first_chunk, pcpu_first_unit_cpu, 0);
992 first_end = pcpu_chunk_addr(pcpu_first_chunk, pcpu_last_unit_cpu,
993 pcpu_unit_pages);
994 if ((unsigned long)addr >= first_start &&
995 (unsigned long)addr < first_end) {
996 for_each_possible_cpu(cpu) {
997 void *start = per_cpu_ptr(base, cpu);
998
999 if (addr >= start && addr < start + pcpu_unit_size) {
1000 in_first_chunk = true;
1001 break;
1002 }
1003 }
1004 }
1005
1006 if (in_first_chunk) {
982 if ((unsigned long)addr < VMALLOC_START || 1007 if ((unsigned long)addr < VMALLOC_START ||
983 (unsigned long)addr >= VMALLOC_END) 1008 (unsigned long)addr >= VMALLOC_END)
984 return __pa(addr); 1009 return __pa(addr);
@@ -1086,7 +1111,7 @@ struct pcpu_alloc_info * __init pcpu_build_alloc_info(
1086 static int group_map[NR_CPUS] __initdata; 1111 static int group_map[NR_CPUS] __initdata;
1087 static int group_cnt[NR_CPUS] __initdata; 1112 static int group_cnt[NR_CPUS] __initdata;
1088 const size_t static_size = __per_cpu_end - __per_cpu_start; 1113 const size_t static_size = __per_cpu_end - __per_cpu_start;
1089 int group_cnt_max = 0, nr_groups = 1, nr_units = 0; 1114 int nr_groups = 1, nr_units = 0;
1090 size_t size_sum, min_unit_size, alloc_size; 1115 size_t size_sum, min_unit_size, alloc_size;
1091 int upa, max_upa, uninitialized_var(best_upa); /* units_per_alloc */ 1116 int upa, max_upa, uninitialized_var(best_upa); /* units_per_alloc */
1092 int last_allocs, group, unit; 1117 int last_allocs, group, unit;
@@ -1096,7 +1121,7 @@ struct pcpu_alloc_info * __init pcpu_build_alloc_info(
1096 1121
1097 /* this function may be called multiple times */ 1122 /* this function may be called multiple times */
1098 memset(group_map, 0, sizeof(group_map)); 1123 memset(group_map, 0, sizeof(group_map));
1099 memset(group_cnt, 0, sizeof(group_map)); 1124 memset(group_cnt, 0, sizeof(group_cnt));
1100 1125
1101 /* 1126 /*
1102 * Determine min_unit_size, alloc_size and max_upa such that 1127 * Determine min_unit_size, alloc_size and max_upa such that
@@ -1130,7 +1155,6 @@ struct pcpu_alloc_info * __init pcpu_build_alloc_info(
1130 } 1155 }
1131 group_map[cpu] = group; 1156 group_map[cpu] = group;
1132 group_cnt[group]++; 1157 group_cnt[group]++;
1133 group_cnt_max = max(group_cnt_max, group_cnt[group]);
1134 } 1158 }
1135 1159
1136 /* 1160 /*
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c
index 0faad5ce6dc4..8c100c9dae28 100644
--- a/net/bluetooth/bnep/netdev.c
+++ b/net/bluetooth/bnep/netdev.c
@@ -104,6 +104,8 @@ static void bnep_net_set_mc_list(struct net_device *dev)
104 break; 104 break;
105 memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN); 105 memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN);
106 memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN); 106 memcpy(__skb_put(skb, ETH_ALEN), ha->addr, ETH_ALEN);
107
108 i++;
107 } 109 }
108 r->len = htons(skb->len - len); 110 r->len = htons(skb->len - len);
109 } 111 }
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 26637439965b..b01dde35a69e 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -128,7 +128,7 @@ void br_fdb_cleanup(unsigned long _data)
128{ 128{
129 struct net_bridge *br = (struct net_bridge *)_data; 129 struct net_bridge *br = (struct net_bridge *)_data;
130 unsigned long delay = hold_time(br); 130 unsigned long delay = hold_time(br);
131 unsigned long next_timer = jiffies + br->forward_delay; 131 unsigned long next_timer = jiffies + br->ageing_time;
132 int i; 132 int i;
133 133
134 spin_lock_bh(&br->hash_lock); 134 spin_lock_bh(&br->hash_lock);
@@ -149,9 +149,7 @@ void br_fdb_cleanup(unsigned long _data)
149 } 149 }
150 spin_unlock_bh(&br->hash_lock); 150 spin_unlock_bh(&br->hash_lock);
151 151
152 /* Add HZ/4 to ensure we round the jiffies upwards to be after the next 152 mod_timer(&br->gc_timer, round_jiffies_up(next_timer));
153 * timer, otherwise we might round down and will have no-op run. */
154 mod_timer(&br->gc_timer, round_jiffies(next_timer + HZ/4));
155} 153}
156 154
157/* Completely flush all dynamic entries in forwarding database.*/ 155/* Completely flush all dynamic entries in forwarding database.*/
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index a98ef1393097..a4e72a89e4ff 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -140,10 +140,10 @@ static int deliver_clone(const struct net_bridge_port *prev,
140 void (*__packet_hook)(const struct net_bridge_port *p, 140 void (*__packet_hook)(const struct net_bridge_port *p,
141 struct sk_buff *skb)) 141 struct sk_buff *skb))
142{ 142{
143 struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
144
143 skb = skb_clone(skb, GFP_ATOMIC); 145 skb = skb_clone(skb, GFP_ATOMIC);
144 if (!skb) { 146 if (!skb) {
145 struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev;
146
147 dev->stats.tx_dropped++; 147 dev->stats.tx_dropped++;
148 return -ENOMEM; 148 return -ENOMEM;
149 } 149 }
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 9f07e749d7b1..34432b4e96bb 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -532,6 +532,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
532 new->ip_summed = old->ip_summed; 532 new->ip_summed = old->ip_summed;
533 skb_copy_queue_mapping(new, old); 533 skb_copy_queue_mapping(new, old);
534 new->priority = old->priority; 534 new->priority = old->priority;
535 new->deliver_no_wcard = old->deliver_no_wcard;
535#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) 536#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
536 new->ipvs_property = old->ipvs_property; 537 new->ipvs_property = old->ipvs_property;
537#endif 538#endif
@@ -569,7 +570,6 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
569 C(len); 570 C(len);
570 C(data_len); 571 C(data_len);
571 C(mac_len); 572 C(mac_len);
572 C(rxhash);
573 n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len; 573 n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len;
574 n->cloned = 1; 574 n->cloned = 1;
575 n->nohdr = 0; 575 n->nohdr = 0;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 9a4a6c96cb0d..041d41df1224 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -873,8 +873,10 @@ int ip_append_data(struct sock *sk,
873 !exthdrlen) 873 !exthdrlen)
874 csummode = CHECKSUM_PARTIAL; 874 csummode = CHECKSUM_PARTIAL;
875 875
876 skb = skb_peek_tail(&sk->sk_write_queue);
877
876 inet->cork.length += length; 878 inet->cork.length += length;
877 if (((length> mtu) || !skb_queue_empty(&sk->sk_write_queue)) && 879 if (((length > mtu) || (skb && skb_is_gso(skb))) &&
878 (sk->sk_protocol == IPPROTO_UDP) && 880 (sk->sk_protocol == IPPROTO_UDP) &&
879 (rt->u.dst.dev->features & NETIF_F_UFO)) { 881 (rt->u.dst.dev->features & NETIF_F_UFO)) {
880 err = ip_ufo_append_data(sk, getfrag, from, length, hh_len, 882 err = ip_ufo_append_data(sk, getfrag, from, length, hh_len,
@@ -892,7 +894,7 @@ int ip_append_data(struct sock *sk,
892 * adding appropriate IP header. 894 * adding appropriate IP header.
893 */ 895 */
894 896
895 if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) 897 if (!skb)
896 goto alloc_new_skb; 898 goto alloc_new_skb;
897 899
898 while (length > 0) { 900 while (length > 0) {
@@ -1121,7 +1123,8 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
1121 return -EINVAL; 1123 return -EINVAL;
1122 1124
1123 inet->cork.length += size; 1125 inet->cork.length += size;
1124 if ((sk->sk_protocol == IPPROTO_UDP) && 1126 if ((size + skb->len > mtu) &&
1127 (sk->sk_protocol == IPPROTO_UDP) &&
1125 (rt->u.dst.dev->features & NETIF_F_UFO)) { 1128 (rt->u.dst.dev->features & NETIF_F_UFO)) {
1126 skb_shinfo(skb)->gso_size = mtu - fragheaderlen; 1129 skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
1127 skb_shinfo(skb)->gso_type = SKB_GSO_UDP; 1130 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 0abdc242ddb7..2efef52fb461 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -586,6 +586,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
586 src_addr = solicited_addr; 586 src_addr = solicited_addr;
587 if (ifp->flags & IFA_F_OPTIMISTIC) 587 if (ifp->flags & IFA_F_OPTIMISTIC)
588 override = 0; 588 override = 0;
589 inc_opt |= ifp->idev->cnf.force_tllao;
589 in6_ifa_put(ifp); 590 in6_ifa_put(ifp);
590 } else { 591 } else {
591 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr, 592 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
@@ -599,7 +600,6 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
599 icmp6h.icmp6_solicited = solicited; 600 icmp6h.icmp6_solicited = solicited;
600 icmp6h.icmp6_override = override; 601 icmp6h.icmp6_override = override;
601 602
602 inc_opt |= ifp->idev->cnf.force_tllao;
603 __ndisc_send(dev, neigh, daddr, src_addr, 603 __ndisc_send(dev, neigh, daddr, src_addr,
604 &icmp6h, solicited_addr, 604 &icmp6h, solicited_addr,
605 inc_opt ? ND_OPT_TARGET_LL_ADDR : 0); 605 inc_opt ? ND_OPT_TARGET_LL_ADDR : 0);
diff --git a/net/mac80211/work.c b/net/mac80211/work.c
index be3d4a698692..b025dc7bb0fd 100644
--- a/net/mac80211/work.c
+++ b/net/mac80211/work.c
@@ -715,7 +715,7 @@ static void ieee80211_work_rx_queued_mgmt(struct ieee80211_local *local,
715 struct ieee80211_rx_status *rx_status; 715 struct ieee80211_rx_status *rx_status;
716 struct ieee80211_mgmt *mgmt; 716 struct ieee80211_mgmt *mgmt;
717 struct ieee80211_work *wk; 717 struct ieee80211_work *wk;
718 enum work_action rma; 718 enum work_action rma = WORK_ACT_NONE;
719 u16 fc; 719 u16 fc;
720 720
721 rx_status = (struct ieee80211_rx_status *) skb->cb; 721 rx_status = (struct ieee80211_rx_status *) skb->cb;
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index d8f7e8ef67b4..ff04e9edbed6 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -162,6 +162,7 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)
162 hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport); 162 hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport);
163 163
164 ct_write_lock(hash); 164 ct_write_lock(hash);
165 spin_lock(&cp->lock);
165 166
166 if (!(cp->flags & IP_VS_CONN_F_HASHED)) { 167 if (!(cp->flags & IP_VS_CONN_F_HASHED)) {
167 list_add(&cp->c_list, &ip_vs_conn_tab[hash]); 168 list_add(&cp->c_list, &ip_vs_conn_tab[hash]);
@@ -174,6 +175,7 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)
174 ret = 0; 175 ret = 0;
175 } 176 }
176 177
178 spin_unlock(&cp->lock);
177 ct_write_unlock(hash); 179 ct_write_unlock(hash);
178 180
179 return ret; 181 return ret;
@@ -193,6 +195,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp)
193 hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport); 195 hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport);
194 196
195 ct_write_lock(hash); 197 ct_write_lock(hash);
198 spin_lock(&cp->lock);
196 199
197 if (cp->flags & IP_VS_CONN_F_HASHED) { 200 if (cp->flags & IP_VS_CONN_F_HASHED) {
198 list_del(&cp->c_list); 201 list_del(&cp->c_list);
@@ -202,6 +205,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp)
202 } else 205 } else
203 ret = 0; 206 ret = 0;
204 207
208 spin_unlock(&cp->lock);
205 ct_write_unlock(hash); 209 ct_write_unlock(hash);
206 210
207 return ret; 211 return ret;
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 3415b6ce1c0a..807643bdcbac 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -449,6 +449,7 @@ static __init void teql_master_setup(struct net_device *dev)
449 dev->tx_queue_len = 100; 449 dev->tx_queue_len = 100;
450 dev->flags = IFF_NOARP; 450 dev->flags = IFF_NOARP;
451 dev->hard_header_len = LL_MAX_HEADER; 451 dev->hard_header_len = LL_MAX_HEADER;
452 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
452} 453}
453 454
454static LIST_HEAD(master_dev_list); 455static LIST_HEAD(master_dev_list);
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 2a9675136c68..7ca65c7005ea 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -210,7 +210,8 @@ struct sock_xprt {
210 * State of TCP reply receive 210 * State of TCP reply receive
211 */ 211 */
212 __be32 tcp_fraghdr, 212 __be32 tcp_fraghdr,
213 tcp_xid; 213 tcp_xid,
214 tcp_calldir;
214 215
215 u32 tcp_offset, 216 u32 tcp_offset,
216 tcp_reclen; 217 tcp_reclen;
@@ -927,7 +928,7 @@ static inline void xs_tcp_read_calldir(struct sock_xprt *transport,
927{ 928{
928 size_t len, used; 929 size_t len, used;
929 u32 offset; 930 u32 offset;
930 __be32 calldir; 931 char *p;
931 932
932 /* 933 /*
933 * We want transport->tcp_offset to be 8 at the end of this routine 934 * We want transport->tcp_offset to be 8 at the end of this routine
@@ -936,26 +937,33 @@ static inline void xs_tcp_read_calldir(struct sock_xprt *transport,
936 * transport->tcp_offset is 4 (after having already read the xid). 937 * transport->tcp_offset is 4 (after having already read the xid).
937 */ 938 */
938 offset = transport->tcp_offset - sizeof(transport->tcp_xid); 939 offset = transport->tcp_offset - sizeof(transport->tcp_xid);
939 len = sizeof(calldir) - offset; 940 len = sizeof(transport->tcp_calldir) - offset;
940 dprintk("RPC: reading CALL/REPLY flag (%Zu bytes)\n", len); 941 dprintk("RPC: reading CALL/REPLY flag (%Zu bytes)\n", len);
941 used = xdr_skb_read_bits(desc, &calldir, len); 942 p = ((char *) &transport->tcp_calldir) + offset;
943 used = xdr_skb_read_bits(desc, p, len);
942 transport->tcp_offset += used; 944 transport->tcp_offset += used;
943 if (used != len) 945 if (used != len)
944 return; 946 return;
945 transport->tcp_flags &= ~TCP_RCV_READ_CALLDIR; 947 transport->tcp_flags &= ~TCP_RCV_READ_CALLDIR;
946 transport->tcp_flags |= TCP_RCV_COPY_CALLDIR;
947 transport->tcp_flags |= TCP_RCV_COPY_DATA;
948 /* 948 /*
949 * We don't yet have the XDR buffer, so we will write the calldir 949 * We don't yet have the XDR buffer, so we will write the calldir
950 * out after we get the buffer from the 'struct rpc_rqst' 950 * out after we get the buffer from the 'struct rpc_rqst'
951 */ 951 */
952 if (ntohl(calldir) == RPC_REPLY) 952 switch (ntohl(transport->tcp_calldir)) {
953 case RPC_REPLY:
954 transport->tcp_flags |= TCP_RCV_COPY_CALLDIR;
955 transport->tcp_flags |= TCP_RCV_COPY_DATA;
953 transport->tcp_flags |= TCP_RPC_REPLY; 956 transport->tcp_flags |= TCP_RPC_REPLY;
954 else 957 break;
958 case RPC_CALL:
959 transport->tcp_flags |= TCP_RCV_COPY_CALLDIR;
960 transport->tcp_flags |= TCP_RCV_COPY_DATA;
955 transport->tcp_flags &= ~TCP_RPC_REPLY; 961 transport->tcp_flags &= ~TCP_RPC_REPLY;
956 dprintk("RPC: reading %s CALL/REPLY flag %08x\n", 962 break;
957 (transport->tcp_flags & TCP_RPC_REPLY) ? 963 default:
958 "reply for" : "request with", calldir); 964 dprintk("RPC: invalid request message type\n");
965 xprt_force_disconnect(&transport->xprt);
966 }
959 xs_tcp_check_fraghdr(transport); 967 xs_tcp_check_fraghdr(transport);
960} 968}
961 969
@@ -975,12 +983,10 @@ static inline void xs_tcp_read_common(struct rpc_xprt *xprt,
975 /* 983 /*
976 * Save the RPC direction in the XDR buffer 984 * Save the RPC direction in the XDR buffer
977 */ 985 */
978 __be32 calldir = transport->tcp_flags & TCP_RPC_REPLY ?
979 htonl(RPC_REPLY) : 0;
980
981 memcpy(rcvbuf->head[0].iov_base + transport->tcp_copied, 986 memcpy(rcvbuf->head[0].iov_base + transport->tcp_copied,
982 &calldir, sizeof(calldir)); 987 &transport->tcp_calldir,
983 transport->tcp_copied += sizeof(calldir); 988 sizeof(transport->tcp_calldir));
989 transport->tcp_copied += sizeof(transport->tcp_calldir);
984 transport->tcp_flags &= ~TCP_RCV_COPY_CALLDIR; 990 transport->tcp_flags &= ~TCP_RCV_COPY_CALLDIR;
985 } 991 }
986 992
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 4bf27d901333..af1c173be4ad 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2300,7 +2300,8 @@ int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first,
2300 return 0; 2300 return 0;
2301 if (xdst->xfrm_genid != dst->xfrm->genid) 2301 if (xdst->xfrm_genid != dst->xfrm->genid)
2302 return 0; 2302 return 0;
2303 if (xdst->policy_genid != atomic_read(&xdst->pols[0]->genid)) 2303 if (xdst->num_pols > 0 &&
2304 xdst->policy_genid != atomic_read(&xdst->pols[0]->genid))
2304 return 0; 2305 return 0;
2305 2306
2306 if (strict && fl && 2307 if (strict && fl &&
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 3318692e4e76..f8779006986d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1342,7 +1342,7 @@ static unsigned int *reloc_location(struct elf_info *elf,
1342 int section = sechdr->sh_info; 1342 int section = sechdr->sh_info;
1343 1343
1344 return (void *)elf->hdr + sechdrs[section].sh_offset + 1344 return (void *)elf->hdr + sechdrs[section].sh_offset +
1345 (r->r_offset - sechdrs[section].sh_addr); 1345 r->r_offset - sechdrs[section].sh_addr;
1346} 1346}
1347 1347
1348static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r) 1348static int addend_386_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 13074b454743..6261745e4459 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -33,7 +33,7 @@ static int key_get_type_from_user(char *type,
33 ret = strncpy_from_user(type, _type, len); 33 ret = strncpy_from_user(type, _type, len);
34 34
35 if (ret < 0) 35 if (ret < 0)
36 return -EFAULT; 36 return ret;
37 37
38 if (ret == 0 || ret >= len) 38 if (ret == 0 || ret >= len)
39 return -EINVAL; 39 return -EINVAL;
@@ -1080,7 +1080,7 @@ set:
1080 return old_setting; 1080 return old_setting;
1081error: 1081error:
1082 abort_creds(new); 1082 abort_creds(new);
1083 return -EINVAL; 1083 return ret;
1084 1084
1085} /* end keyctl_set_reqkey_keyring() */ 1085} /* end keyctl_set_reqkey_keyring() */
1086 1086
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index e89991ea3543..3b4413448226 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -941,11 +941,11 @@ static void outstream_host_buffer_free(struct hpi_adapter_obj *pao,
941 941
942} 942}
943 943
944static long outstream_get_space_available(struct hpi_hostbuffer_status 944static u32 outstream_get_space_available(struct hpi_hostbuffer_status
945 *status) 945 *status)
946{ 946{
947 return status->size_in_bytes - ((long)(status->host_index) - 947 return status->size_in_bytes - (status->host_index -
948 (long)(status->dSP_index)); 948 status->dSP_index);
949} 949}
950 950
951static void outstream_write(struct hpi_adapter_obj *pao, 951static void outstream_write(struct hpi_adapter_obj *pao,
@@ -954,7 +954,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
954 struct hpi_hw_obj *phw = pao->priv; 954 struct hpi_hw_obj *phw = pao->priv;
955 struct bus_master_interface *interface = phw->p_interface_buffer; 955 struct bus_master_interface *interface = phw->p_interface_buffer;
956 struct hpi_hostbuffer_status *status; 956 struct hpi_hostbuffer_status *status;
957 long space_available; 957 u32 space_available;
958 958
959 if (!phw->outstream_host_buffer_size[phm->obj_index]) { 959 if (!phw->outstream_host_buffer_size[phm->obj_index]) {
960 /* there is no BBM buffer, write via message */ 960 /* there is no BBM buffer, write via message */
@@ -1007,7 +1007,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
1007 } 1007 }
1008 1008
1009 space_available = outstream_get_space_available(status); 1009 space_available = outstream_get_space_available(status);
1010 if (space_available < (long)phm->u.d.u.data.data_size) { 1010 if (space_available < phm->u.d.u.data.data_size) {
1011 phr->error = HPI_ERROR_INVALID_DATASIZE; 1011 phr->error = HPI_ERROR_INVALID_DATASIZE;
1012 return; 1012 return;
1013 } 1013 }
@@ -1018,7 +1018,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
1018 && hpios_locked_mem_valid(&phw->outstream_host_buffers[phm-> 1018 && hpios_locked_mem_valid(&phw->outstream_host_buffers[phm->
1019 obj_index])) { 1019 obj_index])) {
1020 u8 *p_bbm_data; 1020 u8 *p_bbm_data;
1021 long l_first_write; 1021 u32 l_first_write;
1022 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data; 1022 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data;
1023 1023
1024 if (hpios_locked_mem_get_virt_addr(&phw-> 1024 if (hpios_locked_mem_get_virt_addr(&phw->
@@ -1248,9 +1248,9 @@ static void instream_start(struct hpi_adapter_obj *pao,
1248 hw_message(pao, phm, phr); 1248 hw_message(pao, phm, phr);
1249} 1249}
1250 1250
1251static long instream_get_bytes_available(struct hpi_hostbuffer_status *status) 1251static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status)
1252{ 1252{
1253 return (long)(status->dSP_index) - (long)(status->host_index); 1253 return status->dSP_index - status->host_index;
1254} 1254}
1255 1255
1256static void instream_read(struct hpi_adapter_obj *pao, 1256static void instream_read(struct hpi_adapter_obj *pao,
@@ -1259,9 +1259,9 @@ static void instream_read(struct hpi_adapter_obj *pao,
1259 struct hpi_hw_obj *phw = pao->priv; 1259 struct hpi_hw_obj *phw = pao->priv;
1260 struct bus_master_interface *interface = phw->p_interface_buffer; 1260 struct bus_master_interface *interface = phw->p_interface_buffer;
1261 struct hpi_hostbuffer_status *status; 1261 struct hpi_hostbuffer_status *status;
1262 long data_available; 1262 u32 data_available;
1263 u8 *p_bbm_data; 1263 u8 *p_bbm_data;
1264 long l_first_read; 1264 u32 l_first_read;
1265 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data; 1265 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data;
1266 1266
1267 if (!phw->instream_host_buffer_size[phm->obj_index]) { 1267 if (!phw->instream_host_buffer_size[phm->obj_index]) {
@@ -1272,7 +1272,7 @@ static void instream_read(struct hpi_adapter_obj *pao,
1272 1272
1273 status = &interface->instream_host_buffer_status[phm->obj_index]; 1273 status = &interface->instream_host_buffer_status[phm->obj_index];
1274 data_available = instream_get_bytes_available(status); 1274 data_available = instream_get_bytes_available(status);
1275 if (data_available < (long)phm->u.d.u.data.data_size) { 1275 if (data_available < phm->u.d.u.data.data_size) {
1276 phr->error = HPI_ERROR_INVALID_DATASIZE; 1276 phr->error = HPI_ERROR_INVALID_DATASIZE;
1277 return; 1277 return;
1278 } 1278 }
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fc767b6b4785..f1ce7d7f5aa3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2619,16 +2619,18 @@ static int alc_build_controls(struct hda_codec *codec)
2619 } 2619 }
2620 2620
2621 /* assign Capture Source enums to NID */ 2621 /* assign Capture Source enums to NID */
2622 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); 2622 if (spec->capsrc_nids || spec->adc_nids) {
2623 if (!kctl) 2623 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2624 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 2624 if (!kctl)
2625 for (i = 0; kctl && i < kctl->count; i++) { 2625 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2626 hda_nid_t *nids = spec->capsrc_nids; 2626 for (i = 0; kctl && i < kctl->count; i++) {
2627 if (!nids) 2627 hda_nid_t *nids = spec->capsrc_nids;
2628 nids = spec->adc_nids; 2628 if (!nids)
2629 err = snd_hda_add_nid(codec, kctl, i, nids[i]); 2629 nids = spec->adc_nids;
2630 if (err < 0) 2630 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2631 return err; 2631 if (err < 0)
2632 return err;
2633 }
2632 } 2634 }
2633 if (spec->cap_mixer) { 2635 if (spec->cap_mixer) {
2634 const char *kname = kctl ? kctl->id.name : NULL; 2636 const char *kname = kctl ? kctl->id.name : NULL;
@@ -6948,7 +6950,7 @@ static struct hda_input_mux mb5_capture_source = {
6948 .num_items = 3, 6950 .num_items = 3,
6949 .items = { 6951 .items = {
6950 { "Mic", 0x1 }, 6952 { "Mic", 0x1 },
6951 { "Line", 0x2 }, 6953 { "Line", 0x7 },
6952 { "CD", 0x4 }, 6954 { "CD", 0x4 },
6953 }, 6955 },
6954}; 6956};
@@ -7469,8 +7471,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7469 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7471 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7472 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7471 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), 7473 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7473 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7475 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7475 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 7477 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), 7478 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
@@ -7853,10 +7855,9 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 7855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7855 7857
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 7859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 7860 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
7859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7860 { } 7861 { }
7861}; 7862};
7862 7863
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 79f0f4ad242c..d3955096d872 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -612,7 +612,6 @@ static void davinci_hw_common_param(struct davinci_audio_dev *dev, int stream)
612 NUMDMA_MASK); 612 NUMDMA_MASK);
613 mcasp_mod_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, 613 mcasp_mod_bits(dev->base + DAVINCI_MCASP_WFIFOCTL,
614 ((dev->txnumevt * tx_ser) << 8), NUMEVT_MASK); 614 ((dev->txnumevt * tx_ser) << 8), NUMEVT_MASK);
615 mcasp_set_bits(dev->base + DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE);
616 } 615 }
617 616
618 if (dev->rxnumevt && stream == SNDRV_PCM_STREAM_CAPTURE) { 617 if (dev->rxnumevt && stream == SNDRV_PCM_STREAM_CAPTURE) {
@@ -623,7 +622,6 @@ static void davinci_hw_common_param(struct davinci_audio_dev *dev, int stream)
623 NUMDMA_MASK); 622 NUMDMA_MASK);
624 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, 623 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
625 ((dev->rxnumevt * rx_ser) << 8), NUMEVT_MASK); 624 ((dev->rxnumevt * rx_ser) << 8), NUMEVT_MASK);
626 mcasp_set_bits(dev->base + DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE);
627 } 625 }
628} 626}
629 627
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index 22208b373fb9..e1ec6d91ea38 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -73,7 +73,7 @@ struct psc_dma {
73}; 73};
74 74
75/* Utility for retrieving psc_dma_stream structure from a substream */ 75/* Utility for retrieving psc_dma_stream structure from a substream */
76inline struct psc_dma_stream * 76static inline struct psc_dma_stream *
77to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma) 77to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
78{ 78{
79 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 79 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index b7aadd614c70..b5855114667e 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -103,7 +103,8 @@ static int uac_clock_selector_get_val(struct snd_usb_audio *chip, int selector_i
103 ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), 103 ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0),
104 UAC2_CS_CUR, 104 UAC2_CS_CUR,
105 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, 105 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
106 UAC2_CX_CLOCK_SELECTOR << 8, selector_id << 8, 106 UAC2_CX_CLOCK_SELECTOR << 8,
107 snd_usb_ctrl_intf(chip) | (selector_id << 8),
107 &buf, sizeof(buf), 1000); 108 &buf, sizeof(buf), 1000);
108 109
109 if (ret < 0) 110 if (ret < 0)
@@ -120,7 +121,8 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
120 121
121 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 122 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
122 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 123 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
123 UAC2_CS_CONTROL_CLOCK_VALID << 8, source_id << 8, 124 UAC2_CS_CONTROL_CLOCK_VALID << 8,
125 snd_usb_ctrl_intf(chip) | (source_id << 8),
124 &data, sizeof(data), 1000); 126 &data, sizeof(data), 1000);
125 127
126 if (err < 0) { 128 if (err < 0) {
@@ -269,7 +271,8 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
269 data[3] = rate >> 24; 271 data[3] = rate >> 24;
270 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, 272 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
271 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, 273 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
272 UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8, 274 UAC2_CS_CONTROL_SAM_FREQ << 8,
275 snd_usb_ctrl_intf(chip) | (clock << 8),
273 data, sizeof(data), 1000)) < 0) { 276 data, sizeof(data), 1000)) < 0) {
274 snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2)\n", 277 snd_printk(KERN_ERR "%d:%d:%d: cannot set freq %d (v2)\n",
275 dev->devnum, iface, fmt->altsetting, rate); 278 dev->devnum, iface, fmt->altsetting, rate);
@@ -278,7 +281,8 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
278 281
279 if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 282 if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
280 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 283 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
281 UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8, 284 UAC2_CS_CONTROL_SAM_FREQ << 8,
285 snd_usb_ctrl_intf(chip) | (clock << 8),
282 data, sizeof(data), 1000)) < 0) { 286 data, sizeof(data), 1000)) < 0) {
283 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", 287 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
284 dev->devnum, iface, fmt->altsetting); 288 dev->devnum, iface, fmt->altsetting);
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 9593b91452b9..6f6596cf2b19 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -427,6 +427,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
427 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) { 427 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) {
428 kfree(fp->rate_table); 428 kfree(fp->rate_table);
429 kfree(fp); 429 kfree(fp);
430 fp = NULL;
430 continue; 431 continue;
431 } 432 }
432 433
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 5367cd1e52d9..30364aba79cc 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -206,6 +206,60 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
206} 206}
207 207
208/* 208/*
209 * Helper function to walk the array of sample rate triplets reported by
210 * the device. The problem is that we need to parse whole array first to
211 * get to know how many sample rates we have to expect.
212 * Then fp->rate_table can be allocated and filled.
213 */
214static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,
215 const unsigned char *data)
216{
217 int i, nr_rates = 0;
218
219 fp->rates = fp->rate_min = fp->rate_max = 0;
220
221 for (i = 0; i < nr_triplets; i++) {
222 int min = combine_quad(&data[2 + 12 * i]);
223 int max = combine_quad(&data[6 + 12 * i]);
224 int res = combine_quad(&data[10 + 12 * i]);
225 int rate;
226
227 if ((max < 0) || (min < 0) || (res < 0) || (max < min))
228 continue;
229
230 /*
231 * for ranges with res == 1, we announce a continuous sample
232 * rate range, and this function should return 0 for no further
233 * parsing.
234 */
235 if (res == 1) {
236 fp->rate_min = min;
237 fp->rate_max = max;
238 fp->rates = SNDRV_PCM_RATE_CONTINUOUS;
239 return 0;
240 }
241
242 for (rate = min; rate <= max; rate += res) {
243 if (fp->rate_table)
244 fp->rate_table[nr_rates] = rate;
245 if (!fp->rate_min || rate < fp->rate_min)
246 fp->rate_min = rate;
247 if (!fp->rate_max || rate > fp->rate_max)
248 fp->rate_max = rate;
249 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
250
251 nr_rates++;
252
253 /* avoid endless loop */
254 if (res == 0)
255 break;
256 }
257 }
258
259 return nr_rates;
260}
261
262/*
209 * parse the format descriptor and stores the possible sample rates 263 * parse the format descriptor and stores the possible sample rates
210 * on the audioformat table (audio class v2). 264 * on the audioformat table (audio class v2).
211 */ 265 */
@@ -215,13 +269,20 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
215{ 269{
216 struct usb_device *dev = chip->dev; 270 struct usb_device *dev = chip->dev;
217 unsigned char tmp[2], *data; 271 unsigned char tmp[2], *data;
218 int i, nr_rates, data_size, ret = 0; 272 int nr_triplets, data_size, ret = 0;
219 int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fp->clock); 273 int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fp->clock);
220 274
275 if (clock < 0) {
276 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n",
277 __func__, clock);
278 goto err;
279 }
280
221 /* get the number of sample rates first by only fetching 2 bytes */ 281 /* get the number of sample rates first by only fetching 2 bytes */
222 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE, 282 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
223 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 283 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
224 UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8, 284 UAC2_CS_CONTROL_SAM_FREQ << 8,
285 snd_usb_ctrl_intf(chip) | (clock << 8),
225 tmp, sizeof(tmp), 1000); 286 tmp, sizeof(tmp), 1000);
226 287
227 if (ret < 0) { 288 if (ret < 0) {
@@ -230,8 +291,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
230 goto err; 291 goto err;
231 } 292 }
232 293
233 nr_rates = (tmp[1] << 8) | tmp[0]; 294 nr_triplets = (tmp[1] << 8) | tmp[0];
234 data_size = 2 + 12 * nr_rates; 295 data_size = 2 + 12 * nr_triplets;
235 data = kzalloc(data_size, GFP_KERNEL); 296 data = kzalloc(data_size, GFP_KERNEL);
236 if (!data) { 297 if (!data) {
237 ret = -ENOMEM; 298 ret = -ENOMEM;
@@ -241,7 +302,8 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
241 /* now get the full information */ 302 /* now get the full information */
242 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE, 303 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
243 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 304 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
244 UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8, 305 UAC2_CS_CONTROL_SAM_FREQ << 8,
306 snd_usb_ctrl_intf(chip) | (clock << 8),
245 data, data_size, 1000); 307 data, data_size, 1000);
246 308
247 if (ret < 0) { 309 if (ret < 0) {
@@ -251,26 +313,28 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
251 goto err_free; 313 goto err_free;
252 } 314 }
253 315
254 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); 316 /* Call the triplet parser, and make sure fp->rate_table is NULL.
317 * We just use the return value to know how many sample rates we
318 * will have to deal with. */
319 kfree(fp->rate_table);
320 fp->rate_table = NULL;
321 fp->nr_rates = parse_uac2_sample_rate_range(fp, nr_triplets, data);
322
323 if (fp->nr_rates == 0) {
324 /* SNDRV_PCM_RATE_CONTINUOUS */
325 ret = 0;
326 goto err_free;
327 }
328
329 fp->rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL);
255 if (!fp->rate_table) { 330 if (!fp->rate_table) {
256 ret = -ENOMEM; 331 ret = -ENOMEM;
257 goto err_free; 332 goto err_free;
258 } 333 }
259 334
260 fp->nr_rates = 0; 335 /* Call the triplet parser again, but this time, fp->rate_table is
261 fp->rate_min = fp->rate_max = 0; 336 * allocated, so the rates will be stored */
262 337 parse_uac2_sample_rate_range(fp, nr_triplets, data);
263 for (i = 0; i < nr_rates; i++) {
264 int rate = combine_quad(&data[2 + 12 * i]);
265
266 fp->rate_table[fp->nr_rates] = rate;
267 if (!fp->rate_min || rate < fp->rate_min)
268 fp->rate_min = rate;
269 if (!fp->rate_max || rate > fp->rate_max)
270 fp->rate_max = rate;
271 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
272 fp->nr_rates++;
273 }
274 338
275err_free: 339err_free:
276 kfree(data); 340 kfree(data);
diff --git a/sound/usb/helper.h b/sound/usb/helper.h
index a6b0e51b3a9a..09bd943c43bf 100644
--- a/sound/usb/helper.h
+++ b/sound/usb/helper.h
@@ -28,5 +28,9 @@ unsigned char snd_usb_parse_datainterval(struct snd_usb_audio *chip,
28#define snd_usb_get_speed(dev) ((dev)->speed) 28#define snd_usb_get_speed(dev) ((dev)->speed)
29#endif 29#endif
30 30
31static inline int snd_usb_ctrl_intf(struct snd_usb_audio *chip)
32{
33 return get_iface_desc(chip->ctrl_intf)->bInterfaceNumber;
34}
31 35
32#endif /* __USBAUDIO_HELPER_H */ 36#endif /* __USBAUDIO_HELPER_H */
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index a060d005e209..6939d0f517d9 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -297,20 +297,27 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v
297 297
298static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) 298static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
299{ 299{
300 unsigned char buf[14]; /* enough space for one range of 4 bytes */ 300 unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */
301 unsigned char *val; 301 unsigned char *val;
302 int ret; 302 int ret, size;
303 __u8 bRequest; 303 __u8 bRequest;
304 304
305 bRequest = (request == UAC_GET_CUR) ? 305 if (request == UAC_GET_CUR) {
306 UAC2_CS_CUR : UAC2_CS_RANGE; 306 bRequest = UAC2_CS_CUR;
307 size = sizeof(__u16);
308 } else {
309 bRequest = UAC2_CS_RANGE;
310 size = sizeof(buf);
311 }
312
313 memset(buf, 0, sizeof(buf));
307 314
308 ret = snd_usb_ctl_msg(cval->mixer->chip->dev, 315 ret = snd_usb_ctl_msg(cval->mixer->chip->dev,
309 usb_rcvctrlpipe(cval->mixer->chip->dev, 0), 316 usb_rcvctrlpipe(cval->mixer->chip->dev, 0),
310 bRequest, 317 bRequest,
311 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, 318 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
312 validx, cval->mixer->ctrlif | (cval->id << 8), 319 validx, cval->mixer->ctrlif | (cval->id << 8),
313 buf, sizeof(buf), 1000); 320 buf, size, 1000);
314 321
315 if (ret < 0) { 322 if (ret < 0) {
316 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", 323 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
@@ -318,6 +325,8 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v
318 return ret; 325 return ret;
319 } 326 }
320 327
328 /* FIXME: how should we handle multiple triplets here? */
329
321 switch (request) { 330 switch (request) {
322 case UAC_GET_CUR: 331 case UAC_GET_CUR:
323 val = buf; 332 val = buf;
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 0df64088135f..b93879677cca 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -194,7 +194,7 @@ static void sig_handler(int sig)
194 194
195static void sig_atexit(void) 195static void sig_atexit(void)
196{ 196{
197 if (child_pid != -1) 197 if (child_pid > 0)
198 kill(child_pid, SIGTERM); 198 kill(child_pid, SIGTERM);
199 199
200 if (signr == -1) 200 if (signr == -1)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index a7460868124b..d7f21d71eb69 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -538,8 +538,10 @@ int event__process_task(event_t *self, struct perf_session *session)
538 dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid, 538 dump_printf("(%d:%d):(%d:%d)\n", self->fork.pid, self->fork.tid,
539 self->fork.ppid, self->fork.ptid); 539 self->fork.ppid, self->fork.ptid);
540 540
541 if (self->header.type == PERF_RECORD_EXIT) 541 if (self->header.type == PERF_RECORD_EXIT) {
542 perf_session__remove_thread(session, thread);
542 return 0; 543 return 0;
544 }
543 545
544 if (thread == NULL || parent == NULL || 546 if (thread == NULL || parent == NULL ||
545 thread__fork(thread, parent) < 0) { 547 thread__fork(thread, parent) < 0) {
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 7bdbfd3e24d2..89c52fc9b22e 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -43,6 +43,9 @@ struct ui_progress *ui_progress__new(const char *title, u64 total)
43 43
44 if (self != NULL) { 44 if (self != NULL) {
45 int cols; 45 int cols;
46
47 if (use_browser <= 0)
48 return self;
46 newtGetScreenSize(&cols, NULL); 49 newtGetScreenSize(&cols, NULL);
47 cols -= 4; 50 cols -= 4;
48 newtCenteredWindow(cols, 1, title); 51 newtCenteredWindow(cols, 1, title);
@@ -67,14 +70,22 @@ out_free_self:
67 70
68void ui_progress__update(struct ui_progress *self, u64 curr) 71void ui_progress__update(struct ui_progress *self, u64 curr)
69{ 72{
73 /*
74 * FIXME: We should have a per UI backend way of showing progress,
75 * stdio will just show a percentage as NN%, etc.
76 */
77 if (use_browser <= 0)
78 return;
70 newtScaleSet(self->scale, curr); 79 newtScaleSet(self->scale, curr);
71 newtRefresh(); 80 newtRefresh();
72} 81}
73 82
74void ui_progress__delete(struct ui_progress *self) 83void ui_progress__delete(struct ui_progress *self)
75{ 84{
76 newtFormDestroy(self->form); 85 if (use_browser > 0) {
77 newtPopWindow(); 86 newtFormDestroy(self->form);
87 newtPopWindow();
88 }
78 free(self); 89 free(self);
79} 90}
80 91
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0564a5cfb12e..030791870e33 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -92,6 +92,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
92 92
93 memcpy(self->filename, filename, len); 93 memcpy(self->filename, filename, len);
94 self->threads = RB_ROOT; 94 self->threads = RB_ROOT;
95 INIT_LIST_HEAD(&self->dead_threads);
95 self->hists_tree = RB_ROOT; 96 self->hists_tree = RB_ROOT;
96 self->last_match = NULL; 97 self->last_match = NULL;
97 self->mmap_window = 32; 98 self->mmap_window = 32;
@@ -133,6 +134,16 @@ void perf_session__delete(struct perf_session *self)
133 free(self); 134 free(self);
134} 135}
135 136
137void perf_session__remove_thread(struct perf_session *self, struct thread *th)
138{
139 rb_erase(&th->rb_node, &self->threads);
140 /*
141 * We may have references to this thread, for instance in some hist_entry
142 * instances, so just move them to a separate list.
143 */
144 list_add_tail(&th->node, &self->dead_threads);
145}
146
136static bool symbol__match_parent_regex(struct symbol *sym) 147static bool symbol__match_parent_regex(struct symbol *sym)
137{ 148{
138 if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0)) 149 if (sym->name && !regexec(&parent_regex, sym->name, 0, NULL, 0))
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 55c6881b218d..9fa0fc2a863f 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -26,6 +26,7 @@ struct perf_session {
26 unsigned long size; 26 unsigned long size;
27 unsigned long mmap_window; 27 unsigned long mmap_window;
28 struct rb_root threads; 28 struct rb_root threads;
29 struct list_head dead_threads;
29 struct thread *last_match; 30 struct thread *last_match;
30 struct machine host_machine; 31 struct machine host_machine;
31 struct rb_root machines; 32 struct rb_root machines;
@@ -99,6 +100,7 @@ int perf_session__create_kernel_maps(struct perf_session *self);
99 100
100int do_read(int fd, void *buf, size_t size); 101int do_read(int fd, void *buf, size_t size);
101void perf_session__update_sample_type(struct perf_session *self); 102void perf_session__update_sample_type(struct perf_session *self);
103void perf_session__remove_thread(struct perf_session *self, struct thread *th);
102 104
103static inline 105static inline
104struct machine *perf_session__find_host_machine(struct perf_session *self) 106struct machine *perf_session__find_host_machine(struct perf_session *self)
diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
index 1dfd9ff8bdcd..ee6bbcf277ca 100644
--- a/tools/perf/util/thread.h
+++ b/tools/perf/util/thread.h
@@ -6,7 +6,10 @@
6#include "symbol.h" 6#include "symbol.h"
7 7
8struct thread { 8struct thread {
9 struct rb_node rb_node; 9 union {
10 struct rb_node rb_node;
11 struct list_head node;
12 };
10 struct map_groups mg; 13 struct map_groups mg;
11 pid_t pid; 14 pid_t pid;
12 char shortname[3]; 15 char shortname[3];