aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/afs.txt26
-rw-r--r--Documentation/filesystems/proc.txt15
-rw-r--r--MAINTAINERS10
-rw-r--r--Makefile2
-rw-r--r--REPORTING-BUGS5
-rw-r--r--arch/arm/configs/kirkwood_defconfig2
-rw-r--r--arch/arm/mach-kirkwood/ts219-setup.c9
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h2
-rw-r--r--arch/avr32/boards/favr-32/setup.c4
-rw-r--r--arch/avr32/lib/memcpy.S16
-rw-r--r--arch/microblaze/configs/mmu_defconfig70
-rw-r--r--arch/microblaze/configs/nommu_defconfig91
-rw-r--r--arch/microblaze/include/asm/hardirq.h2
-rw-r--r--arch/microblaze/kernel/intc.c2
-rw-r--r--arch/microblaze/kernel/irq.c9
-rw-r--r--arch/microblaze/kernel/syscall_table.S2
-rw-r--r--arch/microblaze/kernel/timer.c2
-rw-r--r--arch/microblaze/mm/init.c6
-rw-r--r--arch/s390/kernel/setup.c25
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c9
-rw-r--r--arch/sh/kernel/cpu/shmobile/sleep.S70
-rw-r--r--arch/sparc/kernel/smp_64.c4
-rw-r--r--arch/x86/boot/compressed/Makefile2
-rw-r--r--arch/x86/include/asm/pgtable.h12
-rw-r--r--arch/x86/include/asm/uv/uv_bau.h2
-rw-r--r--arch/x86/kernel/apic/ipi.c3
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c4
-rw-r--r--arch/x86/kernel/cpu/Makefile4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c19
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c7
-rw-r--r--arch/x86/kernel/head_32.S8
-rw-r--r--arch/x86/kernel/setup_percpu.c14
-rw-r--r--arch/x86/kernel/tlb_uv.c1
-rw-r--r--arch/x86/kernel/vmlinux.lds.S126
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/pat.c3
-rw-r--r--arch/x86/mm/tlb.c21
-rw-r--r--arch/x86/xen/Makefile4
-rw-r--r--arch/x86/xen/enlighten.c22
-rw-r--r--drivers/char/tty_ldisc.c10
-rw-r--r--drivers/clocksource/sh_cmt.c28
-rw-r--r--drivers/gpu/drm/drm_crtc.c40
-rw-r--r--drivers/gpu/drm/drm_edid.c72
-rw-r--r--drivers/gpu/drm/drm_sysfs.c51
-rw-r--r--drivers/gpu/drm/radeon/r100.c96
-rw-r--r--drivers/gpu/drm/radeon/r300.c42
-rw-r--r--drivers/gpu/drm/radeon/r420.c13
-rw-r--r--drivers/gpu/drm/radeon/r500_reg.h16
-rw-r--r--drivers/gpu/drm/radeon/r520.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon.h55
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h26
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c48
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.h5
-rw-r--r--drivers/gpu/drm/radeon/radeon_fb.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c30
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c54
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c37
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_crtc.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c19
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h16
-rw-r--r--drivers/gpu/drm/radeon/radeon_state.c3
-rw-r--r--drivers/gpu/drm/radeon/rs600.c82
-rw-r--r--drivers/gpu/drm/radeon/rs690.c65
-rw-r--r--drivers/gpu/drm/radeon/rv515.c19
-rw-r--r--drivers/i2c/busses/i2c-omap.c14
-rw-r--r--drivers/i2c/busses/i2c-stu300.c157
-rw-r--r--drivers/input/joydev.c68
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c1
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c1
-rw-r--r--drivers/input/tablet/wacom_sys.c43
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c17
-rw-r--r--drivers/md/md.c1
-rw-r--r--drivers/mtd/nand/orion_nand.c2
-rw-r--r--drivers/net/3c59x.c4
-rw-r--r--drivers/net/8139cp.c5
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/arm/w90p910_ether.c4
-rw-r--r--drivers/net/atl1c/atl1c_ethtool.c8
-rw-r--r--drivers/net/atlx/atl1.c8
-rw-r--r--drivers/net/b44.c5
-rw-r--r--drivers/net/bnx2.c17
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/can/dev.c7
-rw-r--r--drivers/net/cnic.c143
-rw-r--r--drivers/net/cnic.h1
-rw-r--r--drivers/net/cnic_if.h1
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000e/ich8lan.c94
-rw-r--r--drivers/net/e1000e/netdev.c22
-rw-r--r--drivers/net/fec.c9
-rw-r--r--drivers/net/fec_mpc52xx.c5
-rw-r--r--drivers/net/gianfar.c12
-rw-r--r--drivers/net/ibm_newemac/core.c2
-rw-r--r--drivers/net/irda/pxaficp_ir.c4
-rw-r--r--drivers/net/irda/w83977af_ir.c2
-rw-r--r--drivers/net/ixgbe/ixgbe.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c27
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c2
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c90
-rw-r--r--drivers/net/ixp2000/ixpdev.c5
-rw-r--r--drivers/net/macb.c7
-rw-r--r--drivers/net/mlx4/en_rx.c5
-rw-r--r--drivers/net/mlx4/en_tx.c5
-rw-r--r--drivers/net/netxen/netxen_nic.h2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c7
-rw-r--r--drivers/net/netxen/netxen_nic_main.c105
-rw-r--r--drivers/net/pcnet32.c2
-rw-r--r--drivers/net/smc91x.c40
-rw-r--r--drivers/net/tulip/tulip_core.c5
-rw-r--r--drivers/net/tun.c50
-rw-r--r--drivers/net/ucc_geth.c5
-rw-r--r--drivers/net/usb/pegasus.h2
-rw-r--r--drivers/net/via-rhine.c5
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c5
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c6
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c2
-rw-r--r--drivers/net/wireless/libertas/assoc.c18
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h4
-rw-r--r--drivers/net/wireless/mwl8k.c31
-rw-r--r--drivers/net/wireless/orinoco/hw.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h6
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c14
-rw-r--r--drivers/net/yellowfin.c28
-rw-r--r--drivers/net/zorro8390.c3
-rw-r--r--drivers/pci/pci-driver.c2
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/s390/block/dasd.c2
-rw-r--r--drivers/s390/cio/device.c4
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c98
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h6
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_config.c91
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c124
-rw-r--r--drivers/spi/spi_s3c24xx.c23
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c5
-rw-r--r--drivers/watchdog/ar7_wdt.c2
-rw-r--r--fs/btrfs/inode.c21
-rw-r--r--fs/buffer.c7
-rw-r--r--fs/exec.c4
-rw-r--r--fs/ext3/Kconfig32
-rw-r--r--fs/ext3/super.c40
-rw-r--r--fs/hugetlbfs/inode.c20
-rw-r--r--fs/libfs.c2
-rw-r--r--fs/nfs/nfs4state.c4
-rw-r--r--fs/nilfs2/super.c2
-rw-r--r--fs/nilfs2/the_nilfs.h2
-rw-r--r--fs/ocfs2/alloc.c2
-rw-r--r--fs/ocfs2/dlm/dlmunlock.c4
-rw-r--r--fs/ocfs2/ocfs2_lockid.h1
-rw-r--r--fs/ocfs2/quota_global.c10
-rw-r--r--fs/ocfs2/super.c6
-rw-r--r--fs/proc/base.c19
-rw-r--r--include/drm/radeon_drm.h6
-rw-r--r--include/linux/bitmap.h18
-rw-r--r--include/linux/cpumask.h20
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/gen_stats.h5
-rw-r--r--include/linux/hugetlb.h6
-rw-r--r--include/linux/mm_types.h2
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/ucb1400.h4
-rw-r--r--include/net/act_api.h2
-rw-r--r--include/net/gen_stats.h10
-rw-r--r--include/net/netfilter/xt_rateest.h2
-rw-r--r--include/net/pkt_sched.h4
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--init/main.c2
-rw-r--r--ipc/shm.c8
-rw-r--r--kernel/fork.c1
-rw-r--r--kernel/irq/manage.c10
-rw-r--r--kernel/perf_counter.c15
-rw-r--r--lib/bitmap.c12
-rw-r--r--mm/nommu.c4
-rw-r--r--mm/oom_kill.c64
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/percpu.c35
-rw-r--r--net/appletalk/ddp.c1
-rw-r--r--net/can/raw.c1
-rw-r--r--net/core/gen_estimator.c12
-rw-r--r--net/core/gen_stats.c11
-rw-r--r--net/core/netpoll.c5
-rw-r--r--net/dccp/proto.c1
-rw-r--r--net/econet/af_econet.c1
-rw-r--r--net/ieee802154/af_ieee802154.c8
-rw-r--r--net/ieee802154/dgram.c14
-rw-r--r--net/ieee802154/raw.c14
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv6/af_inet6.c4
-rw-r--r--net/irda/af_irda.c1
-rw-r--r--net/llc/af_llc.c1
-rw-r--r--net/mac80211/agg-tx.c8
-rw-r--r--net/mac80211/key.c28
-rw-r--r--net/netfilter/xt_RATEEST.c2
-rw-r--r--net/netfilter/xt_quota.c2
-rw-r--r--net/netrom/af_netrom.c1
-rw-r--r--net/netrom/nr_route.c21
-rw-r--r--net/phonet/pn_dev.c2
-rw-r--r--net/rose/af_rose.c1
-rw-r--r--net/sched/sch_api.c8
-rw-r--r--net/sched/sch_atm.c2
-rw-r--r--net/sched/sch_cbq.c25
-rw-r--r--net/sched/sch_drr.c2
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sched/sch_htb.c2
-rw-r--r--net/sctp/protocol.c1
-rw-r--r--net/xfrm/xfrm_hash.h2
-rw-r--r--security/Kconfig4
-rw-r--r--security/integrity/ima/ima_crypto.c6
-rw-r--r--sound/core/pcm_lib.c39
-rw-r--r--sound/pci/ali5451/ali5451.c18
-rw-r--r--sound/pci/hda/patch_analog.c6
-rw-r--r--sound/pci/hda/patch_realtek.c15
-rw-r--r--sound/pci/hda/patch_sigmatel.c6
-rw-r--r--sound/pci/vx222/vx222_ops.c4
-rw-r--r--tools/perf/Documentation/Makefile2
-rw-r--r--tools/perf/Documentation/examples.txt (renamed from tools/perf/Documentation/perf-examples.txt)0
-rw-r--r--tools/perf/builtin-annotate.c7
-rw-r--r--tools/perf/builtin-record.c2
221 files changed, 2284 insertions, 1432 deletions
diff --git a/Documentation/filesystems/afs.txt b/Documentation/filesystems/afs.txt
index 12ad6c7f4e50..ffef91c4e0d6 100644
--- a/Documentation/filesystems/afs.txt
+++ b/Documentation/filesystems/afs.txt
@@ -23,15 +23,13 @@ it does support include:
23 23
24 (*) Security (currently only AFS kaserver and KerberosIV tickets). 24 (*) Security (currently only AFS kaserver and KerberosIV tickets).
25 25
26 (*) File reading. 26 (*) File reading and writing.
27 27
28 (*) Automounting. 28 (*) Automounting.
29 29
30It does not yet support the following AFS features: 30 (*) Local caching (via fscache).
31
32 (*) Write support.
33 31
34 (*) Local caching. 32It does not yet support the following AFS features:
35 33
36 (*) pioctl() system call. 34 (*) pioctl() system call.
37 35
@@ -56,7 +54,7 @@ They permit the debugging messages to be turned on dynamically by manipulating
56the masks in the following files: 54the masks in the following files:
57 55
58 /sys/module/af_rxrpc/parameters/debug 56 /sys/module/af_rxrpc/parameters/debug
59 /sys/module/afs/parameters/debug 57 /sys/module/kafs/parameters/debug
60 58
61 59
62===== 60=====
@@ -66,9 +64,9 @@ USAGE
66When inserting the driver modules the root cell must be specified along with a 64When inserting the driver modules the root cell must be specified along with a
67list of volume location server IP addresses: 65list of volume location server IP addresses:
68 66
69 insmod af_rxrpc.o 67 modprobe af_rxrpc
70 insmod rxkad.o 68 modprobe rxkad
71 insmod kafs.o rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91 69 modprobe kafs rootcell=cambridge.redhat.com:172.16.18.73:172.16.18.91
72 70
73The first module is the AF_RXRPC network protocol driver. This provides the 71The first module is the AF_RXRPC network protocol driver. This provides the
74RxRPC remote operation protocol and may also be accessed from userspace. See: 72RxRPC remote operation protocol and may also be accessed from userspace. See:
@@ -81,7 +79,7 @@ is the actual filesystem driver for the AFS filesystem.
81Once the module has been loaded, more modules can be added by the following 79Once the module has been loaded, more modules can be added by the following
82procedure: 80procedure:
83 81
84 echo add grand.central.org 18.7.14.88:128.2.191.224 >/proc/fs/afs/cells 82 echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells
85 83
86Where the parameters to the "add" command are the name of a cell and a list of 84Where the parameters to the "add" command are the name of a cell and a list of
87volume location servers within that cell, with the latter separated by colons. 85volume location servers within that cell, with the latter separated by colons.
@@ -101,7 +99,7 @@ The name of the volume can be suffixes with ".backup" or ".readonly" to
101specify connection to only volumes of those types. 99specify connection to only volumes of those types.
102 100
103The name of the cell is optional, and if not given during a mount, then the 101The name of the cell is optional, and if not given during a mount, then the
104named volume will be looked up in the cell specified during insmod. 102named volume will be looked up in the cell specified during modprobe.
105 103
106Additional cells can be added through /proc (see later section). 104Additional cells can be added through /proc (see later section).
107 105
@@ -163,14 +161,14 @@ THE CELL DATABASE
163 161
164The filesystem maintains an internal database of all the cells it knows and the 162The filesystem maintains an internal database of all the cells it knows and the
165IP addresses of the volume location servers for those cells. The cell to which 163IP addresses of the volume location servers for those cells. The cell to which
166the system belongs is added to the database when insmod is performed by the 164the system belongs is added to the database when modprobe is performed by the
167"rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on 165"rootcell=" argument or, if compiled in, using a "kafs.rootcell=" argument on
168the kernel command line. 166the kernel command line.
169 167
170Further cells can be added by commands similar to the following: 168Further cells can be added by commands similar to the following:
171 169
172 echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells 170 echo add CELLNAME VLADDR[:VLADDR][:VLADDR]... >/proc/fs/afs/cells
173 echo add grand.central.org 18.7.14.88:128.2.191.224 >/proc/fs/afs/cells 171 echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 >/proc/fs/afs/cells
174 172
175No other cell database operations are available at this time. 173No other cell database operations are available at this time.
176 174
@@ -233,7 +231,7 @@ insmod /tmp/kafs.o rootcell=cambridge.redhat.com:172.16.18.91
233mount -t afs \%root.afs. /afs 231mount -t afs \%root.afs. /afs
234mount -t afs \%cambridge.redhat.com:root.cell. /afs/cambridge.redhat.com/ 232mount -t afs \%cambridge.redhat.com:root.cell. /afs/cambridge.redhat.com/
235 233
236echo add grand.central.org 18.7.14.88:128.2.191.224 > /proc/fs/afs/cells 234echo add grand.central.org 18.9.48.14:128.2.203.61:130.237.48.87 > /proc/fs/afs/cells
237mount -t afs "#grand.central.org:root.cell." /afs/grand.central.org/ 235mount -t afs "#grand.central.org:root.cell." /afs/grand.central.org/
238mount -t afs "#grand.central.org:root.archive." /afs/grand.central.org/archive 236mount -t afs "#grand.central.org:root.archive." /afs/grand.central.org/archive
239mount -t afs "#grand.central.org:root.contrib." /afs/grand.central.org/contrib 237mount -t afs "#grand.central.org:root.contrib." /afs/grand.central.org/contrib
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index fad18f9456e4..ffead13f9443 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1167,13 +1167,11 @@ CHAPTER 3: PER-PROCESS PARAMETERS
11673.1 /proc/<pid>/oom_adj - Adjust the oom-killer score 11673.1 /proc/<pid>/oom_adj - Adjust the oom-killer score
1168------------------------------------------------------ 1168------------------------------------------------------
1169 1169
1170This file can be used to adjust the score used to select which processes should 1170This file can be used to adjust the score used to select which processes
1171be killed in an out-of-memory situation. The oom_adj value is a characteristic 1171should be killed in an out-of-memory situation. Giving it a high score will
1172of the task's mm, so all threads that share an mm with pid will have the same 1172increase the likelihood of this process being killed by the oom-killer. Valid
1173oom_adj value. A high value will increase the likelihood of this process being 1173values are in the range -16 to +15, plus the special value -17, which disables
1174killed by the oom-killer. Valid values are in the range -16 to +15 as 1174oom-killing altogether for this process.
1175explained below and a special value of -17, which disables oom-killing
1176altogether for threads sharing pid's mm.
1177 1175
1178The process to be killed in an out-of-memory situation is selected among all others 1176The process to be killed in an out-of-memory situation is selected among all others
1179based on its badness score. This value equals the original memory size of the process 1177based on its badness score. This value equals the original memory size of the process
@@ -1187,9 +1185,6 @@ the parent's score if they do not share the same memory. Thus forking servers
1187are the prime candidates to be killed. Having only one 'hungry' child will make 1185are the prime candidates to be killed. Having only one 'hungry' child will make
1188parent less preferable than the child. 1186parent less preferable than the child.
1189 1187
1190/proc/<pid>/oom_adj cannot be changed for kthreads since they are immune from
1191oom-killing already.
1192
1193/proc/<pid>/oom_score shows process' current badness score. 1188/proc/<pid>/oom_score shows process' current badness score.
1194 1189
1195The following heuristics are then applied: 1190The following heuristics are then applied:
diff --git a/MAINTAINERS b/MAINTAINERS
index 2c4326c0de9a..60299a9a7adb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -904,7 +904,7 @@ F: drivers/input/misc/ati_remote2.c
904 904
905ATLX ETHERNET DRIVERS 905ATLX ETHERNET DRIVERS
906M: Jay Cliburn <jcliburn@gmail.com> 906M: Jay Cliburn <jcliburn@gmail.com>
907M: Chris Snook <csnook@redhat.com> 907M: Chris Snook <chris.snook@gmail.com>
908M: Jie Yang <jie.yang@atheros.com> 908M: Jie Yang <jie.yang@atheros.com>
909L: atl1-devel@lists.sourceforge.net 909L: atl1-devel@lists.sourceforge.net
910W: http://sourceforge.net/projects/atl1 910W: http://sourceforge.net/projects/atl1
@@ -3429,6 +3429,7 @@ F: drivers/mfd/
3429 3429
3430MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM 3430MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
3431S: Orphan 3431S: Orphan
3432L: linux-mmc@vger.kernel.org
3432F: drivers/mmc/ 3433F: drivers/mmc/
3433F: include/linux/mmc/ 3434F: include/linux/mmc/
3434 3435
@@ -3563,6 +3564,9 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
3563S: Maintained 3564S: Maintained
3564F: net/ 3565F: net/
3565F: include/net/ 3566F: include/net/
3567F: include/linux/in.h
3568F: include/linux/net.h
3569F: include/linux/netdevice.h
3566 3570
3567NETWORKING [IPv4/IPv6] 3571NETWORKING [IPv4/IPv6]
3568M: "David S. Miller" <davem@davemloft.net> 3572M: "David S. Miller" <davem@davemloft.net>
@@ -3598,6 +3602,8 @@ W: http://www.linuxfoundation.org/en/Net
3598T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git 3602T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
3599S: Odd Fixes 3603S: Odd Fixes
3600F: drivers/net/ 3604F: drivers/net/
3605F: include/linux/if_*
3606F: include/linux/*device.h
3601 3607
3602NETXEN (1/10) GbE SUPPORT 3608NETXEN (1/10) GbE SUPPORT
3603M: Dhananjay Phadke <dhananjay@netxen.com> 3609M: Dhananjay Phadke <dhananjay@netxen.com>
@@ -3804,7 +3810,7 @@ W: http://open-osd.org
3804T: git git://git.open-osd.org/open-osd.git 3810T: git git://git.open-osd.org/open-osd.git
3805S: Maintained 3811S: Maintained
3806F: drivers/scsi/osd/ 3812F: drivers/scsi/osd/
3807F: drivers/include/scsi/osd_* 3813F: include/scsi/osd_*
3808F: fs/exofs/ 3814F: fs/exofs/
3809 3815
3810P54 WIRELESS DRIVER 3816P54 WIRELESS DRIVER
diff --git a/Makefile b/Makefile
index abcfa85f8f82..9c87e60d169c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 31 3SUBLEVEL = 31
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Man-Eating Seals of Antiquity 5NAME = Man-Eating Seals of Antiquity
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/REPORTING-BUGS b/REPORTING-BUGS
index ab0c56630a8c..55a6074ccbb7 100644
--- a/REPORTING-BUGS
+++ b/REPORTING-BUGS
@@ -15,7 +15,10 @@ worry too much about getting the wrong person. If you are unsure send it
15to the person responsible for the code relevant to what you were doing. 15to the person responsible for the code relevant to what you were doing.
16If it occurs repeatably try and describe how to recreate it. That is 16If it occurs repeatably try and describe how to recreate it. That is
17worth even more than the oops itself. The list of maintainers and 17worth even more than the oops itself. The list of maintainers and
18mailing lists is in the MAINTAINERS file in this directory. 18mailing lists is in the MAINTAINERS file in this directory. If you
19know the file name that causes the problem you can use the following
20command in this directory to find some of the maintainers of that file:
21 perl scripts/get_maintainer.pl -f <filename>
19 22
20 If it is a security bug, please copy the Security Contact listed 23 If it is a security bug, please copy the Security Contact listed
21in the MAINTAINERS file. They can help coordinate bugfix and disclosure. 24in the MAINTAINERS file. They can help coordinate bugfix and disclosure.
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 0a1abb978d7e..af74cc2de8b6 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -629,7 +629,7 @@ CONFIG_SCSI_LOWLEVEL=y
629CONFIG_ATA=y 629CONFIG_ATA=y
630# CONFIG_ATA_NONSTANDARD is not set 630# CONFIG_ATA_NONSTANDARD is not set
631CONFIG_SATA_PMP=y 631CONFIG_SATA_PMP=y
632# CONFIG_SATA_AHCI is not set 632CONFIG_SATA_AHCI=y
633# CONFIG_SATA_SIL24 is not set 633# CONFIG_SATA_SIL24 is not set
634CONFIG_ATA_SFF=y 634CONFIG_ATA_SFF=y
635# CONFIG_SATA_SVW is not set 635# CONFIG_SATA_SVW is not set
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c
index 01aa213c0a6f..ec1a64f263d2 100644
--- a/arch/arm/mach-kirkwood/ts219-setup.c
+++ b/arch/arm/mach-kirkwood/ts219-setup.c
@@ -206,6 +206,15 @@ static void __init qnap_ts219_init(void)
206 206
207} 207}
208 208
209static int __init ts219_pci_init(void)
210{
211 if (machine_is_ts219())
212 kirkwood_pcie_init();
213
214 return 0;
215}
216subsys_initcall(ts219_pci_init);
217
209MACHINE_START(TS219, "QNAP TS-119/TS-219") 218MACHINE_START(TS219, "QNAP TS-119/TS-219")
210 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */ 219 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
211 .phys_io = KIRKWOOD_REGS_PHYS_BASE, 220 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 9646a94ed3d0..07c430fdc9ef 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -11,6 +11,8 @@
11#ifndef __PLAT_GPIO_H 11#ifndef __PLAT_GPIO_H
12#define __PLAT_GPIO_H 12#define __PLAT_GPIO_H
13 13
14#include <linux/init.h>
15
14/* 16/*
15 * GENERIC_GPIO primitives. 17 * GENERIC_GPIO primitives.
16 */ 18 */
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c
index 46c9b0a224cf..75f19f47fb2f 100644
--- a/arch/avr32/boards/favr-32/setup.c
+++ b/arch/avr32/boards/favr-32/setup.c
@@ -72,6 +72,10 @@ static struct ads7846_platform_data ads7843_data = {
72 .debounce_max = 20, 72 .debounce_max = 20,
73 .debounce_rep = 4, 73 .debounce_rep = 4,
74 .debounce_tol = 5, 74 .debounce_tol = 5,
75
76 .keep_vref_on = true,
77 .settle_delay_usecs = 500,
78 .penirq_recheck_delay_usecs = 100,
75}; 79};
76 80
77static struct spi_board_info __initdata spi1_board_info[] = { 81static struct spi_board_info __initdata spi1_board_info[] = {
diff --git a/arch/avr32/lib/memcpy.S b/arch/avr32/lib/memcpy.S
index 0abb26142b64..c2ca49d705af 100644
--- a/arch/avr32/lib/memcpy.S
+++ b/arch/avr32/lib/memcpy.S
@@ -24,8 +24,8 @@ memcpy:
24 brne 1f 24 brne 1f
25 25
26 /* At this point, "from" is word-aligned */ 26 /* At this point, "from" is word-aligned */
272: sub r10, 4 272: mov r9, r12
28 mov r9, r12 285: sub r10, 4
29 brlt 4f 29 brlt 4f
30 30
313: ld.w r8, r11++ 313: ld.w r8, r11++
@@ -49,6 +49,7 @@ memcpy:
49 49
50 /* Handle unaligned "from" pointer */ 50 /* Handle unaligned "from" pointer */
511: sub r10, 4 511: sub r10, 4
52 movlt r9, r12
52 brlt 4b 53 brlt 4b
53 add r10, r9 54 add r10, r9
54 lsl r9, 2 55 lsl r9, 2
@@ -59,4 +60,13 @@ memcpy:
59 st.b r12++, r8 60 st.b r12++, r8
60 ld.ub r8, r11++ 61 ld.ub r8, r11++
61 st.b r12++, r8 62 st.b r12++, r8
62 rjmp 2b 63 mov r8, r12
64 add pc, pc, r9
65 sub r8, 1
66 nop
67 sub r8, 1
68 nop
69 sub r8, 1
70 nop
71 mov r9, r8
72 rjmp 5b
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig
index bd0b85ec38f5..09c32962b66f 100644
--- a/arch/microblaze/configs/mmu_defconfig
+++ b/arch/microblaze/configs/mmu_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc6 3# Linux kernel version: 2.6.31-rc6
4# Fri May 22 10:02:33 2009 4# Tue Aug 18 11:00:02 2009
5# 5#
6CONFIG_MICROBLAZE=y 6CONFIG_MICROBLAZE=y
7# CONFIG_SWAP is not set 7# CONFIG_SWAP is not set
@@ -18,7 +18,11 @@ CONFIG_GENERIC_TIME=y
18CONFIG_GENERIC_CLOCKEVENTS=y 18CONFIG_GENERIC_CLOCKEVENTS=y
19CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 19CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
20CONFIG_GENERIC_GPIO=y 20CONFIG_GENERIC_GPIO=y
21CONFIG_GENERIC_CSUM=y
22# CONFIG_PCI is not set
23CONFIG_NO_DMA=y
21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25CONFIG_CONSTRUCTORS=y
22 26
23# 27#
24# General setup 28# General setup
@@ -59,8 +63,8 @@ CONFIG_INITRAMFS_ROOT_GID=0
59CONFIG_RD_GZIP=y 63CONFIG_RD_GZIP=y
60# CONFIG_RD_BZIP2 is not set 64# CONFIG_RD_BZIP2 is not set
61# CONFIG_RD_LZMA is not set 65# CONFIG_RD_LZMA is not set
62CONFIG_INITRAMFS_COMPRESSION_NONE=y 66# CONFIG_INITRAMFS_COMPRESSION_NONE is not set
63# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set 67CONFIG_INITRAMFS_COMPRESSION_GZIP=y
64# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set 68# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
65# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set 69# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
66# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 70# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -71,7 +75,6 @@ CONFIG_SYSCTL_SYSCALL=y
71CONFIG_KALLSYMS=y 75CONFIG_KALLSYMS=y
72CONFIG_KALLSYMS_ALL=y 76CONFIG_KALLSYMS_ALL=y
73CONFIG_KALLSYMS_EXTRA_PASS=y 77CONFIG_KALLSYMS_EXTRA_PASS=y
74# CONFIG_STRIP_ASM_SYMS is not set
75# CONFIG_HOTPLUG is not set 78# CONFIG_HOTPLUG is not set
76CONFIG_PRINTK=y 79CONFIG_PRINTK=y
77CONFIG_BUG=y 80CONFIG_BUG=y
@@ -84,13 +87,22 @@ CONFIG_TIMERFD=y
84CONFIG_EVENTFD=y 87CONFIG_EVENTFD=y
85# CONFIG_SHMEM is not set 88# CONFIG_SHMEM is not set
86CONFIG_AIO=y 89CONFIG_AIO=y
90
91#
92# Performance Counters
93#
87CONFIG_VM_EVENT_COUNTERS=y 94CONFIG_VM_EVENT_COUNTERS=y
95# CONFIG_STRIP_ASM_SYMS is not set
88CONFIG_COMPAT_BRK=y 96CONFIG_COMPAT_BRK=y
89CONFIG_SLAB=y 97CONFIG_SLAB=y
90# CONFIG_SLUB is not set 98# CONFIG_SLUB is not set
91# CONFIG_SLOB is not set 99# CONFIG_SLOB is not set
92# CONFIG_PROFILING is not set 100# CONFIG_PROFILING is not set
93# CONFIG_MARKERS is not set 101# CONFIG_MARKERS is not set
102
103#
104# GCOV-based kernel profiling
105#
94# CONFIG_SLOW_WORK is not set 106# CONFIG_SLOW_WORK is not set
95# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 107# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
96CONFIG_SLABINFO=y 108CONFIG_SLABINFO=y
@@ -102,7 +114,7 @@ CONFIG_MODULE_UNLOAD=y
102# CONFIG_MODVERSIONS is not set 114# CONFIG_MODVERSIONS is not set
103# CONFIG_MODULE_SRCVERSION_ALL is not set 115# CONFIG_MODULE_SRCVERSION_ALL is not set
104CONFIG_BLOCK=y 116CONFIG_BLOCK=y
105# CONFIG_LBD is not set 117CONFIG_LBDAF=y
106# CONFIG_BLK_DEV_BSG is not set 118# CONFIG_BLK_DEV_BSG is not set
107# CONFIG_BLK_DEV_INTEGRITY is not set 119# CONFIG_BLK_DEV_INTEGRITY is not set
108 120
@@ -194,9 +206,9 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
194# CONFIG_PHYS_ADDR_T_64BIT is not set 206# CONFIG_PHYS_ADDR_T_64BIT is not set
195CONFIG_ZONE_DMA_FLAG=0 207CONFIG_ZONE_DMA_FLAG=0
196CONFIG_VIRT_TO_BUS=y 208CONFIG_VIRT_TO_BUS=y
197CONFIG_UNEVICTABLE_LRU=y
198CONFIG_HAVE_MLOCK=y 209CONFIG_HAVE_MLOCK=y
199CONFIG_HAVE_MLOCKED_PAGE_BIT=y 210CONFIG_HAVE_MLOCKED_PAGE_BIT=y
211CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
200 212
201# 213#
202# Exectuable file formats 214# Exectuable file formats
@@ -262,6 +274,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
262# CONFIG_ECONET is not set 274# CONFIG_ECONET is not set
263# CONFIG_WAN_ROUTER is not set 275# CONFIG_WAN_ROUTER is not set
264# CONFIG_PHONET is not set 276# CONFIG_PHONET is not set
277# CONFIG_IEEE802154 is not set
265# CONFIG_NET_SCHED is not set 278# CONFIG_NET_SCHED is not set
266# CONFIG_DCB is not set 279# CONFIG_DCB is not set
267 280
@@ -325,7 +338,6 @@ CONFIG_MISC_DEVICES=y
325# CONFIG_ATA is not set 338# CONFIG_ATA is not set
326# CONFIG_MD is not set 339# CONFIG_MD is not set
327CONFIG_NETDEVICES=y 340CONFIG_NETDEVICES=y
328CONFIG_COMPAT_NET_DEV_OPS=y
329# CONFIG_DUMMY is not set 341# CONFIG_DUMMY is not set
330# CONFIG_BONDING is not set 342# CONFIG_BONDING is not set
331# CONFIG_MACVLAN is not set 343# CONFIG_MACVLAN is not set
@@ -344,7 +356,7 @@ CONFIG_NET_ETHERNET=y
344# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set 356# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
345# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 357# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
346# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 358# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
347# CONFIG_B44 is not set 359# CONFIG_KS8842 is not set
348CONFIG_NETDEV_1000=y 360CONFIG_NETDEV_1000=y
349CONFIG_NETDEV_10000=y 361CONFIG_NETDEV_10000=y
350 362
@@ -410,6 +422,11 @@ CONFIG_LEGACY_PTY_COUNT=256
410# CONFIG_TCG_TPM is not set 422# CONFIG_TCG_TPM is not set
411# CONFIG_I2C is not set 423# CONFIG_I2C is not set
412# CONFIG_SPI is not set 424# CONFIG_SPI is not set
425
426#
427# PPS support
428#
429# CONFIG_PPS is not set
413CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 430CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
414# CONFIG_GPIOLIB is not set 431# CONFIG_GPIOLIB is not set
415# CONFIG_W1 is not set 432# CONFIG_W1 is not set
@@ -418,12 +435,6 @@ CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
418# CONFIG_THERMAL is not set 435# CONFIG_THERMAL is not set
419# CONFIG_THERMAL_HWMON is not set 436# CONFIG_THERMAL_HWMON is not set
420# CONFIG_WATCHDOG is not set 437# CONFIG_WATCHDOG is not set
421CONFIG_SSB_POSSIBLE=y
422
423#
424# Sonics Silicon Backplane
425#
426# CONFIG_SSB is not set
427 438
428# 439#
429# Multifunction device drivers 440# Multifunction device drivers
@@ -433,22 +444,7 @@ CONFIG_SSB_POSSIBLE=y
433# CONFIG_HTC_PASIC3 is not set 444# CONFIG_HTC_PASIC3 is not set
434# CONFIG_MFD_TMIO is not set 445# CONFIG_MFD_TMIO is not set
435# CONFIG_REGULATOR is not set 446# CONFIG_REGULATOR is not set
436 447# CONFIG_MEDIA_SUPPORT is not set
437#
438# Multimedia devices
439#
440
441#
442# Multimedia core support
443#
444# CONFIG_VIDEO_DEV is not set
445# CONFIG_DVB_CORE is not set
446# CONFIG_VIDEO_MEDIA is not set
447
448#
449# Multimedia drivers
450#
451# CONFIG_DAB is not set
452 448
453# 449#
454# Graphics support 450# Graphics support
@@ -469,9 +465,12 @@ CONFIG_SSB_POSSIBLE=y
469# CONFIG_NEW_LEDS is not set 465# CONFIG_NEW_LEDS is not set
470# CONFIG_ACCESSIBILITY is not set 466# CONFIG_ACCESSIBILITY is not set
471# CONFIG_RTC_CLASS is not set 467# CONFIG_RTC_CLASS is not set
472# CONFIG_DMADEVICES is not set
473# CONFIG_AUXDISPLAY is not set 468# CONFIG_AUXDISPLAY is not set
474# CONFIG_UIO is not set 469# CONFIG_UIO is not set
470
471#
472# TI VLYNQ
473#
475# CONFIG_STAGING is not set 474# CONFIG_STAGING is not set
476 475
477# 476#
@@ -485,12 +484,15 @@ CONFIG_EXT2_FS=y
485# CONFIG_REISERFS_FS is not set 484# CONFIG_REISERFS_FS is not set
486# CONFIG_JFS_FS is not set 485# CONFIG_JFS_FS is not set
487# CONFIG_FS_POSIX_ACL is not set 486# CONFIG_FS_POSIX_ACL is not set
488CONFIG_FILE_LOCKING=y
489# CONFIG_XFS_FS is not set 487# CONFIG_XFS_FS is not set
488# CONFIG_GFS2_FS is not set
490# CONFIG_OCFS2_FS is not set 489# CONFIG_OCFS2_FS is not set
491# CONFIG_BTRFS_FS is not set 490# CONFIG_BTRFS_FS is not set
491CONFIG_FILE_LOCKING=y
492CONFIG_FSNOTIFY=y
492# CONFIG_DNOTIFY is not set 493# CONFIG_DNOTIFY is not set
493# CONFIG_INOTIFY is not set 494# CONFIG_INOTIFY is not set
495CONFIG_INOTIFY_USER=y
494# CONFIG_QUOTA is not set 496# CONFIG_QUOTA is not set
495# CONFIG_AUTOFS_FS is not set 497# CONFIG_AUTOFS_FS is not set
496# CONFIG_AUTOFS4_FS is not set 498# CONFIG_AUTOFS4_FS is not set
@@ -678,6 +680,7 @@ CONFIG_DEBUG_INFO=y
678# CONFIG_SYSCTL_SYSCALL_CHECK is not set 680# CONFIG_SYSCTL_SYSCALL_CHECK is not set
679# CONFIG_PAGE_POISONING is not set 681# CONFIG_PAGE_POISONING is not set
680# CONFIG_SAMPLES is not set 682# CONFIG_SAMPLES is not set
683# CONFIG_KMEMCHECK is not set
681CONFIG_EARLY_PRINTK=y 684CONFIG_EARLY_PRINTK=y
682CONFIG_HEART_BEAT=y 685CONFIG_HEART_BEAT=y
683CONFIG_DEBUG_BOOTMEM=y 686CONFIG_DEBUG_BOOTMEM=y
@@ -793,6 +796,5 @@ CONFIG_ZLIB_INFLATE=y
793CONFIG_DECOMPRESS_GZIP=y 796CONFIG_DECOMPRESS_GZIP=y
794CONFIG_HAS_IOMEM=y 797CONFIG_HAS_IOMEM=y
795CONFIG_HAS_IOPORT=y 798CONFIG_HAS_IOPORT=y
796CONFIG_HAS_DMA=y
797CONFIG_HAVE_LMB=y 799CONFIG_HAVE_LMB=y
798CONFIG_NLATTR=y 800CONFIG_NLATTR=y
diff --git a/arch/microblaze/configs/nommu_defconfig b/arch/microblaze/configs/nommu_defconfig
index 4ef6af0a8f31..8b638615a972 100644
--- a/arch/microblaze/configs/nommu_defconfig
+++ b/arch/microblaze/configs/nommu_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc5 3# Linux kernel version: 2.6.31-rc6
4# Mon May 11 09:01:02 2009 4# Tue Aug 18 10:35:30 2009
5# 5#
6CONFIG_MICROBLAZE=y 6CONFIG_MICROBLAZE=y
7# CONFIG_SWAP is not set 7# CONFIG_SWAP is not set
@@ -17,9 +17,12 @@ CONFIG_GENERIC_TIME=y
17# CONFIG_GENERIC_TIME_VSYSCALL is not set 17# CONFIG_GENERIC_TIME_VSYSCALL is not set
18CONFIG_GENERIC_CLOCKEVENTS=y 18CONFIG_GENERIC_CLOCKEVENTS=y
19CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 19CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
20CONFIG_GENERIC_GPIO=y
21CONFIG_GENERIC_CSUM=y
20# CONFIG_PCI is not set 22# CONFIG_PCI is not set
21# CONFIG_NO_DMA is not set 23CONFIG_NO_DMA=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25CONFIG_CONSTRUCTORS=y
23 26
24# 27#
25# General setup 28# General setup
@@ -64,7 +67,6 @@ CONFIG_SYSCTL_SYSCALL=y
64CONFIG_KALLSYMS=y 67CONFIG_KALLSYMS=y
65CONFIG_KALLSYMS_ALL=y 68CONFIG_KALLSYMS_ALL=y
66CONFIG_KALLSYMS_EXTRA_PASS=y 69CONFIG_KALLSYMS_EXTRA_PASS=y
67# CONFIG_STRIP_ASM_SYMS is not set
68# CONFIG_HOTPLUG is not set 70# CONFIG_HOTPLUG is not set
69CONFIG_PRINTK=y 71CONFIG_PRINTK=y
70CONFIG_BUG=y 72CONFIG_BUG=y
@@ -76,13 +78,23 @@ CONFIG_SIGNALFD=y
76CONFIG_TIMERFD=y 78CONFIG_TIMERFD=y
77CONFIG_EVENTFD=y 79CONFIG_EVENTFD=y
78CONFIG_AIO=y 80CONFIG_AIO=y
81
82#
83# Performance Counters
84#
79CONFIG_VM_EVENT_COUNTERS=y 85CONFIG_VM_EVENT_COUNTERS=y
86# CONFIG_STRIP_ASM_SYMS is not set
80CONFIG_COMPAT_BRK=y 87CONFIG_COMPAT_BRK=y
81CONFIG_SLAB=y 88CONFIG_SLAB=y
82# CONFIG_SLUB is not set 89# CONFIG_SLUB is not set
83# CONFIG_SLOB is not set 90# CONFIG_SLOB is not set
84# CONFIG_PROFILING is not set 91# CONFIG_PROFILING is not set
85# CONFIG_MARKERS is not set 92# CONFIG_MARKERS is not set
93
94#
95# GCOV-based kernel profiling
96#
97# CONFIG_GCOV_KERNEL is not set
86# CONFIG_SLOW_WORK is not set 98# CONFIG_SLOW_WORK is not set
87# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 99# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
88CONFIG_SLABINFO=y 100CONFIG_SLABINFO=y
@@ -95,7 +107,7 @@ CONFIG_MODULE_UNLOAD=y
95# CONFIG_MODVERSIONS is not set 107# CONFIG_MODVERSIONS is not set
96# CONFIG_MODULE_SRCVERSION_ALL is not set 108# CONFIG_MODULE_SRCVERSION_ALL is not set
97CONFIG_BLOCK=y 109CONFIG_BLOCK=y
98# CONFIG_LBD is not set 110CONFIG_LBDAF=y
99# CONFIG_BLK_DEV_BSG is not set 111# CONFIG_BLK_DEV_BSG is not set
100# CONFIG_BLK_DEV_INTEGRITY is not set 112# CONFIG_BLK_DEV_INTEGRITY is not set
101 113
@@ -156,8 +168,16 @@ CONFIG_CMDLINE_BOOL=y
156CONFIG_CMDLINE="console=ttyUL0,115200" 168CONFIG_CMDLINE="console=ttyUL0,115200"
157# CONFIG_CMDLINE_FORCE is not set 169# CONFIG_CMDLINE_FORCE is not set
158CONFIG_OF=y 170CONFIG_OF=y
159CONFIG_OF_DEVICE=y
160CONFIG_PROC_DEVICETREE=y 171CONFIG_PROC_DEVICETREE=y
172
173#
174# Advanced setup
175#
176
177#
178# Default settings for advanced configuration options are used
179#
180CONFIG_KERNEL_START=0x90000000
161CONFIG_SELECT_MEMORY_MODEL=y 181CONFIG_SELECT_MEMORY_MODEL=y
162CONFIG_FLATMEM_MANUAL=y 182CONFIG_FLATMEM_MANUAL=y
163# CONFIG_DISCONTIGMEM_MANUAL is not set 183# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -169,7 +189,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
169# CONFIG_PHYS_ADDR_T_64BIT is not set 189# CONFIG_PHYS_ADDR_T_64BIT is not set
170CONFIG_ZONE_DMA_FLAG=0 190CONFIG_ZONE_DMA_FLAG=0
171CONFIG_VIRT_TO_BUS=y 191CONFIG_VIRT_TO_BUS=y
172CONFIG_UNEVICTABLE_LRU=y 192CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
173CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1 193CONFIG_NOMMU_INITIAL_TRIM_EXCESS=1
174 194
175# 195#
@@ -237,6 +257,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
237# CONFIG_ECONET is not set 257# CONFIG_ECONET is not set
238# CONFIG_WAN_ROUTER is not set 258# CONFIG_WAN_ROUTER is not set
239# CONFIG_PHONET is not set 259# CONFIG_PHONET is not set
260# CONFIG_IEEE802154 is not set
240# CONFIG_NET_SCHED is not set 261# CONFIG_NET_SCHED is not set
241# CONFIG_DCB is not set 262# CONFIG_DCB is not set
242 263
@@ -254,7 +275,11 @@ CONFIG_WIRELESS=y
254CONFIG_WIRELESS_OLD_REGULATORY=y 275CONFIG_WIRELESS_OLD_REGULATORY=y
255# CONFIG_WIRELESS_EXT is not set 276# CONFIG_WIRELESS_EXT is not set
256# CONFIG_LIB80211 is not set 277# CONFIG_LIB80211 is not set
257# CONFIG_MAC80211 is not set 278
279#
280# CFG80211 needs to be enabled for MAC80211
281#
282CONFIG_MAC80211_DEFAULT_PS_VALUE=0
258# CONFIG_WIMAX is not set 283# CONFIG_WIMAX is not set
259# CONFIG_RFKILL is not set 284# CONFIG_RFKILL is not set
260# CONFIG_NET_9P is not set 285# CONFIG_NET_9P is not set
@@ -353,6 +378,7 @@ CONFIG_MTD_UCLINUX=y
353# UBI - Unsorted block images 378# UBI - Unsorted block images
354# 379#
355# CONFIG_MTD_UBI is not set 380# CONFIG_MTD_UBI is not set
381CONFIG_OF_DEVICE=y
356# CONFIG_PARPORT is not set 382# CONFIG_PARPORT is not set
357CONFIG_BLK_DEV=y 383CONFIG_BLK_DEV=y
358# CONFIG_BLK_DEV_COW_COMMON is not set 384# CONFIG_BLK_DEV_COW_COMMON is not set
@@ -364,6 +390,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
364# CONFIG_BLK_DEV_XIP is not set 390# CONFIG_BLK_DEV_XIP is not set
365# CONFIG_CDROM_PKTCDVD is not set 391# CONFIG_CDROM_PKTCDVD is not set
366# CONFIG_ATA_OVER_ETH is not set 392# CONFIG_ATA_OVER_ETH is not set
393# CONFIG_XILINX_SYSACE is not set
367CONFIG_MISC_DEVICES=y 394CONFIG_MISC_DEVICES=y
368# CONFIG_ENCLOSURE_SERVICES is not set 395# CONFIG_ENCLOSURE_SERVICES is not set
369# CONFIG_C2PORT is not set 396# CONFIG_C2PORT is not set
@@ -383,7 +410,6 @@ CONFIG_MISC_DEVICES=y
383# CONFIG_ATA is not set 410# CONFIG_ATA is not set
384# CONFIG_MD is not set 411# CONFIG_MD is not set
385CONFIG_NETDEVICES=y 412CONFIG_NETDEVICES=y
386CONFIG_COMPAT_NET_DEV_OPS=y
387# CONFIG_DUMMY is not set 413# CONFIG_DUMMY is not set
388# CONFIG_BONDING is not set 414# CONFIG_BONDING is not set
389# CONFIG_MACVLAN is not set 415# CONFIG_MACVLAN is not set
@@ -402,7 +428,7 @@ CONFIG_NET_ETHERNET=y
402# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set 428# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
403# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set 429# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
404# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set 430# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
405# CONFIG_B44 is not set 431# CONFIG_KS8842 is not set
406CONFIG_NETDEV_1000=y 432CONFIG_NETDEV_1000=y
407CONFIG_NETDEV_10000=y 433CONFIG_NETDEV_10000=y
408 434
@@ -463,23 +489,25 @@ CONFIG_HW_RANDOM=y
463# CONFIG_HW_RANDOM_TIMERIOMEM is not set 489# CONFIG_HW_RANDOM_TIMERIOMEM is not set
464# CONFIG_RTC is not set 490# CONFIG_RTC is not set
465# CONFIG_GEN_RTC is not set 491# CONFIG_GEN_RTC is not set
492# CONFIG_XILINX_HWICAP is not set
466# CONFIG_R3964 is not set 493# CONFIG_R3964 is not set
467# CONFIG_RAW_DRIVER is not set 494# CONFIG_RAW_DRIVER is not set
468# CONFIG_TCG_TPM is not set 495# CONFIG_TCG_TPM is not set
469# CONFIG_I2C is not set 496# CONFIG_I2C is not set
470# CONFIG_SPI is not set 497# CONFIG_SPI is not set
498
499#
500# PPS support
501#
502# CONFIG_PPS is not set
503CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
504# CONFIG_GPIOLIB is not set
471# CONFIG_W1 is not set 505# CONFIG_W1 is not set
472# CONFIG_POWER_SUPPLY is not set 506# CONFIG_POWER_SUPPLY is not set
473# CONFIG_HWMON is not set 507# CONFIG_HWMON is not set
474# CONFIG_THERMAL is not set 508# CONFIG_THERMAL is not set
475# CONFIG_THERMAL_HWMON is not set 509# CONFIG_THERMAL_HWMON is not set
476# CONFIG_WATCHDOG is not set 510# CONFIG_WATCHDOG is not set
477CONFIG_SSB_POSSIBLE=y
478
479#
480# Sonics Silicon Backplane
481#
482# CONFIG_SSB is not set
483 511
484# 512#
485# Multifunction device drivers 513# Multifunction device drivers
@@ -489,22 +517,7 @@ CONFIG_SSB_POSSIBLE=y
489# CONFIG_HTC_PASIC3 is not set 517# CONFIG_HTC_PASIC3 is not set
490# CONFIG_MFD_TMIO is not set 518# CONFIG_MFD_TMIO is not set
491# CONFIG_REGULATOR is not set 519# CONFIG_REGULATOR is not set
492 520# CONFIG_MEDIA_SUPPORT is not set
493#
494# Multimedia devices
495#
496
497#
498# Multimedia core support
499#
500# CONFIG_VIDEO_DEV is not set
501# CONFIG_DVB_CORE is not set
502# CONFIG_VIDEO_MEDIA is not set
503
504#
505# Multimedia drivers
506#
507CONFIG_DAB=y
508 521
509# 522#
510# Graphics support 523# Graphics support
@@ -520,9 +533,10 @@ CONFIG_VIDEO_OUTPUT_CONTROL=y
520# CONFIG_DISPLAY_SUPPORT is not set 533# CONFIG_DISPLAY_SUPPORT is not set
521# CONFIG_SOUND is not set 534# CONFIG_SOUND is not set
522CONFIG_USB_SUPPORT=y 535CONFIG_USB_SUPPORT=y
523# CONFIG_USB_ARCH_HAS_HCD is not set 536CONFIG_USB_ARCH_HAS_HCD=y
524# CONFIG_USB_ARCH_HAS_OHCI is not set 537# CONFIG_USB_ARCH_HAS_OHCI is not set
525# CONFIG_USB_ARCH_HAS_EHCI is not set 538# CONFIG_USB_ARCH_HAS_EHCI is not set
539# CONFIG_USB is not set
526# CONFIG_USB_OTG_WHITELIST is not set 540# CONFIG_USB_OTG_WHITELIST is not set
527# CONFIG_USB_OTG_BLACKLIST_HUB is not set 541# CONFIG_USB_OTG_BLACKLIST_HUB is not set
528 542
@@ -543,9 +557,12 @@ CONFIG_USB_SUPPORT=y
543# CONFIG_NEW_LEDS is not set 557# CONFIG_NEW_LEDS is not set
544# CONFIG_ACCESSIBILITY is not set 558# CONFIG_ACCESSIBILITY is not set
545# CONFIG_RTC_CLASS is not set 559# CONFIG_RTC_CLASS is not set
546# CONFIG_DMADEVICES is not set
547# CONFIG_AUXDISPLAY is not set 560# CONFIG_AUXDISPLAY is not set
548# CONFIG_UIO is not set 561# CONFIG_UIO is not set
562
563#
564# TI VLYNQ
565#
549# CONFIG_STAGING is not set 566# CONFIG_STAGING is not set
550 567
551# 568#
@@ -558,12 +575,15 @@ CONFIG_EXT2_FS=y
558# CONFIG_REISERFS_FS is not set 575# CONFIG_REISERFS_FS is not set
559# CONFIG_JFS_FS is not set 576# CONFIG_JFS_FS is not set
560CONFIG_FS_POSIX_ACL=y 577CONFIG_FS_POSIX_ACL=y
561CONFIG_FILE_LOCKING=y
562# CONFIG_XFS_FS is not set 578# CONFIG_XFS_FS is not set
579# CONFIG_GFS2_FS is not set
563# CONFIG_OCFS2_FS is not set 580# CONFIG_OCFS2_FS is not set
564# CONFIG_BTRFS_FS is not set 581# CONFIG_BTRFS_FS is not set
582CONFIG_FILE_LOCKING=y
583CONFIG_FSNOTIFY=y
565# CONFIG_DNOTIFY is not set 584# CONFIG_DNOTIFY is not set
566# CONFIG_INOTIFY is not set 585# CONFIG_INOTIFY is not set
586CONFIG_INOTIFY_USER=y
567# CONFIG_QUOTA is not set 587# CONFIG_QUOTA is not set
568# CONFIG_AUTOFS_FS is not set 588# CONFIG_AUTOFS_FS is not set
569# CONFIG_AUTOFS4_FS is not set 589# CONFIG_AUTOFS4_FS is not set
@@ -813,6 +833,5 @@ CONFIG_GENERIC_FIND_LAST_BIT=y
813CONFIG_ZLIB_INFLATE=y 833CONFIG_ZLIB_INFLATE=y
814CONFIG_HAS_IOMEM=y 834CONFIG_HAS_IOMEM=y
815CONFIG_HAS_IOPORT=y 835CONFIG_HAS_IOPORT=y
816CONFIG_HAS_DMA=y
817CONFIG_HAVE_LMB=y 836CONFIG_HAVE_LMB=y
818CONFIG_NLATTR=y 837CONFIG_NLATTR=y
diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h
index 41e1e1aa36ac..cd1ac9aad56c 100644
--- a/arch/microblaze/include/asm/hardirq.h
+++ b/arch/microblaze/include/asm/hardirq.h
@@ -12,8 +12,6 @@
12/* should be defined in each interrupt controller driver */ 12/* should be defined in each interrupt controller driver */
13extern unsigned int get_irq(struct pt_regs *regs); 13extern unsigned int get_irq(struct pt_regs *regs);
14 14
15#define ack_bad_irq ack_bad_irq
16void ack_bad_irq(unsigned int irq);
17#include <asm-generic/hardirq.h> 15#include <asm-generic/hardirq.h>
18 16
19#endif /* _ASM_MICROBLAZE_HARDIRQ_H */ 17#endif /* _ASM_MICROBLAZE_HARDIRQ_H */
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
index b15605299a57..6eea6f92b84e 100644
--- a/arch/microblaze/kernel/intc.c
+++ b/arch/microblaze/kernel/intc.c
@@ -12,6 +12,7 @@
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/bug.h>
15 16
16#include <asm/prom.h> 17#include <asm/prom.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
@@ -130,6 +131,7 @@ void __init init_IRQ(void)
130 if (intc) 131 if (intc)
131 break; 132 break;
132 } 133 }
134 BUG_ON(!intc);
133 135
134 intc_baseaddr = *(int *) of_get_property(intc, "reg", NULL); 136 intc_baseaddr = *(int *) of_get_property(intc, "reg", NULL);
135 intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE); 137 intc_baseaddr = (unsigned long) ioremap(intc_baseaddr, PAGE_SIZE);
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
index f688ee93e3b9..7d5ddd62d4d2 100644
--- a/arch/microblaze/kernel/irq.c
+++ b/arch/microblaze/kernel/irq.c
@@ -30,15 +30,6 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
30} 30}
31EXPORT_SYMBOL_GPL(irq_of_parse_and_map); 31EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
32 32
33/*
34 * 'what should we do if we get a hw irq event on an illegal vector'.
35 * each architecture has to answer this themselves.
36 */
37void ack_bad_irq(unsigned int irq)
38{
39 printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", irq);
40}
41
42static u32 concurrent_irq; 33static u32 concurrent_irq;
43 34
44void do_IRQ(struct pt_regs *regs) 35void do_IRQ(struct pt_regs *regs)
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 216db817beb6..457216097dfd 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -313,7 +313,7 @@ ENTRY(sys_call_table)
313 .long sys_fchmodat 313 .long sys_fchmodat
314 .long sys_faccessat 314 .long sys_faccessat
315 .long sys_ni_syscall /* pselect6 */ 315 .long sys_ni_syscall /* pselect6 */
316 .long sys_ni_syscall /* sys_ppoll */ 316 .long sys_ppoll
317 .long sys_unshare /* 310 */ 317 .long sys_unshare /* 310 */
318 .long sys_set_robust_list 318 .long sys_set_robust_list
319 .long sys_get_robust_list 319 .long sys_get_robust_list
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index bdfa2f9f0c81..5499deae7fa6 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -22,6 +22,7 @@
22#include <linux/clocksource.h> 22#include <linux/clocksource.h>
23#include <linux/clockchips.h> 23#include <linux/clockchips.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/bug.h>
25#include <asm/cpuinfo.h> 26#include <asm/cpuinfo.h>
26#include <asm/setup.h> 27#include <asm/setup.h>
27#include <asm/prom.h> 28#include <asm/prom.h>
@@ -234,6 +235,7 @@ void __init time_init(void)
234 if (timer) 235 if (timer)
235 break; 236 break;
236 } 237 }
238 BUG_ON(!timer);
237 239
238 timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL); 240 timer_baseaddr = *(int *) of_get_property(timer, "reg", NULL);
239 timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE); 241 timer_baseaddr = (unsigned long) ioremap(timer_baseaddr, PAGE_SIZE);
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 8d92c4efe9a4..f207f1a94dbc 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -130,13 +130,13 @@ void __init setup_memory(void)
130 * (in case the address isn't page-aligned). 130 * (in case the address isn't page-aligned).
131 */ 131 */
132#ifndef CONFIG_MMU 132#ifndef CONFIG_MMU
133 map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(TOPHYS((u32)_end)), 133 map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(TOPHYS((u32)klimit)),
134 min_low_pfn, max_low_pfn); 134 min_low_pfn, max_low_pfn);
135#else 135#else
136 map_size = init_bootmem_node(&contig_page_data, 136 map_size = init_bootmem_node(&contig_page_data,
137 PFN_UP(TOPHYS((u32)_end)), min_low_pfn, max_low_pfn); 137 PFN_UP(TOPHYS((u32)klimit)), min_low_pfn, max_low_pfn);
138#endif 138#endif
139 lmb_reserve(PFN_UP(TOPHYS((u32)_end)) << PAGE_SHIFT, map_size); 139 lmb_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size);
140 140
141 /* free bootmem is whole main memory */ 141 /* free bootmem is whole main memory */
142 free_bootmem(memory_start, memory_size); 142 free_bootmem(memory_start, memory_size);
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 9717717c6fea..cbb897bc50bd 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -154,6 +154,20 @@ static int __init condev_setup(char *str)
154 154
155__setup("condev=", condev_setup); 155__setup("condev=", condev_setup);
156 156
157static void __init set_preferred_console(void)
158{
159 if (MACHINE_IS_KVM) {
160 add_preferred_console("hvc", 0, NULL);
161 s390_virtio_console_init();
162 return;
163 }
164
165 if (CONSOLE_IS_3215 || CONSOLE_IS_SCLP)
166 add_preferred_console("ttyS", 0, NULL);
167 if (CONSOLE_IS_3270)
168 add_preferred_console("tty3270", 0, NULL);
169}
170
157static int __init conmode_setup(char *str) 171static int __init conmode_setup(char *str)
158{ 172{
159#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE) 173#if defined(CONFIG_SCLP_CONSOLE) || defined(CONFIG_SCLP_VT220_CONSOLE)
@@ -168,6 +182,7 @@ static int __init conmode_setup(char *str)
168 if (strncmp(str, "3270", 5) == 0) 182 if (strncmp(str, "3270", 5) == 0)
169 SET_CONSOLE_3270; 183 SET_CONSOLE_3270;
170#endif 184#endif
185 set_preferred_console();
171 return 1; 186 return 1;
172} 187}
173 188
@@ -780,9 +795,6 @@ static void __init setup_hwcaps(void)
780void __init 795void __init
781setup_arch(char **cmdline_p) 796setup_arch(char **cmdline_p)
782{ 797{
783 /* set up preferred console */
784 add_preferred_console("ttyS", 0, NULL);
785
786 /* 798 /*
787 * print what head.S has found out about the machine 799 * print what head.S has found out about the machine
788 */ 800 */
@@ -802,11 +814,9 @@ setup_arch(char **cmdline_p)
802 if (MACHINE_IS_VM) 814 if (MACHINE_IS_VM)
803 pr_info("Linux is running as a z/VM " 815 pr_info("Linux is running as a z/VM "
804 "guest operating system in 64-bit mode\n"); 816 "guest operating system in 64-bit mode\n");
805 else if (MACHINE_IS_KVM) { 817 else if (MACHINE_IS_KVM)
806 pr_info("Linux is running under KVM in 64-bit mode\n"); 818 pr_info("Linux is running under KVM in 64-bit mode\n");
807 add_preferred_console("hvc", 0, NULL); 819 else
808 s390_virtio_console_init();
809 } else
810 pr_info("Linux is running natively in 64-bit mode\n"); 820 pr_info("Linux is running natively in 64-bit mode\n");
811#endif /* CONFIG_64BIT */ 821#endif /* CONFIG_64BIT */
812 822
@@ -851,6 +861,7 @@ setup_arch(char **cmdline_p)
851 861
852 /* Setup default console */ 862 /* Setup default console */
853 conmode_default(); 863 conmode_default();
864 set_preferred_console();
854 865
855 /* Setup zfcpdump support */ 866 /* Setup zfcpdump support */
856 setup_zfcpdump(console_devno); 867 setup_zfcpdump(console_devno);
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 8fed45a2fb85..15456a0773bf 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -238,7 +238,7 @@ static struct platform_device ceu1_device = {
238 }, 238 },
239}; 239};
240 240
241/* KEYSC */ 241/* KEYSC in SoC (Needs SW33-2 set to ON) */
242static struct sh_keysc_info keysc_info = { 242static struct sh_keysc_info keysc_info = {
243 .mode = SH_KEYSC_MODE_1, 243 .mode = SH_KEYSC_MODE_1,
244 .scan_timing = 10, 244 .scan_timing = 10,
@@ -255,12 +255,13 @@ static struct sh_keysc_info keysc_info = {
255 255
256static struct resource keysc_resources[] = { 256static struct resource keysc_resources[] = {
257 [0] = { 257 [0] = {
258 .start = 0x1a204000, 258 .name = "KEYSC",
259 .end = 0x1a20400f, 259 .start = 0x044b0000,
260 .end = 0x044b000f,
260 .flags = IORESOURCE_MEM, 261 .flags = IORESOURCE_MEM,
261 }, 262 },
262 [1] = { 263 [1] = {
263 .start = IRQ0_KEY, 264 .start = 79,
264 .flags = IORESOURCE_IRQ, 265 .flags = IORESOURCE_IRQ,
265 }, 266 },
266}; 267};
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S
index 5d888ef53d82..baf2d7d46b05 100644
--- a/arch/sh/kernel/cpu/shmobile/sleep.S
+++ b/arch/sh/kernel/cpu/shmobile/sleep.S
@@ -26,8 +26,30 @@ ENTRY(sh_mobile_standby)
26 26
27 tst #SUSP_SH_SF, r0 27 tst #SUSP_SH_SF, r0
28 bt skip_set_sf 28 bt skip_set_sf
29#ifdef CONFIG_CPU_SUBTYPE_SH7724
30 /* DBSC: put memory in self-refresh mode */
29 31
30 /* SDRAM: disable power down and put in self-refresh mode */ 32 mov.l dben_reg, r4
33 mov.l dben_data0, r1
34 mov.l r1, @r4
35
36 mov.l dbrfpdn0_reg, r4
37 mov.l dbrfpdn0_data0, r1
38 mov.l r1, @r4
39
40 mov.l dbcmdcnt_reg, r4
41 mov.l dbcmdcnt_data0, r1
42 mov.l r1, @r4
43
44 mov.l dbcmdcnt_reg, r4
45 mov.l dbcmdcnt_data1, r1
46 mov.l r1, @r4
47
48 mov.l dbrfpdn0_reg, r4
49 mov.l dbrfpdn0_data1, r1
50 mov.l r1, @r4
51#else
52 /* SBSC: disable power down and put in self-refresh mode */
31 mov.l 1f, r4 53 mov.l 1f, r4
32 mov.l 2f, r1 54 mov.l 2f, r1
33 mov.l @r4, r2 55 mov.l @r4, r2
@@ -35,6 +57,7 @@ ENTRY(sh_mobile_standby)
35 mov.l 3f, r3 57 mov.l 3f, r3
36 and r3, r2 58 and r3, r2
37 mov.l r2, @r4 59 mov.l r2, @r4
60#endif
38 61
39skip_set_sf: 62skip_set_sf:
40 tst #SUSP_SH_SLEEP, r0 63 tst #SUSP_SH_SLEEP, r0
@@ -84,7 +107,36 @@ done_sleep:
84 tst #SUSP_SH_SF, r0 107 tst #SUSP_SH_SF, r0
85 bt skip_restore_sf 108 bt skip_restore_sf
86 109
87 /* SDRAM: set auto-refresh mode */ 110#ifdef CONFIG_CPU_SUBTYPE_SH7724
111 /* DBSC: put memory in auto-refresh mode */
112
113 mov.l dbrfpdn0_reg, r4
114 mov.l dbrfpdn0_data0, r1
115 mov.l r1, @r4
116
117 /* sleep 140 ns */
118 nop
119 nop
120 nop
121 nop
122
123 mov.l dbcmdcnt_reg, r4
124 mov.l dbcmdcnt_data0, r1
125 mov.l r1, @r4
126
127 mov.l dbcmdcnt_reg, r4
128 mov.l dbcmdcnt_data1, r1
129 mov.l r1, @r4
130
131 mov.l dben_reg, r4
132 mov.l dben_data1, r1
133 mov.l r1, @r4
134
135 mov.l dbrfpdn0_reg, r4
136 mov.l dbrfpdn0_data2, r1
137 mov.l r1, @r4
138#else
139 /* SBSC: set auto-refresh mode */
88 mov.l 1f, r4 140 mov.l 1f, r4
89 mov.l @r4, r2 141 mov.l @r4, r2
90 mov.l 4f, r3 142 mov.l 4f, r3
@@ -98,15 +150,29 @@ done_sleep:
98 add r4, r3 150 add r4, r3
99 or r2, r3 151 or r2, r3
100 mov.l r3, @r1 152 mov.l r3, @r1
153#endif
101skip_restore_sf: 154skip_restore_sf:
102 rts 155 rts
103 nop 156 nop
104 157
105 .balign 4 158 .balign 4
159#ifdef CONFIG_CPU_SUBTYPE_SH7724
160dben_reg: .long 0xfd000010 /* DBEN */
161dben_data0: .long 0
162dben_data1: .long 1
163dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */
164dbrfpdn0_data0: .long 0
165dbrfpdn0_data1: .long 1
166dbrfpdn0_data2: .long 0x00010000
167dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */
168dbcmdcnt_data0: .long 2
169dbcmdcnt_data1: .long 4
170#else
1061: .long 0xfe400008 /* SDCR0 */ 1711: .long 0xfe400008 /* SDCR0 */
1072: .long 0x00000400 1722: .long 0x00000400
1083: .long 0xffff7fff 1733: .long 0xffff7fff
1094: .long 0xfffffbff 1744: .long 0xfffffbff
175#endif
1105: .long 0xa4150020 /* STBCR */ 1765: .long 0xa4150020 /* STBCR */
1116: .long 0xfe40001c /* RTCOR */ 1776: .long 0xfe40001c /* RTCOR */
1127: .long 0xfe400018 /* RTCNT */ 1787: .long 0xfe400018 /* RTCNT */
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index fa44eaf8d897..3691907a43b4 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1499,7 +1499,7 @@ void __init setup_per_cpu_areas(void)
1499 dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE; 1499 dyn_size = pcpur_size - static_size - PERCPU_MODULE_RESERVE;
1500 1500
1501 1501
1502 ptrs_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpur_ptrs[0])); 1502 ptrs_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpur_ptrs[0]));
1503 pcpur_ptrs = alloc_bootmem(ptrs_size); 1503 pcpur_ptrs = alloc_bootmem(ptrs_size);
1504 1504
1505 for_each_possible_cpu(cpu) { 1505 for_each_possible_cpu(cpu) {
@@ -1514,7 +1514,7 @@ void __init setup_per_cpu_areas(void)
1514 1514
1515 /* allocate address and map */ 1515 /* allocate address and map */
1516 vm.flags = VM_ALLOC; 1516 vm.flags = VM_ALLOC;
1517 vm.size = num_possible_cpus() * PCPU_CHUNK_SIZE; 1517 vm.size = nr_cpu_ids * PCPU_CHUNK_SIZE;
1518 vm_area_register_early(&vm, PCPU_CHUNK_SIZE); 1518 vm_area_register_early(&vm, PCPU_CHUNK_SIZE);
1519 1519
1520 for_each_possible_cpu(cpu) { 1520 for_each_possible_cpu(cpu) {
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index e2ff504b4ddc..f8ed0658404c 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -4,7 +4,7 @@
4# create a compressed vmlinux image from the original vmlinux 4# create a compressed vmlinux image from the original vmlinux
5# 5#
6 6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o 7targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma head_$(BITS).o misc.o piggy.o
8 8
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 3cc06e3fceb8..16748077559a 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -2,6 +2,7 @@
2#define _ASM_X86_PGTABLE_H 2#define _ASM_X86_PGTABLE_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm/e820.h>
5 6
6#include <asm/pgtable_types.h> 7#include <asm/pgtable_types.h>
7 8
@@ -269,10 +270,17 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
269 270
270#define canon_pgprot(p) __pgprot(massage_pgprot(p)) 271#define canon_pgprot(p) __pgprot(massage_pgprot(p))
271 272
272static inline int is_new_memtype_allowed(unsigned long flags, 273static inline int is_new_memtype_allowed(u64 paddr, unsigned long size,
273 unsigned long new_flags) 274 unsigned long flags,
275 unsigned long new_flags)
274{ 276{
275 /* 277 /*
278 * PAT type is always WB for ISA. So no need to check.
279 */
280 if (is_ISA_range(paddr, paddr + size - 1))
281 return 1;
282
283 /*
276 * Certain new memtypes are not allowed with certain 284 * Certain new memtypes are not allowed with certain
277 * requested memtype: 285 * requested memtype:
278 * - request is uncached, return cannot be write-back 286 * - request is uncached, return cannot be write-back
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index bddd44f2f0ab..80e2984f521c 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -133,7 +133,7 @@ struct bau_msg_payload {
133 * see table 4.2.3.0.1 in broacast_assist spec. 133 * see table 4.2.3.0.1 in broacast_assist spec.
134 */ 134 */
135struct bau_msg_header { 135struct bau_msg_header {
136 unsigned int dest_subnodeid:6; /* must be zero */ 136 unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */
137 /* bits 5:0 */ 137 /* bits 5:0 */
138 unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ 138 unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */
139 /* bits 20:6 */ /* first bit in node_map */ 139 /* bits 20:6 */ /* first bit in node_map */
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index dbf5445727a9..6ef00ba4c886 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -106,6 +106,9 @@ void default_send_IPI_mask_logical(const struct cpumask *cpumask, int vector)
106 unsigned long mask = cpumask_bits(cpumask)[0]; 106 unsigned long mask = cpumask_bits(cpumask)[0];
107 unsigned long flags; 107 unsigned long flags;
108 108
109 if (WARN_ONCE(!mask, "empty IPI mask"))
110 return;
111
109 local_irq_save(flags); 112 local_irq_save(flags);
110 WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]); 113 WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]);
111 __default_send_IPI_dest_field(mask, vector, apic->dest_logical); 114 __default_send_IPI_dest_field(mask, vector, apic->dest_logical);
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 832e908adcb5..601159374e87 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -46,7 +46,7 @@ static int early_get_nodeid(void)
46 return node_id.s.node_id; 46 return node_id.s.node_id;
47} 47}
48 48
49static int uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) 49static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
50{ 50{
51 if (!strcmp(oem_id, "SGI")) { 51 if (!strcmp(oem_id, "SGI")) {
52 if (!strcmp(oem_table_id, "UVL")) 52 if (!strcmp(oem_table_id, "UVL"))
@@ -253,7 +253,7 @@ static void uv_send_IPI_self(int vector)
253 apic_write(APIC_SELF_IPI, vector); 253 apic_write(APIC_SELF_IPI, vector);
254} 254}
255 255
256struct apic apic_x2apic_uv_x = { 256struct apic __refdata apic_x2apic_uv_x = {
257 257
258 .name = "UV large system", 258 .name = "UV large system",
259 .probe = NULL, 259 .probe = NULL,
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 3efcb2b96a15..c1f253dac155 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -7,6 +7,10 @@ ifdef CONFIG_FUNCTION_TRACER
7CFLAGS_REMOVE_common.o = -pg 7CFLAGS_REMOVE_common.o = -pg
8endif 8endif
9 9
10# Make sure load_percpu_segment has no stackprotector
11nostackp := $(call cc-option, -fno-stack-protector)
12CFLAGS_common.o := $(nostackp)
13
10obj-y := intel_cacheinfo.o addon_cpuid_features.o 14obj-y := intel_cacheinfo.o addon_cpuid_features.o
11obj-y += proc.o capflags.o powerflags.o common.o 15obj-y += proc.o capflags.o powerflags.o common.o
12obj-y += vmware.o hypervisor.o 16obj-y += vmware.o hypervisor.o
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 1cfb623ce11c..01213048f62f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1226,8 +1226,13 @@ static void mce_init(void)
1226} 1226}
1227 1227
1228/* Add per CPU specific workarounds here */ 1228/* Add per CPU specific workarounds here */
1229static void mce_cpu_quirks(struct cpuinfo_x86 *c) 1229static int mce_cpu_quirks(struct cpuinfo_x86 *c)
1230{ 1230{
1231 if (c->x86_vendor == X86_VENDOR_UNKNOWN) {
1232 pr_info("MCE: unknown CPU type - not enabling MCE support.\n");
1233 return -EOPNOTSUPP;
1234 }
1235
1231 /* This should be disabled by the BIOS, but isn't always */ 1236 /* This should be disabled by the BIOS, but isn't always */
1232 if (c->x86_vendor == X86_VENDOR_AMD) { 1237 if (c->x86_vendor == X86_VENDOR_AMD) {
1233 if (c->x86 == 15 && banks > 4) { 1238 if (c->x86 == 15 && banks > 4) {
@@ -1273,11 +1278,20 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c)
1273 if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) && 1278 if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) &&
1274 monarch_timeout < 0) 1279 monarch_timeout < 0)
1275 monarch_timeout = USEC_PER_SEC; 1280 monarch_timeout = USEC_PER_SEC;
1281
1282 /*
1283 * There are also broken BIOSes on some Pentium M and
1284 * earlier systems:
1285 */
1286 if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0)
1287 mce_bootlog = 0;
1276 } 1288 }
1277 if (monarch_timeout < 0) 1289 if (monarch_timeout < 0)
1278 monarch_timeout = 0; 1290 monarch_timeout = 0;
1279 if (mce_bootlog != 0) 1291 if (mce_bootlog != 0)
1280 mce_panic_timeout = 30; 1292 mce_panic_timeout = 30;
1293
1294 return 0;
1281} 1295}
1282 1296
1283static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c) 1297static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c)
@@ -1338,11 +1352,10 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
1338 if (!mce_available(c)) 1352 if (!mce_available(c))
1339 return; 1353 return;
1340 1354
1341 if (mce_cap_init() < 0) { 1355 if (mce_cap_init() < 0 || mce_cpu_quirks(c) < 0) {
1342 mce_disabled = 1; 1356 mce_disabled = 1;
1343 return; 1357 return;
1344 } 1358 }
1345 mce_cpu_quirks(c);
1346 1359
1347 machine_check_vector = do_machine_check; 1360 machine_check_vector = do_machine_check;
1348 1361
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 8bc64cfbe936..5957a93e5173 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -116,11 +116,14 @@ static int therm_throt_process(int curr)
116 cpu, __get_cpu_var(thermal_throttle_count)); 116 cpu, __get_cpu_var(thermal_throttle_count));
117 117
118 add_taint(TAINT_MACHINE_CHECK); 118 add_taint(TAINT_MACHINE_CHECK);
119 } else if (was_throttled) { 119 return 1;
120 }
121 if (was_throttled) {
120 printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu); 122 printk(KERN_INFO "CPU%d: Temperature/speed normal\n", cpu);
123 return 1;
121 } 124 }
122 125
123 return 1; 126 return 0;
124} 127}
125 128
126#ifdef CONFIG_SYSFS 129#ifdef CONFIG_SYSFS
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 0d98a01cbdb2..cc827ac9e8d3 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -261,9 +261,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
261 * which will be freed later 261 * which will be freed later
262 */ 262 */
263 263
264#ifndef CONFIG_HOTPLUG_CPU 264__CPUINIT
265.section .init.text,"ax",@progbits
266#endif
267 265
268#ifdef CONFIG_SMP 266#ifdef CONFIG_SMP
269ENTRY(startup_32_smp) 267ENTRY(startup_32_smp)
@@ -602,11 +600,7 @@ ignore_int:
602#endif 600#endif
603 iret 601 iret
604 602
605#ifndef CONFIG_HOTPLUG_CPU
606 __CPUINITDATA
607#else
608 __REFDATA 603 __REFDATA
609#endif
610.align 4 604.align 4
611ENTRY(initial_code) 605ENTRY(initial_code)
612 .long i386_start_kernel 606 .long i386_start_kernel
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 29a3eef7cf4a..07d81916f212 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -165,7 +165,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen)
165 165
166 if (!chosen) { 166 if (!chosen) {
167 size_t vm_size = VMALLOC_END - VMALLOC_START; 167 size_t vm_size = VMALLOC_END - VMALLOC_START;
168 size_t tot_size = num_possible_cpus() * PMD_SIZE; 168 size_t tot_size = nr_cpu_ids * PMD_SIZE;
169 169
170 /* on non-NUMA, embedding is better */ 170 /* on non-NUMA, embedding is better */
171 if (!pcpu_need_numa()) 171 if (!pcpu_need_numa())
@@ -199,7 +199,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen)
199 dyn_size = pcpul_size - static_size - PERCPU_FIRST_CHUNK_RESERVE; 199 dyn_size = pcpul_size - static_size - PERCPU_FIRST_CHUNK_RESERVE;
200 200
201 /* allocate pointer array and alloc large pages */ 201 /* allocate pointer array and alloc large pages */
202 map_size = PFN_ALIGN(num_possible_cpus() * sizeof(pcpul_map[0])); 202 map_size = PFN_ALIGN(nr_cpu_ids * sizeof(pcpul_map[0]));
203 pcpul_map = alloc_bootmem(map_size); 203 pcpul_map = alloc_bootmem(map_size);
204 204
205 for_each_possible_cpu(cpu) { 205 for_each_possible_cpu(cpu) {
@@ -228,7 +228,7 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen)
228 228
229 /* allocate address and map */ 229 /* allocate address and map */
230 pcpul_vm.flags = VM_ALLOC; 230 pcpul_vm.flags = VM_ALLOC;
231 pcpul_vm.size = num_possible_cpus() * PMD_SIZE; 231 pcpul_vm.size = nr_cpu_ids * PMD_SIZE;
232 vm_area_register_early(&pcpul_vm, PMD_SIZE); 232 vm_area_register_early(&pcpul_vm, PMD_SIZE);
233 233
234 for_each_possible_cpu(cpu) { 234 for_each_possible_cpu(cpu) {
@@ -250,8 +250,8 @@ static ssize_t __init setup_pcpu_lpage(size_t static_size, bool chosen)
250 PMD_SIZE, pcpul_vm.addr, NULL); 250 PMD_SIZE, pcpul_vm.addr, NULL);
251 251
252 /* sort pcpul_map array for pcpu_lpage_remapped() */ 252 /* sort pcpul_map array for pcpu_lpage_remapped() */
253 for (i = 0; i < num_possible_cpus() - 1; i++) 253 for (i = 0; i < nr_cpu_ids - 1; i++)
254 for (j = i + 1; j < num_possible_cpus(); j++) 254 for (j = i + 1; j < nr_cpu_ids; j++)
255 if (pcpul_map[i].ptr > pcpul_map[j].ptr) { 255 if (pcpul_map[i].ptr > pcpul_map[j].ptr) {
256 struct pcpul_ent tmp = pcpul_map[i]; 256 struct pcpul_ent tmp = pcpul_map[i];
257 pcpul_map[i] = pcpul_map[j]; 257 pcpul_map[i] = pcpul_map[j];
@@ -288,7 +288,7 @@ void *pcpu_lpage_remapped(void *kaddr)
288{ 288{
289 void *pmd_addr = (void *)((unsigned long)kaddr & PMD_MASK); 289 void *pmd_addr = (void *)((unsigned long)kaddr & PMD_MASK);
290 unsigned long offset = (unsigned long)kaddr & ~PMD_MASK; 290 unsigned long offset = (unsigned long)kaddr & ~PMD_MASK;
291 int left = 0, right = num_possible_cpus() - 1; 291 int left = 0, right = nr_cpu_ids - 1;
292 int pos; 292 int pos;
293 293
294 /* pcpul in use at all? */ 294 /* pcpul in use at all? */
@@ -377,7 +377,7 @@ static ssize_t __init setup_pcpu_4k(size_t static_size)
377 pcpu4k_nr_static_pages = PFN_UP(static_size); 377 pcpu4k_nr_static_pages = PFN_UP(static_size);
378 378
379 /* unaligned allocations can't be freed, round up to page size */ 379 /* unaligned allocations can't be freed, round up to page size */
380 pages_size = PFN_ALIGN(pcpu4k_nr_static_pages * num_possible_cpus() 380 pages_size = PFN_ALIGN(pcpu4k_nr_static_pages * nr_cpu_ids
381 * sizeof(pcpu4k_pages[0])); 381 * sizeof(pcpu4k_pages[0]));
382 pcpu4k_pages = alloc_bootmem(pages_size); 382 pcpu4k_pages = alloc_bootmem(pages_size);
383 383
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 8ccabb8a2f6a..77b9689f8edb 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -744,6 +744,7 @@ uv_activation_descriptor_init(int node, int pnode)
744 * note that base_dest_nodeid is actually a nasid. 744 * note that base_dest_nodeid is actually a nasid.
745 */ 745 */
746 ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; 746 ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1;
747 ad2->header.dest_subnodeid = 0x10; /* the LB */
747 ad2->header.command = UV_NET_ENDPOINT_INTD; 748 ad2->header.command = UV_NET_ENDPOINT_INTD;
748 ad2->header.int_both = 1; 749 ad2->header.int_both = 1;
749 /* 750 /*
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 78d185d797de..9fc178255c04 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -46,11 +46,10 @@ PHDRS {
46 data PT_LOAD FLAGS(7); /* RWE */ 46 data PT_LOAD FLAGS(7); /* RWE */
47#ifdef CONFIG_X86_64 47#ifdef CONFIG_X86_64
48 user PT_LOAD FLAGS(7); /* RWE */ 48 user PT_LOAD FLAGS(7); /* RWE */
49 data.init PT_LOAD FLAGS(7); /* RWE */
50#ifdef CONFIG_SMP 49#ifdef CONFIG_SMP
51 percpu PT_LOAD FLAGS(7); /* RWE */ 50 percpu PT_LOAD FLAGS(7); /* RWE */
52#endif 51#endif
53 data.init2 PT_LOAD FLAGS(7); /* RWE */ 52 init PT_LOAD FLAGS(7); /* RWE */
54#endif 53#endif
55 note PT_NOTE FLAGS(0); /* ___ */ 54 note PT_NOTE FLAGS(0); /* ___ */
56} 55}
@@ -103,65 +102,43 @@ SECTIONS
103 __stop___ex_table = .; 102 __stop___ex_table = .;
104 } :text = 0x9090 103 } :text = 0x9090
105 104
106 RODATA 105 RO_DATA(PAGE_SIZE)
107 106
108 /* Data */ 107 /* Data */
109 . = ALIGN(PAGE_SIZE);
110 .data : AT(ADDR(.data) - LOAD_OFFSET) { 108 .data : AT(ADDR(.data) - LOAD_OFFSET) {
111 /* Start of data section */ 109 /* Start of data section */
112 _sdata = .; 110 _sdata = .;
113 DATA_DATA 111
114 CONSTRUCTORS 112 /* init_task */
115 } :data 113 INIT_TASK_DATA(THREAD_SIZE)
116 114
117#ifdef CONFIG_X86_32 115#ifdef CONFIG_X86_32
118 /* 32 bit has nosave before _edata */ 116 /* 32 bit has nosave before _edata */
119 . = ALIGN(PAGE_SIZE); 117 NOSAVE_DATA
120 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
121 __nosave_begin = .;
122 *(.data.nosave)
123 . = ALIGN(PAGE_SIZE);
124 __nosave_end = .;
125 }
126#endif 118#endif
127 119
128 . = ALIGN(PAGE_SIZE); 120 PAGE_ALIGNED_DATA(PAGE_SIZE)
129 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
130 *(.data.page_aligned)
131 *(.data.idt) 121 *(.data.idt)
132 }
133 122
134#ifdef CONFIG_X86_32 123 CACHELINE_ALIGNED_DATA(CONFIG_X86_L1_CACHE_BYTES)
135 . = ALIGN(32);
136#else
137 . = ALIGN(PAGE_SIZE);
138 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
139#endif
140 .data.cacheline_aligned :
141 AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
142 *(.data.cacheline_aligned)
143 }
144 124
145 /* rarely changed data like cpu maps */ 125 DATA_DATA
146#ifdef CONFIG_X86_32 126 CONSTRUCTORS
147 . = ALIGN(32); 127
148#else 128 /* rarely changed data like cpu maps */
149 . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES); 129 READ_MOSTLY_DATA(CONFIG_X86_INTERNODE_CACHE_BYTES)
150#endif
151 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
152 *(.data.read_mostly)
153 130
154 /* End of data section */ 131 /* End of data section */
155 _edata = .; 132 _edata = .;
156 } 133 } :data
157 134
158#ifdef CONFIG_X86_64 135#ifdef CONFIG_X86_64
159 136
160#define VSYSCALL_ADDR (-10*1024*1024) 137#define VSYSCALL_ADDR (-10*1024*1024)
161#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \ 138#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data) + SIZEOF(.data) + \
162 SIZEOF(.data.read_mostly) + 4095) & ~(4095)) 139 PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
163#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \ 140#define VSYSCALL_VIRT_ADDR ((ADDR(.data) + SIZEOF(.data) + \
164 SIZEOF(.data.read_mostly) + 4095) & ~(4095)) 141 PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
165 142
166#define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR) 143#define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
167#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET) 144#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
@@ -227,35 +204,29 @@ SECTIONS
227 204
228#endif /* CONFIG_X86_64 */ 205#endif /* CONFIG_X86_64 */
229 206
230 /* init_task */ 207 /* Init code and data - will be freed after init */
231 . = ALIGN(THREAD_SIZE); 208 . = ALIGN(PAGE_SIZE);
232 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { 209 .init.begin : AT(ADDR(.init.begin) - LOAD_OFFSET) {
233 *(.data.init_task) 210 __init_begin = .; /* paired with __init_end */
234 } 211 }
235#ifdef CONFIG_X86_64
236 :data.init
237#endif
238 212
213#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)
239 /* 214 /*
240 * smp_locks might be freed after init 215 * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
241 * start/end must be page aligned 216 * output PHDR, so the next output section - .init.text - should
217 * start another segment - init.
242 */ 218 */
243 . = ALIGN(PAGE_SIZE); 219 PERCPU_VADDR(0, :percpu)
244 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 220#endif
245 __smp_locks = .;
246 *(.smp_locks)
247 __smp_locks_end = .;
248 . = ALIGN(PAGE_SIZE);
249 }
250 221
251 /* Init code and data - will be freed after init */
252 . = ALIGN(PAGE_SIZE);
253 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 222 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
254 __init_begin = .; /* paired with __init_end */
255 _sinittext = .; 223 _sinittext = .;
256 INIT_TEXT 224 INIT_TEXT
257 _einittext = .; 225 _einittext = .;
258 } 226 }
227#ifdef CONFIG_X86_64
228 :init
229#endif
259 230
260 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { 231 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
261 INIT_DATA 232 INIT_DATA
@@ -326,17 +297,7 @@ SECTIONS
326 } 297 }
327#endif 298#endif
328 299
329#if defined(CONFIG_X86_64) && defined(CONFIG_SMP) 300#if !defined(CONFIG_X86_64) || !defined(CONFIG_SMP)
330 /*
331 * percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
332 * output PHDR, so the next output section - __data_nosave - should
333 * start another section data.init2. Also, pda should be at the head of
334 * percpu area. Preallocate it and define the percpu offset symbol
335 * so that it can be accessed as a percpu variable.
336 */
337 . = ALIGN(PAGE_SIZE);
338 PERCPU_VADDR(0, :percpu)
339#else
340 PERCPU(PAGE_SIZE) 301 PERCPU(PAGE_SIZE)
341#endif 302#endif
342 303
@@ -347,15 +308,22 @@ SECTIONS
347 __init_end = .; 308 __init_end = .;
348 } 309 }
349 310
311 /*
312 * smp_locks might be freed after init
313 * start/end must be page aligned
314 */
315 . = ALIGN(PAGE_SIZE);
316 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
317 __smp_locks = .;
318 *(.smp_locks)
319 __smp_locks_end = .;
320 . = ALIGN(PAGE_SIZE);
321 }
322
350#ifdef CONFIG_X86_64 323#ifdef CONFIG_X86_64
351 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { 324 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
352 . = ALIGN(PAGE_SIZE); 325 NOSAVE_DATA
353 __nosave_begin = .; 326 }
354 *(.data.nosave)
355 . = ALIGN(PAGE_SIZE);
356 __nosave_end = .;
357 } :data.init2
358 /* use another section data.init2, see PERCPU_VADDR() above */
359#endif 327#endif
360 328
361 /* BSS */ 329 /* BSS */
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 6176fe8f29e0..ea56b8cbb6a6 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -796,7 +796,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
796 return ret; 796 return ret;
797 797
798#else 798#else
799 reserve_bootmem(phys, len, BOOTMEM_DEFAULT); 799 reserve_bootmem(phys, len, flags);
800#endif 800#endif
801 801
802 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { 802 if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index e6718bb28065..352aa9e927e2 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -623,7 +623,8 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
623 return ret; 623 return ret;
624 624
625 if (flags != want_flags) { 625 if (flags != want_flags) {
626 if (strict_prot || !is_new_memtype_allowed(want_flags, flags)) { 626 if (strict_prot ||
627 !is_new_memtype_allowed(paddr, size, want_flags, flags)) {
627 free_memtype(paddr, paddr + size); 628 free_memtype(paddr, paddr + size);
628 printk(KERN_ERR "%s:%d map pfn expected mapping type %s" 629 printk(KERN_ERR "%s:%d map pfn expected mapping type %s"
629 " for %Lx-%Lx, got %s\n", 630 " for %Lx-%Lx, got %s\n",
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 821e97017e95..c814e144a3f0 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -183,18 +183,17 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask,
183 183
184 f->flush_mm = mm; 184 f->flush_mm = mm;
185 f->flush_va = va; 185 f->flush_va = va;
186 cpumask_andnot(to_cpumask(f->flush_cpumask), 186 if (cpumask_andnot(to_cpumask(f->flush_cpumask), cpumask, cpumask_of(smp_processor_id()))) {
187 cpumask, cpumask_of(smp_processor_id())); 187 /*
188 188 * We have to send the IPI only to
189 /* 189 * CPUs affected.
190 * We have to send the IPI only to 190 */
191 * CPUs affected. 191 apic->send_IPI_mask(to_cpumask(f->flush_cpumask),
192 */ 192 INVALIDATE_TLB_VECTOR_START + sender);
193 apic->send_IPI_mask(to_cpumask(f->flush_cpumask),
194 INVALIDATE_TLB_VECTOR_START + sender);
195 193
196 while (!cpumask_empty(to_cpumask(f->flush_cpumask))) 194 while (!cpumask_empty(to_cpumask(f->flush_cpumask)))
197 cpu_relax(); 195 cpu_relax();
196 }
198 197
199 f->flush_mm = NULL; 198 f->flush_mm = NULL;
200 f->flush_va = 0; 199 f->flush_va = 0;
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 172438f86a02..7410640db173 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -5,6 +5,10 @@ CFLAGS_REMOVE_time.o = -pg
5CFLAGS_REMOVE_irq.o = -pg 5CFLAGS_REMOVE_irq.o = -pg
6endif 6endif
7 7
8# Make sure early boot has no stackprotector
9nostackp := $(call cc-option, -fno-stack-protector)
10CFLAGS_enlighten.o := $(nostackp)
11
8obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ 12obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
9 time.o xen-asm.o xen-asm_$(BITS).o \ 13 time.o xen-asm.o xen-asm_$(BITS).o \
10 grant-table.o suspend.o 14 grant-table.o suspend.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 0a1700a2be9c..e90540a46a0b 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -974,10 +974,6 @@ asmlinkage void __init xen_start_kernel(void)
974 974
975 xen_domain_type = XEN_PV_DOMAIN; 975 xen_domain_type = XEN_PV_DOMAIN;
976 976
977 BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);
978
979 xen_setup_features();
980
981 /* Install Xen paravirt ops */ 977 /* Install Xen paravirt ops */
982 pv_info = xen_info; 978 pv_info = xen_info;
983 pv_init_ops = xen_init_ops; 979 pv_init_ops = xen_init_ops;
@@ -986,8 +982,15 @@ asmlinkage void __init xen_start_kernel(void)
986 pv_apic_ops = xen_apic_ops; 982 pv_apic_ops = xen_apic_ops;
987 pv_mmu_ops = xen_mmu_ops; 983 pv_mmu_ops = xen_mmu_ops;
988 984
989 xen_init_irq_ops(); 985#ifdef CONFIG_X86_64
986 /*
987 * Setup percpu state. We only need to do this for 64-bit
988 * because 32-bit already has %fs set properly.
989 */
990 load_percpu_segment(0);
991#endif
990 992
993 xen_init_irq_ops();
991 xen_init_cpuid_mask(); 994 xen_init_cpuid_mask();
992 995
993#ifdef CONFIG_X86_LOCAL_APIC 996#ifdef CONFIG_X86_LOCAL_APIC
@@ -997,6 +1000,8 @@ asmlinkage void __init xen_start_kernel(void)
997 set_xen_basic_apic_ops(); 1000 set_xen_basic_apic_ops();
998#endif 1001#endif
999 1002
1003 xen_setup_features();
1004
1000 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { 1005 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
1001 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; 1006 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
1002 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; 1007 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;
@@ -1004,13 +1009,6 @@ asmlinkage void __init xen_start_kernel(void)
1004 1009
1005 machine_ops = xen_machine_ops; 1010 machine_ops = xen_machine_ops;
1006 1011
1007#ifdef CONFIG_X86_64
1008 /*
1009 * Setup percpu state. We only need to do this for 64-bit
1010 * because 32-bit already has %fs set properly.
1011 */
1012 load_percpu_segment(0);
1013#endif
1014 /* 1012 /*
1015 * The only reliable way to retain the initial address of the 1013 * The only reliable way to retain the initial address of the
1016 * percpu gdt_page is to remember it here, so we can go and 1014 * percpu gdt_page is to remember it here, so we can go and
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 1733d3439ad2..e48af9f79219 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -508,8 +508,9 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)
508 * be obtained while the delayed work queue halt ensures that no more 508 * be obtained while the delayed work queue halt ensures that no more
509 * data is fed to the ldisc. 509 * data is fed to the ldisc.
510 * 510 *
511 * In order to wait for any existing references to complete see 511 * You need to do a 'flush_scheduled_work()' (outside the ldisc_mutex)
512 * tty_ldisc_wait_idle. 512 * in order to make sure any currently executing ldisc work is also
513 * flushed.
513 */ 514 */
514 515
515static int tty_ldisc_halt(struct tty_struct *tty) 516static int tty_ldisc_halt(struct tty_struct *tty)
@@ -753,11 +754,14 @@ void tty_ldisc_hangup(struct tty_struct *tty)
753 * N_TTY. 754 * N_TTY.
754 */ 755 */
755 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { 756 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {
757 /* Make sure the old ldisc is quiescent */
758 tty_ldisc_halt(tty);
759 flush_scheduled_work();
760
756 /* Avoid racing set_ldisc or tty_ldisc_release */ 761 /* Avoid racing set_ldisc or tty_ldisc_release */
757 mutex_lock(&tty->ldisc_mutex); 762 mutex_lock(&tty->ldisc_mutex);
758 if (tty->ldisc) { /* Not yet closed */ 763 if (tty->ldisc) { /* Not yet closed */
759 /* Switch back to N_TTY */ 764 /* Switch back to N_TTY */
760 tty_ldisc_halt(tty);
761 tty_ldisc_reinit(tty); 765 tty_ldisc_reinit(tty);
762 /* At this point we have a closed ldisc and we want to 766 /* At this point we have a closed ldisc and we want to
763 reopen it. We could defer this to the next open but 767 reopen it. We could defer this to the next open but
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 2964f5f4a7ef..6b3e0c2f33e2 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -40,6 +40,7 @@ struct sh_cmt_priv {
40 struct platform_device *pdev; 40 struct platform_device *pdev;
41 41
42 unsigned long flags; 42 unsigned long flags;
43 unsigned long flags_suspend;
43 unsigned long match_value; 44 unsigned long match_value;
44 unsigned long next_match_value; 45 unsigned long next_match_value;
45 unsigned long max_match_value; 46 unsigned long max_match_value;
@@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev)
667 return -EBUSY; /* cannot unregister clockevent and clocksource */ 668 return -EBUSY; /* cannot unregister clockevent and clocksource */
668} 669}
669 670
671static int sh_cmt_suspend(struct device *dev)
672{
673 struct platform_device *pdev = to_platform_device(dev);
674 struct sh_cmt_priv *p = platform_get_drvdata(pdev);
675
676 /* save flag state and stop CMT channel */
677 p->flags_suspend = p->flags;
678 sh_cmt_stop(p, p->flags);
679 return 0;
680}
681
682static int sh_cmt_resume(struct device *dev)
683{
684 struct platform_device *pdev = to_platform_device(dev);
685 struct sh_cmt_priv *p = platform_get_drvdata(pdev);
686
687 /* start CMT channel from saved state */
688 sh_cmt_start(p, p->flags_suspend);
689 return 0;
690}
691
692static struct dev_pm_ops sh_cmt_dev_pm_ops = {
693 .suspend = sh_cmt_suspend,
694 .resume = sh_cmt_resume,
695};
696
670static struct platform_driver sh_cmt_device_driver = { 697static struct platform_driver sh_cmt_device_driver = {
671 .probe = sh_cmt_probe, 698 .probe = sh_cmt_probe,
672 .remove = __devexit_p(sh_cmt_remove), 699 .remove = __devexit_p(sh_cmt_remove),
673 .driver = { 700 .driver = {
674 .name = "sh_cmt", 701 .name = "sh_cmt",
702 .pm = &sh_cmt_dev_pm_ops,
675 } 703 }
676}; 704};
677 705
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 33be210d6723..2f631c75f704 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -258,31 +258,6 @@ void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type)
258EXPORT_SYMBOL(drm_mode_object_find); 258EXPORT_SYMBOL(drm_mode_object_find);
259 259
260/** 260/**
261 * drm_crtc_from_fb - find the CRTC structure associated with an fb
262 * @dev: DRM device
263 * @fb: framebuffer in question
264 *
265 * LOCKING:
266 * Caller must hold mode_config lock.
267 *
268 * Find CRTC in the mode_config structure that matches @fb.
269 *
270 * RETURNS:
271 * Pointer to the CRTC or NULL if it wasn't found.
272 */
273struct drm_crtc *drm_crtc_from_fb(struct drm_device *dev,
274 struct drm_framebuffer *fb)
275{
276 struct drm_crtc *crtc;
277
278 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
279 if (crtc->fb == fb)
280 return crtc;
281 }
282 return NULL;
283}
284
285/**
286 * drm_framebuffer_init - initialize a framebuffer 261 * drm_framebuffer_init - initialize a framebuffer
287 * @dev: DRM device 262 * @dev: DRM device
288 * 263 *
@@ -328,11 +303,20 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb)
328{ 303{
329 struct drm_device *dev = fb->dev; 304 struct drm_device *dev = fb->dev;
330 struct drm_crtc *crtc; 305 struct drm_crtc *crtc;
306 struct drm_mode_set set;
307 int ret;
331 308
332 /* remove from any CRTC */ 309 /* remove from any CRTC */
333 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 310 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
334 if (crtc->fb == fb) 311 if (crtc->fb == fb) {
335 crtc->fb = NULL; 312 /* should turn off the crtc */
313 memset(&set, 0, sizeof(struct drm_mode_set));
314 set.crtc = crtc;
315 set.fb = NULL;
316 ret = crtc->funcs->set_config(&set);
317 if (ret)
318 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc);
319 }
336 } 320 }
337 321
338 drm_mode_object_put(dev, &fb->base); 322 drm_mode_object_put(dev, &fb->base);
@@ -1511,7 +1495,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1511 set.mode = mode; 1495 set.mode = mode;
1512 set.connectors = connector_set; 1496 set.connectors = connector_set;
1513 set.num_connectors = crtc_req->count_connectors; 1497 set.num_connectors = crtc_req->count_connectors;
1514 set.fb =fb; 1498 set.fb = fb;
1515 ret = crtc->funcs->set_config(&set); 1499 ret = crtc->funcs->set_config(&set);
1516 1500
1517out: 1501out:
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 80cc6d06d61b..7f2728bbc16c 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -502,12 +502,40 @@ static int add_detailed_info(struct drm_connector *connector,
502 struct detailed_non_pixel *data = &timing->data.other_data; 502 struct detailed_non_pixel *data = &timing->data.other_data;
503 struct drm_display_mode *newmode; 503 struct drm_display_mode *newmode;
504 504
505 /* EDID up to and including 1.2 may put monitor info here */ 505 /* X server check is version 1.1 or higher */
506 if (edid->version == 1 && edid->revision < 3) 506 if (edid->version == 1 && edid->revision >= 1 &&
507 continue; 507 !timing->pixel_clock) {
508 508 /* Other timing or info */
509 /* Detailed mode timing */ 509 switch (data->type) {
510 if (timing->pixel_clock) { 510 case EDID_DETAIL_MONITOR_SERIAL:
511 break;
512 case EDID_DETAIL_MONITOR_STRING:
513 break;
514 case EDID_DETAIL_MONITOR_RANGE:
515 /* Get monitor range data */
516 break;
517 case EDID_DETAIL_MONITOR_NAME:
518 break;
519 case EDID_DETAIL_MONITOR_CPDATA:
520 break;
521 case EDID_DETAIL_STD_MODES:
522 /* Five modes per detailed section */
523 for (j = 0; j < 5; i++) {
524 struct std_timing *std;
525 struct drm_display_mode *newmode;
526
527 std = &data->data.timings[j];
528 newmode = drm_mode_std(dev, std);
529 if (newmode) {
530 drm_mode_probed_add(connector, newmode);
531 modes++;
532 }
533 }
534 break;
535 default:
536 break;
537 }
538 } else {
511 newmode = drm_mode_detailed(dev, edid, timing, quirks); 539 newmode = drm_mode_detailed(dev, edid, timing, quirks);
512 if (!newmode) 540 if (!newmode)
513 continue; 541 continue;
@@ -518,38 +546,6 @@ static int add_detailed_info(struct drm_connector *connector,
518 drm_mode_probed_add(connector, newmode); 546 drm_mode_probed_add(connector, newmode);
519 547
520 modes++; 548 modes++;
521 continue;
522 }
523
524 /* Other timing or info */
525 switch (data->type) {
526 case EDID_DETAIL_MONITOR_SERIAL:
527 break;
528 case EDID_DETAIL_MONITOR_STRING:
529 break;
530 case EDID_DETAIL_MONITOR_RANGE:
531 /* Get monitor range data */
532 break;
533 case EDID_DETAIL_MONITOR_NAME:
534 break;
535 case EDID_DETAIL_MONITOR_CPDATA:
536 break;
537 case EDID_DETAIL_STD_MODES:
538 /* Five modes per detailed section */
539 for (j = 0; j < 5; i++) {
540 struct std_timing *std;
541 struct drm_display_mode *newmode;
542
543 std = &data->data.timings[j];
544 newmode = drm_mode_std(dev, std);
545 if (newmode) {
546 drm_mode_probed_add(connector, newmode);
547 modes++;
548 }
549 }
550 break;
551 default:
552 break;
553 } 549 }
554 } 550 }
555 551
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 85ec31b3ff00..f7a615b80c70 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -22,44 +22,50 @@
22#define to_drm_minor(d) container_of(d, struct drm_minor, kdev) 22#define to_drm_minor(d) container_of(d, struct drm_minor, kdev)
23#define to_drm_connector(d) container_of(d, struct drm_connector, kdev) 23#define to_drm_connector(d) container_of(d, struct drm_connector, kdev)
24 24
25static struct device_type drm_sysfs_device_minor = {
26 .name = "drm_minor"
27};
28
25/** 29/**
26 * drm_sysfs_suspend - DRM class suspend hook 30 * drm_class_suspend - DRM class suspend hook
27 * @dev: Linux device to suspend 31 * @dev: Linux device to suspend
28 * @state: power state to enter 32 * @state: power state to enter
29 * 33 *
30 * Just figures out what the actual struct drm_device associated with 34 * Just figures out what the actual struct drm_device associated with
31 * @dev is and calls its suspend hook, if present. 35 * @dev is and calls its suspend hook, if present.
32 */ 36 */
33static int drm_sysfs_suspend(struct device *dev, pm_message_t state) 37static int drm_class_suspend(struct device *dev, pm_message_t state)
34{ 38{
35 struct drm_minor *drm_minor = to_drm_minor(dev); 39 if (dev->type == &drm_sysfs_device_minor) {
36 struct drm_device *drm_dev = drm_minor->dev; 40 struct drm_minor *drm_minor = to_drm_minor(dev);
37 41 struct drm_device *drm_dev = drm_minor->dev;
38 if (drm_minor->type == DRM_MINOR_LEGACY && 42
39 !drm_core_check_feature(drm_dev, DRIVER_MODESET) && 43 if (drm_minor->type == DRM_MINOR_LEGACY &&
40 drm_dev->driver->suspend) 44 !drm_core_check_feature(drm_dev, DRIVER_MODESET) &&
41 return drm_dev->driver->suspend(drm_dev, state); 45 drm_dev->driver->suspend)
42 46 return drm_dev->driver->suspend(drm_dev, state);
47 }
43 return 0; 48 return 0;
44} 49}
45 50
46/** 51/**
47 * drm_sysfs_resume - DRM class resume hook 52 * drm_class_resume - DRM class resume hook
48 * @dev: Linux device to resume 53 * @dev: Linux device to resume
49 * 54 *
50 * Just figures out what the actual struct drm_device associated with 55 * Just figures out what the actual struct drm_device associated with
51 * @dev is and calls its resume hook, if present. 56 * @dev is and calls its resume hook, if present.
52 */ 57 */
53static int drm_sysfs_resume(struct device *dev) 58static int drm_class_resume(struct device *dev)
54{ 59{
55 struct drm_minor *drm_minor = to_drm_minor(dev); 60 if (dev->type == &drm_sysfs_device_minor) {
56 struct drm_device *drm_dev = drm_minor->dev; 61 struct drm_minor *drm_minor = to_drm_minor(dev);
57 62 struct drm_device *drm_dev = drm_minor->dev;
58 if (drm_minor->type == DRM_MINOR_LEGACY && 63
59 !drm_core_check_feature(drm_dev, DRIVER_MODESET) && 64 if (drm_minor->type == DRM_MINOR_LEGACY &&
60 drm_dev->driver->resume) 65 !drm_core_check_feature(drm_dev, DRIVER_MODESET) &&
61 return drm_dev->driver->resume(drm_dev); 66 drm_dev->driver->resume)
62 67 return drm_dev->driver->resume(drm_dev);
68 }
63 return 0; 69 return 0;
64} 70}
65 71
@@ -99,8 +105,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
99 goto err_out; 105 goto err_out;
100 } 106 }
101 107
102 class->suspend = drm_sysfs_suspend; 108 class->suspend = drm_class_suspend;
103 class->resume = drm_sysfs_resume; 109 class->resume = drm_class_resume;
104 110
105 err = class_create_file(class, &class_attr_version); 111 err = class_create_file(class, &class_attr_version);
106 if (err) 112 if (err)
@@ -480,6 +486,7 @@ int drm_sysfs_device_add(struct drm_minor *minor)
480 minor->kdev.class = drm_class; 486 minor->kdev.class = drm_class;
481 minor->kdev.release = drm_sysfs_device_release; 487 minor->kdev.release = drm_sysfs_device_release;
482 minor->kdev.devt = minor->device; 488 minor->kdev.devt = minor->device;
489 minor->kdev.type = &drm_sysfs_device_minor;
483 if (minor->type == DRM_MINOR_CONTROL) 490 if (minor->type == DRM_MINOR_CONTROL)
484 minor_str = "controlD%d"; 491 minor_str = "controlD%d";
485 else if (minor->type == DRM_MINOR_RENDER) 492 else if (minor->type == DRM_MINOR_RENDER)
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index f1ba8ff41130..68e728e8be4d 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -254,6 +254,72 @@ void r100_mc_fini(struct radeon_device *rdev)
254 254
255 255
256/* 256/*
257 * Interrupts
258 */
259int r100_irq_set(struct radeon_device *rdev)
260{
261 uint32_t tmp = 0;
262
263 if (rdev->irq.sw_int) {
264 tmp |= RADEON_SW_INT_ENABLE;
265 }
266 if (rdev->irq.crtc_vblank_int[0]) {
267 tmp |= RADEON_CRTC_VBLANK_MASK;
268 }
269 if (rdev->irq.crtc_vblank_int[1]) {
270 tmp |= RADEON_CRTC2_VBLANK_MASK;
271 }
272 WREG32(RADEON_GEN_INT_CNTL, tmp);
273 return 0;
274}
275
276static inline uint32_t r100_irq_ack(struct radeon_device *rdev)
277{
278 uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS);
279 uint32_t irq_mask = RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT |
280 RADEON_CRTC2_VBLANK_STAT;
281
282 if (irqs) {
283 WREG32(RADEON_GEN_INT_STATUS, irqs);
284 }
285 return irqs & irq_mask;
286}
287
288int r100_irq_process(struct radeon_device *rdev)
289{
290 uint32_t status;
291
292 status = r100_irq_ack(rdev);
293 if (!status) {
294 return IRQ_NONE;
295 }
296 while (status) {
297 /* SW interrupt */
298 if (status & RADEON_SW_INT_TEST) {
299 radeon_fence_process(rdev);
300 }
301 /* Vertical blank interrupts */
302 if (status & RADEON_CRTC_VBLANK_STAT) {
303 drm_handle_vblank(rdev->ddev, 0);
304 }
305 if (status & RADEON_CRTC2_VBLANK_STAT) {
306 drm_handle_vblank(rdev->ddev, 1);
307 }
308 status = r100_irq_ack(rdev);
309 }
310 return IRQ_HANDLED;
311}
312
313u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
314{
315 if (crtc == 0)
316 return RREG32(RADEON_CRTC_CRNT_FRAME);
317 else
318 return RREG32(RADEON_CRTC2_CRNT_FRAME);
319}
320
321
322/*
257 * Fence emission 323 * Fence emission
258 */ 324 */
259void r100_fence_ring_emit(struct radeon_device *rdev, 325void r100_fence_ring_emit(struct radeon_device *rdev,
@@ -1025,6 +1091,16 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1025 tmp |= tile_flags; 1091 tmp |= tile_flags;
1026 ib[idx] = tmp; 1092 ib[idx] = tmp;
1027 break; 1093 break;
1094 case RADEON_RB3D_ZPASS_ADDR:
1095 r = r100_cs_packet_next_reloc(p, &reloc);
1096 if (r) {
1097 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1098 idx, reg);
1099 r100_cs_dump_packet(p, pkt);
1100 return r;
1101 }
1102 ib[idx] = ib_chunk->kdata[idx] + ((u32)reloc->lobj.gpu_offset);
1103 break;
1028 default: 1104 default:
1029 /* FIXME: we don't want to allow anyothers packet */ 1105 /* FIXME: we don't want to allow anyothers packet */
1030 break; 1106 break;
@@ -1556,26 +1632,6 @@ void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
1556 r100_pll_errata_after_data(rdev); 1632 r100_pll_errata_after_data(rdev);
1557} 1633}
1558 1634
1559uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg)
1560{
1561 if (reg < 0x10000)
1562 return readl(((void __iomem *)rdev->rmmio) + reg);
1563 else {
1564 writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
1565 return readl(((void __iomem *)rdev->rmmio) + RADEON_MM_DATA);
1566 }
1567}
1568
1569void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
1570{
1571 if (reg < 0x10000)
1572 writel(v, ((void __iomem *)rdev->rmmio) + reg);
1573 else {
1574 writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
1575 writel(v, ((void __iomem *)rdev->rmmio) + RADEON_MM_DATA);
1576 }
1577}
1578
1579int r100_init(struct radeon_device *rdev) 1635int r100_init(struct radeon_device *rdev)
1580{ 1636{
1581 return 0; 1637 return 0;
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 9c8d41534a5d..053f4ec397f7 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -83,8 +83,8 @@ void rv370_pcie_gart_tlb_flush(struct radeon_device *rdev)
83 WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp | RADEON_PCIE_TX_GART_INVALIDATE_TLB); 83 WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp | RADEON_PCIE_TX_GART_INVALIDATE_TLB);
84 (void)RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL); 84 (void)RREG32_PCIE(RADEON_PCIE_TX_GART_CNTL);
85 WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp); 85 WREG32_PCIE(RADEON_PCIE_TX_GART_CNTL, tmp);
86 mb();
87 } 86 }
87 mb();
88} 88}
89 89
90int rv370_pcie_gart_enable(struct radeon_device *rdev) 90int rv370_pcie_gart_enable(struct radeon_device *rdev)
@@ -448,6 +448,7 @@ void r300_gpu_init(struct radeon_device *rdev)
448 /* rv350,rv370,rv380 */ 448 /* rv350,rv370,rv380 */
449 rdev->num_gb_pipes = 1; 449 rdev->num_gb_pipes = 1;
450 } 450 }
451 rdev->num_z_pipes = 1;
451 gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16); 452 gb_tile_config = (R300_ENABLE_TILING | R300_TILE_SIZE_16);
452 switch (rdev->num_gb_pipes) { 453 switch (rdev->num_gb_pipes) {
453 case 2: 454 case 2:
@@ -486,7 +487,8 @@ void r300_gpu_init(struct radeon_device *rdev)
486 printk(KERN_WARNING "Failed to wait MC idle while " 487 printk(KERN_WARNING "Failed to wait MC idle while "
487 "programming pipes. Bad things might happen.\n"); 488 "programming pipes. Bad things might happen.\n");
488 } 489 }
489 DRM_INFO("radeon: %d pipes initialized.\n", rdev->num_gb_pipes); 490 DRM_INFO("radeon: %d quad pipes, %d Z pipes initialized.\n",
491 rdev->num_gb_pipes, rdev->num_z_pipes);
490} 492}
491 493
492int r300_ga_reset(struct radeon_device *rdev) 494int r300_ga_reset(struct radeon_device *rdev)
@@ -593,27 +595,6 @@ void r300_vram_info(struct radeon_device *rdev)
593 595
594 596
595/* 597/*
596 * Indirect registers accessor
597 */
598uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg)
599{
600 uint32_t r;
601
602 WREG8(RADEON_PCIE_INDEX, ((reg) & 0xff));
603 (void)RREG32(RADEON_PCIE_INDEX);
604 r = RREG32(RADEON_PCIE_DATA);
605 return r;
606}
607
608void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
609{
610 WREG8(RADEON_PCIE_INDEX, ((reg) & 0xff));
611 (void)RREG32(RADEON_PCIE_INDEX);
612 WREG32(RADEON_PCIE_DATA, (v));
613 (void)RREG32(RADEON_PCIE_DATA);
614}
615
616/*
617 * PCIE Lanes 598 * PCIE Lanes
618 */ 599 */
619 600
@@ -1403,6 +1384,21 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
1403 tmp = (ib_chunk->kdata[idx] >> 22) & 0xF; 1384 tmp = (ib_chunk->kdata[idx] >> 22) & 0xF;
1404 track->textures[i].txdepth = tmp; 1385 track->textures[i].txdepth = tmp;
1405 break; 1386 break;
1387 case R300_ZB_ZPASS_ADDR:
1388 r = r100_cs_packet_next_reloc(p, &reloc);
1389 if (r) {
1390 DRM_ERROR("No reloc for ib[%d]=0x%04X\n",
1391 idx, reg);
1392 r100_cs_dump_packet(p, pkt);
1393 return r;
1394 }
1395 ib[idx] = ib_chunk->kdata[idx] + ((u32)reloc->lobj.gpu_offset);
1396 break;
1397 case 0x4be8:
1398 /* valid register only on RV530 */
1399 if (p->rdev->family == CHIP_RV530)
1400 break;
1401 /* fallthrough do not move */
1406 default: 1402 default:
1407 printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n", 1403 printk(KERN_ERR "Forbidden register 0x%04X in cs at %d\n",
1408 reg, idx); 1404 reg, idx);
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index dea497a979f2..97426a6f370f 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -165,7 +165,18 @@ void r420_pipes_init(struct radeon_device *rdev)
165 printk(KERN_WARNING "Failed to wait GUI idle while " 165 printk(KERN_WARNING "Failed to wait GUI idle while "
166 "programming pipes. Bad things might happen.\n"); 166 "programming pipes. Bad things might happen.\n");
167 } 167 }
168 DRM_INFO("radeon: %d pipes initialized.\n", rdev->num_gb_pipes); 168
169 if (rdev->family == CHIP_RV530) {
170 tmp = RREG32(RV530_GB_PIPE_SELECT2);
171 if ((tmp & 3) == 3)
172 rdev->num_z_pipes = 2;
173 else
174 rdev->num_z_pipes = 1;
175 } else
176 rdev->num_z_pipes = 1;
177
178 DRM_INFO("radeon: %d quad pipes, %d z pipes initialized.\n",
179 rdev->num_gb_pipes, rdev->num_z_pipes);
169} 180}
170 181
171void r420_gpu_init(struct radeon_device *rdev) 182void r420_gpu_init(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h
index 036691b38cb7..e1d5e0331e19 100644
--- a/drivers/gpu/drm/radeon/r500_reg.h
+++ b/drivers/gpu/drm/radeon/r500_reg.h
@@ -350,6 +350,7 @@
350#define AVIVO_D1CRTC_BLANK_CONTROL 0x6084 350#define AVIVO_D1CRTC_BLANK_CONTROL 0x6084
351#define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088 351#define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088
352#define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c 352#define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c
353#define AVIVO_D1CRTC_FRAME_COUNT 0x60a4
353#define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4 354#define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4
354 355
355/* master controls */ 356/* master controls */
@@ -438,14 +439,15 @@
438# define AVIVO_DC_LB_DISP1_END_ADR_SHIFT 4 439# define AVIVO_DC_LB_DISP1_END_ADR_SHIFT 4
439# define AVIVO_DC_LB_DISP1_END_ADR_MASK 0x7ff 440# define AVIVO_DC_LB_DISP1_END_ADR_MASK 0x7ff
440 441
441#define R500_DxMODE_INT_MASK 0x6540
442#define R500_D1MODE_INT_MASK (1<<0)
443#define R500_D2MODE_INT_MASK (1<<8)
444
445#define AVIVO_D1MODE_DATA_FORMAT 0x6528 442#define AVIVO_D1MODE_DATA_FORMAT 0x6528
446# define AVIVO_D1MODE_INTERLEAVE_EN (1 << 0) 443# define AVIVO_D1MODE_INTERLEAVE_EN (1 << 0)
447#define AVIVO_D1MODE_DESKTOP_HEIGHT 0x652C 444#define AVIVO_D1MODE_DESKTOP_HEIGHT 0x652C
445#define AVIVO_D1MODE_VBLANK_STATUS 0x6534
446# define AVIVO_VBLANK_ACK (1 << 4)
448#define AVIVO_D1MODE_VLINE_START_END 0x6538 447#define AVIVO_D1MODE_VLINE_START_END 0x6538
448#define AVIVO_DxMODE_INT_MASK 0x6540
449# define AVIVO_D1MODE_INT_MASK (1 << 0)
450# define AVIVO_D2MODE_INT_MASK (1 << 8)
449#define AVIVO_D1MODE_VIEWPORT_START 0x6580 451#define AVIVO_D1MODE_VIEWPORT_START 0x6580
450#define AVIVO_D1MODE_VIEWPORT_SIZE 0x6584 452#define AVIVO_D1MODE_VIEWPORT_SIZE 0x6584
451#define AVIVO_D1MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6588 453#define AVIVO_D1MODE_EXT_OVERSCAN_LEFT_RIGHT 0x6588
@@ -475,6 +477,7 @@
475#define AVIVO_D2CRTC_BLANK_CONTROL 0x6884 477#define AVIVO_D2CRTC_BLANK_CONTROL 0x6884
476#define AVIVO_D2CRTC_INTERLACE_CONTROL 0x6888 478#define AVIVO_D2CRTC_INTERLACE_CONTROL 0x6888
477#define AVIVO_D2CRTC_INTERLACE_STATUS 0x688c 479#define AVIVO_D2CRTC_INTERLACE_STATUS 0x688c
480#define AVIVO_D2CRTC_FRAME_COUNT 0x68a4
478#define AVIVO_D2CRTC_STEREO_CONTROL 0x68c4 481#define AVIVO_D2CRTC_STEREO_CONTROL 0x68c4
479 482
480#define AVIVO_D2GRPH_ENABLE 0x6900 483#define AVIVO_D2GRPH_ENABLE 0x6900
@@ -497,6 +500,7 @@
497#define AVIVO_D2CUR_SIZE 0x6c10 500#define AVIVO_D2CUR_SIZE 0x6c10
498#define AVIVO_D2CUR_POSITION 0x6c14 501#define AVIVO_D2CUR_POSITION 0x6c14
499 502
503#define AVIVO_D2MODE_VBLANK_STATUS 0x6d34
500#define AVIVO_D2MODE_VLINE_START_END 0x6d38 504#define AVIVO_D2MODE_VLINE_START_END 0x6d38
501#define AVIVO_D2MODE_VIEWPORT_START 0x6d80 505#define AVIVO_D2MODE_VIEWPORT_START 0x6d80
502#define AVIVO_D2MODE_VIEWPORT_SIZE 0x6d84 506#define AVIVO_D2MODE_VIEWPORT_SIZE 0x6d84
@@ -748,4 +752,8 @@
748# define AVIVO_I2C_EN (1 << 0) 752# define AVIVO_I2C_EN (1 << 0)
749# define AVIVO_I2C_RESET (1 << 8) 753# define AVIVO_I2C_RESET (1 << 8)
750 754
755#define AVIVO_DISP_INTERRUPT_STATUS 0x7edc
756# define AVIVO_D1_VBLANK_INTERRUPT (1 << 4)
757# define AVIVO_D2_VBLANK_INTERRUPT (1 << 5)
758
751#endif 759#endif
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index 09fb0b6ec7dd..ebd6b0f7bdff 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -177,7 +177,6 @@ void r520_gpu_init(struct radeon_device *rdev)
177 */ 177 */
178 /* workaround for RV530 */ 178 /* workaround for RV530 */
179 if (rdev->family == CHIP_RV530) { 179 if (rdev->family == CHIP_RV530) {
180 WREG32(0x4124, 1);
181 WREG32(0x4128, 0xFF); 180 WREG32(0x4128, 0xFF);
182 } 181 }
183 r420_pipes_init(rdev); 182 r420_pipes_init(rdev);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index b1d945b8ed6c..b519fb2fecbb 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -242,6 +242,7 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain,
242 uint64_t *gpu_addr); 242 uint64_t *gpu_addr);
243void radeon_object_unpin(struct radeon_object *robj); 243void radeon_object_unpin(struct radeon_object *robj);
244int radeon_object_wait(struct radeon_object *robj); 244int radeon_object_wait(struct radeon_object *robj);
245int radeon_object_busy_domain(struct radeon_object *robj, uint32_t *cur_placement);
245int radeon_object_evict_vram(struct radeon_device *rdev); 246int radeon_object_evict_vram(struct radeon_device *rdev);
246int radeon_object_mmap(struct radeon_object *robj, uint64_t *offset); 247int radeon_object_mmap(struct radeon_object *robj, uint64_t *offset);
247void radeon_object_force_delete(struct radeon_device *rdev); 248void radeon_object_force_delete(struct radeon_device *rdev);
@@ -574,6 +575,7 @@ struct radeon_asic {
574 void (*ring_start)(struct radeon_device *rdev); 575 void (*ring_start)(struct radeon_device *rdev);
575 int (*irq_set)(struct radeon_device *rdev); 576 int (*irq_set)(struct radeon_device *rdev);
576 int (*irq_process)(struct radeon_device *rdev); 577 int (*irq_process)(struct radeon_device *rdev);
578 u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc);
577 void (*fence_ring_emit)(struct radeon_device *rdev, struct radeon_fence *fence); 579 void (*fence_ring_emit)(struct radeon_device *rdev, struct radeon_fence *fence);
578 int (*cs_parse)(struct radeon_cs_parser *p); 580 int (*cs_parse)(struct radeon_cs_parser *p);
579 int (*copy_blit)(struct radeon_device *rdev, 581 int (*copy_blit)(struct radeon_device *rdev,
@@ -653,6 +655,7 @@ struct radeon_device {
653 int usec_timeout; 655 int usec_timeout;
654 enum radeon_pll_errata pll_errata; 656 enum radeon_pll_errata pll_errata;
655 int num_gb_pipes; 657 int num_gb_pipes;
658 int num_z_pipes;
656 int disp_priority; 659 int disp_priority;
657 /* BIOS */ 660 /* BIOS */
658 uint8_t *bios; 661 uint8_t *bios;
@@ -666,14 +669,11 @@ struct radeon_device {
666 resource_size_t rmmio_base; 669 resource_size_t rmmio_base;
667 resource_size_t rmmio_size; 670 resource_size_t rmmio_size;
668 void *rmmio; 671 void *rmmio;
669 radeon_rreg_t mm_rreg;
670 radeon_wreg_t mm_wreg;
671 radeon_rreg_t mc_rreg; 672 radeon_rreg_t mc_rreg;
672 radeon_wreg_t mc_wreg; 673 radeon_wreg_t mc_wreg;
673 radeon_rreg_t pll_rreg; 674 radeon_rreg_t pll_rreg;
674 radeon_wreg_t pll_wreg; 675 radeon_wreg_t pll_wreg;
675 radeon_rreg_t pcie_rreg; 676 uint32_t pcie_reg_mask;
676 radeon_wreg_t pcie_wreg;
677 radeon_rreg_t pciep_rreg; 677 radeon_rreg_t pciep_rreg;
678 radeon_wreg_t pciep_wreg; 678 radeon_wreg_t pciep_wreg;
679 struct radeon_clock clock; 679 struct radeon_clock clock;
@@ -705,22 +705,42 @@ int radeon_device_init(struct radeon_device *rdev,
705void radeon_device_fini(struct radeon_device *rdev); 705void radeon_device_fini(struct radeon_device *rdev);
706int radeon_gpu_wait_for_idle(struct radeon_device *rdev); 706int radeon_gpu_wait_for_idle(struct radeon_device *rdev);
707 707
708static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg)
709{
710 if (reg < 0x10000)
711 return readl(((void __iomem *)rdev->rmmio) + reg);
712 else {
713 writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
714 return readl(((void __iomem *)rdev->rmmio) + RADEON_MM_DATA);
715 }
716}
717
718static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
719{
720 if (reg < 0x10000)
721 writel(v, ((void __iomem *)rdev->rmmio) + reg);
722 else {
723 writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
724 writel(v, ((void __iomem *)rdev->rmmio) + RADEON_MM_DATA);
725 }
726}
727
708 728
709/* 729/*
710 * Registers read & write functions. 730 * Registers read & write functions.
711 */ 731 */
712#define RREG8(reg) readb(((void __iomem *)rdev->rmmio) + (reg)) 732#define RREG8(reg) readb(((void __iomem *)rdev->rmmio) + (reg))
713#define WREG8(reg, v) writeb(v, ((void __iomem *)rdev->rmmio) + (reg)) 733#define WREG8(reg, v) writeb(v, ((void __iomem *)rdev->rmmio) + (reg))
714#define RREG32(reg) rdev->mm_rreg(rdev, (reg)) 734#define RREG32(reg) r100_mm_rreg(rdev, (reg))
715#define WREG32(reg, v) rdev->mm_wreg(rdev, (reg), (v)) 735#define WREG32(reg, v) r100_mm_wreg(rdev, (reg), (v))
716#define REG_SET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) 736#define REG_SET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK)
717#define REG_GET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK) 737#define REG_GET(FIELD, v) (((v) << FIELD##_SHIFT) & FIELD##_MASK)
718#define RREG32_PLL(reg) rdev->pll_rreg(rdev, (reg)) 738#define RREG32_PLL(reg) rdev->pll_rreg(rdev, (reg))
719#define WREG32_PLL(reg, v) rdev->pll_wreg(rdev, (reg), (v)) 739#define WREG32_PLL(reg, v) rdev->pll_wreg(rdev, (reg), (v))
720#define RREG32_MC(reg) rdev->mc_rreg(rdev, (reg)) 740#define RREG32_MC(reg) rdev->mc_rreg(rdev, (reg))
721#define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v)) 741#define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v))
722#define RREG32_PCIE(reg) rdev->pcie_rreg(rdev, (reg)) 742#define RREG32_PCIE(reg) rv370_pcie_rreg(rdev, (reg))
723#define WREG32_PCIE(reg, v) rdev->pcie_wreg(rdev, (reg), (v)) 743#define WREG32_PCIE(reg, v) rv370_pcie_wreg(rdev, (reg), (v))
724#define WREG32_P(reg, val, mask) \ 744#define WREG32_P(reg, val, mask) \
725 do { \ 745 do { \
726 uint32_t tmp_ = RREG32(reg); \ 746 uint32_t tmp_ = RREG32(reg); \
@@ -736,6 +756,24 @@ int radeon_gpu_wait_for_idle(struct radeon_device *rdev);
736 WREG32_PLL(reg, tmp_); \ 756 WREG32_PLL(reg, tmp_); \
737 } while (0) 757 } while (0)
738 758
759/*
760 * Indirect registers accessor
761 */
762static inline uint32_t rv370_pcie_rreg(struct radeon_device *rdev, uint32_t reg)
763{
764 uint32_t r;
765
766 WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask));
767 r = RREG32(RADEON_PCIE_DATA);
768 return r;
769}
770
771static inline void rv370_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
772{
773 WREG32(RADEON_PCIE_INDEX, ((reg) & rdev->pcie_reg_mask));
774 WREG32(RADEON_PCIE_DATA, (v));
775}
776
739void r100_pll_errata_after_index(struct radeon_device *rdev); 777void r100_pll_errata_after_index(struct radeon_device *rdev);
740 778
741 779
@@ -862,6 +900,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
862#define radeon_ring_start(rdev) (rdev)->asic->ring_start((rdev)) 900#define radeon_ring_start(rdev) (rdev)->asic->ring_start((rdev))
863#define radeon_irq_set(rdev) (rdev)->asic->irq_set((rdev)) 901#define radeon_irq_set(rdev) (rdev)->asic->irq_set((rdev))
864#define radeon_irq_process(rdev) (rdev)->asic->irq_process((rdev)) 902#define radeon_irq_process(rdev) (rdev)->asic->irq_process((rdev))
903#define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->get_vblank_counter((rdev), (crtc))
865#define radeon_fence_ring_emit(rdev, fence) (rdev)->asic->fence_ring_emit((rdev), (fence)) 904#define radeon_fence_ring_emit(rdev, fence) (rdev)->asic->fence_ring_emit((rdev), (fence))
866#define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f)) 905#define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f))
867#define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f)) 906#define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f))
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 9a75876e0c3b..7ca6c13569b5 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -49,6 +49,7 @@ void r100_vram_info(struct radeon_device *rdev);
49int r100_gpu_reset(struct radeon_device *rdev); 49int r100_gpu_reset(struct radeon_device *rdev);
50int r100_mc_init(struct radeon_device *rdev); 50int r100_mc_init(struct radeon_device *rdev);
51void r100_mc_fini(struct radeon_device *rdev); 51void r100_mc_fini(struct radeon_device *rdev);
52u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc);
52int r100_wb_init(struct radeon_device *rdev); 53int r100_wb_init(struct radeon_device *rdev);
53void r100_wb_fini(struct radeon_device *rdev); 54void r100_wb_fini(struct radeon_device *rdev);
54int r100_gart_enable(struct radeon_device *rdev); 55int r100_gart_enable(struct radeon_device *rdev);
@@ -96,6 +97,7 @@ static struct radeon_asic r100_asic = {
96 .ring_start = &r100_ring_start, 97 .ring_start = &r100_ring_start,
97 .irq_set = &r100_irq_set, 98 .irq_set = &r100_irq_set,
98 .irq_process = &r100_irq_process, 99 .irq_process = &r100_irq_process,
100 .get_vblank_counter = &r100_get_vblank_counter,
99 .fence_ring_emit = &r100_fence_ring_emit, 101 .fence_ring_emit = &r100_fence_ring_emit,
100 .cs_parse = &r100_cs_parse, 102 .cs_parse = &r100_cs_parse,
101 .copy_blit = &r100_copy_blit, 103 .copy_blit = &r100_copy_blit,
@@ -156,6 +158,7 @@ static struct radeon_asic r300_asic = {
156 .ring_start = &r300_ring_start, 158 .ring_start = &r300_ring_start,
157 .irq_set = &r100_irq_set, 159 .irq_set = &r100_irq_set,
158 .irq_process = &r100_irq_process, 160 .irq_process = &r100_irq_process,
161 .get_vblank_counter = &r100_get_vblank_counter,
159 .fence_ring_emit = &r300_fence_ring_emit, 162 .fence_ring_emit = &r300_fence_ring_emit,
160 .cs_parse = &r300_cs_parse, 163 .cs_parse = &r300_cs_parse,
161 .copy_blit = &r100_copy_blit, 164 .copy_blit = &r100_copy_blit,
@@ -196,6 +199,7 @@ static struct radeon_asic r420_asic = {
196 .ring_start = &r300_ring_start, 199 .ring_start = &r300_ring_start,
197 .irq_set = &r100_irq_set, 200 .irq_set = &r100_irq_set,
198 .irq_process = &r100_irq_process, 201 .irq_process = &r100_irq_process,
202 .get_vblank_counter = &r100_get_vblank_counter,
199 .fence_ring_emit = &r300_fence_ring_emit, 203 .fence_ring_emit = &r300_fence_ring_emit,
200 .cs_parse = &r300_cs_parse, 204 .cs_parse = &r300_cs_parse,
201 .copy_blit = &r100_copy_blit, 205 .copy_blit = &r100_copy_blit,
@@ -243,6 +247,7 @@ static struct radeon_asic rs400_asic = {
243 .ring_start = &r300_ring_start, 247 .ring_start = &r300_ring_start,
244 .irq_set = &r100_irq_set, 248 .irq_set = &r100_irq_set,
245 .irq_process = &r100_irq_process, 249 .irq_process = &r100_irq_process,
250 .get_vblank_counter = &r100_get_vblank_counter,
246 .fence_ring_emit = &r300_fence_ring_emit, 251 .fence_ring_emit = &r300_fence_ring_emit,
247 .cs_parse = &r300_cs_parse, 252 .cs_parse = &r300_cs_parse,
248 .copy_blit = &r100_copy_blit, 253 .copy_blit = &r100_copy_blit,
@@ -266,6 +271,8 @@ void rs600_vram_info(struct radeon_device *rdev);
266int rs600_mc_init(struct radeon_device *rdev); 271int rs600_mc_init(struct radeon_device *rdev);
267void rs600_mc_fini(struct radeon_device *rdev); 272void rs600_mc_fini(struct radeon_device *rdev);
268int rs600_irq_set(struct radeon_device *rdev); 273int rs600_irq_set(struct radeon_device *rdev);
274int rs600_irq_process(struct radeon_device *rdev);
275u32 rs600_get_vblank_counter(struct radeon_device *rdev, int crtc);
269int rs600_gart_enable(struct radeon_device *rdev); 276int rs600_gart_enable(struct radeon_device *rdev);
270void rs600_gart_disable(struct radeon_device *rdev); 277void rs600_gart_disable(struct radeon_device *rdev);
271void rs600_gart_tlb_flush(struct radeon_device *rdev); 278void rs600_gart_tlb_flush(struct radeon_device *rdev);
@@ -291,7 +298,8 @@ static struct radeon_asic rs600_asic = {
291 .cp_disable = &r100_cp_disable, 298 .cp_disable = &r100_cp_disable,
292 .ring_start = &r300_ring_start, 299 .ring_start = &r300_ring_start,
293 .irq_set = &rs600_irq_set, 300 .irq_set = &rs600_irq_set,
294 .irq_process = &r100_irq_process, 301 .irq_process = &rs600_irq_process,
302 .get_vblank_counter = &rs600_get_vblank_counter,
295 .fence_ring_emit = &r300_fence_ring_emit, 303 .fence_ring_emit = &r300_fence_ring_emit,
296 .cs_parse = &r300_cs_parse, 304 .cs_parse = &r300_cs_parse,
297 .copy_blit = &r100_copy_blit, 305 .copy_blit = &r100_copy_blit,
@@ -308,6 +316,7 @@ static struct radeon_asic rs600_asic = {
308/* 316/*
309 * rs690,rs740 317 * rs690,rs740
310 */ 318 */
319int rs690_init(struct radeon_device *rdev);
311void rs690_errata(struct radeon_device *rdev); 320void rs690_errata(struct radeon_device *rdev);
312void rs690_vram_info(struct radeon_device *rdev); 321void rs690_vram_info(struct radeon_device *rdev);
313int rs690_mc_init(struct radeon_device *rdev); 322int rs690_mc_init(struct radeon_device *rdev);
@@ -316,7 +325,7 @@ uint32_t rs690_mc_rreg(struct radeon_device *rdev, uint32_t reg);
316void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v); 325void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
317void rs690_bandwidth_update(struct radeon_device *rdev); 326void rs690_bandwidth_update(struct radeon_device *rdev);
318static struct radeon_asic rs690_asic = { 327static struct radeon_asic rs690_asic = {
319 .init = &r300_init, 328 .init = &rs690_init,
320 .errata = &rs690_errata, 329 .errata = &rs690_errata,
321 .vram_info = &rs690_vram_info, 330 .vram_info = &rs690_vram_info,
322 .gpu_reset = &r300_gpu_reset, 331 .gpu_reset = &r300_gpu_reset,
@@ -333,7 +342,8 @@ static struct radeon_asic rs690_asic = {
333 .cp_disable = &r100_cp_disable, 342 .cp_disable = &r100_cp_disable,
334 .ring_start = &r300_ring_start, 343 .ring_start = &r300_ring_start,
335 .irq_set = &rs600_irq_set, 344 .irq_set = &rs600_irq_set,
336 .irq_process = &r100_irq_process, 345 .irq_process = &rs600_irq_process,
346 .get_vblank_counter = &rs600_get_vblank_counter,
337 .fence_ring_emit = &r300_fence_ring_emit, 347 .fence_ring_emit = &r300_fence_ring_emit,
338 .cs_parse = &r300_cs_parse, 348 .cs_parse = &r300_cs_parse,
339 .copy_blit = &r100_copy_blit, 349 .copy_blit = &r100_copy_blit,
@@ -381,8 +391,9 @@ static struct radeon_asic rv515_asic = {
381 .cp_fini = &r100_cp_fini, 391 .cp_fini = &r100_cp_fini,
382 .cp_disable = &r100_cp_disable, 392 .cp_disable = &r100_cp_disable,
383 .ring_start = &rv515_ring_start, 393 .ring_start = &rv515_ring_start,
384 .irq_set = &r100_irq_set, 394 .irq_set = &rs600_irq_set,
385 .irq_process = &r100_irq_process, 395 .irq_process = &rs600_irq_process,
396 .get_vblank_counter = &rs600_get_vblank_counter,
386 .fence_ring_emit = &r300_fence_ring_emit, 397 .fence_ring_emit = &r300_fence_ring_emit,
387 .cs_parse = &r300_cs_parse, 398 .cs_parse = &r300_cs_parse,
388 .copy_blit = &r100_copy_blit, 399 .copy_blit = &r100_copy_blit,
@@ -423,8 +434,9 @@ static struct radeon_asic r520_asic = {
423 .cp_fini = &r100_cp_fini, 434 .cp_fini = &r100_cp_fini,
424 .cp_disable = &r100_cp_disable, 435 .cp_disable = &r100_cp_disable,
425 .ring_start = &rv515_ring_start, 436 .ring_start = &rv515_ring_start,
426 .irq_set = &r100_irq_set, 437 .irq_set = &rs600_irq_set,
427 .irq_process = &r100_irq_process, 438 .irq_process = &rs600_irq_process,
439 .get_vblank_counter = &rs600_get_vblank_counter,
428 .fence_ring_emit = &r300_fence_ring_emit, 440 .fence_ring_emit = &r300_fence_ring_emit,
429 .cs_parse = &r300_cs_parse, 441 .cs_parse = &r300_cs_parse,
430 .copy_blit = &r100_copy_blit, 442 .copy_blit = &r100_copy_blit,
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index afc4db280b94..2a027e00762a 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -685,23 +685,15 @@ static const uint32_t default_tvdac_adj[CHIP_LAST] = {
685 0x00780000, /* rs480 */ 685 0x00780000, /* rs480 */
686}; 686};
687 687
688static struct radeon_encoder_tv_dac 688static void radeon_legacy_get_tv_dac_info_from_table(struct radeon_device *rdev,
689 *radeon_legacy_get_tv_dac_info_from_table(struct radeon_device *rdev) 689 struct radeon_encoder_tv_dac *tv_dac)
690{ 690{
691 struct radeon_encoder_tv_dac *tv_dac = NULL;
692
693 tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
694
695 if (!tv_dac)
696 return NULL;
697
698 tv_dac->ps2_tvdac_adj = default_tvdac_adj[rdev->family]; 691 tv_dac->ps2_tvdac_adj = default_tvdac_adj[rdev->family];
699 if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_RV250)) 692 if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_RV250))
700 tv_dac->ps2_tvdac_adj = 0x00880000; 693 tv_dac->ps2_tvdac_adj = 0x00880000;
701 tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; 694 tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
702 tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; 695 tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
703 696 return;
704 return tv_dac;
705} 697}
706 698
707struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct 699struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
@@ -713,19 +705,18 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
713 uint16_t dac_info; 705 uint16_t dac_info;
714 uint8_t rev, bg, dac; 706 uint8_t rev, bg, dac;
715 struct radeon_encoder_tv_dac *tv_dac = NULL; 707 struct radeon_encoder_tv_dac *tv_dac = NULL;
708 int found = 0;
709
710 tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
711 if (!tv_dac)
712 return NULL;
716 713
717 if (rdev->bios == NULL) 714 if (rdev->bios == NULL)
718 return radeon_legacy_get_tv_dac_info_from_table(rdev); 715 goto out;
719 716
720 /* first check TV table */ 717 /* first check TV table */
721 dac_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE); 718 dac_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE);
722 if (dac_info) { 719 if (dac_info) {
723 tv_dac =
724 kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
725
726 if (!tv_dac)
727 return NULL;
728
729 rev = RBIOS8(dac_info + 0x3); 720 rev = RBIOS8(dac_info + 0x3);
730 if (rev > 4) { 721 if (rev > 4) {
731 bg = RBIOS8(dac_info + 0xc) & 0xf; 722 bg = RBIOS8(dac_info + 0xc) & 0xf;
@@ -739,6 +730,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
739 bg = RBIOS8(dac_info + 0x10) & 0xf; 730 bg = RBIOS8(dac_info + 0x10) & 0xf;
740 dac = RBIOS8(dac_info + 0x11) & 0xf; 731 dac = RBIOS8(dac_info + 0x11) & 0xf;
741 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); 732 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
733 found = 1;
742 } else if (rev > 1) { 734 } else if (rev > 1) {
743 bg = RBIOS8(dac_info + 0xc) & 0xf; 735 bg = RBIOS8(dac_info + 0xc) & 0xf;
744 dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf; 736 dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf;
@@ -751,22 +743,15 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
751 bg = RBIOS8(dac_info + 0xe) & 0xf; 743 bg = RBIOS8(dac_info + 0xe) & 0xf;
752 dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf; 744 dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf;
753 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); 745 tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
746 found = 1;
754 } 747 }
755
756 tv_dac->tv_std = radeon_combios_get_tv_info(encoder); 748 tv_dac->tv_std = radeon_combios_get_tv_info(encoder);
757 749 }
758 } else { 750 if (!found) {
759 /* then check CRT table */ 751 /* then check CRT table */
760 dac_info = 752 dac_info =
761 combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); 753 combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
762 if (dac_info) { 754 if (dac_info) {
763 tv_dac =
764 kzalloc(sizeof(struct radeon_encoder_tv_dac),
765 GFP_KERNEL);
766
767 if (!tv_dac)
768 return NULL;
769
770 rev = RBIOS8(dac_info) & 0x3; 755 rev = RBIOS8(dac_info) & 0x3;
771 if (rev < 2) { 756 if (rev < 2) {
772 bg = RBIOS8(dac_info + 0x3) & 0xf; 757 bg = RBIOS8(dac_info + 0x3) & 0xf;
@@ -775,6 +760,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
775 (bg << 16) | (dac << 20); 760 (bg << 16) | (dac << 20);
776 tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; 761 tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
777 tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; 762 tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
763 found = 1;
778 } else { 764 } else {
779 bg = RBIOS8(dac_info + 0x4) & 0xf; 765 bg = RBIOS8(dac_info + 0x4) & 0xf;
780 dac = RBIOS8(dac_info + 0x5) & 0xf; 766 dac = RBIOS8(dac_info + 0x5) & 0xf;
@@ -782,13 +768,17 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
782 (bg << 16) | (dac << 20); 768 (bg << 16) | (dac << 20);
783 tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; 769 tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
784 tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; 770 tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
771 found = 1;
785 } 772 }
786 } else { 773 } else {
787 DRM_INFO("No TV DAC info found in BIOS\n"); 774 DRM_INFO("No TV DAC info found in BIOS\n");
788 return radeon_legacy_get_tv_dac_info_from_table(rdev);
789 } 775 }
790 } 776 }
791 777
778out:
779 if (!found) /* fallback to defaults */
780 radeon_legacy_get_tv_dac_info_from_table(rdev, tv_dac);
781
792 return tv_dac; 782 return tv_dac;
793} 783}
794 784
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index d8356827ef17..7a52c461145c 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -406,6 +406,15 @@ static void radeon_init_pipes(drm_radeon_private_t *dev_priv)
406{ 406{
407 uint32_t gb_tile_config, gb_pipe_sel = 0; 407 uint32_t gb_tile_config, gb_pipe_sel = 0;
408 408
409 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) {
410 uint32_t z_pipe_sel = RADEON_READ(RV530_GB_PIPE_SELECT2);
411 if ((z_pipe_sel & 3) == 3)
412 dev_priv->num_z_pipes = 2;
413 else
414 dev_priv->num_z_pipes = 1;
415 } else
416 dev_priv->num_z_pipes = 1;
417
409 /* RS4xx/RS6xx/R4xx/R5xx */ 418 /* RS4xx/RS6xx/R4xx/R5xx */
410 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { 419 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) {
411 gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); 420 gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 9ff6dcb97f9d..7693f7c67bd3 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -225,25 +225,18 @@ void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
225 225
226void radeon_register_accessor_init(struct radeon_device *rdev) 226void radeon_register_accessor_init(struct radeon_device *rdev)
227{ 227{
228 rdev->mm_rreg = &r100_mm_rreg;
229 rdev->mm_wreg = &r100_mm_wreg;
230 rdev->mc_rreg = &radeon_invalid_rreg; 228 rdev->mc_rreg = &radeon_invalid_rreg;
231 rdev->mc_wreg = &radeon_invalid_wreg; 229 rdev->mc_wreg = &radeon_invalid_wreg;
232 rdev->pll_rreg = &radeon_invalid_rreg; 230 rdev->pll_rreg = &radeon_invalid_rreg;
233 rdev->pll_wreg = &radeon_invalid_wreg; 231 rdev->pll_wreg = &radeon_invalid_wreg;
234 rdev->pcie_rreg = &radeon_invalid_rreg;
235 rdev->pcie_wreg = &radeon_invalid_wreg;
236 rdev->pciep_rreg = &radeon_invalid_rreg; 232 rdev->pciep_rreg = &radeon_invalid_rreg;
237 rdev->pciep_wreg = &radeon_invalid_wreg; 233 rdev->pciep_wreg = &radeon_invalid_wreg;
238 234
239 /* Don't change order as we are overridding accessor. */ 235 /* Don't change order as we are overridding accessor. */
240 if (rdev->family < CHIP_RV515) { 236 if (rdev->family < CHIP_RV515) {
241 rdev->pcie_rreg = &rv370_pcie_rreg; 237 rdev->pcie_reg_mask = 0xff;
242 rdev->pcie_wreg = &rv370_pcie_wreg; 238 } else {
243 } 239 rdev->pcie_reg_mask = 0x7ff;
244 if (rdev->family >= CHIP_RV515) {
245 rdev->pcie_rreg = &rv515_pcie_rreg;
246 rdev->pcie_wreg = &rv515_pcie_wreg;
247 } 240 }
248 /* FIXME: not sure here */ 241 /* FIXME: not sure here */
249 if (rdev->family <= CHIP_R580) { 242 if (rdev->family <= CHIP_R580) {
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
index 3933f8216a34..6fa32dac4e97 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.h
+++ b/drivers/gpu/drm/radeon/radeon_drv.h
@@ -100,9 +100,10 @@
100 * 1.28- Add support for VBL on CRTC2 100 * 1.28- Add support for VBL on CRTC2
101 * 1.29- R500 3D cmd buffer support 101 * 1.29- R500 3D cmd buffer support
102 * 1.30- Add support for occlusion queries 102 * 1.30- Add support for occlusion queries
103 * 1.31- Add support for num Z pipes from GET_PARAM
103 */ 104 */
104#define DRIVER_MAJOR 1 105#define DRIVER_MAJOR 1
105#define DRIVER_MINOR 30 106#define DRIVER_MINOR 31
106#define DRIVER_PATCHLEVEL 0 107#define DRIVER_PATCHLEVEL 0
107 108
108/* 109/*
@@ -329,6 +330,7 @@ typedef struct drm_radeon_private {
329 resource_size_t fb_aper_offset; 330 resource_size_t fb_aper_offset;
330 331
331 int num_gb_pipes; 332 int num_gb_pipes;
333 int num_z_pipes;
332 int track_flush; 334 int track_flush;
333 drm_local_map_t *mmio; 335 drm_local_map_t *mmio;
334 336
@@ -689,6 +691,7 @@ extern void r600_page_table_cleanup(struct drm_device *dev, struct drm_ati_pciga
689 691
690/* pipe config regs */ 692/* pipe config regs */
691#define R400_GB_PIPE_SELECT 0x402c 693#define R400_GB_PIPE_SELECT 0x402c
694#define RV530_GB_PIPE_SELECT2 0x4124
692#define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ 695#define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */
693#define R300_GB_TILE_CONFIG 0x4018 696#define R300_GB_TILE_CONFIG 0x4018
694# define R300_ENABLE_TILING (1 << 0) 697# define R300_ENABLE_TILING (1 << 0)
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 3206c0ad7b6c..ec383edf5f38 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -574,6 +574,8 @@ int radeonfb_create(struct radeon_device *rdev,
574 goto out_unref; 574 goto out_unref;
575 } 575 }
576 576
577 memset_io(fbptr, 0, aligned_size);
578
577 strcpy(info->fix.id, "radeondrmfb"); 579 strcpy(info->fix.id, "radeondrmfb");
578 info->fix.type = FB_TYPE_PACKED_PIXELS; 580 info->fix.type = FB_TYPE_PACKED_PIXELS;
579 info->fix.visual = FB_VISUAL_TRUECOLOR; 581 info->fix.visual = FB_VISUAL_TRUECOLOR;
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index cded5180c752..d880edf254db 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -262,8 +262,34 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data,
262int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, 262int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
263 struct drm_file *filp) 263 struct drm_file *filp)
264{ 264{
265 /* FIXME: implement */ 265 struct drm_radeon_gem_busy *args = data;
266 return 0; 266 struct drm_gem_object *gobj;
267 struct radeon_object *robj;
268 int r;
269 uint32_t cur_placement;
270
271 gobj = drm_gem_object_lookup(dev, filp, args->handle);
272 if (gobj == NULL) {
273 return -EINVAL;
274 }
275 robj = gobj->driver_private;
276 r = radeon_object_busy_domain(robj, &cur_placement);
277 switch (cur_placement) {
278 case TTM_PL_VRAM:
279 args->domain = RADEON_GEM_DOMAIN_VRAM;
280 break;
281 case TTM_PL_TT:
282 args->domain = RADEON_GEM_DOMAIN_GTT;
283 break;
284 case TTM_PL_SYSTEM:
285 args->domain = RADEON_GEM_DOMAIN_CPU;
286 default:
287 break;
288 }
289 mutex_lock(&dev->struct_mutex);
290 drm_gem_object_unreference(gobj);
291 mutex_unlock(&dev->struct_mutex);
292 return r;
267} 293}
268 294
269int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, 295int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 491d569deb0e..9805e4b6ca1b 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -32,60 +32,6 @@
32#include "radeon.h" 32#include "radeon.h"
33#include "atom.h" 33#include "atom.h"
34 34
35static inline uint32_t r100_irq_ack(struct radeon_device *rdev)
36{
37 uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS);
38 uint32_t irq_mask = RADEON_SW_INT_TEST;
39
40 if (irqs) {
41 WREG32(RADEON_GEN_INT_STATUS, irqs);
42 }
43 return irqs & irq_mask;
44}
45
46int r100_irq_set(struct radeon_device *rdev)
47{
48 uint32_t tmp = 0;
49
50 if (rdev->irq.sw_int) {
51 tmp |= RADEON_SW_INT_ENABLE;
52 }
53 /* Todo go through CRTC and enable vblank int or not */
54 WREG32(RADEON_GEN_INT_CNTL, tmp);
55 return 0;
56}
57
58int r100_irq_process(struct radeon_device *rdev)
59{
60 uint32_t status;
61
62 status = r100_irq_ack(rdev);
63 if (!status) {
64 return IRQ_NONE;
65 }
66 while (status) {
67 /* SW interrupt */
68 if (status & RADEON_SW_INT_TEST) {
69 radeon_fence_process(rdev);
70 }
71 status = r100_irq_ack(rdev);
72 }
73 return IRQ_HANDLED;
74}
75
76int rs600_irq_set(struct radeon_device *rdev)
77{
78 uint32_t tmp = 0;
79
80 if (rdev->irq.sw_int) {
81 tmp |= RADEON_SW_INT_ENABLE;
82 }
83 WREG32(RADEON_GEN_INT_CNTL, tmp);
84 /* Todo go through CRTC and enable vblank int or not */
85 WREG32(R500_DxMODE_INT_MASK, 0);
86 return 0;
87}
88
89irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS) 35irqreturn_t radeon_driver_irq_handler_kms(DRM_IRQ_ARGS)
90{ 36{
91 struct drm_device *dev = (struct drm_device *) arg; 37 struct drm_device *dev = (struct drm_device *) arg;
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 3357110e30ce..dce09ada32bc 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -95,6 +95,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
95 case RADEON_INFO_NUM_GB_PIPES: 95 case RADEON_INFO_NUM_GB_PIPES:
96 value = rdev->num_gb_pipes; 96 value = rdev->num_gb_pipes;
97 break; 97 break;
98 case RADEON_INFO_NUM_Z_PIPES:
99 value = rdev->num_z_pipes;
100 break;
98 default: 101 default:
99 DRM_DEBUG("Invalid request %d\n", info->request); 102 DRM_DEBUG("Invalid request %d\n", info->request);
100 return -EINVAL; 103 return -EINVAL;
@@ -141,19 +144,42 @@ void radeon_driver_preclose_kms(struct drm_device *dev,
141 */ 144 */
142u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc) 145u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc)
143{ 146{
144 /* FIXME: implement */ 147 struct radeon_device *rdev = dev->dev_private;
145 return 0; 148
149 if (crtc < 0 || crtc > 1) {
150 DRM_ERROR("Invalid crtc %d\n", crtc);
151 return -EINVAL;
152 }
153
154 return radeon_get_vblank_counter(rdev, crtc);
146} 155}
147 156
148int radeon_enable_vblank_kms(struct drm_device *dev, int crtc) 157int radeon_enable_vblank_kms(struct drm_device *dev, int crtc)
149{ 158{
150 /* FIXME: implement */ 159 struct radeon_device *rdev = dev->dev_private;
151 return 0; 160
161 if (crtc < 0 || crtc > 1) {
162 DRM_ERROR("Invalid crtc %d\n", crtc);
163 return -EINVAL;
164 }
165
166 rdev->irq.crtc_vblank_int[crtc] = true;
167
168 return radeon_irq_set(rdev);
152} 169}
153 170
154void radeon_disable_vblank_kms(struct drm_device *dev, int crtc) 171void radeon_disable_vblank_kms(struct drm_device *dev, int crtc)
155{ 172{
156 /* FIXME: implement */ 173 struct radeon_device *rdev = dev->dev_private;
174
175 if (crtc < 0 || crtc > 1) {
176 DRM_ERROR("Invalid crtc %d\n", crtc);
177 return;
178 }
179
180 rdev->irq.crtc_vblank_int[crtc] = false;
181
182 radeon_irq_set(rdev);
157} 183}
158 184
159 185
@@ -295,5 +321,6 @@ struct drm_ioctl_desc radeon_ioctls_kms[] = {
295 DRM_IOCTL_DEF(DRM_RADEON_INFO, radeon_info_ioctl, DRM_AUTH), 321 DRM_IOCTL_DEF(DRM_RADEON_INFO, radeon_info_ioctl, DRM_AUTH),
296 DRM_IOCTL_DEF(DRM_RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH), 322 DRM_IOCTL_DEF(DRM_RADEON_GEM_SET_TILING, radeon_gem_set_tiling_ioctl, DRM_AUTH),
297 DRM_IOCTL_DEF(DRM_RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH), 323 DRM_IOCTL_DEF(DRM_RADEON_GEM_GET_TILING, radeon_gem_get_tiling_ioctl, DRM_AUTH),
324 DRM_IOCTL_DEF(DRM_RADEON_GEM_BUSY, radeon_gem_busy_ioctl, DRM_AUTH),
298}; 325};
299int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms); 326int radeon_max_kms_ioctl = DRM_ARRAY_SIZE(radeon_ioctls_kms);
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 7d06dc98a42a..0da72f18fd3a 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -310,10 +310,13 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
310 RADEON_CRTC_DISP_REQ_EN_B)); 310 RADEON_CRTC_DISP_REQ_EN_B));
311 WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); 311 WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask);
312 } 312 }
313 drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
314 radeon_crtc_load_lut(crtc);
313 break; 315 break;
314 case DRM_MODE_DPMS_STANDBY: 316 case DRM_MODE_DPMS_STANDBY:
315 case DRM_MODE_DPMS_SUSPEND: 317 case DRM_MODE_DPMS_SUSPEND:
316 case DRM_MODE_DPMS_OFF: 318 case DRM_MODE_DPMS_OFF:
319 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
317 if (radeon_crtc->crtc_id) 320 if (radeon_crtc->crtc_id)
318 WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~mask); 321 WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~mask);
319 else { 322 else {
@@ -323,10 +326,6 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
323 } 326 }
324 break; 327 break;
325 } 328 }
326
327 if (mode != DRM_MODE_DPMS_OFF) {
328 radeon_crtc_load_lut(crtc);
329 }
330} 329}
331 330
332/* properly set crtc bpp when using atombios */ 331/* properly set crtc bpp when using atombios */
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 34d0f58eb944..9322675ef6d0 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -1066,6 +1066,7 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t
1066 1066
1067 switch (radeon_encoder->encoder_id) { 1067 switch (radeon_encoder->encoder_id) {
1068 case ENCODER_OBJECT_ID_INTERNAL_LVDS: 1068 case ENCODER_OBJECT_ID_INTERNAL_LVDS:
1069 encoder->possible_crtcs = 0x1;
1069 drm_encoder_init(dev, encoder, &radeon_legacy_lvds_enc_funcs, DRM_MODE_ENCODER_LVDS); 1070 drm_encoder_init(dev, encoder, &radeon_legacy_lvds_enc_funcs, DRM_MODE_ENCODER_LVDS);
1070 drm_encoder_helper_add(encoder, &radeon_legacy_lvds_helper_funcs); 1071 drm_encoder_helper_add(encoder, &radeon_legacy_lvds_helper_funcs);
1071 if (rdev->is_atom_bios) 1072 if (rdev->is_atom_bios)
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index e98cae3bf4a6..b85fb83d7ae8 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -316,6 +316,25 @@ int radeon_object_wait(struct radeon_object *robj)
316 return r; 316 return r;
317} 317}
318 318
319int radeon_object_busy_domain(struct radeon_object *robj, uint32_t *cur_placement)
320{
321 int r = 0;
322
323 r = radeon_object_reserve(robj, true);
324 if (unlikely(r != 0)) {
325 DRM_ERROR("radeon: failed to reserve object for waiting.\n");
326 return r;
327 }
328 spin_lock(&robj->tobj.lock);
329 *cur_placement = robj->tobj.mem.mem_type;
330 if (robj->tobj.sync_obj) {
331 r = ttm_bo_wait(&robj->tobj, true, true, true);
332 }
333 spin_unlock(&robj->tobj.lock);
334 radeon_object_unreserve(robj);
335 return r;
336}
337
319int radeon_object_evict_vram(struct radeon_device *rdev) 338int radeon_object_evict_vram(struct radeon_device *rdev)
320{ 339{
321 if (rdev->flags & RADEON_IS_IGP) { 340 if (rdev->flags & RADEON_IS_IGP) {
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index e1b618574461..4df43f62c678 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -982,12 +982,15 @@
982# define RS400_TMDS2_PLLRST (1 << 1) 982# define RS400_TMDS2_PLLRST (1 << 1)
983 983
984#define RADEON_GEN_INT_CNTL 0x0040 984#define RADEON_GEN_INT_CNTL 0x0040
985# define RADEON_CRTC_VBLANK_MASK (1 << 0)
986# define RADEON_CRTC2_VBLANK_MASK (1 << 9)
985# define RADEON_SW_INT_ENABLE (1 << 25) 987# define RADEON_SW_INT_ENABLE (1 << 25)
986#define RADEON_GEN_INT_STATUS 0x0044 988#define RADEON_GEN_INT_STATUS 0x0044
987# define RADEON_VSYNC_INT_AK (1 << 2) 989# define AVIVO_DISPLAY_INT_STATUS (1 << 0)
988# define RADEON_VSYNC_INT (1 << 2) 990# define RADEON_CRTC_VBLANK_STAT (1 << 0)
989# define RADEON_VSYNC2_INT_AK (1 << 6) 991# define RADEON_CRTC_VBLANK_STAT_ACK (1 << 0)
990# define RADEON_VSYNC2_INT (1 << 6) 992# define RADEON_CRTC2_VBLANK_STAT (1 << 9)
993# define RADEON_CRTC2_VBLANK_STAT_ACK (1 << 9)
991# define RADEON_SW_INT_FIRE (1 << 26) 994# define RADEON_SW_INT_FIRE (1 << 26)
992# define RADEON_SW_INT_TEST (1 << 25) 995# define RADEON_SW_INT_TEST (1 << 25)
993# define RADEON_SW_INT_TEST_ACK (1 << 25) 996# define RADEON_SW_INT_TEST_ACK (1 << 25)
@@ -2334,6 +2337,9 @@
2334# define RADEON_RE_WIDTH_SHIFT 0 2337# define RADEON_RE_WIDTH_SHIFT 0
2335# define RADEON_RE_HEIGHT_SHIFT 16 2338# define RADEON_RE_HEIGHT_SHIFT 16
2336 2339
2340#define RADEON_RB3D_ZPASS_DATA 0x3290
2341#define RADEON_RB3D_ZPASS_ADDR 0x3294
2342
2337#define RADEON_SE_CNTL 0x1c4c 2343#define RADEON_SE_CNTL 0x1c4c
2338# define RADEON_FFACE_CULL_CW (0 << 0) 2344# define RADEON_FFACE_CULL_CW (0 << 0)
2339# define RADEON_FFACE_CULL_CCW (1 << 0) 2345# define RADEON_FFACE_CULL_CCW (1 << 0)
@@ -3568,4 +3574,6 @@
3568#define RADEON_SCRATCH_REG4 0x15f0 3574#define RADEON_SCRATCH_REG4 0x15f0
3569#define RADEON_SCRATCH_REG5 0x15f4 3575#define RADEON_SCRATCH_REG5 0x15f4
3570 3576
3577#define RV530_GB_PIPE_SELECT2 0x4124
3578
3571#endif 3579#endif
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c
index 46645f3e0328..2882f40d5ec5 100644
--- a/drivers/gpu/drm/radeon/radeon_state.c
+++ b/drivers/gpu/drm/radeon/radeon_state.c
@@ -3081,6 +3081,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
3081 case RADEON_PARAM_NUM_GB_PIPES: 3081 case RADEON_PARAM_NUM_GB_PIPES:
3082 value = dev_priv->num_gb_pipes; 3082 value = dev_priv->num_gb_pipes;
3083 break; 3083 break;
3084 case RADEON_PARAM_NUM_Z_PIPES:
3085 value = dev_priv->num_z_pipes;
3086 break;
3084 default: 3087 default:
3085 DRM_DEBUG("Invalid parameter %d\n", param->param); 3088 DRM_DEBUG("Invalid parameter %d\n", param->param);
3086 return -EINVAL; 3089 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index bbea6dee4a94..7e8ce983a908 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -240,6 +240,88 @@ void rs600_mc_fini(struct radeon_device *rdev)
240 240
241 241
242/* 242/*
243 * Interrupts
244 */
245int rs600_irq_set(struct radeon_device *rdev)
246{
247 uint32_t tmp = 0;
248 uint32_t mode_int = 0;
249
250 if (rdev->irq.sw_int) {
251 tmp |= RADEON_SW_INT_ENABLE;
252 }
253 if (rdev->irq.crtc_vblank_int[0]) {
254 tmp |= AVIVO_DISPLAY_INT_STATUS;
255 mode_int |= AVIVO_D1MODE_INT_MASK;
256 }
257 if (rdev->irq.crtc_vblank_int[1]) {
258 tmp |= AVIVO_DISPLAY_INT_STATUS;
259 mode_int |= AVIVO_D2MODE_INT_MASK;
260 }
261 WREG32(RADEON_GEN_INT_CNTL, tmp);
262 WREG32(AVIVO_DxMODE_INT_MASK, mode_int);
263 return 0;
264}
265
266static inline uint32_t rs600_irq_ack(struct radeon_device *rdev, u32 *r500_disp_int)
267{
268 uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS);
269 uint32_t irq_mask = RADEON_SW_INT_TEST;
270
271 if (irqs & AVIVO_DISPLAY_INT_STATUS) {
272 *r500_disp_int = RREG32(AVIVO_DISP_INTERRUPT_STATUS);
273 if (*r500_disp_int & AVIVO_D1_VBLANK_INTERRUPT) {
274 WREG32(AVIVO_D1MODE_VBLANK_STATUS, AVIVO_VBLANK_ACK);
275 }
276 if (*r500_disp_int & AVIVO_D2_VBLANK_INTERRUPT) {
277 WREG32(AVIVO_D2MODE_VBLANK_STATUS, AVIVO_VBLANK_ACK);
278 }
279 } else {
280 *r500_disp_int = 0;
281 }
282
283 if (irqs) {
284 WREG32(RADEON_GEN_INT_STATUS, irqs);
285 }
286 return irqs & irq_mask;
287}
288
289int rs600_irq_process(struct radeon_device *rdev)
290{
291 uint32_t status;
292 uint32_t r500_disp_int;
293
294 status = rs600_irq_ack(rdev, &r500_disp_int);
295 if (!status && !r500_disp_int) {
296 return IRQ_NONE;
297 }
298 while (status || r500_disp_int) {
299 /* SW interrupt */
300 if (status & RADEON_SW_INT_TEST) {
301 radeon_fence_process(rdev);
302 }
303 /* Vertical blank interrupts */
304 if (r500_disp_int & AVIVO_D1_VBLANK_INTERRUPT) {
305 drm_handle_vblank(rdev->ddev, 0);
306 }
307 if (r500_disp_int & AVIVO_D2_VBLANK_INTERRUPT) {
308 drm_handle_vblank(rdev->ddev, 1);
309 }
310 status = rs600_irq_ack(rdev, &r500_disp_int);
311 }
312 return IRQ_HANDLED;
313}
314
315u32 rs600_get_vblank_counter(struct radeon_device *rdev, int crtc)
316{
317 if (crtc == 0)
318 return RREG32(AVIVO_D1CRTC_FRAME_COUNT);
319 else
320 return RREG32(AVIVO_D2CRTC_FRAME_COUNT);
321}
322
323
324/*
243 * Global GPU functions 325 * Global GPU functions
244 */ 326 */
245void rs600_disable_vga(struct radeon_device *rdev) 327void rs600_disable_vga(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 839595b00728..bc6b7c5339bc 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -652,3 +652,68 @@ void rs690_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
652 WREG32(RS690_MC_DATA, v); 652 WREG32(RS690_MC_DATA, v);
653 WREG32(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); 653 WREG32(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK);
654} 654}
655
656static const unsigned rs690_reg_safe_bm[219] = {
657 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
658 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
659 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
660 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
661 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
662 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
663 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
664 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
665 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
666 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
667 0x17FF1FFF,0xFFFFFFFC,0xFFFFFFFF,0xFF30FFBF,
668 0xFFFFFFF8,0xC3E6FFFF,0xFFFFF6DF,0xFFFFFFFF,
669 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
670 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
671 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFF03F,
672 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
673 0xFFFFFFFF,0xFFFFEFCE,0xF00EBFFF,0x007C0000,
674 0xF0000078,0xFF000009,0xFFFFFFFF,0xFFFFFFFF,
675 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
676 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
677 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
678 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
679 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
680 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
681 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
682 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
683 0xFFFFF7FF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
684 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
685 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
686 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
687 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
688 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
689 0xFFFFFC78,0xFFFFFFFF,0xFFFFFFFE,0xFFFFFFFF,
690 0x38FF8F50,0xFFF88082,0xF000000C,0xFAE009FF,
691 0x0000FFFF,0xFFFFFFFF,0xFFFFFFFF,0x00000000,
692 0x00000000,0x0000C100,0x00000000,0x00000000,
693 0x00000000,0x00000000,0x00000000,0x00000000,
694 0x00000000,0xFFFF0000,0xFFFFFFFF,0xFF80FFFF,
695 0x00000000,0x00000000,0x00000000,0x00000000,
696 0x0003FC01,0xFFFFFFF8,0xFE800B19,0xFFFFFFFF,
697 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
698 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
699 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
700 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
701 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
702 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
703 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
704 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
705 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
706 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
707 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
708 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
709 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
710 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
711 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
712};
713
714int rs690_init(struct radeon_device *rdev)
715{
716 rdev->config.r300.reg_safe_bm = rs690_reg_safe_bm;
717 rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(rs690_reg_safe_bm);
718 return 0;
719}
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index fd8f3ca716ea..31a7f668ae5a 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -400,25 +400,6 @@ void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
400 WREG32(MC_IND_INDEX, 0); 400 WREG32(MC_IND_INDEX, 0);
401} 401}
402 402
403uint32_t rv515_pcie_rreg(struct radeon_device *rdev, uint32_t reg)
404{
405 uint32_t r;
406
407 WREG32(PCIE_INDEX, ((reg) & 0x7ff));
408 (void)RREG32(PCIE_INDEX);
409 r = RREG32(PCIE_DATA);
410 return r;
411}
412
413void rv515_pcie_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
414{
415 WREG32(PCIE_INDEX, ((reg) & 0x7ff));
416 (void)RREG32(PCIE_INDEX);
417 WREG32(PCIE_DATA, (v));
418 (void)RREG32(PCIE_DATA);
419}
420
421
422/* 403/*
423 * Debugfs info 404 * Debugfs info
424 */ 405 */
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index d258b02aef44..827da0858136 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -674,7 +674,14 @@ omap_i2c_isr(int this_irq, void *dev_id)
674 674
675 err = 0; 675 err = 0;
676complete: 676complete:
677 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat); 677 /*
678 * Ack the stat in one go, but [R/X]DR and [R/X]RDY should be
679 * acked after the data operation is complete.
680 * Ref: TRM SWPU114Q Figure 18-31
681 */
682 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat &
683 ~(OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
684 OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
678 685
679 if (stat & OMAP_I2C_STAT_NACK) { 686 if (stat & OMAP_I2C_STAT_NACK) {
680 err |= OMAP_I2C_STAT_NACK; 687 err |= OMAP_I2C_STAT_NACK;
@@ -687,6 +694,9 @@ complete:
687 } 694 }
688 if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | 695 if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK |
689 OMAP_I2C_STAT_AL)) { 696 OMAP_I2C_STAT_AL)) {
697 omap_i2c_ack_stat(dev, stat &
698 (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR |
699 OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
690 omap_i2c_complete_cmd(dev, err); 700 omap_i2c_complete_cmd(dev, err);
691 return IRQ_HANDLED; 701 return IRQ_HANDLED;
692 } 702 }
@@ -774,7 +784,7 @@ complete:
774 * memory to the I2C interface. 784 * memory to the I2C interface.
775 */ 785 */
776 786
777 if (cpu_is_omap34xx()) { 787 if (dev->rev <= OMAP_I2C_REV_ON_3430) {
778 while (!(stat & OMAP_I2C_STAT_XUDF)) { 788 while (!(stat & OMAP_I2C_STAT_XUDF)) {
779 if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) { 789 if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
780 omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); 790 omap_i2c_ack_stat(dev, stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 182e711318ba..d2728a28a8db 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -117,7 +117,8 @@ enum stu300_error {
117 STU300_ERROR_NONE = 0, 117 STU300_ERROR_NONE = 0,
118 STU300_ERROR_ACKNOWLEDGE_FAILURE, 118 STU300_ERROR_ACKNOWLEDGE_FAILURE,
119 STU300_ERROR_BUS_ERROR, 119 STU300_ERROR_BUS_ERROR,
120 STU300_ERROR_ARBITRATION_LOST 120 STU300_ERROR_ARBITRATION_LOST,
121 STU300_ERROR_UNKNOWN
121}; 122};
122 123
123/* timeout waiting for the controller to respond */ 124/* timeout waiting for the controller to respond */
@@ -127,7 +128,7 @@ enum stu300_error {
127 * The number of address send athemps tried before giving up. 128 * The number of address send athemps tried before giving up.
128 * If the first one failes it seems like 5 to 8 attempts are required. 129 * If the first one failes it seems like 5 to 8 attempts are required.
129 */ 130 */
130#define NUM_ADDR_RESEND_ATTEMPTS 10 131#define NUM_ADDR_RESEND_ATTEMPTS 12
131 132
132/* I2C clock speed, in Hz 0-400kHz*/ 133/* I2C clock speed, in Hz 0-400kHz*/
133static unsigned int scl_frequency = 100000; 134static unsigned int scl_frequency = 100000;
@@ -149,6 +150,7 @@ module_param(scl_frequency, uint, 0644);
149 * @msg_index: index of current message 150 * @msg_index: index of current message
150 * @msg_len: length of current message 151 * @msg_len: length of current message
151 */ 152 */
153
152struct stu300_dev { 154struct stu300_dev {
153 struct platform_device *pdev; 155 struct platform_device *pdev;
154 struct i2c_adapter adapter; 156 struct i2c_adapter adapter;
@@ -188,6 +190,27 @@ static inline u32 stu300_r8(void __iomem *address)
188 return readl(address) & 0x000000FFU; 190 return readl(address) & 0x000000FFU;
189} 191}
190 192
193static void stu300_irq_enable(struct stu300_dev *dev)
194{
195 u32 val;
196 val = stu300_r8(dev->virtbase + I2C_CR);
197 val |= I2C_CR_INTERRUPT_ENABLE;
198 /* Twice paranoia (possible HW glitch) */
199 stu300_wr8(val, dev->virtbase + I2C_CR);
200 stu300_wr8(val, dev->virtbase + I2C_CR);
201}
202
203static void stu300_irq_disable(struct stu300_dev *dev)
204{
205 u32 val;
206 val = stu300_r8(dev->virtbase + I2C_CR);
207 val &= ~I2C_CR_INTERRUPT_ENABLE;
208 /* Twice paranoia (possible HW glitch) */
209 stu300_wr8(val, dev->virtbase + I2C_CR);
210 stu300_wr8(val, dev->virtbase + I2C_CR);
211}
212
213
191/* 214/*
192 * Tells whether a certain event or events occurred in 215 * Tells whether a certain event or events occurred in
193 * response to a command. The events represent states in 216 * response to a command. The events represent states in
@@ -196,9 +219,10 @@ static inline u32 stu300_r8(void __iomem *address)
196 * documentation and can only be treated as abstract state 219 * documentation and can only be treated as abstract state
197 * machine states. 220 * machine states.
198 * 221 *
199 * @ret 0 = event has not occurred, any other value means 222 * @ret 0 = event has not occurred or unknown error, any
200 * the event occurred. 223 * other value means the correct event occurred or an error.
201 */ 224 */
225
202static int stu300_event_occurred(struct stu300_dev *dev, 226static int stu300_event_occurred(struct stu300_dev *dev,
203 enum stu300_event mr_event) { 227 enum stu300_event mr_event) {
204 u32 status1; 228 u32 status1;
@@ -206,11 +230,28 @@ static int stu300_event_occurred(struct stu300_dev *dev,
206 230
207 /* What event happened? */ 231 /* What event happened? */
208 status1 = stu300_r8(dev->virtbase + I2C_SR1); 232 status1 = stu300_r8(dev->virtbase + I2C_SR1);
233
209 if (!(status1 & I2C_SR1_EVF_IND)) 234 if (!(status1 & I2C_SR1_EVF_IND))
210 /* No event at all */ 235 /* No event at all */
211 return 0; 236 return 0;
237
212 status2 = stu300_r8(dev->virtbase + I2C_SR2); 238 status2 = stu300_r8(dev->virtbase + I2C_SR2);
213 239
240 /* Block any multiple interrupts */
241 stu300_irq_disable(dev);
242
243 /* Check for errors first */
244 if (status2 & I2C_SR2_AF_IND) {
245 dev->cmd_err = STU300_ERROR_ACKNOWLEDGE_FAILURE;
246 return 1;
247 } else if (status2 & I2C_SR2_BERR_IND) {
248 dev->cmd_err = STU300_ERROR_BUS_ERROR;
249 return 1;
250 } else if (status2 & I2C_SR2_ARLO_IND) {
251 dev->cmd_err = STU300_ERROR_ARBITRATION_LOST;
252 return 1;
253 }
254
214 switch (mr_event) { 255 switch (mr_event) {
215 case STU300_EVENT_1: 256 case STU300_EVENT_1:
216 if (status1 & I2C_SR1_ADSL_IND) 257 if (status1 & I2C_SR1_ADSL_IND)
@@ -221,10 +262,6 @@ static int stu300_event_occurred(struct stu300_dev *dev,
221 case STU300_EVENT_7: 262 case STU300_EVENT_7:
222 case STU300_EVENT_8: 263 case STU300_EVENT_8:
223 if (status1 & I2C_SR1_BTF_IND) { 264 if (status1 & I2C_SR1_BTF_IND) {
224 if (status2 & I2C_SR2_AF_IND)
225 dev->cmd_err = STU300_ERROR_ACKNOWLEDGE_FAILURE;
226 else if (status2 & I2C_SR2_BERR_IND)
227 dev->cmd_err = STU300_ERROR_BUS_ERROR;
228 return 1; 265 return 1;
229 } 266 }
230 break; 267 break;
@@ -240,8 +277,6 @@ static int stu300_event_occurred(struct stu300_dev *dev,
240 case STU300_EVENT_6: 277 case STU300_EVENT_6:
241 if (status2 & I2C_SR2_ENDAD_IND) { 278 if (status2 & I2C_SR2_ENDAD_IND) {
242 /* First check for any errors */ 279 /* First check for any errors */
243 if (status2 & I2C_SR2_AF_IND)
244 dev->cmd_err = STU300_ERROR_ACKNOWLEDGE_FAILURE;
245 return 1; 280 return 1;
246 } 281 }
247 break; 282 break;
@@ -252,8 +287,15 @@ static int stu300_event_occurred(struct stu300_dev *dev,
252 default: 287 default:
253 break; 288 break;
254 } 289 }
255 if (status2 & I2C_SR2_ARLO_IND) 290 /* If we get here, we're on thin ice.
256 dev->cmd_err = STU300_ERROR_ARBITRATION_LOST; 291 * Here we are in a status where we have
292 * gotten a response that does not match
293 * what we requested.
294 */
295 dev->cmd_err = STU300_ERROR_UNKNOWN;
296 dev_err(&dev->pdev->dev,
297 "Unhandled interrupt! %d sr1: 0x%x sr2: 0x%x\n",
298 mr_event, status1, status2);
257 return 0; 299 return 0;
258} 300}
259 301
@@ -262,21 +304,20 @@ static irqreturn_t stu300_irh(int irq, void *data)
262 struct stu300_dev *dev = data; 304 struct stu300_dev *dev = data;
263 int res; 305 int res;
264 306
307 /* Just make sure that the block is clocked */
308 clk_enable(dev->clk);
309
265 /* See if this was what we were waiting for */ 310 /* See if this was what we were waiting for */
266 spin_lock(&dev->cmd_issue_lock); 311 spin_lock(&dev->cmd_issue_lock);
267 if (dev->cmd_event != STU300_EVENT_NONE) { 312
268 res = stu300_event_occurred(dev, dev->cmd_event); 313 res = stu300_event_occurred(dev, dev->cmd_event);
269 if (res || dev->cmd_err != STU300_ERROR_NONE) { 314 if (res || dev->cmd_err != STU300_ERROR_NONE)
270 u32 val; 315 complete(&dev->cmd_complete);
271 316
272 complete(&dev->cmd_complete);
273 /* Block any multiple interrupts */
274 val = stu300_r8(dev->virtbase + I2C_CR);
275 val &= ~I2C_CR_INTERRUPT_ENABLE;
276 stu300_wr8(val, dev->virtbase + I2C_CR);
277 }
278 }
279 spin_unlock(&dev->cmd_issue_lock); 317 spin_unlock(&dev->cmd_issue_lock);
318
319 clk_disable(dev->clk);
320
280 return IRQ_HANDLED; 321 return IRQ_HANDLED;
281} 322}
282 323
@@ -308,7 +349,6 @@ static int stu300_start_and_await_event(struct stu300_dev *dev,
308 stu300_wr8(cr_value, dev->virtbase + I2C_CR); 349 stu300_wr8(cr_value, dev->virtbase + I2C_CR);
309 ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, 350 ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
310 STU300_TIMEOUT); 351 STU300_TIMEOUT);
311
312 if (ret < 0) { 352 if (ret < 0) {
313 dev_err(&dev->pdev->dev, 353 dev_err(&dev->pdev->dev,
314 "wait_for_completion_interruptible_timeout() " 354 "wait_for_completion_interruptible_timeout() "
@@ -342,7 +382,6 @@ static int stu300_await_event(struct stu300_dev *dev,
342 enum stu300_event mr_event) 382 enum stu300_event mr_event)
343{ 383{
344 int ret; 384 int ret;
345 u32 val;
346 385
347 if (unlikely(irqs_disabled())) { 386 if (unlikely(irqs_disabled())) {
348 /* TODO: implement polling for this case if need be. */ 387 /* TODO: implement polling for this case if need be. */
@@ -354,36 +393,18 @@ static int stu300_await_event(struct stu300_dev *dev,
354 /* Is it already here? */ 393 /* Is it already here? */
355 spin_lock_irq(&dev->cmd_issue_lock); 394 spin_lock_irq(&dev->cmd_issue_lock);
356 dev->cmd_err = STU300_ERROR_NONE; 395 dev->cmd_err = STU300_ERROR_NONE;
357 if (stu300_event_occurred(dev, mr_event)) {
358 spin_unlock_irq(&dev->cmd_issue_lock);
359 goto exit_await_check_err;
360 }
361 init_completion(&dev->cmd_complete);
362 dev->cmd_err = STU300_ERROR_NONE;
363 dev->cmd_event = mr_event; 396 dev->cmd_event = mr_event;
364 397
365 /* Turn on the I2C interrupt for current operation */ 398 init_completion(&dev->cmd_complete);
366 val = stu300_r8(dev->virtbase + I2C_CR);
367 val |= I2C_CR_INTERRUPT_ENABLE;
368 stu300_wr8(val, dev->virtbase + I2C_CR);
369
370 /* Twice paranoia (possible HW glitch) */
371 stu300_wr8(val, dev->virtbase + I2C_CR);
372 399
373 /* Check again: is it already here? */ 400 /* Turn on the I2C interrupt for current operation */
374 if (unlikely(stu300_event_occurred(dev, mr_event))) { 401 stu300_irq_enable(dev);
375 /* Disable IRQ again. */
376 val &= ~I2C_CR_INTERRUPT_ENABLE;
377 stu300_wr8(val, dev->virtbase + I2C_CR);
378 spin_unlock_irq(&dev->cmd_issue_lock);
379 goto exit_await_check_err;
380 }
381 402
382 /* Unlock the command block and wait for the event to occur */ 403 /* Unlock the command block and wait for the event to occur */
383 spin_unlock_irq(&dev->cmd_issue_lock); 404 spin_unlock_irq(&dev->cmd_issue_lock);
405
384 ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, 406 ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
385 STU300_TIMEOUT); 407 STU300_TIMEOUT);
386
387 if (ret < 0) { 408 if (ret < 0) {
388 dev_err(&dev->pdev->dev, 409 dev_err(&dev->pdev->dev,
389 "wait_for_completion_interruptible_timeout()" 410 "wait_for_completion_interruptible_timeout()"
@@ -401,7 +422,6 @@ static int stu300_await_event(struct stu300_dev *dev,
401 return -ETIMEDOUT; 422 return -ETIMEDOUT;
402 } 423 }
403 424
404 exit_await_check_err:
405 if (dev->cmd_err != STU300_ERROR_NONE) { 425 if (dev->cmd_err != STU300_ERROR_NONE) {
406 if (mr_event != STU300_EVENT_6) { 426 if (mr_event != STU300_EVENT_6) {
407 dev_err(&dev->pdev->dev, "controller " 427 dev_err(&dev->pdev->dev, "controller "
@@ -457,18 +477,19 @@ struct stu300_clkset {
457}; 477};
458 478
459static const struct stu300_clkset stu300_clktable[] = { 479static const struct stu300_clkset stu300_clktable[] = {
460 { 0, 0xFFU }, 480 { 0, 0xFFU },
461 { 2500000, I2C_OAR2_FR_25_10MHZ }, 481 { 2500000, I2C_OAR2_FR_25_10MHZ },
462 { 10000000, I2C_OAR2_FR_10_1667MHZ }, 482 { 10000000, I2C_OAR2_FR_10_1667MHZ },
463 { 16670000, I2C_OAR2_FR_1667_2667MHZ }, 483 { 16670000, I2C_OAR2_FR_1667_2667MHZ },
464 { 26670000, I2C_OAR2_FR_2667_40MHZ }, 484 { 26670000, I2C_OAR2_FR_2667_40MHZ },
465 { 40000000, I2C_OAR2_FR_40_5333MHZ }, 485 { 40000000, I2C_OAR2_FR_40_5333MHZ },
466 { 53330000, I2C_OAR2_FR_5333_66MHZ }, 486 { 53330000, I2C_OAR2_FR_5333_66MHZ },
467 { 66000000, I2C_OAR2_FR_66_80MHZ }, 487 { 66000000, I2C_OAR2_FR_66_80MHZ },
468 { 80000000, I2C_OAR2_FR_80_100MHZ }, 488 { 80000000, I2C_OAR2_FR_80_100MHZ },
469 { 100000000, 0xFFU }, 489 { 100000000, 0xFFU },
470}; 490};
471 491
492
472static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate) 493static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate)
473{ 494{
474 495
@@ -494,10 +515,10 @@ static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate)
494 515
495 if (dev->speed > 100000) 516 if (dev->speed > 100000)
496 /* Fast Mode I2C */ 517 /* Fast Mode I2C */
497 val = ((clkrate/dev->speed)-9)/3; 518 val = ((clkrate/dev->speed) - 9)/3 + 1;
498 else 519 else
499 /* Standard Mode I2C */ 520 /* Standard Mode I2C */
500 val = ((clkrate/dev->speed)-7)/2; 521 val = ((clkrate/dev->speed) - 7)/2 + 1;
501 522
502 /* According to spec the divider must be > 2 */ 523 /* According to spec the divider must be > 2 */
503 if (val < 0x002) { 524 if (val < 0x002) {
@@ -557,6 +578,7 @@ static int stu300_init_hw(struct stu300_dev *dev)
557 */ 578 */
558 clkrate = clk_get_rate(dev->clk); 579 clkrate = clk_get_rate(dev->clk);
559 ret = stu300_set_clk(dev, clkrate); 580 ret = stu300_set_clk(dev, clkrate);
581
560 if (ret) 582 if (ret)
561 return ret; 583 return ret;
562 /* 584 /*
@@ -641,7 +663,6 @@ static int stu300_xfer_msg(struct i2c_adapter *adap,
641 int attempts = 0; 663 int attempts = 0;
642 struct stu300_dev *dev = i2c_get_adapdata(adap); 664 struct stu300_dev *dev = i2c_get_adapdata(adap);
643 665
644
645 clk_enable(dev->clk); 666 clk_enable(dev->clk);
646 667
647 /* Remove this if (0) to trace each and every message. */ 668 /* Remove this if (0) to trace each and every message. */
@@ -715,14 +736,15 @@ static int stu300_xfer_msg(struct i2c_adapter *adap,
715 736
716 if (attempts < NUM_ADDR_RESEND_ATTEMPTS && attempts > 0) { 737 if (attempts < NUM_ADDR_RESEND_ATTEMPTS && attempts > 0) {
717 dev_dbg(&dev->pdev->dev, "managed to get address " 738 dev_dbg(&dev->pdev->dev, "managed to get address "
718 "through after %d attempts\n", attempts); 739 "through after %d attempts\n", attempts);
719 } else if (attempts == NUM_ADDR_RESEND_ATTEMPTS) { 740 } else if (attempts == NUM_ADDR_RESEND_ATTEMPTS) {
720 dev_dbg(&dev->pdev->dev, "I give up, tried %d times " 741 dev_dbg(&dev->pdev->dev, "I give up, tried %d times "
721 "to resend address.\n", 742 "to resend address.\n",
722 NUM_ADDR_RESEND_ATTEMPTS); 743 NUM_ADDR_RESEND_ATTEMPTS);
723 goto exit_disable; 744 goto exit_disable;
724 } 745 }
725 746
747
726 if (msg->flags & I2C_M_RD) { 748 if (msg->flags & I2C_M_RD) {
727 /* READ: we read the actual bytes one at a time */ 749 /* READ: we read the actual bytes one at a time */
728 for (i = 0; i < msg->len; i++) { 750 for (i = 0; i < msg->len; i++) {
@@ -804,8 +826,10 @@ static int stu300_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
804{ 826{
805 int ret = -1; 827 int ret = -1;
806 int i; 828 int i;
829
807 struct stu300_dev *dev = i2c_get_adapdata(adap); 830 struct stu300_dev *dev = i2c_get_adapdata(adap);
808 dev->msg_len = num; 831 dev->msg_len = num;
832
809 for (i = 0; i < num; i++) { 833 for (i = 0; i < num; i++) {
810 /* 834 /*
811 * Another driver appears to send stop for each message, 835 * Another driver appears to send stop for each message,
@@ -817,6 +841,7 @@ static int stu300_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
817 dev->msg_index = i; 841 dev->msg_index = i;
818 842
819 ret = stu300_xfer_msg(adap, &msgs[i], (i == (num - 1))); 843 ret = stu300_xfer_msg(adap, &msgs[i], (i == (num - 1)));
844
820 if (ret != 0) { 845 if (ret != 0) {
821 num = ret; 846 num = ret;
822 break; 847 break;
@@ -845,6 +870,7 @@ stu300_probe(struct platform_device *pdev)
845 struct resource *res; 870 struct resource *res;
846 int bus_nr; 871 int bus_nr;
847 int ret = 0; 872 int ret = 0;
873 char clk_name[] = "I2C0";
848 874
849 dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL); 875 dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL);
850 if (!dev) { 876 if (!dev) {
@@ -854,7 +880,8 @@ stu300_probe(struct platform_device *pdev)
854 } 880 }
855 881
856 bus_nr = pdev->id; 882 bus_nr = pdev->id;
857 dev->clk = clk_get(&pdev->dev, NULL); 883 clk_name[3] += (char)bus_nr;
884 dev->clk = clk_get(&pdev->dev, clk_name);
858 if (IS_ERR(dev->clk)) { 885 if (IS_ERR(dev->clk)) {
859 ret = PTR_ERR(dev->clk); 886 ret = PTR_ERR(dev->clk);
860 dev_err(&pdev->dev, "could not retrieve i2c bus clock\n"); 887 dev_err(&pdev->dev, "could not retrieve i2c bus clock\n");
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 4cfd084fa897..9a1d55b74d7a 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -456,8 +456,11 @@ static int joydev_ioctl_common(struct joydev *joydev,
456 unsigned int cmd, void __user *argp) 456 unsigned int cmd, void __user *argp)
457{ 457{
458 struct input_dev *dev = joydev->handle.dev; 458 struct input_dev *dev = joydev->handle.dev;
459 size_t len;
459 int i, j; 460 int i, j;
461 const char *name;
460 462
463 /* Process fixed-sized commands. */
461 switch (cmd) { 464 switch (cmd) {
462 465
463 case JS_SET_CAL: 466 case JS_SET_CAL:
@@ -499,9 +502,22 @@ static int joydev_ioctl_common(struct joydev *joydev,
499 return copy_to_user(argp, joydev->corr, 502 return copy_to_user(argp, joydev->corr,
500 sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0; 503 sizeof(joydev->corr[0]) * joydev->nabs) ? -EFAULT : 0;
501 504
502 case JSIOCSAXMAP: 505 }
503 if (copy_from_user(joydev->abspam, argp, 506
504 sizeof(__u8) * (ABS_MAX + 1))) 507 /*
508 * Process variable-sized commands (the axis and button map commands
509 * are considered variable-sized to decouple them from the values of
510 * ABS_MAX and KEY_MAX).
511 */
512 switch (cmd & ~IOCSIZE_MASK) {
513
514 case (JSIOCSAXMAP & ~IOCSIZE_MASK):
515 len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->abspam));
516 /*
517 * FIXME: we should not copy into our axis map before
518 * validating the data.
519 */
520 if (copy_from_user(joydev->abspam, argp, len))
505 return -EFAULT; 521 return -EFAULT;
506 522
507 for (i = 0; i < joydev->nabs; i++) { 523 for (i = 0; i < joydev->nabs; i++) {
@@ -511,13 +527,17 @@ static int joydev_ioctl_common(struct joydev *joydev,
511 } 527 }
512 return 0; 528 return 0;
513 529
514 case JSIOCGAXMAP: 530 case (JSIOCGAXMAP & ~IOCSIZE_MASK):
515 return copy_to_user(argp, joydev->abspam, 531 len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->abspam));
516 sizeof(__u8) * (ABS_MAX + 1)) ? -EFAULT : 0; 532 return copy_to_user(argp, joydev->abspam, len) ? -EFAULT : 0;
517 533
518 case JSIOCSBTNMAP: 534 case (JSIOCSBTNMAP & ~IOCSIZE_MASK):
519 if (copy_from_user(joydev->keypam, argp, 535 len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->keypam));
520 sizeof(__u16) * (KEY_MAX - BTN_MISC + 1))) 536 /*
537 * FIXME: we should not copy into our keymap before
538 * validating the data.
539 */
540 if (copy_from_user(joydev->keypam, argp, len))
521 return -EFAULT; 541 return -EFAULT;
522 542
523 for (i = 0; i < joydev->nkey; i++) { 543 for (i = 0; i < joydev->nkey; i++) {
@@ -529,25 +549,19 @@ static int joydev_ioctl_common(struct joydev *joydev,
529 549
530 return 0; 550 return 0;
531 551
532 case JSIOCGBTNMAP: 552 case (JSIOCGBTNMAP & ~IOCSIZE_MASK):
533 return copy_to_user(argp, joydev->keypam, 553 len = min_t(size_t, _IOC_SIZE(cmd), sizeof(joydev->keypam));
534 sizeof(__u16) * (KEY_MAX - BTN_MISC + 1)) ? -EFAULT : 0; 554 return copy_to_user(argp, joydev->keypam, len) ? -EFAULT : 0;
535 555
536 default: 556 case JSIOCGNAME(0):
537 if ((cmd & ~IOCSIZE_MASK) == JSIOCGNAME(0)) { 557 name = dev->name;
538 int len; 558 if (!name)
539 const char *name = dev->name; 559 return 0;
540 560
541 if (!name) 561 len = min_t(size_t, _IOC_SIZE(cmd), strlen(name) + 1);
542 return 0; 562 return copy_to_user(argp, name, len) ? -EFAULT : len;
543 len = strlen(name) + 1;
544 if (len > _IOC_SIZE(cmd))
545 len = _IOC_SIZE(cmd);
546 if (copy_to_user(argp, name, len))
547 return -EFAULT;
548 return len;
549 }
550 } 563 }
564
551 return -EINVAL; 565 return -EINVAL;
552} 566}
553 567
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index baabf8302645..f6c688cae334 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -74,6 +74,7 @@ static struct iforce_device iforce_device[] = {
74 { 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_avb_wheel, abs_wheel, ff_iforce }, 74 { 0x05ef, 0x8884, "AVB Mag Turbo Force", btn_avb_wheel, abs_wheel, ff_iforce },
75 { 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_avb_tw, abs_wheel, ff_iforce }, //? 75 { 0x05ef, 0x8888, "AVB Top Shot Force Feedback Racing Wheel", btn_avb_tw, abs_wheel, ff_iforce }, //?
76 { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //? 76 { 0x061c, 0xc0a4, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce }, //?
77 { 0x061c, 0xc084, "ACT LABS Force RS", btn_wheel, abs_wheel, ff_iforce },
77 { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //? 78 { 0x06f8, 0x0001, "Guillemot Race Leader Force Feedback", btn_wheel, abs_wheel, ff_iforce }, //?
78 { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //? 79 { 0x06f8, 0x0004, "Guillemot Force Feedback Racing Wheel", btn_wheel, abs_wheel, ff_iforce }, //?
79 { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //? 80 { 0x06f8, 0x0004, "Gullemot Jet Leader 3D", btn_joystick, abs_joystick, ff_iforce }, //?
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index f83185aeb511..9f289d8f52c6 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -223,6 +223,7 @@ static struct usb_device_id iforce_usb_ids [] = {
223 { USB_DEVICE(0x05ef, 0x8884) }, /* AVB Mag Turbo Force */ 223 { USB_DEVICE(0x05ef, 0x8884) }, /* AVB Mag Turbo Force */
224 { USB_DEVICE(0x05ef, 0x8888) }, /* AVB Top Shot FFB Racing Wheel */ 224 { USB_DEVICE(0x05ef, 0x8888) }, /* AVB Top Shot FFB Racing Wheel */
225 { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */ 225 { USB_DEVICE(0x061c, 0xc0a4) }, /* ACT LABS Force RS */
226 { USB_DEVICE(0x061c, 0xc084) }, /* ACT LABS Force RS */
226 { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */ 227 { USB_DEVICE(0x06f8, 0x0001) }, /* Guillemot Race Leader Force Feedback */
227 { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */ 228 { USB_DEVICE(0x06f8, 0x0004) }, /* Guillemot Force Feedback Racing Wheel */
228 { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */ 229 { USB_DEVICE(0x06f8, 0xa302) }, /* Guillemot Jet Leader 3D */
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index a9d5031b855e..ea30c983a33e 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -388,6 +388,32 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
388 return result; 388 return result;
389} 389}
390 390
391static int wacom_query_tablet_data(struct usb_interface *intf)
392{
393 unsigned char *rep_data;
394 int limit = 0;
395 int error;
396
397 rep_data = kmalloc(2, GFP_KERNEL);
398 if (!rep_data)
399 return -ENOMEM;
400
401 do {
402 rep_data[0] = 2;
403 rep_data[1] = 2;
404 error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
405 2, rep_data, 2);
406 if (error >= 0)
407 error = usb_get_report(intf,
408 WAC_HID_FEATURE_REPORT, 2,
409 rep_data, 2);
410 } while ((error < 0 || rep_data[1] != 2) && limit++ < 5);
411
412 kfree(rep_data);
413
414 return error < 0 ? error : 0;
415}
416
391static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) 417static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
392{ 418{
393 struct usb_device *dev = interface_to_usbdev(intf); 419 struct usb_device *dev = interface_to_usbdev(intf);
@@ -398,7 +424,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
398 struct wacom_features *features; 424 struct wacom_features *features;
399 struct input_dev *input_dev; 425 struct input_dev *input_dev;
400 int error = -ENOMEM; 426 int error = -ENOMEM;
401 char rep_data[2], limit = 0;
402 struct hid_descriptor *hid_desc; 427 struct hid_descriptor *hid_desc;
403 428
404 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); 429 wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
@@ -489,20 +514,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
489 514
490 /* 515 /*
491 * Ask the tablet to report tablet data if it is not a Tablet PC. 516 * Ask the tablet to report tablet data if it is not a Tablet PC.
492 * Repeat until it succeeds 517 * Note that if query fails it is not a hard failure.
493 */ 518 */
494 if (wacom_wac->features->type != TABLETPC) { 519 if (wacom_wac->features->type != TABLETPC)
495 do { 520 wacom_query_tablet_data(intf);
496 rep_data[0] = 2;
497 rep_data[1] = 2;
498 error = usb_set_report(intf, WAC_HID_FEATURE_REPORT,
499 2, rep_data, 2);
500 if (error >= 0)
501 error = usb_get_report(intf,
502 WAC_HID_FEATURE_REPORT, 2,
503 rep_data, 2);
504 } while ((error < 0 || rep_data[1] != 2) && limit++ < 5);
505 }
506 521
507 usb_set_intfdata(intf, wacom); 522 usb_set_intfdata(intf, wacom);
508 return 0; 523 return 0;
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 6954f5500108..3a7a58222f83 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -170,11 +170,11 @@ static void ucb1400_handle_pending_irq(struct ucb1400_ts *ucb)
170 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, isr); 170 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, isr);
171 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0); 171 ucb1400_reg_write(ucb->ac97, UCB_IE_CLEAR, 0);
172 172
173 if (isr & UCB_IE_TSPX) { 173 if (isr & UCB_IE_TSPX)
174 ucb1400_ts_irq_disable(ucb->ac97); 174 ucb1400_ts_irq_disable(ucb->ac97);
175 enable_irq(ucb->irq); 175 else
176 } else 176 dev_dbg(&ucb->ts_idev->dev, "ucb1400: unexpected IE_STATUS = %#x\n", isr);
177 printk(KERN_ERR "ucb1400: unexpected IE_STATUS = %#x\n", isr); 177 enable_irq(ucb->irq);
178} 178}
179 179
180static int ucb1400_ts_thread(void *_ucb) 180static int ucb1400_ts_thread(void *_ucb)
@@ -345,6 +345,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb)
345static int ucb1400_ts_probe(struct platform_device *dev) 345static int ucb1400_ts_probe(struct platform_device *dev)
346{ 346{
347 int error, x_res, y_res; 347 int error, x_res, y_res;
348 u16 fcsr;
348 struct ucb1400_ts *ucb = dev->dev.platform_data; 349 struct ucb1400_ts *ucb = dev->dev.platform_data;
349 350
350 ucb->ts_idev = input_allocate_device(); 351 ucb->ts_idev = input_allocate_device();
@@ -382,6 +383,14 @@ static int ucb1400_ts_probe(struct platform_device *dev)
382 ucb->ts_idev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); 383 ucb->ts_idev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
383 ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 384 ucb->ts_idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
384 385
386 /*
387 * Enable ADC filter to prevent horrible jitter on Colibri.
388 * This also further reduces jitter on boards where ADCSYNC
389 * pin is connected.
390 */
391 fcsr = ucb1400_reg_read(ucb->ac97, UCB_FCSR);
392 ucb1400_reg_write(ucb->ac97, UCB_FCSR, fcsr | UCB_FCSR_AVE);
393
385 ucb1400_adc_enable(ucb->ac97); 394 ucb1400_adc_enable(ucb->ac97);
386 x_res = ucb1400_ts_read_xres(ucb); 395 x_res = ucb1400_ts_read_xres(ucb);
387 y_res = ucb1400_ts_read_yres(ucb); 396 y_res = ucb1400_ts_read_yres(ucb);
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 103f2d33fa89..9dd872000cec 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4364,6 +4364,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4364 if (mode == 1) 4364 if (mode == 1)
4365 set_disk_ro(disk, 1); 4365 set_disk_ro(disk, 1);
4366 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 4366 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
4367 err = 0;
4367 } 4368 }
4368out: 4369out:
4369 mutex_unlock(&mddev->open_mutex); 4370 mutex_unlock(&mddev->open_mutex);
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 7ad972229db4..0d9d4bc9c762 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -61,7 +61,7 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
61 buf64 = (uint64_t *)buf; 61 buf64 = (uint64_t *)buf;
62 while (i < len/8) { 62 while (i < len/8) {
63 uint64_t x; 63 uint64_t x;
64 asm ("ldrd\t%0, [%1]" : "=r" (x) : "r" (io_base)); 64 asm volatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base));
65 buf64[i++] = x; 65 buf64[i++] = x;
66 } 66 }
67 i *= 8; 67 i *= 8;
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index c20416850948..45675889850b 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -235,6 +235,7 @@ enum vortex_chips {
235 CH_3C900B_FL, 235 CH_3C900B_FL,
236 CH_3C905_1, 236 CH_3C905_1,
237 CH_3C905_2, 237 CH_3C905_2,
238 CH_3C905B_TX,
238 CH_3C905B_1, 239 CH_3C905B_1,
239 240
240 CH_3C905B_2, 241 CH_3C905B_2,
@@ -307,6 +308,8 @@ static struct vortex_chip_info {
307 PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, 308 PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
308 {"3c905 Boomerang 100baseT4", 309 {"3c905 Boomerang 100baseT4",
309 PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, }, 310 PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
311 {"3C905B-TX Fast Etherlink XL PCI",
312 PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
310 {"3c905B Cyclone 100baseTx", 313 {"3c905B Cyclone 100baseTx",
311 PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, }, 314 PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
312 315
@@ -389,6 +392,7 @@ static struct pci_device_id vortex_pci_tbl[] = {
389 { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL }, 392 { 0x10B7, 0x900A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C900B_FL },
390 { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 }, 393 { 0x10B7, 0x9050, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_1 },
391 { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 }, 394 { 0x10B7, 0x9051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905_2 },
395 { 0x10B7, 0x9054, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_TX },
392 { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 }, 396 { 0x10B7, 0x9055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_1 },
393 397
394 { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 }, 398 { 0x10B7, 0x9058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C905B_2 },
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 50efde11ea6c..d0dbbf39349a 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -515,7 +515,7 @@ rx_status_loop:
515 dma_addr_t mapping; 515 dma_addr_t mapping;
516 struct sk_buff *skb, *new_skb; 516 struct sk_buff *skb, *new_skb;
517 struct cp_desc *desc; 517 struct cp_desc *desc;
518 unsigned buflen; 518 const unsigned buflen = cp->rx_buf_sz;
519 519
520 skb = cp->rx_skb[rx_tail]; 520 skb = cp->rx_skb[rx_tail];
521 BUG_ON(!skb); 521 BUG_ON(!skb);
@@ -549,8 +549,7 @@ rx_status_loop:
549 pr_debug("%s: rx slot %d status 0x%x len %d\n", 549 pr_debug("%s: rx slot %d status 0x%x len %d\n",
550 dev->name, rx_tail, status, len); 550 dev->name, rx_tail, status, len);
551 551
552 buflen = cp->rx_buf_sz + NET_IP_ALIGN; 552 new_skb = netdev_alloc_skb(dev, buflen + NET_IP_ALIGN);
553 new_skb = netdev_alloc_skb(dev, buflen);
554 if (!new_skb) { 553 if (!new_skb) {
555 dev->stats.rx_dropped++; 554 dev->stats.rx_dropped++;
556 goto rx_next; 555 goto rx_next;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 5f6509a5f640..5ce7cbabd7a7 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1727,12 +1727,14 @@ config KS8842
1727 tristate "Micrel KSZ8842" 1727 tristate "Micrel KSZ8842"
1728 depends on HAS_IOMEM 1728 depends on HAS_IOMEM
1729 help 1729 help
1730 This platform driver is for Micrel KSZ8842 chip. 1730 This platform driver is for Micrel KSZ8842 / KS8842
1731 2-port ethernet switch chip (managed, VLAN, QoS).
1731 1732
1732config KS8851 1733config KS8851
1733 tristate "Micrel KS8851 SPI" 1734 tristate "Micrel KS8851 SPI"
1734 depends on SPI 1735 depends on SPI
1735 select MII 1736 select MII
1737 select CRC32
1736 help 1738 help
1737 SPI driver for Micrel KS8851 SPI attached network chip. 1739 SPI driver for Micrel KS8851 SPI attached network chip.
1738 1740
diff --git a/drivers/net/arm/w90p910_ether.c b/drivers/net/arm/w90p910_ether.c
index 616fb7985a34..ddd231cb54b7 100644
--- a/drivers/net/arm/w90p910_ether.c
+++ b/drivers/net/arm/w90p910_ether.c
@@ -1080,7 +1080,7 @@ static struct platform_driver w90p910_ether_driver = {
1080 .probe = w90p910_ether_probe, 1080 .probe = w90p910_ether_probe,
1081 .remove = __devexit_p(w90p910_ether_remove), 1081 .remove = __devexit_p(w90p910_ether_remove),
1082 .driver = { 1082 .driver = {
1083 .name = "w90p910-emc", 1083 .name = "nuc900-emc",
1084 .owner = THIS_MODULE, 1084 .owner = THIS_MODULE,
1085 }, 1085 },
1086}; 1086};
@@ -1101,5 +1101,5 @@ module_exit(w90p910_ether_exit);
1101MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 1101MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
1102MODULE_DESCRIPTION("w90p910 MAC driver!"); 1102MODULE_DESCRIPTION("w90p910 MAC driver!");
1103MODULE_LICENSE("GPL"); 1103MODULE_LICENSE("GPL");
1104MODULE_ALIAS("platform:w90p910-emc"); 1104MODULE_ALIAS("platform:nuc900-emc");
1105 1105
diff --git a/drivers/net/atl1c/atl1c_ethtool.c b/drivers/net/atl1c/atl1c_ethtool.c
index 607007d75b6f..00d11b480af3 100644
--- a/drivers/net/atl1c/atl1c_ethtool.c
+++ b/drivers/net/atl1c/atl1c_ethtool.c
@@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev,
232{ 232{
233 struct atl1c_adapter *adapter = netdev_priv(netdev); 233 struct atl1c_adapter *adapter = netdev_priv(netdev);
234 234
235 strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver)); 235 strlcpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver));
236 strncpy(drvinfo->version, atl1c_driver_version, 236 strlcpy(drvinfo->version, atl1c_driver_version,
237 sizeof(drvinfo->version)); 237 sizeof(drvinfo->version));
238 strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); 238 strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
239 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 239 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
240 sizeof(drvinfo->bus_info)); 240 sizeof(drvinfo->bus_info));
241 drvinfo->n_stats = 0; 241 drvinfo->n_stats = 0;
242 drvinfo->testinfo_len = 0; 242 drvinfo->testinfo_len = 0;
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 94d7325caf4f..8bca12f71390 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev,
3378{ 3378{
3379 struct atl1_adapter *adapter = netdev_priv(netdev); 3379 struct atl1_adapter *adapter = netdev_priv(netdev);
3380 3380
3381 strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver)); 3381 strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
3382 strncpy(drvinfo->version, ATLX_DRIVER_VERSION, 3382 strlcpy(drvinfo->version, ATLX_DRIVER_VERSION,
3383 sizeof(drvinfo->version)); 3383 sizeof(drvinfo->version));
3384 strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); 3384 strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
3385 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 3385 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
3386 sizeof(drvinfo->bus_info)); 3386 sizeof(drvinfo->bus_info));
3387 drvinfo->eedump_len = ATL1_EEDUMP_LEN; 3387 drvinfo->eedump_len = ATL1_EEDUMP_LEN;
3388} 3388}
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 36d4d377ec2f..bafca672ea7d 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -952,9 +952,10 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
952 int rc = NETDEV_TX_OK; 952 int rc = NETDEV_TX_OK;
953 dma_addr_t mapping; 953 dma_addr_t mapping;
954 u32 len, entry, ctrl; 954 u32 len, entry, ctrl;
955 unsigned long flags;
955 956
956 len = skb->len; 957 len = skb->len;
957 spin_lock_irq(&bp->lock); 958 spin_lock_irqsave(&bp->lock, flags);
958 959
959 /* This is a hard error, log it. */ 960 /* This is a hard error, log it. */
960 if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) { 961 if (unlikely(TX_BUFFS_AVAIL(bp) < 1)) {
@@ -1027,7 +1028,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
1027 dev->trans_start = jiffies; 1028 dev->trans_start = jiffies;
1028 1029
1029out_unlock: 1030out_unlock:
1030 spin_unlock_irq(&bp->lock); 1031 spin_unlock_irqrestore(&bp->lock, flags);
1031 1032
1032 return rc; 1033 return rc;
1033 1034
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index b70cc99962fc..06b901152d44 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -399,9 +399,11 @@ static int bnx2_unregister_cnic(struct net_device *dev)
399 struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; 399 struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
400 struct cnic_eth_dev *cp = &bp->cnic_eth_dev; 400 struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
401 401
402 mutex_lock(&bp->cnic_lock);
402 cp->drv_state = 0; 403 cp->drv_state = 0;
403 bnapi->cnic_present = 0; 404 bnapi->cnic_present = 0;
404 rcu_assign_pointer(bp->cnic_ops, NULL); 405 rcu_assign_pointer(bp->cnic_ops, NULL);
406 mutex_unlock(&bp->cnic_lock);
405 synchronize_rcu(); 407 synchronize_rcu();
406 return 0; 408 return 0;
407} 409}
@@ -429,13 +431,13 @@ bnx2_cnic_stop(struct bnx2 *bp)
429 struct cnic_ops *c_ops; 431 struct cnic_ops *c_ops;
430 struct cnic_ctl_info info; 432 struct cnic_ctl_info info;
431 433
432 rcu_read_lock(); 434 mutex_lock(&bp->cnic_lock);
433 c_ops = rcu_dereference(bp->cnic_ops); 435 c_ops = bp->cnic_ops;
434 if (c_ops) { 436 if (c_ops) {
435 info.cmd = CNIC_CTL_STOP_CMD; 437 info.cmd = CNIC_CTL_STOP_CMD;
436 c_ops->cnic_ctl(bp->cnic_data, &info); 438 c_ops->cnic_ctl(bp->cnic_data, &info);
437 } 439 }
438 rcu_read_unlock(); 440 mutex_unlock(&bp->cnic_lock);
439} 441}
440 442
441static void 443static void
@@ -444,8 +446,8 @@ bnx2_cnic_start(struct bnx2 *bp)
444 struct cnic_ops *c_ops; 446 struct cnic_ops *c_ops;
445 struct cnic_ctl_info info; 447 struct cnic_ctl_info info;
446 448
447 rcu_read_lock(); 449 mutex_lock(&bp->cnic_lock);
448 c_ops = rcu_dereference(bp->cnic_ops); 450 c_ops = bp->cnic_ops;
449 if (c_ops) { 451 if (c_ops) {
450 if (!(bp->flags & BNX2_FLAG_USING_MSIX)) { 452 if (!(bp->flags & BNX2_FLAG_USING_MSIX)) {
451 struct bnx2_napi *bnapi = &bp->bnx2_napi[0]; 453 struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
@@ -455,7 +457,7 @@ bnx2_cnic_start(struct bnx2 *bp)
455 info.cmd = CNIC_CTL_START_CMD; 457 info.cmd = CNIC_CTL_START_CMD;
456 c_ops->cnic_ctl(bp->cnic_data, &info); 458 c_ops->cnic_ctl(bp->cnic_data, &info);
457 } 459 }
458 rcu_read_unlock(); 460 mutex_unlock(&bp->cnic_lock);
459} 461}
460 462
461#else 463#else
@@ -7663,6 +7665,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7663 7665
7664 spin_lock_init(&bp->phy_lock); 7666 spin_lock_init(&bp->phy_lock);
7665 spin_lock_init(&bp->indirect_lock); 7667 spin_lock_init(&bp->indirect_lock);
7668#ifdef BCM_CNIC
7669 mutex_init(&bp->cnic_lock);
7670#endif
7666 INIT_WORK(&bp->reset_task, bnx2_reset_task); 7671 INIT_WORK(&bp->reset_task, bnx2_reset_task);
7667 7672
7668 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0); 7673 dev->base_addr = dev->mem_start = pci_resource_start(pdev, 0);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index f1edfaa9e56a..a4f12fd0ecd2 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6902,6 +6902,7 @@ struct bnx2 {
6902 u32 idle_chk_status_idx; 6902 u32 idle_chk_status_idx;
6903 6903
6904#ifdef BCM_CNIC 6904#ifdef BCM_CNIC
6905 struct mutex cnic_lock;
6905 struct cnic_eth_dev cnic_eth_dev; 6906 struct cnic_eth_dev cnic_eth_dev;
6906#endif 6907#endif
6907 6908
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 9e4283aff828..e1a4f8214239 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -611,11 +611,18 @@ nla_put_failure:
611 return -EMSGSIZE; 611 return -EMSGSIZE;
612} 612}
613 613
614static int can_newlink(struct net_device *dev,
615 struct nlattr *tb[], struct nlattr *data[])
616{
617 return -EOPNOTSUPP;
618}
619
614static struct rtnl_link_ops can_link_ops __read_mostly = { 620static struct rtnl_link_ops can_link_ops __read_mostly = {
615 .kind = "can", 621 .kind = "can",
616 .maxtype = IFLA_CAN_MAX, 622 .maxtype = IFLA_CAN_MAX,
617 .policy = can_policy, 623 .policy = can_policy,
618 .setup = can_setup, 624 .setup = can_setup,
625 .newlink = can_newlink,
619 .changelink = can_changelink, 626 .changelink = can_changelink,
620 .fill_info = can_fill_info, 627 .fill_info = can_fill_info,
621 .fill_xstats = can_fill_xstats, 628 .fill_xstats = can_fill_xstats,
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 4869d77cbe91..74c342959b7b 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -138,6 +138,16 @@ static struct cnic_dev *cnic_from_netdev(struct net_device *netdev)
138 return NULL; 138 return NULL;
139} 139}
140 140
141static inline void ulp_get(struct cnic_ulp_ops *ulp_ops)
142{
143 atomic_inc(&ulp_ops->ref_count);
144}
145
146static inline void ulp_put(struct cnic_ulp_ops *ulp_ops)
147{
148 atomic_dec(&ulp_ops->ref_count);
149}
150
141static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val) 151static void cnic_ctx_wr(struct cnic_dev *dev, u32 cid_addr, u32 off, u32 val)
142{ 152{
143 struct cnic_local *cp = dev->cnic_priv; 153 struct cnic_local *cp = dev->cnic_priv;
@@ -358,6 +368,7 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
358 } 368 }
359 read_unlock(&cnic_dev_lock); 369 read_unlock(&cnic_dev_lock);
360 370
371 atomic_set(&ulp_ops->ref_count, 0);
361 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops); 372 rcu_assign_pointer(cnic_ulp_tbl[ulp_type], ulp_ops);
362 mutex_unlock(&cnic_lock); 373 mutex_unlock(&cnic_lock);
363 374
@@ -379,6 +390,8 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
379int cnic_unregister_driver(int ulp_type) 390int cnic_unregister_driver(int ulp_type)
380{ 391{
381 struct cnic_dev *dev; 392 struct cnic_dev *dev;
393 struct cnic_ulp_ops *ulp_ops;
394 int i = 0;
382 395
383 if (ulp_type >= MAX_CNIC_ULP_TYPE) { 396 if (ulp_type >= MAX_CNIC_ULP_TYPE) {
384 printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", 397 printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n",
@@ -386,7 +399,8 @@ int cnic_unregister_driver(int ulp_type)
386 return -EINVAL; 399 return -EINVAL;
387 } 400 }
388 mutex_lock(&cnic_lock); 401 mutex_lock(&cnic_lock);
389 if (!cnic_ulp_tbl[ulp_type]) { 402 ulp_ops = cnic_ulp_tbl[ulp_type];
403 if (!ulp_ops) {
390 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " 404 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not "
391 "been registered\n", ulp_type); 405 "been registered\n", ulp_type);
392 goto out_unlock; 406 goto out_unlock;
@@ -411,6 +425,14 @@ int cnic_unregister_driver(int ulp_type)
411 425
412 mutex_unlock(&cnic_lock); 426 mutex_unlock(&cnic_lock);
413 synchronize_rcu(); 427 synchronize_rcu();
428 while ((atomic_read(&ulp_ops->ref_count) != 0) && (i < 20)) {
429 msleep(100);
430 i++;
431 }
432
433 if (atomic_read(&ulp_ops->ref_count) != 0)
434 printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go"
435 " to zero.\n", dev->netdev->name);
414 return 0; 436 return 0;
415 437
416out_unlock: 438out_unlock:
@@ -466,6 +488,7 @@ EXPORT_SYMBOL(cnic_register_driver);
466static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) 488static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
467{ 489{
468 struct cnic_local *cp = dev->cnic_priv; 490 struct cnic_local *cp = dev->cnic_priv;
491 int i = 0;
469 492
470 if (ulp_type >= MAX_CNIC_ULP_TYPE) { 493 if (ulp_type >= MAX_CNIC_ULP_TYPE) {
471 printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", 494 printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n",
@@ -486,6 +509,15 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
486 509
487 synchronize_rcu(); 510 synchronize_rcu();
488 511
512 while (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]) &&
513 i < 20) {
514 msleep(100);
515 i++;
516 }
517 if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]))
518 printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call"
519 " to complete.\n", dev->netdev->name);
520
489 return 0; 521 return 0;
490} 522}
491EXPORT_SYMBOL(cnic_unregister_driver); 523EXPORT_SYMBOL(cnic_unregister_driver);
@@ -1076,18 +1108,23 @@ static void cnic_ulp_stop(struct cnic_dev *dev)
1076 if (cp->cnic_uinfo) 1108 if (cp->cnic_uinfo)
1077 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); 1109 cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL);
1078 1110
1079 rcu_read_lock();
1080 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1111 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
1081 struct cnic_ulp_ops *ulp_ops; 1112 struct cnic_ulp_ops *ulp_ops;
1082 1113
1083 ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); 1114 mutex_lock(&cnic_lock);
1084 if (!ulp_ops) 1115 ulp_ops = cp->ulp_ops[if_type];
1116 if (!ulp_ops) {
1117 mutex_unlock(&cnic_lock);
1085 continue; 1118 continue;
1119 }
1120 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1121 mutex_unlock(&cnic_lock);
1086 1122
1087 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type])) 1123 if (test_and_clear_bit(ULP_F_START, &cp->ulp_flags[if_type]))
1088 ulp_ops->cnic_stop(cp->ulp_handle[if_type]); 1124 ulp_ops->cnic_stop(cp->ulp_handle[if_type]);
1125
1126 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1089 } 1127 }
1090 rcu_read_unlock();
1091} 1128}
1092 1129
1093static void cnic_ulp_start(struct cnic_dev *dev) 1130static void cnic_ulp_start(struct cnic_dev *dev)
@@ -1095,18 +1132,23 @@ static void cnic_ulp_start(struct cnic_dev *dev)
1095 struct cnic_local *cp = dev->cnic_priv; 1132 struct cnic_local *cp = dev->cnic_priv;
1096 int if_type; 1133 int if_type;
1097 1134
1098 rcu_read_lock();
1099 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) { 1135 for (if_type = 0; if_type < MAX_CNIC_ULP_TYPE; if_type++) {
1100 struct cnic_ulp_ops *ulp_ops; 1136 struct cnic_ulp_ops *ulp_ops;
1101 1137
1102 ulp_ops = rcu_dereference(cp->ulp_ops[if_type]); 1138 mutex_lock(&cnic_lock);
1103 if (!ulp_ops || !ulp_ops->cnic_start) 1139 ulp_ops = cp->ulp_ops[if_type];
1140 if (!ulp_ops || !ulp_ops->cnic_start) {
1141 mutex_unlock(&cnic_lock);
1104 continue; 1142 continue;
1143 }
1144 set_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1145 mutex_unlock(&cnic_lock);
1105 1146
1106 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type])) 1147 if (!test_and_set_bit(ULP_F_START, &cp->ulp_flags[if_type]))
1107 ulp_ops->cnic_start(cp->ulp_handle[if_type]); 1148 ulp_ops->cnic_start(cp->ulp_handle[if_type]);
1149
1150 clear_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[if_type]);
1108 } 1151 }
1109 rcu_read_unlock();
1110} 1152}
1111 1153
1112static int cnic_ctl(void *data, struct cnic_ctl_info *info) 1154static int cnic_ctl(void *data, struct cnic_ctl_info *info)
@@ -1116,22 +1158,18 @@ static int cnic_ctl(void *data, struct cnic_ctl_info *info)
1116 switch (info->cmd) { 1158 switch (info->cmd) {
1117 case CNIC_CTL_STOP_CMD: 1159 case CNIC_CTL_STOP_CMD:
1118 cnic_hold(dev); 1160 cnic_hold(dev);
1119 mutex_lock(&cnic_lock);
1120 1161
1121 cnic_ulp_stop(dev); 1162 cnic_ulp_stop(dev);
1122 cnic_stop_hw(dev); 1163 cnic_stop_hw(dev);
1123 1164
1124 mutex_unlock(&cnic_lock);
1125 cnic_put(dev); 1165 cnic_put(dev);
1126 break; 1166 break;
1127 case CNIC_CTL_START_CMD: 1167 case CNIC_CTL_START_CMD:
1128 cnic_hold(dev); 1168 cnic_hold(dev);
1129 mutex_lock(&cnic_lock);
1130 1169
1131 if (!cnic_start_hw(dev)) 1170 if (!cnic_start_hw(dev))
1132 cnic_ulp_start(dev); 1171 cnic_ulp_start(dev);
1133 1172
1134 mutex_unlock(&cnic_lock);
1135 cnic_put(dev); 1173 cnic_put(dev);
1136 break; 1174 break;
1137 default: 1175 default:
@@ -1145,19 +1183,23 @@ static void cnic_ulp_init(struct cnic_dev *dev)
1145 int i; 1183 int i;
1146 struct cnic_local *cp = dev->cnic_priv; 1184 struct cnic_local *cp = dev->cnic_priv;
1147 1185
1148 rcu_read_lock();
1149 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { 1186 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) {
1150 struct cnic_ulp_ops *ulp_ops; 1187 struct cnic_ulp_ops *ulp_ops;
1151 1188
1152 ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); 1189 mutex_lock(&cnic_lock);
1153 if (!ulp_ops || !ulp_ops->cnic_init) 1190 ulp_ops = cnic_ulp_tbl[i];
1191 if (!ulp_ops || !ulp_ops->cnic_init) {
1192 mutex_unlock(&cnic_lock);
1154 continue; 1193 continue;
1194 }
1195 ulp_get(ulp_ops);
1196 mutex_unlock(&cnic_lock);
1155 1197
1156 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i])) 1198 if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[i]))
1157 ulp_ops->cnic_init(dev); 1199 ulp_ops->cnic_init(dev);
1158 1200
1201 ulp_put(ulp_ops);
1159 } 1202 }
1160 rcu_read_unlock();
1161} 1203}
1162 1204
1163static void cnic_ulp_exit(struct cnic_dev *dev) 1205static void cnic_ulp_exit(struct cnic_dev *dev)
@@ -1165,19 +1207,23 @@ static void cnic_ulp_exit(struct cnic_dev *dev)
1165 int i; 1207 int i;
1166 struct cnic_local *cp = dev->cnic_priv; 1208 struct cnic_local *cp = dev->cnic_priv;
1167 1209
1168 rcu_read_lock();
1169 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) { 1210 for (i = 0; i < MAX_CNIC_ULP_TYPE_EXT; i++) {
1170 struct cnic_ulp_ops *ulp_ops; 1211 struct cnic_ulp_ops *ulp_ops;
1171 1212
1172 ulp_ops = rcu_dereference(cnic_ulp_tbl[i]); 1213 mutex_lock(&cnic_lock);
1173 if (!ulp_ops || !ulp_ops->cnic_exit) 1214 ulp_ops = cnic_ulp_tbl[i];
1215 if (!ulp_ops || !ulp_ops->cnic_exit) {
1216 mutex_unlock(&cnic_lock);
1174 continue; 1217 continue;
1218 }
1219 ulp_get(ulp_ops);
1220 mutex_unlock(&cnic_lock);
1175 1221
1176 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i])) 1222 if (test_and_clear_bit(ULP_F_INIT, &cp->ulp_flags[i]))
1177 ulp_ops->cnic_exit(dev); 1223 ulp_ops->cnic_exit(dev);
1178 1224
1225 ulp_put(ulp_ops);
1179 } 1226 }
1180 rcu_read_unlock();
1181} 1227}
1182 1228
1183static int cnic_cm_offload_pg(struct cnic_sock *csk) 1229static int cnic_cm_offload_pg(struct cnic_sock *csk)
@@ -2393,21 +2439,45 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
2393 return 0; 2439 return 0;
2394} 2440}
2395 2441
2396static int cnic_start_hw(struct cnic_dev *dev) 2442static int cnic_register_netdev(struct cnic_dev *dev)
2397{ 2443{
2398 struct cnic_local *cp = dev->cnic_priv; 2444 struct cnic_local *cp = dev->cnic_priv;
2399 struct cnic_eth_dev *ethdev = cp->ethdev; 2445 struct cnic_eth_dev *ethdev = cp->ethdev;
2400 int err; 2446 int err;
2401 2447
2402 if (test_bit(CNIC_F_CNIC_UP, &dev->flags)) 2448 if (!ethdev)
2403 return -EALREADY; 2449 return -ENODEV;
2450
2451 if (ethdev->drv_state & CNIC_DRV_STATE_REGD)
2452 return 0;
2404 2453
2405 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); 2454 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev);
2406 if (err) { 2455 if (err)
2407 printk(KERN_ERR PFX "%s: register_cnic failed\n", 2456 printk(KERN_ERR PFX "%s: register_cnic failed\n",
2408 dev->netdev->name); 2457 dev->netdev->name);
2409 goto err2; 2458
2410 } 2459 return err;
2460}
2461
2462static void cnic_unregister_netdev(struct cnic_dev *dev)
2463{
2464 struct cnic_local *cp = dev->cnic_priv;
2465 struct cnic_eth_dev *ethdev = cp->ethdev;
2466
2467 if (!ethdev)
2468 return;
2469
2470 ethdev->drv_unregister_cnic(dev->netdev);
2471}
2472
2473static int cnic_start_hw(struct cnic_dev *dev)
2474{
2475 struct cnic_local *cp = dev->cnic_priv;
2476 struct cnic_eth_dev *ethdev = cp->ethdev;
2477 int err;
2478
2479 if (test_bit(CNIC_F_CNIC_UP, &dev->flags))
2480 return -EALREADY;
2411 2481
2412 dev->regview = ethdev->io_base; 2482 dev->regview = ethdev->io_base;
2413 cp->chip_id = ethdev->chip_id; 2483 cp->chip_id = ethdev->chip_id;
@@ -2438,18 +2508,13 @@ static int cnic_start_hw(struct cnic_dev *dev)
2438 return 0; 2508 return 0;
2439 2509
2440err1: 2510err1:
2441 ethdev->drv_unregister_cnic(dev->netdev);
2442 cp->free_resc(dev); 2511 cp->free_resc(dev);
2443 pci_dev_put(dev->pcidev); 2512 pci_dev_put(dev->pcidev);
2444err2:
2445 return err; 2513 return err;
2446} 2514}
2447 2515
2448static void cnic_stop_bnx2_hw(struct cnic_dev *dev) 2516static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
2449{ 2517{
2450 struct cnic_local *cp = dev->cnic_priv;
2451 struct cnic_eth_dev *ethdev = cp->ethdev;
2452
2453 cnic_disable_bnx2_int_sync(dev); 2518 cnic_disable_bnx2_int_sync(dev);
2454 2519
2455 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); 2520 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0);
@@ -2461,8 +2526,6 @@ static void cnic_stop_bnx2_hw(struct cnic_dev *dev)
2461 cnic_setup_5709_context(dev, 0); 2526 cnic_setup_5709_context(dev, 0);
2462 cnic_free_irq(dev); 2527 cnic_free_irq(dev);
2463 2528
2464 ethdev->drv_unregister_cnic(dev->netdev);
2465
2466 cnic_free_resc(dev); 2529 cnic_free_resc(dev);
2467} 2530}
2468 2531
@@ -2543,7 +2606,7 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev)
2543 probe = symbol_get(bnx2_cnic_probe); 2606 probe = symbol_get(bnx2_cnic_probe);
2544 if (probe) { 2607 if (probe) {
2545 ethdev = (*probe)(dev); 2608 ethdev = (*probe)(dev);
2546 symbol_put_addr(probe); 2609 symbol_put(bnx2_cnic_probe);
2547 } 2610 }
2548 if (!ethdev) 2611 if (!ethdev)
2549 return NULL; 2612 return NULL;
@@ -2646,10 +2709,12 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
2646 else if (event == NETDEV_UNREGISTER) 2709 else if (event == NETDEV_UNREGISTER)
2647 cnic_ulp_exit(dev); 2710 cnic_ulp_exit(dev);
2648 else if (event == NETDEV_UP) { 2711 else if (event == NETDEV_UP) {
2649 mutex_lock(&cnic_lock); 2712 if (cnic_register_netdev(dev) != 0) {
2713 cnic_put(dev);
2714 goto done;
2715 }
2650 if (!cnic_start_hw(dev)) 2716 if (!cnic_start_hw(dev))
2651 cnic_ulp_start(dev); 2717 cnic_ulp_start(dev);
2652 mutex_unlock(&cnic_lock);
2653 } 2718 }
2654 2719
2655 rcu_read_lock(); 2720 rcu_read_lock();
@@ -2668,10 +2733,9 @@ static int cnic_netdev_event(struct notifier_block *this, unsigned long event,
2668 rcu_read_unlock(); 2733 rcu_read_unlock();
2669 2734
2670 if (event == NETDEV_GOING_DOWN) { 2735 if (event == NETDEV_GOING_DOWN) {
2671 mutex_lock(&cnic_lock);
2672 cnic_ulp_stop(dev); 2736 cnic_ulp_stop(dev);
2673 cnic_stop_hw(dev); 2737 cnic_stop_hw(dev);
2674 mutex_unlock(&cnic_lock); 2738 cnic_unregister_netdev(dev);
2675 } else if (event == NETDEV_UNREGISTER) { 2739 } else if (event == NETDEV_UNREGISTER) {
2676 write_lock(&cnic_dev_lock); 2740 write_lock(&cnic_dev_lock);
2677 list_del_init(&dev->list); 2741 list_del_init(&dev->list);
@@ -2703,6 +2767,7 @@ static void cnic_release(void)
2703 } 2767 }
2704 2768
2705 cnic_ulp_exit(dev); 2769 cnic_ulp_exit(dev);
2770 cnic_unregister_netdev(dev);
2706 list_del_init(&dev->list); 2771 list_del_init(&dev->list);
2707 cnic_free_dev(dev); 2772 cnic_free_dev(dev);
2708 } 2773 }
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h
index 5192d4a9df5a..a94b302bb464 100644
--- a/drivers/net/cnic.h
+++ b/drivers/net/cnic.h
@@ -176,6 +176,7 @@ struct cnic_local {
176 unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; 176 unsigned long ulp_flags[MAX_CNIC_ULP_TYPE];
177#define ULP_F_INIT 0 177#define ULP_F_INIT 0
178#define ULP_F_START 1 178#define ULP_F_START 1
179#define ULP_F_CALL_PENDING 2
179 struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; 180 struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE];
180 181
181 /* protected by ulp_lock */ 182 /* protected by ulp_lock */
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h
index d1bce27ee99e..a49235739eef 100644
--- a/drivers/net/cnic_if.h
+++ b/drivers/net/cnic_if.h
@@ -290,6 +290,7 @@ struct cnic_ulp_ops {
290 void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type, 290 void (*iscsi_nl_send_msg)(struct cnic_dev *dev, u32 msg_type,
291 char *data, u16 data_size); 291 char *data, u16 data_size);
292 struct module *owner; 292 struct module *owner;
293 atomic_t ref_count;
293}; 294};
294 295
295extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); 296extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops);
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 41b648a67fec..3a6735dc9f6a 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1899,7 +1899,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1899 nic->ru_running = RU_SUSPENDED; 1899 nic->ru_running = RU_SUSPENDED;
1900 pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr, 1900 pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
1901 sizeof(struct rfd), 1901 sizeof(struct rfd),
1902 PCI_DMA_BIDIRECTIONAL); 1902 PCI_DMA_FROMDEVICE);
1903 return -ENODATA; 1903 return -ENODATA;
1904 } 1904 }
1905 1905
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index d56c7473144a..99df2abf82a9 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -338,10 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
338{ 338{
339 struct e1000_nvm_info *nvm = &hw->nvm; 339 struct e1000_nvm_info *nvm = &hw->nvm;
340 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 340 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
341 union ich8_hws_flash_status hsfsts; 341 u32 gfpreg, sector_base_addr, sector_end_addr;
342 u32 gfpreg;
343 u32 sector_base_addr;
344 u32 sector_end_addr;
345 u16 i; 342 u16 i;
346 343
347 /* Can't read flash registers if the register set isn't mapped. */ 344 /* Can't read flash registers if the register set isn't mapped. */
@@ -375,20 +372,6 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
375 /* Adjust to word count */ 372 /* Adjust to word count */
376 nvm->flash_bank_size /= sizeof(u16); 373 nvm->flash_bank_size /= sizeof(u16);
377 374
378 /*
379 * Make sure the flash bank size does not overwrite the 4k
380 * sector ranges. We may have 64k allotted to us but we only care
381 * about the first 2 4k sectors. Therefore, if we have anything less
382 * than 64k set in the HSFSTS register, we will reduce the bank size
383 * down to 4k and let the rest remain unused. If berasesz == 3, then
384 * we are working in 64k mode. Otherwise we are not.
385 */
386 if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) {
387 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
388 if (hsfsts.hsf_status.berasesz != 3)
389 nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS;
390 }
391
392 nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; 375 nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS;
393 376
394 /* Clear shadow ram */ 377 /* Clear shadow ram */
@@ -594,8 +577,8 @@ static DEFINE_MUTEX(nvm_mutex);
594 **/ 577 **/
595static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw) 578static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
596{ 579{
597 u32 extcnf_ctrl; 580 u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
598 u32 timeout = PHY_CFG_TIMEOUT; 581 s32 ret_val = 0;
599 582
600 might_sleep(); 583 might_sleep();
601 584
@@ -603,28 +586,46 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
603 586
604 while (timeout) { 587 while (timeout) {
605 extcnf_ctrl = er32(EXTCNF_CTRL); 588 extcnf_ctrl = er32(EXTCNF_CTRL);
589 if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG))
590 break;
606 591
607 if (!(extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)) { 592 mdelay(1);
608 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; 593 timeout--;
609 ew32(EXTCNF_CTRL, extcnf_ctrl); 594 }
595
596 if (!timeout) {
597 hw_dbg(hw, "SW/FW/HW has locked the resource for too long.\n");
598 ret_val = -E1000_ERR_CONFIG;
599 goto out;
600 }
601
602 timeout = PHY_CFG_TIMEOUT * 2;
603
604 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
605 ew32(EXTCNF_CTRL, extcnf_ctrl);
606
607 while (timeout) {
608 extcnf_ctrl = er32(EXTCNF_CTRL);
609 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
610 break;
610 611
611 extcnf_ctrl = er32(EXTCNF_CTRL);
612 if (extcnf_ctrl & E1000_EXTCNF_CTRL_SWFLAG)
613 break;
614 }
615 mdelay(1); 612 mdelay(1);
616 timeout--; 613 timeout--;
617 } 614 }
618 615
619 if (!timeout) { 616 if (!timeout) {
620 hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); 617 hw_dbg(hw, "Failed to acquire the semaphore.\n");
621 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 618 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
622 ew32(EXTCNF_CTRL, extcnf_ctrl); 619 ew32(EXTCNF_CTRL, extcnf_ctrl);
623 mutex_unlock(&nvm_mutex); 620 ret_val = -E1000_ERR_CONFIG;
624 return -E1000_ERR_CONFIG; 621 goto out;
625 } 622 }
626 623
627 return 0; 624out:
625 if (ret_val)
626 mutex_unlock(&nvm_mutex);
627
628 return ret_val;
628} 629}
629 630
630/** 631/**
@@ -1306,7 +1307,7 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1306 struct e1000_nvm_info *nvm = &hw->nvm; 1307 struct e1000_nvm_info *nvm = &hw->nvm;
1307 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 1308 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
1308 u32 act_offset; 1309 u32 act_offset;
1309 s32 ret_val; 1310 s32 ret_val = 0;
1310 u32 bank = 0; 1311 u32 bank = 0;
1311 u16 i, word; 1312 u16 i, word;
1312 1313
@@ -1321,12 +1322,15 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1321 goto out; 1322 goto out;
1322 1323
1323 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1324 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1324 if (ret_val) 1325 if (ret_val) {
1325 goto release; 1326 hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
1327 bank = 0;
1328 }
1326 1329
1327 act_offset = (bank) ? nvm->flash_bank_size : 0; 1330 act_offset = (bank) ? nvm->flash_bank_size : 0;
1328 act_offset += offset; 1331 act_offset += offset;
1329 1332
1333 ret_val = 0;
1330 for (i = 0; i < words; i++) { 1334 for (i = 0; i < words; i++) {
1331 if ((dev_spec->shadow_ram) && 1335 if ((dev_spec->shadow_ram) &&
1332 (dev_spec->shadow_ram[offset+i].modified)) { 1336 (dev_spec->shadow_ram[offset+i].modified)) {
@@ -1341,7 +1345,6 @@ static s32 e1000_read_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1341 } 1345 }
1342 } 1346 }
1343 1347
1344release:
1345 e1000_release_swflag_ich8lan(hw); 1348 e1000_release_swflag_ich8lan(hw);
1346 1349
1347out: 1350out:
@@ -1592,7 +1595,6 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1592{ 1595{
1593 struct e1000_nvm_info *nvm = &hw->nvm; 1596 struct e1000_nvm_info *nvm = &hw->nvm;
1594 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; 1597 struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
1595 s32 ret_val;
1596 u16 i; 1598 u16 i;
1597 1599
1598 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) || 1600 if ((offset >= nvm->word_size) || (words > nvm->word_size - offset) ||
@@ -1601,17 +1603,11 @@ static s32 e1000_write_nvm_ich8lan(struct e1000_hw *hw, u16 offset, u16 words,
1601 return -E1000_ERR_NVM; 1603 return -E1000_ERR_NVM;
1602 } 1604 }
1603 1605
1604 ret_val = e1000_acquire_swflag_ich8lan(hw);
1605 if (ret_val)
1606 return ret_val;
1607
1608 for (i = 0; i < words; i++) { 1606 for (i = 0; i < words; i++) {
1609 dev_spec->shadow_ram[offset+i].modified = 1; 1607 dev_spec->shadow_ram[offset+i].modified = 1;
1610 dev_spec->shadow_ram[offset+i].value = data[i]; 1608 dev_spec->shadow_ram[offset+i].value = data[i];
1611 } 1609 }
1612 1610
1613 e1000_release_swflag_ich8lan(hw);
1614
1615 return 0; 1611 return 0;
1616} 1612}
1617 1613
@@ -1652,8 +1648,8 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1652 */ 1648 */
1653 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank); 1649 ret_val = e1000_valid_nvm_bank_detect_ich8lan(hw, &bank);
1654 if (ret_val) { 1650 if (ret_val) {
1655 e1000_release_swflag_ich8lan(hw); 1651 hw_dbg(hw, "Could not detect valid bank, assuming bank 0\n");
1656 goto out; 1652 bank = 0;
1657 } 1653 }
1658 1654
1659 if (bank == 0) { 1655 if (bank == 0) {
@@ -2039,12 +2035,8 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
2039 iteration = 1; 2035 iteration = 1;
2040 break; 2036 break;
2041 case 2: 2037 case 2:
2042 if (hw->mac.type == e1000_ich9lan) { 2038 sector_size = ICH_FLASH_SEG_SIZE_8K;
2043 sector_size = ICH_FLASH_SEG_SIZE_8K; 2039 iteration = 1;
2044 iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_8K;
2045 } else {
2046 return -E1000_ERR_NVM;
2047 }
2048 break; 2040 break;
2049 case 3: 2041 case 3:
2050 sector_size = ICH_FLASH_SEG_SIZE_64K; 2042 sector_size = ICH_FLASH_SEG_SIZE_64K;
@@ -2056,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank)
2056 2048
2057 /* Start with the base address, then add the sector offset. */ 2049 /* Start with the base address, then add the sector offset. */
2058 flash_linear_addr = hw->nvm.flash_base_addr; 2050 flash_linear_addr = hw->nvm.flash_base_addr;
2059 flash_linear_addr += (bank) ? (sector_size * iteration) : 0; 2051 flash_linear_addr += (bank) ? flash_bank_size : 0;
2060 2052
2061 for (j = 0; j < iteration ; j++) { 2053 for (j = 0; j < iteration ; j++) {
2062 do { 2054 do {
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 63415bb6f48f..fa92a683aefd 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4538,8 +4538,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4538 /* Allow time for pending master requests to run */ 4538 /* Allow time for pending master requests to run */
4539 e1000e_disable_pcie_master(&adapter->hw); 4539 e1000e_disable_pcie_master(&adapter->hw);
4540 4540
4541 if ((adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) && 4541 if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
4542 !(hw->mac.ops.check_mng_mode(hw))) {
4543 /* enable wakeup by the PHY */ 4542 /* enable wakeup by the PHY */
4544 retval = e1000_init_phy_wakeup(adapter, wufc); 4543 retval = e1000_init_phy_wakeup(adapter, wufc);
4545 if (retval) 4544 if (retval)
@@ -4557,7 +4556,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
4557 *enable_wake = !!wufc; 4556 *enable_wake = !!wufc;
4558 4557
4559 /* make sure adapter isn't asleep if manageability is enabled */ 4558 /* make sure adapter isn't asleep if manageability is enabled */
4560 if (adapter->flags & FLAG_MNG_PT_ENABLED) 4559 if ((adapter->flags & FLAG_MNG_PT_ENABLED) ||
4560 (hw->mac.ops.check_mng_mode(hw)))
4561 *enable_wake = true; 4561 *enable_wake = true;
4562 4562
4563 if (adapter->hw.phy.type == e1000_phy_igp_3) 4563 if (adapter->hw.phy.type == e1000_phy_igp_3)
@@ -4670,14 +4670,6 @@ static int e1000_resume(struct pci_dev *pdev)
4670 return err; 4670 return err;
4671 } 4671 }
4672 4672
4673 /* AER (Advanced Error Reporting) hooks */
4674 err = pci_enable_pcie_error_reporting(pdev);
4675 if (err) {
4676 dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
4677 "0x%x\n", err);
4678 /* non-fatal, continue */
4679 }
4680
4681 pci_set_master(pdev); 4673 pci_set_master(pdev);
4682 4674
4683 pci_enable_wake(pdev, PCI_D3hot, 0); 4675 pci_enable_wake(pdev, PCI_D3hot, 0);
@@ -4990,6 +4982,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4990 if (err) 4982 if (err)
4991 goto err_pci_reg; 4983 goto err_pci_reg;
4992 4984
4985 /* AER (Advanced Error Reporting) hooks */
4986 err = pci_enable_pcie_error_reporting(pdev);
4987 if (err) {
4988 dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
4989 "0x%x\n", err);
4990 /* non-fatal, continue */
4991 }
4992
4993 pci_set_master(pdev); 4993 pci_set_master(pdev);
4994 /* PCI config space info */ 4994 /* PCI config space info */
4995 err = pci_save_state(pdev); 4995 err = pci_save_state(pdev);
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index d4b98074b1b7..c9fd82d3a80d 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -285,6 +285,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
285{ 285{
286 struct fec_enet_private *fep = netdev_priv(dev); 286 struct fec_enet_private *fep = netdev_priv(dev);
287 struct bufdesc *bdp; 287 struct bufdesc *bdp;
288 void *bufaddr;
288 unsigned short status; 289 unsigned short status;
289 unsigned long flags; 290 unsigned long flags;
290 291
@@ -312,7 +313,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
312 status &= ~BD_ENET_TX_STATS; 313 status &= ~BD_ENET_TX_STATS;
313 314
314 /* Set buffer length and buffer pointer */ 315 /* Set buffer length and buffer pointer */
315 bdp->cbd_bufaddr = __pa(skb->data); 316 bufaddr = skb->data;
316 bdp->cbd_datlen = skb->len; 317 bdp->cbd_datlen = skb->len;
317 318
318 /* 319 /*
@@ -320,11 +321,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
320 * 4-byte boundaries. Use bounce buffers to copy data 321 * 4-byte boundaries. Use bounce buffers to copy data
321 * and get it aligned. Ugh. 322 * and get it aligned. Ugh.
322 */ 323 */
323 if (bdp->cbd_bufaddr & FEC_ALIGNMENT) { 324 if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
324 unsigned int index; 325 unsigned int index;
325 index = bdp - fep->tx_bd_base; 326 index = bdp - fep->tx_bd_base;
326 memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len); 327 memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
327 bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]); 328 bufaddr = fep->tx_bounce[index];
328 } 329 }
329 330
330 /* Save skb pointer */ 331 /* Save skb pointer */
@@ -336,7 +337,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
336 /* Push the data cache so the CPM does not get stale memory 337 /* Push the data cache so the CPM does not get stale memory
337 * data. 338 * data.
338 */ 339 */
339 bdp->cbd_bufaddr = dma_map_single(&dev->dev, skb->data, 340 bdp->cbd_bufaddr = dma_map_single(&dev->dev, bufaddr,
340 FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE); 341 FEC_ENET_TX_FRSIZE, DMA_TO_DEVICE);
341 342
342 /* Send it on its way. Tell FEC it's ready, interrupt when done, 343 /* Send it on its way. Tell FEC it's ready, interrupt when done,
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index cc786333d95c..c40113f58963 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -309,6 +309,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
309{ 309{
310 struct mpc52xx_fec_priv *priv = netdev_priv(dev); 310 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
311 struct bcom_fec_bd *bd; 311 struct bcom_fec_bd *bd;
312 unsigned long flags;
312 313
313 if (bcom_queue_full(priv->tx_dmatsk)) { 314 if (bcom_queue_full(priv->tx_dmatsk)) {
314 if (net_ratelimit()) 315 if (net_ratelimit())
@@ -316,7 +317,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
316 return NETDEV_TX_BUSY; 317 return NETDEV_TX_BUSY;
317 } 318 }
318 319
319 spin_lock_irq(&priv->lock); 320 spin_lock_irqsave(&priv->lock, flags);
320 dev->trans_start = jiffies; 321 dev->trans_start = jiffies;
321 322
322 bd = (struct bcom_fec_bd *) 323 bd = (struct bcom_fec_bd *)
@@ -332,7 +333,7 @@ static int mpc52xx_fec_start_xmit(struct sk_buff *skb, struct net_device *dev)
332 netif_stop_queue(dev); 333 netif_stop_queue(dev);
333 } 334 }
334 335
335 spin_unlock_irq(&priv->lock); 336 spin_unlock_irqrestore(&priv->lock, flags);
336 337
337 return NETDEV_TX_OK; 338 return NETDEV_TX_OK;
338} 339}
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index f8ffcbf0bc39..e212f2c5448b 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -936,6 +936,7 @@ int startup_gfar(struct net_device *dev)
936 struct gfar __iomem *regs = priv->regs; 936 struct gfar __iomem *regs = priv->regs;
937 int err = 0; 937 int err = 0;
938 u32 rctrl = 0; 938 u32 rctrl = 0;
939 u32 tctrl = 0;
939 u32 attrs = 0; 940 u32 attrs = 0;
940 941
941 gfar_write(&regs->imask, IMASK_INIT_CLEAR); 942 gfar_write(&regs->imask, IMASK_INIT_CLEAR);
@@ -1111,11 +1112,19 @@ int startup_gfar(struct net_device *dev)
1111 rctrl |= RCTRL_PADDING(priv->padding); 1112 rctrl |= RCTRL_PADDING(priv->padding);
1112 } 1113 }
1113 1114
1115 /* keep vlan related bits if it's enabled */
1116 if (priv->vlgrp) {
1117 rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;
1118 tctrl |= TCTRL_VLINS;
1119 }
1120
1114 /* Init rctrl based on our settings */ 1121 /* Init rctrl based on our settings */
1115 gfar_write(&priv->regs->rctrl, rctrl); 1122 gfar_write(&priv->regs->rctrl, rctrl);
1116 1123
1117 if (dev->features & NETIF_F_IP_CSUM) 1124 if (dev->features & NETIF_F_IP_CSUM)
1118 gfar_write(&priv->regs->tctrl, TCTRL_INIT_CSUM); 1125 tctrl |= TCTRL_INIT_CSUM;
1126
1127 gfar_write(&priv->regs->tctrl, tctrl);
1119 1128
1120 /* Set the extraction length and index */ 1129 /* Set the extraction length and index */
1121 attrs = ATTRELI_EL(priv->rx_stash_size) | 1130 attrs = ATTRELI_EL(priv->rx_stash_size) |
@@ -1450,7 +1459,6 @@ static void gfar_vlan_rx_register(struct net_device *dev,
1450 1459
1451 /* Enable VLAN tag extraction */ 1460 /* Enable VLAN tag extraction */
1452 tempval = gfar_read(&priv->regs->rctrl); 1461 tempval = gfar_read(&priv->regs->rctrl);
1453 tempval |= RCTRL_VLEX;
1454 tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); 1462 tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT);
1455 gfar_write(&priv->regs->rctrl, tempval); 1463 gfar_write(&priv->regs->rctrl, tempval);
1456 } else { 1464 } else {
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index beb84213b671..f0f890803710 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -1305,6 +1305,8 @@ static int emac_close(struct net_device *ndev)
1305 1305
1306 free_irq(dev->emac_irq, dev); 1306 free_irq(dev->emac_irq, dev);
1307 1307
1308 netif_carrier_off(ndev);
1309
1308 return 0; 1310 return 0;
1309} 1311}
1310 1312
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 3376a4f39e0a..77d10edefd25 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -803,9 +803,6 @@ static const struct net_device_ops pxa_irda_netdev_ops = {
803 .ndo_stop = pxa_irda_stop, 803 .ndo_stop = pxa_irda_stop,
804 .ndo_start_xmit = pxa_irda_hard_xmit, 804 .ndo_start_xmit = pxa_irda_hard_xmit,
805 .ndo_do_ioctl = pxa_irda_ioctl, 805 .ndo_do_ioctl = pxa_irda_ioctl,
806 .ndo_change_mtu = eth_change_mtu,
807 .ndo_validate_addr = eth_validate_addr,
808 .ndo_set_mac_address = eth_mac_addr,
809}; 806};
810 807
811static int pxa_irda_probe(struct platform_device *pdev) 808static int pxa_irda_probe(struct platform_device *pdev)
@@ -830,6 +827,7 @@ static int pxa_irda_probe(struct platform_device *pdev)
830 if (!dev) 827 if (!dev)
831 goto err_mem_3; 828 goto err_mem_3;
832 829
830 SET_NETDEV_DEV(dev, &pdev->dev);
833 si = netdev_priv(dev); 831 si = netdev_priv(dev);
834 si->dev = &pdev->dev; 832 si->dev = &pdev->dev;
835 si->pdata = pdev->dev.platform_data; 833 si->pdata = pdev->dev.platform_data;
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index d0883835b0c6..fe4f2b2bff96 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -115,7 +115,7 @@ static int __init w83977af_init(void)
115 115
116 IRDA_DEBUG(0, "%s()\n", __func__ ); 116 IRDA_DEBUG(0, "%s()\n", __func__ );
117 117
118 for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) { 118 for (i=0; i < ARRAY_SIZE(dev_self) && io[i] < 2000; i++) {
119 if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) 119 if (w83977af_open(i, io[i], irq[i], dma[i]) == 0)
120 return 0; 120 return 0;
121 } 121 }
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index e11d83d5852b..2c4dc8221dcd 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -136,6 +136,8 @@ struct ixgbe_ring {
136 136
137 u8 queue_index; /* needed for multiqueue queue management */ 137 u8 queue_index; /* needed for multiqueue queue management */
138 138
139#define IXGBE_RING_RX_PS_ENABLED (u8)(1)
140 u8 flags; /* per ring feature flags */
139 u16 head; 141 u16 head;
140 u16 tail; 142 u16 tail;
141 143
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 79144e950a34..dff8dfac7ed9 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -1948,6 +1948,7 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
1948 struct ethtool_coalesce *ec) 1948 struct ethtool_coalesce *ec)
1949{ 1949{
1950 struct ixgbe_adapter *adapter = netdev_priv(netdev); 1950 struct ixgbe_adapter *adapter = netdev_priv(netdev);
1951 struct ixgbe_q_vector *q_vector;
1951 int i; 1952 int i;
1952 1953
1953 if (ec->tx_max_coalesced_frames_irq) 1954 if (ec->tx_max_coalesced_frames_irq)
@@ -1982,14 +1983,24 @@ static int ixgbe_set_coalesce(struct net_device *netdev,
1982 adapter->itr_setting = 0; 1983 adapter->itr_setting = 0;
1983 } 1984 }
1984 1985
1985 for (i = 0; i < adapter->num_msix_vectors - NON_Q_VECTORS; i++) { 1986 /* MSI/MSIx Interrupt Mode */
1986 struct ixgbe_q_vector *q_vector = adapter->q_vector[i]; 1987 if (adapter->flags &
1987 if (q_vector->txr_count && !q_vector->rxr_count) 1988 (IXGBE_FLAG_MSIX_ENABLED | IXGBE_FLAG_MSI_ENABLED)) {
1988 /* tx vector gets half the rate */ 1989 int num_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
1989 q_vector->eitr = (adapter->eitr_param >> 1); 1990 for (i = 0; i < num_vectors; i++) {
1990 else 1991 q_vector = adapter->q_vector[i];
1991 /* rx only or mixed */ 1992 if (q_vector->txr_count && !q_vector->rxr_count)
1992 q_vector->eitr = adapter->eitr_param; 1993 /* tx vector gets half the rate */
1994 q_vector->eitr = (adapter->eitr_param >> 1);
1995 else
1996 /* rx only or mixed */
1997 q_vector->eitr = adapter->eitr_param;
1998 ixgbe_write_eitr(q_vector);
1999 }
2000 /* Legacy Interrupt Mode */
2001 } else {
2002 q_vector = adapter->q_vector[0];
2003 q_vector->eitr = adapter->eitr_param;
1993 ixgbe_write_eitr(q_vector); 2004 ixgbe_write_eitr(q_vector);
1994 } 2005 }
1995 2006
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index fa9f24e23683..28cf104e36cc 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -336,7 +336,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
336 /* return 0 to bypass going to ULD for DDPed data */ 336 /* return 0 to bypass going to ULD for DDPed data */
337 if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP) 337 if (fcstat == IXGBE_RXDADV_STAT_FCSTAT_DDP)
338 rc = 0; 338 rc = 0;
339 else 339 else if (ddp->len)
340 rc = ddp->len; 340 rc = ddp->len;
341 } 341 }
342 342
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 110c65ab5cb5..77b0381a2b5c 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -492,12 +492,12 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector,
492 492
493 skb_record_rx_queue(skb, ring->queue_index); 493 skb_record_rx_queue(skb, ring->queue_index);
494 if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) { 494 if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) {
495 if (adapter->vlgrp && is_vlan && (tag != 0)) 495 if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK))
496 vlan_gro_receive(napi, adapter->vlgrp, tag, skb); 496 vlan_gro_receive(napi, adapter->vlgrp, tag, skb);
497 else 497 else
498 napi_gro_receive(napi, skb); 498 napi_gro_receive(napi, skb);
499 } else { 499 } else {
500 if (adapter->vlgrp && is_vlan && (tag != 0)) 500 if (adapter->vlgrp && is_vlan && (tag & VLAN_VID_MASK))
501 vlan_hwaccel_rx(skb, adapter->vlgrp, tag); 501 vlan_hwaccel_rx(skb, adapter->vlgrp, tag);
502 else 502 else
503 netif_rx(skb); 503 netif_rx(skb);
@@ -585,7 +585,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
585 rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i); 585 rx_desc = IXGBE_RX_DESC_ADV(*rx_ring, i);
586 586
587 if (!bi->page_dma && 587 if (!bi->page_dma &&
588 (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)) { 588 (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED)) {
589 if (!bi->page) { 589 if (!bi->page) {
590 bi->page = alloc_page(GFP_ATOMIC); 590 bi->page = alloc_page(GFP_ATOMIC);
591 if (!bi->page) { 591 if (!bi->page) {
@@ -629,7 +629,7 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter,
629 } 629 }
630 /* Refresh the desc even if buffer_addrs didn't change because 630 /* Refresh the desc even if buffer_addrs didn't change because
631 * each write-back erases this info. */ 631 * each write-back erases this info. */
632 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 632 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
633 rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma); 633 rx_desc->read.pkt_addr = cpu_to_le64(bi->page_dma);
634 rx_desc->read.hdr_addr = cpu_to_le64(bi->dma); 634 rx_desc->read.hdr_addr = cpu_to_le64(bi->dma);
635 } else { 635 } else {
@@ -726,7 +726,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
726 break; 726 break;
727 (*work_done)++; 727 (*work_done)++;
728 728
729 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 729 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
730 hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc)); 730 hdr_info = le16_to_cpu(ixgbe_get_hdr_info(rx_desc));
731 len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >> 731 len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >>
732 IXGBE_RXDADV_HDRBUFLEN_SHIFT; 732 IXGBE_RXDADV_HDRBUFLEN_SHIFT;
@@ -798,7 +798,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
798 rx_ring->stats.packets++; 798 rx_ring->stats.packets++;
799 rx_ring->stats.bytes += skb->len; 799 rx_ring->stats.bytes += skb->len;
800 } else { 800 } else {
801 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 801 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
802 rx_buffer_info->skb = next_buffer->skb; 802 rx_buffer_info->skb = next_buffer->skb;
803 rx_buffer_info->dma = next_buffer->dma; 803 rx_buffer_info->dma = next_buffer->dma;
804 next_buffer->skb = skb; 804 next_buffer->skb = skb;
@@ -1898,46 +1898,19 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
1898 1898
1899#define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 1899#define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2
1900 1900
1901static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index) 1901static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
1902 struct ixgbe_ring *rx_ring)
1902{ 1903{
1903 struct ixgbe_ring *rx_ring;
1904 u32 srrctl; 1904 u32 srrctl;
1905 int queue0 = 0; 1905 int index;
1906 unsigned long mask;
1907 struct ixgbe_ring_feature *feature = adapter->ring_feature; 1906 struct ixgbe_ring_feature *feature = adapter->ring_feature;
1908 1907
1909 if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 1908 index = rx_ring->reg_idx;
1910 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 1909 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
1911 int dcb_i = feature[RING_F_DCB].indices; 1910 unsigned long mask;
1912 if (dcb_i == 8)
1913 queue0 = index >> 4;
1914 else if (dcb_i == 4)
1915 queue0 = index >> 5;
1916 else
1917 dev_err(&adapter->pdev->dev, "Invalid DCB "
1918 "configuration\n");
1919#ifdef IXGBE_FCOE
1920 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
1921 struct ixgbe_ring_feature *f;
1922
1923 rx_ring = &adapter->rx_ring[queue0];
1924 f = &adapter->ring_feature[RING_F_FCOE];
1925 if ((queue0 == 0) && (index > rx_ring->reg_idx))
1926 queue0 = f->mask + index -
1927 rx_ring->reg_idx - 1;
1928 }
1929#endif /* IXGBE_FCOE */
1930 } else {
1931 queue0 = index;
1932 }
1933 } else {
1934 mask = (unsigned long) feature[RING_F_RSS].mask; 1911 mask = (unsigned long) feature[RING_F_RSS].mask;
1935 queue0 = index & mask;
1936 index = index & mask; 1912 index = index & mask;
1937 } 1913 }
1938
1939 rx_ring = &adapter->rx_ring[queue0];
1940
1941 srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index)); 1914 srrctl = IXGBE_READ_REG(&adapter->hw, IXGBE_SRRCTL(index));
1942 1915
1943 srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK; 1916 srrctl &= ~IXGBE_SRRCTL_BSIZEHDR_MASK;
@@ -1946,7 +1919,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index)
1946 srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) & 1919 srrctl |= (IXGBE_RX_HDR_SIZE << IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT) &
1947 IXGBE_SRRCTL_BSIZEHDR_MASK; 1920 IXGBE_SRRCTL_BSIZEHDR_MASK;
1948 1921
1949 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 1922 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
1950#if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER 1923#if (PAGE_SIZE / 2) > IXGBE_MAX_RXBUFFER
1951 srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; 1924 srrctl |= IXGBE_MAX_RXBUFFER >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
1952#else 1925#else
@@ -2002,6 +1975,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2002{ 1975{
2003 u64 rdba; 1976 u64 rdba;
2004 struct ixgbe_hw *hw = &adapter->hw; 1977 struct ixgbe_hw *hw = &adapter->hw;
1978 struct ixgbe_ring *rx_ring;
2005 struct net_device *netdev = adapter->netdev; 1979 struct net_device *netdev = adapter->netdev;
2006 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 1980 int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
2007 int i, j; 1981 int i, j;
@@ -2018,11 +1992,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2018 /* Decide whether to use packet split mode or not */ 1992 /* Decide whether to use packet split mode or not */
2019 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED; 1993 adapter->flags |= IXGBE_FLAG_RX_PS_ENABLED;
2020 1994
2021#ifdef IXGBE_FCOE
2022 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
2023 adapter->flags &= ~IXGBE_FLAG_RX_PS_ENABLED;
2024#endif /* IXGBE_FCOE */
2025
2026 /* Set the RX buffer length according to the mode */ 1995 /* Set the RX buffer length according to the mode */
2027 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 1996 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
2028 rx_buf_len = IXGBE_RX_HDR_SIZE; 1997 rx_buf_len = IXGBE_RX_HDR_SIZE;
@@ -2070,29 +2039,35 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2070 * the Base and Length of the Rx Descriptor Ring 2039 * the Base and Length of the Rx Descriptor Ring
2071 */ 2040 */
2072 for (i = 0; i < adapter->num_rx_queues; i++) { 2041 for (i = 0; i < adapter->num_rx_queues; i++) {
2073 rdba = adapter->rx_ring[i].dma; 2042 rx_ring = &adapter->rx_ring[i];
2074 j = adapter->rx_ring[i].reg_idx; 2043 rdba = rx_ring->dma;
2044 j = rx_ring->reg_idx;
2075 IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32))); 2045 IXGBE_WRITE_REG(hw, IXGBE_RDBAL(j), (rdba & DMA_BIT_MASK(32)));
2076 IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32)); 2046 IXGBE_WRITE_REG(hw, IXGBE_RDBAH(j), (rdba >> 32));
2077 IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen); 2047 IXGBE_WRITE_REG(hw, IXGBE_RDLEN(j), rdlen);
2078 IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0); 2048 IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0);
2079 IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0); 2049 IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0);
2080 adapter->rx_ring[i].head = IXGBE_RDH(j); 2050 rx_ring->head = IXGBE_RDH(j);
2081 adapter->rx_ring[i].tail = IXGBE_RDT(j); 2051 rx_ring->tail = IXGBE_RDT(j);
2082 adapter->rx_ring[i].rx_buf_len = rx_buf_len; 2052 rx_ring->rx_buf_len = rx_buf_len;
2053
2054 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED)
2055 rx_ring->flags |= IXGBE_RING_RX_PS_ENABLED;
2083 2056
2084#ifdef IXGBE_FCOE 2057#ifdef IXGBE_FCOE
2085 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { 2058 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
2086 struct ixgbe_ring_feature *f; 2059 struct ixgbe_ring_feature *f;
2087 f = &adapter->ring_feature[RING_F_FCOE]; 2060 f = &adapter->ring_feature[RING_F_FCOE];
2088 if ((rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE) && 2061 if ((i >= f->mask) && (i < f->mask + f->indices)) {
2089 (i >= f->mask) && (i < f->mask + f->indices)) 2062 rx_ring->flags &= ~IXGBE_RING_RX_PS_ENABLED;
2090 adapter->rx_ring[i].rx_buf_len = 2063 if (rx_buf_len < IXGBE_FCOE_JUMBO_FRAME_SIZE)
2091 IXGBE_FCOE_JUMBO_FRAME_SIZE; 2064 rx_ring->rx_buf_len =
2065 IXGBE_FCOE_JUMBO_FRAME_SIZE;
2066 }
2092 } 2067 }
2093 2068
2094#endif /* IXGBE_FCOE */ 2069#endif /* IXGBE_FCOE */
2095 ixgbe_configure_srrctl(adapter, j); 2070 ixgbe_configure_srrctl(adapter, rx_ring);
2096 } 2071 }
2097 2072
2098 if (hw->mac.type == ixgbe_mac_82598EB) { 2073 if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -2168,7 +2143,8 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2168 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) { 2143 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
2169 /* Enable 82599 HW-RSC */ 2144 /* Enable 82599 HW-RSC */
2170 for (i = 0; i < adapter->num_rx_queues; i++) { 2145 for (i = 0; i < adapter->num_rx_queues; i++) {
2171 j = adapter->rx_ring[i].reg_idx; 2146 rx_ring = &adapter->rx_ring[i];
2147 j = rx_ring->reg_idx;
2172 rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j)); 2148 rscctrl = IXGBE_READ_REG(hw, IXGBE_RSCCTL(j));
2173 rscctrl |= IXGBE_RSCCTL_RSCEN; 2149 rscctrl |= IXGBE_RSCCTL_RSCEN;
2174 /* 2150 /*
@@ -2176,7 +2152,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2176 * total size of max desc * buf_len is not greater 2152 * total size of max desc * buf_len is not greater
2177 * than 65535 2153 * than 65535
2178 */ 2154 */
2179 if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) { 2155 if (rx_ring->flags & IXGBE_RING_RX_PS_ENABLED) {
2180#if (MAX_SKB_FRAGS > 16) 2156#if (MAX_SKB_FRAGS > 16)
2181 rscctrl |= IXGBE_RSCCTL_MAXDESC_16; 2157 rscctrl |= IXGBE_RSCCTL_MAXDESC_16;
2182#elif (MAX_SKB_FRAGS > 8) 2158#elif (MAX_SKB_FRAGS > 8)
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 2a0174b62e96..92fb8235c766 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -41,6 +41,7 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev)
41 struct ixpdev_priv *ip = netdev_priv(dev); 41 struct ixpdev_priv *ip = netdev_priv(dev);
42 struct ixpdev_tx_desc *desc; 42 struct ixpdev_tx_desc *desc;
43 int entry; 43 int entry;
44 unsigned long flags;
44 45
45 if (unlikely(skb->len > PAGE_SIZE)) { 46 if (unlikely(skb->len > PAGE_SIZE)) {
46 /* @@@ Count drops. */ 47 /* @@@ Count drops. */
@@ -63,11 +64,11 @@ static int ixpdev_xmit(struct sk_buff *skb, struct net_device *dev)
63 64
64 dev->trans_start = jiffies; 65 dev->trans_start = jiffies;
65 66
66 local_irq_disable(); 67 local_irq_save(flags);
67 ip->tx_queue_entries++; 68 ip->tx_queue_entries++;
68 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN) 69 if (ip->tx_queue_entries == TX_BUF_COUNT_PER_CHAN)
69 netif_stop_queue(dev); 70 netif_stop_queue(dev);
70 local_irq_enable(); 71 local_irq_restore(flags);
71 72
72 return 0; 73 return 0;
73} 74}
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 5b5c25368d1e..e3601cf3f931 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -620,6 +620,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
620 dma_addr_t mapping; 620 dma_addr_t mapping;
621 unsigned int len, entry; 621 unsigned int len, entry;
622 u32 ctrl; 622 u32 ctrl;
623 unsigned long flags;
623 624
624#ifdef DEBUG 625#ifdef DEBUG
625 int i; 626 int i;
@@ -635,12 +636,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
635#endif 636#endif
636 637
637 len = skb->len; 638 len = skb->len;
638 spin_lock_irq(&bp->lock); 639 spin_lock_irqsave(&bp->lock, flags);
639 640
640 /* This is a hard error, log it. */ 641 /* This is a hard error, log it. */
641 if (TX_BUFFS_AVAIL(bp) < 1) { 642 if (TX_BUFFS_AVAIL(bp) < 1) {
642 netif_stop_queue(dev); 643 netif_stop_queue(dev);
643 spin_unlock_irq(&bp->lock); 644 spin_unlock_irqrestore(&bp->lock, flags);
644 dev_err(&bp->pdev->dev, 645 dev_err(&bp->pdev->dev,
645 "BUG! Tx Ring full when queue awake!\n"); 646 "BUG! Tx Ring full when queue awake!\n");
646 dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", 647 dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n",
@@ -674,7 +675,7 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev)
674 if (TX_BUFFS_AVAIL(bp) < 1) 675 if (TX_BUFFS_AVAIL(bp) < 1)
675 netif_stop_queue(dev); 676 netif_stop_queue(dev);
676 677
677 spin_unlock_irq(&bp->lock); 678 spin_unlock_irqrestore(&bp->lock, flags);
678 679
679 dev->trans_start = jiffies; 680 dev->trans_start = jiffies;
680 681
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 91bdfdfd431f..3ac0404d0d11 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -506,8 +506,9 @@ static int mlx4_en_complete_rx_desc(struct mlx4_en_priv *priv,
506 PCI_DMA_FROMDEVICE); 506 PCI_DMA_FROMDEVICE);
507 } 507 }
508 /* Adjust size of last fragment to match actual length */ 508 /* Adjust size of last fragment to match actual length */
509 skb_frags_rx[nr - 1].size = length - 509 if (nr > 0)
510 priv->frag_info[nr - 1].frag_prefix_size; 510 skb_frags_rx[nr - 1].size = length -
511 priv->frag_info[nr - 1].frag_prefix_size;
511 return nr; 512 return nr;
512 513
513fail: 514fail:
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 5a88b3f57693..62208401c4df 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -437,6 +437,7 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
437{ 437{
438 struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind]; 438 struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind];
439 struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind]; 439 struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind];
440 unsigned long flags;
440 441
441 /* If we don't have a pending timer, set one up to catch our recent 442 /* If we don't have a pending timer, set one up to catch our recent
442 post in case the interface becomes idle */ 443 post in case the interface becomes idle */
@@ -445,9 +446,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
445 446
446 /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */ 447 /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */
447 if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0) 448 if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0)
448 if (spin_trylock_irq(&ring->comp_lock)) { 449 if (spin_trylock_irqsave(&ring->comp_lock, flags)) {
449 mlx4_en_process_tx_cq(priv->dev, cq); 450 mlx4_en_process_tx_cq(priv->dev, cq);
450 spin_unlock_irq(&ring->comp_lock); 451 spin_unlock_irqrestore(&ring->comp_lock, flags);
451 } 452 }
452} 453}
453 454
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index f86e05047d19..a9c1fcca5e75 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -1254,7 +1254,7 @@ struct netxen_adapter {
1254 u8 mc_enabled; 1254 u8 mc_enabled;
1255 u8 max_mc_count; 1255 u8 max_mc_count;
1256 u8 rss_supported; 1256 u8 rss_supported;
1257 u8 resv2; 1257 u8 link_changed;
1258 u32 resv3; 1258 u32 resv3;
1259 1259
1260 u8 has_link_events; 1260 u8 has_link_events;
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 7acf204e38c9..5d3343ef3d86 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -184,13 +184,6 @@ void netxen_free_sw_resources(struct netxen_adapter *adapter)
184 kfree(recv_ctx->rds_rings); 184 kfree(recv_ctx->rds_rings);
185 185
186skip_rds: 186skip_rds:
187 if (recv_ctx->sds_rings == NULL)
188 goto skip_sds;
189
190 for(ring = 0; ring < adapter->max_sds_rings; ring++)
191 recv_ctx->sds_rings[ring].consumer = 0;
192
193skip_sds:
194 if (adapter->tx_ring == NULL) 187 if (adapter->tx_ring == NULL)
195 return; 188 return;
196 189
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 3cd8cfcf627b..28f270f5ac78 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -94,10 +94,6 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
94 94
95MODULE_DEVICE_TABLE(pci, netxen_pci_tbl); 95MODULE_DEVICE_TABLE(pci, netxen_pci_tbl);
96 96
97static struct workqueue_struct *netxen_workq;
98#define SCHEDULE_WORK(tp) queue_work(netxen_workq, tp)
99#define FLUSH_SCHEDULED_WORK() flush_workqueue(netxen_workq)
100
101static void netxen_watchdog(unsigned long); 97static void netxen_watchdog(unsigned long);
102 98
103static uint32_t crb_cmd_producer[4] = { 99static uint32_t crb_cmd_producer[4] = {
@@ -171,6 +167,8 @@ netxen_free_sds_rings(struct netxen_recv_context *recv_ctx)
171{ 167{
172 if (recv_ctx->sds_rings != NULL) 168 if (recv_ctx->sds_rings != NULL)
173 kfree(recv_ctx->sds_rings); 169 kfree(recv_ctx->sds_rings);
170
171 recv_ctx->sds_rings = NULL;
174} 172}
175 173
176static int 174static int
@@ -193,6 +191,21 @@ netxen_napi_add(struct netxen_adapter *adapter, struct net_device *netdev)
193} 191}
194 192
195static void 193static void
194netxen_napi_del(struct netxen_adapter *adapter)
195{
196 int ring;
197 struct nx_host_sds_ring *sds_ring;
198 struct netxen_recv_context *recv_ctx = &adapter->recv_ctx;
199
200 for (ring = 0; ring < adapter->max_sds_rings; ring++) {
201 sds_ring = &recv_ctx->sds_rings[ring];
202 netif_napi_del(&sds_ring->napi);
203 }
204
205 netxen_free_sds_rings(&adapter->recv_ctx);
206}
207
208static void
196netxen_napi_enable(struct netxen_adapter *adapter) 209netxen_napi_enable(struct netxen_adapter *adapter)
197{ 210{
198 int ring; 211 int ring;
@@ -260,7 +273,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter)
260 change = 0; 273 change = 0;
261 274
262 shift = NXRD32(adapter, CRB_DMA_SHIFT); 275 shift = NXRD32(adapter, CRB_DMA_SHIFT);
263 if (shift >= 32) 276 if (shift > 32)
264 return 0; 277 return 0;
265 278
266 if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9)) 279 if (NX_IS_REVISION_P3(adapter->ahw.revision_id) && (shift > 9))
@@ -272,7 +285,7 @@ nx_update_dma_mask(struct netxen_adapter *adapter)
272 old_mask = pdev->dma_mask; 285 old_mask = pdev->dma_mask;
273 old_cmask = pdev->dev.coherent_dma_mask; 286 old_cmask = pdev->dev.coherent_dma_mask;
274 287
275 mask = (1ULL<<(32+shift)) - 1; 288 mask = DMA_BIT_MASK(32+shift);
276 289
277 err = pci_set_dma_mask(pdev, mask); 290 err = pci_set_dma_mask(pdev, mask);
278 if (err) 291 if (err)
@@ -880,7 +893,6 @@ netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
880 spin_unlock(&adapter->tx_clean_lock); 893 spin_unlock(&adapter->tx_clean_lock);
881 894
882 del_timer_sync(&adapter->watchdog_timer); 895 del_timer_sync(&adapter->watchdog_timer);
883 FLUSH_SCHEDULED_WORK();
884} 896}
885 897
886 898
@@ -894,10 +906,12 @@ netxen_nic_attach(struct netxen_adapter *adapter)
894 struct nx_host_tx_ring *tx_ring; 906 struct nx_host_tx_ring *tx_ring;
895 907
896 err = netxen_init_firmware(adapter); 908 err = netxen_init_firmware(adapter);
897 if (err != 0) { 909 if (err)
898 printk(KERN_ERR "Failed to init firmware\n"); 910 return err;
899 return -EIO; 911
900 } 912 err = netxen_napi_add(adapter, netdev);
913 if (err)
914 return err;
901 915
902 if (adapter->fw_major < 4) 916 if (adapter->fw_major < 4)
903 adapter->max_rds_rings = 3; 917 adapter->max_rds_rings = 3;
@@ -961,6 +975,7 @@ netxen_nic_detach(struct netxen_adapter *adapter)
961 netxen_free_hw_resources(adapter); 975 netxen_free_hw_resources(adapter);
962 netxen_release_rx_buffers(adapter); 976 netxen_release_rx_buffers(adapter);
963 netxen_nic_free_irq(adapter); 977 netxen_nic_free_irq(adapter);
978 netxen_napi_del(adapter);
964 netxen_free_sw_resources(adapter); 979 netxen_free_sw_resources(adapter);
965 980
966 adapter->is_up = 0; 981 adapter->is_up = 0;
@@ -1105,9 +1120,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1105 1120
1106 netdev->irq = adapter->msix_entries[0].vector; 1121 netdev->irq = adapter->msix_entries[0].vector;
1107 1122
1108 if (netxen_napi_add(adapter, netdev))
1109 goto err_out_disable_msi;
1110
1111 init_timer(&adapter->watchdog_timer); 1123 init_timer(&adapter->watchdog_timer);
1112 adapter->watchdog_timer.function = &netxen_watchdog; 1124 adapter->watchdog_timer.function = &netxen_watchdog;
1113 adapter->watchdog_timer.data = (unsigned long)adapter; 1125 adapter->watchdog_timer.data = (unsigned long)adapter;
@@ -1177,6 +1189,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
1177 1189
1178 unregister_netdev(netdev); 1190 unregister_netdev(netdev);
1179 1191
1192 cancel_work_sync(&adapter->watchdog_task);
1193 cancel_work_sync(&adapter->tx_timeout_task);
1194
1180 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 1195 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
1181 netxen_nic_detach(adapter); 1196 netxen_nic_detach(adapter);
1182 } 1197 }
@@ -1185,7 +1200,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
1185 netxen_free_adapter_offload(adapter); 1200 netxen_free_adapter_offload(adapter);
1186 1201
1187 netxen_teardown_intr(adapter); 1202 netxen_teardown_intr(adapter);
1188 netxen_free_sds_rings(&adapter->recv_ctx);
1189 1203
1190 netxen_cleanup_pci_map(adapter); 1204 netxen_cleanup_pci_map(adapter);
1191 1205
@@ -1211,6 +1225,9 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
1211 if (netif_running(netdev)) 1225 if (netif_running(netdev))
1212 netxen_nic_down(adapter, netdev); 1226 netxen_nic_down(adapter, netdev);
1213 1227
1228 cancel_work_sync(&adapter->watchdog_task);
1229 cancel_work_sync(&adapter->tx_timeout_task);
1230
1214 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) 1231 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC)
1215 netxen_nic_detach(adapter); 1232 netxen_nic_detach(adapter);
1216 1233
@@ -1549,11 +1566,6 @@ static int netxen_nic_check_temp(struct netxen_adapter *adapter)
1549 "%s: Device temperature %d degrees C exceeds" 1566 "%s: Device temperature %d degrees C exceeds"
1550 " maximum allowed. Hardware has been shut down.\n", 1567 " maximum allowed. Hardware has been shut down.\n",
1551 netdev->name, temp_val); 1568 netdev->name, temp_val);
1552
1553 netif_device_detach(netdev);
1554 netxen_nic_down(adapter, netdev);
1555 netxen_nic_detach(adapter);
1556
1557 rv = 1; 1569 rv = 1;
1558 } else if (temp_state == NX_TEMP_WARN) { 1570 } else if (temp_state == NX_TEMP_WARN) {
1559 if (adapter->temp == NX_TEMP_NORMAL) { 1571 if (adapter->temp == NX_TEMP_NORMAL) {
@@ -1587,10 +1599,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup)
1587 netif_carrier_off(netdev); 1599 netif_carrier_off(netdev);
1588 netif_stop_queue(netdev); 1600 netif_stop_queue(netdev);
1589 } 1601 }
1590 1602 adapter->link_changed = !adapter->has_link_events;
1591 if (!adapter->has_link_events)
1592 netxen_nic_set_link_parameters(adapter);
1593
1594 } else if (!adapter->ahw.linkup && linkup) { 1603 } else if (!adapter->ahw.linkup && linkup) {
1595 printk(KERN_INFO "%s: %s NIC Link is up\n", 1604 printk(KERN_INFO "%s: %s NIC Link is up\n",
1596 netxen_nic_driver_name, netdev->name); 1605 netxen_nic_driver_name, netdev->name);
@@ -1599,9 +1608,7 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup)
1599 netif_carrier_on(netdev); 1608 netif_carrier_on(netdev);
1600 netif_wake_queue(netdev); 1609 netif_wake_queue(netdev);
1601 } 1610 }
1602 1611 adapter->link_changed = !adapter->has_link_events;
1603 if (!adapter->has_link_events)
1604 netxen_nic_set_link_parameters(adapter);
1605 } 1612 }
1606} 1613}
1607 1614
@@ -1628,11 +1635,36 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1628 netxen_advert_link_change(adapter, linkup); 1635 netxen_advert_link_change(adapter, linkup);
1629} 1636}
1630 1637
1638static void netxen_nic_thermal_shutdown(struct netxen_adapter *adapter)
1639{
1640 struct net_device *netdev = adapter->netdev;
1641
1642 netif_device_detach(netdev);
1643 netxen_nic_down(adapter, netdev);
1644 netxen_nic_detach(adapter);
1645}
1646
1631static void netxen_watchdog(unsigned long v) 1647static void netxen_watchdog(unsigned long v)
1632{ 1648{
1633 struct netxen_adapter *adapter = (struct netxen_adapter *)v; 1649 struct netxen_adapter *adapter = (struct netxen_adapter *)v;
1634 1650
1635 SCHEDULE_WORK(&adapter->watchdog_task); 1651 if (netxen_nic_check_temp(adapter))
1652 goto do_sched;
1653
1654 if (!adapter->has_link_events) {
1655 netxen_nic_handle_phy_intr(adapter);
1656
1657 if (adapter->link_changed)
1658 goto do_sched;
1659 }
1660
1661 if (netif_running(adapter->netdev))
1662 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
1663
1664 return;
1665
1666do_sched:
1667 schedule_work(&adapter->watchdog_task);
1636} 1668}
1637 1669
1638void netxen_watchdog_task(struct work_struct *work) 1670void netxen_watchdog_task(struct work_struct *work)
@@ -1640,11 +1672,13 @@ void netxen_watchdog_task(struct work_struct *work)
1640 struct netxen_adapter *adapter = 1672 struct netxen_adapter *adapter =
1641 container_of(work, struct netxen_adapter, watchdog_task); 1673 container_of(work, struct netxen_adapter, watchdog_task);
1642 1674
1643 if (netxen_nic_check_temp(adapter)) 1675 if (adapter->temp == NX_TEMP_PANIC) {
1676 netxen_nic_thermal_shutdown(adapter);
1644 return; 1677 return;
1678 }
1645 1679
1646 if (!adapter->has_link_events) 1680 if (adapter->link_changed)
1647 netxen_nic_handle_phy_intr(adapter); 1681 netxen_nic_set_link_parameters(adapter);
1648 1682
1649 if (netif_running(adapter->netdev)) 1683 if (netif_running(adapter->netdev))
1650 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 1684 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
@@ -1652,9 +1686,8 @@ void netxen_watchdog_task(struct work_struct *work)
1652 1686
1653static void netxen_tx_timeout(struct net_device *netdev) 1687static void netxen_tx_timeout(struct net_device *netdev)
1654{ 1688{
1655 struct netxen_adapter *adapter = (struct netxen_adapter *) 1689 struct netxen_adapter *adapter = netdev_priv(netdev);
1656 netdev_priv(netdev); 1690 schedule_work(&adapter->tx_timeout_task);
1657 SCHEDULE_WORK(&adapter->tx_timeout_task);
1658} 1691}
1659 1692
1660static void netxen_tx_timeout_task(struct work_struct *work) 1693static void netxen_tx_timeout_task(struct work_struct *work)
@@ -1811,9 +1844,6 @@ static int __init netxen_init_module(void)
1811{ 1844{
1812 printk(KERN_INFO "%s\n", netxen_nic_driver_string); 1845 printk(KERN_INFO "%s\n", netxen_nic_driver_string);
1813 1846
1814 if ((netxen_workq = create_singlethread_workqueue("netxen")) == NULL)
1815 return -ENOMEM;
1816
1817 return pci_register_driver(&netxen_driver); 1847 return pci_register_driver(&netxen_driver);
1818} 1848}
1819 1849
@@ -1822,7 +1852,6 @@ module_init(netxen_init_module);
1822static void __exit netxen_exit_module(void) 1852static void __exit netxen_exit_module(void)
1823{ 1853{
1824 pci_unregister_driver(&netxen_driver); 1854 pci_unregister_driver(&netxen_driver);
1825 destroy_workqueue(netxen_workq);
1826} 1855}
1827 1856
1828module_exit(netxen_exit_module); 1857module_exit(netxen_exit_module);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index a646a445fda9..23e1a0750fe0 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1839,7 +1839,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1839 lp->chip_version = chip_version; 1839 lp->chip_version = chip_version;
1840 lp->msg_enable = pcnet32_debug; 1840 lp->msg_enable = pcnet32_debug;
1841 if ((cards_found >= MAX_UNITS) 1841 if ((cards_found >= MAX_UNITS)
1842 || (options[cards_found] > sizeof(options_mapping))) 1842 || (options[cards_found] >= sizeof(options_mapping)))
1843 lp->options = PCNET32_PORT_ASEL; 1843 lp->options = PCNET32_PORT_ASEL;
1844 else 1844 else
1845 lp->options = options_mapping[options[cards_found]]; 1845 lp->options = options_mapping[options[cards_found]];
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 1c70e999cc50..9da1fa12a67c 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -196,21 +196,23 @@ static void PRINT_PKT(u_char *buf, int length)
196/* this enables an interrupt in the interrupt mask register */ 196/* this enables an interrupt in the interrupt mask register */
197#define SMC_ENABLE_INT(lp, x) do { \ 197#define SMC_ENABLE_INT(lp, x) do { \
198 unsigned char mask; \ 198 unsigned char mask; \
199 spin_lock_irq(&lp->lock); \ 199 unsigned long smc_enable_flags; \
200 spin_lock_irqsave(&lp->lock, smc_enable_flags); \
200 mask = SMC_GET_INT_MASK(lp); \ 201 mask = SMC_GET_INT_MASK(lp); \
201 mask |= (x); \ 202 mask |= (x); \
202 SMC_SET_INT_MASK(lp, mask); \ 203 SMC_SET_INT_MASK(lp, mask); \
203 spin_unlock_irq(&lp->lock); \ 204 spin_unlock_irqrestore(&lp->lock, smc_enable_flags); \
204} while (0) 205} while (0)
205 206
206/* this disables an interrupt from the interrupt mask register */ 207/* this disables an interrupt from the interrupt mask register */
207#define SMC_DISABLE_INT(lp, x) do { \ 208#define SMC_DISABLE_INT(lp, x) do { \
208 unsigned char mask; \ 209 unsigned char mask; \
209 spin_lock_irq(&lp->lock); \ 210 unsigned long smc_disable_flags; \
211 spin_lock_irqsave(&lp->lock, smc_disable_flags); \
210 mask = SMC_GET_INT_MASK(lp); \ 212 mask = SMC_GET_INT_MASK(lp); \
211 mask &= ~(x); \ 213 mask &= ~(x); \
212 SMC_SET_INT_MASK(lp, mask); \ 214 SMC_SET_INT_MASK(lp, mask); \
213 spin_unlock_irq(&lp->lock); \ 215 spin_unlock_irqrestore(&lp->lock, smc_disable_flags); \
214} while (0) 216} while (0)
215 217
216/* 218/*
@@ -520,21 +522,21 @@ static inline void smc_rcv(struct net_device *dev)
520 * any other concurrent access and C would always interrupt B. But life 522 * any other concurrent access and C would always interrupt B. But life
521 * isn't that easy in a SMP world... 523 * isn't that easy in a SMP world...
522 */ 524 */
523#define smc_special_trylock(lock) \ 525#define smc_special_trylock(lock, flags) \
524({ \ 526({ \
525 int __ret; \ 527 int __ret; \
526 local_irq_disable(); \ 528 local_irq_save(flags); \
527 __ret = spin_trylock(lock); \ 529 __ret = spin_trylock(lock); \
528 if (!__ret) \ 530 if (!__ret) \
529 local_irq_enable(); \ 531 local_irq_restore(flags); \
530 __ret; \ 532 __ret; \
531}) 533})
532#define smc_special_lock(lock) spin_lock_irq(lock) 534#define smc_special_lock(lock, flags) spin_lock_irq(lock, flags)
533#define smc_special_unlock(lock) spin_unlock_irq(lock) 535#define smc_special_unlock(lock, flags) spin_unlock_irqrestore(lock, flags)
534#else 536#else
535#define smc_special_trylock(lock) (1) 537#define smc_special_trylock(lock, flags) (1)
536#define smc_special_lock(lock) do { } while (0) 538#define smc_special_lock(lock, flags) do { } while (0)
537#define smc_special_unlock(lock) do { } while (0) 539#define smc_special_unlock(lock, flags) do { } while (0)
538#endif 540#endif
539 541
540/* 542/*
@@ -548,10 +550,11 @@ static void smc_hardware_send_pkt(unsigned long data)
548 struct sk_buff *skb; 550 struct sk_buff *skb;
549 unsigned int packet_no, len; 551 unsigned int packet_no, len;
550 unsigned char *buf; 552 unsigned char *buf;
553 unsigned long flags;
551 554
552 DBG(3, "%s: %s\n", dev->name, __func__); 555 DBG(3, "%s: %s\n", dev->name, __func__);
553 556
554 if (!smc_special_trylock(&lp->lock)) { 557 if (!smc_special_trylock(&lp->lock, flags)) {
555 netif_stop_queue(dev); 558 netif_stop_queue(dev);
556 tasklet_schedule(&lp->tx_task); 559 tasklet_schedule(&lp->tx_task);
557 return; 560 return;
@@ -559,7 +562,7 @@ static void smc_hardware_send_pkt(unsigned long data)
559 562
560 skb = lp->pending_tx_skb; 563 skb = lp->pending_tx_skb;
561 if (unlikely(!skb)) { 564 if (unlikely(!skb)) {
562 smc_special_unlock(&lp->lock); 565 smc_special_unlock(&lp->lock, flags);
563 return; 566 return;
564 } 567 }
565 lp->pending_tx_skb = NULL; 568 lp->pending_tx_skb = NULL;
@@ -569,7 +572,7 @@ static void smc_hardware_send_pkt(unsigned long data)
569 printk("%s: Memory allocation failed.\n", dev->name); 572 printk("%s: Memory allocation failed.\n", dev->name);
570 dev->stats.tx_errors++; 573 dev->stats.tx_errors++;
571 dev->stats.tx_fifo_errors++; 574 dev->stats.tx_fifo_errors++;
572 smc_special_unlock(&lp->lock); 575 smc_special_unlock(&lp->lock, flags);
573 goto done; 576 goto done;
574 } 577 }
575 578
@@ -608,7 +611,7 @@ static void smc_hardware_send_pkt(unsigned long data)
608 611
609 /* queue the packet for TX */ 612 /* queue the packet for TX */
610 SMC_SET_MMU_CMD(lp, MC_ENQUEUE); 613 SMC_SET_MMU_CMD(lp, MC_ENQUEUE);
611 smc_special_unlock(&lp->lock); 614 smc_special_unlock(&lp->lock, flags);
612 615
613 dev->trans_start = jiffies; 616 dev->trans_start = jiffies;
614 dev->stats.tx_packets++; 617 dev->stats.tx_packets++;
@@ -633,6 +636,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
633 struct smc_local *lp = netdev_priv(dev); 636 struct smc_local *lp = netdev_priv(dev);
634 void __iomem *ioaddr = lp->base; 637 void __iomem *ioaddr = lp->base;
635 unsigned int numPages, poll_count, status; 638 unsigned int numPages, poll_count, status;
639 unsigned long flags;
636 640
637 DBG(3, "%s: %s\n", dev->name, __func__); 641 DBG(3, "%s: %s\n", dev->name, __func__);
638 642
@@ -658,7 +662,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
658 return 0; 662 return 0;
659 } 663 }
660 664
661 smc_special_lock(&lp->lock); 665 smc_special_lock(&lp->lock, flags);
662 666
663 /* now, try to allocate the memory */ 667 /* now, try to allocate the memory */
664 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages); 668 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages);
@@ -676,7 +680,7 @@ static int smc_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
676 } 680 }
677 } while (--poll_count); 681 } while (--poll_count);
678 682
679 smc_special_unlock(&lp->lock); 683 smc_special_unlock(&lp->lock, flags);
680 684
681 lp->pending_tx_skb = skb; 685 lp->pending_tx_skb = skb;
682 if (!poll_count) { 686 if (!poll_count) {
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 99a63649f4fc..4cf9a6588751 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -652,8 +652,9 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
652 int entry; 652 int entry;
653 u32 flag; 653 u32 flag;
654 dma_addr_t mapping; 654 dma_addr_t mapping;
655 unsigned long flags;
655 656
656 spin_lock_irq(&tp->lock); 657 spin_lock_irqsave(&tp->lock, flags);
657 658
658 /* Calculate the next Tx descriptor entry. */ 659 /* Calculate the next Tx descriptor entry. */
659 entry = tp->cur_tx % TX_RING_SIZE; 660 entry = tp->cur_tx % TX_RING_SIZE;
@@ -688,7 +689,7 @@ tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
688 /* Trigger an immediate transmit demand. */ 689 /* Trigger an immediate transmit demand. */
689 iowrite32(0, tp->base_addr + CSR1); 690 iowrite32(0, tp->base_addr + CSR1);
690 691
691 spin_unlock_irq(&tp->lock); 692 spin_unlock_irqrestore(&tp->lock, flags);
692 693
693 dev->trans_start = jiffies; 694 dev->trans_start = jiffies;
694 695
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 027f7aba26af..42b6c6319bc2 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1048,20 +1048,15 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1048 return err; 1048 return err;
1049} 1049}
1050 1050
1051static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr) 1051static int tun_get_iff(struct net *net, struct tun_struct *tun,
1052 struct ifreq *ifr)
1052{ 1053{
1053 struct tun_struct *tun = tun_get(file);
1054
1055 if (!tun)
1056 return -EBADFD;
1057
1058 DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name); 1054 DBG(KERN_INFO "%s: tun_get_iff\n", tun->dev->name);
1059 1055
1060 strcpy(ifr->ifr_name, tun->dev->name); 1056 strcpy(ifr->ifr_name, tun->dev->name);
1061 1057
1062 ifr->ifr_flags = tun_flags(tun); 1058 ifr->ifr_flags = tun_flags(tun);
1063 1059
1064 tun_put(tun);
1065 return 0; 1060 return 0;
1066} 1061}
1067 1062
@@ -1105,8 +1100,8 @@ static int set_offload(struct net_device *dev, unsigned long arg)
1105 return 0; 1100 return 0;
1106} 1101}
1107 1102
1108static int tun_chr_ioctl(struct inode *inode, struct file *file, 1103static long tun_chr_ioctl(struct file *file, unsigned int cmd,
1109 unsigned int cmd, unsigned long arg) 1104 unsigned long arg)
1110{ 1105{
1111 struct tun_file *tfile = file->private_data; 1106 struct tun_file *tfile = file->private_data;
1112 struct tun_struct *tun; 1107 struct tun_struct *tun;
@@ -1128,34 +1123,32 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1128 (unsigned int __user*)argp); 1123 (unsigned int __user*)argp);
1129 } 1124 }
1130 1125
1126 rtnl_lock();
1127
1131 tun = __tun_get(tfile); 1128 tun = __tun_get(tfile);
1132 if (cmd == TUNSETIFF && !tun) { 1129 if (cmd == TUNSETIFF && !tun) {
1133 int err;
1134
1135 ifr.ifr_name[IFNAMSIZ-1] = '\0'; 1130 ifr.ifr_name[IFNAMSIZ-1] = '\0';
1136 1131
1137 rtnl_lock(); 1132 ret = tun_set_iff(tfile->net, file, &ifr);
1138 err = tun_set_iff(tfile->net, file, &ifr);
1139 rtnl_unlock();
1140 1133
1141 if (err) 1134 if (ret)
1142 return err; 1135 goto unlock;
1143 1136
1144 if (copy_to_user(argp, &ifr, sizeof(ifr))) 1137 if (copy_to_user(argp, &ifr, sizeof(ifr)))
1145 return -EFAULT; 1138 ret = -EFAULT;
1146 return 0; 1139 goto unlock;
1147 } 1140 }
1148 1141
1149 1142 ret = -EBADFD;
1150 if (!tun) 1143 if (!tun)
1151 return -EBADFD; 1144 goto unlock;
1152 1145
1153 DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd); 1146 DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd);
1154 1147
1155 ret = 0; 1148 ret = 0;
1156 switch (cmd) { 1149 switch (cmd) {
1157 case TUNGETIFF: 1150 case TUNGETIFF:
1158 ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr); 1151 ret = tun_get_iff(current->nsproxy->net_ns, tun, &ifr);
1159 if (ret) 1152 if (ret)
1160 break; 1153 break;
1161 1154
@@ -1201,7 +1194,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1201 1194
1202 case TUNSETLINK: 1195 case TUNSETLINK:
1203 /* Only allow setting the type when the interface is down */ 1196 /* Only allow setting the type when the interface is down */
1204 rtnl_lock();
1205 if (tun->dev->flags & IFF_UP) { 1197 if (tun->dev->flags & IFF_UP) {
1206 DBG(KERN_INFO "%s: Linktype set failed because interface is up\n", 1198 DBG(KERN_INFO "%s: Linktype set failed because interface is up\n",
1207 tun->dev->name); 1199 tun->dev->name);
@@ -1211,7 +1203,6 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1211 DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type); 1203 DBG(KERN_INFO "%s: linktype set to %d\n", tun->dev->name, tun->dev->type);
1212 ret = 0; 1204 ret = 0;
1213 } 1205 }
1214 rtnl_unlock();
1215 break; 1206 break;
1216 1207
1217#ifdef TUN_DEBUG 1208#ifdef TUN_DEBUG
@@ -1220,9 +1211,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1220 break; 1211 break;
1221#endif 1212#endif
1222 case TUNSETOFFLOAD: 1213 case TUNSETOFFLOAD:
1223 rtnl_lock();
1224 ret = set_offload(tun->dev, arg); 1214 ret = set_offload(tun->dev, arg);
1225 rtnl_unlock();
1226 break; 1215 break;
1227 1216
1228 case TUNSETTXFILTER: 1217 case TUNSETTXFILTER:
@@ -1230,9 +1219,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1230 ret = -EINVAL; 1219 ret = -EINVAL;
1231 if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV) 1220 if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
1232 break; 1221 break;
1233 rtnl_lock();
1234 ret = update_filter(&tun->txflt, (void __user *)arg); 1222 ret = update_filter(&tun->txflt, (void __user *)arg);
1235 rtnl_unlock();
1236 break; 1223 break;
1237 1224
1238 case SIOCGIFHWADDR: 1225 case SIOCGIFHWADDR:
@@ -1248,9 +1235,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1248 DBG(KERN_DEBUG "%s: set hw address: %pM\n", 1235 DBG(KERN_DEBUG "%s: set hw address: %pM\n",
1249 tun->dev->name, ifr.ifr_hwaddr.sa_data); 1236 tun->dev->name, ifr.ifr_hwaddr.sa_data);
1250 1237
1251 rtnl_lock();
1252 ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr); 1238 ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr);
1253 rtnl_unlock();
1254 break; 1239 break;
1255 1240
1256 case TUNGETSNDBUF: 1241 case TUNGETSNDBUF:
@@ -1273,7 +1258,10 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
1273 break; 1258 break;
1274 }; 1259 };
1275 1260
1276 tun_put(tun); 1261unlock:
1262 rtnl_unlock();
1263 if (tun)
1264 tun_put(tun);
1277 return ret; 1265 return ret;
1278} 1266}
1279 1267
@@ -1361,7 +1349,7 @@ static const struct file_operations tun_fops = {
1361 .write = do_sync_write, 1349 .write = do_sync_write,
1362 .aio_write = tun_chr_aio_write, 1350 .aio_write = tun_chr_aio_write,
1363 .poll = tun_chr_poll, 1351 .poll = tun_chr_poll,
1364 .ioctl = tun_chr_ioctl, 1352 .unlocked_ioctl = tun_chr_ioctl,
1365 .open = tun_chr_open, 1353 .open = tun_chr_open,
1366 .release = tun_chr_close, 1354 .release = tun_chr_close,
1367 .fasync = tun_chr_fasync 1355 .fasync = tun_chr_fasync
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 3b957e6412ee..8a7b8c7bd781 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3111,10 +3111,11 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3111 u8 __iomem *bd; /* BD pointer */ 3111 u8 __iomem *bd; /* BD pointer */
3112 u32 bd_status; 3112 u32 bd_status;
3113 u8 txQ = 0; 3113 u8 txQ = 0;
3114 unsigned long flags;
3114 3115
3115 ugeth_vdbg("%s: IN", __func__); 3116 ugeth_vdbg("%s: IN", __func__);
3116 3117
3117 spin_lock_irq(&ugeth->lock); 3118 spin_lock_irqsave(&ugeth->lock, flags);
3118 3119
3119 dev->stats.tx_bytes += skb->len; 3120 dev->stats.tx_bytes += skb->len;
3120 3121
@@ -3171,7 +3172,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3171 uccf = ugeth->uccf; 3172 uccf = ugeth->uccf;
3172 out_be16(uccf->p_utodr, UCC_FAST_TOD); 3173 out_be16(uccf->p_utodr, UCC_FAST_TOD);
3173#endif 3174#endif
3174 spin_unlock_irq(&ugeth->lock); 3175 spin_unlock_irqrestore(&ugeth->lock, flags);
3175 3176
3176 return 0; 3177 return 0;
3177} 3178}
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h
index c7467823cd1c..f968c834ff63 100644
--- a/drivers/net/usb/pegasus.h
+++ b/drivers/net/usb/pegasus.h
@@ -250,6 +250,8 @@ PEGASUS_DEV( "IO DATA USB ET/TX", VENDOR_IODATA, 0x0904,
250 DEFAULT_GPIO_RESET ) 250 DEFAULT_GPIO_RESET )
251PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913, 251PEGASUS_DEV( "IO DATA USB ET/TX-S", VENDOR_IODATA, 0x0913,
252 DEFAULT_GPIO_RESET | PEGASUS_II ) 252 DEFAULT_GPIO_RESET | PEGASUS_II )
253PEGASUS_DEV( "IO DATA USB ETX-US2", VENDOR_IODATA, 0x092a,
254 DEFAULT_GPIO_RESET | PEGASUS_II )
253PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a, 255PEGASUS_DEV( "Kingston KNU101TX Ethernet", VENDOR_KINGSTON, 0x000a,
254 DEFAULT_GPIO_RESET) 256 DEFAULT_GPIO_RESET)
255PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002, 257PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 88c30a58b4bd..934f7671650a 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1218,6 +1218,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
1218 struct rhine_private *rp = netdev_priv(dev); 1218 struct rhine_private *rp = netdev_priv(dev);
1219 void __iomem *ioaddr = rp->base; 1219 void __iomem *ioaddr = rp->base;
1220 unsigned entry; 1220 unsigned entry;
1221 unsigned long flags;
1221 1222
1222 /* Caution: the write order is important here, set the field 1223 /* Caution: the write order is important here, set the field
1223 with the "ownership" bits last. */ 1224 with the "ownership" bits last. */
@@ -1261,7 +1262,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
1261 cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN)); 1262 cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
1262 1263
1263 /* lock eth irq */ 1264 /* lock eth irq */
1264 spin_lock_irq(&rp->lock); 1265 spin_lock_irqsave(&rp->lock, flags);
1265 wmb(); 1266 wmb();
1266 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn); 1267 rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
1267 wmb(); 1268 wmb();
@@ -1280,7 +1281,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
1280 1281
1281 dev->trans_start = jiffies; 1282 dev->trans_start = jiffies;
1282 1283
1283 spin_unlock_irq(&rp->lock); 1284 spin_unlock_irqrestore(&rp->lock, flags);
1284 1285
1285 if (debug > 4) { 1286 if (debug > 4) {
1286 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n", 1287 printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 3ba35956327a..cee08a1e497a 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1778,7 +1778,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
1778 * mode 1778 * mode
1779 */ 1779 */
1780 if (vptr->rev_id < REV_ID_VT3216_A0) { 1780 if (vptr->rev_id < REV_ID_VT3216_A0) {
1781 if (vptr->mii_status | VELOCITY_DUPLEX_FULL) 1781 if (vptr->mii_status & VELOCITY_DUPLEX_FULL)
1782 BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR); 1782 BYTE_REG_BITS_ON(TCR_TB2BDIS, &regs->TCR);
1783 else 1783 else
1784 BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR); 1784 BYTE_REG_BITS_OFF(TCR_TB2BDIS, &regs->TCR);
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 9d38cf60a0db..88c3d8573869 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -1967,13 +1967,14 @@ static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue,
1967 int ret; 1967 int ret;
1968 1968
1969 mutex_lock(&ar->mutex); 1969 mutex_lock(&ar->mutex);
1970 if ((param) && !(queue > __AR9170_NUM_TXQ)) { 1970 if (queue < __AR9170_NUM_TXQ) {
1971 memcpy(&ar->edcf[ar9170_qos_hwmap[queue]], 1971 memcpy(&ar->edcf[ar9170_qos_hwmap[queue]],
1972 param, sizeof(*param)); 1972 param, sizeof(*param));
1973 1973
1974 ret = ar9170_set_qos(ar); 1974 ret = ar9170_set_qos(ar);
1975 } else 1975 } else {
1976 ret = -EINVAL; 1976 ret = -EINVAL;
1977 }
1977 1978
1978 mutex_unlock(&ar->mutex); 1979 mutex_unlock(&ar->mutex);
1979 return ret; 1980 return ret;
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 754b1f8d8da9..007eb85fc67e 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -598,11 +598,15 @@ static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
598 598
599 err = request_firmware(&aru->init_values, "ar9170-1.fw", 599 err = request_firmware(&aru->init_values, "ar9170-1.fw",
600 &aru->udev->dev); 600 &aru->udev->dev);
601 if (err) {
602 dev_err(&aru->udev->dev, "file with init values not found.\n");
603 return err;
604 }
601 605
602 err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev); 606 err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
603 if (err) { 607 if (err) {
604 release_firmware(aru->init_values); 608 release_firmware(aru->init_values);
605 dev_err(&aru->udev->dev, "file with init values not found.\n"); 609 dev_err(&aru->udev->dev, "firmware file not found.\n");
606 return err; 610 return err;
607 } 611 }
608 612
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 44c29b3f6728..6dcac73b4d29 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -6226,7 +6226,7 @@ static void ipw_add_scan_channels(struct ipw_priv *priv,
6226 }; 6226 };
6227 6227
6228 u8 channel; 6228 u8 channel;
6229 while (channel_index < IPW_SCAN_CHANNELS) { 6229 while (channel_index < IPW_SCAN_CHANNELS - 1) {
6230 channel = 6230 channel =
6231 priv->speed_scan[priv->speed_scan_pos]; 6231 priv->speed_scan[priv->speed_scan_pos];
6232 if (channel == 0) { 6232 if (channel == 0) {
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index d6997371c27e..b9b374119033 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -1,7 +1,6 @@
1/* Copyright (C) 2006, Red Hat, Inc. */ 1/* Copyright (C) 2006, Red Hat, Inc. */
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/kernel.h>
5#include <linux/etherdevice.h> 4#include <linux/etherdevice.h>
6#include <linux/ieee80211.h> 5#include <linux/ieee80211.h>
7#include <linux/if_arp.h> 6#include <linux/if_arp.h>
@@ -44,21 +43,21 @@ static int get_common_rates(struct lbs_private *priv,
44 u16 *rates_size) 43 u16 *rates_size)
45{ 44{
46 u8 *card_rates = lbs_bg_rates; 45 u8 *card_rates = lbs_bg_rates;
46 size_t num_card_rates = sizeof(lbs_bg_rates);
47 int ret = 0, i, j; 47 int ret = 0, i, j;
48 u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)]; 48 u8 tmp[30];
49 size_t tmp_size = 0; 49 size_t tmp_size = 0;
50 50
51 /* For each rate in card_rates that exists in rate1, copy to tmp */ 51 /* For each rate in card_rates that exists in rate1, copy to tmp */
52 for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) { 52 for (i = 0; card_rates[i] && (i < num_card_rates); i++) {
53 for (j = 0; j < *rates_size && rates[j]; j++) { 53 for (j = 0; rates[j] && (j < *rates_size); j++) {
54 if (rates[j] == card_rates[i]) 54 if (rates[j] == card_rates[i])
55 tmp[tmp_size++] = card_rates[i]; 55 tmp[tmp_size++] = card_rates[i];
56 } 56 }
57 } 57 }
58 58
59 lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); 59 lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
60 lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, 60 lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates);
61 ARRAY_SIZE(lbs_bg_rates));
62 lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); 61 lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
63 lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); 62 lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
64 63
@@ -70,7 +69,10 @@ static int get_common_rates(struct lbs_private *priv,
70 lbs_pr_alert("Previously set fixed data rate %#x isn't " 69 lbs_pr_alert("Previously set fixed data rate %#x isn't "
71 "compatible with the network.\n", priv->cur_rate); 70 "compatible with the network.\n", priv->cur_rate);
72 ret = -1; 71 ret = -1;
72 goto done;
73 } 73 }
74 ret = 0;
75
74done: 76done:
75 memset(rates, 0, *rates_size); 77 memset(rates, 0, *rates_size);
76 *rates_size = min_t(int, tmp_size, *rates_size); 78 *rates_size = min_t(int, tmp_size, *rates_size);
@@ -320,7 +322,7 @@ static int lbs_associate(struct lbs_private *priv,
320 rates = (struct mrvl_ie_rates_param_set *) pos; 322 rates = (struct mrvl_ie_rates_param_set *) pos;
321 rates->header.type = cpu_to_le16(TLV_TYPE_RATES); 323 rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
322 memcpy(&rates->rates, &bss->rates, MAX_RATES); 324 memcpy(&rates->rates, &bss->rates, MAX_RATES);
323 tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES); 325 tmplen = MAX_RATES;
324 if (get_common_rates(priv, rates->rates, &tmplen)) { 326 if (get_common_rates(priv, rates->rates, &tmplen)) {
325 ret = -1; 327 ret = -1;
326 goto done; 328 goto done;
@@ -596,7 +598,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
596 598
597 /* Copy Data rates from the rates recorded in scan response */ 599 /* Copy Data rates from the rates recorded in scan response */
598 memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); 600 memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
599 ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES); 601 ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES);
600 memcpy(cmd.bss.rates, bss->rates, ratesize); 602 memcpy(cmd.bss.rates, bss->rates, ratesize);
601 if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { 603 if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
602 lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); 604 lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 0a2e29140add..c8a1998d4744 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -56,8 +56,8 @@ struct rxpd {
56 u8 bss_type; 56 u8 bss_type;
57 /* BSS number */ 57 /* BSS number */
58 u8 bss_num; 58 u8 bss_num;
59 } bss; 59 } __attribute__ ((packed)) bss;
60 } u; 60 } __attribute__ ((packed)) u;
61 61
62 /* SNR */ 62 /* SNR */
63 u8 snr; 63 u8 snr;
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index a263d5c84c08..83967afe0821 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -261,7 +261,7 @@ struct mwl8k_vif {
261 */ 261 */
262}; 262};
263 263
264#define MWL8K_VIF(_vif) (struct mwl8k_vif *)(&((_vif)->drv_priv)) 264#define MWL8K_VIF(_vif) ((struct mwl8k_vif *)&((_vif)->drv_priv))
265 265
266static const struct ieee80211_channel mwl8k_channels[] = { 266static const struct ieee80211_channel mwl8k_channels[] = {
267 { .center_freq = 2412, .hw_value = 1, }, 267 { .center_freq = 2412, .hw_value = 1, },
@@ -1012,6 +1012,8 @@ static int rxq_process(struct ieee80211_hw *hw, int index, int limit)
1012 rmb(); 1012 rmb();
1013 1013
1014 skb = rxq->rx_skb[rxq->rx_head]; 1014 skb = rxq->rx_skb[rxq->rx_head];
1015 if (skb == NULL)
1016 break;
1015 rxq->rx_skb[rxq->rx_head] = NULL; 1017 rxq->rx_skb[rxq->rx_head] = NULL;
1016 1018
1017 rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS; 1019 rxq->rx_head = (rxq->rx_head + 1) % MWL8K_RX_DESCS;
@@ -1591,6 +1593,9 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
1591 timeout = wait_for_completion_timeout(&cmd_wait, 1593 timeout = wait_for_completion_timeout(&cmd_wait,
1592 msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS)); 1594 msecs_to_jiffies(MWL8K_CMD_TIMEOUT_MS));
1593 1595
1596 pci_unmap_single(priv->pdev, dma_addr, dma_size,
1597 PCI_DMA_BIDIRECTIONAL);
1598
1594 result = &cmd->result; 1599 result = &cmd->result;
1595 if (!timeout) { 1600 if (!timeout) {
1596 spin_lock_irq(&priv->fw_lock); 1601 spin_lock_irq(&priv->fw_lock);
@@ -1610,8 +1615,6 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd)
1610 *result); 1615 *result);
1611 } 1616 }
1612 1617
1613 pci_unmap_single(priv->pdev, dma_addr, dma_size,
1614 PCI_DMA_BIDIRECTIONAL);
1615 return rc; 1618 return rc;
1616} 1619}
1617 1620
@@ -1654,18 +1657,18 @@ static int mwl8k_cmd_get_hw_spec(struct ieee80211_hw *hw)
1654 memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr)); 1657 memset(cmd->perm_addr, 0xff, sizeof(cmd->perm_addr));
1655 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma); 1658 cmd->ps_cookie = cpu_to_le32(priv->cookie_dma);
1656 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma); 1659 cmd->rx_queue_ptr = cpu_to_le32(priv->rxq[0].rx_desc_dma);
1657 cmd->num_tx_queues = MWL8K_TX_QUEUES; 1660 cmd->num_tx_queues = cpu_to_le32(MWL8K_TX_QUEUES);
1658 for (i = 0; i < MWL8K_TX_QUEUES; i++) 1661 for (i = 0; i < MWL8K_TX_QUEUES; i++)
1659 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma); 1662 cmd->tx_queue_ptrs[i] = cpu_to_le32(priv->txq[i].tx_desc_dma);
1660 cmd->num_tx_desc_per_queue = MWL8K_TX_DESCS; 1663 cmd->num_tx_desc_per_queue = cpu_to_le32(MWL8K_TX_DESCS);
1661 cmd->total_rx_desc = MWL8K_RX_DESCS; 1664 cmd->total_rx_desc = cpu_to_le32(MWL8K_RX_DESCS);
1662 1665
1663 rc = mwl8k_post_cmd(hw, &cmd->header); 1666 rc = mwl8k_post_cmd(hw, &cmd->header);
1664 1667
1665 if (!rc) { 1668 if (!rc) {
1666 SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr); 1669 SET_IEEE80211_PERM_ADDR(hw, cmd->perm_addr);
1667 priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs); 1670 priv->num_mcaddrs = le16_to_cpu(cmd->num_mcaddrs);
1668 priv->fw_rev = cmd->fw_rev; 1671 priv->fw_rev = le32_to_cpu(cmd->fw_rev);
1669 priv->hw_rev = cmd->hw_rev; 1672 priv->hw_rev = cmd->hw_rev;
1670 priv->region_code = le16_to_cpu(cmd->region_code); 1673 priv->region_code = le16_to_cpu(cmd->region_code);
1671 } 1674 }
@@ -3216,15 +3219,19 @@ static int mwl8k_configure_filter_wt(struct work_struct *wt)
3216 struct dev_addr_list *mclist = worker->mclist; 3219 struct dev_addr_list *mclist = worker->mclist;
3217 3220
3218 struct mwl8k_priv *priv = hw->priv; 3221 struct mwl8k_priv *priv = hw->priv;
3219 struct mwl8k_vif *mv_vif;
3220 int rc = 0; 3222 int rc = 0;
3221 3223
3222 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) { 3224 if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
3223 if (*total_flags & FIF_BCN_PRBRESP_PROMISC) 3225 if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
3224 rc = mwl8k_cmd_set_pre_scan(hw); 3226 rc = mwl8k_cmd_set_pre_scan(hw);
3225 else { 3227 else {
3226 mv_vif = MWL8K_VIF(priv->vif); 3228 u8 *bssid;
3227 rc = mwl8k_cmd_set_post_scan(hw, mv_vif->bssid); 3229
3230 bssid = "\x00\x00\x00\x00\x00\x00";
3231 if (priv->vif != NULL)
3232 bssid = MWL8K_VIF(priv->vif)->bssid;
3233
3234 rc = mwl8k_cmd_set_post_scan(hw, bssid);
3228 } 3235 }
3229 } 3236 }
3230 3237
@@ -3726,6 +3733,8 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev)
3726 3733
3727 ieee80211_stop_queues(hw); 3734 ieee80211_stop_queues(hw);
3728 3735
3736 ieee80211_unregister_hw(hw);
3737
3729 /* Remove tx reclaim tasklet */ 3738 /* Remove tx reclaim tasklet */
3730 tasklet_kill(&priv->tx_reclaim_task); 3739 tasklet_kill(&priv->tx_reclaim_task);
3731 3740
@@ -3739,8 +3748,6 @@ static void __devexit mwl8k_remove(struct pci_dev *pdev)
3739 for (i = 0; i < MWL8K_TX_QUEUES; i++) 3748 for (i = 0; i < MWL8K_TX_QUEUES; i++)
3740 mwl8k_txq_reclaim(hw, i, 1); 3749 mwl8k_txq_reclaim(hw, i, 1);
3741 3750
3742 ieee80211_unregister_hw(hw);
3743
3744 for (i = 0; i < MWL8K_TX_QUEUES; i++) 3751 for (i = 0; i < MWL8K_TX_QUEUES; i++)
3745 mwl8k_txq_deinit(hw, i); 3752 mwl8k_txq_deinit(hw, i);
3746 3753
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 632fac86a308..b3946272c72e 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -70,7 +70,7 @@ int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc)
70 int err = 0; 70 int err = 0;
71 u8 tsc_arr[4][IW_ENCODE_SEQ_MAX_SIZE]; 71 u8 tsc_arr[4][IW_ENCODE_SEQ_MAX_SIZE];
72 72
73 if ((key < 0) || (key > 4)) 73 if ((key < 0) || (key >= 4))
74 return -EINVAL; 74 return -EINVAL;
75 75
76 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, 76 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index a498dde024e1..49c9e2c1433d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -849,13 +849,15 @@ struct rt2x00_dev {
849static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev, 849static inline void rt2x00_rf_read(struct rt2x00_dev *rt2x00dev,
850 const unsigned int word, u32 *data) 850 const unsigned int word, u32 *data)
851{ 851{
852 *data = rt2x00dev->rf[word]; 852 BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
853 *data = rt2x00dev->rf[word - 1];
853} 854}
854 855
855static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev, 856static inline void rt2x00_rf_write(struct rt2x00_dev *rt2x00dev,
856 const unsigned int word, u32 data) 857 const unsigned int word, u32 data)
857{ 858{
858 rt2x00dev->rf[word] = data; 859 BUG_ON(word < 1 || word > rt2x00dev->ops->rf_size / sizeof(u32));
860 rt2x00dev->rf[word - 1] = data;
859} 861}
860 862
861/* 863/*
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 294250e294dd..87a95588a8e3 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -869,6 +869,9 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
869 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ 869 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */
870 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); 870 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0);
871 871
872 /* ENEDCA flag must always be set, transmit issues? */
873 rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA);
874
872 return 0; 875 return 0;
873} 876}
874 877
@@ -1173,13 +1176,16 @@ static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
1173 rtl818x_iowrite8(priv, &priv->map->BSSID[i], 1176 rtl818x_iowrite8(priv, &priv->map->BSSID[i],
1174 info->bssid[i]); 1177 info->bssid[i]);
1175 1178
1179 if (priv->is_rtl8187b)
1180 reg = RTL818X_MSR_ENEDCA;
1181 else
1182 reg = 0;
1183
1176 if (is_valid_ether_addr(info->bssid)) { 1184 if (is_valid_ether_addr(info->bssid)) {
1177 reg = RTL818X_MSR_INFRA; 1185 reg |= RTL818X_MSR_INFRA;
1178 if (priv->is_rtl8187b)
1179 reg |= RTL818X_MSR_ENEDCA;
1180 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1186 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1181 } else { 1187 } else {
1182 reg = RTL818X_MSR_NO_LINK; 1188 reg |= RTL818X_MSR_NO_LINK;
1183 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1189 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1184 } 1190 }
1185 1191
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index a07580138e81..c2fd6187773f 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -346,7 +346,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
346static int yellowfin_open(struct net_device *dev); 346static int yellowfin_open(struct net_device *dev);
347static void yellowfin_timer(unsigned long data); 347static void yellowfin_timer(unsigned long data);
348static void yellowfin_tx_timeout(struct net_device *dev); 348static void yellowfin_tx_timeout(struct net_device *dev);
349static void yellowfin_init_ring(struct net_device *dev); 349static int yellowfin_init_ring(struct net_device *dev);
350static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev); 350static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev);
351static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance); 351static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance);
352static int yellowfin_rx(struct net_device *dev); 352static int yellowfin_rx(struct net_device *dev);
@@ -573,19 +573,24 @@ static int yellowfin_open(struct net_device *dev)
573{ 573{
574 struct yellowfin_private *yp = netdev_priv(dev); 574 struct yellowfin_private *yp = netdev_priv(dev);
575 void __iomem *ioaddr = yp->base; 575 void __iomem *ioaddr = yp->base;
576 int i; 576 int i, ret;
577 577
578 /* Reset the chip. */ 578 /* Reset the chip. */
579 iowrite32(0x80000000, ioaddr + DMACtrl); 579 iowrite32(0x80000000, ioaddr + DMACtrl);
580 580
581 i = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev); 581 ret = request_irq(dev->irq, &yellowfin_interrupt, IRQF_SHARED, dev->name, dev);
582 if (i) return i; 582 if (ret)
583 return ret;
583 584
584 if (yellowfin_debug > 1) 585 if (yellowfin_debug > 1)
585 printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n", 586 printk(KERN_DEBUG "%s: yellowfin_open() irq %d.\n",
586 dev->name, dev->irq); 587 dev->name, dev->irq);
587 588
588 yellowfin_init_ring(dev); 589 ret = yellowfin_init_ring(dev);
590 if (ret) {
591 free_irq(dev->irq, dev);
592 return ret;
593 }
589 594
590 iowrite32(yp->rx_ring_dma, ioaddr + RxPtr); 595 iowrite32(yp->rx_ring_dma, ioaddr + RxPtr);
591 iowrite32(yp->tx_ring_dma, ioaddr + TxPtr); 596 iowrite32(yp->tx_ring_dma, ioaddr + TxPtr);
@@ -725,10 +730,10 @@ static void yellowfin_tx_timeout(struct net_device *dev)
725} 730}
726 731
727/* Initialize the Rx and Tx rings, along with various 'dev' bits. */ 732/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
728static void yellowfin_init_ring(struct net_device *dev) 733static int yellowfin_init_ring(struct net_device *dev)
729{ 734{
730 struct yellowfin_private *yp = netdev_priv(dev); 735 struct yellowfin_private *yp = netdev_priv(dev);
731 int i; 736 int i, j;
732 737
733 yp->tx_full = 0; 738 yp->tx_full = 0;
734 yp->cur_rx = yp->cur_tx = 0; 739 yp->cur_rx = yp->cur_tx = 0;
@@ -753,6 +758,11 @@ static void yellowfin_init_ring(struct net_device *dev)
753 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev, 758 yp->rx_ring[i].addr = cpu_to_le32(pci_map_single(yp->pci_dev,
754 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE)); 759 skb->data, yp->rx_buf_sz, PCI_DMA_FROMDEVICE));
755 } 760 }
761 if (i != RX_RING_SIZE) {
762 for (j = 0; j < i; j++)
763 dev_kfree_skb(yp->rx_skbuff[j]);
764 return -ENOMEM;
765 }
756 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP); 766 yp->rx_ring[i-1].dbdma_cmd = cpu_to_le32(CMD_STOP);
757 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE); 767 yp->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
758 768
@@ -769,8 +779,6 @@ static void yellowfin_init_ring(struct net_device *dev)
769 yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS); 779 yp->tx_ring[--i].dbdma_cmd = cpu_to_le32(CMD_STOP | BRANCH_ALWAYS);
770#else 780#else
771{ 781{
772 int j;
773
774 /* Tx ring needs a pair of descriptors, the second for the status. */ 782 /* Tx ring needs a pair of descriptors, the second for the status. */
775 for (i = 0; i < TX_RING_SIZE; i++) { 783 for (i = 0; i < TX_RING_SIZE; i++) {
776 j = 2*i; 784 j = 2*i;
@@ -805,7 +813,7 @@ static void yellowfin_init_ring(struct net_device *dev)
805} 813}
806#endif 814#endif
807 yp->tx_tail_desc = &yp->tx_status[0]; 815 yp->tx_tail_desc = &yp->tx_status[0];
808 return; 816 return 0;
809} 817}
810 818
811static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) 819static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev)
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c
index 37c84e3b8be0..81c753a617ab 100644
--- a/drivers/net/zorro8390.c
+++ b/drivers/net/zorro8390.c
@@ -120,6 +120,9 @@ static int __devinit zorro8390_init_one(struct zorro_dev *z,
120 for (i = ARRAY_SIZE(cards)-1; i >= 0; i--) 120 for (i = ARRAY_SIZE(cards)-1; i >= 0; i--)
121 if (z->id == cards[i].id) 121 if (z->id == cards[i].id)
122 break; 122 break;
123 if (i < 0)
124 return -ENODEV;
125
123 board = z->resource.start; 126 board = z->resource.start;
124 ioaddr = board+cards[i].offset; 127 ioaddr = board+cards[i].offset;
125 dev = alloc_ei_netdev(); 128 dev = alloc_ei_netdev();
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d76c4c85367e..f99bc7f089f1 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -508,7 +508,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
508 return error; 508 return error;
509 } 509 }
510 510
511 return pci_dev->state_saved ? pci_restore_state(pci_dev) : 0; 511 return pci_restore_state(pci_dev);
512} 512}
513 513
514static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) 514static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index dbd0f947f497..7b70312181d7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -846,6 +846,8 @@ pci_restore_state(struct pci_dev *dev)
846 int i; 846 int i;
847 u32 val; 847 u32 val;
848 848
849 if (!dev->state_saved)
850 return 0;
849 /* PCI Express register must be restored first */ 851 /* PCI Express register must be restored first */
850 pci_restore_pcie_state(dev); 852 pci_restore_pcie_state(dev);
851 853
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 749836668655..3f62dd50bbbe 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2135,9 +2135,9 @@ static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
2135 struct dasd_device *base; 2135 struct dasd_device *base;
2136 2136
2137 block = bdev->bd_disk->private_data; 2137 block = bdev->bd_disk->private_data;
2138 base = block->base;
2139 if (!block) 2138 if (!block)
2140 return -ENODEV; 2139 return -ENODEV;
2140 base = block->base;
2141 2141
2142 if (!base->discipline || 2142 if (!base->discipline ||
2143 !base->discipline->fill_geometry) 2143 !base->discipline->fill_geometry)
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 3c57c1a18bb8..d593bc76afe3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -772,10 +772,8 @@ static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch)
772 cdev = io_subchannel_allocate_dev(sch); 772 cdev = io_subchannel_allocate_dev(sch);
773 if (!IS_ERR(cdev)) { 773 if (!IS_ERR(cdev)) {
774 ret = io_subchannel_initialize_dev(sch, cdev); 774 ret = io_subchannel_initialize_dev(sch, cdev);
775 if (ret) { 775 if (ret)
776 kfree(cdev);
777 cdev = ERR_PTR(ret); 776 cdev = ERR_PTR(ret);
778 }
779 } 777 }
780 return cdev; 778 return cdev;
781} 779}
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index f3da592f7bcc..35a13867495e 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -119,6 +119,64 @@ _base_fault_reset_work(struct work_struct *work)
119 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 119 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
120} 120}
121 121
122/**
123 * mpt2sas_base_start_watchdog - start the fault_reset_work_q
124 * @ioc: pointer to scsi command object
125 * Context: sleep.
126 *
127 * Return nothing.
128 */
129void
130mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc)
131{
132 unsigned long flags;
133
134 if (ioc->fault_reset_work_q)
135 return;
136
137 /* initialize fault polling */
138 INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work);
139 snprintf(ioc->fault_reset_work_q_name,
140 sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id);
141 ioc->fault_reset_work_q =
142 create_singlethread_workqueue(ioc->fault_reset_work_q_name);
143 if (!ioc->fault_reset_work_q) {
144 printk(MPT2SAS_ERR_FMT "%s: failed (line=%d)\n",
145 ioc->name, __func__, __LINE__);
146 return;
147 }
148 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
149 if (ioc->fault_reset_work_q)
150 queue_delayed_work(ioc->fault_reset_work_q,
151 &ioc->fault_reset_work,
152 msecs_to_jiffies(FAULT_POLLING_INTERVAL));
153 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
154}
155
156/**
157 * mpt2sas_base_stop_watchdog - stop the fault_reset_work_q
158 * @ioc: pointer to scsi command object
159 * Context: sleep.
160 *
161 * Return nothing.
162 */
163void
164mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc)
165{
166 unsigned long flags;
167 struct workqueue_struct *wq;
168
169 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
170 wq = ioc->fault_reset_work_q;
171 ioc->fault_reset_work_q = NULL;
172 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
173 if (wq) {
174 if (!cancel_delayed_work(&ioc->fault_reset_work))
175 flush_workqueue(wq);
176 destroy_workqueue(wq);
177 }
178}
179
122#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 180#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
123/** 181/**
124 * _base_sas_ioc_info - verbose translation of the ioc status 182 * _base_sas_ioc_info - verbose translation of the ioc status
@@ -440,6 +498,10 @@ _base_sas_log_info(struct MPT2SAS_ADAPTER *ioc , u32 log_info)
440 if (sas_loginfo.dw.bus_type != 3 /*SAS*/) 498 if (sas_loginfo.dw.bus_type != 3 /*SAS*/)
441 return; 499 return;
442 500
501 /* each nexus loss loginfo */
502 if (log_info == 0x31170000)
503 return;
504
443 /* eat the loginfos associated with task aborts */ 505 /* eat the loginfos associated with task aborts */
444 if (ioc->ignore_loginfos && (log_info == 30050000 || log_info == 506 if (ioc->ignore_loginfos && (log_info == 30050000 || log_info ==
445 0x31140000 || log_info == 0x31130000)) 507 0x31140000 || log_info == 0x31130000))
@@ -1109,7 +1171,6 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
1109 } 1171 }
1110 } 1172 }
1111 1173
1112 pci_set_drvdata(pdev, ioc->shost);
1113 _base_mask_interrupts(ioc); 1174 _base_mask_interrupts(ioc);
1114 r = _base_enable_msix(ioc); 1175 r = _base_enable_msix(ioc);
1115 if (r) 1176 if (r)
@@ -1132,7 +1193,6 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
1132 ioc->pci_irq = -1; 1193 ioc->pci_irq = -1;
1133 pci_release_selected_regions(ioc->pdev, ioc->bars); 1194 pci_release_selected_regions(ioc->pdev, ioc->bars);
1134 pci_disable_device(pdev); 1195 pci_disable_device(pdev);
1135 pci_set_drvdata(pdev, NULL);
1136 return r; 1196 return r;
1137} 1197}
1138 1198
@@ -3191,7 +3251,6 @@ mpt2sas_base_free_resources(struct MPT2SAS_ADAPTER *ioc)
3191 ioc->chip_phys = 0; 3251 ioc->chip_phys = 0;
3192 pci_release_selected_regions(ioc->pdev, ioc->bars); 3252 pci_release_selected_regions(ioc->pdev, ioc->bars);
3193 pci_disable_device(pdev); 3253 pci_disable_device(pdev);
3194 pci_set_drvdata(pdev, NULL);
3195 return; 3254 return;
3196} 3255}
3197 3256
@@ -3205,7 +3264,6 @@ int
3205mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) 3264mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3206{ 3265{
3207 int r, i; 3266 int r, i;
3208 unsigned long flags;
3209 3267
3210 dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, 3268 dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
3211 __func__)); 3269 __func__));
@@ -3214,6 +3272,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3214 if (r) 3272 if (r)
3215 return r; 3273 return r;
3216 3274
3275 pci_set_drvdata(ioc->pdev, ioc->shost);
3217 r = _base_make_ioc_ready(ioc, CAN_SLEEP, SOFT_RESET); 3276 r = _base_make_ioc_ready(ioc, CAN_SLEEP, SOFT_RESET);
3218 if (r) 3277 if (r)
3219 goto out_free_resources; 3278 goto out_free_resources;
@@ -3288,23 +3347,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3288 if (r) 3347 if (r)
3289 goto out_free_resources; 3348 goto out_free_resources;
3290 3349
3291 /* initialize fault polling */ 3350 mpt2sas_base_start_watchdog(ioc);
3292 INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work);
3293 snprintf(ioc->fault_reset_work_q_name,
3294 sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id);
3295 ioc->fault_reset_work_q =
3296 create_singlethread_workqueue(ioc->fault_reset_work_q_name);
3297 if (!ioc->fault_reset_work_q) {
3298 printk(MPT2SAS_ERR_FMT "%s: failed (line=%d)\n",
3299 ioc->name, __func__, __LINE__);
3300 goto out_free_resources;
3301 }
3302 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
3303 if (ioc->fault_reset_work_q)
3304 queue_delayed_work(ioc->fault_reset_work_q,
3305 &ioc->fault_reset_work,
3306 msecs_to_jiffies(FAULT_POLLING_INTERVAL));
3307 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
3308 return 0; 3351 return 0;
3309 3352
3310 out_free_resources: 3353 out_free_resources:
@@ -3312,6 +3355,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3312 ioc->remove_host = 1; 3355 ioc->remove_host = 1;
3313 mpt2sas_base_free_resources(ioc); 3356 mpt2sas_base_free_resources(ioc);
3314 _base_release_memory_pools(ioc); 3357 _base_release_memory_pools(ioc);
3358 pci_set_drvdata(ioc->pdev, NULL);
3315 kfree(ioc->tm_cmds.reply); 3359 kfree(ioc->tm_cmds.reply);
3316 kfree(ioc->transport_cmds.reply); 3360 kfree(ioc->transport_cmds.reply);
3317 kfree(ioc->config_cmds.reply); 3361 kfree(ioc->config_cmds.reply);
@@ -3337,22 +3381,14 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3337void 3381void
3338mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc) 3382mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc)
3339{ 3383{
3340 unsigned long flags;
3341 struct workqueue_struct *wq;
3342 3384
3343 dexitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, 3385 dexitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
3344 __func__)); 3386 __func__));
3345 3387
3346 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); 3388 mpt2sas_base_stop_watchdog(ioc);
3347 wq = ioc->fault_reset_work_q;
3348 ioc->fault_reset_work_q = NULL;
3349 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
3350 if (!cancel_delayed_work(&ioc->fault_reset_work))
3351 flush_workqueue(wq);
3352 destroy_workqueue(wq);
3353
3354 mpt2sas_base_free_resources(ioc); 3389 mpt2sas_base_free_resources(ioc);
3355 _base_release_memory_pools(ioc); 3390 _base_release_memory_pools(ioc);
3391 pci_set_drvdata(ioc->pdev, NULL);
3356 kfree(ioc->pfacts); 3392 kfree(ioc->pfacts);
3357 kfree(ioc->ctl_cmds.reply); 3393 kfree(ioc->ctl_cmds.reply);
3358 kfree(ioc->base_cmds.reply); 3394 kfree(ioc->base_cmds.reply);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 286c185fa9e4..acdcff150a35 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -69,10 +69,10 @@
69#define MPT2SAS_DRIVER_NAME "mpt2sas" 69#define MPT2SAS_DRIVER_NAME "mpt2sas"
70#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" 70#define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>"
71#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" 71#define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver"
72#define MPT2SAS_DRIVER_VERSION "01.100.03.00" 72#define MPT2SAS_DRIVER_VERSION "01.100.04.00"
73#define MPT2SAS_MAJOR_VERSION 01 73#define MPT2SAS_MAJOR_VERSION 01
74#define MPT2SAS_MINOR_VERSION 100 74#define MPT2SAS_MINOR_VERSION 100
75#define MPT2SAS_BUILD_VERSION 03 75#define MPT2SAS_BUILD_VERSION 04
76#define MPT2SAS_RELEASE_VERSION 00 76#define MPT2SAS_RELEASE_VERSION 00
77 77
78/* 78/*
@@ -673,6 +673,8 @@ typedef void (*MPT_CALLBACK)(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID,
673 673
674/* base shared API */ 674/* base shared API */
675extern struct list_head mpt2sas_ioc_list; 675extern struct list_head mpt2sas_ioc_list;
676void mpt2sas_base_start_watchdog(struct MPT2SAS_ADAPTER *ioc);
677void mpt2sas_base_stop_watchdog(struct MPT2SAS_ADAPTER *ioc);
676 678
677int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc); 679int mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc);
678void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc); 680void mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc);
diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c
index 58cfb97846f7..6ddee161beb3 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_config.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_config.c
@@ -236,17 +236,25 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
236 Mpi2ConfigRequest_t *config_request; 236 Mpi2ConfigRequest_t *config_request;
237 int r; 237 int r;
238 u8 retry_count; 238 u8 retry_count;
239 u8 issue_reset; 239 u8 issue_host_reset = 0;
240 u16 wait_state_count; 240 u16 wait_state_count;
241 241
242 mutex_lock(&ioc->config_cmds.mutex);
242 if (ioc->config_cmds.status != MPT2_CMD_NOT_USED) { 243 if (ioc->config_cmds.status != MPT2_CMD_NOT_USED) {
243 printk(MPT2SAS_ERR_FMT "%s: config_cmd in use\n", 244 printk(MPT2SAS_ERR_FMT "%s: config_cmd in use\n",
244 ioc->name, __func__); 245 ioc->name, __func__);
246 mutex_unlock(&ioc->config_cmds.mutex);
245 return -EAGAIN; 247 return -EAGAIN;
246 } 248 }
247 retry_count = 0; 249 retry_count = 0;
248 250
249 retry_config: 251 retry_config:
252 if (retry_count) {
253 if (retry_count > 2) /* attempt only 2 retries */
254 return -EFAULT;
255 printk(MPT2SAS_INFO_FMT "%s: attempting retry (%d)\n",
256 ioc->name, __func__, retry_count);
257 }
250 wait_state_count = 0; 258 wait_state_count = 0;
251 ioc_state = mpt2sas_base_get_iocstate(ioc, 1); 259 ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
252 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) { 260 while (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
@@ -254,8 +262,8 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
254 printk(MPT2SAS_ERR_FMT 262 printk(MPT2SAS_ERR_FMT
255 "%s: failed due to ioc not operational\n", 263 "%s: failed due to ioc not operational\n",
256 ioc->name, __func__); 264 ioc->name, __func__);
257 ioc->config_cmds.status = MPT2_CMD_NOT_USED; 265 r = -EFAULT;
258 return -EFAULT; 266 goto out;
259 } 267 }
260 ssleep(1); 268 ssleep(1);
261 ioc_state = mpt2sas_base_get_iocstate(ioc, 1); 269 ioc_state = mpt2sas_base_get_iocstate(ioc, 1);
@@ -271,8 +279,8 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
271 if (!smid) { 279 if (!smid) {
272 printk(MPT2SAS_ERR_FMT "%s: failed obtaining a smid\n", 280 printk(MPT2SAS_ERR_FMT "%s: failed obtaining a smid\n",
273 ioc->name, __func__); 281 ioc->name, __func__);
274 ioc->config_cmds.status = MPT2_CMD_NOT_USED; 282 r = -EAGAIN;
275 return -EAGAIN; 283 goto out;
276 } 284 }
277 285
278 r = 0; 286 r = 0;
@@ -292,9 +300,15 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
292 ioc->name, __func__); 300 ioc->name, __func__);
293 _debug_dump_mf(mpi_request, 301 _debug_dump_mf(mpi_request,
294 sizeof(Mpi2ConfigRequest_t)/4); 302 sizeof(Mpi2ConfigRequest_t)/4);
295 if (!(ioc->config_cmds.status & MPT2_CMD_RESET)) 303 retry_count++;
296 issue_reset = 1; 304 if (ioc->config_cmds.smid == smid)
297 goto issue_host_reset; 305 mpt2sas_base_free_smid(ioc, smid);
306 if ((ioc->shost_recovery) ||
307 (ioc->config_cmds.status & MPT2_CMD_RESET))
308 goto retry_config;
309 issue_host_reset = 1;
310 r = -EFAULT;
311 goto out;
298 } 312 }
299 if (ioc->config_cmds.status & MPT2_CMD_REPLY_VALID) 313 if (ioc->config_cmds.status & MPT2_CMD_REPLY_VALID)
300 memcpy(mpi_reply, ioc->config_cmds.reply, 314 memcpy(mpi_reply, ioc->config_cmds.reply,
@@ -302,21 +316,13 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
302 if (retry_count) 316 if (retry_count)
303 printk(MPT2SAS_INFO_FMT "%s: retry completed!!\n", 317 printk(MPT2SAS_INFO_FMT "%s: retry completed!!\n",
304 ioc->name, __func__); 318 ioc->name, __func__);
319out:
305 ioc->config_cmds.status = MPT2_CMD_NOT_USED; 320 ioc->config_cmds.status = MPT2_CMD_NOT_USED;
306 return r; 321 mutex_unlock(&ioc->config_cmds.mutex);
307 322 if (issue_host_reset)
308 issue_host_reset:
309 if (issue_reset)
310 mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, 323 mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP,
311 FORCE_BIG_HAMMER); 324 FORCE_BIG_HAMMER);
312 ioc->config_cmds.status = MPT2_CMD_NOT_USED; 325 return r;
313 if (!retry_count) {
314 printk(MPT2SAS_INFO_FMT "%s: attempting retry\n",
315 ioc->name, __func__);
316 retry_count++;
317 goto retry_config;
318 }
319 return -EFAULT;
320} 326}
321 327
322/** 328/**
@@ -375,7 +381,6 @@ mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
375 int r; 381 int r;
376 struct config_request mem; 382 struct config_request mem;
377 383
378 mutex_lock(&ioc->config_cmds.mutex);
379 memset(config_page, 0, sizeof(Mpi2ManufacturingPage0_t)); 384 memset(config_page, 0, sizeof(Mpi2ManufacturingPage0_t));
380 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 385 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
381 mpi_request.Function = MPI2_FUNCTION_CONFIG; 386 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -417,7 +422,6 @@ mpt2sas_config_get_manufacturing_pg0(struct MPT2SAS_ADAPTER *ioc,
417 _config_free_config_dma_memory(ioc, &mem); 422 _config_free_config_dma_memory(ioc, &mem);
418 423
419 out: 424 out:
420 mutex_unlock(&ioc->config_cmds.mutex);
421 return r; 425 return r;
422} 426}
423 427
@@ -438,7 +442,6 @@ mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc,
438 int r; 442 int r;
439 struct config_request mem; 443 struct config_request mem;
440 444
441 mutex_lock(&ioc->config_cmds.mutex);
442 memset(config_page, 0, sizeof(Mpi2BiosPage2_t)); 445 memset(config_page, 0, sizeof(Mpi2BiosPage2_t));
443 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 446 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
444 mpi_request.Function = MPI2_FUNCTION_CONFIG; 447 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -480,7 +483,6 @@ mpt2sas_config_get_bios_pg2(struct MPT2SAS_ADAPTER *ioc,
480 _config_free_config_dma_memory(ioc, &mem); 483 _config_free_config_dma_memory(ioc, &mem);
481 484
482 out: 485 out:
483 mutex_unlock(&ioc->config_cmds.mutex);
484 return r; 486 return r;
485} 487}
486 488
@@ -501,7 +503,6 @@ mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
501 int r; 503 int r;
502 struct config_request mem; 504 struct config_request mem;
503 505
504 mutex_lock(&ioc->config_cmds.mutex);
505 memset(config_page, 0, sizeof(Mpi2BiosPage3_t)); 506 memset(config_page, 0, sizeof(Mpi2BiosPage3_t));
506 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 507 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
507 mpi_request.Function = MPI2_FUNCTION_CONFIG; 508 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -543,7 +544,6 @@ mpt2sas_config_get_bios_pg3(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
543 _config_free_config_dma_memory(ioc, &mem); 544 _config_free_config_dma_memory(ioc, &mem);
544 545
545 out: 546 out:
546 mutex_unlock(&ioc->config_cmds.mutex);
547 return r; 547 return r;
548} 548}
549 549
@@ -564,7 +564,6 @@ mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc,
564 int r; 564 int r;
565 struct config_request mem; 565 struct config_request mem;
566 566
567 mutex_lock(&ioc->config_cmds.mutex);
568 memset(config_page, 0, sizeof(Mpi2IOUnitPage0_t)); 567 memset(config_page, 0, sizeof(Mpi2IOUnitPage0_t));
569 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 568 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
570 mpi_request.Function = MPI2_FUNCTION_CONFIG; 569 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -606,7 +605,6 @@ mpt2sas_config_get_iounit_pg0(struct MPT2SAS_ADAPTER *ioc,
606 _config_free_config_dma_memory(ioc, &mem); 605 _config_free_config_dma_memory(ioc, &mem);
607 606
608 out: 607 out:
609 mutex_unlock(&ioc->config_cmds.mutex);
610 return r; 608 return r;
611} 609}
612 610
@@ -627,7 +625,6 @@ mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
627 int r; 625 int r;
628 struct config_request mem; 626 struct config_request mem;
629 627
630 mutex_lock(&ioc->config_cmds.mutex);
631 memset(config_page, 0, sizeof(Mpi2IOUnitPage1_t)); 628 memset(config_page, 0, sizeof(Mpi2IOUnitPage1_t));
632 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 629 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
633 mpi_request.Function = MPI2_FUNCTION_CONFIG; 630 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -669,7 +666,6 @@ mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
669 _config_free_config_dma_memory(ioc, &mem); 666 _config_free_config_dma_memory(ioc, &mem);
670 667
671 out: 668 out:
672 mutex_unlock(&ioc->config_cmds.mutex);
673 return r; 669 return r;
674} 670}
675 671
@@ -690,7 +686,6 @@ mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
690 int r; 686 int r;
691 struct config_request mem; 687 struct config_request mem;
692 688
693 mutex_lock(&ioc->config_cmds.mutex);
694 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 689 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
695 mpi_request.Function = MPI2_FUNCTION_CONFIG; 690 mpi_request.Function = MPI2_FUNCTION_CONFIG;
696 mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; 691 mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
@@ -732,7 +727,6 @@ mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc,
732 _config_free_config_dma_memory(ioc, &mem); 727 _config_free_config_dma_memory(ioc, &mem);
733 728
734 out: 729 out:
735 mutex_unlock(&ioc->config_cmds.mutex);
736 return r; 730 return r;
737} 731}
738 732
@@ -753,7 +747,6 @@ mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc,
753 int r; 747 int r;
754 struct config_request mem; 748 struct config_request mem;
755 749
756 mutex_lock(&ioc->config_cmds.mutex);
757 memset(config_page, 0, sizeof(Mpi2IOCPage8_t)); 750 memset(config_page, 0, sizeof(Mpi2IOCPage8_t));
758 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 751 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
759 mpi_request.Function = MPI2_FUNCTION_CONFIG; 752 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -795,7 +788,6 @@ mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc,
795 _config_free_config_dma_memory(ioc, &mem); 788 _config_free_config_dma_memory(ioc, &mem);
796 789
797 out: 790 out:
798 mutex_unlock(&ioc->config_cmds.mutex);
799 return r; 791 return r;
800} 792}
801 793
@@ -818,7 +810,6 @@ mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
818 int r; 810 int r;
819 struct config_request mem; 811 struct config_request mem;
820 812
821 mutex_lock(&ioc->config_cmds.mutex);
822 memset(config_page, 0, sizeof(Mpi2SasDevicePage0_t)); 813 memset(config_page, 0, sizeof(Mpi2SasDevicePage0_t));
823 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 814 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
824 mpi_request.Function = MPI2_FUNCTION_CONFIG; 815 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -863,7 +854,6 @@ mpt2sas_config_get_sas_device_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
863 _config_free_config_dma_memory(ioc, &mem); 854 _config_free_config_dma_memory(ioc, &mem);
864 855
865 out: 856 out:
866 mutex_unlock(&ioc->config_cmds.mutex);
867 return r; 857 return r;
868} 858}
869 859
@@ -886,7 +876,6 @@ mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
886 int r; 876 int r;
887 struct config_request mem; 877 struct config_request mem;
888 878
889 mutex_lock(&ioc->config_cmds.mutex);
890 memset(config_page, 0, sizeof(Mpi2SasDevicePage1_t)); 879 memset(config_page, 0, sizeof(Mpi2SasDevicePage1_t));
891 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 880 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
892 mpi_request.Function = MPI2_FUNCTION_CONFIG; 881 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -931,7 +920,6 @@ mpt2sas_config_get_sas_device_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
931 _config_free_config_dma_memory(ioc, &mem); 920 _config_free_config_dma_memory(ioc, &mem);
932 921
933 out: 922 out:
934 mutex_unlock(&ioc->config_cmds.mutex);
935 return r; 923 return r;
936} 924}
937 925
@@ -953,7 +941,6 @@ mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys)
953 Mpi2ConfigReply_t mpi_reply; 941 Mpi2ConfigReply_t mpi_reply;
954 Mpi2SasIOUnitPage0_t config_page; 942 Mpi2SasIOUnitPage0_t config_page;
955 943
956 mutex_lock(&ioc->config_cmds.mutex);
957 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 944 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
958 mpi_request.Function = MPI2_FUNCTION_CONFIG; 945 mpi_request.Function = MPI2_FUNCTION_CONFIG;
959 mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER; 946 mpi_request.Action = MPI2_CONFIG_ACTION_PAGE_HEADER;
@@ -1002,7 +989,6 @@ mpt2sas_config_get_number_hba_phys(struct MPT2SAS_ADAPTER *ioc, u8 *num_phys)
1002 _config_free_config_dma_memory(ioc, &mem); 989 _config_free_config_dma_memory(ioc, &mem);
1003 990
1004 out: 991 out:
1005 mutex_unlock(&ioc->config_cmds.mutex);
1006 return r; 992 return r;
1007} 993}
1008 994
@@ -1026,8 +1012,6 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1026 Mpi2ConfigRequest_t mpi_request; 1012 Mpi2ConfigRequest_t mpi_request;
1027 int r; 1013 int r;
1028 struct config_request mem; 1014 struct config_request mem;
1029
1030 mutex_lock(&ioc->config_cmds.mutex);
1031 memset(config_page, 0, sz); 1015 memset(config_page, 0, sz);
1032 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1016 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1033 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1017 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1070,7 +1054,6 @@ mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1070 _config_free_config_dma_memory(ioc, &mem); 1054 _config_free_config_dma_memory(ioc, &mem);
1071 1055
1072 out: 1056 out:
1073 mutex_unlock(&ioc->config_cmds.mutex);
1074 return r; 1057 return r;
1075} 1058}
1076 1059
@@ -1095,7 +1078,6 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1095 int r; 1078 int r;
1096 struct config_request mem; 1079 struct config_request mem;
1097 1080
1098 mutex_lock(&ioc->config_cmds.mutex);
1099 memset(config_page, 0, sz); 1081 memset(config_page, 0, sz);
1100 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1082 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1101 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1083 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1138,7 +1120,6 @@ mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1138 _config_free_config_dma_memory(ioc, &mem); 1120 _config_free_config_dma_memory(ioc, &mem);
1139 1121
1140 out: 1122 out:
1141 mutex_unlock(&ioc->config_cmds.mutex);
1142 return r; 1123 return r;
1143} 1124}
1144 1125
@@ -1161,7 +1142,6 @@ mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1161 int r; 1142 int r;
1162 struct config_request mem; 1143 struct config_request mem;
1163 1144
1164 mutex_lock(&ioc->config_cmds.mutex);
1165 memset(config_page, 0, sizeof(Mpi2ExpanderPage0_t)); 1145 memset(config_page, 0, sizeof(Mpi2ExpanderPage0_t));
1166 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1146 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1167 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1147 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1206,7 +1186,6 @@ mpt2sas_config_get_expander_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1206 _config_free_config_dma_memory(ioc, &mem); 1186 _config_free_config_dma_memory(ioc, &mem);
1207 1187
1208 out: 1188 out:
1209 mutex_unlock(&ioc->config_cmds.mutex);
1210 return r; 1189 return r;
1211} 1190}
1212 1191
@@ -1230,7 +1209,6 @@ mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1230 int r; 1209 int r;
1231 struct config_request mem; 1210 struct config_request mem;
1232 1211
1233 mutex_lock(&ioc->config_cmds.mutex);
1234 memset(config_page, 0, sizeof(Mpi2ExpanderPage1_t)); 1212 memset(config_page, 0, sizeof(Mpi2ExpanderPage1_t));
1235 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1213 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1236 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1214 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1277,7 +1255,6 @@ mpt2sas_config_get_expander_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1277 _config_free_config_dma_memory(ioc, &mem); 1255 _config_free_config_dma_memory(ioc, &mem);
1278 1256
1279 out: 1257 out:
1280 mutex_unlock(&ioc->config_cmds.mutex);
1281 return r; 1258 return r;
1282} 1259}
1283 1260
@@ -1300,7 +1277,6 @@ mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1300 int r; 1277 int r;
1301 struct config_request mem; 1278 struct config_request mem;
1302 1279
1303 mutex_lock(&ioc->config_cmds.mutex);
1304 memset(config_page, 0, sizeof(Mpi2SasEnclosurePage0_t)); 1280 memset(config_page, 0, sizeof(Mpi2SasEnclosurePage0_t));
1305 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1281 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1306 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1282 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1345,7 +1321,6 @@ mpt2sas_config_get_enclosure_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1345 _config_free_config_dma_memory(ioc, &mem); 1321 _config_free_config_dma_memory(ioc, &mem);
1346 1322
1347 out: 1323 out:
1348 mutex_unlock(&ioc->config_cmds.mutex);
1349 return r; 1324 return r;
1350} 1325}
1351 1326
@@ -1367,7 +1342,6 @@ mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1367 int r; 1342 int r;
1368 struct config_request mem; 1343 struct config_request mem;
1369 1344
1370 mutex_lock(&ioc->config_cmds.mutex);
1371 memset(config_page, 0, sizeof(Mpi2SasPhyPage0_t)); 1345 memset(config_page, 0, sizeof(Mpi2SasPhyPage0_t));
1372 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1346 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1373 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1347 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1413,7 +1387,6 @@ mpt2sas_config_get_phy_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1413 _config_free_config_dma_memory(ioc, &mem); 1387 _config_free_config_dma_memory(ioc, &mem);
1414 1388
1415 out: 1389 out:
1416 mutex_unlock(&ioc->config_cmds.mutex);
1417 return r; 1390 return r;
1418} 1391}
1419 1392
@@ -1435,7 +1408,6 @@ mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1435 int r; 1408 int r;
1436 struct config_request mem; 1409 struct config_request mem;
1437 1410
1438 mutex_lock(&ioc->config_cmds.mutex);
1439 memset(config_page, 0, sizeof(Mpi2SasPhyPage1_t)); 1411 memset(config_page, 0, sizeof(Mpi2SasPhyPage1_t));
1440 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1412 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1441 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1413 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1481,7 +1453,6 @@ mpt2sas_config_get_phy_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1481 _config_free_config_dma_memory(ioc, &mem); 1453 _config_free_config_dma_memory(ioc, &mem);
1482 1454
1483 out: 1455 out:
1484 mutex_unlock(&ioc->config_cmds.mutex);
1485 return r; 1456 return r;
1486} 1457}
1487 1458
@@ -1505,7 +1476,6 @@ mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc,
1505 int r; 1476 int r;
1506 struct config_request mem; 1477 struct config_request mem;
1507 1478
1508 mutex_lock(&ioc->config_cmds.mutex);
1509 memset(config_page, 0, sizeof(Mpi2RaidVolPage1_t)); 1479 memset(config_page, 0, sizeof(Mpi2RaidVolPage1_t));
1510 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1480 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1511 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1481 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1548,7 +1518,6 @@ mpt2sas_config_get_raid_volume_pg1(struct MPT2SAS_ADAPTER *ioc,
1548 _config_free_config_dma_memory(ioc, &mem); 1518 _config_free_config_dma_memory(ioc, &mem);
1549 1519
1550 out: 1520 out:
1551 mutex_unlock(&ioc->config_cmds.mutex);
1552 return r; 1521 return r;
1553} 1522}
1554 1523
@@ -1572,7 +1541,6 @@ mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle,
1572 struct config_request mem; 1541 struct config_request mem;
1573 u16 ioc_status; 1542 u16 ioc_status;
1574 1543
1575 mutex_lock(&ioc->config_cmds.mutex);
1576 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1544 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1577 *num_pds = 0; 1545 *num_pds = 0;
1578 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1546 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1620,7 +1588,6 @@ mpt2sas_config_get_number_pds(struct MPT2SAS_ADAPTER *ioc, u16 handle,
1620 _config_free_config_dma_memory(ioc, &mem); 1588 _config_free_config_dma_memory(ioc, &mem);
1621 1589
1622 out: 1590 out:
1623 mutex_unlock(&ioc->config_cmds.mutex);
1624 return r; 1591 return r;
1625} 1592}
1626 1593
@@ -1645,7 +1612,6 @@ mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc,
1645 int r; 1612 int r;
1646 struct config_request mem; 1613 struct config_request mem;
1647 1614
1648 mutex_lock(&ioc->config_cmds.mutex);
1649 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1615 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1650 memset(config_page, 0, sz); 1616 memset(config_page, 0, sz);
1651 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1617 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1687,7 +1653,6 @@ mpt2sas_config_get_raid_volume_pg0(struct MPT2SAS_ADAPTER *ioc,
1687 _config_free_config_dma_memory(ioc, &mem); 1653 _config_free_config_dma_memory(ioc, &mem);
1688 1654
1689 out: 1655 out:
1690 mutex_unlock(&ioc->config_cmds.mutex);
1691 return r; 1656 return r;
1692} 1657}
1693 1658
@@ -1711,7 +1676,6 @@ mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1711 int r; 1676 int r;
1712 struct config_request mem; 1677 struct config_request mem;
1713 1678
1714 mutex_lock(&ioc->config_cmds.mutex);
1715 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1679 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1716 memset(config_page, 0, sizeof(Mpi2RaidPhysDiskPage0_t)); 1680 memset(config_page, 0, sizeof(Mpi2RaidPhysDiskPage0_t));
1717 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1681 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1754,7 +1718,6 @@ mpt2sas_config_get_phys_disk_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
1754 _config_free_config_dma_memory(ioc, &mem); 1718 _config_free_config_dma_memory(ioc, &mem);
1755 1719
1756 out: 1720 out:
1757 mutex_unlock(&ioc->config_cmds.mutex);
1758 return r; 1721 return r;
1759} 1722}
1760 1723
@@ -1778,7 +1741,6 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
1778 struct config_request mem; 1741 struct config_request mem;
1779 u16 ioc_status; 1742 u16 ioc_status;
1780 1743
1781 mutex_lock(&ioc->config_cmds.mutex);
1782 *volume_handle = 0; 1744 *volume_handle = 0;
1783 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t)); 1745 memset(&mpi_request, 0, sizeof(Mpi2ConfigRequest_t));
1784 mpi_request.Function = MPI2_FUNCTION_CONFIG; 1746 mpi_request.Function = MPI2_FUNCTION_CONFIG;
@@ -1842,7 +1804,6 @@ mpt2sas_config_get_volume_handle(struct MPT2SAS_ADAPTER *ioc, u16 pd_handle,
1842 _config_free_config_dma_memory(ioc, &mem); 1804 _config_free_config_dma_memory(ioc, &mem);
1843 1805
1844 out: 1806 out:
1845 mutex_unlock(&ioc->config_cmds.mutex);
1846 return r; 1807 return r;
1847} 1808}
1848 1809
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 2a01a5f2a84d..2e9a4445596f 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -2767,6 +2767,10 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
2767 char *desc_ioc_state = NULL; 2767 char *desc_ioc_state = NULL;
2768 char *desc_scsi_status = NULL; 2768 char *desc_scsi_status = NULL;
2769 char *desc_scsi_state = ioc->tmp_string; 2769 char *desc_scsi_state = ioc->tmp_string;
2770 u32 log_info = le32_to_cpu(mpi_reply->IOCLogInfo);
2771
2772 if (log_info == 0x31170000)
2773 return;
2770 2774
2771 switch (ioc_status) { 2775 switch (ioc_status) {
2772 case MPI2_IOCSTATUS_SUCCESS: 2776 case MPI2_IOCSTATUS_SUCCESS:
@@ -3426,7 +3430,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
3426 __le64 sas_address; 3430 __le64 sas_address;
3427 int i; 3431 int i;
3428 unsigned long flags; 3432 unsigned long flags;
3429 struct _sas_port *mpt2sas_port; 3433 struct _sas_port *mpt2sas_port = NULL;
3430 int rc = 0; 3434 int rc = 0;
3431 3435
3432 if (!handle) 3436 if (!handle)
@@ -3518,12 +3522,20 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
3518 &expander_pg1, i, handle))) { 3522 &expander_pg1, i, handle))) {
3519 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", 3523 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
3520 ioc->name, __FILE__, __LINE__, __func__); 3524 ioc->name, __FILE__, __LINE__, __func__);
3521 continue; 3525 rc = -1;
3526 goto out_fail;
3522 } 3527 }
3523 sas_expander->phy[i].handle = handle; 3528 sas_expander->phy[i].handle = handle;
3524 sas_expander->phy[i].phy_id = i; 3529 sas_expander->phy[i].phy_id = i;
3525 mpt2sas_transport_add_expander_phy(ioc, &sas_expander->phy[i], 3530
3526 expander_pg1, sas_expander->parent_dev); 3531 if ((mpt2sas_transport_add_expander_phy(ioc,
3532 &sas_expander->phy[i], expander_pg1,
3533 sas_expander->parent_dev))) {
3534 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
3535 ioc->name, __FILE__, __LINE__, __func__);
3536 rc = -1;
3537 goto out_fail;
3538 }
3527 } 3539 }
3528 3540
3529 if (sas_expander->enclosure_handle) { 3541 if (sas_expander->enclosure_handle) {
@@ -3540,8 +3552,9 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
3540 3552
3541 out_fail: 3553 out_fail:
3542 3554
3543 if (sas_expander) 3555 if (mpt2sas_port)
3544 kfree(sas_expander->phy); 3556 mpt2sas_transport_port_remove(ioc, sas_expander->sas_address,
3557 sas_expander->parent_handle);
3545 kfree(sas_expander); 3558 kfree(sas_expander);
3546 return rc; 3559 return rc;
3547} 3560}
@@ -3663,12 +3676,11 @@ _scsih_add_device(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 phy_num, u8 is_pd)
3663 sas_device->hidden_raid_component = is_pd; 3676 sas_device->hidden_raid_component = is_pd;
3664 3677
3665 /* get enclosure_logical_id */ 3678 /* get enclosure_logical_id */
3666 if (!(mpt2sas_config_get_enclosure_pg0(ioc, &mpi_reply, &enclosure_pg0, 3679 if (sas_device->enclosure_handle && !(mpt2sas_config_get_enclosure_pg0(
3667 MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, 3680 ioc, &mpi_reply, &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE,
3668 sas_device->enclosure_handle))) { 3681 sas_device->enclosure_handle)))
3669 sas_device->enclosure_logical_id = 3682 sas_device->enclosure_logical_id =
3670 le64_to_cpu(enclosure_pg0.EnclosureLogicalID); 3683 le64_to_cpu(enclosure_pg0.EnclosureLogicalID);
3671 }
3672 3684
3673 /* get device name */ 3685 /* get device name */
3674 sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName); 3686 sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName);
@@ -4250,12 +4262,6 @@ _scsih_sas_volume_add(struct MPT2SAS_ADAPTER *ioc,
4250 u16 handle = le16_to_cpu(element->VolDevHandle); 4262 u16 handle = le16_to_cpu(element->VolDevHandle);
4251 int rc; 4263 int rc;
4252 4264
4253#if 0 /* RAID_HACKS */
4254 if (le32_to_cpu(event_data->Flags) &
4255 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG)
4256 return;
4257#endif
4258
4259 mpt2sas_config_get_volume_wwid(ioc, handle, &wwid); 4265 mpt2sas_config_get_volume_wwid(ioc, handle, &wwid);
4260 if (!wwid) { 4266 if (!wwid) {
4261 printk(MPT2SAS_ERR_FMT 4267 printk(MPT2SAS_ERR_FMT
@@ -4310,12 +4316,6 @@ _scsih_sas_volume_delete(struct MPT2SAS_ADAPTER *ioc,
4310 unsigned long flags; 4316 unsigned long flags;
4311 struct MPT2SAS_TARGET *sas_target_priv_data; 4317 struct MPT2SAS_TARGET *sas_target_priv_data;
4312 4318
4313#if 0 /* RAID_HACKS */
4314 if (le32_to_cpu(event_data->Flags) &
4315 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG)
4316 return;
4317#endif
4318
4319 spin_lock_irqsave(&ioc->raid_device_lock, flags); 4319 spin_lock_irqsave(&ioc->raid_device_lock, flags);
4320 raid_device = _scsih_raid_device_find_by_handle(ioc, handle); 4320 raid_device = _scsih_raid_device_find_by_handle(ioc, handle);
4321 spin_unlock_irqrestore(&ioc->raid_device_lock, flags); 4321 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
@@ -4428,14 +4428,38 @@ _scsih_sas_pd_add(struct MPT2SAS_ADAPTER *ioc,
4428 struct _sas_device *sas_device; 4428 struct _sas_device *sas_device;
4429 unsigned long flags; 4429 unsigned long flags;
4430 u16 handle = le16_to_cpu(element->PhysDiskDevHandle); 4430 u16 handle = le16_to_cpu(element->PhysDiskDevHandle);
4431 Mpi2ConfigReply_t mpi_reply;
4432 Mpi2SasDevicePage0_t sas_device_pg0;
4433 u32 ioc_status;
4431 4434
4432 spin_lock_irqsave(&ioc->sas_device_lock, flags); 4435 spin_lock_irqsave(&ioc->sas_device_lock, flags);
4433 sas_device = _scsih_sas_device_find_by_handle(ioc, handle); 4436 sas_device = _scsih_sas_device_find_by_handle(ioc, handle);
4434 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 4437 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
4435 if (sas_device) 4438 if (sas_device) {
4436 sas_device->hidden_raid_component = 1; 4439 sas_device->hidden_raid_component = 1;
4437 else 4440 return;
4438 _scsih_add_device(ioc, handle, 0, 1); 4441 }
4442
4443 if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
4444 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
4445 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4446 ioc->name, __FILE__, __LINE__, __func__);
4447 return;
4448 }
4449
4450 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
4451 MPI2_IOCSTATUS_MASK;
4452 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
4453 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4454 ioc->name, __FILE__, __LINE__, __func__);
4455 return;
4456 }
4457
4458 _scsih_link_change(ioc,
4459 le16_to_cpu(sas_device_pg0.ParentDevHandle),
4460 handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
4461
4462 _scsih_add_device(ioc, handle, 0, 1);
4439} 4463}
4440 4464
4441#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4465#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
@@ -4535,12 +4559,15 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4535{ 4559{
4536 Mpi2EventIrConfigElement_t *element; 4560 Mpi2EventIrConfigElement_t *element;
4537 int i; 4561 int i;
4562 u8 foreign_config;
4538 4563
4539#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4564#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4540 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 4565 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
4541 _scsih_sas_ir_config_change_event_debug(ioc, event_data); 4566 _scsih_sas_ir_config_change_event_debug(ioc, event_data);
4542 4567
4543#endif 4568#endif
4569 foreign_config = (le32_to_cpu(event_data->Flags) &
4570 MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0;
4544 4571
4545 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; 4572 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
4546 for (i = 0; i < event_data->NumElements; i++, element++) { 4573 for (i = 0; i < event_data->NumElements; i++, element++) {
@@ -4548,11 +4575,13 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4548 switch (element->ReasonCode) { 4575 switch (element->ReasonCode) {
4549 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED: 4576 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_CREATED:
4550 case MPI2_EVENT_IR_CHANGE_RC_ADDED: 4577 case MPI2_EVENT_IR_CHANGE_RC_ADDED:
4551 _scsih_sas_volume_add(ioc, element); 4578 if (!foreign_config)
4579 _scsih_sas_volume_add(ioc, element);
4552 break; 4580 break;
4553 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED: 4581 case MPI2_EVENT_IR_CHANGE_RC_VOLUME_DELETED:
4554 case MPI2_EVENT_IR_CHANGE_RC_REMOVED: 4582 case MPI2_EVENT_IR_CHANGE_RC_REMOVED:
4555 _scsih_sas_volume_delete(ioc, element); 4583 if (!foreign_config)
4584 _scsih_sas_volume_delete(ioc, element);
4556 break; 4585 break;
4557 case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED: 4586 case MPI2_EVENT_IR_CHANGE_RC_PD_CREATED:
4558 _scsih_sas_pd_hide(ioc, element); 4587 _scsih_sas_pd_hide(ioc, element);
@@ -4671,6 +4700,9 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4671 u32 state; 4700 u32 state;
4672 struct _sas_device *sas_device; 4701 struct _sas_device *sas_device;
4673 unsigned long flags; 4702 unsigned long flags;
4703 Mpi2ConfigReply_t mpi_reply;
4704 Mpi2SasDevicePage0_t sas_device_pg0;
4705 u32 ioc_status;
4674 4706
4675 if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED) 4707 if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED)
4676 return; 4708 return;
@@ -4687,22 +4719,40 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4687 spin_unlock_irqrestore(&ioc->sas_device_lock, flags); 4719 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
4688 4720
4689 switch (state) { 4721 switch (state) {
4690#if 0
4691 case MPI2_RAID_PD_STATE_OFFLINE:
4692 if (sas_device)
4693 _scsih_remove_device(ioc, handle);
4694 break;
4695#endif
4696 case MPI2_RAID_PD_STATE_ONLINE: 4722 case MPI2_RAID_PD_STATE_ONLINE:
4697 case MPI2_RAID_PD_STATE_DEGRADED: 4723 case MPI2_RAID_PD_STATE_DEGRADED:
4698 case MPI2_RAID_PD_STATE_REBUILDING: 4724 case MPI2_RAID_PD_STATE_REBUILDING:
4699 case MPI2_RAID_PD_STATE_OPTIMAL: 4725 case MPI2_RAID_PD_STATE_OPTIMAL:
4700 if (sas_device) 4726 if (sas_device) {
4701 sas_device->hidden_raid_component = 1; 4727 sas_device->hidden_raid_component = 1;
4702 else 4728 return;
4703 _scsih_add_device(ioc, handle, 0, 1); 4729 }
4730
4731 if ((mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply,
4732 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
4733 handle))) {
4734 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4735 ioc->name, __FILE__, __LINE__, __func__);
4736 return;
4737 }
4738
4739 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
4740 MPI2_IOCSTATUS_MASK;
4741 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
4742 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
4743 ioc->name, __FILE__, __LINE__, __func__);
4744 return;
4745 }
4746
4747 _scsih_link_change(ioc,
4748 le16_to_cpu(sas_device_pg0.ParentDevHandle),
4749 handle, sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
4750
4751 _scsih_add_device(ioc, handle, 0, 1);
4752
4704 break; 4753 break;
4705 4754
4755 case MPI2_RAID_PD_STATE_OFFLINE:
4706 case MPI2_RAID_PD_STATE_NOT_CONFIGURED: 4756 case MPI2_RAID_PD_STATE_NOT_CONFIGURED:
4707 case MPI2_RAID_PD_STATE_NOT_COMPATIBLE: 4757 case MPI2_RAID_PD_STATE_NOT_COMPATIBLE:
4708 case MPI2_RAID_PD_STATE_HOT_SPARE: 4758 case MPI2_RAID_PD_STATE_HOT_SPARE:
@@ -5774,6 +5824,7 @@ _scsih_suspend(struct pci_dev *pdev, pm_message_t state)
5774 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); 5824 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
5775 u32 device_state; 5825 u32 device_state;
5776 5826
5827 mpt2sas_base_stop_watchdog(ioc);
5777 flush_scheduled_work(); 5828 flush_scheduled_work();
5778 scsi_block_requests(shost); 5829 scsi_block_requests(shost);
5779 device_state = pci_choose_state(pdev, state); 5830 device_state = pci_choose_state(pdev, state);
@@ -5816,6 +5867,7 @@ _scsih_resume(struct pci_dev *pdev)
5816 5867
5817 mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET); 5868 mpt2sas_base_hard_reset_handler(ioc, CAN_SLEEP, SOFT_RESET);
5818 scsi_unblock_requests(shost); 5869 scsi_unblock_requests(shost);
5870 mpt2sas_base_start_watchdog(ioc);
5819 return 0; 5871 return 0;
5820} 5872}
5821#endif /* CONFIG_PM */ 5873#endif /* CONFIG_PM */
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index e0d44af4745a..3f3119d760db 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -111,29 +111,32 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi,
111 unsigned int bpw; 111 unsigned int bpw;
112 unsigned int hz; 112 unsigned int hz;
113 unsigned int div; 113 unsigned int div;
114 unsigned long clk;
114 115
115 bpw = t ? t->bits_per_word : spi->bits_per_word; 116 bpw = t ? t->bits_per_word : spi->bits_per_word;
116 hz = t ? t->speed_hz : spi->max_speed_hz; 117 hz = t ? t->speed_hz : spi->max_speed_hz;
117 118
119 if (!bpw)
120 bpw = 8;
121
122 if (!hz)
123 hz = spi->max_speed_hz;
124
118 if (bpw != 8) { 125 if (bpw != 8) {
119 dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); 126 dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw);
120 return -EINVAL; 127 return -EINVAL;
121 } 128 }
122 129
123 div = clk_get_rate(hw->clk) / hz; 130 clk = clk_get_rate(hw->clk);
124 131 div = DIV_ROUND_UP(clk, hz * 2) - 1;
125 /* is clk = pclk / (2 * (pre+1)), or is it
126 * clk = (pclk * 2) / ( pre + 1) */
127
128 div /= 2;
129
130 if (div > 0)
131 div -= 1;
132 132
133 if (div > 255) 133 if (div > 255)
134 div = 255; 134 div = 255;
135 135
136 dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", div, hz); 136 dev_dbg(&spi->dev, "setting pre-scaler to %d (wanted %d, got %ld)\n",
137 div, hz, clk / (2 * (div + 1)));
138
139
137 writeb(div, hw->regs + S3C2410_SPPRE); 140 writeb(div, hw->regs + S3C2410_SPPRE);
138 141
139 spin_lock(&hw->bitbang.lock); 142 spin_lock(&hw->bitbang.lock);
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 8f24564f77b0..07f22b625632 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -481,6 +481,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
481 /* tell the board code to enable the panel */ 481 /* tell the board code to enable the panel */
482 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { 482 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
483 ch = &priv->ch[k]; 483 ch = &priv->ch[k];
484 if (!ch->enabled)
485 continue;
486
484 board_cfg = &ch->cfg.board_cfg; 487 board_cfg = &ch->cfg.board_cfg;
485 if (board_cfg->display_on) 488 if (board_cfg->display_on)
486 board_cfg->display_on(board_cfg->board_data); 489 board_cfg->display_on(board_cfg->board_data);
@@ -498,6 +501,8 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
498 /* clean up deferred io and ask board code to disable panel */ 501 /* clean up deferred io and ask board code to disable panel */
499 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { 502 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
500 ch = &priv->ch[k]; 503 ch = &priv->ch[k];
504 if (!ch->enabled)
505 continue;
501 506
502 /* deferred io mode: 507 /* deferred io mode:
503 * flush frame, and wait for frame end interrupt 508 * flush frame, and wait for frame end interrupt
diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
index 3fe9742c23ca..2f8643efe92c 100644
--- a/drivers/watchdog/ar7_wdt.c
+++ b/drivers/watchdog/ar7_wdt.c
@@ -37,7 +37,7 @@
37#include <linux/uaccess.h> 37#include <linux/uaccess.h>
38 38
39#include <asm/addrspace.h> 39#include <asm/addrspace.h>
40#include <asm/ar7/ar7.h> 40#include <asm/mach-ar7/ar7.h>
41 41
42#define DRVNAME "ar7_wdt" 42#define DRVNAME "ar7_wdt"
43#define LONGNAME "TI AR7 Watchdog Timer" 43#define LONGNAME "TI AR7 Watchdog Timer"
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 272b9b2bea86..59cba180fe83 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3099,8 +3099,12 @@ static void inode_tree_add(struct inode *inode)
3099{ 3099{
3100 struct btrfs_root *root = BTRFS_I(inode)->root; 3100 struct btrfs_root *root = BTRFS_I(inode)->root;
3101 struct btrfs_inode *entry; 3101 struct btrfs_inode *entry;
3102 struct rb_node **p = &root->inode_tree.rb_node; 3102 struct rb_node **p;
3103 struct rb_node *parent = NULL; 3103 struct rb_node *parent;
3104
3105again:
3106 p = &root->inode_tree.rb_node;
3107 parent = NULL;
3104 3108
3105 spin_lock(&root->inode_lock); 3109 spin_lock(&root->inode_lock);
3106 while (*p) { 3110 while (*p) {
@@ -3108,13 +3112,16 @@ static void inode_tree_add(struct inode *inode)
3108 entry = rb_entry(parent, struct btrfs_inode, rb_node); 3112 entry = rb_entry(parent, struct btrfs_inode, rb_node);
3109 3113
3110 if (inode->i_ino < entry->vfs_inode.i_ino) 3114 if (inode->i_ino < entry->vfs_inode.i_ino)
3111 p = &(*p)->rb_left; 3115 p = &parent->rb_left;
3112 else if (inode->i_ino > entry->vfs_inode.i_ino) 3116 else if (inode->i_ino > entry->vfs_inode.i_ino)
3113 p = &(*p)->rb_right; 3117 p = &parent->rb_right;
3114 else { 3118 else {
3115 WARN_ON(!(entry->vfs_inode.i_state & 3119 WARN_ON(!(entry->vfs_inode.i_state &
3116 (I_WILL_FREE | I_FREEING | I_CLEAR))); 3120 (I_WILL_FREE | I_FREEING | I_CLEAR)));
3117 break; 3121 rb_erase(parent, &root->inode_tree);
3122 RB_CLEAR_NODE(parent);
3123 spin_unlock(&root->inode_lock);
3124 goto again;
3118 } 3125 }
3119 } 3126 }
3120 rb_link_node(&BTRFS_I(inode)->rb_node, parent, p); 3127 rb_link_node(&BTRFS_I(inode)->rb_node, parent, p);
@@ -3126,12 +3133,12 @@ static void inode_tree_del(struct inode *inode)
3126{ 3133{
3127 struct btrfs_root *root = BTRFS_I(inode)->root; 3134 struct btrfs_root *root = BTRFS_I(inode)->root;
3128 3135
3136 spin_lock(&root->inode_lock);
3129 if (!RB_EMPTY_NODE(&BTRFS_I(inode)->rb_node)) { 3137 if (!RB_EMPTY_NODE(&BTRFS_I(inode)->rb_node)) {
3130 spin_lock(&root->inode_lock);
3131 rb_erase(&BTRFS_I(inode)->rb_node, &root->inode_tree); 3138 rb_erase(&BTRFS_I(inode)->rb_node, &root->inode_tree);
3132 spin_unlock(&root->inode_lock);
3133 RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node); 3139 RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
3134 } 3140 }
3141 spin_unlock(&root->inode_lock);
3135} 3142}
3136 3143
3137static noinline void init_btrfs_i(struct inode *inode) 3144static noinline void init_btrfs_i(struct inode *inode)
diff --git a/fs/buffer.c b/fs/buffer.c
index a3ef091a45bd..28f320fac4d4 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1165,8 +1165,11 @@ void mark_buffer_dirty(struct buffer_head *bh)
1165 1165
1166 if (!test_set_buffer_dirty(bh)) { 1166 if (!test_set_buffer_dirty(bh)) {
1167 struct page *page = bh->b_page; 1167 struct page *page = bh->b_page;
1168 if (!TestSetPageDirty(page)) 1168 if (!TestSetPageDirty(page)) {
1169 __set_page_dirty(page, page_mapping(page), 0); 1169 struct address_space *mapping = page_mapping(page);
1170 if (mapping)
1171 __set_page_dirty(page, mapping, 0);
1172 }
1170 } 1173 }
1171} 1174}
1172 1175
diff --git a/fs/exec.c b/fs/exec.c
index 4a8849e45b21..fb4f3cdda78c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -678,8 +678,8 @@ exit:
678} 678}
679EXPORT_SYMBOL(open_exec); 679EXPORT_SYMBOL(open_exec);
680 680
681int kernel_read(struct file *file, unsigned long offset, 681int kernel_read(struct file *file, loff_t offset,
682 char *addr, unsigned long count) 682 char *addr, unsigned long count)
683{ 683{
684 mm_segment_t old_fs; 684 mm_segment_t old_fs;
685 loff_t pos = offset; 685 loff_t pos = offset;
diff --git a/fs/ext3/Kconfig b/fs/ext3/Kconfig
index fb3c1a21b135..522b15498f45 100644
--- a/fs/ext3/Kconfig
+++ b/fs/ext3/Kconfig
@@ -29,23 +29,25 @@ config EXT3_FS
29 module will be called ext3. 29 module will be called ext3.
30 30
31config EXT3_DEFAULTS_TO_ORDERED 31config EXT3_DEFAULTS_TO_ORDERED
32 bool "Default to 'data=ordered' in ext3 (legacy option)" 32 bool "Default to 'data=ordered' in ext3"
33 depends on EXT3_FS 33 depends on EXT3_FS
34 help 34 help
35 If a filesystem does not explicitly specify a data ordering 35 The journal mode options for ext3 have different tradeoffs
36 mode, and the journal capability allowed it, ext3 used to 36 between when data is guaranteed to be on disk and
37 historically default to 'data=ordered'. 37 performance. The use of "data=writeback" can cause
38 38 unwritten data to appear in files after an system crash or
39 That was a rather unfortunate choice, because it leads to all 39 power failure, which can be a security issue. However,
40 kinds of latency problems, and the 'data=writeback' mode is more 40 "data=ordered" mode can also result in major performance
41 appropriate these days. 41 problems, including seconds-long delays before an fsync()
42 42 call returns. For details, see:
43 You should probably always answer 'n' here, and if you really 43
44 want to use 'data=ordered' mode, set it in the filesystem itself 44 http://ext4.wiki.kernel.org/index.php/Ext3_data_mode_tradeoffs
45 with 'tune2fs -o journal_data_ordered'. 45
46 46 If you have been historically happy with ext3's performance,
47 But if you really want to enable the legacy default, you can do 47 data=ordered mode will be a safe choice and you should
48 so by answering 'y' to this question. 48 answer 'y' here. If you understand the reliability and data
49 privacy issues of data=writeback and are willing to make
50 that trade off, answer 'n'.
49 51
50config EXT3_FS_XATTR 52config EXT3_FS_XATTR
51 bool "Ext3 extended attributes" 53 bool "Ext3 extended attributes"
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 524b349c6299..a8d80a7f1105 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -543,6 +543,19 @@ static inline void ext3_show_quota_options(struct seq_file *seq, struct super_bl
543#endif 543#endif
544} 544}
545 545
546static char *data_mode_string(unsigned long mode)
547{
548 switch (mode) {
549 case EXT3_MOUNT_JOURNAL_DATA:
550 return "journal";
551 case EXT3_MOUNT_ORDERED_DATA:
552 return "ordered";
553 case EXT3_MOUNT_WRITEBACK_DATA:
554 return "writeback";
555 }
556 return "unknown";
557}
558
546/* 559/*
547 * Show an option if 560 * Show an option if
548 * - it's set to a non-default value OR 561 * - it's set to a non-default value OR
@@ -616,13 +629,8 @@ static int ext3_show_options(struct seq_file *seq, struct vfsmount *vfs)
616 if (test_opt(sb, NOBH)) 629 if (test_opt(sb, NOBH))
617 seq_puts(seq, ",nobh"); 630 seq_puts(seq, ",nobh");
618 631
619 if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA) 632 seq_printf(seq, ",data=%s", data_mode_string(sbi->s_mount_opt &
620 seq_puts(seq, ",data=journal"); 633 EXT3_MOUNT_DATA_FLAGS));
621 else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA)
622 seq_puts(seq, ",data=ordered");
623 else if (test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)
624 seq_puts(seq, ",data=writeback");
625
626 if (test_opt(sb, DATA_ERR_ABORT)) 634 if (test_opt(sb, DATA_ERR_ABORT))
627 seq_puts(seq, ",data_err=abort"); 635 seq_puts(seq, ",data_err=abort");
628 636
@@ -1024,12 +1032,18 @@ static int parse_options (char *options, struct super_block *sb,
1024 datacheck: 1032 datacheck:
1025 if (is_remount) { 1033 if (is_remount) {
1026 if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS) 1034 if ((sbi->s_mount_opt & EXT3_MOUNT_DATA_FLAGS)
1027 != data_opt) { 1035 == data_opt)
1028 printk(KERN_ERR 1036 break;
1029 "EXT3-fs: cannot change data " 1037 printk(KERN_ERR
1030 "mode on remount\n"); 1038 "EXT3-fs (device %s): Cannot change "
1031 return 0; 1039 "data mode on remount. The filesystem "
1032 } 1040 "is mounted in data=%s mode and you "
1041 "try to remount it in data=%s mode.\n",
1042 sb->s_id,
1043 data_mode_string(sbi->s_mount_opt &
1044 EXT3_MOUNT_DATA_FLAGS),
1045 data_mode_string(data_opt));
1046 return 0;
1033 } else { 1047 } else {
1034 sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS; 1048 sbi->s_mount_opt &= ~EXT3_MOUNT_DATA_FLAGS;
1035 sbi->s_mount_opt |= data_opt; 1049 sbi->s_mount_opt |= data_opt;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 941c8425c10b..cb88dac8ccaa 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -935,26 +935,28 @@ static int can_do_hugetlb_shm(void)
935 return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); 935 return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group);
936} 936}
937 937
938struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag) 938struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
939 struct user_struct **user)
939{ 940{
940 int error = -ENOMEM; 941 int error = -ENOMEM;
941 int unlock_shm = 0;
942 struct file *file; 942 struct file *file;
943 struct inode *inode; 943 struct inode *inode;
944 struct dentry *dentry, *root; 944 struct dentry *dentry, *root;
945 struct qstr quick_string; 945 struct qstr quick_string;
946 struct user_struct *user = current_user();
947 946
947 *user = NULL;
948 if (!hugetlbfs_vfsmount) 948 if (!hugetlbfs_vfsmount)
949 return ERR_PTR(-ENOENT); 949 return ERR_PTR(-ENOENT);
950 950
951 if (!can_do_hugetlb_shm()) { 951 if (!can_do_hugetlb_shm()) {
952 if (user_shm_lock(size, user)) { 952 *user = current_user();
953 unlock_shm = 1; 953 if (user_shm_lock(size, *user)) {
954 WARN_ONCE(1, 954 WARN_ONCE(1,
955 "Using mlock ulimits for SHM_HUGETLB deprecated\n"); 955 "Using mlock ulimits for SHM_HUGETLB deprecated\n");
956 } else 956 } else {
957 *user = NULL;
957 return ERR_PTR(-EPERM); 958 return ERR_PTR(-EPERM);
959 }
958 } 960 }
959 961
960 root = hugetlbfs_vfsmount->mnt_root; 962 root = hugetlbfs_vfsmount->mnt_root;
@@ -996,8 +998,10 @@ out_inode:
996out_dentry: 998out_dentry:
997 dput(dentry); 999 dput(dentry);
998out_shm_unlock: 1000out_shm_unlock:
999 if (unlock_shm) 1001 if (*user) {
1000 user_shm_unlock(size, user); 1002 user_shm_unlock(size, *user);
1003 *user = NULL;
1004 }
1001 return ERR_PTR(error); 1005 return ERR_PTR(error);
1002} 1006}
1003 1007
diff --git a/fs/libfs.c b/fs/libfs.c
index ddfa89948c3f..dcec3d3ea64f 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -217,7 +217,7 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
217 return PTR_ERR(s); 217 return PTR_ERR(s);
218 218
219 s->s_flags = MS_NOUSER; 219 s->s_flags = MS_NOUSER;
220 s->s_maxbytes = ~0ULL; 220 s->s_maxbytes = MAX_LFS_FILESIZE;
221 s->s_blocksize = PAGE_SIZE; 221 s->s_blocksize = PAGE_SIZE;
222 s->s_blocksize_bits = PAGE_SHIFT; 222 s->s_blocksize_bits = PAGE_SHIFT;
223 s->s_magic = magic; 223 s->s_magic = magic;
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 65ca8c18476f..1434080aefeb 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1250,8 +1250,8 @@ static void nfs4_state_manager(struct nfs_client *clp)
1250 continue; 1250 continue;
1251 } 1251 }
1252 /* Initialize or reset the session */ 1252 /* Initialize or reset the session */
1253 if (nfs4_has_session(clp) && 1253 if (test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)
1254 test_and_clear_bit(NFS4CLNT_SESSION_SETUP, &clp->cl_state)) { 1254 && nfs4_has_session(clp)) {
1255 if (clp->cl_cons_state == NFS_CS_SESSION_INITING) 1255 if (clp->cl_cons_state == NFS_CS_SESSION_INITING)
1256 status = nfs4_initialize_session(clp); 1256 status = nfs4_initialize_session(clp);
1257 else 1257 else
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 8e2ec43b18f4..151964f0de4c 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -416,8 +416,10 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
416 if (unlikely(err)) 416 if (unlikely(err))
417 goto failed; 417 goto failed;
418 418
419 down_read(&nilfs->ns_segctor_sem);
419 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp, 420 err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, cno, 0, &raw_cp,
420 &bh_cp); 421 &bh_cp);
422 up_read(&nilfs->ns_segctor_sem);
421 if (unlikely(err)) { 423 if (unlikely(err)) {
422 if (err == -ENOENT || err == -EINVAL) { 424 if (err == -ENOENT || err == -EINVAL) {
423 printk(KERN_ERR 425 printk(KERN_ERR
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index e8adbffc626f..1b9caafb8662 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -253,7 +253,7 @@ nilfs_detach_writer(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi)
253 253
254static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi) 254static inline void nilfs_put_sbinfo(struct nilfs_sb_info *sbi)
255{ 255{
256 if (!atomic_dec_and_test(&sbi->s_count)) 256 if (atomic_dec_and_test(&sbi->s_count))
257 kfree(sbi); 257 kfree(sbi);
258} 258}
259 259
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index f9a3e8942669..ab513ddaeff2 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -6851,7 +6851,7 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
6851 } 6851 }
6852 status = 0; 6852 status = 0;
6853bail: 6853bail:
6854 6854 brelse(last_eb_bh);
6855 mlog_exit(status); 6855 mlog_exit(status);
6856 return status; 6856 return status;
6857} 6857}
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c
index fcf879ed6930..756f5b0998e0 100644
--- a/fs/ocfs2/dlm/dlmunlock.c
+++ b/fs/ocfs2/dlm/dlmunlock.c
@@ -122,7 +122,7 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
122 * that still has AST's pending... */ 122 * that still has AST's pending... */
123 in_use = !list_empty(&lock->ast_list); 123 in_use = !list_empty(&lock->ast_list);
124 spin_unlock(&dlm->ast_lock); 124 spin_unlock(&dlm->ast_lock);
125 if (in_use) { 125 if (in_use && !(flags & LKM_CANCEL)) {
126 mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock " 126 mlog(ML_ERROR, "lockres %.*s: Someone is calling dlmunlock "
127 "while waiting for an ast!", res->lockname.len, 127 "while waiting for an ast!", res->lockname.len,
128 res->lockname.name); 128 res->lockname.name);
@@ -131,7 +131,7 @@ static enum dlm_status dlmunlock_common(struct dlm_ctxt *dlm,
131 131
132 spin_lock(&res->spinlock); 132 spin_lock(&res->spinlock);
133 if (res->state & DLM_LOCK_RES_IN_PROGRESS) { 133 if (res->state & DLM_LOCK_RES_IN_PROGRESS) {
134 if (master_node) { 134 if (master_node && !(flags & LKM_CANCEL)) {
135 mlog(ML_ERROR, "lockres in progress!\n"); 135 mlog(ML_ERROR, "lockres in progress!\n");
136 spin_unlock(&res->spinlock); 136 spin_unlock(&res->spinlock);
137 return DLM_FORWARD; 137 return DLM_FORWARD;
diff --git a/fs/ocfs2/ocfs2_lockid.h b/fs/ocfs2/ocfs2_lockid.h
index fcdba091af3d..c212cf5a2bdf 100644
--- a/fs/ocfs2/ocfs2_lockid.h
+++ b/fs/ocfs2/ocfs2_lockid.h
@@ -108,6 +108,7 @@ static char *ocfs2_lock_type_strings[] = {
108 [OCFS2_LOCK_TYPE_OPEN] = "Open", 108 [OCFS2_LOCK_TYPE_OPEN] = "Open",
109 [OCFS2_LOCK_TYPE_FLOCK] = "Flock", 109 [OCFS2_LOCK_TYPE_FLOCK] = "Flock",
110 [OCFS2_LOCK_TYPE_QINFO] = "Quota", 110 [OCFS2_LOCK_TYPE_QINFO] = "Quota",
111 [OCFS2_LOCK_TYPE_NFS_SYNC] = "NFSSync",
111 [OCFS2_LOCK_TYPE_ORPHAN_SCAN] = "OrphanScan", 112 [OCFS2_LOCK_TYPE_ORPHAN_SCAN] = "OrphanScan",
112}; 113};
113 114
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index bf7742d0ee3b..44f2a5e1d042 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -23,6 +23,7 @@
23#include "sysfile.h" 23#include "sysfile.h"
24#include "dlmglue.h" 24#include "dlmglue.h"
25#include "uptodate.h" 25#include "uptodate.h"
26#include "super.h"
26#include "quota.h" 27#include "quota.h"
27 28
28static struct workqueue_struct *ocfs2_quota_wq = NULL; 29static struct workqueue_struct *ocfs2_quota_wq = NULL;
@@ -114,6 +115,15 @@ int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
114 int rc = 0; 115 int rc = 0;
115 struct buffer_head *tmp = *bh; 116 struct buffer_head *tmp = *bh;
116 117
118 if (i_size_read(inode) >> inode->i_sb->s_blocksize_bits <= v_block) {
119 ocfs2_error(inode->i_sb,
120 "Quota file %llu is probably corrupted! Requested "
121 "to read block %Lu but file has size only %Lu\n",
122 (unsigned long long)OCFS2_I(inode)->ip_blkno,
123 (unsigned long long)v_block,
124 (unsigned long long)i_size_read(inode));
125 return -EIO;
126 }
117 rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, 0, 127 rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, 0,
118 ocfs2_validate_quota_block); 128 ocfs2_validate_quota_block);
119 if (rc) 129 if (rc)
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index b0ee0fdf799a..a3f8871d21fd 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1218,13 +1218,17 @@ static void ocfs2_kill_sb(struct super_block *sb)
1218{ 1218{
1219 struct ocfs2_super *osb = OCFS2_SB(sb); 1219 struct ocfs2_super *osb = OCFS2_SB(sb);
1220 1220
1221 /* Failed mount? */
1222 if (!osb || atomic_read(&osb->vol_state) == VOLUME_DISABLED)
1223 goto out;
1224
1221 /* Prevent further queueing of inode drop events */ 1225 /* Prevent further queueing of inode drop events */
1222 spin_lock(&dentry_list_lock); 1226 spin_lock(&dentry_list_lock);
1223 ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED); 1227 ocfs2_set_osb_flag(osb, OCFS2_OSB_DROP_DENTRY_LOCK_IMMED);
1224 spin_unlock(&dentry_list_lock); 1228 spin_unlock(&dentry_list_lock);
1225 /* Wait for work to finish and/or remove it */ 1229 /* Wait for work to finish and/or remove it */
1226 cancel_work_sync(&osb->dentry_lock_work); 1230 cancel_work_sync(&osb->dentry_lock_work);
1227 1231out:
1228 kill_block_super(sb); 1232 kill_block_super(sb);
1229} 1233}
1230 1234
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 175db258942f..6f742f6658a9 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1003,12 +1003,7 @@ static ssize_t oom_adjust_read(struct file *file, char __user *buf,
1003 1003
1004 if (!task) 1004 if (!task)
1005 return -ESRCH; 1005 return -ESRCH;
1006 task_lock(task); 1006 oom_adjust = task->oomkilladj;
1007 if (task->mm)
1008 oom_adjust = task->mm->oom_adj;
1009 else
1010 oom_adjust = OOM_DISABLE;
1011 task_unlock(task);
1012 put_task_struct(task); 1007 put_task_struct(task);
1013 1008
1014 len = snprintf(buffer, sizeof(buffer), "%i\n", oom_adjust); 1009 len = snprintf(buffer, sizeof(buffer), "%i\n", oom_adjust);
@@ -1037,19 +1032,11 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
1037 task = get_proc_task(file->f_path.dentry->d_inode); 1032 task = get_proc_task(file->f_path.dentry->d_inode);
1038 if (!task) 1033 if (!task)
1039 return -ESRCH; 1034 return -ESRCH;
1040 task_lock(task); 1035 if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) {
1041 if (!task->mm) {
1042 task_unlock(task);
1043 put_task_struct(task);
1044 return -EINVAL;
1045 }
1046 if (oom_adjust < task->mm->oom_adj && !capable(CAP_SYS_RESOURCE)) {
1047 task_unlock(task);
1048 put_task_struct(task); 1036 put_task_struct(task);
1049 return -EACCES; 1037 return -EACCES;
1050 } 1038 }
1051 task->mm->oom_adj = oom_adjust; 1039 task->oomkilladj = oom_adjust;
1052 task_unlock(task);
1053 put_task_struct(task); 1040 put_task_struct(task);
1054 if (end - buffer == 0) 1041 if (end - buffer == 0)
1055 return -EIO; 1042 return -EIO;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index af4b4826997e..2ba61e18fc8b 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -508,6 +508,7 @@ typedef struct {
508#define DRM_RADEON_INFO 0x27 508#define DRM_RADEON_INFO 0x27
509#define DRM_RADEON_GEM_SET_TILING 0x28 509#define DRM_RADEON_GEM_SET_TILING 0x28
510#define DRM_RADEON_GEM_GET_TILING 0x29 510#define DRM_RADEON_GEM_GET_TILING 0x29
511#define DRM_RADEON_GEM_BUSY 0x2a
511 512
512#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 513#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
513#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 514#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -548,6 +549,7 @@ typedef struct {
548#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info) 549#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
549#define DRM_IOCTL_RADEON_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) 550#define DRM_IOCTL_RADEON_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
550#define DRM_IOCTL_RADEON_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) 551#define DRM_IOCTL_RADEON_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
552#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
551 553
552typedef struct drm_radeon_init { 554typedef struct drm_radeon_init {
553 enum { 555 enum {
@@ -707,6 +709,7 @@ typedef struct drm_radeon_indirect {
707#define RADEON_PARAM_FB_LOCATION 14 /* FB location */ 709#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
708#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ 710#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
709#define RADEON_PARAM_DEVICE_ID 16 711#define RADEON_PARAM_DEVICE_ID 16
712#define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */
710 713
711typedef struct drm_radeon_getparam { 714typedef struct drm_radeon_getparam {
712 int param; 715 int param;
@@ -838,7 +841,7 @@ struct drm_radeon_gem_wait_idle {
838 841
839struct drm_radeon_gem_busy { 842struct drm_radeon_gem_busy {
840 uint32_t handle; 843 uint32_t handle;
841 uint32_t busy; 844 uint32_t domain;
842}; 845};
843 846
844struct drm_radeon_gem_pread { 847struct drm_radeon_gem_pread {
@@ -895,6 +898,7 @@ struct drm_radeon_cs {
895 898
896#define RADEON_INFO_DEVICE_ID 0x00 899#define RADEON_INFO_DEVICE_ID 0x00
897#define RADEON_INFO_NUM_GB_PIPES 0x01 900#define RADEON_INFO_NUM_GB_PIPES 0x01
901#define RADEON_INFO_NUM_Z_PIPES 0x02
898 902
899struct drm_radeon_info { 903struct drm_radeon_info {
900 uint32_t request; 904 uint32_t request;
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 2878811c6134..756d78b8c1c5 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -94,13 +94,13 @@ extern void __bitmap_shift_right(unsigned long *dst,
94 const unsigned long *src, int shift, int bits); 94 const unsigned long *src, int shift, int bits);
95extern void __bitmap_shift_left(unsigned long *dst, 95extern void __bitmap_shift_left(unsigned long *dst,
96 const unsigned long *src, int shift, int bits); 96 const unsigned long *src, int shift, int bits);
97extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 97extern int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
98 const unsigned long *bitmap2, int bits); 98 const unsigned long *bitmap2, int bits);
99extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 99extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
100 const unsigned long *bitmap2, int bits); 100 const unsigned long *bitmap2, int bits);
101extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, 101extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
102 const unsigned long *bitmap2, int bits); 102 const unsigned long *bitmap2, int bits);
103extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 103extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
104 const unsigned long *bitmap2, int bits); 104 const unsigned long *bitmap2, int bits);
105extern int __bitmap_intersects(const unsigned long *bitmap1, 105extern int __bitmap_intersects(const unsigned long *bitmap1,
106 const unsigned long *bitmap2, int bits); 106 const unsigned long *bitmap2, int bits);
@@ -171,13 +171,12 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
171 } 171 }
172} 172}
173 173
174static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, 174static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
175 const unsigned long *src2, int nbits) 175 const unsigned long *src2, int nbits)
176{ 176{
177 if (small_const_nbits(nbits)) 177 if (small_const_nbits(nbits))
178 *dst = *src1 & *src2; 178 return (*dst = *src1 & *src2) != 0;
179 else 179 return __bitmap_and(dst, src1, src2, nbits);
180 __bitmap_and(dst, src1, src2, nbits);
181} 180}
182 181
183static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 182static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
@@ -198,13 +197,12 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
198 __bitmap_xor(dst, src1, src2, nbits); 197 __bitmap_xor(dst, src1, src2, nbits);
199} 198}
200 199
201static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, 200static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
202 const unsigned long *src2, int nbits) 201 const unsigned long *src2, int nbits)
203{ 202{
204 if (small_const_nbits(nbits)) 203 if (small_const_nbits(nbits))
205 *dst = *src1 & ~(*src2); 204 return (*dst = *src1 & ~(*src2)) != 0;
206 else 205 return __bitmap_andnot(dst, src1, src2, nbits);
207 __bitmap_andnot(dst, src1, src2, nbits);
208} 206}
209 207
210static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 208static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index c5ac87ca7bc6..796df12091b7 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -43,10 +43,10 @@
43 * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask 43 * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
44 * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask 44 * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
45 * 45 *
46 * void cpus_and(dst, src1, src2) dst = src1 & src2 [intersection] 46 * int cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
47 * void cpus_or(dst, src1, src2) dst = src1 | src2 [union] 47 * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
48 * void cpus_xor(dst, src1, src2) dst = src1 ^ src2 48 * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
49 * void cpus_andnot(dst, src1, src2) dst = src1 & ~src2 49 * int cpus_andnot(dst, src1, src2) dst = src1 & ~src2
50 * void cpus_complement(dst, src) dst = ~src 50 * void cpus_complement(dst, src) dst = ~src
51 * 51 *
52 * int cpus_equal(mask1, mask2) Does mask1 == mask2? 52 * int cpus_equal(mask1, mask2) Does mask1 == mask2?
@@ -179,10 +179,10 @@ static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
179} 179}
180 180
181#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS) 181#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
182static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p, 182static inline int __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
183 const cpumask_t *src2p, int nbits) 183 const cpumask_t *src2p, int nbits)
184{ 184{
185 bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); 185 return bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
186} 186}
187 187
188#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS) 188#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
@@ -201,10 +201,10 @@ static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
201 201
202#define cpus_andnot(dst, src1, src2) \ 202#define cpus_andnot(dst, src1, src2) \
203 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS) 203 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
204static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p, 204static inline int __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
205 const cpumask_t *src2p, int nbits) 205 const cpumask_t *src2p, int nbits)
206{ 206{
207 bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); 207 return bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
208} 208}
209 209
210#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS) 210#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
@@ -738,11 +738,11 @@ static inline void cpumask_clear(struct cpumask *dstp)
738 * @src1p: the first input 738 * @src1p: the first input
739 * @src2p: the second input 739 * @src2p: the second input
740 */ 740 */
741static inline void cpumask_and(struct cpumask *dstp, 741static inline int cpumask_and(struct cpumask *dstp,
742 const struct cpumask *src1p, 742 const struct cpumask *src1p,
743 const struct cpumask *src2p) 743 const struct cpumask *src2p)
744{ 744{
745 bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p), 745 return bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p),
746 cpumask_bits(src2p), nr_cpumask_bits); 746 cpumask_bits(src2p), nr_cpumask_bits);
747} 747}
748 748
@@ -779,11 +779,11 @@ static inline void cpumask_xor(struct cpumask *dstp,
779 * @src1p: the first input 779 * @src1p: the first input
780 * @src2p: the second input 780 * @src2p: the second input
781 */ 781 */
782static inline void cpumask_andnot(struct cpumask *dstp, 782static inline int cpumask_andnot(struct cpumask *dstp,
783 const struct cpumask *src1p, 783 const struct cpumask *src1p,
784 const struct cpumask *src2p) 784 const struct cpumask *src2p)
785{ 785{
786 bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p), 786 return bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p),
787 cpumask_bits(src2p), nr_cpumask_bits); 787 cpumask_bits(src2p), nr_cpumask_bits);
788} 788}
789 789
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 67888a9e0655..73e9b643e455 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2123,7 +2123,7 @@ extern struct file *do_filp_open(int dfd, const char *pathname,
2123 int open_flag, int mode, int acc_mode); 2123 int open_flag, int mode, int acc_mode);
2124extern int may_open(struct path *, int, int); 2124extern int may_open(struct path *, int, int);
2125 2125
2126extern int kernel_read(struct file *, unsigned long, char *, unsigned long); 2126extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2127extern struct file * open_exec(const char *); 2127extern struct file * open_exec(const char *);
2128 2128
2129/* fs/dcache.c -- generic fs support functions */ 2129/* fs/dcache.c -- generic fs support functions */
diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h
index 0ffa41df0ee8..710e901085d0 100644
--- a/include/linux/gen_stats.h
+++ b/include/linux/gen_stats.h
@@ -22,6 +22,11 @@ struct gnet_stats_basic
22{ 22{
23 __u64 bytes; 23 __u64 bytes;
24 __u32 packets; 24 __u32 packets;
25};
26struct gnet_stats_basic_packed
27{
28 __u64 bytes;
29 __u32 packets;
25} __attribute__ ((packed)); 30} __attribute__ ((packed));
26 31
27/** 32/**
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 2723513a5651..5cbc620bdfe0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -10,6 +10,7 @@
10#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
11 11
12struct ctl_table; 12struct ctl_table;
13struct user_struct;
13 14
14int PageHuge(struct page *page); 15int PageHuge(struct page *page);
15 16
@@ -146,7 +147,8 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
146 147
147extern const struct file_operations hugetlbfs_file_operations; 148extern const struct file_operations hugetlbfs_file_operations;
148extern struct vm_operations_struct hugetlb_vm_ops; 149extern struct vm_operations_struct hugetlb_vm_ops;
149struct file *hugetlb_file_setup(const char *name, size_t, int); 150struct file *hugetlb_file_setup(const char *name, size_t size, int acct,
151 struct user_struct **user);
150int hugetlb_get_quota(struct address_space *mapping, long delta); 152int hugetlb_get_quota(struct address_space *mapping, long delta);
151void hugetlb_put_quota(struct address_space *mapping, long delta); 153void hugetlb_put_quota(struct address_space *mapping, long delta);
152 154
@@ -168,7 +170,7 @@ static inline void set_file_hugepages(struct file *file)
168 170
169#define is_file_hugepages(file) 0 171#define is_file_hugepages(file) 0
170#define set_file_hugepages(file) BUG() 172#define set_file_hugepages(file) BUG()
171#define hugetlb_file_setup(name,size,acctflag) ERR_PTR(-ENOSYS) 173#define hugetlb_file_setup(name,size,acct,user) ERR_PTR(-ENOSYS)
172 174
173#endif /* !CONFIG_HUGETLBFS */ 175#endif /* !CONFIG_HUGETLBFS */
174 176
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 7acc8439d9b3..0042090a4d70 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -240,8 +240,6 @@ struct mm_struct {
240 240
241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
242 242
243 s8 oom_adj; /* OOM kill score adjustment (bit shift) */
244
245 cpumask_t cpu_vm_mask; 243 cpumask_t cpu_vm_mask;
246 244
247 /* Architecture-specific MM context */ 245 /* Architecture-specific MM context */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3ab08e4bb6b8..0f1ea4a66957 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1198,6 +1198,7 @@ struct task_struct {
1198 * a short time 1198 * a short time
1199 */ 1199 */
1200 unsigned char fpu_counter; 1200 unsigned char fpu_counter;
1201 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1201#ifdef CONFIG_BLK_DEV_IO_TRACE 1202#ifdef CONFIG_BLK_DEV_IO_TRACE
1202 unsigned int btrace_seq; 1203 unsigned int btrace_seq;
1203#endif 1204#endif
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index ed889f4168f3..ae779bb8cc0f 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -73,6 +73,10 @@
73 73
74#define UCB_ADC_DATA 0x68 74#define UCB_ADC_DATA 0x68
75#define UCB_ADC_DAT_VALID (1 << 15) 75#define UCB_ADC_DAT_VALID (1 << 15)
76
77#define UCB_FCSR 0x6c
78#define UCB_FCSR_AVE (1 << 12)
79
76#define UCB_ADC_DAT_MASK 0x3ff 80#define UCB_ADC_DAT_MASK 0x3ff
77 81
78#define UCB_ID 0x7e 82#define UCB_ID 0x7e
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 565eed8fe496..c05fd717c588 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -16,7 +16,7 @@ struct tcf_common {
16 u32 tcfc_capab; 16 u32 tcfc_capab;
17 int tcfc_action; 17 int tcfc_action;
18 struct tcf_t tcfc_tm; 18 struct tcf_t tcfc_tm;
19 struct gnet_stats_basic tcfc_bstats; 19 struct gnet_stats_basic_packed tcfc_bstats;
20 struct gnet_stats_queue tcfc_qstats; 20 struct gnet_stats_queue tcfc_qstats;
21 struct gnet_stats_rate_est tcfc_rate_est; 21 struct gnet_stats_rate_est tcfc_rate_est;
22 spinlock_t tcfc_lock; 22 spinlock_t tcfc_lock;
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index d136b5240ef2..c1488553e349 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -28,7 +28,7 @@ extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
28 spinlock_t *lock, struct gnet_dump *d); 28 spinlock_t *lock, struct gnet_dump *d);
29 29
30extern int gnet_stats_copy_basic(struct gnet_dump *d, 30extern int gnet_stats_copy_basic(struct gnet_dump *d,
31 struct gnet_stats_basic *b); 31 struct gnet_stats_basic_packed *b);
32extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 32extern int gnet_stats_copy_rate_est(struct gnet_dump *d,
33 struct gnet_stats_rate_est *r); 33 struct gnet_stats_rate_est *r);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 34extern int gnet_stats_copy_queue(struct gnet_dump *d,
@@ -37,14 +37,14 @@ extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
37 37
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 38extern int gnet_stats_finish_copy(struct gnet_dump *d);
39 39
40extern int gen_new_estimator(struct gnet_stats_basic *bstats, 40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est *rate_est, 41 struct gnet_stats_rate_est *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 42 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic *bstats, 43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est *rate_est); 44 struct gnet_stats_rate_est *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic *bstats, 45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est *rate_est, 46 struct gnet_stats_rate_est *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt); 47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic *bstats, 48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est *rate_est); 49 const struct gnet_stats_rate_est *rate_est);
50#endif 50#endif
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 65d594dffbff..ddbf37e19616 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -8,7 +8,7 @@ struct xt_rateest {
8 spinlock_t lock; 8 spinlock_t lock;
9 struct gnet_estimator params; 9 struct gnet_estimator params;
10 struct gnet_stats_rate_est rstats; 10 struct gnet_stats_rate_est rstats;
11 struct gnet_stats_basic bstats; 11 struct gnet_stats_basic_packed bstats;
12}; 12};
13 13
14extern struct xt_rateest *xt_rateest_lookup(const char *name); 14extern struct xt_rateest *xt_rateest_lookup(const char *name);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 82a3191375f5..7eafb8d54470 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -61,8 +61,8 @@ psched_tdiff_bounded(psched_time_t tv1, psched_time_t tv2, psched_time_t bound)
61} 61}
62 62
63struct qdisc_watchdog { 63struct qdisc_watchdog {
64 struct hrtimer timer; 64 struct tasklet_hrtimer timer;
65 struct Qdisc *qdisc; 65 struct Qdisc *qdisc;
66}; 66};
67 67
68extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc); 68extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 964ffa0d8815..5482e9582f55 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -72,7 +72,7 @@ struct Qdisc
72 */ 72 */
73 unsigned long state; 73 unsigned long state;
74 struct sk_buff_head q; 74 struct sk_buff_head q;
75 struct gnet_stats_basic bstats; 75 struct gnet_stats_basic_packed bstats;
76 struct gnet_stats_queue qstats; 76 struct gnet_stats_queue qstats;
77}; 77};
78 78
diff --git a/init/main.c b/init/main.c
index 98e679e3494a..11f4f145be3f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -584,8 +584,8 @@ asmlinkage void __init start_kernel(void)
584 setup_arch(&command_line); 584 setup_arch(&command_line);
585 mm_init_owner(&init_mm, &init_task); 585 mm_init_owner(&init_mm, &init_task);
586 setup_command_line(command_line); 586 setup_command_line(command_line);
587 setup_per_cpu_areas();
588 setup_nr_cpu_ids(); 587 setup_nr_cpu_ids();
588 setup_per_cpu_areas();
589 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 589 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
590 590
591 build_all_zonelists(); 591 build_all_zonelists();
diff --git a/ipc/shm.c b/ipc/shm.c
index 15dd238e5338..1bc4701ef4f0 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -174,7 +174,7 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
174 shm_unlock(shp); 174 shm_unlock(shp);
175 if (!is_file_hugepages(shp->shm_file)) 175 if (!is_file_hugepages(shp->shm_file))
176 shmem_lock(shp->shm_file, 0, shp->mlock_user); 176 shmem_lock(shp->shm_file, 0, shp->mlock_user);
177 else 177 else if (shp->mlock_user)
178 user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size, 178 user_shm_unlock(shp->shm_file->f_path.dentry->d_inode->i_size,
179 shp->mlock_user); 179 shp->mlock_user);
180 fput (shp->shm_file); 180 fput (shp->shm_file);
@@ -369,8 +369,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
369 /* hugetlb_file_setup applies strict accounting */ 369 /* hugetlb_file_setup applies strict accounting */
370 if (shmflg & SHM_NORESERVE) 370 if (shmflg & SHM_NORESERVE)
371 acctflag = VM_NORESERVE; 371 acctflag = VM_NORESERVE;
372 file = hugetlb_file_setup(name, size, acctflag); 372 file = hugetlb_file_setup(name, size, acctflag,
373 shp->mlock_user = current_user(); 373 &shp->mlock_user);
374 } else { 374 } else {
375 /* 375 /*
376 * Do not allow no accounting for OVERCOMMIT_NEVER, even 376 * Do not allow no accounting for OVERCOMMIT_NEVER, even
@@ -410,6 +410,8 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
410 return error; 410 return error;
411 411
412no_id: 412no_id:
413 if (shp->mlock_user) /* shmflg & SHM_HUGETLB case */
414 user_shm_unlock(size, shp->mlock_user);
413 fput(file); 415 fput(file);
414no_file: 416no_file:
415 security_shm_free(shp); 417 security_shm_free(shp);
diff --git a/kernel/fork.c b/kernel/fork.c
index 021e1138556e..144326b7af50 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -426,7 +426,6 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
426 init_rwsem(&mm->mmap_sem); 426 init_rwsem(&mm->mmap_sem);
427 INIT_LIST_HEAD(&mm->mmlist); 427 INIT_LIST_HEAD(&mm->mmlist);
428 mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; 428 mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
429 mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0;
430 mm->core_state = NULL; 429 mm->core_state = NULL;
431 mm->nr_ptes = 0; 430 mm->nr_ptes = 0;
432 set_mm_counter(mm, file_rss, 0); 431 set_mm_counter(mm, file_rss, 0);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index d222515a5a06..0ec9ed831737 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -607,7 +607,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
607 */ 607 */
608 get_task_struct(t); 608 get_task_struct(t);
609 new->thread = t; 609 new->thread = t;
610 wake_up_process(t);
611 } 610 }
612 611
613 /* 612 /*
@@ -690,6 +689,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
690 (int)(new->flags & IRQF_TRIGGER_MASK)); 689 (int)(new->flags & IRQF_TRIGGER_MASK));
691 } 690 }
692 691
692 new->irq = irq;
693 *old_ptr = new; 693 *old_ptr = new;
694 694
695 /* Reset broken irq detection when installing new handler */ 695 /* Reset broken irq detection when installing new handler */
@@ -707,7 +707,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
707 707
708 spin_unlock_irqrestore(&desc->lock, flags); 708 spin_unlock_irqrestore(&desc->lock, flags);
709 709
710 new->irq = irq; 710 /*
711 * Strictly no need to wake it up, but hung_task complains
712 * when no hard interrupt wakes the thread up.
713 */
714 if (new->thread)
715 wake_up_process(new->thread);
716
711 register_irq_proc(irq, desc); 717 register_irq_proc(irq, desc);
712 new->dir = NULL; 718 new->dir = NULL;
713 register_handler_proc(irq, new); 719 register_handler_proc(irq, new);
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 534e20d14d63..36f65e2b8b57 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1503,10 +1503,21 @@ static void perf_counter_enable_on_exec(struct task_struct *task)
1503 */ 1503 */
1504static void __perf_counter_read(void *info) 1504static void __perf_counter_read(void *info)
1505{ 1505{
1506 struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
1506 struct perf_counter *counter = info; 1507 struct perf_counter *counter = info;
1507 struct perf_counter_context *ctx = counter->ctx; 1508 struct perf_counter_context *ctx = counter->ctx;
1508 unsigned long flags; 1509 unsigned long flags;
1509 1510
1511 /*
1512 * If this is a task context, we need to check whether it is
1513 * the current task context of this cpu. If not it has been
1514 * scheduled out before the smp call arrived. In that case
1515 * counter->count would have been updated to a recent sample
1516 * when the counter was scheduled out.
1517 */
1518 if (ctx->task && cpuctx->task_ctx != ctx)
1519 return;
1520
1510 local_irq_save(flags); 1521 local_irq_save(flags);
1511 if (ctx->is_active) 1522 if (ctx->is_active)
1512 update_context_time(ctx); 1523 update_context_time(ctx);
@@ -2008,6 +2019,10 @@ int perf_counter_task_disable(void)
2008 return 0; 2019 return 0;
2009} 2020}
2010 2021
2022#ifndef PERF_COUNTER_INDEX_OFFSET
2023# define PERF_COUNTER_INDEX_OFFSET 0
2024#endif
2025
2011static int perf_counter_index(struct perf_counter *counter) 2026static int perf_counter_index(struct perf_counter *counter)
2012{ 2027{
2013 if (counter->state != PERF_COUNTER_STATE_ACTIVE) 2028 if (counter->state != PERF_COUNTER_STATE_ACTIVE)
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 35a1f7ff4149..702565821c99 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -179,14 +179,16 @@ void __bitmap_shift_left(unsigned long *dst,
179} 179}
180EXPORT_SYMBOL(__bitmap_shift_left); 180EXPORT_SYMBOL(__bitmap_shift_left);
181 181
182void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, 182int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
183 const unsigned long *bitmap2, int bits) 183 const unsigned long *bitmap2, int bits)
184{ 184{
185 int k; 185 int k;
186 int nr = BITS_TO_LONGS(bits); 186 int nr = BITS_TO_LONGS(bits);
187 unsigned long result = 0;
187 188
188 for (k = 0; k < nr; k++) 189 for (k = 0; k < nr; k++)
189 dst[k] = bitmap1[k] & bitmap2[k]; 190 result |= (dst[k] = bitmap1[k] & bitmap2[k]);
191 return result != 0;
190} 192}
191EXPORT_SYMBOL(__bitmap_and); 193EXPORT_SYMBOL(__bitmap_and);
192 194
@@ -212,14 +214,16 @@ void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
212} 214}
213EXPORT_SYMBOL(__bitmap_xor); 215EXPORT_SYMBOL(__bitmap_xor);
214 216
215void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, 217int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
216 const unsigned long *bitmap2, int bits) 218 const unsigned long *bitmap2, int bits)
217{ 219{
218 int k; 220 int k;
219 int nr = BITS_TO_LONGS(bits); 221 int nr = BITS_TO_LONGS(bits);
222 unsigned long result = 0;
220 223
221 for (k = 0; k < nr; k++) 224 for (k = 0; k < nr; k++)
222 dst[k] = bitmap1[k] & ~bitmap2[k]; 225 result |= (dst[k] = bitmap1[k] & ~bitmap2[k]);
226 return result != 0;
223} 227}
224EXPORT_SYMBOL(__bitmap_andnot); 228EXPORT_SYMBOL(__bitmap_andnot);
225 229
diff --git a/mm/nommu.c b/mm/nommu.c
index 28754c40be98..4bde489ec431 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -919,6 +919,10 @@ static int validate_mmap_request(struct file *file,
919 if (!file->f_op->read) 919 if (!file->f_op->read)
920 capabilities &= ~BDI_CAP_MAP_COPY; 920 capabilities &= ~BDI_CAP_MAP_COPY;
921 921
922 /* The file shall have been opened with read permission. */
923 if (!(file->f_mode & FMODE_READ))
924 return -EACCES;
925
922 if (flags & MAP_SHARED) { 926 if (flags & MAP_SHARED) {
923 /* do checks for writing, appending and locking */ 927 /* do checks for writing, appending and locking */
924 if ((prot & PROT_WRITE) && 928 if ((prot & PROT_WRITE) &&
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 175a67a78a99..a7b2460e922b 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -58,7 +58,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
58 unsigned long points, cpu_time, run_time; 58 unsigned long points, cpu_time, run_time;
59 struct mm_struct *mm; 59 struct mm_struct *mm;
60 struct task_struct *child; 60 struct task_struct *child;
61 int oom_adj;
62 61
63 task_lock(p); 62 task_lock(p);
64 mm = p->mm; 63 mm = p->mm;
@@ -66,11 +65,6 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
66 task_unlock(p); 65 task_unlock(p);
67 return 0; 66 return 0;
68 } 67 }
69 oom_adj = mm->oom_adj;
70 if (oom_adj == OOM_DISABLE) {
71 task_unlock(p);
72 return 0;
73 }
74 68
75 /* 69 /*
76 * The memory size of the process is the basis for the badness. 70 * The memory size of the process is the basis for the badness.
@@ -154,15 +148,15 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
154 points /= 8; 148 points /= 8;
155 149
156 /* 150 /*
157 * Adjust the score by oom_adj. 151 * Adjust the score by oomkilladj.
158 */ 152 */
159 if (oom_adj) { 153 if (p->oomkilladj) {
160 if (oom_adj > 0) { 154 if (p->oomkilladj > 0) {
161 if (!points) 155 if (!points)
162 points = 1; 156 points = 1;
163 points <<= oom_adj; 157 points <<= p->oomkilladj;
164 } else 158 } else
165 points >>= -(oom_adj); 159 points >>= -(p->oomkilladj);
166 } 160 }
167 161
168#ifdef DEBUG 162#ifdef DEBUG
@@ -257,8 +251,11 @@ static struct task_struct *select_bad_process(unsigned long *ppoints,
257 *ppoints = ULONG_MAX; 251 *ppoints = ULONG_MAX;
258 } 252 }
259 253
254 if (p->oomkilladj == OOM_DISABLE)
255 continue;
256
260 points = badness(p, uptime.tv_sec); 257 points = badness(p, uptime.tv_sec);
261 if (points > *ppoints) { 258 if (points > *ppoints || !chosen) {
262 chosen = p; 259 chosen = p;
263 *ppoints = points; 260 *ppoints = points;
264 } 261 }
@@ -307,7 +304,8 @@ static void dump_tasks(const struct mem_cgroup *mem)
307 } 304 }
308 printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n", 305 printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n",
309 p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm, 306 p->pid, __task_cred(p)->uid, p->tgid, mm->total_vm,
310 get_mm_rss(mm), (int)task_cpu(p), mm->oom_adj, p->comm); 307 get_mm_rss(mm), (int)task_cpu(p), p->oomkilladj,
308 p->comm);
311 task_unlock(p); 309 task_unlock(p);
312 } while_each_thread(g, p); 310 } while_each_thread(g, p);
313} 311}
@@ -325,8 +323,11 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
325 return; 323 return;
326 } 324 }
327 325
328 if (!p->mm) 326 if (!p->mm) {
327 WARN_ON(1);
328 printk(KERN_WARNING "tried to kill an mm-less task!\n");
329 return; 329 return;
330 }
330 331
331 if (verbose) 332 if (verbose)
332 printk(KERN_ERR "Killed process %d (%s)\n", 333 printk(KERN_ERR "Killed process %d (%s)\n",
@@ -348,13 +349,28 @@ static int oom_kill_task(struct task_struct *p)
348 struct mm_struct *mm; 349 struct mm_struct *mm;
349 struct task_struct *g, *q; 350 struct task_struct *g, *q;
350 351
351 task_lock(p);
352 mm = p->mm; 352 mm = p->mm;
353 if (!mm || mm->oom_adj == OOM_DISABLE) { 353
354 task_unlock(p); 354 /* WARNING: mm may not be dereferenced since we did not obtain its
355 * value from get_task_mm(p). This is OK since all we need to do is
356 * compare mm to q->mm below.
357 *
358 * Furthermore, even if mm contains a non-NULL value, p->mm may
359 * change to NULL at any time since we do not hold task_lock(p).
360 * However, this is of no concern to us.
361 */
362
363 if (mm == NULL)
355 return 1; 364 return 1;
356 } 365
357 task_unlock(p); 366 /*
367 * Don't kill the process if any threads are set to OOM_DISABLE
368 */
369 do_each_thread(g, q) {
370 if (q->mm == mm && q->oomkilladj == OOM_DISABLE)
371 return 1;
372 } while_each_thread(g, q);
373
358 __oom_kill_task(p, 1); 374 __oom_kill_task(p, 1);
359 375
360 /* 376 /*
@@ -377,11 +393,10 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
377 struct task_struct *c; 393 struct task_struct *c;
378 394
379 if (printk_ratelimit()) { 395 if (printk_ratelimit()) {
380 task_lock(current);
381 printk(KERN_WARNING "%s invoked oom-killer: " 396 printk(KERN_WARNING "%s invoked oom-killer: "
382 "gfp_mask=0x%x, order=%d, oom_adj=%d\n", 397 "gfp_mask=0x%x, order=%d, oomkilladj=%d\n",
383 current->comm, gfp_mask, order, 398 current->comm, gfp_mask, order, current->oomkilladj);
384 current->mm ? current->mm->oom_adj : OOM_DISABLE); 399 task_lock(current);
385 cpuset_print_task_mems_allowed(current); 400 cpuset_print_task_mems_allowed(current);
386 task_unlock(current); 401 task_unlock(current);
387 dump_stack(); 402 dump_stack();
@@ -394,9 +409,8 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
394 /* 409 /*
395 * If the task is already exiting, don't alarm the sysadmin or kill 410 * If the task is already exiting, don't alarm the sysadmin or kill
396 * its children or threads, just set TIF_MEMDIE so it can die quickly 411 * its children or threads, just set TIF_MEMDIE so it can die quickly
397 * if its mm is still attached.
398 */ 412 */
399 if (p->mm && (p->flags & PF_EXITING)) { 413 if (p->flags & PF_EXITING) {
400 __oom_kill_task(p, 0); 414 __oom_kill_task(p, 0);
401 return 0; 415 return 0;
402 } 416 }
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d052abbe3063..5cc986eb9f6f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2544,7 +2544,6 @@ static void build_zonelists(pg_data_t *pgdat)
2544 prev_node = local_node; 2544 prev_node = local_node;
2545 nodes_clear(used_mask); 2545 nodes_clear(used_mask);
2546 2546
2547 memset(node_load, 0, sizeof(node_load));
2548 memset(node_order, 0, sizeof(node_order)); 2547 memset(node_order, 0, sizeof(node_order));
2549 j = 0; 2548 j = 0;
2550 2549
@@ -2653,6 +2652,9 @@ static int __build_all_zonelists(void *dummy)
2653{ 2652{
2654 int nid; 2653 int nid;
2655 2654
2655#ifdef CONFIG_NUMA
2656 memset(node_load, 0, sizeof(node_load));
2657#endif
2656 for_each_online_node(nid) { 2658 for_each_online_node(nid) {
2657 pg_data_t *pgdat = NODE_DATA(nid); 2659 pg_data_t *pgdat = NODE_DATA(nid);
2658 2660
diff --git a/mm/percpu.c b/mm/percpu.c
index b70f2acd8853..5fe37842e0ea 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -8,12 +8,12 @@
8 * 8 *
9 * This is percpu allocator which can handle both static and dynamic 9 * This is percpu allocator which can handle both static and dynamic
10 * areas. Percpu areas are allocated in chunks in vmalloc area. Each 10 * areas. Percpu areas are allocated in chunks in vmalloc area. Each
11 * chunk is consisted of num_possible_cpus() units and the first chunk 11 * chunk is consisted of nr_cpu_ids units and the first chunk is used
12 * is used for static percpu variables in the kernel image (special 12 * for static percpu variables in the kernel image (special boot time
13 * boot time alloc/init handling necessary as these areas need to be 13 * alloc/init handling necessary as these areas need to be brought up
14 * brought up before allocation services are running). Unit grows as 14 * before allocation services are running). Unit grows as necessary
15 * necessary and all units grow or shrink in unison. When a chunk is 15 * and all units grow or shrink in unison. When a chunk is filled up,
16 * filled up, another chunk is allocated. ie. in vmalloc area 16 * another chunk is allocated. ie. in vmalloc area
17 * 17 *
18 * c0 c1 c2 18 * c0 c1 c2
19 * ------------------- ------------------- ------------ 19 * ------------------- ------------------- ------------
@@ -558,7 +558,7 @@ static void pcpu_free_area(struct pcpu_chunk *chunk, int freeme)
558static void pcpu_unmap(struct pcpu_chunk *chunk, int page_start, int page_end, 558static void pcpu_unmap(struct pcpu_chunk *chunk, int page_start, int page_end,
559 bool flush_tlb) 559 bool flush_tlb)
560{ 560{
561 unsigned int last = num_possible_cpus() - 1; 561 unsigned int last = nr_cpu_ids - 1;
562 unsigned int cpu; 562 unsigned int cpu;
563 563
564 /* unmap must not be done on immutable chunk */ 564 /* unmap must not be done on immutable chunk */
@@ -643,7 +643,7 @@ static void pcpu_depopulate_chunk(struct pcpu_chunk *chunk, int off, int size,
643 */ 643 */
644static int pcpu_map(struct pcpu_chunk *chunk, int page_start, int page_end) 644static int pcpu_map(struct pcpu_chunk *chunk, int page_start, int page_end)
645{ 645{
646 unsigned int last = num_possible_cpus() - 1; 646 unsigned int last = nr_cpu_ids - 1;
647 unsigned int cpu; 647 unsigned int cpu;
648 int err; 648 int err;
649 649
@@ -749,7 +749,7 @@ static struct pcpu_chunk *alloc_pcpu_chunk(void)
749 chunk->map[chunk->map_used++] = pcpu_unit_size; 749 chunk->map[chunk->map_used++] = pcpu_unit_size;
750 chunk->page = chunk->page_ar; 750 chunk->page = chunk->page_ar;
751 751
752 chunk->vm = get_vm_area(pcpu_chunk_size, GFP_KERNEL); 752 chunk->vm = get_vm_area(pcpu_chunk_size, VM_ALLOC);
753 if (!chunk->vm) { 753 if (!chunk->vm) {
754 free_pcpu_chunk(chunk); 754 free_pcpu_chunk(chunk);
755 return NULL; 755 return NULL;
@@ -1067,9 +1067,9 @@ size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
1067 PFN_UP(size_sum)); 1067 PFN_UP(size_sum));
1068 1068
1069 pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT; 1069 pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT;
1070 pcpu_chunk_size = num_possible_cpus() * pcpu_unit_size; 1070 pcpu_chunk_size = nr_cpu_ids * pcpu_unit_size;
1071 pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) 1071 pcpu_chunk_struct_size = sizeof(struct pcpu_chunk)
1072 + num_possible_cpus() * pcpu_unit_pages * sizeof(struct page *); 1072 + nr_cpu_ids * pcpu_unit_pages * sizeof(struct page *);
1073 1073
1074 if (dyn_size < 0) 1074 if (dyn_size < 0)
1075 dyn_size = pcpu_unit_size - static_size - reserved_size; 1075 dyn_size = pcpu_unit_size - static_size - reserved_size;
@@ -1248,7 +1248,7 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size,
1248 } else 1248 } else
1249 pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE); 1249 pcpue_unit_size = max_t(size_t, pcpue_size, PCPU_MIN_UNIT_SIZE);
1250 1250
1251 chunk_size = pcpue_unit_size * num_possible_cpus(); 1251 chunk_size = pcpue_unit_size * nr_cpu_ids;
1252 1252
1253 pcpue_ptr = __alloc_bootmem_nopanic(chunk_size, PAGE_SIZE, 1253 pcpue_ptr = __alloc_bootmem_nopanic(chunk_size, PAGE_SIZE,
1254 __pa(MAX_DMA_ADDRESS)); 1254 __pa(MAX_DMA_ADDRESS));
@@ -1259,12 +1259,15 @@ ssize_t __init pcpu_embed_first_chunk(size_t static_size, size_t reserved_size,
1259 } 1259 }
1260 1260
1261 /* return the leftover and copy */ 1261 /* return the leftover and copy */
1262 for_each_possible_cpu(cpu) { 1262 for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
1263 void *ptr = pcpue_ptr + cpu * pcpue_unit_size; 1263 void *ptr = pcpue_ptr + cpu * pcpue_unit_size;
1264 1264
1265 free_bootmem(__pa(ptr + pcpue_size), 1265 if (cpu_possible(cpu)) {
1266 pcpue_unit_size - pcpue_size); 1266 free_bootmem(__pa(ptr + pcpue_size),
1267 memcpy(ptr, __per_cpu_load, static_size); 1267 pcpue_unit_size - pcpue_size);
1268 memcpy(ptr, __per_cpu_load, static_size);
1269 } else
1270 free_bootmem(__pa(ptr), pcpue_unit_size);
1268 } 1271 }
1269 1272
1270 /* we're ready, commit */ 1273 /* we're ready, commit */
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index bfbe13786bb4..875eda5dbad7 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1238,6 +1238,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
1238 return -ENOBUFS; 1238 return -ENOBUFS;
1239 1239
1240 *uaddr_len = sizeof(struct sockaddr_at); 1240 *uaddr_len = sizeof(struct sockaddr_at);
1241 memset(&sat.sat_zero, 0, sizeof(sat.sat_zero));
1241 1242
1242 if (peer) { 1243 if (peer) {
1243 if (sk->sk_state != TCP_ESTABLISHED) 1244 if (sk->sk_state != TCP_ESTABLISHED)
diff --git a/net/can/raw.c b/net/can/raw.c
index f4cc44548bda..db3152df7d2b 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -401,6 +401,7 @@ static int raw_getname(struct socket *sock, struct sockaddr *uaddr,
401 if (peer) 401 if (peer)
402 return -EOPNOTSUPP; 402 return -EOPNOTSUPP;
403 403
404 memset(addr, 0, sizeof(*addr));
404 addr->can_family = AF_CAN; 405 addr->can_family = AF_CAN;
405 addr->can_ifindex = ro->ifindex; 406 addr->can_ifindex = ro->ifindex;
406 407
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 78e5bfc454ae..493775f4f2f1 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -81,7 +81,7 @@
81struct gen_estimator 81struct gen_estimator
82{ 82{
83 struct list_head list; 83 struct list_head list;
84 struct gnet_stats_basic *bstats; 84 struct gnet_stats_basic_packed *bstats;
85 struct gnet_stats_rate_est *rate_est; 85 struct gnet_stats_rate_est *rate_est;
86 spinlock_t *stats_lock; 86 spinlock_t *stats_lock;
87 int ewma_log; 87 int ewma_log;
@@ -165,7 +165,7 @@ static void gen_add_node(struct gen_estimator *est)
165} 165}
166 166
167static 167static
168struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats, 168struct gen_estimator *gen_find_node(const struct gnet_stats_basic_packed *bstats,
169 const struct gnet_stats_rate_est *rate_est) 169 const struct gnet_stats_rate_est *rate_est)
170{ 170{
171 struct rb_node *p = est_root.rb_node; 171 struct rb_node *p = est_root.rb_node;
@@ -202,7 +202,7 @@ struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats,
202 * 202 *
203 * NOTE: Called under rtnl_mutex 203 * NOTE: Called under rtnl_mutex
204 */ 204 */
205int gen_new_estimator(struct gnet_stats_basic *bstats, 205int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
206 struct gnet_stats_rate_est *rate_est, 206 struct gnet_stats_rate_est *rate_est,
207 spinlock_t *stats_lock, 207 spinlock_t *stats_lock,
208 struct nlattr *opt) 208 struct nlattr *opt)
@@ -262,7 +262,7 @@ static void __gen_kill_estimator(struct rcu_head *head)
262 * 262 *
263 * NOTE: Called under rtnl_mutex 263 * NOTE: Called under rtnl_mutex
264 */ 264 */
265void gen_kill_estimator(struct gnet_stats_basic *bstats, 265void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
266 struct gnet_stats_rate_est *rate_est) 266 struct gnet_stats_rate_est *rate_est)
267{ 267{
268 struct gen_estimator *e; 268 struct gen_estimator *e;
@@ -292,7 +292,7 @@ EXPORT_SYMBOL(gen_kill_estimator);
292 * 292 *
293 * Returns 0 on success or a negative error code. 293 * Returns 0 on success or a negative error code.
294 */ 294 */
295int gen_replace_estimator(struct gnet_stats_basic *bstats, 295int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
296 struct gnet_stats_rate_est *rate_est, 296 struct gnet_stats_rate_est *rate_est,
297 spinlock_t *stats_lock, struct nlattr *opt) 297 spinlock_t *stats_lock, struct nlattr *opt)
298{ 298{
@@ -308,7 +308,7 @@ EXPORT_SYMBOL(gen_replace_estimator);
308 * 308 *
309 * Returns true if estimator is active, and false if not. 309 * Returns true if estimator is active, and false if not.
310 */ 310 */
311bool gen_estimator_active(const struct gnet_stats_basic *bstats, 311bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
312 const struct gnet_stats_rate_est *rate_est) 312 const struct gnet_stats_rate_est *rate_est)
313{ 313{
314 ASSERT_RTNL(); 314 ASSERT_RTNL();
diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c
index c3d0ffeac243..8569310268ab 100644
--- a/net/core/gen_stats.c
+++ b/net/core/gen_stats.c
@@ -106,16 +106,21 @@ gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
106 * if the room in the socket buffer was not sufficient. 106 * if the room in the socket buffer was not sufficient.
107 */ 107 */
108int 108int
109gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic *b) 109gnet_stats_copy_basic(struct gnet_dump *d, struct gnet_stats_basic_packed *b)
110{ 110{
111 if (d->compat_tc_stats) { 111 if (d->compat_tc_stats) {
112 d->tc_stats.bytes = b->bytes; 112 d->tc_stats.bytes = b->bytes;
113 d->tc_stats.packets = b->packets; 113 d->tc_stats.packets = b->packets;
114 } 114 }
115 115
116 if (d->tail) 116 if (d->tail) {
117 return gnet_stats_copy(d, TCA_STATS_BASIC, b, sizeof(*b)); 117 struct gnet_stats_basic sb;
118 118
119 memset(&sb, 0, sizeof(sb));
120 sb.bytes = b->bytes;
121 sb.packets = b->packets;
122 return gnet_stats_copy(d, TCA_STATS_BASIC, &sb, sizeof(sb));
123 }
119 return 0; 124 return 0;
120} 125}
121 126
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index df30feb2fc72..1b76eb11deb4 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -319,6 +319,11 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
319 319
320 udelay(USEC_PER_POLL); 320 udelay(USEC_PER_POLL);
321 } 321 }
322
323 WARN_ONCE(!irqs_disabled(),
324 "netpoll_send_skb(): %s enabled interrupts in poll (%pF)\n",
325 dev->name, ops->ndo_start_xmit);
326
322 local_irq_restore(flags); 327 local_irq_restore(flags);
323 } 328 }
324 329
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 3281013ce038..1bca9205104e 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1159,6 +1159,7 @@ static void __exit dccp_fini(void)
1159 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); 1159 kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);
1160 dccp_ackvec_exit(); 1160 dccp_ackvec_exit();
1161 dccp_sysctl_exit(); 1161 dccp_sysctl_exit();
1162 percpu_counter_destroy(&dccp_orphan_count);
1162} 1163}
1163 1164
1164module_init(dccp_init); 1165module_init(dccp_init);
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 2e1f836d4240..f0bbc57926cd 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -520,6 +520,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
520 if (peer) 520 if (peer)
521 return -EOPNOTSUPP; 521 return -EOPNOTSUPP;
522 522
523 memset(sec, 0, sizeof(*sec));
523 mutex_lock(&econet_mutex); 524 mutex_lock(&econet_mutex);
524 525
525 sk = sock->sk; 526 sk = sock->sk;
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index 3bb6bdb1dac1..af661805b9fa 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -136,7 +136,7 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
136 unsigned int cmd) 136 unsigned int cmd)
137{ 137{
138 struct ifreq ifr; 138 struct ifreq ifr;
139 int ret = -EINVAL; 139 int ret = -ENOIOCTLCMD;
140 struct net_device *dev; 140 struct net_device *dev;
141 141
142 if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) 142 if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
@@ -146,8 +146,10 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
146 146
147 dev_load(sock_net(sk), ifr.ifr_name); 147 dev_load(sock_net(sk), ifr.ifr_name);
148 dev = dev_get_by_name(sock_net(sk), ifr.ifr_name); 148 dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
149 if (dev->type == ARPHRD_IEEE802154 || 149
150 dev->type == ARPHRD_IEEE802154_PHY) 150 if ((dev->type == ARPHRD_IEEE802154 ||
151 dev->type == ARPHRD_IEEE802154_PHY) &&
152 dev->netdev_ops->ndo_do_ioctl)
151 ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd); 153 ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
152 154
153 if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq))) 155 if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq)))
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index 14d39840dd62..ba8b214dda8f 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -377,6 +377,18 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
377 return ret; 377 return ret;
378} 378}
379 379
380static int dgram_getsockopt(struct sock *sk, int level, int optname,
381 char __user *optval, int __user *optlen)
382{
383 return -EOPNOTSUPP;
384}
385
386static int dgram_setsockopt(struct sock *sk, int level, int optname,
387 char __user *optval, int __user optlen)
388{
389 return -EOPNOTSUPP;
390}
391
380struct proto ieee802154_dgram_prot = { 392struct proto ieee802154_dgram_prot = {
381 .name = "IEEE-802.15.4-MAC", 393 .name = "IEEE-802.15.4-MAC",
382 .owner = THIS_MODULE, 394 .owner = THIS_MODULE,
@@ -391,5 +403,7 @@ struct proto ieee802154_dgram_prot = {
391 .connect = dgram_connect, 403 .connect = dgram_connect,
392 .disconnect = dgram_disconnect, 404 .disconnect = dgram_disconnect,
393 .ioctl = dgram_ioctl, 405 .ioctl = dgram_ioctl,
406 .getsockopt = dgram_getsockopt,
407 .setsockopt = dgram_setsockopt,
394}; 408};
395 409
diff --git a/net/ieee802154/raw.c b/net/ieee802154/raw.c
index fca44d59f97e..9315977c4c61 100644
--- a/net/ieee802154/raw.c
+++ b/net/ieee802154/raw.c
@@ -238,6 +238,18 @@ void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb)
238 read_unlock(&raw_lock); 238 read_unlock(&raw_lock);
239} 239}
240 240
241static int raw_getsockopt(struct sock *sk, int level, int optname,
242 char __user *optval, int __user *optlen)
243{
244 return -EOPNOTSUPP;
245}
246
247static int raw_setsockopt(struct sock *sk, int level, int optname,
248 char __user *optval, int __user optlen)
249{
250 return -EOPNOTSUPP;
251}
252
241struct proto ieee802154_raw_prot = { 253struct proto ieee802154_raw_prot = {
242 .name = "IEEE-802.15.4-RAW", 254 .name = "IEEE-802.15.4-RAW",
243 .owner = THIS_MODULE, 255 .owner = THIS_MODULE,
@@ -250,5 +262,7 @@ struct proto ieee802154_raw_prot = {
250 .unhash = raw_unhash, 262 .unhash = raw_unhash,
251 .connect = raw_connect, 263 .connect = raw_connect,
252 .disconnect = raw_disconnect, 264 .disconnect = raw_disconnect,
265 .getsockopt = raw_getsockopt,
266 .setsockopt = raw_setsockopt,
253}; 267};
254 268
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index cb4a0f4bd5e5..82c11dd10a62 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -951,7 +951,7 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
951 addend += 4; 951 addend += 4;
952 } 952 }
953 dev->needed_headroom = addend + hlen; 953 dev->needed_headroom = addend + hlen;
954 mtu -= dev->hard_header_len - addend; 954 mtu -= dev->hard_header_len + addend;
955 955
956 if (mtu < 68) 956 if (mtu < 68)
957 mtu = 68; 957 mtu = 68;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index caa0278d30a9..45f9a2a42d56 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -306,8 +306,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
306 v4addr != htonl(INADDR_ANY) && 306 v4addr != htonl(INADDR_ANY) &&
307 chk_addr_ret != RTN_LOCAL && 307 chk_addr_ret != RTN_LOCAL &&
308 chk_addr_ret != RTN_MULTICAST && 308 chk_addr_ret != RTN_MULTICAST &&
309 chk_addr_ret != RTN_BROADCAST) 309 chk_addr_ret != RTN_BROADCAST) {
310 err = -EADDRNOTAVAIL;
310 goto out; 311 goto out;
312 }
311 } else { 313 } else {
312 if (addr_type != IPV6_ADDR_ANY) { 314 if (addr_type != IPV6_ADDR_ANY) {
313 struct net_device *dev = NULL; 315 struct net_device *dev = NULL;
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 80cf29aae096..50b43c57d5d8 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -715,6 +715,7 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr,
715 struct sock *sk = sock->sk; 715 struct sock *sk = sock->sk;
716 struct irda_sock *self = irda_sk(sk); 716 struct irda_sock *self = irda_sk(sk);
717 717
718 memset(&saddr, 0, sizeof(saddr));
718 if (peer) { 719 if (peer) {
719 if (sk->sk_state != TCP_ESTABLISHED) 720 if (sk->sk_state != TCP_ESTABLISHED)
720 return -ENOTCONN; 721 return -ENOTCONN;
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 9208cf5f2bd5..c45eee1c0e8d 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -914,6 +914,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
914 struct llc_sock *llc = llc_sk(sk); 914 struct llc_sock *llc = llc_sk(sk);
915 int rc = 0; 915 int rc = 0;
916 916
917 memset(&sllc, 0, sizeof(sllc));
917 lock_sock(sk); 918 lock_sock(sk);
918 if (sock_flag(sk, SOCK_ZAPPED)) 919 if (sock_flag(sk, SOCK_ZAPPED))
919 goto out; 920 goto out;
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 9e5762ad307d..a24e59816b93 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -381,6 +381,14 @@ static void ieee80211_agg_splice_packets(struct ieee80211_local *local,
381 &local->hw, queue, 381 &local->hw, queue,
382 IEEE80211_QUEUE_STOP_REASON_AGGREGATION); 382 IEEE80211_QUEUE_STOP_REASON_AGGREGATION);
383 383
384 if (!(sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK))
385 return;
386
387 if (WARN(!sta->ampdu_mlme.tid_tx[tid],
388 "TID %d gone but expected when splicing aggregates from"
389 "the pending queue\n", tid))
390 return;
391
384 if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) { 392 if (!skb_queue_empty(&sta->ampdu_mlme.tid_tx[tid]->pending)) {
385 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 393 spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
386 /* mark queue as pending, it is stopped already */ 394 /* mark queue as pending, it is stopped already */
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index ce267565e180..659a42d529e3 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -67,6 +67,8 @@ static DECLARE_WORK(todo_work, key_todo);
67 * 67 *
68 * @key: key to add to do item for 68 * @key: key to add to do item for
69 * @flag: todo flag(s) 69 * @flag: todo flag(s)
70 *
71 * Must be called with IRQs or softirqs disabled.
70 */ 72 */
71static void add_todo(struct ieee80211_key *key, u32 flag) 73static void add_todo(struct ieee80211_key *key, u32 flag)
72{ 74{
@@ -140,9 +142,9 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
140 ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf); 142 ret = drv_set_key(key->local, SET_KEY, &sdata->vif, sta, &key->conf);
141 143
142 if (!ret) { 144 if (!ret) {
143 spin_lock(&todo_lock); 145 spin_lock_bh(&todo_lock);
144 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; 146 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
145 spin_unlock(&todo_lock); 147 spin_unlock_bh(&todo_lock);
146 } 148 }
147 149
148 if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP) 150 if (ret && ret != -ENOSPC && ret != -EOPNOTSUPP)
@@ -164,12 +166,12 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
164 if (!key || !key->local->ops->set_key) 166 if (!key || !key->local->ops->set_key)
165 return; 167 return;
166 168
167 spin_lock(&todo_lock); 169 spin_lock_bh(&todo_lock);
168 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) { 170 if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
169 spin_unlock(&todo_lock); 171 spin_unlock_bh(&todo_lock);
170 return; 172 return;
171 } 173 }
172 spin_unlock(&todo_lock); 174 spin_unlock_bh(&todo_lock);
173 175
174 sta = get_sta_for_key(key); 176 sta = get_sta_for_key(key);
175 sdata = key->sdata; 177 sdata = key->sdata;
@@ -188,9 +190,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
188 wiphy_name(key->local->hw.wiphy), 190 wiphy_name(key->local->hw.wiphy),
189 key->conf.keyidx, sta ? sta->addr : bcast_addr, ret); 191 key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
190 192
191 spin_lock(&todo_lock); 193 spin_lock_bh(&todo_lock);
192 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 194 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
193 spin_unlock(&todo_lock); 195 spin_unlock_bh(&todo_lock);
194} 196}
195 197
196static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, 198static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
@@ -437,14 +439,14 @@ void ieee80211_key_link(struct ieee80211_key *key,
437 439
438 __ieee80211_key_replace(sdata, sta, old_key, key); 440 __ieee80211_key_replace(sdata, sta, old_key, key);
439 441
440 spin_unlock_irqrestore(&sdata->local->key_lock, flags);
441
442 /* free old key later */ 442 /* free old key later */
443 add_todo(old_key, KEY_FLAG_TODO_DELETE); 443 add_todo(old_key, KEY_FLAG_TODO_DELETE);
444 444
445 add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS); 445 add_todo(key, KEY_FLAG_TODO_ADD_DEBUGFS);
446 if (netif_running(sdata->dev)) 446 if (netif_running(sdata->dev))
447 add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD); 447 add_todo(key, KEY_FLAG_TODO_HWACCEL_ADD);
448
449 spin_unlock_irqrestore(&sdata->local->key_lock, flags);
448} 450}
449 451
450static void __ieee80211_key_free(struct ieee80211_key *key) 452static void __ieee80211_key_free(struct ieee80211_key *key)
@@ -547,7 +549,7 @@ static void __ieee80211_key_todo(void)
547 */ 549 */
548 synchronize_rcu(); 550 synchronize_rcu();
549 551
550 spin_lock(&todo_lock); 552 spin_lock_bh(&todo_lock);
551 while (!list_empty(&todo_list)) { 553 while (!list_empty(&todo_list)) {
552 key = list_first_entry(&todo_list, struct ieee80211_key, todo); 554 key = list_first_entry(&todo_list, struct ieee80211_key, todo);
553 list_del_init(&key->todo); 555 list_del_init(&key->todo);
@@ -558,7 +560,7 @@ static void __ieee80211_key_todo(void)
558 KEY_FLAG_TODO_HWACCEL_REMOVE | 560 KEY_FLAG_TODO_HWACCEL_REMOVE |
559 KEY_FLAG_TODO_DELETE); 561 KEY_FLAG_TODO_DELETE);
560 key->flags &= ~todoflags; 562 key->flags &= ~todoflags;
561 spin_unlock(&todo_lock); 563 spin_unlock_bh(&todo_lock);
562 564
563 work_done = false; 565 work_done = false;
564 566
@@ -591,9 +593,9 @@ static void __ieee80211_key_todo(void)
591 593
592 WARN_ON(!work_done); 594 WARN_ON(!work_done);
593 595
594 spin_lock(&todo_lock); 596 spin_lock_bh(&todo_lock);
595 } 597 }
596 spin_unlock(&todo_lock); 598 spin_unlock_bh(&todo_lock);
597} 599}
598 600
599void ieee80211_key_todo(void) 601void ieee80211_key_todo(void)
diff --git a/net/netfilter/xt_RATEEST.c b/net/netfilter/xt_RATEEST.c
index 43f5676b1af4..d80b8192e0d4 100644
--- a/net/netfilter/xt_RATEEST.c
+++ b/net/netfilter/xt_RATEEST.c
@@ -74,7 +74,7 @@ static unsigned int
74xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par) 74xt_rateest_tg(struct sk_buff *skb, const struct xt_target_param *par)
75{ 75{
76 const struct xt_rateest_target_info *info = par->targinfo; 76 const struct xt_rateest_target_info *info = par->targinfo;
77 struct gnet_stats_basic *stats = &info->est->bstats; 77 struct gnet_stats_basic_packed *stats = &info->est->bstats;
78 78
79 spin_lock_bh(&info->est->lock); 79 spin_lock_bh(&info->est->lock);
80 stats->bytes += skb->len; 80 stats->bytes += skb->len;
diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
index 98fc190e8f0e..390b7d09fe51 100644
--- a/net/netfilter/xt_quota.c
+++ b/net/netfilter/xt_quota.c
@@ -52,7 +52,7 @@ static bool quota_mt_check(const struct xt_mtchk_param *par)
52 52
53 q->master = kmalloc(sizeof(*q->master), GFP_KERNEL); 53 q->master = kmalloc(sizeof(*q->master), GFP_KERNEL);
54 if (q->master == NULL) 54 if (q->master == NULL)
55 return -ENOMEM; 55 return false;
56 56
57 q->master->quota = q->quota; 57 q->master->quota = q->quota;
58 return true; 58 return true;
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index ce51ce012cda..ce1a34b99c23 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -847,6 +847,7 @@ static int nr_getname(struct socket *sock, struct sockaddr *uaddr,
847 sax->fsa_ax25.sax25_family = AF_NETROM; 847 sax->fsa_ax25.sax25_family = AF_NETROM;
848 sax->fsa_ax25.sax25_ndigis = 1; 848 sax->fsa_ax25.sax25_ndigis = 1;
849 sax->fsa_ax25.sax25_call = nr->user_addr; 849 sax->fsa_ax25.sax25_call = nr->user_addr;
850 memset(sax->fsa_digipeater, 0, sizeof(sax->fsa_digipeater));
850 sax->fsa_digipeater[0] = nr->dest_addr; 851 sax->fsa_digipeater[0] = nr->dest_addr;
851 *uaddr_len = sizeof(struct full_sockaddr_ax25); 852 *uaddr_len = sizeof(struct full_sockaddr_ax25);
852 } else { 853 } else {
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index e943c16552a2..4eb1ac9a7679 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -630,23 +630,23 @@ out:
630 return dev; 630 return dev;
631} 631}
632 632
633static ax25_digi *nr_call_to_digi(int ndigis, ax25_address *digipeaters) 633static ax25_digi *nr_call_to_digi(ax25_digi *digi, int ndigis,
634 ax25_address *digipeaters)
634{ 635{
635 static ax25_digi ax25_digi;
636 int i; 636 int i;
637 637
638 if (ndigis == 0) 638 if (ndigis == 0)
639 return NULL; 639 return NULL;
640 640
641 for (i = 0; i < ndigis; i++) { 641 for (i = 0; i < ndigis; i++) {
642 ax25_digi.calls[i] = digipeaters[i]; 642 digi->calls[i] = digipeaters[i];
643 ax25_digi.repeated[i] = 0; 643 digi->repeated[i] = 0;
644 } 644 }
645 645
646 ax25_digi.ndigi = ndigis; 646 digi->ndigi = ndigis;
647 ax25_digi.lastrepeat = -1; 647 digi->lastrepeat = -1;
648 648
649 return &ax25_digi; 649 return digi;
650} 650}
651 651
652/* 652/*
@@ -656,6 +656,7 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
656{ 656{
657 struct nr_route_struct nr_route; 657 struct nr_route_struct nr_route;
658 struct net_device *dev; 658 struct net_device *dev;
659 ax25_digi digi;
659 int ret; 660 int ret;
660 661
661 switch (cmd) { 662 switch (cmd) {
@@ -673,13 +674,15 @@ int nr_rt_ioctl(unsigned int cmd, void __user *arg)
673 ret = nr_add_node(&nr_route.callsign, 674 ret = nr_add_node(&nr_route.callsign,
674 nr_route.mnemonic, 675 nr_route.mnemonic,
675 &nr_route.neighbour, 676 &nr_route.neighbour,
676 nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), 677 nr_call_to_digi(&digi, nr_route.ndigis,
678 nr_route.digipeaters),
677 dev, nr_route.quality, 679 dev, nr_route.quality,
678 nr_route.obs_count); 680 nr_route.obs_count);
679 break; 681 break;
680 case NETROM_NEIGH: 682 case NETROM_NEIGH:
681 ret = nr_add_neigh(&nr_route.callsign, 683 ret = nr_add_neigh(&nr_route.callsign,
682 nr_call_to_digi(nr_route.ndigis, nr_route.digipeaters), 684 nr_call_to_digi(&digi, nr_route.ndigis,
685 nr_route.digipeaters),
683 dev, nr_route.quality); 686 dev, nr_route.quality);
684 break; 687 break;
685 default: 688 default:
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index b0d6ddd82a9d..c2b77a698695 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -96,7 +96,7 @@ struct net_device *phonet_device_get(struct net *net)
96{ 96{
97 struct phonet_device_list *pndevs = phonet_device_list(net); 97 struct phonet_device_list *pndevs = phonet_device_list(net);
98 struct phonet_device *pnd; 98 struct phonet_device *pnd;
99 struct net_device *dev; 99 struct net_device *dev = NULL;
100 100
101 spin_lock_bh(&pndevs->lock); 101 spin_lock_bh(&pndevs->lock);
102 list_for_each_entry(pnd, &pndevs->list, list) { 102 list_for_each_entry(pnd, &pndevs->list, list) {
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index f0a76f6bca71..e5f478ca3d61 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -954,6 +954,7 @@ static int rose_getname(struct socket *sock, struct sockaddr *uaddr,
954 struct rose_sock *rose = rose_sk(sk); 954 struct rose_sock *rose = rose_sk(sk);
955 int n; 955 int n;
956 956
957 memset(srose, 0, sizeof(*srose));
957 if (peer != 0) { 958 if (peer != 0) {
958 if (sk->sk_state != TCP_ESTABLISHED) 959 if (sk->sk_state != TCP_ESTABLISHED)
959 return -ENOTCONN; 960 return -ENOTCONN;
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 24d17ce9c294..e1c2bf7e9ba4 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -468,8 +468,8 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
468 468
469void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc) 469void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc)
470{ 470{
471 hrtimer_init(&wd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 471 tasklet_hrtimer_init(&wd->timer, qdisc_watchdog,
472 wd->timer.function = qdisc_watchdog; 472 CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
473 wd->qdisc = qdisc; 473 wd->qdisc = qdisc;
474} 474}
475EXPORT_SYMBOL(qdisc_watchdog_init); 475EXPORT_SYMBOL(qdisc_watchdog_init);
@@ -485,13 +485,13 @@ void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires)
485 wd->qdisc->flags |= TCQ_F_THROTTLED; 485 wd->qdisc->flags |= TCQ_F_THROTTLED;
486 time = ktime_set(0, 0); 486 time = ktime_set(0, 0);
487 time = ktime_add_ns(time, PSCHED_TICKS2NS(expires)); 487 time = ktime_add_ns(time, PSCHED_TICKS2NS(expires));
488 hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS); 488 tasklet_hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS);
489} 489}
490EXPORT_SYMBOL(qdisc_watchdog_schedule); 490EXPORT_SYMBOL(qdisc_watchdog_schedule);
491 491
492void qdisc_watchdog_cancel(struct qdisc_watchdog *wd) 492void qdisc_watchdog_cancel(struct qdisc_watchdog *wd)
493{ 493{
494 hrtimer_cancel(&wd->timer); 494 tasklet_hrtimer_cancel(&wd->timer);
495 wd->qdisc->flags &= ~TCQ_F_THROTTLED; 495 wd->qdisc->flags &= ~TCQ_F_THROTTLED;
496} 496}
497EXPORT_SYMBOL(qdisc_watchdog_cancel); 497EXPORT_SYMBOL(qdisc_watchdog_cancel);
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 2a8b83af7c47..ab82f145f689 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -49,7 +49,7 @@ struct atm_flow_data {
49 struct socket *sock; /* for closing */ 49 struct socket *sock; /* for closing */
50 u32 classid; /* x:y type ID */ 50 u32 classid; /* x:y type ID */
51 int ref; /* reference count */ 51 int ref; /* reference count */
52 struct gnet_stats_basic bstats; 52 struct gnet_stats_basic_packed bstats;
53 struct gnet_stats_queue qstats; 53 struct gnet_stats_queue qstats;
54 struct atm_flow_data *next; 54 struct atm_flow_data *next;
55 struct atm_flow_data *excess; /* flow for excess traffic; 55 struct atm_flow_data *excess; /* flow for excess traffic;
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 23a167670fd5..81652d6ccd36 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -128,7 +128,7 @@ struct cbq_class
128 long avgidle; 128 long avgidle;
129 long deficit; /* Saved deficit for WRR */ 129 long deficit; /* Saved deficit for WRR */
130 psched_time_t penalized; 130 psched_time_t penalized;
131 struct gnet_stats_basic bstats; 131 struct gnet_stats_basic_packed bstats;
132 struct gnet_stats_queue qstats; 132 struct gnet_stats_queue qstats;
133 struct gnet_stats_rate_est rate_est; 133 struct gnet_stats_rate_est rate_est;
134 struct tc_cbq_xstats xstats; 134 struct tc_cbq_xstats xstats;
@@ -163,7 +163,7 @@ struct cbq_sched_data
163 psched_time_t now_rt; /* Cached real time */ 163 psched_time_t now_rt; /* Cached real time */
164 unsigned pmask; 164 unsigned pmask;
165 165
166 struct hrtimer delay_timer; 166 struct tasklet_hrtimer delay_timer;
167 struct qdisc_watchdog watchdog; /* Watchdog timer, 167 struct qdisc_watchdog watchdog; /* Watchdog timer,
168 started when CBQ has 168 started when CBQ has
169 backlog, but cannot 169 backlog, but cannot
@@ -503,6 +503,8 @@ static void cbq_ovl_delay(struct cbq_class *cl)
503 cl->undertime = q->now + delay; 503 cl->undertime = q->now + delay;
504 504
505 if (delay > 0) { 505 if (delay > 0) {
506 struct hrtimer *ht;
507
506 sched += delay + cl->penalty; 508 sched += delay + cl->penalty;
507 cl->penalized = sched; 509 cl->penalized = sched;
508 cl->cpriority = TC_CBQ_MAXPRIO; 510 cl->cpriority = TC_CBQ_MAXPRIO;
@@ -510,12 +512,12 @@ static void cbq_ovl_delay(struct cbq_class *cl)
510 512
511 expires = ktime_set(0, 0); 513 expires = ktime_set(0, 0);
512 expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); 514 expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched));
513 if (hrtimer_try_to_cancel(&q->delay_timer) && 515 ht = &q->delay_timer.timer;
514 ktime_to_ns(ktime_sub( 516 if (hrtimer_try_to_cancel(ht) &&
515 hrtimer_get_expires(&q->delay_timer), 517 ktime_to_ns(ktime_sub(hrtimer_get_expires(ht),
516 expires)) > 0) 518 expires)) > 0)
517 hrtimer_set_expires(&q->delay_timer, expires); 519 hrtimer_set_expires(ht, expires);
518 hrtimer_restart(&q->delay_timer); 520 hrtimer_restart(ht);
519 cl->delayed = 1; 521 cl->delayed = 1;
520 cl->xstats.overactions++; 522 cl->xstats.overactions++;
521 return; 523 return;
@@ -621,7 +623,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
621 623
622 time = ktime_set(0, 0); 624 time = ktime_set(0, 0);
623 time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); 625 time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay));
624 hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); 626 tasklet_hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS);
625 } 627 }
626 628
627 sch->flags &= ~TCQ_F_THROTTLED; 629 sch->flags &= ~TCQ_F_THROTTLED;
@@ -1214,7 +1216,7 @@ cbq_reset(struct Qdisc* sch)
1214 q->tx_class = NULL; 1216 q->tx_class = NULL;
1215 q->tx_borrowed = NULL; 1217 q->tx_borrowed = NULL;
1216 qdisc_watchdog_cancel(&q->watchdog); 1218 qdisc_watchdog_cancel(&q->watchdog);
1217 hrtimer_cancel(&q->delay_timer); 1219 tasklet_hrtimer_cancel(&q->delay_timer);
1218 q->toplevel = TC_CBQ_MAXLEVEL; 1220 q->toplevel = TC_CBQ_MAXLEVEL;
1219 q->now = psched_get_time(); 1221 q->now = psched_get_time();
1220 q->now_rt = q->now; 1222 q->now_rt = q->now;
@@ -1397,7 +1399,8 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
1397 q->link.minidle = -0x7FFFFFFF; 1399 q->link.minidle = -0x7FFFFFFF;
1398 1400
1399 qdisc_watchdog_init(&q->watchdog, sch); 1401 qdisc_watchdog_init(&q->watchdog, sch);
1400 hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 1402 tasklet_hrtimer_init(&q->delay_timer, cbq_undelay,
1403 CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
1401 q->delay_timer.function = cbq_undelay; 1404 q->delay_timer.function = cbq_undelay;
1402 q->toplevel = TC_CBQ_MAXLEVEL; 1405 q->toplevel = TC_CBQ_MAXLEVEL;
1403 q->now = psched_get_time(); 1406 q->now = psched_get_time();
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index 7597fe146866..12b2fb04b29b 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -22,7 +22,7 @@ struct drr_class {
22 unsigned int refcnt; 22 unsigned int refcnt;
23 unsigned int filter_cnt; 23 unsigned int filter_cnt;
24 24
25 struct gnet_stats_basic bstats; 25 struct gnet_stats_basic_packed bstats;
26 struct gnet_stats_queue qstats; 26 struct gnet_stats_queue qstats;
27 struct gnet_stats_rate_est rate_est; 27 struct gnet_stats_rate_est rate_est;
28 struct list_head alist; 28 struct list_head alist;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 362c2811b2df..dad0144423da 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -116,7 +116,7 @@ struct hfsc_class
116 struct Qdisc_class_common cl_common; 116 struct Qdisc_class_common cl_common;
117 unsigned int refcnt; /* usage count */ 117 unsigned int refcnt; /* usage count */
118 118
119 struct gnet_stats_basic bstats; 119 struct gnet_stats_basic_packed bstats;
120 struct gnet_stats_queue qstats; 120 struct gnet_stats_queue qstats;
121 struct gnet_stats_rate_est rate_est; 121 struct gnet_stats_rate_est rate_est;
122 unsigned int level; /* class level in hierarchy */ 122 unsigned int level; /* class level in hierarchy */
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 88cd02626621..ec4d46399d59 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -74,7 +74,7 @@ enum htb_cmode {
74struct htb_class { 74struct htb_class {
75 struct Qdisc_class_common common; 75 struct Qdisc_class_common common;
76 /* general class parameters */ 76 /* general class parameters */
77 struct gnet_stats_basic bstats; 77 struct gnet_stats_basic_packed bstats;
78 struct gnet_stats_queue qstats; 78 struct gnet_stats_queue qstats;
79 struct gnet_stats_rate_est rate_est; 79 struct gnet_stats_rate_est rate_est;
80 struct tc_htb_xstats xstats; /* our special stats */ 80 struct tc_htb_xstats xstats; /* our special stats */
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 79cbd47f4df7..a76da657244a 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -160,6 +160,7 @@ static void sctp_proc_exit(void)
160 remove_proc_entry("sctp", init_net.proc_net); 160 remove_proc_entry("sctp", init_net.proc_net);
161 } 161 }
162#endif 162#endif
163 percpu_counter_destroy(&sctp_sockets_allocated);
163} 164}
164 165
165/* Private helper to extract ipv4 address and stash them in 166/* Private helper to extract ipv4 address and stash them in
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h
index d401dc8f05ed..e5195c99f71e 100644
--- a/net/xfrm/xfrm_hash.h
+++ b/net/xfrm/xfrm_hash.h
@@ -16,7 +16,7 @@ static inline unsigned int __xfrm6_addr_hash(xfrm_address_t *addr)
16 16
17static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) 17static inline unsigned int __xfrm4_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)
18{ 18{
19 return ntohl(daddr->a4 ^ saddr->a4); 19 return ntohl(daddr->a4 + saddr->a4);
20} 20}
21 21
22static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr) 22static inline unsigned int __xfrm6_daddr_saddr_hash(xfrm_address_t *daddr, xfrm_address_t *saddr)
diff --git a/security/Kconfig b/security/Kconfig
index 9c60c346a91d..4c865345caa0 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -114,9 +114,9 @@ config SECURITY_ROOTPLUG
114 If you are unsure how to answer this question, answer N. 114 If you are unsure how to answer this question, answer N.
115 115
116config LSM_MMAP_MIN_ADDR 116config LSM_MMAP_MIN_ADDR
117 int "Low address space for LSM to from user allocation" 117 int "Low address space for LSM to protect from user allocation"
118 depends on SECURITY && SECURITY_SELINUX 118 depends on SECURITY && SECURITY_SELINUX
119 default 65535 119 default 65536
120 help 120 help
121 This is the portion of low virtual memory which should be protected 121 This is the portion of low virtual memory which should be protected
122 from userspace allocation. Keeping a user from writing to low pages 122 from userspace allocation. Keeping a user from writing to low pages
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
index 63003a63aaee..46642a19bc78 100644
--- a/security/integrity/ima/ima_crypto.c
+++ b/security/integrity/ima/ima_crypto.c
@@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest)
45{ 45{
46 struct hash_desc desc; 46 struct hash_desc desc;
47 struct scatterlist sg[1]; 47 struct scatterlist sg[1];
48 loff_t i_size; 48 loff_t i_size, offset = 0;
49 char *rbuf; 49 char *rbuf;
50 int rc, offset = 0; 50 int rc;
51 51
52 rc = init_desc(&desc); 52 rc = init_desc(&desc);
53 if (rc != 0) 53 if (rc != 0)
@@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest)
67 rc = rbuf_len; 67 rc = rbuf_len;
68 break; 68 break;
69 } 69 }
70 if (rbuf_len == 0)
71 break;
70 offset += rbuf_len; 72 offset += rbuf_len;
71 sg_init_one(sg, rbuf, rbuf_len); 73 sg_init_one(sg, rbuf, rbuf_len);
72 74
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 72cfd47af6b8..9db60d831bb2 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -943,47 +943,24 @@ static int snd_interval_ratden(struct snd_interval *i,
943int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask) 943int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask)
944{ 944{
945 unsigned int k; 945 unsigned int k;
946 int changed = 0; 946 struct snd_interval list_range;
947 947
948 if (!count) { 948 if (!count) {
949 i->empty = 1; 949 i->empty = 1;
950 return -EINVAL; 950 return -EINVAL;
951 } 951 }
952 snd_interval_any(&list_range);
953 list_range.min = UINT_MAX;
954 list_range.max = 0;
952 for (k = 0; k < count; k++) { 955 for (k = 0; k < count; k++) {
953 if (mask && !(mask & (1 << k))) 956 if (mask && !(mask & (1 << k)))
954 continue; 957 continue;
955 if (i->min == list[k] && !i->openmin) 958 if (!snd_interval_test(i, list[k]))
956 goto _l1;
957 if (i->min < list[k]) {
958 i->min = list[k];
959 i->openmin = 0;
960 changed = 1;
961 goto _l1;
962 }
963 }
964 i->empty = 1;
965 return -EINVAL;
966 _l1:
967 for (k = count; k-- > 0;) {
968 if (mask && !(mask & (1 << k)))
969 continue; 959 continue;
970 if (i->max == list[k] && !i->openmax) 960 list_range.min = min(list_range.min, list[k]);
971 goto _l2; 961 list_range.max = max(list_range.max, list[k]);
972 if (i->max > list[k]) {
973 i->max = list[k];
974 i->openmax = 0;
975 changed = 1;
976 goto _l2;
977 }
978 } 962 }
979 i->empty = 1; 963 return snd_interval_refine(i, &list_range);
980 return -EINVAL;
981 _l2:
982 if (snd_interval_checkempty(i)) {
983 i->empty = 1;
984 return -EINVAL;
985 }
986 return changed;
987} 964}
988 965
989EXPORT_SYMBOL(snd_interval_list); 966EXPORT_SYMBOL(snd_interval_list);
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index c551006e2920..76d76c08339b 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -310,12 +310,16 @@ static int snd_ali_codec_ready(struct snd_ali *codec,
310 unsigned int res; 310 unsigned int res;
311 311
312 end_time = jiffies + msecs_to_jiffies(250); 312 end_time = jiffies + msecs_to_jiffies(250);
313 do { 313
314 for (;;) {
314 res = snd_ali_5451_peek(codec,port); 315 res = snd_ali_5451_peek(codec,port);
315 if (!(res & 0x8000)) 316 if (!(res & 0x8000))
316 return 0; 317 return 0;
318 if (!time_after_eq(end_time, jiffies))
319 break;
317 schedule_timeout_uninterruptible(1); 320 schedule_timeout_uninterruptible(1);
318 } while (time_after_eq(end_time, jiffies)); 321 }
322
319 snd_ali_5451_poke(codec, port, res & ~0x8000); 323 snd_ali_5451_poke(codec, port, res & ~0x8000);
320 snd_printdd("ali_codec_ready: codec is not ready.\n "); 324 snd_printdd("ali_codec_ready: codec is not ready.\n ");
321 return -EIO; 325 return -EIO;
@@ -327,15 +331,17 @@ static int snd_ali_stimer_ready(struct snd_ali *codec)
327 unsigned long dwChk1,dwChk2; 331 unsigned long dwChk1,dwChk2;
328 332
329 dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER); 333 dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER);
330 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
331
332 end_time = jiffies + msecs_to_jiffies(250); 334 end_time = jiffies + msecs_to_jiffies(250);
333 do { 335
336 for (;;) {
334 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); 337 dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
335 if (dwChk2 != dwChk1) 338 if (dwChk2 != dwChk1)
336 return 0; 339 return 0;
340 if (!time_after_eq(end_time, jiffies))
341 break;
337 schedule_timeout_uninterruptible(1); 342 schedule_timeout_uninterruptible(1);
338 } while (time_after_eq(end_time, jiffies)); 343 }
344
339 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); 345 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n");
340 return -EIO; 346 return -EIO;
341} 347}
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 3da85caf8af1..403588c6e3f6 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -3835,9 +3835,11 @@ static struct hda_verb ad1884a_laptop_verbs[] = {
3835 /* Port-F (int speaker) mixer - route only from analog mixer */ 3835 /* Port-F (int speaker) mixer - route only from analog mixer */
3836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3838 /* Port-F pin */ 3838 /* Port-F (int speaker) pin */
3839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3840 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3841 /* required for compaq 6530s/6531s speaker output */
3842 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3841 /* Port-C pin - internal mic-in */ 3843 /* Port-C pin - internal mic-in */
3842 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3844 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3843 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ 3845 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fea976793ae5..6f683e451f2b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -12521,8 +12521,6 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
12521 ALC268_TOSHIBA), 12521 ALC268_TOSHIBA),
12522 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 12522 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12523 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), 12523 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12524 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12525 ALC268_TOSHIBA),
12526 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), 12524 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12527 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 12525 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12528 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), 12526 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
@@ -12530,6 +12528,15 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
12530 {} 12528 {}
12531}; 12529};
12532 12530
12531/* Toshiba laptops have no unique PCI SSID but only codec SSID */
12532static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12533 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12534 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12535 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12536 ALC268_TOSHIBA),
12537 {}
12538};
12539
12533static struct alc_config_preset alc268_presets[] = { 12540static struct alc_config_preset alc268_presets[] = {
12534 [ALC267_QUANTA_IL1] = { 12541 [ALC267_QUANTA_IL1] = {
12535 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, 12542 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
@@ -12696,6 +12703,10 @@ static int patch_alc268(struct hda_codec *codec)
12696 alc268_models, 12703 alc268_models,
12697 alc268_cfg_tbl); 12704 alc268_cfg_tbl);
12698 12705
12706 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12707 board_config = snd_hda_check_board_codec_sid_config(codec,
12708 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12709
12699 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { 12710 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12700 printk(KERN_INFO "hda_codec: Unknown model for %s, " 12711 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12701 "trying auto-probe from BIOS...\n", codec->chip_name); 12712 "trying auto-probe from BIOS...\n", codec->chip_name);
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 456ef6ac12e4..6990cfcb6a38 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -76,6 +76,7 @@ enum {
76 STAC_92HD73XX_AUTO, 76 STAC_92HD73XX_AUTO,
77 STAC_92HD73XX_NO_JD, /* no jack-detection */ 77 STAC_92HD73XX_NO_JD, /* no jack-detection */
78 STAC_92HD73XX_REF, 78 STAC_92HD73XX_REF,
79 STAC_92HD73XX_INTEL,
79 STAC_DELL_M6_AMIC, 80 STAC_DELL_M6_AMIC,
80 STAC_DELL_M6_DMIC, 81 STAC_DELL_M6_DMIC,
81 STAC_DELL_M6_BOTH, 82 STAC_DELL_M6_BOTH,
@@ -1777,6 +1778,7 @@ static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1777 [STAC_92HD73XX_AUTO] = "auto", 1778 [STAC_92HD73XX_AUTO] = "auto",
1778 [STAC_92HD73XX_NO_JD] = "no-jd", 1779 [STAC_92HD73XX_NO_JD] = "no-jd",
1779 [STAC_92HD73XX_REF] = "ref", 1780 [STAC_92HD73XX_REF] = "ref",
1781 [STAC_92HD73XX_INTEL] = "intel",
1780 [STAC_DELL_M6_AMIC] = "dell-m6-amic", 1782 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1781 [STAC_DELL_M6_DMIC] = "dell-m6-dmic", 1783 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1782 [STAC_DELL_M6_BOTH] = "dell-m6", 1784 [STAC_DELL_M6_BOTH] = "dell-m6",
@@ -1789,6 +1791,10 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1789 "DFI LanParty", STAC_92HD73XX_REF), 1791 "DFI LanParty", STAC_92HD73XX_REF),
1790 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 1792 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1791 "DFI LanParty", STAC_92HD73XX_REF), 1793 "DFI LanParty", STAC_92HD73XX_REF),
1794 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1795 "Intel DG45ID", STAC_92HD73XX_INTEL),
1796 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1797 "Intel DG45FC", STAC_92HD73XX_INTEL),
1792 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, 1798 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1793 "Dell Studio 1535", STAC_DELL_M6_DMIC), 1799 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1794 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, 1800 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index 6416d3f0c7be..a69e774d0b13 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -885,10 +885,10 @@ static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
885 struct vx_core *_chip = snd_kcontrol_chip(kcontrol); 885 struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
886 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 886 struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
887 if (ucontrol->value.integer.value[0] < 0 || 887 if (ucontrol->value.integer.value[0] < 0 ||
888 ucontrol->value.integer.value[0] < MIC_LEVEL_MAX) 888 ucontrol->value.integer.value[0] > MIC_LEVEL_MAX)
889 return -EINVAL; 889 return -EINVAL;
890 if (ucontrol->value.integer.value[1] < 0 || 890 if (ucontrol->value.integer.value[1] < 0 ||
891 ucontrol->value.integer.value[1] < MIC_LEVEL_MAX) 891 ucontrol->value.integer.value[1] > MIC_LEVEL_MAX)
892 return -EINVAL; 892 return -EINVAL;
893 mutex_lock(&_chip->mixer_mutex); 893 mutex_lock(&_chip->mixer_mutex);
894 if (chip->input_level[0] != ucontrol->value.integer.value[0] || 894 if (chip->input_level[0] != ucontrol->value.integer.value[0] ||
diff --git a/tools/perf/Documentation/Makefile b/tools/perf/Documentation/Makefile
index 5457192e1b41..bdd3b7ecad0a 100644
--- a/tools/perf/Documentation/Makefile
+++ b/tools/perf/Documentation/Makefile
@@ -35,7 +35,7 @@ man7dir=$(mandir)/man7
35# DESTDIR= 35# DESTDIR=
36 36
37ASCIIDOC=asciidoc 37ASCIIDOC=asciidoc
38ASCIIDOC_EXTRA = 38ASCIIDOC_EXTRA = --unsafe
39MANPAGE_XSL = manpage-normal.xsl 39MANPAGE_XSL = manpage-normal.xsl
40XMLTO_EXTRA = 40XMLTO_EXTRA =
41INSTALL?=install 41INSTALL?=install
diff --git a/tools/perf/Documentation/perf-examples.txt b/tools/perf/Documentation/examples.txt
index 8eb6c489fb15..8eb6c489fb15 100644
--- a/tools/perf/Documentation/perf-examples.txt
+++ b/tools/perf/Documentation/examples.txt
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 1dba568e1941..343e7b14bf01 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -980,6 +980,13 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
980 (void *)(long)(event->header.size), 980 (void *)(long)(event->header.size),
981 event->fork.pid, event->fork.ppid); 981 event->fork.pid, event->fork.ppid);
982 982
983 /*
984 * A thread clone will have the same PID for both
985 * parent and child.
986 */
987 if (thread == parent)
988 return 0;
989
983 if (!thread || !parent || thread__fork(thread, parent)) { 990 if (!thread || !parent || thread__fork(thread, parent)) {
984 dprintf("problem processing PERF_EVENT_FORK, skipping event.\n"); 991 dprintf("problem processing PERF_EVENT_FORK, skipping event.\n");
985 return -1; 992 return -1;
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3d051b9cf25f..89a5ddcd1ded 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -219,7 +219,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full)
219 snprintf(filename, sizeof(filename), "/proc/%d/status", pid); 219 snprintf(filename, sizeof(filename), "/proc/%d/status", pid);
220 220
221 fp = fopen(filename, "r"); 221 fp = fopen(filename, "r");
222 if (fd == NULL) { 222 if (fp == NULL) {
223 /* 223 /*
224 * We raced with a task exiting - just return: 224 * We raced with a task exiting - just return:
225 */ 225 */