Browse Source

Merge branch 'master' into next

Conflicts:
	fs/cifs/misc.c

Merge to resolve above, per the patch below.

Signed-off-by: James Morris <jmorris@namei.org>

diff --cc fs/cifs/misc.c
index ec36410,addd1dc..0000000
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@@ -347,13 -338,13 +338,13 @@@ header_assemble(struct smb_hdr *buffer
  		/*  BB Add support for establishing new tCon and SMB Session  */
  		/*      with userid/password pairs found on the smb session   */
  		/*	for other target tcp/ip addresses 		BB    */
 -				if (current->fsuid != treeCon->ses->linux_uid) {
 +				if (current_fsuid() != treeCon->ses->linux_uid) {
  					cFYI(1, ("Multiuser mode and UID "
  						 "did not match tcon uid"));
- 					read_lock(&GlobalSMBSeslock);
- 					list_for_each(temp_item, &GlobalSMBSessionList) {
- 						ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList);
+ 					read_lock(&cifs_tcp_ses_lock);
+ 					list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) {
+ 						ses = list_entry(temp_item, struct cifsSesInfo, smb_ses_list);
 -						if (ses->linux_uid == current->fsuid) {
 +						if (ses->linux_uid == current_fsuid()) {
  							if (ses->server == treeCon->ses->server) {
  								cFYI(1, ("found matching uid substitute right smb_uid"));
  								buffer->Uid = ses->Suid;
James Morris 16 years ago
parent
commit
f3a5c54701
100 changed files with 1022 additions and 387 deletions
  1. 2 40
      Documentation/00-INDEX
  2. 2 0
      Documentation/PCI/00-INDEX
  3. 0 0
      Documentation/PCI/MSI-HOWTO.txt
  4. 16 0
      Documentation/blockdev/00-INDEX
  5. 0 0
      Documentation/blockdev/README.DAC960
  6. 0 0
      Documentation/blockdev/cciss.txt
  7. 0 0
      Documentation/blockdev/cpqarray.txt
  8. 0 0
      Documentation/blockdev/floppy.txt
  9. 0 0
      Documentation/blockdev/nbd.txt
  10. 0 0
      Documentation/blockdev/paride.txt
  11. 0 0
      Documentation/blockdev/ramdisk.txt
  12. 10 0
      Documentation/ioctl/00-INDEX
  13. 0 0
      Documentation/ioctl/ioctl-number.txt
  14. 12 12
      Documentation/kernel-parameters.txt
  15. 24 0
      Documentation/serial/00-INDEX
  16. 0 0
      Documentation/serial/README.cycladesZ
  17. 1 1
      Documentation/serial/computone.txt
  18. 0 0
      Documentation/serial/digiepca.txt
  19. 0 0
      Documentation/serial/hayes-esp.txt
  20. 0 0
      Documentation/serial/moxa-smartio
  21. 0 0
      Documentation/serial/riscom8.txt
  22. 0 0
      Documentation/serial/rocket.txt
  23. 0 0
      Documentation/serial/specialix.txt
  24. 0 0
      Documentation/serial/stallion.txt
  25. 0 0
      Documentation/serial/sx.txt
  26. 0 0
      Documentation/serial/tty.txt
  27. 1 1
      Makefile
  28. 1 1
      arch/m68k/kernel/ints.c
  29. 13 7
      arch/s390/kernel/entry.S
  30. 7 4
      arch/s390/kernel/entry64.S
  31. 3 0
      arch/s390/kernel/process.c
  32. 2 2
      arch/s390/kernel/setup.c
  33. 1 1
      arch/s390/kernel/sys_s390.c
  34. 7 4
      arch/s390/kernel/topology.c
  35. 4 0
      arch/sh/include/asm/io.h
  36. 6 0
      arch/sh/include/asm/pgtable.h
  37. 3 3
      arch/sh/kernel/cpu/sh4a/setup-sh7723.c
  38. 2 1
      arch/sh/kernel/early_printk.c
  39. 1 1
      arch/sh/kernel/timers/timer-tmu.c
  40. 8 3
      arch/sh/lib/copy_page.S
  41. 1 1
      arch/sh/mm/Makefile_32
  42. 1 1
      arch/sh/mm/Makefile_64
  43. 9 3
      arch/sh/mm/init.c
  44. 31 0
      arch/sh/mm/mmap.c
  45. 17 0
      arch/sh/mm/pg-sh4.c
  46. 5 6
      arch/sparc/include/asm/termbits.h
  47. 2 2
      arch/sparc/kernel/of_device.c
  48. 0 1
      arch/x86/include/asm/iommu.h
  49. 0 18
      arch/x86/kernel/early-quirks.c
  50. 1 1
      drivers/acpi/sleep/proc.c
  51. 11 2
      drivers/ata/libata-sff.c
  52. 15 14
      drivers/block/Kconfig
  53. 1 1
      drivers/block/floppy.c
  54. 18 2
      drivers/block/ub.c
  55. 12 12
      drivers/char/Kconfig
  56. 1 1
      drivers/char/specialix.c
  57. 9 2
      drivers/hid/hid-apple.c
  58. 9 3
      drivers/hid/hid-core.c
  59. 3 0
      drivers/hid/hid-ids.h
  60. 16 14
      drivers/hid/hidraw.c
  61. 19 6
      drivers/hid/usbhid/hid-core.c
  62. 0 1
      drivers/hwmon/lis3lv02d.c
  63. 2 1
      drivers/i2c/busses/i2c-sh_mobile.c
  64. 1 0
      drivers/ide/ide-cs.c
  65. 4 2
      drivers/isdn/i4l/isdn_net.c
  66. 6 2
      drivers/md/dm-mpath.c
  67. 1 0
      drivers/md/dm-raid1.c
  68. 3 1
      drivers/md/dm-stripe.c
  69. 21 13
      drivers/md/dm.c
  70. 149 82
      drivers/media/video/tvaudio.c
  71. 1 1
      drivers/mfd/da903x.c
  72. 13 2
      drivers/mfd/wm8350-i2c.c
  73. 1 0
      drivers/misc/c2port/core.c
  74. 0 4
      drivers/net/atl1e/atl1e_hw.c
  75. 3 14
      drivers/net/atlx/atl1.c
  76. 10 10
      drivers/net/e100.c
  77. 6 2
      drivers/net/e1000/e1000_ethtool.c
  78. 1 0
      drivers/net/e1000/e1000_main.c
  79. 5 0
      drivers/net/e1000e/e1000.h
  80. 6 2
      drivers/net/e1000e/ethtool.c
  81. 23 2
      drivers/net/e1000e/netdev.c
  82. 25 0
      drivers/net/e1000e/param.c
  83. 8 7
      drivers/net/gianfar.c
  84. 6 2
      drivers/net/igb/igb_ethtool.c
  85. 4 4
      drivers/net/igb/igb_main.c
  86. 4 4
      drivers/net/mlx4/en_netdev.c
  87. 16 14
      drivers/net/mlx4/en_params.c
  88. 4 4
      drivers/net/mlx4/mlx4_en.h
  89. 282 8
      drivers/net/niu.c
  90. 13 0
      drivers/net/niu.h
  91. 66 0
      drivers/net/phy/marvell.c
  92. 1 1
      drivers/net/phy/mdio_bus.c
  93. 2 2
      drivers/net/phy/phy_device.c
  94. 5 14
      drivers/net/qla3xxx.c
  95. 3 3
      drivers/net/ucc_geth_ethtool.c
  96. 4 0
      drivers/net/usb/asix.c
  97. 1 1
      drivers/net/via-velocity.c
  98. 2 1
      drivers/pcmcia/cistpl.c
  99. 7 7
      drivers/pcmcia/cs.c
  100. 6 5
      drivers/pcmcia/ds.c

+ 2 - 40
Documentation/00-INDEX

@@ -42,14 +42,8 @@ IRQ.txt
 	- description of what an IRQ is.
 	- description of what an IRQ is.
 ManagementStyle
 ManagementStyle
 	- how to (attempt to) manage kernel hackers.
 	- how to (attempt to) manage kernel hackers.
-MSI-HOWTO.txt
-	- the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ.
 RCU/
 RCU/
 	- directory with info on RCU (read-copy update).
 	- directory with info on RCU (read-copy update).
-README.DAC960
-	- info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux.
-README.cycladesZ
-	- info on Cyclades-Z firmware loading.
 SAK.txt
 SAK.txt
 	- info on Secure Attention Keys.
 	- info on Secure Attention Keys.
 SM501.txt
 SM501.txt
@@ -86,20 +80,16 @@ blackfin/
 	- directory with documentation for the Blackfin arch.
 	- directory with documentation for the Blackfin arch.
 block/
 block/
 	- info on the Block I/O (BIO) layer.
 	- info on the Block I/O (BIO) layer.
+blockdev/
+	- info on block devices & drivers
 cachetlb.txt
 cachetlb.txt
 	- describes the cache/TLB flushing interfaces Linux uses.
 	- describes the cache/TLB flushing interfaces Linux uses.
-cciss.txt
-	- info, major/minor #'s for Compaq's SMART Array Controllers.
 cdrom/
 cdrom/
 	- directory with information on the CD-ROM drivers that Linux has.
 	- directory with information on the CD-ROM drivers that Linux has.
-computone.txt
-	- info on Computone Intelliport II/Plus Multiport Serial Driver.
 connector/
 connector/
 	- docs on the netlink based userspace<->kernel space communication mod.
 	- docs on the netlink based userspace<->kernel space communication mod.
 console/
 console/
 	- documentation on Linux console drivers.
 	- documentation on Linux console drivers.
-cpqarray.txt
-	- info on using Compaq's SMART2 Intelligent Disk Array Controllers.
 cpu-freq/
 cpu-freq/
 	- info on CPU frequency and voltage scaling.
 	- info on CPU frequency and voltage scaling.
 cpu-hotplug.txt
 cpu-hotplug.txt
@@ -126,8 +116,6 @@ device-mapper/
 	- directory with info on Device Mapper.
 	- directory with info on Device Mapper.
 devices.txt
 devices.txt
 	- plain ASCII listing of all the nodes in /dev/ with major minor #'s.
 	- plain ASCII listing of all the nodes in /dev/ with major minor #'s.
-digiepca.txt
-	- info on Digi Intl. {PC,PCI,EISA}Xx and Xem series cards.
 dontdiff
 dontdiff
 	- file containing a list of files that should never be diff'ed.
 	- file containing a list of files that should never be diff'ed.
 driver-model/
 driver-model/
@@ -152,14 +140,10 @@ filesystems/
 	- info on the vfs and the various filesystems that Linux supports.
 	- info on the vfs and the various filesystems that Linux supports.
 firmware_class/
 firmware_class/
 	- request_firmware() hotplug interface info.
 	- request_firmware() hotplug interface info.
-floppy.txt
-	- notes and driver options for the floppy disk driver.
 frv/
 frv/
 	- Fujitsu FR-V Linux documentation.
 	- Fujitsu FR-V Linux documentation.
 gpio.txt
 gpio.txt
 	- overview of GPIO (General Purpose Input/Output) access conventions.
 	- overview of GPIO (General Purpose Input/Output) access conventions.
-hayes-esp.txt
-	- info on using the Hayes ESP serial driver.
 highuid.txt
 highuid.txt
 	- notes on the change from 16 bit to 32 bit user/group IDs.
 	- notes on the change from 16 bit to 32 bit user/group IDs.
 timers/
 timers/
@@ -186,8 +170,6 @@ io_ordering.txt
 	- info on ordering I/O writes to memory-mapped addresses.
 	- info on ordering I/O writes to memory-mapped addresses.
 ioctl/
 ioctl/
 	- directory with documents describing various IOCTL calls.
 	- directory with documents describing various IOCTL calls.
-ioctl-number.txt
-	- how to implement and register device/driver ioctl calls.
 iostats.txt
 iostats.txt
 	- info on I/O statistics Linux kernel provides.
 	- info on I/O statistics Linux kernel provides.
 irqflags-tracing.txt
 irqflags-tracing.txt
@@ -250,14 +232,10 @@ mips/
 	- directory with info about Linux on MIPS architecture.
 	- directory with info about Linux on MIPS architecture.
 mono.txt
 mono.txt
 	- how to execute Mono-based .NET binaries with the help of BINFMT_MISC.
 	- how to execute Mono-based .NET binaries with the help of BINFMT_MISC.
-moxa-smartio
-	- file with info on installing/using Moxa multiport serial driver.
 mutex-design.txt
 mutex-design.txt
 	- info on the generic mutex subsystem.
 	- info on the generic mutex subsystem.
 namespaces/
 namespaces/
 	- directory with various information about namespaces
 	- directory with various information about namespaces
-nbd.txt
-	- info on a TCP implementation of a network block device.
 netlabel/
 netlabel/
 	- directory with information on the NetLabel subsystem.
 	- directory with information on the NetLabel subsystem.
 networking/
 networking/
@@ -270,8 +248,6 @@ numastat.txt
 	- info on how to read Numa policy hit/miss statistics in sysfs.
 	- info on how to read Numa policy hit/miss statistics in sysfs.
 oops-tracing.txt
 oops-tracing.txt
 	- how to decode those nasty internal kernel error dump messages.
 	- how to decode those nasty internal kernel error dump messages.
-paride.txt
-	- information about the parallel port IDE subsystem.
 parisc/
 parisc/
 	- directory with info on using Linux on PA-RISC architecture.
 	- directory with info on using Linux on PA-RISC architecture.
 parport.txt
 parport.txt
@@ -294,18 +270,12 @@ printk-formats.txt
 	- how to get printk format specifiers right
 	- how to get printk format specifiers right
 prio_tree.txt
 prio_tree.txt
 	- info on radix-priority-search-tree use for indexing vmas.
 	- info on radix-priority-search-tree use for indexing vmas.
-ramdisk.txt
-	- short guide on how to set up and use the RAM disk.
 rbtree.txt
 rbtree.txt
 	- info on what red-black trees are and what they are for.
 	- info on what red-black trees are and what they are for.
-riscom8.txt
-	- notes on using the RISCom/8 multi-port serial driver.
 robust-futex-ABI.txt
 robust-futex-ABI.txt
 	- documentation of the robust futex ABI.
 	- documentation of the robust futex ABI.
 robust-futexes.txt
 robust-futexes.txt
 	- a description of what robust futexes are.
 	- a description of what robust futexes are.
-rocket.txt
-	- info on the Comtrol RocketPort multiport serial driver.
 rt-mutex-design.txt
 rt-mutex-design.txt
 	- description of the RealTime mutex implementation design.
 	- description of the RealTime mutex implementation design.
 rt-mutex.txt
 rt-mutex.txt
@@ -334,8 +304,6 @@ sparc/
 	- directory with info on using Linux on Sparc architecture.
 	- directory with info on using Linux on Sparc architecture.
 sparse.txt
 sparse.txt
 	- info on how to obtain and use the sparse tool for typechecking.
 	- info on how to obtain and use the sparse tool for typechecking.
-specialix.txt
-	- info on hardware/driver for specialix IO8+ multiport serial card.
 spi/
 spi/
 	- overview of Linux kernel Serial Peripheral Interface (SPI) support.
 	- overview of Linux kernel Serial Peripheral Interface (SPI) support.
 spinlocks.txt
 spinlocks.txt
@@ -344,14 +312,10 @@ stable_api_nonsense.txt
 	- info on why the kernel does not have a stable in-kernel api or abi.
 	- info on why the kernel does not have a stable in-kernel api or abi.
 stable_kernel_rules.txt
 stable_kernel_rules.txt
 	- rules and procedures for the -stable kernel releases.
 	- rules and procedures for the -stable kernel releases.
-stallion.txt
-	- info on using the Stallion multiport serial driver.
 svga.txt
 svga.txt
 	- short guide on selecting video modes at boot via VGA BIOS.
 	- short guide on selecting video modes at boot via VGA BIOS.
 sysfs-rules.txt
 sysfs-rules.txt
 	- How not to use sysfs.
 	- How not to use sysfs.
-sx.txt
-	- info on the Specialix SX/SI multiport serial driver.
 sysctl/
 sysctl/
 	- directory with info on the /proc/sys/* files.
 	- directory with info on the /proc/sys/* files.
 sysrq.txt
 sysrq.txt
@@ -360,8 +324,6 @@ telephony/
 	- directory with info on telephony (e.g. voice over IP) support.
 	- directory with info on telephony (e.g. voice over IP) support.
 time_interpolators.txt
 time_interpolators.txt
 	- info on time interpolators.
 	- info on time interpolators.
-tty.txt
-	- guide to the locking policies of the tty layer.
 uml/
 uml/
 	- directory with information about User Mode Linux.
 	- directory with information about User Mode Linux.
 unicode.txt
 unicode.txt

+ 2 - 0
Documentation/PCI/00-INDEX

@@ -1,5 +1,7 @@
 00-INDEX
 00-INDEX
 	- this file
 	- this file
+MSI-HOWTO.txt
+	- the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ.
 PCI-DMA-mapping.txt
 PCI-DMA-mapping.txt
 	- info for PCI drivers using DMA portably across all platforms
 	- info for PCI drivers using DMA portably across all platforms
 PCIEBUS-HOWTO.txt
 PCIEBUS-HOWTO.txt

+ 0 - 0
Documentation/MSI-HOWTO.txt → Documentation/PCI/MSI-HOWTO.txt


+ 16 - 0
Documentation/blockdev/00-INDEX

@@ -0,0 +1,16 @@
+00-INDEX
+	- this file
+README.DAC960
+	- info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux.
+cciss.txt
+	- info, major/minor #'s for Compaq's SMART Array Controllers.
+cpqarray.txt
+	- info on using Compaq's SMART2 Intelligent Disk Array Controllers.
+floppy.txt
+	- notes and driver options for the floppy disk driver.
+nbd.txt
+	- info on a TCP implementation of a network block device.
+paride.txt
+	- information about the parallel port IDE subsystem.
+ramdisk.txt
+	- short guide on how to set up and use the RAM disk.

+ 0 - 0
Documentation/README.DAC960 → Documentation/blockdev/README.DAC960


+ 0 - 0
Documentation/cciss.txt → Documentation/blockdev/cciss.txt


+ 0 - 0
Documentation/cpqarray.txt → Documentation/blockdev/cpqarray.txt


+ 0 - 0
Documentation/floppy.txt → Documentation/blockdev/floppy.txt


+ 0 - 0
Documentation/nbd.txt → Documentation/blockdev/nbd.txt


+ 0 - 0
Documentation/paride.txt → Documentation/blockdev/paride.txt


+ 0 - 0
Documentation/ramdisk.txt → Documentation/blockdev/ramdisk.txt


+ 10 - 0
Documentation/ioctl/00-INDEX

@@ -0,0 +1,10 @@
+00-INDEX
+	- this file
+cdrom.txt
+	- summary of CDROM ioctl calls
+hdio.txt
+	- summary of HDIO_ ioctl calls
+ioctl-decoding.txt
+	- how to decode the bits of an IOCTL code
+ioctl-number.txt
+	- how to implement and register device/driver ioctl calls

+ 0 - 0
Documentation/ioctl-number.txt → Documentation/ioctl/ioctl-number.txt


+ 12 - 12
Documentation/kernel-parameters.txt

@@ -629,7 +629,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
 
 	digiepca=	[HW,SERIAL]
 	digiepca=	[HW,SERIAL]
 			See drivers/char/README.epca and
 			See drivers/char/README.epca and
-			Documentation/digiepca.txt.
+			Documentation/serial/digiepca.txt.
 
 
 	disable_mtrr_cleanup [X86]
 	disable_mtrr_cleanup [X86]
 	enable_mtrr_cleanup [X86]
 	enable_mtrr_cleanup [X86]
@@ -740,7 +740,7 @@ and is between 256 and 4096 characters. It is defined in the file
 			See header of drivers/scsi/fdomain.c.
 			See header of drivers/scsi/fdomain.c.
 
 
 	floppy=		[HW]
 	floppy=		[HW]
-			See Documentation/floppy.txt.
+			See Documentation/blockdev/floppy.txt.
 
 
 	force_pal_cache_flush
 	force_pal_cache_flush
 			[IA-64] Avoid check_sal_cache_flush which may hang on
 			[IA-64] Avoid check_sal_cache_flush which may hang on
@@ -1101,7 +1101,7 @@ and is between 256 and 4096 characters. It is defined in the file
 			the same attribute, the last one is used.
 			the same attribute, the last one is used.
 
 
 	load_ramdisk=	[RAM] List of ramdisks to load from floppy
 	load_ramdisk=	[RAM] List of ramdisks to load from floppy
-			See Documentation/ramdisk.txt.
+			See Documentation/blockdev/ramdisk.txt.
 
 
 	lockd.nlm_grace_period=P  [NFS] Assign grace period.
 	lockd.nlm_grace_period=P  [NFS] Assign grace period.
 			Format: <integer>
 			Format: <integer>
@@ -1600,7 +1600,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
 
 	pcd.		[PARIDE]
 	pcd.		[PARIDE]
 			See header of drivers/block/paride/pcd.c.
 			See header of drivers/block/paride/pcd.c.
-			See also Documentation/paride.txt.
+			See also Documentation/blockdev/paride.txt.
 
 
 	pci=option[,option...]	[PCI] various PCI subsystem options:
 	pci=option[,option...]	[PCI] various PCI subsystem options:
 		off		[X86] don't probe for the PCI bus
 		off		[X86] don't probe for the PCI bus
@@ -1701,7 +1701,7 @@ and is between 256 and 4096 characters. It is defined in the file
 	pcmv=		[HW,PCMCIA] BadgePAD 4
 	pcmv=		[HW,PCMCIA] BadgePAD 4
 
 
 	pd.		[PARIDE]
 	pd.		[PARIDE]
-			See Documentation/paride.txt.
+			See Documentation/blockdev/paride.txt.
 
 
 	pdcchassis=	[PARISC,HW] Disable/Enable PDC Chassis Status codes at
 	pdcchassis=	[PARISC,HW] Disable/Enable PDC Chassis Status codes at
 			boot time.
 			boot time.
@@ -1709,10 +1709,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			See arch/parisc/kernel/pdc_chassis.c
 			See arch/parisc/kernel/pdc_chassis.c
 
 
 	pf.		[PARIDE]
 	pf.		[PARIDE]
-			See Documentation/paride.txt.
+			See Documentation/blockdev/paride.txt.
 
 
 	pg.		[PARIDE]
 	pg.		[PARIDE]
-			See Documentation/paride.txt.
+			See Documentation/blockdev/paride.txt.
 
 
 	pirq=		[SMP,APIC] Manual mp-table setup
 	pirq=		[SMP,APIC] Manual mp-table setup
 			See Documentation/x86/i386/IO-APIC.txt.
 			See Documentation/x86/i386/IO-APIC.txt.
@@ -1782,7 +1782,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
 
 	prompt_ramdisk=	[RAM] List of RAM disks to prompt for floppy disk
 	prompt_ramdisk=	[RAM] List of RAM disks to prompt for floppy disk
 			before loading.
 			before loading.
-			See Documentation/ramdisk.txt.
+			See Documentation/blockdev/ramdisk.txt.
 
 
 	psmouse.proto=	[HW,MOUSE] Highest PS2 mouse protocol extension to
 	psmouse.proto=	[HW,MOUSE] Highest PS2 mouse protocol extension to
 			probe for; one of (bare|imps|exps|lifebook|any).
 			probe for; one of (bare|imps|exps|lifebook|any).
@@ -1802,7 +1802,7 @@ and is between 256 and 4096 characters. It is defined in the file
 			<io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq>
 			<io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq>
 
 
 	pt.		[PARIDE]
 	pt.		[PARIDE]
-			See Documentation/paride.txt.
+			See Documentation/blockdev/paride.txt.
 
 
 	pty.legacy_count=
 	pty.legacy_count=
 			[KNL] Number of legacy pty's. Overwrites compiled-in
 			[KNL] Number of legacy pty's. Overwrites compiled-in
@@ -1816,10 +1816,10 @@ and is between 256 and 4096 characters. It is defined in the file
 			See Documentation/md.txt.
 			See Documentation/md.txt.
 
 
 	ramdisk_blocksize=	[RAM]
 	ramdisk_blocksize=	[RAM]
-			See Documentation/ramdisk.txt.
+			See Documentation/blockdev/ramdisk.txt.
 
 
 	ramdisk_size=	[RAM] Sizes of RAM disks in kilobytes
 	ramdisk_size=	[RAM] Sizes of RAM disks in kilobytes
-			See Documentation/ramdisk.txt.
+			See Documentation/blockdev/ramdisk.txt.
 
 
 	rcupdate.blimit=	[KNL,BOOT]
 	rcupdate.blimit=	[KNL,BOOT]
 			Set maximum number of finished RCU callbacks to process
 			Set maximum number of finished RCU callbacks to process
@@ -2151,7 +2151,7 @@ and is between 256 and 4096 characters. It is defined in the file
 			See Documentation/sonypi.txt
 			See Documentation/sonypi.txt
 
 
 	specialix=	[HW,SERIAL] Specialix multi-serial port adapter
 	specialix=	[HW,SERIAL] Specialix multi-serial port adapter
-			See Documentation/specialix.txt.
+			See Documentation/serial/specialix.txt.
 
 
 	spia_io_base=	[HW,MTD]
 	spia_io_base=	[HW,MTD]
 	spia_fio_base=
 	spia_fio_base=

+ 24 - 0
Documentation/serial/00-INDEX

@@ -0,0 +1,24 @@
+00-INDEX
+	- this file.
+README.cycladesZ
+	- info on Cyclades-Z firmware loading.
+computone.txt
+	- info on Computone Intelliport II/Plus Multiport Serial Driver.
+digiepca.txt
+	- info on Digi Intl. {PC,PCI,EISA}Xx and Xem series cards.
+hayes-esp.txt
+	- info on using the Hayes ESP serial driver.
+moxa-smartio
+	- file with info on installing/using Moxa multiport serial driver.
+riscom8.txt
+	- notes on using the RISCom/8 multi-port serial driver.
+rocket.txt
+	- info on the Comtrol RocketPort multiport serial driver.
+specialix.txt
+	- info on hardware/driver for specialix IO8+ multiport serial card.
+stallion.txt
+	- info on using the Stallion multiport serial driver.
+sx.txt
+	- info on the Specialix SX/SI multiport serial driver.
+tty.txt
+	- guide to the locking policies of the tty layer.

+ 0 - 0
Documentation/README.cycladesZ → Documentation/serial/README.cycladesZ


+ 1 - 1
Documentation/computone.txt → Documentation/serial/computone.txt

@@ -247,7 +247,7 @@ shar archive to make it easier to extract the script from the documentation.
 To create the ip2mkdev shell script change to a convenient directory (/tmp
 To create the ip2mkdev shell script change to a convenient directory (/tmp
 works just fine) and run the following command:
 works just fine) and run the following command:
 
 
-	unshar Documentation/computone.txt
+	unshar Documentation/serial/computone.txt
 		(This file)
 		(This file)
 
 
 You should now have a file ip2mkdev in your current working directory with
 You should now have a file ip2mkdev in your current working directory with

+ 0 - 0
Documentation/digiepca.txt → Documentation/serial/digiepca.txt


+ 0 - 0
Documentation/hayes-esp.txt → Documentation/serial/hayes-esp.txt


+ 0 - 0
Documentation/moxa-smartio → Documentation/serial/moxa-smartio


+ 0 - 0
Documentation/riscom8.txt → Documentation/serial/riscom8.txt


+ 0 - 0
Documentation/rocket.txt → Documentation/serial/rocket.txt


+ 0 - 0
Documentation/specialix.txt → Documentation/serial/specialix.txt


+ 0 - 0
Documentation/stallion.txt → Documentation/serial/stallion.txt


+ 0 - 0
Documentation/sx.txt → Documentation/serial/sx.txt


+ 0 - 0
Documentation/tty.txt → Documentation/serial/tty.txt


+ 1 - 1
Makefile

@@ -1,7 +1,7 @@
 VERSION = 2
 VERSION = 2
 PATCHLEVEL = 6
 PATCHLEVEL = 6
 SUBLEVEL = 28
 SUBLEVEL = 28
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc5
 NAME = Killer Bat of Doom
 NAME = Killer Bat of Doom
 
 
 # *DOCUMENTATION*
 # *DOCUMENTATION*

+ 1 - 1
arch/m68k/kernel/ints.c

@@ -133,7 +133,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
 {
 {
 	int i;
 	int i;
 
 
-	BUG_ON(IRQ_USER + cnt >= NR_IRQS);
+	BUG_ON(IRQ_USER + cnt > NR_IRQS);
 	m68k_first_user_vec = vec;
 	m68k_first_user_vec = vec;
 	for (i = 0; i < cnt; i++)
 	for (i = 0; i < cnt; i++)
 		irq_controller[IRQ_USER + i] = &user_irq_controller;
 		irq_controller[IRQ_USER + i] = &user_irq_controller;

+ 13 - 7
arch/s390/kernel/entry.S

@@ -61,22 +61,25 @@ STACK_SIZE  = 1 << STACK_SHIFT
 
 
 #ifdef CONFIG_TRACE_IRQFLAGS
 #ifdef CONFIG_TRACE_IRQFLAGS
 	.macro	TRACE_IRQS_ON
 	.macro	TRACE_IRQS_ON
-	l	%r1,BASED(.Ltrace_irq_on)
+	basr	%r2,%r0
+	l	%r1,BASED(.Ltrace_irq_on_caller)
 	basr	%r14,%r1
 	basr	%r14,%r1
 	.endm
 	.endm
 
 
 	.macro	TRACE_IRQS_OFF
 	.macro	TRACE_IRQS_OFF
-	l	%r1,BASED(.Ltrace_irq_off)
+	basr	%r2,%r0
+	l	%r1,BASED(.Ltrace_irq_off_caller)
 	basr	%r14,%r1
 	basr	%r14,%r1
 	.endm
 	.endm
 
 
 	.macro	TRACE_IRQS_CHECK
 	.macro	TRACE_IRQS_CHECK
+	basr	%r2,%r0
 	tm	SP_PSW(%r15),0x03	# irqs enabled?
 	tm	SP_PSW(%r15),0x03	# irqs enabled?
 	jz	0f
 	jz	0f
-	l	%r1,BASED(.Ltrace_irq_on)
+	l	%r1,BASED(.Ltrace_irq_on_caller)
 	basr	%r14,%r1
 	basr	%r14,%r1
 	j	1f
 	j	1f
-0:	l	%r1,BASED(.Ltrace_irq_off)
+0:	l	%r1,BASED(.Ltrace_irq_off_caller)
 	basr	%r14,%r1
 	basr	%r14,%r1
 1:
 1:
 	.endm
 	.endm
@@ -1113,9 +1116,12 @@ cleanup_io_leave_insn:
 .Lschedtail:	.long	schedule_tail
 .Lschedtail:	.long	schedule_tail
 .Lsysc_table:	.long	sys_call_table
 .Lsysc_table:	.long	sys_call_table
 #ifdef CONFIG_TRACE_IRQFLAGS
 #ifdef CONFIG_TRACE_IRQFLAGS
-.Ltrace_irq_on: .long	trace_hardirqs_on
-.Ltrace_irq_off:
-		.long	trace_hardirqs_off
+.Ltrace_irq_on_caller:
+		.long	trace_hardirqs_on_caller
+.Ltrace_irq_off_caller:
+		.long	trace_hardirqs_off_caller
+#endif
+#ifdef CONFIG_LOCKDEP
 .Llockdep_sys_exit:
 .Llockdep_sys_exit:
 		.long	lockdep_sys_exit
 		.long	lockdep_sys_exit
 #endif
 #endif

+ 7 - 4
arch/s390/kernel/entry64.S

@@ -61,19 +61,22 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
 
 
 #ifdef CONFIG_TRACE_IRQFLAGS
 #ifdef CONFIG_TRACE_IRQFLAGS
 	.macro	TRACE_IRQS_ON
 	.macro	TRACE_IRQS_ON
-	 brasl	%r14,trace_hardirqs_on
+	 basr	%r2,%r0
+	 brasl	%r14,trace_hardirqs_on_caller
 	.endm
 	.endm
 
 
 	.macro	TRACE_IRQS_OFF
 	.macro	TRACE_IRQS_OFF
-	 brasl	%r14,trace_hardirqs_off
+	 basr	%r2,%r0
+	 brasl	%r14,trace_hardirqs_off_caller
 	.endm
 	.endm
 
 
 	.macro TRACE_IRQS_CHECK
 	.macro TRACE_IRQS_CHECK
+	basr	%r2,%r0
 	tm	SP_PSW(%r15),0x03	# irqs enabled?
 	tm	SP_PSW(%r15),0x03	# irqs enabled?
 	jz	0f
 	jz	0f
-	brasl	%r14,trace_hardirqs_on
+	brasl	%r14,trace_hardirqs_on_caller
 	j	1f
 	j	1f
-0:	brasl	%r14,trace_hardirqs_off
+0:	brasl	%r14,trace_hardirqs_off_caller
 1:
 1:
 	.endm
 	.endm
 #else
 #else

+ 3 - 0
arch/s390/kernel/process.c

@@ -136,9 +136,12 @@ static void default_idle(void)
 		return;
 		return;
 	}
 	}
 	trace_hardirqs_on();
 	trace_hardirqs_on();
+	/* Don't trace preempt off for idle. */
+	stop_critical_timings();
 	/* Wait for external, I/O or machine check interrupt. */
 	/* Wait for external, I/O or machine check interrupt. */
 	__load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
 	__load_psw_mask(psw_kernel_bits | PSW_MASK_WAIT |
 			PSW_MASK_IO | PSW_MASK_EXT);
 			PSW_MASK_IO | PSW_MASK_EXT);
+	start_critical_timings();
 }
 }
 
 
 void cpu_idle(void)
 void cpu_idle(void)

+ 2 - 2
arch/s390/kernel/setup.c

@@ -604,13 +604,13 @@ setup_memory(void)
 		if (memory_chunk[i].type != CHUNK_READ_WRITE)
 		if (memory_chunk[i].type != CHUNK_READ_WRITE)
 			continue;
 			continue;
 		start_chunk = PFN_DOWN(memory_chunk[i].addr);
 		start_chunk = PFN_DOWN(memory_chunk[i].addr);
-		end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size) - 1;
+		end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size);
 		end_chunk = min(end_chunk, end_pfn);
 		end_chunk = min(end_chunk, end_pfn);
 		if (start_chunk >= end_chunk)
 		if (start_chunk >= end_chunk)
 			continue;
 			continue;
 		add_active_range(0, start_chunk, end_chunk);
 		add_active_range(0, start_chunk, end_chunk);
 		pfn = max(start_chunk, start_pfn);
 		pfn = max(start_chunk, start_pfn);
-		for (; pfn <= end_chunk; pfn++)
+		for (; pfn < end_chunk; pfn++)
 			page_set_storage_key(PFN_PHYS(pfn), PAGE_DEFAULT_KEY);
 			page_set_storage_key(PFN_PHYS(pfn), PAGE_DEFAULT_KEY);
 	}
 	}
 
 

+ 1 - 1
arch/s390/kernel/sys_s390.c

@@ -198,7 +198,7 @@ asmlinkage long s390x_newuname(struct new_utsname __user *name)
 {
 {
 	int ret = sys_newuname(name);
 	int ret = sys_newuname(name);
 
 
-	if (current->personality == PER_LINUX32 && !ret) {
+	if (personality(current->personality) == PER_LINUX32 && !ret) {
 		ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
 		ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
 		if (ret) ret = -EFAULT;
 		if (ret) ret = -EFAULT;
 	}
 	}

+ 7 - 4
arch/s390/kernel/topology.c

@@ -65,18 +65,21 @@ static int machine_has_topology_irq;
 static struct timer_list topology_timer;
 static struct timer_list topology_timer;
 static void set_topology_timer(void);
 static void set_topology_timer(void);
 static DECLARE_WORK(topology_work, topology_work_fn);
 static DECLARE_WORK(topology_work, topology_work_fn);
+/* topology_lock protects the core linked list */
+static DEFINE_SPINLOCK(topology_lock);
 
 
 cpumask_t cpu_core_map[NR_CPUS];
 cpumask_t cpu_core_map[NR_CPUS];
 
 
 cpumask_t cpu_coregroup_map(unsigned int cpu)
 cpumask_t cpu_coregroup_map(unsigned int cpu)
 {
 {
 	struct core_info *core = &core_info;
 	struct core_info *core = &core_info;
+	unsigned long flags;
 	cpumask_t mask;
 	cpumask_t mask;
 
 
 	cpus_clear(mask);
 	cpus_clear(mask);
 	if (!machine_has_topology)
 	if (!machine_has_topology)
 		return cpu_present_map;
 		return cpu_present_map;
-	mutex_lock(&smp_cpu_state_mutex);
+	spin_lock_irqsave(&topology_lock, flags);
 	while (core) {
 	while (core) {
 		if (cpu_isset(cpu, core->mask)) {
 		if (cpu_isset(cpu, core->mask)) {
 			mask = core->mask;
 			mask = core->mask;
@@ -84,7 +87,7 @@ cpumask_t cpu_coregroup_map(unsigned int cpu)
 		}
 		}
 		core = core->next;
 		core = core->next;
 	}
 	}
-	mutex_unlock(&smp_cpu_state_mutex);
+	spin_unlock_irqrestore(&topology_lock, flags);
 	if (cpus_empty(mask))
 	if (cpus_empty(mask))
 		mask = cpumask_of_cpu(cpu);
 		mask = cpumask_of_cpu(cpu);
 	return mask;
 	return mask;
@@ -133,7 +136,7 @@ static void tl_to_cores(struct tl_info *info)
 	union tl_entry *tle, *end;
 	union tl_entry *tle, *end;
 	struct core_info *core = &core_info;
 	struct core_info *core = &core_info;
 
 
-	mutex_lock(&smp_cpu_state_mutex);
+	spin_lock_irq(&topology_lock);
 	clear_cores();
 	clear_cores();
 	tle = info->tle;
 	tle = info->tle;
 	end = (union tl_entry *)((unsigned long)info + info->length);
 	end = (union tl_entry *)((unsigned long)info + info->length);
@@ -157,7 +160,7 @@ static void tl_to_cores(struct tl_info *info)
 		}
 		}
 		tle = next_tle(tle);
 		tle = next_tle(tle);
 	}
 	}
-	mutex_unlock(&smp_cpu_state_mutex);
+	spin_unlock_irq(&topology_lock);
 }
 }
 
 
 static void topology_update_polarization_simple(void)
 static void topology_update_polarization_simple(void)

+ 4 - 0
arch/sh/include/asm/io.h

@@ -293,6 +293,10 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
  */
  */
 #define xlate_dev_kmem_ptr(p)	p
 #define xlate_dev_kmem_ptr(p)	p
 
 
+#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
+int valid_phys_addr_range(unsigned long addr, size_t size);
+int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
+
 #endif /* __KERNEL__ */
 #endif /* __KERNEL__ */
 
 
 #endif /* __ASM_SH_IO_H */
 #endif /* __ASM_SH_IO_H */

+ 6 - 0
arch/sh/include/asm/pgtable.h

@@ -148,6 +148,12 @@ extern void paging_init(void);
 extern void page_table_range_init(unsigned long start, unsigned long end,
 extern void page_table_range_init(unsigned long start, unsigned long end,
 				  pgd_t *pgd);
 				  pgd_t *pgd);
 
 
+#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_CPU_SH4) && defined(CONFIG_MMU)
+extern void kmap_coherent_init(void);
+#else
+#define kmap_coherent_init()	do { } while (0)
+#endif
+
 #include <asm-generic/pgtable.h>
 #include <asm-generic/pgtable.h>
 
 
 #endif /* __ASM_SH_PGTABLE_H */
 #endif /* __ASM_SH_PGTABLE_H */

+ 3 - 3
arch/sh/kernel/cpu/sh4a/setup-sh7723.c

@@ -119,17 +119,17 @@ static struct plat_sci_port sci_platform_data[] = {
 	},{
 	},{
 		.mapbase	= 0xa4e30000,
 		.mapbase	= 0xa4e30000,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.flags		= UPF_BOOT_AUTOCONF,
-		.type		= PORT_SCI,
+		.type		= PORT_SCIFA,
 		.irqs		= { 56, 56, 56, 56 },
 		.irqs		= { 56, 56, 56, 56 },
 	},{
 	},{
 		.mapbase	= 0xa4e40000,
 		.mapbase	= 0xa4e40000,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.flags		= UPF_BOOT_AUTOCONF,
-		.type		= PORT_SCI,
+		.type		= PORT_SCIFA,
 		.irqs		= { 88, 88, 88, 88 },
 		.irqs		= { 88, 88, 88, 88 },
 	},{
 	},{
 		.mapbase	= 0xa4e50000,
 		.mapbase	= 0xa4e50000,
 		.flags		= UPF_BOOT_AUTOCONF,
 		.flags		= UPF_BOOT_AUTOCONF,
-		.type		= PORT_SCI,
+		.type		= PORT_SCIFA,
 		.irqs		= { 109, 109, 109, 109 },
 		.irqs		= { 109, 109, 109, 109 },
 	}, {
 	}, {
 		.flags = 0,
 		.flags = 0,

+ 2 - 1
arch/sh/kernel/early_printk.c

@@ -75,6 +75,7 @@ static struct console bios_console = {
 #endif
 #endif
 
 
 static struct uart_port scif_port = {
 static struct uart_port scif_port = {
+	.type		= PORT_SCIF,
 	.mapbase	= CONFIG_EARLY_SCIF_CONSOLE_PORT,
 	.mapbase	= CONFIG_EARLY_SCIF_CONSOLE_PORT,
 	.membase	= (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT,
 	.membase	= (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT,
 };
 };
@@ -84,9 +85,9 @@ static void scif_sercon_putc(int c)
 	while (((sci_in(&scif_port, SCFDR) & EPK_FIFO_BITS) >= EPK_FIFO_SIZE))
 	while (((sci_in(&scif_port, SCFDR) & EPK_FIFO_BITS) >= EPK_FIFO_SIZE))
 		;
 		;
 
 
-	sci_out(&scif_port, SCxTDR, c);
 	sci_in(&scif_port, SCxSR);
 	sci_in(&scif_port, SCxSR);
 	sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40));
 	sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40));
+	sci_out(&scif_port, SCxTDR, c);
 
 
 	while ((sci_in(&scif_port, SCxSR) & 0x40) == 0)
 	while ((sci_in(&scif_port, SCxSR) & 0x40) == 0)
 		;
 		;

+ 1 - 1
arch/sh/kernel/timers/timer-tmu.c

@@ -120,7 +120,7 @@ static void tmu_set_mode(enum clock_event_mode mode,
 {
 {
 	switch (mode) {
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
 	case CLOCK_EVT_MODE_PERIODIC:
-		ctrl_outl(ctrl_inl(TMU0_TCNT), TMU0_TCOR);
+		ctrl_outl(tmu_latest_interval[TMU0], TMU0_TCOR);
 		break;
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 	case CLOCK_EVT_MODE_ONESHOT:
 		ctrl_outl(0, TMU0_TCOR);
 		ctrl_outl(0, TMU0_TCOR);

+ 8 - 3
arch/sh/lib/copy_page.S

@@ -80,6 +80,11 @@ ENTRY(copy_page)
 	.section __ex_table, "a";	\
 	.section __ex_table, "a";	\
 	.long 9999b, 6000f	;	\
 	.long 9999b, 6000f	;	\
 	.previous
 	.previous
+#define EX_NO_POP(...)			\
+	9999: __VA_ARGS__ ;		\
+	.section __ex_table, "a";	\
+	.long 9999b, 6005f	;	\
+	.previous
 ENTRY(__copy_user)
 ENTRY(__copy_user)
 	! Check if small number of bytes
 	! Check if small number of bytes
 	mov	#11,r0
 	mov	#11,r0
@@ -139,9 +144,9 @@ EX(	mov.b	r1,@r4		)
 	bt	1f
 	bt	1f
 
 
 2:
 2:
-EX(	mov.b	@r5+,r0		)
+EX_NO_POP(	mov.b	@r5+,r0		)
 	dt	r6
 	dt	r6
-EX(	mov.b	r0,@r4		)
+EX_NO_POP(	mov.b	r0,@r4		)
 	bf/s	2b
 	bf/s	2b
 	 add	#1,r4
 	 add	#1,r4
 
 
@@ -150,7 +155,7 @@ EX(	mov.b	r0,@r4		)
 
 
 # Exception handler:
 # Exception handler:
 .section .fixup, "ax"
 .section .fixup, "ax"
-6000:
+6005:
 	mov.l	8000f,r1
 	mov.l	8000f,r1
 	mov	r3,r0
 	mov	r3,r0
 	jmp	@r1
 	jmp	@r1

+ 1 - 1
arch/sh/mm/Makefile_32

@@ -2,7 +2,7 @@
 # Makefile for the Linux SuperH-specific parts of the memory manager.
 # Makefile for the Linux SuperH-specific parts of the memory manager.
 #
 #
 
 
-obj-y			:= init.o extable_32.o consistent.o
+obj-y			:= init.o extable_32.o consistent.o mmap.o
 
 
 ifndef CONFIG_CACHE_OFF
 ifndef CONFIG_CACHE_OFF
 cache-$(CONFIG_CPU_SH2)		:= cache-sh2.o
 cache-$(CONFIG_CPU_SH2)		:= cache-sh2.o

+ 1 - 1
arch/sh/mm/Makefile_64

@@ -2,7 +2,7 @@
 # Makefile for the Linux SuperH-specific parts of the memory manager.
 # Makefile for the Linux SuperH-specific parts of the memory manager.
 #
 #
 
 
-obj-y			:= init.o consistent.o
+obj-y			:= init.o consistent.o mmap.o
 
 
 mmu-y			:= tlb-nommu.o pg-nommu.o extable_32.o
 mmu-y			:= tlb-nommu.o pg-nommu.o extable_32.o
 mmu-$(CONFIG_MMU)	:= fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o \
 mmu-$(CONFIG_MMU)	:= fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o \

+ 9 - 3
arch/sh/mm/init.c

@@ -137,6 +137,7 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
 void __init paging_init(void)
 void __init paging_init(void)
 {
 {
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
 	unsigned long max_zone_pfns[MAX_NR_ZONES];
+	unsigned long vaddr;
 	int nid;
 	int nid;
 
 
 	/* We don't need to map the kernel through the TLB, as
 	/* We don't need to map the kernel through the TLB, as
@@ -148,10 +149,15 @@ void __init paging_init(void)
 	 * check for a null value. */
 	 * check for a null value. */
 	set_TTB(swapper_pg_dir);
 	set_TTB(swapper_pg_dir);
 
 
-	/* Populate the relevant portions of swapper_pg_dir so that
+	/*
+	 * Populate the relevant portions of swapper_pg_dir so that
 	 * we can use the fixmap entries without calling kmalloc.
 	 * we can use the fixmap entries without calling kmalloc.
-	 * pte's will be filled in by __set_fixmap(). */
-	page_table_range_init(FIXADDR_START, FIXADDR_TOP, swapper_pg_dir);
+	 * pte's will be filled in by __set_fixmap().
+	 */
+	vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
+	page_table_range_init(vaddr, 0, swapper_pg_dir);
+
+	kmap_coherent_init();
 
 
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
 	memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
 
 

+ 31 - 0
arch/sh/mm/mmap.c

@@ -0,0 +1,31 @@
+/*
+ * arch/sh/mm/mmap.c
+ *
+ * Copyright (C) 2008  Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/io.h>
+#include <linux/mm.h>
+#include <asm/page.h>
+
+/*
+ * You really shouldn't be using read() or write() on /dev/mem.  This
+ * might go away in the future.
+ */
+int valid_phys_addr_range(unsigned long addr, size_t count)
+{
+	if (addr < __MEMORY_START)
+		return 0;
+	if (addr + count > __pa(high_memory))
+		return 0;
+
+	return 1;
+}
+
+int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
+{
+	return 1;
+}

+ 17 - 0
arch/sh/mm/pg-sh4.c

@@ -7,6 +7,7 @@
  * Released under the terms of the GNU GPL v2.0.
  * Released under the terms of the GNU GPL v2.0.
  */
  */
 #include <linux/mm.h>
 #include <linux/mm.h>
+#include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/mutex.h>
 #include <linux/fs.h>
 #include <linux/fs.h>
 #include <linux/highmem.h>
 #include <linux/highmem.h>
@@ -16,6 +17,20 @@
 
 
 #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask)
 #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask)
 
 
+#define kmap_get_fixmap_pte(vaddr)                                     \
+	pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
+
+static pte_t *kmap_coherent_pte;
+
+void __init kmap_coherent_init(void)
+{
+	unsigned long vaddr;
+
+	/* cache the first coherent kmap pte */
+	vaddr = __fix_to_virt(FIX_CMAP_BEGIN);
+	kmap_coherent_pte = kmap_get_fixmap_pte(vaddr);
+}
+
 static inline void *kmap_coherent(struct page *page, unsigned long addr)
 static inline void *kmap_coherent(struct page *page, unsigned long addr)
 {
 {
 	enum fixed_addresses idx;
 	enum fixed_addresses idx;
@@ -34,6 +49,8 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr)
 
 
 	update_mmu_cache(NULL, vaddr, pte);
 	update_mmu_cache(NULL, vaddr, pte);
 
 
+	set_pte(kmap_coherent_pte - (FIX_CMAP_END - idx), pte);
+
 	return (void *)vaddr;
 	return (void *)vaddr;
 }
 }
 
 

+ 5 - 6
arch/sparc/include/asm/termbits.h

@@ -29,10 +29,11 @@ struct termios {
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
 	cc_t c_line;			/* line discipline */
 	cc_t c_line;			/* line discipline */
+#ifndef __KERNEL__
 	cc_t c_cc[NCCS];		/* control characters */
 	cc_t c_cc[NCCS];		/* control characters */
-#ifdef __KERNEL__
+#else
+	cc_t c_cc[NCCS+2];	/* kernel needs 2 more to hold vmin/vtime */
 #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
 #define SIZEOF_USER_TERMIOS sizeof (struct termios) - (2*sizeof (cc_t))
-	cc_t _x_cc[2];                  /* We need them to hold vmin/vtime */
 #endif
 #endif
 };
 };
 
 
@@ -42,8 +43,7 @@ struct termios2 {
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
 	cc_t c_line;			/* line discipline */
 	cc_t c_line;			/* line discipline */
-	cc_t c_cc[NCCS];		/* control characters */
-	cc_t _x_cc[2];                  /* padding to match ktermios */
+	cc_t c_cc[NCCS+2];		/* control characters */
 	speed_t c_ispeed;		/* input speed */
 	speed_t c_ispeed;		/* input speed */
 	speed_t c_ospeed;		/* output speed */
 	speed_t c_ospeed;		/* output speed */
 };
 };
@@ -54,8 +54,7 @@ struct ktermios {
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_cflag;		/* control mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
 	tcflag_t c_lflag;		/* local mode flags */
 	cc_t c_line;			/* line discipline */
 	cc_t c_line;			/* line discipline */
-	cc_t c_cc[NCCS];		/* control characters */
-	cc_t _x_cc[2];                  /* We need them to hold vmin/vtime */
+	cc_t c_cc[NCCS+2];		/* control characters */
 	speed_t c_ispeed;		/* input speed */
 	speed_t c_ispeed;		/* input speed */
 	speed_t c_ospeed;		/* output speed */
 	speed_t c_ospeed;		/* output speed */
 };
 };

+ 2 - 2
arch/sparc/kernel/of_device.c

@@ -563,9 +563,9 @@ build_resources:
 	op->dev.parent = parent;
 	op->dev.parent = parent;
 	op->dev.bus = &of_platform_bus_type;
 	op->dev.bus = &of_platform_bus_type;
 	if (!parent)
 	if (!parent)
-		strcpy(op->dev.bus_id, "root");
+		dev_set_name(&op->dev, "root");
 	else
 	else
-		sprintf(op->dev.bus_id, "%08x", dp->node);
+		dev_set_name(&op->dev, "%08x", dp->node);
 
 
 	if (of_device_register(op)) {
 	if (of_device_register(op)) {
 		printk("%s: Could not register of device.\n",
 		printk("%s: Could not register of device.\n",

+ 0 - 1
arch/x86/include/asm/iommu.h

@@ -6,7 +6,6 @@ extern void no_iommu_init(void);
 extern struct dma_mapping_ops nommu_dma_ops;
 extern struct dma_mapping_ops nommu_dma_ops;
 extern int force_iommu, no_iommu;
 extern int force_iommu, no_iommu;
 extern int iommu_detected;
 extern int iommu_detected;
-extern int dmar_disabled;
 
 
 extern unsigned long iommu_nr_pages(unsigned long addr, unsigned long len);
 extern unsigned long iommu_nr_pages(unsigned long addr, unsigned long len);
 
 

+ 0 - 18
arch/x86/kernel/early-quirks.c

@@ -188,20 +188,6 @@ static void __init ati_bugs_contd(int num, int slot, int func)
 }
 }
 #endif
 #endif
 
 
-#ifdef CONFIG_DMAR
-static void __init intel_g33_dmar(int num, int slot, int func)
-{
-	struct acpi_table_header *dmar_tbl;
-	acpi_status status;
-
-	status = acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_tbl);
-	if (ACPI_SUCCESS(status)) {
-		printk(KERN_INFO "BIOS BUG: DMAR advertised on Intel G31/G33 chipset -- ignoring\n");
-		dmar_disabled = 1;
-	}
-}
-#endif
-
 #define QFLAG_APPLY_ONCE 	0x1
 #define QFLAG_APPLY_ONCE 	0x1
 #define QFLAG_APPLIED		0x2
 #define QFLAG_APPLIED		0x2
 #define QFLAG_DONE		(QFLAG_APPLY_ONCE|QFLAG_APPLIED)
 #define QFLAG_DONE		(QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -225,10 +211,6 @@ static struct chipset early_qrk[] __initdata = {
 	  PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
 	  PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
 	  PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
 	  PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
-#ifdef CONFIG_DMAR
-	{ PCI_VENDOR_ID_INTEL, 0x29c0,
-	  PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, intel_g33_dmar },
-#endif
 	{}
 	{}
 };
 };
 
 

+ 1 - 1
drivers/acpi/sleep/proc.c

@@ -366,7 +366,7 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
 			   dev->wakeup.state.enabled ? "enabled" : "disabled");
 			   dev->wakeup.state.enabled ? "enabled" : "disabled");
 		if (ldev)
 		if (ldev)
 			seq_printf(seq, "%s:%s",
 			seq_printf(seq, "%s:%s",
-				   dev_name(ldev) ? ldev->bus->name : "no-bus",
+				   ldev->bus ? ldev->bus->name : "no-bus",
 				   dev_name(ldev));
 				   dev_name(ldev));
 		seq_printf(seq, "\n");
 		seq_printf(seq, "\n");
 		put_device(ldev);
 		put_device(ldev);

+ 11 - 2
drivers/ata/libata-sff.c

@@ -1227,10 +1227,19 @@ fsm_start:
 			/* ATA PIO protocol */
 			/* ATA PIO protocol */
 			if (unlikely((status & ATA_DRQ) == 0)) {
 			if (unlikely((status & ATA_DRQ) == 0)) {
 				/* handle BSY=0, DRQ=0 as error */
 				/* handle BSY=0, DRQ=0 as error */
-				if (likely(status & (ATA_ERR | ATA_DF)))
+				if (likely(status & (ATA_ERR | ATA_DF))) {
 					/* device stops HSM for abort/error */
 					/* device stops HSM for abort/error */
 					qc->err_mask |= AC_ERR_DEV;
 					qc->err_mask |= AC_ERR_DEV;
-				else {
+
+					/* If diagnostic failed and this is
+					 * IDENTIFY, it's likely a phantom
+					 * device.  Mark hint.
+					 */
+					if (qc->dev->horkage &
+					    ATA_HORKAGE_DIAGNOSTIC)
+						qc->err_mask |=
+							AC_ERR_NODEV_HINT;
+				} else {
 					/* HSM violation. Let EH handle this.
 					/* HSM violation. Let EH handle this.
 					 * Phantom devices also trigger this
 					 * Phantom devices also trigger this
 					 * condition.  Mark hint.
 					 * condition.  Mark hint.

+ 15 - 14
drivers/block/Kconfig

@@ -21,7 +21,8 @@ config BLK_DEV_FD
 	---help---
 	---help---
 	  If you want to use the floppy disk drive(s) of your PC under Linux,
 	  If you want to use the floppy disk drive(s) of your PC under Linux,
 	  say Y. Information about this driver, especially important for IBM
 	  say Y. Information about this driver, especially important for IBM
-	  Thinkpad users, is contained in <file:Documentation/floppy.txt>.
+	  Thinkpad users, is contained in
+	  <file:Documentation/blockdev/floppy.txt>.
 	  That file also contains the location of the Floppy driver FAQ as
 	  That file also contains the location of the Floppy driver FAQ as
 	  well as location of the fdutils package used to configure additional
 	  well as location of the fdutils package used to configure additional
 	  parameters of the driver at run time.
 	  parameters of the driver at run time.
@@ -76,7 +77,7 @@ config PARIDE
 	  your computer's parallel port. Most of them are actually IDE devices
 	  your computer's parallel port. Most of them are actually IDE devices
 	  using a parallel port IDE adapter. This option enables the PARIDE
 	  using a parallel port IDE adapter. This option enables the PARIDE
 	  subsystem which contains drivers for many of these external drives.
 	  subsystem which contains drivers for many of these external drives.
-	  Read <file:Documentation/paride.txt> for more information.
+	  Read <file:Documentation/blockdev/paride.txt> for more information.
 
 
 	  If you have said Y to the "Parallel-port support" configuration
 	  If you have said Y to the "Parallel-port support" configuration
 	  option, you may share a single port between your printer and other
 	  option, you may share a single port between your printer and other
@@ -114,9 +115,9 @@ config BLK_CPQ_DA
 	help
 	help
 	  This is the driver for Compaq Smart Array controllers.  Everyone
 	  This is the driver for Compaq Smart Array controllers.  Everyone
 	  using these boards should say Y here.  See the file
 	  using these boards should say Y here.  See the file
-	  <file:Documentation/cpqarray.txt> for the current list of boards
-	  supported by this driver, and for further information on the use of
-	  this driver.
+	  <file:Documentation/blockdev/cpqarray.txt> for the current list of
+	  boards supported by this driver, and for further information on the
+	  use of this driver.
 
 
 config BLK_CPQ_CISS_DA
 config BLK_CPQ_CISS_DA
 	tristate "Compaq Smart Array 5xxx support"
 	tristate "Compaq Smart Array 5xxx support"
@@ -124,7 +125,7 @@ config BLK_CPQ_CISS_DA
 	help
 	help
 	  This is the driver for Compaq Smart Array 5xxx controllers.
 	  This is the driver for Compaq Smart Array 5xxx controllers.
 	  Everyone using these boards should say Y here.
 	  Everyone using these boards should say Y here.
-	  See <file:Documentation/cciss.txt> for the current list of
+	  See <file:Documentation/blockdev/cciss.txt> for the current list of
 	  boards supported by this driver, and for further information
 	  boards supported by this driver, and for further information
 	  on the use of this driver.
 	  on the use of this driver.
 
 
@@ -135,7 +136,7 @@ config CISS_SCSI_TAPE
 	help
 	help
 	  When enabled (Y), this option allows SCSI tape drives and SCSI medium
 	  When enabled (Y), this option allows SCSI tape drives and SCSI medium
 	  changers (tape robots) to be accessed via a Compaq 5xxx array 
 	  changers (tape robots) to be accessed via a Compaq 5xxx array 
-	  controller.  (See <file:Documentation/cciss.txt> for more details.)
+	  controller.  (See <file:Documentation/blockdev/cciss.txt> for more details.)
 
 
 	  "SCSI support" and "SCSI tape support" must also be enabled for this 
 	  "SCSI support" and "SCSI tape support" must also be enabled for this 
 	  option to work.
 	  option to work.
@@ -149,8 +150,8 @@ config BLK_DEV_DAC960
 	help
 	help
 	  This driver adds support for the Mylex DAC960, AcceleRAID, and
 	  This driver adds support for the Mylex DAC960, AcceleRAID, and
 	  eXtremeRAID PCI RAID controllers.  See the file
 	  eXtremeRAID PCI RAID controllers.  See the file
-	  <file:Documentation/README.DAC960> for further information about
-	  this driver.
+	  <file:Documentation/blockdev/README.DAC960> for further information
+	  about this driver.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called DAC960.
 	  module will be called DAC960.
@@ -278,9 +279,9 @@ config BLK_DEV_NBD
 	  userland (making server and client physically the same computer,
 	  userland (making server and client physically the same computer,
 	  communicating using the loopback network device).
 	  communicating using the loopback network device).
 
 
-	  Read <file:Documentation/nbd.txt> for more information, especially
-	  about where to find the server code, which runs in user space and
-	  does not need special kernel support.
+	  Read <file:Documentation/blockdev/nbd.txt> for more information,
+	  especially about where to find the server code, which runs in user
+	  space and does not need special kernel support.
 
 
 	  Note that this has nothing to do with the network file systems NFS
 	  Note that this has nothing to do with the network file systems NFS
 	  or Coda; you can say N here even if you intend to use NFS or Coda.
 	  or Coda; you can say N here even if you intend to use NFS or Coda.
@@ -321,8 +322,8 @@ config BLK_DEV_RAM
 	  store a copy of a minimal root file system off of a floppy into RAM
 	  store a copy of a minimal root file system off of a floppy into RAM
 	  during the initial install of Linux.
 	  during the initial install of Linux.
 
 
-	  Note that the kernel command line option "ramdisk=XX" is now
-	  obsolete. For details, read <file:Documentation/ramdisk.txt>.
+	  Note that the kernel command line option "ramdisk=XX" is now obsolete.
+	  For details, read <file:Documentation/blockdev/ramdisk.txt>.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called rd.
 	  module will be called rd.

+ 1 - 1
drivers/block/floppy.c

@@ -4124,7 +4124,7 @@ static int __init floppy_setup(char *str)
 		printk("\n");
 		printk("\n");
 	} else
 	} else
 		DPRINT("botched floppy option\n");
 		DPRINT("botched floppy option\n");
-	DPRINT("Read Documentation/floppy.txt\n");
+	DPRINT("Read Documentation/blockdev/floppy.txt\n");
 	return 0;
 	return 0;
 }
 }
 
 

+ 18 - 2
drivers/block/ub.c

@@ -1546,8 +1546,6 @@ static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd)
 
 
 /*
 /*
  * Reset management
  * Reset management
- * XXX Move usb_reset_device to khubd. Hogging kevent is not a good thing.
- * XXX Make usb_sync_reset asynchronous.
  */
  */
 
 
 static void ub_reset_enter(struct ub_dev *sc, int try)
 static void ub_reset_enter(struct ub_dev *sc, int try)
@@ -1632,6 +1630,22 @@ static void ub_reset_task(struct work_struct *work)
 	spin_unlock_irqrestore(sc->lock, flags);
 	spin_unlock_irqrestore(sc->lock, flags);
 }
 }
 
 
+/*
+ * XXX Reset brackets are too much hassle to implement, so just stub them
+ * in order to prevent forced unbinding (which deadlocks solid when our
+ * ->disconnect method waits for the reset to complete and this kills keventd).
+ *
+ * XXX Tell Alan to move usb_unlock_device inside of usb_reset_device,
+ * or else the post_reset is invoked, and restats I/O on a locked device.
+ */
+static int ub_pre_reset(struct usb_interface *iface) {
+	return 0;
+}
+
+static int ub_post_reset(struct usb_interface *iface) {
+	return 0;
+}
+
 /*
 /*
  * This is called from a process context.
  * This is called from a process context.
  */
  */
@@ -2446,6 +2460,8 @@ static struct usb_driver ub_driver = {
 	.probe =	ub_probe,
 	.probe =	ub_probe,
 	.disconnect =	ub_disconnect,
 	.disconnect =	ub_disconnect,
 	.id_table =	ub_usb_ids,
 	.id_table =	ub_usb_ids,
+	.pre_reset =	ub_pre_reset,
+	.post_reset =	ub_post_reset,
 };
 };
 
 
 static int __init ub_init(void)
 static int __init ub_init(void)

+ 12 - 12
drivers/char/Kconfig

@@ -124,7 +124,7 @@ config COMPUTONE
 	  which give you many serial ports. You would need something like this
 	  which give you many serial ports. You would need something like this
 	  to connect more than two modems to your Linux box, for instance in
 	  to connect more than two modems to your Linux box, for instance in
 	  order to become a dial-in server. If you have a card like that, say
 	  order to become a dial-in server. If you have a card like that, say
-	  Y here and read <file:Documentation/computone.txt>.
+	  Y here and read <file:Documentation/serial/computone.txt>.
 
 
 	  To compile this driver as module, choose M here: the
 	  To compile this driver as module, choose M here: the
 	  module will be called ip2.
 	  module will be called ip2.
@@ -136,7 +136,7 @@ config ROCKETPORT
 	  This driver supports Comtrol RocketPort and RocketModem PCI boards.   
 	  This driver supports Comtrol RocketPort and RocketModem PCI boards.   
           These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or
           These boards provide 2, 4, 8, 16, or 32 high-speed serial ports or
           modems.  For information about the RocketPort/RocketModem  boards
           modems.  For information about the RocketPort/RocketModem  boards
-          and this driver read <file:Documentation/rocket.txt>.
+          and this driver read <file:Documentation/serial/rocket.txt>.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called rocket.
 	  module will be called rocket.
@@ -154,7 +154,7 @@ config CYCLADES
 	  your Linux box, for instance in order to become a dial-in server.
 	  your Linux box, for instance in order to become a dial-in server.
 
 
 	  For information about the Cyclades-Z card, read
 	  For information about the Cyclades-Z card, read
-	  <file:Documentation/README.cycladesZ>.
+	  <file:Documentation/serial/README.cycladesZ>.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called cyclades.
 	  module will be called cyclades.
@@ -183,7 +183,7 @@ config DIGIEPCA
 	  box, for instance in order to become a dial-in server. This driver
 	  box, for instance in order to become a dial-in server. This driver
 	  supports the original PC (ISA) boards as well as PCI, and EISA. If
 	  supports the original PC (ISA) boards as well as PCI, and EISA. If
 	  you have a card like this, say Y here and read the file
 	  you have a card like this, say Y here and read the file
-	  <file:Documentation/digiepca.txt>.
+	  <file:Documentation/serial/digiepca.txt>.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called epca.
 	  module will be called epca.
@@ -289,7 +289,7 @@ config RISCOM8
 	  which gives you many serial ports. You would need something like
 	  which gives you many serial ports. You would need something like
 	  this to connect more than two modems to your Linux box, for instance
 	  this to connect more than two modems to your Linux box, for instance
 	  in order to become a dial-in server. If you have a card like that,
 	  in order to become a dial-in server. If you have a card like that,
-	  say Y here and read the file <file:Documentation/riscom8.txt>.
+	  say Y here and read the file <file:Documentation/serial/riscom8.txt>.
 
 
 	  Also it's possible to say M here and compile this driver as kernel
 	  Also it's possible to say M here and compile this driver as kernel
 	  loadable module; the module will be called riscom8.
 	  loadable module; the module will be called riscom8.
@@ -304,8 +304,8 @@ config SPECIALIX
 	  your Linux box, for instance in order to become a dial-in server.
 	  your Linux box, for instance in order to become a dial-in server.
 
 
 	  If you have a card like that, say Y here and read the file
 	  If you have a card like that, say Y here and read the file
-	  <file:Documentation/specialix.txt>. Also it's possible to say M here
-	  and compile this driver as kernel loadable module which will be
+	  <file:Documentation/serial/specialix.txt>. Also it's possible to say
+	  M here and compile this driver as kernel loadable module which will be
 	  called specialix.
 	  called specialix.
 
 
 config SX
 config SX
@@ -313,7 +313,7 @@ config SX
 	depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
 	depends on SERIAL_NONSTANDARD && (PCI || EISA || ISA)
 	help
 	help
 	  This is a driver for the SX and SI multiport serial cards.
 	  This is a driver for the SX and SI multiport serial cards.
-	  Please read the file <file:Documentation/sx.txt> for details.
+	  Please read the file <file:Documentation/serial/sx.txt> for details.
 
 
 	  This driver can only be built as a module ( = code which can be
 	  This driver can only be built as a module ( = code which can be
 	  inserted in and removed from the running kernel whenever you want).
 	  inserted in and removed from the running kernel whenever you want).
@@ -344,8 +344,8 @@ config STALDRV
 	  like this to connect more than two modems to your Linux box, for
 	  like this to connect more than two modems to your Linux box, for
 	  instance in order to become a dial-in server.  If you say Y here,
 	  instance in order to become a dial-in server.  If you say Y here,
 	  you will be asked for your specific card model in the next
 	  you will be asked for your specific card model in the next
-	  questions.  Make sure to read <file:Documentation/stallion.txt> in
-	  this case.  If you have never heard about all this, it's safe to
+	  questions.  Make sure to read <file:Documentation/serial/stallion.txt>
+	  in this case.  If you have never heard about all this, it's safe to
 	  say N.
 	  say N.
 
 
 config STALLION
 config STALLION
@@ -354,7 +354,7 @@ config STALLION
 	help
 	help
 	  If you have an EasyIO or EasyConnection 8/32 multiport Stallion
 	  If you have an EasyIO or EasyConnection 8/32 multiport Stallion
 	  card, then this is for you; say Y.  Make sure to read
 	  card, then this is for you; say Y.  Make sure to read
-	  <file:Documentation/stallion.txt>.
+	  <file:Documentation/serial/stallion.txt>.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called stallion.
 	  module will be called stallion.
@@ -365,7 +365,7 @@ config ISTALLION
 	help
 	help
 	  If you have an EasyConnection 8/64, ONboard, Brumby or Stallion
 	  If you have an EasyConnection 8/64, ONboard, Brumby or Stallion
 	  serial multiport card, say Y here. Make sure to read
 	  serial multiport card, say Y here. Make sure to read
-	  <file:Documentation/stallion.txt>.
+	  <file:Documentation/serial/stallion.txt>.
 
 
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called istallion.
 	  module will be called istallion.

+ 1 - 1
drivers/char/specialix.c

@@ -72,7 +72,7 @@
 /*
 /*
  * There is a bunch of documentation about the card, jumpers, config
  * There is a bunch of documentation about the card, jumpers, config
  * settings, restrictions, cables, device names and numbers in
  * settings, restrictions, cables, device names and numbers in
- * Documentation/specialix.txt
+ * Documentation/serial/specialix.txt
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>

+ 9 - 2
drivers/hid/hid-apple.c

@@ -55,10 +55,11 @@ struct apple_key_translation {
 
 
 static struct apple_key_translation apple_fn_keys[] = {
 static struct apple_key_translation apple_fn_keys[] = {
 	{ KEY_BACKSPACE, KEY_DELETE },
 	{ KEY_BACKSPACE, KEY_DELETE },
+	{ KEY_ENTER,	KEY_INSERT },
 	{ KEY_F1,	KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
 	{ KEY_F1,	KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
 	{ KEY_F2,	KEY_BRIGHTNESSUP,   APPLE_FLAG_FKEY },
 	{ KEY_F2,	KEY_BRIGHTNESSUP,   APPLE_FLAG_FKEY },
-	{ KEY_F3,	KEY_FN_F5,          APPLE_FLAG_FKEY }, /* Exposé */
-	{ KEY_F4,	KEY_FN_F4,          APPLE_FLAG_FKEY }, /* Dashboard */
+	{ KEY_F3,	KEY_SCALE,          APPLE_FLAG_FKEY },
+	{ KEY_F4,	KEY_DASHBOARD,      APPLE_FLAG_FKEY },
 	{ KEY_F5,	KEY_KBDILLUMDOWN,   APPLE_FLAG_FKEY },
 	{ KEY_F5,	KEY_KBDILLUMDOWN,   APPLE_FLAG_FKEY },
 	{ KEY_F6,	KEY_KBDILLUMUP,     APPLE_FLAG_FKEY },
 	{ KEY_F6,	KEY_KBDILLUMUP,     APPLE_FLAG_FKEY },
 	{ KEY_F7,	KEY_PREVIOUSSONG,   APPLE_FLAG_FKEY },
 	{ KEY_F7,	KEY_PREVIOUSSONG,   APPLE_FLAG_FKEY },
@@ -418,6 +419,12 @@ static const struct hid_device_id apple_devices[] = {
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
 		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
+		.driver_data = APPLE_HAS_FN },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
+		.driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
+		.driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 		.driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),

+ 9 - 3
drivers/hid/hid-core.c

@@ -1250,9 +1250,11 @@ static const struct hid_device_id hid_blacklist[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
@@ -1265,7 +1267,6 @@ static const struct hid_device_id hid_blacklist[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
@@ -1409,6 +1410,7 @@ static const struct hid_device_id hid_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
 	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM2)},
+	{ HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) },
@@ -1486,6 +1488,7 @@ static const struct hid_device_id hid_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_CASSY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_POCKETCASSY) },
@@ -1573,6 +1576,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
 	{ }
 	{ }
@@ -1730,7 +1736,7 @@ static int __init hid_init(void)
 		goto err_bus;
 		goto err_bus;
 
 
 #ifdef CONFIG_HID_COMPAT
 #ifdef CONFIG_HID_COMPAT
-	hid_compat_wq = create_workqueue("hid_compat");
+	hid_compat_wq = create_singlethread_workqueue("hid_compat");
 	if (!hid_compat_wq) {
 	if (!hid_compat_wq) {
 		hidraw_exit();
 		hidraw_exit();
 		goto err;
 		goto err;

+ 3 - 0
drivers/hid/hid-ids.h

@@ -82,6 +82,9 @@
 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI	0x0230
 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI	0x0230
 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO	0x0231
 #define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO	0x0231
 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS	0x0232
 #define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS	0x0232
+#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI	0x0236
+#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO	0x0237
+#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS	0x0238
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY	0x030a
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY	0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY	0x030b
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY	0x030b
 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL	0x8241
 #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL	0x8241

+ 16 - 14
drivers/hid/hidraw.c

@@ -38,7 +38,7 @@ static int hidraw_major;
 static struct cdev hidraw_cdev;
 static struct cdev hidraw_cdev;
 static struct class *hidraw_class;
 static struct class *hidraw_class;
 static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];
 static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];
-static DEFINE_SPINLOCK(minors_lock);
+static DEFINE_MUTEX(minors_lock);
 
 
 static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
 {
@@ -159,13 +159,13 @@ static int hidraw_open(struct inode *inode, struct file *file)
 	struct hidraw_list *list;
 	struct hidraw_list *list;
 	int err = 0;
 	int err = 0;
 
 
-	lock_kernel();
 	if (!(list = kzalloc(sizeof(struct hidraw_list), GFP_KERNEL))) {
 	if (!(list = kzalloc(sizeof(struct hidraw_list), GFP_KERNEL))) {
 		err = -ENOMEM;
 		err = -ENOMEM;
 		goto out;
 		goto out;
 	}
 	}
 
 
-	spin_lock(&minors_lock);
+	lock_kernel();
+	mutex_lock(&minors_lock);
 	if (!hidraw_table[minor]) {
 	if (!hidraw_table[minor]) {
 		printk(KERN_EMERG "hidraw device with minor %d doesn't exist\n",
 		printk(KERN_EMERG "hidraw device with minor %d doesn't exist\n",
 				minor);
 				minor);
@@ -180,13 +180,16 @@ static int hidraw_open(struct inode *inode, struct file *file)
 	file->private_data = list;
 	file->private_data = list;
 
 
 	dev = hidraw_table[minor];
 	dev = hidraw_table[minor];
-	if (!dev->open++)
-		dev->hid->ll_driver->open(dev->hid);
+	if (!dev->open++) {
+		err = dev->hid->ll_driver->open(dev->hid);
+		if (err < 0)
+			dev->open--;
+	}
 
 
 out_unlock:
 out_unlock:
-	spin_unlock(&minors_lock);
-out:
+	mutex_unlock(&minors_lock);
 	unlock_kernel();
 	unlock_kernel();
+out:
 	return err;
 	return err;
 
 
 }
 }
@@ -310,7 +313,7 @@ int hidraw_connect(struct hid_device *hid)
 
 
 	result = -EINVAL;
 	result = -EINVAL;
 
 
-	spin_lock(&minors_lock);
+	mutex_lock(&minors_lock);
 
 
 	for (minor = 0; minor < HIDRAW_MAX_DEVICES; minor++) {
 	for (minor = 0; minor < HIDRAW_MAX_DEVICES; minor++) {
 		if (hidraw_table[minor])
 		if (hidraw_table[minor])
@@ -320,9 +323,8 @@ int hidraw_connect(struct hid_device *hid)
 		break;
 		break;
 	}
 	}
 
 
-	spin_unlock(&minors_lock);
-
 	if (result) {
 	if (result) {
+		mutex_unlock(&minors_lock);
 		kfree(dev);
 		kfree(dev);
 		goto out;
 		goto out;
 	}
 	}
@@ -331,14 +333,14 @@ int hidraw_connect(struct hid_device *hid)
 				 NULL, "%s%d", "hidraw", minor);
 				 NULL, "%s%d", "hidraw", minor);
 
 
 	if (IS_ERR(dev->dev)) {
 	if (IS_ERR(dev->dev)) {
-		spin_lock(&minors_lock);
 		hidraw_table[minor] = NULL;
 		hidraw_table[minor] = NULL;
-		spin_unlock(&minors_lock);
+		mutex_unlock(&minors_lock);
 		result = PTR_ERR(dev->dev);
 		result = PTR_ERR(dev->dev);
 		kfree(dev);
 		kfree(dev);
 		goto out;
 		goto out;
 	}
 	}
 
 
+	mutex_unlock(&minors_lock);
 	init_waitqueue_head(&dev->wait);
 	init_waitqueue_head(&dev->wait);
 	INIT_LIST_HEAD(&dev->list);
 	INIT_LIST_HEAD(&dev->list);
 
 
@@ -360,9 +362,9 @@ void hidraw_disconnect(struct hid_device *hid)
 
 
 	hidraw->exist = 0;
 	hidraw->exist = 0;
 
 
-	spin_lock(&minors_lock);
+	mutex_lock(&minors_lock);
 	hidraw_table[hidraw->minor] = NULL;
 	hidraw_table[hidraw->minor] = NULL;
-	spin_unlock(&minors_lock);
+	mutex_unlock(&minors_lock);
 
 
 	device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
 	device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
 
 

+ 19 - 6
drivers/hid/usbhid/hid-core.c

@@ -781,6 +781,8 @@ static int usbhid_start(struct hid_device *hid)
 	unsigned int n, insize = 0;
 	unsigned int n, insize = 0;
 	int ret;
 	int ret;
 
 
+	clear_bit(HID_DISCONNECTED, &usbhid->iofl);
+
 	usbhid->bufsize = HID_MIN_BUFFER_SIZE;
 	usbhid->bufsize = HID_MIN_BUFFER_SIZE;
 	hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize);
 	hid_find_max_report(hid, HID_INPUT_REPORT, &usbhid->bufsize);
 	hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize);
 	hid_find_max_report(hid, HID_OUTPUT_REPORT, &usbhid->bufsize);
@@ -847,12 +849,6 @@ static int usbhid_start(struct hid_device *hid)
 		}
 		}
 	}
 	}
 
 
-	if (!usbhid->urbin) {
-		err_hid("couldn't find an input interrupt endpoint");
-		ret = -ENODEV;
-		goto fail;
-	}
-
 	init_waitqueue_head(&usbhid->wait);
 	init_waitqueue_head(&usbhid->wait);
 	INIT_WORK(&usbhid->reset_work, hid_reset);
 	INIT_WORK(&usbhid->reset_work, hid_reset);
 	setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
 	setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid);
@@ -888,6 +884,9 @@ fail:
 	usb_free_urb(usbhid->urbin);
 	usb_free_urb(usbhid->urbin);
 	usb_free_urb(usbhid->urbout);
 	usb_free_urb(usbhid->urbout);
 	usb_free_urb(usbhid->urbctrl);
 	usb_free_urb(usbhid->urbctrl);
+	usbhid->urbin = NULL;
+	usbhid->urbout = NULL;
+	usbhid->urbctrl = NULL;
 	hid_free_buffers(dev, hid);
 	hid_free_buffers(dev, hid);
 	mutex_unlock(&usbhid->setup);
 	mutex_unlock(&usbhid->setup);
 	return ret;
 	return ret;
@@ -924,6 +923,9 @@ static void usbhid_stop(struct hid_device *hid)
 	usb_free_urb(usbhid->urbin);
 	usb_free_urb(usbhid->urbin);
 	usb_free_urb(usbhid->urbctrl);
 	usb_free_urb(usbhid->urbctrl);
 	usb_free_urb(usbhid->urbout);
 	usb_free_urb(usbhid->urbout);
+	usbhid->urbin = NULL; /* don't mess up next start */
+	usbhid->urbctrl = NULL;
+	usbhid->urbout = NULL;
 
 
 	hid_free_buffers(hid_to_usb_dev(hid), hid);
 	hid_free_buffers(hid_to_usb_dev(hid), hid);
 	mutex_unlock(&usbhid->setup);
 	mutex_unlock(&usbhid->setup);
@@ -940,15 +942,26 @@ static struct hid_ll_driver usb_hid_driver = {
 
 
 static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
 static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id)
 {
 {
+	struct usb_host_interface *interface = intf->cur_altsetting;
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct usbhid_device *usbhid;
 	struct usbhid_device *usbhid;
 	struct hid_device *hid;
 	struct hid_device *hid;
+	unsigned int n, has_in = 0;
 	size_t len;
 	size_t len;
 	int ret;
 	int ret;
 
 
 	dbg_hid("HID probe called for ifnum %d\n",
 	dbg_hid("HID probe called for ifnum %d\n",
 			intf->altsetting->desc.bInterfaceNumber);
 			intf->altsetting->desc.bInterfaceNumber);
 
 
+	for (n = 0; n < interface->desc.bNumEndpoints; n++)
+		if (usb_endpoint_is_int_in(&interface->endpoint[n].desc))
+			has_in++;
+	if (!has_in) {
+		dev_err(&intf->dev, "couldn't find an input interrupt "
+				"endpoint\n");
+		return -ENODEV;
+	}
+
 	hid = hid_allocate_device();
 	hid = hid_allocate_device();
 	if (IS_ERR(hid))
 	if (IS_ERR(hid))
 		return PTR_ERR(hid);
 		return PTR_ERR(hid);

+ 0 - 1
drivers/hwmon/lis3lv02d.c

@@ -33,7 +33,6 @@
 #include <linux/wait.h>
 #include <linux/wait.h>
 #include <linux/poll.h>
 #include <linux/poll.h>
 #include <linux/freezer.h>
 #include <linux/freezer.h>
-#include <linux/version.h>
 #include <linux/uaccess.h>
 #include <linux/uaccess.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_drivers.h>
 #include <asm/atomic.h>
 #include <asm/atomic.h>

+ 2 - 1
drivers/i2c/busses/i2c-sh_mobile.c

@@ -318,7 +318,8 @@ static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd)
 		} else
 		} else
 			data = i2c_op(pd, OP_RX, 0);
 			data = i2c_op(pd, OP_RX, 0);
 
 
-		pd->msg->buf[real_pos] = data;
+		if (real_pos >= 0)
+			pd->msg->buf[real_pos] = data;
 	} while (0);
 	} while (0);
 
 
 	pd->pos++;
 	pd->pos++;

+ 1 - 0
drivers/ide/ide-cs.c

@@ -444,6 +444,7 @@ static struct pcmcia_device_id ide_ids[] = {
 	PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
 	PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
 	PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),
 	PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),
 	PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
 	PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6),
+	PCMCIA_DEVICE_PROD_ID2("Flash Card", 0x5a362506),
 	PCMCIA_DEVICE_NULL,
 	PCMCIA_DEVICE_NULL,
 };
 };
 MODULE_DEVICE_TABLE(pcmcia, ide_ids);
 MODULE_DEVICE_TABLE(pcmcia, ide_ids);

+ 4 - 2
drivers/isdn/i4l/isdn_net.c

@@ -1641,8 +1641,10 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp)
 	/* slarp reply, send own ip/netmask; if values are nonsense remote
 	/* slarp reply, send own ip/netmask; if values are nonsense remote
 	 * should think we are unable to provide it with an address via SLARP */
 	 * should think we are unable to provide it with an address via SLARP */
 	p += put_u32(p, CISCO_SLARP_REPLY);
 	p += put_u32(p, CISCO_SLARP_REPLY);
-	p += put_u32(p, addr);	// address
-	p += put_u32(p, mask);	// netmask
+	*(__be32 *)p = addr;	// address
+	p += 4;
+	*(__be32 *)p = mask;	// netmask
+	p += 4;
 	p += put_u16(p, 0);	// unused
 	p += put_u16(p, 0);	// unused
 
 
 	isdn_net_write_super(lp, skb);
 	isdn_net_write_super(lp, skb);

+ 6 - 2
drivers/md/dm-mpath.c

@@ -441,13 +441,13 @@ static void process_queued_ios(struct work_struct *work)
 		__choose_pgpath(m);
 		__choose_pgpath(m);
 
 
 	pgpath = m->current_pgpath;
 	pgpath = m->current_pgpath;
-	m->pgpath_to_activate = m->current_pgpath;
 
 
 	if ((pgpath && !m->queue_io) ||
 	if ((pgpath && !m->queue_io) ||
 	    (!pgpath && !m->queue_if_no_path))
 	    (!pgpath && !m->queue_if_no_path))
 		must_queue = 0;
 		must_queue = 0;
 
 
-	if (m->pg_init_required && !m->pg_init_in_progress) {
+	if (m->pg_init_required && !m->pg_init_in_progress && pgpath) {
+		m->pgpath_to_activate = pgpath;
 		m->pg_init_count++;
 		m->pg_init_count++;
 		m->pg_init_required = 0;
 		m->pg_init_required = 0;
 		m->pg_init_in_progress = 1;
 		m->pg_init_in_progress = 1;
@@ -708,6 +708,10 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m)
 		m->hw_handler_name = NULL;
 		m->hw_handler_name = NULL;
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
+
+	if (hw_argc > 1)
+		DMWARN("Ignoring user-specified arguments for "
+		       "hardware handler \"%s\"", m->hw_handler_name);
 	consume(as, hw_argc - 1);
 	consume(as, hw_argc - 1);
 
 
 	return 0;
 	return 0;

+ 1 - 0
drivers/md/dm-raid1.c

@@ -1032,6 +1032,7 @@ static void mirror_dtr(struct dm_target *ti)
 
 
 	del_timer_sync(&ms->timer);
 	del_timer_sync(&ms->timer);
 	flush_workqueue(ms->kmirrord_wq);
 	flush_workqueue(ms->kmirrord_wq);
+	flush_scheduled_work();
 	dm_kcopyd_client_destroy(ms->kcopyd_client);
 	dm_kcopyd_client_destroy(ms->kcopyd_client);
 	destroy_workqueue(ms->kmirrord_wq);
 	destroy_workqueue(ms->kmirrord_wq);
 	free_context(ms, ti, ms->nr_mirrors);
 	free_context(ms, ti, ms->nr_mirrors);

+ 3 - 1
drivers/md/dm-stripe.c

@@ -320,8 +320,10 @@ int __init dm_stripe_init(void)
 	int r;
 	int r;
 
 
 	r = dm_register_target(&stripe_target);
 	r = dm_register_target(&stripe_target);
-	if (r < 0)
+	if (r < 0) {
 		DMWARN("target registration failed");
 		DMWARN("target registration failed");
+		return r;
+	}
 
 
 	kstriped = create_singlethread_workqueue("kstriped");
 	kstriped = create_singlethread_workqueue("kstriped");
 	if (!kstriped) {
 	if (!kstriped) {

+ 21 - 13
drivers/md/dm.c

@@ -375,7 +375,7 @@ static void start_io_acct(struct dm_io *io)
 	dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending);
 	dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending);
 }
 }
 
 
-static int end_io_acct(struct dm_io *io)
+static void end_io_acct(struct dm_io *io)
 {
 {
 	struct mapped_device *md = io->md;
 	struct mapped_device *md = io->md;
 	struct bio *bio = io->bio;
 	struct bio *bio = io->bio;
@@ -391,7 +391,9 @@ static int end_io_acct(struct dm_io *io)
 	dm_disk(md)->part0.in_flight = pending =
 	dm_disk(md)->part0.in_flight = pending =
 		atomic_dec_return(&md->pending);
 		atomic_dec_return(&md->pending);
 
 
-	return !pending;
+	/* nudge anyone waiting on suspend queue */
+	if (!pending)
+		wake_up(&md->wait);
 }
 }
 
 
 /*
 /*
@@ -499,9 +501,7 @@ static void dec_pending(struct dm_io *io, int error)
 			spin_unlock_irqrestore(&io->md->pushback_lock, flags);
 			spin_unlock_irqrestore(&io->md->pushback_lock, flags);
 		}
 		}
 
 
-		if (end_io_acct(io))
-			/* nudge anyone waiting on suspend queue */
-			wake_up(&io->md->wait);
+		end_io_acct(io);
 
 
 		if (io->error != DM_ENDIO_REQUEUE) {
 		if (io->error != DM_ENDIO_REQUEUE) {
 			blk_add_trace_bio(io->md->queue, io->bio,
 			blk_add_trace_bio(io->md->queue, io->bio,
@@ -937,16 +937,24 @@ static void dm_unplug_all(struct request_queue *q)
 
 
 static int dm_any_congested(void *congested_data, int bdi_bits)
 static int dm_any_congested(void *congested_data, int bdi_bits)
 {
 {
-	int r;
-	struct mapped_device *md = (struct mapped_device *) congested_data;
-	struct dm_table *map = dm_get_table(md);
+	int r = bdi_bits;
+	struct mapped_device *md = congested_data;
+	struct dm_table *map;
 
 
-	if (!map || test_bit(DMF_BLOCK_IO, &md->flags))
-		r = bdi_bits;
-	else
-		r = dm_table_any_congested(map, bdi_bits);
+	atomic_inc(&md->pending);
+
+	if (!test_bit(DMF_BLOCK_IO, &md->flags)) {
+		map = dm_get_table(md);
+		if (map) {
+			r = dm_table_any_congested(map, bdi_bits);
+			dm_table_put(map);
+		}
+	}
+
+	if (!atomic_dec_return(&md->pending))
+		/* nudge anyone waiting on suspend queue */
+		wake_up(&md->wait);
 
 
-	dm_table_put(map);
 	return r;
 	return r;
 }
 }
 
 

+ 149 - 82
drivers/media/video/tvaudio.c

@@ -1,5 +1,5 @@
 /*
 /*
- * experimental driver for simple i2c audio chips.
+ * Driver for simple i2c audio chips.
  *
  *
  * Copyright (c) 2000 Gerd Knorr
  * Copyright (c) 2000 Gerd Knorr
  * based on code by:
  * based on code by:
@@ -7,6 +7,10 @@
  *   Steve VanDeBogart (vandebo@uclink.berkeley.edu)
  *   Steve VanDeBogart (vandebo@uclink.berkeley.edu)
  *   Greg Alexander (galexand@acm.org)
  *   Greg Alexander (galexand@acm.org)
  *
  *
+ * Copyright(c) 2005-2008 Mauro Carvalho Chehab
+ *	- Some cleanups, code fixes, etc
+ *	- Convert it to V4L2 API
+ *
  * This code is placed under the terms of the GNU General Public License
  * This code is placed under the terms of the GNU General Public License
  *
  *
  * OPTIONS:
  * OPTIONS:
@@ -30,6 +34,7 @@
 
 
 #include <media/tvaudio.h>
 #include <media/tvaudio.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 #include <media/v4l2-chip-ident.h>
 #include <media/v4l2-chip-ident.h>
 #include <media/v4l2-i2c-drv-legacy.h>
 #include <media/v4l2-i2c-drv-legacy.h>
 
 
@@ -58,7 +63,6 @@ typedef int  (*checkit)(struct CHIPSTATE*);
 typedef int  (*initialize)(struct CHIPSTATE*);
 typedef int  (*initialize)(struct CHIPSTATE*);
 typedef int  (*getmode)(struct CHIPSTATE*);
 typedef int  (*getmode)(struct CHIPSTATE*);
 typedef void (*setmode)(struct CHIPSTATE*, int mode);
 typedef void (*setmode)(struct CHIPSTATE*, int mode);
-typedef void (*checkmode)(struct CHIPSTATE*);
 
 
 /* i2c command */
 /* i2c command */
 typedef struct AUDIOCMD {
 typedef struct AUDIOCMD {
@@ -79,6 +83,7 @@ struct CHIPDESC {
 #define CHIP_HAS_VOLUME      1
 #define CHIP_HAS_VOLUME      1
 #define CHIP_HAS_BASSTREBLE  2
 #define CHIP_HAS_BASSTREBLE  2
 #define CHIP_HAS_INPUTSEL    4
 #define CHIP_HAS_INPUTSEL    4
+#define CHIP_NEED_CHECKMODE  8
 
 
 	/* various i2c command sequences */
 	/* various i2c command sequences */
 	audiocmd   init;
 	audiocmd   init;
@@ -96,23 +101,20 @@ struct CHIPDESC {
 	getmode  getmode;
 	getmode  getmode;
 	setmode  setmode;
 	setmode  setmode;
 
 
-	/* check / autoswitch audio after channel switches */
-	checkmode  checkmode;
-
 	/* input switch register + values for v4l inputs */
 	/* input switch register + values for v4l inputs */
 	int  inputreg;
 	int  inputreg;
 	int  inputmap[4];
 	int  inputmap[4];
 	int  inputmute;
 	int  inputmute;
 	int  inputmask;
 	int  inputmask;
 };
 };
-static struct CHIPDESC chiplist[];
 
 
 /* current state of the chip */
 /* current state of the chip */
 struct CHIPSTATE {
 struct CHIPSTATE {
 	struct i2c_client *c;
 	struct i2c_client *c;
 
 
-	/* index into CHIPDESC array */
-	int type;
+	/* chip-specific description - should point to
+	   an entry at CHIPDESC table */
+	struct CHIPDESC *desc;
 
 
 	/* shadow register set */
 	/* shadow register set */
 	audiocmd   shadow;
 	audiocmd   shadow;
@@ -152,7 +154,7 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
 {
 {
 	unsigned char buffer[2];
 	unsigned char buffer[2];
 
 
-	if (-1 == subaddr) {
+	if (subaddr < 0) {
 		v4l_dbg(1, debug, chip->c, "%s: chip_write: 0x%x\n",
 		v4l_dbg(1, debug, chip->c, "%s: chip_write: 0x%x\n",
 			chip->c->name, val);
 			chip->c->name, val);
 		chip->shadow.bytes[1] = val;
 		chip->shadow.bytes[1] = val;
@@ -163,6 +165,13 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
 			return -1;
 			return -1;
 		}
 		}
 	} else {
 	} else {
+		if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
+			v4l_info(chip->c,
+				"Tried to access a non-existent register: %d\n",
+				subaddr);
+			return -EINVAL;
+		}
+
 		v4l_dbg(1, debug, chip->c, "%s: chip_write: reg%d=0x%x\n",
 		v4l_dbg(1, debug, chip->c, "%s: chip_write: reg%d=0x%x\n",
 			chip->c->name, subaddr, val);
 			chip->c->name, subaddr, val);
 		chip->shadow.bytes[subaddr+1] = val;
 		chip->shadow.bytes[subaddr+1] = val;
@@ -177,12 +186,20 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
 	return 0;
 	return 0;
 }
 }
 
 
-static int chip_write_masked(struct CHIPSTATE *chip, int subaddr, int val, int mask)
+static int chip_write_masked(struct CHIPSTATE *chip,
+			     int subaddr, int val, int mask)
 {
 {
 	if (mask != 0) {
 	if (mask != 0) {
-		if (-1 == subaddr) {
+		if (subaddr < 0) {
 			val = (chip->shadow.bytes[1] & ~mask) | (val & mask);
 			val = (chip->shadow.bytes[1] & ~mask) | (val & mask);
 		} else {
 		} else {
+			if (subaddr + 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
+				v4l_info(chip->c,
+					"Tried to access a non-existent register: %d\n",
+					subaddr);
+				return -EINVAL;
+			}
+
 			val = (chip->shadow.bytes[subaddr+1] & ~mask) | (val & mask);
 			val = (chip->shadow.bytes[subaddr+1] & ~mask) | (val & mask);
 		}
 		}
 	}
 	}
@@ -228,6 +245,15 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
 	if (0 == cmd->count)
 	if (0 == cmd->count)
 		return 0;
 		return 0;
 
 
+	if (cmd->count + cmd->bytes[0] - 1 >= ARRAY_SIZE(chip->shadow.bytes)) {
+		v4l_info(chip->c,
+			 "Tried to access a non-existent register range: %d to %d\n",
+			 cmd->bytes[0] + 1, cmd->bytes[0] + cmd->count - 1);
+		return -EINVAL;
+	}
+
+	/* FIXME: it seems that the shadow bytes are wrong bellow !*/
+
 	/* update our shadow register set; print bytes if (debug > 0) */
 	/* update our shadow register set; print bytes if (debug > 0) */
 	v4l_dbg(1, debug, chip->c, "%s: chip_cmd(%s): reg=%d, data:",
 	v4l_dbg(1, debug, chip->c, "%s: chip_cmd(%s): reg=%d, data:",
 		chip->c->name, name,cmd->bytes[0]);
 		chip->c->name, name,cmd->bytes[0]);
@@ -263,7 +289,8 @@ static void chip_thread_wake(unsigned long data)
 static int chip_thread(void *data)
 static int chip_thread(void *data)
 {
 {
 	struct CHIPSTATE *chip = data;
 	struct CHIPSTATE *chip = data;
-	struct CHIPDESC  *desc = chiplist + chip->type;
+	struct CHIPDESC  *desc = chip->desc;
+	int mode;
 
 
 	v4l_dbg(1, debug, chip->c, "%s: thread started\n", chip->c->name);
 	v4l_dbg(1, debug, chip->c, "%s: thread started\n", chip->c->name);
 	set_freezable();
 	set_freezable();
@@ -282,7 +309,26 @@ static int chip_thread(void *data)
 			continue;
 			continue;
 
 
 		/* have a look what's going on */
 		/* have a look what's going on */
-		desc->checkmode(chip);
+		mode = desc->getmode(chip);
+		if (mode == chip->prevmode)
+			continue;
+
+		/* chip detected a new audio mode - set it */
+		v4l_dbg(1, debug, chip->c, "%s: thread checkmode\n",
+			chip->c->name);
+
+		chip->prevmode = mode;
+
+		if (mode & V4L2_TUNER_MODE_STEREO)
+			desc->setmode(chip, V4L2_TUNER_MODE_STEREO);
+		if (mode & V4L2_TUNER_MODE_LANG1_LANG2)
+			desc->setmode(chip, V4L2_TUNER_MODE_STEREO);
+		else if (mode & V4L2_TUNER_MODE_LANG1)
+			desc->setmode(chip, V4L2_TUNER_MODE_LANG1);
+		else if (mode & V4L2_TUNER_MODE_LANG2)
+			desc->setmode(chip, V4L2_TUNER_MODE_LANG2);
+		else
+			desc->setmode(chip, V4L2_TUNER_MODE_MONO);
 
 
 		/* schedule next check */
 		/* schedule next check */
 		mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
 		mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
@@ -292,29 +338,6 @@ static int chip_thread(void *data)
 	return 0;
 	return 0;
 }
 }
 
 
-static void generic_checkmode(struct CHIPSTATE *chip)
-{
-	struct CHIPDESC  *desc = chiplist + chip->type;
-	int mode = desc->getmode(chip);
-
-	if (mode == chip->prevmode)
-	return;
-
-	v4l_dbg(1, debug, chip->c, "%s: thread checkmode\n", chip->c->name);
-	chip->prevmode = mode;
-
-	if (mode & V4L2_TUNER_MODE_STEREO)
-		desc->setmode(chip,V4L2_TUNER_MODE_STEREO);
-	if (mode & V4L2_TUNER_MODE_LANG1_LANG2)
-		desc->setmode(chip,V4L2_TUNER_MODE_STEREO);
-	else if (mode & V4L2_TUNER_MODE_LANG1)
-		desc->setmode(chip,V4L2_TUNER_MODE_LANG1);
-	else if (mode & V4L2_TUNER_MODE_LANG2)
-		desc->setmode(chip,V4L2_TUNER_MODE_LANG2);
-	else
-		desc->setmode(chip,V4L2_TUNER_MODE_MONO);
-}
-
 /* ---------------------------------------------------------------------- */
 /* ---------------------------------------------------------------------- */
 /* audio chip descriptions - defines+functions for tda9840                */
 /* audio chip descriptions - defines+functions for tda9840                */
 
 
@@ -777,7 +800,7 @@ static struct tda9874a_MODES {
 	char *name;
 	char *name;
 	audiocmd cmd;
 	audiocmd cmd;
 } tda9874a_modelist[9] = {
 } tda9874a_modelist[9] = {
-  {	"A2, B/G",
+  {	"A2, B/G", /* default */
 	{ 9, { TDA9874A_C1FRA, 0x72,0x95,0x55, 0x77,0xA0,0x00, 0x00,0x00 }} },
 	{ 9, { TDA9874A_C1FRA, 0x72,0x95,0x55, 0x77,0xA0,0x00, 0x00,0x00 }} },
   {	"A2, M (Korea)",
   {	"A2, M (Korea)",
 	{ 9, { TDA9874A_C1FRA, 0x5D,0xC0,0x00, 0x62,0x6A,0xAA, 0x20,0x22 }} },
 	{ 9, { TDA9874A_C1FRA, 0x5D,0xC0,0x00, 0x62,0x6A,0xAA, 0x20,0x22 }} },
@@ -791,7 +814,7 @@ static struct tda9874a_MODES {
 	{ 9, { TDA9874A_C1FRA, 0x7D,0x00,0x00, 0x88,0x8A,0xAA, 0x08,0x33 }} },
 	{ 9, { TDA9874A_C1FRA, 0x7D,0x00,0x00, 0x88,0x8A,0xAA, 0x08,0x33 }} },
   {	"NICAM, B/G",
   {	"NICAM, B/G",
 	{ 9, { TDA9874A_C1FRA, 0x72,0x95,0x55, 0x79,0xEA,0xAA, 0x08,0x33 }} },
 	{ 9, { TDA9874A_C1FRA, 0x72,0x95,0x55, 0x79,0xEA,0xAA, 0x08,0x33 }} },
-  {	"NICAM, D/K", /* default */
+  {	"NICAM, D/K",
 	{ 9, { TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x79,0xEA,0xAA, 0x08,0x33 }} },
 	{ 9, { TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x79,0xEA,0xAA, 0x08,0x33 }} },
   {	"NICAM, L",
   {	"NICAM, L",
 	{ 9, { TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x79,0xEA,0xAA, 0x09,0x33 }} }
 	{ 9, { TDA9874A_C1FRA, 0x87,0x6A,0xAA, 0x79,0xEA,0xAA, 0x09,0x33 }} }
@@ -981,7 +1004,7 @@ static int tda9874a_initialize(struct CHIPSTATE *chip)
 {
 {
 	if (tda9874a_SIF > 2)
 	if (tda9874a_SIF > 2)
 		tda9874a_SIF = 1;
 		tda9874a_SIF = 1;
-	if (tda9874a_STD > 8)
+	if (tda9874a_STD >= ARRAY_SIZE(tda9874a_modelist))
 		tda9874a_STD = 0;
 		tda9874a_STD = 0;
 	if(tda9874a_AMSEL > 1)
 	if(tda9874a_AMSEL > 1)
 		tda9874a_AMSEL = 0;
 		tda9874a_AMSEL = 0;
@@ -1089,7 +1112,7 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; }
 
 
 static int tda8425_initialize(struct CHIPSTATE *chip)
 static int tda8425_initialize(struct CHIPSTATE *chip)
 {
 {
-	struct CHIPDESC *desc = chiplist + chip->type;
+	struct CHIPDESC *desc = chip->desc;
 	int inputmap[4] = { /* tuner	*/ TDA8425_S1_CH2, /* radio  */ TDA8425_S1_CH1,
 	int inputmap[4] = { /* tuner	*/ TDA8425_S1_CH2, /* radio  */ TDA8425_S1_CH1,
 			    /* extern	*/ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF};
 			    /* extern	*/ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF};
 
 
@@ -1259,27 +1282,28 @@ static struct CHIPDESC chiplist[] = {
 		.addr_lo    = I2C_ADDR_TDA9840 >> 1,
 		.addr_lo    = I2C_ADDR_TDA9840 >> 1,
 		.addr_hi    = I2C_ADDR_TDA9840 >> 1,
 		.addr_hi    = I2C_ADDR_TDA9840 >> 1,
 		.registers  = 5,
 		.registers  = 5,
+		.flags      = CHIP_NEED_CHECKMODE,
 
 
+		/* callbacks */
 		.checkit    = tda9840_checkit,
 		.checkit    = tda9840_checkit,
 		.getmode    = tda9840_getmode,
 		.getmode    = tda9840_getmode,
 		.setmode    = tda9840_setmode,
 		.setmode    = tda9840_setmode,
-		.checkmode  = generic_checkmode,
 
 
 		.init       = { 2, { TDA9840_TEST, TDA9840_TEST_INT1SN
 		.init       = { 2, { TDA9840_TEST, TDA9840_TEST_INT1SN
 				/* ,TDA9840_SW, TDA9840_MONO */} }
 				/* ,TDA9840_SW, TDA9840_MONO */} }
 	},
 	},
 	{
 	{
 		.name       = "tda9873h",
 		.name       = "tda9873h",
-		.checkit    = tda9873_checkit,
 		.insmodopt  = &tda9873,
 		.insmodopt  = &tda9873,
 		.addr_lo    = I2C_ADDR_TDA985x_L >> 1,
 		.addr_lo    = I2C_ADDR_TDA985x_L >> 1,
 		.addr_hi    = I2C_ADDR_TDA985x_H >> 1,
 		.addr_hi    = I2C_ADDR_TDA985x_H >> 1,
 		.registers  = 3,
 		.registers  = 3,
-		.flags      = CHIP_HAS_INPUTSEL,
+		.flags      = CHIP_HAS_INPUTSEL | CHIP_NEED_CHECKMODE,
 
 
+		/* callbacks */
+		.checkit    = tda9873_checkit,
 		.getmode    = tda9873_getmode,
 		.getmode    = tda9873_getmode,
 		.setmode    = tda9873_setmode,
 		.setmode    = tda9873_setmode,
-		.checkmode  = generic_checkmode,
 
 
 		.init       = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } },
 		.init       = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } },
 		.inputreg   = TDA9873_SW,
 		.inputreg   = TDA9873_SW,
@@ -1290,15 +1314,16 @@ static struct CHIPDESC chiplist[] = {
 	},
 	},
 	{
 	{
 		.name       = "tda9874h/a",
 		.name       = "tda9874h/a",
-		.checkit    = tda9874a_checkit,
-		.initialize = tda9874a_initialize,
 		.insmodopt  = &tda9874a,
 		.insmodopt  = &tda9874a,
 		.addr_lo    = I2C_ADDR_TDA9874 >> 1,
 		.addr_lo    = I2C_ADDR_TDA9874 >> 1,
 		.addr_hi    = I2C_ADDR_TDA9874 >> 1,
 		.addr_hi    = I2C_ADDR_TDA9874 >> 1,
+		.flags      = CHIP_NEED_CHECKMODE,
 
 
+		/* callbacks */
+		.initialize = tda9874a_initialize,
+		.checkit    = tda9874a_checkit,
 		.getmode    = tda9874a_getmode,
 		.getmode    = tda9874a_getmode,
 		.setmode    = tda9874a_setmode,
 		.setmode    = tda9874a_setmode,
-		.checkmode  = generic_checkmode,
 	},
 	},
 	{
 	{
 		.name       = "tda9850",
 		.name       = "tda9850",
@@ -1324,10 +1349,11 @@ static struct CHIPDESC chiplist[] = {
 		.rightreg   = TDA9855_VR,
 		.rightreg   = TDA9855_VR,
 		.bassreg    = TDA9855_BA,
 		.bassreg    = TDA9855_BA,
 		.treblereg  = TDA9855_TR,
 		.treblereg  = TDA9855_TR,
+
+		/* callbacks */
 		.volfunc    = tda9855_volume,
 		.volfunc    = tda9855_volume,
 		.bassfunc   = tda9855_bass,
 		.bassfunc   = tda9855_bass,
 		.treblefunc = tda9855_treble,
 		.treblefunc = tda9855_treble,
-
 		.getmode    = tda985x_getmode,
 		.getmode    = tda985x_getmode,
 		.setmode    = tda985x_setmode,
 		.setmode    = tda985x_setmode,
 
 
@@ -1348,6 +1374,8 @@ static struct CHIPDESC chiplist[] = {
 		.rightreg   = TEA6300_VL,
 		.rightreg   = TEA6300_VL,
 		.bassreg    = TEA6300_BA,
 		.bassreg    = TEA6300_BA,
 		.treblereg  = TEA6300_TR,
 		.treblereg  = TEA6300_TR,
+
+		/* callbacks */
 		.volfunc    = tea6300_shift10,
 		.volfunc    = tea6300_shift10,
 		.bassfunc   = tea6300_shift12,
 		.bassfunc   = tea6300_shift12,
 		.treblefunc = tea6300_shift12,
 		.treblefunc = tea6300_shift12,
@@ -1358,7 +1386,6 @@ static struct CHIPDESC chiplist[] = {
 	},
 	},
 	{
 	{
 		.name       = "tea6320",
 		.name       = "tea6320",
-		.initialize = tea6320_initialize,
 		.insmodopt  = &tea6320,
 		.insmodopt  = &tea6320,
 		.addr_lo    = I2C_ADDR_TEA6300 >> 1,
 		.addr_lo    = I2C_ADDR_TEA6300 >> 1,
 		.addr_hi    = I2C_ADDR_TEA6300 >> 1,
 		.addr_hi    = I2C_ADDR_TEA6300 >> 1,
@@ -1369,6 +1396,9 @@ static struct CHIPDESC chiplist[] = {
 		.rightreg   = TEA6320_V,
 		.rightreg   = TEA6320_V,
 		.bassreg    = TEA6320_BA,
 		.bassreg    = TEA6320_BA,
 		.treblereg  = TEA6320_TR,
 		.treblereg  = TEA6320_TR,
+
+		/* callbacks */
+		.initialize = tea6320_initialize,
 		.volfunc    = tea6320_volume,
 		.volfunc    = tea6320_volume,
 		.bassfunc   = tea6320_shift11,
 		.bassfunc   = tea6320_shift11,
 		.treblefunc = tea6320_shift11,
 		.treblefunc = tea6320_shift11,
@@ -1401,16 +1431,18 @@ static struct CHIPDESC chiplist[] = {
 		.rightreg   = TDA8425_VR,
 		.rightreg   = TDA8425_VR,
 		.bassreg    = TDA8425_BA,
 		.bassreg    = TDA8425_BA,
 		.treblereg  = TDA8425_TR,
 		.treblereg  = TDA8425_TR,
+
+		/* callbacks */
+		.initialize = tda8425_initialize,
 		.volfunc    = tda8425_shift10,
 		.volfunc    = tda8425_shift10,
 		.bassfunc   = tda8425_shift12,
 		.bassfunc   = tda8425_shift12,
 		.treblefunc = tda8425_shift12,
 		.treblefunc = tda8425_shift12,
+		.setmode    = tda8425_setmode,
 
 
 		.inputreg   = TDA8425_S1,
 		.inputreg   = TDA8425_S1,
 		.inputmap   = { TDA8425_S1_CH1, TDA8425_S1_CH1, TDA8425_S1_CH1 },
 		.inputmap   = { TDA8425_S1_CH1, TDA8425_S1_CH1, TDA8425_S1_CH1 },
 		.inputmute  = TDA8425_S1_OFF,
 		.inputmute  = TDA8425_S1_OFF,
 
 
-		.setmode    = tda8425_setmode,
-		.initialize = tda8425_initialize,
 	},
 	},
 	{
 	{
 		.name       = "pic16c54 (PV951)",
 		.name       = "pic16c54 (PV951)",
@@ -1434,10 +1466,11 @@ static struct CHIPDESC chiplist[] = {
 		.addr_lo    = I2C_ADDR_TDA9840 >> 1,
 		.addr_lo    = I2C_ADDR_TDA9840 >> 1,
 		.addr_hi    = I2C_ADDR_TDA9840 >> 1,
 		.addr_hi    = I2C_ADDR_TDA9840 >> 1,
 		.registers  = 2,
 		.registers  = 2,
+		.flags      = CHIP_NEED_CHECKMODE,
 
 
+		/* callbacks */
 		.getmode    = ta8874z_getmode,
 		.getmode    = ta8874z_getmode,
 		.setmode    = ta8874z_setmode,
 		.setmode    = ta8874z_setmode,
-		.checkmode  = generic_checkmode,
 
 
 		.init       = {2, { TA8874Z_MONO_SET, TA8874Z_SEPARATION_DEFAULT}},
 		.init       = {2, { TA8874Z_MONO_SET, TA8874Z_SEPARATION_DEFAULT}},
 	},
 	},
@@ -1481,6 +1514,7 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	}
 	}
 	if (desc->name == NULL) {
 	if (desc->name == NULL) {
 		v4l_dbg(1, debug, client, "no matching chip description found\n");
 		v4l_dbg(1, debug, client, "no matching chip description found\n");
+		kfree(chip);
 		return -EIO;
 		return -EIO;
 	}
 	}
 	v4l_info(client, "%s found @ 0x%x (%s)\n", desc->name, client->addr<<1, client->adapter->name);
 	v4l_info(client, "%s found @ 0x%x (%s)\n", desc->name, client->addr<<1, client->adapter->name);
@@ -1494,7 +1528,7 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	/* fill required data structures */
 	/* fill required data structures */
 	if (!id)
 	if (!id)
 		strlcpy(client->name, desc->name, I2C_NAME_SIZE);
 		strlcpy(client->name, desc->name, I2C_NAME_SIZE);
-	chip->type = desc-chiplist;
+	chip->desc = desc;
 	chip->shadow.count = desc->registers+1;
 	chip->shadow.count = desc->registers+1;
 	chip->prevmode = -1;
 	chip->prevmode = -1;
 	chip->audmode = V4L2_TUNER_MODE_LANG1;
 	chip->audmode = V4L2_TUNER_MODE_LANG1;
@@ -1506,20 +1540,49 @@ static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		chip_cmd(chip,"init",&desc->init);
 		chip_cmd(chip,"init",&desc->init);
 
 
 	if (desc->flags & CHIP_HAS_VOLUME) {
 	if (desc->flags & CHIP_HAS_VOLUME) {
-		chip->left   = desc->leftinit   ? desc->leftinit   : 65535;
-		chip->right  = desc->rightinit  ? desc->rightinit  : 65535;
-		chip_write(chip,desc->leftreg,desc->volfunc(chip->left));
-		chip_write(chip,desc->rightreg,desc->volfunc(chip->right));
+		if (!desc->volfunc) {
+			/* This shouldn't be happen. Warn user, but keep working
+			   without volume controls
+			 */
+			v4l_info(chip->c, "volume callback undefined!\n");
+			desc->flags &= ~CHIP_HAS_VOLUME;
+		} else {
+			chip->left  = desc->leftinit  ? desc->leftinit  : 65535;
+			chip->right = desc->rightinit ? desc->rightinit : 65535;
+			chip_write(chip, desc->leftreg,
+				   desc->volfunc(chip->left));
+			chip_write(chip, desc->rightreg,
+				   desc->volfunc(chip->right));
+		}
 	}
 	}
 	if (desc->flags & CHIP_HAS_BASSTREBLE) {
 	if (desc->flags & CHIP_HAS_BASSTREBLE) {
-		chip->treble = desc->trebleinit ? desc->trebleinit : 32768;
-		chip->bass   = desc->bassinit   ? desc->bassinit   : 32768;
-		chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
-		chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
+		if (!desc->bassfunc || !desc->treblefunc) {
+			/* This shouldn't be happen. Warn user, but keep working
+			   without bass/treble controls
+			 */
+			v4l_info(chip->c, "bass/treble callbacks undefined!\n");
+			desc->flags &= ~CHIP_HAS_BASSTREBLE;
+		} else {
+			chip->treble = desc->trebleinit ?
+						desc->trebleinit : 32768;
+			chip->bass   = desc->bassinit   ?
+						desc->bassinit   : 32768;
+			chip_write(chip, desc->bassreg,
+				   desc->bassfunc(chip->bass));
+			chip_write(chip, desc->treblereg,
+				   desc->treblefunc(chip->treble));
+		}
 	}
 	}
 
 
 	chip->thread = NULL;
 	chip->thread = NULL;
-	if (desc->checkmode) {
+	if (desc->flags & CHIP_NEED_CHECKMODE) {
+		if (!desc->getmode || !desc->setmode) {
+			/* This shouldn't be happen. Warn user, but keep working
+			   without kthread
+			 */
+			v4l_info(chip->c, "set/get mode callbacks undefined!\n");
+			return 0;
+		}
 		/* start async thread */
 		/* start async thread */
 		init_timer(&chip->wt);
 		init_timer(&chip->wt);
 		chip->wt.function = chip_thread_wake;
 		chip->wt.function = chip_thread_wake;
@@ -1552,7 +1615,7 @@ static int chip_remove(struct i2c_client *client)
 static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
 static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
 			    struct v4l2_control *ctrl)
 			    struct v4l2_control *ctrl)
 {
 {
-	struct CHIPDESC *desc = chiplist + chip->type;
+	struct CHIPDESC *desc = chip->desc;
 
 
 	switch (ctrl->id) {
 	switch (ctrl->id) {
 	case V4L2_CID_AUDIO_MUTE:
 	case V4L2_CID_AUDIO_MUTE:
@@ -1576,13 +1639,13 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
 		return 0;
 		return 0;
 	}
 	}
 	case V4L2_CID_AUDIO_BASS:
 	case V4L2_CID_AUDIO_BASS:
-		if (desc->flags & CHIP_HAS_BASSTREBLE)
+		if (!(desc->flags & CHIP_HAS_BASSTREBLE))
 			break;
 			break;
 		ctrl->value = chip->bass;
 		ctrl->value = chip->bass;
 		return 0;
 		return 0;
 	case V4L2_CID_AUDIO_TREBLE:
 	case V4L2_CID_AUDIO_TREBLE:
-		if (desc->flags & CHIP_HAS_BASSTREBLE)
-			return -EINVAL;
+		if (!(desc->flags & CHIP_HAS_BASSTREBLE))
+			break;
 		ctrl->value = chip->treble;
 		ctrl->value = chip->treble;
 		return 0;
 		return 0;
 	}
 	}
@@ -1592,7 +1655,7 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
 static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
 static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
 			    struct v4l2_control *ctrl)
 			    struct v4l2_control *ctrl)
 {
 {
-	struct CHIPDESC *desc = chiplist + chip->type;
+	struct CHIPDESC *desc = chip->desc;
 
 
 	switch (ctrl->id) {
 	switch (ctrl->id) {
 	case V4L2_CID_AUDIO_MUTE:
 	case V4L2_CID_AUDIO_MUTE:
@@ -1642,16 +1705,15 @@ static int tvaudio_set_ctrl(struct CHIPSTATE *chip,
 		return 0;
 		return 0;
 	}
 	}
 	case V4L2_CID_AUDIO_BASS:
 	case V4L2_CID_AUDIO_BASS:
-		if (desc->flags & CHIP_HAS_BASSTREBLE)
+		if (!(desc->flags & CHIP_HAS_BASSTREBLE))
 			break;
 			break;
 		chip->bass = ctrl->value;
 		chip->bass = ctrl->value;
 		chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
 		chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));
 
 
 		return 0;
 		return 0;
 	case V4L2_CID_AUDIO_TREBLE:
 	case V4L2_CID_AUDIO_TREBLE:
-		if (desc->flags & CHIP_HAS_BASSTREBLE)
-			return -EINVAL;
-
+		if (!(desc->flags & CHIP_HAS_BASSTREBLE))
+			break;
 		chip->treble = ctrl->value;
 		chip->treble = ctrl->value;
 		chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
 		chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
 
 
@@ -1668,9 +1730,12 @@ static int chip_command(struct i2c_client *client,
 			unsigned int cmd, void *arg)
 			unsigned int cmd, void *arg)
 {
 {
 	struct CHIPSTATE *chip = i2c_get_clientdata(client);
 	struct CHIPSTATE *chip = i2c_get_clientdata(client);
-	struct CHIPDESC  *desc = chiplist + chip->type;
+	struct CHIPDESC  *desc = chip->desc;
 
 
-	v4l_dbg(1, debug, chip->c, "%s: chip_command 0x%x\n", chip->c->name, cmd);
+	if (debug > 0) {
+		v4l_i2c_print_ioctl(chip->c, cmd);
+		printk("\n");
+	}
 
 
 	switch (cmd) {
 	switch (cmd) {
 	case AUDC_SET_RADIO:
 	case AUDC_SET_RADIO:
@@ -1695,7 +1760,7 @@ static int chip_command(struct i2c_client *client,
 				break;
 				break;
 			case V4L2_CID_AUDIO_BASS:
 			case V4L2_CID_AUDIO_BASS:
 			case V4L2_CID_AUDIO_TREBLE:
 			case V4L2_CID_AUDIO_TREBLE:
-				if (desc->flags & CHIP_HAS_BASSTREBLE)
+				if (!(desc->flags & CHIP_HAS_BASSTREBLE))
 					return -EINVAL;
 					return -EINVAL;
 				break;
 				break;
 			default:
 			default:
@@ -1792,12 +1857,20 @@ static int chip_command(struct i2c_client *client,
 		break;
 		break;
 	case VIDIOC_S_FREQUENCY:
 	case VIDIOC_S_FREQUENCY:
 		chip->mode = 0; /* automatic */
 		chip->mode = 0; /* automatic */
-		if (desc->checkmode && desc->setmode) {
+
+		/* For chips that provide getmode and setmode, and doesn't
+		   automatically follows the stereo carrier, a kthread is
+		   created to set the audio standard. In this case, when then
+		   the video channel is changed, tvaudio starts on MONO mode.
+		   After waiting for 2 seconds, the kernel thread is called,
+		   to follow whatever audio standard is pointed by the
+		   audio carrier.
+		 */
+		if (chip->thread) {
 			desc->setmode(chip,V4L2_TUNER_MODE_MONO);
 			desc->setmode(chip,V4L2_TUNER_MODE_MONO);
 			if (chip->prevmode != V4L2_TUNER_MODE_MONO)
 			if (chip->prevmode != V4L2_TUNER_MODE_MONO)
 				chip->prevmode = -1; /* reset previous mode */
 				chip->prevmode = -1; /* reset previous mode */
 			mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
 			mod_timer(&chip->wt, jiffies+msecs_to_jiffies(2000));
-			/* the thread will call checkmode() later */
 		}
 		}
 		break;
 		break;
 
 
@@ -1836,9 +1909,3 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
 	.legacy_probe = chip_legacy_probe,
 	.legacy_probe = chip_legacy_probe,
 	.id_table = chip_id,
 	.id_table = chip_id,
 };
 };
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */

+ 1 - 1
drivers/mfd/da903x.c

@@ -267,7 +267,7 @@ static int da9030_mask_events(struct da903x_chip *chip, unsigned int events)
 {
 {
 	uint8_t v[3];
 	uint8_t v[3];
 
 
-	chip->events_mask &= ~events;
+	chip->events_mask |= events;
 
 
 	v[0] = (chip->events_mask & 0xff);
 	v[0] = (chip->events_mask & 0xff);
 	v[1] = (chip->events_mask >> 8) & 0xff;
 	v[1] = (chip->events_mask >> 8) & 0xff;

+ 13 - 2
drivers/mfd/wm8350-i2c.c

@@ -30,7 +30,12 @@ static int wm8350_i2c_read_device(struct wm8350 *wm8350, char reg,
 	ret = i2c_master_send(wm8350->i2c_client, &reg, 1);
 	ret = i2c_master_send(wm8350->i2c_client, &reg, 1);
 	if (ret < 0)
 	if (ret < 0)
 		return ret;
 		return ret;
-	return i2c_master_recv(wm8350->i2c_client, dest, bytes);
+	ret = i2c_master_recv(wm8350->i2c_client, dest, bytes);
+	if (ret < 0)
+		return ret;
+	if (ret != bytes)
+		return -EIO;
+	return 0;
 }
 }
 
 
 static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
 static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
@@ -38,13 +43,19 @@ static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
 {
 {
 	/* we add 1 byte for device register */
 	/* we add 1 byte for device register */
 	u8 msg[(WM8350_MAX_REGISTER << 1) + 1];
 	u8 msg[(WM8350_MAX_REGISTER << 1) + 1];
+	int ret;
 
 
 	if (bytes > ((WM8350_MAX_REGISTER << 1) + 1))
 	if (bytes > ((WM8350_MAX_REGISTER << 1) + 1))
 		return -EINVAL;
 		return -EINVAL;
 
 
 	msg[0] = reg;
 	msg[0] = reg;
 	memcpy(&msg[1], src, bytes);
 	memcpy(&msg[1], src, bytes);
-	return i2c_master_send(wm8350->i2c_client, msg, bytes + 1);
+	ret = i2c_master_send(wm8350->i2c_client, msg, bytes + 1);
+	if (ret < 0)
+		return ret;
+	if (ret != bytes + 1)
+		return -EIO;
+	return 0;
 }
 }
 
 
 static int wm8350_i2c_probe(struct i2c_client *i2c,
 static int wm8350_i2c_probe(struct i2c_client *i2c,

+ 1 - 0
drivers/misc/c2port/core.c

@@ -18,6 +18,7 @@
 #include <linux/ctype.h>
 #include <linux/ctype.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/idr.h>
 #include <linux/idr.h>
+#include <linux/sched.h>
 
 
 #include <linux/c2port.h>
 #include <linux/c2port.h>
 
 

+ 0 - 4
drivers/net/atl1e/atl1e_hw.c

@@ -163,9 +163,6 @@ int atl1e_read_mac_addr(struct atl1e_hw *hw)
  * atl1e_hash_mc_addr
  * atl1e_hash_mc_addr
  *  purpose
  *  purpose
  *      set hash value for a multicast address
  *      set hash value for a multicast address
- *      hash calcu processing :
- *          1. calcu 32bit CRC for multicast address
- *          2. reverse crc with MSB to LSB
  */
  */
 u32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr)
 u32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr)
 {
 {
@@ -174,7 +171,6 @@ u32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr)
 	int i;
 	int i;
 
 
 	crc32 = ether_crc_le(6, mc_addr);
 	crc32 = ether_crc_le(6, mc_addr);
-	crc32 = ~crc32;
 	for (i = 0; i < 32; i++)
 	for (i = 0; i < 32; i++)
 		value |= (((crc32 >> i) & 1) << (31 - i));
 		value |= (((crc32 >> i) & 1) << (31 - i));
 
 

+ 3 - 14
drivers/net/atlx/atl1.c

@@ -3404,14 +3404,8 @@ static void atl1_get_wol(struct net_device *netdev,
 {
 {
 	struct atl1_adapter *adapter = netdev_priv(netdev);
 	struct atl1_adapter *adapter = netdev_priv(netdev);
 
 
-	wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC;
+	wol->supported = WAKE_MAGIC;
 	wol->wolopts = 0;
 	wol->wolopts = 0;
-	if (adapter->wol & ATLX_WUFC_EX)
-		wol->wolopts |= WAKE_UCAST;
-	if (adapter->wol & ATLX_WUFC_MC)
-		wol->wolopts |= WAKE_MCAST;
-	if (adapter->wol & ATLX_WUFC_BC)
-		wol->wolopts |= WAKE_BCAST;
 	if (adapter->wol & ATLX_WUFC_MAG)
 	if (adapter->wol & ATLX_WUFC_MAG)
 		wol->wolopts |= WAKE_MAGIC;
 		wol->wolopts |= WAKE_MAGIC;
 	return;
 	return;
@@ -3422,15 +3416,10 @@ static int atl1_set_wol(struct net_device *netdev,
 {
 {
 	struct atl1_adapter *adapter = netdev_priv(netdev);
 	struct atl1_adapter *adapter = netdev_priv(netdev);
 
 
-	if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
+	if (wol->wolopts & (WAKE_PHY | WAKE_UCAST | WAKE_MCAST | WAKE_BCAST |
+		WAKE_ARP | WAKE_MAGICSECURE))
 		return -EOPNOTSUPP;
 		return -EOPNOTSUPP;
 	adapter->wol = 0;
 	adapter->wol = 0;
-	if (wol->wolopts & WAKE_UCAST)
-		adapter->wol |= ATLX_WUFC_EX;
-	if (wol->wolopts & WAKE_MCAST)
-		adapter->wol |= ATLX_WUFC_MC;
-	if (wol->wolopts & WAKE_BCAST)
-		adapter->wol |= ATLX_WUFC_BC;
 	if (wol->wolopts & WAKE_MAGIC)
 	if (wol->wolopts & WAKE_MAGIC)
 		adapter->wol |= ATLX_WUFC_MAG;
 		adapter->wol |= ATLX_WUFC_MAG;
 	return 0;
 	return 0;

+ 10 - 10
drivers/net/e100.c

@@ -166,7 +166,7 @@
 
 
 #define DRV_NAME		"e100"
 #define DRV_NAME		"e100"
 #define DRV_EXT			"-NAPI"
 #define DRV_EXT			"-NAPI"
-#define DRV_VERSION		"3.5.23-k4"DRV_EXT
+#define DRV_VERSION		"3.5.23-k6"DRV_EXT
 #define DRV_DESCRIPTION		"Intel(R) PRO/100 Network Driver"
 #define DRV_DESCRIPTION		"Intel(R) PRO/100 Network Driver"
 #define DRV_COPYRIGHT		"Copyright(c) 1999-2006 Intel Corporation"
 #define DRV_COPYRIGHT		"Copyright(c) 1999-2006 Intel Corporation"
 #define PFX			DRV_NAME ": "
 #define PFX			DRV_NAME ": "
@@ -1804,7 +1804,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
 		struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
 		struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
 		put_unaligned_le32(rx->dma_addr, &prev_rfd->link);
 		put_unaligned_le32(rx->dma_addr, &prev_rfd->link);
 		pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
 		pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
-			sizeof(struct rfd), PCI_DMA_TODEVICE);
+			sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL);
 	}
 	}
 
 
 	return 0;
 	return 0;
@@ -1823,7 +1823,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
 
 
 	/* Need to sync before taking a peek at cb_complete bit */
 	/* Need to sync before taking a peek at cb_complete bit */
 	pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr,
 	pci_dma_sync_single_for_cpu(nic->pdev, rx->dma_addr,
-		sizeof(struct rfd), PCI_DMA_FROMDEVICE);
+		sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL);
 	rfd_status = le16_to_cpu(rfd->status);
 	rfd_status = le16_to_cpu(rfd->status);
 
 
 	DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status);
 	DPRINTK(RX_STATUS, DEBUG, "status=0x%04X\n", rfd_status);
@@ -1850,7 +1850,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
 
 
 	/* Get data */
 	/* Get data */
 	pci_unmap_single(nic->pdev, rx->dma_addr,
 	pci_unmap_single(nic->pdev, rx->dma_addr,
-		RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
+		RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
 
 
 	/* If this buffer has the el bit, but we think the receiver
 	/* If this buffer has the el bit, but we think the receiver
 	 * is still running, check to see if it really stopped while
 	 * is still running, check to see if it really stopped while
@@ -1943,7 +1943,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
 		new_before_last_rfd->command |= cpu_to_le16(cb_el);
 		new_before_last_rfd->command |= cpu_to_le16(cb_el);
 		pci_dma_sync_single_for_device(nic->pdev,
 		pci_dma_sync_single_for_device(nic->pdev,
 			new_before_last_rx->dma_addr, sizeof(struct rfd),
 			new_before_last_rx->dma_addr, sizeof(struct rfd),
-			PCI_DMA_TODEVICE);
+			PCI_DMA_BIDIRECTIONAL);
 
 
 		/* Now that we have a new stopping point, we can clear the old
 		/* Now that we have a new stopping point, we can clear the old
 		 * stopping point.  We must sync twice to get the proper
 		 * stopping point.  We must sync twice to get the proper
@@ -1951,11 +1951,11 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
 		old_before_last_rfd->command &= ~cpu_to_le16(cb_el);
 		old_before_last_rfd->command &= ~cpu_to_le16(cb_el);
 		pci_dma_sync_single_for_device(nic->pdev,
 		pci_dma_sync_single_for_device(nic->pdev,
 			old_before_last_rx->dma_addr, sizeof(struct rfd),
 			old_before_last_rx->dma_addr, sizeof(struct rfd),
-			PCI_DMA_TODEVICE);
+			PCI_DMA_BIDIRECTIONAL);
 		old_before_last_rfd->size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
 		old_before_last_rfd->size = cpu_to_le16(VLAN_ETH_FRAME_LEN);
 		pci_dma_sync_single_for_device(nic->pdev,
 		pci_dma_sync_single_for_device(nic->pdev,
 			old_before_last_rx->dma_addr, sizeof(struct rfd),
 			old_before_last_rx->dma_addr, sizeof(struct rfd),
-			PCI_DMA_TODEVICE);
+			PCI_DMA_BIDIRECTIONAL);
 	}
 	}
 
 
 	if(restart_required) {
 	if(restart_required) {
@@ -1978,7 +1978,7 @@ static void e100_rx_clean_list(struct nic *nic)
 		for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
 		for(rx = nic->rxs, i = 0; i < count; rx++, i++) {
 			if(rx->skb) {
 			if(rx->skb) {
 				pci_unmap_single(nic->pdev, rx->dma_addr,
 				pci_unmap_single(nic->pdev, rx->dma_addr,
-					RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
+					RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
 				dev_kfree_skb(rx->skb);
 				dev_kfree_skb(rx->skb);
 			}
 			}
 		}
 		}
@@ -2021,7 +2021,7 @@ static int e100_rx_alloc_list(struct nic *nic)
 	before_last->command |= cpu_to_le16(cb_el);
 	before_last->command |= cpu_to_le16(cb_el);
 	before_last->size = 0;
 	before_last->size = 0;
 	pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
 	pci_dma_sync_single_for_device(nic->pdev, rx->dma_addr,
-		sizeof(struct rfd), PCI_DMA_TODEVICE);
+		sizeof(struct rfd), PCI_DMA_BIDIRECTIONAL);
 
 
 	nic->rx_to_use = nic->rx_to_clean = nic->rxs;
 	nic->rx_to_use = nic->rx_to_clean = nic->rxs;
 	nic->ru_running = RU_SUSPENDED;
 	nic->ru_running = RU_SUSPENDED;
@@ -2222,7 +2222,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
 	msleep(10);
 	msleep(10);
 
 
 	pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr,
 	pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr,
-			RFD_BUF_LEN, PCI_DMA_FROMDEVICE);
+			RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
 
 
 	if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd),
 	if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd),
 	   skb->data, ETH_DATA_LEN))
 	   skb->data, ETH_DATA_LEN))

+ 6 - 2
drivers/net/e1000/e1000_ethtool.c

@@ -1774,7 +1774,8 @@ static void e1000_get_wol(struct net_device *netdev,
 
 
 	/* this function will set ->supported = 0 and return 1 if wol is not
 	/* this function will set ->supported = 0 and return 1 if wol is not
 	 * supported by this hardware */
 	 * supported by this hardware */
-	if (e1000_wol_exclusion(adapter, wol))
+	if (e1000_wol_exclusion(adapter, wol) ||
+	    !device_can_wakeup(&adapter->pdev->dev))
 		return;
 		return;
 
 
 	/* apply any specific unsupported masks here */
 	/* apply any specific unsupported masks here */
@@ -1811,7 +1812,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 	if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
 	if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
 		return -EOPNOTSUPP;
 		return -EOPNOTSUPP;
 
 
-	if (e1000_wol_exclusion(adapter, wol))
+	if (e1000_wol_exclusion(adapter, wol) ||
+	    !device_can_wakeup(&adapter->pdev->dev))
 		return wol->wolopts ? -EOPNOTSUPP : 0;
 		return wol->wolopts ? -EOPNOTSUPP : 0;
 
 
 	switch (hw->device_id) {
 	switch (hw->device_id) {
@@ -1838,6 +1840,8 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 	if (wol->wolopts & WAKE_MAGIC)
 	if (wol->wolopts & WAKE_MAGIC)
 		adapter->wol |= E1000_WUFC_MAG;
 		adapter->wol |= E1000_WUFC_MAG;
 
 
+	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
+
 	return 0;
 	return 0;
 }
 }
 
 

+ 1 - 0
drivers/net/e1000/e1000_main.c

@@ -1179,6 +1179,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
 
 	/* initialize the wol settings based on the eeprom settings */
 	/* initialize the wol settings based on the eeprom settings */
 	adapter->wol = adapter->eeprom_wol;
 	adapter->wol = adapter->eeprom_wol;
+	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
 
 
 	/* print bus type/speed/width info */
 	/* print bus type/speed/width info */
 	DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ",
 	DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ",

+ 5 - 0
drivers/net/e1000e/e1000.h

@@ -299,6 +299,7 @@ struct e1000_adapter {
 	unsigned long led_status;
 	unsigned long led_status;
 
 
 	unsigned int flags;
 	unsigned int flags;
+	unsigned int flags2;
 	struct work_struct downshift_task;
 	struct work_struct downshift_task;
 	struct work_struct update_phy_task;
 	struct work_struct update_phy_task;
 };
 };
@@ -306,6 +307,7 @@ struct e1000_adapter {
 struct e1000_info {
 struct e1000_info {
 	enum e1000_mac_type	mac;
 	enum e1000_mac_type	mac;
 	unsigned int		flags;
 	unsigned int		flags;
+	unsigned int            flags2;
 	u32			pba;
 	u32			pba;
 	s32			(*get_variants)(struct e1000_adapter *);
 	s32			(*get_variants)(struct e1000_adapter *);
 	struct e1000_mac_operations *mac_ops;
 	struct e1000_mac_operations *mac_ops;
@@ -347,6 +349,9 @@ struct e1000_info {
 #define FLAG_RX_RESTART_NOW               (1 << 30)
 #define FLAG_RX_RESTART_NOW               (1 << 30)
 #define FLAG_MSI_TEST_FAILED              (1 << 31)
 #define FLAG_MSI_TEST_FAILED              (1 << 31)
 
 
+/* CRC Stripping defines */
+#define FLAG2_CRC_STRIPPING               (1 << 0)
+
 #define E1000_RX_DESC_PS(R, i)	    \
 #define E1000_RX_DESC_PS(R, i)	    \
 	(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
 	(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
 #define E1000_GET_DESC(R, i, type)	(&(((struct type *)((R).desc))[i]))
 #define E1000_GET_DESC(R, i, type)	(&(((struct type *)((R).desc))[i]))

+ 6 - 2
drivers/net/e1000e/ethtool.c

@@ -1713,7 +1713,8 @@ static void e1000_get_wol(struct net_device *netdev,
 	wol->supported = 0;
 	wol->supported = 0;
 	wol->wolopts = 0;
 	wol->wolopts = 0;
 
 
-	if (!(adapter->flags & FLAG_HAS_WOL))
+	if (!(adapter->flags & FLAG_HAS_WOL) ||
+	    !device_can_wakeup(&adapter->pdev->dev))
 		return;
 		return;
 
 
 	wol->supported = WAKE_UCAST | WAKE_MCAST |
 	wol->supported = WAKE_UCAST | WAKE_MCAST |
@@ -1751,7 +1752,8 @@ static int e1000_set_wol(struct net_device *netdev,
 	if (wol->wolopts & WAKE_MAGICSECURE)
 	if (wol->wolopts & WAKE_MAGICSECURE)
 		return -EOPNOTSUPP;
 		return -EOPNOTSUPP;
 
 
-	if (!(adapter->flags & FLAG_HAS_WOL))
+	if (!(adapter->flags & FLAG_HAS_WOL) ||
+	    !device_can_wakeup(&adapter->pdev->dev))
 		return wol->wolopts ? -EOPNOTSUPP : 0;
 		return wol->wolopts ? -EOPNOTSUPP : 0;
 
 
 	/* these settings will always override what we currently have */
 	/* these settings will always override what we currently have */
@@ -1770,6 +1772,8 @@ static int e1000_set_wol(struct net_device *netdev,
 	if (wol->wolopts & WAKE_ARP)
 	if (wol->wolopts & WAKE_ARP)
 		adapter->wol |= E1000_WUFC_ARP;
 		adapter->wol |= E1000_WUFC_ARP;
 
 
+	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
+
 	return 0;
 	return 0;
 }
 }
 
 

+ 23 - 2
drivers/net/e1000e/netdev.c

@@ -499,6 +499,10 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
 			goto next_desc;
 			goto next_desc;
 		}
 		}
 
 
+		/* adjust length to remove Ethernet CRC */
+		if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
+			length -= 4;
+
 		total_rx_bytes += length;
 		total_rx_bytes += length;
 		total_rx_packets++;
 		total_rx_packets++;
 
 
@@ -804,6 +808,10 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
 			pci_dma_sync_single_for_device(pdev, ps_page->dma,
 			pci_dma_sync_single_for_device(pdev, ps_page->dma,
 				PAGE_SIZE, PCI_DMA_FROMDEVICE);
 				PAGE_SIZE, PCI_DMA_FROMDEVICE);
 
 
+			/* remove the CRC */
+			if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
+				l1 -= 4;
+
 			skb_put(skb, l1);
 			skb_put(skb, l1);
 			goto copydone;
 			goto copydone;
 		} /* if */
 		} /* if */
@@ -825,6 +833,12 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
 			skb->truesize += length;
 			skb->truesize += length;
 		}
 		}
 
 
+		/* strip the ethernet crc, problem is we're using pages now so
+		 * this whole operation can get a little cpu intensive
+		 */
+		if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
+			pskb_trim(skb, skb->len - 4);
+
 copydone:
 copydone:
 		total_rx_bytes += skb->len;
 		total_rx_bytes += skb->len;
 		total_rx_packets++;
 		total_rx_packets++;
@@ -2301,8 +2315,12 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
 	else
 	else
 		rctl |= E1000_RCTL_LPE;
 		rctl |= E1000_RCTL_LPE;
 
 
-	/* Enable hardware CRC frame stripping */
-	rctl |= E1000_RCTL_SECRC;
+	/* Some systems expect that the CRC is included in SMBUS traffic. The
+	 * hardware strips the CRC before sending to both SMBUS (BMC) and to
+	 * host memory when this is enabled
+	 */
+	if (adapter->flags2 & FLAG2_CRC_STRIPPING)
+		rctl |= E1000_RCTL_SECRC;
 
 
 	/* Setup buffer sizes */
 	/* Setup buffer sizes */
 	rctl &= ~E1000_RCTL_SZ_4096;
 	rctl &= ~E1000_RCTL_SZ_4096;
@@ -4766,6 +4784,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 	adapter->ei = ei;
 	adapter->ei = ei;
 	adapter->pba = ei->pba;
 	adapter->pba = ei->pba;
 	adapter->flags = ei->flags;
 	adapter->flags = ei->flags;
+	adapter->flags2 = ei->flags2;
 	adapter->hw.adapter = adapter;
 	adapter->hw.adapter = adapter;
 	adapter->hw.mac.type = ei->mac;
 	adapter->hw.mac.type = ei->mac;
 	adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
 	adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
@@ -4970,6 +4989,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 
 
 	/* initialize the wol settings based on the eeprom settings */
 	/* initialize the wol settings based on the eeprom settings */
 	adapter->wol = adapter->eeprom_wol;
 	adapter->wol = adapter->eeprom_wol;
+	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
 
 
 	/* reset the hardware with the new settings */
 	/* reset the hardware with the new settings */
 	e1000e_reset(adapter);
 	e1000e_reset(adapter);
@@ -5008,6 +5028,7 @@ err_hw_init:
 err_sw_init:
 err_sw_init:
 	if (adapter->hw.flash_address)
 	if (adapter->hw.flash_address)
 		iounmap(adapter->hw.flash_address);
 		iounmap(adapter->hw.flash_address);
+	e1000e_reset_interrupt_capability(adapter);
 err_flashmap:
 err_flashmap:
 	iounmap(adapter->hw.hw_addr);
 	iounmap(adapter->hw.hw_addr);
 err_ioremap:
 err_ioremap:

+ 25 - 0
drivers/net/e1000e/param.c

@@ -151,6 +151,16 @@ E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
  */
  */
 E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
 E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
 
 
+/*
+ * Enable CRC Stripping
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (enabled)
+ */
+E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \
+                          "the CRC");
+
 struct e1000_option {
 struct e1000_option {
 	enum { enable_option, range_option, list_option } type;
 	enum { enable_option, range_option, list_option } type;
 	const char *name;
 	const char *name;
@@ -404,6 +414,21 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
 				adapter->flags |= FLAG_SMART_POWER_DOWN;
 				adapter->flags |= FLAG_SMART_POWER_DOWN;
 		}
 		}
 	}
 	}
+	{ /* CRC Stripping */
+		const struct e1000_option opt = {
+			.type = enable_option,
+			.name = "CRC Stripping",
+			.err  = "defaulting to enabled",
+			.def  = OPTION_ENABLED
+		};
+
+		if (num_CrcStripping > bd) {
+			unsigned int crc_stripping = CrcStripping[bd];
+			e1000_validate_option(&crc_stripping, &opt, adapter);
+			if (crc_stripping == OPTION_ENABLED)
+				adapter->flags2 |= FLAG2_CRC_STRIPPING;
+		}
+	}
 	{ /* Kumeran Lock Loss Workaround */
 	{ /* Kumeran Lock Loss Workaround */
 		const struct e1000_option opt = {
 		const struct e1000_option opt = {
 			.type = enable_option,
 			.type = enable_option,

+ 8 - 7
drivers/net/gianfar.c

@@ -1407,6 +1407,10 @@ static int gfar_clean_tx_ring(struct net_device *dev)
 		if (bdp->status & TXBD_DEF)
 		if (bdp->status & TXBD_DEF)
 			dev->stats.collisions++;
 			dev->stats.collisions++;
 
 
+		/* Unmap the DMA memory */
+		dma_unmap_single(&priv->dev->dev, bdp->bufPtr,
+				bdp->length, DMA_TO_DEVICE);
+
 		/* Free the sk buffer associated with this TxBD */
 		/* Free the sk buffer associated with this TxBD */
 		dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]);
 		dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]);
 
 
@@ -1666,6 +1670,9 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 
 
 		skb = priv->rx_skbuff[priv->skb_currx];
 		skb = priv->rx_skbuff[priv->skb_currx];
 
 
+		dma_unmap_single(&priv->dev->dev, bdp->bufPtr,
+				priv->rx_buffer_size, DMA_FROM_DEVICE);
+
 		/* We drop the frame if we failed to allocate a new buffer */
 		/* We drop the frame if we failed to allocate a new buffer */
 		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
 		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
 				 bdp->status & RXBD_ERR)) {
 				 bdp->status & RXBD_ERR)) {
@@ -1674,14 +1681,8 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 			if (unlikely(!newskb))
 			if (unlikely(!newskb))
 				newskb = skb;
 				newskb = skb;
 
 
-			if (skb) {
-				dma_unmap_single(&priv->dev->dev,
-						bdp->bufPtr,
-						priv->rx_buffer_size,
-						DMA_FROM_DEVICE);
-
+			if (skb)
 				dev_kfree_skb_any(skb);
 				dev_kfree_skb_any(skb);
-			}
 		} else {
 		} else {
 			/* Increment the number of packets */
 			/* Increment the number of packets */
 			dev->stats.rx_packets++;
 			dev->stats.rx_packets++;

+ 6 - 2
drivers/net/igb/igb_ethtool.c

@@ -1776,7 +1776,8 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 
 
 	/* this function will set ->supported = 0 and return 1 if wol is not
 	/* this function will set ->supported = 0 and return 1 if wol is not
 	 * supported by this hardware */
 	 * supported by this hardware */
-	if (igb_wol_exclusion(adapter, wol))
+	if (igb_wol_exclusion(adapter, wol) ||
+	    !device_can_wakeup(&adapter->pdev->dev))
 		return;
 		return;
 
 
 	/* apply any specific unsupported masks here */
 	/* apply any specific unsupported masks here */
@@ -1805,7 +1806,8 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 	if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
 	if (wol->wolopts & (WAKE_PHY | WAKE_ARP | WAKE_MAGICSECURE))
 		return -EOPNOTSUPP;
 		return -EOPNOTSUPP;
 
 
-	if (igb_wol_exclusion(adapter, wol))
+	if (igb_wol_exclusion(adapter, wol) ||
+	    !device_can_wakeup(&adapter->pdev->dev))
 		return wol->wolopts ? -EOPNOTSUPP : 0;
 		return wol->wolopts ? -EOPNOTSUPP : 0;
 
 
 	switch (hw->device_id) {
 	switch (hw->device_id) {
@@ -1825,6 +1827,8 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 	if (wol->wolopts & WAKE_MAGIC)
 	if (wol->wolopts & WAKE_MAGIC)
 		adapter->wol |= E1000_WUFC_MAG;
 		adapter->wol |= E1000_WUFC_MAG;
 
 
+	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
+
 	return 0;
 	return 0;
 }
 }
 
 

+ 4 - 4
drivers/net/igb/igb_main.c

@@ -1019,10 +1019,9 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 			state &= ~PCIE_LINK_STATE_L0S;
 			state &= ~PCIE_LINK_STATE_L0S;
 			pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL,
 			pci_write_config_word(us_dev, pos + PCI_EXP_LNKCTL,
 			                      state);
 			                      state);
-			printk(KERN_INFO "Disabling ASPM L0s upstream switch "
-			       "port %x:%x.%x\n", us_dev->bus->number,
-			       PCI_SLOT(us_dev->devfn),
-			       PCI_FUNC(us_dev->devfn));
+			dev_info(&pdev->dev,
+				 "Disabling ASPM L0s upstream switch port %s\n",
+				 pci_name(us_dev));
 		}
 		}
 	default:
 	default:
 		break;
 		break;
@@ -1244,6 +1243,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 
 
 	/* initialize the wol settings based on the eeprom settings */
 	/* initialize the wol settings based on the eeprom settings */
 	adapter->wol = adapter->eeprom_wol;
 	adapter->wol = adapter->eeprom_wol;
+	device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
 
 
 	/* reset the hardware with the new settings */
 	/* reset the hardware with the new settings */
 	igb_reset(adapter);
 	igb_reset(adapter);

+ 4 - 4
drivers/net/mlx4/en_netdev.c

@@ -656,10 +656,10 @@ static int mlx4_en_start_port(struct net_device *dev)
 	/* Configure port */
 	/* Configure port */
 	err = mlx4_SET_PORT_general(mdev->dev, priv->port,
 	err = mlx4_SET_PORT_general(mdev->dev, priv->port,
 				    priv->rx_skb_size + ETH_FCS_LEN,
 				    priv->rx_skb_size + ETH_FCS_LEN,
-				    mdev->profile.tx_pause,
-				    mdev->profile.tx_ppp,
-				    mdev->profile.rx_pause,
-				    mdev->profile.rx_ppp);
+				    priv->prof->tx_pause,
+				    priv->prof->tx_ppp,
+				    priv->prof->rx_pause,
+				    priv->prof->rx_ppp);
 	if (err) {
 	if (err) {
 		mlx4_err(mdev, "Failed setting port general configurations"
 		mlx4_err(mdev, "Failed setting port general configurations"
 			       " for port %d, with error %d\n", priv->port, err);
 			       " for port %d, with error %d\n", priv->port, err);

+ 16 - 14
drivers/net/mlx4/en_params.c

@@ -90,6 +90,7 @@ MLX4_EN_PARM_INT(rx_ring_size2, MLX4_EN_AUTO_CONF, "Rx ring size for port 2");
 int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
 int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
 {
 {
 	struct mlx4_en_profile *params = &mdev->profile;
 	struct mlx4_en_profile *params = &mdev->profile;
+	int i;
 
 
 	params->rx_moder_cnt = min_t(int, rx_moder_cnt, MLX4_EN_AUTO_CONF);
 	params->rx_moder_cnt = min_t(int, rx_moder_cnt, MLX4_EN_AUTO_CONF);
 	params->rx_moder_time = min_t(int, rx_moder_time, MLX4_EN_AUTO_CONF);
 	params->rx_moder_time = min_t(int, rx_moder_time, MLX4_EN_AUTO_CONF);
@@ -97,11 +98,13 @@ int mlx4_en_get_profile(struct mlx4_en_dev *mdev)
 	params->rss_xor = (rss_xor != 0);
 	params->rss_xor = (rss_xor != 0);
 	params->rss_mask = rss_mask & 0x1f;
 	params->rss_mask = rss_mask & 0x1f;
 	params->num_lro = min_t(int, num_lro , MLX4_EN_MAX_LRO_DESCRIPTORS);
 	params->num_lro = min_t(int, num_lro , MLX4_EN_MAX_LRO_DESCRIPTORS);
-	params->rx_pause = pprx;
-	params->rx_ppp = pfcrx;
-	params->tx_pause = pptx;
-	params->tx_ppp = pfctx;
-	if (params->rx_ppp || params->tx_ppp) {
+	for (i = 1; i <= MLX4_MAX_PORTS; i++) {
+		params->prof[i].rx_pause = pprx;
+		params->prof[i].rx_ppp = pfcrx;
+		params->prof[i].tx_pause = pptx;
+		params->prof[i].tx_ppp = pfctx;
+	}
+	if (pfcrx || pfctx) {
 		params->prof[1].tx_ring_num = MLX4_EN_TX_RING_NUM;
 		params->prof[1].tx_ring_num = MLX4_EN_TX_RING_NUM;
 		params->prof[2].tx_ring_num = MLX4_EN_TX_RING_NUM;
 		params->prof[2].tx_ring_num = MLX4_EN_TX_RING_NUM;
 	} else {
 	} else {
@@ -407,14 +410,14 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
 	struct mlx4_en_dev *mdev = priv->mdev;
 	struct mlx4_en_dev *mdev = priv->mdev;
 	int err;
 	int err;
 
 
-	mdev->profile.tx_pause = pause->tx_pause != 0;
-	mdev->profile.rx_pause = pause->rx_pause != 0;
+	priv->prof->tx_pause = pause->tx_pause != 0;
+	priv->prof->rx_pause = pause->rx_pause != 0;
 	err = mlx4_SET_PORT_general(mdev->dev, priv->port,
 	err = mlx4_SET_PORT_general(mdev->dev, priv->port,
 				    priv->rx_skb_size + ETH_FCS_LEN,
 				    priv->rx_skb_size + ETH_FCS_LEN,
-				    mdev->profile.tx_pause,
-				    mdev->profile.tx_ppp,
-				    mdev->profile.rx_pause,
-				    mdev->profile.rx_ppp);
+				    priv->prof->tx_pause,
+				    priv->prof->tx_ppp,
+				    priv->prof->rx_pause,
+				    priv->prof->rx_ppp);
 	if (err)
 	if (err)
 		mlx4_err(mdev, "Failed setting pause params to\n");
 		mlx4_err(mdev, "Failed setting pause params to\n");
 
 
@@ -425,10 +428,9 @@ static void mlx4_en_get_pauseparam(struct net_device *dev,
 				 struct ethtool_pauseparam *pause)
 				 struct ethtool_pauseparam *pause)
 {
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct mlx4_en_priv *priv = netdev_priv(dev);
-	struct mlx4_en_dev *mdev = priv->mdev;
 
 
-	pause->tx_pause = mdev->profile.tx_pause;
-	pause->rx_pause = mdev->profile.rx_pause;
+	pause->tx_pause = priv->prof->tx_pause;
+	pause->rx_pause = priv->prof->rx_pause;
 }
 }
 
 
 static void mlx4_en_get_ringparam(struct net_device *dev,
 static void mlx4_en_get_ringparam(struct net_device *dev,

+ 4 - 4
drivers/net/mlx4/mlx4_en.h

@@ -322,6 +322,10 @@ struct mlx4_en_port_profile {
 	u32 rx_ring_num;
 	u32 rx_ring_num;
 	u32 tx_ring_size;
 	u32 tx_ring_size;
 	u32 rx_ring_size;
 	u32 rx_ring_size;
+	u8 rx_pause;
+	u8 rx_ppp;
+	u8 tx_pause;
+	u8 tx_ppp;
 };
 };
 
 
 struct mlx4_en_profile {
 struct mlx4_en_profile {
@@ -333,10 +337,6 @@ struct mlx4_en_profile {
 	int rx_moder_cnt;
 	int rx_moder_cnt;
 	int rx_moder_time;
 	int rx_moder_time;
 	int auto_moder;
 	int auto_moder;
-	u8 rx_pause;
-	u8 rx_ppp;
-	u8 tx_pause;
-	u8 tx_ppp;
 	u8 no_reset;
 	u8 no_reset;
 	struct mlx4_en_port_profile prof[MLX4_MAX_PORTS + 1];
 	struct mlx4_en_port_profile prof[MLX4_MAX_PORTS + 1];
 };
 };

+ 282 - 8
drivers/net/niu.c

@@ -33,8 +33,8 @@
 
 
 #define DRV_MODULE_NAME		"niu"
 #define DRV_MODULE_NAME		"niu"
 #define PFX DRV_MODULE_NAME	": "
 #define PFX DRV_MODULE_NAME	": "
-#define DRV_MODULE_VERSION	"0.9"
-#define DRV_MODULE_RELDATE	"May 4, 2008"
+#define DRV_MODULE_VERSION	"1.0"
+#define DRV_MODULE_RELDATE	"Nov 14, 2008"
 
 
 static char version[] __devinitdata =
 static char version[] __devinitdata =
 	DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
 	DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -406,7 +406,7 @@ static int esr2_set_rx_cfg(struct niu *np, unsigned long channel, u32 val)
 }
 }
 
 
 /* Mode is always 10G fiber.  */
 /* Mode is always 10G fiber.  */
-static int serdes_init_niu(struct niu *np)
+static int serdes_init_niu_10g_fiber(struct niu *np)
 {
 {
 	struct niu_link_config *lp = &np->link_config;
 	struct niu_link_config *lp = &np->link_config;
 	u32 tx_cfg, rx_cfg;
 	u32 tx_cfg, rx_cfg;
@@ -443,6 +443,223 @@ static int serdes_init_niu(struct niu *np)
 	return 0;
 	return 0;
 }
 }
 
 
+static int serdes_init_niu_1g_serdes(struct niu *np)
+{
+	struct niu_link_config *lp = &np->link_config;
+	u16 pll_cfg, pll_sts;
+	int max_retry = 100;
+	u64 sig, mask, val;
+	u32 tx_cfg, rx_cfg;
+	unsigned long i;
+	int err;
+
+	tx_cfg = (PLL_TX_CFG_ENTX | PLL_TX_CFG_SWING_1375MV |
+		  PLL_TX_CFG_RATE_HALF);
+	rx_cfg = (PLL_RX_CFG_ENRX | PLL_RX_CFG_TERM_0P8VDDT |
+		  PLL_RX_CFG_ALIGN_ENA | PLL_RX_CFG_LOS_LTHRESH |
+		  PLL_RX_CFG_RATE_HALF);
+
+	if (np->port == 0)
+		rx_cfg |= PLL_RX_CFG_EQ_LP_ADAPTIVE;
+
+	if (lp->loopback_mode == LOOPBACK_PHY) {
+		u16 test_cfg = PLL_TEST_CFG_LOOPBACK_CML_DIS;
+
+		mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
+			   ESR2_TI_PLL_TEST_CFG_L, test_cfg);
+
+		tx_cfg |= PLL_TX_CFG_ENTEST;
+		rx_cfg |= PLL_RX_CFG_ENTEST;
+	}
+
+	/* Initialize PLL for 1G */
+	pll_cfg = (PLL_CFG_ENPLL | PLL_CFG_MPY_8X);
+
+	err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
+			 ESR2_TI_PLL_CFG_L, pll_cfg);
+	if (err) {
+		dev_err(np->device, PFX "NIU Port %d "
+			"serdes_init_niu_1g_serdes: "
+			"mdio write to ESR2_TI_PLL_CFG_L failed", np->port);
+		return err;
+	}
+
+	pll_sts = PLL_CFG_ENPLL;
+
+	err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
+			 ESR2_TI_PLL_STS_L, pll_sts);
+	if (err) {
+		dev_err(np->device, PFX "NIU Port %d "
+			"serdes_init_niu_1g_serdes: "
+			"mdio write to ESR2_TI_PLL_STS_L failed", np->port);
+		return err;
+	}
+
+	udelay(200);
+
+	/* Initialize all 4 lanes of the SERDES.  */
+	for (i = 0; i < 4; i++) {
+		err = esr2_set_tx_cfg(np, i, tx_cfg);
+		if (err)
+			return err;
+	}
+
+	for (i = 0; i < 4; i++) {
+		err = esr2_set_rx_cfg(np, i, rx_cfg);
+		if (err)
+			return err;
+	}
+
+	switch (np->port) {
+	case 0:
+		val = (ESR_INT_SRDY0_P0 | ESR_INT_DET0_P0);
+		mask = val;
+		break;
+
+	case 1:
+		val = (ESR_INT_SRDY0_P1 | ESR_INT_DET0_P1);
+		mask = val;
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	while (max_retry--) {
+		sig = nr64(ESR_INT_SIGNALS);
+		if ((sig & mask) == val)
+			break;
+
+		mdelay(500);
+	}
+
+	if ((sig & mask) != val) {
+		dev_err(np->device, PFX "Port %u signal bits [%08x] are not "
+			"[%08x]\n", np->port, (int) (sig & mask), (int) val);
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static int serdes_init_niu_10g_serdes(struct niu *np)
+{
+	struct niu_link_config *lp = &np->link_config;
+	u32 tx_cfg, rx_cfg, pll_cfg, pll_sts;
+	int max_retry = 100;
+	u64 sig, mask, val;
+	unsigned long i;
+	int err;
+
+	tx_cfg = (PLL_TX_CFG_ENTX | PLL_TX_CFG_SWING_1375MV);
+	rx_cfg = (PLL_RX_CFG_ENRX | PLL_RX_CFG_TERM_0P8VDDT |
+		  PLL_RX_CFG_ALIGN_ENA | PLL_RX_CFG_LOS_LTHRESH |
+		  PLL_RX_CFG_EQ_LP_ADAPTIVE);
+
+	if (lp->loopback_mode == LOOPBACK_PHY) {
+		u16 test_cfg = PLL_TEST_CFG_LOOPBACK_CML_DIS;
+
+		mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
+			   ESR2_TI_PLL_TEST_CFG_L, test_cfg);
+
+		tx_cfg |= PLL_TX_CFG_ENTEST;
+		rx_cfg |= PLL_RX_CFG_ENTEST;
+	}
+
+	/* Initialize PLL for 10G */
+	pll_cfg = (PLL_CFG_ENPLL | PLL_CFG_MPY_10X);
+
+	err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
+			 ESR2_TI_PLL_CFG_L, pll_cfg & 0xffff);
+	if (err) {
+		dev_err(np->device, PFX "NIU Port %d "
+			"serdes_init_niu_10g_serdes: "
+			"mdio write to ESR2_TI_PLL_CFG_L failed", np->port);
+		return err;
+	}
+
+	pll_sts = PLL_CFG_ENPLL;
+
+	err = mdio_write(np, np->port, NIU_ESR2_DEV_ADDR,
+			 ESR2_TI_PLL_STS_L, pll_sts & 0xffff);
+	if (err) {
+		dev_err(np->device, PFX "NIU Port %d "
+			"serdes_init_niu_10g_serdes: "
+			"mdio write to ESR2_TI_PLL_STS_L failed", np->port);
+		return err;
+	}
+
+	udelay(200);
+
+	/* Initialize all 4 lanes of the SERDES.  */
+	for (i = 0; i < 4; i++) {
+		err = esr2_set_tx_cfg(np, i, tx_cfg);
+		if (err)
+			return err;
+	}
+
+	for (i = 0; i < 4; i++) {
+		err = esr2_set_rx_cfg(np, i, rx_cfg);
+		if (err)
+			return err;
+	}
+
+	/* check if serdes is ready */
+
+	switch (np->port) {
+	case 0:
+		mask = ESR_INT_SIGNALS_P0_BITS;
+		val = (ESR_INT_SRDY0_P0 |
+		       ESR_INT_DET0_P0 |
+		       ESR_INT_XSRDY_P0 |
+		       ESR_INT_XDP_P0_CH3 |
+		       ESR_INT_XDP_P0_CH2 |
+		       ESR_INT_XDP_P0_CH1 |
+		       ESR_INT_XDP_P0_CH0);
+		break;
+
+	case 1:
+		mask = ESR_INT_SIGNALS_P1_BITS;
+		val = (ESR_INT_SRDY0_P1 |
+		       ESR_INT_DET0_P1 |
+		       ESR_INT_XSRDY_P1 |
+		       ESR_INT_XDP_P1_CH3 |
+		       ESR_INT_XDP_P1_CH2 |
+		       ESR_INT_XDP_P1_CH1 |
+		       ESR_INT_XDP_P1_CH0);
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	while (max_retry--) {
+		sig = nr64(ESR_INT_SIGNALS);
+		if ((sig & mask) == val)
+			break;
+
+		mdelay(500);
+	}
+
+	if ((sig & mask) != val) {
+		pr_info(PFX "NIU Port %u signal bits [%08x] are not "
+			"[%08x] for 10G...trying 1G\n",
+			np->port, (int) (sig & mask), (int) val);
+
+		/* 10G failed, try initializing at 1G */
+		err = serdes_init_niu_1g_serdes(np);
+		if (!err) {
+			np->flags &= ~NIU_FLAGS_10G;
+			np->mac_xcvr = MAC_XCVR_PCS;
+		}  else {
+			dev_err(np->device, PFX "Port %u 10G/1G SERDES "
+				"Link Failed \n", np->port);
+			return -ENODEV;
+		}
+	}
+	return 0;
+}
+
 static int esr_read_rxtx_ctrl(struct niu *np, unsigned long chan, u32 *val)
 static int esr_read_rxtx_ctrl(struct niu *np, unsigned long chan, u32 *val)
 {
 {
 	int err;
 	int err;
@@ -1954,13 +2171,23 @@ static const struct niu_phy_ops phy_ops_10g_serdes = {
 	.link_status		= link_status_10g_serdes,
 	.link_status		= link_status_10g_serdes,
 };
 };
 
 
+static const struct niu_phy_ops phy_ops_10g_serdes_niu = {
+	.serdes_init		= serdes_init_niu_10g_serdes,
+	.link_status		= link_status_10g_serdes,
+};
+
+static const struct niu_phy_ops phy_ops_1g_serdes_niu = {
+	.serdes_init		= serdes_init_niu_1g_serdes,
+	.link_status		= link_status_1g_serdes,
+};
+
 static const struct niu_phy_ops phy_ops_1g_rgmii = {
 static const struct niu_phy_ops phy_ops_1g_rgmii = {
 	.xcvr_init		= xcvr_init_1g_rgmii,
 	.xcvr_init		= xcvr_init_1g_rgmii,
 	.link_status		= link_status_1g_rgmii,
 	.link_status		= link_status_1g_rgmii,
 };
 };
 
 
 static const struct niu_phy_ops phy_ops_10g_fiber_niu = {
 static const struct niu_phy_ops phy_ops_10g_fiber_niu = {
-	.serdes_init		= serdes_init_niu,
+	.serdes_init		= serdes_init_niu_10g_fiber,
 	.xcvr_init		= xcvr_init_10g,
 	.xcvr_init		= xcvr_init_10g,
 	.link_status		= link_status_10g,
 	.link_status		= link_status_10g,
 };
 };
@@ -1998,11 +2225,21 @@ struct niu_phy_template {
 	u32				phy_addr_base;
 	u32				phy_addr_base;
 };
 };
 
 
-static const struct niu_phy_template phy_template_niu = {
+static const struct niu_phy_template phy_template_niu_10g_fiber = {
 	.ops		= &phy_ops_10g_fiber_niu,
 	.ops		= &phy_ops_10g_fiber_niu,
 	.phy_addr_base	= 16,
 	.phy_addr_base	= 16,
 };
 };
 
 
+static const struct niu_phy_template phy_template_niu_10g_serdes = {
+	.ops		= &phy_ops_10g_serdes_niu,
+	.phy_addr_base	= 0,
+};
+
+static const struct niu_phy_template phy_template_niu_1g_serdes = {
+	.ops		= &phy_ops_1g_serdes_niu,
+	.phy_addr_base	= 0,
+};
+
 static const struct niu_phy_template phy_template_10g_fiber = {
 static const struct niu_phy_template phy_template_10g_fiber = {
 	.ops		= &phy_ops_10g_fiber,
 	.ops		= &phy_ops_10g_fiber,
 	.phy_addr_base	= 8,
 	.phy_addr_base	= 8,
@@ -2182,8 +2419,25 @@ static int niu_determine_phy_disposition(struct niu *np)
 	u32 phy_addr_off = 0;
 	u32 phy_addr_off = 0;
 
 
 	if (plat_type == PLAT_TYPE_NIU) {
 	if (plat_type == PLAT_TYPE_NIU) {
-		tp = &phy_template_niu;
-		phy_addr_off += np->port;
+		switch (np->flags &
+			(NIU_FLAGS_10G |
+			 NIU_FLAGS_FIBER |
+			 NIU_FLAGS_XCVR_SERDES)) {
+		case NIU_FLAGS_10G | NIU_FLAGS_XCVR_SERDES:
+			/* 10G Serdes */
+			tp = &phy_template_niu_10g_serdes;
+			break;
+		case NIU_FLAGS_XCVR_SERDES:
+			/* 1G Serdes */
+			tp = &phy_template_niu_1g_serdes;
+			break;
+		case NIU_FLAGS_10G | NIU_FLAGS_FIBER:
+			/* 10G Fiber */
+		default:
+			tp = &phy_template_niu_10g_fiber;
+			phy_addr_off += np->port;
+			break;
+		}
 	} else {
 	} else {
 		switch (np->flags &
 		switch (np->flags &
 			(NIU_FLAGS_10G |
 			(NIU_FLAGS_10G |
@@ -7213,6 +7467,12 @@ static int __devinit niu_phy_type_prop_decode(struct niu *np,
 		np->flags |= NIU_FLAGS_10G;
 		np->flags |= NIU_FLAGS_10G;
 		np->flags &= ~NIU_FLAGS_FIBER;
 		np->flags &= ~NIU_FLAGS_FIBER;
 		np->mac_xcvr = MAC_XCVR_XPCS;
 		np->mac_xcvr = MAC_XCVR_XPCS;
+	} else if (!strcmp(phy_prop, "xgsd") || !strcmp(phy_prop, "gsd")) {
+		/* 10G Serdes or 1G Serdes, default to 10G */
+		np->flags |= NIU_FLAGS_10G;
+		np->flags &= ~NIU_FLAGS_FIBER;
+		np->flags |= NIU_FLAGS_XCVR_SERDES;
+		np->mac_xcvr = MAC_XCVR_XPCS;
 	} else {
 	} else {
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
@@ -7741,6 +8001,8 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
 	u32 val;
 	u32 val;
 	int err;
 	int err;
 
 
+	num_10g = num_1g = 0;
+
 	if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) ||
 	if (!strcmp(np->vpd.model, NIU_ALONSO_MDL_STR) ||
 	    !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) {
 	    !strcmp(np->vpd.model, NIU_KIMI_MDL_STR)) {
 		num_10g = 0;
 		num_10g = 0;
@@ -7757,6 +8019,16 @@ static int __devinit walk_phys(struct niu *np, struct niu_parent *parent)
 		parent->num_ports = 2;
 		parent->num_ports = 2;
 		val = (phy_encode(PORT_TYPE_10G, 0) |
 		val = (phy_encode(PORT_TYPE_10G, 0) |
 		       phy_encode(PORT_TYPE_10G, 1));
 		       phy_encode(PORT_TYPE_10G, 1));
+	} else if ((np->flags & NIU_FLAGS_XCVR_SERDES) &&
+		   (parent->plat_type == PLAT_TYPE_NIU)) {
+		/* this is the Monza case */
+		if (np->flags & NIU_FLAGS_10G) {
+			val = (phy_encode(PORT_TYPE_10G, 0) |
+			       phy_encode(PORT_TYPE_10G, 1));
+		} else {
+			val = (phy_encode(PORT_TYPE_1G, 0) |
+			       phy_encode(PORT_TYPE_1G, 1));
+		}
 	} else {
 	} else {
 		err = fill_phy_probe_info(np, parent, info);
 		err = fill_phy_probe_info(np, parent, info);
 		if (err)
 		if (err)
@@ -8656,7 +8928,9 @@ static void __devinit niu_device_announce(struct niu *np)
 				dev->name,
 				dev->name,
 				(np->flags & NIU_FLAGS_XMAC ? "XMAC" : "BMAC"),
 				(np->flags & NIU_FLAGS_XMAC ? "XMAC" : "BMAC"),
 				(np->flags & NIU_FLAGS_10G ? "10G" : "1G"),
 				(np->flags & NIU_FLAGS_10G ? "10G" : "1G"),
-				(np->flags & NIU_FLAGS_FIBER ? "FIBER" : "COPPER"),
+				(np->flags & NIU_FLAGS_FIBER ? "FIBER" :
+				 (np->flags & NIU_FLAGS_XCVR_SERDES ? "SERDES" :
+				  "COPPER")),
 				(np->mac_xcvr == MAC_XCVR_MII ? "MII" :
 				(np->mac_xcvr == MAC_XCVR_MII ? "MII" :
 				 (np->mac_xcvr == MAC_XCVR_PCS ? "PCS" : "XPCS")),
 				 (np->mac_xcvr == MAC_XCVR_PCS ? "PCS" : "XPCS")),
 				np->vpd.phy_type);
 				np->vpd.phy_type);

+ 13 - 0
drivers/net/niu.h

@@ -1048,6 +1048,13 @@
 #define  PLL_CFG_LD_SHIFT		8
 #define  PLL_CFG_LD_SHIFT		8
 #define  PLL_CFG_MPY			0x0000001e
 #define  PLL_CFG_MPY			0x0000001e
 #define  PLL_CFG_MPY_SHIFT		1
 #define  PLL_CFG_MPY_SHIFT		1
+#define  PLL_CFG_MPY_4X		0x0
+#define  PLL_CFG_MPY_5X		0x00000002
+#define  PLL_CFG_MPY_6X		0x00000004
+#define  PLL_CFG_MPY_8X		0x00000008
+#define  PLL_CFG_MPY_10X		0x0000000a
+#define  PLL_CFG_MPY_12X		0x0000000c
+#define  PLL_CFG_MPY_12P5X		0x0000000e
 #define  PLL_CFG_ENPLL			0x00000001
 #define  PLL_CFG_ENPLL			0x00000001
 
 
 #define ESR2_TI_PLL_STS_L		(ESR2_BASE + 0x002)
 #define ESR2_TI_PLL_STS_L		(ESR2_BASE + 0x002)
@@ -1093,6 +1100,9 @@
 #define  PLL_TX_CFG_INVPAIR		0x00000080
 #define  PLL_TX_CFG_INVPAIR		0x00000080
 #define  PLL_TX_CFG_RATE		0x00000060
 #define  PLL_TX_CFG_RATE		0x00000060
 #define  PLL_TX_CFG_RATE_SHIFT		5
 #define  PLL_TX_CFG_RATE_SHIFT		5
+#define  PLL_TX_CFG_RATE_FULL		0x0
+#define  PLL_TX_CFG_RATE_HALF		0x20
+#define  PLL_TX_CFG_RATE_QUAD		0x40
 #define  PLL_TX_CFG_BUSWIDTH		0x0000001c
 #define  PLL_TX_CFG_BUSWIDTH		0x0000001c
 #define  PLL_TX_CFG_BUSWIDTH_SHIFT	2
 #define  PLL_TX_CFG_BUSWIDTH_SHIFT	2
 #define  PLL_TX_CFG_ENTEST		0x00000002
 #define  PLL_TX_CFG_ENTEST		0x00000002
@@ -1132,6 +1142,9 @@
 #define  PLL_RX_CFG_INVPAIR		0x00000080
 #define  PLL_RX_CFG_INVPAIR		0x00000080
 #define  PLL_RX_CFG_RATE		0x00000060
 #define  PLL_RX_CFG_RATE		0x00000060
 #define  PLL_RX_CFG_RATE_SHIFT		5
 #define  PLL_RX_CFG_RATE_SHIFT		5
+#define  PLL_RX_CFG_RATE_FULL		0x0
+#define  PLL_RX_CFG_RATE_HALF		0x20
+#define  PLL_RX_CFG_RATE_QUAD		0x40
 #define  PLL_RX_CFG_BUSWIDTH		0x0000001c
 #define  PLL_RX_CFG_BUSWIDTH		0x0000001c
 #define  PLL_RX_CFG_BUSWIDTH_SHIFT	2
 #define  PLL_RX_CFG_BUSWIDTH_SHIFT	2
 #define  PLL_RX_CFG_ENTEST		0x00000002
 #define  PLL_RX_CFG_ENTEST		0x00000002

+ 66 - 0
drivers/net/phy/marvell.c

@@ -227,6 +227,59 @@ static int m88e1111_config_init(struct phy_device *phydev)
 	return 0;
 	return 0;
 }
 }
 
 
+static int m88e1118_config_aneg(struct phy_device *phydev)
+{
+	int err;
+
+	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, MII_M1011_PHY_SCR,
+			MII_M1011_PHY_SCR_AUTO_CROSS);
+	if (err < 0)
+		return err;
+
+	err = genphy_config_aneg(phydev);
+	return 0;
+}
+
+static int m88e1118_config_init(struct phy_device *phydev)
+{
+	int err;
+
+	/* Change address */
+	err = phy_write(phydev, 0x16, 0x0002);
+	if (err < 0)
+		return err;
+
+	/* Enable 1000 Mbit */
+	err = phy_write(phydev, 0x15, 0x1070);
+	if (err < 0)
+		return err;
+
+	/* Change address */
+	err = phy_write(phydev, 0x16, 0x0003);
+	if (err < 0)
+		return err;
+
+	/* Adjust LED Control */
+	err = phy_write(phydev, 0x10, 0x021e);
+	if (err < 0)
+		return err;
+
+	/* Reset address */
+	err = phy_write(phydev, 0x16, 0x0);
+	if (err < 0)
+		return err;
+
+	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
 static int m88e1145_config_init(struct phy_device *phydev)
 static int m88e1145_config_init(struct phy_device *phydev)
 {
 {
 	int err;
 	int err;
@@ -415,6 +468,19 @@ static struct phy_driver marvell_drivers[] = {
 		.config_intr = &marvell_config_intr,
 		.config_intr = &marvell_config_intr,
 		.driver = { .owner = THIS_MODULE },
 		.driver = { .owner = THIS_MODULE },
 	},
 	},
+	{
+		.phy_id = 0x01410e10,
+		.phy_id_mask = 0xfffffff0,
+		.name = "Marvell 88E1118",
+		.features = PHY_GBIT_FEATURES,
+		.flags = PHY_HAS_INTERRUPT,
+		.config_init = &m88e1118_config_init,
+		.config_aneg = &m88e1118_config_aneg,
+		.read_status = &genphy_read_status,
+		.ack_interrupt = &marvell_ack_interrupt,
+		.config_intr = &marvell_config_intr,
+		.driver = {.owner = THIS_MODULE,},
+	},
 	{
 	{
 		.phy_id = 0x01410cd0,
 		.phy_id = 0x01410cd0,
 		.phy_id_mask = 0xfffffff0,
 		.phy_id_mask = 0xfffffff0,

+ 1 - 1
drivers/net/phy/mdio_bus.c

@@ -136,7 +136,7 @@ void mdiobus_unregister(struct mii_bus *bus)
 	BUG_ON(bus->state != MDIOBUS_REGISTERED);
 	BUG_ON(bus->state != MDIOBUS_REGISTERED);
 	bus->state = MDIOBUS_UNREGISTERED;
 	bus->state = MDIOBUS_UNREGISTERED;
 
 
-	device_unregister(&bus->dev);
+	device_del(&bus->dev);
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 	for (i = 0; i < PHY_MAX_ADDR; i++) {
 		if (bus->phy_map[i])
 		if (bus->phy_map[i])
 			device_unregister(&bus->phy_map[i]->dev);
 			device_unregister(&bus->phy_map[i]->dev);

+ 2 - 2
drivers/net/phy/phy_device.c

@@ -227,8 +227,8 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr)
 	if (r)
 	if (r)
 		return ERR_PTR(r);
 		return ERR_PTR(r);
 
 
-	/* If the phy_id is all Fs, there is no device there */
-	if (0xffffffff == phy_id)
+	/* If the phy_id is all Fs or all 0s, there is no device there */
+	if ((0xffff == phy_id) || (0x00 == phy_id))
 		return NULL;
 		return NULL;
 
 
 	dev = phy_device_create(bus, addr, phy_id);
 	dev = phy_device_create(bus, addr, phy_id);

+ 5 - 14
drivers/net/qla3xxx.c

@@ -1515,9 +1515,6 @@ static u32 ql_get_link_state(struct ql3_adapter *qdev)
 		linkState = LS_UP;
 		linkState = LS_UP;
 	} else {
 	} else {
 		linkState = LS_DOWN;
 		linkState = LS_DOWN;
-		if (netif_msg_link(qdev))
-			printk(KERN_WARNING PFX
-			       "%s: Link is down.\n", qdev->ndev->name);
 	}
 	}
 	return linkState;
 	return linkState;
 }
 }
@@ -1581,10 +1578,6 @@ static int ql_finish_auto_neg(struct ql3_adapter *qdev)
 			ql_mac_enable(qdev, 1);
 			ql_mac_enable(qdev, 1);
 		}
 		}
 
 
-		if (netif_msg_link(qdev))
-			printk(KERN_DEBUG PFX
-			       "%s: Change port_link_state LS_DOWN to LS_UP.\n",
-			       qdev->ndev->name);
 		qdev->port_link_state = LS_UP;
 		qdev->port_link_state = LS_UP;
 		netif_start_queue(qdev->ndev);
 		netif_start_queue(qdev->ndev);
 		netif_carrier_on(qdev->ndev);
 		netif_carrier_on(qdev->ndev);
@@ -1655,14 +1648,9 @@ static void ql_link_state_machine_work(struct work_struct *work)
 		/* Fall Through */
 		/* Fall Through */
 
 
 	case LS_DOWN:
 	case LS_DOWN:
-		if (netif_msg_link(qdev))
-			printk(KERN_DEBUG PFX
-			       "%s: port_link_state = LS_DOWN.\n",
-			       qdev->ndev->name);
 		if (curr_link_state == LS_UP) {
 		if (curr_link_state == LS_UP) {
 			if (netif_msg_link(qdev))
 			if (netif_msg_link(qdev))
-				printk(KERN_DEBUG PFX
-				       "%s: curr_link_state = LS_UP.\n",
+				printk(KERN_INFO PFX "%s: Link is up.\n",
 				       qdev->ndev->name);
 				       qdev->ndev->name);
 			if (ql_is_auto_neg_complete(qdev))
 			if (ql_is_auto_neg_complete(qdev))
 				ql_finish_auto_neg(qdev);
 				ql_finish_auto_neg(qdev);
@@ -1670,6 +1658,7 @@ static void ql_link_state_machine_work(struct work_struct *work)
 			if (qdev->port_link_state == LS_UP)
 			if (qdev->port_link_state == LS_UP)
 				ql_link_down_detect_clear(qdev);
 				ql_link_down_detect_clear(qdev);
 
 
+			qdev->port_link_state = LS_UP;
 		}
 		}
 		break;
 		break;
 
 
@@ -1678,12 +1667,14 @@ static void ql_link_state_machine_work(struct work_struct *work)
 		 * See if the link is currently down or went down and came
 		 * See if the link is currently down or went down and came
 		 * back up
 		 * back up
 		 */
 		 */
-		if ((curr_link_state == LS_DOWN) || ql_link_down_detect(qdev)) {
+		if (curr_link_state == LS_DOWN) {
 			if (netif_msg_link(qdev))
 			if (netif_msg_link(qdev))
 				printk(KERN_INFO PFX "%s: Link is down.\n",
 				printk(KERN_INFO PFX "%s: Link is down.\n",
 				       qdev->ndev->name);
 				       qdev->ndev->name);
 			qdev->port_link_state = LS_DOWN;
 			qdev->port_link_state = LS_DOWN;
 		}
 		}
+		if (ql_link_down_detect(qdev))
+			qdev->port_link_state = LS_DOWN;
 		break;
 		break;
 	}
 	}
 	spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
 	spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);

+ 3 - 3
drivers/net/ucc_geth_ethtool.c

@@ -323,17 +323,17 @@ static void uec_get_ethtool_stats(struct net_device *netdev,
 	if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) {
 	if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) {
 		base = (u32 __iomem *)&ugeth->ug_regs->tx64;
 		base = (u32 __iomem *)&ugeth->ug_regs->tx64;
 		for (i = 0; i < UEC_HW_STATS_LEN; i++)
 		for (i = 0; i < UEC_HW_STATS_LEN; i++)
-			data[j++] = (u64)in_be32(&base[i]);
+			data[j++] = in_be32(&base[i]);
 	}
 	}
 	if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
 	if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) {
 		base = (u32 __iomem *)ugeth->p_tx_fw_statistics_pram;
 		base = (u32 __iomem *)ugeth->p_tx_fw_statistics_pram;
 		for (i = 0; i < UEC_TX_FW_STATS_LEN; i++)
 		for (i = 0; i < UEC_TX_FW_STATS_LEN; i++)
-			data[j++] = (u64)in_be32(&base[i]);
+			data[j++] = base ? in_be32(&base[i]) : 0;
 	}
 	}
 	if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) {
 	if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) {
 		base = (u32 __iomem *)ugeth->p_rx_fw_statistics_pram;
 		base = (u32 __iomem *)ugeth->p_rx_fw_statistics_pram;
 		for (i = 0; i < UEC_RX_FW_STATS_LEN; i++)
 		for (i = 0; i < UEC_RX_FW_STATS_LEN; i++)
-			data[j++] = (u64)in_be32(&base[i]);
+			data[j++] = base ? in_be32(&base[i]) : 0;
 	}
 	}
 }
 }
 
 

+ 4 - 0
drivers/net/usb/asix.c

@@ -1444,6 +1444,10 @@ static const struct usb_device_id	products [] = {
 	// Apple USB Ethernet Adapter
 	// Apple USB Ethernet Adapter
 	USB_DEVICE(0x05ac, 0x1402),
 	USB_DEVICE(0x05ac, 0x1402),
 	.driver_info = (unsigned long) &ax88772_info,
 	.driver_info = (unsigned long) &ax88772_info,
+}, {
+	// Cables-to-Go USB Ethernet Adapter
+	USB_DEVICE(0x0b95, 0x772a),
+	.driver_info = (unsigned long) &ax88772_info,
 },
 },
 	{ },		// END
 	{ },		// END
 };
 };

+ 1 - 1
drivers/net/via-velocity.c

@@ -2296,7 +2296,7 @@ static void velocity_set_multi(struct net_device *dev)
 		}
 		}
 
 
 		mac_set_cam_mask(regs, vptr->mCAMmask);
 		mac_set_cam_mask(regs, vptr->mCAMmask);
-		rx_mode = (RCR_AM | RCR_AB);
+		rx_mode = RCR_AM | RCR_AB | RCR_AP;
 	}
 	}
 	if (dev->mtu > 1500)
 	if (dev->mtu > 1500)
 		rx_mode |= RCR_AL;
 		rx_mode |= RCR_AL;

+ 2 - 1
drivers/pcmcia/cistpl.c

@@ -351,10 +351,11 @@ int verify_cis_cache(struct pcmcia_socket *s)
 	char *buf;
 	char *buf;
 
 
 	buf = kmalloc(256, GFP_KERNEL);
 	buf = kmalloc(256, GFP_KERNEL);
-	if (buf == NULL)
+	if (buf == NULL) {
 		dev_printk(KERN_WARNING, &s->dev,
 		dev_printk(KERN_WARNING, &s->dev,
 			   "no memory for verifying CIS\n");
 			   "no memory for verifying CIS\n");
 		return -ENOMEM;
 		return -ENOMEM;
+	}
 	list_for_each_entry(cis, &s->cis_cache, node) {
 	list_for_each_entry(cis, &s->cis_cache, node) {
 		int len = cis->len;
 		int len = cis->len;
 
 

+ 7 - 7
drivers/pcmcia/cs.c

@@ -186,12 +186,6 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 
 
 	spin_lock_init(&socket->lock);
 	spin_lock_init(&socket->lock);
 
 
-	if (socket->resource_ops->init) {
-		ret = socket->resource_ops->init(socket);
-		if (ret)
-			return (ret);
-	}
-
 	/* try to obtain a socket number [yes, it gets ugly if we
 	/* try to obtain a socket number [yes, it gets ugly if we
 	 * register more than 2^sizeof(unsigned int) pcmcia
 	 * register more than 2^sizeof(unsigned int) pcmcia
 	 * sockets... but the socket number is deprecated
 	 * sockets... but the socket number is deprecated
@@ -226,7 +220,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 	/* set proper values in socket->dev */
 	/* set proper values in socket->dev */
 	dev_set_drvdata(&socket->dev, socket);
 	dev_set_drvdata(&socket->dev, socket);
 	socket->dev.class = &pcmcia_socket_class;
 	socket->dev.class = &pcmcia_socket_class;
-	snprintf(socket->dev.bus_id, BUS_ID_SIZE, "pcmcia_socket%u", socket->sock);
+	dev_set_name(&socket->dev, "pcmcia_socket%u", socket->sock);
 
 
 	/* base address = 0, map = 0 */
 	/* base address = 0, map = 0 */
 	socket->cis_mem.flags = 0;
 	socket->cis_mem.flags = 0;
@@ -239,6 +233,12 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
 	mutex_init(&socket->skt_mutex);
 	mutex_init(&socket->skt_mutex);
 	spin_lock_init(&socket->thread_lock);
 	spin_lock_init(&socket->thread_lock);
 
 
+	if (socket->resource_ops->init) {
+		ret = socket->resource_ops->init(socket);
+		if (ret)
+			goto err;
+	}
+
 	tsk = kthread_run(pccardd, socket, "pccardd");
 	tsk = kthread_run(pccardd, socket, "pccardd");
 	if (IS_ERR(tsk)) {
 	if (IS_ERR(tsk)) {
 		ret = PTR_ERR(tsk);
 		ret = PTR_ERR(tsk);

+ 6 - 5
drivers/pcmcia/ds.c

@@ -622,7 +622,6 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
 {
 {
 	struct pcmcia_device *p_dev, *tmp_dev;
 	struct pcmcia_device *p_dev, *tmp_dev;
 	unsigned long flags;
 	unsigned long flags;
-	int bus_id_len;
 
 
 	s = pcmcia_get_socket(s);
 	s = pcmcia_get_socket(s);
 	if (!s)
 	if (!s)
@@ -650,12 +649,12 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
 	/* by default don't allow DMA */
 	/* by default don't allow DMA */
 	p_dev->dma_mask = DMA_MASK_NONE;
 	p_dev->dma_mask = DMA_MASK_NONE;
 	p_dev->dev.dma_mask = &p_dev->dma_mask;
 	p_dev->dev.dma_mask = &p_dev->dma_mask;
-	bus_id_len = sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no);
-
-	p_dev->devname = kmalloc(6 + bus_id_len + 1, GFP_KERNEL);
+	dev_set_name(&p_dev->dev, "%d.%d", p_dev->socket->sock, p_dev->device_no);
+	if (!dev_name(&p_dev->dev))
+		goto err_free;
+	p_dev->devname = kasprintf(GFP_KERNEL, "pcmcia%s", dev_name(&p_dev->dev));
 	if (!p_dev->devname)
 	if (!p_dev->devname)
 		goto err_free;
 		goto err_free;
-	sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id);
 	ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname);
 	ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname);
 
 
 	spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
 	spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
@@ -668,6 +667,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
         list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list)
         list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list)
                 if (p_dev->func == tmp_dev->func) {
                 if (p_dev->func == tmp_dev->func) {
 			p_dev->function_config = tmp_dev->function_config;
 			p_dev->function_config = tmp_dev->function_config;
+			p_dev->io = tmp_dev->io;
+			p_dev->irq = tmp_dev->irq;
 			kref_get(&p_dev->function_config->ref);
 			kref_get(&p_dev->function_config->ref);
 		}
 		}
 
 

Some files were not shown because too many files changed in this diff