aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX4
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-kone2
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus8
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-kovaplus8
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra8
-rw-r--r--Documentation/ABI/testing/sysfs-platform-asus-laptop2
-rw-r--r--Documentation/cgroups/cgroups.txt12
-rw-r--r--Documentation/devicetree/booting-without-of.txt6
-rw-r--r--Documentation/dvb/udev.txt2
-rw-r--r--Documentation/edac.txt2
-rw-r--r--Documentation/kernel-parameters.txt16
-rw-r--r--Documentation/kmemleak.txt4
-rw-r--r--Documentation/laptops/asus-laptop.txt4
-rw-r--r--Documentation/leds/00-INDEX8
-rw-r--r--Documentation/leds/leds-class.txt (renamed from Documentation/leds-class.txt)1
-rw-r--r--Documentation/leds/leds-lp3944.txt (renamed from Documentation/leds-lp3944.txt)0
-rw-r--r--Documentation/networking/batman-adv.txt2
-rw-r--r--Documentation/s390/Debugging390.txt2
-rw-r--r--Documentation/scheduler/sched-domains.txt32
-rw-r--r--Documentation/scsi/sym53c8xx_2.txt2
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt2
-rw-r--r--Documentation/sound/oss/AudioExcelDSP166
-rw-r--r--Documentation/sound/oss/README.ymfsb2
-rw-r--r--Documentation/video4linux/bttv/Insmod-options2
-rw-r--r--Documentation/video4linux/bttv/Sound-FAQ2
-rw-r--r--Documentation/video4linux/et61x251.txt4
-rw-r--r--Documentation/video4linux/sn9c102.txt4
-rw-r--r--Documentation/video4linux/w9968cf.txt2
-rw-r--r--Documentation/video4linux/zc0301.txt6
-rw-r--r--Makefile2
-rw-r--r--arch/ia64/sn/kernel/irq.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c42
-rw-r--r--arch/microblaze/include/asm/unistd.h6
-rw-r--r--arch/microblaze/kernel/Makefile1
-rw-r--r--arch/microblaze/kernel/ftrace.c10
-rw-r--r--arch/microblaze/kernel/intc.c4
-rw-r--r--arch/microblaze/kernel/syscall_table.S4
-rw-r--r--arch/microblaze/lib/Makefile6
-rw-r--r--arch/powerpc/boot/dts/p1020rdb.dts12
-rw-r--r--arch/powerpc/boot/dts/p2020rdb.dts12
-rw-r--r--arch/powerpc/boot/dts/p2020rdb_camp_core0.dts4
-rw-r--r--arch/powerpc/boot/dts/p2020rdb_camp_core1.dts10
-rw-r--r--arch/powerpc/include/asm/machdep.h3
-rw-r--r--arch/powerpc/include/asm/smp.h5
-rw-r--r--arch/powerpc/kernel/crash.c6
-rw-r--r--arch/powerpc/kernel/head_32.S9
-rw-r--r--arch/powerpc/kernel/head_64.S7
-rw-r--r--arch/powerpc/kernel/idle_power4.S21
-rw-r--r--arch/powerpc/kernel/irq.c3
-rw-r--r--arch/powerpc/kernel/paca.c2
-rw-r--r--arch/powerpc/kernel/setup-common.c3
-rw-r--r--arch/powerpc/kernel/smp.c153
-rw-r--r--arch/powerpc/kernel/time.c15
-rw-r--r--arch/powerpc/mm/tlb_low_64e.S2
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/powermac/pmac.h1
-rw-r--r--arch/powerpc/platforms/powermac/setup.c56
-rw-r--r--arch/powerpc/platforms/powermac/smp.c154
-rw-r--r--arch/powerpc/platforms/pseries/offline_states.h2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/smp.c17
-rw-r--r--arch/sparc/include/asm/unistd.h3
-rw-r--r--arch/sparc/kernel/auxio_64.c2
-rw-r--r--arch/sparc/kernel/central.c4
-rw-r--r--arch/sparc/kernel/ds.c2
-rw-r--r--arch/sparc/kernel/entry.S2
-rw-r--r--arch/sparc/kernel/mdesc.c2
-rw-r--r--arch/sparc/kernel/pci_fire.c2
-rw-r--r--arch/sparc/kernel/pci_psycho.c2
-rw-r--r--arch/sparc/kernel/pci_sabre.c2
-rw-r--r--arch/sparc/kernel/pci_schizo.c2
-rw-r--r--arch/sparc/kernel/pci_sun4v.c2
-rw-r--r--arch/sparc/kernel/power.c2
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S2
-rw-r--r--arch/sparc/kernel/time_64.c6
-rw-r--r--arch/unicore32/Makefile2
-rw-r--r--arch/unicore32/include/asm/futex.h143
-rw-r--r--arch/unicore32/include/mach/PKUnity.h10
-rw-r--r--arch/unicore32/include/mach/memory.h1
-rw-r--r--arch/unicore32/kernel/puv3-core.c5
-rw-r--r--arch/unicore32/kernel/rtc.c9
-rw-r--r--arch/unicore32/kernel/setup.c15
-rw-r--r--arch/unicore32/kernel/traps.c1
-rw-r--r--arch/unicore32/kernel/vmlinux.lds.S7
-rw-r--r--arch/unicore32/mm/mmu.c20
-rw-r--r--arch/x86/include/asm/apic.h1
-rw-r--r--arch/x86/include/asm/dma.h1
-rw-r--r--arch/x86/kernel/amd_nb.c2
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c10
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c20
-rw-r--r--arch/x86/kernel/irq.c1
-rw-r--r--arch/x86/kernel/microcode_core.c1
-rw-r--r--arch/x86/kernel/reboot.c1
-rw-r--r--arch/x86/oprofile/nmi_int.c5
-rw-r--r--arch/x86/oprofile/op_counter.h1
-rw-r--r--arch/x86/platform/uv/tlb_uv.c1
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-flush.c6
-rw-r--r--block/blk-integrity.c12
-rw-r--r--block/blk-throttle.c4
-rw-r--r--block/elevator.c35
-rw-r--r--drivers/atm/solos-pci.c39
-rw-r--r--drivers/bluetooth/btusb.c6
-rw-r--r--drivers/connector/cn_queue.c58
-rw-r--r--drivers/connector/connector.c47
-rw-r--r--drivers/edac/mpc85xx_edac.c27
-rw-r--r--drivers/gpu/drm/drm_edid.c3
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c20
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c25
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c34
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.c2
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c20
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c13
-rw-r--r--drivers/gpu/drm/radeon/rs600.c11
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c10
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c16
-rw-r--r--drivers/hid/Kconfig13
-rw-r--r--drivers/hid/hid-core.c2
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-lgff.c2
-rw-r--r--drivers/hid/hid-magicmouse.c2
-rw-r--r--drivers/hid/hid-ortek.c16
-rw-r--r--drivers/hid/hid-roccat-pyra.c3
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hwmon/twl4030-madc-hwmon.c2
-rw-r--r--drivers/ide/ide-io.c43
-rw-r--r--drivers/input/keyboard/spear-keyboard.c2
-rw-r--r--drivers/input/misc/uinput.c6
-rw-r--r--drivers/input/mouse/synaptics.c4
-rw-r--r--drivers/input/serio/i8042.c7
-rw-r--r--drivers/input/serio/rpckbd.c2
-rw-r--r--drivers/input/sparse-keymap.c14
-rw-r--r--drivers/input/tablet/wacom_wac.c291
-rw-r--r--drivers/input/tablet/wacom_wac.h2
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c2
-rw-r--r--drivers/macintosh/therm_pm72.c60
-rw-r--r--drivers/md/dm-table.c114
-rw-r--r--drivers/media/radio/wl128x/fmdrv_common.c16
-rw-r--r--drivers/media/rc/ite-cir.c1
-rw-r--r--drivers/net/atlx/atl2.c22
-rw-r--r--drivers/net/bonding/bond_alb.h2
-rw-r--r--drivers/net/irda/via-ircc.c94
-rw-r--r--drivers/net/mlx4/eq.c4
-rw-r--r--drivers/net/mlx4/mcg.c7
-rw-r--r--drivers/net/phy/phy_device.c8
-rw-r--r--drivers/net/starfire.c6
-rw-r--r--drivers/net/usb/Kconfig15
-rw-r--r--drivers/net/usb/Makefile1
-rw-r--r--drivers/net/usb/cdc_eem.c2
-rw-r--r--drivers/net/usb/cdc_ether.c23
-rw-r--r--drivers/net/usb/cdc_ncm.c2
-rw-r--r--drivers/net/usb/cdc_subset.c8
-rw-r--r--drivers/net/usb/gl620a.c2
-rw-r--r--drivers/net/usb/lg-vl600.c346
-rw-r--r--drivers/net/usb/net1080.c2
-rw-r--r--drivers/net/usb/plusb.c2
-rw-r--r--drivers/net/usb/rndis_host.c2
-rw-r--r--drivers/net/usb/usbnet.c13
-rw-r--r--drivers/net/usb/zaurus.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c4
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c1
-rw-r--r--drivers/net/wireless/ath/carl9170/tx.c7
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c10
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c10
-rw-r--r--drivers/rtc/rtc-mrst.c10
-rw-r--r--drivers/scsi/ultrastor.c1
-rw-r--r--drivers/staging/altera-stapl/altera-jtag.c1
-rw-r--r--drivers/staging/hv/hv_mouse.c1
-rw-r--r--drivers/tty/n_tty.c6
-rw-r--r--drivers/tty/serial/Kconfig2
-rw-r--r--drivers/tty/serial/apbuart.c34
-rw-r--r--drivers/tty/tty_buffer.c4
-rw-r--r--drivers/usb/serial/mct_u232.c4
-rw-r--r--drivers/usb/serial/opticon.c2
-rw-r--r--drivers/video/fb-puv3.c28
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/disk-io.c4
-rw-r--r--fs/btrfs/file.c2
-rw-r--r--fs/btrfs/free-space-cache.c84
-rw-r--r--fs/btrfs/inode.c29
-rw-r--r--fs/btrfs/ioctl.c8
-rw-r--r--fs/btrfs/root-tree.c18
-rw-r--r--fs/btrfs/super.c19
-rw-r--r--fs/btrfs/transaction.c2
-rw-r--r--fs/ceph/mds_client.c6
-rw-r--r--fs/ceph/super.c2
-rw-r--r--fs/inode.c9
-rw-r--r--fs/nilfs2/file.c11
-rw-r--r--fs/nilfs2/nilfs.h14
-rw-r--r--fs/nilfs2/page.c2
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c1
-rw-r--r--fs/notify/inotify/inotify_user.c39
-rw-r--r--fs/ubifs/xattr.c4
-rw-r--r--fs/ufs/truncate.c1
-rw-r--r--include/asm-generic/bug.h7
-rw-r--r--include/drm/drm_crtc.h1
-rw-r--r--include/drm/drm_pciids.h2
-rw-r--r--include/drm/ttm/ttm_bo_api.h12
-rw-r--r--include/drm/ttm/ttm_bo_driver.h4
-rw-r--r--include/keys/ceph-type.h8
-rw-r--r--include/linux/atmdev.h1
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/ceph/auth.h4
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/connector.h16
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/kexec.h1
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--include/linux/rcupdate.h20
-rw-r--r--include/linux/skbuff.h2
-rw-r--r--include/linux/usb/usbnet.h5
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--include/net/if_inet6.h16
-rw-r--r--include/net/ip.h8
-rw-r--r--include/net/sctp/structs.h2
-rw-r--r--include/sound/soc-dapm.h16
-rw-r--r--kernel/kexec.c5
-rw-r--r--kernel/perf_event.c9
-rw-r--r--kernel/sched.c11
-rw-r--r--kernel/sched_fair.c5
-rw-r--r--kernel/signal.c153
-rw-r--r--kernel/time/ntp.c2
-rw-r--r--lib/Kconfig.debug6
-rw-r--r--mm/mremap.c11
-rw-r--r--net/appletalk/ddp.c11
-rw-r--r--net/atm/common.c1
-rw-r--r--net/bluetooth/hci_core.c10
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/l2cap_core.c4
-rw-r--r--net/bluetooth/l2cap_sock.c5
-rw-r--r--net/bluetooth/mgmt.c2
-rw-r--r--net/bridge/br_multicast.c2
-rw-r--r--net/bridge/br_stp_if.c2
-rw-r--r--net/ceph/Kconfig1
-rw-r--r--net/ceph/auth.c8
-rw-r--r--net/ceph/auth_x.c8
-rw-r--r--net/ceph/ceph_common.c112
-rw-r--r--net/ceph/crypto.c73
-rw-r--r--net/ceph/crypto.h4
-rw-r--r--net/ceph/mon_client.c2
-rw-r--r--net/ceph/osd_client.c12
-rw-r--r--net/core/dev.c24
-rw-r--r--net/ipv4/arp.c3
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/tcp_ipv6.c1
-rw-r--r--net/mac80211/key.c7
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c25
-rw-r--r--net/mac80211/rx.c3
-rw-r--r--net/sctp/protocol.c4
-rw-r--r--net/sctp/sm_make_chunk.c4
-rw-r--r--net/wireless/scan.c31
-rw-r--r--sound/core/pcm_lib.c4
-rw-r--r--sound/firewire/speakers.c3
-rw-r--r--sound/pci/ens1370.c23
-rw-r--r--sound/pci/hda/patch_conexant.c1
-rw-r--r--sound/pci/hda/patch_realtek.c21
-rw-r--r--sound/soc/codecs/sn95031.c2
-rw-r--r--sound/soc/codecs/tlv320dac33.c32
-rw-r--r--sound/soc/codecs/twl6040.c4
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c9
-rw-r--r--sound/soc/imx/imx-ssi.h3
-rw-r--r--sound/soc/pxa/corgi.c2
-rw-r--r--tools/perf/Makefile8
-rw-r--r--tools/perf/builtin-record.c25
-rw-r--r--tools/perf/builtin-top.c44
-rw-r--r--tools/perf/util/debug.c10
-rw-r--r--tools/perf/util/debug.h1
-rw-r--r--tools/perf/util/event.c2
-rw-r--r--tools/perf/util/setup.py7
-rw-r--r--tools/perf/util/symbol.c5
283 files changed, 2470 insertions, 1468 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index f607367e642f..c17cd4bb2290 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -206,8 +206,8 @@ laptops/
206 - directory with laptop related info and laptop driver documentation. 206 - directory with laptop related info and laptop driver documentation.
207ldm.txt 207ldm.txt
208 - a brief description of LDM (Windows Dynamic Disks). 208 - a brief description of LDM (Windows Dynamic Disks).
209leds-class.txt 209leds/
210 - documents LED handling under Linux. 210 - directory with info about LED handling under Linux.
211local_ops.txt 211local_ops.txt
212 - semantics and behavior of local atomic operations. 212 - semantics and behavior of local atomic operations.
213lockdep-design.txt 213lockdep-design.txt
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone
index b4c4f158ab9c..3ca3971109bf 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone
+++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kone
@@ -40,7 +40,7 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-
40Date: March 2010 40Date: March 2010
41Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 41Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
42Description: The mouse can store 5 profiles which can be switched by the 42Description: The mouse can store 5 profiles which can be switched by the
43 press of a button. A profile holds informations like button 43 press of a button. A profile holds information like button
44 mappings, sensitivity, the colors of the 5 leds and light 44 mappings, sensitivity, the colors of the 5 leds and light
45 effects. 45 effects.
46 When read, these files return the respective profile. The 46 When read, these files return the respective profile. The
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
index 00efced73969..326e05452da7 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
+++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus
@@ -33,7 +33,7 @@ Date: August 2010
33Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 33Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
34Description: The mouse can store 5 profiles which can be switched by the 34Description: The mouse can store 5 profiles which can be switched by the
35 press of a button. A profile is split in settings and buttons. 35 press of a button. A profile is split in settings and buttons.
36 profile_buttons holds informations about button layout. 36 profile_buttons holds information about button layout.
37 When written, this file lets one write the respective profile 37 When written, this file lets one write the respective profile
38 buttons back to the mouse. The data has to be 77 bytes long. 38 buttons back to the mouse. The data has to be 77 bytes long.
39 The mouse will reject invalid data. 39 The mouse will reject invalid data.
@@ -47,7 +47,7 @@ Date: August 2010
47Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 47Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
48Description: The mouse can store 5 profiles which can be switched by the 48Description: The mouse can store 5 profiles which can be switched by the
49 press of a button. A profile is split in settings and buttons. 49 press of a button. A profile is split in settings and buttons.
50 profile_buttons holds informations about button layout. 50 profile_buttons holds information about button layout.
51 When read, these files return the respective profile buttons. 51 When read, these files return the respective profile buttons.
52 The returned data is 77 bytes in size. 52 The returned data is 77 bytes in size.
53 This file is readonly. 53 This file is readonly.
@@ -58,7 +58,7 @@ Date: October 2010
58Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 58Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
59Description: The mouse can store 5 profiles which can be switched by the 59Description: The mouse can store 5 profiles which can be switched by the
60 press of a button. A profile is split in settings and buttons. 60 press of a button. A profile is split in settings and buttons.
61 profile_settings holds informations like resolution, sensitivity 61 profile_settings holds information like resolution, sensitivity
62 and light effects. 62 and light effects.
63 When written, this file lets one write the respective profile 63 When written, this file lets one write the respective profile
64 settings back to the mouse. The data has to be 43 bytes long. 64 settings back to the mouse. The data has to be 43 bytes long.
@@ -73,7 +73,7 @@ Date: August 2010
73Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 73Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
74Description: The mouse can store 5 profiles which can be switched by the 74Description: The mouse can store 5 profiles which can be switched by the
75 press of a button. A profile is split in settings and buttons. 75 press of a button. A profile is split in settings and buttons.
76 profile_settings holds informations like resolution, sensitivity 76 profile_settings holds information like resolution, sensitivity
77 and light effects. 77 and light effects.
78 When read, these files return the respective profile settings. 78 When read, these files return the respective profile settings.
79 The returned data is 43 bytes in size. 79 The returned data is 43 bytes in size.
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kovaplus b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kovaplus
index fdfa16f8189b..20f937c9d84f 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-kovaplus
+++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-kovaplus
@@ -52,7 +52,7 @@ Date: January 2011
52Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 52Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
53Description: The mouse can store 5 profiles which can be switched by the 53Description: The mouse can store 5 profiles which can be switched by the
54 press of a button. A profile is split in settings and buttons. 54 press of a button. A profile is split in settings and buttons.
55 profile_buttons holds informations about button layout. 55 profile_buttons holds information about button layout.
56 When written, this file lets one write the respective profile 56 When written, this file lets one write the respective profile
57 buttons back to the mouse. The data has to be 23 bytes long. 57 buttons back to the mouse. The data has to be 23 bytes long.
58 The mouse will reject invalid data. 58 The mouse will reject invalid data.
@@ -66,7 +66,7 @@ Date: January 2011
66Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 66Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
67Description: The mouse can store 5 profiles which can be switched by the 67Description: The mouse can store 5 profiles which can be switched by the
68 press of a button. A profile is split in settings and buttons. 68 press of a button. A profile is split in settings and buttons.
69 profile_buttons holds informations about button layout. 69 profile_buttons holds information about button layout.
70 When read, these files return the respective profile buttons. 70 When read, these files return the respective profile buttons.
71 The returned data is 23 bytes in size. 71 The returned data is 23 bytes in size.
72 This file is readonly. 72 This file is readonly.
@@ -77,7 +77,7 @@ Date: January 2011
77Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 77Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
78Description: The mouse can store 5 profiles which can be switched by the 78Description: The mouse can store 5 profiles which can be switched by the
79 press of a button. A profile is split in settings and buttons. 79 press of a button. A profile is split in settings and buttons.
80 profile_settings holds informations like resolution, sensitivity 80 profile_settings holds information like resolution, sensitivity
81 and light effects. 81 and light effects.
82 When written, this file lets one write the respective profile 82 When written, this file lets one write the respective profile
83 settings back to the mouse. The data has to be 16 bytes long. 83 settings back to the mouse. The data has to be 16 bytes long.
@@ -92,7 +92,7 @@ Date: January 2011
92Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 92Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
93Description: The mouse can store 5 profiles which can be switched by the 93Description: The mouse can store 5 profiles which can be switched by the
94 press of a button. A profile is split in settings and buttons. 94 press of a button. A profile is split in settings and buttons.
95 profile_settings holds informations like resolution, sensitivity 95 profile_settings holds information like resolution, sensitivity
96 and light effects. 96 and light effects.
97 When read, these files return the respective profile settings. 97 When read, these files return the respective profile settings.
98 The returned data is 16 bytes in size. 98 The returned data is 16 bytes in size.
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra b/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra
index 5fab71af3c46..3f8de50e4ff1 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra
+++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra
@@ -39,7 +39,7 @@ Date: August 2010
39Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 39Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
40Description: The mouse can store 5 profiles which can be switched by the 40Description: The mouse can store 5 profiles which can be switched by the
41 press of a button. A profile is split in settings and buttons. 41 press of a button. A profile is split in settings and buttons.
42 profile_settings holds informations like resolution, sensitivity 42 profile_settings holds information like resolution, sensitivity
43 and light effects. 43 and light effects.
44 When written, this file lets one write the respective profile 44 When written, this file lets one write the respective profile
45 settings back to the mouse. The data has to be 13 bytes long. 45 settings back to the mouse. The data has to be 13 bytes long.
@@ -54,7 +54,7 @@ Date: August 2010
54Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 54Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
55Description: The mouse can store 5 profiles which can be switched by the 55Description: The mouse can store 5 profiles which can be switched by the
56 press of a button. A profile is split in settings and buttons. 56 press of a button. A profile is split in settings and buttons.
57 profile_settings holds informations like resolution, sensitivity 57 profile_settings holds information like resolution, sensitivity
58 and light effects. 58 and light effects.
59 When read, these files return the respective profile settings. 59 When read, these files return the respective profile settings.
60 The returned data is 13 bytes in size. 60 The returned data is 13 bytes in size.
@@ -66,7 +66,7 @@ Date: August 2010
66Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 66Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
67Description: The mouse can store 5 profiles which can be switched by the 67Description: The mouse can store 5 profiles which can be switched by the
68 press of a button. A profile is split in settings and buttons. 68 press of a button. A profile is split in settings and buttons.
69 profile_buttons holds informations about button layout. 69 profile_buttons holds information about button layout.
70 When written, this file lets one write the respective profile 70 When written, this file lets one write the respective profile
71 buttons back to the mouse. The data has to be 19 bytes long. 71 buttons back to the mouse. The data has to be 19 bytes long.
72 The mouse will reject invalid data. 72 The mouse will reject invalid data.
@@ -80,7 +80,7 @@ Date: August 2010
80Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 80Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
81Description: The mouse can store 5 profiles which can be switched by the 81Description: The mouse can store 5 profiles which can be switched by the
82 press of a button. A profile is split in settings and buttons. 82 press of a button. A profile is split in settings and buttons.
83 profile_buttons holds informations about button layout. 83 profile_buttons holds information about button layout.
84 When read, these files return the respective profile buttons. 84 When read, these files return the respective profile buttons.
85 The returned data is 19 bytes in size. 85 The returned data is 19 bytes in size.
86 This file is readonly. 86 This file is readonly.
diff --git a/Documentation/ABI/testing/sysfs-platform-asus-laptop b/Documentation/ABI/testing/sysfs-platform-asus-laptop
index 41ff8ae4dee0..cd9d667c3da2 100644
--- a/Documentation/ABI/testing/sysfs-platform-asus-laptop
+++ b/Documentation/ABI/testing/sysfs-platform-asus-laptop
@@ -27,7 +27,7 @@ KernelVersion: 2.6.20
27Contact: "Corentin Chary" <corentincj@iksaif.net> 27Contact: "Corentin Chary" <corentincj@iksaif.net>
28Description: 28Description:
29 Some models like the W1N have a LED display that can be 29 Some models like the W1N have a LED display that can be
30 used to display several informations. 30 used to display several items of information.
31 To control the LED display, use the following : 31 To control the LED display, use the following :
32 echo 0x0T000DDD > /sys/devices/platform/asus_laptop/ 32 echo 0x0T000DDD > /sys/devices/platform/asus_laptop/
33 where T control the 3 letters display, and DDD the 3 digits display. 33 where T control the 3 letters display, and DDD the 3 digits display.
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index cbdfb7d9455b..aedf1bd02fdd 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -110,22 +110,22 @@ university server with various users - students, professors, system
110tasks etc. The resource planning for this server could be along the 110tasks etc. The resource planning for this server could be along the
111following lines: 111following lines:
112 112
113 CPU : Top cpuset 113 CPU : "Top cpuset"
114 / \ 114 / \
115 CPUSet1 CPUSet2 115 CPUSet1 CPUSet2
116 | | 116 | |
117 (Profs) (Students) 117 (Professors) (Students)
118 118
119 In addition (system tasks) are attached to topcpuset (so 119 In addition (system tasks) are attached to topcpuset (so
120 that they can run anywhere) with a limit of 20% 120 that they can run anywhere) with a limit of 20%
121 121
122 Memory : Professors (50%), students (30%), system (20%) 122 Memory : Professors (50%), Students (30%), system (20%)
123 123
124 Disk : Prof (50%), students (30%), system (20%) 124 Disk : Professors (50%), Students (30%), system (20%)
125 125
126 Network : WWW browsing (20%), Network File System (60%), others (20%) 126 Network : WWW browsing (20%), Network File System (60%), others (20%)
127 / \ 127 / \
128 Prof (15%) students (5%) 128 Professors (15%) students (5%)
129 129
130Browsers like Firefox/Lynx go into the WWW network class, while (k)nfsd go 130Browsers like Firefox/Lynx go into the WWW network class, while (k)nfsd go
131into NFS network class. 131into NFS network class.
diff --git a/Documentation/devicetree/booting-without-of.txt b/Documentation/devicetree/booting-without-of.txt
index 55fd2623445b..50619a0720a8 100644
--- a/Documentation/devicetree/booting-without-of.txt
+++ b/Documentation/devicetree/booting-without-of.txt
@@ -138,7 +138,7 @@ and properties to be present. This will be described in detail in
138section III, but, for example, the kernel does not require you to 138section III, but, for example, the kernel does not require you to
139create a node for every PCI device in the system. It is a requirement 139create a node for every PCI device in the system. It is a requirement
140to have a node for PCI host bridges in order to provide interrupt 140to have a node for PCI host bridges in order to provide interrupt
141routing informations and memory/IO ranges, among others. It is also 141routing information and memory/IO ranges, among others. It is also
142recommended to define nodes for on chip devices and other buses that 142recommended to define nodes for on chip devices and other buses that
143don't specifically fit in an existing OF specification. This creates a 143don't specifically fit in an existing OF specification. This creates a
144great flexibility in the way the kernel can then probe those and match 144great flexibility in the way the kernel can then probe those and match
@@ -385,7 +385,7 @@ struct boot_param_header {
385 among others, by kexec. If you are on an SMP system, this value 385 among others, by kexec. If you are on an SMP system, this value
386 should match the content of the "reg" property of the CPU node in 386 should match the content of the "reg" property of the CPU node in
387 the device-tree corresponding to the CPU calling the kernel entry 387 the device-tree corresponding to the CPU calling the kernel entry
388 point (see further chapters for more informations on the required 388 point (see further chapters for more information on the required
389 device-tree contents) 389 device-tree contents)
390 390
391 - size_dt_strings 391 - size_dt_strings
@@ -553,7 +553,7 @@ looks like in practice.
553 553
554This tree is almost a minimal tree. It pretty much contains the 554This tree is almost a minimal tree. It pretty much contains the
555minimal set of required nodes and properties to boot a linux kernel; 555minimal set of required nodes and properties to boot a linux kernel;
556that is, some basic model informations at the root, the CPUs, and the 556that is, some basic model information at the root, the CPUs, and the
557physical memory layout. It also includes misc information passed 557physical memory layout. It also includes misc information passed
558through /chosen, like in this example, the platform type (mandatory) 558through /chosen, like in this example, the platform type (mandatory)
559and the kernel command line arguments (optional). 559and the kernel command line arguments (optional).
diff --git a/Documentation/dvb/udev.txt b/Documentation/dvb/udev.txt
index 68ee224b6aae..412305b7c557 100644
--- a/Documentation/dvb/udev.txt
+++ b/Documentation/dvb/udev.txt
@@ -1,7 +1,7 @@
1The DVB subsystem currently registers to the sysfs subsystem using the 1The DVB subsystem currently registers to the sysfs subsystem using the
2"class_simple" interface. 2"class_simple" interface.
3 3
4This means that only the basic informations like module loading parameters 4This means that only the basic information like module loading parameters
5are presented through sysfs. Other things that might be interesting are 5are presented through sysfs. Other things that might be interesting are
6currently *not* available. 6currently *not* available.
7 7
diff --git a/Documentation/edac.txt b/Documentation/edac.txt
index 44364fa3598d..249822cde82b 100644
--- a/Documentation/edac.txt
+++ b/Documentation/edac.txt
@@ -311,7 +311,7 @@ Total Correctable Errors count attribute file:
311 'ce_noinfo_count' 311 'ce_noinfo_count'
312 312
313 This attribute file displays the number of CEs that 313 This attribute file displays the number of CEs that
314 have occurred wherewith no informations as to which DIMM slot 314 have occurred wherewith no information as to which DIMM slot
315 is having errors. Memory is handicapped, but operational, 315 is having errors. Memory is handicapped, but operational,
316 yet no information is available to indicate which slot 316 yet no information is available to indicate which slot
317 the failing memory is in. This count field should be also 317 the failing memory is in. This count field should be also
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 49e9796a86a5..cc85a9278190 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1832,15 +1832,17 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
1832 perfmon on Intel CPUs instead of the 1832 perfmon on Intel CPUs instead of the
1833 CPU specific event set. 1833 CPU specific event set.
1834 1834
1835 oops=panic Always panic on oopses. Default is to just kill the process, 1835 oops=panic Always panic on oopses. Default is to just kill the
1836 but there is a small probability of deadlocking the machine. 1836 process, but there is a small probability of
1837 deadlocking the machine.
1837 This will also cause panics on machine check exceptions. 1838 This will also cause panics on machine check exceptions.
1838 Useful together with panic=30 to trigger a reboot. 1839 Useful together with panic=30 to trigger a reboot.
1839 1840
1840 OSS [HW,OSS] 1841 OSS [HW,OSS]
1841 See Documentation/sound/oss/oss-parameters.txt 1842 See Documentation/sound/oss/oss-parameters.txt
1842 1843
1843 panic= [KNL] Kernel behaviour on panic 1844 panic= [KNL] Kernel behaviour on panic: delay <timeout>
1845 seconds before rebooting
1844 Format: <timeout> 1846 Format: <timeout>
1845 1847
1846 parkbd.port= [HW] Parallel port number the keyboard adapter is 1848 parkbd.port= [HW] Parallel port number the keyboard adapter is
@@ -2343,6 +2345,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2343 2345
2344 softlockup_panic= 2346 softlockup_panic=
2345 [KNL] Should the soft-lockup detector generate panics. 2347 [KNL] Should the soft-lockup detector generate panics.
2348 Format: <integer>
2346 2349
2347 sonypi.*= [HW] Sony Programmable I/O Control Device driver 2350 sonypi.*= [HW] Sony Programmable I/O Control Device driver
2348 See Documentation/sonypi.txt 2351 See Documentation/sonypi.txt
@@ -2475,8 +2478,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2475 topology= [S390] 2478 topology= [S390]
2476 Format: {off | on} 2479 Format: {off | on}
2477 Specify if the kernel should make use of the cpu 2480 Specify if the kernel should make use of the cpu
2478 topology informations if the hardware supports these. 2481 topology information if the hardware supports this.
2479 The scheduler will make use of these informations and 2482 The scheduler will make use of this information and
2480 e.g. base its process migration decisions on it. 2483 e.g. base its process migration decisions on it.
2481 Default is on. 2484 Default is on.
2482 2485
@@ -2529,8 +2532,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2529 reported either. 2532 reported either.
2530 2533
2531 unknown_nmi_panic 2534 unknown_nmi_panic
2532 [X86] 2535 [X86] Cause panic on unknown NMI.
2533 Set unknown_nmi_panic=1 early on boot.
2534 2536
2535 usbcore.autosuspend= 2537 usbcore.autosuspend=
2536 [USB] The autosuspend time delay (in seconds) used 2538 [USB] The autosuspend time delay (in seconds) used
diff --git a/Documentation/kmemleak.txt b/Documentation/kmemleak.txt
index 34f6638aa5ac..090e6ee04536 100644
--- a/Documentation/kmemleak.txt
+++ b/Documentation/kmemleak.txt
@@ -11,6 +11,7 @@ with the difference that the orphan objects are not freed but only
11reported via /sys/kernel/debug/kmemleak. A similar method is used by the 11reported via /sys/kernel/debug/kmemleak. A similar method is used by the
12Valgrind tool (memcheck --leak-check) to detect the memory leaks in 12Valgrind tool (memcheck --leak-check) to detect the memory leaks in
13user-space applications. 13user-space applications.
14Kmemleak is supported on x86, arm, powerpc, sparc, sh, microblaze and tile.
14 15
15Usage 16Usage
16----- 17-----
@@ -178,5 +179,4 @@ block doesn't need to be freed (some cases in the init_call functions),
178the pointer is calculated by other methods than the usual container_of 179the pointer is calculated by other methods than the usual container_of
179macro or the pointer is stored in a location not scanned by kmemleak. 180macro or the pointer is stored in a location not scanned by kmemleak.
180 181
181Page allocations and ioremap are not tracked. Only the ARM and x86 182Page allocations and ioremap are not tracked.
182architectures are currently supported.
diff --git a/Documentation/laptops/asus-laptop.txt b/Documentation/laptops/asus-laptop.txt
index c1c5be84e4b1..803e51f6768b 100644
--- a/Documentation/laptops/asus-laptop.txt
+++ b/Documentation/laptops/asus-laptop.txt
@@ -61,7 +61,7 @@ Usage
61 Hotkeys are also reported as input keys (like keyboards) you can check 61 Hotkeys are also reported as input keys (like keyboards) you can check
62 which key are supported using "xev" under X11. 62 which key are supported using "xev" under X11.
63 63
64 You can get informations on the version of your DSDT table by reading the 64 You can get information on the version of your DSDT table by reading the
65 /sys/devices/platform/asus-laptop/infos entry. If you have a question or a 65 /sys/devices/platform/asus-laptop/infos entry. If you have a question or a
66 bug report to do, please include the output of this entry. 66 bug report to do, please include the output of this entry.
67 67
@@ -178,7 +178,7 @@ LED display
178----------- 178-----------
179 179
180 Some models like the W1N have a LED display that can be used to display 180 Some models like the W1N have a LED display that can be used to display
181 several informations. 181 several items of information.
182 182
183 LED display works for the following models: 183 LED display works for the following models:
184 W1000N 184 W1000N
diff --git a/Documentation/leds/00-INDEX b/Documentation/leds/00-INDEX
new file mode 100644
index 000000000000..29f481df32c7
--- /dev/null
+++ b/Documentation/leds/00-INDEX
@@ -0,0 +1,8 @@
1leds-class.txt
2 - documents LED handling under Linux.
3leds-lp3944.txt
4 - notes on how to use the leds-lp3944 driver.
5leds-lp5521.txt
6 - notes on how to use the leds-lp5521 driver.
7leds-lp5523.txt
8 - notes on how to use the leds-lp5523 driver.
diff --git a/Documentation/leds-class.txt b/Documentation/leds/leds-class.txt
index 58b266bd1846..4996586e27e8 100644
--- a/Documentation/leds-class.txt
+++ b/Documentation/leds/leds-class.txt
@@ -95,4 +95,3 @@ There are a number of cases where a trigger might only be mappable to a
95particular LED (ACPI?). The addition of triggers provided by the LED driver 95particular LED (ACPI?). The addition of triggers provided by the LED driver
96should cover this option and be possible to add without breaking the 96should cover this option and be possible to add without breaking the
97current interface. 97current interface.
98
diff --git a/Documentation/leds-lp3944.txt b/Documentation/leds/leds-lp3944.txt
index c6eda18b15ef..c6eda18b15ef 100644
--- a/Documentation/leds-lp3944.txt
+++ b/Documentation/leds/leds-lp3944.txt
diff --git a/Documentation/networking/batman-adv.txt b/Documentation/networking/batman-adv.txt
index 18afcd8afd51..ee496eb2f4a6 100644
--- a/Documentation/networking/batman-adv.txt
+++ b/Documentation/networking/batman-adv.txt
@@ -72,7 +72,7 @@ folder:
72# fragmentation gw_sel_class vis_mode 72# fragmentation gw_sel_class vis_mode
73 73
74 74
75There is a special folder for debugging informations: 75There is a special folder for debugging information:
76 76
77# ls /sys/kernel/debug/batman_adv/bat0/ 77# ls /sys/kernel/debug/batman_adv/bat0/
78# gateways socket transtable_global vis_data 78# gateways socket transtable_global vis_data
diff --git a/Documentation/s390/Debugging390.txt b/Documentation/s390/Debugging390.txt
index 86f9f74b2b34..efe998becc5b 100644
--- a/Documentation/s390/Debugging390.txt
+++ b/Documentation/s390/Debugging390.txt
@@ -2273,7 +2273,7 @@ IP forwarding is on.
2273There is a lot of useful info in here best found by going in & having a look around, 2273There is a lot of useful info in here best found by going in & having a look around,
2274so I'll take you through some entries I consider important. 2274so I'll take you through some entries I consider important.
2275 2275
2276All the processes running on the machine have there own entry defined by 2276All the processes running on the machine have their own entry defined by
2277/proc/<pid> 2277/proc/<pid>
2278So lets have a look at the init process 2278So lets have a look at the init process
2279cd /proc/1 2279cd /proc/1
diff --git a/Documentation/scheduler/sched-domains.txt b/Documentation/scheduler/sched-domains.txt
index 373ceacc367e..b7ee379b651b 100644
--- a/Documentation/scheduler/sched-domains.txt
+++ b/Documentation/scheduler/sched-domains.txt
@@ -1,8 +1,7 @@
1Each CPU has a "base" scheduling domain (struct sched_domain). These are 1Each CPU has a "base" scheduling domain (struct sched_domain). The domain
2accessed via cpu_sched_domain(i) and this_sched_domain() macros. The domain
3hierarchy is built from these base domains via the ->parent pointer. ->parent 2hierarchy is built from these base domains via the ->parent pointer. ->parent
4MUST be NULL terminated, and domain structures should be per-CPU as they 3MUST be NULL terminated, and domain structures should be per-CPU as they are
5are locklessly updated. 4locklessly updated.
6 5
7Each scheduling domain spans a number of CPUs (stored in the ->span field). 6Each scheduling domain spans a number of CPUs (stored in the ->span field).
8A domain's span MUST be a superset of it child's span (this restriction could 7A domain's span MUST be a superset of it child's span (this restriction could
@@ -26,11 +25,26 @@ is treated as one entity. The load of a group is defined as the sum of the
26load of each of its member CPUs, and only when the load of a group becomes 25load of each of its member CPUs, and only when the load of a group becomes
27out of balance are tasks moved between groups. 26out of balance are tasks moved between groups.
28 27
29In kernel/sched.c, rebalance_tick is run periodically on each CPU. This 28In kernel/sched.c, trigger_load_balance() is run periodically on each CPU
30function takes its CPU's base sched domain and checks to see if has reached 29through scheduler_tick(). It raises a softirq after the next regularly scheduled
31its rebalance interval. If so, then it will run load_balance on that domain. 30rebalancing event for the current runqueue has arrived. The actual load
32rebalance_tick then checks the parent sched_domain (if it exists), and the 31balancing workhorse, run_rebalance_domains()->rebalance_domains(), is then run
33parent of the parent and so forth. 32in softirq context (SCHED_SOFTIRQ).
33
34The latter function takes two arguments: the current CPU and whether it was idle
35at the time the scheduler_tick() happened and iterates over all sched domains
36our CPU is on, starting from its base domain and going up the ->parent chain.
37While doing that, it checks to see if the current domain has exhausted its
38rebalance interval. If so, it runs load_balance() on that domain. It then checks
39the parent sched_domain (if it exists), and the parent of the parent and so
40forth.
41
42Initially, load_balance() finds the busiest group in the current sched domain.
43If it succeeds, it looks for the busiest runqueue of all the CPUs' runqueues in
44that group. If it manages to find such a runqueue, it locks both our initial
45CPU's runqueue and the newly found busiest one and starts moving tasks from it
46to our runqueue. The exact number of tasks amounts to an imbalance previously
47computed while iterating over this sched domain's groups.
34 48
35*** Implementing sched domains *** 49*** Implementing sched domains ***
36The "base" domain will "span" the first level of the hierarchy. In the case 50The "base" domain will "span" the first level of the hierarchy. In the case
diff --git a/Documentation/scsi/sym53c8xx_2.txt b/Documentation/scsi/sym53c8xx_2.txt
index 6f63b7989679..6af8f7a7770f 100644
--- a/Documentation/scsi/sym53c8xx_2.txt
+++ b/Documentation/scsi/sym53c8xx_2.txt
@@ -285,7 +285,7 @@ from the driver.
285 285
2867. Profiling information 2867. Profiling information
287 287
288This driver does not provide profiling informations as did its predecessors. 288This driver does not provide profiling information as did its predecessors.
289This feature was not this useful and added complexity to the code. 289This feature was not this useful and added complexity to the code.
290As the driver code got more complex, I have decided to remove everything 290As the driver code got more complex, I have decided to remove everything
291that didn't seem actually useful. 291that didn't seem actually useful.
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index b9b7f30ab500..9822afb6313c 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -2229,7 +2229,7 @@ Proc interfaces (/proc/asound)
2229 2229
2230/proc/asound/card#/pcm#[cp]/oss 2230/proc/asound/card#/pcm#[cp]/oss
2231------------------------------- 2231-------------------------------
2232 String "erase" - erase all additional informations about OSS applications 2232 String "erase" - erase all additional information about OSS applications
2233 String "<app_name> <fragments> <fragment_size> [<options>]" 2233 String "<app_name> <fragments> <fragment_size> [<options>]"
2234 2234
2235 <app_name> - name of application with (higher priority) or without path 2235 <app_name> - name of application with (higher priority) or without path
diff --git a/Documentation/sound/oss/AudioExcelDSP16 b/Documentation/sound/oss/AudioExcelDSP16
index c0f08922993b..e0dc0641b480 100644
--- a/Documentation/sound/oss/AudioExcelDSP16
+++ b/Documentation/sound/oss/AudioExcelDSP16
@@ -1,10 +1,10 @@
1Driver 1Driver
2------ 2------
3 3
4Informations about Audio Excel DSP 16 driver can be found in the source 4Information about Audio Excel DSP 16 driver can be found in the source
5file aedsp16.c 5file aedsp16.c
6Please, read the head of the source before using it. It contain useful 6Please, read the head of the source before using it. It contain useful
7informations. 7information.
8 8
9Configuration 9Configuration
10------------- 10-------------
@@ -68,7 +68,7 @@ Sound cards supported
68This driver supports the SC-6000 and SC-6600 based Gallant's sound card. 68This driver supports the SC-6000 and SC-6600 based Gallant's sound card.
69It don't support the Audio Excel DSP 16 III (try the SC-6600 code). 69It don't support the Audio Excel DSP 16 III (try the SC-6600 code).
70I'm working on the III version of the card: if someone have useful 70I'm working on the III version of the card: if someone have useful
71informations about it, please let me know. 71information about it, please let me know.
72For all the non-supported audio cards, you have to boot MS-DOS (or WIN95) 72For all the non-supported audio cards, you have to boot MS-DOS (or WIN95)
73activating the audio card with the MS-DOS device driver, then you have to 73activating the audio card with the MS-DOS device driver, then you have to
74<ctrl>-<alt>-<del> and boot Linux. 74<ctrl>-<alt>-<del> and boot Linux.
diff --git a/Documentation/sound/oss/README.ymfsb b/Documentation/sound/oss/README.ymfsb
index af8a7d3a4e8e..b6b77906b58d 100644
--- a/Documentation/sound/oss/README.ymfsb
+++ b/Documentation/sound/oss/README.ymfsb
@@ -5,7 +5,7 @@ FIRST OF ALL
5============ 5============
6 6
7 This code references YAMAHA's sample codes and data sheets. 7 This code references YAMAHA's sample codes and data sheets.
8 I respect and thank for all people they made open the informations 8 I respect and thank for all people they made open the information
9 about YMF7xx cards. 9 about YMF7xx cards.
10 10
11 And this codes heavily based on Jeff Garzik <jgarzik@pobox.com>'s 11 And this codes heavily based on Jeff Garzik <jgarzik@pobox.com>'s
diff --git a/Documentation/video4linux/bttv/Insmod-options b/Documentation/video4linux/bttv/Insmod-options
index bbe3ed667d91..14c065fa23ef 100644
--- a/Documentation/video4linux/bttv/Insmod-options
+++ b/Documentation/video4linux/bttv/Insmod-options
@@ -1,5 +1,5 @@
1 1
2Note: "modinfo <module>" prints various informations about a kernel 2Note: "modinfo <module>" prints various information about a kernel
3module, among them a complete and up-to-date list of insmod options. 3module, among them a complete and up-to-date list of insmod options.
4This list tends to be outdated because it is updated manually ... 4This list tends to be outdated because it is updated manually ...
5 5
diff --git a/Documentation/video4linux/bttv/Sound-FAQ b/Documentation/video4linux/bttv/Sound-FAQ
index b6e6debbbc94..395f6c6fdd98 100644
--- a/Documentation/video4linux/bttv/Sound-FAQ
+++ b/Documentation/video4linux/bttv/Sound-FAQ
@@ -8,7 +8,7 @@ completely by the bt8xx chip, which is common on all boards. But
8sound is handled in slightly different ways on each board. 8sound is handled in slightly different ways on each board.
9 9
10To handle the grabber boards correctly, there is a array tvcards[] in 10To handle the grabber boards correctly, there is a array tvcards[] in
11bttv-cards.c, which holds the informations required for each board. 11bttv-cards.c, which holds the information required for each board.
12Sound will work only, if the correct entry is used (for video it often 12Sound will work only, if the correct entry is used (for video it often
13makes no difference). The bttv driver prints a line to the kernel 13makes no difference). The bttv driver prints a line to the kernel
14log, telling which card type is used. Like this one: 14log, telling which card type is used. Like this one:
diff --git a/Documentation/video4linux/et61x251.txt b/Documentation/video4linux/et61x251.txt
index 1247566c4de3..e0cdae491858 100644
--- a/Documentation/video4linux/et61x251.txt
+++ b/Documentation/video4linux/et61x251.txt
@@ -191,10 +191,10 @@ Syntax: <n>
191Description: Debugging information level, from 0 to 3: 191Description: Debugging information level, from 0 to 3:
192 0 = none (use carefully) 192 0 = none (use carefully)
193 1 = critical errors 193 1 = critical errors
194 2 = significant informations 194 2 = significant information
195 3 = more verbose messages 195 3 = more verbose messages
196 Level 3 is useful for testing only, when only one device 196 Level 3 is useful for testing only, when only one device
197 is used at the same time. It also shows some more informations 197 is used at the same time. It also shows some more information
198 about the hardware being detected. This module parameter can be 198 about the hardware being detected. This module parameter can be
199 changed at runtime thanks to the /sys filesystem interface. 199 changed at runtime thanks to the /sys filesystem interface.
200Default: 2 200Default: 2
diff --git a/Documentation/video4linux/sn9c102.txt b/Documentation/video4linux/sn9c102.txt
index 73de4050d637..b4f67040403a 100644
--- a/Documentation/video4linux/sn9c102.txt
+++ b/Documentation/video4linux/sn9c102.txt
@@ -214,10 +214,10 @@ Syntax: <n>
214Description: Debugging information level, from 0 to 3: 214Description: Debugging information level, from 0 to 3:
215 0 = none (use carefully) 215 0 = none (use carefully)
216 1 = critical errors 216 1 = critical errors
217 2 = significant informations 217 2 = significant information
218 3 = more verbose messages 218 3 = more verbose messages
219 Level 3 is useful for testing only. It also shows some more 219 Level 3 is useful for testing only. It also shows some more
220 informations about the hardware being detected. 220 information about the hardware being detected.
221 This parameter can be changed at runtime thanks to the /sys 221 This parameter can be changed at runtime thanks to the /sys
222 filesystem interface. 222 filesystem interface.
223Default: 2 223Default: 2
diff --git a/Documentation/video4linux/w9968cf.txt b/Documentation/video4linux/w9968cf.txt
index 05138e8aea07..9649450f3b90 100644
--- a/Documentation/video4linux/w9968cf.txt
+++ b/Documentation/video4linux/w9968cf.txt
@@ -413,7 +413,7 @@ Syntax: <n>
413Description: Debugging information level, from 0 to 6: 413Description: Debugging information level, from 0 to 6:
414 0 = none (use carefully) 414 0 = none (use carefully)
415 1 = critical errors 415 1 = critical errors
416 2 = significant informations 416 2 = significant information
417 3 = configuration or general messages 417 3 = configuration or general messages
418 4 = warnings 418 4 = warnings
419 5 = called functions 419 5 = called functions
diff --git a/Documentation/video4linux/zc0301.txt b/Documentation/video4linux/zc0301.txt
index befdfdacdc5b..b41c83cf09f4 100644
--- a/Documentation/video4linux/zc0301.txt
+++ b/Documentation/video4linux/zc0301.txt
@@ -181,10 +181,10 @@ Syntax: <n>
181Description: Debugging information level, from 0 to 3: 181Description: Debugging information level, from 0 to 3:
182 0 = none (use carefully) 182 0 = none (use carefully)
183 1 = critical errors 183 1 = critical errors
184 2 = significant informations 184 2 = significant information
185 3 = more verbose messages 185 3 = more verbose messages
186 Level 3 is useful for testing only, when only one device 186 Level 3 is useful for testing only, when only one device
187 is used at the same time. It also shows some more informations 187 is used at the same time. It also shows some information
188 about the hardware being detected. This module parameter can be 188 about the hardware being detected. This module parameter can be
189 changed at runtime thanks to the /sys filesystem interface. 189 changed at runtime thanks to the /sys filesystem interface.
190Default: 2 190Default: 2
@@ -261,7 +261,7 @@ the fingerprint is: '88E8 F32F 7244 68BA 3958 5D40 99DA 5D2A FCE6 35A4'.
261 261
26211. Credits 26211. Credits
263=========== 263===========
264- Informations about the chip internals needed to enable the I2C protocol have 264- Information about the chip internals needed to enable the I2C protocol have
265 been taken from the documentation of the ZC030x Video4Linux1 driver written 265 been taken from the documentation of the ZC030x Video4Linux1 driver written
266 by Andrew Birkett <andy@nobugs.org>; 266 by Andrew Birkett <andy@nobugs.org>;
267- The initialization values of the ZC0301 controller connected to the PAS202BCB 267- The initialization values of the ZC0301 controller connected to the PAS202BCB
diff --git a/Makefile b/Makefile
index ba7a55ccd890..8392b64079df 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 39 3SUBLEVEL = 39
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Flesh-Eating Bats with Fangs 5NAME = Flesh-Eating Bats with Fangs
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 1c50e4cd63ed..81a1f4e6bcd8 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -412,7 +412,7 @@ sn_call_force_intr_provider(struct sn_irq_info *sn_irq_info)
412 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type]; 412 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type];
413 413
414 /* Don't force an interrupt if the irq has been disabled */ 414 /* Don't force an interrupt if the irq has been disabled */
415 if (!irqd_irq_disabled(sn_irq_info->irq_irq) && 415 if (!irqd_irq_disabled(irq_get_irq_data(sn_irq_info->irq_irq)) &&
416 pci_provider && pci_provider->force_interrupt) 416 pci_provider && pci_provider->force_interrupt)
417 (*pci_provider->force_interrupt)(sn_irq_info); 417 (*pci_provider->force_interrupt)(sn_irq_info);
418} 418}
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index c76d8dc3aea3..7aab87f48060 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -45,38 +45,6 @@ static int licenseID_open(struct inode *inode, struct file *file)
45 return single_open(file, licenseID_show, NULL); 45 return single_open(file, licenseID_show, NULL);
46} 46}
47 47
48/*
49 * Enable forced interrupt by default.
50 * When set, the sn interrupt handler writes the force interrupt register on
51 * the bridge chip. The hardware will then send an interrupt message if the
52 * interrupt line is active. This mimics a level sensitive interrupt.
53 */
54extern int sn_force_interrupt_flag;
55
56static int sn_force_interrupt_show(struct seq_file *s, void *p)
57{
58 seq_printf(s, "Force interrupt is %s\n",
59 sn_force_interrupt_flag ? "enabled" : "disabled");
60 return 0;
61}
62
63static ssize_t sn_force_interrupt_write_proc(struct file *file,
64 const char __user *buffer, size_t count, loff_t *data)
65{
66 char val;
67
68 if (copy_from_user(&val, buffer, 1))
69 return -EFAULT;
70
71 sn_force_interrupt_flag = (val == '0') ? 0 : 1;
72 return count;
73}
74
75static int sn_force_interrupt_open(struct inode *inode, struct file *file)
76{
77 return single_open(file, sn_force_interrupt_show, NULL);
78}
79
80static int coherence_id_show(struct seq_file *s, void *p) 48static int coherence_id_show(struct seq_file *s, void *p)
81{ 49{
82 seq_printf(s, "%d\n", partition_coherence_id()); 50 seq_printf(s, "%d\n", partition_coherence_id());
@@ -114,14 +82,6 @@ static const struct file_operations proc_license_id_fops = {
114 .release = single_release, 82 .release = single_release,
115}; 83};
116 84
117static const struct file_operations proc_sn_force_intr_fops = {
118 .open = sn_force_interrupt_open,
119 .read = seq_read,
120 .write = sn_force_interrupt_write_proc,
121 .llseek = seq_lseek,
122 .release = single_release,
123};
124
125static const struct file_operations proc_coherence_id_fops = { 85static const struct file_operations proc_coherence_id_fops = {
126 .open = coherence_id_open, 86 .open = coherence_id_open,
127 .read = seq_read, 87 .read = seq_read,
@@ -149,8 +109,6 @@ void register_sn_procfs(void)
149 proc_create("system_serial_number", 0444, sgi_proc_dir, 109 proc_create("system_serial_number", 0444, sgi_proc_dir,
150 &proc_system_sn_fops); 110 &proc_system_sn_fops);
151 proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops); 111 proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops);
152 proc_create("sn_force_interrupt", 0644, sgi_proc_dir,
153 &proc_sn_force_intr_fops);
154 proc_create("coherence_id", 0444, sgi_proc_dir, 112 proc_create("coherence_id", 0444, sgi_proc_dir,
155 &proc_coherence_id_fops); 113 &proc_coherence_id_fops);
156 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops); 114 proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops);
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index d770b00ec6b1..30edd61a6b8f 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -386,8 +386,12 @@
386#define __NR_fanotify_init 368 386#define __NR_fanotify_init 368
387#define __NR_fanotify_mark 369 387#define __NR_fanotify_mark 369
388#define __NR_prlimit64 370 388#define __NR_prlimit64 370
389#define __NR_name_to_handle_at 371
390#define __NR_open_by_handle_at 372
391#define __NR_clock_adjtime 373
392#define __NR_syncfs 374
389 393
390#define __NR_syscalls 371 394#define __NR_syscalls 375
391 395
392#ifdef __KERNEL__ 396#ifdef __KERNEL__
393#ifndef __ASSEMBLY__ 397#ifndef __ASSEMBLY__
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index f0cb5c26c81c..494b63b72dd7 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -10,6 +10,7 @@ CFLAGS_REMOVE_early_printk.o = -pg
10CFLAGS_REMOVE_selfmod.o = -pg 10CFLAGS_REMOVE_selfmod.o = -pg
11CFLAGS_REMOVE_heartbeat.o = -pg 11CFLAGS_REMOVE_heartbeat.o = -pg
12CFLAGS_REMOVE_ftrace.o = -pg 12CFLAGS_REMOVE_ftrace.o = -pg
13CFLAGS_REMOVE_process.o = -pg
13endif 14endif
14 15
15extra-y := head.o vmlinux.lds 16extra-y := head.o vmlinux.lds
diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c
index 515feb404555..357d56abe24a 100644
--- a/arch/microblaze/kernel/ftrace.c
+++ b/arch/microblaze/kernel/ftrace.c
@@ -51,6 +51,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
51 : "r" (parent), "r" (return_hooker) 51 : "r" (parent), "r" (return_hooker)
52 ); 52 );
53 53
54 flush_dcache_range((u32)parent, (u32)parent + 4);
55 flush_icache_range((u32)parent, (u32)parent + 4);
56
54 if (unlikely(faulted)) { 57 if (unlikely(faulted)) {
55 ftrace_graph_stop(); 58 ftrace_graph_stop();
56 WARN_ON(1); 59 WARN_ON(1);
@@ -95,6 +98,9 @@ static int ftrace_modify_code(unsigned long addr, unsigned int value)
95 if (unlikely(faulted)) 98 if (unlikely(faulted))
96 return -EFAULT; 99 return -EFAULT;
97 100
101 flush_dcache_range(addr, addr + 4);
102 flush_icache_range(addr, addr + 4);
103
98 return 0; 104 return 0;
99} 105}
100 106
@@ -195,8 +201,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
195 ret += ftrace_modify_code((unsigned long)&ftrace_caller, 201 ret += ftrace_modify_code((unsigned long)&ftrace_caller,
196 MICROBLAZE_NOP); 202 MICROBLAZE_NOP);
197 203
198 /* All changes are done - lets do caches consistent */
199 flush_icache();
200 return ret; 204 return ret;
201} 205}
202 206
@@ -210,7 +214,6 @@ int ftrace_enable_ftrace_graph_caller(void)
210 214
211 old_jump = *(unsigned int *)ip; /* save jump over instruction */ 215 old_jump = *(unsigned int *)ip; /* save jump over instruction */
212 ret = ftrace_modify_code(ip, MICROBLAZE_NOP); 216 ret = ftrace_modify_code(ip, MICROBLAZE_NOP);
213 flush_icache();
214 217
215 pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump); 218 pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump);
216 return ret; 219 return ret;
@@ -222,7 +225,6 @@ int ftrace_disable_ftrace_graph_caller(void)
222 unsigned long ip = (unsigned long)(&ftrace_call_graph); 225 unsigned long ip = (unsigned long)(&ftrace_call_graph);
223 226
224 ret = ftrace_modify_code(ip, old_jump); 227 ret = ftrace_modify_code(ip, old_jump);
225 flush_icache();
226 228
227 pr_debug("%s\n", __func__); 229 pr_debug("%s\n", __func__);
228 return ret; 230 return ret;
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
index 5ba7e162833b..c88f066f41bd 100644
--- a/arch/microblaze/kernel/intc.c
+++ b/arch/microblaze/kernel/intc.c
@@ -158,11 +158,11 @@ void __init init_IRQ(void)
158 for (i = 0; i < nr_irq; ++i) { 158 for (i = 0; i < nr_irq; ++i) {
159 if (intr_type & (0x00000001 << i)) { 159 if (intr_type & (0x00000001 << i)) {
160 irq_set_chip_and_handler_name(i, &intc_dev, 160 irq_set_chip_and_handler_name(i, &intc_dev,
161 handle_edge_irq, intc_dev.name); 161 handle_edge_irq, "edge");
162 irq_clear_status_flags(i, IRQ_LEVEL); 162 irq_clear_status_flags(i, IRQ_LEVEL);
163 } else { 163 } else {
164 irq_set_chip_and_handler_name(i, &intc_dev, 164 irq_set_chip_and_handler_name(i, &intc_dev,
165 handle_level_irq, intc_dev.name); 165 handle_level_irq, "level");
166 irq_set_status_flags(i, IRQ_LEVEL); 166 irq_set_status_flags(i, IRQ_LEVEL);
167 } 167 }
168 } 168 }
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index e88a930fd1e3..85cea81d1ca1 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -375,3 +375,7 @@ ENTRY(sys_call_table)
375 .long sys_fanotify_init 375 .long sys_fanotify_init
376 .long sys_fanotify_mark 376 .long sys_fanotify_mark
377 .long sys_prlimit64 /* 370 */ 377 .long sys_prlimit64 /* 370 */
378 .long sys_name_to_handle_at
379 .long sys_open_by_handle_at
380 .long sys_clock_adjtime
381 .long sys_syncfs
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index f1fcbff3da25..10c320aa908b 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -2,6 +2,12 @@
2# Makefile 2# Makefile
3# 3#
4 4
5ifdef CONFIG_FUNCTION_TRACER
6CFLAGS_REMOVE_ashldi3.o = -pg
7CFLAGS_REMOVE_ashrdi3.o = -pg
8CFLAGS_REMOVE_lshrdi3.o = -pg
9endif
10
5lib-y := memset.o 11lib-y := memset.o
6 12
7ifeq ($(CONFIG_OPT_LIB_ASM),y) 13ifeq ($(CONFIG_OPT_LIB_ASM),y)
diff --git a/arch/powerpc/boot/dts/p1020rdb.dts b/arch/powerpc/boot/dts/p1020rdb.dts
index 22f64b62d7f6..e0668f877794 100644
--- a/arch/powerpc/boot/dts/p1020rdb.dts
+++ b/arch/powerpc/boot/dts/p1020rdb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * P1020 RDB Device Tree Source 2 * P1020 RDB Device Tree Source
3 * 3 *
4 * Copyright 2009 Freescale Semiconductor Inc. 4 * Copyright 2009-2011 Freescale Semiconductor Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -553,7 +553,7 @@
553 reg = <0 0xffe09000 0 0x1000>; 553 reg = <0 0xffe09000 0 0x1000>;
554 bus-range = <0 255>; 554 bus-range = <0 255>;
555 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000 555 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
556 0x1000000 0x0 0x00000000 0 0xffc30000 0x0 0x10000>; 556 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
557 clock-frequency = <33333333>; 557 clock-frequency = <33333333>;
558 interrupt-parent = <&mpic>; 558 interrupt-parent = <&mpic>;
559 interrupts = <16 2>; 559 interrupts = <16 2>;
@@ -580,8 +580,8 @@
580 #address-cells = <3>; 580 #address-cells = <3>;
581 reg = <0 0xffe0a000 0 0x1000>; 581 reg = <0 0xffe0a000 0 0x1000>;
582 bus-range = <0 255>; 582 bus-range = <0 255>;
583 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000 583 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
584 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>; 584 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
585 clock-frequency = <33333333>; 585 clock-frequency = <33333333>;
586 interrupt-parent = <&mpic>; 586 interrupt-parent = <&mpic>;
587 interrupts = <16 2>; 587 interrupts = <16 2>;
@@ -590,8 +590,8 @@
590 #size-cells = <2>; 590 #size-cells = <2>;
591 #address-cells = <3>; 591 #address-cells = <3>;
592 device_type = "pci"; 592 device_type = "pci";
593 ranges = <0x2000000 0x0 0xc0000000 593 ranges = <0x2000000 0x0 0x80000000
594 0x2000000 0x0 0xc0000000 594 0x2000000 0x0 0x80000000
595 0x0 0x20000000 595 0x0 0x20000000
596 596
597 0x1000000 0x0 0x0 597 0x1000000 0x0 0x0
diff --git a/arch/powerpc/boot/dts/p2020rdb.dts b/arch/powerpc/boot/dts/p2020rdb.dts
index da4cb0d8d215..e2d48fd4416e 100644
--- a/arch/powerpc/boot/dts/p2020rdb.dts
+++ b/arch/powerpc/boot/dts/p2020rdb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * P2020 RDB Device Tree Source 2 * P2020 RDB Device Tree Source
3 * 3 *
4 * Copyright 2009 Freescale Semiconductor Inc. 4 * Copyright 2009-2011 Freescale Semiconductor Inc.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -537,7 +537,7 @@
537 reg = <0 0xffe09000 0 0x1000>; 537 reg = <0 0xffe09000 0 0x1000>;
538 bus-range = <0 255>; 538 bus-range = <0 255>;
539 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000 539 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
540 0x1000000 0x0 0x00000000 0 0xffc30000 0x0 0x10000>; 540 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
541 clock-frequency = <33333333>; 541 clock-frequency = <33333333>;
542 interrupt-parent = <&mpic>; 542 interrupt-parent = <&mpic>;
543 interrupts = <25 2>; 543 interrupts = <25 2>;
@@ -564,8 +564,8 @@
564 #address-cells = <3>; 564 #address-cells = <3>;
565 reg = <0 0xffe0a000 0 0x1000>; 565 reg = <0 0xffe0a000 0 0x1000>;
566 bus-range = <0 255>; 566 bus-range = <0 255>;
567 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000 567 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
568 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>; 568 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
569 clock-frequency = <33333333>; 569 clock-frequency = <33333333>;
570 interrupt-parent = <&mpic>; 570 interrupt-parent = <&mpic>;
571 interrupts = <26 2>; 571 interrupts = <26 2>;
@@ -574,8 +574,8 @@
574 #size-cells = <2>; 574 #size-cells = <2>;
575 #address-cells = <3>; 575 #address-cells = <3>;
576 device_type = "pci"; 576 device_type = "pci";
577 ranges = <0x2000000 0x0 0xc0000000 577 ranges = <0x2000000 0x0 0x80000000
578 0x2000000 0x0 0xc0000000 578 0x2000000 0x0 0x80000000
579 0x0 0x20000000 579 0x0 0x20000000
580 580
581 0x1000000 0x0 0x0 581 0x1000000 0x0 0x0
diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
index 0fe93d0c8b2e..b69c3a5dc858 100644
--- a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
+++ b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
@@ -6,7 +6,7 @@
6 * This dts file allows core0 to have memory, l2, i2c, spi, gpio, dma1, usb, 6 * This dts file allows core0 to have memory, l2, i2c, spi, gpio, dma1, usb,
7 * eth1, eth2, sdhc, crypto, global-util, pci0. 7 * eth1, eth2, sdhc, crypto, global-util, pci0.
8 * 8 *
9 * Copyright 2009 Freescale Semiconductor Inc. 9 * Copyright 2009-2011 Freescale Semiconductor Inc.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 12 * under the terms of the GNU General Public License as published by the
@@ -342,7 +342,7 @@
342 reg = <0 0xffe09000 0 0x1000>; 342 reg = <0 0xffe09000 0 0x1000>;
343 bus-range = <0 255>; 343 bus-range = <0 255>;
344 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000 344 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
345 0x1000000 0x0 0x00000000 0 0xffc30000 0x0 0x10000>; 345 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>;
346 clock-frequency = <33333333>; 346 clock-frequency = <33333333>;
347 interrupt-parent = <&mpic>; 347 interrupt-parent = <&mpic>;
348 interrupts = <25 2>; 348 interrupts = <25 2>;
diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
index e95a51285328..7a31d46c01b0 100644
--- a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
+++ b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
@@ -7,7 +7,7 @@
7 * 7 *
8 * Please note to add "-b 1" for core1's dts compiling. 8 * Please note to add "-b 1" for core1's dts compiling.
9 * 9 *
10 * Copyright 2009 Freescale Semiconductor Inc. 10 * Copyright 2009-2011 Freescale Semiconductor Inc.
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
@@ -162,8 +162,8 @@
162 #address-cells = <3>; 162 #address-cells = <3>;
163 reg = <0 0xffe0a000 0 0x1000>; 163 reg = <0 0xffe0a000 0 0x1000>;
164 bus-range = <0 255>; 164 bus-range = <0 255>;
165 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000 165 ranges = <0x2000000 0x0 0x80000000 0 0x80000000 0x0 0x20000000
166 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>; 166 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>;
167 clock-frequency = <33333333>; 167 clock-frequency = <33333333>;
168 interrupt-parent = <&mpic>; 168 interrupt-parent = <&mpic>;
169 interrupts = <26 2>; 169 interrupts = <26 2>;
@@ -172,8 +172,8 @@
172 #size-cells = <2>; 172 #size-cells = <2>;
173 #address-cells = <3>; 173 #address-cells = <3>;
174 device_type = "pci"; 174 device_type = "pci";
175 ranges = <0x2000000 0x0 0xc0000000 175 ranges = <0x2000000 0x0 0x80000000
176 0x2000000 0x0 0xc0000000 176 0x2000000 0x0 0x80000000
177 0x0 0x20000000 177 0x0 0x20000000
178 178
179 0x1000000 0x0 0x0 179 0x1000000 0x0 0x0
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index fe56a23e1ff0..e4f01915fbb0 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -35,9 +35,9 @@ struct smp_ops_t {
35 int (*probe)(void); 35 int (*probe)(void);
36 void (*kick_cpu)(int nr); 36 void (*kick_cpu)(int nr);
37 void (*setup_cpu)(int nr); 37 void (*setup_cpu)(int nr);
38 void (*bringup_done)(void);
38 void (*take_timebase)(void); 39 void (*take_timebase)(void);
39 void (*give_timebase)(void); 40 void (*give_timebase)(void);
40 int (*cpu_enable)(unsigned int nr);
41 int (*cpu_disable)(void); 41 int (*cpu_disable)(void);
42 void (*cpu_die)(unsigned int nr); 42 void (*cpu_die)(unsigned int nr);
43 int (*cpu_bootable)(unsigned int nr); 43 int (*cpu_bootable)(unsigned int nr);
@@ -267,7 +267,6 @@ struct machdep_calls {
267 267
268extern void e500_idle(void); 268extern void e500_idle(void);
269extern void power4_idle(void); 269extern void power4_idle(void);
270extern void power4_cpu_offline_powersave(void);
271extern void ppc6xx_idle(void); 270extern void ppc6xx_idle(void);
272extern void book3e_idle(void); 271extern void book3e_idle(void);
273 272
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 66e237bbe15f..a902a0d3ae0d 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -36,15 +36,16 @@ extern void cpu_die(void);
36 36
37extern void smp_send_debugger_break(int cpu); 37extern void smp_send_debugger_break(int cpu);
38extern void smp_message_recv(int); 38extern void smp_message_recv(int);
39extern void start_secondary_resume(void);
39 40
40DECLARE_PER_CPU(unsigned int, cpu_pvr); 41DECLARE_PER_CPU(unsigned int, cpu_pvr);
41 42
42#ifdef CONFIG_HOTPLUG_CPU 43#ifdef CONFIG_HOTPLUG_CPU
43extern void fixup_irqs(const struct cpumask *map); 44extern void migrate_irqs(void);
44int generic_cpu_disable(void); 45int generic_cpu_disable(void);
45int generic_cpu_enable(unsigned int cpu);
46void generic_cpu_die(unsigned int cpu); 46void generic_cpu_die(unsigned int cpu);
47void generic_mach_cpu_die(void); 47void generic_mach_cpu_die(void);
48void generic_set_cpu_dead(unsigned int cpu);
48#endif 49#endif
49 50
50#ifdef CONFIG_PPC64 51#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 3d569e2aff18..3d3d416339dd 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -163,7 +163,7 @@ static void crash_kexec_prepare_cpus(int cpu)
163} 163}
164 164
165/* wait for all the CPUs to hit real mode but timeout if they don't come in */ 165/* wait for all the CPUs to hit real mode but timeout if they don't come in */
166#ifdef CONFIG_PPC_STD_MMU_64 166#if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP)
167static void crash_kexec_wait_realmode(int cpu) 167static void crash_kexec_wait_realmode(int cpu)
168{ 168{
169 unsigned int msecs; 169 unsigned int msecs;
@@ -188,6 +188,8 @@ static void crash_kexec_wait_realmode(int cpu)
188 } 188 }
189 mb(); 189 mb();
190} 190}
191#else
192static inline void crash_kexec_wait_realmode(int cpu) {}
191#endif 193#endif
192 194
193/* 195/*
@@ -344,9 +346,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
344 crash_save_cpu(regs, crashing_cpu); 346 crash_save_cpu(regs, crashing_cpu);
345 crash_kexec_prepare_cpus(crashing_cpu); 347 crash_kexec_prepare_cpus(crashing_cpu);
346 cpu_set(crashing_cpu, cpus_in_crash); 348 cpu_set(crashing_cpu, cpus_in_crash);
347#if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP)
348 crash_kexec_wait_realmode(crashing_cpu); 349 crash_kexec_wait_realmode(crashing_cpu);
349#endif
350 350
351 machine_kexec_mask_interrupts(); 351 machine_kexec_mask_interrupts();
352 352
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 98c4b29a56f4..c5c24beb8387 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -890,6 +890,15 @@ __secondary_start:
890 mtspr SPRN_SRR1,r4 890 mtspr SPRN_SRR1,r4
891 SYNC 891 SYNC
892 RFI 892 RFI
893
894_GLOBAL(start_secondary_resume)
895 /* Reset stack */
896 rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
897 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
898 li r3,0
899 std r3,0(r1) /* Zero the stack frame pointer */
900 bl start_secondary
901 b .
893#endif /* CONFIG_SMP */ 902#endif /* CONFIG_SMP */
894 903
895#ifdef CONFIG_KVM_BOOK3S_HANDLER 904#ifdef CONFIG_KVM_BOOK3S_HANDLER
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 285e6f775bdf..3a319f9c9d3e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -536,6 +536,13 @@ _GLOBAL(pmac_secondary_start)
536 add r13,r13,r4 /* for this processor. */ 536 add r13,r13,r4 /* for this processor. */
537 mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/ 537 mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/
538 538
539 /* Mark interrupts soft and hard disabled (they might be enabled
540 * in the PACA when doing hotplug)
541 */
542 li r0,0
543 stb r0,PACASOFTIRQEN(r13)
544 stb r0,PACAHARDIRQEN(r13)
545
539 /* Create a temp kernel stack for use before relocation is on. */ 546 /* Create a temp kernel stack for use before relocation is on. */
540 ld r1,PACAEMERGSP(r13) 547 ld r1,PACAEMERGSP(r13)
541 subi r1,r1,STACK_FRAME_OVERHEAD 548 subi r1,r1,STACK_FRAME_OVERHEAD
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 5328709eeedc..ba3195478600 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -53,24 +53,3 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
53 isync 53 isync
54 b 1b 54 b 1b
55 55
56_GLOBAL(power4_cpu_offline_powersave)
57 /* Go to NAP now */
58 mfmsr r7
59 rldicl r0,r7,48,1
60 rotldi r0,r0,16
61 mtmsrd r0,1 /* hard-disable interrupts */
62 li r0,1
63 li r6,0
64 stb r0,PACAHARDIRQEN(r13) /* we'll hard-enable shortly */
65 stb r6,PACASOFTIRQEN(r13) /* soft-disable irqs */
66BEGIN_FTR_SECTION
67 DSSALL
68 sync
69END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
70 ori r7,r7,MSR_EE
71 oris r7,r7,MSR_POW@h
72 sync
73 isync
74 mtmsrd r7
75 isync
76 blr
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 63625e0650b5..f621b7d2d869 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -246,12 +246,13 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
246} 246}
247 247
248#ifdef CONFIG_HOTPLUG_CPU 248#ifdef CONFIG_HOTPLUG_CPU
249void fixup_irqs(const struct cpumask *map) 249void migrate_irqs(void)
250{ 250{
251 struct irq_desc *desc; 251 struct irq_desc *desc;
252 unsigned int irq; 252 unsigned int irq;
253 static int warned; 253 static int warned;
254 cpumask_var_t mask; 254 cpumask_var_t mask;
255 const struct cpumask *map = cpu_online_mask;
255 256
256 alloc_cpumask_var(&mask, GFP_KERNEL); 257 alloc_cpumask_var(&mask, GFP_KERNEL);
257 258
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index f4adf89d7614..10f0aadee95b 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -203,7 +203,7 @@ void __init free_unused_pacas(void)
203{ 203{
204 int new_size; 204 int new_size;
205 205
206 new_size = PAGE_ALIGN(sizeof(struct paca_struct) * num_possible_cpus()); 206 new_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids);
207 207
208 if (new_size >= paca_size) 208 if (new_size >= paca_size)
209 return; 209 return;
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 9d4882a46647..21f30cb68077 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -509,6 +509,9 @@ void __init smp_setup_cpu_maps(void)
509 */ 509 */
510 cpu_init_thread_core_maps(nthreads); 510 cpu_init_thread_core_maps(nthreads);
511 511
512 /* Now that possible cpus are set, set nr_cpu_ids for later use */
513 nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
514
512 free_unused_pacas(); 515 free_unused_pacas();
513} 516}
514#endif /* CONFIG_SMP */ 517#endif /* CONFIG_SMP */
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 981360509172..cbdbb14be4b0 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -57,6 +57,25 @@
57#define DBG(fmt...) 57#define DBG(fmt...)
58#endif 58#endif
59 59
60
61/* Store all idle threads, this can be reused instead of creating
62* a new thread. Also avoids complicated thread destroy functionality
63* for idle threads.
64*/
65#ifdef CONFIG_HOTPLUG_CPU
66/*
67 * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is
68 * removed after init for !CONFIG_HOTPLUG_CPU.
69 */
70static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
71#define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
72#define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
73#else
74static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
75#define get_idle_for_cpu(x) (idle_thread_array[(x)])
76#define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p))
77#endif
78
60struct thread_info *secondary_ti; 79struct thread_info *secondary_ti;
61 80
62DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map); 81DEFINE_PER_CPU(cpumask_var_t, cpu_sibling_map);
@@ -238,23 +257,6 @@ static void __devinit smp_store_cpu_info(int id)
238 per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR); 257 per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR);
239} 258}
240 259
241static void __init smp_create_idle(unsigned int cpu)
242{
243 struct task_struct *p;
244
245 /* create a process for the processor */
246 p = fork_idle(cpu);
247 if (IS_ERR(p))
248 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
249#ifdef CONFIG_PPC64
250 paca[cpu].__current = p;
251 paca[cpu].kstack = (unsigned long) task_thread_info(p)
252 + THREAD_SIZE - STACK_FRAME_OVERHEAD;
253#endif
254 current_set[cpu] = task_thread_info(p);
255 task_thread_info(p)->cpu = cpu;
256}
257
258void __init smp_prepare_cpus(unsigned int max_cpus) 260void __init smp_prepare_cpus(unsigned int max_cpus)
259{ 261{
260 unsigned int cpu; 262 unsigned int cpu;
@@ -288,10 +290,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
288 max_cpus = NR_CPUS; 290 max_cpus = NR_CPUS;
289 else 291 else
290 max_cpus = 1; 292 max_cpus = 1;
291
292 for_each_possible_cpu(cpu)
293 if (cpu != boot_cpuid)
294 smp_create_idle(cpu);
295} 293}
296 294
297void __devinit smp_prepare_boot_cpu(void) 295void __devinit smp_prepare_boot_cpu(void)
@@ -305,7 +303,7 @@ void __devinit smp_prepare_boot_cpu(void)
305 303
306#ifdef CONFIG_HOTPLUG_CPU 304#ifdef CONFIG_HOTPLUG_CPU
307/* State of each CPU during hotplug phases */ 305/* State of each CPU during hotplug phases */
308DEFINE_PER_CPU(int, cpu_state) = { 0 }; 306static DEFINE_PER_CPU(int, cpu_state) = { 0 };
309 307
310int generic_cpu_disable(void) 308int generic_cpu_disable(void)
311{ 309{
@@ -317,30 +315,8 @@ int generic_cpu_disable(void)
317 set_cpu_online(cpu, false); 315 set_cpu_online(cpu, false);
318#ifdef CONFIG_PPC64 316#ifdef CONFIG_PPC64
319 vdso_data->processorCount--; 317 vdso_data->processorCount--;
320 fixup_irqs(cpu_online_mask);
321#endif
322 return 0;
323}
324
325int generic_cpu_enable(unsigned int cpu)
326{
327 /* Do the normal bootup if we haven't
328 * already bootstrapped. */
329 if (system_state != SYSTEM_RUNNING)
330 return -ENOSYS;
331
332 /* get the target out of it's holding state */
333 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
334 smp_wmb();
335
336 while (!cpu_online(cpu))
337 cpu_relax();
338
339#ifdef CONFIG_PPC64
340 fixup_irqs(cpu_online_mask);
341 /* counter the irq disable in fixup_irqs */
342 local_irq_enable();
343#endif 318#endif
319 migrate_irqs();
344 return 0; 320 return 0;
345} 321}
346 322
@@ -362,37 +338,89 @@ void generic_mach_cpu_die(void)
362 unsigned int cpu; 338 unsigned int cpu;
363 339
364 local_irq_disable(); 340 local_irq_disable();
341 idle_task_exit();
365 cpu = smp_processor_id(); 342 cpu = smp_processor_id();
366 printk(KERN_DEBUG "CPU%d offline\n", cpu); 343 printk(KERN_DEBUG "CPU%d offline\n", cpu);
367 __get_cpu_var(cpu_state) = CPU_DEAD; 344 __get_cpu_var(cpu_state) = CPU_DEAD;
368 smp_wmb(); 345 smp_wmb();
369 while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE) 346 while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
370 cpu_relax(); 347 cpu_relax();
371 set_cpu_online(cpu, true); 348}
372 local_irq_enable(); 349
350void generic_set_cpu_dead(unsigned int cpu)
351{
352 per_cpu(cpu_state, cpu) = CPU_DEAD;
373} 353}
374#endif 354#endif
375 355
376static int __devinit cpu_enable(unsigned int cpu) 356struct create_idle {
357 struct work_struct work;
358 struct task_struct *idle;
359 struct completion done;
360 int cpu;
361};
362
363static void __cpuinit do_fork_idle(struct work_struct *work)
377{ 364{
378 if (smp_ops && smp_ops->cpu_enable) 365 struct create_idle *c_idle =
379 return smp_ops->cpu_enable(cpu); 366 container_of(work, struct create_idle, work);
367
368 c_idle->idle = fork_idle(c_idle->cpu);
369 complete(&c_idle->done);
370}
371
372static int __cpuinit create_idle(unsigned int cpu)
373{
374 struct thread_info *ti;
375 struct create_idle c_idle = {
376 .cpu = cpu,
377 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
378 };
379 INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle);
380
381 c_idle.idle = get_idle_for_cpu(cpu);
382
383 /* We can't use kernel_thread since we must avoid to
384 * reschedule the child. We use a workqueue because
385 * we want to fork from a kernel thread, not whatever
386 * userspace process happens to be trying to online us.
387 */
388 if (!c_idle.idle) {
389 schedule_work(&c_idle.work);
390 wait_for_completion(&c_idle.done);
391 } else
392 init_idle(c_idle.idle, cpu);
393 if (IS_ERR(c_idle.idle)) {
394 pr_err("Failed fork for CPU %u: %li", cpu, PTR_ERR(c_idle.idle));
395 return PTR_ERR(c_idle.idle);
396 }
397 ti = task_thread_info(c_idle.idle);
398
399#ifdef CONFIG_PPC64
400 paca[cpu].__current = c_idle.idle;
401 paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD;
402#endif
403 ti->cpu = cpu;
404 current_set[cpu] = ti;
380 405
381 return -ENOSYS; 406 return 0;
382} 407}
383 408
384int __cpuinit __cpu_up(unsigned int cpu) 409int __cpuinit __cpu_up(unsigned int cpu)
385{ 410{
386 int c; 411 int rc, c;
387 412
388 secondary_ti = current_set[cpu]; 413 secondary_ti = current_set[cpu];
389 if (!cpu_enable(cpu))
390 return 0;
391 414
392 if (smp_ops == NULL || 415 if (smp_ops == NULL ||
393 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) 416 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
394 return -EINVAL; 417 return -EINVAL;
395 418
419 /* Make sure we have an idle thread */
420 rc = create_idle(cpu);
421 if (rc)
422 return rc;
423
396 /* Make sure callin-map entry is 0 (can be leftover a CPU 424 /* Make sure callin-map entry is 0 (can be leftover a CPU
397 * hotplug 425 * hotplug
398 */ 426 */
@@ -502,7 +530,7 @@ static struct device_node *cpu_to_l2cache(int cpu)
502} 530}
503 531
504/* Activate a secondary processor. */ 532/* Activate a secondary processor. */
505int __devinit start_secondary(void *unused) 533void __devinit start_secondary(void *unused)
506{ 534{
507 unsigned int cpu = smp_processor_id(); 535 unsigned int cpu = smp_processor_id();
508 struct device_node *l2_cache; 536 struct device_node *l2_cache;
@@ -523,6 +551,10 @@ int __devinit start_secondary(void *unused)
523 551
524 secondary_cpu_time_init(); 552 secondary_cpu_time_init();
525 553
554#ifdef CONFIG_PPC64
555 if (system_state == SYSTEM_RUNNING)
556 vdso_data->processorCount++;
557#endif
526 ipi_call_lock(); 558 ipi_call_lock();
527 notify_cpu_starting(cpu); 559 notify_cpu_starting(cpu);
528 set_cpu_online(cpu, true); 560 set_cpu_online(cpu, true);
@@ -558,7 +590,8 @@ int __devinit start_secondary(void *unused)
558 local_irq_enable(); 590 local_irq_enable();
559 591
560 cpu_idle(); 592 cpu_idle();
561 return 0; 593
594 BUG();
562} 595}
563 596
564int setup_profiling_timer(unsigned int multiplier) 597int setup_profiling_timer(unsigned int multiplier)
@@ -585,7 +618,11 @@ void __init smp_cpus_done(unsigned int max_cpus)
585 618
586 free_cpumask_var(old_mask); 619 free_cpumask_var(old_mask);
587 620
621 if (smp_ops && smp_ops->bringup_done)
622 smp_ops->bringup_done();
623
588 dump_numa_cpu_topology(); 624 dump_numa_cpu_topology();
625
589} 626}
590 627
591int arch_sd_sibling_asym_packing(void) 628int arch_sd_sibling_asym_packing(void)
@@ -660,5 +697,9 @@ void cpu_die(void)
660{ 697{
661 if (ppc_md.cpu_die) 698 if (ppc_md.cpu_die)
662 ppc_md.cpu_die(); 699 ppc_md.cpu_die();
700
701 /* If we return, we re-enter start_secondary */
702 start_secondary_resume();
663} 703}
704
664#endif 705#endif
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index aa9269600ca2..375480c56eb9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -577,14 +577,21 @@ void timer_interrupt(struct pt_regs * regs)
577 struct clock_event_device *evt = &decrementer->event; 577 struct clock_event_device *evt = &decrementer->event;
578 u64 now; 578 u64 now;
579 579
580 /* Ensure a positive value is written to the decrementer, or else
581 * some CPUs will continue to take decrementer exceptions.
582 */
583 set_dec(DECREMENTER_MAX);
584
585 /* Some implementations of hotplug will get timer interrupts while
586 * offline, just ignore these
587 */
588 if (!cpu_online(smp_processor_id()))
589 return;
590
580 trace_timer_interrupt_entry(regs); 591 trace_timer_interrupt_entry(regs);
581 592
582 __get_cpu_var(irq_stat).timer_irqs++; 593 __get_cpu_var(irq_stat).timer_irqs++;
583 594
584 /* Ensure a positive value is written to the decrementer, or else
585 * some CPUs will continuue to take decrementer exceptions */
586 set_dec(DECREMENTER_MAX);
587
588#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC) 595#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
589 if (atomic_read(&ppc_n_lost_interrupts) != 0) 596 if (atomic_read(&ppc_n_lost_interrupts) != 0)
590 do_IRQ(regs); 597 do_IRQ(regs);
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index 33cf704e4e1b..af0892209417 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -431,7 +431,7 @@ virt_page_table_tlb_miss_fault:
431 * The thing is, we know that in normal circumstances, this is 431 * The thing is, we know that in normal circumstances, this is
432 * always called as a second level tlb miss for SW load or as a first 432 * always called as a second level tlb miss for SW load or as a first
433 * level TLB miss for HW load, so we should be able to peek at the 433 * level TLB miss for HW load, so we should be able to peek at the
434 * relevant informations in the first exception frame in the PACA. 434 * relevant information in the first exception frame in the PACA.
435 * 435 *
436 * However, we do need to double check that, because we may just hit 436 * However, we do need to double check that, because we may just hit
437 * a stray kernel pointer or a userland attack trying to hit those 437 * a stray kernel pointer or a userland attack trying to hit those
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 20576829eca5..f7b07720aa30 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -46,7 +46,7 @@ config PPC_OF_BOOT_TRAMPOLINE
46 help 46 help
47 Support from booting from Open Firmware or yaboot using an 47 Support from booting from Open Firmware or yaboot using an
48 Open Firmware client interface. This enables the kernel to 48 Open Firmware client interface. This enables the kernel to
49 communicate with open firmware to retrieve system informations 49 communicate with open firmware to retrieve system information
50 such as the device tree. 50 such as the device tree.
51 51
52 In case of doubt, say Y 52 In case of doubt, say Y
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index f0bc08f6c1f0..20468f49aec0 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -33,7 +33,6 @@ extern void pmac_setup_pci_dma(void);
33extern void pmac_check_ht_link(void); 33extern void pmac_check_ht_link(void);
34 34
35extern void pmac_setup_smp(void); 35extern void pmac_setup_smp(void);
36extern void pmac32_cpu_die(void);
37extern void low_cpu_die(void) __attribute__((noreturn)); 36extern void low_cpu_die(void) __attribute__((noreturn));
38 37
39extern int pmac_nvram_init(void); 38extern int pmac_nvram_init(void);
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index d5aceb7fb125..aa45281bd296 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -650,51 +650,6 @@ static int pmac_pci_probe_mode(struct pci_bus *bus)
650 return PCI_PROBE_NORMAL; 650 return PCI_PROBE_NORMAL;
651 return PCI_PROBE_DEVTREE; 651 return PCI_PROBE_DEVTREE;
652} 652}
653
654#ifdef CONFIG_HOTPLUG_CPU
655/* access per cpu vars from generic smp.c */
656DECLARE_PER_CPU(int, cpu_state);
657
658static void pmac64_cpu_die(void)
659{
660 /*
661 * turn off as much as possible, we'll be
662 * kicked out as this will only be invoked
663 * on core99 platforms for now ...
664 */
665
666 printk(KERN_INFO "CPU#%d offline\n", smp_processor_id());
667 __get_cpu_var(cpu_state) = CPU_DEAD;
668 smp_wmb();
669
670 /*
671 * during the path that leads here preemption is disabled,
672 * reenable it now so that when coming up preempt count is
673 * zero correctly
674 */
675 preempt_enable();
676
677 /*
678 * hard-disable interrupts for the non-NAP case, the NAP code
679 * needs to re-enable interrupts (but soft-disables them)
680 */
681 hard_irq_disable();
682
683 while (1) {
684 /* let's not take timer interrupts too often ... */
685 set_dec(0x7fffffff);
686
687 /* should always be true at this point */
688 if (cpu_has_feature(CPU_FTR_CAN_NAP))
689 power4_cpu_offline_powersave();
690 else {
691 HMT_low();
692 HMT_very_low();
693 }
694 }
695}
696#endif /* CONFIG_HOTPLUG_CPU */
697
698#endif /* CONFIG_PPC64 */ 653#endif /* CONFIG_PPC64 */
699 654
700define_machine(powermac) { 655define_machine(powermac) {
@@ -726,15 +681,4 @@ define_machine(powermac) {
726 .pcibios_after_init = pmac_pcibios_after_init, 681 .pcibios_after_init = pmac_pcibios_after_init,
727 .phys_mem_access_prot = pci_phys_mem_access_prot, 682 .phys_mem_access_prot = pci_phys_mem_access_prot,
728#endif 683#endif
729#ifdef CONFIG_HOTPLUG_CPU
730#ifdef CONFIG_PPC64
731 .cpu_die = pmac64_cpu_die,
732#endif
733#ifdef CONFIG_PPC32
734 .cpu_die = pmac32_cpu_die,
735#endif
736#endif
737#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32)
738 .cpu_die = generic_mach_cpu_die,
739#endif
740}; 684};
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index c95215f4f8b6..a830c5e80657 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -840,92 +840,149 @@ static void __devinit smp_core99_setup_cpu(int cpu_nr)
840 840
841 /* Setup openpic */ 841 /* Setup openpic */
842 mpic_setup_this_cpu(); 842 mpic_setup_this_cpu();
843}
843 844
844 if (cpu_nr == 0) { 845#ifdef CONFIG_HOTPLUG_CPU
845#ifdef CONFIG_PPC64 846static int smp_core99_cpu_notify(struct notifier_block *self,
846 extern void g5_phy_disable_cpu1(void); 847 unsigned long action, void *hcpu)
848{
849 int rc;
847 850
848 /* Close i2c bus if it was used for tb sync */ 851 switch(action) {
852 case CPU_UP_PREPARE:
853 case CPU_UP_PREPARE_FROZEN:
854 /* Open i2c bus if it was used for tb sync */
849 if (pmac_tb_clock_chip_host) { 855 if (pmac_tb_clock_chip_host) {
850 pmac_i2c_close(pmac_tb_clock_chip_host); 856 rc = pmac_i2c_open(pmac_tb_clock_chip_host, 1);
851 pmac_tb_clock_chip_host = NULL; 857 if (rc) {
858 pr_err("Failed to open i2c bus for time sync\n");
859 return notifier_from_errno(rc);
860 }
852 } 861 }
862 break;
863 case CPU_ONLINE:
864 case CPU_UP_CANCELED:
865 /* Close i2c bus if it was used for tb sync */
866 if (pmac_tb_clock_chip_host)
867 pmac_i2c_close(pmac_tb_clock_chip_host);
868 break;
869 default:
870 break;
871 }
872 return NOTIFY_OK;
873}
853 874
854 /* If we didn't start the second CPU, we must take 875static struct notifier_block __cpuinitdata smp_core99_cpu_nb = {
855 * it off the bus 876 .notifier_call = smp_core99_cpu_notify,
856 */ 877};
857 if (of_machine_is_compatible("MacRISC4") && 878#endif /* CONFIG_HOTPLUG_CPU */
858 num_online_cpus() < 2) 879
859 g5_phy_disable_cpu1(); 880static void __init smp_core99_bringup_done(void)
860#endif /* CONFIG_PPC64 */ 881{
882#ifdef CONFIG_PPC64
883 extern void g5_phy_disable_cpu1(void);
884
885 /* Close i2c bus if it was used for tb sync */
886 if (pmac_tb_clock_chip_host)
887 pmac_i2c_close(pmac_tb_clock_chip_host);
861 888
862 if (ppc_md.progress) 889 /* If we didn't start the second CPU, we must take
863 ppc_md.progress("core99_setup_cpu 0 done", 0x349); 890 * it off the bus.
891 */
892 if (of_machine_is_compatible("MacRISC4") &&
893 num_online_cpus() < 2) {
894 set_cpu_present(1, false);
895 g5_phy_disable_cpu1();
864 } 896 }
865} 897#endif /* CONFIG_PPC64 */
866 898
899#ifdef CONFIG_HOTPLUG_CPU
900 register_cpu_notifier(&smp_core99_cpu_nb);
901#endif
902 if (ppc_md.progress)
903 ppc_md.progress("smp_core99_bringup_done", 0x349);
904}
867 905
868#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC32) 906#ifdef CONFIG_HOTPLUG_CPU
869 907
870int smp_core99_cpu_disable(void) 908static int smp_core99_cpu_disable(void)
871{ 909{
872 set_cpu_online(smp_processor_id(), false); 910 int rc = generic_cpu_disable();
911 if (rc)
912 return rc;
873 913
874 /* XXX reset cpu affinity here */
875 mpic_cpu_set_priority(0xf); 914 mpic_cpu_set_priority(0xf);
876 asm volatile("mtdec %0" : : "r" (0x7fffffff)); 915
877 mb();
878 udelay(20);
879 asm volatile("mtdec %0" : : "r" (0x7fffffff));
880 return 0; 916 return 0;
881} 917}
882 918
883static int cpu_dead[NR_CPUS]; 919#ifdef CONFIG_PPC32
884 920
885void pmac32_cpu_die(void) 921static void pmac_cpu_die(void)
886{ 922{
923 int cpu = smp_processor_id();
924
887 local_irq_disable(); 925 local_irq_disable();
888 cpu_dead[smp_processor_id()] = 1; 926 idle_task_exit();
927 pr_debug("CPU%d offline\n", cpu);
928 generic_set_cpu_dead(cpu);
929 smp_wmb();
889 mb(); 930 mb();
890 low_cpu_die(); 931 low_cpu_die();
891} 932}
892 933
893void smp_core99_cpu_die(unsigned int cpu) 934#else /* CONFIG_PPC32 */
935
936static void pmac_cpu_die(void)
894{ 937{
895 int timeout; 938 int cpu = smp_processor_id();
896 939
897 timeout = 1000; 940 local_irq_disable();
898 while (!cpu_dead[cpu]) { 941 idle_task_exit();
899 if (--timeout == 0) { 942
900 printk("CPU %u refused to die!\n", cpu); 943 /*
901 break; 944 * turn off as much as possible, we'll be
902 } 945 * kicked out as this will only be invoked
903 msleep(1); 946 * on core99 platforms for now ...
947 */
948
949 printk(KERN_INFO "CPU#%d offline\n", cpu);
950 generic_set_cpu_dead(cpu);
951 smp_wmb();
952
953 /*
954 * Re-enable interrupts. The NAP code needs to enable them
955 * anyways, do it now so we deal with the case where one already
956 * happened while soft-disabled.
957 * We shouldn't get any external interrupts, only decrementer, and the
958 * decrementer handler is safe for use on offline CPUs
959 */
960 local_irq_enable();
961
962 while (1) {
963 /* let's not take timer interrupts too often ... */
964 set_dec(0x7fffffff);
965
966 /* Enter NAP mode */
967 power4_idle();
904 } 968 }
905 cpu_dead[cpu] = 0;
906} 969}
907 970
908#endif /* CONFIG_HOTPLUG_CPU && CONFIG_PP32 */ 971#endif /* else CONFIG_PPC32 */
972#endif /* CONFIG_HOTPLUG_CPU */
909 973
910/* Core99 Macs (dual G4s and G5s) */ 974/* Core99 Macs (dual G4s and G5s) */
911struct smp_ops_t core99_smp_ops = { 975struct smp_ops_t core99_smp_ops = {
912 .message_pass = smp_mpic_message_pass, 976 .message_pass = smp_mpic_message_pass,
913 .probe = smp_core99_probe, 977 .probe = smp_core99_probe,
978 .bringup_done = smp_core99_bringup_done,
914 .kick_cpu = smp_core99_kick_cpu, 979 .kick_cpu = smp_core99_kick_cpu,
915 .setup_cpu = smp_core99_setup_cpu, 980 .setup_cpu = smp_core99_setup_cpu,
916 .give_timebase = smp_core99_give_timebase, 981 .give_timebase = smp_core99_give_timebase,
917 .take_timebase = smp_core99_take_timebase, 982 .take_timebase = smp_core99_take_timebase,
918#if defined(CONFIG_HOTPLUG_CPU) 983#if defined(CONFIG_HOTPLUG_CPU)
919# if defined(CONFIG_PPC32)
920 .cpu_disable = smp_core99_cpu_disable, 984 .cpu_disable = smp_core99_cpu_disable,
921 .cpu_die = smp_core99_cpu_die,
922# endif
923# if defined(CONFIG_PPC64)
924 .cpu_disable = generic_cpu_disable,
925 .cpu_die = generic_cpu_die, 985 .cpu_die = generic_cpu_die,
926 /* intentionally do *NOT* assign cpu_enable,
927 * the generic code will use kick_cpu then! */
928# endif
929#endif 986#endif
930}; 987};
931 988
@@ -957,5 +1014,10 @@ void __init pmac_setup_smp(void)
957 smp_ops = &psurge_smp_ops; 1014 smp_ops = &psurge_smp_ops;
958 } 1015 }
959#endif /* CONFIG_PPC32 */ 1016#endif /* CONFIG_PPC32 */
1017
1018#ifdef CONFIG_HOTPLUG_CPU
1019 ppc_md.cpu_die = pmac_cpu_die;
1020#endif
960} 1021}
961 1022
1023
diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h
index 75a6f480d931..08672d9136ab 100644
--- a/arch/powerpc/platforms/pseries/offline_states.h
+++ b/arch/powerpc/platforms/pseries/offline_states.h
@@ -34,6 +34,4 @@ static inline void set_default_offline_state(int cpu)
34#endif 34#endif
35 35
36extern enum cpu_state_vals get_preferred_offline_state(int cpu); 36extern enum cpu_state_vals get_preferred_offline_state(int cpu);
37extern int start_secondary(void);
38extern void start_secondary_resume(void);
39#endif 37#endif
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index c319d04aa799..000724149089 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -378,7 +378,7 @@ static int __init pSeries_init_panel(void)
378 378
379 return 0; 379 return 0;
380} 380}
381arch_initcall(pSeries_init_panel); 381machine_arch_initcall(pseries, pSeries_init_panel);
382 382
383static int pseries_set_dabr(unsigned long dabr) 383static int pseries_set_dabr(unsigned long dabr)
384{ 384{
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index d6479f9738f0..a509c5292a67 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -112,10 +112,10 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
112 112
113 /* Fixup atomic count: it exited inside IRQ handler. */ 113 /* Fixup atomic count: it exited inside IRQ handler. */
114 task_thread_info(paca[lcpu].__current)->preempt_count = 0; 114 task_thread_info(paca[lcpu].__current)->preempt_count = 0;
115 115#ifdef CONFIG_HOTPLUG_CPU
116 if (get_cpu_current_state(lcpu) == CPU_STATE_INACTIVE) 116 if (get_cpu_current_state(lcpu) == CPU_STATE_INACTIVE)
117 goto out; 117 goto out;
118 118#endif
119 /* 119 /*
120 * If the RTAS start-cpu token does not exist then presume the 120 * If the RTAS start-cpu token does not exist then presume the
121 * cpu is already spinning. 121 * cpu is already spinning.
@@ -130,7 +130,9 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
130 return 0; 130 return 0;
131 } 131 }
132 132
133#ifdef CONFIG_HOTPLUG_CPU
133out: 134out:
135#endif
134 return 1; 136 return 1;
135} 137}
136 138
@@ -144,16 +146,15 @@ static void __devinit smp_xics_setup_cpu(int cpu)
144 vpa_init(cpu); 146 vpa_init(cpu);
145 147
146 cpumask_clear_cpu(cpu, of_spin_mask); 148 cpumask_clear_cpu(cpu, of_spin_mask);
149#ifdef CONFIG_HOTPLUG_CPU
147 set_cpu_current_state(cpu, CPU_STATE_ONLINE); 150 set_cpu_current_state(cpu, CPU_STATE_ONLINE);
148 set_default_offline_state(cpu); 151 set_default_offline_state(cpu);
149 152#endif
150} 153}
151#endif /* CONFIG_XICS */ 154#endif /* CONFIG_XICS */
152 155
153static void __devinit smp_pSeries_kick_cpu(int nr) 156static void __devinit smp_pSeries_kick_cpu(int nr)
154{ 157{
155 long rc;
156 unsigned long hcpuid;
157 BUG_ON(nr < 0 || nr >= NR_CPUS); 158 BUG_ON(nr < 0 || nr >= NR_CPUS);
158 159
159 if (!smp_startup_cpu(nr)) 160 if (!smp_startup_cpu(nr))
@@ -165,16 +166,20 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
165 * the processor will continue on to secondary_start 166 * the processor will continue on to secondary_start
166 */ 167 */
167 paca[nr].cpu_start = 1; 168 paca[nr].cpu_start = 1;
168 169#ifdef CONFIG_HOTPLUG_CPU
169 set_preferred_offline_state(nr, CPU_STATE_ONLINE); 170 set_preferred_offline_state(nr, CPU_STATE_ONLINE);
170 171
171 if (get_cpu_current_state(nr) == CPU_STATE_INACTIVE) { 172 if (get_cpu_current_state(nr) == CPU_STATE_INACTIVE) {
173 long rc;
174 unsigned long hcpuid;
175
172 hcpuid = get_hard_smp_processor_id(nr); 176 hcpuid = get_hard_smp_processor_id(nr);
173 rc = plpar_hcall_norets(H_PROD, hcpuid); 177 rc = plpar_hcall_norets(H_PROD, hcpuid);
174 if (rc != H_SUCCESS) 178 if (rc != H_SUCCESS)
175 printk(KERN_ERR "Error: Prod to wake up processor %d " 179 printk(KERN_ERR "Error: Prod to wake up processor %d "
176 "Ret= %ld\n", nr, rc); 180 "Ret= %ld\n", nr, rc);
177 } 181 }
182#endif
178} 183}
179 184
180static int smp_pSeries_cpu_bootable(unsigned int nr) 185static int smp_pSeries_cpu_bootable(unsigned int nr)
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index 2f475d7c0b53..9d897b6db983 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -403,8 +403,9 @@
403#define __NR_name_to_handle_at 332 403#define __NR_name_to_handle_at 332
404#define __NR_open_by_handle_at 333 404#define __NR_open_by_handle_at 333
405#define __NR_clock_adjtime 334 405#define __NR_clock_adjtime 334
406#define __NR_syncfs 335
406 407
407#define NR_syscalls 335 408#define NR_syscalls 336
408 409
409#ifdef __32bit_syscall_numbers__ 410#ifdef __32bit_syscall_numbers__
410/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants, 411/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 2abace076c7d..773091ac71a3 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -93,7 +93,7 @@ void auxio_set_lte(int on)
93} 93}
94EXPORT_SYMBOL(auxio_set_lte); 94EXPORT_SYMBOL(auxio_set_lte);
95 95
96static struct of_device_id __initdata auxio_match[] = { 96static const struct of_device_id auxio_match[] = {
97 { 97 {
98 .name = "auxio", 98 .name = "auxio",
99 }, 99 },
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 136d3718a74a..7eef3f741963 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -140,7 +140,7 @@ out_free:
140 goto out; 140 goto out;
141} 141}
142 142
143static struct of_device_id __initdata clock_board_match[] = { 143static const struct of_device_id clock_board_match[] = {
144 { 144 {
145 .name = "clock-board", 145 .name = "clock-board",
146 }, 146 },
@@ -245,7 +245,7 @@ out_free:
245 goto out; 245 goto out;
246} 246}
247 247
248static struct of_device_id __initdata fhc_match[] = { 248static const struct of_device_id fhc_match[] = {
249 { 249 {
250 .name = "fhc", 250 .name = "fhc",
251 }, 251 },
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 4a700f4b79ce..3add4de8a1a9 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -1218,7 +1218,7 @@ static int ds_remove(struct vio_dev *vdev)
1218 return 0; 1218 return 0;
1219} 1219}
1220 1220
1221static struct vio_device_id __initdata ds_match[] = { 1221static const struct vio_device_id ds_match[] = {
1222 { 1222 {
1223 .type = "domain-services-port", 1223 .type = "domain-services-port",
1224 }, 1224 },
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 8e607b3b0ed9..6da784a5612b 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1283,7 +1283,7 @@ linux_syscall_trace:
1283 .globl ret_from_fork 1283 .globl ret_from_fork
1284ret_from_fork: 1284ret_from_fork:
1285 call schedule_tail 1285 call schedule_tail
1286 mov %g3, %o0 1286 ld [%g3 + TI_TASK], %o0
1287 b ret_sys_call 1287 b ret_sys_call
1288 ld [%sp + STACKFRAME_SZ + PT_I0], %o0 1288 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
1289 1289
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 6addb914fcc8..56db06432ce9 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -107,7 +107,7 @@ static struct mdesc_handle * __init mdesc_memblock_alloc(unsigned int mdesc_size
107 return hp; 107 return hp;
108} 108}
109 109
110static void mdesc_memblock_free(struct mdesc_handle *hp) 110static void __init mdesc_memblock_free(struct mdesc_handle *hp)
111{ 111{
112 unsigned int alloc_size; 112 unsigned int alloc_size;
113 unsigned long start; 113 unsigned long start;
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 3d70f8326efd..d29a32fcc5e4 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -496,7 +496,7 @@ out_err:
496 return err; 496 return err;
497} 497}
498 498
499static struct of_device_id __initdata fire_match[] = { 499static const struct of_device_id fire_match[] = {
500 { 500 {
501 .name = "pci", 501 .name = "pci",
502 .compatible = "pciex108e,80f0", 502 .compatible = "pciex108e,80f0",
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 56ee745064de..86ae08d9b6ee 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -592,7 +592,7 @@ out_err:
592 return err; 592 return err;
593} 593}
594 594
595static struct of_device_id __initdata psycho_match[] = { 595static const struct of_device_id psycho_match[] = {
596 { 596 {
597 .name = "pci", 597 .name = "pci",
598 .compatible = "pci108e,8000", 598 .compatible = "pci108e,8000",
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 2857073342d2..948068a083fc 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -581,7 +581,7 @@ out_err:
581 return err; 581 return err;
582} 582}
583 583
584static struct of_device_id __initdata sabre_match[] = { 584static const struct of_device_id sabre_match[] = {
585 { 585 {
586 .name = "pci", 586 .name = "pci",
587 .compatible = "pci108e,a001", 587 .compatible = "pci108e,a001",
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 1d41af73a92f..fecfcb2063c8 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1470,7 +1470,7 @@ static int __devinit schizo_probe(struct platform_device *op)
1470 * and pci108e,8001. So list the chips in reverse chronological 1470 * and pci108e,8001. So list the chips in reverse chronological
1471 * order. 1471 * order.
1472 */ 1472 */
1473static struct of_device_id __initdata schizo_match[] = { 1473static const struct of_device_id schizo_match[] = {
1474 { 1474 {
1475 .name = "pci", 1475 .name = "pci",
1476 .compatible = "pci108e,a801", 1476 .compatible = "pci108e,a801",
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 6cf534681788..b01a06e9ae4e 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -998,7 +998,7 @@ out_err:
998 return err; 998 return err;
999} 999}
1000 1000
1001static struct of_device_id __initdata pci_sun4v_match[] = { 1001static const struct of_device_id pci_sun4v_match[] = {
1002 { 1002 {
1003 .name = "pci", 1003 .name = "pci",
1004 .compatible = "SUNW,sun4v-pci", 1004 .compatible = "SUNW,sun4v-pci",
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index cd725fe238b2..cb4c0f57c024 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -52,7 +52,7 @@ static int __devinit power_probe(struct platform_device *op)
52 return 0; 52 return 0;
53} 53}
54 54
55static struct of_device_id __initdata power_match[] = { 55static const struct of_device_id power_match[] = {
56 { 56 {
57 .name = "power", 57 .name = "power",
58 }, 58 },
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 4b86eaf04fe5..47ac73c32e88 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -84,4 +84,4 @@ sys_call_table:
84/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 84/*320*/ .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
87 87/*335*/ .long sys_syncfs
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 0331bafdf3a3..4f3170c1ef47 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -85,6 +85,7 @@ sys_call_table32:
85/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv 85/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv
86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init 86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
87/*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime 87/*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
88 .word sys_syncfs
88 89
89#endif /* CONFIG_COMPAT */ 90#endif /* CONFIG_COMPAT */
90 91
@@ -161,3 +162,4 @@ sys_call_table:
161/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv 162/*320*/ .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
162 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 163 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
163/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 164/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
165 .word sys_syncfs
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 95ec25faba39..2b8d54b2d850 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -442,7 +442,7 @@ static int __devinit rtc_probe(struct platform_device *op)
442 return platform_device_register(&rtc_cmos_device); 442 return platform_device_register(&rtc_cmos_device);
443} 443}
444 444
445static struct of_device_id __initdata rtc_match[] = { 445static const struct of_device_id rtc_match[] = {
446 { 446 {
447 .name = "rtc", 447 .name = "rtc",
448 .compatible = "m5819", 448 .compatible = "m5819",
@@ -487,7 +487,7 @@ static int __devinit bq4802_probe(struct platform_device *op)
487 return platform_device_register(&rtc_bq4802_device); 487 return platform_device_register(&rtc_bq4802_device);
488} 488}
489 489
490static struct of_device_id __initdata bq4802_match[] = { 490static const struct of_device_id bq4802_match[] = {
491 { 491 {
492 .name = "rtc", 492 .name = "rtc",
493 .compatible = "bq4802", 493 .compatible = "bq4802",
@@ -552,7 +552,7 @@ static int __devinit mostek_probe(struct platform_device *op)
552 return platform_device_register(&m48t59_rtc); 552 return platform_device_register(&m48t59_rtc);
553} 553}
554 554
555static struct of_device_id __initdata mostek_match[] = { 555static const struct of_device_id mostek_match[] = {
556 { 556 {
557 .name = "eeprom", 557 .name = "eeprom",
558 }, 558 },
diff --git a/arch/unicore32/Makefile b/arch/unicore32/Makefile
index e08d6d370a8a..76a8beec7d03 100644
--- a/arch/unicore32/Makefile
+++ b/arch/unicore32/Makefile
@@ -48,7 +48,7 @@ ASM_GENERIC_HEADERS += bitsperlong.h bug.h bugs.h
48ASM_GENERIC_HEADERS += cputime.h current.h 48ASM_GENERIC_HEADERS += cputime.h current.h
49ASM_GENERIC_HEADERS += device.h div64.h 49ASM_GENERIC_HEADERS += device.h div64.h
50ASM_GENERIC_HEADERS += emergency-restart.h errno.h 50ASM_GENERIC_HEADERS += emergency-restart.h errno.h
51ASM_GENERIC_HEADERS += fb.h fcntl.h ftrace.h 51ASM_GENERIC_HEADERS += fb.h fcntl.h ftrace.h futex.h
52ASM_GENERIC_HEADERS += hardirq.h hw_irq.h 52ASM_GENERIC_HEADERS += hardirq.h hw_irq.h
53ASM_GENERIC_HEADERS += ioctl.h ioctls.h ipcbuf.h irq_regs.h 53ASM_GENERIC_HEADERS += ioctl.h ioctls.h ipcbuf.h irq_regs.h
54ASM_GENERIC_HEADERS += kdebug.h kmap_types.h 54ASM_GENERIC_HEADERS += kdebug.h kmap_types.h
diff --git a/arch/unicore32/include/asm/futex.h b/arch/unicore32/include/asm/futex.h
deleted file mode 100644
index 07dea6170558..000000000000
--- a/arch/unicore32/include/asm/futex.h
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * linux/arch/unicore32/include/asm/futex.h
3 *
4 * Code specific to PKUnity SoC and UniCore ISA
5 *
6 * Copyright (C) 2001-2010 GUAN Xue-tao
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __UNICORE_FUTEX_H__
14#define __UNICORE_FUTEX_H__
15
16#ifdef __KERNEL__
17
18#include <linux/futex.h>
19#include <linux/preempt.h>
20#include <linux/uaccess.h>
21#include <linux/errno.h>
22
23#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
24 __asm__ __volatile__( \
25 "1: ldw.u %1, [%2]\n" \
26 " " insn "\n" \
27 "2: stw.u %0, [%2]\n" \
28 " mov %0, #0\n" \
29 "3:\n" \
30 " .pushsection __ex_table,\"a\"\n" \
31 " .align 3\n" \
32 " .long 1b, 4f, 2b, 4f\n" \
33 " .popsection\n" \
34 " .pushsection .fixup,\"ax\"\n" \
35 "4: mov %0, %4\n" \
36 " b 3b\n" \
37 " .popsection" \
38 : "=&r" (ret), "=&r" (oldval) \
39 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \
40 : "cc", "memory")
41
42static inline int
43futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
44{
45 int op = (encoded_op >> 28) & 7;
46 int cmp = (encoded_op >> 24) & 15;
47 int oparg = (encoded_op << 8) >> 20;
48 int cmparg = (encoded_op << 20) >> 20;
49 int oldval = 0, ret;
50
51 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
52 oparg = 1 << oparg;
53
54 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
55 return -EFAULT;
56
57 pagefault_disable(); /* implies preempt_disable() */
58
59 switch (op) {
60 case FUTEX_OP_SET:
61 __futex_atomic_op("mov %0, %3", ret, oldval, uaddr, oparg);
62 break;
63 case FUTEX_OP_ADD:
64 __futex_atomic_op("add %0, %1, %3", ret, oldval, uaddr, oparg);
65 break;
66 case FUTEX_OP_OR:
67 __futex_atomic_op("or %0, %1, %3", ret, oldval, uaddr, oparg);
68 break;
69 case FUTEX_OP_ANDN:
70 __futex_atomic_op("and %0, %1, %3",
71 ret, oldval, uaddr, ~oparg);
72 break;
73 case FUTEX_OP_XOR:
74 __futex_atomic_op("xor %0, %1, %3", ret, oldval, uaddr, oparg);
75 break;
76 default:
77 ret = -ENOSYS;
78 }
79
80 pagefault_enable(); /* subsumes preempt_enable() */
81
82 if (!ret) {
83 switch (cmp) {
84 case FUTEX_OP_CMP_EQ:
85 ret = (oldval == cmparg);
86 break;
87 case FUTEX_OP_CMP_NE:
88 ret = (oldval != cmparg);
89 break;
90 case FUTEX_OP_CMP_LT:
91 ret = (oldval < cmparg);
92 break;
93 case FUTEX_OP_CMP_GE:
94 ret = (oldval >= cmparg);
95 break;
96 case FUTEX_OP_CMP_LE:
97 ret = (oldval <= cmparg);
98 break;
99 case FUTEX_OP_CMP_GT:
100 ret = (oldval > cmparg);
101 break;
102 default:
103 ret = -ENOSYS;
104 }
105 }
106 return ret;
107}
108
109static inline int
110futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
111{
112 int val;
113
114 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
115 return -EFAULT;
116
117 pagefault_disable(); /* implies preempt_disable() */
118
119 __asm__ __volatile__("@futex_atomic_cmpxchg_inatomic\n"
120 "1: ldw.u %0, [%3]\n"
121 " cmpxor.a %0, %1\n"
122 " bne 3f\n"
123 "2: stw.u %2, [%3]\n"
124 "3:\n"
125 " .pushsection __ex_table,\"a\"\n"
126 " .align 3\n"
127 " .long 1b, 4f, 2b, 4f\n"
128 " .popsection\n"
129 " .pushsection .fixup,\"ax\"\n"
130 "4: mov %0, %4\n"
131 " b 3b\n"
132 " .popsection"
133 : "=&r" (val)
134 : "r" (oldval), "r" (newval), "r" (uaddr), "Ir" (-EFAULT)
135 : "cc", "memory");
136
137 pagefault_enable(); /* subsumes preempt_enable() */
138
139 return val;
140}
141
142#endif /* __KERNEL__ */
143#endif /* __UNICORE_FUTEX_H__ */
diff --git a/arch/unicore32/include/mach/PKUnity.h b/arch/unicore32/include/mach/PKUnity.h
index a18bdc3810e6..8040d575dddb 100644
--- a/arch/unicore32/include/mach/PKUnity.h
+++ b/arch/unicore32/include/mach/PKUnity.h
@@ -24,16 +24,6 @@
24#define PKUNITY_MMIO_BASE 0x80000000 /* 0x80000000 - 0xFFFFFFFF 2GB */ 24#define PKUNITY_MMIO_BASE 0x80000000 /* 0x80000000 - 0xFFFFFFFF 2GB */
25 25
26/* 26/*
27 * PKUNITY Memory Map Addresses: 0x0D000000 - 0x0EFFFFFF (32MB)
28 * 0x0D000000 - 0x0DFFFFFF 16MB: for UVC
29 * 0x0E000000 - 0x0EFFFFFF 16MB: for UNIGFX
30 */
31#define PKUNITY_UVC_MMAP_BASE 0x0D000000
32#define PKUNITY_UVC_MMAP_SIZE 0x01000000 /* 16MB */
33#define PKUNITY_UNIGFX_MMAP_BASE 0x0E000000
34#define PKUNITY_UNIGFX_MMAP_SIZE 0x01000000 /* 16MB */
35
36/*
37 * PKUNITY System Bus Addresses (PCI): 0x80000000 - 0xBFFFFFFF (1GB) 27 * PKUNITY System Bus Addresses (PCI): 0x80000000 - 0xBFFFFFFF (1GB)
38 * 0x80000000 - 0x8000000B 12B PCI Configuration regs 28 * 0x80000000 - 0x8000000B 12B PCI Configuration regs
39 * 0x80010000 - 0x80010250 592B PCI Bridge Base 29 * 0x80010000 - 0x80010250 592B PCI Bridge Base
diff --git a/arch/unicore32/include/mach/memory.h b/arch/unicore32/include/mach/memory.h
index 0bf21c944710..4be72c21d491 100644
--- a/arch/unicore32/include/mach/memory.h
+++ b/arch/unicore32/include/mach/memory.h
@@ -50,7 +50,6 @@ void puv3_pci_adjust_zones(unsigned long *size, unsigned long *holes);
50 50
51/* kuser area */ 51/* kuser area */
52#define KUSER_VECPAGE_BASE (KUSER_BASE + UL(0x3fff0000)) 52#define KUSER_VECPAGE_BASE (KUSER_BASE + UL(0x3fff0000))
53#define KUSER_UNIGFX_BASE (PAGE_OFFSET + PKUNITY_UNIGFX_MMAP_BASE)
54/* kuser_vecpage (0xbfff0000) is ro, and vectors page (0xffff0000) is rw */ 53/* kuser_vecpage (0xbfff0000) is ro, and vectors page (0xffff0000) is rw */
55#define kuser_vecpage_to_vectors(x) ((x) - (KUSER_VECPAGE_BASE) \ 54#define kuser_vecpage_to_vectors(x) ((x) - (KUSER_VECPAGE_BASE) \
56 + (VECTORS_BASE)) 55 + (VECTORS_BASE))
diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c
index 8b1b6beb858e..1a505a787765 100644
--- a/arch/unicore32/kernel/puv3-core.c
+++ b/arch/unicore32/kernel/puv3-core.c
@@ -99,11 +99,6 @@ static struct resource puv3_unigfx_resources[] = {
99 .end = io_v2p(PKUNITY_UNIGFX_BASE) + 0xfff, 99 .end = io_v2p(PKUNITY_UNIGFX_BASE) + 0xfff,
100 .flags = IORESOURCE_MEM, 100 .flags = IORESOURCE_MEM,
101 }, 101 },
102 [1] = {
103 .start = PKUNITY_UNIGFX_MMAP_BASE,
104 .end = PKUNITY_UNIGFX_MMAP_BASE + PKUNITY_UNIGFX_MMAP_SIZE,
105 .flags = IORESOURCE_MEM,
106 },
107}; 102};
108 103
109static struct resource puv3_rtc_resources[] = { 104static struct resource puv3_rtc_resources[] = {
diff --git a/arch/unicore32/kernel/rtc.c b/arch/unicore32/kernel/rtc.c
index c5f068295b51..8cad70b3302c 100644
--- a/arch/unicore32/kernel/rtc.c
+++ b/arch/unicore32/kernel/rtc.c
@@ -88,11 +88,6 @@ static int puv3_rtc_setpie(struct device *dev, int enabled)
88 return 0; 88 return 0;
89} 89}
90 90
91static int puv3_rtc_setfreq(struct device *dev, int freq)
92{
93 return 0;
94}
95
96/* Time read/write */ 91/* Time read/write */
97 92
98static int puv3_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) 93static int puv3_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
@@ -214,8 +209,6 @@ static const struct rtc_class_ops puv3_rtcops = {
214 .set_time = puv3_rtc_settime, 209 .set_time = puv3_rtc_settime,
215 .read_alarm = puv3_rtc_getalarm, 210 .read_alarm = puv3_rtc_getalarm,
216 .set_alarm = puv3_rtc_setalarm, 211 .set_alarm = puv3_rtc_setalarm,
217 .irq_set_freq = puv3_rtc_setfreq,
218 .irq_set_state = puv3_rtc_setpie,
219 .proc = puv3_rtc_proc, 212 .proc = puv3_rtc_proc,
220}; 213};
221 214
@@ -294,8 +287,6 @@ static int puv3_rtc_probe(struct platform_device *pdev)
294 287
295 puv3_rtc_enable(pdev, 1); 288 puv3_rtc_enable(pdev, 1);
296 289
297 puv3_rtc_setfreq(&pdev->dev, 1);
298
299 /* register RTC and exit */ 290 /* register RTC and exit */
300 291
301 rtc = rtc_device_register("pkunity", &pdev->dev, &puv3_rtcops, 292 rtc = rtc_device_register("pkunity", &pdev->dev, &puv3_rtcops,
diff --git a/arch/unicore32/kernel/setup.c b/arch/unicore32/kernel/setup.c
index 1e175a82844d..471b6bca8da4 100644
--- a/arch/unicore32/kernel/setup.c
+++ b/arch/unicore32/kernel/setup.c
@@ -64,12 +64,6 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
64 */ 64 */
65static struct resource mem_res[] = { 65static struct resource mem_res[] = {
66 { 66 {
67 .name = "Video RAM",
68 .start = 0,
69 .end = 0,
70 .flags = IORESOURCE_MEM
71 },
72 {
73 .name = "Kernel text", 67 .name = "Kernel text",
74 .start = 0, 68 .start = 0,
75 .end = 0, 69 .end = 0,
@@ -83,9 +77,8 @@ static struct resource mem_res[] = {
83 } 77 }
84}; 78};
85 79
86#define video_ram mem_res[0] 80#define kernel_code mem_res[0]
87#define kernel_code mem_res[1] 81#define kernel_data mem_res[1]
88#define kernel_data mem_res[2]
89 82
90/* 83/*
91 * These functions re-use the assembly code in head.S, which 84 * These functions re-use the assembly code in head.S, which
@@ -224,10 +217,6 @@ request_standard_resources(struct meminfo *mi)
224 kernel_data.end <= res->end) 217 kernel_data.end <= res->end)
225 request_resource(res, &kernel_data); 218 request_resource(res, &kernel_data);
226 } 219 }
227
228 video_ram.start = PKUNITY_UNIGFX_MMAP_BASE;
229 video_ram.end = PKUNITY_UNIGFX_MMAP_BASE + PKUNITY_UNIGFX_MMAP_SIZE;
230 request_resource(&iomem_resource, &video_ram);
231} 220}
232 221
233static void (*init_machine)(void) __initdata; 222static void (*init_machine)(void) __initdata;
diff --git a/arch/unicore32/kernel/traps.c b/arch/unicore32/kernel/traps.c
index 25abbb101729..254e36fa9513 100644
--- a/arch/unicore32/kernel/traps.c
+++ b/arch/unicore32/kernel/traps.c
@@ -22,7 +22,6 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/hardirq.h> 23#include <linux/hardirq.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/uaccess.h>
26#include <linux/atomic.h> 25#include <linux/atomic.h>
27#include <linux/unistd.h> 26#include <linux/unistd.h>
28 27
diff --git a/arch/unicore32/kernel/vmlinux.lds.S b/arch/unicore32/kernel/vmlinux.lds.S
index 0b4eb89729e7..9bf7f7af52c5 100644
--- a/arch/unicore32/kernel/vmlinux.lds.S
+++ b/arch/unicore32/kernel/vmlinux.lds.S
@@ -14,6 +14,7 @@
14#include <asm/thread_info.h> 14#include <asm/thread_info.h>
15#include <asm/memory.h> 15#include <asm/memory.h>
16#include <asm/page.h> 16#include <asm/page.h>
17#include <asm/cache.h>
17 18
18OUTPUT_ARCH(unicore32) 19OUTPUT_ARCH(unicore32)
19ENTRY(stext) 20ENTRY(stext)
@@ -29,7 +30,7 @@ SECTIONS
29 HEAD_TEXT_SECTION 30 HEAD_TEXT_SECTION
30 INIT_TEXT_SECTION(PAGE_SIZE) 31 INIT_TEXT_SECTION(PAGE_SIZE)
31 INIT_DATA_SECTION(16) 32 INIT_DATA_SECTION(16)
32 PERCPU(PAGE_SIZE) 33 PERCPU(L1_CACHE_BYTES, PAGE_SIZE)
33 __init_end = .; 34 __init_end = .;
34 35
35 _stext = .; 36 _stext = .;
@@ -45,10 +46,10 @@ SECTIONS
45 46
46 _sdata = .; 47 _sdata = .;
47 RO_DATA_SECTION(PAGE_SIZE) 48 RO_DATA_SECTION(PAGE_SIZE)
48 RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) 49 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
49 _edata = .; 50 _edata = .;
50 51
51 EXCEPTION_TABLE(32) 52 EXCEPTION_TABLE(L1_CACHE_BYTES)
52 NOTES 53 NOTES
53 54
54 BSS_SECTION(0, 0, 0) 55 BSS_SECTION(0, 0, 0)
diff --git a/arch/unicore32/mm/mmu.c b/arch/unicore32/mm/mmu.c
index 7bf3d588631f..db2d334941b4 100644
--- a/arch/unicore32/mm/mmu.c
+++ b/arch/unicore32/mm/mmu.c
@@ -338,15 +338,6 @@ void __init uc32_mm_memblock_reserve(void)
338 * and can only be in node 0. 338 * and can only be in node 0.
339 */ 339 */
340 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t)); 340 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
341
342#ifdef CONFIG_PUV3_UNIGFX
343 /*
344 * These should likewise go elsewhere. They pre-reserve the
345 * screen/video memory region at the 48M~64M of main system memory.
346 */
347 memblock_reserve(PKUNITY_UNIGFX_MMAP_BASE, PKUNITY_UNIGFX_MMAP_SIZE);
348 memblock_reserve(PKUNITY_UVC_MMAP_BASE, PKUNITY_UVC_MMAP_SIZE);
349#endif
350} 341}
351 342
352/* 343/*
@@ -371,17 +362,6 @@ static void __init devicemaps_init(void)
371 pmd_clear(pmd_off_k(addr)); 362 pmd_clear(pmd_off_k(addr));
372 363
373 /* 364 /*
374 * Create a mapping for UniGFX VRAM
375 */
376#ifdef CONFIG_PUV3_UNIGFX
377 map.pfn = __phys_to_pfn(PKUNITY_UNIGFX_MMAP_BASE);
378 map.virtual = KUSER_UNIGFX_BASE;
379 map.length = PKUNITY_UNIGFX_MMAP_SIZE;
380 map.type = MT_KUSER;
381 create_mapping(&map);
382#endif
383
384 /*
385 * Create a mapping for the machine vectors at the high-vectors 365 * Create a mapping for the machine vectors at the high-vectors
386 * location (0xffff0000). If we aren't using high-vectors, also 366 * location (0xffff0000). If we aren't using high-vectors, also
387 * create a mapping at the low-vectors virtual address. 367 * create a mapping at the low-vectors virtual address.
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index a279d98ea95e..2b7d573be549 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -2,7 +2,6 @@
2#define _ASM_X86_APIC_H 2#define _ASM_X86_APIC_H
3 3
4#include <linux/cpumask.h> 4#include <linux/cpumask.h>
5#include <linux/delay.h>
6#include <linux/pm.h> 5#include <linux/pm.h>
7 6
8#include <asm/alternative.h> 7#include <asm/alternative.h>
diff --git a/arch/x86/include/asm/dma.h b/arch/x86/include/asm/dma.h
index 97b6d8114a43..057099e5faba 100644
--- a/arch/x86/include/asm/dma.h
+++ b/arch/x86/include/asm/dma.h
@@ -10,7 +10,6 @@
10 10
11#include <linux/spinlock.h> /* And spinlocks */ 11#include <linux/spinlock.h> /* And spinlocks */
12#include <asm/io.h> /* need byte IO */ 12#include <asm/io.h> /* need byte IO */
13#include <linux/delay.h>
14 13
15#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER 14#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
16#define dma_outb outb_p 15#define dma_outb outb_p
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index 6801959a8b2a..4c39baa8facc 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -21,7 +21,7 @@ const struct pci_device_id amd_nb_misc_ids[] = {
21EXPORT_SYMBOL(amd_nb_misc_ids); 21EXPORT_SYMBOL(amd_nb_misc_ids);
22 22
23static struct pci_device_id amd_nb_link_ids[] = { 23static struct pci_device_id amd_nb_link_ids[] = {
24 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_LINK) }, 24 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
25 {} 25 {}
26}; 26};
27 27
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index c4e557a1ebb6..5260fe91bcb6 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -16,6 +16,7 @@
16#include <linux/kprobes.h> 16#include <linux/kprobes.h>
17#include <linux/nmi.h> 17#include <linux/nmi.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/delay.h>
19 20
20#ifdef CONFIG_HARDLOCKUP_DETECTOR 21#ifdef CONFIG_HARDLOCKUP_DETECTOR
21u64 hw_nmi_get_sample_period(void) 22u64 hw_nmi_get_sample_period(void)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 3c289281394c..33b10a0fc095 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -23,6 +23,8 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/kdebug.h> 25#include <linux/kdebug.h>
26#include <linux/delay.h>
27#include <linux/crash_dump.h>
26 28
27#include <asm/uv/uv_mmrs.h> 29#include <asm/uv/uv_mmrs.h>
28#include <asm/uv/uv_hub.h> 30#include <asm/uv/uv_hub.h>
@@ -34,6 +36,7 @@
34#include <asm/ipi.h> 36#include <asm/ipi.h>
35#include <asm/smp.h> 37#include <asm/smp.h>
36#include <asm/x86_init.h> 38#include <asm/x86_init.h>
39#include <asm/emergency-restart.h>
37 40
38DEFINE_PER_CPU(int, x2apic_extra_bits); 41DEFINE_PER_CPU(int, x2apic_extra_bits);
39 42
@@ -810,4 +813,11 @@ void __init uv_system_init(void)
810 813
811 /* register Legacy VGA I/O redirection handler */ 814 /* register Legacy VGA I/O redirection handler */
812 pci_register_set_vga_state(uv_set_vga_state); 815 pci_register_set_vga_state(uv_set_vga_state);
816
817 /*
818 * For a kdump kernel the reset must be BOOT_ACPI, not BOOT_EFI, as
819 * EFI is not enabled in the kdump kernel.
820 */
821 if (is_kdump_kernel())
822 reboot_type = BOOT_ACPI;
813} 823}
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5a05ef63eb4a..3385ea26f684 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1626,7 +1626,7 @@ out:
1626static unsigned int mce_poll(struct file *file, poll_table *wait) 1626static unsigned int mce_poll(struct file *file, poll_table *wait)
1627{ 1627{
1628 poll_wait(file, &mce_wait, wait); 1628 poll_wait(file, &mce_wait, wait);
1629 if (rcu_dereference_check_mce(mcelog.next)) 1629 if (rcu_access_index(mcelog.next))
1630 return POLLIN | POLLRDNORM; 1630 return POLLIN | POLLRDNORM;
1631 if (!mce_apei_read_done && apei_check_mce()) 1631 if (!mce_apei_read_done && apei_check_mce())
1632 return POLLIN | POLLRDNORM; 1632 return POLLIN | POLLRDNORM;
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 307dfbbf4a8e..929739a653d1 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -293,14 +293,24 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
293 293
294 /* 294 /*
295 * HACK! 295 * HACK!
296 * We use this same function to initialize the mtrrs on boot. 296 *
297 * The state of the boot cpu's mtrrs has been saved, and we want 297 * We use this same function to initialize the mtrrs during boot,
298 * to replicate across all the APs. 298 * resume, runtime cpu online and on an explicit request to set a
299 * If we're doing that @reg is set to something special... 299 * specific MTRR.
300 *
301 * During boot or suspend, the state of the boot cpu's mtrrs has been
302 * saved, and we want to replicate that across all the cpus that come
303 * online (either at the end of boot or resume or during a runtime cpu
304 * online). If we're doing that, @reg is set to something special and on
305 * this cpu we still do mtrr_if->set_all(). During boot/resume, this
306 * is unnecessary if at this point we are still on the cpu that started
307 * the boot/resume sequence. But there is no guarantee that we are still
308 * on the same cpu. So we do mtrr_if->set_all() on this cpu aswell to be
309 * sure that we are in sync with everyone else.
300 */ 310 */
301 if (reg != ~0U) 311 if (reg != ~0U)
302 mtrr_if->set(reg, base, size, type); 312 mtrr_if->set(reg, base, size, type);
303 else if (!mtrr_aps_delayed_init) 313 else
304 mtrr_if->set_all(); 314 mtrr_if->set_all();
305 315
306 /* Wait for the others */ 316 /* Wait for the others */
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 948a31eae75f..1cb0b9fc78dc 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -8,6 +8,7 @@
8#include <linux/seq_file.h> 8#include <linux/seq_file.h>
9#include <linux/smp.h> 9#include <linux/smp.h>
10#include <linux/ftrace.h> 10#include <linux/ftrace.h>
11#include <linux/delay.h>
11 12
12#include <asm/apic.h> 13#include <asm/apic.h>
13#include <asm/io_apic.h> 14#include <asm/io_apic.h>
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 5ed0ab549eb8..f9242800bc84 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -550,6 +550,7 @@ static void __exit microcode_exit(void)
550 microcode_dev_exit(); 550 microcode_dev_exit();
551 551
552 unregister_hotcpu_notifier(&mc_cpu_notifier); 552 unregister_hotcpu_notifier(&mc_cpu_notifier);
553 unregister_syscore_ops(&mc_syscore_ops);
553 554
554 get_online_cpus(); 555 get_online_cpus();
555 mutex_lock(&microcode_mutex); 556 mutex_lock(&microcode_mutex);
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index d3ce37edb54d..08c44b08bf5b 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -6,6 +6,7 @@
6#include <linux/dmi.h> 6#include <linux/dmi.h>
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/tboot.h> 8#include <linux/tboot.h>
9#include <linux/delay.h>
9#include <acpi/reboot.h> 10#include <acpi/reboot.h>
10#include <asm/io.h> 11#include <asm/io.h>
11#include <asm/apic.h> 12#include <asm/apic.h>
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 8dace181c88e..cf9750004a08 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -49,6 +49,10 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
49 val |= counter_config->user ? ARCH_PERFMON_EVENTSEL_USR : 0; 49 val |= counter_config->user ? ARCH_PERFMON_EVENTSEL_USR : 0;
50 val |= counter_config->kernel ? ARCH_PERFMON_EVENTSEL_OS : 0; 50 val |= counter_config->kernel ? ARCH_PERFMON_EVENTSEL_OS : 0;
51 val |= (counter_config->unit_mask & 0xFF) << 8; 51 val |= (counter_config->unit_mask & 0xFF) << 8;
52 counter_config->extra &= (ARCH_PERFMON_EVENTSEL_INV |
53 ARCH_PERFMON_EVENTSEL_EDGE |
54 ARCH_PERFMON_EVENTSEL_CMASK);
55 val |= counter_config->extra;
52 event &= model->event_mask ? model->event_mask : 0xFF; 56 event &= model->event_mask ? model->event_mask : 0xFF;
53 val |= event & 0xFF; 57 val |= event & 0xFF;
54 val |= (event & 0x0F00) << 24; 58 val |= (event & 0x0F00) << 24;
@@ -440,6 +444,7 @@ static int nmi_create_files(struct super_block *sb, struct dentry *root)
440 oprofilefs_create_ulong(sb, dir, "unit_mask", &counter_config[i].unit_mask); 444 oprofilefs_create_ulong(sb, dir, "unit_mask", &counter_config[i].unit_mask);
441 oprofilefs_create_ulong(sb, dir, "kernel", &counter_config[i].kernel); 445 oprofilefs_create_ulong(sb, dir, "kernel", &counter_config[i].kernel);
442 oprofilefs_create_ulong(sb, dir, "user", &counter_config[i].user); 446 oprofilefs_create_ulong(sb, dir, "user", &counter_config[i].user);
447 oprofilefs_create_ulong(sb, dir, "extra", &counter_config[i].extra);
443 } 448 }
444 449
445 return 0; 450 return 0;
diff --git a/arch/x86/oprofile/op_counter.h b/arch/x86/oprofile/op_counter.h
index e28398df0df2..0b7b7b179cbe 100644
--- a/arch/x86/oprofile/op_counter.h
+++ b/arch/x86/oprofile/op_counter.h
@@ -22,6 +22,7 @@ struct op_counter_config {
22 unsigned long kernel; 22 unsigned long kernel;
23 unsigned long user; 23 unsigned long user;
24 unsigned long unit_mask; 24 unsigned long unit_mask;
25 unsigned long extra;
25}; 26};
26 27
27extern struct op_counter_config counter_config[]; 28extern struct op_counter_config counter_config[];
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index a7b38d35c29a..7cb6424317f6 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -11,6 +11,7 @@
11#include <linux/debugfs.h> 11#include <linux/debugfs.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/delay.h>
14 15
15#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
16#include <asm/uv/uv.h> 17#include <asm/uv/uv.h>
diff --git a/block/blk-core.c b/block/blk-core.c
index 071ae6d2768b..90f22cc30799 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2163,7 +2163,7 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
2163 * size, something has gone terribly wrong. 2163 * size, something has gone terribly wrong.
2164 */ 2164 */
2165 if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) { 2165 if (blk_rq_bytes(req) < blk_rq_cur_bytes(req)) {
2166 printk(KERN_ERR "blk: request botched\n"); 2166 blk_dump_rq_flags(req, "request botched");
2167 req->__data_len = blk_rq_cur_bytes(req); 2167 req->__data_len = blk_rq_cur_bytes(req);
2168 } 2168 }
2169 2169
@@ -2665,7 +2665,7 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b)
2665 struct request *rqa = container_of(a, struct request, queuelist); 2665 struct request *rqa = container_of(a, struct request, queuelist);
2666 struct request *rqb = container_of(b, struct request, queuelist); 2666 struct request *rqb = container_of(b, struct request, queuelist);
2667 2667
2668 return !(rqa->q == rqb->q); 2668 return !(rqa->q <= rqb->q);
2669} 2669}
2670 2670
2671static void flush_plug_list(struct blk_plug *plug) 2671static void flush_plug_list(struct blk_plug *plug)
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 93d5fd8e51eb..eba4a2790c6c 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -261,7 +261,7 @@ static bool blk_kick_flush(struct request_queue *q)
261 q->flush_rq.end_io = flush_end_io; 261 q->flush_rq.end_io = flush_end_io;
262 262
263 q->flush_pending_idx ^= 1; 263 q->flush_pending_idx ^= 1;
264 elv_insert(q, &q->flush_rq, ELEVATOR_INSERT_REQUEUE); 264 list_add_tail(&q->flush_rq.queuelist, &q->queue_head);
265 return true; 265 return true;
266} 266}
267 267
@@ -281,7 +281,7 @@ static void flush_data_end_io(struct request *rq, int error)
281 * blk_insert_flush - insert a new FLUSH/FUA request 281 * blk_insert_flush - insert a new FLUSH/FUA request
282 * @rq: request to insert 282 * @rq: request to insert
283 * 283 *
284 * To be called from elv_insert() for %ELEVATOR_INSERT_FLUSH insertions. 284 * To be called from __elv_add_request() for %ELEVATOR_INSERT_FLUSH insertions.
285 * @rq is being submitted. Analyze what needs to be done and put it on the 285 * @rq is being submitted. Analyze what needs to be done and put it on the
286 * right queue. 286 * right queue.
287 * 287 *
@@ -312,7 +312,7 @@ void blk_insert_flush(struct request *rq)
312 */ 312 */
313 if ((policy & REQ_FSEQ_DATA) && 313 if ((policy & REQ_FSEQ_DATA) &&
314 !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) { 314 !(policy & (REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH))) {
315 list_add(&rq->queuelist, &q->queue_head); 315 list_add_tail(&rq->queuelist, &q->queue_head);
316 return; 316 return;
317 } 317 }
318 318
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 54bcba6c02a7..129b9e209a3b 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -30,6 +30,8 @@
30 30
31static struct kmem_cache *integrity_cachep; 31static struct kmem_cache *integrity_cachep;
32 32
33static const char *bi_unsupported_name = "unsupported";
34
33/** 35/**
34 * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements 36 * blk_rq_count_integrity_sg - Count number of integrity scatterlist elements
35 * @q: request queue 37 * @q: request queue
@@ -358,6 +360,14 @@ static struct kobj_type integrity_ktype = {
358 .release = blk_integrity_release, 360 .release = blk_integrity_release,
359}; 361};
360 362
363bool blk_integrity_is_initialized(struct gendisk *disk)
364{
365 struct blk_integrity *bi = blk_get_integrity(disk);
366
367 return (bi && bi->name && strcmp(bi->name, bi_unsupported_name) != 0);
368}
369EXPORT_SYMBOL(blk_integrity_is_initialized);
370
361/** 371/**
362 * blk_integrity_register - Register a gendisk as being integrity-capable 372 * blk_integrity_register - Register a gendisk as being integrity-capable
363 * @disk: struct gendisk pointer to make integrity-aware 373 * @disk: struct gendisk pointer to make integrity-aware
@@ -407,7 +417,7 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
407 bi->get_tag_fn = template->get_tag_fn; 417 bi->get_tag_fn = template->get_tag_fn;
408 bi->tag_size = template->tag_size; 418 bi->tag_size = template->tag_size;
409 } else 419 } else
410 bi->name = "unsupported"; 420 bi->name = bi_unsupported_name;
411 421
412 return 0; 422 return 0;
413} 423}
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index c8b16c88b315..0475a22a420d 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -77,7 +77,7 @@ struct throtl_grp {
77 unsigned long slice_end[2]; 77 unsigned long slice_end[2];
78 78
79 /* Some throttle limits got updated for the group */ 79 /* Some throttle limits got updated for the group */
80 bool limits_changed; 80 int limits_changed;
81}; 81};
82 82
83struct throtl_data 83struct throtl_data
@@ -102,7 +102,7 @@ struct throtl_data
102 /* Work for dispatching throttled bios */ 102 /* Work for dispatching throttled bios */
103 struct delayed_work throtl_work; 103 struct delayed_work throtl_work;
104 104
105 bool limits_changed; 105 int limits_changed;
106}; 106};
107 107
108enum tg_state_flags { 108enum tg_state_flags {
diff --git a/block/elevator.c b/block/elevator.c
index c387d3168734..0cdb4e7ebab4 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -610,7 +610,7 @@ void elv_requeue_request(struct request_queue *q, struct request *rq)
610 610
611 rq->cmd_flags &= ~REQ_STARTED; 611 rq->cmd_flags &= ~REQ_STARTED;
612 612
613 elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE); 613 __elv_add_request(q, rq, ELEVATOR_INSERT_REQUEUE);
614} 614}
615 615
616void elv_drain_elevator(struct request_queue *q) 616void elv_drain_elevator(struct request_queue *q)
@@ -655,12 +655,25 @@ void elv_quiesce_end(struct request_queue *q)
655 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q); 655 queue_flag_clear(QUEUE_FLAG_ELVSWITCH, q);
656} 656}
657 657
658void elv_insert(struct request_queue *q, struct request *rq, int where) 658void __elv_add_request(struct request_queue *q, struct request *rq, int where)
659{ 659{
660 trace_block_rq_insert(q, rq); 660 trace_block_rq_insert(q, rq);
661 661
662 rq->q = q; 662 rq->q = q;
663 663
664 BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
665
666 if (rq->cmd_flags & REQ_SOFTBARRIER) {
667 /* barriers are scheduling boundary, update end_sector */
668 if (rq->cmd_type == REQ_TYPE_FS ||
669 (rq->cmd_flags & REQ_DISCARD)) {
670 q->end_sector = rq_end_sector(rq);
671 q->boundary_rq = rq;
672 }
673 } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
674 where == ELEVATOR_INSERT_SORT)
675 where = ELEVATOR_INSERT_BACK;
676
664 switch (where) { 677 switch (where) {
665 case ELEVATOR_INSERT_REQUEUE: 678 case ELEVATOR_INSERT_REQUEUE:
666 case ELEVATOR_INSERT_FRONT: 679 case ELEVATOR_INSERT_FRONT:
@@ -722,24 +735,6 @@ void elv_insert(struct request_queue *q, struct request *rq, int where)
722 BUG(); 735 BUG();
723 } 736 }
724} 737}
725
726void __elv_add_request(struct request_queue *q, struct request *rq, int where)
727{
728 BUG_ON(rq->cmd_flags & REQ_ON_PLUG);
729
730 if (rq->cmd_flags & REQ_SOFTBARRIER) {
731 /* barriers are scheduling boundary, update end_sector */
732 if (rq->cmd_type == REQ_TYPE_FS ||
733 (rq->cmd_flags & REQ_DISCARD)) {
734 q->end_sector = rq_end_sector(rq);
735 q->boundary_rq = rq;
736 }
737 } else if (!(rq->cmd_flags & REQ_ELVPRIV) &&
738 where == ELEVATOR_INSERT_SORT)
739 where = ELEVATOR_INSERT_BACK;
740
741 elv_insert(q, rq, where);
742}
743EXPORT_SYMBOL(__elv_add_request); 738EXPORT_SYMBOL(__elv_add_request);
744 739
745void elv_add_request(struct request_queue *q, struct request *rq, int where) 740void elv_add_request(struct request_queue *q, struct request *rq, int where)
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 25ef1a4556e6..cd0ff66469b2 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -165,7 +165,6 @@ static uint32_t fpga_tx(struct solos_card *);
165static irqreturn_t solos_irq(int irq, void *dev_id); 165static irqreturn_t solos_irq(int irq, void *dev_id);
166static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); 166static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci);
167static int list_vccs(int vci); 167static int list_vccs(int vci);
168static void release_vccs(struct atm_dev *dev);
169static int atm_init(struct solos_card *, struct device *); 168static int atm_init(struct solos_card *, struct device *);
170static void atm_remove(struct solos_card *); 169static void atm_remove(struct solos_card *);
171static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); 170static int send_command(struct solos_card *card, int dev, const char *buf, size_t size);
@@ -384,7 +383,6 @@ static int process_status(struct solos_card *card, int port, struct sk_buff *skb
384 /* Anything but 'Showtime' is down */ 383 /* Anything but 'Showtime' is down */
385 if (strcmp(state_str, "Showtime")) { 384 if (strcmp(state_str, "Showtime")) {
386 atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST); 385 atm_dev_signal_change(card->atmdev[port], ATM_PHY_SIG_LOST);
387 release_vccs(card->atmdev[port]);
388 dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str); 386 dev_info(&card->dev->dev, "Port %d: %s\n", port, state_str);
389 return 0; 387 return 0;
390 } 388 }
@@ -697,7 +695,7 @@ void solos_bh(unsigned long card_arg)
697 size); 695 size);
698 } 696 }
699 if (atmdebug) { 697 if (atmdebug) {
700 dev_info(&card->dev->dev, "Received: device %d\n", port); 698 dev_info(&card->dev->dev, "Received: port %d\n", port);
701 dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n", 699 dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n",
702 size, le16_to_cpu(header->vpi), 700 size, le16_to_cpu(header->vpi),
703 le16_to_cpu(header->vci)); 701 le16_to_cpu(header->vci));
@@ -710,8 +708,8 @@ void solos_bh(unsigned long card_arg)
710 le16_to_cpu(header->vci)); 708 le16_to_cpu(header->vci));
711 if (!vcc) { 709 if (!vcc) {
712 if (net_ratelimit()) 710 if (net_ratelimit())
713 dev_warn(&card->dev->dev, "Received packet for unknown VCI.VPI %d.%d on port %d\n", 711 dev_warn(&card->dev->dev, "Received packet for unknown VPI.VCI %d.%d on port %d\n",
714 le16_to_cpu(header->vci), le16_to_cpu(header->vpi), 712 le16_to_cpu(header->vpi), le16_to_cpu(header->vci),
715 port); 713 port);
716 continue; 714 continue;
717 } 715 }
@@ -830,28 +828,6 @@ static int list_vccs(int vci)
830 return num_found; 828 return num_found;
831} 829}
832 830
833static void release_vccs(struct atm_dev *dev)
834{
835 int i;
836
837 write_lock_irq(&vcc_sklist_lock);
838 for (i = 0; i < VCC_HTABLE_SIZE; i++) {
839 struct hlist_head *head = &vcc_hash[i];
840 struct hlist_node *node, *tmp;
841 struct sock *s;
842 struct atm_vcc *vcc;
843
844 sk_for_each_safe(s, node, tmp, head) {
845 vcc = atm_sk(s);
846 if (vcc->dev == dev) {
847 vcc_release_async(vcc, -EPIPE);
848 sk_del_node_init(s);
849 }
850 }
851 }
852 write_unlock_irq(&vcc_sklist_lock);
853}
854
855 831
856static int popen(struct atm_vcc *vcc) 832static int popen(struct atm_vcc *vcc)
857{ 833{
@@ -1018,8 +994,15 @@ static uint32_t fpga_tx(struct solos_card *card)
1018 994
1019 /* Clean up and free oldskb now it's gone */ 995 /* Clean up and free oldskb now it's gone */
1020 if (atmdebug) { 996 if (atmdebug) {
997 struct pkt_hdr *header = (void *)oldskb->data;
998 int size = le16_to_cpu(header->size);
999
1000 skb_pull(oldskb, sizeof(*header));
1021 dev_info(&card->dev->dev, "Transmitted: port %d\n", 1001 dev_info(&card->dev->dev, "Transmitted: port %d\n",
1022 port); 1002 port);
1003 dev_info(&card->dev->dev, "size: %d VPI: %d VCI: %d\n",
1004 size, le16_to_cpu(header->vpi),
1005 le16_to_cpu(header->vci));
1023 print_buffer(oldskb); 1006 print_buffer(oldskb);
1024 } 1007 }
1025 1008
@@ -1262,7 +1245,7 @@ static int atm_init(struct solos_card *card, struct device *parent)
1262 card->atmdev[i]->ci_range.vci_bits = 16; 1245 card->atmdev[i]->ci_range.vci_bits = 16;
1263 card->atmdev[i]->dev_data = card; 1246 card->atmdev[i]->dev_data = card;
1264 card->atmdev[i]->phy_data = (void *)(unsigned long)i; 1247 card->atmdev[i]->phy_data = (void *)(unsigned long)i;
1265 atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_UNKNOWN); 1248 atm_dev_signal_change(card->atmdev[i], ATM_PHY_SIG_FOUND);
1266 1249
1267 skb = alloc_skb(sizeof(*header), GFP_ATOMIC); 1250 skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
1268 if (!skb) { 1251 if (!skb) {
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 866811428e20..762a5109c68a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -71,6 +71,9 @@ static struct usb_device_id btusb_table[] = {
71 /* Apple MacBookAir3,1, MacBookAir3,2 */ 71 /* Apple MacBookAir3,1, MacBookAir3,2 */
72 { USB_DEVICE(0x05ac, 0x821b) }, 72 { USB_DEVICE(0x05ac, 0x821b) },
73 73
74 /* Apple MacBookPro8,2 */
75 { USB_DEVICE(0x05ac, 0x821a) },
76
74 /* AVM BlueFRITZ! USB v2.0 */ 77 /* AVM BlueFRITZ! USB v2.0 */
75 { USB_DEVICE(0x057c, 0x3800) }, 78 { USB_DEVICE(0x057c, 0x3800) },
76 79
@@ -690,7 +693,8 @@ static int btusb_send_frame(struct sk_buff *skb)
690 break; 693 break;
691 694
692 case HCI_ACLDATA_PKT: 695 case HCI_ACLDATA_PKT:
693 if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1) 696 if (!data->bulk_tx_ep || (hdev->conn_hash.acl_num < 1 &&
697 hdev->conn_hash.le_num < 1))
694 return -ENODEV; 698 return -ENODEV;
695 699
696 urb = usb_alloc_urb(0, GFP_ATOMIC); 700 urb = usb_alloc_urb(0, GFP_ATOMIC);
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 55653aba6735..c42c9d517790 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -31,24 +31,9 @@
31#include <linux/connector.h> 31#include <linux/connector.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33 33
34void cn_queue_wrapper(struct work_struct *work)
35{
36 struct cn_callback_entry *cbq =
37 container_of(work, struct cn_callback_entry, work);
38 struct cn_callback_data *d = &cbq->data;
39 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
40 struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);
41
42 d->callback(msg, nsp);
43
44 kfree_skb(d->skb);
45 d->skb = NULL;
46
47 kfree(d->free);
48}
49
50static struct cn_callback_entry * 34static struct cn_callback_entry *
51cn_queue_alloc_callback_entry(const char *name, struct cb_id *id, 35cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
36 struct cb_id *id,
52 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)) 37 void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
53{ 38{
54 struct cn_callback_entry *cbq; 39 struct cn_callback_entry *cbq;
@@ -59,17 +44,23 @@ cn_queue_alloc_callback_entry(const char *name, struct cb_id *id,
59 return NULL; 44 return NULL;
60 } 45 }
61 46
47 atomic_set(&cbq->refcnt, 1);
48
49 atomic_inc(&dev->refcnt);
50 cbq->pdev = dev;
51
62 snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name); 52 snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name);
63 memcpy(&cbq->id.id, id, sizeof(struct cb_id)); 53 memcpy(&cbq->id.id, id, sizeof(struct cb_id));
64 cbq->data.callback = callback; 54 cbq->callback = callback;
65
66 INIT_WORK(&cbq->work, &cn_queue_wrapper);
67 return cbq; 55 return cbq;
68} 56}
69 57
70static void cn_queue_free_callback(struct cn_callback_entry *cbq) 58void cn_queue_release_callback(struct cn_callback_entry *cbq)
71{ 59{
72 flush_workqueue(cbq->pdev->cn_queue); 60 if (!atomic_dec_and_test(&cbq->refcnt))
61 return;
62
63 atomic_dec(&cbq->pdev->refcnt);
73 kfree(cbq); 64 kfree(cbq);
74} 65}
75 66
@@ -85,13 +76,10 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
85 struct cn_callback_entry *cbq, *__cbq; 76 struct cn_callback_entry *cbq, *__cbq;
86 int found = 0; 77 int found = 0;
87 78
88 cbq = cn_queue_alloc_callback_entry(name, id, callback); 79 cbq = cn_queue_alloc_callback_entry(dev, name, id, callback);
89 if (!cbq) 80 if (!cbq)
90 return -ENOMEM; 81 return -ENOMEM;
91 82
92 atomic_inc(&dev->refcnt);
93 cbq->pdev = dev;
94
95 spin_lock_bh(&dev->queue_lock); 83 spin_lock_bh(&dev->queue_lock);
96 list_for_each_entry(__cbq, &dev->queue_list, callback_entry) { 84 list_for_each_entry(__cbq, &dev->queue_list, callback_entry) {
97 if (cn_cb_equal(&__cbq->id.id, id)) { 85 if (cn_cb_equal(&__cbq->id.id, id)) {
@@ -104,8 +92,7 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
104 spin_unlock_bh(&dev->queue_lock); 92 spin_unlock_bh(&dev->queue_lock);
105 93
106 if (found) { 94 if (found) {
107 cn_queue_free_callback(cbq); 95 cn_queue_release_callback(cbq);
108 atomic_dec(&dev->refcnt);
109 return -EINVAL; 96 return -EINVAL;
110 } 97 }
111 98
@@ -130,10 +117,8 @@ void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id)
130 } 117 }
131 spin_unlock_bh(&dev->queue_lock); 118 spin_unlock_bh(&dev->queue_lock);
132 119
133 if (found) { 120 if (found)
134 cn_queue_free_callback(cbq); 121 cn_queue_release_callback(cbq);
135 atomic_dec(&dev->refcnt);
136 }
137} 122}
138 123
139struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls) 124struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls)
@@ -151,12 +136,6 @@ struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *nls)
151 136
152 dev->nls = nls; 137 dev->nls = nls;
153 138
154 dev->cn_queue = alloc_ordered_workqueue(dev->name, 0);
155 if (!dev->cn_queue) {
156 kfree(dev);
157 return NULL;
158 }
159
160 return dev; 139 return dev;
161} 140}
162 141
@@ -164,9 +143,6 @@ void cn_queue_free_dev(struct cn_queue_dev *dev)
164{ 143{
165 struct cn_callback_entry *cbq, *n; 144 struct cn_callback_entry *cbq, *n;
166 145
167 flush_workqueue(dev->cn_queue);
168 destroy_workqueue(dev->cn_queue);
169
170 spin_lock_bh(&dev->queue_lock); 146 spin_lock_bh(&dev->queue_lock);
171 list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry) 147 list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry)
172 list_del(&cbq->callback_entry); 148 list_del(&cbq->callback_entry);
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index f7554de3be5e..d77005849af8 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -122,51 +122,28 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
122 */ 122 */
123static int cn_call_callback(struct sk_buff *skb) 123static int cn_call_callback(struct sk_buff *skb)
124{ 124{
125 struct cn_callback_entry *__cbq, *__new_cbq; 125 struct cn_callback_entry *i, *cbq = NULL;
126 struct cn_dev *dev = &cdev; 126 struct cn_dev *dev = &cdev;
127 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb)); 127 struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
128 struct netlink_skb_parms *nsp = &NETLINK_CB(skb);
128 int err = -ENODEV; 129 int err = -ENODEV;
129 130
130 spin_lock_bh(&dev->cbdev->queue_lock); 131 spin_lock_bh(&dev->cbdev->queue_lock);
131 list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { 132 list_for_each_entry(i, &dev->cbdev->queue_list, callback_entry) {
132 if (cn_cb_equal(&__cbq->id.id, &msg->id)) { 133 if (cn_cb_equal(&i->id.id, &msg->id)) {
133 if (likely(!work_pending(&__cbq->work) && 134 atomic_inc(&i->refcnt);
134 __cbq->data.skb == NULL)) { 135 cbq = i;
135 __cbq->data.skb = skb;
136
137 if (queue_work(dev->cbdev->cn_queue,
138 &__cbq->work))
139 err = 0;
140 else
141 err = -EINVAL;
142 } else {
143 struct cn_callback_data *d;
144
145 err = -ENOMEM;
146 __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
147 if (__new_cbq) {
148 d = &__new_cbq->data;
149 d->skb = skb;
150 d->callback = __cbq->data.callback;
151 d->free = __new_cbq;
152
153 INIT_WORK(&__new_cbq->work,
154 &cn_queue_wrapper);
155
156 if (queue_work(dev->cbdev->cn_queue,
157 &__new_cbq->work))
158 err = 0;
159 else {
160 kfree(__new_cbq);
161 err = -EINVAL;
162 }
163 }
164 }
165 break; 136 break;
166 } 137 }
167 } 138 }
168 spin_unlock_bh(&dev->cbdev->queue_lock); 139 spin_unlock_bh(&dev->cbdev->queue_lock);
169 140
141 if (cbq != NULL) {
142 cbq->callback(msg, nsp);
143 kfree_skb(skb);
144 cn_queue_release_callback(cbq);
145 }
146
170 return err; 147 return err;
171} 148}
172 149
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index ffb5ad080bee..38ab8e2cd7f4 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -1147,13 +1147,14 @@ static struct platform_driver mpc85xx_mc_err_driver = {
1147static void __init mpc85xx_mc_clear_rfxe(void *data) 1147static void __init mpc85xx_mc_clear_rfxe(void *data)
1148{ 1148{
1149 orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1); 1149 orig_hid1[smp_processor_id()] = mfspr(SPRN_HID1);
1150 mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~0x20000)); 1150 mtspr(SPRN_HID1, (orig_hid1[smp_processor_id()] & ~HID1_RFXE));
1151} 1151}
1152#endif 1152#endif
1153 1153
1154static int __init mpc85xx_mc_init(void) 1154static int __init mpc85xx_mc_init(void)
1155{ 1155{
1156 int res = 0; 1156 int res = 0;
1157 u32 pvr = 0;
1157 1158
1158 printk(KERN_INFO "Freescale(R) MPC85xx EDAC driver, " 1159 printk(KERN_INFO "Freescale(R) MPC85xx EDAC driver, "
1159 "(C) 2006 Montavista Software\n"); 1160 "(C) 2006 Montavista Software\n");
@@ -1183,12 +1184,17 @@ static int __init mpc85xx_mc_init(void)
1183#endif 1184#endif
1184 1185
1185#ifdef CONFIG_FSL_SOC_BOOKE 1186#ifdef CONFIG_FSL_SOC_BOOKE
1186 /* 1187 pvr = mfspr(SPRN_PVR);
1187 * need to clear HID1[RFXE] to disable machine check int 1188
1188 * so we can catch it 1189 if ((PVR_VER(pvr) == PVR_VER_E500V1) ||
1189 */ 1190 (PVR_VER(pvr) == PVR_VER_E500V2)) {
1190 if (edac_op_state == EDAC_OPSTATE_INT) 1191 /*
1191 on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0); 1192 * need to clear HID1[RFXE] to disable machine check int
1193 * so we can catch it
1194 */
1195 if (edac_op_state == EDAC_OPSTATE_INT)
1196 on_each_cpu(mpc85xx_mc_clear_rfxe, NULL, 0);
1197 }
1192#endif 1198#endif
1193 1199
1194 return 0; 1200 return 0;
@@ -1206,7 +1212,12 @@ static void __exit mpc85xx_mc_restore_hid1(void *data)
1206static void __exit mpc85xx_mc_exit(void) 1212static void __exit mpc85xx_mc_exit(void)
1207{ 1213{
1208#ifdef CONFIG_FSL_SOC_BOOKE 1214#ifdef CONFIG_FSL_SOC_BOOKE
1209 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); 1215 u32 pvr = mfspr(SPRN_PVR);
1216
1217 if ((PVR_VER(pvr) == PVR_VER_E500V1) ||
1218 (PVR_VER(pvr) == PVR_VER_E500V2)) {
1219 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0);
1220 }
1210#endif 1221#endif
1211#ifdef CONFIG_PCI 1222#ifdef CONFIG_PCI
1212 platform_driver_unregister(&mpc85xx_pci_err_driver); 1223 platform_driver_unregister(&mpc85xx_pci_err_driver);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 9c595e3b9c20..adc9358c9bec 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1297,7 +1297,7 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
1297/** 1297/**
1298 * Search EDID for CEA extension block. 1298 * Search EDID for CEA extension block.
1299 */ 1299 */
1300static u8 *drm_find_cea_extension(struct edid *edid) 1300u8 *drm_find_cea_extension(struct edid *edid)
1301{ 1301{
1302 u8 *edid_ext = NULL; 1302 u8 *edid_ext = NULL;
1303 int i; 1303 int i;
@@ -1318,6 +1318,7 @@ static u8 *drm_find_cea_extension(struct edid *edid)
1318 1318
1319 return edid_ext; 1319 return edid_ext;
1320} 1320}
1321EXPORT_SYMBOL(drm_find_cea_extension);
1321 1322
1322/** 1323/**
1323 * drm_detect_hdmi_monitor - detect whether monitor is hdmi. 1324 * drm_detect_hdmi_monitor - detect whether monitor is hdmi.
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 8342259f3160..d03fc05b39c0 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -269,21 +269,6 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
269 return ret; 269 return ret;
270} 270}
271 271
272static bool intel_crt_ddc_probe(struct drm_i915_private *dev_priv, int ddc_bus)
273{
274 u8 buf;
275 struct i2c_msg msgs[] = {
276 {
277 .addr = 0xA0,
278 .flags = 0,
279 .len = 1,
280 .buf = &buf,
281 },
282 };
283 /* DDC monitor detect: Does it ACK a write to 0xA0? */
284 return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1;
285}
286
287static bool intel_crt_detect_ddc(struct drm_connector *connector) 272static bool intel_crt_detect_ddc(struct drm_connector *connector)
288{ 273{
289 struct intel_crt *crt = intel_attached_crt(connector); 274 struct intel_crt *crt = intel_attached_crt(connector);
@@ -293,11 +278,6 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
293 if (crt->base.type != INTEL_OUTPUT_ANALOG) 278 if (crt->base.type != INTEL_OUTPUT_ANALOG)
294 return false; 279 return false;
295 280
296 if (intel_crt_ddc_probe(dev_priv, dev_priv->crt_ddc_pin)) {
297 DRM_DEBUG_KMS("CRT detected via DDC:0xa0\n");
298 return true;
299 }
300
301 if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) { 281 if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) {
302 struct edid *edid; 282 struct edid *edid;
303 bool is_digital = false; 283 bool is_digital = false;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5daa991cb287..f5b0d8306d83 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -39,7 +39,7 @@
39 ret__ = -ETIMEDOUT; \ 39 ret__ = -ETIMEDOUT; \
40 break; \ 40 break; \
41 } \ 41 } \
42 if (W && !in_dbg_master()) msleep(W); \ 42 if (W && !(in_atomic() || in_dbg_master())) msleep(W); \
43 } \ 43 } \
44 ret__; \ 44 ret__; \
45}) 45})
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 82d04c5899d2..d3b903bce7c5 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -259,7 +259,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
259 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50)) 259 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50))
260 goto timeout; 260 goto timeout;
261 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) 261 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
262 return 0; 262 goto clear_err;
263 263
264 val = I915_READ(GMBUS3 + reg_offset); 264 val = I915_READ(GMBUS3 + reg_offset);
265 do { 265 do {
@@ -287,7 +287,7 @@ gmbus_xfer(struct i2c_adapter *adapter,
287 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50)) 287 if (wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_RDY), 50))
288 goto timeout; 288 goto timeout;
289 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) 289 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
290 return 0; 290 goto clear_err;
291 291
292 val = loop = 0; 292 val = loop = 0;
293 do { 293 do {
@@ -302,14 +302,31 @@ gmbus_xfer(struct i2c_adapter *adapter,
302 if (i + 1 < num && wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_WAIT_PHASE), 50)) 302 if (i + 1 < num && wait_for(I915_READ(GMBUS2 + reg_offset) & (GMBUS_SATOER | GMBUS_HW_WAIT_PHASE), 50))
303 goto timeout; 303 goto timeout;
304 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER) 304 if (I915_READ(GMBUS2 + reg_offset) & GMBUS_SATOER)
305 return 0; 305 goto clear_err;
306 } 306 }
307 307
308 return num; 308 goto done;
309
310clear_err:
311 /* Toggle the Software Clear Interrupt bit. This has the effect
312 * of resetting the GMBUS controller and so clearing the
313 * BUS_ERROR raised by the slave's NAK.
314 */
315 I915_WRITE(GMBUS1 + reg_offset, GMBUS_SW_CLR_INT);
316 I915_WRITE(GMBUS1 + reg_offset, 0);
317
318done:
319 /* Mark the GMBUS interface as disabled. We will re-enable it at the
320 * start of the next xfer, till then let it sleep.
321 */
322 I915_WRITE(GMBUS0 + reg_offset, 0);
323 return i;
309 324
310timeout: 325timeout:
311 DRM_INFO("GMBUS timed out, falling back to bit banging on pin %d [%s]\n", 326 DRM_INFO("GMBUS timed out, falling back to bit banging on pin %d [%s]\n",
312 bus->reg0 & 0xff, bus->adapter.name); 327 bus->reg0 & 0xff, bus->adapter.name);
328 I915_WRITE(GMBUS0 + reg_offset, 0);
329
313 /* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */ 330 /* Hardware may not support GMBUS over these pins? Try GPIO bitbanging instead. */
314 bus->force_bit = intel_gpio_create(dev_priv, bus->reg0 & 0xff); 331 bus->force_bit = intel_gpio_create(dev_priv, bus->reg0 & 0xff);
315 if (!bus->force_bit) 332 if (!bus->force_bit)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 1a311ad01116..a562bd2648c7 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -473,19 +473,13 @@ static enum drm_connector_status
473intel_lvds_detect(struct drm_connector *connector, bool force) 473intel_lvds_detect(struct drm_connector *connector, bool force)
474{ 474{
475 struct drm_device *dev = connector->dev; 475 struct drm_device *dev = connector->dev;
476 enum drm_connector_status status = connector_status_connected; 476 enum drm_connector_status status;
477 477
478 status = intel_panel_detect(dev); 478 status = intel_panel_detect(dev);
479 if (status != connector_status_unknown) 479 if (status != connector_status_unknown)
480 return status; 480 return status;
481 481
482 /* ACPI lid methods were generally unreliable in this generation, so 482 return connector_status_connected;
483 * don't even bother.
484 */
485 if (IS_GEN2(dev) || IS_GEN3(dev))
486 return connector_status_connected;
487
488 return status;
489} 483}
490 484
491/** 485/**
@@ -835,25 +829,6 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
835 return false; 829 return false;
836} 830}
837 831
838static bool intel_lvds_ddc_probe(struct drm_device *dev, u8 pin)
839{
840 struct drm_i915_private *dev_priv = dev->dev_private;
841 u8 buf = 0;
842 struct i2c_msg msgs[] = {
843 {
844 .addr = 0xA0,
845 .flags = 0,
846 .len = 1,
847 .buf = &buf,
848 },
849 };
850 struct i2c_adapter *i2c = &dev_priv->gmbus[pin].adapter;
851 /* XXX this only appears to work when using GMBUS */
852 if (intel_gmbus_is_forced_bit(i2c))
853 return true;
854 return i2c_transfer(i2c, msgs, 1) == 1;
855}
856
857/** 832/**
858 * intel_lvds_init - setup LVDS connectors on this device 833 * intel_lvds_init - setup LVDS connectors on this device
859 * @dev: drm device 834 * @dev: drm device
@@ -894,11 +869,6 @@ bool intel_lvds_init(struct drm_device *dev)
894 } 869 }
895 } 870 }
896 871
897 if (!intel_lvds_ddc_probe(dev, pin)) {
898 DRM_DEBUG_KMS("LVDS did not respond to DDC probe\n");
899 return false;
900 }
901
902 intel_lvds = kzalloc(sizeof(struct intel_lvds), GFP_KERNEL); 872 intel_lvds = kzalloc(sizeof(struct intel_lvds), GFP_KERNEL);
903 if (!intel_lvds) { 873 if (!intel_lvds) {
904 return false; 874 return false;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index e8b04f4aed7e..b52e46018245 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -97,7 +97,7 @@ nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan,
97 return -ENOMEM; 97 return -ENOMEM;
98 } 98 }
99 99
100 nvbo->bo.persistant_swap_storage = nvbo->gem->filp; 100 nvbo->bo.persistent_swap_storage = nvbo->gem->filp;
101 nvbo->gem->driver_private = nvbo; 101 nvbo->gem->driver_private = nvbo;
102 return 0; 102 return 0;
103} 103}
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 10e41af6b026..b41ec59c7100 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1009,6 +1009,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1009 uint64_t fb_location; 1009 uint64_t fb_location;
1010 uint32_t fb_format, fb_pitch_pixels, tiling_flags; 1010 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
1011 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); 1011 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
1012 u32 tmp;
1012 int r; 1013 int r;
1013 1014
1014 /* no fb bound */ 1015 /* no fb bound */
@@ -1137,6 +1138,15 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1137 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1138 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1138 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); 1139 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
1139 1140
1141 /* pageflip setup */
1142 /* make sure flip is at vb rather than hb */
1143 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
1144 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
1145 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
1146
1147 /* set pageflip to happen anywhere in vblank interval */
1148 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
1149
1140 if (!atomic && fb && fb != crtc->fb) { 1150 if (!atomic && fb && fb != crtc->fb) {
1141 radeon_fb = to_radeon_framebuffer(fb); 1151 radeon_fb = to_radeon_framebuffer(fb);
1142 rbo = gem_to_radeon_bo(radeon_fb->obj); 1152 rbo = gem_to_radeon_bo(radeon_fb->obj);
@@ -1167,6 +1177,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1167 uint64_t fb_location; 1177 uint64_t fb_location;
1168 uint32_t fb_format, fb_pitch_pixels, tiling_flags; 1178 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
1169 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; 1179 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE;
1180 u32 tmp;
1170 int r; 1181 int r;
1171 1182
1172 /* no fb bound */ 1183 /* no fb bound */
@@ -1294,6 +1305,15 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1294 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1305 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1295 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); 1306 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
1296 1307
1308 /* pageflip setup */
1309 /* make sure flip is at vb rather than hb */
1310 tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
1311 tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN;
1312 WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
1313
1314 /* set pageflip to happen anywhere in vblank interval */
1315 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
1316
1297 if (!atomic && fb && fb != crtc->fb) { 1317 if (!atomic && fb && fb != crtc->fb) {
1298 radeon_fb = to_radeon_framebuffer(fb); 1318 radeon_fb = to_radeon_framebuffer(fb);
1299 rbo = gem_to_radeon_bo(radeon_fb->obj); 1319 rbo = gem_to_radeon_bo(radeon_fb->obj);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 941080a77940..0b0cc74c08c0 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -43,17 +43,6 @@ static void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
43 43
44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) 44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc)
45{ 45{
46 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
47 u32 tmp;
48
49 /* make sure flip is at vb rather than hb */
50 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
51 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
52 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
53
54 /* set pageflip to happen anywhere in vblank interval */
55 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
56
57 /* enable the pflip int */ 46 /* enable the pflip int */
58 radeon_irq_kms_pflip_irq_get(rdev, crtc); 47 radeon_irq_kms_pflip_irq_get(rdev, crtc);
59} 48}
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 02d5c415f499..99768d9d91da 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -675,7 +675,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
675 ATOM_ENCODER_CAP_RECORD *cap_record; 675 ATOM_ENCODER_CAP_RECORD *cap_record;
676 u16 caps = 0; 676 u16 caps = 0;
677 677
678 while (record->ucRecordType > 0 && 678 while (record->ucRecordSize > 0 &&
679 record->ucRecordType > 0 &&
679 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { 680 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
680 switch (record->ucRecordType) { 681 switch (record->ucRecordType) {
681 case ATOM_ENCODER_CAP_RECORD_TYPE: 682 case ATOM_ENCODER_CAP_RECORD_TYPE:
@@ -720,7 +721,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
720 break; 721 break;
721 } 722 }
722 723
723 while (record->ucRecordType > 0 && 724 while (record->ucRecordSize > 0 &&
725 record->ucRecordType > 0 &&
724 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { 726 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
725 switch (record->ucRecordType) { 727 switch (record->ucRecordType) {
726 case ATOM_I2C_RECORD_TYPE: 728 case ATOM_I2C_RECORD_TYPE:
@@ -782,10 +784,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
782 ATOM_HPD_INT_RECORD *hpd_record; 784 ATOM_HPD_INT_RECORD *hpd_record;
783 ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; 785 ATOM_I2C_ID_CONFIG_ACCESS *i2c_config;
784 786
785 while (record->ucRecordType > 0 787 while (record->ucRecordSize > 0 &&
786 && record-> 788 record->ucRecordType > 0 &&
787 ucRecordType <= 789 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
788 ATOM_MAX_OBJECT_RECORD_NUMBER) {
789 switch (record->ucRecordType) { 790 switch (record->ucRecordType) {
790 case ATOM_I2C_RECORD_TYPE: 791 case ATOM_I2C_RECORD_TYPE:
791 i2c_record = 792 i2c_record =
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index cf602e2d0718..8caf546c8e92 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -2079,6 +2079,19 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
2079 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 2079 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
2080 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, 2080 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
2081 &hpd); 2081 &hpd);
2082 /* TV - TV DAC */
2083 ddc_i2c.valid = false;
2084 hpd.hpd = RADEON_HPD_NONE;
2085 radeon_add_legacy_encoder(dev,
2086 radeon_get_encoder_enum(dev,
2087 ATOM_DEVICE_TV1_SUPPORT,
2088 2),
2089 ATOM_DEVICE_TV1_SUPPORT);
2090 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
2091 DRM_MODE_CONNECTOR_SVIDEO,
2092 &ddc_i2c,
2093 CONNECTOR_OBJECT_ID_SVIDEO,
2094 &hpd);
2082 break; 2095 break;
2083 default: 2096 default:
2084 DRM_INFO("Connector table: %d (invalid)\n", 2097 DRM_INFO("Connector table: %d (invalid)\n",
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 19763f5df5e1..876cebc4b8ba 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -48,17 +48,6 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev);
48 48
49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc) 49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc)
50{ 50{
51 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
52 u32 tmp;
53
54 /* make sure flip is at vb rather than hb */
55 tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
56 tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN;
57 WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
58
59 /* set pageflip to happen anywhere in vblank interval */
60 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
61
62 /* enable the pflip int */ 51 /* enable the pflip int */
63 radeon_irq_kms_pflip_irq_get(rdev, crtc); 52 radeon_irq_kms_pflip_irq_get(rdev, crtc);
64} 53}
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 0b6a55ac2f87..2e618b5ac465 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1168,7 +1168,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1168 uint32_t page_alignment, 1168 uint32_t page_alignment,
1169 unsigned long buffer_start, 1169 unsigned long buffer_start,
1170 bool interruptible, 1170 bool interruptible,
1171 struct file *persistant_swap_storage, 1171 struct file *persistent_swap_storage,
1172 size_t acc_size, 1172 size_t acc_size,
1173 void (*destroy) (struct ttm_buffer_object *)) 1173 void (*destroy) (struct ttm_buffer_object *))
1174{ 1174{
@@ -1211,7 +1211,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1211 bo->priv_flags = 0; 1211 bo->priv_flags = 0;
1212 bo->mem.placement = (TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED); 1212 bo->mem.placement = (TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED);
1213 bo->seq_valid = false; 1213 bo->seq_valid = false;
1214 bo->persistant_swap_storage = persistant_swap_storage; 1214 bo->persistent_swap_storage = persistent_swap_storage;
1215 bo->acc_size = acc_size; 1215 bo->acc_size = acc_size;
1216 atomic_inc(&bo->glob->bo_count); 1216 atomic_inc(&bo->glob->bo_count);
1217 1217
@@ -1260,7 +1260,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
1260 uint32_t page_alignment, 1260 uint32_t page_alignment,
1261 unsigned long buffer_start, 1261 unsigned long buffer_start,
1262 bool interruptible, 1262 bool interruptible,
1263 struct file *persistant_swap_storage, 1263 struct file *persistent_swap_storage,
1264 struct ttm_buffer_object **p_bo) 1264 struct ttm_buffer_object **p_bo)
1265{ 1265{
1266 struct ttm_buffer_object *bo; 1266 struct ttm_buffer_object *bo;
@@ -1282,7 +1282,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
1282 1282
1283 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, 1283 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment,
1284 buffer_start, interruptible, 1284 buffer_start, interruptible,
1285 persistant_swap_storage, acc_size, NULL); 1285 persistent_swap_storage, acc_size, NULL);
1286 if (likely(ret == 0)) 1286 if (likely(ret == 0))
1287 *p_bo = bo; 1287 *p_bo = bo;
1288 1288
@@ -1863,7 +1863,7 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink)
1863 if (bo->bdev->driver->swap_notify) 1863 if (bo->bdev->driver->swap_notify)
1864 bo->bdev->driver->swap_notify(bo); 1864 bo->bdev->driver->swap_notify(bo);
1865 1865
1866 ret = ttm_tt_swapout(bo->ttm, bo->persistant_swap_storage); 1866 ret = ttm_tt_swapout(bo->ttm, bo->persistent_swap_storage);
1867out: 1867out:
1868 1868
1869 /** 1869 /**
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 86d5b1745a45..90e23e0bfadb 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -332,7 +332,7 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
332 ttm_tt_free_page_directory(ttm); 332 ttm_tt_free_page_directory(ttm);
333 } 333 }
334 334
335 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTANT_SWAP) && 335 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP) &&
336 ttm->swap_storage) 336 ttm->swap_storage)
337 fput(ttm->swap_storage); 337 fput(ttm->swap_storage);
338 338
@@ -503,7 +503,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm)
503 page_cache_release(from_page); 503 page_cache_release(from_page);
504 } 504 }
505 505
506 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTANT_SWAP)) 506 if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP))
507 fput(swap_storage); 507 fput(swap_storage);
508 ttm->swap_storage = NULL; 508 ttm->swap_storage = NULL;
509 ttm->page_flags &= ~TTM_PAGE_FLAG_SWAPPED; 509 ttm->page_flags &= ~TTM_PAGE_FLAG_SWAPPED;
@@ -514,7 +514,7 @@ out_err:
514 return ret; 514 return ret;
515} 515}
516 516
517int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage) 517int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
518{ 518{
519 struct address_space *swap_space; 519 struct address_space *swap_space;
520 struct file *swap_storage; 520 struct file *swap_storage;
@@ -540,7 +540,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
540 return 0; 540 return 0;
541 } 541 }
542 542
543 if (!persistant_swap_storage) { 543 if (!persistent_swap_storage) {
544 swap_storage = shmem_file_setup("ttm swap", 544 swap_storage = shmem_file_setup("ttm swap",
545 ttm->num_pages << PAGE_SHIFT, 545 ttm->num_pages << PAGE_SHIFT,
546 0); 546 0);
@@ -549,7 +549,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
549 return PTR_ERR(swap_storage); 549 return PTR_ERR(swap_storage);
550 } 550 }
551 } else 551 } else
552 swap_storage = persistant_swap_storage; 552 swap_storage = persistent_swap_storage;
553 553
554 swap_space = swap_storage->f_path.dentry->d_inode->i_mapping; 554 swap_space = swap_storage->f_path.dentry->d_inode->i_mapping;
555 555
@@ -577,12 +577,12 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistant_swap_storage)
577 ttm_tt_free_alloced_pages(ttm); 577 ttm_tt_free_alloced_pages(ttm);
578 ttm->swap_storage = swap_storage; 578 ttm->swap_storage = swap_storage;
579 ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED; 579 ttm->page_flags |= TTM_PAGE_FLAG_SWAPPED;
580 if (persistant_swap_storage) 580 if (persistent_swap_storage)
581 ttm->page_flags |= TTM_PAGE_FLAG_PERSISTANT_SWAP; 581 ttm->page_flags |= TTM_PAGE_FLAG_PERSISTENT_SWAP;
582 582
583 return 0; 583 return 0;
584out_err: 584out_err:
585 if (!persistant_swap_storage) 585 if (!persistent_swap_storage)
586 fput(swap_storage); 586 fput(swap_storage);
587 587
588 return ret; 588 return ret;
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index b7ec4057841d..9de9e97149ec 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -185,7 +185,7 @@ config HID_EZKEY
185 Support for Ezkey BTC 8193 keyboard. 185 Support for Ezkey BTC 8193 keyboard.
186 186
187config HID_KEYTOUCH 187config HID_KEYTOUCH
188 tristate "Keyoutch HID devices" 188 tristate "Keytouch HID devices"
189 depends on USB_HID 189 depends on USB_HID
190 ---help--- 190 ---help---
191 Support for Keytouch HID devices not fully compliant with 191 Support for Keytouch HID devices not fully compliant with
@@ -340,10 +340,17 @@ config HID_NTRIG
340 Support for N-Trig touch screen. 340 Support for N-Trig touch screen.
341 341
342config HID_ORTEK 342config HID_ORTEK
343 tristate "Ortek PKB-1700/WKB-2000 wireless keyboard and mouse trackpad" 343 tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
344 depends on USB_HID 344 depends on USB_HID
345 ---help--- 345 ---help---
346 Support for Ortek PKB-1700/WKB-2000 wireless keyboard + mouse trackpad. 346 There are certain devices which have LogicalMaximum wrong in the keyboard
347 usage page of their report descriptor. The most prevailing ones so far
348 are manufactured by Ortek, thus the name of the driver. Currently
349 supported devices by this driver are
350
351 - Ortek PKB-1700
352 - Ortek WKB-2000
353 - Skycable wireless presenter
347 354
348config HID_PANTHERLORD 355config HID_PANTHERLORD
349 tristate "Pantherlord/GreenAsia game controller" 356 tristate "Pantherlord/GreenAsia game controller"
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 453e7e6da0c2..408c4bea4d8d 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1449,8 +1449,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
1449 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, 1449 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) },
1450 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, 1450 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) },
1451 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 1451 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
1452 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) },
1452 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1453 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1453 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, 1454 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
1455 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
1454 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1456 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1455 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1457 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1456 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1458 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 65ac53d7aecc..00a94b535d28 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -150,6 +150,7 @@
150#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01 150#define USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6 0x0f01
151 151
152#define USB_VENDOR_ID_CH 0x068e 152#define USB_VENDOR_ID_CH 0x068e
153#define USB_DEVICE_ID_CH_PRO_THROTTLE 0x00f1
153#define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2 154#define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2
154#define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4 155#define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4
155#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051 156#define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051
@@ -524,6 +525,9 @@
524#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 525#define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
525#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 526#define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600
526 527
528#define USB_VENDOR_ID_SKYCABLE 0x1223
529#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
530
527#define USB_VENDOR_ID_SONY 0x054c 531#define USB_VENDOR_ID_SONY 0x054c
528#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b 532#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
529#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268 533#define USB_DEVICE_ID_SONY_PS3_CONTROLLER 0x0268
diff --git a/drivers/hid/hid-lgff.c b/drivers/hid/hid-lgff.c
index 90d0ef2c92be..f099079ca6b9 100644
--- a/drivers/hid/hid-lgff.c
+++ b/drivers/hid/hid-lgff.c
@@ -73,6 +73,8 @@ static const struct dev_type devices[] = {
73 { 0x046d, 0xc293, ff_joystick }, 73 { 0x046d, 0xc293, ff_joystick },
74 { 0x046d, 0xc294, ff_wheel }, 74 { 0x046d, 0xc294, ff_wheel },
75 { 0x046d, 0xc295, ff_joystick }, 75 { 0x046d, 0xc295, ff_joystick },
76 { 0x046d, 0xc298, ff_wheel },
77 { 0x046d, 0xc299, ff_wheel },
76 { 0x046d, 0xca03, ff_wheel }, 78 { 0x046d, 0xca03, ff_wheel },
77}; 79};
78 80
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index 7a6137346097..0ec91c18a421 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -418,6 +418,8 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
418 input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, 418 input_set_abs_params(input, ABS_MT_POSITION_Y, -2456,
419 2565, 4, 0); 419 2565, 4, 0);
420 } 420 }
421
422 input_set_events_per_packet(input, 60);
421 } 423 }
422 424
423 if (report_undeciphered) { 425 if (report_undeciphered) {
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
index f9b7dd4f607f..0ffa1d2d64f0 100644
--- a/drivers/hid/hid-ortek.c
+++ b/drivers/hid/hid-ortek.c
@@ -1,8 +1,14 @@
1/* 1/*
2 * HID driver for Ortek PKB-1700/WKB-2000 (wireless keyboard + mouse trackpad). 2 * HID driver for various devices which are apparently based on the same chipset
3 * Fixes LogicalMaximum error in HID report description. 3 * from certain vendor which produces chips that contain wrong LogicalMaximum
4 * value in their HID report descriptor. Currently supported devices are:
5 *
6 * Ortek PKB-1700
7 * Ortek WKB-2000
8 * Skycable wireless presenter
4 * 9 *
5 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com> 10 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
11 * Copyright (c) 2011 Jiri Kosina
6 */ 12 */
7 13
8/* 14/*
@@ -22,8 +28,11 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
22 unsigned int *rsize) 28 unsigned int *rsize)
23{ 29{
24 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { 30 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
25 hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n"); 31 hid_info(hdev, "Fixing up logical minimum in report descriptor (Ortek)\n");
26 rdesc[55] = 0x92; 32 rdesc[55] = 0x92;
33 } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
34 hid_info(hdev, "Fixing up logical minimum in report descriptor (Skycable)\n");
35 rdesc[53] = 0x65;
27 } 36 }
28 return rdesc; 37 return rdesc;
29} 38}
@@ -31,6 +40,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
31static const struct hid_device_id ortek_devices[] = { 40static const struct hid_device_id ortek_devices[] = {
32 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 41 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
33 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 42 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
43 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
34 { } 44 { }
35}; 45};
36MODULE_DEVICE_TABLE(hid, ortek_devices); 46MODULE_DEVICE_TABLE(hid, ortek_devices);
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c
index 160f481344f6..38280c055a19 100644
--- a/drivers/hid/hid-roccat-pyra.c
+++ b/drivers/hid/hid-roccat-pyra.c
@@ -652,7 +652,8 @@ static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report,
652static const struct hid_device_id pyra_devices[] = { 652static const struct hid_device_id pyra_devices[] = {
653 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, 653 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT,
654 USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, 654 USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
655 /* TODO add USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS after testing */ 655 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT,
656 USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) },
656 { } 657 { }
657}; 658};
658 659
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 9a94b643ccde..a8426f15e9ab 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -59,6 +59,7 @@ static const struct hid_blacklist {
59 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, 59 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET },
60 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, 60 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET },
61 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET }, 61 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET },
62 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_THROTTLE, HID_QUIRK_NOGET },
62 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET }, 63 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET },
63 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, 64 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
64 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, 65 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
diff --git a/drivers/hwmon/twl4030-madc-hwmon.c b/drivers/hwmon/twl4030-madc-hwmon.c
index 97e22bef85ab..de5819199e2e 100644
--- a/drivers/hwmon/twl4030-madc-hwmon.c
+++ b/drivers/hwmon/twl4030-madc-hwmon.c
@@ -154,4 +154,4 @@ module_exit(twl4030_madc_hwmon_exit);
154MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver"); 154MODULE_DESCRIPTION("TWL4030 ADC Hwmon driver");
155MODULE_LICENSE("GPL"); 155MODULE_LICENSE("GPL");
156MODULE_AUTHOR("J Keerthy"); 156MODULE_AUTHOR("J Keerthy");
157MODULE_ALIAS("twl4030_madc_hwmon"); 157MODULE_ALIAS("platform:twl4030_madc_hwmon");
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 0e406d73b2c8..177db6d5b2f5 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -430,6 +430,26 @@ static inline void ide_unlock_host(struct ide_host *host)
430 } 430 }
431} 431}
432 432
433static void __ide_requeue_and_plug(struct request_queue *q, struct request *rq)
434{
435 if (rq)
436 blk_requeue_request(q, rq);
437 if (rq || blk_peek_request(q)) {
438 /* Use 3ms as that was the old plug delay */
439 blk_delay_queue(q, 3);
440 }
441}
442
443void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
444{
445 struct request_queue *q = drive->queue;
446 unsigned long flags;
447
448 spin_lock_irqsave(q->queue_lock, flags);
449 __ide_requeue_and_plug(q, rq);
450 spin_unlock_irqrestore(q->queue_lock, flags);
451}
452
433/* 453/*
434 * Issue a new request to a device. 454 * Issue a new request to a device.
435 */ 455 */
@@ -550,28 +570,7 @@ plug_device:
550 ide_unlock_host(host); 570 ide_unlock_host(host);
551plug_device_2: 571plug_device_2:
552 spin_lock_irq(q->queue_lock); 572 spin_lock_irq(q->queue_lock);
553 573 __ide_requeue_and_plug(q, rq);
554 if (rq) {
555 blk_requeue_request(q, rq);
556 blk_delay_queue(q, queue_run_ms);
557 }
558}
559
560void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq)
561{
562 struct request_queue *q = drive->queue;
563 unsigned long flags;
564
565 spin_lock_irqsave(q->queue_lock, flags);
566
567 if (rq)
568 blk_requeue_request(q, rq);
569
570 spin_unlock_irqrestore(q->queue_lock, flags);
571
572 /* Use 3ms as that was the old plug delay */
573 if (rq)
574 blk_delay_queue(q, 3);
575} 574}
576 575
577static int drive_is_ready(ide_drive_t *drive) 576static int drive_is_ready(ide_drive_t *drive)
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index bee03d64c453..d712dffd2157 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -69,7 +69,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id)
69 u8 sts, val; 69 u8 sts, val;
70 70
71 sts = readb(kbd->io_base + STATUS_REG); 71 sts = readb(kbd->io_base + STATUS_REG);
72 if (sts & DATA_AVAIL) 72 if (!(sts & DATA_AVAIL))
73 return IRQ_NONE; 73 return IRQ_NONE;
74 74
75 if (kbd->last_key != KEY_RESERVED) { 75 if (kbd->last_key != KEY_RESERVED) {
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 364bdf43a381..736056897e50 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -302,10 +302,14 @@ static int uinput_validate_absbits(struct input_dev *dev)
302 int retval = 0; 302 int retval = 0;
303 303
304 for (cnt = 0; cnt < ABS_CNT; cnt++) { 304 for (cnt = 0; cnt < ABS_CNT; cnt++) {
305 int min, max;
305 if (!test_bit(cnt, dev->absbit)) 306 if (!test_bit(cnt, dev->absbit))
306 continue; 307 continue;
307 308
308 if (input_abs_get_max(dev, cnt) <= input_abs_get_min(dev, cnt)) { 309 min = input_abs_get_min(dev, cnt);
310 max = input_abs_get_max(dev, cnt);
311
312 if ((min != 0 || max != 0) && max <= min) {
309 printk(KERN_DEBUG 313 printk(KERN_DEBUG
310 "%s: invalid abs[%02x] min:%d max:%d\n", 314 "%s: invalid abs[%02x] min:%d max:%d\n",
311 UINPUT_NAME, cnt, 315 UINPUT_NAME, cnt,
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index aa186cf6c514..e06e045bf907 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -836,8 +836,8 @@ static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
836 }, 836 },
837 837
838 }, 838 },
839 { }
840#endif 839#endif
840 { }
841}; 841};
842 842
843static bool broken_olpc_ec; 843static bool broken_olpc_ec;
@@ -851,8 +851,8 @@ static const struct dmi_system_id __initconst olpc_dmi_table[] = {
851 DMI_MATCH(DMI_PRODUCT_NAME, "XO"), 851 DMI_MATCH(DMI_PRODUCT_NAME, "XO"),
852 }, 852 },
853 }, 853 },
854 { }
855#endif 854#endif
855 { }
856}; 856};
857 857
858void __init synaptics_module_init(void) 858void __init synaptics_module_init(void)
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index ac4c93689ab9..d37a48e099d0 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -869,15 +869,15 @@ static int i8042_controller_selftest(void)
869 do { 869 do {
870 870
871 if (i8042_command(&param, I8042_CMD_CTL_TEST)) { 871 if (i8042_command(&param, I8042_CMD_CTL_TEST)) {
872 pr_err("i8042 controller self test timeout\n"); 872 pr_err("i8042 controller selftest timeout\n");
873 return -ENODEV; 873 return -ENODEV;
874 } 874 }
875 875
876 if (param == I8042_RET_CTL_TEST) 876 if (param == I8042_RET_CTL_TEST)
877 return 0; 877 return 0;
878 878
879 pr_err("i8042 controller selftest failed. (%#x != %#x)\n", 879 dbg("i8042 controller selftest: %#x != %#x\n",
880 param, I8042_RET_CTL_TEST); 880 param, I8042_RET_CTL_TEST);
881 msleep(50); 881 msleep(50);
882 } while (i++ < 5); 882 } while (i++ < 5);
883 883
@@ -891,6 +891,7 @@ static int i8042_controller_selftest(void)
891 pr_info("giving up on controller selftest, continuing anyway...\n"); 891 pr_info("giving up on controller selftest, continuing anyway...\n");
892 return 0; 892 return 0;
893#else 893#else
894 pr_err("i8042 controller selftest failed\n");
894 return -EIO; 895 return -EIO;
895#endif 896#endif
896} 897}
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c
index 9da6fbcaaa7e..7ec3c97dc1b9 100644
--- a/drivers/input/serio/rpckbd.c
+++ b/drivers/input/serio/rpckbd.c
@@ -90,7 +90,7 @@ static int rpckbd_open(struct serio *port)
90 90
91 if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", port) != 0) { 91 if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", port) != 0) {
92 printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n"); 92 printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n");
93 free_irq(IRQ_KEYBOARDRX, NULL); 93 free_irq(IRQ_KEYBOARDRX, port);
94 return -EBUSY; 94 return -EBUSY;
95 } 95 }
96 96
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 337bf51bc984..fdb6a3976f94 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -208,6 +208,12 @@ int sparse_keymap_setup(struct input_dev *dev,
208 } 208 }
209 } 209 }
210 210
211 if (test_bit(EV_KEY, dev->evbit)) {
212 __set_bit(KEY_UNKNOWN, dev->keybit);
213 __set_bit(EV_MSC, dev->evbit);
214 __set_bit(MSC_SCAN, dev->mscbit);
215 }
216
211 dev->keycode = map; 217 dev->keycode = map;
212 dev->keycodemax = map_size; 218 dev->keycodemax = map_size;
213 dev->getkeycode = sparse_keymap_getkeycode; 219 dev->getkeycode = sparse_keymap_getkeycode;
@@ -268,6 +274,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k
268{ 274{
269 switch (ke->type) { 275 switch (ke->type) {
270 case KE_KEY: 276 case KE_KEY:
277 input_event(dev, EV_MSC, MSC_SCAN, ke->code);
271 input_report_key(dev, ke->keycode, value); 278 input_report_key(dev, ke->keycode, value);
272 input_sync(dev); 279 input_sync(dev);
273 if (value && autorelease) { 280 if (value && autorelease) {
@@ -305,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
305{ 312{
306 const struct key_entry *ke = 313 const struct key_entry *ke =
307 sparse_keymap_entry_from_scancode(dev, code); 314 sparse_keymap_entry_from_scancode(dev, code);
315 struct key_entry unknown_ke;
308 316
309 if (ke) { 317 if (ke) {
310 sparse_keymap_report_entry(dev, ke, value, autorelease); 318 sparse_keymap_report_entry(dev, ke, value, autorelease);
311 return true; 319 return true;
312 } 320 }
313 321
322 /* Report an unknown key event as a debugging aid */
323 unknown_ke.type = KE_KEY;
324 unknown_ke.code = code;
325 unknown_ke.keycode = KEY_UNKNOWN;
326 sparse_keymap_report_entry(dev, &unknown_ke, value, true);
327
314 return false; 328 return false;
315} 329}
316EXPORT_SYMBOL(sparse_keymap_report_event); 330EXPORT_SYMBOL(sparse_keymap_report_event);
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 5597637cfd41..08ba5ad9c9be 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -16,6 +16,14 @@
16#include "wacom.h" 16#include "wacom.h"
17#include <linux/input/mt.h> 17#include <linux/input/mt.h>
18 18
19/* resolution for penabled devices */
20#define WACOM_PL_RES 20
21#define WACOM_PENPRTN_RES 40
22#define WACOM_VOLITO_RES 50
23#define WACOM_GRAPHIRE_RES 80
24#define WACOM_INTUOS_RES 100
25#define WACOM_INTUOS3_RES 200
26
19static int wacom_penpartner_irq(struct wacom_wac *wacom) 27static int wacom_penpartner_irq(struct wacom_wac *wacom)
20{ 28{
21 unsigned char *data = wacom->data; 29 unsigned char *data = wacom->data;
@@ -1055,6 +1063,19 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1055 input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max, 1063 input_set_abs_params(input_dev, ABS_PRESSURE, 0, features->pressure_max,
1056 features->pressure_fuzz, 0); 1064 features->pressure_fuzz, 0);
1057 1065
1066 if (features->device_type == BTN_TOOL_PEN) {
1067 /* penabled devices have fixed resolution for each model */
1068 input_abs_set_res(input_dev, ABS_X, features->x_resolution);
1069 input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
1070 } else {
1071 input_abs_set_res(input_dev, ABS_X,
1072 wacom_calculate_touch_res(features->x_max,
1073 features->x_phy));
1074 input_abs_set_res(input_dev, ABS_Y,
1075 wacom_calculate_touch_res(features->y_max,
1076 features->y_phy));
1077 }
1078
1058 __set_bit(ABS_MISC, input_dev->absbit); 1079 __set_bit(ABS_MISC, input_dev->absbit);
1059 1080
1060 switch (wacom_wac->features.type) { 1081 switch (wacom_wac->features.type) {
@@ -1171,15 +1192,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1171 case TABLETPC: 1192 case TABLETPC:
1172 __clear_bit(ABS_MISC, input_dev->absbit); 1193 __clear_bit(ABS_MISC, input_dev->absbit);
1173 1194
1174 if (features->device_type != BTN_TOOL_PEN) { 1195 if (features->device_type != BTN_TOOL_PEN)
1175 input_abs_set_res(input_dev, ABS_X,
1176 wacom_calculate_touch_res(features->x_max,
1177 features->x_phy));
1178 input_abs_set_res(input_dev, ABS_Y,
1179 wacom_calculate_touch_res(features->y_max,
1180 features->y_phy));
1181 break; /* no need to process stylus stuff */ 1196 break; /* no need to process stylus stuff */
1182 } 1197
1183 /* fall through */ 1198 /* fall through */
1184 1199
1185 case PL: 1200 case PL:
@@ -1216,12 +1231,6 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1216 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1231 input_set_abs_params(input_dev, ABS_MT_PRESSURE,
1217 0, features->pressure_max, 1232 0, features->pressure_max,
1218 features->pressure_fuzz, 0); 1233 features->pressure_fuzz, 0);
1219 input_abs_set_res(input_dev, ABS_X,
1220 wacom_calculate_touch_res(features->x_max,
1221 features->x_phy));
1222 input_abs_set_res(input_dev, ABS_Y,
1223 wacom_calculate_touch_res(features->y_max,
1224 features->y_phy));
1225 } else if (features->device_type == BTN_TOOL_PEN) { 1234 } else if (features->device_type == BTN_TOOL_PEN) {
1226 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 1235 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1227 __set_bit(BTN_TOOL_PEN, input_dev->keybit); 1236 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -1233,161 +1242,242 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1233} 1242}
1234 1243
1235static const struct wacom_features wacom_features_0x00 = 1244static const struct wacom_features wacom_features_0x00 =
1236 { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }; 1245 { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
1246 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
1237static const struct wacom_features wacom_features_0x10 = 1247static const struct wacom_features wacom_features_0x10 =
1238 { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; 1248 { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
1249 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1239static const struct wacom_features wacom_features_0x11 = 1250static const struct wacom_features wacom_features_0x11 =
1240 { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; 1251 { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
1252 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1241static const struct wacom_features wacom_features_0x12 = 1253static const struct wacom_features wacom_features_0x12 =
1242 { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }; 1254 { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511,
1255 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1243static const struct wacom_features wacom_features_0x13 = 1256static const struct wacom_features wacom_features_0x13 =
1244 { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }; 1257 { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
1258 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1245static const struct wacom_features wacom_features_0x14 = 1259static const struct wacom_features wacom_features_0x14 =
1246 { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; 1260 { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1261 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1247static const struct wacom_features wacom_features_0x15 = 1262static const struct wacom_features wacom_features_0x15 =
1248 { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }; 1263 { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
1264 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1249static const struct wacom_features wacom_features_0x16 = 1265static const struct wacom_features wacom_features_0x16 =
1250 { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }; 1266 { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1267 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1251static const struct wacom_features wacom_features_0x17 = 1268static const struct wacom_features wacom_features_0x17 =
1252 { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; 1269 { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
1270 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1253static const struct wacom_features wacom_features_0x18 = 1271static const struct wacom_features wacom_features_0x18 =
1254 { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }; 1272 { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511,
1273 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1255static const struct wacom_features wacom_features_0x19 = 1274static const struct wacom_features wacom_features_0x19 =
1256 { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; 1275 { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1276 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1257static const struct wacom_features wacom_features_0x60 = 1277static const struct wacom_features wacom_features_0x60 =
1258 { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; 1278 { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1279 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1259static const struct wacom_features wacom_features_0x61 = 1280static const struct wacom_features wacom_features_0x61 =
1260 { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }; 1281 { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255,
1282 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1261static const struct wacom_features wacom_features_0x62 = 1283static const struct wacom_features wacom_features_0x62 =
1262 { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; 1284 { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1285 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1263static const struct wacom_features wacom_features_0x63 = 1286static const struct wacom_features wacom_features_0x63 =
1264 { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }; 1287 { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511,
1288 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1265static const struct wacom_features wacom_features_0x64 = 1289static const struct wacom_features wacom_features_0x64 =
1266 { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }; 1290 { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511,
1291 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1267static const struct wacom_features wacom_features_0x65 = 1292static const struct wacom_features wacom_features_0x65 =
1268 { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; 1293 { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
1294 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1269static const struct wacom_features wacom_features_0x69 = 1295static const struct wacom_features wacom_features_0x69 =
1270 { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; 1296 { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1297 63, GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
1271static const struct wacom_features wacom_features_0x20 = 1298static const struct wacom_features wacom_features_0x20 =
1272 { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; 1299 { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
1300 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1273static const struct wacom_features wacom_features_0x21 = 1301static const struct wacom_features wacom_features_0x21 =
1274 { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1302 { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1303 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1275static const struct wacom_features wacom_features_0x22 = 1304static const struct wacom_features wacom_features_0x22 =
1276 { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; 1305 { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
1306 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1277static const struct wacom_features wacom_features_0x23 = 1307static const struct wacom_features wacom_features_0x23 =
1278 { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; 1308 { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
1309 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1279static const struct wacom_features wacom_features_0x24 = 1310static const struct wacom_features wacom_features_0x24 =
1280 { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; 1311 { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
1312 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1281static const struct wacom_features wacom_features_0x30 = 1313static const struct wacom_features wacom_features_0x30 =
1282 { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }; 1314 { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255,
1315 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1283static const struct wacom_features wacom_features_0x31 = 1316static const struct wacom_features wacom_features_0x31 =
1284 { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }; 1317 { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255,
1318 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1285static const struct wacom_features wacom_features_0x32 = 1319static const struct wacom_features wacom_features_0x32 =
1286 { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }; 1320 { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255,
1321 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1287static const struct wacom_features wacom_features_0x33 = 1322static const struct wacom_features wacom_features_0x33 =
1288 { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }; 1323 { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255,
1324 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1289static const struct wacom_features wacom_features_0x34 = 1325static const struct wacom_features wacom_features_0x34 =
1290 { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }; 1326 { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511,
1327 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1291static const struct wacom_features wacom_features_0x35 = 1328static const struct wacom_features wacom_features_0x35 =
1292 { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }; 1329 { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511,
1330 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1293static const struct wacom_features wacom_features_0x37 = 1331static const struct wacom_features wacom_features_0x37 =
1294 { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }; 1332 { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511,
1333 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1295static const struct wacom_features wacom_features_0x38 = 1334static const struct wacom_features wacom_features_0x38 =
1296 { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; 1335 { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
1336 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1297static const struct wacom_features wacom_features_0x39 = 1337static const struct wacom_features wacom_features_0x39 =
1298 { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }; 1338 { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511,
1339 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1299static const struct wacom_features wacom_features_0xC4 = 1340static const struct wacom_features wacom_features_0xC4 =
1300 { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; 1341 { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
1342 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1301static const struct wacom_features wacom_features_0xC0 = 1343static const struct wacom_features wacom_features_0xC0 =
1302 { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; 1344 { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
1345 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1303static const struct wacom_features wacom_features_0xC2 = 1346static const struct wacom_features wacom_features_0xC2 =
1304 { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; 1347 { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
1348 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1305static const struct wacom_features wacom_features_0x03 = 1349static const struct wacom_features wacom_features_0x03 =
1306 { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }; 1350 { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511,
1351 0, PTU, WACOM_PL_RES, WACOM_PL_RES };
1307static const struct wacom_features wacom_features_0x41 = 1352static const struct wacom_features wacom_features_0x41 =
1308 { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; 1353 { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
1354 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1309static const struct wacom_features wacom_features_0x42 = 1355static const struct wacom_features wacom_features_0x42 =
1310 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1356 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1357 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1311static const struct wacom_features wacom_features_0x43 = 1358static const struct wacom_features wacom_features_0x43 =
1312 { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; 1359 { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
1360 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1313static const struct wacom_features wacom_features_0x44 = 1361static const struct wacom_features wacom_features_0x44 =
1314 { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; 1362 { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
1363 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1315static const struct wacom_features wacom_features_0x45 = 1364static const struct wacom_features wacom_features_0x45 =
1316 { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; 1365 { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
1366 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1317static const struct wacom_features wacom_features_0xB0 = 1367static const struct wacom_features wacom_features_0xB0 =
1318 { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }; 1368 { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023,
1369 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1319static const struct wacom_features wacom_features_0xB1 = 1370static const struct wacom_features wacom_features_0xB1 =
1320 { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }; 1371 { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023,
1372 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1321static const struct wacom_features wacom_features_0xB2 = 1373static const struct wacom_features wacom_features_0xB2 =
1322 { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }; 1374 { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023,
1375 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1323static const struct wacom_features wacom_features_0xB3 = 1376static const struct wacom_features wacom_features_0xB3 =
1324 { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }; 1377 { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023,
1378 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1325static const struct wacom_features wacom_features_0xB4 = 1379static const struct wacom_features wacom_features_0xB4 =
1326 { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }; 1380 { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023,
1381 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1327static const struct wacom_features wacom_features_0xB5 = 1382static const struct wacom_features wacom_features_0xB5 =
1328 { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }; 1383 { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023,
1384 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1329static const struct wacom_features wacom_features_0xB7 = 1385static const struct wacom_features wacom_features_0xB7 =
1330 { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }; 1386 { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023,
1387 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1331static const struct wacom_features wacom_features_0xB8 = 1388static const struct wacom_features wacom_features_0xB8 =
1332 { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }; 1389 { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
1390 63, INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1333static const struct wacom_features wacom_features_0xB9 = 1391static const struct wacom_features wacom_features_0xB9 =
1334 { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }; 1392 { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
1393 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1335static const struct wacom_features wacom_features_0xBA = 1394static const struct wacom_features wacom_features_0xBA =
1336 { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; 1395 { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
1396 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1337static const struct wacom_features wacom_features_0xBB = 1397static const struct wacom_features wacom_features_0xBB =
1338 { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; 1398 { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047,
1399 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1339static const struct wacom_features wacom_features_0xBC = 1400static const struct wacom_features wacom_features_0xBC =
1340 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047, 63, INTUOS4 }; 1401 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40840, 25400, 2047,
1402 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1341static const struct wacom_features wacom_features_0x3F = 1403static const struct wacom_features wacom_features_0x3F =
1342 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; 1404 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023,
1405 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1343static const struct wacom_features wacom_features_0xC5 = 1406static const struct wacom_features wacom_features_0xC5 =
1344 { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }; 1407 { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023,
1408 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1345static const struct wacom_features wacom_features_0xC6 = 1409static const struct wacom_features wacom_features_0xC6 =
1346 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; 1410 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023,
1411 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1347static const struct wacom_features wacom_features_0xC7 = 1412static const struct wacom_features wacom_features_0xC7 =
1348 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; 1413 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511,
1414 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1349static const struct wacom_features wacom_features_0xCE = 1415static const struct wacom_features wacom_features_0xCE =
1350 { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511, 0, DTU }; 1416 { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511,
1417 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1351static const struct wacom_features wacom_features_0xF0 = 1418static const struct wacom_features wacom_features_0xF0 =
1352 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, 0, DTU }; 1419 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511,
1420 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1353static const struct wacom_features wacom_features_0xCC = 1421static const struct wacom_features wacom_features_0xCC =
1354 { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047, 63, WACOM_21UX2 }; 1422 { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87200, 65600, 2047,
1423 63, WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1355static const struct wacom_features wacom_features_0x90 = 1424static const struct wacom_features wacom_features_0x90 =
1356 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1425 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1426 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1357static const struct wacom_features wacom_features_0x93 = 1427static const struct wacom_features wacom_features_0x93 =
1358 { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1428 { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1429 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1359static const struct wacom_features wacom_features_0x9A = 1430static const struct wacom_features wacom_features_0x9A =
1360 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1431 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1432 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1361static const struct wacom_features wacom_features_0x9F = 1433static const struct wacom_features wacom_features_0x9F =
1362 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; 1434 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
1435 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1363static const struct wacom_features wacom_features_0xE2 = 1436static const struct wacom_features wacom_features_0xE2 =
1364 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 1437 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
1438 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1365static const struct wacom_features wacom_features_0xE3 = 1439static const struct wacom_features wacom_features_0xE3 =
1366 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; 1440 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
1441 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1442static const struct wacom_features wacom_features_0xE6 =
1443 { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255,
1444 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1367static const struct wacom_features wacom_features_0x47 = 1445static const struct wacom_features wacom_features_0x47 =
1368 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; 1446 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1369static struct wacom_features wacom_features_0xD0 = 1447 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1370 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1448static const struct wacom_features wacom_features_0xD0 =
1371static struct wacom_features wacom_features_0xD1 = 1449 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1372 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1450 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1373static struct wacom_features wacom_features_0xD2 = 1451static const struct wacom_features wacom_features_0xD1 =
1374 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1452 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1375static struct wacom_features wacom_features_0xD3 = 1453 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1376 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1454static const struct wacom_features wacom_features_0xD2 =
1455 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1456 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1457static const struct wacom_features wacom_features_0xD3 =
1458 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1459 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1377static const struct wacom_features wacom_features_0xD4 = 1460static const struct wacom_features wacom_features_0xD4 =
1378 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255, 63, BAMBOO_PT }; 1461 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 255,
1379static struct wacom_features wacom_features_0xD6 = 1462 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1380 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1463static const struct wacom_features wacom_features_0xD6 =
1381static struct wacom_features wacom_features_0xD7 = 1464 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1382 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1465 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1383static struct wacom_features wacom_features_0xD8 = 1466static const struct wacom_features wacom_features_0xD7 =
1384 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1467 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1385static struct wacom_features wacom_features_0xDA = 1468 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1386 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1469static const struct wacom_features wacom_features_0xD8 =
1470 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1471 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1472static const struct wacom_features wacom_features_0xDA =
1473 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
1474 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1387static struct wacom_features wacom_features_0xDB = 1475static struct wacom_features wacom_features_0xDB =
1388 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1476 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023,
1477 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1389static const struct wacom_features wacom_features_0x6004 = 1478static const struct wacom_features wacom_features_0x6004 =
1390 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 0, TABLETPC }; 1479 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
1480 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1391 1481
1392#define USB_DEVICE_WACOM(prod) \ 1482#define USB_DEVICE_WACOM(prod) \
1393 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ 1483 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
@@ -1474,6 +1564,7 @@ const struct usb_device_id wacom_ids[] = {
1474 { USB_DEVICE_WACOM(0x9F) }, 1564 { USB_DEVICE_WACOM(0x9F) },
1475 { USB_DEVICE_WACOM(0xE2) }, 1565 { USB_DEVICE_WACOM(0xE2) },
1476 { USB_DEVICE_WACOM(0xE3) }, 1566 { USB_DEVICE_WACOM(0xE3) },
1567 { USB_DEVICE_WACOM(0xE6) },
1477 { USB_DEVICE_WACOM(0x47) }, 1568 { USB_DEVICE_WACOM(0x47) },
1478 { USB_DEVICE_LENOVO(0x6004) }, 1569 { USB_DEVICE_LENOVO(0x6004) },
1479 { } 1570 { }
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 835f756b150c..53eb71b68330 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -74,6 +74,8 @@ struct wacom_features {
74 int pressure_max; 74 int pressure_max;
75 int distance_max; 75 int distance_max;
76 int type; 76 int type;
77 int x_resolution;
78 int y_resolution;
77 int device_type; 79 int device_type;
78 int x_phy; 80 int x_phy;
79 int y_phy; 81 int y_phy;
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index b4d7f63deff1..efa06882de00 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -62,7 +62,7 @@ MODULE_LICENSE("GPL");
62 Programmer has no control over these numbers. 62 Programmer has no control over these numbers.
63 TODO there are holes - specifically 1,7,0x0a 63 TODO there are holes - specifically 1,7,0x0a
64*/ 64*/
65#define VERSION_ID 0 /* Get Version (request/respose) */ 65#define VERSION_ID 0 /* Get Version (request/response) */
66#define KEYBD_ID 2 /* Keyboard (event) */ 66#define KEYBD_ID 2 /* Keyboard (event) */
67#define TOUCHS_ID 3 /* Touch Screen (event)*/ 67#define TOUCHS_ID 3 /* Touch Screen (event)*/
68#define EEPROM_READ_ID 4 /* (request/response) */ 68#define EEPROM_READ_ID 4 /* (request/response) */
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index d25df48b437b..bb8b722a9783 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -153,7 +153,7 @@ static struct i2c_adapter * u3_0;
153static struct i2c_adapter * u3_1; 153static struct i2c_adapter * u3_1;
154static struct i2c_adapter * k2; 154static struct i2c_adapter * k2;
155static struct i2c_client * fcu; 155static struct i2c_client * fcu;
156static struct cpu_pid_state cpu_state[2]; 156static struct cpu_pid_state processor_state[2];
157static struct basckside_pid_params backside_params; 157static struct basckside_pid_params backside_params;
158static struct backside_pid_state backside_state; 158static struct backside_pid_state backside_state;
159static struct drives_pid_state drives_state; 159static struct drives_pid_state drives_state;
@@ -664,8 +664,8 @@ static int read_eeprom(int cpu, struct mpu_data *out)
664 664
665static void fetch_cpu_pumps_minmax(void) 665static void fetch_cpu_pumps_minmax(void)
666{ 666{
667 struct cpu_pid_state *state0 = &cpu_state[0]; 667 struct cpu_pid_state *state0 = &processor_state[0];
668 struct cpu_pid_state *state1 = &cpu_state[1]; 668 struct cpu_pid_state *state1 = &processor_state[1];
669 u16 pump_min = 0, pump_max = 0xffff; 669 u16 pump_min = 0, pump_max = 0xffff;
670 u16 tmp[4]; 670 u16 tmp[4];
671 671
@@ -717,17 +717,17 @@ static ssize_t show_##name(struct device *dev, struct device_attribute *attr, ch
717 return sprintf(buf, "%d", data); \ 717 return sprintf(buf, "%d", data); \
718} 718}
719 719
720BUILD_SHOW_FUNC_FIX(cpu0_temperature, cpu_state[0].last_temp) 720BUILD_SHOW_FUNC_FIX(cpu0_temperature, processor_state[0].last_temp)
721BUILD_SHOW_FUNC_FIX(cpu0_voltage, cpu_state[0].voltage) 721BUILD_SHOW_FUNC_FIX(cpu0_voltage, processor_state[0].voltage)
722BUILD_SHOW_FUNC_FIX(cpu0_current, cpu_state[0].current_a) 722BUILD_SHOW_FUNC_FIX(cpu0_current, processor_state[0].current_a)
723BUILD_SHOW_FUNC_INT(cpu0_exhaust_fan_rpm, cpu_state[0].rpm) 723BUILD_SHOW_FUNC_INT(cpu0_exhaust_fan_rpm, processor_state[0].rpm)
724BUILD_SHOW_FUNC_INT(cpu0_intake_fan_rpm, cpu_state[0].intake_rpm) 724BUILD_SHOW_FUNC_INT(cpu0_intake_fan_rpm, processor_state[0].intake_rpm)
725 725
726BUILD_SHOW_FUNC_FIX(cpu1_temperature, cpu_state[1].last_temp) 726BUILD_SHOW_FUNC_FIX(cpu1_temperature, processor_state[1].last_temp)
727BUILD_SHOW_FUNC_FIX(cpu1_voltage, cpu_state[1].voltage) 727BUILD_SHOW_FUNC_FIX(cpu1_voltage, processor_state[1].voltage)
728BUILD_SHOW_FUNC_FIX(cpu1_current, cpu_state[1].current_a) 728BUILD_SHOW_FUNC_FIX(cpu1_current, processor_state[1].current_a)
729BUILD_SHOW_FUNC_INT(cpu1_exhaust_fan_rpm, cpu_state[1].rpm) 729BUILD_SHOW_FUNC_INT(cpu1_exhaust_fan_rpm, processor_state[1].rpm)
730BUILD_SHOW_FUNC_INT(cpu1_intake_fan_rpm, cpu_state[1].intake_rpm) 730BUILD_SHOW_FUNC_INT(cpu1_intake_fan_rpm, processor_state[1].intake_rpm)
731 731
732BUILD_SHOW_FUNC_FIX(backside_temperature, backside_state.last_temp) 732BUILD_SHOW_FUNC_FIX(backside_temperature, backside_state.last_temp)
733BUILD_SHOW_FUNC_INT(backside_fan_pwm, backside_state.pwm) 733BUILD_SHOW_FUNC_INT(backside_fan_pwm, backside_state.pwm)
@@ -919,8 +919,8 @@ static void do_cpu_pid(struct cpu_pid_state *state, s32 temp, s32 power)
919 919
920static void do_monitor_cpu_combined(void) 920static void do_monitor_cpu_combined(void)
921{ 921{
922 struct cpu_pid_state *state0 = &cpu_state[0]; 922 struct cpu_pid_state *state0 = &processor_state[0];
923 struct cpu_pid_state *state1 = &cpu_state[1]; 923 struct cpu_pid_state *state1 = &processor_state[1];
924 s32 temp0, power0, temp1, power1; 924 s32 temp0, power0, temp1, power1;
925 s32 temp_combi, power_combi; 925 s32 temp_combi, power_combi;
926 int rc, intake, pump; 926 int rc, intake, pump;
@@ -1150,7 +1150,7 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state)
1150/* 1150/*
1151 * Initialize the state structure for one CPU control loop 1151 * Initialize the state structure for one CPU control loop
1152 */ 1152 */
1153static int init_cpu_state(struct cpu_pid_state *state, int index) 1153static int init_processor_state(struct cpu_pid_state *state, int index)
1154{ 1154{
1155 int err; 1155 int err;
1156 1156
@@ -1205,7 +1205,7 @@ static int init_cpu_state(struct cpu_pid_state *state, int index)
1205/* 1205/*
1206 * Dispose of the state data for one CPU control loop 1206 * Dispose of the state data for one CPU control loop
1207 */ 1207 */
1208static void dispose_cpu_state(struct cpu_pid_state *state) 1208static void dispose_processor_state(struct cpu_pid_state *state)
1209{ 1209{
1210 if (state->monitor == NULL) 1210 if (state->monitor == NULL)
1211 return; 1211 return;
@@ -1804,9 +1804,9 @@ static int main_control_loop(void *x)
1804 set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); 1804 set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM);
1805 1805
1806 /* Initialize ADCs */ 1806 /* Initialize ADCs */
1807 initialize_adc(&cpu_state[0]); 1807 initialize_adc(&processor_state[0]);
1808 if (cpu_state[1].monitor != NULL) 1808 if (processor_state[1].monitor != NULL)
1809 initialize_adc(&cpu_state[1]); 1809 initialize_adc(&processor_state[1]);
1810 1810
1811 fcu_tickle_ticks = FCU_TICKLE_TICKS; 1811 fcu_tickle_ticks = FCU_TICKLE_TICKS;
1812 1812
@@ -1833,14 +1833,14 @@ static int main_control_loop(void *x)
1833 if (cpu_pid_type == CPU_PID_TYPE_COMBINED) 1833 if (cpu_pid_type == CPU_PID_TYPE_COMBINED)
1834 do_monitor_cpu_combined(); 1834 do_monitor_cpu_combined();
1835 else if (cpu_pid_type == CPU_PID_TYPE_RACKMAC) { 1835 else if (cpu_pid_type == CPU_PID_TYPE_RACKMAC) {
1836 do_monitor_cpu_rack(&cpu_state[0]); 1836 do_monitor_cpu_rack(&processor_state[0]);
1837 if (cpu_state[1].monitor != NULL) 1837 if (processor_state[1].monitor != NULL)
1838 do_monitor_cpu_rack(&cpu_state[1]); 1838 do_monitor_cpu_rack(&processor_state[1]);
1839 // better deal with UP 1839 // better deal with UP
1840 } else { 1840 } else {
1841 do_monitor_cpu_split(&cpu_state[0]); 1841 do_monitor_cpu_split(&processor_state[0]);
1842 if (cpu_state[1].monitor != NULL) 1842 if (processor_state[1].monitor != NULL)
1843 do_monitor_cpu_split(&cpu_state[1]); 1843 do_monitor_cpu_split(&processor_state[1]);
1844 // better deal with UP 1844 // better deal with UP
1845 } 1845 }
1846 /* Then, the rest */ 1846 /* Then, the rest */
@@ -1885,8 +1885,8 @@ static int main_control_loop(void *x)
1885 */ 1885 */
1886static void dispose_control_loops(void) 1886static void dispose_control_loops(void)
1887{ 1887{
1888 dispose_cpu_state(&cpu_state[0]); 1888 dispose_processor_state(&processor_state[0]);
1889 dispose_cpu_state(&cpu_state[1]); 1889 dispose_processor_state(&processor_state[1]);
1890 dispose_backside_state(&backside_state); 1890 dispose_backside_state(&backside_state);
1891 dispose_drives_state(&drives_state); 1891 dispose_drives_state(&drives_state);
1892 dispose_slots_state(&slots_state); 1892 dispose_slots_state(&slots_state);
@@ -1928,12 +1928,12 @@ static int create_control_loops(void)
1928 /* Create control loops for everything. If any fail, everything 1928 /* Create control loops for everything. If any fail, everything
1929 * fails 1929 * fails
1930 */ 1930 */
1931 if (init_cpu_state(&cpu_state[0], 0)) 1931 if (init_processor_state(&processor_state[0], 0))
1932 goto fail; 1932 goto fail;
1933 if (cpu_pid_type == CPU_PID_TYPE_COMBINED) 1933 if (cpu_pid_type == CPU_PID_TYPE_COMBINED)
1934 fetch_cpu_pumps_minmax(); 1934 fetch_cpu_pumps_minmax();
1935 1935
1936 if (cpu_count > 1 && init_cpu_state(&cpu_state[1], 1)) 1936 if (cpu_count > 1 && init_processor_state(&processor_state[1], 1))
1937 goto fail; 1937 goto fail;
1938 if (init_backside_state(&backside_state)) 1938 if (init_backside_state(&backside_state))
1939 goto fail; 1939 goto fail;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 416d4e258df6..cb8380c9767f 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -927,20 +927,80 @@ static int dm_table_build_index(struct dm_table *t)
927} 927}
928 928
929/* 929/*
930 * Get a disk whose integrity profile reflects the table's profile.
931 * If %match_all is true, all devices' profiles must match.
932 * If %match_all is false, all devices must at least have an
933 * allocated integrity profile; but uninitialized is ok.
934 * Returns NULL if integrity support was inconsistent or unavailable.
935 */
936static struct gendisk * dm_table_get_integrity_disk(struct dm_table *t,
937 bool match_all)
938{
939 struct list_head *devices = dm_table_get_devices(t);
940 struct dm_dev_internal *dd = NULL;
941 struct gendisk *prev_disk = NULL, *template_disk = NULL;
942
943 list_for_each_entry(dd, devices, list) {
944 template_disk = dd->dm_dev.bdev->bd_disk;
945 if (!blk_get_integrity(template_disk))
946 goto no_integrity;
947 if (!match_all && !blk_integrity_is_initialized(template_disk))
948 continue; /* skip uninitialized profiles */
949 else if (prev_disk &&
950 blk_integrity_compare(prev_disk, template_disk) < 0)
951 goto no_integrity;
952 prev_disk = template_disk;
953 }
954
955 return template_disk;
956
957no_integrity:
958 if (prev_disk)
959 DMWARN("%s: integrity not set: %s and %s profile mismatch",
960 dm_device_name(t->md),
961 prev_disk->disk_name,
962 template_disk->disk_name);
963 return NULL;
964}
965
966/*
930 * Register the mapped device for blk_integrity support if 967 * Register the mapped device for blk_integrity support if
931 * the underlying devices support it. 968 * the underlying devices have an integrity profile. But all devices
969 * may not have matching profiles (checking all devices isn't reliable
970 * during table load because this table may use other DM device(s) which
971 * must be resumed before they will have an initialized integity profile).
972 * Stacked DM devices force a 2 stage integrity profile validation:
973 * 1 - during load, validate all initialized integrity profiles match
974 * 2 - during resume, validate all integrity profiles match
932 */ 975 */
933static int dm_table_prealloc_integrity(struct dm_table *t, struct mapped_device *md) 976static int dm_table_prealloc_integrity(struct dm_table *t, struct mapped_device *md)
934{ 977{
935 struct list_head *devices = dm_table_get_devices(t); 978 struct gendisk *template_disk = NULL;
936 struct dm_dev_internal *dd;
937 979
938 list_for_each_entry(dd, devices, list) 980 template_disk = dm_table_get_integrity_disk(t, false);
939 if (bdev_get_integrity(dd->dm_dev.bdev)) { 981 if (!template_disk)
940 t->integrity_supported = 1; 982 return 0;
941 return blk_integrity_register(dm_disk(md), NULL);
942 }
943 983
984 if (!blk_integrity_is_initialized(dm_disk(md))) {
985 t->integrity_supported = 1;
986 return blk_integrity_register(dm_disk(md), NULL);
987 }
988
989 /*
990 * If DM device already has an initalized integrity
991 * profile the new profile should not conflict.
992 */
993 if (blk_integrity_is_initialized(template_disk) &&
994 blk_integrity_compare(dm_disk(md), template_disk) < 0) {
995 DMWARN("%s: conflict with existing integrity profile: "
996 "%s profile mismatch",
997 dm_device_name(t->md),
998 template_disk->disk_name);
999 return 1;
1000 }
1001
1002 /* Preserve existing initialized integrity profile */
1003 t->integrity_supported = 1;
944 return 0; 1004 return 0;
945} 1005}
946 1006
@@ -1094,41 +1154,27 @@ combine_limits:
1094 1154
1095/* 1155/*
1096 * Set the integrity profile for this device if all devices used have 1156 * Set the integrity profile for this device if all devices used have
1097 * matching profiles. 1157 * matching profiles. We're quite deep in the resume path but still
1158 * don't know if all devices (particularly DM devices this device
1159 * may be stacked on) have matching profiles. Even if the profiles
1160 * don't match we have no way to fail (to resume) at this point.
1098 */ 1161 */
1099static void dm_table_set_integrity(struct dm_table *t) 1162static void dm_table_set_integrity(struct dm_table *t)
1100{ 1163{
1101 struct list_head *devices = dm_table_get_devices(t); 1164 struct gendisk *template_disk = NULL;
1102 struct dm_dev_internal *prev = NULL, *dd = NULL;
1103 1165
1104 if (!blk_get_integrity(dm_disk(t->md))) 1166 if (!blk_get_integrity(dm_disk(t->md)))
1105 return; 1167 return;
1106 1168
1107 list_for_each_entry(dd, devices, list) { 1169 template_disk = dm_table_get_integrity_disk(t, true);
1108 if (prev && 1170 if (!template_disk &&
1109 blk_integrity_compare(prev->dm_dev.bdev->bd_disk, 1171 blk_integrity_is_initialized(dm_disk(t->md))) {
1110 dd->dm_dev.bdev->bd_disk) < 0) { 1172 DMWARN("%s: device no longer has a valid integrity profile",
1111 DMWARN("%s: integrity not set: %s and %s mismatch", 1173 dm_device_name(t->md));
1112 dm_device_name(t->md), 1174 return;
1113 prev->dm_dev.bdev->bd_disk->disk_name,
1114 dd->dm_dev.bdev->bd_disk->disk_name);
1115 goto no_integrity;
1116 }
1117 prev = dd;
1118 } 1175 }
1119
1120 if (!prev || !bdev_get_integrity(prev->dm_dev.bdev))
1121 goto no_integrity;
1122
1123 blk_integrity_register(dm_disk(t->md), 1176 blk_integrity_register(dm_disk(t->md),
1124 bdev_get_integrity(prev->dm_dev.bdev)); 1177 blk_get_integrity(template_disk));
1125
1126 return;
1127
1128no_integrity:
1129 blk_integrity_register(dm_disk(t->md), NULL);
1130
1131 return;
1132} 1178}
1133 1179
1134void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, 1180void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c
index 26fb9cbd7530..5991ab60303d 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -1494,12 +1494,17 @@ u32 fmc_prepare(struct fmdev *fmdev)
1494 } 1494 }
1495 1495
1496 memset(&fm_st_proto, 0, sizeof(fm_st_proto)); 1496 memset(&fm_st_proto, 0, sizeof(fm_st_proto));
1497 fm_st_proto.type = ST_FM;
1498 fm_st_proto.recv = fm_st_receive; 1497 fm_st_proto.recv = fm_st_receive;
1499 fm_st_proto.match_packet = NULL; 1498 fm_st_proto.match_packet = NULL;
1500 fm_st_proto.reg_complete_cb = fm_st_reg_comp_cb; 1499 fm_st_proto.reg_complete_cb = fm_st_reg_comp_cb;
1501 fm_st_proto.write = NULL; /* TI ST driver will fill write pointer */ 1500 fm_st_proto.write = NULL; /* TI ST driver will fill write pointer */
1502 fm_st_proto.priv_data = fmdev; 1501 fm_st_proto.priv_data = fmdev;
1502 fm_st_proto.chnl_id = 0x08;
1503 fm_st_proto.max_frame_size = 0xff;
1504 fm_st_proto.hdr_len = 1;
1505 fm_st_proto.offset_len_in_hdr = 0;
1506 fm_st_proto.len_size = 1;
1507 fm_st_proto.reserve = 1;
1503 1508
1504 ret = st_register(&fm_st_proto); 1509 ret = st_register(&fm_st_proto);
1505 if (ret == -EINPROGRESS) { 1510 if (ret == -EINPROGRESS) {
@@ -1532,7 +1537,7 @@ u32 fmc_prepare(struct fmdev *fmdev)
1532 g_st_write = fm_st_proto.write; 1537 g_st_write = fm_st_proto.write;
1533 } else { 1538 } else {
1534 fmerr("Failed to get ST write func pointer\n"); 1539 fmerr("Failed to get ST write func pointer\n");
1535 ret = st_unregister(ST_FM); 1540 ret = st_unregister(&fm_st_proto);
1536 if (ret < 0) 1541 if (ret < 0)
1537 fmerr("st_unregister failed %d\n", ret); 1542 fmerr("st_unregister failed %d\n", ret);
1538 return -EAGAIN; 1543 return -EAGAIN;
@@ -1586,6 +1591,7 @@ u32 fmc_prepare(struct fmdev *fmdev)
1586 */ 1591 */
1587u32 fmc_release(struct fmdev *fmdev) 1592u32 fmc_release(struct fmdev *fmdev)
1588{ 1593{
1594 static struct st_proto_s fm_st_proto;
1589 u32 ret; 1595 u32 ret;
1590 1596
1591 if (!test_bit(FM_CORE_READY, &fmdev->flag)) { 1597 if (!test_bit(FM_CORE_READY, &fmdev->flag)) {
@@ -1604,7 +1610,11 @@ u32 fmc_release(struct fmdev *fmdev)
1604 fmdev->resp_comp = NULL; 1610 fmdev->resp_comp = NULL;
1605 fmdev->rx.freq = 0; 1611 fmdev->rx.freq = 0;
1606 1612
1607 ret = st_unregister(ST_FM); 1613 memset(&fm_st_proto, 0, sizeof(fm_st_proto));
1614 fm_st_proto.chnl_id = 0x08;
1615
1616 ret = st_unregister(&fm_st_proto);
1617
1608 if (ret < 0) 1618 if (ret < 0)
1609 fmerr("Failed to de-register FM from ST %d\n", ret); 1619 fmerr("Failed to de-register FM from ST %d\n", ret);
1610 else 1620 else
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index ac0e42b47b2a..accaf6c9789a 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -41,6 +41,7 @@
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42#include <media/rc-core.h> 42#include <media/rc-core.h>
43#include <linux/pci_ids.h> 43#include <linux/pci_ids.h>
44#include <linux/delay.h>
44 45
45#include "ite-cir.h" 46#include "ite-cir.h"
46 47
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index f46ee4546fdc..e3cbf45dc612 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -1996,13 +1996,15 @@ static int atl2_set_eeprom(struct net_device *netdev,
1996 if (!eeprom_buff) 1996 if (!eeprom_buff)
1997 return -ENOMEM; 1997 return -ENOMEM;
1998 1998
1999 ptr = (u32 *)eeprom_buff; 1999 ptr = eeprom_buff;
2000 2000
2001 if (eeprom->offset & 3) { 2001 if (eeprom->offset & 3) {
2002 /* need read/modify/write of first changed EEPROM word */ 2002 /* need read/modify/write of first changed EEPROM word */
2003 /* only the second byte of the word is being modified */ 2003 /* only the second byte of the word is being modified */
2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) 2004 if (!atl2_read_eeprom(hw, first_dword*4, &(eeprom_buff[0]))) {
2005 return -EIO; 2005 ret_val = -EIO;
2006 goto out;
2007 }
2006 ptr++; 2008 ptr++;
2007 } 2009 }
2008 if (((eeprom->offset + eeprom->len) & 3)) { 2010 if (((eeprom->offset + eeprom->len) & 3)) {
@@ -2011,18 +2013,22 @@ static int atl2_set_eeprom(struct net_device *netdev,
2011 * only the first byte of the word is being modified 2013 * only the first byte of the word is being modified
2012 */ 2014 */
2013 if (!atl2_read_eeprom(hw, last_dword * 4, 2015 if (!atl2_read_eeprom(hw, last_dword * 4,
2014 &(eeprom_buff[last_dword - first_dword]))) 2016 &(eeprom_buff[last_dword - first_dword]))) {
2015 return -EIO; 2017 ret_val = -EIO;
2018 goto out;
2019 }
2016 } 2020 }
2017 2021
2018 /* Device's eeprom is always little-endian, word addressable */ 2022 /* Device's eeprom is always little-endian, word addressable */
2019 memcpy(ptr, bytes, eeprom->len); 2023 memcpy(ptr, bytes, eeprom->len);
2020 2024
2021 for (i = 0; i < last_dword - first_dword + 1; i++) { 2025 for (i = 0; i < last_dword - first_dword + 1; i++) {
2022 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) 2026 if (!atl2_write_eeprom(hw, ((first_dword+i)*4), eeprom_buff[i])) {
2023 return -EIO; 2027 ret_val = -EIO;
2028 goto out;
2029 }
2024 } 2030 }
2025 2031 out:
2026 kfree(eeprom_buff); 2032 kfree(eeprom_buff);
2027 return ret_val; 2033 return ret_val;
2028} 2034}
diff --git a/drivers/net/bonding/bond_alb.h b/drivers/net/bonding/bond_alb.h
index b3bc7502868f..86861f08b24d 100644
--- a/drivers/net/bonding/bond_alb.h
+++ b/drivers/net/bonding/bond_alb.h
@@ -74,7 +74,7 @@ struct tlb_client_info {
74 * packets to a Client that the Hash function 74 * packets to a Client that the Hash function
75 * gave this entry index. 75 * gave this entry index.
76 */ 76 */
77 u32 tx_bytes; /* Each Client acumulates the BytesTx that 77 u32 tx_bytes; /* Each Client accumulates the BytesTx that
78 * were tranmitted to it, and after each 78 * were tranmitted to it, and after each
79 * CallBack the LoadHistory is divided 79 * CallBack the LoadHistory is divided
80 * by the balance interval 80 * by the balance interval
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index fc896854e282..f504b262ba36 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -75,15 +75,9 @@ static int dongle_id = 0; /* default: probe */
75/* We can't guess the type of connected dongle, user *must* supply it. */ 75/* We can't guess the type of connected dongle, user *must* supply it. */
76module_param(dongle_id, int, 0); 76module_param(dongle_id, int, 0);
77 77
78/* FIXME : we should not need this, because instances should be automatically
79 * managed by the PCI layer. Especially that we seem to only be using the
80 * first entry. Jean II */
81/* Max 4 instances for now */
82static struct via_ircc_cb *dev_self[] = { NULL, NULL, NULL, NULL };
83
84/* Some prototypes */ 78/* Some prototypes */
85static int via_ircc_open(int i, chipio_t * info, unsigned int id); 79static int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
86static int via_ircc_close(struct via_ircc_cb *self); 80 unsigned int id);
87static int via_ircc_dma_receive(struct via_ircc_cb *self); 81static int via_ircc_dma_receive(struct via_ircc_cb *self);
88static int via_ircc_dma_receive_complete(struct via_ircc_cb *self, 82static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
89 int iobase); 83 int iobase);
@@ -215,7 +209,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
215 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0)); 209 pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
216 pci_write_config_byte(pcidev,0x5a,0xc0); 210 pci_write_config_byte(pcidev,0x5a,0xc0);
217 WriteLPCReg(0x28, 0x70 ); 211 WriteLPCReg(0x28, 0x70 );
218 if (via_ircc_open(0, &info,0x3076) == 0) 212 if (via_ircc_open(pcidev, &info, 0x3076) == 0)
219 rc=0; 213 rc=0;
220 } else 214 } else
221 rc = -ENODEV; //IR not turn on 215 rc = -ENODEV; //IR not turn on
@@ -254,7 +248,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
254 info.irq=FirIRQ; 248 info.irq=FirIRQ;
255 info.dma=FirDRQ1; 249 info.dma=FirDRQ1;
256 info.dma2=FirDRQ0; 250 info.dma2=FirDRQ0;
257 if (via_ircc_open(0, &info,0x3096) == 0) 251 if (via_ircc_open(pcidev, &info, 0x3096) == 0)
258 rc=0; 252 rc=0;
259 } else 253 } else
260 rc = -ENODEV; //IR not turn on !!!!! 254 rc = -ENODEV; //IR not turn on !!!!!
@@ -264,48 +258,10 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
264 return rc; 258 return rc;
265} 259}
266 260
267/*
268 * Function via_ircc_clean ()
269 *
270 * Close all configured chips
271 *
272 */
273static void via_ircc_clean(void)
274{
275 int i;
276
277 IRDA_DEBUG(3, "%s()\n", __func__);
278
279 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
280 if (dev_self[i])
281 via_ircc_close(dev_self[i]);
282 }
283}
284
285static void __devexit via_remove_one (struct pci_dev *pdev)
286{
287 IRDA_DEBUG(3, "%s()\n", __func__);
288
289 /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
290 * to get our driver instance and call directly via_ircc_close().
291 * See vlsi_ir for details...
292 * Jean II */
293 via_ircc_clean();
294
295 /* FIXME : This should be in via_ircc_close(), because here we may
296 * theoritically disable still configured devices :-( - Jean II */
297 pci_disable_device(pdev);
298}
299
300static void __exit via_ircc_cleanup(void) 261static void __exit via_ircc_cleanup(void)
301{ 262{
302 IRDA_DEBUG(3, "%s()\n", __func__); 263 IRDA_DEBUG(3, "%s()\n", __func__);
303 264
304 /* FIXME : This should be redundant, as pci_unregister_driver()
305 * should call via_remove_one() on each device.
306 * Jean II */
307 via_ircc_clean();
308
309 /* Cleanup all instances of the driver */ 265 /* Cleanup all instances of the driver */
310 pci_unregister_driver (&via_driver); 266 pci_unregister_driver (&via_driver);
311} 267}
@@ -324,12 +280,13 @@ static const struct net_device_ops via_ircc_fir_ops = {
324}; 280};
325 281
326/* 282/*
327 * Function via_ircc_open (iobase, irq) 283 * Function via_ircc_open(pdev, iobase, irq)
328 * 284 *
329 * Open driver instance 285 * Open driver instance
330 * 286 *
331 */ 287 */
332static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id) 288static __devinit int via_ircc_open(struct pci_dev *pdev, chipio_t * info,
289 unsigned int id)
333{ 290{
334 struct net_device *dev; 291 struct net_device *dev;
335 struct via_ircc_cb *self; 292 struct via_ircc_cb *self;
@@ -337,9 +294,6 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
337 294
338 IRDA_DEBUG(3, "%s()\n", __func__); 295 IRDA_DEBUG(3, "%s()\n", __func__);
339 296
340 if (i >= ARRAY_SIZE(dev_self))
341 return -ENOMEM;
342
343 /* Allocate new instance of the driver */ 297 /* Allocate new instance of the driver */
344 dev = alloc_irdadev(sizeof(struct via_ircc_cb)); 298 dev = alloc_irdadev(sizeof(struct via_ircc_cb));
345 if (dev == NULL) 299 if (dev == NULL)
@@ -349,13 +303,8 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
349 self->netdev = dev; 303 self->netdev = dev;
350 spin_lock_init(&self->lock); 304 spin_lock_init(&self->lock);
351 305
352 /* FIXME : We should store our driver instance in the PCI layer, 306 pci_set_drvdata(pdev, self);
353 * using pci_set_drvdata(), not in this array. 307
354 * See vlsi_ir for details... - Jean II */
355 /* FIXME : 'i' is always 0 (see via_init_one()) :-( - Jean II */
356 /* Need to store self somewhere */
357 dev_self[i] = self;
358 self->index = i;
359 /* Initialize Resource */ 308 /* Initialize Resource */
360 self->io.cfg_base = info->cfg_base; 309 self->io.cfg_base = info->cfg_base;
361 self->io.fir_base = info->fir_base; 310 self->io.fir_base = info->fir_base;
@@ -414,7 +363,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
414 363
415 /* Allocate memory if needed */ 364 /* Allocate memory if needed */
416 self->rx_buff.head = 365 self->rx_buff.head =
417 dma_alloc_coherent(NULL, self->rx_buff.truesize, 366 dma_alloc_coherent(&pdev->dev, self->rx_buff.truesize,
418 &self->rx_buff_dma, GFP_KERNEL); 367 &self->rx_buff_dma, GFP_KERNEL);
419 if (self->rx_buff.head == NULL) { 368 if (self->rx_buff.head == NULL) {
420 err = -ENOMEM; 369 err = -ENOMEM;
@@ -423,7 +372,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
423 memset(self->rx_buff.head, 0, self->rx_buff.truesize); 372 memset(self->rx_buff.head, 0, self->rx_buff.truesize);
424 373
425 self->tx_buff.head = 374 self->tx_buff.head =
426 dma_alloc_coherent(NULL, self->tx_buff.truesize, 375 dma_alloc_coherent(&pdev->dev, self->tx_buff.truesize,
427 &self->tx_buff_dma, GFP_KERNEL); 376 &self->tx_buff_dma, GFP_KERNEL);
428 if (self->tx_buff.head == NULL) { 377 if (self->tx_buff.head == NULL) {
429 err = -ENOMEM; 378 err = -ENOMEM;
@@ -455,33 +404,32 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
455 via_hw_init(self); 404 via_hw_init(self);
456 return 0; 405 return 0;
457 err_out4: 406 err_out4:
458 dma_free_coherent(NULL, self->tx_buff.truesize, 407 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
459 self->tx_buff.head, self->tx_buff_dma); 408 self->tx_buff.head, self->tx_buff_dma);
460 err_out3: 409 err_out3:
461 dma_free_coherent(NULL, self->rx_buff.truesize, 410 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
462 self->rx_buff.head, self->rx_buff_dma); 411 self->rx_buff.head, self->rx_buff_dma);
463 err_out2: 412 err_out2:
464 release_region(self->io.fir_base, self->io.fir_ext); 413 release_region(self->io.fir_base, self->io.fir_ext);
465 err_out1: 414 err_out1:
415 pci_set_drvdata(pdev, NULL);
466 free_netdev(dev); 416 free_netdev(dev);
467 dev_self[i] = NULL;
468 return err; 417 return err;
469} 418}
470 419
471/* 420/*
472 * Function via_ircc_close (self) 421 * Function via_remove_one(pdev)
473 * 422 *
474 * Close driver instance 423 * Close driver instance
475 * 424 *
476 */ 425 */
477static int via_ircc_close(struct via_ircc_cb *self) 426static void __devexit via_remove_one(struct pci_dev *pdev)
478{ 427{
428 struct via_ircc_cb *self = pci_get_drvdata(pdev);
479 int iobase; 429 int iobase;
480 430
481 IRDA_DEBUG(3, "%s()\n", __func__); 431 IRDA_DEBUG(3, "%s()\n", __func__);
482 432
483 IRDA_ASSERT(self != NULL, return -1;);
484
485 iobase = self->io.fir_base; 433 iobase = self->io.fir_base;
486 434
487 ResetChip(iobase, 5); //hardware reset. 435 ResetChip(iobase, 5); //hardware reset.
@@ -493,16 +441,16 @@ static int via_ircc_close(struct via_ircc_cb *self)
493 __func__, self->io.fir_base); 441 __func__, self->io.fir_base);
494 release_region(self->io.fir_base, self->io.fir_ext); 442 release_region(self->io.fir_base, self->io.fir_ext);
495 if (self->tx_buff.head) 443 if (self->tx_buff.head)
496 dma_free_coherent(NULL, self->tx_buff.truesize, 444 dma_free_coherent(&pdev->dev, self->tx_buff.truesize,
497 self->tx_buff.head, self->tx_buff_dma); 445 self->tx_buff.head, self->tx_buff_dma);
498 if (self->rx_buff.head) 446 if (self->rx_buff.head)
499 dma_free_coherent(NULL, self->rx_buff.truesize, 447 dma_free_coherent(&pdev->dev, self->rx_buff.truesize,
500 self->rx_buff.head, self->rx_buff_dma); 448 self->rx_buff.head, self->rx_buff_dma);
501 dev_self[self->index] = NULL; 449 pci_set_drvdata(pdev, NULL);
502 450
503 free_netdev(self->netdev); 451 free_netdev(self->netdev);
504 452
505 return 0; 453 pci_disable_device(pdev);
506} 454}
507 455
508/* 456/*
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 506cfd0372ec..1ad1f6029af8 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -603,7 +603,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
603 } 603 }
604 604
605 for (i = 0; i < dev->caps.num_comp_vectors; ++i) { 605 for (i = 0; i < dev->caps.num_comp_vectors; ++i) {
606 err = mlx4_create_eq(dev, dev->caps.num_cqs + MLX4_NUM_SPARE_EQE, 606 err = mlx4_create_eq(dev, dev->caps.num_cqs -
607 dev->caps.reserved_cqs +
608 MLX4_NUM_SPARE_EQE,
607 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, 609 (dev->flags & MLX4_FLAG_MSI_X) ? i : 0,
608 &priv->eq_table.eq[i]); 610 &priv->eq_table.eq[i]);
609 if (err) { 611 if (err) {
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index 279521aed826..e63c37d6a115 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -111,7 +111,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 vep_num, u8 port,
111 u32 members_count; 111 u32 members_count;
112 struct mlx4_steer_index *new_entry; 112 struct mlx4_steer_index *new_entry;
113 struct mlx4_promisc_qp *pqp; 113 struct mlx4_promisc_qp *pqp;
114 struct mlx4_promisc_qp *dqp; 114 struct mlx4_promisc_qp *dqp = NULL;
115 u32 prot; 115 u32 prot;
116 int err; 116 int err;
117 u8 pf_num; 117 u8 pf_num;
@@ -184,7 +184,7 @@ out_mailbox:
184out_alloc: 184out_alloc:
185 if (dqp) { 185 if (dqp) {
186 list_del(&dqp->list); 186 list_del(&dqp->list);
187 kfree(&dqp); 187 kfree(dqp);
188 } 188 }
189 list_del(&new_entry->list); 189 list_del(&new_entry->list);
190 kfree(new_entry); 190 kfree(new_entry);
@@ -469,7 +469,6 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 vep_num, u8 port,
469 469
470 /*remove from list of promisc qps */ 470 /*remove from list of promisc qps */
471 list_del(&pqp->list); 471 list_del(&pqp->list);
472 kfree(pqp);
473 472
474 /* set the default entry not to include the removed one */ 473 /* set the default entry not to include the removed one */
475 mailbox = mlx4_alloc_cmd_mailbox(dev); 474 mailbox = mlx4_alloc_cmd_mailbox(dev);
@@ -528,6 +527,8 @@ out_mailbox:
528out_list: 527out_list:
529 if (back_to_list) 528 if (back_to_list)
530 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]); 529 list_add_tail(&pqp->list, &s_steer->promisc_qps[steer]);
530 else
531 kfree(pqp);
531out_mutex: 532out_mutex:
532 mutex_unlock(&priv->mcg_table.mutex); 533 mutex_unlock(&priv->mcg_table.mutex);
533 return err; 534 return err;
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ff6129319b89..ff109fe5af6b 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -442,11 +442,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
442 u32 flags, phy_interface_t interface) 442 u32 flags, phy_interface_t interface)
443{ 443{
444 struct device *d = &phydev->dev; 444 struct device *d = &phydev->dev;
445 int err;
445 446
446 /* Assume that if there is no driver, that it doesn't 447 /* Assume that if there is no driver, that it doesn't
447 * exist, and we should use the genphy driver. */ 448 * exist, and we should use the genphy driver. */
448 if (NULL == d->driver) { 449 if (NULL == d->driver) {
449 int err;
450 d->driver = &genphy_driver.driver; 450 d->driver = &genphy_driver.driver;
451 451
452 err = d->driver->probe(d); 452 err = d->driver->probe(d);
@@ -474,7 +474,11 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
474 /* Do initial configuration here, now that 474 /* Do initial configuration here, now that
475 * we have certain key parameters 475 * we have certain key parameters
476 * (dev_flags and interface) */ 476 * (dev_flags and interface) */
477 return phy_init_hw(phydev); 477 err = phy_init_hw(phydev);
478 if (err)
479 phy_detach(phydev);
480
481 return err;
478} 482}
479 483
480/** 484/**
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index a4f2bd52e546..36045f3b0327 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -144,11 +144,7 @@ static int full_duplex[MAX_UNITS] = {0, };
144/* Time in jiffies before concluding the transmitter is hung. */ 144/* Time in jiffies before concluding the transmitter is hung. */
145#define TX_TIMEOUT (2 * HZ) 145#define TX_TIMEOUT (2 * HZ)
146 146
147/* 147#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
148 * This SUCKS.
149 * We need a much better method to determine if dma_addr_t is 64-bit.
150 */
151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || (defined(CONFIG_MIPS) && ((defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || defined(CONFIG_64BIT))) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT))
152/* 64-bit dma_addr_t */ 148/* 64-bit dma_addr_t */
153#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 149#define ADDR_64BITS /* This chip uses 64 bit addresses. */
154#define netdrv_addr_t __le64 150#define netdrv_addr_t __le64
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 6f600cced6e1..3ec22c307797 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -433,4 +433,19 @@ config USB_SIERRA_NET
433 To compile this driver as a module, choose M here: the 433 To compile this driver as a module, choose M here: the
434 module will be called sierra_net. 434 module will be called sierra_net.
435 435
436config USB_VL600
437 tristate "LG VL600 modem dongle"
438 depends on USB_NET_CDCETHER
439 select USB_ACM
440 help
441 Select this if you want to use an LG Electronics 4G/LTE usb modem
442 called VL600. This driver only handles the ethernet
443 interface exposed by the modem firmware. To establish a connection
444 you will first need a userspace program that sends the right
445 command to the modem through its CDC ACM port, and most
446 likely also a DHCP client. See this thread about using the
447 4G modem from Verizon:
448
449 http://ubuntuforums.org/showpost.php?p=10589647&postcount=17
450
436endmenu 451endmenu
diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index cac170301187..c7ec8a5f0a90 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -27,4 +27,5 @@ obj-$(CONFIG_USB_IPHETH) += ipheth.o
27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o 27obj-$(CONFIG_USB_SIERRA_NET) += sierra_net.o
28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o 28obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.o
29obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o 29obj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.o
30obj-$(CONFIG_USB_VL600) += lg-vl600.o
30 31
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 555284761313..882f53f708df 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -340,7 +340,7 @@ next:
340 340
341static const struct driver_info eem_info = { 341static const struct driver_info eem_info = {
342 .description = "CDC EEM Device", 342 .description = "CDC EEM Device",
343 .flags = FLAG_ETHER, 343 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
344 .bind = eem_bind, 344 .bind = eem_bind,
345 .rx_fixup = eem_rx_fixup, 345 .rx_fixup = eem_rx_fixup,
346 .tx_fixup = eem_tx_fixup, 346 .tx_fixup = eem_tx_fixup,
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 9a60e415d76b..341f7056a800 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -378,7 +378,7 @@ static void dumpspeed(struct usbnet *dev, __le32 *speeds)
378 __le32_to_cpu(speeds[1]) / 1000); 378 __le32_to_cpu(speeds[1]) / 1000);
379} 379}
380 380
381static void cdc_status(struct usbnet *dev, struct urb *urb) 381void usbnet_cdc_status(struct usbnet *dev, struct urb *urb)
382{ 382{
383 struct usb_cdc_notification *event; 383 struct usb_cdc_notification *event;
384 384
@@ -418,8 +418,9 @@ static void cdc_status(struct usbnet *dev, struct urb *urb)
418 break; 418 break;
419 } 419 }
420} 420}
421EXPORT_SYMBOL_GPL(usbnet_cdc_status);
421 422
422static int cdc_bind(struct usbnet *dev, struct usb_interface *intf) 423int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
423{ 424{
424 int status; 425 int status;
425 struct cdc_state *info = (void *) &dev->data; 426 struct cdc_state *info = (void *) &dev->data;
@@ -441,6 +442,7 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
441 */ 442 */
442 return 0; 443 return 0;
443} 444}
445EXPORT_SYMBOL_GPL(usbnet_cdc_bind);
444 446
445static int cdc_manage_power(struct usbnet *dev, int on) 447static int cdc_manage_power(struct usbnet *dev, int on)
446{ 448{
@@ -450,20 +452,20 @@ static int cdc_manage_power(struct usbnet *dev, int on)
450 452
451static const struct driver_info cdc_info = { 453static const struct driver_info cdc_info = {
452 .description = "CDC Ethernet Device", 454 .description = "CDC Ethernet Device",
453 .flags = FLAG_ETHER, 455 .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
454 // .check_connect = cdc_check_connect, 456 // .check_connect = cdc_check_connect,
455 .bind = cdc_bind, 457 .bind = usbnet_cdc_bind,
456 .unbind = usbnet_cdc_unbind, 458 .unbind = usbnet_cdc_unbind,
457 .status = cdc_status, 459 .status = usbnet_cdc_status,
458 .manage_power = cdc_manage_power, 460 .manage_power = cdc_manage_power,
459}; 461};
460 462
461static const struct driver_info mbm_info = { 463static const struct driver_info mbm_info = {
462 .description = "Mobile Broadband Network Device", 464 .description = "Mobile Broadband Network Device",
463 .flags = FLAG_WWAN, 465 .flags = FLAG_WWAN,
464 .bind = cdc_bind, 466 .bind = usbnet_cdc_bind,
465 .unbind = usbnet_cdc_unbind, 467 .unbind = usbnet_cdc_unbind,
466 .status = cdc_status, 468 .status = usbnet_cdc_status,
467 .manage_power = cdc_manage_power, 469 .manage_power = cdc_manage_power,
468}; 470};
469 471
@@ -560,6 +562,13 @@ static const struct usb_device_id products [] = {
560 .driver_info = 0, 562 .driver_info = 0,
561}, 563},
562 564
565/* LG Electronics VL600 wants additional headers on every frame */
566{
567 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
568 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
569 .driver_info = 0,
570},
571
563/* 572/*
564 * WHITELIST!!! 573 * WHITELIST!!!
565 * 574 *
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 7113168473cf..967371f04454 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1237,7 +1237,7 @@ static int cdc_ncm_manage_power(struct usbnet *dev, int status)
1237 1237
1238static const struct driver_info cdc_ncm_info = { 1238static const struct driver_info cdc_ncm_info = {
1239 .description = "CDC NCM", 1239 .description = "CDC NCM",
1240 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET, 1240 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
1241 .bind = cdc_ncm_bind, 1241 .bind = cdc_ncm_bind,
1242 .unbind = cdc_ncm_unbind, 1242 .unbind = cdc_ncm_unbind,
1243 .check_connect = cdc_ncm_check_connect, 1243 .check_connect = cdc_ncm_check_connect,
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index ca39ace0b0eb..fc5f13d47ad9 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -89,6 +89,7 @@ static int always_connected (struct usbnet *dev)
89 89
90static const struct driver_info ali_m5632_info = { 90static const struct driver_info ali_m5632_info = {
91 .description = "ALi M5632", 91 .description = "ALi M5632",
92 .flags = FLAG_POINTTOPOINT,
92}; 93};
93 94
94#endif 95#endif
@@ -110,6 +111,7 @@ static const struct driver_info ali_m5632_info = {
110 111
111static const struct driver_info an2720_info = { 112static const struct driver_info an2720_info = {
112 .description = "AnchorChips/Cypress 2720", 113 .description = "AnchorChips/Cypress 2720",
114 .flags = FLAG_POINTTOPOINT,
113 // no reset available! 115 // no reset available!
114 // no check_connect available! 116 // no check_connect available!
115 117
@@ -132,6 +134,7 @@ static const struct driver_info an2720_info = {
132 134
133static const struct driver_info belkin_info = { 135static const struct driver_info belkin_info = {
134 .description = "Belkin, eTEK, or compatible", 136 .description = "Belkin, eTEK, or compatible",
137 .flags = FLAG_POINTTOPOINT,
135}; 138};
136 139
137#endif /* CONFIG_USB_BELKIN */ 140#endif /* CONFIG_USB_BELKIN */
@@ -157,6 +160,7 @@ static const struct driver_info belkin_info = {
157static const struct driver_info epson2888_info = { 160static const struct driver_info epson2888_info = {
158 .description = "Epson USB Device", 161 .description = "Epson USB Device",
159 .check_connect = always_connected, 162 .check_connect = always_connected,
163 .flags = FLAG_POINTTOPOINT,
160 164
161 .in = 4, .out = 3, 165 .in = 4, .out = 3,
162}; 166};
@@ -173,6 +177,7 @@ static const struct driver_info epson2888_info = {
173#define HAVE_HARDWARE 177#define HAVE_HARDWARE
174static const struct driver_info kc2190_info = { 178static const struct driver_info kc2190_info = {
175 .description = "KC Technology KC-190", 179 .description = "KC Technology KC-190",
180 .flags = FLAG_POINTTOPOINT,
176}; 181};
177#endif /* CONFIG_USB_KC2190 */ 182#endif /* CONFIG_USB_KC2190 */
178 183
@@ -200,16 +205,19 @@ static const struct driver_info kc2190_info = {
200static const struct driver_info linuxdev_info = { 205static const struct driver_info linuxdev_info = {
201 .description = "Linux Device", 206 .description = "Linux Device",
202 .check_connect = always_connected, 207 .check_connect = always_connected,
208 .flags = FLAG_POINTTOPOINT,
203}; 209};
204 210
205static const struct driver_info yopy_info = { 211static const struct driver_info yopy_info = {
206 .description = "Yopy", 212 .description = "Yopy",
207 .check_connect = always_connected, 213 .check_connect = always_connected,
214 .flags = FLAG_POINTTOPOINT,
208}; 215};
209 216
210static const struct driver_info blob_info = { 217static const struct driver_info blob_info = {
211 .description = "Boot Loader OBject", 218 .description = "Boot Loader OBject",
212 .check_connect = always_connected, 219 .check_connect = always_connected,
220 .flags = FLAG_POINTTOPOINT,
213}; 221};
214 222
215#endif /* CONFIG_USB_ARMLINUX */ 223#endif /* CONFIG_USB_ARMLINUX */
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index dcd57c37ef73..c4cfd1dea881 100644
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -193,7 +193,7 @@ static int genelink_bind(struct usbnet *dev, struct usb_interface *intf)
193 193
194static const struct driver_info genelink_info = { 194static const struct driver_info genelink_info = {
195 .description = "Genesys GeneLink", 195 .description = "Genesys GeneLink",
196 .flags = FLAG_FRAMING_GL | FLAG_NO_SETINT, 196 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_GL | FLAG_NO_SETINT,
197 .bind = genelink_bind, 197 .bind = genelink_bind,
198 .rx_fixup = genelink_rx_fixup, 198 .rx_fixup = genelink_rx_fixup,
199 .tx_fixup = genelink_tx_fixup, 199 .tx_fixup = genelink_tx_fixup,
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
new file mode 100644
index 000000000000..1d83ccfd7277
--- /dev/null
+++ b/drivers/net/usb/lg-vl600.c
@@ -0,0 +1,346 @@
1/*
2 * Ethernet interface part of the LG VL600 LTE modem (4G dongle)
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Author: Andrzej Zaborowski <balrogg@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/etherdevice.h>
22#include <linux/ethtool.h>
23#include <linux/mii.h>
24#include <linux/usb.h>
25#include <linux/usb/cdc.h>
26#include <linux/usb/usbnet.h>
27#include <linux/if_ether.h>
28#include <linux/if_arp.h>
29#include <linux/inetdevice.h>
30
31/*
32 * The device has a CDC ACM port for modem control (it claims to be
33 * CDC ACM anyway) and a CDC Ethernet port for actual network data.
34 * It will however ignore data on both ports that is not encapsulated
35 * in a specific way, any data returned is also encapsulated the same
36 * way. The headers don't seem to follow any popular standard.
37 *
38 * This driver adds and strips these headers from the ethernet frames
39 * sent/received from the CDC Ethernet port. The proprietary header
40 * replaces the standard ethernet header in a packet so only actual
41 * ethernet frames are allowed. The headers allow some form of
42 * multiplexing by using non standard values of the .h_proto field.
43 * Windows/Mac drivers do send a couple of such frames to the device
44 * during initialisation, with protocol set to 0x0906 or 0x0b06 and (what
45 * seems to be) a flag in the .dummy_flags. This doesn't seem necessary
46 * for modem operation but can possibly be used for GPS or other funcitons.
47 */
48
49struct vl600_frame_hdr {
50 __le32 len;
51 __le32 serial;
52 __le32 pkt_cnt;
53 __le32 dummy_flags;
54 __le32 dummy;
55 __le32 magic;
56} __attribute__((packed));
57
58struct vl600_pkt_hdr {
59 __le32 dummy[2];
60 __le32 len;
61 __be16 h_proto;
62} __attribute__((packed));
63
64struct vl600_state {
65 struct sk_buff *current_rx_buf;
66};
67
68static int vl600_bind(struct usbnet *dev, struct usb_interface *intf)
69{
70 int ret;
71 struct vl600_state *s = kzalloc(sizeof(struct vl600_state), GFP_KERNEL);
72
73 if (!s)
74 return -ENOMEM;
75
76 ret = usbnet_cdc_bind(dev, intf);
77 if (ret) {
78 kfree(s);
79 return ret;
80 }
81
82 dev->driver_priv = s;
83
84 /* ARP packets don't go through, but they're also of no use. The
85 * subnet has only two hosts anyway: us and the gateway / DHCP
86 * server (probably simulated by modem firmware or network operator)
87 * whose address changes everytime we connect to the intarwebz and
88 * who doesn't bother answering ARP requests either. So hardware
89 * addresses have no meaning, the destination and the source of every
90 * packet depend only on whether it is on the IN or OUT endpoint. */
91 dev->net->flags |= IFF_NOARP;
92
93 return ret;
94}
95
96static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf)
97{
98 struct vl600_state *s = dev->driver_priv;
99
100 if (s->current_rx_buf)
101 dev_kfree_skb(s->current_rx_buf);
102
103 kfree(s);
104
105 return usbnet_cdc_unbind(dev, intf);
106}
107
108static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
109{
110 struct vl600_frame_hdr *frame;
111 struct vl600_pkt_hdr *packet;
112 struct ethhdr *ethhdr;
113 int packet_len, count;
114 struct sk_buff *buf = skb;
115 struct sk_buff *clone;
116 struct vl600_state *s = dev->driver_priv;
117
118 /* Frame lengths are generally 4B multiplies but every couple of
119 * hours there's an odd number of bytes sized yet correct frame,
120 * so don't require this. */
121
122 /* Allow a packet (or multiple packets batched together) to be
123 * split across many frames. We don't allow a new batch to
124 * begin in the same frame another one is ending however, and no
125 * leading or trailing pad bytes. */
126 if (s->current_rx_buf) {
127 frame = (struct vl600_frame_hdr *) s->current_rx_buf->data;
128 if (skb->len + s->current_rx_buf->len >
129 le32_to_cpup(&frame->len)) {
130 netif_err(dev, ifup, dev->net, "Fragment too long\n");
131 dev->net->stats.rx_length_errors++;
132 goto error;
133 }
134
135 buf = s->current_rx_buf;
136 memcpy(skb_put(buf, skb->len), skb->data, skb->len);
137 } else if (skb->len < 4) {
138 netif_err(dev, ifup, dev->net, "Frame too short\n");
139 dev->net->stats.rx_length_errors++;
140 goto error;
141 }
142
143 frame = (struct vl600_frame_hdr *) buf->data;
144 /* NOTE: Should check that frame->magic == 0x53544448?
145 * Otherwise if we receive garbage at the beginning of the frame
146 * we may end up allocating a huge buffer and saving all the
147 * future incoming data into it. */
148
149 if (buf->len < sizeof(*frame) ||
150 buf->len != le32_to_cpup(&frame->len)) {
151 /* Save this fragment for later assembly */
152 if (s->current_rx_buf)
153 return 0;
154
155 s->current_rx_buf = skb_copy_expand(skb, 0,
156 le32_to_cpup(&frame->len), GFP_ATOMIC);
157 if (!s->current_rx_buf) {
158 netif_err(dev, ifup, dev->net, "Reserving %i bytes "
159 "for packet assembly failed.\n",
160 le32_to_cpup(&frame->len));
161 dev->net->stats.rx_errors++;
162 }
163
164 return 0;
165 }
166
167 count = le32_to_cpup(&frame->pkt_cnt);
168
169 skb_pull(buf, sizeof(*frame));
170
171 while (count--) {
172 if (buf->len < sizeof(*packet)) {
173 netif_err(dev, ifup, dev->net, "Packet too short\n");
174 goto error;
175 }
176
177 packet = (struct vl600_pkt_hdr *) buf->data;
178 packet_len = sizeof(*packet) + le32_to_cpup(&packet->len);
179 if (packet_len > buf->len) {
180 netif_err(dev, ifup, dev->net,
181 "Bad packet length stored in header\n");
182 goto error;
183 }
184
185 /* Packet header is same size as the ethernet header
186 * (sizeof(*packet) == sizeof(*ethhdr)), additionally
187 * the h_proto field is in the same place so we just leave it
188 * alone and fill in the remaining fields.
189 */
190 ethhdr = (struct ethhdr *) skb->data;
191 if (be16_to_cpup(&ethhdr->h_proto) == ETH_P_ARP &&
192 buf->len > 0x26) {
193 /* Copy the addresses from packet contents */
194 memcpy(ethhdr->h_source,
195 &buf->data[sizeof(*ethhdr) + 0x8],
196 ETH_ALEN);
197 memcpy(ethhdr->h_dest,
198 &buf->data[sizeof(*ethhdr) + 0x12],
199 ETH_ALEN);
200 } else {
201 memset(ethhdr->h_source, 0, ETH_ALEN);
202 memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN);
203 }
204
205 if (count) {
206 /* Not the last packet in this batch */
207 clone = skb_clone(buf, GFP_ATOMIC);
208 if (!clone)
209 goto error;
210
211 skb_trim(clone, packet_len);
212 usbnet_skb_return(dev, clone);
213
214 skb_pull(buf, (packet_len + 3) & ~3);
215 } else {
216 skb_trim(buf, packet_len);
217
218 if (s->current_rx_buf) {
219 usbnet_skb_return(dev, buf);
220 s->current_rx_buf = NULL;
221 return 0;
222 }
223
224 return 1;
225 }
226 }
227
228error:
229 if (s->current_rx_buf) {
230 dev_kfree_skb_any(s->current_rx_buf);
231 s->current_rx_buf = NULL;
232 }
233 dev->net->stats.rx_errors++;
234 return 0;
235}
236
237static struct sk_buff *vl600_tx_fixup(struct usbnet *dev,
238 struct sk_buff *skb, gfp_t flags)
239{
240 struct sk_buff *ret;
241 struct vl600_frame_hdr *frame;
242 struct vl600_pkt_hdr *packet;
243 static uint32_t serial = 1;
244 int orig_len = skb->len - sizeof(struct ethhdr);
245 int full_len = (skb->len + sizeof(struct vl600_frame_hdr) + 3) & ~3;
246
247 frame = (struct vl600_frame_hdr *) skb->data;
248 if (skb->len > sizeof(*frame) && skb->len == le32_to_cpup(&frame->len))
249 return skb; /* Already encapsulated? */
250
251 if (skb->len < sizeof(struct ethhdr))
252 /* Drop, device can only deal with ethernet packets */
253 return NULL;
254
255 if (!skb_cloned(skb)) {
256 int headroom = skb_headroom(skb);
257 int tailroom = skb_tailroom(skb);
258
259 if (tailroom >= full_len - skb->len - sizeof(*frame) &&
260 headroom >= sizeof(*frame))
261 /* There's enough head and tail room */
262 goto encapsulate;
263
264 if (headroom + tailroom + skb->len >= full_len) {
265 /* There's enough total room, just readjust */
266 skb->data = memmove(skb->head + sizeof(*frame),
267 skb->data, skb->len);
268 skb_set_tail_pointer(skb, skb->len);
269 goto encapsulate;
270 }
271 }
272
273 /* Alloc a new skb with the required size */
274 ret = skb_copy_expand(skb, sizeof(struct vl600_frame_hdr), full_len -
275 skb->len - sizeof(struct vl600_frame_hdr), flags);
276 dev_kfree_skb_any(skb);
277 if (!ret)
278 return ret;
279 skb = ret;
280
281encapsulate:
282 /* Packet header is same size as ethernet packet header
283 * (sizeof(*packet) == sizeof(struct ethhdr)), additionally the
284 * h_proto field is in the same place so we just leave it alone and
285 * overwrite the remaining fields.
286 */
287 packet = (struct vl600_pkt_hdr *) skb->data;
288 memset(&packet->dummy, 0, sizeof(packet->dummy));
289 packet->len = cpu_to_le32(orig_len);
290
291 frame = (struct vl600_frame_hdr *) skb_push(skb, sizeof(*frame));
292 memset(frame, 0, sizeof(*frame));
293 frame->len = cpu_to_le32(full_len);
294 frame->serial = cpu_to_le32(serial++);
295 frame->pkt_cnt = cpu_to_le32(1);
296
297 if (skb->len < full_len) /* Pad */
298 skb_put(skb, full_len - skb->len);
299
300 return skb;
301}
302
303static const struct driver_info vl600_info = {
304 .description = "LG VL600 modem",
305 .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE,
306 .bind = vl600_bind,
307 .unbind = vl600_unbind,
308 .status = usbnet_cdc_status,
309 .rx_fixup = vl600_rx_fixup,
310 .tx_fixup = vl600_tx_fixup,
311};
312
313static const struct usb_device_id products[] = {
314 {
315 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
316 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
317 .driver_info = (unsigned long) &vl600_info,
318 },
319 {}, /* End */
320};
321MODULE_DEVICE_TABLE(usb, products);
322
323static struct usb_driver lg_vl600_driver = {
324 .name = "lg-vl600",
325 .id_table = products,
326 .probe = usbnet_probe,
327 .disconnect = usbnet_disconnect,
328 .suspend = usbnet_suspend,
329 .resume = usbnet_resume,
330};
331
332static int __init vl600_init(void)
333{
334 return usb_register(&lg_vl600_driver);
335}
336module_init(vl600_init);
337
338static void __exit vl600_exit(void)
339{
340 usb_deregister(&lg_vl600_driver);
341}
342module_exit(vl600_exit);
343
344MODULE_AUTHOR("Anrzej Zaborowski");
345MODULE_DESCRIPTION("LG-VL600 modem's ethernet link");
346MODULE_LICENSE("GPL");
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index ba72a7281cb0..01db4602a39e 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -560,7 +560,7 @@ static int net1080_bind(struct usbnet *dev, struct usb_interface *intf)
560 560
561static const struct driver_info net1080_info = { 561static const struct driver_info net1080_info = {
562 .description = "NetChip TurboCONNECT", 562 .description = "NetChip TurboCONNECT",
563 .flags = FLAG_FRAMING_NC, 563 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_NC,
564 .bind = net1080_bind, 564 .bind = net1080_bind,
565 .reset = net1080_reset, 565 .reset = net1080_reset,
566 .check_connect = net1080_check_connect, 566 .check_connect = net1080_check_connect,
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 08ad269f6b4e..823c53751307 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -96,7 +96,7 @@ static int pl_reset(struct usbnet *dev)
96 96
97static const struct driver_info prolific_info = { 97static const struct driver_info prolific_info = {
98 .description = "Prolific PL-2301/PL-2302", 98 .description = "Prolific PL-2301/PL-2302",
99 .flags = FLAG_NO_SETINT, 99 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT,
100 /* some PL-2302 versions seem to fail usb_set_interface() */ 100 /* some PL-2302 versions seem to fail usb_set_interface() */
101 .reset = pl_reset, 101 .reset = pl_reset,
102}; 102};
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index dd8a4adf48ca..5994a25c56ac 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -573,7 +573,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup);
573 573
574static const struct driver_info rndis_info = { 574static const struct driver_info rndis_info = {
575 .description = "RNDIS device", 575 .description = "RNDIS device",
576 .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, 576 .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
577 .bind = rndis_bind, 577 .bind = rndis_bind,
578 .unbind = rndis_unbind, 578 .unbind = rndis_unbind,
579 .status = rndis_status, 579 .status = rndis_status,
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 95c41d56631c..069c1cf0fdf7 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -387,8 +387,12 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
387static inline void rx_process (struct usbnet *dev, struct sk_buff *skb) 387static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
388{ 388{
389 if (dev->driver_info->rx_fixup && 389 if (dev->driver_info->rx_fixup &&
390 !dev->driver_info->rx_fixup (dev, skb)) 390 !dev->driver_info->rx_fixup (dev, skb)) {
391 goto error; 391 /* With RX_ASSEMBLE, rx_fixup() must update counters */
392 if (!(dev->driver_info->flags & FLAG_RX_ASSEMBLE))
393 dev->net->stats.rx_errors++;
394 goto done;
395 }
392 // else network stack removes extra byte if we forced a short packet 396 // else network stack removes extra byte if we forced a short packet
393 397
394 if (skb->len) { 398 if (skb->len) {
@@ -401,8 +405,8 @@ static inline void rx_process (struct usbnet *dev, struct sk_buff *skb)
401 } 405 }
402 406
403 netif_dbg(dev, rx_err, dev->net, "drop\n"); 407 netif_dbg(dev, rx_err, dev->net, "drop\n");
404error:
405 dev->net->stats.rx_errors++; 408 dev->net->stats.rx_errors++;
409done:
406 skb_queue_tail(&dev->done, skb); 410 skb_queue_tail(&dev->done, skb);
407} 411}
408 412
@@ -1376,7 +1380,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1376 // else "eth%d" when there's reasonable doubt. userspace 1380 // else "eth%d" when there's reasonable doubt. userspace
1377 // can rename the link if it knows better. 1381 // can rename the link if it knows better.
1378 if ((dev->driver_info->flags & FLAG_ETHER) != 0 && 1382 if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
1379 (net->dev_addr [0] & 0x02) == 0) 1383 ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
1384 (net->dev_addr [0] & 0x02) == 0))
1380 strcpy (net->name, "eth%d"); 1385 strcpy (net->name, "eth%d");
1381 /* WLAN devices should always be named "wlan%d" */ 1386 /* WLAN devices should always be named "wlan%d" */
1382 if ((dev->driver_info->flags & FLAG_WLAN) != 0) 1387 if ((dev->driver_info->flags & FLAG_WLAN) != 0)
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 3eb0b167b5b4..241756e0e86f 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -102,7 +102,7 @@ static int always_connected (struct usbnet *dev)
102 102
103static const struct driver_info zaurus_sl5x00_info = { 103static const struct driver_info zaurus_sl5x00_info = {
104 .description = "Sharp Zaurus SL-5x00", 104 .description = "Sharp Zaurus SL-5x00",
105 .flags = FLAG_FRAMING_Z, 105 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
106 .check_connect = always_connected, 106 .check_connect = always_connected,
107 .bind = zaurus_bind, 107 .bind = zaurus_bind,
108 .unbind = usbnet_cdc_unbind, 108 .unbind = usbnet_cdc_unbind,
@@ -112,7 +112,7 @@ static const struct driver_info zaurus_sl5x00_info = {
112 112
113static const struct driver_info zaurus_pxa_info = { 113static const struct driver_info zaurus_pxa_info = {
114 .description = "Sharp Zaurus, PXA-2xx based", 114 .description = "Sharp Zaurus, PXA-2xx based",
115 .flags = FLAG_FRAMING_Z, 115 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
116 .check_connect = always_connected, 116 .check_connect = always_connected,
117 .bind = zaurus_bind, 117 .bind = zaurus_bind,
118 .unbind = usbnet_cdc_unbind, 118 .unbind = usbnet_cdc_unbind,
@@ -122,7 +122,7 @@ static const struct driver_info zaurus_pxa_info = {
122 122
123static const struct driver_info olympus_mxl_info = { 123static const struct driver_info olympus_mxl_info = {
124 .description = "Olympus R1000", 124 .description = "Olympus R1000",
125 .flags = FLAG_FRAMING_Z, 125 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
126 .check_connect = always_connected, 126 .check_connect = always_connected,
127 .bind = zaurus_bind, 127 .bind = zaurus_bind,
128 .unbind = usbnet_cdc_unbind, 128 .unbind = usbnet_cdc_unbind,
@@ -258,7 +258,7 @@ bad_desc:
258 258
259static const struct driver_info bogus_mdlm_info = { 259static const struct driver_info bogus_mdlm_info = {
260 .description = "pseudo-MDLM (BLAN) device", 260 .description = "pseudo-MDLM (BLAN) device",
261 .flags = FLAG_FRAMING_Z, 261 .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
262 .check_connect = always_connected, 262 .check_connect = always_connected,
263 .tx_fixup = zaurus_tx_fixup, 263 .tx_fixup = zaurus_tx_fixup,
264 .bind = blan_mdlm_bind, 264 .bind = blan_mdlm_bind,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 524825720a09..dddb85de622d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1048,6 +1048,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1048 "Starting driver with initial channel: %d MHz\n", 1048 "Starting driver with initial channel: %d MHz\n",
1049 curchan->center_freq); 1049 curchan->center_freq);
1050 1050
1051 ath9k_ps_wakeup(sc);
1052
1051 mutex_lock(&sc->mutex); 1053 mutex_lock(&sc->mutex);
1052 1054
1053 /* setup initial channel */ 1055 /* setup initial channel */
@@ -1143,6 +1145,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
1143mutex_unlock: 1145mutex_unlock:
1144 mutex_unlock(&sc->mutex); 1146 mutex_unlock(&sc->mutex);
1145 1147
1148 ath9k_ps_restore(sc);
1149
1146 return r; 1150 return r;
1147} 1151}
1148 1152
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index c01c43d8e61b..3d4ed5863732 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -443,6 +443,7 @@ struct carl9170_ba_stats {
443 u8 ampdu_len; 443 u8 ampdu_len;
444 u8 ampdu_ack_len; 444 u8 ampdu_ack_len;
445 bool clear; 445 bool clear;
446 bool req;
446}; 447};
447 448
448struct carl9170_sta_info { 449struct carl9170_sta_info {
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index ede3d7e5a048..89fe60accf85 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1355,6 +1355,7 @@ static int carl9170_op_ampdu_action(struct ieee80211_hw *hw,
1355 tid_info = rcu_dereference(sta_info->agg[tid]); 1355 tid_info = rcu_dereference(sta_info->agg[tid]);
1356 1356
1357 sta_info->stats[tid].clear = true; 1357 sta_info->stats[tid].clear = true;
1358 sta_info->stats[tid].req = false;
1358 1359
1359 if (tid_info) { 1360 if (tid_info) {
1360 bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE); 1361 bitmap_zero(tid_info->bitmap, CARL9170_BAW_SIZE);
diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c
index 0ef70b6fc512..cb70ed7ec5cc 100644
--- a/drivers/net/wireless/ath/carl9170/tx.c
+++ b/drivers/net/wireless/ath/carl9170/tx.c
@@ -383,6 +383,7 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
383 383
384 if (sta_info->stats[tid].clear) { 384 if (sta_info->stats[tid].clear) {
385 sta_info->stats[tid].clear = false; 385 sta_info->stats[tid].clear = false;
386 sta_info->stats[tid].req = false;
386 sta_info->stats[tid].ampdu_len = 0; 387 sta_info->stats[tid].ampdu_len = 0;
387 sta_info->stats[tid].ampdu_ack_len = 0; 388 sta_info->stats[tid].ampdu_ack_len = 0;
388 } 389 }
@@ -391,10 +392,16 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,
391 if (txinfo->status.rates[0].count == 1) 392 if (txinfo->status.rates[0].count == 1)
392 sta_info->stats[tid].ampdu_ack_len++; 393 sta_info->stats[tid].ampdu_ack_len++;
393 394
395 if (!(txinfo->flags & IEEE80211_TX_STAT_ACK))
396 sta_info->stats[tid].req = true;
397
394 if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) { 398 if (super->f.mac_control & cpu_to_le16(AR9170_TX_MAC_IMM_BA)) {
395 super->s.rix = sta_info->stats[tid].ampdu_len; 399 super->s.rix = sta_info->stats[tid].ampdu_len;
396 super->s.cnt = sta_info->stats[tid].ampdu_ack_len; 400 super->s.cnt = sta_info->stats[tid].ampdu_ack_len;
397 txinfo->flags |= IEEE80211_TX_STAT_AMPDU; 401 txinfo->flags |= IEEE80211_TX_STAT_AMPDU;
402 if (sta_info->stats[tid].req)
403 txinfo->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
404
398 sta_info->stats[tid].clear = true; 405 sta_info->stats[tid].clear = true;
399 } 406 }
400 spin_unlock_bh(&tid_info->lock); 407 spin_unlock_bh(&tid_info->lock);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 1c3a8cb186bf..7007d61bb6b5 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -1805,6 +1805,15 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1805 1805
1806 mutex_lock(&priv->mutex); 1806 mutex_lock(&priv->mutex);
1807 1807
1808 if (!ctx->vif || !iwl_legacy_is_ready_rf(priv)) {
1809 /*
1810 * Huh? But wait ... this can maybe happen when
1811 * we're in the middle of a firmware restart!
1812 */
1813 err = -EBUSY;
1814 goto out;
1815 }
1816
1808 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes; 1817 interface_modes = ctx->interface_modes | ctx->exclusive_interface_modes;
1809 1818
1810 if (!(interface_modes & BIT(newtype))) { 1819 if (!(interface_modes & BIT(newtype))) {
@@ -1832,6 +1841,7 @@ iwl_legacy_mac_change_interface(struct ieee80211_hw *hw,
1832 /* success */ 1841 /* success */
1833 iwl_legacy_teardown_interface(priv, vif, true); 1842 iwl_legacy_teardown_interface(priv, vif, true);
1834 vif->type = newtype; 1843 vif->type = newtype;
1844 vif->p2p = newp2p;
1835 err = iwl_legacy_setup_interface(priv, ctx); 1845 err = iwl_legacy_setup_interface(priv, ctx);
1836 WARN_ON(err); 1846 WARN_ON(err);
1837 /* 1847 /*
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index ab87e1b73529..28eb3d885ba1 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -93,6 +93,7 @@ MODULE_LICENSE("GPL");
93struct iwl_mod_params iwl3945_mod_params = { 93struct iwl_mod_params iwl3945_mod_params = {
94 .sw_crypto = 1, 94 .sw_crypto = 1,
95 .restart_fw = 1, 95 .restart_fw = 1,
96 .disable_hw_scan = 1,
96 /* the rest are 0 by default */ 97 /* the rest are 0 by default */
97}; 98};
98 99
@@ -3960,8 +3961,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
3960 * "the hard way", rather than using device's scan. 3961 * "the hard way", rather than using device's scan.
3961 */ 3962 */
3962 if (iwl3945_mod_params.disable_hw_scan) { 3963 if (iwl3945_mod_params.disable_hw_scan) {
3963 dev_printk(KERN_DEBUG, &(pdev->dev), 3964 IWL_DEBUG_INFO(priv, "Disabling hw_scan\n");
3964 "sw scan support is deprecated\n");
3965 iwl3945_hw_ops.hw_scan = NULL; 3965 iwl3945_hw_ops.hw_scan = NULL;
3966 } 3966 }
3967 3967
@@ -4280,8 +4280,7 @@ MODULE_PARM_DESC(swcrypto,
4280 "using software crypto (default 1 [software])"); 4280 "using software crypto (default 1 [software])");
4281module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, 4281module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan,
4282 int, S_IRUGO); 4282 int, S_IRUGO);
4283MODULE_PARM_DESC(disable_hw_scan, 4283MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 1)");
4284 "disable hardware scanning (default 0) (deprecated)");
4285#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 4284#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
4286module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR); 4285module_param_named(debug, iwlegacy_debug_level, uint, S_IRUGO | S_IWUSR);
4287MODULE_PARM_DESC(debug, "debug output mask"); 4286MODULE_PARM_DESC(debug, "debug output mask");
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 4e368657a83c..37509d019910 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -730,8 +730,12 @@ static struct usb_device_id rt2800usb_device_table[] = {
730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) }, 730 { USB_DEVICE(0x050d, 0x8053), USB_DEVICE_DATA(&rt2800usb_ops) },
731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) }, 731 { USB_DEVICE(0x050d, 0x805c), USB_DEVICE_DATA(&rt2800usb_ops) },
732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) }, 732 { USB_DEVICE(0x050d, 0x815c), USB_DEVICE_DATA(&rt2800usb_ops) },
733 { USB_DEVICE(0x050d, 0x825b), USB_DEVICE_DATA(&rt2800usb_ops) },
734 { USB_DEVICE(0x050d, 0x935a), USB_DEVICE_DATA(&rt2800usb_ops) },
735 { USB_DEVICE(0x050d, 0x935b), USB_DEVICE_DATA(&rt2800usb_ops) },
733 /* Buffalo */ 736 /* Buffalo */
734 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) }, 737 { USB_DEVICE(0x0411, 0x00e8), USB_DEVICE_DATA(&rt2800usb_ops) },
738 { USB_DEVICE(0x0411, 0x016f), USB_DEVICE_DATA(&rt2800usb_ops) },
735 /* Conceptronic */ 739 /* Conceptronic */
736 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) }, 740 { USB_DEVICE(0x14b2, 0x3c06), USB_DEVICE_DATA(&rt2800usb_ops) },
737 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) }, 741 { USB_DEVICE(0x14b2, 0x3c07), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -818,6 +822,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
818 /* Pegatron */ 822 /* Pegatron */
819 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) }, 823 { USB_DEVICE(0x1d4d, 0x000c), USB_DEVICE_DATA(&rt2800usb_ops) },
820 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) }, 824 { USB_DEVICE(0x1d4d, 0x000e), USB_DEVICE_DATA(&rt2800usb_ops) },
825 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
821 /* Philips */ 826 /* Philips */
822 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) }, 827 { USB_DEVICE(0x0471, 0x200f), USB_DEVICE_DATA(&rt2800usb_ops) },
823 /* Planex */ 828 /* Planex */
@@ -899,6 +904,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
899 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) }, 904 { USB_DEVICE(0x148f, 0x3572), USB_DEVICE_DATA(&rt2800usb_ops) },
900 /* Sitecom */ 905 /* Sitecom */
901 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) }, 906 { USB_DEVICE(0x0df6, 0x0041), USB_DEVICE_DATA(&rt2800usb_ops) },
907 /* Toshiba */
908 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
902 /* Zinwell */ 909 /* Zinwell */
903 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) }, 910 { USB_DEVICE(0x5a57, 0x0284), USB_DEVICE_DATA(&rt2800usb_ops) },
904#endif 911#endif
@@ -961,7 +968,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
961 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) }, 968 { USB_DEVICE(0x05a6, 0x0101), USB_DEVICE_DATA(&rt2800usb_ops) },
962 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) }, 969 { USB_DEVICE(0x1d4d, 0x0002), USB_DEVICE_DATA(&rt2800usb_ops) },
963 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) }, 970 { USB_DEVICE(0x1d4d, 0x0010), USB_DEVICE_DATA(&rt2800usb_ops) },
964 { USB_DEVICE(0x1d4d, 0x0011), USB_DEVICE_DATA(&rt2800usb_ops) },
965 /* Planex */ 971 /* Planex */
966 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) }, 972 { USB_DEVICE(0x2019, 0x5201), USB_DEVICE_DATA(&rt2800usb_ops) },
967 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) }, 973 { USB_DEVICE(0x2019, 0xab24), USB_DEVICE_DATA(&rt2800usb_ops) },
@@ -975,8 +981,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
975 /* Sweex */ 981 /* Sweex */
976 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) }, 982 { USB_DEVICE(0x177f, 0x0153), USB_DEVICE_DATA(&rt2800usb_ops) },
977 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) }, 983 { USB_DEVICE(0x177f, 0x0313), USB_DEVICE_DATA(&rt2800usb_ops) },
978 /* Toshiba */
979 { USB_DEVICE(0x0930, 0x0a07), USB_DEVICE_DATA(&rt2800usb_ops) },
980 /* Zyxel */ 984 /* Zyxel */
981 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) }, 985 { USB_DEVICE(0x0586, 0x341a), USB_DEVICE_DATA(&rt2800usb_ops) },
982#endif 986#endif
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index b86bc328463b..332a2c4a891c 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -319,7 +319,7 @@ static irqreturn_t mrst_rtc_irq(int irq, void *p)
319 return IRQ_NONE; 319 return IRQ_NONE;
320} 320}
321 321
322static int __init 322static int __devinit
323vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq) 323vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
324{ 324{
325 int retval = 0; 325 int retval = 0;
@@ -391,7 +391,7 @@ static void rtc_mrst_do_shutdown(void)
391 spin_unlock_irq(&rtc_lock); 391 spin_unlock_irq(&rtc_lock);
392} 392}
393 393
394static void __exit rtc_mrst_do_remove(struct device *dev) 394static void __devexit rtc_mrst_do_remove(struct device *dev)
395{ 395{
396 struct mrst_rtc *mrst = dev_get_drvdata(dev); 396 struct mrst_rtc *mrst = dev_get_drvdata(dev);
397 struct resource *iomem; 397 struct resource *iomem;
@@ -500,14 +500,14 @@ static inline int mrst_poweroff(struct device *dev)
500 500
501#endif 501#endif
502 502
503static int __init vrtc_mrst_platform_probe(struct platform_device *pdev) 503static int __devinit vrtc_mrst_platform_probe(struct platform_device *pdev)
504{ 504{
505 return vrtc_mrst_do_probe(&pdev->dev, 505 return vrtc_mrst_do_probe(&pdev->dev,
506 platform_get_resource(pdev, IORESOURCE_MEM, 0), 506 platform_get_resource(pdev, IORESOURCE_MEM, 0),
507 platform_get_irq(pdev, 0)); 507 platform_get_irq(pdev, 0));
508} 508}
509 509
510static int __exit vrtc_mrst_platform_remove(struct platform_device *pdev) 510static int __devexit vrtc_mrst_platform_remove(struct platform_device *pdev)
511{ 511{
512 rtc_mrst_do_remove(&pdev->dev); 512 rtc_mrst_do_remove(&pdev->dev);
513 return 0; 513 return 0;
@@ -525,7 +525,7 @@ MODULE_ALIAS("platform:vrtc_mrst");
525 525
526static struct platform_driver vrtc_mrst_platform_driver = { 526static struct platform_driver vrtc_mrst_platform_driver = {
527 .probe = vrtc_mrst_platform_probe, 527 .probe = vrtc_mrst_platform_probe,
528 .remove = __exit_p(vrtc_mrst_platform_remove), 528 .remove = __devexit_p(vrtc_mrst_platform_remove),
529 .shutdown = vrtc_mrst_platform_shutdown, 529 .shutdown = vrtc_mrst_platform_shutdown,
530 .driver = { 530 .driver = {
531 .name = (char *) driver_name, 531 .name = (char *) driver_name,
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 0571ef9639cb..9f4b58b7daad 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -138,6 +138,7 @@
138#include <linux/spinlock.h> 138#include <linux/spinlock.h>
139#include <linux/stat.h> 139#include <linux/stat.h>
140#include <linux/bitops.h> 140#include <linux/bitops.h>
141#include <linux/delay.h>
141 142
142#include <asm/io.h> 143#include <asm/io.h>
143#include <asm/system.h> 144#include <asm/system.h>
diff --git a/drivers/staging/altera-stapl/altera-jtag.c b/drivers/staging/altera-stapl/altera-jtag.c
index 6b633b179a7e..876308858b82 100644
--- a/drivers/staging/altera-stapl/altera-jtag.c
+++ b/drivers/staging/altera-stapl/altera-jtag.c
@@ -23,6 +23,7 @@
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25 25
26#include <linux/delay.h>
26#include <linux/firmware.h> 27#include <linux/firmware.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <staging/altera.h> 29#include <staging/altera.h>
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 50147f84741c..9c6d4d24f889 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -23,6 +23,7 @@
23#include <linux/hiddev.h> 23#include <linux/hiddev.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/dmi.h> 25#include <linux/dmi.h>
26#include <linux/delay.h>
26 27
27#include "hv_api.h" 28#include "hv_api.h"
28#include "logging.h" 29#include "logging.h"
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 428f4fe0b5f7..0ad32888091c 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -95,6 +95,7 @@ static void n_tty_set_room(struct tty_struct *tty)
95{ 95{
96 /* tty->read_cnt is not read locked ? */ 96 /* tty->read_cnt is not read locked ? */
97 int left = N_TTY_BUF_SIZE - tty->read_cnt - 1; 97 int left = N_TTY_BUF_SIZE - tty->read_cnt - 1;
98 int old_left;
98 99
99 /* 100 /*
100 * If we are doing input canonicalization, and there are no 101 * If we are doing input canonicalization, and there are no
@@ -104,7 +105,12 @@ static void n_tty_set_room(struct tty_struct *tty)
104 */ 105 */
105 if (left <= 0) 106 if (left <= 0)
106 left = tty->icanon && !tty->canon_data; 107 left = tty->icanon && !tty->canon_data;
108 old_left = tty->receive_room;
107 tty->receive_room = left; 109 tty->receive_room = left;
110
111 /* Did this open up the receive buffer? We may need to flip */
112 if (left && !old_left)
113 schedule_work(&tty->buf.work);
108} 114}
109 115
110static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) 116static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index e1aee37270f5..80484af781e1 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1506,7 +1506,7 @@ config SERIAL_BCM63XX_CONSOLE
1506 1506
1507config SERIAL_GRLIB_GAISLER_APBUART 1507config SERIAL_GRLIB_GAISLER_APBUART
1508 tristate "GRLIB APBUART serial support" 1508 tristate "GRLIB APBUART serial support"
1509 depends on OF 1509 depends on OF && SPARC
1510 select SERIAL_CORE 1510 select SERIAL_CORE
1511 ---help--- 1511 ---help---
1512 Add support for the GRLIB APBUART serial port. 1512 Add support for the GRLIB APBUART serial port.
diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 1ab999b04ef3..19a943693e4c 100644
--- a/drivers/tty/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
@@ -555,10 +555,9 @@ static struct uart_driver grlib_apbuart_driver = {
555 555
556static int __devinit apbuart_probe(struct platform_device *op) 556static int __devinit apbuart_probe(struct platform_device *op)
557{ 557{
558 int i = -1; 558 int i;
559 struct uart_port *port = NULL; 559 struct uart_port *port = NULL;
560 560
561 i = 0;
562 for (i = 0; i < grlib_apbuart_port_nr; i++) { 561 for (i = 0; i < grlib_apbuart_port_nr; i++) {
563 if (op->dev.of_node == grlib_apbuart_nodes[i]) 562 if (op->dev.of_node == grlib_apbuart_nodes[i])
564 break; 563 break;
@@ -566,6 +565,7 @@ static int __devinit apbuart_probe(struct platform_device *op)
566 565
567 port = &grlib_apbuart_ports[i]; 566 port = &grlib_apbuart_ports[i];
568 port->dev = &op->dev; 567 port->dev = &op->dev;
568 port->irq = op->archdata.irqs[0];
569 569
570 uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port); 570 uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port);
571 571
@@ -598,24 +598,12 @@ static struct platform_driver grlib_apbuart_of_driver = {
598 598
599static int grlib_apbuart_configure(void) 599static int grlib_apbuart_configure(void)
600{ 600{
601 struct device_node *np, *rp; 601 struct device_node *np;
602 const u32 *prop; 602 int line = 0;
603 int freq_khz, line = 0;
604
605 /* Get bus frequency */
606 rp = of_find_node_by_path("/");
607 if (!rp)
608 return -ENODEV;
609 rp = of_get_next_child(rp, NULL);
610 if (!rp)
611 return -ENODEV;
612 prop = of_get_property(rp, "clock-frequency", NULL);
613 if (!prop)
614 return -ENODEV;
615 freq_khz = *prop;
616 603
617 for_each_matching_node(np, apbuart_match) { 604 for_each_matching_node(np, apbuart_match) {
618 const int *irqs, *ampopts; 605 const int *ampopts;
606 const u32 *freq_hz;
619 const struct amba_prom_registers *regs; 607 const struct amba_prom_registers *regs;
620 struct uart_port *port; 608 struct uart_port *port;
621 unsigned long addr; 609 unsigned long addr;
@@ -623,11 +611,11 @@ static int grlib_apbuart_configure(void)
623 ampopts = of_get_property(np, "ampopts", NULL); 611 ampopts = of_get_property(np, "ampopts", NULL);
624 if (ampopts && (*ampopts == 0)) 612 if (ampopts && (*ampopts == 0))
625 continue; /* Ignore if used by another OS instance */ 613 continue; /* Ignore if used by another OS instance */
626
627 irqs = of_get_property(np, "interrupts", NULL);
628 regs = of_get_property(np, "reg", NULL); 614 regs = of_get_property(np, "reg", NULL);
615 /* Frequency of APB Bus is frequency of UART */
616 freq_hz = of_get_property(np, "freq", NULL);
629 617
630 if (!irqs || !regs) 618 if (!regs || !freq_hz || (*freq_hz == 0))
631 continue; 619 continue;
632 620
633 grlib_apbuart_nodes[line] = np; 621 grlib_apbuart_nodes[line] = np;
@@ -638,12 +626,12 @@ static int grlib_apbuart_configure(void)
638 626
639 port->mapbase = addr; 627 port->mapbase = addr;
640 port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map)); 628 port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map));
641 port->irq = *irqs; 629 port->irq = 0;
642 port->iotype = UPIO_MEM; 630 port->iotype = UPIO_MEM;
643 port->ops = &grlib_apbuart_ops; 631 port->ops = &grlib_apbuart_ops;
644 port->flags = UPF_BOOT_AUTOCONF; 632 port->flags = UPF_BOOT_AUTOCONF;
645 port->line = line; 633 port->line = line;
646 port->uartclk = freq_khz * 1000; 634 port->uartclk = *freq_hz;
647 port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); 635 port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line);
648 line++; 636 line++;
649 637
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index b9451219528b..f1a7918d71aa 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -442,10 +442,8 @@ static void flush_to_ldisc(struct work_struct *work)
442 line discipline as we want to empty the queue */ 442 line discipline as we want to empty the queue */
443 if (test_bit(TTY_FLUSHPENDING, &tty->flags)) 443 if (test_bit(TTY_FLUSHPENDING, &tty->flags))
444 break; 444 break;
445 if (!tty->receive_room || seen_tail) { 445 if (!tty->receive_room || seen_tail)
446 schedule_work(&tty->buf.work);
447 break; 446 break;
448 }
449 if (count > tty->receive_room) 447 if (count > tty->receive_room)
450 count = tty->receive_room; 448 count = tty->receive_room;
451 char_buf = head->char_buf_ptr + head->read; 449 char_buf = head->char_buf_ptr + head->read;
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index d2c019637e45..ba0d28727ccb 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -106,7 +106,7 @@ static void mct_u232_break_ctl(struct tty_struct *tty, int break_state);
106static int mct_u232_tiocmget(struct tty_struct *tty); 106static int mct_u232_tiocmget(struct tty_struct *tty);
107static int mct_u232_tiocmset(struct tty_struct *tty, 107static int mct_u232_tiocmset(struct tty_struct *tty,
108 unsigned int set, unsigned int clear); 108 unsigned int set, unsigned int clear);
109static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 109static int mct_u232_ioctl(struct tty_struct *tty,
110 unsigned int cmd, unsigned long arg); 110 unsigned int cmd, unsigned long arg);
111static int mct_u232_get_icount(struct tty_struct *tty, 111static int mct_u232_get_icount(struct tty_struct *tty,
112 struct serial_icounter_struct *icount); 112 struct serial_icounter_struct *icount);
@@ -874,7 +874,7 @@ static void mct_u232_unthrottle(struct tty_struct *tty)
874 } 874 }
875} 875}
876 876
877static int mct_u232_ioctl(struct tty_struct *tty, struct file *file, 877static int mct_u232_ioctl(struct tty_struct *tty,
878 unsigned int cmd, unsigned long arg) 878 unsigned int cmd, unsigned long arg)
879{ 879{
880 DEFINE_WAIT(wait); 880 DEFINE_WAIT(wait);
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
index a6f63cc8c130..1b5633f46984 100644
--- a/drivers/usb/serial/opticon.c
+++ b/drivers/usb/serial/opticon.c
@@ -413,7 +413,7 @@ static int opticon_tiocmget(struct tty_struct *tty)
413 return result; 413 return result;
414} 414}
415 415
416static int opticon_tiocmset(struct tty_struct *tty, struct file *file, 416static int opticon_tiocmset(struct tty_struct *tty,
417 unsigned int set, unsigned int clear) 417 unsigned int set, unsigned int clear)
418{ 418{
419 struct usb_serial_port *port = tty->driver_data; 419 struct usb_serial_port *port = tty->driver_data;
diff --git a/drivers/video/fb-puv3.c b/drivers/video/fb-puv3.c
index dbd2dc4745d1..27f2c57e06e9 100644
--- a/drivers/video/fb-puv3.c
+++ b/drivers/video/fb-puv3.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/vmalloc.h>
17#include <linux/platform_device.h> 16#include <linux/platform_device.h>
18#include <linux/clk.h> 17#include <linux/clk.h>
19#include <linux/fb.h> 18#include <linux/fb.h>
@@ -531,7 +530,7 @@ static int unifb_set_par(struct fb_info *info)
531 return -EINVAL; 530 return -EINVAL;
532 } 531 }
533 532
534 writel(PKUNITY_UNIGFX_MMAP_BASE, UDE_FSA); 533 writel(info->fix.smem_start, UDE_FSA);
535 writel(info->var.yres, UDE_LS); 534 writel(info->var.yres, UDE_LS);
536 writel(get_line_length(info->var.xres, 535 writel(get_line_length(info->var.xres,
537 info->var.bits_per_pixel) >> 3, UDE_PS); 536 info->var.bits_per_pixel) >> 3, UDE_PS);
@@ -680,13 +679,27 @@ static int unifb_probe(struct platform_device *dev)
680 struct fb_info *info; 679 struct fb_info *info;
681 u32 unifb_regs[UNIFB_REGS_NUM]; 680 u32 unifb_regs[UNIFB_REGS_NUM];
682 int retval = -ENOMEM; 681 int retval = -ENOMEM;
683 struct resource *iomem, *mapmem; 682 struct resource *iomem;
683 void *videomemory;
684
685 videomemory = (void *)__get_free_pages(GFP_KERNEL | __GFP_COMP,
686 get_order(UNIFB_MEMSIZE));
687 if (!videomemory)
688 goto err;
689
690 memset(videomemory, 0, UNIFB_MEMSIZE);
691
692 unifb_fix.smem_start = virt_to_phys(videomemory);
693 unifb_fix.smem_len = UNIFB_MEMSIZE;
694
695 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
696 unifb_fix.mmio_start = iomem->start;
684 697
685 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev); 698 info = framebuffer_alloc(sizeof(u32)*256, &dev->dev);
686 if (!info) 699 if (!info)
687 goto err; 700 goto err;
688 701
689 info->screen_base = (char __iomem *)KUSER_UNIGFX_BASE; 702 info->screen_base = (char __iomem *)videomemory;
690 info->fbops = &unifb_ops; 703 info->fbops = &unifb_ops;
691 704
692 retval = fb_find_mode(&info->var, info, NULL, 705 retval = fb_find_mode(&info->var, info, NULL,
@@ -695,13 +708,6 @@ static int unifb_probe(struct platform_device *dev)
695 if (!retval || (retval == 4)) 708 if (!retval || (retval == 4))
696 info->var = unifb_default; 709 info->var = unifb_default;
697 710
698 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
699 unifb_fix.mmio_start = iomem->start;
700
701 mapmem = platform_get_resource(dev, IORESOURCE_MEM, 1);
702 unifb_fix.smem_start = mapmem->start;
703 unifb_fix.smem_len = UNIFB_MEMSIZE;
704
705 info->fix = unifb_fix; 711 info->fix = unifb_fix;
706 info->pseudo_palette = info->par; 712 info->pseudo_palette = info->par;
707 info->par = NULL; 713 info->par = NULL;
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index d47ce8307854..3458b5725540 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1284,6 +1284,8 @@ struct btrfs_root {
1284#define BTRFS_INODE_DIRSYNC (1 << 10) 1284#define BTRFS_INODE_DIRSYNC (1 << 10)
1285#define BTRFS_INODE_COMPRESS (1 << 11) 1285#define BTRFS_INODE_COMPRESS (1 << 11)
1286 1286
1287#define BTRFS_INODE_ROOT_ITEM_INIT (1 << 31)
1288
1287/* some macros to generate set/get funcs for the struct fields. This 1289/* some macros to generate set/get funcs for the struct fields. This
1288 * assumes there is a lefoo_to_cpu for every type, so lets make a simple 1290 * assumes there is a lefoo_to_cpu for every type, so lets make a simple
1289 * one for u8: 1291 * one for u8:
@@ -2359,6 +2361,8 @@ int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid);
2359int btrfs_find_orphan_roots(struct btrfs_root *tree_root); 2361int btrfs_find_orphan_roots(struct btrfs_root *tree_root);
2360int btrfs_set_root_node(struct btrfs_root_item *item, 2362int btrfs_set_root_node(struct btrfs_root_item *item,
2361 struct extent_buffer *node); 2363 struct extent_buffer *node);
2364void btrfs_check_and_init_root_item(struct btrfs_root_item *item);
2365
2362/* dir-item.c */ 2366/* dir-item.c */
2363int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, 2367int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
2364 struct btrfs_root *root, const char *name, 2368 struct btrfs_root *root, const char *name,
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index d7a7315bd031..8f1d44ba332f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1275,8 +1275,10 @@ struct btrfs_root *btrfs_read_fs_root_no_radix(struct btrfs_root *tree_root,
1275 root->commit_root = btrfs_root_node(root); 1275 root->commit_root = btrfs_root_node(root);
1276 BUG_ON(!root->node); 1276 BUG_ON(!root->node);
1277out: 1277out:
1278 if (location->objectid != BTRFS_TREE_LOG_OBJECTID) 1278 if (location->objectid != BTRFS_TREE_LOG_OBJECTID) {
1279 root->ref_cows = 1; 1279 root->ref_cows = 1;
1280 btrfs_check_and_init_root_item(&root->root_item);
1281 }
1280 1282
1281 return root; 1283 return root;
1282} 1284}
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 656bc0a892b1..e621ea54a3fd 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -906,7 +906,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
906 unsigned long last_index; 906 unsigned long last_index;
907 size_t num_written = 0; 907 size_t num_written = 0;
908 int nrptrs; 908 int nrptrs;
909 int ret; 909 int ret = 0;
910 910
911 nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) / 911 nrptrs = min((iov_iter_count(i) + PAGE_CACHE_SIZE - 1) /
912 PAGE_CACHE_SIZE, PAGE_CACHE_SIZE / 912 PAGE_CACHE_SIZE, PAGE_CACHE_SIZE /
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 0037427d8a9d..f561c953205b 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -24,6 +24,7 @@
24#include "free-space-cache.h" 24#include "free-space-cache.h"
25#include "transaction.h" 25#include "transaction.h"
26#include "disk-io.h" 26#include "disk-io.h"
27#include "extent_io.h"
27 28
28#define BITS_PER_BITMAP (PAGE_CACHE_SIZE * 8) 29#define BITS_PER_BITMAP (PAGE_CACHE_SIZE * 8)
29#define MAX_CACHE_BYTES_PER_GIG (32 * 1024) 30#define MAX_CACHE_BYTES_PER_GIG (32 * 1024)
@@ -81,6 +82,8 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,
81 return ERR_PTR(-ENOENT); 82 return ERR_PTR(-ENOENT);
82 } 83 }
83 84
85 inode->i_mapping->flags &= ~__GFP_FS;
86
84 spin_lock(&block_group->lock); 87 spin_lock(&block_group->lock);
85 if (!root->fs_info->closing) { 88 if (!root->fs_info->closing) {
86 block_group->inode = igrab(inode); 89 block_group->inode = igrab(inode);
@@ -222,6 +225,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
222 u64 num_entries; 225 u64 num_entries;
223 u64 num_bitmaps; 226 u64 num_bitmaps;
224 u64 generation; 227 u64 generation;
228 u64 used = btrfs_block_group_used(&block_group->item);
225 u32 cur_crc = ~(u32)0; 229 u32 cur_crc = ~(u32)0;
226 pgoff_t index = 0; 230 pgoff_t index = 0;
227 unsigned long first_page_offset; 231 unsigned long first_page_offset;
@@ -467,6 +471,17 @@ next:
467 index++; 471 index++;
468 } 472 }
469 473
474 spin_lock(&block_group->tree_lock);
475 if (block_group->free_space != (block_group->key.offset - used -
476 block_group->bytes_super)) {
477 spin_unlock(&block_group->tree_lock);
478 printk(KERN_ERR "block group %llu has an wrong amount of free "
479 "space\n", block_group->key.objectid);
480 ret = 0;
481 goto free_cache;
482 }
483 spin_unlock(&block_group->tree_lock);
484
470 ret = 1; 485 ret = 1;
471out: 486out:
472 kfree(checksums); 487 kfree(checksums);
@@ -495,8 +510,11 @@ int btrfs_write_out_cache(struct btrfs_root *root,
495 struct list_head *pos, *n; 510 struct list_head *pos, *n;
496 struct page *page; 511 struct page *page;
497 struct extent_state *cached_state = NULL; 512 struct extent_state *cached_state = NULL;
513 struct btrfs_free_cluster *cluster = NULL;
514 struct extent_io_tree *unpin = NULL;
498 struct list_head bitmap_list; 515 struct list_head bitmap_list;
499 struct btrfs_key key; 516 struct btrfs_key key;
517 u64 start, end, len;
500 u64 bytes = 0; 518 u64 bytes = 0;
501 u32 *crc, *checksums; 519 u32 *crc, *checksums;
502 pgoff_t index = 0, last_index = 0; 520 pgoff_t index = 0, last_index = 0;
@@ -505,6 +523,7 @@ int btrfs_write_out_cache(struct btrfs_root *root,
505 int entries = 0; 523 int entries = 0;
506 int bitmaps = 0; 524 int bitmaps = 0;
507 int ret = 0; 525 int ret = 0;
526 bool next_page = false;
508 527
509 root = root->fs_info->tree_root; 528 root = root->fs_info->tree_root;
510 529
@@ -551,6 +570,18 @@ int btrfs_write_out_cache(struct btrfs_root *root,
551 */ 570 */
552 first_page_offset = (sizeof(u32) * num_checksums) + sizeof(u64); 571 first_page_offset = (sizeof(u32) * num_checksums) + sizeof(u64);
553 572
573 /* Get the cluster for this block_group if it exists */
574 if (!list_empty(&block_group->cluster_list))
575 cluster = list_entry(block_group->cluster_list.next,
576 struct btrfs_free_cluster,
577 block_group_list);
578
579 /*
580 * We shouldn't have switched the pinned extents yet so this is the
581 * right one
582 */
583 unpin = root->fs_info->pinned_extents;
584
554 /* 585 /*
555 * Lock all pages first so we can lock the extent safely. 586 * Lock all pages first so we can lock the extent safely.
556 * 587 *
@@ -580,6 +611,12 @@ int btrfs_write_out_cache(struct btrfs_root *root,
580 lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1, 611 lock_extent_bits(&BTRFS_I(inode)->io_tree, 0, i_size_read(inode) - 1,
581 0, &cached_state, GFP_NOFS); 612 0, &cached_state, GFP_NOFS);
582 613
614 /*
615 * When searching for pinned extents, we need to start at our start
616 * offset.
617 */
618 start = block_group->key.objectid;
619
583 /* Write out the extent entries */ 620 /* Write out the extent entries */
584 do { 621 do {
585 struct btrfs_free_space_entry *entry; 622 struct btrfs_free_space_entry *entry;
@@ -587,6 +624,8 @@ int btrfs_write_out_cache(struct btrfs_root *root,
587 unsigned long offset = 0; 624 unsigned long offset = 0;
588 unsigned long start_offset = 0; 625 unsigned long start_offset = 0;
589 626
627 next_page = false;
628
590 if (index == 0) { 629 if (index == 0) {
591 start_offset = first_page_offset; 630 start_offset = first_page_offset;
592 offset = start_offset; 631 offset = start_offset;
@@ -598,7 +637,7 @@ int btrfs_write_out_cache(struct btrfs_root *root,
598 entry = addr + start_offset; 637 entry = addr + start_offset;
599 638
600 memset(addr, 0, PAGE_CACHE_SIZE); 639 memset(addr, 0, PAGE_CACHE_SIZE);
601 while (1) { 640 while (node && !next_page) {
602 struct btrfs_free_space *e; 641 struct btrfs_free_space *e;
603 642
604 e = rb_entry(node, struct btrfs_free_space, offset_index); 643 e = rb_entry(node, struct btrfs_free_space, offset_index);
@@ -614,12 +653,49 @@ int btrfs_write_out_cache(struct btrfs_root *root,
614 entry->type = BTRFS_FREE_SPACE_EXTENT; 653 entry->type = BTRFS_FREE_SPACE_EXTENT;
615 } 654 }
616 node = rb_next(node); 655 node = rb_next(node);
617 if (!node) 656 if (!node && cluster) {
618 break; 657 node = rb_first(&cluster->root);
658 cluster = NULL;
659 }
619 offset += sizeof(struct btrfs_free_space_entry); 660 offset += sizeof(struct btrfs_free_space_entry);
620 if (offset + sizeof(struct btrfs_free_space_entry) >= 661 if (offset + sizeof(struct btrfs_free_space_entry) >=
621 PAGE_CACHE_SIZE) 662 PAGE_CACHE_SIZE)
663 next_page = true;
664 entry++;
665 }
666
667 /*
668 * We want to add any pinned extents to our free space cache
669 * so we don't leak the space
670 */
671 while (!next_page && (start < block_group->key.objectid +
672 block_group->key.offset)) {
673 ret = find_first_extent_bit(unpin, start, &start, &end,
674 EXTENT_DIRTY);
675 if (ret) {
676 ret = 0;
677 break;
678 }
679
680 /* This pinned extent is out of our range */
681 if (start >= block_group->key.objectid +
682 block_group->key.offset)
622 break; 683 break;
684
685 len = block_group->key.objectid +
686 block_group->key.offset - start;
687 len = min(len, end + 1 - start);
688
689 entries++;
690 entry->offset = cpu_to_le64(start);
691 entry->bytes = cpu_to_le64(len);
692 entry->type = BTRFS_FREE_SPACE_EXTENT;
693
694 start = end + 1;
695 offset += sizeof(struct btrfs_free_space_entry);
696 if (offset + sizeof(struct btrfs_free_space_entry) >=
697 PAGE_CACHE_SIZE)
698 next_page = true;
623 entry++; 699 entry++;
624 } 700 }
625 *crc = ~(u32)0; 701 *crc = ~(u32)0;
@@ -650,7 +726,7 @@ int btrfs_write_out_cache(struct btrfs_root *root,
650 page_cache_release(page); 726 page_cache_release(page);
651 727
652 index++; 728 index++;
653 } while (node); 729 } while (node || next_page);
654 730
655 /* Write out the bitmaps */ 731 /* Write out the bitmaps */
656 list_for_each_safe(pos, n, &bitmap_list) { 732 list_for_each_safe(pos, n, &bitmap_list) {
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 80920bce01ab..5cc64ab9c485 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -112,6 +112,7 @@ static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
112static noinline int insert_inline_extent(struct btrfs_trans_handle *trans, 112static noinline int insert_inline_extent(struct btrfs_trans_handle *trans,
113 struct btrfs_root *root, struct inode *inode, 113 struct btrfs_root *root, struct inode *inode,
114 u64 start, size_t size, size_t compressed_size, 114 u64 start, size_t size, size_t compressed_size,
115 int compress_type,
115 struct page **compressed_pages) 116 struct page **compressed_pages)
116{ 117{
117 struct btrfs_key key; 118 struct btrfs_key key;
@@ -126,12 +127,9 @@ static noinline int insert_inline_extent(struct btrfs_trans_handle *trans,
126 size_t cur_size = size; 127 size_t cur_size = size;
127 size_t datasize; 128 size_t datasize;
128 unsigned long offset; 129 unsigned long offset;
129 int compress_type = BTRFS_COMPRESS_NONE;
130 130
131 if (compressed_size && compressed_pages) { 131 if (compressed_size && compressed_pages)
132 compress_type = root->fs_info->compress_type;
133 cur_size = compressed_size; 132 cur_size = compressed_size;
134 }
135 133
136 path = btrfs_alloc_path(); 134 path = btrfs_alloc_path();
137 if (!path) 135 if (!path)
@@ -221,7 +219,7 @@ fail:
221static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans, 219static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
222 struct btrfs_root *root, 220 struct btrfs_root *root,
223 struct inode *inode, u64 start, u64 end, 221 struct inode *inode, u64 start, u64 end,
224 size_t compressed_size, 222 size_t compressed_size, int compress_type,
225 struct page **compressed_pages) 223 struct page **compressed_pages)
226{ 224{
227 u64 isize = i_size_read(inode); 225 u64 isize = i_size_read(inode);
@@ -254,7 +252,7 @@ static noinline int cow_file_range_inline(struct btrfs_trans_handle *trans,
254 inline_len = min_t(u64, isize, actual_end); 252 inline_len = min_t(u64, isize, actual_end);
255 ret = insert_inline_extent(trans, root, inode, start, 253 ret = insert_inline_extent(trans, root, inode, start,
256 inline_len, compressed_size, 254 inline_len, compressed_size,
257 compressed_pages); 255 compress_type, compressed_pages);
258 BUG_ON(ret); 256 BUG_ON(ret);
259 btrfs_delalloc_release_metadata(inode, end + 1 - start); 257 btrfs_delalloc_release_metadata(inode, end + 1 - start);
260 btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0); 258 btrfs_drop_extent_cache(inode, start, aligned_end - 1, 0);
@@ -433,12 +431,13 @@ again:
433 * to make an uncompressed inline extent. 431 * to make an uncompressed inline extent.
434 */ 432 */
435 ret = cow_file_range_inline(trans, root, inode, 433 ret = cow_file_range_inline(trans, root, inode,
436 start, end, 0, NULL); 434 start, end, 0, 0, NULL);
437 } else { 435 } else {
438 /* try making a compressed inline extent */ 436 /* try making a compressed inline extent */
439 ret = cow_file_range_inline(trans, root, inode, 437 ret = cow_file_range_inline(trans, root, inode,
440 start, end, 438 start, end,
441 total_compressed, pages); 439 total_compressed,
440 compress_type, pages);
442 } 441 }
443 if (ret == 0) { 442 if (ret == 0) {
444 /* 443 /*
@@ -792,7 +791,7 @@ static noinline int cow_file_range(struct inode *inode,
792 if (start == 0) { 791 if (start == 0) {
793 /* lets try to make an inline extent */ 792 /* lets try to make an inline extent */
794 ret = cow_file_range_inline(trans, root, inode, 793 ret = cow_file_range_inline(trans, root, inode,
795 start, end, 0, NULL); 794 start, end, 0, 0, NULL);
796 if (ret == 0) { 795 if (ret == 0) {
797 extent_clear_unlock_delalloc(inode, 796 extent_clear_unlock_delalloc(inode,
798 &BTRFS_I(inode)->io_tree, 797 &BTRFS_I(inode)->io_tree,
@@ -2222,8 +2221,6 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
2222 insert = 1; 2221 insert = 1;
2223#endif 2222#endif
2224 insert = 1; 2223 insert = 1;
2225 } else {
2226 WARN_ON(!BTRFS_I(inode)->orphan_meta_reserved);
2227 } 2224 }
2228 2225
2229 if (!BTRFS_I(inode)->orphan_meta_reserved) { 2226 if (!BTRFS_I(inode)->orphan_meta_reserved) {
@@ -2537,8 +2534,6 @@ static void btrfs_read_locked_inode(struct inode *inode)
2537 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item); 2534 BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item);
2538 2535
2539 alloc_group_block = btrfs_inode_block_group(leaf, inode_item); 2536 alloc_group_block = btrfs_inode_block_group(leaf, inode_item);
2540 if (location.objectid == BTRFS_FREE_SPACE_OBJECTID)
2541 inode->i_mapping->flags &= ~__GFP_FS;
2542 2537
2543 /* 2538 /*
2544 * try to precache a NULL acl entry for files that don't have 2539 * try to precache a NULL acl entry for files that don't have
@@ -6960,8 +6955,10 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
6960 * should cover the worst case number of items we'll modify. 6955 * should cover the worst case number of items we'll modify.
6961 */ 6956 */
6962 trans = btrfs_start_transaction(root, 20); 6957 trans = btrfs_start_transaction(root, 20);
6963 if (IS_ERR(trans)) 6958 if (IS_ERR(trans)) {
6964 return PTR_ERR(trans); 6959 ret = PTR_ERR(trans);
6960 goto out_notrans;
6961 }
6965 6962
6966 btrfs_set_trans_block_group(trans, new_dir); 6963 btrfs_set_trans_block_group(trans, new_dir);
6967 6964
@@ -7061,7 +7058,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7061 } 7058 }
7062out_fail: 7059out_fail:
7063 btrfs_end_transaction_throttle(trans, root); 7060 btrfs_end_transaction_throttle(trans, root);
7064 7061out_notrans:
7065 if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID) 7062 if (old_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID)
7066 up_read(&root->fs_info->subvol_sem); 7063 up_read(&root->fs_info->subvol_sem);
7067 7064
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 7c07fe26b7cf..cfc264fefdb0 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -373,6 +373,10 @@ static noinline int create_subvol(struct btrfs_root *root,
373 inode_item->nbytes = cpu_to_le64(root->leafsize); 373 inode_item->nbytes = cpu_to_le64(root->leafsize);
374 inode_item->mode = cpu_to_le32(S_IFDIR | 0755); 374 inode_item->mode = cpu_to_le32(S_IFDIR | 0755);
375 375
376 root_item.flags = 0;
377 root_item.byte_limit = 0;
378 inode_item->flags = cpu_to_le64(BTRFS_INODE_ROOT_ITEM_INIT);
379
376 btrfs_set_root_bytenr(&root_item, leaf->start); 380 btrfs_set_root_bytenr(&root_item, leaf->start);
377 btrfs_set_root_generation(&root_item, trans->transid); 381 btrfs_set_root_generation(&root_item, trans->transid);
378 btrfs_set_root_level(&root_item, 0); 382 btrfs_set_root_level(&root_item, 0);
@@ -2436,8 +2440,10 @@ static noinline long btrfs_ioctl_start_sync(struct file *file, void __user *argp
2436 return PTR_ERR(trans); 2440 return PTR_ERR(trans);
2437 transid = trans->transid; 2441 transid = trans->transid;
2438 ret = btrfs_commit_transaction_async(trans, root, 0); 2442 ret = btrfs_commit_transaction_async(trans, root, 0);
2439 if (ret) 2443 if (ret) {
2444 btrfs_end_transaction(trans, root);
2440 return ret; 2445 return ret;
2446 }
2441 2447
2442 if (argp) 2448 if (argp)
2443 if (copy_to_user(argp, &transid, sizeof(transid))) 2449 if (copy_to_user(argp, &transid, sizeof(transid)))
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
index 29b2d7c930eb..6928bff62daa 100644
--- a/fs/btrfs/root-tree.c
+++ b/fs/btrfs/root-tree.c
@@ -473,3 +473,21 @@ again:
473 btrfs_free_path(path); 473 btrfs_free_path(path);
474 return 0; 474 return 0;
475} 475}
476
477/*
478 * Old btrfs forgets to init root_item->flags and root_item->byte_limit
479 * for subvolumes. To work around this problem, we steal a bit from
480 * root_item->inode_item->flags, and use it to indicate if those fields
481 * have been properly initialized.
482 */
483void btrfs_check_and_init_root_item(struct btrfs_root_item *root_item)
484{
485 u64 inode_flags = le64_to_cpu(root_item->inode.flags);
486
487 if (!(inode_flags & BTRFS_INODE_ROOT_ITEM_INIT)) {
488 inode_flags |= BTRFS_INODE_ROOT_ITEM_INIT;
489 root_item->inode.flags = cpu_to_le64(inode_flags);
490 root_item->flags = 0;
491 root_item->byte_limit = 0;
492 }
493}
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 2edfc039f098..58e7de9cc90c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -644,6 +644,7 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
644{ 644{
645 struct btrfs_root *root = btrfs_sb(vfs->mnt_sb); 645 struct btrfs_root *root = btrfs_sb(vfs->mnt_sb);
646 struct btrfs_fs_info *info = root->fs_info; 646 struct btrfs_fs_info *info = root->fs_info;
647 char *compress_type;
647 648
648 if (btrfs_test_opt(root, DEGRADED)) 649 if (btrfs_test_opt(root, DEGRADED))
649 seq_puts(seq, ",degraded"); 650 seq_puts(seq, ",degraded");
@@ -662,8 +663,16 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
662 if (info->thread_pool_size != min_t(unsigned long, 663 if (info->thread_pool_size != min_t(unsigned long,
663 num_online_cpus() + 2, 8)) 664 num_online_cpus() + 2, 8))
664 seq_printf(seq, ",thread_pool=%d", info->thread_pool_size); 665 seq_printf(seq, ",thread_pool=%d", info->thread_pool_size);
665 if (btrfs_test_opt(root, COMPRESS)) 666 if (btrfs_test_opt(root, COMPRESS)) {
666 seq_puts(seq, ",compress"); 667 if (info->compress_type == BTRFS_COMPRESS_ZLIB)
668 compress_type = "zlib";
669 else
670 compress_type = "lzo";
671 if (btrfs_test_opt(root, FORCE_COMPRESS))
672 seq_printf(seq, ",compress-force=%s", compress_type);
673 else
674 seq_printf(seq, ",compress=%s", compress_type);
675 }
667 if (btrfs_test_opt(root, NOSSD)) 676 if (btrfs_test_opt(root, NOSSD))
668 seq_puts(seq, ",nossd"); 677 seq_puts(seq, ",nossd");
669 if (btrfs_test_opt(root, SSD_SPREAD)) 678 if (btrfs_test_opt(root, SSD_SPREAD))
@@ -678,6 +687,12 @@ static int btrfs_show_options(struct seq_file *seq, struct vfsmount *vfs)
678 seq_puts(seq, ",discard"); 687 seq_puts(seq, ",discard");
679 if (!(root->fs_info->sb->s_flags & MS_POSIXACL)) 688 if (!(root->fs_info->sb->s_flags & MS_POSIXACL))
680 seq_puts(seq, ",noacl"); 689 seq_puts(seq, ",noacl");
690 if (btrfs_test_opt(root, SPACE_CACHE))
691 seq_puts(seq, ",space_cache");
692 if (btrfs_test_opt(root, CLEAR_CACHE))
693 seq_puts(seq, ",clear_cache");
694 if (btrfs_test_opt(root, USER_SUBVOL_RM_ALLOWED))
695 seq_puts(seq, ",user_subvol_rm_allowed");
681 return 0; 696 return 0;
682} 697}
683 698
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index ce48eb59d615..5b158da7e0bb 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -197,6 +197,7 @@ again:
197 197
198 ret = join_transaction(root); 198 ret = join_transaction(root);
199 if (ret < 0) { 199 if (ret < 0) {
200 kmem_cache_free(btrfs_trans_handle_cachep, h);
200 if (type != TRANS_JOIN_NOLOCK) 201 if (type != TRANS_JOIN_NOLOCK)
201 mutex_unlock(&root->fs_info->trans_mutex); 202 mutex_unlock(&root->fs_info->trans_mutex);
202 return ERR_PTR(ret); 203 return ERR_PTR(ret);
@@ -975,6 +976,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
975 record_root_in_trans(trans, root); 976 record_root_in_trans(trans, root);
976 btrfs_set_root_last_snapshot(&root->root_item, trans->transid); 977 btrfs_set_root_last_snapshot(&root->root_item, trans->transid);
977 memcpy(new_root_item, &root->root_item, sizeof(*new_root_item)); 978 memcpy(new_root_item, &root->root_item, sizeof(*new_root_item));
979 btrfs_check_and_init_root_item(new_root_item);
978 980
979 root_flags = btrfs_root_flags(new_root_item); 981 root_flags = btrfs_root_flags(new_root_item);
980 if (pending->readonly) 982 if (pending->readonly)
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index a1ee8fa3a8e7..f60b07b0feb0 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -3215,9 +3215,15 @@ void ceph_mdsc_destroy(struct ceph_fs_client *fsc)
3215{ 3215{
3216 struct ceph_mds_client *mdsc = fsc->mdsc; 3216 struct ceph_mds_client *mdsc = fsc->mdsc;
3217 3217
3218 dout("mdsc_destroy %p\n", mdsc);
3218 ceph_mdsc_stop(mdsc); 3219 ceph_mdsc_stop(mdsc);
3220
3221 /* flush out any connection work with references to us */
3222 ceph_msgr_flush();
3223
3219 fsc->mdsc = NULL; 3224 fsc->mdsc = NULL;
3220 kfree(mdsc); 3225 kfree(mdsc);
3226 dout("mdsc_destroy %p done\n", mdsc);
3221} 3227}
3222 3228
3223 3229
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index a9e78b4a258c..f2f77fd3c14c 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -353,7 +353,7 @@ static int ceph_show_options(struct seq_file *m, struct vfsmount *mnt)
353 353
354 if (opt->name) 354 if (opt->name)
355 seq_printf(m, ",name=%s", opt->name); 355 seq_printf(m, ",name=%s", opt->name);
356 if (opt->secret) 356 if (opt->key)
357 seq_puts(m, ",secret=<hidden>"); 357 seq_puts(m, ",secret=<hidden>");
358 358
359 if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) 359 if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
diff --git a/fs/inode.c b/fs/inode.c
index 5f4e11aaeb5c..33c963d08ab4 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -125,6 +125,14 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(inode_wb_list_lock);
125static DECLARE_RWSEM(iprune_sem); 125static DECLARE_RWSEM(iprune_sem);
126 126
127/* 127/*
128 * Empty aops. Can be used for the cases where the user does not
129 * define any of the address_space operations.
130 */
131const struct address_space_operations empty_aops = {
132};
133EXPORT_SYMBOL(empty_aops);
134
135/*
128 * Statistics gathering.. 136 * Statistics gathering..
129 */ 137 */
130struct inodes_stat_t inodes_stat; 138struct inodes_stat_t inodes_stat;
@@ -176,7 +184,6 @@ int proc_nr_inodes(ctl_table *table, int write,
176 */ 184 */
177int inode_init_always(struct super_block *sb, struct inode *inode) 185int inode_init_always(struct super_block *sb, struct inode *inode)
178{ 186{
179 static const struct address_space_operations empty_aops;
180 static const struct inode_operations empty_iops; 187 static const struct inode_operations empty_iops;
181 static const struct file_operations empty_fops; 188 static const struct file_operations empty_fops;
182 struct address_space *const mapping = &inode->i_data; 189 struct address_space *const mapping = &inode->i_data;
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index 93589fccdd97..397e73258631 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -72,10 +72,9 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
72 /* 72 /*
73 * check to see if the page is mapped already (no holes) 73 * check to see if the page is mapped already (no holes)
74 */ 74 */
75 if (PageMappedToDisk(page)) { 75 if (PageMappedToDisk(page))
76 unlock_page(page);
77 goto mapped; 76 goto mapped;
78 } 77
79 if (page_has_buffers(page)) { 78 if (page_has_buffers(page)) {
80 struct buffer_head *bh, *head; 79 struct buffer_head *bh, *head;
81 int fully_mapped = 1; 80 int fully_mapped = 1;
@@ -90,7 +89,6 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
90 89
91 if (fully_mapped) { 90 if (fully_mapped) {
92 SetPageMappedToDisk(page); 91 SetPageMappedToDisk(page);
93 unlock_page(page);
94 goto mapped; 92 goto mapped;
95 } 93 }
96 } 94 }
@@ -105,16 +103,17 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
105 return VM_FAULT_SIGBUS; 103 return VM_FAULT_SIGBUS;
106 104
107 ret = block_page_mkwrite(vma, vmf, nilfs_get_block); 105 ret = block_page_mkwrite(vma, vmf, nilfs_get_block);
108 if (unlikely(ret)) { 106 if (ret != VM_FAULT_LOCKED) {
109 nilfs_transaction_abort(inode->i_sb); 107 nilfs_transaction_abort(inode->i_sb);
110 return ret; 108 return ret;
111 } 109 }
110 nilfs_set_file_dirty(inode, 1 << (PAGE_SHIFT - inode->i_blkbits));
112 nilfs_transaction_commit(inode->i_sb); 111 nilfs_transaction_commit(inode->i_sb);
113 112
114 mapped: 113 mapped:
115 SetPageChecked(page); 114 SetPageChecked(page);
116 wait_on_page_writeback(page); 115 wait_on_page_writeback(page);
117 return 0; 116 return VM_FAULT_LOCKED;
118} 117}
119 118
120static const struct vm_operations_struct nilfs_file_vm_ops = { 119static const struct vm_operations_struct nilfs_file_vm_ops = {
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index 856e8e4e0b74..a8dd344303cb 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -114,19 +114,19 @@ enum {
114 * Macros to check inode numbers 114 * Macros to check inode numbers
115 */ 115 */
116#define NILFS_MDT_INO_BITS \ 116#define NILFS_MDT_INO_BITS \
117 ((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO | \ 117 ((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO | \
118 1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO | \ 118 1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO | \
119 1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO)) 119 1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO))
120 120
121#define NILFS_SYS_INO_BITS \ 121#define NILFS_SYS_INO_BITS \
122 ((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS) 122 ((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS)
123 123
124#define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino) 124#define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino)
125 125
126#define NILFS_MDT_INODE(sb, ino) \ 126#define NILFS_MDT_INODE(sb, ino) \
127 ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino)))) 127 ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino))))
128#define NILFS_VALID_INODE(sb, ino) \ 128#define NILFS_VALID_INODE(sb, ino) \
129 ((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino)))) 129 ((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino))))
130 130
131/** 131/**
132 * struct nilfs_transaction_info: context information for synchronization 132 * struct nilfs_transaction_info: context information for synchronization
@@ -285,7 +285,7 @@ extern void nilfs_destroy_inode(struct inode *);
285extern void nilfs_error(struct super_block *, const char *, const char *, ...) 285extern void nilfs_error(struct super_block *, const char *, const char *, ...)
286 __attribute__ ((format (printf, 3, 4))); 286 __attribute__ ((format (printf, 3, 4)));
287extern void nilfs_warning(struct super_block *, const char *, const char *, ...) 287extern void nilfs_warning(struct super_block *, const char *, const char *, ...)
288 __attribute__ ((format (printf, 3, 4))); 288 __attribute__ ((format (printf, 3, 4)));
289extern struct nilfs_super_block * 289extern struct nilfs_super_block *
290nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **); 290nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **);
291extern int nilfs_store_magic_and_option(struct super_block *, 291extern int nilfs_store_magic_and_option(struct super_block *,
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 4d2a1ee0eb47..1168059c7efd 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -500,7 +500,7 @@ void nilfs_mapping_init(struct address_space *mapping,
500 mapping_set_gfp_mask(mapping, GFP_NOFS); 500 mapping_set_gfp_mask(mapping, GFP_NOFS);
501 mapping->assoc_mapping = NULL; 501 mapping->assoc_mapping = NULL;
502 mapping->backing_dev_info = bdi; 502 mapping->backing_dev_info = bdi;
503 mapping->a_ops = NULL; 503 mapping->a_ops = &empty_aops;
504} 504}
505 505
506/* 506/*
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 7400898c0339..e3cbd746f64a 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -198,6 +198,7 @@ static void inotify_free_group_priv(struct fsnotify_group *group)
198 idr_for_each(&group->inotify_data.idr, idr_callback, group); 198 idr_for_each(&group->inotify_data.idr, idr_callback, group);
199 idr_remove_all(&group->inotify_data.idr); 199 idr_remove_all(&group->inotify_data.idr);
200 idr_destroy(&group->inotify_data.idr); 200 idr_destroy(&group->inotify_data.idr);
201 atomic_dec(&group->inotify_data.user->inotify_devs);
201 free_uid(group->inotify_data.user); 202 free_uid(group->inotify_data.user);
202} 203}
203 204
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index bd46e7c8a0ef..8445fbc8985c 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -290,7 +290,6 @@ static int inotify_fasync(int fd, struct file *file, int on)
290static int inotify_release(struct inode *ignored, struct file *file) 290static int inotify_release(struct inode *ignored, struct file *file)
291{ 291{
292 struct fsnotify_group *group = file->private_data; 292 struct fsnotify_group *group = file->private_data;
293 struct user_struct *user = group->inotify_data.user;
294 293
295 pr_debug("%s: group=%p\n", __func__, group); 294 pr_debug("%s: group=%p\n", __func__, group);
296 295
@@ -299,8 +298,6 @@ static int inotify_release(struct inode *ignored, struct file *file)
299 /* free this group, matching get was inotify_init->fsnotify_obtain_group */ 298 /* free this group, matching get was inotify_init->fsnotify_obtain_group */
300 fsnotify_put_group(group); 299 fsnotify_put_group(group);
301 300
302 atomic_dec(&user->inotify_devs);
303
304 return 0; 301 return 0;
305} 302}
306 303
@@ -697,7 +694,7 @@ retry:
697 return ret; 694 return ret;
698} 695}
699 696
700static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsigned int max_events) 697static struct fsnotify_group *inotify_new_group(unsigned int max_events)
701{ 698{
702 struct fsnotify_group *group; 699 struct fsnotify_group *group;
703 700
@@ -710,8 +707,14 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign
710 spin_lock_init(&group->inotify_data.idr_lock); 707 spin_lock_init(&group->inotify_data.idr_lock);
711 idr_init(&group->inotify_data.idr); 708 idr_init(&group->inotify_data.idr);
712 group->inotify_data.last_wd = 0; 709 group->inotify_data.last_wd = 0;
713 group->inotify_data.user = user;
714 group->inotify_data.fa = NULL; 710 group->inotify_data.fa = NULL;
711 group->inotify_data.user = get_current_user();
712
713 if (atomic_inc_return(&group->inotify_data.user->inotify_devs) >
714 inotify_max_user_instances) {
715 fsnotify_put_group(group);
716 return ERR_PTR(-EMFILE);
717 }
715 718
716 return group; 719 return group;
717} 720}
@@ -721,7 +724,6 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign
721SYSCALL_DEFINE1(inotify_init1, int, flags) 724SYSCALL_DEFINE1(inotify_init1, int, flags)
722{ 725{
723 struct fsnotify_group *group; 726 struct fsnotify_group *group;
724 struct user_struct *user;
725 int ret; 727 int ret;
726 728
727 /* Check the IN_* constants for consistency. */ 729 /* Check the IN_* constants for consistency. */
@@ -731,31 +733,16 @@ SYSCALL_DEFINE1(inotify_init1, int, flags)
731 if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) 733 if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
732 return -EINVAL; 734 return -EINVAL;
733 735
734 user = get_current_user();
735 if (unlikely(atomic_read(&user->inotify_devs) >=
736 inotify_max_user_instances)) {
737 ret = -EMFILE;
738 goto out_free_uid;
739 }
740
741 /* fsnotify_obtain_group took a reference to group, we put this when we kill the file in the end */ 736 /* fsnotify_obtain_group took a reference to group, we put this when we kill the file in the end */
742 group = inotify_new_group(user, inotify_max_queued_events); 737 group = inotify_new_group(inotify_max_queued_events);
743 if (IS_ERR(group)) { 738 if (IS_ERR(group))
744 ret = PTR_ERR(group); 739 return PTR_ERR(group);
745 goto out_free_uid;
746 }
747
748 atomic_inc(&user->inotify_devs);
749 740
750 ret = anon_inode_getfd("inotify", &inotify_fops, group, 741 ret = anon_inode_getfd("inotify", &inotify_fops, group,
751 O_RDONLY | flags); 742 O_RDONLY | flags);
752 if (ret >= 0) 743 if (ret < 0)
753 return ret; 744 fsnotify_put_group(group);
754 745
755 fsnotify_put_group(group);
756 atomic_dec(&user->inotify_devs);
757out_free_uid:
758 free_uid(user);
759 return ret; 746 return ret;
760} 747}
761 748
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
index c74400f88fe0..3299f469e712 100644
--- a/fs/ubifs/xattr.c
+++ b/fs/ubifs/xattr.c
@@ -56,6 +56,7 @@
56 */ 56 */
57 57
58#include "ubifs.h" 58#include "ubifs.h"
59#include <linux/fs.h>
59#include <linux/slab.h> 60#include <linux/slab.h>
60#include <linux/xattr.h> 61#include <linux/xattr.h>
61#include <linux/posix_acl_xattr.h> 62#include <linux/posix_acl_xattr.h>
@@ -80,7 +81,6 @@ enum {
80}; 81};
81 82
82static const struct inode_operations none_inode_operations; 83static const struct inode_operations none_inode_operations;
83static const struct address_space_operations none_address_operations;
84static const struct file_operations none_file_operations; 84static const struct file_operations none_file_operations;
85 85
86/** 86/**
@@ -130,7 +130,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,
130 } 130 }
131 131
132 /* Re-define all operations to be "nothing" */ 132 /* Re-define all operations to be "nothing" */
133 inode->i_mapping->a_ops = &none_address_operations; 133 inode->i_mapping->a_ops = &empty_aops;
134 inode->i_op = &none_inode_operations; 134 inode->i_op = &none_inode_operations;
135 inode->i_fop = &none_file_operations; 135 inode->i_fop = &none_file_operations;
136 136
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 11014302c9ca..5f821dbc0579 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -479,7 +479,6 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
479 break; 479 break;
480 if (IS_SYNC(inode) && (inode->i_state & I_DIRTY)) 480 if (IS_SYNC(inode) && (inode->i_state & I_DIRTY))
481 ufs_sync_inode (inode); 481 ufs_sync_inode (inode);
482 blk_flush_plug(current);
483 yield(); 482 yield();
484 } 483 }
485 484
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index f2d2faf4d9ae..e5a3f5880001 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -194,6 +194,13 @@ extern void warn_slowpath_null(const char *file, const int line);
194#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
195# define WARN_ON_SMP(x) WARN_ON(x) 195# define WARN_ON_SMP(x) WARN_ON(x)
196#else 196#else
197/*
198 * Use of ({0;}) because WARN_ON_SMP(x) may be used either as
199 * a stand alone line statement or as a condition in an if ()
200 * statement.
201 * A simple "0" would cause gcc to give a "statement has no effect"
202 * warning.
203 */
197# define WARN_ON_SMP(x) ({0;}) 204# define WARN_ON_SMP(x) ({0;})
198#endif 205#endif
199 206
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e2ed98b175f6..d94684b7ba34 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -778,6 +778,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
778 void *data, struct drm_file *file_priv); 778 void *data, struct drm_file *file_priv);
779extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 779extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
780 void *data, struct drm_file *file_priv); 780 void *data, struct drm_file *file_priv);
781extern u8 *drm_find_cea_extension(struct edid *edid);
781extern bool drm_detect_hdmi_monitor(struct edid *edid); 782extern bool drm_detect_hdmi_monitor(struct edid *edid);
782extern bool drm_detect_monitor_audio(struct edid *edid); 783extern bool drm_detect_monitor_audio(struct edid *edid);
783extern int drm_mode_page_flip_ioctl(struct drm_device *dev, 784extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 820ee9029482..816e30cbd968 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -472,6 +472,8 @@
472 {0x1002, 0x9803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 472 {0x1002, 0x9803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
473 {0x1002, 0x9804, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 473 {0x1002, 0x9804, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
474 {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ 474 {0x1002, 0x9805, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
475 {0x1002, 0x9806, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
476 {0x1002, 0x9807, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PALM|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \
475 {0, 0, 0} 477 {0, 0, 0}
476 478
477#define r128_PCI_IDS \ 479#define r128_PCI_IDS \
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 94e2ce43488d..62a0e4c4ceee 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -158,7 +158,7 @@ struct ttm_tt;
158 * the object is destroyed. 158 * the object is destroyed.
159 * @event_queue: Queue for processes waiting on buffer object status change. 159 * @event_queue: Queue for processes waiting on buffer object status change.
160 * @mem: structure describing current placement. 160 * @mem: structure describing current placement.
161 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 161 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
162 * pinned in physical memory. If this behaviour is not desired, this member 162 * pinned in physical memory. If this behaviour is not desired, this member
163 * holds a pointer to a persistent shmem object. 163 * holds a pointer to a persistent shmem object.
164 * @ttm: TTM structure holding system pages. 164 * @ttm: TTM structure holding system pages.
@@ -221,7 +221,7 @@ struct ttm_buffer_object {
221 */ 221 */
222 222
223 struct ttm_mem_reg mem; 223 struct ttm_mem_reg mem;
224 struct file *persistant_swap_storage; 224 struct file *persistent_swap_storage;
225 struct ttm_tt *ttm; 225 struct ttm_tt *ttm;
226 bool evicted; 226 bool evicted;
227 227
@@ -459,7 +459,7 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
459 * user buffer object. 459 * user buffer object.
460 * @interruptible: If needing to sleep to wait for GPU resources, 460 * @interruptible: If needing to sleep to wait for GPU resources,
461 * sleep interruptible. 461 * sleep interruptible.
462 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 462 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
463 * pinned in physical memory. If this behaviour is not desired, this member 463 * pinned in physical memory. If this behaviour is not desired, this member
464 * holds a pointer to a persistent shmem object. Typically, this would 464 * holds a pointer to a persistent shmem object. Typically, this would
465 * point to the shmem object backing a GEM object if TTM is used to back a 465 * point to the shmem object backing a GEM object if TTM is used to back a
@@ -490,7 +490,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
490 uint32_t page_alignment, 490 uint32_t page_alignment,
491 unsigned long buffer_start, 491 unsigned long buffer_start,
492 bool interrubtible, 492 bool interrubtible,
493 struct file *persistant_swap_storage, 493 struct file *persistent_swap_storage,
494 size_t acc_size, 494 size_t acc_size,
495 void (*destroy) (struct ttm_buffer_object *)); 495 void (*destroy) (struct ttm_buffer_object *));
496/** 496/**
@@ -506,7 +506,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
506 * user buffer object. 506 * user buffer object.
507 * @interruptible: If needing to sleep while waiting for GPU resources, 507 * @interruptible: If needing to sleep while waiting for GPU resources,
508 * sleep interruptible. 508 * sleep interruptible.
509 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 509 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
510 * pinned in physical memory. If this behaviour is not desired, this member 510 * pinned in physical memory. If this behaviour is not desired, this member
511 * holds a pointer to a persistent shmem object. Typically, this would 511 * holds a pointer to a persistent shmem object. Typically, this would
512 * point to the shmem object backing a GEM object if TTM is used to back a 512 * point to the shmem object backing a GEM object if TTM is used to back a
@@ -528,7 +528,7 @@ extern int ttm_bo_create(struct ttm_bo_device *bdev,
528 uint32_t page_alignment, 528 uint32_t page_alignment,
529 unsigned long buffer_start, 529 unsigned long buffer_start,
530 bool interruptible, 530 bool interruptible,
531 struct file *persistant_swap_storage, 531 struct file *persistent_swap_storage,
532 struct ttm_buffer_object **p_bo); 532 struct ttm_buffer_object **p_bo);
533 533
534/** 534/**
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 8b52c9ab350b..09af2d746d1c 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -122,7 +122,7 @@ struct ttm_backend {
122#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2) 122#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
123#define TTM_PAGE_FLAG_WRITE (1 << 3) 123#define TTM_PAGE_FLAG_WRITE (1 << 3)
124#define TTM_PAGE_FLAG_SWAPPED (1 << 4) 124#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
125#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5) 125#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
126#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) 126#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
127#define TTM_PAGE_FLAG_DMA32 (1 << 7) 127#define TTM_PAGE_FLAG_DMA32 (1 << 7)
128 128
@@ -714,7 +714,7 @@ extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
714 */ 714 */
715extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement); 715extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
716extern int ttm_tt_swapout(struct ttm_tt *ttm, 716extern int ttm_tt_swapout(struct ttm_tt *ttm,
717 struct file *persistant_swap_storage); 717 struct file *persistent_swap_storage);
718 718
719/* 719/*
720 * ttm_bo.c 720 * ttm_bo.c
diff --git a/include/keys/ceph-type.h b/include/keys/ceph-type.h
new file mode 100644
index 000000000000..f69c4ac197a0
--- /dev/null
+++ b/include/keys/ceph-type.h
@@ -0,0 +1,8 @@
1#ifndef _KEYS_CEPH_TYPE_H
2#define _KEYS_CEPH_TYPE_H
3
4#include <linux/key.h>
5
6extern struct key_type key_type_ceph;
7
8#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 475f8c42c0e9..381f4cec8260 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -443,6 +443,7 @@ void atm_dev_signal_change(struct atm_dev *dev, char signal);
443 443
444void vcc_insert_socket(struct sock *sk); 444void vcc_insert_socket(struct sock *sk);
445 445
446void atm_dev_release_vccs(struct atm_dev *dev);
446 447
447/* 448/*
448 * This is approximately the algorithm used by alloc_skb. 449 * This is approximately the algorithm used by alloc_skb.
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 16a902f099ac..32176cc8e715 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1206,6 +1206,7 @@ struct blk_integrity {
1206 struct kobject kobj; 1206 struct kobject kobj;
1207}; 1207};
1208 1208
1209extern bool blk_integrity_is_initialized(struct gendisk *);
1209extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); 1210extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
1210extern void blk_integrity_unregister(struct gendisk *); 1211extern void blk_integrity_unregister(struct gendisk *);
1211extern int blk_integrity_compare(struct gendisk *, struct gendisk *); 1212extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
@@ -1262,6 +1263,7 @@ queue_max_integrity_segments(struct request_queue *q)
1262#define queue_max_integrity_segments(a) (0) 1263#define queue_max_integrity_segments(a) (0)
1263#define blk_integrity_merge_rq(a, b, c) (0) 1264#define blk_integrity_merge_rq(a, b, c) (0)
1264#define blk_integrity_merge_bio(a, b, c) (0) 1265#define blk_integrity_merge_bio(a, b, c) (0)
1266#define blk_integrity_is_initialized(a) (0)
1265 1267
1266#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1268#endif /* CONFIG_BLK_DEV_INTEGRITY */
1267 1269
diff --git a/include/linux/ceph/auth.h b/include/linux/ceph/auth.h
index 7fff521d7eb5..aa13392a7efb 100644
--- a/include/linux/ceph/auth.h
+++ b/include/linux/ceph/auth.h
@@ -67,12 +67,12 @@ struct ceph_auth_client {
67 bool negotiating; /* true if negotiating protocol */ 67 bool negotiating; /* true if negotiating protocol */
68 const char *name; /* entity name */ 68 const char *name; /* entity name */
69 u64 global_id; /* our unique id in system */ 69 u64 global_id; /* our unique id in system */
70 const char *secret; /* our secret key */ 70 const struct ceph_crypto_key *key; /* our secret key */
71 unsigned want_keys; /* which services we want */ 71 unsigned want_keys; /* which services we want */
72}; 72};
73 73
74extern struct ceph_auth_client *ceph_auth_init(const char *name, 74extern struct ceph_auth_client *ceph_auth_init(const char *name,
75 const char *secret); 75 const struct ceph_crypto_key *key);
76extern void ceph_auth_destroy(struct ceph_auth_client *ac); 76extern void ceph_auth_destroy(struct ceph_auth_client *ac);
77 77
78extern void ceph_auth_reset(struct ceph_auth_client *ac); 78extern void ceph_auth_reset(struct ceph_auth_client *ac);
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 0d2e0fffb470..6365f041745b 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -61,7 +61,7 @@ struct ceph_options {
61 pointer type of args */ 61 pointer type of args */
62 int num_mon; 62 int num_mon;
63 char *name; 63 char *name;
64 char *secret; 64 struct ceph_crypto_key *key;
65}; 65};
66 66
67/* 67/*
diff --git a/include/linux/connector.h b/include/linux/connector.h
index bcafc942e5e4..7c60d0942adb 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -88,8 +88,6 @@ struct cn_queue_dev {
88 atomic_t refcnt; 88 atomic_t refcnt;
89 unsigned char name[CN_CBQ_NAMELEN]; 89 unsigned char name[CN_CBQ_NAMELEN];
90 90
91 struct workqueue_struct *cn_queue;
92
93 struct list_head queue_list; 91 struct list_head queue_list;
94 spinlock_t queue_lock; 92 spinlock_t queue_lock;
95 93
@@ -101,20 +99,13 @@ struct cn_callback_id {
101 struct cb_id id; 99 struct cb_id id;
102}; 100};
103 101
104struct cn_callback_data {
105 struct sk_buff *skb;
106 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
107
108 void *free;
109};
110
111struct cn_callback_entry { 102struct cn_callback_entry {
112 struct list_head callback_entry; 103 struct list_head callback_entry;
113 struct work_struct work; 104 atomic_t refcnt;
114 struct cn_queue_dev *pdev; 105 struct cn_queue_dev *pdev;
115 106
116 struct cn_callback_id id; 107 struct cn_callback_id id;
117 struct cn_callback_data data; 108 void (*callback) (struct cn_msg *, struct netlink_skb_parms *);
118 109
119 u32 seq, group; 110 u32 seq, group;
120}; 111};
@@ -138,13 +129,12 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
138 struct cb_id *id, 129 struct cb_id *id,
139 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 130 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
140void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 131void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
132void cn_queue_release_callback(struct cn_callback_entry *);
141 133
142struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *); 134struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *);
143void cn_queue_free_dev(struct cn_queue_dev *dev); 135void cn_queue_free_dev(struct cn_queue_dev *dev);
144 136
145int cn_cb_equal(struct cb_id *, struct cb_id *); 137int cn_cb_equal(struct cb_id *, struct cb_id *);
146 138
147void cn_queue_wrapper(struct work_struct *work);
148
149#endif /* __KERNEL__ */ 139#endif /* __KERNEL__ */
150#endif /* __CONNECTOR_H */ 140#endif /* __CONNECTOR_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index d93efcc44570..21a8ebf2dc3a 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -101,7 +101,6 @@ extern void elv_dispatch_sort(struct request_queue *, struct request *);
101extern void elv_dispatch_add_tail(struct request_queue *, struct request *); 101extern void elv_dispatch_add_tail(struct request_queue *, struct request *);
102extern void elv_add_request(struct request_queue *, struct request *, int); 102extern void elv_add_request(struct request_queue *, struct request *, int);
103extern void __elv_add_request(struct request_queue *, struct request *, int); 103extern void __elv_add_request(struct request_queue *, struct request *, int);
104extern void elv_insert(struct request_queue *, struct request *, int);
105extern int elv_merge(struct request_queue *, struct request **, struct bio *); 104extern int elv_merge(struct request_queue *, struct request **, struct bio *);
106extern int elv_try_merge(struct request *, struct bio *); 105extern int elv_try_merge(struct request *, struct bio *);
107extern void elv_merge_requests(struct request_queue *, struct request *, 106extern void elv_merge_requests(struct request_queue *, struct request *,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f03632d2ac18..dbd860af0804 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -613,6 +613,8 @@ struct address_space_operations {
613 int (*error_remove_page)(struct address_space *, struct page *); 613 int (*error_remove_page)(struct address_space *, struct page *);
614}; 614};
615 615
616extern const struct address_space_operations empty_aops;
617
616/* 618/*
617 * pagecache_write_begin/pagecache_write_end must be used by general code 619 * pagecache_write_begin/pagecache_write_end must be used by general code
618 * to write into the pagecache. 620 * to write into the pagecache.
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 03e8e8dbc577..c2478a342cd7 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -208,6 +208,7 @@ int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
208 unsigned long long *crash_size, unsigned long long *crash_base); 208 unsigned long long *crash_size, unsigned long long *crash_base);
209int crash_shrink_memory(unsigned long new_size); 209int crash_shrink_memory(unsigned long new_size);
210size_t crash_get_memory_size(void); 210size_t crash_get_memory_size(void);
211void crash_free_reserved_phys_range(unsigned long begin, unsigned long end);
211 212
212#else /* !CONFIG_KEXEC */ 213#else /* !CONFIG_KEXEC */
213struct pt_regs; 214struct pt_regs;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5eeb2cd3631c..0249fe7e3872 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2598,8 +2598,8 @@ static inline int dev_ethtool_get_settings(struct net_device *dev,
2598 2598
2599static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) 2599static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2600{ 2600{
2601 if (dev->hw_features & NETIF_F_RXCSUM) 2601 if (dev->features & NETIF_F_RXCSUM)
2602 return !!(dev->features & NETIF_F_RXCSUM); 2602 return 1;
2603 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) 2603 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2604 return 0; 2604 return 0;
2605 return dev->ethtool_ops->get_rx_csum(dev); 2605 return dev->ethtool_ops->get_rx_csum(dev);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 11fd38151cc9..4e2c9150a785 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -518,7 +518,7 @@
518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
520#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 520#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603
521#define PCI_DEVICE_ID_AMD_15H_NB_LINK 0x1604 521#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604
522#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 522#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
523#define PCI_DEVICE_ID_AMD_LANCE 0x2000 523#define PCI_DEVICE_ID_AMD_LANCE 0x2000
524#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 524#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 393b60c71732..ee9f1e782800 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1086,7 +1086,7 @@ void perf_event_task_sched_out(struct task_struct *task, struct task_struct *nex
1086{ 1086{
1087 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); 1087 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
1088 1088
1089 COND_STMT(&perf_sched_events, __perf_event_task_sched_out(task, next)); 1089 __perf_event_task_sched_out(task, next);
1090} 1090}
1091 1091
1092extern void perf_event_mmap(struct vm_area_struct *vma); 1092extern void perf_event_mmap(struct vm_area_struct *vma);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index af5614856285..ff422d2b7f90 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -339,6 +339,12 @@ extern int rcu_my_thread_group_empty(void);
339 ((typeof(*p) __force __kernel *)(p)); \ 339 ((typeof(*p) __force __kernel *)(p)); \
340 }) 340 })
341 341
342#define __rcu_access_index(p, space) \
343 ({ \
344 typeof(p) _________p1 = ACCESS_ONCE(p); \
345 rcu_dereference_sparse(p, space); \
346 (_________p1); \
347 })
342#define __rcu_dereference_index_check(p, c) \ 348#define __rcu_dereference_index_check(p, c) \
343 ({ \ 349 ({ \
344 typeof(p) _________p1 = ACCESS_ONCE(p); \ 350 typeof(p) _________p1 = ACCESS_ONCE(p); \
@@ -429,6 +435,20 @@ extern int rcu_my_thread_group_empty(void);
429#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/ 435#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/
430 436
431/** 437/**
438 * rcu_access_index() - fetch RCU index with no dereferencing
439 * @p: The index to read
440 *
441 * Return the value of the specified RCU-protected index, but omit the
442 * smp_read_barrier_depends() and keep the ACCESS_ONCE(). This is useful
443 * when the value of this index is accessed, but the index is not
444 * dereferenced, for example, when testing an RCU-protected index against
445 * -1. Although rcu_access_index() may also be used in cases where
446 * update-side locks prevent the value of the index from changing, you
447 * should instead use rcu_dereference_index_protected() for this use case.
448 */
449#define rcu_access_index(p) __rcu_access_index((p), __rcu)
450
451/**
432 * rcu_dereference_index_check() - rcu_dereference for indices with debug checking 452 * rcu_dereference_index_check() - rcu_dereference for indices with debug checking
433 * @p: The pointer to read, prior to dereferencing 453 * @p: The pointer to read, prior to dereferencing
434 * @c: The conditions under which the dereference will take place 454 * @c: The conditions under which the dereference will take place
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b759896d9754..d0ae90af0b40 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -126,7 +126,7 @@ struct sk_buff;
126 * GRO uses frags we allocate at least 16 regardless of page size. 126 * GRO uses frags we allocate at least 16 regardless of page size.
127 */ 127 */
128#if (65536/PAGE_SIZE + 2) < 16 128#if (65536/PAGE_SIZE + 2) < 16
129#define MAX_SKB_FRAGS 16 129#define MAX_SKB_FRAGS 16UL
130#else 130#else
131#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) 131#define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2)
132#endif 132#endif
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 44842c8d38c0..3c7329b8ea0e 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -97,11 +97,14 @@ struct driver_info {
97 97
98#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ 98#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
99 99
100#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
101
100/* 102/*
101 * Indicates to usbnet, that USB driver accumulates multiple IP packets. 103 * Indicates to usbnet, that USB driver accumulates multiple IP packets.
102 * Affects statistic (counters) and short packet handling. 104 * Affects statistic (counters) and short packet handling.
103 */ 105 */
104#define FLAG_MULTI_PACKET 0x1000 106#define FLAG_MULTI_PACKET 0x1000
107#define FLAG_RX_ASSEMBLE 0x2000 /* rx packets may span >1 frames */
105 108
106 /* init device ... can sleep, or cause probe() failure */ 109 /* init device ... can sleep, or cause probe() failure */
107 int (*bind)(struct usbnet *, struct usb_interface *); 110 int (*bind)(struct usbnet *, struct usb_interface *);
@@ -172,7 +175,9 @@ struct cdc_state {
172}; 175};
173 176
174extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); 177extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
178extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
175extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); 179extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
180extern void usbnet_cdc_status(struct usbnet *, struct urb *);
176 181
177/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 182/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
178#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 183#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ec6acf2f1c0b..2c0d309c7381 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -84,6 +84,8 @@ enum {
84 HCI_SERVICE_CACHE, 84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS, 85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS, 86 HCI_DEBUG_KEYS,
87
88 HCI_RESET,
87}; 89};
88 90
89/* HCI ioctl defines */ 91/* HCI ioctl defines */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 04977eefb0ee..fccc2180c61b 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -286,5 +286,21 @@ static inline void ipv6_ib_mc_map(const struct in6_addr *addr,
286 buf[9] = broadcast[9]; 286 buf[9] = broadcast[9];
287 memcpy(buf + 10, addr->s6_addr + 6, 10); 287 memcpy(buf + 10, addr->s6_addr + 6, 10);
288} 288}
289
290static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr,
291 const unsigned char *broadcast, char *buf)
292{
293 if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) {
294 memcpy(buf, broadcast, 4);
295 } else {
296 /* v4mapped? */
297 if ((addr->s6_addr32[0] | addr->s6_addr32[1] |
298 (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0)
299 return -EINVAL;
300 memcpy(buf, &addr->s6_addr32[3], 4);
301 }
302 return 0;
303}
304
289#endif 305#endif
290#endif 306#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index a4f631108c54..7c416583b710 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -339,6 +339,14 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch
339 buf[16] = addr & 0x0f; 339 buf[16] = addr & 0x0f;
340} 340}
341 341
342static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast, char *buf)
343{
344 if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0)
345 memcpy(buf, broadcast, 4);
346 else
347 memcpy(buf, &naddr, sizeof(naddr));
348}
349
342#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 350#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
343#include <linux/ipv6.h> 351#include <linux/ipv6.h>
344#endif 352#endif
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index cc9185ca8fd1..0f6e60a9c308 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -422,7 +422,7 @@ struct sctp_cookie {
422 __u32 adaptation_ind; 422 __u32 adaptation_ind;
423 423
424 __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH]; 424 __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH];
425 __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS + 2]; 425 __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS * sizeof(__u16) + 2];
426 __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS]; 426 __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS];
427 427
428 /* This is a shim for my peer's INIT packet, followed by 428 /* This is a shim for my peer's INIT packet, followed by
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5534fdf4d670..f72c1039a6fb 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -45,25 +45,25 @@
45/* platform domain */ 45/* platform domain */
46#define SND_SOC_DAPM_INPUT(wname) \ 46#define SND_SOC_DAPM_INPUT(wname) \
47{ .id = snd_soc_dapm_input, .name = wname, .kcontrols = NULL, \ 47{ .id = snd_soc_dapm_input, .name = wname, .kcontrols = NULL, \
48 .num_kcontrols = 0} 48 .num_kcontrols = 0, .reg = SND_SOC_NOPM }
49#define SND_SOC_DAPM_OUTPUT(wname) \ 49#define SND_SOC_DAPM_OUTPUT(wname) \
50{ .id = snd_soc_dapm_output, .name = wname, .kcontrols = NULL, \ 50{ .id = snd_soc_dapm_output, .name = wname, .kcontrols = NULL, \
51 .num_kcontrols = 0} 51 .num_kcontrols = 0, .reg = SND_SOC_NOPM }
52#define SND_SOC_DAPM_MIC(wname, wevent) \ 52#define SND_SOC_DAPM_MIC(wname, wevent) \
53{ .id = snd_soc_dapm_mic, .name = wname, .kcontrols = NULL, \ 53{ .id = snd_soc_dapm_mic, .name = wname, .kcontrols = NULL, \
54 .num_kcontrols = 0, .event = wevent, \ 54 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
55 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 55 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
56#define SND_SOC_DAPM_HP(wname, wevent) \ 56#define SND_SOC_DAPM_HP(wname, wevent) \
57{ .id = snd_soc_dapm_hp, .name = wname, .kcontrols = NULL, \ 57{ .id = snd_soc_dapm_hp, .name = wname, .kcontrols = NULL, \
58 .num_kcontrols = 0, .event = wevent, \ 58 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
59 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 59 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
60#define SND_SOC_DAPM_SPK(wname, wevent) \ 60#define SND_SOC_DAPM_SPK(wname, wevent) \
61{ .id = snd_soc_dapm_spk, .name = wname, .kcontrols = NULL, \ 61{ .id = snd_soc_dapm_spk, .name = wname, .kcontrols = NULL, \
62 .num_kcontrols = 0, .event = wevent, \ 62 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
63 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 63 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
64#define SND_SOC_DAPM_LINE(wname, wevent) \ 64#define SND_SOC_DAPM_LINE(wname, wevent) \
65{ .id = snd_soc_dapm_line, .name = wname, .kcontrols = NULL, \ 65{ .id = snd_soc_dapm_line, .name = wname, .kcontrols = NULL, \
66 .num_kcontrols = 0, .event = wevent, \ 66 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
67 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 67 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD}
68 68
69/* path domain */ 69/* path domain */
@@ -189,11 +189,11 @@
189/* events that are pre and post DAPM */ 189/* events that are pre and post DAPM */
190#define SND_SOC_DAPM_PRE(wname, wevent) \ 190#define SND_SOC_DAPM_PRE(wname, wevent) \
191{ .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \ 191{ .id = snd_soc_dapm_pre, .name = wname, .kcontrols = NULL, \
192 .num_kcontrols = 0, .event = wevent, \ 192 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
193 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD} 193 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD}
194#define SND_SOC_DAPM_POST(wname, wevent) \ 194#define SND_SOC_DAPM_POST(wname, wevent) \
195{ .id = snd_soc_dapm_post, .name = wname, .kcontrols = NULL, \ 195{ .id = snd_soc_dapm_post, .name = wname, .kcontrols = NULL, \
196 .num_kcontrols = 0, .event = wevent, \ 196 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \
197 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} 197 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD}
198 198
199/* stream domain */ 199/* stream domain */
diff --git a/kernel/kexec.c b/kernel/kexec.c
index e7e3d9788dc3..55936f9cb251 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1099,7 +1099,8 @@ size_t crash_get_memory_size(void)
1099 return size; 1099 return size;
1100} 1100}
1101 1101
1102static void free_reserved_phys_range(unsigned long begin, unsigned long end) 1102void __weak crash_free_reserved_phys_range(unsigned long begin,
1103 unsigned long end)
1103{ 1104{
1104 unsigned long addr; 1105 unsigned long addr;
1105 1106
@@ -1135,7 +1136,7 @@ int crash_shrink_memory(unsigned long new_size)
1135 start = roundup(start, PAGE_SIZE); 1136 start = roundup(start, PAGE_SIZE);
1136 end = roundup(start + new_size, PAGE_SIZE); 1137 end = roundup(start + new_size, PAGE_SIZE);
1137 1138
1138 free_reserved_phys_range(end, crashk_res.end); 1139 crash_free_reserved_phys_range(end, crashk_res.end);
1139 1140
1140 if ((start == end) && (crashk_res.parent != NULL)) 1141 if ((start == end) && (crashk_res.parent != NULL))
1141 release_resource(&crashk_res); 1142 release_resource(&crashk_res);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index c75925c4d1e2..27960f114efd 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -145,8 +145,8 @@ static struct srcu_struct pmus_srcu;
145 */ 145 */
146int sysctl_perf_event_paranoid __read_mostly = 1; 146int sysctl_perf_event_paranoid __read_mostly = 1;
147 147
148/* Minimum for 128 pages + 1 for the user control page */ 148/* Minimum for 512 kiB + 1 user control page */
149int sysctl_perf_event_mlock __read_mostly = 516; /* 'free' kb per user */ 149int sysctl_perf_event_mlock __read_mostly = 512 + (PAGE_SIZE / 1024); /* 'free' kiB per user */
150 150
151/* 151/*
152 * max perf event sample rate 152 * max perf event sample rate
@@ -6531,6 +6531,11 @@ SYSCALL_DEFINE5(perf_event_open,
6531 goto err_alloc; 6531 goto err_alloc;
6532 } 6532 }
6533 6533
6534 if (task) {
6535 put_task_struct(task);
6536 task = NULL;
6537 }
6538
6534 /* 6539 /*
6535 * Look up the group leader (we will attach this event to it): 6540 * Look up the group leader (we will attach this event to it):
6536 */ 6541 */
diff --git a/kernel/sched.c b/kernel/sched.c
index 865b433fac5b..dc7ca5c2a7ab 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5011,6 +5011,17 @@ recheck:
5011 return -EINVAL; 5011 return -EINVAL;
5012 } 5012 }
5013 5013
5014 /*
5015 * If not changing anything there's no need to proceed further:
5016 */
5017 if (unlikely(policy == p->policy && (!rt_policy(policy) ||
5018 param->sched_priority == p->rt_priority))) {
5019
5020 __task_rq_unlock(rq);
5021 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
5022 return 0;
5023 }
5024
5014#ifdef CONFIG_RT_GROUP_SCHED 5025#ifdef CONFIG_RT_GROUP_SCHED
5015 if (user) { 5026 if (user) {
5016 /* 5027 /*
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 3cb7f07887a1..4104533d43ef 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -22,6 +22,7 @@
22 22
23#include <linux/latencytop.h> 23#include <linux/latencytop.h>
24#include <linux/sched.h> 24#include <linux/sched.h>
25#include <linux/cpumask.h>
25 26
26/* 27/*
27 * Targeted preemption latency for CPU-bound tasks: 28 * Targeted preemption latency for CPU-bound tasks:
@@ -3850,8 +3851,8 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle)
3850 interval = msecs_to_jiffies(interval); 3851 interval = msecs_to_jiffies(interval);
3851 if (unlikely(!interval)) 3852 if (unlikely(!interval))
3852 interval = 1; 3853 interval = 1;
3853 if (interval > HZ*NR_CPUS/10) 3854 if (interval > HZ*num_online_cpus()/10)
3854 interval = HZ*NR_CPUS/10; 3855 interval = HZ*num_online_cpus()/10;
3855 3856
3856 need_serialize = sd->flags & SD_SERIALIZE; 3857 need_serialize = sd->flags & SD_SERIALIZE;
3857 3858
diff --git a/kernel/signal.c b/kernel/signal.c
index f486d10f3b8e..29e233fd7a0f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -226,7 +226,7 @@ static inline void print_dropped_signal(int sig)
226/* 226/*
227 * allocate a new signal queue record 227 * allocate a new signal queue record
228 * - this may be called without locks if and only if t == current, otherwise an 228 * - this may be called without locks if and only if t == current, otherwise an
229 * appopriate lock must be held to stop the target task from exiting 229 * appropriate lock must be held to stop the target task from exiting
230 */ 230 */
231static struct sigqueue * 231static struct sigqueue *
232__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit) 232__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit)
@@ -375,15 +375,15 @@ int unhandled_signal(struct task_struct *tsk, int sig)
375 return !tracehook_consider_fatal_signal(tsk, sig); 375 return !tracehook_consider_fatal_signal(tsk, sig);
376} 376}
377 377
378 378/*
379/* Notify the system that a driver wants to block all signals for this 379 * Notify the system that a driver wants to block all signals for this
380 * process, and wants to be notified if any signals at all were to be 380 * process, and wants to be notified if any signals at all were to be
381 * sent/acted upon. If the notifier routine returns non-zero, then the 381 * sent/acted upon. If the notifier routine returns non-zero, then the
382 * signal will be acted upon after all. If the notifier routine returns 0, 382 * signal will be acted upon after all. If the notifier routine returns 0,
383 * then then signal will be blocked. Only one block per process is 383 * then then signal will be blocked. Only one block per process is
384 * allowed. priv is a pointer to private data that the notifier routine 384 * allowed. priv is a pointer to private data that the notifier routine
385 * can use to determine if the signal should be blocked or not. */ 385 * can use to determine if the signal should be blocked or not.
386 386 */
387void 387void
388block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask) 388block_all_signals(int (*notifier)(void *priv), void *priv, sigset_t *mask)
389{ 389{
@@ -434,9 +434,10 @@ still_pending:
434 copy_siginfo(info, &first->info); 434 copy_siginfo(info, &first->info);
435 __sigqueue_free(first); 435 __sigqueue_free(first);
436 } else { 436 } else {
437 /* Ok, it wasn't in the queue. This must be 437 /*
438 a fast-pathed signal or we must have been 438 * Ok, it wasn't in the queue. This must be
439 out of queue space. So zero out the info. 439 * a fast-pathed signal or we must have been
440 * out of queue space. So zero out the info.
440 */ 441 */
441 info->si_signo = sig; 442 info->si_signo = sig;
442 info->si_errno = 0; 443 info->si_errno = 0;
@@ -468,7 +469,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
468} 469}
469 470
470/* 471/*
471 * Dequeue a signal and return the element to the caller, which is 472 * Dequeue a signal and return the element to the caller, which is
472 * expected to free it. 473 * expected to free it.
473 * 474 *
474 * All callers have to hold the siglock. 475 * All callers have to hold the siglock.
@@ -490,7 +491,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
490 * itimers are process shared and we restart periodic 491 * itimers are process shared and we restart periodic
491 * itimers in the signal delivery path to prevent DoS 492 * itimers in the signal delivery path to prevent DoS
492 * attacks in the high resolution timer case. This is 493 * attacks in the high resolution timer case. This is
493 * compliant with the old way of self restarting 494 * compliant with the old way of self-restarting
494 * itimers, as the SIGALRM is a legacy signal and only 495 * itimers, as the SIGALRM is a legacy signal and only
495 * queued once. Changing the restart behaviour to 496 * queued once. Changing the restart behaviour to
496 * restart the timer in the signal dequeue path is 497 * restart the timer in the signal dequeue path is
@@ -923,14 +924,15 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
923 if (info == SEND_SIG_FORCED) 924 if (info == SEND_SIG_FORCED)
924 goto out_set; 925 goto out_set;
925 926
926 /* Real-time signals must be queued if sent by sigqueue, or 927 /*
927 some other real-time mechanism. It is implementation 928 * Real-time signals must be queued if sent by sigqueue, or
928 defined whether kill() does so. We attempt to do so, on 929 * some other real-time mechanism. It is implementation
929 the principle of least surprise, but since kill is not 930 * defined whether kill() does so. We attempt to do so, on
930 allowed to fail with EAGAIN when low on memory we just 931 * the principle of least surprise, but since kill is not
931 make sure at least one signal gets delivered and don't 932 * allowed to fail with EAGAIN when low on memory we just
932 pass on the info struct. */ 933 * make sure at least one signal gets delivered and don't
933 934 * pass on the info struct.
935 */
934 if (sig < SIGRTMIN) 936 if (sig < SIGRTMIN)
935 override_rlimit = (is_si_special(info) || info->si_code >= 0); 937 override_rlimit = (is_si_special(info) || info->si_code >= 0);
936 else 938 else
@@ -1201,8 +1203,7 @@ retry:
1201 return error; 1203 return error;
1202} 1204}
1203 1205
1204int 1206int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1205kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1206{ 1207{
1207 int error; 1208 int error;
1208 rcu_read_lock(); 1209 rcu_read_lock();
@@ -1299,8 +1300,7 @@ static int kill_something_info(int sig, struct siginfo *info, pid_t pid)
1299 * These are for backward compatibility with the rest of the kernel source. 1300 * These are for backward compatibility with the rest of the kernel source.
1300 */ 1301 */
1301 1302
1302int 1303int send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1303send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1304{ 1304{
1305 /* 1305 /*
1306 * Make sure legacy kernel users don't send in bad values 1306 * Make sure legacy kernel users don't send in bad values
@@ -1368,7 +1368,7 @@ EXPORT_SYMBOL(kill_pid);
1368 * These functions support sending signals using preallocated sigqueue 1368 * These functions support sending signals using preallocated sigqueue
1369 * structures. This is needed "because realtime applications cannot 1369 * structures. This is needed "because realtime applications cannot
1370 * afford to lose notifications of asynchronous events, like timer 1370 * afford to lose notifications of asynchronous events, like timer
1371 * expirations or I/O completions". In the case of Posix Timers 1371 * expirations or I/O completions". In the case of POSIX Timers
1372 * we allocate the sigqueue structure from the timer_create. If this 1372 * we allocate the sigqueue structure from the timer_create. If this
1373 * allocation fails we are able to report the failure to the application 1373 * allocation fails we are able to report the failure to the application
1374 * with an EAGAIN error. 1374 * with an EAGAIN error.
@@ -1553,7 +1553,7 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, int why)
1553 info.si_signo = SIGCHLD; 1553 info.si_signo = SIGCHLD;
1554 info.si_errno = 0; 1554 info.si_errno = 0;
1555 /* 1555 /*
1556 * see comment in do_notify_parent() abot the following 3 lines 1556 * see comment in do_notify_parent() about the following 4 lines
1557 */ 1557 */
1558 rcu_read_lock(); 1558 rcu_read_lock();
1559 info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns); 1559 info.si_pid = task_pid_nr_ns(tsk, parent->nsproxy->pid_ns);
@@ -1611,7 +1611,7 @@ static inline int may_ptrace_stop(void)
1611} 1611}
1612 1612
1613/* 1613/*
1614 * Return nonzero if there is a SIGKILL that should be waking us up. 1614 * Return non-zero if there is a SIGKILL that should be waking us up.
1615 * Called with the siglock held. 1615 * Called with the siglock held.
1616 */ 1616 */
1617static int sigkill_pending(struct task_struct *tsk) 1617static int sigkill_pending(struct task_struct *tsk)
@@ -1735,7 +1735,7 @@ void ptrace_notify(int exit_code)
1735/* 1735/*
1736 * This performs the stopping for SIGSTOP and other stop signals. 1736 * This performs the stopping for SIGSTOP and other stop signals.
1737 * We have to stop all threads in the thread group. 1737 * We have to stop all threads in the thread group.
1738 * Returns nonzero if we've actually stopped and released the siglock. 1738 * Returns non-zero if we've actually stopped and released the siglock.
1739 * Returns zero if we didn't stop and still hold the siglock. 1739 * Returns zero if we didn't stop and still hold the siglock.
1740 */ 1740 */
1741static int do_signal_stop(int signr) 1741static int do_signal_stop(int signr)
@@ -1823,10 +1823,12 @@ static int ptrace_signal(int signr, siginfo_t *info,
1823 1823
1824 current->exit_code = 0; 1824 current->exit_code = 0;
1825 1825
1826 /* Update the siginfo structure if the signal has 1826 /*
1827 changed. If the debugger wanted something 1827 * Update the siginfo structure if the signal has
1828 specific in the siginfo structure then it should 1828 * changed. If the debugger wanted something
1829 have updated *info via PTRACE_SETSIGINFO. */ 1829 * specific in the siginfo structure then it should
1830 * have updated *info via PTRACE_SETSIGINFO.
1831 */
1830 if (signr != info->si_signo) { 1832 if (signr != info->si_signo) {
1831 info->si_signo = signr; 1833 info->si_signo = signr;
1832 info->si_errno = 0; 1834 info->si_errno = 0;
@@ -2034,7 +2036,8 @@ void exit_signals(struct task_struct *tsk)
2034 if (!signal_pending(tsk)) 2036 if (!signal_pending(tsk))
2035 goto out; 2037 goto out;
2036 2038
2037 /* It could be that __group_complete_signal() choose us to 2039 /*
2040 * It could be that __group_complete_signal() choose us to
2038 * notify about group-wide signal. Another thread should be 2041 * notify about group-wide signal. Another thread should be
2039 * woken now to take the signal since we will not. 2042 * woken now to take the signal since we will not.
2040 */ 2043 */
@@ -2072,6 +2075,9 @@ EXPORT_SYMBOL(unblock_all_signals);
2072 * System call entry points. 2075 * System call entry points.
2073 */ 2076 */
2074 2077
2078/**
2079 * sys_restart_syscall - restart a system call
2080 */
2075SYSCALL_DEFINE0(restart_syscall) 2081SYSCALL_DEFINE0(restart_syscall)
2076{ 2082{
2077 struct restart_block *restart = &current_thread_info()->restart_block; 2083 struct restart_block *restart = &current_thread_info()->restart_block;
@@ -2125,6 +2131,13 @@ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
2125 return error; 2131 return error;
2126} 2132}
2127 2133
2134/**
2135 * sys_rt_sigprocmask - change the list of currently blocked signals
2136 * @how: whether to add, remove, or set signals
2137 * @set: stores pending signals
2138 * @oset: previous value of signal mask if non-null
2139 * @sigsetsize: size of sigset_t type
2140 */
2128SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, set, 2141SYSCALL_DEFINE4(rt_sigprocmask, int, how, sigset_t __user *, set,
2129 sigset_t __user *, oset, size_t, sigsetsize) 2142 sigset_t __user *, oset, size_t, sigsetsize)
2130{ 2143{
@@ -2183,8 +2196,14 @@ long do_sigpending(void __user *set, unsigned long sigsetsize)
2183 2196
2184out: 2197out:
2185 return error; 2198 return error;
2186} 2199}
2187 2200
2201/**
2202 * sys_rt_sigpending - examine a pending signal that has been raised
2203 * while blocked
2204 * @set: stores pending signals
2205 * @sigsetsize: size of sigset_t type or larger
2206 */
2188SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize) 2207SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, set, size_t, sigsetsize)
2189{ 2208{
2190 return do_sigpending(set, sigsetsize); 2209 return do_sigpending(set, sigsetsize);
@@ -2233,9 +2252,9 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
2233 err |= __put_user(from->si_trapno, &to->si_trapno); 2252 err |= __put_user(from->si_trapno, &to->si_trapno);
2234#endif 2253#endif
2235#ifdef BUS_MCEERR_AO 2254#ifdef BUS_MCEERR_AO
2236 /* 2255 /*
2237 * Other callers might not initialize the si_lsb field, 2256 * Other callers might not initialize the si_lsb field,
2238 * so check explicitely for the right codes here. 2257 * so check explicitly for the right codes here.
2239 */ 2258 */
2240 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) 2259 if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)
2241 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); 2260 err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb);
@@ -2264,6 +2283,14 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
2264 2283
2265#endif 2284#endif
2266 2285
2286/**
2287 * sys_rt_sigtimedwait - synchronously wait for queued signals specified
2288 * in @uthese
2289 * @uthese: queued signals to wait for
2290 * @uinfo: if non-null, the signal's siginfo is returned here
2291 * @uts: upper bound on process time suspension
2292 * @sigsetsize: size of sigset_t type
2293 */
2267SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, 2294SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2268 siginfo_t __user *, uinfo, const struct timespec __user *, uts, 2295 siginfo_t __user *, uinfo, const struct timespec __user *, uts,
2269 size_t, sigsetsize) 2296 size_t, sigsetsize)
@@ -2280,7 +2307,7 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2280 2307
2281 if (copy_from_user(&these, uthese, sizeof(these))) 2308 if (copy_from_user(&these, uthese, sizeof(these)))
2282 return -EFAULT; 2309 return -EFAULT;
2283 2310
2284 /* 2311 /*
2285 * Invert the set of allowed signals to get those we 2312 * Invert the set of allowed signals to get those we
2286 * want to block. 2313 * want to block.
@@ -2305,9 +2332,11 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2305 + (ts.tv_sec || ts.tv_nsec)); 2332 + (ts.tv_sec || ts.tv_nsec));
2306 2333
2307 if (timeout) { 2334 if (timeout) {
2308 /* None ready -- temporarily unblock those we're 2335 /*
2336 * None ready -- temporarily unblock those we're
2309 * interested while we are sleeping in so that we'll 2337 * interested while we are sleeping in so that we'll
2310 * be awakened when they arrive. */ 2338 * be awakened when they arrive.
2339 */
2311 current->real_blocked = current->blocked; 2340 current->real_blocked = current->blocked;
2312 sigandsets(&current->blocked, &current->blocked, &these); 2341 sigandsets(&current->blocked, &current->blocked, &these);
2313 recalc_sigpending(); 2342 recalc_sigpending();
@@ -2339,6 +2368,11 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese,
2339 return ret; 2368 return ret;
2340} 2369}
2341 2370
2371/**
2372 * sys_kill - send a signal to a process
2373 * @pid: the PID of the process
2374 * @sig: signal to be sent
2375 */
2342SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) 2376SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
2343{ 2377{
2344 struct siginfo info; 2378 struct siginfo info;
@@ -2414,7 +2448,11 @@ SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid_t, pid, int, sig)
2414 return do_tkill(tgid, pid, sig); 2448 return do_tkill(tgid, pid, sig);
2415} 2449}
2416 2450
2417/* 2451/**
2452 * sys_tkill - send signal to one specific task
2453 * @pid: the PID of the task
2454 * @sig: signal to be sent
2455 *
2418 * Send a signal to only one task, even if it's a CLONE_THREAD task. 2456 * Send a signal to only one task, even if it's a CLONE_THREAD task.
2419 */ 2457 */
2420SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig) 2458SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
@@ -2426,6 +2464,12 @@ SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
2426 return do_tkill(0, pid, sig); 2464 return do_tkill(0, pid, sig);
2427} 2465}
2428 2466
2467/**
2468 * sys_rt_sigqueueinfo - send signal information to a signal
2469 * @pid: the PID of the thread
2470 * @sig: signal to be sent
2471 * @uinfo: signal info to be sent
2472 */
2429SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig, 2473SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
2430 siginfo_t __user *, uinfo) 2474 siginfo_t __user *, uinfo)
2431{ 2475{
@@ -2553,12 +2597,11 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
2553 2597
2554 error = -EINVAL; 2598 error = -EINVAL;
2555 /* 2599 /*
2556 * 2600 * Note - this code used to test ss_flags incorrectly:
2557 * Note - this code used to test ss_flags incorrectly
2558 * old code may have been written using ss_flags==0 2601 * old code may have been written using ss_flags==0
2559 * to mean ss_flags==SS_ONSTACK (as this was the only 2602 * to mean ss_flags==SS_ONSTACK (as this was the only
2560 * way that worked) - this fix preserves that older 2603 * way that worked) - this fix preserves that older
2561 * mechanism 2604 * mechanism.
2562 */ 2605 */
2563 if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0) 2606 if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
2564 goto out; 2607 goto out;
@@ -2592,6 +2635,10 @@ out:
2592 2635
2593#ifdef __ARCH_WANT_SYS_SIGPENDING 2636#ifdef __ARCH_WANT_SYS_SIGPENDING
2594 2637
2638/**
2639 * sys_sigpending - examine pending signals
2640 * @set: where mask of pending signal is returned
2641 */
2595SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set) 2642SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
2596{ 2643{
2597 return do_sigpending(set, sizeof(*set)); 2644 return do_sigpending(set, sizeof(*set));
@@ -2600,8 +2647,15 @@ SYSCALL_DEFINE1(sigpending, old_sigset_t __user *, set)
2600#endif 2647#endif
2601 2648
2602#ifdef __ARCH_WANT_SYS_SIGPROCMASK 2649#ifdef __ARCH_WANT_SYS_SIGPROCMASK
2603/* Some platforms have their own version with special arguments others 2650/**
2604 support only sys_rt_sigprocmask. */ 2651 * sys_sigprocmask - examine and change blocked signals
2652 * @how: whether to add, remove, or set signals
2653 * @set: signals to add or remove (if non-null)
2654 * @oset: previous value of signal mask if non-null
2655 *
2656 * Some platforms have their own version with special arguments;
2657 * others support only sys_rt_sigprocmask.
2658 */
2605 2659
2606SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set, 2660SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set,
2607 old_sigset_t __user *, oset) 2661 old_sigset_t __user *, oset)
@@ -2654,6 +2708,13 @@ out:
2654#endif /* __ARCH_WANT_SYS_SIGPROCMASK */ 2708#endif /* __ARCH_WANT_SYS_SIGPROCMASK */
2655 2709
2656#ifdef __ARCH_WANT_SYS_RT_SIGACTION 2710#ifdef __ARCH_WANT_SYS_RT_SIGACTION
2711/**
2712 * sys_rt_sigaction - alter an action taken by a process
2713 * @sig: signal to be sent
2714 * @act: the thread group ID of the thread
2715 * @oact: the PID of the thread
2716 * @sigsetsize: size of sigset_t type
2717 */
2657SYSCALL_DEFINE4(rt_sigaction, int, sig, 2718SYSCALL_DEFINE4(rt_sigaction, int, sig,
2658 const struct sigaction __user *, act, 2719 const struct sigaction __user *, act,
2659 struct sigaction __user *, oact, 2720 struct sigaction __user *, oact,
@@ -2740,6 +2801,12 @@ SYSCALL_DEFINE0(pause)
2740#endif 2801#endif
2741 2802
2742#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND 2803#ifdef __ARCH_WANT_SYS_RT_SIGSUSPEND
2804/**
2805 * sys_rt_sigsuspend - replace the signal mask for a value with the
2806 * @unewset value until a signal is received
2807 * @unewset: new signal mask value
2808 * @sigsetsize: size of sigset_t type
2809 */
2743SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize) 2810SYSCALL_DEFINE2(rt_sigsuspend, sigset_t __user *, unewset, size_t, sigsetsize)
2744{ 2811{
2745 sigset_t newset; 2812 sigset_t newset;
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 5f1bb8e2008f..f6117a4c7cb8 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -652,6 +652,8 @@ int do_adjtimex(struct timex *txc)
652 struct timespec delta; 652 struct timespec delta;
653 delta.tv_sec = txc->time.tv_sec; 653 delta.tv_sec = txc->time.tv_sec;
654 delta.tv_nsec = txc->time.tv_usec; 654 delta.tv_nsec = txc->time.tv_usec;
655 if (!capable(CAP_SYS_TIME))
656 return -EPERM;
655 if (!(txc->modes & ADJ_NANO)) 657 if (!(txc->modes & ADJ_NANO))
656 delta.tv_nsec *= 1000; 658 delta.tv_nsec *= 1000;
657 result = timekeeping_inject_offset(&delta); 659 result = timekeeping_inject_offset(&delta);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index df9234c5f9d1..c768bcdda1b7 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -434,11 +434,9 @@ config DEBUG_KMEMLEAK_EARLY_LOG_SIZE
434 434
435config DEBUG_KMEMLEAK_TEST 435config DEBUG_KMEMLEAK_TEST
436 tristate "Simple test for the kernel memory leak detector" 436 tristate "Simple test for the kernel memory leak detector"
437 depends on DEBUG_KMEMLEAK 437 depends on DEBUG_KMEMLEAK && m
438 help 438 help
439 Say Y or M here to build a test for the kernel memory leak 439 This option enables a module that explicitly leaks memory.
440 detector. This option enables a module that explicitly leaks
441 memory.
442 440
443 If unsure, say N. 441 If unsure, say N.
444 442
diff --git a/mm/mremap.c b/mm/mremap.c
index 1de98d492ddc..a7c1f9f9b941 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -277,9 +277,16 @@ static struct vm_area_struct *vma_to_resize(unsigned long addr,
277 if (old_len > vma->vm_end - addr) 277 if (old_len > vma->vm_end - addr)
278 goto Efault; 278 goto Efault;
279 279
280 if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP)) { 280 /* Need to be careful about a growing mapping */
281 if (new_len > old_len) 281 if (new_len > old_len) {
282 unsigned long pgoff;
283
284 if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP))
282 goto Efault; 285 goto Efault;
286 pgoff = (addr - vma->vm_start) >> PAGE_SHIFT;
287 pgoff += vma->vm_pgoff;
288 if (pgoff + (new_len >> PAGE_SHIFT) < pgoff)
289 goto Einval;
283 } 290 }
284 291
285 if (vma->vm_flags & VM_LOCKED) { 292 if (vma->vm_flags & VM_LOCKED) {
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 206e771e82d1..956a5302002a 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1051,16 +1051,17 @@ static int atalk_release(struct socket *sock)
1051{ 1051{
1052 struct sock *sk = sock->sk; 1052 struct sock *sk = sock->sk;
1053 1053
1054 sock_hold(sk);
1055 lock_sock(sk);
1056 if (sk) { 1054 if (sk) {
1055 sock_hold(sk);
1056 lock_sock(sk);
1057
1057 sock_orphan(sk); 1058 sock_orphan(sk);
1058 sock->sk = NULL; 1059 sock->sk = NULL;
1059 atalk_destroy_socket(sk); 1060 atalk_destroy_socket(sk);
1060 }
1061 release_sock(sk);
1062 sock_put(sk);
1063 1061
1062 release_sock(sk);
1063 sock_put(sk);
1064 }
1064 return 0; 1065 return 0;
1065} 1066}
1066 1067
diff --git a/net/atm/common.c b/net/atm/common.c
index 1b9c52a02cd3..22b963d06a10 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -252,6 +252,7 @@ void atm_dev_release_vccs(struct atm_dev *dev)
252 } 252 }
253 write_unlock_irq(&vcc_sklist_lock); 253 write_unlock_irq(&vcc_sklist_lock);
254} 254}
255EXPORT_SYMBOL(atm_dev_release_vccs);
255 256
256static int adjust_tp(struct atm_trafprm *tp, unsigned char aal) 257static int adjust_tp(struct atm_trafprm *tp, unsigned char aal)
257{ 258{
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 42d5ff02cb59..c83f618282f7 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -186,6 +186,7 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt)
186 BT_DBG("%s %ld", hdev->name, opt); 186 BT_DBG("%s %ld", hdev->name, opt);
187 187
188 /* Reset device */ 188 /* Reset device */
189 set_bit(HCI_RESET, &hdev->flags);
189 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); 190 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
190} 191}
191 192
@@ -213,8 +214,10 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
213 /* Mandatory initialization */ 214 /* Mandatory initialization */
214 215
215 /* Reset */ 216 /* Reset */
216 if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) 217 if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
218 set_bit(HCI_RESET, &hdev->flags);
217 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); 219 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
220 }
218 221
219 /* Read Local Supported Features */ 222 /* Read Local Supported Features */
220 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL); 223 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
@@ -584,6 +587,9 @@ static int hci_dev_do_close(struct hci_dev *hdev)
584 hci_req_cancel(hdev, ENODEV); 587 hci_req_cancel(hdev, ENODEV);
585 hci_req_lock(hdev); 588 hci_req_lock(hdev);
586 589
590 /* Stop timer, it might be running */
591 del_timer_sync(&hdev->cmd_timer);
592
587 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { 593 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
588 hci_req_unlock(hdev); 594 hci_req_unlock(hdev);
589 return 0; 595 return 0;
@@ -623,7 +629,6 @@ static int hci_dev_do_close(struct hci_dev *hdev)
623 629
624 /* Drop last sent command */ 630 /* Drop last sent command */
625 if (hdev->sent_cmd) { 631 if (hdev->sent_cmd) {
626 del_timer_sync(&hdev->cmd_timer);
627 kfree_skb(hdev->sent_cmd); 632 kfree_skb(hdev->sent_cmd);
628 hdev->sent_cmd = NULL; 633 hdev->sent_cmd = NULL;
629 } 634 }
@@ -1074,6 +1079,7 @@ static void hci_cmd_timer(unsigned long arg)
1074 1079
1075 BT_ERR("%s command tx timeout", hdev->name); 1080 BT_ERR("%s command tx timeout", hdev->name);
1076 atomic_set(&hdev->cmd_cnt, 1); 1081 atomic_set(&hdev->cmd_cnt, 1);
1082 clear_bit(HCI_RESET, &hdev->flags);
1077 tasklet_schedule(&hdev->cmd_task); 1083 tasklet_schedule(&hdev->cmd_task);
1078} 1084}
1079 1085
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3fbfa50c2bff..cebe7588469f 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -183,6 +183,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
183 183
184 BT_DBG("%s status 0x%x", hdev->name, status); 184 BT_DBG("%s status 0x%x", hdev->name, status);
185 185
186 clear_bit(HCI_RESET, &hdev->flags);
187
186 hci_req_complete(hdev, HCI_OP_RESET, status); 188 hci_req_complete(hdev, HCI_OP_RESET, status);
187} 189}
188 190
@@ -1847,7 +1849,7 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
1847 if (ev->opcode != HCI_OP_NOP) 1849 if (ev->opcode != HCI_OP_NOP)
1848 del_timer(&hdev->cmd_timer); 1850 del_timer(&hdev->cmd_timer);
1849 1851
1850 if (ev->ncmd) { 1852 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
1851 atomic_set(&hdev->cmd_cnt, 1); 1853 atomic_set(&hdev->cmd_cnt, 1);
1852 if (!skb_queue_empty(&hdev->cmd_q)) 1854 if (!skb_queue_empty(&hdev->cmd_q))
1853 tasklet_schedule(&hdev->cmd_task); 1855 tasklet_schedule(&hdev->cmd_task);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index c9f9cecca527..ca27f3a41536 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1116,7 +1116,9 @@ int l2cap_ertm_send(struct sock *sk)
1116 bt_cb(skb)->tx_seq = pi->next_tx_seq; 1116 bt_cb(skb)->tx_seq = pi->next_tx_seq;
1117 pi->next_tx_seq = (pi->next_tx_seq + 1) % 64; 1117 pi->next_tx_seq = (pi->next_tx_seq + 1) % 64;
1118 1118
1119 pi->unacked_frames++; 1119 if (bt_cb(skb)->retries == 1)
1120 pi->unacked_frames++;
1121
1120 pi->frames_sent++; 1122 pi->frames_sent++;
1121 1123
1122 if (skb_queue_is_last(TX_QUEUE(sk), skb)) 1124 if (skb_queue_is_last(TX_QUEUE(sk), skb))
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 36b9c5d0ebe3..299fe56a9668 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -923,8 +923,9 @@ void __l2cap_sock_close(struct sock *sk, int reason)
923 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); 923 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
924 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 924 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
925 L2CAP_CONN_RSP, sizeof(rsp), &rsp); 925 L2CAP_CONN_RSP, sizeof(rsp), &rsp);
926 } else 926 }
927 l2cap_chan_del(sk, reason); 927
928 l2cap_chan_del(sk, reason);
928 break; 929 break;
929 930
930 case BT_CONNECT: 931 case BT_CONNECT:
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 0054c74e27b7..4476d8e3c0f2 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1230,6 +1230,8 @@ static int user_confirm_reply(struct sock *sk, u16 index, unsigned char *data,
1230 if (!hdev) 1230 if (!hdev)
1231 return cmd_status(sk, index, mgmt_op, ENODEV); 1231 return cmd_status(sk, index, mgmt_op, ENODEV);
1232 1232
1233 hci_dev_lock_bh(hdev);
1234
1233 if (!test_bit(HCI_UP, &hdev->flags)) { 1235 if (!test_bit(HCI_UP, &hdev->flags)) {
1234 err = cmd_status(sk, index, mgmt_op, ENETDOWN); 1236 err = cmd_status(sk, index, mgmt_op, ENETDOWN);
1235 goto failed; 1237 goto failed;
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index f61eb2eff3fd..59660c909a7c 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1475,7 +1475,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1475 ip6h->payload_len == 0) 1475 ip6h->payload_len == 0)
1476 return 0; 1476 return 0;
1477 1477
1478 len = ntohs(ip6h->payload_len); 1478 len = ntohs(ip6h->payload_len) + sizeof(*ip6h);
1479 if (skb->len < len) 1479 if (skb->len < len)
1480 return -EINVAL; 1480 return -EINVAL;
1481 1481
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 5593f5aec942..9b61d09de9b9 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -213,7 +213,7 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)
213 213
214 /* user has chosen a value so keep it */ 214 /* user has chosen a value so keep it */
215 if (br->flags & BR_SET_MAC_ADDR) 215 if (br->flags & BR_SET_MAC_ADDR)
216 return; 216 return false;
217 217
218 list_for_each_entry(p, &br->port_list, list) { 218 list_for_each_entry(p, &br->port_list, list) {
219 if (addr == br_mac_zero || 219 if (addr == br_mac_zero ||
diff --git a/net/ceph/Kconfig b/net/ceph/Kconfig
index ad424049b0cf..be683f2d401f 100644
--- a/net/ceph/Kconfig
+++ b/net/ceph/Kconfig
@@ -4,6 +4,7 @@ config CEPH_LIB
4 select LIBCRC32C 4 select LIBCRC32C
5 select CRYPTO_AES 5 select CRYPTO_AES
6 select CRYPTO 6 select CRYPTO
7 select KEYS
7 default n 8 default n
8 help 9 help
9 Choose Y or M here to include cephlib, which provides the 10 Choose Y or M here to include cephlib, which provides the
diff --git a/net/ceph/auth.c b/net/ceph/auth.c
index 549c1f43e1d5..b4bf4ac090f1 100644
--- a/net/ceph/auth.c
+++ b/net/ceph/auth.c
@@ -35,12 +35,12 @@ static int ceph_auth_init_protocol(struct ceph_auth_client *ac, int protocol)
35/* 35/*
36 * setup, teardown. 36 * setup, teardown.
37 */ 37 */
38struct ceph_auth_client *ceph_auth_init(const char *name, const char *secret) 38struct ceph_auth_client *ceph_auth_init(const char *name, const struct ceph_crypto_key *key)
39{ 39{
40 struct ceph_auth_client *ac; 40 struct ceph_auth_client *ac;
41 int ret; 41 int ret;
42 42
43 dout("auth_init name '%s' secret '%s'\n", name, secret); 43 dout("auth_init name '%s'\n", name);
44 44
45 ret = -ENOMEM; 45 ret = -ENOMEM;
46 ac = kzalloc(sizeof(*ac), GFP_NOFS); 46 ac = kzalloc(sizeof(*ac), GFP_NOFS);
@@ -52,8 +52,8 @@ struct ceph_auth_client *ceph_auth_init(const char *name, const char *secret)
52 ac->name = name; 52 ac->name = name;
53 else 53 else
54 ac->name = CEPH_AUTH_NAME_DEFAULT; 54 ac->name = CEPH_AUTH_NAME_DEFAULT;
55 dout("auth_init name %s secret %s\n", ac->name, secret); 55 dout("auth_init name %s\n", ac->name);
56 ac->secret = secret; 56 ac->key = key;
57 return ac; 57 return ac;
58 58
59out: 59out:
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c
index 7fd5dfcf6e18..1587dc6010c6 100644
--- a/net/ceph/auth_x.c
+++ b/net/ceph/auth_x.c
@@ -662,14 +662,16 @@ int ceph_x_init(struct ceph_auth_client *ac)
662 goto out; 662 goto out;
663 663
664 ret = -EINVAL; 664 ret = -EINVAL;
665 if (!ac->secret) { 665 if (!ac->key) {
666 pr_err("no secret set (for auth_x protocol)\n"); 666 pr_err("no secret set (for auth_x protocol)\n");
667 goto out_nomem; 667 goto out_nomem;
668 } 668 }
669 669
670 ret = ceph_crypto_key_unarmor(&xi->secret, ac->secret); 670 ret = ceph_crypto_key_clone(&xi->secret, ac->key);
671 if (ret) 671 if (ret < 0) {
672 pr_err("cannot clone key: %d\n", ret);
672 goto out_nomem; 673 goto out_nomem;
674 }
673 675
674 xi->starting = true; 676 xi->starting = true;
675 xi->ticket_handlers = RB_ROOT; 677 xi->ticket_handlers = RB_ROOT;
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 95f96ab94bba..132963abc266 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -5,6 +5,8 @@
5#include <linux/fs.h> 5#include <linux/fs.h>
6#include <linux/inet.h> 6#include <linux/inet.h>
7#include <linux/in6.h> 7#include <linux/in6.h>
8#include <linux/key.h>
9#include <keys/ceph-type.h>
8#include <linux/module.h> 10#include <linux/module.h>
9#include <linux/mount.h> 11#include <linux/mount.h>
10#include <linux/parser.h> 12#include <linux/parser.h>
@@ -20,6 +22,7 @@
20#include <linux/ceph/decode.h> 22#include <linux/ceph/decode.h>
21#include <linux/ceph/mon_client.h> 23#include <linux/ceph/mon_client.h>
22#include <linux/ceph/auth.h> 24#include <linux/ceph/auth.h>
25#include "crypto.h"
23 26
24 27
25 28
@@ -117,9 +120,29 @@ int ceph_compare_options(struct ceph_options *new_opt,
117 if (ret) 120 if (ret)
118 return ret; 121 return ret;
119 122
120 ret = strcmp_null(opt1->secret, opt2->secret); 123 if (opt1->key && !opt2->key)
121 if (ret) 124 return -1;
122 return ret; 125 if (!opt1->key && opt2->key)
126 return 1;
127 if (opt1->key && opt2->key) {
128 if (opt1->key->type != opt2->key->type)
129 return -1;
130 if (opt1->key->created.tv_sec != opt2->key->created.tv_sec)
131 return -1;
132 if (opt1->key->created.tv_nsec != opt2->key->created.tv_nsec)
133 return -1;
134 if (opt1->key->len != opt2->key->len)
135 return -1;
136 if (opt1->key->key && !opt2->key->key)
137 return -1;
138 if (!opt1->key->key && opt2->key->key)
139 return 1;
140 if (opt1->key->key && opt2->key->key) {
141 ret = memcmp(opt1->key->key, opt2->key->key, opt1->key->len);
142 if (ret)
143 return ret;
144 }
145 }
123 146
124 /* any matching mon ip implies a match */ 147 /* any matching mon ip implies a match */
125 for (i = 0; i < opt1->num_mon; i++) { 148 for (i = 0; i < opt1->num_mon; i++) {
@@ -176,6 +199,7 @@ enum {
176 Opt_fsid, 199 Opt_fsid,
177 Opt_name, 200 Opt_name,
178 Opt_secret, 201 Opt_secret,
202 Opt_key,
179 Opt_ip, 203 Opt_ip,
180 Opt_last_string, 204 Opt_last_string,
181 /* string args above */ 205 /* string args above */
@@ -192,6 +216,7 @@ static match_table_t opt_tokens = {
192 {Opt_fsid, "fsid=%s"}, 216 {Opt_fsid, "fsid=%s"},
193 {Opt_name, "name=%s"}, 217 {Opt_name, "name=%s"},
194 {Opt_secret, "secret=%s"}, 218 {Opt_secret, "secret=%s"},
219 {Opt_key, "key=%s"},
195 {Opt_ip, "ip=%s"}, 220 {Opt_ip, "ip=%s"},
196 /* string args above */ 221 /* string args above */
197 {Opt_noshare, "noshare"}, 222 {Opt_noshare, "noshare"},
@@ -203,11 +228,56 @@ void ceph_destroy_options(struct ceph_options *opt)
203{ 228{
204 dout("destroy_options %p\n", opt); 229 dout("destroy_options %p\n", opt);
205 kfree(opt->name); 230 kfree(opt->name);
206 kfree(opt->secret); 231 if (opt->key) {
232 ceph_crypto_key_destroy(opt->key);
233 kfree(opt->key);
234 }
207 kfree(opt); 235 kfree(opt);
208} 236}
209EXPORT_SYMBOL(ceph_destroy_options); 237EXPORT_SYMBOL(ceph_destroy_options);
210 238
239/* get secret from key store */
240static int get_secret(struct ceph_crypto_key *dst, const char *name) {
241 struct key *ukey;
242 int key_err;
243 int err = 0;
244 struct ceph_crypto_key *ckey;
245
246 ukey = request_key(&key_type_ceph, name, NULL);
247 if (!ukey || IS_ERR(ukey)) {
248 /* request_key errors don't map nicely to mount(2)
249 errors; don't even try, but still printk */
250 key_err = PTR_ERR(ukey);
251 switch (key_err) {
252 case -ENOKEY:
253 pr_warning("ceph: Mount failed due to key not found: %s\n", name);
254 break;
255 case -EKEYEXPIRED:
256 pr_warning("ceph: Mount failed due to expired key: %s\n", name);
257 break;
258 case -EKEYREVOKED:
259 pr_warning("ceph: Mount failed due to revoked key: %s\n", name);
260 break;
261 default:
262 pr_warning("ceph: Mount failed due to unknown key error"
263 " %d: %s\n", key_err, name);
264 }
265 err = -EPERM;
266 goto out;
267 }
268
269 ckey = ukey->payload.data;
270 err = ceph_crypto_key_clone(dst, ckey);
271 if (err)
272 goto out_key;
273 /* pass through, err is 0 */
274
275out_key:
276 key_put(ukey);
277out:
278 return err;
279}
280
211int ceph_parse_options(struct ceph_options **popt, char *options, 281int ceph_parse_options(struct ceph_options **popt, char *options,
212 const char *dev_name, const char *dev_name_end, 282 const char *dev_name, const char *dev_name_end,
213 int (*parse_extra_token)(char *c, void *private), 283 int (*parse_extra_token)(char *c, void *private),
@@ -295,9 +365,24 @@ int ceph_parse_options(struct ceph_options **popt, char *options,
295 GFP_KERNEL); 365 GFP_KERNEL);
296 break; 366 break;
297 case Opt_secret: 367 case Opt_secret:
298 opt->secret = kstrndup(argstr[0].from, 368 opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
299 argstr[0].to-argstr[0].from, 369 if (!opt->key) {
300 GFP_KERNEL); 370 err = -ENOMEM;
371 goto out;
372 }
373 err = ceph_crypto_key_unarmor(opt->key, argstr[0].from);
374 if (err < 0)
375 goto out;
376 break;
377 case Opt_key:
378 opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
379 if (!opt->key) {
380 err = -ENOMEM;
381 goto out;
382 }
383 err = get_secret(opt->key, argstr[0].from);
384 if (err < 0)
385 goto out;
301 break; 386 break;
302 387
303 /* misc */ 388 /* misc */
@@ -394,8 +479,8 @@ void ceph_destroy_client(struct ceph_client *client)
394 ceph_osdc_stop(&client->osdc); 479 ceph_osdc_stop(&client->osdc);
395 480
396 /* 481 /*
397 * make sure mds and osd connections close out before destroying 482 * make sure osd connections close out before destroying the
398 * the auth module, which is needed to free those connections' 483 * auth module, which is needed to free those connections'
399 * ceph_authorizers. 484 * ceph_authorizers.
400 */ 485 */
401 ceph_msgr_flush(); 486 ceph_msgr_flush();
@@ -496,10 +581,14 @@ static int __init init_ceph_lib(void)
496 if (ret < 0) 581 if (ret < 0)
497 goto out; 582 goto out;
498 583
499 ret = ceph_msgr_init(); 584 ret = ceph_crypto_init();
500 if (ret < 0) 585 if (ret < 0)
501 goto out_debugfs; 586 goto out_debugfs;
502 587
588 ret = ceph_msgr_init();
589 if (ret < 0)
590 goto out_crypto;
591
503 pr_info("loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n", 592 pr_info("loaded (mon/osd proto %d/%d, osdmap %d/%d %d/%d)\n",
504 CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL, 593 CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL,
505 CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT, 594 CEPH_OSDMAP_VERSION, CEPH_OSDMAP_VERSION_EXT,
@@ -507,6 +596,8 @@ static int __init init_ceph_lib(void)
507 596
508 return 0; 597 return 0;
509 598
599out_crypto:
600 ceph_crypto_shutdown();
510out_debugfs: 601out_debugfs:
511 ceph_debugfs_cleanup(); 602 ceph_debugfs_cleanup();
512out: 603out:
@@ -517,6 +608,7 @@ static void __exit exit_ceph_lib(void)
517{ 608{
518 dout("exit_ceph_lib\n"); 609 dout("exit_ceph_lib\n");
519 ceph_msgr_exit(); 610 ceph_msgr_exit();
611 ceph_crypto_shutdown();
520 ceph_debugfs_cleanup(); 612 ceph_debugfs_cleanup();
521} 613}
522 614
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c
index 7b505b0c983f..5a8009c9e0cd 100644
--- a/net/ceph/crypto.c
+++ b/net/ceph/crypto.c
@@ -5,10 +5,23 @@
5#include <linux/scatterlist.h> 5#include <linux/scatterlist.h>
6#include <linux/slab.h> 6#include <linux/slab.h>
7#include <crypto/hash.h> 7#include <crypto/hash.h>
8#include <linux/key-type.h>
8 9
10#include <keys/ceph-type.h>
9#include <linux/ceph/decode.h> 11#include <linux/ceph/decode.h>
10#include "crypto.h" 12#include "crypto.h"
11 13
14int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
15 const struct ceph_crypto_key *src)
16{
17 memcpy(dst, src, sizeof(struct ceph_crypto_key));
18 dst->key = kmalloc(src->len, GFP_NOFS);
19 if (!dst->key)
20 return -ENOMEM;
21 memcpy(dst->key, src->key, src->len);
22 return 0;
23}
24
12int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end) 25int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end)
13{ 26{
14 if (*p + sizeof(u16) + sizeof(key->created) + 27 if (*p + sizeof(u16) + sizeof(key->created) +
@@ -410,3 +423,63 @@ int ceph_encrypt2(struct ceph_crypto_key *secret, void *dst, size_t *dst_len,
410 return -EINVAL; 423 return -EINVAL;
411 } 424 }
412} 425}
426
427int ceph_key_instantiate(struct key *key, const void *data, size_t datalen)
428{
429 struct ceph_crypto_key *ckey;
430 int ret;
431 void *p;
432
433 ret = -EINVAL;
434 if (datalen <= 0 || datalen > 32767 || !data)
435 goto err;
436
437 ret = key_payload_reserve(key, datalen);
438 if (ret < 0)
439 goto err;
440
441 ret = -ENOMEM;
442 ckey = kmalloc(sizeof(*ckey), GFP_KERNEL);
443 if (!ckey)
444 goto err;
445
446 /* TODO ceph_crypto_key_decode should really take const input */
447 p = (void*)data;
448 ret = ceph_crypto_key_decode(ckey, &p, (char*)data+datalen);
449 if (ret < 0)
450 goto err_ckey;
451
452 key->payload.data = ckey;
453 return 0;
454
455err_ckey:
456 kfree(ckey);
457err:
458 return ret;
459}
460
461int ceph_key_match(const struct key *key, const void *description)
462{
463 return strcmp(key->description, description) == 0;
464}
465
466void ceph_key_destroy(struct key *key) {
467 struct ceph_crypto_key *ckey = key->payload.data;
468
469 ceph_crypto_key_destroy(ckey);
470}
471
472struct key_type key_type_ceph = {
473 .name = "ceph",
474 .instantiate = ceph_key_instantiate,
475 .match = ceph_key_match,
476 .destroy = ceph_key_destroy,
477};
478
479int ceph_crypto_init(void) {
480 return register_key_type(&key_type_ceph);
481}
482
483void ceph_crypto_shutdown(void) {
484 unregister_key_type(&key_type_ceph);
485}
diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h
index f9eccace592b..1919d1550d75 100644
--- a/net/ceph/crypto.h
+++ b/net/ceph/crypto.h
@@ -19,6 +19,8 @@ static inline void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
19 kfree(key->key); 19 kfree(key->key);
20} 20}
21 21
22extern int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
23 const struct ceph_crypto_key *src);
22extern int ceph_crypto_key_encode(struct ceph_crypto_key *key, 24extern int ceph_crypto_key_encode(struct ceph_crypto_key *key,
23 void **p, void *end); 25 void **p, void *end);
24extern int ceph_crypto_key_decode(struct ceph_crypto_key *key, 26extern int ceph_crypto_key_decode(struct ceph_crypto_key *key,
@@ -40,6 +42,8 @@ extern int ceph_encrypt2(struct ceph_crypto_key *secret,
40 void *dst, size_t *dst_len, 42 void *dst, size_t *dst_len,
41 const void *src1, size_t src1_len, 43 const void *src1, size_t src1_len,
42 const void *src2, size_t src2_len); 44 const void *src2, size_t src2_len);
45extern int ceph_crypto_init(void);
46extern void ceph_crypto_shutdown(void);
43 47
44/* armor.c */ 48/* armor.c */
45extern int ceph_armor(char *dst, const char *src, const char *end); 49extern int ceph_armor(char *dst, const char *src, const char *end);
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 8a079399174a..cbe31fa45508 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -759,7 +759,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
759 759
760 /* authentication */ 760 /* authentication */
761 monc->auth = ceph_auth_init(cl->options->name, 761 monc->auth = ceph_auth_init(cl->options->name,
762 cl->options->secret); 762 cl->options->key);
763 if (IS_ERR(monc->auth)) 763 if (IS_ERR(monc->auth))
764 return PTR_ERR(monc->auth); 764 return PTR_ERR(monc->auth);
765 monc->auth->want_keys = 765 monc->auth->want_keys =
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 8d4ee7e01793..50af02737a3d 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -837,8 +837,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
837 dout("moving osd to %p lru\n", req->r_osd); 837 dout("moving osd to %p lru\n", req->r_osd);
838 __move_osd_to_lru(osdc, req->r_osd); 838 __move_osd_to_lru(osdc, req->r_osd);
839 } 839 }
840 if (list_empty(&req->r_osd_item) && 840 if (list_empty(&req->r_linger_item))
841 list_empty(&req->r_linger_item))
842 req->r_osd = NULL; 841 req->r_osd = NULL;
843 } 842 }
844 843
@@ -883,7 +882,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,
883 dout("moving osd to %p lru\n", req->r_osd); 882 dout("moving osd to %p lru\n", req->r_osd);
884 __move_osd_to_lru(osdc, req->r_osd); 883 __move_osd_to_lru(osdc, req->r_osd);
885 } 884 }
886 req->r_osd = NULL; 885 if (list_empty(&req->r_osd_item))
886 req->r_osd = NULL;
887 } 887 }
888} 888}
889 889
@@ -1602,11 +1602,11 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1602 cookie, ver, event); 1602 cookie, ver, event);
1603 if (event) { 1603 if (event) {
1604 event_work = kmalloc(sizeof(*event_work), GFP_NOIO); 1604 event_work = kmalloc(sizeof(*event_work), GFP_NOIO);
1605 INIT_WORK(&event_work->work, do_event_work);
1606 if (!event_work) { 1605 if (!event_work) {
1607 dout("ERROR: could not allocate event_work\n"); 1606 dout("ERROR: could not allocate event_work\n");
1608 goto done_err; 1607 goto done_err;
1609 } 1608 }
1609 INIT_WORK(&event_work->work, do_event_work);
1610 event_work->event = event; 1610 event_work->event = event;
1611 event_work->ver = ver; 1611 event_work->ver = ver;
1612 event_work->notify_id = notify_id; 1612 event_work->notify_id = notify_id;
@@ -1672,7 +1672,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1672 if (req->r_sent == 0) { 1672 if (req->r_sent == 0) {
1673 rc = __map_request(osdc, req); 1673 rc = __map_request(osdc, req);
1674 if (rc < 0) 1674 if (rc < 0)
1675 return rc; 1675 goto out_unlock;
1676 if (req->r_osd == NULL) { 1676 if (req->r_osd == NULL) {
1677 dout("send_request %p no up osds in pg\n", req); 1677 dout("send_request %p no up osds in pg\n", req);
1678 ceph_monc_request_next_osdmap(&osdc->client->monc); 1678 ceph_monc_request_next_osdmap(&osdc->client->monc);
@@ -1689,6 +1689,8 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1689 } 1689 }
1690 } 1690 }
1691 } 1691 }
1692
1693out_unlock:
1692 mutex_unlock(&osdc->request_mutex); 1694 mutex_unlock(&osdc->request_mutex);
1693 up_read(&osdc->map_sem); 1695 up_read(&osdc->map_sem);
1694 return rc; 1696 return rc;
diff --git a/net/core/dev.c b/net/core/dev.c
index 56c3e00098c0..956d3b006e8b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1454,6 +1454,27 @@ static inline void net_timestamp_check(struct sk_buff *skb)
1454 __net_timestamp(skb); 1454 __net_timestamp(skb);
1455} 1455}
1456 1456
1457static inline bool is_skb_forwardable(struct net_device *dev,
1458 struct sk_buff *skb)
1459{
1460 unsigned int len;
1461
1462 if (!(dev->flags & IFF_UP))
1463 return false;
1464
1465 len = dev->mtu + dev->hard_header_len + VLAN_HLEN;
1466 if (skb->len <= len)
1467 return true;
1468
1469 /* if TSO is enabled, we don't care about the length as the packet
1470 * could be forwarded without being segmented before
1471 */
1472 if (skb_is_gso(skb))
1473 return true;
1474
1475 return false;
1476}
1477
1457/** 1478/**
1458 * dev_forward_skb - loopback an skb to another netif 1479 * dev_forward_skb - loopback an skb to another netif
1459 * 1480 *
@@ -1477,8 +1498,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1477 skb_orphan(skb); 1498 skb_orphan(skb);
1478 nf_reset(skb); 1499 nf_reset(skb);
1479 1500
1480 if (unlikely(!(dev->flags & IFF_UP) || 1501 if (unlikely(!is_skb_forwardable(dev, skb))) {
1481 (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
1482 atomic_long_inc(&dev->rx_dropped); 1502 atomic_long_inc(&dev->rx_dropped);
1483 kfree_skb(skb); 1503 kfree_skb(skb);
1484 return NET_RX_DROP; 1504 return NET_RX_DROP;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 090d273d7865..1b74d3b64371 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -215,6 +215,9 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir)
215 case ARPHRD_INFINIBAND: 215 case ARPHRD_INFINIBAND:
216 ip_ib_mc_map(addr, dev->broadcast, haddr); 216 ip_ib_mc_map(addr, dev->broadcast, haddr);
217 return 0; 217 return 0;
218 case ARPHRD_IPGRE:
219 ip_ipgre_mc_map(addr, dev->broadcast, haddr);
220 return 0;
218 default: 221 default:
219 if (dir) { 222 if (dir) {
220 memcpy(haddr, dev->broadcast, dev->addr_len); 223 memcpy(haddr, dev->broadcast, dev->addr_len);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index f116ce8f1b46..451088330bbb 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1068,6 +1068,7 @@ static void ip_fib_net_exit(struct net *net)
1068 fib4_rules_exit(net); 1068 fib4_rules_exit(net);
1069#endif 1069#endif
1070 1070
1071 rtnl_lock();
1071 for (i = 0; i < FIB_TABLE_HASHSZ; i++) { 1072 for (i = 0; i < FIB_TABLE_HASHSZ; i++) {
1072 struct fib_table *tb; 1073 struct fib_table *tb;
1073 struct hlist_head *head; 1074 struct hlist_head *head;
@@ -1080,6 +1081,7 @@ static void ip_fib_net_exit(struct net *net)
1080 fib_free_table(tb); 1081 fib_free_table(tb);
1081 } 1082 }
1082 } 1083 }
1084 rtnl_unlock();
1083 kfree(net->ipv4.fib_table_hash); 1085 kfree(net->ipv4.fib_table_hash);
1084} 1086}
1085 1087
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 64f30eca1c67..17388c7f49c4 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1003,7 +1003,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
1003 int nlen; 1003 int nlen;
1004 u8 flags; 1004 u8 flags;
1005 1005
1006 BUG_ON(len > skb->len); 1006 if (WARN_ON(len > skb->len))
1007 return -EINVAL;
1007 1008
1008 nsize = skb_headlen(skb) - len; 1009 nsize = skb_headlen(skb) - len;
1009 if (nsize < 0) 1010 if (nsize < 0)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 0e49c9db3c98..92f952d093db 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -341,6 +341,8 @@ int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int d
341 case ARPHRD_INFINIBAND: 341 case ARPHRD_INFINIBAND:
342 ipv6_ib_mc_map(addr, dev->broadcast, buf); 342 ipv6_ib_mc_map(addr, dev->broadcast, buf);
343 return 0; 343 return 0;
344 case ARPHRD_IPGRE:
345 return ipv6_ipgre_mc_map(addr, dev->broadcast, buf);
344 default: 346 default:
345 if (dir) { 347 if (dir) {
346 memcpy(buf, dev->broadcast, dev->addr_len); 348 memcpy(buf, dev->broadcast, dev->addr_len);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 2b0c186862c8..56fa12538d45 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -503,6 +503,7 @@ static int tcp_v6_send_synack(struct sock *sk, struct request_sock *req,
503 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); 503 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
504 if (IS_ERR(dst)) { 504 if (IS_ERR(dst)) {
505 err = PTR_ERR(dst); 505 err = PTR_ERR(dst);
506 dst = NULL;
506 goto done; 507 goto done;
507 } 508 }
508 skb = tcp_make_synack(sk, dst, req, rvp); 509 skb = tcp_make_synack(sk, dst, req, rvp);
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 8c02469b7176..af3c56482c80 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -342,7 +342,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
342 if (IS_ERR(key->u.ccmp.tfm)) { 342 if (IS_ERR(key->u.ccmp.tfm)) {
343 err = PTR_ERR(key->u.ccmp.tfm); 343 err = PTR_ERR(key->u.ccmp.tfm);
344 kfree(key); 344 kfree(key);
345 key = ERR_PTR(err); 345 return ERR_PTR(err);
346 } 346 }
347 break; 347 break;
348 case WLAN_CIPHER_SUITE_AES_CMAC: 348 case WLAN_CIPHER_SUITE_AES_CMAC:
@@ -360,7 +360,7 @@ struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
360 if (IS_ERR(key->u.aes_cmac.tfm)) { 360 if (IS_ERR(key->u.aes_cmac.tfm)) {
361 err = PTR_ERR(key->u.aes_cmac.tfm); 361 err = PTR_ERR(key->u.aes_cmac.tfm);
362 kfree(key); 362 kfree(key);
363 key = ERR_PTR(err); 363 return ERR_PTR(err);
364 } 364 }
365 break; 365 break;
366 } 366 }
@@ -400,11 +400,12 @@ int ieee80211_key_link(struct ieee80211_key *key,
400{ 400{
401 struct ieee80211_key *old_key; 401 struct ieee80211_key *old_key;
402 int idx, ret; 402 int idx, ret;
403 bool pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; 403 bool pairwise;
404 404
405 BUG_ON(!sdata); 405 BUG_ON(!sdata);
406 BUG_ON(!key); 406 BUG_ON(!key);
407 407
408 pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
408 idx = key->conf.keyidx; 409 idx = key->conf.keyidx;
409 key->local = sdata->local; 410 key->local = sdata->local;
410 key->sdata = sdata; 411 key->sdata = sdata;
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 78e67d22dc1f..c06aa3ac6b9d 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -659,18 +659,14 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
659 struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; 659 struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
660 struct ieee80211_local *local = hw_to_local(mp->hw); 660 struct ieee80211_local *local = hw_to_local(mp->hw);
661 u16 sta_cap = sta->ht_cap.cap; 661 u16 sta_cap = sta->ht_cap.cap;
662 int n_supported = 0;
662 int ack_dur; 663 int ack_dur;
663 int stbc; 664 int stbc;
664 int i; 665 int i;
665 666
666 /* fall back to the old minstrel for legacy stations */ 667 /* fall back to the old minstrel for legacy stations */
667 if (!sta->ht_cap.ht_supported) { 668 if (!sta->ht_cap.ht_supported)
668 msp->is_ht = false; 669 goto use_legacy;
669 memset(&msp->legacy, 0, sizeof(msp->legacy));
670 msp->legacy.r = msp->ratelist;
671 msp->legacy.sample_table = msp->sample_table;
672 return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
673 }
674 670
675 BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != 671 BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) !=
676 MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS); 672 MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS);
@@ -725,7 +721,22 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
725 721
726 mi->groups[i].supported = 722 mi->groups[i].supported =
727 mcs->rx_mask[minstrel_mcs_groups[i].streams - 1]; 723 mcs->rx_mask[minstrel_mcs_groups[i].streams - 1];
724
725 if (mi->groups[i].supported)
726 n_supported++;
728 } 727 }
728
729 if (!n_supported)
730 goto use_legacy;
731
732 return;
733
734use_legacy:
735 msp->is_ht = false;
736 memset(&msp->legacy, 0, sizeof(msp->legacy));
737 msp->legacy.r = msp->ratelist;
738 msp->legacy.sample_table = msp->sample_table;
739 return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
729} 740}
730 741
731static void 742static void
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index c50b68423c7b..9d192d665ff5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -612,7 +612,8 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
612 skipped++; 612 skipped++;
613 continue; 613 continue;
614 } 614 }
615 if (!time_after(jiffies, tid_agg_rx->reorder_time[j] + 615 if (skipped &&
616 !time_after(jiffies, tid_agg_rx->reorder_time[j] +
616 HT_RX_REORDER_BUF_TIMEOUT)) 617 HT_RX_REORDER_BUF_TIMEOUT))
617 goto set_release_timer; 618 goto set_release_timer;
618 619
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 152976ec0b74..d5bf91d04f63 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1205,7 +1205,7 @@ SCTP_STATIC __init int sctp_init(void)
1205 if ((sctp_assoc_hashsize > (64 * 1024)) && order > 0) 1205 if ((sctp_assoc_hashsize > (64 * 1024)) && order > 0)
1206 continue; 1206 continue;
1207 sctp_assoc_hashtable = (struct sctp_hashbucket *) 1207 sctp_assoc_hashtable = (struct sctp_hashbucket *)
1208 __get_free_pages(GFP_ATOMIC, order); 1208 __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order);
1209 } while (!sctp_assoc_hashtable && --order > 0); 1209 } while (!sctp_assoc_hashtable && --order > 0);
1210 if (!sctp_assoc_hashtable) { 1210 if (!sctp_assoc_hashtable) {
1211 pr_err("Failed association hash alloc\n"); 1211 pr_err("Failed association hash alloc\n");
@@ -1238,7 +1238,7 @@ SCTP_STATIC __init int sctp_init(void)
1238 if ((sctp_port_hashsize > (64 * 1024)) && order > 0) 1238 if ((sctp_port_hashsize > (64 * 1024)) && order > 0)
1239 continue; 1239 continue;
1240 sctp_port_hashtable = (struct sctp_bind_hashbucket *) 1240 sctp_port_hashtable = (struct sctp_bind_hashbucket *)
1241 __get_free_pages(GFP_ATOMIC, order); 1241 __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order);
1242 } while (!sctp_port_hashtable && --order > 0); 1242 } while (!sctp_port_hashtable && --order > 0);
1243 if (!sctp_port_hashtable) { 1243 if (!sctp_port_hashtable) {
1244 pr_err("Failed bind hash alloc\n"); 1244 pr_err("Failed bind hash alloc\n");
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index de98665db524..b3434cc7d0cf 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3106,10 +3106,10 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
3106 3106
3107 /* create an ASCONF_ACK chunk. 3107 /* create an ASCONF_ACK chunk.
3108 * Based on the definitions of parameters, we know that the size of 3108 * Based on the definitions of parameters, we know that the size of
3109 * ASCONF_ACK parameters are less than or equal to the twice of ASCONF 3109 * ASCONF_ACK parameters are less than or equal to the fourfold of ASCONF
3110 * parameters. 3110 * parameters.
3111 */ 3111 */
3112 asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2); 3112 asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 4);
3113 if (!asconf_ack) 3113 if (!asconf_ack)
3114 goto done; 3114 goto done;
3115 3115
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index ea427f418f64..fbf6f33ae4d0 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -124,6 +124,15 @@ void cfg80211_bss_age(struct cfg80211_registered_device *dev,
124} 124}
125 125
126/* must hold dev->bss_lock! */ 126/* must hold dev->bss_lock! */
127static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
128 struct cfg80211_internal_bss *bss)
129{
130 list_del_init(&bss->list);
131 rb_erase(&bss->rbn, &dev->bss_tree);
132 kref_put(&bss->ref, bss_release);
133}
134
135/* must hold dev->bss_lock! */
127void cfg80211_bss_expire(struct cfg80211_registered_device *dev) 136void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
128{ 137{
129 struct cfg80211_internal_bss *bss, *tmp; 138 struct cfg80211_internal_bss *bss, *tmp;
@@ -134,9 +143,7 @@ void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
134 continue; 143 continue;
135 if (!time_after(jiffies, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE)) 144 if (!time_after(jiffies, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE))
136 continue; 145 continue;
137 list_del(&bss->list); 146 __cfg80211_unlink_bss(dev, bss);
138 rb_erase(&bss->rbn, &dev->bss_tree);
139 kref_put(&bss->ref, bss_release);
140 expired = true; 147 expired = true;
141 } 148 }
142 149
@@ -585,16 +592,23 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
585 struct cfg80211_internal_bss *res; 592 struct cfg80211_internal_bss *res;
586 size_t ielen = len - offsetof(struct ieee80211_mgmt, 593 size_t ielen = len - offsetof(struct ieee80211_mgmt,
587 u.probe_resp.variable); 594 u.probe_resp.variable);
588 size_t privsz = wiphy->bss_priv_size; 595 size_t privsz;
596
597 if (WARN_ON(!mgmt))
598 return NULL;
599
600 if (WARN_ON(!wiphy))
601 return NULL;
589 602
590 if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && 603 if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC &&
591 (signal < 0 || signal > 100))) 604 (signal < 0 || signal > 100)))
592 return NULL; 605 return NULL;
593 606
594 if (WARN_ON(!mgmt || !wiphy || 607 if (WARN_ON(len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable)))
595 len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable)))
596 return NULL; 608 return NULL;
597 609
610 privsz = wiphy->bss_priv_size;
611
598 res = kzalloc(sizeof(*res) + privsz + ielen, gfp); 612 res = kzalloc(sizeof(*res) + privsz + ielen, gfp);
599 if (!res) 613 if (!res)
600 return NULL; 614 return NULL;
@@ -662,11 +676,8 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
662 676
663 spin_lock_bh(&dev->bss_lock); 677 spin_lock_bh(&dev->bss_lock);
664 if (!list_empty(&bss->list)) { 678 if (!list_empty(&bss->list)) {
665 list_del_init(&bss->list); 679 __cfg80211_unlink_bss(dev, bss);
666 dev->bss_generation++; 680 dev->bss_generation++;
667 rb_erase(&bss->rbn, &dev->bss_tree);
668
669 kref_put(&bss->ref, bss_release);
670 } 681 }
671 spin_unlock_bh(&dev->bss_lock); 682 spin_unlock_bh(&dev->bss_lock);
672} 683}
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index a82e3756a72d..64449cb8f873 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -375,6 +375,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
375 } 375 }
376 376
377 if (runtime->no_period_wakeup) { 377 if (runtime->no_period_wakeup) {
378 snd_pcm_sframes_t xrun_threshold;
378 /* 379 /*
379 * Without regular period interrupts, we have to check 380 * Without regular period interrupts, we have to check
380 * the elapsed time to detect xruns. 381 * the elapsed time to detect xruns.
@@ -383,7 +384,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
383 if (jdelta < runtime->hw_ptr_buffer_jiffies / 2) 384 if (jdelta < runtime->hw_ptr_buffer_jiffies / 2)
384 goto no_delta_check; 385 goto no_delta_check;
385 hdelta = jdelta - delta * HZ / runtime->rate; 386 hdelta = jdelta - delta * HZ / runtime->rate;
386 while (hdelta > runtime->hw_ptr_buffer_jiffies / 2 + 1) { 387 xrun_threshold = runtime->hw_ptr_buffer_jiffies / 2 + 1;
388 while (hdelta > xrun_threshold) {
387 delta += runtime->buffer_size; 389 delta += runtime->buffer_size;
388 hw_base += runtime->buffer_size; 390 hw_base += runtime->buffer_size;
389 if (hw_base >= runtime->boundary) 391 if (hw_base >= runtime->boundary)
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c
index 0fce9218abb1..5466de8527bd 100644
--- a/sound/firewire/speakers.c
+++ b/sound/firewire/speakers.c
@@ -778,10 +778,9 @@ static int __devexit fwspk_remove(struct device *dev)
778{ 778{
779 struct fwspk *fwspk = dev_get_drvdata(dev); 779 struct fwspk *fwspk = dev_get_drvdata(dev);
780 780
781 snd_card_disconnect(fwspk->card);
782
783 mutex_lock(&fwspk->mutex); 781 mutex_lock(&fwspk->mutex);
784 amdtp_out_stream_pcm_abort(&fwspk->stream); 782 amdtp_out_stream_pcm_abort(&fwspk->stream);
783 snd_card_disconnect(fwspk->card);
785 fwspk_stop_stream(fwspk); 784 fwspk_stop_stream(fwspk);
786 mutex_unlock(&fwspk->mutex); 785 mutex_unlock(&fwspk->mutex);
787 786
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 537cfba829a5..863eafea691f 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -229,6 +229,7 @@ MODULE_PARM_DESC(lineio, "Line In to Rear Out (0 = auto, 1 = force).");
229#define ES_REG_1371_CODEC 0x14 /* W/R: Codec Read/Write register address */ 229#define ES_REG_1371_CODEC 0x14 /* W/R: Codec Read/Write register address */
230#define ES_1371_CODEC_RDY (1<<31) /* codec ready */ 230#define ES_1371_CODEC_RDY (1<<31) /* codec ready */
231#define ES_1371_CODEC_WIP (1<<30) /* codec register access in progress */ 231#define ES_1371_CODEC_WIP (1<<30) /* codec register access in progress */
232#define EV_1938_CODEC_MAGIC (1<<26)
232#define ES_1371_CODEC_PIRD (1<<23) /* codec read/write select register */ 233#define ES_1371_CODEC_PIRD (1<<23) /* codec read/write select register */
233#define ES_1371_CODEC_WRITE(a,d) ((((a)&0x7f)<<16)|(((d)&0xffff)<<0)) 234#define ES_1371_CODEC_WRITE(a,d) ((((a)&0x7f)<<16)|(((d)&0xffff)<<0))
234#define ES_1371_CODEC_READS(a) ((((a)&0x7f)<<16)|ES_1371_CODEC_PIRD) 235#define ES_1371_CODEC_READS(a) ((((a)&0x7f)<<16)|ES_1371_CODEC_PIRD)
@@ -603,12 +604,18 @@ static void snd_es1370_codec_write(struct snd_ak4531 *ak4531,
603 604
604#ifdef CHIP1371 605#ifdef CHIP1371
605 606
607static inline bool is_ev1938(struct ensoniq *ensoniq)
608{
609 return ensoniq->pci->device == 0x8938;
610}
611
606static void snd_es1371_codec_write(struct snd_ac97 *ac97, 612static void snd_es1371_codec_write(struct snd_ac97 *ac97,
607 unsigned short reg, unsigned short val) 613 unsigned short reg, unsigned short val)
608{ 614{
609 struct ensoniq *ensoniq = ac97->private_data; 615 struct ensoniq *ensoniq = ac97->private_data;
610 unsigned int t, x; 616 unsigned int t, x, flag;
611 617
618 flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0;
612 mutex_lock(&ensoniq->src_mutex); 619 mutex_lock(&ensoniq->src_mutex);
613 for (t = 0; t < POLL_COUNT; t++) { 620 for (t = 0; t < POLL_COUNT; t++) {
614 if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { 621 if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
@@ -630,7 +637,8 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
630 0x00010000) 637 0x00010000)
631 break; 638 break;
632 } 639 }
633 outl(ES_1371_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1371_CODEC)); 640 outl(ES_1371_CODEC_WRITE(reg, val) | flag,
641 ES_REG(ensoniq, 1371_CODEC));
634 /* restore SRC reg */ 642 /* restore SRC reg */
635 snd_es1371_wait_src_ready(ensoniq); 643 snd_es1371_wait_src_ready(ensoniq);
636 outl(x, ES_REG(ensoniq, 1371_SMPRATE)); 644 outl(x, ES_REG(ensoniq, 1371_SMPRATE));
@@ -647,8 +655,9 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
647 unsigned short reg) 655 unsigned short reg)
648{ 656{
649 struct ensoniq *ensoniq = ac97->private_data; 657 struct ensoniq *ensoniq = ac97->private_data;
650 unsigned int t, x, fail = 0; 658 unsigned int t, x, flag, fail = 0;
651 659
660 flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0;
652 __again: 661 __again:
653 mutex_lock(&ensoniq->src_mutex); 662 mutex_lock(&ensoniq->src_mutex);
654 for (t = 0; t < POLL_COUNT; t++) { 663 for (t = 0; t < POLL_COUNT; t++) {
@@ -671,7 +680,8 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
671 0x00010000) 680 0x00010000)
672 break; 681 break;
673 } 682 }
674 outl(ES_1371_CODEC_READS(reg), ES_REG(ensoniq, 1371_CODEC)); 683 outl(ES_1371_CODEC_READS(reg) | flag,
684 ES_REG(ensoniq, 1371_CODEC));
675 /* restore SRC reg */ 685 /* restore SRC reg */
676 snd_es1371_wait_src_ready(ensoniq); 686 snd_es1371_wait_src_ready(ensoniq);
677 outl(x, ES_REG(ensoniq, 1371_SMPRATE)); 687 outl(x, ES_REG(ensoniq, 1371_SMPRATE));
@@ -683,6 +693,11 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
683 /* now wait for the stinkin' data (RDY) */ 693 /* now wait for the stinkin' data (RDY) */
684 for (t = 0; t < POLL_COUNT; t++) { 694 for (t = 0; t < POLL_COUNT; t++) {
685 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { 695 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
696 if (is_ev1938(ensoniq)) {
697 for (t = 0; t < 100; t++)
698 inl(ES_REG(ensoniq, CONTROL));
699 x = inl(ES_REG(ensoniq, 1371_CODEC));
700 }
686 mutex_unlock(&ensoniq->src_mutex); 701 mutex_unlock(&ensoniq->src_mutex);
687 return ES_1371_CODEC_READ(x); 702 return ES_1371_CODEC_READ(x);
688 } 703 }
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index d08cf31596f3..69e33869a53e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3034,6 +3034,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3034 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), 3034 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
3035 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), 3035 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
3036 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 3036 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
3037 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD),
3037 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), 3038 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS),
3038 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ 3039 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */
3039 {} 3040 {}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 1e5a786c8c27..7e28a64884f6 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9863,7 +9863,6 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
9863 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 9863 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9864 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), 9864 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9865 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), 9865 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9866 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9867 9866
9868 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), 9867 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9869 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), 9868 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
@@ -10700,6 +10699,7 @@ enum {
10700 PINFIX_LENOVO_Y530, 10699 PINFIX_LENOVO_Y530,
10701 PINFIX_PB_M5210, 10700 PINFIX_PB_M5210,
10702 PINFIX_ACER_ASPIRE_7736, 10701 PINFIX_ACER_ASPIRE_7736,
10702 PINFIX_GIGABYTE_880GM,
10703}; 10703};
10704 10704
10705static const struct alc_fixup alc882_fixups[] = { 10705static const struct alc_fixup alc882_fixups[] = {
@@ -10731,6 +10731,13 @@ static const struct alc_fixup alc882_fixups[] = {
10731 .type = ALC_FIXUP_SKU, 10731 .type = ALC_FIXUP_SKU,
10732 .v.sku = ALC_FIXUP_SKU_IGNORE, 10732 .v.sku = ALC_FIXUP_SKU_IGNORE,
10733 }, 10733 },
10734 [PINFIX_GIGABYTE_880GM] = {
10735 .type = ALC_FIXUP_PINS,
10736 .v.pins = (const struct alc_pincfg[]) {
10737 { 0x14, 0x1114410 }, /* set as speaker */
10738 { }
10739 }
10740 },
10734}; 10741};
10735 10742
10736static struct snd_pci_quirk alc882_fixup_tbl[] = { 10743static struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -10738,6 +10745,7 @@ static struct snd_pci_quirk alc882_fixup_tbl[] = {
10738 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), 10745 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
10739 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), 10746 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10740 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), 10747 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10748 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM),
10741 {} 10749 {}
10742}; 10750};
10743 10751
@@ -18774,8 +18782,6 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
18774 ALC662_3ST_6ch_DIG), 18782 ALC662_3ST_6ch_DIG),
18775 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), 18783 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18776 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 18784 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18777 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18778 ALC662_3ST_6ch_DIG),
18779 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), 18785 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18780 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), 18786 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18781 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), 18787 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
@@ -19449,6 +19455,7 @@ enum {
19449 ALC662_FIXUP_IDEAPAD, 19455 ALC662_FIXUP_IDEAPAD,
19450 ALC272_FIXUP_MARIO, 19456 ALC272_FIXUP_MARIO,
19451 ALC662_FIXUP_CZC_P10T, 19457 ALC662_FIXUP_CZC_P10T,
19458 ALC662_FIXUP_GIGABYTE,
19452}; 19459};
19453 19460
19454static const struct alc_fixup alc662_fixups[] = { 19461static const struct alc_fixup alc662_fixups[] = {
@@ -19477,12 +19484,20 @@ static const struct alc_fixup alc662_fixups[] = {
19477 {} 19484 {}
19478 } 19485 }
19479 }, 19486 },
19487 [ALC662_FIXUP_GIGABYTE] = {
19488 .type = ALC_FIXUP_PINS,
19489 .v.pins = (const struct alc_pincfg[]) {
19490 { 0x14, 0x1114410 }, /* set as speaker */
19491 { }
19492 }
19493 },
19480}; 19494};
19481 19495
19482static struct snd_pci_quirk alc662_fixup_tbl[] = { 19496static struct snd_pci_quirk alc662_fixup_tbl[] = {
19483 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), 19497 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19484 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), 19498 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19485 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 19499 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19500 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE),
19486 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 19501 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19487 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 19502 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19488 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), 19503 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index 2a30eae1881c..a54d2a5b28f6 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -26,7 +26,9 @@
26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 26#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
27 27
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/delay.h>
29#include <linux/slab.h> 30#include <linux/slab.h>
31
30#include <asm/intel_scu_ipc.h> 32#include <asm/intel_scu_ipc.h>
31#include <sound/pcm.h> 33#include <sound/pcm.h>
32#include <sound/pcm_params.h> 34#include <sound/pcm_params.h>
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index f01f1417da41..082e9d51963f 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -324,6 +324,10 @@ static void dac33_init_chip(struct snd_soc_codec *codec)
324 dac33_write(codec, DAC33_OUT_AMP_CTRL, 324 dac33_write(codec, DAC33_OUT_AMP_CTRL,
325 dac33_read_reg_cache(codec, DAC33_OUT_AMP_CTRL)); 325 dac33_read_reg_cache(codec, DAC33_OUT_AMP_CTRL));
326 326
327 dac33_write(codec, DAC33_LDAC_PWR_CTRL,
328 dac33_read_reg_cache(codec, DAC33_LDAC_PWR_CTRL));
329 dac33_write(codec, DAC33_RDAC_PWR_CTRL,
330 dac33_read_reg_cache(codec, DAC33_RDAC_PWR_CTRL));
327} 331}
328 332
329static inline int dac33_read_id(struct snd_soc_codec *codec) 333static inline int dac33_read_id(struct snd_soc_codec *codec)
@@ -670,6 +674,7 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
670{ 674{
671 struct snd_soc_codec *codec = dac33->codec; 675 struct snd_soc_codec *codec = dac33->codec;
672 unsigned int delay; 676 unsigned int delay;
677 unsigned long flags;
673 678
674 switch (dac33->fifo_mode) { 679 switch (dac33->fifo_mode) {
675 case DAC33_FIFO_MODE1: 680 case DAC33_FIFO_MODE1:
@@ -677,10 +682,10 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
677 DAC33_THRREG(dac33->nsample)); 682 DAC33_THRREG(dac33->nsample));
678 683
679 /* Take the timestamps */ 684 /* Take the timestamps */
680 spin_lock_irq(&dac33->lock); 685 spin_lock_irqsave(&dac33->lock, flags);
681 dac33->t_stamp2 = ktime_to_us(ktime_get()); 686 dac33->t_stamp2 = ktime_to_us(ktime_get());
682 dac33->t_stamp1 = dac33->t_stamp2; 687 dac33->t_stamp1 = dac33->t_stamp2;
683 spin_unlock_irq(&dac33->lock); 688 spin_unlock_irqrestore(&dac33->lock, flags);
684 689
685 dac33_write16(codec, DAC33_PREFILL_MSB, 690 dac33_write16(codec, DAC33_PREFILL_MSB,
686 DAC33_THRREG(dac33->alarm_threshold)); 691 DAC33_THRREG(dac33->alarm_threshold));
@@ -692,11 +697,11 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
692 break; 697 break;
693 case DAC33_FIFO_MODE7: 698 case DAC33_FIFO_MODE7:
694 /* Take the timestamp */ 699 /* Take the timestamp */
695 spin_lock_irq(&dac33->lock); 700 spin_lock_irqsave(&dac33->lock, flags);
696 dac33->t_stamp1 = ktime_to_us(ktime_get()); 701 dac33->t_stamp1 = ktime_to_us(ktime_get());
697 /* Move back the timestamp with drain time */ 702 /* Move back the timestamp with drain time */
698 dac33->t_stamp1 -= dac33->mode7_us_to_lthr; 703 dac33->t_stamp1 -= dac33->mode7_us_to_lthr;
699 spin_unlock_irq(&dac33->lock); 704 spin_unlock_irqrestore(&dac33->lock, flags);
700 705
701 dac33_write16(codec, DAC33_PREFILL_MSB, 706 dac33_write16(codec, DAC33_PREFILL_MSB,
702 DAC33_THRREG(DAC33_MODE7_MARGIN)); 707 DAC33_THRREG(DAC33_MODE7_MARGIN));
@@ -714,13 +719,14 @@ static inline void dac33_prefill_handler(struct tlv320dac33_priv *dac33)
714static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33) 719static inline void dac33_playback_handler(struct tlv320dac33_priv *dac33)
715{ 720{
716 struct snd_soc_codec *codec = dac33->codec; 721 struct snd_soc_codec *codec = dac33->codec;
722 unsigned long flags;
717 723
718 switch (dac33->fifo_mode) { 724 switch (dac33->fifo_mode) {
719 case DAC33_FIFO_MODE1: 725 case DAC33_FIFO_MODE1:
720 /* Take the timestamp */ 726 /* Take the timestamp */
721 spin_lock_irq(&dac33->lock); 727 spin_lock_irqsave(&dac33->lock, flags);
722 dac33->t_stamp2 = ktime_to_us(ktime_get()); 728 dac33->t_stamp2 = ktime_to_us(ktime_get());
723 spin_unlock_irq(&dac33->lock); 729 spin_unlock_irqrestore(&dac33->lock, flags);
724 730
725 dac33_write16(codec, DAC33_NSAMPLE_MSB, 731 dac33_write16(codec, DAC33_NSAMPLE_MSB,
726 DAC33_THRREG(dac33->nsample)); 732 DAC33_THRREG(dac33->nsample));
@@ -773,10 +779,11 @@ static irqreturn_t dac33_interrupt_handler(int irq, void *dev)
773{ 779{
774 struct snd_soc_codec *codec = dev; 780 struct snd_soc_codec *codec = dev;
775 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); 781 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
782 unsigned long flags;
776 783
777 spin_lock(&dac33->lock); 784 spin_lock_irqsave(&dac33->lock, flags);
778 dac33->t_stamp1 = ktime_to_us(ktime_get()); 785 dac33->t_stamp1 = ktime_to_us(ktime_get());
779 spin_unlock(&dac33->lock); 786 spin_unlock_irqrestore(&dac33->lock, flags);
780 787
781 /* Do not schedule the workqueue in Mode7 */ 788 /* Do not schedule the workqueue in Mode7 */
782 if (dac33->fifo_mode != DAC33_FIFO_MODE7) 789 if (dac33->fifo_mode != DAC33_FIFO_MODE7)
@@ -1173,15 +1180,16 @@ static snd_pcm_sframes_t dac33_dai_delay(
1173 unsigned int time_delta, uthr; 1180 unsigned int time_delta, uthr;
1174 int samples_out, samples_in, samples; 1181 int samples_out, samples_in, samples;
1175 snd_pcm_sframes_t delay = 0; 1182 snd_pcm_sframes_t delay = 0;
1183 unsigned long flags;
1176 1184
1177 switch (dac33->fifo_mode) { 1185 switch (dac33->fifo_mode) {
1178 case DAC33_FIFO_BYPASS: 1186 case DAC33_FIFO_BYPASS:
1179 break; 1187 break;
1180 case DAC33_FIFO_MODE1: 1188 case DAC33_FIFO_MODE1:
1181 spin_lock(&dac33->lock); 1189 spin_lock_irqsave(&dac33->lock, flags);
1182 t0 = dac33->t_stamp1; 1190 t0 = dac33->t_stamp1;
1183 t1 = dac33->t_stamp2; 1191 t1 = dac33->t_stamp2;
1184 spin_unlock(&dac33->lock); 1192 spin_unlock_irqrestore(&dac33->lock, flags);
1185 t_now = ktime_to_us(ktime_get()); 1193 t_now = ktime_to_us(ktime_get());
1186 1194
1187 /* We have not started to fill the FIFO yet, delay is 0 */ 1195 /* We have not started to fill the FIFO yet, delay is 0 */
@@ -1246,10 +1254,10 @@ static snd_pcm_sframes_t dac33_dai_delay(
1246 } 1254 }
1247 break; 1255 break;
1248 case DAC33_FIFO_MODE7: 1256 case DAC33_FIFO_MODE7:
1249 spin_lock(&dac33->lock); 1257 spin_lock_irqsave(&dac33->lock, flags);
1250 t0 = dac33->t_stamp1; 1258 t0 = dac33->t_stamp1;
1251 uthr = dac33->uthr; 1259 uthr = dac33->uthr;
1252 spin_unlock(&dac33->lock); 1260 spin_unlock_irqrestore(&dac33->lock, flags);
1253 t_now = ktime_to_us(ktime_get()); 1261 t_now = ktime_to_us(ktime_get());
1254 1262
1255 /* We have not started to fill the FIFO yet, delay is 0 */ 1263 /* We have not started to fill the FIFO yet, delay is 0 */
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 482fcdb59bfa..255901c4460d 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1629,8 +1629,10 @@ static int twl6040_probe(struct snd_soc_codec *codec)
1629 priv->naudint = naudint; 1629 priv->naudint = naudint;
1630 priv->workqueue = create_singlethread_workqueue("twl6040-codec"); 1630 priv->workqueue = create_singlethread_workqueue("twl6040-codec");
1631 1631
1632 if (!priv->workqueue) 1632 if (!priv->workqueue) {
1633 ret = -ENOMEM;
1633 goto work_err; 1634 goto work_err;
1635 }
1634 1636
1635 INIT_DELAYED_WORK(&priv->delayed_work, twl6040_accessory_work); 1637 INIT_DELAYED_WORK(&priv->delayed_work, twl6040_accessory_work);
1636 1638
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index 671ef8dd524c..aab7765f401a 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -110,12 +110,12 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
110 slave_config.direction = DMA_TO_DEVICE; 110 slave_config.direction = DMA_TO_DEVICE;
111 slave_config.dst_addr = dma_params->dma_addr; 111 slave_config.dst_addr = dma_params->dma_addr;
112 slave_config.dst_addr_width = buswidth; 112 slave_config.dst_addr_width = buswidth;
113 slave_config.dst_maxburst = dma_params->burstsize; 113 slave_config.dst_maxburst = dma_params->burstsize * buswidth;
114 } else { 114 } else {
115 slave_config.direction = DMA_FROM_DEVICE; 115 slave_config.direction = DMA_FROM_DEVICE;
116 slave_config.src_addr = dma_params->dma_addr; 116 slave_config.src_addr = dma_params->dma_addr;
117 slave_config.src_addr_width = buswidth; 117 slave_config.src_addr_width = buswidth;
118 slave_config.src_maxburst = dma_params->burstsize; 118 slave_config.src_maxburst = dma_params->burstsize * buswidth;
119 } 119 }
120 120
121 ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config); 121 ret = dmaengine_slave_config(iprtd->dma_chan, &slave_config);
@@ -303,6 +303,11 @@ static struct snd_soc_platform_driver imx_soc_platform_mx2 = {
303 303
304static int __devinit imx_soc_platform_probe(struct platform_device *pdev) 304static int __devinit imx_soc_platform_probe(struct platform_device *pdev)
305{ 305{
306 struct imx_ssi *ssi = platform_get_drvdata(pdev);
307
308 ssi->dma_params_tx.burstsize = 6;
309 ssi->dma_params_rx.burstsize = 4;
310
306 return snd_soc_register_platform(&pdev->dev, &imx_soc_platform_mx2); 311 return snd_soc_register_platform(&pdev->dev, &imx_soc_platform_mx2);
307} 312}
308 313
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/imx/imx-ssi.h
index a4406a134892..dc8a87530e3e 100644
--- a/sound/soc/imx/imx-ssi.h
+++ b/sound/soc/imx/imx-ssi.h
@@ -234,7 +234,4 @@ void imx_pcm_free(struct snd_pcm *pcm);
234 */ 234 */
235#define IMX_SSI_DMABUF_SIZE (64 * 1024) 235#define IMX_SSI_DMABUF_SIZE (64 * 1024)
236 236
237#define DMA_RXFIFO_BURST 0x4
238#define DMA_TXFIFO_BURST 0x6
239
240#endif /* _IMX_SSI_H */ 237#endif /* _IMX_SSI_H */
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 784cff5f67e8..9027da466cae 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -310,7 +310,7 @@ static struct snd_soc_dai_link corgi_dai = {
310 .cpu_dai_name = "pxa2xx-i2s", 310 .cpu_dai_name = "pxa2xx-i2s",
311 .codec_dai_name = "wm8731-hifi", 311 .codec_dai_name = "wm8731-hifi",
312 .platform_name = "pxa-pcm-audio", 312 .platform_name = "pxa-pcm-audio",
313 .codec_name = "wm8731-codec-0.001b", 313 .codec_name = "wm8731-codec.0-001b",
314 .init = corgi_wm8731_init, 314 .init = corgi_wm8731_init,
315 .ops = &corgi_ops, 315 .ops = &corgi_ops,
316}; 316};
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 158c30e8210c..207dee5c5b16 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -165,8 +165,12 @@ grep-libs = $(filter -l%,$(1))
165strip-libs = $(filter-out -l%,$(1)) 165strip-libs = $(filter-out -l%,$(1))
166 166
167$(OUTPUT)python/perf.so: $(PYRF_OBJS) 167$(OUTPUT)python/perf.so: $(PYRF_OBJS)
168 $(QUIET_GEN)python util/setup.py --quiet build_ext --build-lib='$(OUTPUT)python' \ 168 $(QUIET_GEN)( \
169 --build-temp='$(OUTPUT)python/temp' 169 export CFLAGS="$(BASIC_CFLAGS)"; \
170 python util/setup.py --quiet build_ext --build-lib='$(OUTPUT)python' \
171 --build-temp='$(OUTPUT)python/temp' \
172 )
173
170# 174#
171# No Perl scripts right now: 175# No Perl scripts right now:
172# 176#
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6febcc168a8c..17d1dcb3c667 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -41,7 +41,7 @@ static u64 user_interval = ULLONG_MAX;
41static u64 default_interval = 0; 41static u64 default_interval = 0;
42 42
43static unsigned int page_size; 43static unsigned int page_size;
44static unsigned int mmap_pages = 128; 44static unsigned int mmap_pages = UINT_MAX;
45static unsigned int user_freq = UINT_MAX; 45static unsigned int user_freq = UINT_MAX;
46static int freq = 1000; 46static int freq = 1000;
47static int output; 47static int output;
@@ -275,11 +275,10 @@ try_again:
275 !no_inherit) < 0) { 275 !no_inherit) < 0) {
276 int err = errno; 276 int err = errno;
277 277
278 if (err == EPERM || err == EACCES) 278 if (err == EPERM || err == EACCES) {
279 die("Permission error - are you root?\n" 279 ui__warning_paranoid();
280 "\t Consider tweaking" 280 exit(EXIT_FAILURE);
281 " /proc/sys/kernel/perf_event_paranoid.\n"); 281 } else if (err == ENODEV && cpu_list) {
282 else if (err == ENODEV && cpu_list) {
283 die("No such device - did you specify" 282 die("No such device - did you specify"
284 " an out-of-range profile CPU?\n"); 283 " an out-of-range profile CPU?\n");
285 } else if (err == EINVAL && sample_id_all_avail) { 284 } else if (err == EINVAL && sample_id_all_avail) {
@@ -302,11 +301,19 @@ try_again:
302 && attr->config == PERF_COUNT_HW_CPU_CYCLES) { 301 && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
303 302
304 if (verbose) 303 if (verbose)
305 warning(" ... trying to fall back to cpu-clock-ticks\n"); 304 ui__warning("The cycles event is not supported, "
305 "trying to fall back to cpu-clock-ticks\n");
306 attr->type = PERF_TYPE_SOFTWARE; 306 attr->type = PERF_TYPE_SOFTWARE;
307 attr->config = PERF_COUNT_SW_CPU_CLOCK; 307 attr->config = PERF_COUNT_SW_CPU_CLOCK;
308 goto try_again; 308 goto try_again;
309 } 309 }
310
311 if (err == ENOENT) {
312 ui__warning("The %s event is not supported.\n",
313 event_name(pos));
314 exit(EXIT_FAILURE);
315 }
316
310 printf("\n"); 317 printf("\n");
311 error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n", 318 error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n",
312 err, strerror(err)); 319 err, strerror(err));
@@ -506,6 +513,10 @@ static int __cmd_record(int argc, const char **argv)
506 if (have_tracepoints(&evsel_list->entries)) 513 if (have_tracepoints(&evsel_list->entries))
507 perf_header__set_feat(&session->header, HEADER_TRACE_INFO); 514 perf_header__set_feat(&session->header, HEADER_TRACE_INFO);
508 515
516 /* 512 kiB: default amount of unprivileged mlocked memory */
517 if (mmap_pages == UINT_MAX)
518 mmap_pages = (512 * 1024) / page_size;
519
509 if (forks) { 520 if (forks) {
510 child_pid = fork(); 521 child_pid = fork();
511 if (child_pid < 0) { 522 if (child_pid < 0) {
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 676b4fb0070f..fc1273e976c5 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -850,10 +850,10 @@ try_again:
850 top.evlist->threads, group, inherit) < 0) { 850 top.evlist->threads, group, inherit) < 0) {
851 int err = errno; 851 int err = errno;
852 852
853 if (err == EPERM || err == EACCES) 853 if (err == EPERM || err == EACCES) {
854 die("Permission error - are you root?\n" 854 ui__warning_paranoid();
855 "\t Consider tweaking" 855 goto out_err;
856 " /proc/sys/kernel/perf_event_paranoid.\n"); 856 }
857 /* 857 /*
858 * If it's cycles then fall back to hrtimer 858 * If it's cycles then fall back to hrtimer
859 * based cpu-clock-tick sw counter, which 859 * based cpu-clock-tick sw counter, which
@@ -861,25 +861,41 @@ try_again:
861 */ 861 */
862 if (attr->type == PERF_TYPE_HARDWARE && 862 if (attr->type == PERF_TYPE_HARDWARE &&
863 attr->config == PERF_COUNT_HW_CPU_CYCLES) { 863 attr->config == PERF_COUNT_HW_CPU_CYCLES) {
864
865 if (verbose) 864 if (verbose)
866 warning(" ... trying to fall back to cpu-clock-ticks\n"); 865 ui__warning("Cycles event not supported,\n"
866 "trying to fall back to cpu-clock-ticks\n");
867 867
868 attr->type = PERF_TYPE_SOFTWARE; 868 attr->type = PERF_TYPE_SOFTWARE;
869 attr->config = PERF_COUNT_SW_CPU_CLOCK; 869 attr->config = PERF_COUNT_SW_CPU_CLOCK;
870 goto try_again; 870 goto try_again;
871 } 871 }
872 printf("\n"); 872
873 error("sys_perf_event_open() syscall returned with %d " 873 if (err == ENOENT) {
874 "(%s). /bin/dmesg may provide additional information.\n", 874 ui__warning("The %s event is not supported.\n",
875 err, strerror(err)); 875 event_name(counter));
876 die("No CONFIG_PERF_EVENTS=y kernel support configured?\n"); 876 goto out_err;
877 exit(-1); 877 }
878
879 ui__warning("The sys_perf_event_open() syscall "
880 "returned with %d (%s). /bin/dmesg "
881 "may provide additional information.\n"
882 "No CONFIG_PERF_EVENTS=y kernel support "
883 "configured?\n", err, strerror(err));
884 goto out_err;
878 } 885 }
879 } 886 }
880 887
881 if (perf_evlist__mmap(evlist, mmap_pages, false) < 0) 888 if (perf_evlist__mmap(evlist, mmap_pages, false) < 0) {
882 die("failed to mmap with %d (%s)\n", errno, strerror(errno)); 889 ui__warning("Failed to mmap with %d (%s)\n",
890 errno, strerror(errno));
891 goto out_err;
892 }
893
894 return;
895
896out_err:
897 exit_browser(0);
898 exit(0);
883} 899}
884 900
885static int __cmd_top(void) 901static int __cmd_top(void)
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index d4536a9e0d8c..155749d74350 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -57,6 +57,16 @@ void ui__warning(const char *format, ...)
57} 57}
58#endif 58#endif
59 59
60void ui__warning_paranoid(void)
61{
62 ui__warning("Permission error - are you root?\n"
63 "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
64 " -1 - Not paranoid at all\n"
65 " 0 - Disallow raw tracepoint access for unpriv\n"
66 " 1 - Disallow cpu events for unpriv\n"
67 " 2 - Disallow kernel profiling for unpriv\n");
68}
69
60void trace_event(union perf_event *event) 70void trace_event(union perf_event *event)
61{ 71{
62 unsigned char *raw_event = (void *)event; 72 unsigned char *raw_event = (void *)event;
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 93516cf4682c..fd53db47e3de 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -36,5 +36,6 @@ int ui_helpline__show_help(const char *format, va_list ap);
36#endif 36#endif
37 37
38void ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); 38void ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
39void ui__warning_paranoid(void);
39 40
40#endif /* __PERF_DEBUG_H */ 41#endif /* __PERF_DEBUG_H */
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2b15c362ef56..1023f67633a4 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -710,7 +710,7 @@ try_again:
710 * in the whole kernel symbol list. 710 * in the whole kernel symbol list.
711 */ 711 */
712 if ((long long)al->addr < 0 && 712 if ((long long)al->addr < 0 &&
713 cpumode == PERF_RECORD_MISC_KERNEL && 713 cpumode == PERF_RECORD_MISC_USER &&
714 machine && mg != &machine->kmaps) { 714 machine && mg != &machine->kmaps) {
715 mg = &machine->kmaps; 715 mg = &machine->kmaps;
716 goto try_again; 716 goto try_again;
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index e24ffadb20b2..bbc982f5dd8b 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -1,13 +1,18 @@
1#!/usr/bin/python2 1#!/usr/bin/python2
2 2
3from distutils.core import setup, Extension 3from distutils.core import setup, Extension
4from os import getenv
5
6cflags = ['-fno-strict-aliasing', '-Wno-write-strings']
7cflags += getenv('CFLAGS', '').split()
4 8
5perf = Extension('perf', 9perf = Extension('perf',
6 sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c', 10 sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c',
7 'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c', 11 'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c',
8 'util/util.c', 'util/xyarray.c', 'util/cgroup.c'], 12 'util/util.c', 'util/xyarray.c', 'util/cgroup.c'],
9 include_dirs = ['util/include'], 13 include_dirs = ['util/include'],
10 extra_compile_args = ['-fno-strict-aliasing', '-Wno-write-strings']) 14 extra_compile_args = cflags,
15 )
11 16
12setup(name='perf', 17setup(name='perf',
13 version='0.1', 18 version='0.1',
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 17df793c8924..f06c10f092ba 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1196,6 +1196,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name,
1196 if (curr_dso == NULL) 1196 if (curr_dso == NULL)
1197 goto out_elf_end; 1197 goto out_elf_end;
1198 curr_dso->kernel = self->kernel; 1198 curr_dso->kernel = self->kernel;
1199 curr_dso->long_name = self->long_name;
1200 curr_dso->long_name_len = self->long_name_len;
1199 curr_map = map__new2(start, curr_dso, 1201 curr_map = map__new2(start, curr_dso,
1200 map->type); 1202 map->type);
1201 if (curr_map == NULL) { 1203 if (curr_map == NULL) {
@@ -1842,6 +1844,7 @@ int dso__load_vmlinux(struct dso *self, struct map *map,
1842 if (fd < 0) 1844 if (fd < 0)
1843 return -1; 1845 return -1;
1844 1846
1847 dso__set_long_name(self, (char *)vmlinux);
1845 dso__set_loaded(self, map->type); 1848 dso__set_loaded(self, map->type);
1846 err = dso__load_sym(self, map, symfs_vmlinux, fd, filter, 0, 0); 1849 err = dso__load_sym(self, map, symfs_vmlinux, fd, filter, 0, 0);
1847 close(fd); 1850 close(fd);
@@ -2403,6 +2406,8 @@ int symbol__init(void)
2403 if (symbol_conf.initialized) 2406 if (symbol_conf.initialized)
2404 return 0; 2407 return 0;
2405 2408
2409 symbol_conf.priv_size = ALIGN(symbol_conf.priv_size, sizeof(u64));
2410
2406 elf_version(EV_CURRENT); 2411 elf_version(EV_CURRENT);
2407 if (symbol_conf.sort_by_name) 2412 if (symbol_conf.sort_by_name)
2408 symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) - 2413 symbol_conf.priv_size += (sizeof(struct symbol_name_rb_node) -