aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/HOWTO28
-rw-r--r--MAINTAINERS8
-rw-r--r--Makefile2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/sys_arm.c13
-rw-r--r--arch/arm/mach-at91/pm.c4
-rw-r--r--arch/blackfin/Kconfig6
-rw-r--r--arch/blackfin/Makefile21
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig12
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig26
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig26
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig12
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig13
-rw-r--r--arch/blackfin/kernel/setup.c18
-rw-r--r--arch/blackfin/kernel/traps.c3
-rw-r--r--arch/i386/kernel/acpi/boot.c21
-rw-r--r--arch/i386/kernel/cpu/mtrr/cyrix.c4
-rw-r--r--arch/i386/kernel/cpu/mtrr/generic.c8
-rw-r--r--arch/i386/kernel/cpu/perfctr-watchdog.c35
-rw-r--r--arch/mips/jazz/setup.c2
-rw-r--r--arch/mips/kernel/smp-mt.c4
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c9
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S2
-rw-r--r--arch/sparc64/kernel/irq.c12
-rw-r--r--drivers/acpi/asus_acpi.c3
-rw-r--r--drivers/acpi/osl.c4
-rw-r--r--drivers/ata/Kconfig5
-rw-r--r--drivers/ata/ata_generic.c2
-rw-r--r--drivers/ata/libata-core.c9
-rw-r--r--drivers/ata/libata-sff.c5
-rw-r--r--drivers/ata/pata_ali.c8
-rw-r--r--drivers/ata/pata_cs5520.c5
-rw-r--r--drivers/ata/pata_pcmcia.c2
-rw-r--r--drivers/ata/pata_pdc2027x.c11
-rw-r--r--drivers/ata/pata_pdc202xx_old.c4
-rw-r--r--drivers/ata/pata_sis.c46
-rw-r--r--drivers/ata/sata_inic162x.c7
-rw-r--r--drivers/ata/sata_mv.c3
-rw-r--r--drivers/ata/sata_nv.c1
-rw-r--r--drivers/ata/sata_sis.c39
-rw-r--r--drivers/ata/sis.h2
-rw-r--r--drivers/atm/Kconfig2
-rw-r--r--drivers/dma/ioatdma.c8
-rw-r--r--drivers/firewire/Kconfig65
-rw-r--r--drivers/firewire/fw-ohci.c6
-rw-r--r--drivers/ide/ide-probe.c4
-rw-r--r--drivers/ide/ide-taskfile.c12
-rw-r--r--drivers/ide/pci/amd74xx.c8
-rw-r--r--drivers/ide/pci/hpt366.c21
-rw-r--r--drivers/ide/pci/it821x.c3
-rw-r--r--drivers/ide/pci/pdc202xx_new.c10
-rw-r--r--drivers/ide/setup-pci.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c4
-rw-r--r--drivers/media/dvb/Kconfig2
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c66
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c2
-rw-r--r--drivers/media/radio/Kconfig2
-rw-r--r--drivers/media/video/Kconfig6
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c13
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c2
-rw-r--r--drivers/misc/blink.c22
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/irda/irport.c2
-rw-r--r--drivers/net/irda/smsc-ircc2.c16
-rw-r--r--drivers/net/mlx4/main.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/netxen/netxen_nic.h180
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h2
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c33
-rw-r--r--drivers/net/netxen/netxen_nic_init.c51
-rw-r--r--drivers/net/netxen/netxen_nic_main.c177
-rw-r--r--drivers/net/netxen/netxen_nic_phan_reg.h14
-rw-r--r--drivers/net/ns83820.c4
-rw-r--r--drivers/net/pcmcia/3c589_cs.c2
-rw-r--r--drivers/net/pcmcia/Kconfig2
-rw-r--r--drivers/net/phy/mdio_bus.c3
-rw-r--r--drivers/net/phy/vitesse.c2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/usb/cdc_ether.c8
-rw-r--r--drivers/net/usb/dm9601.c11
-rw-r--r--drivers/net/usb/usbnet.c9
-rw-r--r--drivers/net/wireless/libertas/Makefile2
-rw-r--r--drivers/net/wireless/libertas/README275
-rw-r--r--drivers/net/wireless/libertas/assoc.c28
-rw-r--r--drivers/net/wireless/libertas/cmd.c12
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c21
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h2
-rw-r--r--drivers/net/wireless/libertas/ioctl.c1081
-rw-r--r--drivers/net/wireless/libertas/main.c8
-rw-r--r--drivers/net/wireless/libertas/scan.c51
-rw-r--r--drivers/net/wireless/libertas/wext.c152
-rw-r--r--drivers/net/wireless/libertas/wext.h45
-rw-r--r--drivers/pnp/quirks.c66
-rw-r--r--drivers/scsi/Kconfig1
-rw-r--r--drivers/serial/mpsc.c3
-rw-r--r--drivers/video/aty/atyfb_base.c17
-rw-r--r--drivers/video/chipsfb.c6
-rw-r--r--drivers/w1/slaves/w1_therm.c6
-rw-r--r--fs/direct-io.c2
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h2
-rw-r--r--fs/ecryptfs/inode.c66
-rw-r--r--fs/ecryptfs/mmap.c55
-rw-r--r--fs/ext2/super.c1
-rw-r--r--fs/signalfd.c3
-rw-r--r--fs/sync.c8
-rw-r--r--include/asm-arm/unistd.h1
-rw-r--r--include/asm-blackfin/macros.h0
-rw-r--r--include/asm-blackfin/processor.h4
-rw-r--r--include/asm-frv/pgtable.h2
-rw-r--r--include/asm-mips/mach-ip32/dma-coherence.h6
-rw-r--r--include/asm-mips/ptrace.h2
-rw-r--r--include/asm-mips/unistd.h16
-rw-r--r--include/asm-powerpc/systbl.h1
-rw-r--r--include/asm-powerpc/unistd.h3
-rw-r--r--include/asm-sparc64/mdesc.h1
-rw-r--r--include/asm-sparc64/tlb.h1
-rw-r--r--include/linux/eventfd.h3
-rw-r--r--include/linux/pci.h11
-rw-r--r--include/linux/pm.h62
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--kernel/power/main.c6
-rw-r--r--kernel/relay.c11
-rw-r--r--kernel/time/ntp.c2
-rw-r--r--mm/rmap.c24
-rw-r--r--mm/slab.c1
-rw-r--r--mm/slub.c8
-rw-r--r--net/core/netpoll.c30
-rw-r--r--net/sctp/socket.c120
-rwxr-xr-xscripts/checksyscalls.sh5
-rw-r--r--sound/drivers/mts64.c2
-rw-r--r--sound/isa/opl3sa2.c2
-rw-r--r--sound/oss/sb_card.c2
-rw-r--r--sound/pci/ice1712/prodigy192.c2
134 files changed, 1341 insertions, 2143 deletions
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index ced9207bed..98e2701c74 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -322,39 +322,34 @@ kernel releases as described above.
322Here is a list of some of the different kernel trees available: 322Here is a list of some of the different kernel trees available:
323 git trees: 323 git trees:
324 - Kbuild development tree, Sam Ravnborg <sam@ravnborg.org> 324 - Kbuild development tree, Sam Ravnborg <sam@ravnborg.org>
325 kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git 325 git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
326 326
327 - ACPI development tree, Len Brown <len.brown@intel.com> 327 - ACPI development tree, Len Brown <len.brown@intel.com>
328 kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git 328 git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
329 329
330 - Block development tree, Jens Axboe <axboe@suse.de> 330 - Block development tree, Jens Axboe <axboe@suse.de>
331 kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git 331 git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
332 332
333 - DRM development tree, Dave Airlie <airlied@linux.ie> 333 - DRM development tree, Dave Airlie <airlied@linux.ie>
334 kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git 334 git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
335 335
336 - ia64 development tree, Tony Luck <tony.luck@intel.com> 336 - ia64 development tree, Tony Luck <tony.luck@intel.com>
337 kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git 337 git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
338
339 - ieee1394 development tree, Jody McIntyre <scjody@modernduck.com>
340 kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git
341 338
342 - infiniband, Roland Dreier <rolandd@cisco.com> 339 - infiniband, Roland Dreier <rolandd@cisco.com>
343 kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git 340 git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
344 341
345 - libata, Jeff Garzik <jgarzik@pobox.com> 342 - libata, Jeff Garzik <jgarzik@pobox.com>
346 kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git 343 git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
347 344
348 - network drivers, Jeff Garzik <jgarzik@pobox.com> 345 - network drivers, Jeff Garzik <jgarzik@pobox.com>
349 kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 346 git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
350 347
351 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> 348 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net>
352 kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git 349 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
353 350
354 - SCSI, James Bottomley <James.Bottomley@SteelEye.com> 351 - SCSI, James Bottomley <James.Bottomley@SteelEye.com>
355 kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git 352 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
356
357 Other git kernel trees can be found listed at http://kernel.org/git
358 353
359 quilt trees: 354 quilt trees:
360 - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> 355 - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de>
@@ -362,6 +357,9 @@ Here is a list of some of the different kernel trees available:
362 - x86-64, partly i386, Andi Kleen <ak@suse.de> 357 - x86-64, partly i386, Andi Kleen <ak@suse.de>
363 ftp.firstfloor.org:/pub/ak/x86_64/quilt/ 358 ftp.firstfloor.org:/pub/ak/x86_64/quilt/
364 359
360 Other kernel trees can be found listed at http://git.kernel.org/ and in
361 the MAINTAINERS file.
362
365Bug Reporting 363Bug Reporting
366------------- 364-------------
367 365
diff --git a/MAINTAINERS b/MAINTAINERS
index 4ce895a4b5..23a04f4312 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3618,7 +3618,7 @@ W: http://www.kroah.com/linux-usb/
3618USB DAVICOM DM9601 DRIVER 3618USB DAVICOM DM9601 DRIVER
3619P: Peter Korsgaard 3619P: Peter Korsgaard
3620M: jacmet@sunsite.dk 3620M: jacmet@sunsite.dk
3621L: linux-usb-devel@lists.sourceforge.net 3621L: netdev@vger.kernel.org
3622W: http://www.linux-usb.org/usbnet 3622W: http://www.linux-usb.org/usbnet
3623S: Maintained 3623S: Maintained
3624 3624
@@ -3702,8 +3702,8 @@ S: Maintained
3702USB PEGASUS DRIVER 3702USB PEGASUS DRIVER
3703P: Petko Manolov 3703P: Petko Manolov
3704M: petkan@users.sourceforge.net 3704M: petkan@users.sourceforge.net
3705L: linux-usb-users@lists.sourceforge.net
3706L: linux-usb-devel@lists.sourceforge.net 3705L: linux-usb-devel@lists.sourceforge.net
3706L: netdev@vger.kernel.org
3707W: http://pegasus2.sourceforge.net/ 3707W: http://pegasus2.sourceforge.net/
3708S: Maintained 3708S: Maintained
3709 3709
@@ -3717,8 +3717,8 @@ S: Maintained
3717USB RTL8150 DRIVER 3717USB RTL8150 DRIVER
3718P: Petko Manolov 3718P: Petko Manolov
3719M: petkan@users.sourceforge.net 3719M: petkan@users.sourceforge.net
3720L: linux-usb-users@lists.sourceforge.net
3721L: linux-usb-devel@lists.sourceforge.net 3720L: linux-usb-devel@lists.sourceforge.net
3721L: netdev@vger.kernel.org
3722W: http://pegasus2.sourceforge.net/ 3722W: http://pegasus2.sourceforge.net/
3723S: Maintained 3723S: Maintained
3724 3724
@@ -3829,7 +3829,7 @@ S: Maintained
3829USB "USBNET" DRIVER FRAMEWORK 3829USB "USBNET" DRIVER FRAMEWORK
3830P: David Brownell 3830P: David Brownell
3831M: dbrownell@users.sourceforge.net 3831M: dbrownell@users.sourceforge.net
3832L: linux-usb-devel@lists.sourceforge.net 3832L: netdev@vger.kernel.org
3833W: http://www.linux-usb.org/usbnet 3833W: http://www.linux-usb.org/usbnet
3834S: Maintained 3834S: Maintained
3835 3835
diff --git a/Makefile b/Makefile
index 8a3c2717e3..c6f7b71eae 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 22 3SUBLEVEL = 22
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc7
5NAME = Holy Dancing Manatees, Batman! 5NAME = Holy Dancing Manatees, Batman!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 19326d7cde..a98d0c933d 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -350,7 +350,7 @@
350 CALL(sys_set_robust_list) 350 CALL(sys_set_robust_list)
351 CALL(sys_get_robust_list) 351 CALL(sys_get_robust_list)
352/* 340 */ CALL(sys_splice) 352/* 340 */ CALL(sys_splice)
353 CALL(sys_arm_sync_file_range) 353 CALL(sys_sync_file_range2)
354 CALL(sys_tee) 354 CALL(sys_tee)
355 CALL(sys_vmsplice) 355 CALL(sys_vmsplice)
356 CALL(sys_move_pages) 356 CALL(sys_move_pages)
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 1ca2d5174f..4d25e49a14 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -328,16 +328,3 @@ asmlinkage long sys_arm_fadvise64_64(int fd, int advice,
328{ 328{
329 return sys_fadvise64_64(fd, offset, len, advice); 329 return sys_fadvise64_64(fd, offset, len, advice);
330} 330}
331
332/*
333 * Yet more syscall fsckage - we can't fit sys_sync_file_range's
334 * arguments into the available registers with EABI. So, let's
335 * create an ARM specific syscall for this which has _sane_
336 * arguments. (This incidentally also has an ABI-independent
337 * argument layout.)
338 */
339asmlinkage long sys_arm_sync_file_range(int fd, unsigned int flags,
340 loff_t offset, loff_t nbytes)
341{
342 return sys_sync_file_range(fd, offset, nbytes, flags);
343}
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 47ff676aca..ddf9184d56 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -53,7 +53,7 @@ static suspend_state_t target_state;
53/* 53/*
54 * Called after processes are frozen, but before we shutdown devices. 54 * Called after processes are frozen, but before we shutdown devices.
55 */ 55 */
56static int at91_pm_prepare(suspend_state_t state) 56static int at91_pm_set_target(suspend_state_t state)
57{ 57{
58 target_state = state; 58 target_state = state;
59 return 0; 59 return 0;
@@ -201,7 +201,7 @@ error:
201 201
202static struct pm_ops at91_pm_ops ={ 202static struct pm_ops at91_pm_ops ={
203 .valid = at91_pm_valid_state, 203 .valid = at91_pm_valid_state,
204 .prepare = at91_pm_prepare, 204 .set_target = at91_pm_set_target,
205 .enter = at91_pm_enter, 205 .enter = at91_pm_enter,
206}; 206};
207 207
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 1fad8560c7..d98bafcaca 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -142,6 +142,12 @@ config BF_REV_0_5
142 bool "0.5" 142 bool "0.5"
143 depends on (BF561 || BF533 || BF532 || BF531) 143 depends on (BF561 || BF533 || BF532 || BF531)
144 144
145config BF_REV_ANY
146 bool "any"
147
148config BF_REV_NONE
149 bool "none"
150
145endchoice 151endchoice
146 152
147config BFIN_DUAL_CORE 153config BFIN_DUAL_CORE
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 75e89c3247..6971a4418d 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -28,6 +28,27 @@ machine-$(CONFIG_BF561) := bf561
28MACHINE := $(machine-y) 28MACHINE := $(machine-y)
29export MACHINE 29export MACHINE
30 30
31cpu-$(CONFIG_BF531) := bf531
32cpu-$(CONFIG_BF532) := bf532
33cpu-$(CONFIG_BF533) := bf533
34cpu-$(CONFIG_BF534) := bf534
35cpu-$(CONFIG_BF536) := bf536
36cpu-$(CONFIG_BF537) := bf537
37cpu-$(CONFIG_BF548) := bf548
38cpu-$(CONFIG_BF549) := bf549
39cpu-$(CONFIG_BF561) := bf561
40
41rev-$(CONFIG_BF_REV_0_0) := 0.0
42rev-$(CONFIG_BF_REV_0_1) := 0.1
43rev-$(CONFIG_BF_REV_0_2) := 0.2
44rev-$(CONFIG_BF_REV_0_3) := 0.3
45rev-$(CONFIG_BF_REV_0_4) := 0.4
46rev-$(CONFIG_BF_REV_0_5) := 0.5
47rev-$(CONFIG_BF_REV_NONE) := none
48rev-$(CONFIG_BF_REV_ANY) := any
49
50CFLAGS += -mcpu=$(cpu-y)-$(rev-y)
51AFLAGS += -mcpu=$(cpu-y)-$(rev-y)
31 52
32head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o 53head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o
33 54
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 90d58aabe6..1cf1ab28dc 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21.3 3# Linux kernel version: 2.6.21.5
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,17 +115,26 @@ CONFIG_BF533=y
115# CONFIG_BF534 is not set 115# CONFIG_BF534 is not set
116# CONFIG_BF536 is not set 116# CONFIG_BF536 is not set
117# CONFIG_BF537 is not set 117# CONFIG_BF537 is not set
118# CONFIG_BF542 is not set
119# CONFIG_BF544 is not set
120# CONFIG_BF548 is not set
121# CONFIG_BF549 is not set
118# CONFIG_BF561 is not set 122# CONFIG_BF561 is not set
123# CONFIG_BF_REV_0_0 is not set
119# CONFIG_BF_REV_0_2 is not set 124# CONFIG_BF_REV_0_2 is not set
120CONFIG_BF_REV_0_3=y 125CONFIG_BF_REV_0_3=y
121# CONFIG_BF_REV_0_4 is not set 126# CONFIG_BF_REV_0_4 is not set
122# CONFIG_BF_REV_0_5 is not set 127# CONFIG_BF_REV_0_5 is not set
128# CONFIG_BF_REV_ANY is not set
129# CONFIG_BF_REV_NONE is not set
130CONFIG_BF53x=y
123CONFIG_BFIN_SINGLE_CORE=y 131CONFIG_BFIN_SINGLE_CORE=y
124CONFIG_BFIN533_EZKIT=y 132CONFIG_BFIN533_EZKIT=y
125# CONFIG_BFIN533_STAMP is not set 133# CONFIG_BFIN533_STAMP is not set
126# CONFIG_BFIN537_STAMP is not set 134# CONFIG_BFIN537_STAMP is not set
127# CONFIG_BFIN533_BLUETECHNIX_CM is not set 135# CONFIG_BFIN533_BLUETECHNIX_CM is not set
128# CONFIG_BFIN537_BLUETECHNIX_CM is not set 136# CONFIG_BFIN537_BLUETECHNIX_CM is not set
137# CONFIG_BFIN548_EZKIT is not set
129# CONFIG_BFIN561_BLUETECHNIX_CM is not set 138# CONFIG_BFIN561_BLUETECHNIX_CM is not set
130# CONFIG_BFIN561_EZKIT is not set 139# CONFIG_BFIN561_EZKIT is not set
131# CONFIG_BFIN561_TEPLA is not set 140# CONFIG_BFIN561_TEPLA is not set
@@ -634,6 +643,7 @@ CONFIG_NETDEVICES=y
634CONFIG_NET_ETHERNET=y 643CONFIG_NET_ETHERNET=y
635CONFIG_MII=y 644CONFIG_MII=y
636CONFIG_SMC91X=y 645CONFIG_SMC91X=y
646# CONFIG_SMSC911X is not set
637 647
638# 648#
639# Ethernet (1000 Mbit) 649# Ethernet (1000 Mbit)
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index fee9189573..64b7f1b3b2 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21.3 3# Linux kernel version: 2.6.21.5
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,17 +115,26 @@ CONFIG_BF533=y
115# CONFIG_BF534 is not set 115# CONFIG_BF534 is not set
116# CONFIG_BF536 is not set 116# CONFIG_BF536 is not set
117# CONFIG_BF537 is not set 117# CONFIG_BF537 is not set
118# CONFIG_BF542 is not set
119# CONFIG_BF544 is not set
120# CONFIG_BF548 is not set
121# CONFIG_BF549 is not set
118# CONFIG_BF561 is not set 122# CONFIG_BF561 is not set
123# CONFIG_BF_REV_0_0 is not set
119# CONFIG_BF_REV_0_2 is not set 124# CONFIG_BF_REV_0_2 is not set
120CONFIG_BF_REV_0_3=y 125CONFIG_BF_REV_0_3=y
121# CONFIG_BF_REV_0_4 is not set 126# CONFIG_BF_REV_0_4 is not set
122# CONFIG_BF_REV_0_5 is not set 127# CONFIG_BF_REV_0_5 is not set
128# CONFIG_BF_REV_ANY is not set
129# CONFIG_BF_REV_NONE is not set
130CONFIG_BF53x=y
123CONFIG_BFIN_SINGLE_CORE=y 131CONFIG_BFIN_SINGLE_CORE=y
124# CONFIG_BFIN533_EZKIT is not set 132# CONFIG_BFIN533_EZKIT is not set
125CONFIG_BFIN533_STAMP=y 133CONFIG_BFIN533_STAMP=y
126# CONFIG_BFIN537_STAMP is not set 134# CONFIG_BFIN537_STAMP is not set
127# CONFIG_BFIN533_BLUETECHNIX_CM is not set 135# CONFIG_BFIN533_BLUETECHNIX_CM is not set
128# CONFIG_BFIN537_BLUETECHNIX_CM is not set 136# CONFIG_BFIN537_BLUETECHNIX_CM is not set
137# CONFIG_BFIN548_EZKIT is not set
129# CONFIG_BFIN561_BLUETECHNIX_CM is not set 138# CONFIG_BFIN561_BLUETECHNIX_CM is not set
130# CONFIG_BFIN561_EZKIT is not set 139# CONFIG_BFIN561_EZKIT is not set
131# CONFIG_BFIN561_TEPLA is not set 140# CONFIG_BFIN561_TEPLA is not set
@@ -646,6 +655,7 @@ CONFIG_NETDEVICES=y
646CONFIG_NET_ETHERNET=y 655CONFIG_NET_ETHERNET=y
647CONFIG_MII=y 656CONFIG_MII=y
648CONFIG_SMC91X=y 657CONFIG_SMC91X=y
658# CONFIG_SMSC911X is not set
649 659
650# 660#
651# Ethernet (1000 Mbit) 661# Ethernet (1000 Mbit)
@@ -986,9 +996,17 @@ CONFIG_SND_VERBOSE_PROCFS=y
986# 996#
987# ALSA Blackfin devices 997# ALSA Blackfin devices
988# 998#
989# CONFIG_SND_BLACKFIN_AD1836 is not set 999CONFIG_SND_BLACKFIN_AD1836=m
990# CONFIG_SND_BLACKFIN_AD1981B is not set 1000CONFIG_SND_BLACKFIN_AD1836_TDM=y
991# CONFIG_SND_BFIN_AD73311 is not set 1001# CONFIG_SND_BLACKFIN_AD1836_I2S is not set
1002CONFIG_SND_BLACKFIN_AD1836_MULSUB=y
1003# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
1004CONFIG_SND_BLACKFIN_AD1981B=m
1005CONFIG_SND_BLACKFIN_SPORT=0
1006CONFIG_SND_BLACKFIN_SPI_PFBIT=4
1007CONFIG_SND_BFIN_AD73311=m
1008CONFIG_SND_BFIN_SPORT=0
1009CONFIG_SND_BFIN_AD73311_SE=4
992 1010
993# 1011#
994# SoC audio support 1012# SoC audio support
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 37688bb55b..ccf09dc09a 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21.3 3# Linux kernel version: 2.6.21.5
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,17 +115,26 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# CONFIG_BF534 is not set 115# CONFIG_BF534 is not set
116# CONFIG_BF536 is not set 116# CONFIG_BF536 is not set
117CONFIG_BF537=y 117CONFIG_BF537=y
118# CONFIG_BF542 is not set
119# CONFIG_BF544 is not set
120# CONFIG_BF548 is not set
121# CONFIG_BF549 is not set
118# CONFIG_BF561 is not set 122# CONFIG_BF561 is not set
123# CONFIG_BF_REV_0_0 is not set
119CONFIG_BF_REV_0_2=y 124CONFIG_BF_REV_0_2=y
120# CONFIG_BF_REV_0_3 is not set 125# CONFIG_BF_REV_0_3 is not set
121# CONFIG_BF_REV_0_4 is not set 126# CONFIG_BF_REV_0_4 is not set
122# CONFIG_BF_REV_0_5 is not set 127# CONFIG_BF_REV_0_5 is not set
128# CONFIG_BF_REV_ANY is not set
129# CONFIG_BF_REV_NONE is not set
130CONFIG_BF53x=y
123CONFIG_BFIN_SINGLE_CORE=y 131CONFIG_BFIN_SINGLE_CORE=y
124# CONFIG_BFIN533_EZKIT is not set 132# CONFIG_BFIN533_EZKIT is not set
125# CONFIG_BFIN533_STAMP is not set 133# CONFIG_BFIN533_STAMP is not set
126CONFIG_BFIN537_STAMP=y 134CONFIG_BFIN537_STAMP=y
127# CONFIG_BFIN533_BLUETECHNIX_CM is not set 135# CONFIG_BFIN533_BLUETECHNIX_CM is not set
128# CONFIG_BFIN537_BLUETECHNIX_CM is not set 136# CONFIG_BFIN537_BLUETECHNIX_CM is not set
137# CONFIG_BFIN548_EZKIT is not set
129# CONFIG_BFIN561_BLUETECHNIX_CM is not set 138# CONFIG_BFIN561_BLUETECHNIX_CM is not set
130# CONFIG_BFIN561_EZKIT is not set 139# CONFIG_BFIN561_EZKIT is not set
131# CONFIG_BFIN561_TEPLA is not set 140# CONFIG_BFIN561_TEPLA is not set
@@ -664,6 +673,7 @@ CONFIG_BFIN_MAC_USE_L1=y
664CONFIG_BFIN_TX_DESC_NUM=10 673CONFIG_BFIN_TX_DESC_NUM=10
665CONFIG_BFIN_RX_DESC_NUM=20 674CONFIG_BFIN_RX_DESC_NUM=20
666# CONFIG_BFIN_MAC_RMII is not set 675# CONFIG_BFIN_MAC_RMII is not set
676# CONFIG_SMSC911X is not set
667 677
668# 678#
669# Ethernet (1000 Mbit) 679# Ethernet (1000 Mbit)
@@ -1020,9 +1030,17 @@ CONFIG_SND_VERBOSE_PROCFS=y
1020# 1030#
1021# ALSA Blackfin devices 1031# ALSA Blackfin devices
1022# 1032#
1023# CONFIG_SND_BLACKFIN_AD1836 is not set 1033CONFIG_SND_BLACKFIN_AD1836=m
1024# CONFIG_SND_BLACKFIN_AD1981B is not set 1034CONFIG_SND_BLACKFIN_AD1836_TDM=y
1025# CONFIG_SND_BFIN_AD73311 is not set 1035# CONFIG_SND_BLACKFIN_AD1836_I2S is not set
1036CONFIG_SND_BLACKFIN_AD1836_MULSUB=y
1037# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
1038CONFIG_SND_BLACKFIN_AD1981B=m
1039CONFIG_SND_BLACKFIN_SPORT=0
1040CONFIG_SND_BLACKFIN_SPI_PFBIT=4
1041CONFIG_SND_BFIN_AD73311=m
1042CONFIG_SND_BFIN_SPORT=0
1043CONFIG_SND_BFIN_AD73311_SE=4
1026 1044
1027# 1045#
1028# SoC audio support 1046# SoC audio support
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index fe4e67deba..51c0b6f977 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21.3 3# Linux kernel version: 2.6.21.5
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,17 +115,25 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# CONFIG_BF534 is not set 115# CONFIG_BF534 is not set
116# CONFIG_BF536 is not set 116# CONFIG_BF536 is not set
117# CONFIG_BF537 is not set 117# CONFIG_BF537 is not set
118# CONFIG_BF542 is not set
119# CONFIG_BF544 is not set
120# CONFIG_BF548 is not set
121# CONFIG_BF549 is not set
118CONFIG_BF561=y 122CONFIG_BF561=y
123# CONFIG_BF_REV_0_0 is not set
119# CONFIG_BF_REV_0_2 is not set 124# CONFIG_BF_REV_0_2 is not set
120CONFIG_BF_REV_0_3=y 125CONFIG_BF_REV_0_3=y
121# CONFIG_BF_REV_0_4 is not set 126# CONFIG_BF_REV_0_4 is not set
122# CONFIG_BF_REV_0_5 is not set 127# CONFIG_BF_REV_0_5 is not set
128# CONFIG_BF_REV_ANY is not set
129# CONFIG_BF_REV_NONE is not set
123CONFIG_BFIN_DUAL_CORE=y 130CONFIG_BFIN_DUAL_CORE=y
124# CONFIG_BFIN533_EZKIT is not set 131# CONFIG_BFIN533_EZKIT is not set
125# CONFIG_BFIN533_STAMP is not set 132# CONFIG_BFIN533_STAMP is not set
126# CONFIG_BFIN537_STAMP is not set 133# CONFIG_BFIN537_STAMP is not set
127# CONFIG_BFIN533_BLUETECHNIX_CM is not set 134# CONFIG_BFIN533_BLUETECHNIX_CM is not set
128# CONFIG_BFIN537_BLUETECHNIX_CM is not set 135# CONFIG_BFIN537_BLUETECHNIX_CM is not set
136# CONFIG_BFIN548_EZKIT is not set
129# CONFIG_BFIN561_BLUETECHNIX_CM is not set 137# CONFIG_BFIN561_BLUETECHNIX_CM is not set
130CONFIG_BFIN561_EZKIT=y 138CONFIG_BFIN561_EZKIT=y
131# CONFIG_BFIN561_TEPLA is not set 139# CONFIG_BFIN561_TEPLA is not set
@@ -673,6 +681,7 @@ CONFIG_NETDEVICES=y
673CONFIG_NET_ETHERNET=y 681CONFIG_NET_ETHERNET=y
674CONFIG_MII=y 682CONFIG_MII=y
675CONFIG_SMC91X=y 683CONFIG_SMC91X=y
684# CONFIG_SMSC911X is not set
676 685
677# 686#
678# Ethernet (1000 Mbit) 687# Ethernet (1000 Mbit)
@@ -801,7 +810,6 @@ CONFIG_WATCHDOG=y
801CONFIG_BFIN_WDT=y 810CONFIG_BFIN_WDT=y
802CONFIG_HW_RANDOM=y 811CONFIG_HW_RANDOM=y
803# CONFIG_GEN_RTC is not set 812# CONFIG_GEN_RTC is not set
804# CONFIG_BLACKFIN_DPMC is not set
805# CONFIG_DTLK is not set 813# CONFIG_DTLK is not set
806# CONFIG_R3964 is not set 814# CONFIG_R3964 is not set
807# CONFIG_RAW_DRIVER is not set 815# CONFIG_RAW_DRIVER is not set
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index a783ff69ac..983ed181c8 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21.3 3# Linux kernel version: 2.6.21.5
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -114,17 +114,26 @@ CONFIG_PREEMPT_VOLUNTARY=y
114# CONFIG_BF534 is not set 114# CONFIG_BF534 is not set
115# CONFIG_BF536 is not set 115# CONFIG_BF536 is not set
116CONFIG_BF537=y 116CONFIG_BF537=y
117# CONFIG_BF542 is not set
118# CONFIG_BF544 is not set
119# CONFIG_BF548 is not set
120# CONFIG_BF549 is not set
117# CONFIG_BF561 is not set 121# CONFIG_BF561 is not set
122# CONFIG_BF_REV_0_0 is not set
118CONFIG_BF_REV_0_2=y 123CONFIG_BF_REV_0_2=y
119# CONFIG_BF_REV_0_3 is not set 124# CONFIG_BF_REV_0_3 is not set
120# CONFIG_BF_REV_0_4 is not set 125# CONFIG_BF_REV_0_4 is not set
121# CONFIG_BF_REV_0_5 is not set 126# CONFIG_BF_REV_0_5 is not set
127# CONFIG_BF_REV_ANY is not set
128# CONFIG_BF_REV_NONE is not set
129CONFIG_BF53x=y
122CONFIG_BFIN_SINGLE_CORE=y 130CONFIG_BFIN_SINGLE_CORE=y
123# CONFIG_BFIN533_EZKIT is not set 131# CONFIG_BFIN533_EZKIT is not set
124# CONFIG_BFIN533_STAMP is not set 132# CONFIG_BFIN533_STAMP is not set
125# CONFIG_BFIN537_STAMP is not set 133# CONFIG_BFIN537_STAMP is not set
126# CONFIG_BFIN533_BLUETECHNIX_CM is not set 134# CONFIG_BFIN533_BLUETECHNIX_CM is not set
127# CONFIG_BFIN537_BLUETECHNIX_CM is not set 135# CONFIG_BFIN537_BLUETECHNIX_CM is not set
136# CONFIG_BFIN548_EZKIT is not set
128# CONFIG_BFIN561_BLUETECHNIX_CM is not set 137# CONFIG_BFIN561_BLUETECHNIX_CM is not set
129# CONFIG_BFIN561_EZKIT is not set 138# CONFIG_BFIN561_EZKIT is not set
130# CONFIG_BFIN561_TEPLA is not set 139# CONFIG_BFIN561_TEPLA is not set
@@ -598,6 +607,7 @@ CONFIG_BFIN_MAC=y
598CONFIG_BFIN_TX_DESC_NUM=100 607CONFIG_BFIN_TX_DESC_NUM=100
599CONFIG_BFIN_RX_DESC_NUM=100 608CONFIG_BFIN_RX_DESC_NUM=100
600CONFIG_BFIN_MAC_RMII=y 609CONFIG_BFIN_MAC_RMII=y
610# CONFIG_SMSC911X is not set
601 611
602# 612#
603# Ethernet (1000 Mbit) 613# Ethernet (1000 Mbit)
@@ -746,7 +756,6 @@ CONFIG_CAN_BLACKFIN=m
746# CONFIG_WATCHDOG is not set 756# CONFIG_WATCHDOG is not set
747CONFIG_HW_RANDOM=y 757CONFIG_HW_RANDOM=y
748# CONFIG_GEN_RTC is not set 758# CONFIG_GEN_RTC is not set
749CONFIG_BLACKFIN_DPMC=y
750# CONFIG_DTLK is not set 759# CONFIG_DTLK is not set
751# CONFIG_R3964 is not set 760# CONFIG_R3964 is not set
752# CONFIG_RAW_DRIVER is not set 761# CONFIG_RAW_DRIVER is not set
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 5b9b434c1e..83060f98d1 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -307,10 +307,20 @@ void __init setup_arch(char **cmdline_p)
307 init_leds(); 307 init_leds();
308 308
309 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n"); 309 printk(KERN_INFO "Blackfin support (C) 2004-2007 Analog Devices, Inc.\n");
310 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid()); 310 if (bfin_compiled_revid() == 0xffff)
311 if (bfin_revid() != bfin_compiled_revid()) 311 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
312 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", 312 else if (bfin_compiled_revid() == -1)
313 bfin_compiled_revid(), bfin_revid()); 313 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
314 else
315 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
316 if (bfin_revid() != bfin_compiled_revid()) {
317 if (bfin_compiled_revid() == -1)
318 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
319 bfin_revid());
320 else if (bfin_compiled_revid() != 0xffff)
321 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
322 bfin_compiled_revid(), bfin_revid());
323 }
314 if (bfin_revid() < SUPPORTED_REVID) 324 if (bfin_revid() < SUPPORTED_REVID)
315 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n", 325 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
316 CPU, bfin_revid()); 326 CPU, bfin_revid());
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index aa660f32d8..56058b0b6d 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -545,7 +545,8 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
545 545
546 if (current->mm) { 546 if (current->mm) {
547 printk(KERN_EMERG "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" 547 printk(KERN_EMERG "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
548 "BSS = 0x%p-0x%p USER-STACK = 0x%p\n\n", 548 KERN_EMERG "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
549 KERN_EMERG "\n",
549 (void*)current->mm->start_code, 550 (void*)current->mm->start_code,
550 (void*)current->mm->end_code, 551 (void*)current->mm->end_code,
551 (void*)current->mm->start_data, 552 (void*)current->mm->start_data,
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 280898b045..a574cd2c8b 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -621,8 +621,6 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table)
621static int __init acpi_parse_hpet(struct acpi_table_header *table) 621static int __init acpi_parse_hpet(struct acpi_table_header *table)
622{ 622{
623 struct acpi_table_hpet *hpet_tbl; 623 struct acpi_table_hpet *hpet_tbl;
624 struct resource *hpet_res;
625 resource_size_t res_start;
626 624
627 hpet_tbl = (struct acpi_table_hpet *)table; 625 hpet_tbl = (struct acpi_table_hpet *)table;
628 if (!hpet_tbl) { 626 if (!hpet_tbl) {
@@ -636,29 +634,10 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
636 return -1; 634 return -1;
637 } 635 }
638 636
639#define HPET_RESOURCE_NAME_SIZE 9
640 hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
641 if (hpet_res) {
642 memset(hpet_res, 0, sizeof(*hpet_res));
643 hpet_res->name = (void *)&hpet_res[1];
644 hpet_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
645 snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE,
646 "HPET %u", hpet_tbl->sequence);
647 hpet_res->end = (1 * 1024) - 1;
648 }
649
650 hpet_address = hpet_tbl->address.address; 637 hpet_address = hpet_tbl->address.address;
651 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", 638 printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
652 hpet_tbl->id, hpet_address); 639 hpet_tbl->id, hpet_address);
653 640
654 res_start = hpet_address;
655
656 if (hpet_res) {
657 hpet_res->start = res_start;
658 hpet_res->end += res_start;
659 insert_resource(&iomem_resource, hpet_res);
660 }
661
662 return 0; 641 return 0;
663} 642}
664#else 643#else
diff --git a/arch/i386/kernel/cpu/mtrr/cyrix.c b/arch/i386/kernel/cpu/mtrr/cyrix.c
index 9edf562558..1001f1e0fe 100644
--- a/arch/i386/kernel/cpu/mtrr/cyrix.c
+++ b/arch/i386/kernel/cpu/mtrr/cyrix.c
@@ -233,12 +233,12 @@ typedef struct {
233 mtrr_type type; 233 mtrr_type type;
234} arr_state_t; 234} arr_state_t;
235 235
236static arr_state_t arr_state[8] __devinitdata = { 236static arr_state_t arr_state[8] = {
237 {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, 237 {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL},
238 {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL} 238 {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}
239}; 239};
240 240
241static unsigned char ccr_state[7] __devinitdata = { 0, 0, 0, 0, 0, 0, 0 }; 241static unsigned char ccr_state[7] = { 0, 0, 0, 0, 0, 0, 0 };
242 242
243static void cyrix_set_all(void) 243static void cyrix_set_all(void)
244{ 244{
diff --git a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
index 6d5937891b..f6e46943e6 100644
--- a/arch/i386/kernel/cpu/mtrr/generic.c
+++ b/arch/i386/kernel/cpu/mtrr/generic.c
@@ -65,7 +65,8 @@ get_fixed_ranges(mtrr_type * frs)
65 65
66void mtrr_save_fixed_ranges(void *info) 66void mtrr_save_fixed_ranges(void *info)
67{ 67{
68 get_fixed_ranges(mtrr_state.fixed_ranges); 68 if (cpu_has_mtrr)
69 get_fixed_ranges(mtrr_state.fixed_ranges);
69} 70}
70 71
71static void print_fixed(unsigned base, unsigned step, const mtrr_type*types) 72static void print_fixed(unsigned base, unsigned step, const mtrr_type*types)
@@ -469,11 +470,6 @@ int generic_validate_add_page(unsigned long base, unsigned long size, unsigned i
469 } 470 }
470 } 471 }
471 472
472 if (base < 0x100) {
473 printk(KERN_WARNING "mtrr: cannot set region below 1 MiB (0x%lx000,0x%lx000)\n",
474 base, size);
475 return -EINVAL;
476 }
477 /* Check upper bits of base and last are equal and lower bits are 0 473 /* Check upper bits of base and last are equal and lower bits are 0
478 for base and 1 for last */ 474 for base and 1 for last */
479 last = base + size - 1; 475 last = base + size - 1;
diff --git a/arch/i386/kernel/cpu/perfctr-watchdog.c b/arch/i386/kernel/cpu/perfctr-watchdog.c
index f0b67630b9..4d26d514c5 100644
--- a/arch/i386/kernel/cpu/perfctr-watchdog.c
+++ b/arch/i386/kernel/cpu/perfctr-watchdog.c
@@ -55,14 +55,45 @@ static DEFINE_PER_CPU(struct nmi_watchdog_ctlblk, nmi_watchdog_ctlblk);
55/* converts an msr to an appropriate reservation bit */ 55/* converts an msr to an appropriate reservation bit */
56static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) 56static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
57{ 57{
58 return wd_ops ? msr - wd_ops->perfctr : 0; 58 /* returns the bit offset of the performance counter register */
59 switch (boot_cpu_data.x86_vendor) {
60 case X86_VENDOR_AMD:
61 return (msr - MSR_K7_PERFCTR0);
62 case X86_VENDOR_INTEL:
63 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
64 return (msr - MSR_ARCH_PERFMON_PERFCTR0);
65
66 switch (boot_cpu_data.x86) {
67 case 6:
68 return (msr - MSR_P6_PERFCTR0);
69 case 15:
70 return (msr - MSR_P4_BPU_PERFCTR0);
71 }
72 }
73 return 0;
59} 74}
60 75
61/* converts an msr to an appropriate reservation bit */ 76/* converts an msr to an appropriate reservation bit */
62/* returns the bit offset of the event selection register */ 77/* returns the bit offset of the event selection register */
63static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) 78static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
64{ 79{
65 return wd_ops ? msr - wd_ops->evntsel : 0; 80 /* returns the bit offset of the event selection register */
81 switch (boot_cpu_data.x86_vendor) {
82 case X86_VENDOR_AMD:
83 return (msr - MSR_K7_EVNTSEL0);
84 case X86_VENDOR_INTEL:
85 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
86 return (msr - MSR_ARCH_PERFMON_EVENTSEL0);
87
88 switch (boot_cpu_data.x86) {
89 case 6:
90 return (msr - MSR_P6_EVNTSEL0);
91 case 15:
92 return (msr - MSR_P4_BSU_ESCR0);
93 }
94 }
95 return 0;
96
66} 97}
67 98
68/* checks for a bit availability (hack for oprofile) */ 99/* checks for a bit availability (hack for oprofile) */
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index d848f1a077..81ec559a1c 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -54,7 +54,7 @@ static struct resource jazz_io_resources[] = {
54 .start = 0x40, 54 .start = 0x40,
55 .end = 0x5f, 55 .end = 0x5f,
56 .name = "timer", 56 .name = "timer",
57 .end = IORESOURCE_BUSY 57 .flags = IORESOURCE_BUSY
58 }, { 58 }, {
59 .start = 0x80, 59 .start = 0x80,
60 .end = 0x8f, 60 .end = 0x8f,
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index b8fa7ddd78..19b30d6f17 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -236,8 +236,6 @@ void __init plat_smp_setup(void)
236 dvpe(); 236 dvpe();
237 dmt(); 237 dmt();
238 238
239 mips_mt_set_cpuoptions();
240
241 /* Put MVPE's into 'configuration state' */ 239 /* Put MVPE's into 'configuration state' */
242 set_c0_mvpcontrol(MVPCONTROL_VPC); 240 set_c0_mvpcontrol(MVPCONTROL_VPC);
243 241
@@ -263,6 +261,8 @@ void __init plat_smp_setup(void)
263 261
264void __init plat_prepare_cpus(unsigned int max_cpus) 262void __init plat_prepare_cpus(unsigned int max_cpus)
265{ 263{
264 mips_mt_set_cpuoptions();
265
266 /* set up ipi interrupts */ 266 /* set up ipi interrupts */
267 if (cpu_has_vint) { 267 if (cpu_has_vint) {
268 set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); 268 set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch);
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 047246ad4f..b42cbf1e2d 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -810,3 +810,12 @@ asmlinkage long compat_sys_request_key(const char __user *_type,
810 return sys_request_key(_type, _description, _callout_info, destringid); 810 return sys_request_key(_type, _description, _callout_info, destringid);
811} 811}
812 812
813asmlinkage long compat_sys_sync_file_range2(int fd, unsigned int flags,
814 unsigned offset_hi, unsigned offset_lo,
815 unsigned nbytes_hi, unsigned nbytes_lo)
816{
817 loff_t offset = ((loff_t)offset_hi << 32) | offset_lo;
818 loff_t nbytes = ((loff_t)nbytes_hi << 32) | nbytes_lo;
819
820 return sys_sync_file_range(fd, offset, nbytes, flags);
821}
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index 2d7a5104c6..c6401f9e37 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -31,7 +31,7 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
31 mr r11,r3 /* r11 holds tv */ 31 mr r11,r3 /* r11 holds tv */
32 mr r10,r4 /* r10 holds tz */ 32 mr r10,r4 /* r10 holds tz */
33 bl V_LOCAL_FUNC(__get_datapage) /* get data page */ 33 bl V_LOCAL_FUNC(__get_datapage) /* get data page */
34 cmpldi r10,0 /* check if tv is NULL */ 34 cmpldi r11,0 /* check if tv is NULL */
35 beq 2f 35 beq 2f
36 bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ 36 bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */
37 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */ 37 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index e60d283f60..6b6165d36f 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -329,6 +329,10 @@ static void sun4v_irq_enable(unsigned int virt_irq)
329 if (err != HV_EOK) 329 if (err != HV_EOK)
330 printk("sun4v_intr_settarget(%x,%lu): err(%d)\n", 330 printk("sun4v_intr_settarget(%x,%lu): err(%d)\n",
331 ino, cpuid, err); 331 ino, cpuid, err);
332 err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
333 if (err != HV_EOK)
334 printk("sun4v_intr_setstate(%x): "
335 "err(%d)\n", ino, err);
332 err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED); 336 err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED);
333 if (err != HV_EOK) 337 if (err != HV_EOK)
334 printk("sun4v_intr_setenabled(%x): err(%d)\n", 338 printk("sun4v_intr_setenabled(%x): err(%d)\n",
@@ -400,6 +404,12 @@ static void sun4v_virq_enable(unsigned int virt_irq)
400 "err(%d)\n", 404 "err(%d)\n",
401 dev_handle, dev_ino, cpuid, err); 405 dev_handle, dev_ino, cpuid, err);
402 err = sun4v_vintr_set_state(dev_handle, dev_ino, 406 err = sun4v_vintr_set_state(dev_handle, dev_ino,
407 HV_INTR_STATE_IDLE);
408 if (err != HV_EOK)
409 printk("sun4v_vintr_set_state(%lx,%lx,"
410 "HV_INTR_STATE_IDLE): err(%d)\n",
411 dev_handle, dev_ino, err);
412 err = sun4v_vintr_set_valid(dev_handle, dev_ino,
403 HV_INTR_ENABLED); 413 HV_INTR_ENABLED);
404 if (err != HV_EOK) 414 if (err != HV_EOK)
405 printk("sun4v_vintr_set_state(%lx,%lx," 415 printk("sun4v_vintr_set_state(%lx,%lx,"
@@ -420,7 +430,7 @@ static void sun4v_virq_disable(unsigned int virt_irq)
420 dev_handle = ino & IMAP_IGN; 430 dev_handle = ino & IMAP_IGN;
421 dev_ino = ino & IMAP_INO; 431 dev_ino = ino & IMAP_INO;
422 432
423 err = sun4v_vintr_set_state(dev_handle, dev_ino, 433 err = sun4v_vintr_set_valid(dev_handle, dev_ino,
424 HV_INTR_DISABLED); 434 HV_INTR_DISABLED);
425 if (err != HV_EOK) 435 if (err != HV_EOK)
426 printk("sun4v_vintr_set_state(%lx,%lx," 436 printk("sun4v_vintr_set_state(%lx,%lx,"
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 6d7d4157e0..3cd79caad7 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1398,7 +1398,7 @@ static int __init asus_acpi_init(void)
1398 if (!asus_hotk_found) { 1398 if (!asus_hotk_found) {
1399 acpi_bus_unregister_driver(&asus_hotk_driver); 1399 acpi_bus_unregister_driver(&asus_hotk_driver);
1400 remove_proc_entry(PROC_ASUS, acpi_root_dir); 1400 remove_proc_entry(PROC_ASUS, acpi_root_dir);
1401 return result; 1401 return -ENODEV;
1402 } 1402 }
1403 1403
1404 asus_backlight_device = backlight_device_register("asus",NULL,NULL, 1404 asus_backlight_device = backlight_device_register("asus",NULL,NULL,
@@ -1407,6 +1407,7 @@ static int __init asus_acpi_init(void)
1407 printk(KERN_ERR "Could not register asus backlight device\n"); 1407 printk(KERN_ERR "Could not register asus backlight device\n");
1408 asus_backlight_device = NULL; 1408 asus_backlight_device = NULL;
1409 asus_acpi_exit(); 1409 asus_acpi_exit();
1410 return -ENODEV;
1410 } 1411 }
1411 asus_backlight_device->props.max_brightness = 15; 1412 asus_backlight_device->props.max_brightness = 15;
1412 1413
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 58ceb18ec9..2e7ba615d7 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -999,11 +999,11 @@ static int __init acpi_osi_setup(char *str)
999 if (str == NULL || *str == '\0') { 999 if (str == NULL || *str == '\0') {
1000 printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1000 printk(KERN_INFO PREFIX "_OSI method disabled\n");
1001 acpi_gbl_create_osi_method = FALSE; 1001 acpi_gbl_create_osi_method = FALSE;
1002 } else if (!strcmp("!Linux", str)) {
1003 enable_osi_linux(0);
1002 } else if (*str == '!') { 1004 } else if (*str == '!') {
1003 if (acpi_osi_invalidate(++str) == AE_OK) 1005 if (acpi_osi_invalidate(++str) == AE_OK)
1004 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); 1006 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
1005 } else if (!strcmp("!Linux", str)) {
1006 enable_osi_linux(0);
1007 } else if (!strcmp("Linux", str)) { 1007 } else if (!strcmp("Linux", str)) {
1008 enable_osi_linux(1); 1008 enable_osi_linux(1);
1009 } else if (*osi_additional_string == '\0') { 1009 } else if (*osi_additional_string == '\0') {
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index b4a8d6030e..4ad8675f5a 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -16,6 +16,11 @@ menuconfig ATA
16 that "speaks" the ATA protocol, also called ATA controller), 16 that "speaks" the ATA protocol, also called ATA controller),
17 because you will be asked for it. 17 because you will be asked for it.
18 18
19 NOTE: ATA enables basic SCSI support; *however*,
20 'SCSI disk support', 'SCSI tape support', or
21 'SCSI CDROM support' may also be needed,
22 depending on your hardware configuration.
23
19if ATA 24if ATA
20 25
21config ATA_NONSTANDARD 26config ATA_NONSTANDARD
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 7565f022bd..4c6e95c95e 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -50,7 +50,7 @@ static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
50 50
51 /* Bits 5 and 6 indicate if DMA is active on master/slave */ 51 /* Bits 5 and 6 indicate if DMA is active on master/slave */
52 if (ap->ioaddr.bmdma_addr) 52 if (ap->ioaddr.bmdma_addr)
53 dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 53 dma_enabled = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
54 54
55 for (i = 0; i < ATA_MAX_DEVICES; i++) { 55 for (i = 0; i < ATA_MAX_DEVICES; i++) {
56 struct ata_device *dev = &ap->device[i]; 56 struct ata_device *dev = &ap->device[i];
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index bfc59a1047..981b397cb4 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3798,6 +3798,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3798 /* Drives which do spurious command completion */ 3798 /* Drives which do spurious command completion */
3799 { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, }, 3799 { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, },
3800 { "HTS541612J9SA00", "SBDIC7JP", ATA_HORKAGE_NONCQ, }, 3800 { "HTS541612J9SA00", "SBDIC7JP", ATA_HORKAGE_NONCQ, },
3801 { "Hitachi HTS541616J9SA00", "SB4OC70P", ATA_HORKAGE_NONCQ, },
3801 { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, }, 3802 { "WDC WD740ADFD-00NLR1", NULL, ATA_HORKAGE_NONCQ, },
3802 3803
3803 /* Devices with NCQ limits */ 3804 /* Devices with NCQ limits */
@@ -4781,8 +4782,6 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
4781 } else 4782 } else
4782 ata_qc_complete(qc); 4783 ata_qc_complete(qc);
4783 } 4784 }
4784
4785 ata_altstatus(ap); /* flush */
4786} 4785}
4787 4786
4788/** 4787/**
@@ -6424,14 +6423,14 @@ int ata_host_activate(struct ata_host *host, int irq,
6424 if (rc) 6423 if (rc)
6425 return rc; 6424 return rc;
6426 6425
6426 /* Used to print device info at probe */
6427 host->irq = irq;
6428
6427 rc = ata_host_register(host, sht); 6429 rc = ata_host_register(host, sht);
6428 /* if failed, just free the IRQ and leave ports alone */ 6430 /* if failed, just free the IRQ and leave ports alone */
6429 if (rc) 6431 if (rc)
6430 devm_free_irq(host->dev, irq, host); 6432 devm_free_irq(host->dev, irq, host);
6431 6433
6432 /* Used to print device info at probe */
6433 host->irq = irq;
6434
6435 return rc; 6434 return rc;
6436} 6435}
6437 6436
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index ce84805ba5..fa1c22c7b3 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -1065,10 +1065,11 @@ int ata_pci_init_one(struct pci_dev *pdev,
1065 if (rc) 1065 if (rc)
1066 goto err_out; 1066 goto err_out;
1067 1067
1068 if (!legacy_mode) 1068 if (!legacy_mode) {
1069 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, 1069 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
1070 IRQF_SHARED, DRV_NAME, host); 1070 IRQF_SHARED, DRV_NAME, host);
1071 else { 1071 host->irq = pdev->irq;
1072 } else {
1072 irq_handler_t handler[2] = { host->ops->irq_handler, 1073 irq_handler_t handler[2] = { host->ops->irq_handler,
1073 host->ops->irq_handler }; 1074 host->ops->irq_handler };
1074 unsigned int irq_flags[2] = { IRQF_SHARED, IRQF_SHARED }; 1075 unsigned int irq_flags[2] = { IRQF_SHARED, IRQF_SHARED };
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 3c55a5ff74..75e95bdbe0 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -550,22 +550,22 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
550 .udma_mask = 0x1f, 550 .udma_mask = 0x1f,
551 .port_ops = &ali_c2_port_ops 551 .port_ops = &ali_c2_port_ops
552 }; 552 };
553 /* Revision 0xC3 is UDMA100 */ 553 /* Revision 0xC3 is UDMA66 for now */
554 static const struct ata_port_info info_c3 = { 554 static const struct ata_port_info info_c3 = {
555 .sht = &ali_sht, 555 .sht = &ali_sht,
556 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 556 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
557 .pio_mask = 0x1f, 557 .pio_mask = 0x1f,
558 .mwdma_mask = 0x07, 558 .mwdma_mask = 0x07,
559 .udma_mask = 0x3f, 559 .udma_mask = 0x1f,
560 .port_ops = &ali_c2_port_ops 560 .port_ops = &ali_c2_port_ops
561 }; 561 };
562 /* Revision 0xC4 is UDMA133 */ 562 /* Revision 0xC4 is UDMA100 */
563 static const struct ata_port_info info_c4 = { 563 static const struct ata_port_info info_c4 = {
564 .sht = &ali_sht, 564 .sht = &ali_sht,
565 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 565 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48,
566 .pio_mask = 0x1f, 566 .pio_mask = 0x1f,
567 .mwdma_mask = 0x07, 567 .mwdma_mask = 0x07,
568 .udma_mask = 0x7f, 568 .udma_mask = 0x3f,
569 .port_ops = &ali_c2_port_ops 569 .port_ops = &ali_c2_port_ops
570 }; 570 };
571 /* Revision 0xC5 is UDMA133 with LBA48 DMA */ 571 /* Revision 0xC5 is UDMA133 with LBA48 DMA */
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 1aabe15ad9..00cf013407 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -284,6 +284,11 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
284 ata_interrupt, 0, DRV_NAME, host); 284 ata_interrupt, 0, DRV_NAME, host);
285 if (rc) 285 if (rc)
286 return rc; 286 return rc;
287
288 if (i == 0)
289 host->irq = irq[0];
290 else
291 host->irq2 = irq[1];
287 } 292 }
288 293
289 return ata_host_register(host, &cs5520_sht); 294 return ata_host_register(host, &cs5520_sht);
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 4d44c7555d..a56257c98f 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -129,7 +129,7 @@ static struct ata_port_operations pcmcia_port_ops = {
129 .irq_on = ata_irq_on, 129 .irq_on = ata_irq_on,
130 .irq_ack = ata_irq_ack, 130 .irq_ack = ata_irq_ack,
131 131
132 .port_start = ata_port_start, 132 .port_start = ata_sff_port_start,
133}; 133};
134 134
135#define CS_CHECK(fn, ret) \ 135#define CS_CHECK(fn, ret) \
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 0d2cc49fde..69a5aa4949 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -689,10 +689,12 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
689 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR]; 689 void __iomem *mmio_base = host->iomap[PDC_MMIO_BAR];
690 u32 scr; 690 u32 scr;
691 long start_count, end_count; 691 long start_count, end_count;
692 long pll_clock; 692 struct timeval start_time, end_time;
693 long pll_clock, usec_elapsed;
693 694
694 /* Read current counter value */ 695 /* Read current counter value */
695 start_count = pdc_read_counter(host); 696 start_count = pdc_read_counter(host);
697 do_gettimeofday(&start_time);
696 698
697 /* Start the test mode */ 699 /* Start the test mode */
698 scr = readl(mmio_base + PDC_SYS_CTL); 700 scr = readl(mmio_base + PDC_SYS_CTL);
@@ -705,6 +707,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
705 707
706 /* Read the counter values again */ 708 /* Read the counter values again */
707 end_count = pdc_read_counter(host); 709 end_count = pdc_read_counter(host);
710 do_gettimeofday(&end_time);
708 711
709 /* Stop the test mode */ 712 /* Stop the test mode */
710 scr = readl(mmio_base + PDC_SYS_CTL); 713 scr = readl(mmio_base + PDC_SYS_CTL);
@@ -713,7 +716,11 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
713 readl(mmio_base + PDC_SYS_CTL); /* flush */ 716 readl(mmio_base + PDC_SYS_CTL); /* flush */
714 717
715 /* calculate the input clock in Hz */ 718 /* calculate the input clock in Hz */
716 pll_clock = (start_count - end_count) * 10; 719 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
720 (end_time.tv_usec - start_time.tv_usec);
721
722 pll_clock = (start_count - end_count) / 100 *
723 (100000000 / usec_elapsed);
717 724
718 PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count); 725 PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count);
719 PDPRINTK("PLL input clock[%ld]Hz\n", pll_clock); 726 PDPRINTK("PLL input clock[%ld]Hz\n", pll_clock);
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index edbaf9d653..d277246b73 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -31,8 +31,8 @@ static int pdc2026x_cable_detect(struct ata_port *ap)
31 31
32 pci_read_config_word(pdev, 0x50, &cis); 32 pci_read_config_word(pdev, 0x50, &cis);
33 if (cis & (1 << (10 + ap->port_no))) 33 if (cis & (1 << (10 + ap->port_no)))
34 return ATA_CBL_PATA80; 34 return ATA_CBL_PATA40;
35 return ATA_CBL_PATA40; 35 return ATA_CBL_PATA80;
36} 36}
37 37
38/** 38/**
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index ec3ae93750..cfe4ec6eb3 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -560,6 +560,40 @@ static const struct ata_port_operations sis_133_ops = {
560 .port_start = ata_port_start, 560 .port_start = ata_port_start,
561}; 561};
562 562
563static const struct ata_port_operations sis_133_for_sata_ops = {
564 .port_disable = ata_port_disable,
565 .set_piomode = sis_133_set_piomode,
566 .set_dmamode = sis_133_set_dmamode,
567 .mode_filter = ata_pci_default_filter,
568
569 .tf_load = ata_tf_load,
570 .tf_read = ata_tf_read,
571 .check_status = ata_check_status,
572 .exec_command = ata_exec_command,
573 .dev_select = ata_std_dev_select,
574
575 .freeze = ata_bmdma_freeze,
576 .thaw = ata_bmdma_thaw,
577 .error_handler = ata_bmdma_error_handler,
578 .post_internal_cmd = ata_bmdma_post_internal_cmd,
579 .cable_detect = sis_133_cable_detect,
580
581 .bmdma_setup = ata_bmdma_setup,
582 .bmdma_start = ata_bmdma_start,
583 .bmdma_stop = ata_bmdma_stop,
584 .bmdma_status = ata_bmdma_status,
585 .qc_prep = ata_qc_prep,
586 .qc_issue = ata_qc_issue_prot,
587 .data_xfer = ata_data_xfer,
588
589 .irq_handler = ata_interrupt,
590 .irq_clear = ata_bmdma_irq_clear,
591 .irq_on = ata_irq_on,
592 .irq_ack = ata_irq_ack,
593
594 .port_start = ata_port_start,
595};
596
563static const struct ata_port_operations sis_133_early_ops = { 597static const struct ata_port_operations sis_133_early_ops = {
564 .port_disable = ata_port_disable, 598 .port_disable = ata_port_disable,
565 .set_piomode = sis_100_set_piomode, 599 .set_piomode = sis_100_set_piomode,
@@ -733,13 +767,20 @@ static const struct ata_port_info sis_info100_early = {
733 .pio_mask = 0x1f, /* pio0-4 */ 767 .pio_mask = 0x1f, /* pio0-4 */
734 .port_ops = &sis_66_ops, 768 .port_ops = &sis_66_ops,
735}; 769};
736const struct ata_port_info sis_info133 = { 770static const struct ata_port_info sis_info133 = {
737 .sht = &sis_sht, 771 .sht = &sis_sht,
738 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 772 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
739 .pio_mask = 0x1f, /* pio0-4 */ 773 .pio_mask = 0x1f, /* pio0-4 */
740 .udma_mask = ATA_UDMA6, 774 .udma_mask = ATA_UDMA6,
741 .port_ops = &sis_133_ops, 775 .port_ops = &sis_133_ops,
742}; 776};
777const struct ata_port_info sis_info133_for_sata = {
778 .sht = &sis_sht,
779 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
780 .pio_mask = 0x1f, /* pio0-4 */
781 .udma_mask = ATA_UDMA6,
782 .port_ops = &sis_133_for_sata_ops,
783};
743static const struct ata_port_info sis_info133_early = { 784static const struct ata_port_info sis_info133_early = {
744 .sht = &sis_sht, 785 .sht = &sis_sht,
745 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 786 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST,
@@ -749,7 +790,7 @@ static const struct ata_port_info sis_info133_early = {
749}; 790};
750 791
751/* Privately shared with the SiS180 SATA driver, not for use elsewhere */ 792/* Privately shared with the SiS180 SATA driver, not for use elsewhere */
752EXPORT_SYMBOL_GPL(sis_info133); 793EXPORT_SYMBOL_GPL(sis_info133_for_sata);
753 794
754static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis) 795static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
755{ 796{
@@ -975,6 +1016,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
975static const struct pci_device_id sis_pci_tbl[] = { 1016static const struct pci_device_id sis_pci_tbl[] = {
976 { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */ 1017 { PCI_VDEVICE(SI, 0x5513), }, /* SiS 5513 */
977 { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */ 1018 { PCI_VDEVICE(SI, 0x5518), }, /* SiS 5518 */
1019 { PCI_VDEVICE(SI, 0x1180), }, /* SiS 1180 */
978 1020
979 { } 1021 { }
980}; 1022};
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 2d80c9d95e..dc3bbce046 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -496,6 +496,13 @@ static void inic_dev_config(struct ata_device *dev)
496 /* inic can only handle upto LBA28 max sectors */ 496 /* inic can only handle upto LBA28 max sectors */
497 if (dev->max_sectors > ATA_MAX_SECTORS) 497 if (dev->max_sectors > ATA_MAX_SECTORS)
498 dev->max_sectors = ATA_MAX_SECTORS; 498 dev->max_sectors = ATA_MAX_SECTORS;
499
500 if (dev->n_sectors >= 1 << 28) {
501 ata_dev_printk(dev, KERN_ERR,
502 "ERROR: This driver doesn't support LBA48 yet and may cause\n"
503 " data corruption on such devices. Disabling.\n");
504 ata_dev_disable(dev);
505 }
499} 506}
500 507
501static void init_port(struct ata_port *ap) 508static void init_port(struct ata_port *ap)
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index c957e6e54b..590f2f92b4 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -582,6 +582,9 @@ static const struct pci_device_id mv_pci_tbl[] = {
582 582
583 { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x }, 583 { PCI_VDEVICE(ADAPTEC2, 0x0241), chip_604x },
584 584
585 /* Adaptec 1430SA */
586 { PCI_VDEVICE(ADAPTEC2, 0x0243), chip_7042 },
587
585 { PCI_VDEVICE(TTI, 0x2310), chip_7042 }, 588 { PCI_VDEVICE(TTI, 0x2310), chip_7042 },
586 589
587 /* add Marvell 7042 support */ 590 /* add Marvell 7042 support */
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index adfa693db5..b2656867c6 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -325,6 +325,7 @@ static struct scsi_host_template nv_adma_sht = {
325 .name = DRV_NAME, 325 .name = DRV_NAME,
326 .ioctl = ata_scsi_ioctl, 326 .ioctl = ata_scsi_ioctl,
327 .queuecommand = ata_scsi_queuecmd, 327 .queuecommand = ata_scsi_queuecmd,
328 .change_queue_depth = ata_scsi_change_queue_depth,
328 .can_queue = NV_ADMA_MAX_CPBS, 329 .can_queue = NV_ADMA_MAX_CPBS,
329 .this_id = ATA_SHT_THIS_ID, 330 .this_id = ATA_SHT_THIS_ID,
330 .sg_tablesize = NV_ADMA_SGTBL_TOTAL_LEN, 331 .sg_tablesize = NV_ADMA_SGTBL_TOTAL_LEN,
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 221099d1d0..f111c984a3 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -72,8 +72,8 @@ static const struct pci_device_id sis_pci_tbl[] = {
72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */ 72 { PCI_VDEVICE(SI, 0x0181), sis_180 }, /* SiS 964/180 */
73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */ 73 { PCI_VDEVICE(SI, 0x0182), sis_180 }, /* SiS 965/965L */
74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */ 74 { PCI_VDEVICE(SI, 0x0183), sis_180 }, /* SiS 965/965L */
75 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/966L */ 75 { PCI_VDEVICE(SI, 0x1182), sis_180 }, /* SiS 966/680 */
76 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L */ 76 { PCI_VDEVICE(SI, 0x1183), sis_180 }, /* SiS 966/966L/968/680 */
77 77
78 { } /* terminate list */ 78 { } /* terminate list */
79}; 79};
@@ -161,7 +161,6 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
161 case 0x0182: 161 case 0x0182:
162 case 0x0183: 162 case 0x0183:
163 case 0x1182: 163 case 0x1182:
164 case 0x1183:
165 addr += SIS182_SATA1_OFS; 164 addr += SIS182_SATA1_OFS;
166 break; 165 break;
167 } 166 }
@@ -183,8 +182,8 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
183 182
184 pci_read_config_dword(pdev, cfg_addr, &val); 183 pci_read_config_dword(pdev, cfg_addr, &val);
185 184
186 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 185 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
187 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 186 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
188 pci_read_config_dword(pdev, cfg_addr+0x10, &val2); 187 pci_read_config_dword(pdev, cfg_addr+0x10, &val2);
189 188
190 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ 189 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */
@@ -203,8 +202,8 @@ static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val
203 202
204 pci_write_config_dword(pdev, cfg_addr, val); 203 pci_write_config_dword(pdev, cfg_addr, val);
205 204
206 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 205 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
207 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 206 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
208 pci_write_config_dword(pdev, cfg_addr+0x10, val); 207 pci_write_config_dword(pdev, cfg_addr+0x10, val);
209} 208}
210 209
@@ -224,8 +223,8 @@ static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg)
224 223
225 val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); 224 val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4));
226 225
227 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 226 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
228 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 227 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
229 val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10); 228 val2 = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4) + 0x10);
230 229
231 return (val | val2) & 0xfffffffb; 230 return (val | val2) & 0xfffffffb;
@@ -245,8 +244,8 @@ static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
245 sis_scr_cfg_write(ap, sc_reg, val); 244 sis_scr_cfg_write(ap, sc_reg, val);
246 else { 245 else {
247 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 246 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4));
248 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || (pdev->device == 0x1182) || 247 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
249 (pdev->device == 0x1183) || (pmr & SIS_PMR_COMBINED)) 248 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
250 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10); 249 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)+0x10);
251 } 250 }
252} 251}
@@ -293,11 +292,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
293 /* The PATA-handling is provided by pata_sis */ 292 /* The PATA-handling is provided by pata_sis */
294 switch (pmr & 0x30) { 293 switch (pmr & 0x30) {
295 case 0x10: 294 case 0x10:
296 ppi[1] = &sis_info133; 295 ppi[1] = &sis_info133_for_sata;
297 break; 296 break;
298 297
299 case 0x30: 298 case 0x30:
300 ppi[0] = &sis_info133; 299 ppi[0] = &sis_info133_for_sata;
301 break; 300 break;
302 } 301 }
303 if ((pmr & SIS_PMR_COMBINED) == 0) { 302 if ((pmr & SIS_PMR_COMBINED) == 0) {
@@ -324,14 +323,14 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
324 break; 323 break;
325 324
326 case 0x1182: 325 case 0x1182:
326 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/966/680 SATA controller\n");
327 pi.flags |= ATA_FLAG_SLAVE_POSS;
328 break;
329
327 case 0x1183: 330 case 0x1183:
328 pci_read_config_dword(pdev, 0x64, &val); 331 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n");
329 if (val & 0x10000000) { 332 ppi[0] = &sis_info133_for_sata;
330 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966L SATA controller\n"); 333 ppi[1] = &sis_info133_for_sata;
331 } else {
332 dev_printk(KERN_INFO, &pdev->dev, "Detected SiS 1182/1183/966 SATA controller\n");
333 pi.flags |= ATA_FLAG_SLAVE_POSS;
334 }
335 break; 334 break;
336 } 335 }
337 336
diff --git a/drivers/ata/sis.h b/drivers/ata/sis.h
index 0f2208d8d5..f7f3eebe66 100644
--- a/drivers/ata/sis.h
+++ b/drivers/ata/sis.h
@@ -2,4 +2,4 @@
2struct ata_port_info; 2struct ata_port_info;
3 3
4/* pata_sis.c */ 4/* pata_sis.c */
5extern const struct ata_port_info sis_info133; 5extern const struct ata_port_info sis_info133_for_sata;
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index f5a47a48c3..5b4fab2415 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -7,7 +7,7 @@ menuconfig ATM_DRIVERS
7 depends on NETDEVICES && ATM 7 depends on NETDEVICES && ATM
8 default y 8 default y
9 9
10if ATM_DRIVERS 10if ATM_DRIVERS && NETDEVICES && ATM
11 11
12config ATM_DUMMY 12config ATM_DUMMY
13 tristate "Dummy ATM driver" 13 tristate "Dummy ATM driver"
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c
index 8e87261046..8500141395 100644
--- a/drivers/dma/ioatdma.c
+++ b/drivers/dma/ioatdma.c
@@ -556,7 +556,7 @@ static struct pci_device_id ioat_pci_tbl[] = {
556 { 0, } 556 { 0, }
557}; 557};
558 558
559static struct pci_driver ioat_pci_drv = { 559static struct pci_driver ioat_pci_driver = {
560 .name = "ioatdma", 560 .name = "ioatdma",
561 .id_table = ioat_pci_tbl, 561 .id_table = ioat_pci_tbl,
562 .probe = ioat_probe, 562 .probe = ioat_probe,
@@ -699,7 +699,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev,
699 if (err) 699 if (err)
700 goto err_set_dma_mask; 700 goto err_set_dma_mask;
701 701
702 err = pci_request_regions(pdev, ioat_pci_drv.name); 702 err = pci_request_regions(pdev, ioat_pci_driver.name);
703 if (err) 703 if (err)
704 goto err_request_regions; 704 goto err_request_regions;
705 705
@@ -828,14 +828,14 @@ static int __init ioat_init_module(void)
828 /* if forced, worst case is that rmmod hangs */ 828 /* if forced, worst case is that rmmod hangs */
829 __unsafe(THIS_MODULE); 829 __unsafe(THIS_MODULE);
830 830
831 return pci_register_driver(&ioat_pci_drv); 831 return pci_register_driver(&ioat_pci_driver);
832} 832}
833 833
834module_init(ioat_init_module); 834module_init(ioat_init_module);
835 835
836static void __exit ioat_exit_module(void) 836static void __exit ioat_exit_module(void)
837{ 837{
838 pci_unregister_driver(&ioat_pci_drv); 838 pci_unregister_driver(&ioat_pci_driver);
839} 839}
840 840
841module_exit(ioat_exit_module); 841module_exit(ioat_exit_module);
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index 396dade731..d011a76f8e 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -4,27 +4,44 @@ comment "An alternative FireWire stack is available with EXPERIMENTAL=y"
4 depends on EXPERIMENTAL=n 4 depends on EXPERIMENTAL=n
5 5
6config FIREWIRE 6config FIREWIRE
7 tristate "IEEE 1394 (FireWire) support (JUJU alternative stack, experimental)" 7 tristate "IEEE 1394 (FireWire) support - alternative stack, EXPERIMENTAL"
8 depends on EXPERIMENTAL 8 depends on EXPERIMENTAL
9 select CRC_ITU_T 9 select CRC_ITU_T
10 help 10 help
11 IEEE 1394 describes a high performance serial bus, which is also 11 This is the "Juju" FireWire stack, a new alternative implementation
12 known as FireWire(tm) or i.Link(tm) and is used for connecting all
13 sorts of devices (most notably digital video cameras) to your
14 computer.
15
16 If you have FireWire hardware and want to use it, say Y here. This
17 is the core support only, you will also need to select a driver for
18 your IEEE 1394 adapter.
19
20 To compile this driver as a module, say M here: the module will be
21 called firewire-core.
22
23 This is the "JUJU" FireWire stack, an alternative implementation
24 designed for robustness and simplicity. You can build either this 12 designed for robustness and simplicity. You can build either this
25 stack, or the classic stack (the ieee1394 driver, ohci1394 etc.) 13 stack, or the classic stack (the ieee1394 driver, ohci1394 etc.)
26 or both. 14 or both.
27 15
16 To compile this driver as a module, say M here: the module will be
17 called firewire-core. It functionally replaces ieee1394, raw1394,
18 and video1394.
19
20 NOTE:
21
22 You should only build ONE of the stacks, unless you REALLY know what
23 you are doing. If you install both, you should configure them only as
24 modules rather than link them statically, and you should blacklist one
25 of the concurrent low-level drivers in /etc/modprobe.conf. Add either
26
27 blacklist firewire-ohci
28 or
29 blacklist ohci1394
30
31 there depending on which driver you DON'T want to have auto-loaded.
32 You can optionally do the same with the other IEEE 1394/ FireWire
33 drivers.
34
35 If you have an old modprobe which doesn't implement the blacklist
36 directive, use either
37
38 install firewire-ohci /bin/true
39 or
40 install ohci1394 /bin/true
41
42 and so on, depending on which modules you DON't want to have
43 auto-loaded.
44
28config FIREWIRE_OHCI 45config FIREWIRE_OHCI
29 tristate "Support for OHCI FireWire host controllers" 46 tristate "Support for OHCI FireWire host controllers"
30 depends on PCI && FIREWIRE 47 depends on PCI && FIREWIRE
@@ -34,11 +51,13 @@ config FIREWIRE_OHCI
34 is the only chipset in use, so say Y here. 51 is the only chipset in use, so say Y here.
35 52
36 To compile this driver as a module, say M here: The module will be 53 To compile this driver as a module, say M here: The module will be
37 called firewire-ohci. 54 called firewire-ohci. It replaces ohci1394 of the classic IEEE 1394
55 stack.
56
57 NOTE:
38 58
39 If you also build ohci1394 of the classic IEEE 1394 driver stack, 59 If you also build ohci1394 of the classic stack, blacklist either
40 blacklist either ohci1394 or firewire-ohci to let hotplug load the 60 ohci1394 or firewire-ohci to let hotplug load only the desired driver.
41 desired driver.
42 61
43config FIREWIRE_SBP2 62config FIREWIRE_SBP2
44 tristate "Support for storage devices (SBP-2 protocol driver)" 63 tristate "Support for storage devices (SBP-2 protocol driver)"
@@ -50,12 +69,14 @@ config FIREWIRE_SBP2
50 like scanners. 69 like scanners.
51 70
52 To compile this driver as a module, say M here: The module will be 71 To compile this driver as a module, say M here: The module will be
53 called firewire-sbp2. 72 called firewire-sbp2. It replaces sbp2 of the classic IEEE 1394
73 stack.
54 74
55 You should also enable support for disks, CD-ROMs, etc. in the SCSI 75 You should also enable support for disks, CD-ROMs, etc. in the SCSI
56 configuration section. 76 configuration section.
57 77
58 If you also build sbp2 of the classic IEEE 1394 driver stack, 78 NOTE:
59 blacklist either sbp2 or firewire-sbp2 to let hotplug load the 79
60 desired driver. 80 If you also build sbp2 of the classic stack, blacklist either sbp2
81 or firewire-sbp2 to let hotplug load only the desired driver.
61 82
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index b72a5c1f9e..96c8ac5b86 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -373,8 +373,8 @@ static void ar_context_tasklet(unsigned long data)
373 373
374 offset = offsetof(struct ar_buffer, data); 374 offset = offsetof(struct ar_buffer, data);
375 dma_unmap_single(ohci->card.device, 375 dma_unmap_single(ohci->card.device,
376 ab->descriptor.data_address - offset, 376 le32_to_cpu(ab->descriptor.data_address) - offset,
377 PAGE_SIZE, DMA_BIDIRECTIONAL); 377 PAGE_SIZE, DMA_BIDIRECTIONAL);
378 378
379 buffer = ab; 379 buffer = ab;
380 ab = ab->next; 380 ab = ab->next;
@@ -427,7 +427,7 @@ static void ar_context_run(struct ar_context *ctx)
427 size_t offset; 427 size_t offset;
428 428
429 offset = offsetof(struct ar_buffer, data); 429 offset = offsetof(struct ar_buffer, data);
430 ab_bus = ab->descriptor.data_address - offset; 430 ab_bus = le32_to_cpu(ab->descriptor.data_address) - offset;
431 431
432 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab_bus | 1); 432 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab_bus | 1);
433 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); 433 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 41bfa4d21a..f5ce22c38f 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -574,11 +574,11 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
574 /* look for ATAPI device */ 574 /* look for ATAPI device */
575 (void) do_probe(drive, WIN_PIDENTIFY); 575 (void) do_probe(drive, WIN_PIDENTIFY);
576 } 576 }
577 if (strstr(drive->id->model, "E X A B Y T E N E S T"))
578 enable_nest(drive);
579 if (!drive->present) 577 if (!drive->present)
580 /* drive not found */ 578 /* drive not found */
581 return 0; 579 return 0;
580 if (strstr(drive->id->model, "E X A B Y T E N E S T"))
581 enable_nest(drive);
582 582
583 /* identification failed? */ 583 /* identification failed? */
584 if (!drive->id_read) { 584 if (!drive->id_read) {
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 30175c7688..aa06dafb74 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -238,7 +238,7 @@ EXPORT_SYMBOL(task_no_data_intr);
238static u8 wait_drive_not_busy(ide_drive_t *drive) 238static u8 wait_drive_not_busy(ide_drive_t *drive)
239{ 239{
240 ide_hwif_t *hwif = HWIF(drive); 240 ide_hwif_t *hwif = HWIF(drive);
241 int retries = 100; 241 int retries;
242 u8 stat; 242 u8 stat;
243 243
244 /* 244 /*
@@ -246,10 +246,14 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
246 * This can take up to 10 usec, but we will wait max 1 ms 246 * This can take up to 10 usec, but we will wait max 1 ms
247 * (drive_cmd_intr() waits that long). 247 * (drive_cmd_intr() waits that long).
248 */ 248 */
249 while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--) 249 for (retries = 0; retries < 100; retries++) {
250 udelay(10); 250 if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT)
251 udelay(10);
252 else
253 break;
254 }
251 255
252 if (!retries) 256 if (stat & BUSY_STAT)
253 printk(KERN_ERR "%s: drive still BUSY!\n", drive->name); 257 printk(KERN_ERR "%s: drive still BUSY!\n", drive->name);
254 258
255 return stat; 259 return stat;
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 9db1be826e..a2be65fcf8 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Version 2.15 2 * Version 2.16
3 * 3 *
4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04
5 * IDE driver for Linux. 5 * IDE driver for Linux.
@@ -244,10 +244,8 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed)
244 struct ide_timing t, p; 244 struct ide_timing t, p;
245 int T, UT; 245 int T, UT;
246 246
247 if (speed != XFER_PIO_SLOW && speed != drive->current_speed) 247 if (speed != XFER_PIO_SLOW)
248 if (ide_config_drive_speed(drive, speed)) 248 ide_config_drive_speed(drive, speed);
249 printk(KERN_WARNING "ide%d: Drive %d didn't accept speed setting. Oh, well.\n",
250 drive->dn >> 1, drive->dn & 1);
251 249
252 T = 1000000000 / amd_clock; 250 T = 1000000000 / amd_clock;
253 UT = T / min_t(int, max_t(int, amd_config->flags & AMD_UDMA, 1), 2); 251 UT = T / min_t(int, max_t(int, amd_config->flags & AMD_UDMA, 1), 2);
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index ce8a5449a5..c33d0b0f11 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.04 Jun 4, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.06 Jun 27, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -182,6 +182,7 @@ static const char *bad_ata66_4[] = {
182 "IC35L040AVER07-0", 182 "IC35L040AVER07-0",
183 "IC35L060AVER07-0", 183 "IC35L060AVER07-0",
184 "WDC AC310200R", 184 "WDC AC310200R",
185 "MAXTOR STM3320620A",
185 NULL 186 NULL
186}; 187};
187 188
@@ -1513,18 +1514,28 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
1513 goto init_single; 1514 goto init_single;
1514 1515
1515 /* 1516 /*
1516 * HPT36x chips are single channel and 1517 * HPT36x chips have one channel per function and have
1517 * do not seem to have the channel enable bit... 1518 * both channel enable bits located differently and visible
1519 * to both functions -- really stupid design decision... :-(
1520 * Bit 4 is for the primary channel, bit 5 for the secondary.
1518 */ 1521 */
1519 d->channels = 1; 1522 d->channels = 1;
1520 d->enablebits[0].reg = 0; 1523 d->enablebits[0].mask = d->enablebits[0].val = 0x10;
1521 1524
1522 if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) { 1525 if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) {
1523 u8 pin1 = 0, pin2 = 0; 1526 u8 mcr1 = 0, pin1 = 0, pin2 = 0;
1524 int ret; 1527 int ret;
1525 1528
1526 pci_set_drvdata(dev2, info[rev]); 1529 pci_set_drvdata(dev2, info[rev]);
1527 1530
1531 /*
1532 * Now we'll have to force both channels enabled if
1533 * at least one of them has been enabled by BIOS...
1534 */
1535 pci_read_config_byte(dev, 0x50, &mcr1);
1536 if (mcr1 & 0x30)
1537 pci_write_config_byte(dev, 0x50, mcr1 | 0x30);
1538
1528 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin1); 1539 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin1);
1529 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2); 1540 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2);
1530 if (pin1 != pin2 && dev->irq == dev2->irq) { 1541 if (pin1 != pin2 && dev->irq == dev2->irq) {
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index 4bd4bf02e9..3aeb7f1b79 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -1,6 +1,6 @@
1 1
2/* 2/*
3 * linux/drivers/ide/pci/it821x.c Version 0.15 Jun 2 2007 3 * linux/drivers/ide/pci/it821x.c Version 0.16 Jul 3 2007
4 * 4 *
5 * Copyright (C) 2004 Red Hat <alan@redhat.com> 5 * Copyright (C) 2004 Red Hat <alan@redhat.com>
6 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 6 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
@@ -660,7 +660,6 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
660 660
661 hwif->ultra_mask = 0x7f; 661 hwif->ultra_mask = 0x7f;
662 hwif->mwdma_mask = 0x07; 662 hwif->mwdma_mask = 0x07;
663 hwif->swdma_mask = 0x07;
664 663
665 hwif->ide_dma_check = &it821x_config_drive_for_dma; 664 hwif->ide_dma_check = &it821x_config_drive_for_dma;
666 if (!(hwif->udma_four)) 665 if (!(hwif->udma_four))
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index cc0bfdcf1f..0765dce694 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -306,11 +306,13 @@ static long __devinit read_counter(u32 dma_base)
306 */ 306 */
307static long __devinit detect_pll_input_clock(unsigned long dma_base) 307static long __devinit detect_pll_input_clock(unsigned long dma_base)
308{ 308{
309 struct timeval start_time, end_time;
309 long start_count, end_count; 310 long start_count, end_count;
310 long pll_input; 311 long pll_input, usec_elapsed;
311 u8 scr1; 312 u8 scr1;
312 313
313 start_count = read_counter(dma_base); 314 start_count = read_counter(dma_base);
315 do_gettimeofday(&start_time);
314 316
315 /* Start the test mode */ 317 /* Start the test mode */
316 outb(0x01, dma_base + 0x01); 318 outb(0x01, dma_base + 0x01);
@@ -322,6 +324,7 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
322 mdelay(10); 324 mdelay(10);
323 325
324 end_count = read_counter(dma_base); 326 end_count = read_counter(dma_base);
327 do_gettimeofday(&end_time);
325 328
326 /* Stop the test mode */ 329 /* Stop the test mode */
327 outb(0x01, dma_base + 0x01); 330 outb(0x01, dma_base + 0x01);
@@ -333,7 +336,10 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
333 * Calculate the input clock in Hz 336 * Calculate the input clock in Hz
334 * (the clock counter is 30 bit wide and counts down) 337 * (the clock counter is 30 bit wide and counts down)
335 */ 338 */
336 pll_input = ((start_count - end_count) & 0x3ffffff) * 100; 339 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
340 (end_time.tv_usec - start_time.tv_usec);
341 pll_input = ((start_count - end_count) & 0x3ffffff) / 10 *
342 (10000000 / usec_elapsed);
337 343
338 DBG("start[%ld] end[%ld]\n", start_count, end_count); 344 DBG("start[%ld] end[%ld]\n", start_count, end_count);
339 345
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 67035ba4bf..c88d33225c 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -872,11 +872,15 @@ void __init ide_scan_pcibus (int scan_direction)
872 * are post init. 872 * are post init.
873 */ 873 */
874 874
875 list_for_each_safe(l, n, &ide_pci_drivers) 875 list_for_each_safe(l, n, &ide_pci_drivers) {
876 {
877 list_del(l); 876 list_del(l);
878 d = list_entry(l, struct pci_driver, node); 877 d = list_entry(l, struct pci_driver, node);
879 __pci_register_driver(d, d->driver.owner, d->driver.mod_name); 878 if (__pci_register_driver(d, d->driver.owner,
879 d->driver.mod_name)) {
880 printk(KERN_ERR "%s: failed to register driver "
881 "for %s\n", __FUNCTION__,
882 d->driver.mod_name);
883 }
880 } 884 }
881} 885}
882#endif 886#endif
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 5ffc464c99..ea74d1eaf0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -148,8 +148,8 @@ partial_error:
148 148
149 ib_dma_unmap_single(priv->ca, mapping[0], IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE); 149 ib_dma_unmap_single(priv->ca, mapping[0], IPOIB_CM_HEAD_SIZE, DMA_FROM_DEVICE);
150 150
151 for (; i >= 0; --i) 151 for (; i > 0; --i)
152 ib_dma_unmap_single(priv->ca, mapping[i + 1], PAGE_SIZE, DMA_FROM_DEVICE); 152 ib_dma_unmap_single(priv->ca, mapping[i], PAGE_SIZE, DMA_FROM_DEVICE);
153 153
154 dev_kfree_skb_any(skb); 154 dev_kfree_skb_any(skb);
155 return NULL; 155 return NULL;
diff --git a/drivers/media/dvb/Kconfig b/drivers/media/dvb/Kconfig
index efd2b74681..03ef88acd9 100644
--- a/drivers/media/dvb/Kconfig
+++ b/drivers/media/dvb/Kconfig
@@ -11,7 +11,7 @@ menuconfig DVB_CAPTURE_DRIVERS
11 ---help--- 11 ---help---
12 Say Y to select Digital TV adapters 12 Say Y to select Digital TV adapters
13 13
14if DVB_CAPTURE_DRIVERS 14if DVB_CAPTURE_DRIVERS && DVB_CORE
15 15
16comment "Supported SAA7146 based PCI Adapters" 16comment "Supported SAA7146 based PCI Adapters"
17 depends on DVB_CORE && PCI && I2C 17 depends on DVB_CORE && PCI && I2C
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index 6aba5b39ed..b40af48a2e 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -118,6 +118,7 @@ struct cinergyt2 {
118 struct dvb_demux demux; 118 struct dvb_demux demux;
119 struct usb_device *udev; 119 struct usb_device *udev;
120 struct mutex sem; 120 struct mutex sem;
121 struct mutex wq_sem;
121 struct dvb_adapter adapter; 122 struct dvb_adapter adapter;
122 struct dvb_device *fedev; 123 struct dvb_device *fedev;
123 struct dmxdev dmxdev; 124 struct dmxdev dmxdev;
@@ -482,14 +483,14 @@ static int cinergyt2_open (struct inode *inode, struct file *file)
482 struct cinergyt2 *cinergyt2 = dvbdev->priv; 483 struct cinergyt2 *cinergyt2 = dvbdev->priv;
483 int err = -ERESTARTSYS; 484 int err = -ERESTARTSYS;
484 485
485 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 486 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem))
486 return -ERESTARTSYS; 487 goto out;
487 488
488 if ((err = dvb_generic_open(inode, file))) { 489 if (mutex_lock_interruptible(&cinergyt2->sem))
489 mutex_unlock(&cinergyt2->sem); 490 goto out_unlock1;
490 return err;
491 }
492 491
492 if ((err = dvb_generic_open(inode, file)))
493 goto out_unlock2;
493 494
494 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 495 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
495 cinergyt2_sleep(cinergyt2, 0); 496 cinergyt2_sleep(cinergyt2, 0);
@@ -498,8 +499,12 @@ static int cinergyt2_open (struct inode *inode, struct file *file)
498 499
499 atomic_inc(&cinergyt2->inuse); 500 atomic_inc(&cinergyt2->inuse);
500 501
502out_unlock2:
501 mutex_unlock(&cinergyt2->sem); 503 mutex_unlock(&cinergyt2->sem);
502 return 0; 504out_unlock1:
505 mutex_unlock(&cinergyt2->wq_sem);
506out:
507 return err;
503} 508}
504 509
505static void cinergyt2_unregister(struct cinergyt2 *cinergyt2) 510static void cinergyt2_unregister(struct cinergyt2 *cinergyt2)
@@ -519,15 +524,17 @@ static int cinergyt2_release (struct inode *inode, struct file *file)
519 struct dvb_device *dvbdev = file->private_data; 524 struct dvb_device *dvbdev = file->private_data;
520 struct cinergyt2 *cinergyt2 = dvbdev->priv; 525 struct cinergyt2 *cinergyt2 = dvbdev->priv;
521 526
522 mutex_lock(&cinergyt2->sem); 527 mutex_lock(&cinergyt2->wq_sem);
523 528
524 if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { 529 if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) {
525 cancel_delayed_work(&cinergyt2->query_work); 530 cancel_rearming_delayed_work(&cinergyt2->query_work);
526 flush_scheduled_work(); 531
532 mutex_lock(&cinergyt2->sem);
527 cinergyt2_sleep(cinergyt2, 1); 533 cinergyt2_sleep(cinergyt2, 1);
534 mutex_unlock(&cinergyt2->sem);
528 } 535 }
529 536
530 mutex_unlock(&cinergyt2->sem); 537 mutex_unlock(&cinergyt2->wq_sem);
531 538
532 if (atomic_dec_and_test(&cinergyt2->inuse) && cinergyt2->disconnect_pending) { 539 if (atomic_dec_and_test(&cinergyt2->inuse) && cinergyt2->disconnect_pending) {
533 warn("delayed unregister in release"); 540 warn("delayed unregister in release");
@@ -838,13 +845,13 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
838 845
839static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) 846static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2)
840{ 847{
841 cancel_delayed_work(&cinergyt2->rc_query_work); 848 cancel_rearming_delayed_work(&cinergyt2->rc_query_work);
842 input_unregister_device(cinergyt2->rc_input_dev); 849 input_unregister_device(cinergyt2->rc_input_dev);
843} 850}
844 851
845static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2) 852static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2)
846{ 853{
847 cancel_delayed_work(&cinergyt2->rc_query_work); 854 cancel_rearming_delayed_work(&cinergyt2->rc_query_work);
848} 855}
849 856
850static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2) 857static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2)
@@ -907,6 +914,7 @@ static int cinergyt2_probe (struct usb_interface *intf,
907 usb_set_intfdata (intf, (void *) cinergyt2); 914 usb_set_intfdata (intf, (void *) cinergyt2);
908 915
909 mutex_init(&cinergyt2->sem); 916 mutex_init(&cinergyt2->sem);
917 mutex_init(&cinergyt2->wq_sem);
910 init_waitqueue_head (&cinergyt2->poll_wq); 918 init_waitqueue_head (&cinergyt2->poll_wq);
911 INIT_DELAYED_WORK(&cinergyt2->query_work, cinergyt2_query); 919 INIT_DELAYED_WORK(&cinergyt2->query_work, cinergyt2_query);
912 920
@@ -974,11 +982,8 @@ static void cinergyt2_disconnect (struct usb_interface *intf)
974{ 982{
975 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); 983 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
976 984
977 flush_scheduled_work();
978
979 cinergyt2_unregister_rc(cinergyt2); 985 cinergyt2_unregister_rc(cinergyt2);
980 986 cancel_rearming_delayed_work(&cinergyt2->query_work);
981 cancel_delayed_work(&cinergyt2->query_work);
982 wake_up_interruptible(&cinergyt2->poll_wq); 987 wake_up_interruptible(&cinergyt2->poll_wq);
983 988
984 cinergyt2->demux.dmx.close(&cinergyt2->demux.dmx); 989 cinergyt2->demux.dmx.close(&cinergyt2->demux.dmx);
@@ -992,21 +997,21 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
992{ 997{
993 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); 998 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
994 999
995 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 1000 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem))
996 return -ERESTARTSYS; 1001 return -ERESTARTSYS;
997 1002
998 if (1) { 1003 if (1) {
999 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
1000
1001 cinergyt2_suspend_rc(cinergyt2); 1004 cinergyt2_suspend_rc(cinergyt2);
1002 cancel_delayed_work(&cinergyt2->query_work); 1005 cancel_rearming_delayed_work(&cinergyt2->query_work);
1006
1007 mutex_lock(&cinergyt2->sem);
1003 if (cinergyt2->streaming) 1008 if (cinergyt2->streaming)
1004 cinergyt2_stop_stream_xfer(cinergyt2); 1009 cinergyt2_stop_stream_xfer(cinergyt2);
1005 flush_scheduled_work();
1006 cinergyt2_sleep(cinergyt2, 1); 1010 cinergyt2_sleep(cinergyt2, 1);
1011 mutex_unlock(&cinergyt2->sem);
1007 } 1012 }
1008 1013
1009 mutex_unlock(&cinergyt2->sem); 1014 mutex_unlock(&cinergyt2->wq_sem);
1010 return 0; 1015 return 0;
1011} 1016}
1012 1017
@@ -1014,9 +1019,15 @@ static int cinergyt2_resume (struct usb_interface *intf)
1014{ 1019{
1015 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); 1020 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
1016 struct dvbt_set_parameters_msg *param = &cinergyt2->param; 1021 struct dvbt_set_parameters_msg *param = &cinergyt2->param;
1022 int err = -ERESTARTSYS;
1017 1023
1018 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) 1024 if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem))
1019 return -ERESTARTSYS; 1025 goto out;
1026
1027 if (mutex_lock_interruptible(&cinergyt2->sem))
1028 goto out_unlock1;
1029
1030 err = 0;
1020 1031
1021 if (!cinergyt2->sleeping) { 1032 if (!cinergyt2->sleeping) {
1022 cinergyt2_sleep(cinergyt2, 0); 1033 cinergyt2_sleep(cinergyt2, 0);
@@ -1029,7 +1040,10 @@ static int cinergyt2_resume (struct usb_interface *intf)
1029 cinergyt2_resume_rc(cinergyt2); 1040 cinergyt2_resume_rc(cinergyt2);
1030 1041
1031 mutex_unlock(&cinergyt2->sem); 1042 mutex_unlock(&cinergyt2->sem);
1032 return 0; 1043out_unlock1:
1044 mutex_unlock(&cinergyt2->wq_sem);
1045out:
1046 return err;
1033} 1047}
1034 1048
1035static const struct usb_device_id cinergyt2_table [] __devinitdata = { 1049static const struct usb_device_id cinergyt2_table [] __devinitdata = {
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index 2557ac9620..b611f2b1f8 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -529,7 +529,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
529 if (bi->type != BUDGET_FS_ACTIVY) 529 if (bi->type != BUDGET_FS_ACTIVY)
530 saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI); 530 saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI);
531 531
532 if (budget_register(budget) == 0) 532 if ((ret = budget_register(budget)) == 0)
533 return 0; /* Everything OK */ 533 return 0; /* Everything OK */
534 534
535 /* An error occurred, cleanup resources */ 535 /* An error occurred, cleanup resources */
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index a6ac82a609..194b102140 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -9,7 +9,7 @@ menuconfig RADIO_ADAPTERS
9 ---help--- 9 ---help---
10 Say Y here to enable selecting AM/FM radio adapters. 10 Say Y here to enable selecting AM/FM radio adapters.
11 11
12if RADIO_ADAPTERS 12if RADIO_ADAPTERS && VIDEO_DEV
13 13
14config RADIO_CADET 14config RADIO_CADET
15 tristate "ADS Cadet AM/FM Tuner" 15 tristate "ADS Cadet AM/FM Tuner"
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 4cca55170e..4d45a40016 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -11,7 +11,7 @@ menuconfig VIDEO_CAPTURE_DRIVERS
11 webcams, analog TV, and hybrid analog/digital TV. 11 webcams, analog TV, and hybrid analog/digital TV.
12 Some of those devices also supports FM radio. 12 Some of those devices also supports FM radio.
13 13
14if VIDEO_CAPTURE_DRIVERS 14if VIDEO_CAPTURE_DRIVERS && VIDEO_DEV
15 15
16config VIDEO_ADV_DEBUG 16config VIDEO_ADV_DEBUG
17 bool "Enable advanced debug functionality" 17 bool "Enable advanced debug functionality"
@@ -347,7 +347,7 @@ endmenu # encoder / decoder chips
347 347
348config VIDEO_VIVI 348config VIDEO_VIVI
349 tristate "Virtual Video Driver" 349 tristate "Virtual Video Driver"
350 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI && VIDEO_DEV 350 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI
351 select VIDEO_BUF 351 select VIDEO_BUF
352 default n 352 default n
353 ---help--- 353 ---help---
@@ -691,7 +691,7 @@ menuconfig V4L_USB_DRIVERS
691 depends on USB 691 depends on USB
692 default y 692 default y
693 693
694if V4L_USB_DRIVERS 694if V4L_USB_DRIVERS && USB
695 695
696source "drivers/media/video/pvrusb2/Kconfig" 696source "drivers/media/video/pvrusb2/Kconfig"
697 697
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 1c38723d31..b1fedb0f64 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1331,7 +1331,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
1331 1331
1332/* Call with btv->lock down. */ 1332/* Call with btv->lock down. */
1333static void 1333static void
1334set_input(struct bttv *btv, unsigned int input) 1334set_input(struct bttv *btv, unsigned int input, unsigned int norm)
1335{ 1335{
1336 unsigned long flags; 1336 unsigned long flags;
1337 1337
@@ -1350,7 +1350,7 @@ set_input(struct bttv *btv, unsigned int input)
1350 } 1350 }
1351 audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? 1351 audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ?
1352 TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); 1352 TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN));
1353 set_tvnorm(btv,btv->tvnorm); 1353 set_tvnorm(btv, norm);
1354 i2c_vidiocschan(btv); 1354 i2c_vidiocschan(btv);
1355} 1355}
1356 1356
@@ -1441,7 +1441,7 @@ static void bttv_reinit_bt848(struct bttv *btv)
1441 1441
1442 init_bt848(btv); 1442 init_bt848(btv);
1443 btv->pll.pll_current = -1; 1443 btv->pll.pll_current = -1;
1444 set_input(btv,btv->input); 1444 set_input(btv, btv->input, btv->tvnorm);
1445} 1445}
1446 1446
1447static int get_control(struct bttv *btv, struct v4l2_control *c) 1447static int get_control(struct bttv *btv, struct v4l2_control *c)
@@ -2011,8 +2011,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
2011 return 0; 2011 return 0;
2012 } 2012 }
2013 2013
2014 btv->tvnorm = v->norm; 2014 set_input(btv, v->channel, v->norm);
2015 set_input(btv,v->channel);
2016 mutex_unlock(&btv->lock); 2015 mutex_unlock(&btv->lock);
2017 return 0; 2016 return 0;
2018 } 2017 }
@@ -2148,7 +2147,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
2148 if (*i > bttv_tvcards[btv->c.type].video_inputs) 2147 if (*i > bttv_tvcards[btv->c.type].video_inputs)
2149 return -EINVAL; 2148 return -EINVAL;
2150 mutex_lock(&btv->lock); 2149 mutex_lock(&btv->lock);
2151 set_input(btv,*i); 2150 set_input(btv, *i, btv->tvnorm);
2152 mutex_unlock(&btv->lock); 2151 mutex_unlock(&btv->lock);
2153 return 0; 2152 return 0;
2154 } 2153 }
@@ -4780,7 +4779,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
4780 bt848_hue(btv,32768); 4779 bt848_hue(btv,32768);
4781 bt848_sat(btv,32768); 4780 bt848_sat(btv,32768);
4782 audio_mute(btv, 1); 4781 audio_mute(btv, 1);
4783 set_input(btv,0); 4782 set_input(btv, 0, btv->tvnorm);
4784 bttv_crop_reset(&btv->crop[0], btv->tvnorm); 4783 bttv_crop_reset(&btv->crop[0], btv->tvnorm);
4785 btv->crop[1] = btv->crop[0]; /* current = default */ 4784 btv->crop[1] = btv->crop[0]; /* current = default */
4786 disclaim_vbi_lines(btv); 4785 disclaim_vbi_lines(btv);
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index b0466b88f5..a80b1cb1ab 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1034,6 +1034,8 @@ static int vidioc_g_tuner (struct file *file, void *priv,
1034 1034
1035 if (unlikely(UNSET == core->tuner_type)) 1035 if (unlikely(UNSET == core->tuner_type))
1036 return -EINVAL; 1036 return -EINVAL;
1037 if (0 != t->index)
1038 return -EINVAL;
1037 1039
1038 strcpy(t->name, "Television"); 1040 strcpy(t->name, "Television");
1039 t->type = V4L2_TUNER_ANALOG_TV; 1041 t->type = V4L2_TUNER_ANALOG_TV;
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 7b56041186..30395d6b5f 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -1005,7 +1005,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev)
1005int saa7134_tvaudio_fini(struct saa7134_dev *dev) 1005int saa7134_tvaudio_fini(struct saa7134_dev *dev)
1006{ 1006{
1007 /* shutdown tvaudio thread */ 1007 /* shutdown tvaudio thread */
1008 if (dev->thread.pid >= 0) { 1008 if (dev->thread.pid > 0) {
1009 dev->thread.shutdown = 1; 1009 dev->thread.shutdown = 1;
1010 wake_up_interruptible(&dev->thread.wq); 1010 wake_up_interruptible(&dev->thread.wq);
1011 wait_for_completion(&dev->thread.exit); 1011 wait_for_completion(&dev->thread.exit);
diff --git a/drivers/misc/blink.c b/drivers/misc/blink.c
index 634431ce11..97f7253ce2 100644
--- a/drivers/misc/blink.c
+++ b/drivers/misc/blink.c
@@ -16,12 +16,30 @@ static void do_blink(unsigned long data)
16 add_timer(&blink_timer); 16 add_timer(&blink_timer);
17} 17}
18 18
19static int blink_init(void) 19static int blink_panic_event(struct notifier_block *blk,
20 unsigned long event, void *arg)
20{ 21{
21 printk(KERN_INFO "Enabling keyboard blinking\n");
22 do_blink(0); 22 do_blink(0);
23 return 0; 23 return 0;
24} 24}
25 25
26static struct notifier_block blink_notify = {
27 .notifier_call = blink_panic_event,
28};
29
30static __init int blink_init(void)
31{
32 printk(KERN_INFO "Enabling keyboard blinking\n");
33 atomic_notifier_chain_register(&panic_notifier_list, &blink_notify);
34 return 0;
35}
36
37static __exit void blink_remove(void)
38{
39 del_timer_sync(&blink_timer);
40 atomic_notifier_chain_unregister(&panic_notifier_list, &blink_notify);
41}
42
26module_init(blink_init); 43module_init(blink_init);
44module_exit(blink_remove);
27 45
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6822bf1426..1b854bf07b 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -944,7 +944,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
944 flags |= TXFCB_UDP; 944 flags |= TXFCB_UDP;
945 fcb->phcs = udp_hdr(skb)->check; 945 fcb->phcs = udp_hdr(skb)->check;
946 } else 946 } else
947 fcb->phcs = udp_hdr(skb)->check; 947 fcb->phcs = tcp_hdr(skb)->check;
948 948
949 /* l3os is the distance between the start of the 949 /* l3os is the distance between the start of the
950 * frame (skb->data) and the start of the IP hdr. 950 * frame (skb->data) and the start of the IP hdr.
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c
index 3098960dc2..3078c419cb 100644
--- a/drivers/net/irda/irport.c
+++ b/drivers/net/irda/irport.c
@@ -509,7 +509,7 @@ static void irport_timeout(struct net_device *dev)
509 IRDA_DEBUG(0, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", 509 IRDA_DEBUG(0, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
510 __FUNCTION__, iir, lsr, iobase); 510 __FUNCTION__, iir, lsr, iobase);
511 511
512 IRDA_DEBUG(0, "%s(), transmitting=%d, remain=%d, done=%d\n", 512 IRDA_DEBUG(0, "%s(), transmitting=%d, remain=%d, done=%td\n",
513 __FUNCTION__, self->transmitting, self->tx_buff.len, 513 __FUNCTION__, self->transmitting, self->tx_buff.len,
514 self->tx_buff.data - self->tx_buff.head); 514 self->tx_buff.data - self->tx_buff.head);
515 515
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 9043bf4aa4..36ab98386b 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -79,7 +79,7 @@ MODULE_AUTHOR("Daniele Peri <peri@csai.unipa.it>");
79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver"); 79MODULE_DESCRIPTION("SMC IrCC SIR/FIR controller driver");
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
81 81
82static int smsc_nopnp; 82static int smsc_nopnp = 1;
83module_param_named(nopnp, smsc_nopnp, bool, 0); 83module_param_named(nopnp, smsc_nopnp, bool, 0);
84MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings"); 84MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings");
85 85
@@ -416,6 +416,13 @@ static int __init smsc_ircc_legacy_probe(void)
416{ 416{
417 int ret = 0; 417 int ret = 0;
418 418
419#ifdef CONFIG_PCI
420 if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) {
421 /* Ignore errors from preconfiguration */
422 IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
423 }
424#endif
425
419 if (ircc_fir > 0 && ircc_sir > 0) { 426 if (ircc_fir > 0 && ircc_sir > 0) {
420 IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir); 427 IRDA_MESSAGE(" Overriding FIR address 0x%04x\n", ircc_fir);
421 IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir); 428 IRDA_MESSAGE(" Overriding SIR address 0x%04x\n", ircc_sir);
@@ -459,13 +466,6 @@ static int __init smsc_ircc_init(void)
459 return ret; 466 return ret;
460 } 467 }
461 468
462#ifdef CONFIG_PCI
463 if (smsc_ircc_preconfigure_subsystems(ircc_cfg, ircc_fir, ircc_sir, ircc_dma, ircc_irq) < 0) {
464 /* Ignore errors from preconfiguration */
465 IRDA_ERROR("%s, Preconfiguration failed !\n", driver_name);
466 }
467#endif
468
469 dev_count = 0; 469 dev_count = 0;
470 470
471 if (smsc_nopnp || !pnp_platform_devices || 471 if (smsc_nopnp || !pnp_platform_devices ||
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 41eafebf58..c3da2a2f54 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -911,6 +911,8 @@ static struct pci_device_id mlx4_pci_table[] = {
911 { PCI_VDEVICE(MELLANOX, 0x6340) }, /* MT25408 "Hermon" SDR */ 911 { PCI_VDEVICE(MELLANOX, 0x6340) }, /* MT25408 "Hermon" SDR */
912 { PCI_VDEVICE(MELLANOX, 0x634a) }, /* MT25408 "Hermon" DDR */ 912 { PCI_VDEVICE(MELLANOX, 0x634a) }, /* MT25408 "Hermon" DDR */
913 { PCI_VDEVICE(MELLANOX, 0x6354) }, /* MT25408 "Hermon" QDR */ 913 { PCI_VDEVICE(MELLANOX, 0x6354) }, /* MT25408 "Hermon" QDR */
914 { PCI_VDEVICE(MELLANOX, 0x6732) }, /* MT25408 "Hermon" DDR PCIe gen2 */
915 { PCI_VDEVICE(MELLANOX, 0x673c) }, /* MT25408 "Hermon" QDR PCIe gen2 */
914 { 0, } 916 { 0, }
915}; 917};
916 918
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 0f9904fe3a..d0cc122fa3 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -2854,6 +2854,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2854 return -ENOMEM; 2854 return -ENOMEM;
2855 } 2855 }
2856 2856
2857 SET_NETDEV_DEV(netdev, &pdev->dev);
2858
2857 mgp = netdev_priv(netdev); 2859 mgp = netdev_priv(netdev);
2858 memset(mgp, 0, sizeof(*mgp)); 2860 memset(mgp, 0, sizeof(*mgp));
2859 mgp->dev = netdev; 2861 mgp->dev = netdev;
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 91f25e0a63..619503742b 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -937,6 +937,7 @@ struct netxen_adapter {
937 struct netxen_ring_ctx *ctx_desc; 937 struct netxen_ring_ctx *ctx_desc;
938 struct pci_dev *ctx_desc_pdev; 938 struct pci_dev *ctx_desc_pdev;
939 dma_addr_t ctx_desc_phys_addr; 939 dma_addr_t ctx_desc_phys_addr;
940 int intr_scheme;
940 int (*enable_phy_interrupts) (struct netxen_adapter *); 941 int (*enable_phy_interrupts) (struct netxen_adapter *);
941 int (*disable_phy_interrupts) (struct netxen_adapter *); 942 int (*disable_phy_interrupts) (struct netxen_adapter *);
942 void (*handle_phy_intr) (struct netxen_adapter *); 943 void (*handle_phy_intr) (struct netxen_adapter *);
@@ -951,6 +952,24 @@ struct netxen_adapter {
951 int (*stop_port) (struct netxen_adapter *); 952 int (*stop_port) (struct netxen_adapter *);
952}; /* netxen_adapter structure */ 953}; /* netxen_adapter structure */
953 954
955/*
956 * NetXen dma watchdog control structure
957 *
958 * Bit 0 : enabled => R/O: 1 watchdog active, 0 inactive
959 * Bit 1 : disable_request => 1 req disable dma watchdog
960 * Bit 2 : enable_request => 1 req enable dma watchdog
961 * Bit 3-31 : unused
962 */
963
964#define netxen_set_dma_watchdog_disable_req(config_word) \
965 _netxen_set_bits(config_word, 1, 1, 1)
966#define netxen_set_dma_watchdog_enable_req(config_word) \
967 _netxen_set_bits(config_word, 2, 1, 1)
968#define netxen_get_dma_watchdog_enabled(config_word) \
969 ((config_word) & 0x1)
970#define netxen_get_dma_watchdog_disabled(config_word) \
971 (((config_word) >> 1) & 0x1)
972
954/* Max number of xmit producer threads that can run simultaneously */ 973/* Max number of xmit producer threads that can run simultaneously */
955#define MAX_XMIT_PRODUCERS 16 974#define MAX_XMIT_PRODUCERS 16
956 975
@@ -1030,8 +1049,8 @@ int netxen_nic_erase_pxe(struct netxen_adapter *adapter);
1030/* Functions from netxen_nic_init.c */ 1049/* Functions from netxen_nic_init.c */
1031void netxen_free_adapter_offload(struct netxen_adapter *adapter); 1050void netxen_free_adapter_offload(struct netxen_adapter *adapter);
1032int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); 1051int netxen_initialize_adapter_offload(struct netxen_adapter *adapter);
1033void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); 1052int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val);
1034void netxen_load_firmware(struct netxen_adapter *adapter); 1053int netxen_load_firmware(struct netxen_adapter *adapter);
1035int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); 1054int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose);
1036int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp); 1055int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp);
1037int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr, 1056int netxen_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
@@ -1080,37 +1099,106 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
1080 1099
1081static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) 1100static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
1082{ 1101{
1083 /* 1102 uint32_t mask = 0x7ff;
1084 * ISR_INT_MASK: Can be read from window 0 or 1. 1103 int retries = 32;
1085 */ 1104
1086 writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); 1105 DPRINTK(1, INFO, "Entered ISR Disable \n");
1106
1107 switch (adapter->portnum) {
1108 case 0:
1109 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
1110 break;
1111 case 1:
1112 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
1113 break;
1114 case 2:
1115 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
1116 break;
1117 case 3:
1118 writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
1119 break;
1120 }
1087 1121
1122 if (adapter->intr_scheme != -1 &&
1123 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
1124 writel(mask,
1125 (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
1126 }
1127
1128 /* Window = 0 or 1 */
1129 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1130 do {
1131 writel(0xffffffff, (void *)
1132 (PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS)));
1133 mask = readl((void *)
1134 (pci_base_offset(adapter, ISR_INT_VECTOR)));
1135 if (!(mask & 0x80))
1136 break;
1137 udelay(10);
1138 } while (--retries);
1139
1140 if (!retries) {
1141 printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
1142 netxen_nic_driver_name);
1143 }
1144 }
1145
1146 DPRINTK(1, INFO, "Done with Disable Int\n");
1147
1148 return;
1088} 1149}
1089 1150
1090static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) 1151static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
1091{ 1152{
1092 u32 mask; 1153 u32 mask;
1093 1154
1094 switch (adapter->ahw.board_type) { 1155 DPRINTK(1, INFO, "Entered ISR Enable \n");
1095 case NETXEN_NIC_GBE: 1156
1096 mask = 0x77b; 1157 if (adapter->intr_scheme != -1 &&
1158 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
1159 switch (adapter->ahw.board_type) {
1160 case NETXEN_NIC_GBE:
1161 mask = 0x77b;
1162 break;
1163 case NETXEN_NIC_XGBE:
1164 mask = 0x77f;
1165 break;
1166 default:
1167 mask = 0x7ff;
1168 break;
1169 }
1170
1171 writel(mask,
1172 (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
1173 }
1174 switch (adapter->portnum) {
1175 case 0:
1176 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
1177 break;
1178 case 1:
1179 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
1097 break; 1180 break;
1098 case NETXEN_NIC_XGBE: 1181 case 2:
1099 mask = 0x77f; 1182 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
1100 break; 1183 break;
1101 default: 1184 case 3:
1102 mask = 0x7ff; 1185 writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
1103 break; 1186 break;
1104 } 1187 }
1105 1188
1106 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
1107
1108 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { 1189 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1109 mask = 0xbff; 1190 mask = 0xbff;
1110 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); 1191 if (adapter->intr_scheme != -1 &&
1111 writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, 1192 adapter->intr_scheme != INTR_SCHEME_PERPORT) {
1112 ISR_INT_TARGET_MASK)); 1193 writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1194 }
1195 writel(mask,
1196 (void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
1113 } 1197 }
1198
1199 DPRINTK(1, INFO, "Done with enable Int\n");
1200
1201 return;
1114} 1202}
1115 1203
1116/* 1204/*
@@ -1164,6 +1252,62 @@ static inline void get_brd_name_by_type(u32 type, char *name)
1164 name = "Unknown"; 1252 name = "Unknown";
1165} 1253}
1166 1254
1255static inline int
1256dma_watchdog_shutdown_request(struct netxen_adapter *adapter)
1257{
1258 u32 ctrl;
1259
1260 /* check if already inactive */
1261 if (netxen_nic_hw_read_wx(adapter,
1262 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
1263 printk(KERN_ERR "failed to read dma watchdog status\n");
1264
1265 if (netxen_get_dma_watchdog_enabled(ctrl) == 0)
1266 return 1;
1267
1268 /* Send the disable request */
1269 netxen_set_dma_watchdog_disable_req(ctrl);
1270 netxen_crb_writelit_adapter(adapter,
1271 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
1272
1273 return 0;
1274}
1275
1276static inline int
1277dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
1278{
1279 u32 ctrl;
1280
1281 if (netxen_nic_hw_read_wx(adapter,
1282 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
1283 printk(KERN_ERR "failed to read dma watchdog status\n");
1284
1285 return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) &&
1286 (netxen_get_dma_watchdog_disabled(ctrl) == 0));
1287}
1288
1289static inline int
1290dma_watchdog_wakeup(struct netxen_adapter *adapter)
1291{
1292 u32 ctrl;
1293
1294 if (netxen_nic_hw_read_wx(adapter,
1295 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
1296 printk(KERN_ERR "failed to read dma watchdog status\n");
1297
1298 if (netxen_get_dma_watchdog_enabled(ctrl))
1299 return 1;
1300
1301 /* send the wakeup request */
1302 netxen_set_dma_watchdog_enable_req(ctrl);
1303
1304 netxen_crb_writelit_adapter(adapter,
1305 NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), ctrl);
1306
1307 return 0;
1308}
1309
1310
1167int netxen_is_flash_supported(struct netxen_adapter *adapter); 1311int netxen_is_flash_supported(struct netxen_adapter *adapter);
1168int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]); 1312int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]);
1169extern void netxen_change_ringparam(struct netxen_adapter *adapter); 1313extern void netxen_change_ringparam(struct netxen_adapter *adapter);
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 608e37b349..3276866b17 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -687,4 +687,6 @@ enum {
687 687
688#define PCIE_MAX_MASTER_SPLIT (0x14048) 688#define PCIE_MAX_MASTER_SPLIT (0x14048)
689 689
690#define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14)
691
690#endif /* __NETXEN_NIC_HDR_H_ */ 692#endif /* __NETXEN_NIC_HDR_H_ */
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index c012764d11..aac15421bd 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -377,7 +377,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
377 recv_crb_registers[ctx]. 377 recv_crb_registers[ctx].
378 crb_rcvpeg_state)); 378 crb_rcvpeg_state));
379 while (state != PHAN_PEG_RCV_INITIALIZED && loops < 20) { 379 while (state != PHAN_PEG_RCV_INITIALIZED && loops < 20) {
380 udelay(100); 380 msleep(1);
381 /* Window 1 call */ 381 /* Window 1 call */
382 state = readl(NETXEN_CRB_NORMALIZE(adapter, 382 state = readl(NETXEN_CRB_NORMALIZE(adapter,
383 recv_crb_registers 383 recv_crb_registers
@@ -392,7 +392,11 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
392 return err; 392 return err;
393 } 393 }
394 } 394 }
395 DPRINTK(INFO, "Recieve Peg ready too. starting stuff\n"); 395 adapter->intr_scheme = readl(
396 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW));
397 printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name,
398 adapter->intr_scheme);
399 DPRINTK(INFO, "Receive Peg ready too. starting stuff\n");
396 400
397 addr = netxen_alloc(adapter->ahw.pdev, 401 addr = netxen_alloc(adapter->ahw.pdev,
398 sizeof(struct netxen_ring_ctx) + 402 sizeof(struct netxen_ring_ctx) +
@@ -697,7 +701,7 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw)
697 adapter->curr_window = 0; 701 adapter->curr_window = 0;
698} 702}
699 703
700void netxen_load_firmware(struct netxen_adapter *adapter) 704int netxen_load_firmware(struct netxen_adapter *adapter)
701{ 705{
702 int i; 706 int i;
703 u32 data, size = 0; 707 u32 data, size = 0;
@@ -709,15 +713,24 @@ void netxen_load_firmware(struct netxen_adapter *adapter)
709 writel(1, NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CAS_RST)); 713 writel(1, NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CAS_RST));
710 714
711 for (i = 0; i < size; i++) { 715 for (i = 0; i < size; i++) {
712 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) { 716 int retries = 10;
713 DPRINTK(ERR, 717 if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0)
714 "Error in netxen_rom_fast_read(). Will skip" 718 return -EIO;
715 "loading flash image\n"); 719
716 return;
717 }
718 off = netxen_nic_pci_set_window(adapter, memaddr); 720 off = netxen_nic_pci_set_window(adapter, memaddr);
719 addr = pci_base_offset(adapter, off); 721 addr = pci_base_offset(adapter, off);
720 writel(data, addr); 722 writel(data, addr);
723 do {
724 if (readl(addr) == data)
725 break;
726 msleep(100);
727 writel(data, addr);
728 } while (--retries);
729 if (!retries) {
730 printk(KERN_ERR "%s: firmware load aborted, write failed at 0x%x\n",
731 netxen_nic_driver_name, memaddr);
732 return -EIO;
733 }
721 flashaddr += 4; 734 flashaddr += 4;
722 memaddr += 4; 735 memaddr += 4;
723 } 736 }
@@ -727,7 +740,7 @@ void netxen_load_firmware(struct netxen_adapter *adapter)
727 NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL)); 740 NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CHIP_CLK_CTRL));
728 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CAS_RST)); 741 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_ROMUSB_GLB_CAS_RST));
729 742
730 udelay(100); 743 return 0;
731} 744}
732 745
733int 746int
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index bb23f4c360..1811bcb8c3 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -139,6 +139,8 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
139 return err; 139 return err;
140 } 140 }
141 /* Window 1 call */ 141 /* Window 1 call */
142 writel(INTR_SCHEME_PERPORT,
143 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST));
142 writel(MPORT_MULTI_FUNCTION_MODE, 144 writel(MPORT_MULTI_FUNCTION_MODE,
143 NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); 145 NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE));
144 writel(PHAN_INITIALIZE_ACK, 146 writel(PHAN_INITIALIZE_ACK,
@@ -405,10 +407,7 @@ static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
405static inline int 407static inline int
406do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) 408do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp)
407{ 409{
408 if (jiffies > (last_schedule_time + (8 * HZ))) { 410 cond_resched();
409 last_schedule_time = jiffies;
410 schedule();
411 }
412 411
413 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); 412 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr);
414 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); 413 netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3);
@@ -854,10 +853,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
854 netxen_nic_pci_change_crbwindow(adapter, 1); 853 netxen_nic_pci_change_crbwindow(adapter, 1);
855 } 854 }
856 if (init_delay == 1) { 855 if (init_delay == 1) {
857 ssleep(1); 856 msleep(2000);
858 init_delay = 0; 857 init_delay = 0;
859 } 858 }
860 msleep(1); 859 msleep(20);
861 } 860 }
862 kfree(buf); 861 kfree(buf);
863 862
@@ -933,10 +932,6 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
933void netxen_free_adapter_offload(struct netxen_adapter *adapter) 932void netxen_free_adapter_offload(struct netxen_adapter *adapter)
934{ 933{
935 if (adapter->dummy_dma.addr) { 934 if (adapter->dummy_dma.addr) {
936 writel(0, NETXEN_CRB_NORMALIZE(adapter,
937 CRB_HOST_DUMMY_BUF_ADDR_HI));
938 writel(0, NETXEN_CRB_NORMALIZE(adapter,
939 CRB_HOST_DUMMY_BUF_ADDR_LO));
940 pci_free_consistent(adapter->ahw.pdev, 935 pci_free_consistent(adapter->ahw.pdev,
941 NETXEN_HOST_DUMMY_DMA_SIZE, 936 NETXEN_HOST_DUMMY_DMA_SIZE,
942 adapter->dummy_dma.addr, 937 adapter->dummy_dma.addr,
@@ -945,25 +940,32 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter)
945 } 940 }
946} 941}
947 942
948void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val) 943int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)
949{ 944{
950 u32 val = 0; 945 u32 val = 0;
951 int loops = 0; 946 int retries = 30;
952 947
953 if (!pegtune_val) { 948 if (!pegtune_val) {
954 val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); 949 do {
955 while (val != PHAN_INITIALIZE_COMPLETE && 950 val = readl(NETXEN_CRB_NORMALIZE
956 val != PHAN_INITIALIZE_ACK && loops < 200000) {
957 udelay(100);
958 schedule();
959 val =
960 readl(NETXEN_CRB_NORMALIZE
961 (adapter, CRB_CMDPEG_STATE)); 951 (adapter, CRB_CMDPEG_STATE));
962 loops++; 952 pegtune_val = readl(NETXEN_CRB_NORMALIZE
953 (adapter, NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
954
955 if (val == PHAN_INITIALIZE_COMPLETE ||
956 val == PHAN_INITIALIZE_ACK)
957 return 0;
958
959 msleep(1000);
960 } while (--retries);
961 if (!retries) {
962 printk(KERN_WARNING "netxen_phantom_init: init failed, "
963 "pegtune_val=%x\n", pegtune_val);
964 return -1;
963 } 965 }
964 if (val != PHAN_INITIALIZE_COMPLETE)
965 printk("WARNING: Initial boot wait loop failed...\n");
966 } 966 }
967
968 return 0;
967} 969}
968 970
969int netxen_nic_rx_has_work(struct netxen_adapter *adapter) 971int netxen_nic_rx_has_work(struct netxen_adapter *adapter)
@@ -1120,6 +1122,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1120 adapter->stats.csummed++; 1122 adapter->stats.csummed++;
1121 skb->ip_summed = CHECKSUM_UNNECESSARY; 1123 skb->ip_summed = CHECKSUM_UNNECESSARY;
1122 } 1124 }
1125 skb->dev = netdev;
1123 if (desc_ctx == RCV_DESC_LRO_CTXID) { 1126 if (desc_ctx == RCV_DESC_LRO_CTXID) {
1124 /* True length was only available on the last pkt */ 1127 /* True length was only available on the last pkt */
1125 skb_put(skb, buffer->lro_length); 1128 skb_put(skb, buffer->lro_length);
@@ -1224,6 +1227,7 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
1224 NETXEN_CRB_NORMALIZE(adapter, 1227 NETXEN_CRB_NORMALIZE(adapter,
1225 recv_crb_registers[adapter->portnum]. 1228 recv_crb_registers[adapter->portnum].
1226 crb_rcv_status_consumer)); 1229 crb_rcv_status_consumer));
1230 wmb();
1227 } 1231 }
1228 1232
1229 return count; 1233 return count;
@@ -1276,11 +1280,13 @@ int netxen_process_cmd_ring(unsigned long data)
1276 if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) { 1280 if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
1277 pci_unmap_single(pdev, frag->dma, frag->length, 1281 pci_unmap_single(pdev, frag->dma, frag->length,
1278 PCI_DMA_TODEVICE); 1282 PCI_DMA_TODEVICE);
1283 frag->dma = 0ULL;
1279 for (i = 1; i < buffer->frag_count; i++) { 1284 for (i = 1; i < buffer->frag_count; i++) {
1280 DPRINTK(INFO, "getting fragment no %d\n", i); 1285 DPRINTK(INFO, "getting fragment no %d\n", i);
1281 frag++; /* Get the next frag */ 1286 frag++; /* Get the next frag */
1282 pci_unmap_page(pdev, frag->dma, frag->length, 1287 pci_unmap_page(pdev, frag->dma, frag->length,
1283 PCI_DMA_TODEVICE); 1288 PCI_DMA_TODEVICE);
1289 frag->dma = 0ULL;
1284 } 1290 }
1285 1291
1286 adapter->stats.skbfreed++; 1292 adapter->stats.skbfreed++;
@@ -1446,6 +1452,7 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1446 writel(msg, 1452 writel(msg,
1447 DB_NORMALIZE(adapter, 1453 DB_NORMALIZE(adapter,
1448 NETXEN_RCV_PRODUCER_OFFSET)); 1454 NETXEN_RCV_PRODUCER_OFFSET));
1455 wmb();
1449 } 1456 }
1450 } 1457 }
1451} 1458}
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 6167b58d27..a66ff58366 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -308,7 +308,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
308 308
309 adapter->netdev = netdev; 309 adapter->netdev = netdev;
310 adapter->pdev = pdev; 310 adapter->pdev = pdev;
311
312 /* this will be read from FW later */
313 adapter->intr_scheme = -1;
314
315 /* This will be reset for mezz cards */
311 adapter->portnum = pci_func_id; 316 adapter->portnum = pci_func_id;
317 adapter->status &= ~NETXEN_NETDEV_STATUS;
312 318
313 netdev->open = netxen_nic_open; 319 netdev->open = netxen_nic_open;
314 netdev->stop = netxen_nic_close; 320 netdev->stop = netxen_nic_close;
@@ -336,11 +342,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
336 if (pci_using_dac) 342 if (pci_using_dac)
337 netdev->features |= NETIF_F_HIGHDMA; 343 netdev->features |= NETIF_F_HIGHDMA;
338 344
339 if (pci_enable_msi(pdev)) { 345 if (pci_enable_msi(pdev))
340 adapter->flags &= ~NETXEN_NIC_MSI_ENABLED; 346 adapter->flags &= ~NETXEN_NIC_MSI_ENABLED;
341 printk(KERN_WARNING "%s: unable to allocate MSI interrupt" 347 else
342 " error\n", netxen_nic_driver_name);
343 } else
344 adapter->flags |= NETXEN_NIC_MSI_ENABLED; 348 adapter->flags |= NETXEN_NIC_MSI_ENABLED;
345 349
346 netdev->irq = pdev->irq; 350 netdev->irq = pdev->irq;
@@ -355,13 +359,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
355 /* initialize the adapter */ 359 /* initialize the adapter */
356 netxen_initialize_adapter_hw(adapter); 360 netxen_initialize_adapter_hw(adapter);
357 361
358#ifdef CONFIG_PPC
359 if ((adapter->ahw.boardcfg.board_type ==
360 NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) &&
361 (pci_func_id == 2))
362 goto err_out_free_adapter;
363#endif /* CONFIG_PPC */
364
365 /* 362 /*
366 * Adapter in our case is quad port so initialize it before 363 * Adapter in our case is quad port so initialize it before
367 * initializing the ports 364 * initializing the ports
@@ -509,22 +506,30 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
509 NETXEN_CAM_RAM(0x1fc))); 506 NETXEN_CAM_RAM(0x1fc)));
510 if (val == 0x55555555) { 507 if (val == 0x55555555) {
511 /* This is the first boot after power up */ 508 /* This is the first boot after power up */
509 netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(0x4), &val);
510 if (!(val & 0x4)) {
511 val |= 0x4;
512 netxen_nic_write_w0(adapter, NETXEN_PCIE_REG(0x4), val);
513 netxen_nic_read_w0(adapter, NETXEN_PCIE_REG(0x4), &val);
514 if (!(val & 0x4))
515 printk(KERN_ERR "%s: failed to set MSI bit in PCI-e reg\n",
516 netxen_nic_driver_name);
517 }
512 val = readl(NETXEN_CRB_NORMALIZE(adapter, 518 val = readl(NETXEN_CRB_NORMALIZE(adapter,
513 NETXEN_ROMUSB_GLB_SW_RESET)); 519 NETXEN_ROMUSB_GLB_SW_RESET));
514 printk(KERN_INFO"NetXen: read 0x%08x for reset reg.\n",val); 520 printk(KERN_INFO"NetXen: read 0x%08x for reset reg.\n",val);
515 if (val != 0x80000f) { 521 if (val != 0x80000f) {
516 /* clear the register for future unloads/loads */ 522 /* clear the register for future unloads/loads */
517 writel(0, NETXEN_CRB_NORMALIZE(adapter, 523 writel(0, NETXEN_CRB_NORMALIZE(adapter,
518 NETXEN_CAM_RAM(0x1fc))); 524 NETXEN_CAM_RAM(0x1fc)));
519 printk(KERN_ERR "ERROR in NetXen HW init sequence.\n"); 525 printk(KERN_ERR "ERROR in NetXen HW init sequence.\n");
520 err = -ENODEV; 526 err = -ENODEV;
521 goto err_out_free_dev; 527 goto err_out_free_dev;
522 } 528 }
523
524 /* clear the register for future unloads/loads */
525 writel(0, NETXEN_CRB_NORMALIZE(adapter,
526 NETXEN_CAM_RAM(0x1fc)));
527 } 529 }
530
531 /* clear the register for future unloads/loads */
532 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
528 printk(KERN_INFO "State: 0x%0x\n", 533 printk(KERN_INFO "State: 0x%0x\n",
529 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); 534 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
530 535
@@ -542,13 +547,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
542 NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); 547 NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
543 /* Handshake with the card before we register the devices. */ 548 /* Handshake with the card before we register the devices. */
544 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 549 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
545
546 /* leave the hw in the same state as reboot */
547 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
548 netxen_pinit_from_rom(adapter, 0);
549 udelay(500);
550 netxen_load_firmware(adapter);
551 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
552 } 550 }
553 551
554 /* 552 /*
@@ -639,8 +637,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
639 struct netxen_rx_buffer *buffer; 637 struct netxen_rx_buffer *buffer;
640 struct netxen_recv_context *recv_ctx; 638 struct netxen_recv_context *recv_ctx;
641 struct netxen_rcv_desc_ctx *rcv_desc; 639 struct netxen_rcv_desc_ctx *rcv_desc;
642 int i; 640 int i, ctxid, ring;
643 int ctxid, ring; 641 static int init_firmware_done = 0;
644 642
645 adapter = pci_get_drvdata(pdev); 643 adapter = pci_get_drvdata(pdev);
646 if (adapter == NULL) 644 if (adapter == NULL)
@@ -648,30 +646,20 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
648 646
649 netdev = adapter->netdev; 647 netdev = adapter->netdev;
650 648
651 netxen_nic_disable_int(adapter); 649 unregister_netdev(netdev);
652 if (adapter->irq) 650
653 free_irq(adapter->irq, adapter);
654
655 if (adapter->stop_port) 651 if (adapter->stop_port)
656 adapter->stop_port(adapter); 652 adapter->stop_port(adapter);
657 653
658 if ((adapter->flags & NETXEN_NIC_MSI_ENABLED)) 654 netxen_nic_disable_int(adapter);
659 pci_disable_msi(pdev);
660
661 if (adapter->portnum == 0)
662 netxen_free_adapter_offload(adapter);
663 655
664 if(adapter->portnum == 0) { 656 if (adapter->irq)
665 /* leave the hw in the same state as reboot */ 657 free_irq(adapter->irq, adapter);
666 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
667 netxen_pinit_from_rom(adapter, 0);
668 udelay(500);
669 netxen_load_firmware(adapter);
670 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
671 }
672 658
673 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) 659 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
660 init_firmware_done++;
674 netxen_free_hw_resources(adapter); 661 netxen_free_hw_resources(adapter);
662 }
675 663
676 for (ctxid = 0; ctxid < MAX_RCV_CTX; ++ctxid) { 664 for (ctxid = 0; ctxid < MAX_RCV_CTX; ++ctxid) {
677 recv_ctx = &adapter->recv_ctx[ctxid]; 665 recv_ctx = &adapter->recv_ctx[ctxid];
@@ -691,17 +679,73 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
691 } 679 }
692 } 680 }
693 681
694 unregister_netdev(netdev); 682 if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
683 pci_disable_msi(pdev);
695 684
696 vfree(adapter->cmd_buf_arr); 685 vfree(adapter->cmd_buf_arr);
697 686
687 pci_disable_device(pdev);
688
689 if (adapter->portnum == 0) {
690 if (init_firmware_done) {
691 dma_watchdog_shutdown_request(adapter);
692 msleep(100);
693 i = 100;
694 while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) {
695 printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n");
696 msleep(100);
697 i--;
698 }
699
700 if (i == 0) {
701 printk(KERN_ERR "dma_watchdog_shutdown_request failed\n");
702 return;
703 }
704
705 /* clear the register for future unloads/loads */
706 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
707 printk(KERN_INFO "State: 0x%0x\n",
708 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
709
710 /* leave the hw in the same state as reboot */
711 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
712 if (netxen_pinit_from_rom(adapter, 0))
713 return;
714 msleep(1);
715 if (netxen_load_firmware(adapter))
716 return;
717 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
718 }
719
720 /* clear the register for future unloads/loads */
721 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
722 printk(KERN_INFO "State: 0x%0x\n",
723 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
724
725 dma_watchdog_shutdown_request(adapter);
726 msleep(100);
727 i = 100;
728 while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) {
729 printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n");
730 msleep(100);
731 i--;
732 }
733
734 if (i) {
735 netxen_free_adapter_offload(adapter);
736 } else {
737 printk(KERN_ERR "failed to dma shutdown\n");
738 return;
739 }
740
741 }
742
698 iounmap(adapter->ahw.db_base); 743 iounmap(adapter->ahw.db_base);
699 iounmap(adapter->ahw.pci_base0); 744 iounmap(adapter->ahw.pci_base0);
700 iounmap(adapter->ahw.pci_base1); 745 iounmap(adapter->ahw.pci_base1);
701 iounmap(adapter->ahw.pci_base2); 746 iounmap(adapter->ahw.pci_base2);
702 747
703 pci_release_regions(pdev); 748 pci_release_regions(pdev);
704 pci_disable_device(pdev);
705 pci_set_drvdata(pdev, NULL); 749 pci_set_drvdata(pdev, NULL);
706 750
707 free_netdev(netdev); 751 free_netdev(netdev);
@@ -798,7 +842,7 @@ static int netxen_nic_close(struct net_device *netdev)
798 if (buffrag->dma) { 842 if (buffrag->dma) {
799 pci_unmap_single(adapter->pdev, buffrag->dma, 843 pci_unmap_single(adapter->pdev, buffrag->dma,
800 buffrag->length, PCI_DMA_TODEVICE); 844 buffrag->length, PCI_DMA_TODEVICE);
801 buffrag->dma = (u64) NULL; 845 buffrag->dma = 0ULL;
802 } 846 }
803 for (j = 0; j < cmd_buff->frag_count; j++) { 847 for (j = 0; j < cmd_buff->frag_count; j++) {
804 buffrag++; 848 buffrag++;
@@ -806,7 +850,7 @@ static int netxen_nic_close(struct net_device *netdev)
806 pci_unmap_page(adapter->pdev, buffrag->dma, 850 pci_unmap_page(adapter->pdev, buffrag->dma,
807 buffrag->length, 851 buffrag->length,
808 PCI_DMA_TODEVICE); 852 PCI_DMA_TODEVICE);
809 buffrag->dma = (u64) NULL; 853 buffrag->dma = 0ULL;
810 } 854 }
811 } 855 }
812 /* Free the skb we received in netxen_nic_xmit_frame */ 856 /* Free the skb we received in netxen_nic_xmit_frame */
@@ -816,8 +860,10 @@ static int netxen_nic_close(struct net_device *netdev)
816 } 860 }
817 cmd_buff++; 861 cmd_buff++;
818 } 862 }
819 FLUSH_SCHEDULED_WORK(); 863 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
820 del_timer_sync(&adapter->watchdog_timer); 864 FLUSH_SCHEDULED_WORK();
865 del_timer_sync(&adapter->watchdog_timer);
866 }
821 867
822 return 0; 868 return 0;
823} 869}
@@ -1103,28 +1149,26 @@ static int
1103netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev) 1149netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev)
1104{ 1150{
1105 u32 ret = 0; 1151 u32 ret = 0;
1152 u32 our_int = 0;
1106 1153
1107 DPRINTK(INFO, "Entered handle ISR\n"); 1154 DPRINTK(INFO, "Entered handle ISR\n");
1108 adapter->stats.ints++; 1155 adapter->stats.ints++;
1109 1156
1110 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { 1157 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1111 int count = 0;
1112 u32 mask;
1113 u32 our_int = 0;
1114 our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR)); 1158 our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1115 /* not our interrupt */ 1159 /* not our interrupt */
1116 if ((our_int & (0x80 << adapter->portnum)) == 0) 1160 if ((our_int & (0x80 << adapter->portnum)) == 0)
1117 return ret; 1161 return ret;
1118 netxen_nic_disable_int(adapter); 1162 }
1119 /* Window = 0 or 1 */
1120 do {
1121 writel(0xffffffff, PCI_OFFSET_SECOND_RANGE(adapter,
1122 ISR_INT_TARGET_STATUS));
1123 mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
1124 } while (((mask & 0x80) != 0) && (++count < 32));
1125 if ((mask & 0x80) != 0)
1126 printk("Could not disable interrupt completely\n");
1127 1163
1164 netxen_nic_disable_int(adapter);
1165
1166 if (adapter->intr_scheme == INTR_SCHEME_PERPORT) {
1167 /* claim interrupt */
1168 if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
1169 writel(our_int & ~((u32)(0x80 << adapter->portnum)),
1170 NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
1171 }
1128 } 1172 }
1129 1173
1130 if (netxen_nic_rx_has_work(adapter) || netxen_nic_tx_has_work(adapter)) { 1174 if (netxen_nic_rx_has_work(adapter) || netxen_nic_tx_has_work(adapter)) {
@@ -1136,7 +1180,7 @@ netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev)
1136 } else { 1180 } else {
1137 static unsigned int intcount = 0; 1181 static unsigned int intcount = 0;
1138 if ((++intcount & 0xfff) == 0xfff) 1182 if ((++intcount & 0xfff) == 0xfff)
1139 printk(KERN_ERR 1183 DPRINTK(KERN_ERR
1140 "%s: %s interrupt %d while in poll\n", 1184 "%s: %s interrupt %d while in poll\n",
1141 netxen_nic_driver_name, netdev->name, 1185 netxen_nic_driver_name, netdev->name,
1142 intcount); 1186 intcount);
@@ -1258,6 +1302,7 @@ static void __exit netxen_exit_module(void)
1258 /* 1302 /*
1259 * Wait for some time to allow the dma to drain, if any. 1303 * Wait for some time to allow the dma to drain, if any.
1260 */ 1304 */
1305 msleep(100);
1261 pci_unregister_driver(&netxen_driver); 1306 pci_unregister_driver(&netxen_driver);
1262 destroy_workqueue(netxen_workq); 1307 destroy_workqueue(netxen_workq);
1263} 1308}
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
index 9457fc7249..10fe6fafa6 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -114,6 +114,20 @@
114#define CRB_V2P_3 NETXEN_NIC_REG(0x29c) 114#define CRB_V2P_3 NETXEN_NIC_REG(0x29c)
115#define CRB_V2P(port) (CRB_V2P_0+((port)*4)) 115#define CRB_V2P(port) (CRB_V2P_0+((port)*4))
116#define CRB_DRIVER_VERSION NETXEN_NIC_REG(0x2a0) 116#define CRB_DRIVER_VERSION NETXEN_NIC_REG(0x2a0)
117/* sw int status/mask registers */
118#define CRB_SW_INT_MASK_0 NETXEN_NIC_REG(0x1d8)
119#define CRB_SW_INT_MASK_1 NETXEN_NIC_REG(0x1e0)
120#define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4)
121#define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8)
122
123/*
124 * capabilities register, can be used to selectively enable/disable features
125 * for backward compability
126 */
127#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8)
128#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc)
129
130#define INTR_SCHEME_PERPORT 0x1
117 131
118/* used for ethtool tests */ 132/* used for ethtool tests */
119#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) 133#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 717d8e9b98..104aab3c95 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1831,11 +1831,13 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
1831 1831
1832 ndev = alloc_etherdev(sizeof(struct ns83820)); 1832 ndev = alloc_etherdev(sizeof(struct ns83820));
1833 dev = PRIV(ndev); 1833 dev = PRIV(ndev);
1834 dev->ndev = ndev; 1834
1835 err = -ENOMEM; 1835 err = -ENOMEM;
1836 if (!dev) 1836 if (!dev)
1837 goto out; 1837 goto out;
1838 1838
1839 dev->ndev = ndev;
1840
1839 spin_lock_init(&dev->rx_info.lock); 1841 spin_lock_init(&dev->rx_info.lock);
1840 spin_lock_init(&dev->tx_lock); 1842 spin_lock_init(&dev->tx_lock);
1841 spin_lock_init(&dev->misc_lock); 1843 spin_lock_init(&dev->misc_lock);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 143ae2ff30..503f2685fb 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -629,9 +629,9 @@ static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
629 outw(SetTxThreshold + 1536, ioaddr + EL3_CMD); 629 outw(SetTxThreshold + 1536, ioaddr + EL3_CMD);
630 } 630 }
631 631
632 dev_kfree_skb(skb);
633 pop_tx_status(dev); 632 pop_tx_status(dev);
634 spin_unlock_irqrestore(&priv->lock, flags); 633 spin_unlock_irqrestore(&priv->lock, flags);
634 dev_kfree_skb(skb);
635 635
636 return 0; 636 return 0;
637} 637}
diff --git a/drivers/net/pcmcia/Kconfig b/drivers/net/pcmcia/Kconfig
index 5d658bc979..e8f55d8ed7 100644
--- a/drivers/net/pcmcia/Kconfig
+++ b/drivers/net/pcmcia/Kconfig
@@ -19,7 +19,7 @@ menuconfig NET_PCMCIA
19 19
20 If unsure, say N. 20 If unsure, say N.
21 21
22if NET_PCMCIA 22if NET_PCMCIA && PCMCIA
23 23
24config PCMCIA_3C589 24config PCMCIA_3C589
25 tristate "3Com 3c589 PCMCIA support" 25 tristate "3Com 3c589 PCMCIA support"
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index fc4aee96cd..fc2f0e695a 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -131,7 +131,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
131 struct phy_device *phydev = to_phy_device(dev); 131 struct phy_device *phydev = to_phy_device(dev);
132 struct phy_driver *phydrv = to_phy_driver(drv); 132 struct phy_driver *phydrv = to_phy_driver(drv);
133 133
134 return (phydrv->phy_id == (phydev->phy_id & phydrv->phy_id_mask)); 134 return ((phydrv->phy_id & phydrv->phy_id_mask) ==
135 (phydev->phy_id & phydrv->phy_id_mask));
135} 136}
136 137
137/* Suspend and resume. Copied from platform_suspend and 138/* Suspend and resume. Copied from platform_suspend and
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
index 792716beb0..596222b260 100644
--- a/drivers/net/phy/vitesse.c
+++ b/drivers/net/phy/vitesse.c
@@ -84,7 +84,7 @@ static int vsc824x_config_intr(struct phy_device *phydev)
84 84
85/* Vitesse 824x */ 85/* Vitesse 824x */
86static struct phy_driver vsc8244_driver = { 86static struct phy_driver vsc8244_driver = {
87 .phy_id = 0x000fc6c2, 87 .phy_id = 0x000fc6c0,
88 .name = "Vitesse VSC8244", 88 .name = "Vitesse VSC8244",
89 .phy_id_mask = 0x000fffc0, 89 .phy_id_mask = 0x000fffc0,
90 .features = PHY_GBIT_FEATURES, 90 .features = PHY_GBIT_FEATURES,
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 9d6e454a8f..786d4b9c07 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -152,7 +152,7 @@ static int full_duplex[MAX_UNITS] = {0, };
152 * This SUCKS. 152 * This SUCKS.
153 * We need a much better method to determine if dma_addr_t is 64-bit. 153 * We need a much better method to determine if dma_addr_t is 64-bit.
154 */ 154 */
155#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) 155#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR))
156/* 64-bit dma_addr_t */ 156/* 64-bit dma_addr_t */
157#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 157#define ADDR_64BITS /* This chip uses 64 bit addresses. */
158#define netdrv_addr_t u64 158#define netdrv_addr_t u64
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 675ac99a79..a42acc3cc6 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -144,14 +144,14 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
144 * modem interface from an RNDIS non-modem. 144 * modem interface from an RNDIS non-modem.
145 */ 145 */
146 if (rndis) { 146 if (rndis) {
147 struct usb_cdc_acm_descriptor *d; 147 struct usb_cdc_acm_descriptor *acm;
148 148
149 d = (void *) buf; 149 acm = (void *) buf;
150 if (d->bmCapabilities) { 150 if (acm->bmCapabilities) {
151 dev_dbg(&intf->dev, 151 dev_dbg(&intf->dev,
152 "ACM capabilities %02x, " 152 "ACM capabilities %02x, "
153 "not really RNDIS?\n", 153 "not really RNDIS?\n",
154 d->bmCapabilities); 154 acm->bmCapabilities);
155 goto bad_desc; 155 goto bad_desc;
156 } 156 }
157 } 157 }
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index a676386014..16c7a0e878 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -414,18 +414,16 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
414 dev->mii.reg_num_mask = 0x1f; 414 dev->mii.reg_num_mask = 0x1f;
415 415
416 /* reset */ 416 /* reset */
417 ret = dm_write_reg(dev, DM_NET_CTRL, 1); 417 dm_write_reg(dev, DM_NET_CTRL, 1);
418 udelay(20); 418 udelay(20);
419 419
420 /* read MAC */ 420 /* read MAC */
421 ret = dm_read(dev, DM_PHY_ADDR, ETH_ALEN, dev->net->dev_addr); 421 if (dm_read(dev, DM_PHY_ADDR, ETH_ALEN, dev->net->dev_addr) < 0) {
422 if (ret < 0) {
423 printk(KERN_ERR "Error reading MAC address\n"); 422 printk(KERN_ERR "Error reading MAC address\n");
424 ret = -ENODEV; 423 ret = -ENODEV;
425 goto out; 424 goto out;
426 } 425 }
427 426
428
429 /* power up phy */ 427 /* power up phy */
430 dm_write_reg(dev, DM_GPR_CTRL, 1); 428 dm_write_reg(dev, DM_GPR_CTRL, 1);
431 dm_write_reg(dev, DM_GPR_DATA, 0); 429 dm_write_reg(dev, DM_GPR_DATA, 0);
@@ -489,6 +487,8 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
489 b3..n: packet data 487 b3..n: packet data
490 */ 488 */
491 489
490 len = skb->len;
491
492 if (skb_headroom(skb) < DM_TX_OVERHEAD) { 492 if (skb_headroom(skb) < DM_TX_OVERHEAD) {
493 struct sk_buff *skb2; 493 struct sk_buff *skb2;
494 494
@@ -501,10 +501,9 @@ static struct sk_buff *dm9601_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
501 501
502 __skb_push(skb, DM_TX_OVERHEAD); 502 __skb_push(skb, DM_TX_OVERHEAD);
503 503
504 len = skb->len;
505 /* usbnet adds padding if length is a multiple of packet size 504 /* usbnet adds padding if length is a multiple of packet size
506 if so, adjust length value in header */ 505 if so, adjust length value in header */
507 if ((len % dev->maxpacket) == 0) 506 if ((skb->len % dev->maxpacket) == 0)
508 len++; 507 len++;
509 508
510 skb->data[0] = len; 509 skb->data[0] = len;
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 5b16d9a126..a12f576391 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -953,11 +953,14 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
953 /* don't assume the hardware handles USB_ZERO_PACKET 953 /* don't assume the hardware handles USB_ZERO_PACKET
954 * NOTE: strictly conforming cdc-ether devices should expect 954 * NOTE: strictly conforming cdc-ether devices should expect
955 * the ZLP here, but ignore the one-byte packet. 955 * the ZLP here, but ignore the one-byte packet.
956 *
957 * FIXME zero that byte, if it doesn't require a new skb.
958 */ 956 */
959 if ((length % dev->maxpacket) == 0) 957 if ((length % dev->maxpacket) == 0) {
960 urb->transfer_buffer_length++; 958 urb->transfer_buffer_length++;
959 if (skb_tailroom(skb)) {
960 skb->data[skb->len] = 0;
961 __skb_put(skb, 1);
962 }
963 }
961 964
962 spin_lock_irqsave (&dev->txq.lock, flags); 965 spin_lock_irqsave (&dev->txq.lock, flags);
963 966
diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
index a1097f59fd..32ed4136b0 100644
--- a/drivers/net/wireless/libertas/Makefile
+++ b/drivers/net/wireless/libertas/Makefile
@@ -2,7 +2,7 @@ libertas-objs := main.o fw.o wext.o \
2 rx.o tx.o cmd.o \ 2 rx.o tx.o cmd.o \
3 cmdresp.o scan.o \ 3 cmdresp.o scan.o \
4 join.o 11d.o \ 4 join.o 11d.o \
5 ioctl.o debugfs.o \ 5 debugfs.o \
6 ethtool.o assoc.o 6 ethtool.o assoc.o
7 7
8usb8xxx-objs += if_bootcmd.o 8usb8xxx-objs += if_bootcmd.o
diff --git a/drivers/net/wireless/libertas/README b/drivers/net/wireless/libertas/README
index 1f92f50b64..0b133ce638 100644
--- a/drivers/net/wireless/libertas/README
+++ b/drivers/net/wireless/libertas/README
@@ -28,281 +28,6 @@ DRIVER LOADING
28 28
29 insmod usb8388.ko [fw_name=usb8388.bin] 29 insmod usb8388.ko [fw_name=usb8388.bin]
30 30
31=====================
32IWPRIV COMMAND
33=====================
34
35NAME
36 This manual describes the usage of private commands used in Marvell WLAN
37 Linux Driver. All the commands available in Wlanconfig will not be available
38 in the iwpriv.
39
40SYNOPSIS
41 iwpriv <ethX> <command> [sub-command] ...
42
43 iwpriv ethX setregioncode <n>
44 iwpriv ethX getregioncode
45
46Version 5 Command:
47 iwpriv ethX ledgpio <n>
48
49BT Commands:
50 The blinding table (BT) contains a list of mac addresses that will be,
51 by default, ignored by the firmware. It is also possible to invert this
52 behavior so that we will ignore all traffic except for the portion
53 coming from mac addresess in the list. It is primarily used for
54 debugging and testing networks. It can be edited and inspected with
55 the following commands:
56
57 iwpriv ethX bt_reset
58 iwpriv ethX bt_add <mac_address>
59 iwpriv ethX bt_del <mac_address>
60 iwpriv ethX bt_list <id>
61 iwpriv ethX bt_get_invert <n>
62 iwpriv ethX bt_set_invert <n>
63
64FWT Commands:
65 The forwarding table (FWT) is a feature used to manage mesh network
66 routing in the firmware. The FWT is essentially a routing table that
67 associates a destination mac address (da) with a next hop receiver
68 address (ra). The FWT can be inspected and edited with the following
69 iwpriv commands, which are described in greater detail below.
70 Eventually, the table will be automatically maintained by a custom
71 routing protocol.
72
73 NOTE: FWT commands replace the previous DFT commands. What were the DFT
74 commands?, you might ask. They were an earlier API to the firmware that
75 implemented a simple MAC-layer forwarding mechanism. In the unlikely
76 event that you were using these commands, you must migrate to the new
77 FWT commands which can be used to achieve the same functionality.
78
79 iwpriv ethX fwt_add [parameters]
80 iwpriv ethX fwt_del [parameters]
81 iwpriv ethX fwt_lookup [parameters]
82 iwpriv ethX fwt_list [parameters]
83 iwpriv ethX fwt_list_route [parameters]
84 iwpriv ethX fwt_list_neigh [parameters]
85 iwpriv ethX fwt_reset [parameters]
86 iwpriv ethX fwt_cleanup
87 iwpriv ethX fwt_time
88
89MESH Commands:
90
91 The MESH commands are used to configure various features of the mesh
92 routing protocol. The following commands are supported:
93
94 iwpriv ethX mesh_get_ttl
95 iwpriv ethX mesh_set_ttl ttl
96
97DESCRIPTION
98 Those commands are used to send additional commands to the Marvell WLAN
99 card via the Linux device driver.
100
101 The ethX parameter specifies the network device that is to be used to
102 perform this command on. it could be eth0, eth1 etc.
103
104setregioncode
105 This command is used to set the region code in the station.
106 where value is 'region code' for various regions like
107 USA FCC, Canada IC, Spain, France, Europe ETSI, Japan ...
108
109 Usage:
110 iwpriv ethX setregioncode 0x10: set region code to USA (0x10).
111
112getregioncode
113 This command is used to get the region code information set in the
114 station.
115
116ledgpio
117 This command is used to set/get LEDs.
118
119 iwpriv ethX ledgpio <LEDs>
120 will set the corresponding LED for the GPIO Line.
121
122 iwpriv ethX ledgpio
123 will give u which LEDs are Enabled.
124
125 Usage:
126 iwpriv eth1 ledgpio 1 0 2 1 3 4
127 will enable
128 LED 1 -> GPIO 0
129 LED 2 -> GPIO 1
130 LED 3 -> GPIO 4
131
132 iwpriv eth1 ledgpio
133 shows LED information in the format as mentioned above.
134
135 Note: LED0 is invalid
136 Note: Maximum Number of LEDs are 16.
137
138fwt_add
139 This command is used to insert an entry into the FWT table. The list of
140 parameters must follow the following structure:
141
142 iwpriv ethX fwt_add da ra [metric dir rate ssn dsn hopcount ttl expiration sleepmode snr]
143
144 The parameters between brackets are optional, but they must appear in
145 the order specified. For example, if you want to specify the metric,
146 you must also specify the dir, ssn, and dsn but you need not specify the
147 hopcount, expiration, sleepmode, or snr. Any unspecified parameters
148 will be assigned the defaults specified below.
149
150 The different parameters are:-
151 da -- DA MAC address in the form 00:11:22:33:44:55
152 ra -- RA MAC address in the form 00:11:22:33:44:55
153 metric -- route metric (cost: smaller-metric routes are
154 preferred, default is 0)
155 dir -- direction (1 for direct, 0 for reverse,
156 default is 1)
157 rate -- data rate used for transmission to the RA,
158 as specified for the rateadapt command,
159 default is 3 (11Mbps)
160 ssn -- Source Sequence Number (time at the RA for
161 reverse routes. Default is 0)
162 dsn -- Destination Sequence Number (time at the DA
163 for direct routes. Default is 0)
164 hopcount -- hop count (currently unused, default is 0)
165 ttl -- TTL (Only used in reverse entries)
166 expiration -- entry expiration (in ticks, where a tick is
167 1024us, or ~ 1ms. Use 0 for an indefinite
168 entry, default is 0)
169 sleepmode -- RA's sleep mode (currently unused, default is
170 0)
171 snr -- SNR in the link to RA (currently unused,
172 default is 0)
173
174 The command does not return anything.
175
176fwt_del
177 This command is used to remove an entry to the FWT table. The list of
178 parameters must follow the following structure:
179
180 iwpriv ethX fwt_del da ra [dir]
181
182 where the different parameters are:-
183 da -- DA MAC address (in the form "00:11:22:33:44:55")
184 ra -- RA MAC address (in the form "00:11:22:33:44:55")
185 dir -- direction (1 for direct, 0 for reverse,
186 default is 1)
187
188 The command does not return anything.
189
190fwt_lookup
191 This command is used to get the best route in the FWT table to a given
192 host. The only parameter is the MAC address of the host that is being
193 looked for.
194
195 iwpriv ethX fwt_lookup da
196
197 where:-
198 da -- DA MAC address (in the form "00:11:22:33:44:55")
199
200 The command returns an output string identical to the one returned by
201 fwt_list described below.
202
203
204fwt_list
205 This command is used to list a route from the FWT table. The only
206 parameter is the index into the table. If you want to list all the
207 routes in a table, start with index=0, and keep listing until you get a
208 "(null)" string. Note that the indicies may change as the fwt is
209 updated. It is expected that most users will not use fwt_list directly,
210 but that a utility similar to the traditional route command will be used
211 to invoke fwt_list over and over.
212
213 iwpriv ethX fwt_list index
214
215 The output is a string of the following form:
216
217 da ra valid metric dir rate ssn dsn hopcount ttl expiration
218 sleepmode snr precursor
219
220 where the different fields are:-
221 da -- DA MAC address (in the form "00:11:22:33:44:55")
222 ra -- RA MAC address (in the form "00:11:22:33:44:55")
223 valid -- whether the route is valid (0 if not valid)
224 metric -- route metric (cost: smaller-metric routes are preferred)
225 dir -- direction (1 for direct, 0 for reverse)
226 rate -- data rate used for transmission to the RA,
227 as specified for the rateadapt command
228 ssn -- Source Sequence Number (time at the RA for reverse routes)
229 dsn -- Destination Sequence Number (time at the DA for direct routes)
230 hopcount -- hop count (currently unused)
231 ttl -- TTL (only used in reverse entries)
232 expiration -- entry expiration (in ticks, where a tick is 1024us, or ~ 1ms. Use 0 for an indefinite entry)
233 sleepmode -- RA's sleep mode (currently unused)
234 snr -- SNR in the link to RA (currently unused)
235 precursor -- predecessor in direct routes
236
237fwt_list_route
238 This command is equivalent to fwt_list.
239
240fwt_list_neigh
241 This command is used to list a neighbor from the FWT table. The only
242 parameter is the neighbor ID. If you want to list all the neighbors in a
243 table, start with nid=0, and keep incrementing nid until you get a
244 "(null)" string. Note that the nid from a fwt_list_route command can be
245 used as an input to this command. Also note that this command is meant
246 mostly for debugging. It is expected that users will use fwt_lookup.
247 One important reason for this is that the neighbor id may change as the
248 neighbor table is altered.
249
250 iwpriv ethX fwt_list_neigh nid
251
252 The output is a string of the following form:
253
254 ra sleepmode snr references
255
256 where the different fields are:-
257 ra -- RA MAC address (in the form "00:11:22:33:44:55")
258 sleepmode -- RA's sleep mode (currently unused)
259 snr -- SNR in the link to RA (currently unused)
260 references -- RA's reference counter
261
262fwt_reset
263 This command is used to reset the FWT table, getting rid of all the
264 entries. There are no input parameters.
265
266 iwpriv ethX fwt_reset
267
268 The command does not return anything.
269
270fwt_cleanup
271 This command is used to perform user-based garbage recollection. The
272 FWT table is checked, and all the entries that are expired or invalid
273 are cleaned. Note that this is exported to the driver for debugging
274 purposes, as garbage collection is also fired by the firmware when in
275 space problems. There are no input parameters.
276
277 iwpriv ethX fwt_cleanup
278
279 The command does returns the number of invalid/expired routes deleted.
280
281fwt_time
282 This command returns a card's internal time representation. It is this
283 time that is used to represent the expiration times of FWT entries. The
284 number is not consistent from card to card; it is simply a timer count.
285 The fwt_time command is used to inspect the timer so that expiration
286 times reported by fwt_list can be properly interpreted.
287
288 iwpriv ethX fwt_time
289
290mesh_get_ttl
291
292 The mesh ttl is the number of hops a mesh packet can traverse before it
293 is dropped. This parameter is used to prevent infinite loops in the
294 mesh network. The value returned by this function is the ttl assigned
295 to all mesh packets. Currently there is no way to control the ttl on a
296 per packet or per socket basis.
297
298 iwpriv ethX mesh_get_ttl
299
300mesh_set_ttl ttl
301
302 Set the ttl. The argument must be between 0 and 255.
303
304 iwpriv ethX mesh_set_ttl <ttl>
305
306========================= 31=========================
307ETHTOOL 32ETHTOOL
308========================= 33=========================
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index f67efa0815..afd5617dd9 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -323,6 +323,8 @@ static int assoc_helper_secinfo(wlan_private *priv,
323{ 323{
324 wlan_adapter *adapter = priv->adapter; 324 wlan_adapter *adapter = priv->adapter;
325 int ret = 0; 325 int ret = 0;
326 u32 do_wpa;
327 u32 rsn = 0;
326 328
327 lbs_deb_enter(LBS_DEB_ASSOC); 329 lbs_deb_enter(LBS_DEB_ASSOC);
328 330
@@ -333,12 +335,34 @@ static int assoc_helper_secinfo(wlan_private *priv,
333 if (ret) 335 if (ret)
334 goto out; 336 goto out;
335 337
336 /* enable/disable RSN */ 338 /* If RSN is already enabled, don't try to enable it again, since
339 * ENABLE_RSN resets internal state machines and will clobber the
340 * 4-way WPA handshake.
341 */
342
343 /* Get RSN enabled/disabled */
337 ret = libertas_prepare_and_send_command(priv, 344 ret = libertas_prepare_and_send_command(priv,
338 cmd_802_11_enable_rsn, 345 cmd_802_11_enable_rsn,
339 cmd_act_set, 346 cmd_act_set,
340 cmd_option_waitforrsp, 347 cmd_option_waitforrsp,
341 0, assoc_req); 348 0, &rsn);
349 if (ret) {
350 lbs_deb_assoc("Failed to get RSN status: %d", ret);
351 goto out;
352 }
353
354 /* Don't re-enable RSN if it's already enabled */
355 do_wpa = (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled);
356 if (do_wpa == rsn)
357 goto out;
358
359 /* Set RSN enabled/disabled */
360 rsn = do_wpa;
361 ret = libertas_prepare_and_send_command(priv,
362 cmd_802_11_enable_rsn,
363 cmd_act_set,
364 cmd_option_waitforrsp,
365 0, &rsn);
342 366
343out: 367out:
344 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); 368 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 124e029f1b..13f6528abb 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -228,17 +228,19 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
228 void * pdata_buf) 228 void * pdata_buf)
229{ 229{
230 struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; 230 struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn;
231 struct assoc_request * assoc_req = pdata_buf; 231 u32 * enable = pdata_buf;
232 232
233 lbs_deb_enter(LBS_DEB_CMD); 233 lbs_deb_enter(LBS_DEB_CMD);
234 234
235 cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); 235 cmd->command = cpu_to_le16(cmd_802_11_enable_rsn);
236 cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); 236 cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN);
237 penableRSN->action = cpu_to_le16(cmd_action); 237 penableRSN->action = cpu_to_le16(cmd_action);
238 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { 238
239 penableRSN->enable = cpu_to_le16(cmd_enable_rsn); 239 if (cmd_action == cmd_act_set) {
240 } else { 240 if (*enable)
241 penableRSN->enable = cpu_to_le16(cmd_disable_rsn); 241 penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
242 else
243 penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
242 } 244 }
243 245
244 lbs_deb_leave(LBS_DEB_CMD); 246 lbs_deb_leave(LBS_DEB_CMD);
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 0c3b9a583d..6ac0d4752f 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -537,6 +537,24 @@ static int wlan_ret_get_log(wlan_private * priv,
537 return 0; 537 return 0;
538} 538}
539 539
540static int libertas_ret_802_11_enable_rsn(wlan_private * priv,
541 struct cmd_ds_command *resp)
542{
543 struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn;
544 wlan_adapter *adapter = priv->adapter;
545 u32 * pdata_buf = adapter->cur_cmd->pdata_buf;
546
547 lbs_deb_enter(LBS_DEB_CMD);
548
549 if (enable_rsn->action == cpu_to_le16(cmd_act_get)) {
550 if (pdata_buf)
551 *pdata_buf = (u32) le16_to_cpu(enable_rsn->enable);
552 }
553
554 lbs_deb_enter(LBS_DEB_CMD);
555 return 0;
556}
557
540static inline int handle_cmd_response(u16 respcmd, 558static inline int handle_cmd_response(u16 respcmd,
541 struct cmd_ds_command *resp, 559 struct cmd_ds_command *resp,
542 wlan_private *priv) 560 wlan_private *priv)
@@ -610,7 +628,10 @@ static inline int handle_cmd_response(u16 respcmd,
610 case cmd_ret_802_11_authenticate: 628 case cmd_ret_802_11_authenticate:
611 case cmd_ret_802_11_radio_control: 629 case cmd_ret_802_11_radio_control:
612 case cmd_ret_802_11_beacon_stop: 630 case cmd_ret_802_11_beacon_stop:
631 break;
632
613 case cmd_ret_802_11_enable_rsn: 633 case cmd_ret_802_11_enable_rsn:
634 ret = libertas_ret_802_11_enable_rsn(priv, resp);
614 break; 635 break;
615 636
616 case cmd_ret_802_11_data_rate: 637 case cmd_ret_802_11_data_rate:
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 3acf939881..09b898f671 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -503,7 +503,7 @@ struct cmd_ds_802_11_ad_hoc_join {
503struct cmd_ds_802_11_enable_rsn { 503struct cmd_ds_802_11_enable_rsn {
504 __le16 action; 504 __le16 action;
505 __le16 enable; 505 __le16 enable;
506}; 506} __attribute__ ((packed));
507 507
508struct MrvlIEtype_keyParamSet { 508struct MrvlIEtype_keyParamSet {
509 /* type ID */ 509 /* type ID */
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c
deleted file mode 100644
index f410815855..0000000000
--- a/drivers/net/wireless/libertas/ioctl.c
+++ /dev/null
@@ -1,1081 +0,0 @@
1/**
2 * This file contains ioctl functions
3 */
4
5#include <linux/ctype.h>
6#include <linux/delay.h>
7#include <linux/if.h>
8#include <linux/if_arp.h>
9#include <linux/wireless.h>
10
11#include <net/iw_handler.h>
12#include <net/ieee80211.h>
13
14#include "host.h"
15#include "radiotap.h"
16#include "decl.h"
17#include "defs.h"
18#include "dev.h"
19#include "join.h"
20#include "wext.h"
21
22#define MAX_SCAN_CELL_SIZE (IW_EV_ADDR_LEN + \
23 IW_ESSID_MAX_SIZE + \
24 IW_EV_UINT_LEN + IW_EV_FREQ_LEN + \
25 IW_EV_QUAL_LEN + IW_ESSID_MAX_SIZE + \
26 IW_EV_PARAM_LEN + 40) /* 40 for WPAIE */
27
28#define WAIT_FOR_SCAN_RRESULT_MAX_TIME (10 * HZ)
29
30static int wlan_set_region(wlan_private * priv, u16 region_code)
31{
32 int i;
33 int ret = 0;
34
35 for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
36 // use the region code to search for the index
37 if (region_code == libertas_region_code_to_index[i]) {
38 priv->adapter->regiontableindex = (u16) i;
39 priv->adapter->regioncode = region_code;
40 break;
41 }
42 }
43
44 // if it's unidentified region code
45 if (i >= MRVDRV_MAX_REGION_CODE) {
46 lbs_deb_ioctl("region Code not identified\n");
47 ret = -1;
48 goto done;
49 }
50
51 if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
52 ret = -EINVAL;
53 }
54
55done:
56 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
57 return ret;
58}
59
60static inline int hex2int(char c)
61{
62 if (c >= '0' && c <= '9')
63 return (c - '0');
64 if (c >= 'a' && c <= 'f')
65 return (c - 'a' + 10);
66 if (c >= 'A' && c <= 'F')
67 return (c - 'A' + 10);
68 return -1;
69}
70
71/* Convert a string representation of a MAC address ("xx:xx:xx:xx:xx:xx")
72 into binary format (6 bytes).
73
74 This function expects that each byte is represented with 2 characters
75 (e.g., 11:2:11:11:11:11 is invalid)
76
77 */
78static char *eth_str2addr(char *ethstr, u8 * addr)
79{
80 int i, val, val2;
81 char *pos = ethstr;
82
83 /* get rid of initial blanks */
84 while (*pos == ' ' || *pos == '\t')
85 ++pos;
86
87 for (i = 0; i < 6; i++) {
88 val = hex2int(*pos++);
89 if (val < 0)
90 return NULL;
91 val2 = hex2int(*pos++);
92 if (val2 < 0)
93 return NULL;
94 addr[i] = (val * 16 + val2) & 0xff;
95
96 if (i < 5 && *pos++ != ':')
97 return NULL;
98 }
99 return pos;
100}
101
102/* this writes xx:xx:xx:xx:xx:xx into ethstr
103 (ethstr must have space for 18 chars) */
104static int eth_addr2str(u8 * addr, char *ethstr)
105{
106 int i;
107 char *pos = ethstr;
108
109 for (i = 0; i < 6; i++) {
110 sprintf(pos, "%02x", addr[i] & 0xff);
111 pos += 2;
112 if (i < 5)
113 *pos++ = ':';
114 }
115 return 17;
116}
117
118/**
119 * @brief Add an entry to the BT table
120 * @param priv A pointer to wlan_private structure
121 * @param req A pointer to ifreq structure
122 * @return 0 --success, otherwise fail
123 */
124static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
125{
126 struct iwreq *wrq = (struct iwreq *)req;
127 char ethaddrs_str[18];
128 char *pos;
129 u8 ethaddr[ETH_ALEN];
130 int ret;
131
132 lbs_deb_enter(LBS_DEB_IOCTL);
133
134 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
135 sizeof(ethaddrs_str)))
136 return -EFAULT;
137
138 if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
139 lbs_pr_info("BT_ADD: Invalid MAC address\n");
140 return -EINVAL;
141 }
142
143 lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
144 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
145 cmd_act_bt_access_add,
146 cmd_option_waitforrsp, 0, ethaddr);
147 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
148 return ret;
149}
150
151/**
152 * @brief Delete an entry from the BT table
153 * @param priv A pointer to wlan_private structure
154 * @param req A pointer to ifreq structure
155 * @return 0 --success, otherwise fail
156 */
157static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
158{
159 struct iwreq *wrq = (struct iwreq *)req;
160 char ethaddrs_str[18];
161 u8 ethaddr[ETH_ALEN];
162 char *pos;
163
164 lbs_deb_enter(LBS_DEB_IOCTL);
165
166 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
167 sizeof(ethaddrs_str)))
168 return -EFAULT;
169
170 if ((pos = eth_str2addr(ethaddrs_str, ethaddr)) == NULL) {
171 lbs_pr_info("Invalid MAC address\n");
172 return -EINVAL;
173 }
174
175 lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
176
177 return (libertas_prepare_and_send_command(priv,
178 cmd_bt_access,
179 cmd_act_bt_access_del,
180 cmd_option_waitforrsp, 0, ethaddr));
181
182 lbs_deb_leave(LBS_DEB_IOCTL);
183 return 0;
184}
185
186/**
187 * @brief Reset all entries from the BT table
188 * @param priv A pointer to wlan_private structure
189 * @return 0 --success, otherwise fail
190 */
191static int wlan_bt_reset_ioctl(wlan_private * priv)
192{
193 lbs_deb_enter(LBS_DEB_IOCTL);
194
195 lbs_pr_alert( "BT: resetting\n");
196
197 return (libertas_prepare_and_send_command(priv,
198 cmd_bt_access,
199 cmd_act_bt_access_reset,
200 cmd_option_waitforrsp, 0, NULL));
201
202 lbs_deb_leave(LBS_DEB_IOCTL);
203 return 0;
204}
205
206/**
207 * @brief List an entry from the BT table
208 * @param priv A pointer to wlan_private structure
209 * @param req A pointer to ifreq structure
210 * @return 0 --success, otherwise fail
211 */
212static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
213{
214 int pos;
215 char *addr1;
216 struct iwreq *wrq = (struct iwreq *)req;
217 /* used to pass id and store the bt entry returned by the FW */
218 union {
219 u32 id;
220 char addr1addr2[2 * ETH_ALEN];
221 } param;
222 static char outstr[64];
223 char *pbuf = outstr;
224 int ret;
225
226 lbs_deb_enter(LBS_DEB_IOCTL);
227
228 if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
229 lbs_deb_ioctl("Copy from user failed\n");
230 return -1;
231 }
232 param.id = simple_strtoul(outstr, NULL, 10);
233 pos = sprintf(pbuf, "%d: ", param.id);
234 pbuf += pos;
235
236 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
237 cmd_act_bt_access_list,
238 cmd_option_waitforrsp, 0,
239 (char *)&param);
240
241 if (ret == 0) {
242 addr1 = param.addr1addr2;
243
244 pos = sprintf(pbuf, "BT includes node ");
245 pbuf += pos;
246 pos = eth_addr2str(addr1, pbuf);
247 pbuf += pos;
248 } else {
249 sprintf(pbuf, "(null)");
250 pbuf += pos;
251 }
252
253 wrq->u.data.length = strlen(outstr);
254 if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
255 wrq->u.data.length)) {
256 lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
257 return -EFAULT;
258 }
259
260 lbs_deb_leave(LBS_DEB_IOCTL);
261 return 0 ;
262}
263
264/**
265 * @brief Sets inverted state of blacklist (non-zero if inverted)
266 * @param priv A pointer to wlan_private structure
267 * @param req A pointer to ifreq structure
268 * @return 0 --success, otherwise fail
269 */
270static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
271{
272 int ret;
273 struct iwreq *wrq = (struct iwreq *)req;
274 union {
275 u32 id;
276 char addr1addr2[2 * ETH_ALEN];
277 } param;
278
279 lbs_deb_enter(LBS_DEB_IOCTL);
280
281 param.id = SUBCMD_DATA(wrq) ;
282 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
283 cmd_act_bt_access_set_invert,
284 cmd_option_waitforrsp, 0,
285 (char *)&param);
286 if (ret != 0)
287 return -EFAULT;
288 lbs_deb_leave(LBS_DEB_IOCTL);
289 return 0;
290}
291
292/**
293 * @brief Gets inverted state of blacklist (non-zero if inverted)
294 * @param priv A pointer to wlan_private structure
295 * @param req A pointer to ifreq structure
296 * @return 0 --success, otherwise fail
297 */
298static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
299{
300 struct iwreq *wrq = (struct iwreq *)req;
301 int ret;
302 union {
303 u32 id;
304 char addr1addr2[2 * ETH_ALEN];
305 } param;
306
307 lbs_deb_enter(LBS_DEB_IOCTL);
308
309 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
310 cmd_act_bt_access_get_invert,
311 cmd_option_waitforrsp, 0,
312 (char *)&param);
313
314 if (ret == 0)
315 wrq->u.param.value = le32_to_cpu(param.id);
316 else
317 return -EFAULT;
318
319 lbs_deb_leave(LBS_DEB_IOCTL);
320 return 0;
321}
322
323/**
324 * @brief Find the next parameter in an input string
325 * @param ptr A pointer to the input parameter string
326 * @return A pointer to the next parameter, or 0 if no parameters left.
327 */
328static char * next_param(char * ptr)
329{
330 if (!ptr) return NULL;
331 while (*ptr == ' ' || *ptr == '\t') ++ptr;
332 return (*ptr == '\0') ? NULL : ptr;
333}
334
335/**
336 * @brief Add an entry to the FWT table
337 * @param priv A pointer to wlan_private structure
338 * @param req A pointer to ifreq structure
339 * @return 0 --success, otherwise fail
340 */
341static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
342{
343 struct iwreq *wrq = (struct iwreq *)req;
344 char in_str[128];
345 static struct cmd_ds_fwt_access fwt_access;
346 char *ptr;
347 int ret;
348
349 lbs_deb_enter(LBS_DEB_IOCTL);
350
351 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
352 return -EFAULT;
353
354 if ((ptr = eth_str2addr(in_str, fwt_access.da)) == NULL) {
355 lbs_pr_alert( "FWT_ADD: Invalid MAC address 1\n");
356 return -EINVAL;
357 }
358
359 if ((ptr = eth_str2addr(ptr, fwt_access.ra)) == NULL) {
360 lbs_pr_alert( "FWT_ADD: Invalid MAC address 2\n");
361 return -EINVAL;
362 }
363
364 if ((ptr = next_param(ptr)))
365 fwt_access.metric =
366 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
367 else
368 fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
369
370 if ((ptr = next_param(ptr)))
371 fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
372 else
373 fwt_access.dir = FWT_DEFAULT_DIR;
374
375 if ((ptr = next_param(ptr)))
376 fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10);
377 else
378 fwt_access.rate = FWT_DEFAULT_RATE;
379
380 if ((ptr = next_param(ptr)))
381 fwt_access.ssn =
382 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
383 else
384 fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
385
386 if ((ptr = next_param(ptr)))
387 fwt_access.dsn =
388 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
389 else
390 fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
391
392 if ((ptr = next_param(ptr)))
393 fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10);
394 else
395 fwt_access.hopcount = FWT_DEFAULT_HOPCOUNT;
396
397 if ((ptr = next_param(ptr)))
398 fwt_access.ttl = simple_strtoul(ptr, &ptr, 10);
399 else
400 fwt_access.ttl = FWT_DEFAULT_TTL;
401
402 if ((ptr = next_param(ptr)))
403 fwt_access.expiration =
404 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
405 else
406 fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
407
408 if ((ptr = next_param(ptr)))
409 fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10);
410 else
411 fwt_access.sleepmode = FWT_DEFAULT_SLEEPMODE;
412
413 if ((ptr = next_param(ptr)))
414 fwt_access.snr =
415 cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
416 else
417 fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
418
419#ifdef DEBUG
420 {
421 char ethaddr1_str[18], ethaddr2_str[18];
422 eth_addr2str(fwt_access.da, ethaddr1_str);
423 eth_addr2str(fwt_access.ra, ethaddr2_str);
424 lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
425 fwt_access.dir, ethaddr2_str);
426 lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
427 fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
428 fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
429 fwt_access.sleepmode, fwt_access.snr);
430 }
431#endif
432
433 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
434 cmd_act_fwt_access_add,
435 cmd_option_waitforrsp, 0,
436 (void *)&fwt_access);
437
438 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
439 return ret;
440}
441
442/**
443 * @brief Delete an entry from the FWT table
444 * @param priv A pointer to wlan_private structure
445 * @param req A pointer to ifreq structure
446 * @return 0 --success, otherwise fail
447 */
448static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
449{
450 struct iwreq *wrq = (struct iwreq *)req;
451 char in_str[64];
452 static struct cmd_ds_fwt_access fwt_access;
453 char *ptr;
454 int ret;
455
456 lbs_deb_enter(LBS_DEB_IOCTL);
457
458 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
459 return -EFAULT;
460
461 if ((ptr = eth_str2addr(in_str, fwt_access.da)) == NULL) {
462 lbs_pr_alert( "FWT_DEL: Invalid MAC address 1\n");
463 return -EINVAL;
464 }
465
466 if ((ptr = eth_str2addr(ptr, fwt_access.ra)) == NULL) {
467 lbs_pr_alert( "FWT_DEL: Invalid MAC address 2\n");
468 return -EINVAL;
469 }
470
471 if ((ptr = next_param(ptr)))
472 fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10);
473 else
474 fwt_access.dir = FWT_DEFAULT_DIR;
475
476#ifdef DEBUG
477 {
478 char ethaddr1_str[18], ethaddr2_str[18];
479 lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
480 eth_addr2str(fwt_access.da, ethaddr1_str);
481 eth_addr2str(fwt_access.ra, ethaddr2_str);
482 lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
483 ethaddr2_str, fwt_access.dir);
484 }
485#endif
486
487 ret = libertas_prepare_and_send_command(priv,
488 cmd_fwt_access,
489 cmd_act_fwt_access_del,
490 cmd_option_waitforrsp, 0,
491 (void *)&fwt_access);
492 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
493 return ret;
494}
495
496
497/**
498 * @brief Print route parameters
499 * @param fwt_access struct cmd_ds_fwt_access with route info
500 * @param buf destination buffer for route info
501 */
502static void print_route(struct cmd_ds_fwt_access fwt_access, char *buf)
503{
504 buf += sprintf(buf, " ");
505 buf += eth_addr2str(fwt_access.da, buf);
506 buf += sprintf(buf, " ");
507 buf += eth_addr2str(fwt_access.ra, buf);
508 buf += sprintf(buf, " %u", fwt_access.valid);
509 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
510 buf += sprintf(buf, " %u", fwt_access.dir);
511 buf += sprintf(buf, " %u", fwt_access.rate);
512 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
513 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
514 buf += sprintf(buf, " %u", fwt_access.hopcount);
515 buf += sprintf(buf, " %u", fwt_access.ttl);
516 buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
517 buf += sprintf(buf, " %u", fwt_access.sleepmode);
518 buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr));
519 buf += eth_addr2str(fwt_access.prec, buf);
520}
521
522/**
523 * @brief Lookup an entry in the FWT table
524 * @param priv A pointer to wlan_private structure
525 * @param req A pointer to ifreq structure
526 * @return 0 --success, otherwise fail
527 */
528static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
529{
530 struct iwreq *wrq = (struct iwreq *)req;
531 char in_str[64];
532 char *ptr;
533 static struct cmd_ds_fwt_access fwt_access;
534 static char out_str[128];
535 int ret;
536
537 lbs_deb_enter(LBS_DEB_IOCTL);
538
539 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
540 return -EFAULT;
541
542 if ((ptr = eth_str2addr(in_str, fwt_access.da)) == NULL) {
543 lbs_pr_alert( "FWT_LOOKUP: Invalid MAC address\n");
544 return -EINVAL;
545 }
546
547#ifdef DEBUG
548 {
549 char ethaddr1_str[18];
550 lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
551 eth_addr2str(fwt_access.da, ethaddr1_str);
552 lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
553 }
554#endif
555
556 ret = libertas_prepare_and_send_command(priv,
557 cmd_fwt_access,
558 cmd_act_fwt_access_lookup,
559 cmd_option_waitforrsp, 0,
560 (void *)&fwt_access);
561
562 if (ret == 0)
563 print_route(fwt_access, out_str);
564 else
565 sprintf(out_str, "(null)");
566
567 wrq->u.data.length = strlen(out_str);
568 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
569 wrq->u.data.length)) {
570 lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
571 return -EFAULT;
572 }
573
574 lbs_deb_leave(LBS_DEB_IOCTL);
575 return 0;
576}
577
578/**
579 * @brief Reset all entries from the FWT table
580 * @param priv A pointer to wlan_private structure
581 * @return 0 --success, otherwise fail
582 */
583static int wlan_fwt_reset_ioctl(wlan_private * priv)
584{
585 lbs_deb_ioctl("FWT: resetting\n");
586
587 return (libertas_prepare_and_send_command(priv,
588 cmd_fwt_access,
589 cmd_act_fwt_access_reset,
590 cmd_option_waitforrsp, 0, NULL));
591}
592
593/**
594 * @brief List an entry from the FWT table
595 * @param priv A pointer to wlan_private structure
596 * @param req A pointer to ifreq structure
597 * @return 0 --success, otherwise fail
598 */
599static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
600{
601 struct iwreq *wrq = (struct iwreq *)req;
602 char in_str[8];
603 static struct cmd_ds_fwt_access fwt_access;
604 char *ptr = in_str;
605 static char out_str[128];
606 char *pbuf = out_str;
607 int ret = 0;
608
609 lbs_deb_enter(LBS_DEB_IOCTL);
610
611 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) {
612 ret = -EFAULT;
613 goto out;
614 }
615
616 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
617
618#ifdef DEBUG
619 {
620 lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
621 lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
622 }
623#endif
624
625 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
626 cmd_act_fwt_access_list,
627 cmd_option_waitforrsp, 0, (void *)&fwt_access);
628
629 if (ret == 0)
630 print_route(fwt_access, pbuf);
631 else
632 pbuf += sprintf(pbuf, " (null)");
633
634 wrq->u.data.length = strlen(out_str);
635 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
636 wrq->u.data.length)) {
637 lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
638 ret = -EFAULT;
639 goto out;
640 }
641
642 ret = 0;
643
644out:
645 lbs_deb_leave(LBS_DEB_IOCTL);
646 return ret;
647}
648
649/**
650 * @brief List an entry from the FRT table
651 * @param priv A pointer to wlan_private structure
652 * @param req A pointer to ifreq structure
653 * @return 0 --success, otherwise fail
654 */
655static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
656{
657 struct iwreq *wrq = (struct iwreq *)req;
658 char in_str[64];
659 static struct cmd_ds_fwt_access fwt_access;
660 char *ptr = in_str;
661 static char out_str[128];
662 char *pbuf = out_str;
663 int ret;
664
665 lbs_deb_enter(LBS_DEB_IOCTL);
666
667 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
668 return -EFAULT;
669
670 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
671
672#ifdef DEBUG
673 {
674 lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
675 lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
676 }
677#endif
678
679 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
680 cmd_act_fwt_access_list_route,
681 cmd_option_waitforrsp, 0, (void *)&fwt_access);
682
683 if (ret == 0) {
684 print_route(fwt_access, pbuf);
685 } else
686 pbuf += sprintf(pbuf, " (null)");
687
688 wrq->u.data.length = strlen(out_str);
689 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
690 wrq->u.data.length)) {
691 lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
692 return -EFAULT;
693 }
694
695 lbs_deb_leave(LBS_DEB_IOCTL);
696 return 0;
697}
698
699/**
700 * @brief List an entry from the FNT table
701 * @param priv A pointer to wlan_private structure
702 * @param req A pointer to ifreq structure
703 * @return 0 --success, otherwise fail
704 */
705static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
706{
707 struct iwreq *wrq = (struct iwreq *)req;
708 char in_str[8];
709 static struct cmd_ds_fwt_access fwt_access;
710 char *ptr = in_str;
711 static char out_str[128];
712 char *pbuf = out_str;
713 int ret;
714
715 lbs_deb_enter(LBS_DEB_IOCTL);
716
717 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
718 return -EFAULT;
719
720 memset(&fwt_access, 0, sizeof(fwt_access));
721 fwt_access.id = cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
722
723#ifdef DEBUG
724 {
725 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
726 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
727 }
728#endif
729
730 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
731 cmd_act_fwt_access_list_neighbor,
732 cmd_option_waitforrsp, 0,
733 (void *)&fwt_access);
734
735 if (ret == 0) {
736 pbuf += sprintf(pbuf, " ra ");
737 pbuf += eth_addr2str(fwt_access.ra, pbuf);
738 pbuf += sprintf(pbuf, " slp %u", fwt_access.sleepmode);
739 pbuf += sprintf(pbuf, " snr %u", le32_to_cpu(fwt_access.snr));
740 pbuf += sprintf(pbuf, " ref %u", le32_to_cpu(fwt_access.references));
741 } else
742 pbuf += sprintf(pbuf, " (null)");
743
744 wrq->u.data.length = strlen(out_str);
745 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
746 wrq->u.data.length)) {
747 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
748 return -EFAULT;
749 }
750
751 lbs_deb_leave(LBS_DEB_IOCTL);
752 return 0;
753}
754
755/**
756 * @brief Cleans up the route (FRT) and neighbor (FNT) tables
757 * (Garbage Collection)
758 * @param priv A pointer to wlan_private structure
759 * @param req A pointer to ifreq structure
760 * @return 0 --success, otherwise fail
761 */
762static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
763{
764 struct iwreq *wrq = (struct iwreq *)req;
765 static struct cmd_ds_fwt_access fwt_access;
766 int ret;
767
768 lbs_deb_enter(LBS_DEB_IOCTL);
769
770 lbs_deb_ioctl("FWT: cleaning up\n");
771
772 memset(&fwt_access, 0, sizeof(fwt_access));
773
774 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
775 cmd_act_fwt_access_cleanup,
776 cmd_option_waitforrsp, 0,
777 (void *)&fwt_access);
778
779 if (ret == 0)
780 wrq->u.param.value = le32_to_cpu(fwt_access.references);
781 else
782 return -EFAULT;
783
784 lbs_deb_leave(LBS_DEB_IOCTL);
785 return 0;
786}
787
788/**
789 * @brief Gets firmware internal time (debug purposes)
790 * @param priv A pointer to wlan_private structure
791 * @param req A pointer to ifreq structure
792 * @return 0 --success, otherwise fail
793 */
794static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
795{
796 struct iwreq *wrq = (struct iwreq *)req;
797 static struct cmd_ds_fwt_access fwt_access;
798 int ret;
799
800 lbs_deb_enter(LBS_DEB_IOCTL);
801
802 lbs_deb_ioctl("FWT: getting time\n");
803
804 memset(&fwt_access, 0, sizeof(fwt_access));
805
806 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
807 cmd_act_fwt_access_time,
808 cmd_option_waitforrsp, 0,
809 (void *)&fwt_access);
810
811 if (ret == 0)
812 wrq->u.param.value = le32_to_cpu(fwt_access.references);
813 else
814 return -EFAULT;
815
816 lbs_deb_leave(LBS_DEB_IOCTL);
817 return 0;
818}
819
820/**
821 * @brief Gets mesh ttl from firmware
822 * @param priv A pointer to wlan_private structure
823 * @param req A pointer to ifreq structure
824 * @return 0 --success, otherwise fail
825 */
826static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
827{
828 struct iwreq *wrq = (struct iwreq *)req;
829 struct cmd_ds_mesh_access mesh_access;
830 int ret;
831
832 lbs_deb_enter(LBS_DEB_IOCTL);
833
834 memset(&mesh_access, 0, sizeof(mesh_access));
835
836 ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
837 cmd_act_mesh_get_ttl,
838 cmd_option_waitforrsp, 0,
839 (void *)&mesh_access);
840
841 if (ret == 0)
842 wrq->u.param.value = le32_to_cpu(mesh_access.data[0]);
843 else
844 return -EFAULT;
845
846 lbs_deb_leave(LBS_DEB_IOCTL);
847 return 0;
848}
849
850/**
851 * @brief Gets mesh ttl from firmware
852 * @param priv A pointer to wlan_private structure
853 * @param ttl New ttl value
854 * @return 0 --success, otherwise fail
855 */
856static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
857{
858 struct cmd_ds_mesh_access mesh_access;
859 int ret;
860
861 lbs_deb_enter(LBS_DEB_IOCTL);
862
863 if( (ttl > 0xff) || (ttl < 0) )
864 return -EINVAL;
865
866 memset(&mesh_access, 0, sizeof(mesh_access));
867 mesh_access.data[0] = cpu_to_le32(ttl);
868
869 ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
870 cmd_act_mesh_set_ttl,
871 cmd_option_waitforrsp, 0,
872 (void *)&mesh_access);
873
874 if (ret != 0)
875 ret = -EFAULT;
876
877 lbs_deb_leave(LBS_DEB_IOCTL);
878 return ret;
879}
880
881/**
882 * @brief ioctl function - entry point
883 *
884 * @param dev A pointer to net_device structure
885 * @param req A pointer to ifreq structure
886 * @param cmd command
887 * @return 0--success, otherwise fail
888 */
889int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
890{
891 int subcmd = 0;
892 int idata = 0;
893 int *pdata;
894 int ret = 0;
895 wlan_private *priv = dev->priv;
896 wlan_adapter *adapter = priv->adapter;
897 struct iwreq *wrq = (struct iwreq *)req;
898
899 lbs_deb_enter(LBS_DEB_IOCTL);
900
901 lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
902 switch (cmd) {
903 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
904 switch (wrq->u.data.flags) {
905 case WLAN_SUBCMD_BT_RESET: /* bt_reset */
906 wlan_bt_reset_ioctl(priv);
907 break;
908 case WLAN_SUBCMD_FWT_RESET: /* fwt_reset */
909 wlan_fwt_reset_ioctl(priv);
910 break;
911 } /* End of switch */
912 break;
913
914 case WLAN_SETONEINT_GETNONE:
915 /* The first 4 bytes of req->ifr_data is sub-ioctl number
916 * after 4 bytes sits the payload.
917 */
918 subcmd = wrq->u.data.flags;
919 if (!subcmd)
920 subcmd = (int)wrq->u.param.value;
921
922 switch (subcmd) {
923 case WLANSETREGION:
924 idata = SUBCMD_DATA(wrq);
925 ret = wlan_set_region(priv, (u16) idata);
926 break;
927 case WLAN_SUBCMD_MESH_SET_TTL:
928 idata = SUBCMD_DATA(wrq);
929 ret = wlan_mesh_set_ttl_ioctl(priv, idata);
930 break;
931
932 case WLAN_SUBCMD_BT_SET_INVERT:
933 ret = wlan_bt_set_invert_ioctl(priv, req);
934 break ;
935
936 default:
937 ret = -EOPNOTSUPP;
938 break;
939 }
940
941 break;
942
943 case WLAN_SET128CHAR_GET128CHAR:
944 switch ((int)wrq->u.data.flags) {
945 case WLAN_SUBCMD_BT_ADD:
946 ret = wlan_bt_add_ioctl(priv, req);
947 break;
948 case WLAN_SUBCMD_BT_DEL:
949 ret = wlan_bt_del_ioctl(priv, req);
950 break;
951 case WLAN_SUBCMD_BT_LIST:
952 ret = wlan_bt_list_ioctl(priv, req);
953 break;
954 case WLAN_SUBCMD_FWT_ADD:
955 ret = wlan_fwt_add_ioctl(priv, req);
956 break;
957 case WLAN_SUBCMD_FWT_DEL:
958 ret = wlan_fwt_del_ioctl(priv, req);
959 break;
960 case WLAN_SUBCMD_FWT_LOOKUP:
961 ret = wlan_fwt_lookup_ioctl(priv, req);
962 break;
963 case WLAN_SUBCMD_FWT_LIST_NEIGHBOR:
964 ret = wlan_fwt_list_neighbor_ioctl(priv, req);
965 break;
966 case WLAN_SUBCMD_FWT_LIST:
967 ret = wlan_fwt_list_ioctl(priv, req);
968 break;
969 case WLAN_SUBCMD_FWT_LIST_ROUTE:
970 ret = wlan_fwt_list_route_ioctl(priv, req);
971 break;
972 }
973 break;
974
975 case WLAN_SETNONE_GETONEINT:
976 switch (wrq->u.param.value) {
977 case WLANGETREGION:
978 pdata = (int *)wrq->u.name;
979 *pdata = (int)adapter->regioncode;
980 break;
981 case WLAN_SUBCMD_FWT_CLEANUP: /* fwt_cleanup */
982 ret = wlan_fwt_cleanup_ioctl(priv, req);
983 break;
984
985 case WLAN_SUBCMD_FWT_TIME: /* fwt_time */
986 ret = wlan_fwt_time_ioctl(priv, req);
987 break;
988
989 case WLAN_SUBCMD_MESH_GET_TTL:
990 ret = wlan_mesh_get_ttl_ioctl(priv, req);
991 break;
992
993 case WLAN_SUBCMD_BT_GET_INVERT:
994 ret = wlan_bt_get_invert_ioctl(priv, req);
995 break ;
996
997 default:
998 ret = -EOPNOTSUPP;
999
1000 }
1001
1002 break;
1003
1004 case WLAN_SET_GET_SIXTEEN_INT:
1005 switch ((int)wrq->u.data.flags) {
1006 case WLAN_LED_GPIO_CTRL:
1007 {
1008 int i;
1009 int data[16];
1010
1011 struct cmd_ds_802_11_led_ctrl ctrl;
1012 struct mrvlietypes_ledgpio *gpio =
1013 (struct mrvlietypes_ledgpio *) ctrl.data;
1014
1015 memset(&ctrl, 0, sizeof(ctrl));
1016 if (wrq->u.data.length > MAX_LEDS * 2)
1017 return -ENOTSUPP;
1018 if ((wrq->u.data.length % 2) != 0)
1019 return -ENOTSUPP;
1020 if (wrq->u.data.length == 0) {
1021 ctrl.action =
1022 cpu_to_le16
1023 (cmd_act_get);
1024 } else {
1025 if (copy_from_user
1026 (data, wrq->u.data.pointer,
1027 sizeof(int) *
1028 wrq->u.data.length)) {
1029 lbs_deb_ioctl(
1030 "Copy from user failed\n");
1031 return -EFAULT;
1032 }
1033
1034 ctrl.action =
1035 cpu_to_le16
1036 (cmd_act_set);
1037 ctrl.numled = cpu_to_le16(0);
1038 gpio->header.type =
1039 cpu_to_le16(TLV_TYPE_LED_GPIO);
1040 gpio->header.len = wrq->u.data.length;
1041 for (i = 0; i < wrq->u.data.length;
1042 i += 2) {
1043 gpio->ledpin[i / 2].led =
1044 data[i];
1045 gpio->ledpin[i / 2].pin =
1046 data[i + 1];
1047 }
1048 }
1049 ret =
1050 libertas_prepare_and_send_command(priv,
1051 cmd_802_11_led_gpio_ctrl,
1052 0,
1053 cmd_option_waitforrsp,
1054 0, (void *)&ctrl);
1055 for (i = 0; i < gpio->header.len; i += 2) {
1056 data[i] = gpio->ledpin[i / 2].led;
1057 data[i + 1] = gpio->ledpin[i / 2].pin;
1058 }
1059 if (copy_to_user(wrq->u.data.pointer, data,
1060 sizeof(int) *
1061 gpio->header.len)) {
1062 lbs_deb_ioctl("Copy to user failed\n");
1063 return -EFAULT;
1064 }
1065
1066 wrq->u.data.length = gpio->header.len;
1067 }
1068 break;
1069 }
1070 break;
1071
1072 default:
1073 ret = -EINVAL;
1074 break;
1075 }
1076
1077 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
1078 return ret;
1079}
1080
1081
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 623ab4b169..4a59306a3f 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -181,7 +181,8 @@ u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
181 * @brief Get function for sysfs attribute anycast_mask 181 * @brief Get function for sysfs attribute anycast_mask
182 */ 182 */
183static ssize_t libertas_anycast_get(struct device * dev, 183static ssize_t libertas_anycast_get(struct device * dev,
184 struct device_attribute *attr, char * buf) { 184 struct device_attribute *attr, char * buf)
185{
185 struct cmd_ds_mesh_access mesh_access; 186 struct cmd_ds_mesh_access mesh_access;
186 187
187 memset(&mesh_access, 0, sizeof(mesh_access)); 188 memset(&mesh_access, 0, sizeof(mesh_access));
@@ -197,7 +198,8 @@ static ssize_t libertas_anycast_get(struct device * dev,
197 * @brief Set function for sysfs attribute anycast_mask 198 * @brief Set function for sysfs attribute anycast_mask
198 */ 199 */
199static ssize_t libertas_anycast_set(struct device * dev, 200static ssize_t libertas_anycast_set(struct device * dev,
200 struct device_attribute *attr, const char * buf, size_t count) { 201 struct device_attribute *attr, const char * buf, size_t count)
202{
201 struct cmd_ds_mesh_access mesh_access; 203 struct cmd_ds_mesh_access mesh_access;
202 uint32_t datum; 204 uint32_t datum;
203 205
@@ -799,7 +801,6 @@ wlan_private *libertas_add_card(void *card, struct device *dmdev)
799 dev->open = wlan_open; 801 dev->open = wlan_open;
800 dev->hard_start_xmit = wlan_pre_start_xmit; 802 dev->hard_start_xmit = wlan_pre_start_xmit;
801 dev->stop = wlan_close; 803 dev->stop = wlan_close;
802 dev->do_ioctl = libertas_do_ioctl;
803 dev->set_mac_address = wlan_set_mac_address; 804 dev->set_mac_address = wlan_set_mac_address;
804 dev->tx_timeout = wlan_tx_timeout; 805 dev->tx_timeout = wlan_tx_timeout;
805 dev->get_stats = wlan_get_stats; 806 dev->get_stats = wlan_get_stats;
@@ -918,7 +919,6 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
918 mesh_dev->open = mesh_open; 919 mesh_dev->open = mesh_open;
919 mesh_dev->hard_start_xmit = mesh_pre_start_xmit; 920 mesh_dev->hard_start_xmit = mesh_pre_start_xmit;
920 mesh_dev->stop = mesh_close; 921 mesh_dev->stop = mesh_close;
921 mesh_dev->do_ioctl = libertas_do_ioctl;
922 mesh_dev->get_stats = wlan_get_stats; 922 mesh_dev->get_stats = wlan_get_stats;
923 mesh_dev->set_mac_address = wlan_set_mac_address; 923 mesh_dev->set_mac_address = wlan_set_mac_address;
924 mesh_dev->ethtool_ops = &libertas_ethtool_ops; 924 mesh_dev->ethtool_ops = &libertas_ethtool_ops;
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 606af50fa0..c3043dcb54 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -215,38 +215,6 @@ done:
215} 215}
216 216
217/** 217/**
218 * @brief Post process the scan table after a new scan command has completed
219 *
220 * Inspect each entry of the scan table and try to find an entry that
221 * matches our current associated/joined network from the scan. If
222 * one is found, update the stored copy of the bssdescriptor for our
223 * current network.
224 *
225 * Debug dump the current scan table contents if compiled accordingly.
226 *
227 * @param priv A pointer to wlan_private structure
228 *
229 * @return void
230 */
231static void wlan_scan_process_results(wlan_private * priv)
232{
233 wlan_adapter *adapter = priv->adapter;
234 struct bss_descriptor * iter_bss;
235 int i = 0;
236
237 if (adapter->connect_status == libertas_connected)
238 return;
239
240 mutex_lock(&adapter->lock);
241 list_for_each_entry (iter_bss, &adapter->network_list, list) {
242 lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
243 i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
244 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
245 }
246 mutex_unlock(&adapter->lock);
247}
248
249/**
250 * @brief Create a channel list for the driver to scan based on region info 218 * @brief Create a channel list for the driver to scan based on region info
251 * 219 *
252 * Use the driver region/band information to construct a comprehensive list 220 * Use the driver region/band information to construct a comprehensive list
@@ -791,6 +759,10 @@ int wlan_scan_networks(wlan_private * priv,
791 u8 scancurrentchanonly; 759 u8 scancurrentchanonly;
792 int maxchanperscan; 760 int maxchanperscan;
793 int ret; 761 int ret;
762#ifdef CONFIG_LIBERTAS_DEBUG
763 struct bss_descriptor * iter_bss;
764 int i = 0;
765#endif
794 766
795 lbs_deb_enter(LBS_DEB_ASSOC); 767 lbs_deb_enter(LBS_DEB_ASSOC);
796 768
@@ -832,11 +804,16 @@ int wlan_scan_networks(wlan_private * priv,
832 puserscanin, 804 puserscanin,
833 full_scan); 805 full_scan);
834 806
835 /* Process the resulting scan table: 807#ifdef CONFIG_LIBERTAS_DEBUG
836 * - Remove any bad ssids 808 /* Dump the scan table */
837 * - Update our current BSS information from scan data 809 mutex_lock(&adapter->lock);
838 */ 810 list_for_each_entry (iter_bss, &adapter->network_list, list) {
839 wlan_scan_process_results(priv); 811 lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
812 i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
813 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
814 }
815 mutex_unlock(&adapter->lock);
816#endif
840 817
841 if (priv->adapter->connect_status == libertas_connected) { 818 if (priv->adapter->connect_status == libertas_connected) {
842 netif_carrier_on(priv->dev); 819 netif_carrier_on(priv->dev);
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 8939251a2f..f42b796b5e 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -913,148 +913,6 @@ out:
913 return 0; 913 return 0;
914} 914}
915 915
916/*
917 * iwpriv settable callbacks
918 */
919
920static const iw_handler wlan_private_handler[] = {
921 NULL, /* SIOCIWFIRSTPRIV */
922};
923
924static const struct iw_priv_args wlan_private_args[] = {
925 /*
926 * { cmd, set_args, get_args, name }
927 */
928 /* Using iwpriv sub-command feature */
929 {
930 WLAN_SETONEINT_GETNONE, /* IOCTL: 24 */
931 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
932 IW_PRIV_TYPE_NONE,
933 ""},
934 {
935 WLANSETREGION,
936 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
937 IW_PRIV_TYPE_NONE,
938 "setregioncode"},
939 {
940 WLAN_SUBCMD_MESH_SET_TTL,
941 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
942 IW_PRIV_TYPE_NONE,
943 "mesh_set_ttl"},
944 {
945 WLAN_SETNONE_GETONEINT,
946 IW_PRIV_TYPE_NONE,
947 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
948 ""},
949 {
950 WLANGETREGION,
951 IW_PRIV_TYPE_NONE,
952 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
953 "getregioncode"},
954 {
955 WLAN_SUBCMD_FWT_CLEANUP,
956 IW_PRIV_TYPE_NONE,
957 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
958 "fwt_cleanup"},
959 {
960 WLAN_SUBCMD_FWT_TIME,
961 IW_PRIV_TYPE_NONE,
962 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
963 "fwt_time"},
964 {
965 WLAN_SUBCMD_MESH_GET_TTL,
966 IW_PRIV_TYPE_NONE,
967 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
968 "mesh_get_ttl"},
969 {
970 WLAN_SETNONE_GETNONE,
971 IW_PRIV_TYPE_NONE,
972 IW_PRIV_TYPE_NONE,
973 ""},
974 {
975 WLAN_SUBCMD_FWT_RESET,
976 IW_PRIV_TYPE_NONE,
977 IW_PRIV_TYPE_NONE,
978 "fwt_reset"},
979 {
980 WLAN_SUBCMD_BT_RESET,
981 IW_PRIV_TYPE_NONE,
982 IW_PRIV_TYPE_NONE,
983 "bt_reset"},
984 {
985 WLAN_SET128CHAR_GET128CHAR,
986 IW_PRIV_TYPE_CHAR | 128,
987 IW_PRIV_TYPE_CHAR | 128,
988 ""},
989 /* BT Management */
990 {
991 WLAN_SUBCMD_BT_ADD,
992 IW_PRIV_TYPE_CHAR | 128,
993 IW_PRIV_TYPE_CHAR | 128,
994 "bt_add"},
995 {
996 WLAN_SUBCMD_BT_DEL,
997 IW_PRIV_TYPE_CHAR | 128,
998 IW_PRIV_TYPE_CHAR | 128,
999 "bt_del"},
1000 {
1001 WLAN_SUBCMD_BT_LIST,
1002 IW_PRIV_TYPE_CHAR | 128,
1003 IW_PRIV_TYPE_CHAR | 128,
1004 "bt_list"},
1005 {
1006 WLAN_SUBCMD_BT_SET_INVERT,
1007 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1008 IW_PRIV_TYPE_NONE,
1009 "bt_set_invert"},
1010 {
1011 WLAN_SUBCMD_BT_GET_INVERT,
1012 IW_PRIV_TYPE_NONE,
1013 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
1014 "bt_get_invert"},
1015 /* FWT Management */
1016 {
1017 WLAN_SUBCMD_FWT_ADD,
1018 IW_PRIV_TYPE_CHAR | 128,
1019 IW_PRIV_TYPE_CHAR | 128,
1020 "fwt_add"},
1021 {
1022 WLAN_SUBCMD_FWT_DEL,
1023 IW_PRIV_TYPE_CHAR | 128,
1024 IW_PRIV_TYPE_CHAR | 128,
1025 "fwt_del"},
1026 {
1027 WLAN_SUBCMD_FWT_LOOKUP,
1028 IW_PRIV_TYPE_CHAR | 128,
1029 IW_PRIV_TYPE_CHAR | 128,
1030 "fwt_lookup"},
1031 {
1032 WLAN_SUBCMD_FWT_LIST_NEIGHBOR,
1033 IW_PRIV_TYPE_CHAR | 128,
1034 IW_PRIV_TYPE_CHAR | 128,
1035 "fwt_list_neigh"},
1036 {
1037 WLAN_SUBCMD_FWT_LIST,
1038 IW_PRIV_TYPE_CHAR | 128,
1039 IW_PRIV_TYPE_CHAR | 128,
1040 "fwt_list"},
1041 {
1042 WLAN_SUBCMD_FWT_LIST_ROUTE,
1043 IW_PRIV_TYPE_CHAR | 128,
1044 IW_PRIV_TYPE_CHAR | 128,
1045 "fwt_list_route"},
1046 {
1047 WLAN_SET_GET_SIXTEEN_INT,
1048 IW_PRIV_TYPE_INT | 16,
1049 IW_PRIV_TYPE_INT | 16,
1050 ""},
1051 {
1052 WLAN_LED_GPIO_CTRL,
1053 IW_PRIV_TYPE_INT | 16,
1054 IW_PRIV_TYPE_INT | 16,
1055 "ledgpio"},
1056};
1057
1058static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) 916static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1059{ 917{
1060 enum { 918 enum {
@@ -2444,22 +2302,12 @@ static const iw_handler mesh_wlan_handler[] = {
2444}; 2302};
2445struct iw_handler_def libertas_handler_def = { 2303struct iw_handler_def libertas_handler_def = {
2446 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler), 2304 .num_standard = sizeof(wlan_handler) / sizeof(iw_handler),
2447 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
2448 .num_private_args = sizeof(wlan_private_args) /
2449 sizeof(struct iw_priv_args),
2450 .standard = (iw_handler *) wlan_handler, 2305 .standard = (iw_handler *) wlan_handler,
2451 .private = (iw_handler *) wlan_private_handler,
2452 .private_args = (struct iw_priv_args *)wlan_private_args,
2453 .get_wireless_stats = wlan_get_wireless_stats, 2306 .get_wireless_stats = wlan_get_wireless_stats,
2454}; 2307};
2455 2308
2456struct iw_handler_def mesh_handler_def = { 2309struct iw_handler_def mesh_handler_def = {
2457 .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler), 2310 .num_standard = sizeof(mesh_wlan_handler) / sizeof(iw_handler),
2458 .num_private = sizeof(wlan_private_handler) / sizeof(iw_handler),
2459 .num_private_args = sizeof(wlan_private_args) /
2460 sizeof(struct iw_priv_args),
2461 .standard = (iw_handler *) mesh_wlan_handler, 2311 .standard = (iw_handler *) mesh_wlan_handler,
2462 .private = (iw_handler *) wlan_private_handler,
2463 .private_args = (struct iw_priv_args *)wlan_private_args,
2464 .get_wireless_stats = wlan_get_wireless_stats, 2312 .get_wireless_stats = wlan_get_wireless_stats,
2465}; 2313};
diff --git a/drivers/net/wireless/libertas/wext.h b/drivers/net/wireless/libertas/wext.h
index d555056b25..3d5196c955 100644
--- a/drivers/net/wireless/libertas/wext.h
+++ b/drivers/net/wireless/libertas/wext.h
@@ -7,45 +7,6 @@
7#define SUBCMD_OFFSET 4 7#define SUBCMD_OFFSET 4
8#define SUBCMD_DATA(x) *((int *)(x->u.name + SUBCMD_OFFSET)) 8#define SUBCMD_DATA(x) *((int *)(x->u.name + SUBCMD_OFFSET))
9 9
10/** PRIVATE CMD ID */
11#define WLANIOCTL SIOCIWFIRSTPRIV
12
13#define WLAN_SETNONE_GETNONE (WLANIOCTL + 8)
14#define WLAN_SUBCMD_BT_RESET 13
15#define WLAN_SUBCMD_FWT_RESET 14
16
17#define WLAN_SETNONE_GETONEINT (WLANIOCTL + 15)
18#define WLANGETREGION 1
19
20#define WLAN_SUBCMD_FWT_CLEANUP 15
21#define WLAN_SUBCMD_FWT_TIME 16
22#define WLAN_SUBCMD_MESH_GET_TTL 17
23#define WLAN_SUBCMD_BT_GET_INVERT 18
24
25#define WLAN_SETONEINT_GETNONE (WLANIOCTL + 24)
26#define WLANSETREGION 8
27#define WLAN_SUBCMD_MESH_SET_TTL 18
28#define WLAN_SUBCMD_BT_SET_INVERT 19
29
30#define WLAN_SET128CHAR_GET128CHAR (WLANIOCTL + 25)
31#define WLAN_SUBCMD_BT_ADD 18
32#define WLAN_SUBCMD_BT_DEL 19
33#define WLAN_SUBCMD_BT_LIST 20
34#define WLAN_SUBCMD_FWT_ADD 21
35#define WLAN_SUBCMD_FWT_DEL 22
36#define WLAN_SUBCMD_FWT_LOOKUP 23
37#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR 24
38#define WLAN_SUBCMD_FWT_LIST 25
39#define WLAN_SUBCMD_FWT_LIST_ROUTE 26
40
41#define WLAN_SET_GET_SIXTEEN_INT (WLANIOCTL + 29)
42#define WLAN_LED_GPIO_CTRL 5
43
44#define WLAN_LINKMODE_802_3 0
45#define WLAN_LINKMODE_802_11 2
46#define WLAN_RADIOMODE_NONE 0
47#define WLAN_RADIOMODE_RADIOTAP 2
48
49/** wlan_ioctl_regrdwr */ 10/** wlan_ioctl_regrdwr */
50struct wlan_ioctl_regrdwr { 11struct wlan_ioctl_regrdwr {
51 /** Which register to access */ 12 /** Which register to access */
@@ -57,9 +18,13 @@ struct wlan_ioctl_regrdwr {
57 u32 value; 18 u32 value;
58}; 19};
59 20
21#define WLAN_LINKMODE_802_3 0
22#define WLAN_LINKMODE_802_11 2
23#define WLAN_RADIOMODE_NONE 0
24#define WLAN_RADIOMODE_RADIOTAP 2
25
60extern struct iw_handler_def libertas_handler_def; 26extern struct iw_handler_def libertas_handler_def;
61extern struct iw_handler_def mesh_handler_def; 27extern struct iw_handler_def mesh_handler_def;
62int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int i);
63int wlan_radio_ioctl(wlan_private * priv, u8 option); 28int wlan_radio_ioctl(wlan_private * priv, u8 option);
64 29
65#endif /* _WLAN_WEXT_H_ */ 30#endif /* _WLAN_WEXT_H_ */
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 277df50c89..967a8e22b2 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -107,31 +107,61 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
107 return; 107 return;
108} 108}
109 109
110static void quirk_smc_enable(struct pnp_dev *dev) 110static int quirk_smc_fir_enabled(struct pnp_dev *dev)
111{ 111{
112 unsigned int firbase; 112 unsigned long firbase;
113 u8 bank, high, low, chip;
114
115 if (!pnp_port_valid(dev, 1))
116 return 0;
117
118 firbase = pnp_port_start(dev, 1);
119
120 /* Select register bank 3 */
121 bank = inb(firbase + 7);
122 bank &= 0xf0;
123 bank |= 3;
124 outb(bank, firbase + 7);
125
126 high = inb(firbase + 0);
127 low = inb(firbase + 1);
128 chip = inb(firbase + 2);
129
130 /* This corresponds to the check in smsc_ircc_present() */
131 if (high == 0x10 && low == 0xb8 && (chip == 0xf1 || chip == 0xf2))
132 return 1;
133
134 return 0;
135}
113 136
114 if (!dev->active || !pnp_port_valid(dev, 1)) 137static void quirk_smc_enable(struct pnp_dev *dev)
138{
139 /*
140 * If the BIOS left the device disabled, or it is enabled and
141 * responding correctly, we're in good shape.
142 */
143 if (!dev->active || quirk_smc_fir_enabled(dev))
115 return; 144 return;
116 145
117 /* 146 /*
118 * On the HP/Compaq nw8240 (and probably other similar machines), 147 * Sometimes the BIOS claims the device is enabled, but it reports
119 * there is an SMCF010 device with two I/O port regions: 148 * the wrong FIR resources or doesn't properly configure ISA or LPC
120 * 149 * bridges on the way to the device.
121 * 0x3e8-0x3ef SIR
122 * 0x100-0x10f FIR
123 * 150 *
124 * _STA reports the device is enabled, but in fact, the BIOS 151 * HP nc6000 and nc8000/nw8000 laptops have known problems like
125 * neglects to enable the FIR range. Fortunately, it does fully 152 * this. Fortunately, they do fix things up if we auto-configure
126 * enable the device if we call _SRS. 153 * the device using its _PRS and _SRS methods.
127 */ 154 */
128 firbase = pnp_port_start(dev, 1); 155 dev_err(&dev->dev, "%s device not responding, auto-configuring "
129 if (inb(firbase + 0x7 /* IRCC_MASTER */) == 0xff) { 156 "resources\n", dev->id->id);
130 pnp_err("%s (%s) enabled but not responding, disabling and " 157
131 "re-enabling", dev->dev.bus_id, pnp_dev_name(dev)); 158 pnp_disable_dev(dev);
132 pnp_disable_dev(dev); 159 pnp_init_resource_table(&dev->res);
133 pnp_activate_dev(dev); 160 pnp_auto_config_dev(dev);
134 } 161 pnp_activate_dev(dev);
162
163 if (!quirk_smc_fir_enabled(dev))
164 dev_err(&dev->dev, "giving up; try \"smsc-ircc2.nopnp\"\n");
135} 165}
136 166
137 167
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 2b2f5c1201..eb46cb0e3c 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -60,6 +60,7 @@ config BLK_DEV_SD
60 depends on SCSI 60 depends on SCSI
61 ---help--- 61 ---help---
62 If you want to use SCSI hard disks, Fibre Channel disks, 62 If you want to use SCSI hard disks, Fibre Channel disks,
63 Serial ATA (SATA) or Parallel ATA (PATA) hard disks,
63 USB storage or the SCSI or parallel port version of 64 USB storage or the SCSI or parallel port version of
64 the IOMEGA ZIP drive, say Y and read the SCSI-HOWTO, 65 the IOMEGA ZIP drive, say Y and read the SCSI-HOWTO,
65 the Disk-HOWTO and the Multi-Disk-HOWTO, available from 66 the Disk-HOWTO and the Multi-Disk-HOWTO, available from
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index d09f2097d5..00924feaf6 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -503,7 +503,8 @@ mpsc_sdma_intr_ack(struct mpsc_port_info *pi)
503 503
504 if (pi->mirror_regs) 504 if (pi->mirror_regs)
505 pi->shared_regs->SDMA_INTR_CAUSE_m = 0; 505 pi->shared_regs->SDMA_INTR_CAUSE_m = 0;
506 writel(0, pi->shared_regs->sdma_intr_base + SDMA_INTR_CAUSE); 506 writeb(0x00, pi->shared_regs->sdma_intr_base + SDMA_INTR_CAUSE +
507 pi->port.line);
507 return; 508 return;
508} 509}
509 510
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 8d3455da66..2fbff63174 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2290,15 +2290,6 @@ static int __devinit aty_init(struct fb_info *info)
2290 init_waitqueue_head(&par->vblank.wait); 2290 init_waitqueue_head(&par->vblank.wait);
2291 spin_lock_init(&par->int_lock); 2291 spin_lock_init(&par->int_lock);
2292 2292
2293#ifdef CONFIG_PPC_PMAC
2294 /* The Apple iBook1 uses non-standard memory frequencies. We detect it
2295 * and set the frequency manually. */
2296 if (machine_is_compatible("PowerBook2,1")) {
2297 par->pll_limits.mclk = 70;
2298 par->pll_limits.xclk = 53;
2299 }
2300#endif
2301
2302#ifdef CONFIG_FB_ATY_GX 2293#ifdef CONFIG_FB_ATY_GX
2303 if (!M64_HAS(INTEGRATED)) { 2294 if (!M64_HAS(INTEGRATED)) {
2304 u32 stat0; 2295 u32 stat0;
@@ -2383,6 +2374,14 @@ static int __devinit aty_init(struct fb_info *info)
2383 par->pll_limits.xclk = (par->pll_limits.xclk + 1) >> 1; 2374 par->pll_limits.xclk = (par->pll_limits.xclk + 1) >> 1;
2384 } 2375 }
2385#endif 2376#endif
2377#ifdef CONFIG_PPC_PMAC
2378 /* The Apple iBook1 uses non-standard memory frequencies. We detect it
2379 * and set the frequency manually. */
2380 if (machine_is_compatible("PowerBook2,1")) {
2381 par->pll_limits.mclk = 70;
2382 par->pll_limits.xclk = 53;
2383 }
2384#endif
2386 2385
2387 /* Allow command line to override clocks. */ 2386 /* Allow command line to override clocks. */
2388 if (pll) 2387 if (pll)
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index af313bf1a2..f48e8c534c 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -292,7 +292,7 @@ static void __init chips_hw_init(void)
292 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); 292 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data);
293} 293}
294 294
295static struct fb_fix_screeninfo chipsfb_fix __initdata = { 295static struct fb_fix_screeninfo chipsfb_fix __devinitdata = {
296 .id = "C&T 65550", 296 .id = "C&T 65550",
297 .type = FB_TYPE_PACKED_PIXELS, 297 .type = FB_TYPE_PACKED_PIXELS,
298 .visual = FB_VISUAL_PSEUDOCOLOR, 298 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -309,7 +309,7 @@ static struct fb_fix_screeninfo chipsfb_fix __initdata = {
309 .smem_len = 0x100000, /* 1MB */ 309 .smem_len = 0x100000, /* 1MB */
310}; 310};
311 311
312static struct fb_var_screeninfo chipsfb_var __initdata = { 312static struct fb_var_screeninfo chipsfb_var __devinitdata = {
313 .xres = 800, 313 .xres = 800,
314 .yres = 600, 314 .yres = 600,
315 .xres_virtual = 800, 315 .xres_virtual = 800,
@@ -330,7 +330,7 @@ static struct fb_var_screeninfo chipsfb_var __initdata = {
330 .vsync_len = 8, 330 .vsync_len = 8,
331}; 331};
332 332
333static void __init init_chips(struct fb_info *p, unsigned long addr) 333static void __devinit init_chips(struct fb_info *p, unsigned long addr)
334{ 334{
335 memset(p->screen_base, 0, 0x100000); 335 memset(p->screen_base, 0, 0x100000);
336 336
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 732db47800..1a6937dc19 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -191,11 +191,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj, char *buf, loff_t off, si
191 191
192 w1_write_8(dev, W1_CONVERT_TEMP); 192 w1_write_8(dev, W1_CONVERT_TEMP);
193 193
194 while (tm) { 194 msleep(tm);
195 tm = msleep_interruptible(tm);
196 if (signal_pending(current))
197 flush_signals(current);
198 }
199 195
200 if (!w1_reset_select_slave(sl)) { 196 if (!w1_reset_select_slave(sl)) {
201 197
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 8593f3dfd2..52bb2638f7 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1106,7 +1106,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
1106 spin_lock_irqsave(&dio->bio_lock, flags); 1106 spin_lock_irqsave(&dio->bio_lock, flags);
1107 ret2 = --dio->refcount; 1107 ret2 = --dio->refcount;
1108 spin_unlock_irqrestore(&dio->bio_lock, flags); 1108 spin_unlock_irqrestore(&dio->bio_lock, flags);
1109 BUG_ON(!dio->is_async && ret2 != 0); 1109
1110 if (ret2 == 0) { 1110 if (ret2 == 0) {
1111 ret = dio_complete(dio, offset, ret); 1111 ret = dio_complete(dio, offset, ret);
1112 kfree(dio); 1112 kfree(dio);
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 403e3bad14..1b9dd9a96f 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -580,5 +580,7 @@ void
580ecryptfs_write_header_metadata(char *virt, 580ecryptfs_write_header_metadata(char *virt,
581 struct ecryptfs_crypt_stat *crypt_stat, 581 struct ecryptfs_crypt_stat *crypt_stat,
582 size_t *written); 582 size_t *written);
583int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start,
584 int num_zeros);
583 585
584#endif /* #ifndef ECRYPTFS_KERNEL_H */ 586#endif /* #ifndef ECRYPTFS_KERNEL_H */
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 1548be26b5..83e94fedd4 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -800,6 +800,25 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
800 goto out_fput; 800 goto out_fput;
801 } 801 }
802 } else { /* new_length < i_size_read(inode) */ 802 } else { /* new_length < i_size_read(inode) */
803 pgoff_t index = 0;
804 int end_pos_in_page = -1;
805
806 if (new_length != 0) {
807 index = ((new_length - 1) >> PAGE_CACHE_SHIFT);
808 end_pos_in_page = ((new_length - 1) & ~PAGE_CACHE_MASK);
809 }
810 if (end_pos_in_page != (PAGE_CACHE_SIZE - 1)) {
811 if ((rc = ecryptfs_write_zeros(&fake_ecryptfs_file,
812 index,
813 (end_pos_in_page + 1),
814 ((PAGE_CACHE_SIZE - 1)
815 - end_pos_in_page)))) {
816 printk(KERN_ERR "Error attempting to zero out "
817 "the remainder of the end page on "
818 "reducing truncate; rc = [%d]\n", rc);
819 goto out_fput;
820 }
821 }
803 vmtruncate(inode, new_length); 822 vmtruncate(inode, new_length);
804 rc = ecryptfs_write_inode_size_to_metadata( 823 rc = ecryptfs_write_inode_size_to_metadata(
805 lower_file, lower_dentry->d_inode, inode, dentry, 824 lower_file, lower_dentry->d_inode, inode, dentry,
@@ -875,9 +894,54 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
875 struct ecryptfs_crypt_stat *crypt_stat; 894 struct ecryptfs_crypt_stat *crypt_stat;
876 895
877 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; 896 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat;
878 lower_dentry = ecryptfs_dentry_to_lower(dentry); 897 if (!(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED))
898 ecryptfs_init_crypt_stat(crypt_stat);
879 inode = dentry->d_inode; 899 inode = dentry->d_inode;
880 lower_inode = ecryptfs_inode_to_lower(inode); 900 lower_inode = ecryptfs_inode_to_lower(inode);
901 lower_dentry = ecryptfs_dentry_to_lower(dentry);
902 mutex_lock(&crypt_stat->cs_mutex);
903 if (S_ISDIR(dentry->d_inode->i_mode))
904 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
905 else if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)
906 || !(crypt_stat->flags & ECRYPTFS_KEY_VALID)) {
907 struct vfsmount *lower_mnt;
908 struct file *lower_file = NULL;
909 struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
910 int lower_flags;
911
912 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
913 lower_flags = O_RDONLY;
914 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry,
915 lower_mnt, lower_flags))) {
916 printk(KERN_ERR
917 "Error opening lower file; rc = [%d]\n", rc);
918 mutex_unlock(&crypt_stat->cs_mutex);
919 goto out;
920 }
921 mount_crypt_stat = &ecryptfs_superblock_to_private(
922 dentry->d_sb)->mount_crypt_stat;
923 if ((rc = ecryptfs_read_metadata(dentry, lower_file))) {
924 if (!(mount_crypt_stat->flags
925 & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) {
926 rc = -EIO;
927 printk(KERN_WARNING "Attempt to read file that "
928 "is not in a valid eCryptfs format, "
929 "and plaintext passthrough mode is not "
930 "enabled; returning -EIO\n");
931
932 mutex_unlock(&crypt_stat->cs_mutex);
933 fput(lower_file);
934 goto out;
935 }
936 rc = 0;
937 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
938 mutex_unlock(&crypt_stat->cs_mutex);
939 fput(lower_file);
940 goto out;
941 }
942 fput(lower_file);
943 }
944 mutex_unlock(&crypt_stat->cs_mutex);
881 if (ia->ia_valid & ATTR_SIZE) { 945 if (ia->ia_valid & ATTR_SIZE) {
882 ecryptfs_printk(KERN_DEBUG, 946 ecryptfs_printk(KERN_DEBUG,
883 "ia->ia_valid = [0x%x] ATTR_SIZE" " = [0x%x]\n", 947 "ia->ia_valid = [0x%x] ATTR_SIZE" " = [0x%x]\n",
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 55cec98a84..7d5a43cb0d 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -56,9 +56,6 @@ static struct page *ecryptfs_get1page(struct file *file, int index)
56 return read_mapping_page(mapping, index, (void *)file); 56 return read_mapping_page(mapping, index, (void *)file);
57} 57}
58 58
59static
60int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros);
61
62/** 59/**
63 * ecryptfs_fill_zeros 60 * ecryptfs_fill_zeros
64 * @file: The ecryptfs file 61 * @file: The ecryptfs file
@@ -101,10 +98,13 @@ int ecryptfs_fill_zeros(struct file *file, loff_t new_length)
101 if (old_end_page_index == new_end_page_index) { 98 if (old_end_page_index == new_end_page_index) {
102 /* Start and end are in the same page; we just need to 99 /* Start and end are in the same page; we just need to
103 * set a portion of the existing page to zero's */ 100 * set a portion of the existing page to zero's */
104 rc = write_zeros(file, index, (old_end_pos_in_page + 1), 101 rc = ecryptfs_write_zeros(file, index,
105 (new_end_pos_in_page - old_end_pos_in_page)); 102 (old_end_pos_in_page + 1),
103 (new_end_pos_in_page
104 - old_end_pos_in_page));
106 if (rc) 105 if (rc)
107 ecryptfs_printk(KERN_ERR, "write_zeros(file=[%p], " 106 ecryptfs_printk(KERN_ERR, "ecryptfs_write_zeros("
107 "file=[%p], "
108 "index=[0x%.16x], " 108 "index=[0x%.16x], "
109 "old_end_pos_in_page=[d], " 109 "old_end_pos_in_page=[d], "
110 "(PAGE_CACHE_SIZE - new_end_pos_in_page" 110 "(PAGE_CACHE_SIZE - new_end_pos_in_page"
@@ -117,10 +117,10 @@ int ecryptfs_fill_zeros(struct file *file, loff_t new_length)
117 goto out; 117 goto out;
118 } 118 }
119 /* Fill the remainder of the previous last page with zeros */ 119 /* Fill the remainder of the previous last page with zeros */
120 rc = write_zeros(file, index, (old_end_pos_in_page + 1), 120 rc = ecryptfs_write_zeros(file, index, (old_end_pos_in_page + 1),
121 ((PAGE_CACHE_SIZE - 1) - old_end_pos_in_page)); 121 ((PAGE_CACHE_SIZE - 1) - old_end_pos_in_page));
122 if (rc) { 122 if (rc) {
123 ecryptfs_printk(KERN_ERR, "write_zeros(file=[%p], " 123 ecryptfs_printk(KERN_ERR, "ecryptfs_write_zeros(file=[%p], "
124 "index=[0x%.16x], old_end_pos_in_page=[d], " 124 "index=[0x%.16x], old_end_pos_in_page=[d], "
125 "(PAGE_CACHE_SIZE - old_end_pos_in_page)=[d]) " 125 "(PAGE_CACHE_SIZE - old_end_pos_in_page)=[d]) "
126 "returned [%d]\n", file, index, 126 "returned [%d]\n", file, index,
@@ -131,9 +131,10 @@ int ecryptfs_fill_zeros(struct file *file, loff_t new_length)
131 index++; 131 index++;
132 while (index < new_end_page_index) { 132 while (index < new_end_page_index) {
133 /* Fill all intermediate pages with zeros */ 133 /* Fill all intermediate pages with zeros */
134 rc = write_zeros(file, index, 0, PAGE_CACHE_SIZE); 134 rc = ecryptfs_write_zeros(file, index, 0, PAGE_CACHE_SIZE);
135 if (rc) { 135 if (rc) {
136 ecryptfs_printk(KERN_ERR, "write_zeros(file=[%p], " 136 ecryptfs_printk(KERN_ERR, "ecryptfs_write_zeros("
137 "file=[%p], "
137 "index=[0x%.16x], " 138 "index=[0x%.16x], "
138 "old_end_pos_in_page=[d], " 139 "old_end_pos_in_page=[d], "
139 "(PAGE_CACHE_SIZE - new_end_pos_in_page" 140 "(PAGE_CACHE_SIZE - new_end_pos_in_page"
@@ -149,9 +150,9 @@ int ecryptfs_fill_zeros(struct file *file, loff_t new_length)
149 } 150 }
150 /* Fill the portion at the beginning of the last new page with 151 /* Fill the portion at the beginning of the last new page with
151 * zero's */ 152 * zero's */
152 rc = write_zeros(file, index, 0, (new_end_pos_in_page + 1)); 153 rc = ecryptfs_write_zeros(file, index, 0, (new_end_pos_in_page + 1));
153 if (rc) { 154 if (rc) {
154 ecryptfs_printk(KERN_ERR, "write_zeros(file=" 155 ecryptfs_printk(KERN_ERR, "ecryptfs_write_zeros(file="
155 "[%p], index=[0x%.16x], 0, " 156 "[%p], index=[0x%.16x], 0, "
156 "new_end_pos_in_page=[%d]" 157 "new_end_pos_in_page=[%d]"
157 "returned [%d]\n", file, index, 158 "returned [%d]\n", file, index,
@@ -400,7 +401,6 @@ out:
400static int ecryptfs_prepare_write(struct file *file, struct page *page, 401static int ecryptfs_prepare_write(struct file *file, struct page *page,
401 unsigned from, unsigned to) 402 unsigned from, unsigned to)
402{ 403{
403 loff_t pos;
404 int rc = 0; 404 int rc = 0;
405 405
406 if (from == 0 && to == PAGE_CACHE_SIZE) 406 if (from == 0 && to == PAGE_CACHE_SIZE)
@@ -408,15 +408,22 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page,
408 up to date. */ 408 up to date. */
409 if (!PageUptodate(page)) 409 if (!PageUptodate(page))
410 rc = ecryptfs_do_readpage(file, page, page->index); 410 rc = ecryptfs_do_readpage(file, page, page->index);
411 pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; 411 if (page->index != 0) {
412 if (pos > i_size_read(page->mapping->host)) { 412 loff_t end_of_prev_pg_pos =
413 rc = ecryptfs_truncate(file->f_path.dentry, pos); 413 (((loff_t)page->index << PAGE_CACHE_SHIFT) - 1);
414 if (rc) { 414
415 printk(KERN_ERR "Error on attempt to " 415 if (end_of_prev_pg_pos > i_size_read(page->mapping->host)) {
416 "truncate to (higher) offset [%lld];" 416 rc = ecryptfs_truncate(file->f_path.dentry,
417 " rc = [%d]\n", pos, rc); 417 end_of_prev_pg_pos);
418 goto out; 418 if (rc) {
419 printk(KERN_ERR "Error on attempt to "
420 "truncate to (higher) offset [%lld];"
421 " rc = [%d]\n", end_of_prev_pg_pos, rc);
422 goto out;
423 }
419 } 424 }
425 if (end_of_prev_pg_pos + 1 > i_size_read(page->mapping->host))
426 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
420 } 427 }
421out: 428out:
422 return rc; 429 return rc;
@@ -753,7 +760,7 @@ out:
753} 760}
754 761
755/** 762/**
756 * write_zeros 763 * ecryptfs_write_zeros
757 * @file: The ecryptfs file 764 * @file: The ecryptfs file
758 * @index: The index in which we are writing 765 * @index: The index in which we are writing
759 * @start: The position after the last block of data 766 * @start: The position after the last block of data
@@ -763,8 +770,8 @@ out:
763 * 770 *
764 * (start + num_zeros) must be less than or equal to PAGE_CACHE_SIZE 771 * (start + num_zeros) must be less than or equal to PAGE_CACHE_SIZE
765 */ 772 */
766static 773int
767int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros) 774ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
768{ 775{
769 int rc = 0; 776 int rc = 0;
770 struct page *tmp_page; 777 struct page *tmp_page;
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index c9fd8cf6ea..5de5061eb3 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1043,6 +1043,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1043 1043
1044 if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) { 1044 if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) {
1045 printk("XIP: Unsupported blocksize\n"); 1045 printk("XIP: Unsupported blocksize\n");
1046 err = -EINVAL;
1046 goto restore_opts; 1047 goto restore_opts;
1047 } 1048 }
1048 1049
diff --git a/fs/signalfd.c b/fs/signalfd.c
index f1da89203a..3b07f26d98 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -133,7 +133,8 @@ static unsigned int signalfd_poll(struct file *file, poll_table *wait)
133 * the peer disconnects. 133 * the peer disconnects.
134 */ 134 */
135 if (signalfd_lock(ctx, &lk)) { 135 if (signalfd_lock(ctx, &lk)) {
136 if (next_signal(&lk.tsk->pending, &ctx->sigmask) > 0 || 136 if ((lk.tsk == current &&
137 next_signal(&lk.tsk->pending, &ctx->sigmask) > 0) ||
137 next_signal(&lk.tsk->signal->shared_pending, 138 next_signal(&lk.tsk->signal->shared_pending,
138 &ctx->sigmask) > 0) 139 &ctx->sigmask) > 0)
139 events |= POLLIN; 140 events |= POLLIN;
diff --git a/fs/sync.c b/fs/sync.c
index 2f97576355..7cd005ea76 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -236,6 +236,14 @@ out:
236 return ret; 236 return ret;
237} 237}
238 238
239/* It would be nice if people remember that not all the world's an i386
240 when they introduce new system calls */
241asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
242 loff_t offset, loff_t nbytes)
243{
244 return sys_sync_file_range(fd, offset, nbytes, flags);
245}
246
239/* 247/*
240 * `endbyte' is inclusive 248 * `endbyte' is inclusive
241 */ 249 */
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 250d7f145a..bfdbebebdc 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -367,6 +367,7 @@
367#define __NR_get_robust_list (__NR_SYSCALL_BASE+339) 367#define __NR_get_robust_list (__NR_SYSCALL_BASE+339)
368#define __NR_splice (__NR_SYSCALL_BASE+340) 368#define __NR_splice (__NR_SYSCALL_BASE+340)
369#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341) 369#define __NR_arm_sync_file_range (__NR_SYSCALL_BASE+341)
370#define __NR_sync_file_range2 __NR_arm_sync_file_range
370#define __NR_tee (__NR_SYSCALL_BASE+342) 371#define __NR_tee (__NR_SYSCALL_BASE+342)
371#define __NR_vmsplice (__NR_SYSCALL_BASE+343) 372#define __NR_vmsplice (__NR_SYSCALL_BASE+343)
372#define __NR_move_pages (__NR_SYSCALL_BASE+344) 373#define __NR_move_pages (__NR_SYSCALL_BASE+344)
diff --git a/include/asm-blackfin/macros.h b/include/asm-blackfin/macros.h
deleted file mode 100644
index e69de29bb2..0000000000
--- a/include/asm-blackfin/macros.h
+++ /dev/null
diff --git a/include/asm-blackfin/processor.h b/include/asm-blackfin/processor.h
index aba2b30a8e..6bb3e0d470 100644
--- a/include/asm-blackfin/processor.h
+++ b/include/asm-blackfin/processor.h
@@ -124,6 +124,10 @@ static inline __attribute_pure__ uint32_t bfin_compiled_revid(void)
124 return 4; 124 return 4;
125#elif defined(CONFIG_BF_REV_0_5) 125#elif defined(CONFIG_BF_REV_0_5)
126 return 5; 126 return 5;
127#elif defined(CONFIG_BF_REV_ANY)
128 return 0xffff;
129#else
130 return -1;
127#endif 131#endif
128} 132}
129 133
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 2687c77151..114aefae27 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -25,7 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28struct mm_struct; 28#include <linux/sched.h>
29struct vm_area_struct; 29struct vm_area_struct;
30#endif 30#endif
31 31
diff --git a/include/asm-mips/mach-ip32/dma-coherence.h b/include/asm-mips/mach-ip32/dma-coherence.h
index c3f9a6a20e..a5511ebb2d 100644
--- a/include/asm-mips/mach-ip32/dma-coherence.h
+++ b/include/asm-mips/mach-ip32/dma-coherence.h
@@ -6,8 +6,8 @@
6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org> 6 * Copyright (C) 2006 Ralf Baechle <ralf@linux-mips.org>
7 * 7 *
8 */ 8 */
9#ifndef __ASM_MACH_IP35_DMA_COHERENCE_H 9#ifndef __ASM_MACH_IP32_DMA_COHERENCE_H
10#define __ASM_MACH_IP35_DMA_COHERENCE_H 10#define __ASM_MACH_IP32_DMA_COHERENCE_H
11 11
12#include <asm/ip32/crime.h> 12#include <asm/ip32/crime.h>
13 13
@@ -69,4 +69,4 @@ static inline int plat_device_is_coherent(struct device *dev)
69 return 0; /* IP32 is non-cohernet */ 69 return 0; /* IP32 is non-cohernet */
70} 70}
71 71
72#endif /* __ASM_MACH_IP35_DMA_COHERENCE_H */ 72#endif /* __ASM_MACH_IP32_DMA_COHERENCE_H */
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 1906938285..85b4436634 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -86,7 +86,7 @@ struct pt_regs {
86 86
87extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); 87extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
88 88
89extern NORET_TYPE void die(const char *, struct pt_regs *); 89extern NORET_TYPE void die(const char *, struct pt_regs *) ATTRIB_NORET;
90 90
91static inline void die_if_kernel(const char *str, struct pt_regs *regs) 91static inline void die_if_kernel(const char *str, struct pt_regs *regs)
92{ 92{
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 59d6fec8fb..ed16de0a63 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -977,6 +977,22 @@
977# define __ARCH_WANT_COMPAT_SYS_TIME 977# define __ARCH_WANT_COMPAT_SYS_TIME
978# endif 978# endif
979 979
980/* whitelists for checksyscalls */
981#define __IGNORE_select
982#define __IGNORE_vfork
983#define __IGNORE_time
984#define __IGNORE_uselib
985#define __IGNORE_fadvise64_64
986#define __IGNORE_getdents64
987#if _MIPS_SIM == _MIPS_SIM_NABI32
988#define __IGNORE_truncate64
989#define __IGNORE_ftruncate64
990#define __IGNORE_stat64
991#define __IGNORE_lstat64
992#define __IGNORE_fstat64
993#define __IGNORE_fstatat64
994#endif
995
980#endif /* !__ASSEMBLY__ */ 996#endif /* !__ASSEMBLY__ */
981 997
982/* 998/*
diff --git a/include/asm-powerpc/systbl.h b/include/asm-powerpc/systbl.h
index 700ca59287..1cc3f9cb6f 100644
--- a/include/asm-powerpc/systbl.h
+++ b/include/asm-powerpc/systbl.h
@@ -311,3 +311,4 @@ COMPAT_SYS_SPU(utimensat)
311COMPAT_SYS_SPU(signalfd) 311COMPAT_SYS_SPU(signalfd)
312COMPAT_SYS_SPU(timerfd) 312COMPAT_SYS_SPU(timerfd)
313SYSCALL_SPU(eventfd) 313SYSCALL_SPU(eventfd)
314COMPAT_SYS_SPU(sync_file_range2)
diff --git a/include/asm-powerpc/unistd.h b/include/asm-powerpc/unistd.h
index e3c28dc31a..f71c6061f1 100644
--- a/include/asm-powerpc/unistd.h
+++ b/include/asm-powerpc/unistd.h
@@ -330,10 +330,11 @@
330#define __NR_signalfd 305 330#define __NR_signalfd 305
331#define __NR_timerfd 306 331#define __NR_timerfd 306
332#define __NR_eventfd 307 332#define __NR_eventfd 307
333#define __NR_sync_file_range2 308
333 334
334#ifdef __KERNEL__ 335#ifdef __KERNEL__
335 336
336#define __NR_syscalls 308 337#define __NR_syscalls 309
337 338
338#define __NR__exit __NR_exit 339#define __NR__exit __NR_exit
339#define NR_syscalls __NR_syscalls 340#define NR_syscalls __NR_syscalls
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h
index 124eb8ca23..c6383982b5 100644
--- a/include/asm-sparc64/mdesc.h
+++ b/include/asm-sparc64/mdesc.h
@@ -15,6 +15,7 @@ struct mdesc_node {
15 u64 node; 15 u64 node;
16 unsigned int unique_id; 16 unsigned int unique_id;
17 unsigned int num_arcs; 17 unsigned int num_arcs;
18 unsigned int irqs[2];
18 struct property *properties; 19 struct property *properties;
19 struct mdesc_node *hash_next; 20 struct mdesc_node *hash_next;
20 struct mdesc_node *allnodes_next; 21 struct mdesc_node *allnodes_next;
diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h
index 7af1e1109c..349d1d3e9c 100644
--- a/include/asm-sparc64/tlb.h
+++ b/include/asm-sparc64/tlb.h
@@ -2,6 +2,7 @@
2#define _SPARC64_TLB_H 2#define _SPARC64_TLB_H
3 3
4#include <linux/swap.h> 4#include <linux/swap.h>
5#include <linux/pagemap.h>
5#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
6#include <asm/tlbflush.h> 7#include <asm/tlbflush.h>
7#include <asm/mmu_context.h> 8#include <asm/mmu_context.h>
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 0d6ecc60b9..b489fc6d0b 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -19,7 +19,8 @@ int eventfd_signal(struct file *file, int n);
19#else /* CONFIG_EVENTFD */ 19#else /* CONFIG_EVENTFD */
20 20
21#define eventfd_fget(fd) ERR_PTR(-ENOSYS) 21#define eventfd_fget(fd) ERR_PTR(-ENOSYS)
22#define eventfd_signal(f, n) 0 22static inline int eventfd_signal(struct file *file, int n)
23{ return 0; }
23 24
24#endif /* CONFIG_EVENTFD */ 25#endif /* CONFIG_EVENTFD */
25 26
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fbf3766dac..086a0e5a63 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -748,6 +748,17 @@ static inline void pci_release_regions(struct pci_dev *dev) { }
748static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } 748static inline void pci_block_user_cfg_access(struct pci_dev *dev) { }
749static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { } 749static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { }
750 750
751static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
752{ return NULL; }
753
754static inline struct pci_dev *pci_get_slot(struct pci_bus *bus,
755 unsigned int devfn)
756{ return NULL; }
757
758static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
759 unsigned int devfn)
760{ return NULL; }
761
751#endif /* CONFIG_PCI */ 762#endif /* CONFIG_PCI */
752 763
753/* Include architecture-dependent settings and functions */ 764/* Include architecture-dependent settings and functions */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 87545e0f0b..b2c4fde4e9 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -110,37 +110,67 @@ typedef int __bitwise suspend_state_t;
110#define PM_SUSPEND_MAX ((__force suspend_state_t) 4) 110#define PM_SUSPEND_MAX ((__force suspend_state_t) 4)
111 111
112/** 112/**
113 * struct pm_ops - Callbacks for managing platform dependent suspend states. 113 * struct pm_ops - Callbacks for managing platform dependent system sleep
114 * @valid: Callback to determine whether the given state can be entered. 114 * states.
115 * Valid states are advertised in /sys/power/state but can still
116 * be rejected by prepare or enter if the conditions aren't right.
117 * There is a %pm_valid_only_mem function available that can be assigned
118 * to this if you only implement mem sleep.
119 * 115 *
120 * @prepare: Prepare the platform for the given suspend state. Can return a 116 * @valid: Callback to determine if given system sleep state is supported by
121 * negative error code if necessary. 117 * the platform.
118 * Valid (ie. supported) states are advertised in /sys/power/state. Note
119 * that it still may be impossible to enter given system sleep state if the
120 * conditions aren't right.
121 * There is the %pm_valid_only_mem function available that can be assigned
122 * to this if the platform only supports mem sleep.
122 * 123 *
123 * @enter: Enter the given suspend state, must be assigned. Can return a 124 * @set_target: Tell the platform which system sleep state is going to be
124 * negative error code if necessary. 125 * entered.
126 * @set_target() is executed right prior to suspending devices. The
127 * information conveyed to the platform code by @set_target() should be
128 * disregarded by the platform as soon as @finish() is executed and if
129 * @prepare() fails. If @set_target() fails (ie. returns nonzero),
130 * @prepare(), @enter() and @finish() will not be called by the PM core.
131 * This callback is optional. However, if it is implemented, the argument
132 * passed to @prepare(), @enter() and @finish() is meaningless and should
133 * be ignored.
125 * 134 *
126 * @finish: Called when the system has left the given state and all devices 135 * @prepare: Prepare the platform for entering the system sleep state indicated
127 * are resumed. The return value is ignored. 136 * by @set_target() or represented by the argument if @set_target() is not
137 * implemented.
138 * @prepare() is called right after devices have been suspended (ie. the
139 * appropriate .suspend() method has been executed for each device) and
140 * before the nonboot CPUs are disabled (it is executed with IRQs enabled).
141 * This callback is optional. It returns 0 on success or a negative
142 * error code otherwise, in which case the system cannot enter the desired
143 * sleep state (@enter() and @finish() will not be called in that case).
144 *
145 * @enter: Enter the system sleep state indicated by @set_target() or
146 * represented by the argument if @set_target() is not implemented.
147 * This callback is mandatory. It returns 0 on success or a negative
148 * error code otherwise, in which case the system cannot enter the desired
149 * sleep state.
150 *
151 * @finish: Called when the system has just left a sleep state, right after
152 * the nonboot CPUs have been enabled and before devices are resumed (it is
153 * executed with IRQs enabled). If @set_target() is not implemented, the
154 * argument represents the sleep state being left.
155 * This callback is optional, but should be implemented by the platforms
156 * that implement @prepare(). If implemented, it is always called after
157 * @enter() (even if @enter() fails).
128 */ 158 */
129struct pm_ops { 159struct pm_ops {
130 int (*valid)(suspend_state_t state); 160 int (*valid)(suspend_state_t state);
161 int (*set_target)(suspend_state_t state);
131 int (*prepare)(suspend_state_t state); 162 int (*prepare)(suspend_state_t state);
132 int (*enter)(suspend_state_t state); 163 int (*enter)(suspend_state_t state);
133 int (*finish)(suspend_state_t state); 164 int (*finish)(suspend_state_t state);
134}; 165};
135 166
167extern struct pm_ops *pm_ops;
168
136/** 169/**
137 * pm_set_ops - set platform dependent power management ops 170 * pm_set_ops - set platform dependent power management ops
138 * @pm_ops: The new power management operations to set. 171 * @pm_ops: The new power management operations to set.
139 */ 172 */
140extern void pm_set_ops(struct pm_ops *pm_ops); 173extern void pm_set_ops(struct pm_ops *pm_ops);
141extern struct pm_ops *pm_ops;
142extern int pm_suspend(suspend_state_t state);
143
144extern int pm_valid_only_mem(suspend_state_t state); 174extern int pm_valid_only_mem(suspend_state_t state);
145 175
146/** 176/**
@@ -161,6 +191,8 @@ extern void arch_suspend_disable_irqs(void);
161 */ 191 */
162extern void arch_suspend_enable_irqs(void); 192extern void arch_suspend_enable_irqs(void);
163 193
194extern int pm_suspend(suspend_state_t state);
195
164/* 196/*
165 * Device power management 197 * Device power management
166 */ 198 */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index b02070eac4..83d0ec1123 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -598,6 +598,8 @@ asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
598 598
599asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, 599asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
600 unsigned int flags); 600 unsigned int flags);
601asmlinkage long sys_sync_file_range2(int fd, unsigned int flags,
602 loff_t offset, loff_t nbytes);
601asmlinkage long sys_get_robust_list(int pid, 603asmlinkage long sys_get_robust_list(int pid,
602 struct robust_list_head __user * __user *head_ptr, 604 struct robust_list_head __user * __user *head_ptr,
603 size_t __user *len_ptr); 605 size_t __user *len_ptr);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 8812985f30..fc45ed2262 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -15,7 +15,6 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/pm.h>
19#include <linux/console.h> 18#include <linux/console.h>
20#include <linux/cpu.h> 19#include <linux/cpu.h>
21#include <linux/resume-trace.h> 20#include <linux/resume-trace.h>
@@ -97,6 +96,11 @@ static int suspend_prepare(suspend_state_t state)
97 } 96 }
98 } 97 }
99 98
99 if (pm_ops->set_target) {
100 error = pm_ops->set_target(state);
101 if (error)
102 goto Thaw;
103 }
100 suspend_console(); 104 suspend_console();
101 error = device_suspend(PMSG_SUSPEND); 105 error = device_suspend(PMSG_SUSPEND);
102 if (error) { 106 if (error) {
diff --git a/kernel/relay.c b/kernel/relay.c
index 4311101b0c..95db8c79fe 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -812,7 +812,10 @@ static void relay_file_read_consume(struct rchan_buf *buf,
812 } 812 }
813 813
814 buf->bytes_consumed += bytes_consumed; 814 buf->bytes_consumed += bytes_consumed;
815 read_subbuf = read_pos / buf->chan->subbuf_size; 815 if (!read_pos)
816 read_subbuf = buf->subbufs_consumed % n_subbufs;
817 else
818 read_subbuf = read_pos / buf->chan->subbuf_size;
816 if (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) { 819 if (buf->bytes_consumed + buf->padding[read_subbuf] == subbuf_size) {
817 if ((read_subbuf == buf->subbufs_produced % n_subbufs) && 820 if ((read_subbuf == buf->subbufs_produced % n_subbufs) &&
818 (buf->offset == subbuf_size)) 821 (buf->offset == subbuf_size))
@@ -841,8 +844,9 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
841 } 844 }
842 845
843 if (unlikely(produced - consumed >= n_subbufs)) { 846 if (unlikely(produced - consumed >= n_subbufs)) {
844 consumed = (produced / n_subbufs) * n_subbufs; 847 consumed = produced - n_subbufs + 1;
845 buf->subbufs_consumed = consumed; 848 buf->subbufs_consumed = consumed;
849 buf->bytes_consumed = 0;
846 } 850 }
847 851
848 produced = (produced % n_subbufs) * subbuf_size + buf->offset; 852 produced = (produced % n_subbufs) * subbuf_size + buf->offset;
@@ -899,7 +903,10 @@ static size_t relay_file_read_start_pos(size_t read_pos,
899 size_t read_subbuf, padding, padding_start, padding_end; 903 size_t read_subbuf, padding, padding_start, padding_end;
900 size_t subbuf_size = buf->chan->subbuf_size; 904 size_t subbuf_size = buf->chan->subbuf_size;
901 size_t n_subbufs = buf->chan->n_subbufs; 905 size_t n_subbufs = buf->chan->n_subbufs;
906 size_t consumed = buf->subbufs_consumed % n_subbufs;
902 907
908 if (!read_pos)
909 read_pos = consumed * subbuf_size + buf->bytes_consumed;
903 read_subbuf = read_pos / subbuf_size; 910 read_subbuf = read_pos / subbuf_size;
904 padding = buf->padding[read_subbuf]; 911 padding = buf->padding[read_subbuf];
905 padding_start = (read_subbuf + 1) * subbuf_size - padding; 912 padding_start = (read_subbuf + 1) * subbuf_size - padding;
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 87aa5ff931..cf53bb5814 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -122,7 +122,6 @@ void second_overflow(void)
122 */ 122 */
123 time_interpolator_update(-NSEC_PER_SEC); 123 time_interpolator_update(-NSEC_PER_SEC);
124 time_state = TIME_OOP; 124 time_state = TIME_OOP;
125 clock_was_set();
126 printk(KERN_NOTICE "Clock: inserting leap second " 125 printk(KERN_NOTICE "Clock: inserting leap second "
127 "23:59:60 UTC\n"); 126 "23:59:60 UTC\n");
128 } 127 }
@@ -137,7 +136,6 @@ void second_overflow(void)
137 */ 136 */
138 time_interpolator_update(NSEC_PER_SEC); 137 time_interpolator_update(NSEC_PER_SEC);
139 time_state = TIME_WAIT; 138 time_state = TIME_WAIT;
140 clock_was_set();
141 printk(KERN_NOTICE "Clock: deleting leap second " 139 printk(KERN_NOTICE "Clock: deleting leap second "
142 "23:59:59 UTC\n"); 140 "23:59:59 UTC\n");
143 } 141 }
diff --git a/mm/rmap.c b/mm/rmap.c
index 850165d32b..61e492597a 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -53,24 +53,6 @@
53 53
54struct kmem_cache *anon_vma_cachep; 54struct kmem_cache *anon_vma_cachep;
55 55
56static inline void validate_anon_vma(struct vm_area_struct *find_vma)
57{
58#ifdef CONFIG_DEBUG_VM
59 struct anon_vma *anon_vma = find_vma->anon_vma;
60 struct vm_area_struct *vma;
61 unsigned int mapcount = 0;
62 int found = 0;
63
64 list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
65 mapcount++;
66 BUG_ON(mapcount > 100000);
67 if (vma == find_vma)
68 found = 1;
69 }
70 BUG_ON(!found);
71#endif
72}
73
74/* This must be called under the mmap_sem. */ 56/* This must be called under the mmap_sem. */
75int anon_vma_prepare(struct vm_area_struct *vma) 57int anon_vma_prepare(struct vm_area_struct *vma)
76{ 58{
@@ -121,10 +103,8 @@ void __anon_vma_link(struct vm_area_struct *vma)
121{ 103{
122 struct anon_vma *anon_vma = vma->anon_vma; 104 struct anon_vma *anon_vma = vma->anon_vma;
123 105
124 if (anon_vma) { 106 if (anon_vma)
125 list_add_tail(&vma->anon_vma_node, &anon_vma->head); 107 list_add_tail(&vma->anon_vma_node, &anon_vma->head);
126 validate_anon_vma(vma);
127 }
128} 108}
129 109
130void anon_vma_link(struct vm_area_struct *vma) 110void anon_vma_link(struct vm_area_struct *vma)
@@ -134,7 +114,6 @@ void anon_vma_link(struct vm_area_struct *vma)
134 if (anon_vma) { 114 if (anon_vma) {
135 spin_lock(&anon_vma->lock); 115 spin_lock(&anon_vma->lock);
136 list_add_tail(&vma->anon_vma_node, &anon_vma->head); 116 list_add_tail(&vma->anon_vma_node, &anon_vma->head);
137 validate_anon_vma(vma);
138 spin_unlock(&anon_vma->lock); 117 spin_unlock(&anon_vma->lock);
139 } 118 }
140} 119}
@@ -148,7 +127,6 @@ void anon_vma_unlink(struct vm_area_struct *vma)
148 return; 127 return;
149 128
150 spin_lock(&anon_vma->lock); 129 spin_lock(&anon_vma->lock);
151 validate_anon_vma(vma);
152 list_del(&vma->anon_vma_node); 130 list_del(&vma->anon_vma_node);
153 131
154 /* We must garbage collect the anon_vma if it's empty */ 132 /* We must garbage collect the anon_vma if it's empty */
diff --git a/mm/slab.c b/mm/slab.c
index 6d65cf4e4b..a9c4472e92 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -774,7 +774,6 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
774 */ 774 */
775 BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL); 775 BUG_ON(malloc_sizes[INDEX_AC].cs_cachep == NULL);
776#endif 776#endif
777 WARN_ON_ONCE(size == 0);
778 while (size > csizep->cs_size) 777 while (size > csizep->cs_size)
779 csizep++; 778 csizep++;
780 779
diff --git a/mm/slub.c b/mm/slub.c
index 202049a457..0437f2f099 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1798,8 +1798,6 @@ static struct kmem_cache_node * __init early_kmem_cache_node_alloc(gfp_t gfpflag
1798 BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node)); 1798 BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node));
1799 1799
1800 page = new_slab(kmalloc_caches, gfpflags | GFP_THISNODE, node); 1800 page = new_slab(kmalloc_caches, gfpflags | GFP_THISNODE, node);
1801 /* new_slab() disables interupts */
1802 local_irq_enable();
1803 1801
1804 BUG_ON(!page); 1802 BUG_ON(!page);
1805 n = page->freelist; 1803 n = page->freelist;
@@ -1811,6 +1809,12 @@ static struct kmem_cache_node * __init early_kmem_cache_node_alloc(gfp_t gfpflag
1811 init_kmem_cache_node(n); 1809 init_kmem_cache_node(n);
1812 atomic_long_inc(&n->nr_slabs); 1810 atomic_long_inc(&n->nr_slabs);
1813 add_partial(n, page); 1811 add_partial(n, page);
1812
1813 /*
1814 * new_slab() disables interupts. If we do not reenable interrupts here
1815 * then bootup would continue with interrupts disabled.
1816 */
1817 local_irq_enable();
1814 return n; 1818 return n;
1815} 1819}
1816 1820
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 758dafe284..cf40ff91ac 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -72,7 +72,8 @@ static void queue_process(struct work_struct *work)
72 netif_tx_unlock(dev); 72 netif_tx_unlock(dev);
73 local_irq_restore(flags); 73 local_irq_restore(flags);
74 74
75 schedule_delayed_work(&npinfo->tx_work, HZ/10); 75 if (atomic_read(&npinfo->refcnt))
76 schedule_delayed_work(&npinfo->tx_work, HZ/10);
76 return; 77 return;
77 } 78 }
78 netif_tx_unlock(dev); 79 netif_tx_unlock(dev);
@@ -250,22 +251,23 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
250 unsigned long flags; 251 unsigned long flags;
251 252
252 local_irq_save(flags); 253 local_irq_save(flags);
253 if (netif_tx_trylock(dev)) { 254 /* try until next clock tick */
254 /* try until next clock tick */ 255 for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
255 for (tries = jiffies_to_usecs(1)/USEC_PER_POLL; 256 tries > 0; --tries) {
256 tries > 0; --tries) { 257 if (netif_tx_trylock(dev)) {
257 if (!netif_queue_stopped(dev)) 258 if (!netif_queue_stopped(dev))
258 status = dev->hard_start_xmit(skb, dev); 259 status = dev->hard_start_xmit(skb, dev);
260 netif_tx_unlock(dev);
259 261
260 if (status == NETDEV_TX_OK) 262 if (status == NETDEV_TX_OK)
261 break; 263 break;
262 264
263 /* tickle device maybe there is some cleanup */
264 netpoll_poll(np);
265
266 udelay(USEC_PER_POLL);
267 } 265 }
268 netif_tx_unlock(dev); 266
267 /* tickle device maybe there is some cleanup */
268 netpoll_poll(np);
269
270 udelay(USEC_PER_POLL);
269 } 271 }
270 local_irq_restore(flags); 272 local_irq_restore(flags);
271 } 273 }
@@ -784,9 +786,15 @@ void netpoll_cleanup(struct netpoll *np)
784 if (atomic_dec_and_test(&npinfo->refcnt)) { 786 if (atomic_dec_and_test(&npinfo->refcnt)) {
785 skb_queue_purge(&npinfo->arp_tx); 787 skb_queue_purge(&npinfo->arp_tx);
786 skb_queue_purge(&npinfo->txq); 788 skb_queue_purge(&npinfo->txq);
787 cancel_rearming_delayed_work(&npinfo->tx_work); 789 cancel_delayed_work(&npinfo->tx_work);
788 flush_scheduled_work(); 790 flush_scheduled_work();
789 791
792 /* clean after last, unfinished work */
793 if (!skb_queue_empty(&npinfo->txq)) {
794 struct sk_buff *skb;
795 skb = __skb_dequeue(&npinfo->txq);
796 kfree_skb(skb);
797 }
790 kfree(npinfo); 798 kfree(npinfo);
791 } 799 }
792 } 800 }
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6edaaa009d..67861a8f00 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3375,12 +3375,13 @@ static int sctp_getsockopt_sctp_status(struct sock *sk, int len,
3375 sctp_assoc_t associd; 3375 sctp_assoc_t associd;
3376 int retval = 0; 3376 int retval = 0;
3377 3377
3378 if (len != sizeof(status)) { 3378 if (len < sizeof(status)) {
3379 retval = -EINVAL; 3379 retval = -EINVAL;
3380 goto out; 3380 goto out;
3381 } 3381 }
3382 3382
3383 if (copy_from_user(&status, optval, sizeof(status))) { 3383 len = sizeof(status);
3384 if (copy_from_user(&status, optval, len)) {
3384 retval = -EFAULT; 3385 retval = -EFAULT;
3385 goto out; 3386 goto out;
3386 } 3387 }
@@ -3452,12 +3453,13 @@ static int sctp_getsockopt_peer_addr_info(struct sock *sk, int len,
3452 struct sctp_transport *transport; 3453 struct sctp_transport *transport;
3453 int retval = 0; 3454 int retval = 0;
3454 3455
3455 if (len != sizeof(pinfo)) { 3456 if (len < sizeof(pinfo)) {
3456 retval = -EINVAL; 3457 retval = -EINVAL;
3457 goto out; 3458 goto out;
3458 } 3459 }
3459 3460
3460 if (copy_from_user(&pinfo, optval, sizeof(pinfo))) { 3461 len = sizeof(pinfo);
3462 if (copy_from_user(&pinfo, optval, len)) {
3461 retval = -EFAULT; 3463 retval = -EFAULT;
3462 goto out; 3464 goto out;
3463 } 3465 }
@@ -3523,8 +3525,11 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
3523static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, 3525static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
3524 int __user *optlen) 3526 int __user *optlen)
3525{ 3527{
3526 if (len != sizeof(struct sctp_event_subscribe)) 3528 if (len < sizeof(struct sctp_event_subscribe))
3527 return -EINVAL; 3529 return -EINVAL;
3530 len = sizeof(struct sctp_event_subscribe);
3531 if (put_user(len, optlen))
3532 return -EFAULT;
3528 if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len)) 3533 if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len))
3529 return -EFAULT; 3534 return -EFAULT;
3530 return 0; 3535 return 0;
@@ -3546,9 +3551,12 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
3546 /* Applicable to UDP-style socket only */ 3551 /* Applicable to UDP-style socket only */
3547 if (sctp_style(sk, TCP)) 3552 if (sctp_style(sk, TCP))
3548 return -EOPNOTSUPP; 3553 return -EOPNOTSUPP;
3549 if (len != sizeof(int)) 3554 if (len < sizeof(int))
3550 return -EINVAL; 3555 return -EINVAL;
3551 if (copy_to_user(optval, &sctp_sk(sk)->autoclose, len)) 3556 len = sizeof(int);
3557 if (put_user(len, optlen))
3558 return -EFAULT;
3559 if (copy_to_user(optval, &sctp_sk(sk)->autoclose, sizeof(int)))
3552 return -EFAULT; 3560 return -EFAULT;
3553 return 0; 3561 return 0;
3554} 3562}
@@ -3599,8 +3607,9 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
3599 int retval = 0; 3607 int retval = 0;
3600 struct sctp_association *asoc; 3608 struct sctp_association *asoc;
3601 3609
3602 if (len != sizeof(sctp_peeloff_arg_t)) 3610 if (len < sizeof(sctp_peeloff_arg_t))
3603 return -EINVAL; 3611 return -EINVAL;
3612 len = sizeof(sctp_peeloff_arg_t);
3604 if (copy_from_user(&peeloff, optval, len)) 3613 if (copy_from_user(&peeloff, optval, len))
3605 return -EFAULT; 3614 return -EFAULT;
3606 3615
@@ -3628,6 +3637,8 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval
3628 3637
3629 /* Return the fd mapped to the new socket. */ 3638 /* Return the fd mapped to the new socket. */
3630 peeloff.sd = retval; 3639 peeloff.sd = retval;
3640 if (put_user(len, optlen))
3641 return -EFAULT;
3631 if (copy_to_user(optval, &peeloff, len)) 3642 if (copy_to_user(optval, &peeloff, len))
3632 retval = -EFAULT; 3643 retval = -EFAULT;
3633 3644
@@ -3736,9 +3747,9 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
3736 struct sctp_association *asoc = NULL; 3747 struct sctp_association *asoc = NULL;
3737 struct sctp_sock *sp = sctp_sk(sk); 3748 struct sctp_sock *sp = sctp_sk(sk);
3738 3749
3739 if (len != sizeof(struct sctp_paddrparams)) 3750 if (len < sizeof(struct sctp_paddrparams))
3740 return -EINVAL; 3751 return -EINVAL;
3741 3752 len = sizeof(struct sctp_paddrparams);
3742 if (copy_from_user(&params, optval, len)) 3753 if (copy_from_user(&params, optval, len))
3743 return -EFAULT; 3754 return -EFAULT;
3744 3755
@@ -3837,9 +3848,11 @@ static int sctp_getsockopt_delayed_ack_time(struct sock *sk, int len,
3837 struct sctp_association *asoc = NULL; 3848 struct sctp_association *asoc = NULL;
3838 struct sctp_sock *sp = sctp_sk(sk); 3849 struct sctp_sock *sp = sctp_sk(sk);
3839 3850
3840 if (len != sizeof(struct sctp_assoc_value)) 3851 if (len < sizeof(struct sctp_assoc_value))
3841 return - EINVAL; 3852 return - EINVAL;
3842 3853
3854 len = sizeof(struct sctp_assoc_value);
3855
3843 if (copy_from_user(&params, optval, len)) 3856 if (copy_from_user(&params, optval, len))
3844 return -EFAULT; 3857 return -EFAULT;
3845 3858
@@ -3888,8 +3901,11 @@ static int sctp_getsockopt_delayed_ack_time(struct sock *sk, int len,
3888 */ 3901 */
3889static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen) 3902static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen)
3890{ 3903{
3891 if (len != sizeof(struct sctp_initmsg)) 3904 if (len < sizeof(struct sctp_initmsg))
3892 return -EINVAL; 3905 return -EINVAL;
3906 len = sizeof(struct sctp_initmsg);
3907 if (put_user(len, optlen))
3908 return -EFAULT;
3893 if (copy_to_user(optval, &sctp_sk(sk)->initmsg, len)) 3909 if (copy_to_user(optval, &sctp_sk(sk)->initmsg, len))
3894 return -EFAULT; 3910 return -EFAULT;
3895 return 0; 3911 return 0;
@@ -3904,7 +3920,7 @@ static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len,
3904 struct list_head *pos; 3920 struct list_head *pos;
3905 int cnt = 0; 3921 int cnt = 0;
3906 3922
3907 if (len != sizeof(sctp_assoc_t)) 3923 if (len < sizeof(sctp_assoc_t))
3908 return -EINVAL; 3924 return -EINVAL;
3909 3925
3910 if (copy_from_user(&id, optval, sizeof(sctp_assoc_t))) 3926 if (copy_from_user(&id, optval, sizeof(sctp_assoc_t)))
@@ -3940,10 +3956,12 @@ static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len,
3940 struct sctp_sock *sp = sctp_sk(sk); 3956 struct sctp_sock *sp = sctp_sk(sk);
3941 int addrlen; 3957 int addrlen;
3942 3958
3943 if (len != sizeof(struct sctp_getaddrs_old)) 3959 if (len < sizeof(struct sctp_getaddrs_old))
3944 return -EINVAL; 3960 return -EINVAL;
3945 3961
3946 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old))) 3962 len = sizeof(struct sctp_getaddrs_old);
3963
3964 if (copy_from_user(&getaddrs, optval, len))
3947 return -EFAULT; 3965 return -EFAULT;
3948 3966
3949 if (getaddrs.addr_num <= 0) return -EINVAL; 3967 if (getaddrs.addr_num <= 0) return -EINVAL;
@@ -3966,7 +3984,9 @@ static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len,
3966 if (cnt >= getaddrs.addr_num) break; 3984 if (cnt >= getaddrs.addr_num) break;
3967 } 3985 }
3968 getaddrs.addr_num = cnt; 3986 getaddrs.addr_num = cnt;
3969 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old))) 3987 if (put_user(len, optlen))
3988 return -EFAULT;
3989 if (copy_to_user(optval, &getaddrs, len))
3970 return -EFAULT; 3990 return -EFAULT;
3971 3991
3972 return 0; 3992 return 0;
@@ -3999,8 +4019,7 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
3999 return -EINVAL; 4019 return -EINVAL;
4000 4020
4001 to = optval + offsetof(struct sctp_getaddrs,addrs); 4021 to = optval + offsetof(struct sctp_getaddrs,addrs);
4002 space_left = len - sizeof(struct sctp_getaddrs) - 4022 space_left = len - offsetof(struct sctp_getaddrs,addrs);
4003 offsetof(struct sctp_getaddrs,addrs);
4004 4023
4005 list_for_each(pos, &asoc->peer.transport_addr_list) { 4024 list_for_each(pos, &asoc->peer.transport_addr_list) {
4006 from = list_entry(pos, struct sctp_transport, transports); 4025 from = list_entry(pos, struct sctp_transport, transports);
@@ -4037,7 +4056,7 @@ static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len,
4037 rwlock_t *addr_lock; 4056 rwlock_t *addr_lock;
4038 int cnt = 0; 4057 int cnt = 0;
4039 4058
4040 if (len != sizeof(sctp_assoc_t)) 4059 if (len < sizeof(sctp_assoc_t))
4041 return -EINVAL; 4060 return -EINVAL;
4042 4061
4043 if (copy_from_user(&id, optval, sizeof(sctp_assoc_t))) 4062 if (copy_from_user(&id, optval, sizeof(sctp_assoc_t)))
@@ -4179,10 +4198,11 @@ static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
4179 void *buf; 4198 void *buf;
4180 int bytes_copied = 0; 4199 int bytes_copied = 0;
4181 4200
4182 if (len != sizeof(struct sctp_getaddrs_old)) 4201 if (len < sizeof(struct sctp_getaddrs_old))
4183 return -EINVAL; 4202 return -EINVAL;
4184 4203
4185 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs_old))) 4204 len = sizeof(struct sctp_getaddrs_old);
4205 if (copy_from_user(&getaddrs, optval, len))
4186 return -EFAULT; 4206 return -EFAULT;
4187 4207
4188 if (getaddrs.addr_num <= 0) return -EINVAL; 4208 if (getaddrs.addr_num <= 0) return -EINVAL;
@@ -4254,7 +4274,7 @@ copy_getaddrs:
4254 4274
4255 /* copy the leading structure back to user */ 4275 /* copy the leading structure back to user */
4256 getaddrs.addr_num = cnt; 4276 getaddrs.addr_num = cnt;
4257 if (copy_to_user(optval, &getaddrs, sizeof(struct sctp_getaddrs_old))) 4277 if (copy_to_user(optval, &getaddrs, len))
4258 err = -EFAULT; 4278 err = -EFAULT;
4259 4279
4260error: 4280error:
@@ -4282,7 +4302,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4282 void *addrs; 4302 void *addrs;
4283 void *buf; 4303 void *buf;
4284 4304
4285 if (len <= sizeof(struct sctp_getaddrs)) 4305 if (len < sizeof(struct sctp_getaddrs))
4286 return -EINVAL; 4306 return -EINVAL;
4287 4307
4288 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) 4308 if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs)))
@@ -4306,8 +4326,8 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
4306 } 4326 }
4307 4327
4308 to = optval + offsetof(struct sctp_getaddrs,addrs); 4328 to = optval + offsetof(struct sctp_getaddrs,addrs);
4309 space_left = len - sizeof(struct sctp_getaddrs) - 4329 space_left = len - offsetof(struct sctp_getaddrs,addrs);
4310 offsetof(struct sctp_getaddrs,addrs); 4330
4311 addrs = kmalloc(space_left, GFP_KERNEL); 4331 addrs = kmalloc(space_left, GFP_KERNEL);
4312 if (!addrs) 4332 if (!addrs)
4313 return -ENOMEM; 4333 return -ENOMEM;
@@ -4379,10 +4399,12 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
4379 struct sctp_association *asoc; 4399 struct sctp_association *asoc;
4380 struct sctp_sock *sp = sctp_sk(sk); 4400 struct sctp_sock *sp = sctp_sk(sk);
4381 4401
4382 if (len != sizeof(struct sctp_prim)) 4402 if (len < sizeof(struct sctp_prim))
4383 return -EINVAL; 4403 return -EINVAL;
4384 4404
4385 if (copy_from_user(&prim, optval, sizeof(struct sctp_prim))) 4405 len = sizeof(struct sctp_prim);
4406
4407 if (copy_from_user(&prim, optval, len))
4386 return -EFAULT; 4408 return -EFAULT;
4387 4409
4388 asoc = sctp_id2assoc(sk, prim.ssp_assoc_id); 4410 asoc = sctp_id2assoc(sk, prim.ssp_assoc_id);
@@ -4398,7 +4420,9 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
4398 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, 4420 sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp,
4399 (union sctp_addr *)&prim.ssp_addr); 4421 (union sctp_addr *)&prim.ssp_addr);
4400 4422
4401 if (copy_to_user(optval, &prim, sizeof(struct sctp_prim))) 4423 if (put_user(len, optlen))
4424 return -EFAULT;
4425 if (copy_to_user(optval, &prim, len))
4402 return -EFAULT; 4426 return -EFAULT;
4403 4427
4404 return 0; 4428 return 0;
@@ -4415,10 +4439,15 @@ static int sctp_getsockopt_adaptation_layer(struct sock *sk, int len,
4415{ 4439{
4416 struct sctp_setadaptation adaptation; 4440 struct sctp_setadaptation adaptation;
4417 4441
4418 if (len != sizeof(struct sctp_setadaptation)) 4442 if (len < sizeof(struct sctp_setadaptation))
4419 return -EINVAL; 4443 return -EINVAL;
4420 4444
4445 len = sizeof(struct sctp_setadaptation);
4446
4421 adaptation.ssb_adaptation_ind = sctp_sk(sk)->adaptation_ind; 4447 adaptation.ssb_adaptation_ind = sctp_sk(sk)->adaptation_ind;
4448
4449 if (put_user(len, optlen))
4450 return -EFAULT;
4422 if (copy_to_user(optval, &adaptation, len)) 4451 if (copy_to_user(optval, &adaptation, len))
4423 return -EFAULT; 4452 return -EFAULT;
4424 4453
@@ -4452,9 +4481,12 @@ static int sctp_getsockopt_default_send_param(struct sock *sk,
4452 struct sctp_association *asoc; 4481 struct sctp_association *asoc;
4453 struct sctp_sock *sp = sctp_sk(sk); 4482 struct sctp_sock *sp = sctp_sk(sk);
4454 4483
4455 if (len != sizeof(struct sctp_sndrcvinfo)) 4484 if (len < sizeof(struct sctp_sndrcvinfo))
4456 return -EINVAL; 4485 return -EINVAL;
4457 if (copy_from_user(&info, optval, sizeof(struct sctp_sndrcvinfo))) 4486
4487 len = sizeof(struct sctp_sndrcvinfo);
4488
4489 if (copy_from_user(&info, optval, len))
4458 return -EFAULT; 4490 return -EFAULT;
4459 4491
4460 asoc = sctp_id2assoc(sk, info.sinfo_assoc_id); 4492 asoc = sctp_id2assoc(sk, info.sinfo_assoc_id);
@@ -4475,7 +4507,9 @@ static int sctp_getsockopt_default_send_param(struct sock *sk,
4475 info.sinfo_timetolive = sp->default_timetolive; 4507 info.sinfo_timetolive = sp->default_timetolive;
4476 } 4508 }
4477 4509
4478 if (copy_to_user(optval, &info, sizeof(struct sctp_sndrcvinfo))) 4510 if (put_user(len, optlen))
4511 return -EFAULT;
4512 if (copy_to_user(optval, &info, len))
4479 return -EFAULT; 4513 return -EFAULT;
4480 4514
4481 return 0; 4515 return 0;
@@ -4526,10 +4560,12 @@ static int sctp_getsockopt_rtoinfo(struct sock *sk, int len,
4526 struct sctp_rtoinfo rtoinfo; 4560 struct sctp_rtoinfo rtoinfo;
4527 struct sctp_association *asoc; 4561 struct sctp_association *asoc;
4528 4562
4529 if (len != sizeof (struct sctp_rtoinfo)) 4563 if (len < sizeof (struct sctp_rtoinfo))
4530 return -EINVAL; 4564 return -EINVAL;
4531 4565
4532 if (copy_from_user(&rtoinfo, optval, sizeof (struct sctp_rtoinfo))) 4566 len = sizeof(struct sctp_rtoinfo);
4567
4568 if (copy_from_user(&rtoinfo, optval, len))
4533 return -EFAULT; 4569 return -EFAULT;
4534 4570
4535 asoc = sctp_id2assoc(sk, rtoinfo.srto_assoc_id); 4571 asoc = sctp_id2assoc(sk, rtoinfo.srto_assoc_id);
@@ -4581,11 +4617,12 @@ static int sctp_getsockopt_associnfo(struct sock *sk, int len,
4581 struct list_head *pos; 4617 struct list_head *pos;
4582 int cnt = 0; 4618 int cnt = 0;
4583 4619
4584 if (len != sizeof (struct sctp_assocparams)) 4620 if (len < sizeof (struct sctp_assocparams))
4585 return -EINVAL; 4621 return -EINVAL;
4586 4622
4587 if (copy_from_user(&assocparams, optval, 4623 len = sizeof(struct sctp_assocparams);
4588 sizeof (struct sctp_assocparams))) 4624
4625 if (copy_from_user(&assocparams, optval, len))
4589 return -EFAULT; 4626 return -EFAULT;
4590 4627
4591 asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id); 4628 asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id);
@@ -4671,9 +4708,11 @@ static int sctp_getsockopt_context(struct sock *sk, int len,
4671 struct sctp_sock *sp; 4708 struct sctp_sock *sp;
4672 struct sctp_association *asoc; 4709 struct sctp_association *asoc;
4673 4710
4674 if (len != sizeof(struct sctp_assoc_value)) 4711 if (len < sizeof(struct sctp_assoc_value))
4675 return -EINVAL; 4712 return -EINVAL;
4676 4713
4714 len = sizeof(struct sctp_assoc_value);
4715
4677 if (copy_from_user(&params, optval, len)) 4716 if (copy_from_user(&params, optval, len))
4678 return -EFAULT; 4717 return -EFAULT;
4679 4718
@@ -6084,8 +6123,11 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
6084 * queued to the backlog. This prevents a potential race between 6123 * queued to the backlog. This prevents a potential race between
6085 * backlog processing on the old socket and new-packet processing 6124 * backlog processing on the old socket and new-packet processing
6086 * on the new socket. 6125 * on the new socket.
6126 *
6127 * The caller has just allocated newsk so we can guarantee that other
6128 * paths won't try to lock it and then oldsk.
6087 */ 6129 */
6088 sctp_lock_sock(newsk); 6130 lock_sock_nested(newsk, SINGLE_DEPTH_NESTING);
6089 sctp_assoc_migrate(assoc, newsk); 6131 sctp_assoc_migrate(assoc, newsk);
6090 6132
6091 /* If the association on the newsk is already closed before accept() 6133 /* If the association on the newsk is already closed before accept()
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index f98171f5a3..0dcc01ce45 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -99,6 +99,11 @@ cat << EOF
99#define __IGNORE_setfsuid32 99#define __IGNORE_setfsuid32
100#define __IGNORE_setfsgid32 100#define __IGNORE_setfsgid32
101 101
102/* sync_file_range had a stupid ABI. Allow sync_file_range2 instead */
103#ifdef __NR_sync_file_range2
104#define __IGNORE_sync_file_range
105#endif
106
102/* Unmerged syscalls for AFS, STREAMS, etc. */ 107/* Unmerged syscalls for AFS, STREAMS, etc. */
103#define __IGNORE_afs_syscall 108#define __IGNORE_afs_syscall
104#define __IGNORE_getpmsg 109#define __IGNORE_getpmsg
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index ebb1bdac72..2025db5947 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -1048,7 +1048,7 @@ static struct platform_driver snd_mts64_driver = {
1048/********************************************************************* 1048/*********************************************************************
1049 * module init stuff 1049 * module init stuff
1050 *********************************************************************/ 1050 *********************************************************************/
1051static void __init_or_module snd_mts64_unregister_all(void) 1051static void snd_mts64_unregister_all(void)
1052{ 1052{
1053 int i; 1053 int i;
1054 1054
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 61a323cc0e..4f6800b43b 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -953,7 +953,7 @@ static int snd_opl3sa2_isa_resume(struct device *dev, unsigned int n)
953static struct isa_driver snd_opl3sa2_isa_driver = { 953static struct isa_driver snd_opl3sa2_isa_driver = {
954 .match = snd_opl3sa2_isa_match, 954 .match = snd_opl3sa2_isa_match,
955 .probe = snd_opl3sa2_isa_probe, 955 .probe = snd_opl3sa2_isa_probe,
956 .remove = __devexit( snd_opl3sa2_isa_remove), 956 .remove = __devexit_p(snd_opl3sa2_isa_remove),
957#ifdef CONFIG_PM 957#ifdef CONFIG_PM
958 .suspend = snd_opl3sa2_isa_suspend, 958 .suspend = snd_opl3sa2_isa_suspend,
959 .resume = snd_opl3sa2_isa_resume, 959 .resume = snd_opl3sa2_isa_resume,
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c
index 27acd6f29b..7de18b58f2 100644
--- a/sound/oss/sb_card.c
+++ b/sound/oss/sb_card.c
@@ -290,7 +290,7 @@ static struct pnp_card_driver sb_pnp_driver = {
290MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table); 290MODULE_DEVICE_TABLE(pnp_card, sb_pnp_card_table);
291#endif /* CONFIG_PNP */ 291#endif /* CONFIG_PNP */
292 292
293static void __init_or_module sb_unregister_all(void) 293static void sb_unregister_all(void)
294{ 294{
295#ifdef CONFIG_PNP 295#ifdef CONFIG_PNP
296 if (pnp_registered) 296 if (pnp_registered)
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c
index f03c02c077..4bae7305a7 100644
--- a/sound/pci/ice1712/prodigy192.c
+++ b/sound/pci/ice1712/prodigy192.c
@@ -705,7 +705,7 @@ static int ak4114_input_sw_put(struct snd_kcontrol *kcontrol,
705} 705}
706 706
707 707
708static const struct snd_kcontrol_new ak4114_controls[] __devinitdata = { 708static struct snd_kcontrol_new ak4114_controls[] __devinitdata = {
709 { 709 {
710 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 710 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
711 .name = "MIODIO IEC958 Capture Input", 711 .name = "MIODIO IEC958 Capture Input",