aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/ext4.txt6
-rw-r--r--Documentation/ja_JP/HOWTO67
-rw-r--r--Documentation/ja_JP/SubmitChecklist111
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--Makefile2
-rw-r--r--arch/arm/mach-integrator/impd1.c2
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c4
-rw-r--r--arch/arm/mach-pxa/clock.c25
-rw-r--r--arch/arm/mach-pxa/clock.h5
-rw-r--r--arch/arm/mach-pxa/eseries.c170
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c10
-rw-r--r--arch/arm/mach-pxa/pxa300.c2
-rw-r--r--arch/s390/defconfig54
-rw-r--r--arch/s390/include/asm/bitops.h6
-rw-r--r--arch/s390/kernel/process.c4
-rw-r--r--arch/s390/kernel/smp.c2
-rw-r--r--arch/x86/kernel/amd_iommu.c2
-rw-r--r--arch/x86/kernel/cpu/addon_cpuid_features.c17
-rw-r--r--arch/x86/kernel/cpu/cyrix.c18
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c20
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c5
-rw-r--r--arch/x86/kernel/genx2apic_uv_x.c8
-rw-r--r--arch/x86/kernel/numaq_32.c2
-rw-r--r--arch/x86/kernel/paravirt.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c14
-rw-r--r--arch/x86/kernel/setup.c16
-rw-r--r--arch/x86/kernel/smpboot.c3
-rw-r--r--arch/x86/kernel/tlb_uv.c3
-rw-r--r--arch/x86/kernel/tsc_sync.c6
-rw-r--r--arch/x86/mm/init_64.c36
-rw-r--r--arch/x86/mm/ioremap.c8
-rw-r--r--arch/x86/mm/mmio-mod.c4
-rw-r--r--arch/x86/mm/pageattr.c6
-rw-r--r--arch/x86/mm/pat.c50
-rw-r--r--arch/x86/oprofile/nmi_int.c39
-rw-r--r--block/genhd.c36
-rw-r--r--drivers/ata/ahci.c8
-rw-r--r--drivers/ata/ata_piix.c8
-rw-r--r--drivers/ata/libata-core.c60
-rw-r--r--drivers/ata/libata-eh.c30
-rw-r--r--drivers/ata/pata_acpi.c2
-rw-r--r--drivers/ata/pata_atiixp.c2
-rw-r--r--drivers/ata/pata_cs5530.c6
-rw-r--r--drivers/ata/pata_it821x.c2
-rw-r--r--drivers/ata/pata_oldpiix.c2
-rw-r--r--drivers/ata/pata_sc1200.c6
-rw-r--r--drivers/ata/pata_via.c59
-rw-r--r--drivers/ata/sata_mv.c37
-rw-r--r--drivers/base/class.c11
-rw-r--r--drivers/base/core.c31
-rw-r--r--drivers/base/driver.c3
-rw-r--r--drivers/base/power/main.c19
-rw-r--r--drivers/base/power/power.h9
-rw-r--r--drivers/block/brd.c2
-rw-r--r--drivers/block/nbd.c10
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_iba7220.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c8
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c19
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c10
-rw-r--r--drivers/misc/eeepc-laptop.c2
-rw-r--r--drivers/rtc/Kconfig2
-rw-r--r--drivers/rtc/rtc-bfin.c60
-rw-r--r--drivers/rtc/rtc-dev.c5
-rw-r--r--drivers/rtc/rtc-ds1374.c10
-rw-r--r--drivers/s390/block/dasd.c5
-rw-r--r--drivers/s390/block/dasd_eckd.h2
-rw-r--r--drivers/s390/block/dasd_eer.c3
-rw-r--r--drivers/s390/block/dcssblk.c4
-rw-r--r--drivers/s390/char/tape_char.c2
-rw-r--r--drivers/s390/char/tape_std.c2
-rw-r--r--drivers/s390/cio/ccwgroup.c20
-rw-r--r--drivers/s390/cio/css.c1
-rw-r--r--drivers/s390/cio/device.c40
-rw-r--r--drivers/s390/cio/device.h2
-rw-r--r--drivers/s390/cio/device_fsm.c31
-rw-r--r--drivers/s390/cio/qdio_debug.h6
-rw-r--r--drivers/s390/cio/qdio_main.c74
-rw-r--r--drivers/s390/cio/qdio_setup.c6
-rw-r--r--drivers/s390/cio/qdio_thinint.c6
-rw-r--r--drivers/uio/Kconfig13
-rw-r--r--drivers/uio/Makefile1
-rw-r--r--drivers/uio/uio_pdrv.c4
-rw-r--r--drivers/uio/uio_pdrv_genirq.c188
-rw-r--r--drivers/usb/class/cdc-acm.c5
-rw-r--r--drivers/usb/core/driver.c96
-rw-r--r--drivers/usb/core/hcd.c9
-rw-r--r--drivers/usb/core/hcd.h4
-rw-r--r--drivers/usb/core/hub.c9
-rw-r--r--drivers/usb/core/urb.c9
-rw-r--r--drivers/usb/core/usb.c73
-rw-r--r--drivers/usb/core/usb.h3
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c2
-rw-r--r--drivers/usb/host/isp1760-hcd.c2
-rw-r--r--drivers/usb/host/ohci-at91.c1
-rw-r--r--drivers/usb/host/ohci-au1xxx.c1
-rw-r--r--drivers/usb/host/ohci-ep93xx.c1
-rw-r--r--drivers/usb/host/ohci-hub.c53
-rw-r--r--drivers/usb/host/ohci-lh7a404.c1
-rw-r--r--drivers/usb/host/ohci-omap.c1
-rw-r--r--drivers/usb/host/ohci-pci.c1
-rw-r--r--drivers/usb/host/ohci-pnx4008.c1
-rw-r--r--drivers/usb/host/ohci-pnx8550.c1
-rw-r--r--drivers/usb/host/ohci-ppc-of.c1
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c1
-rw-r--r--drivers/usb/host/ohci-ps3.c1
-rw-r--r--drivers/usb/host/ohci-pxa27x.c1
-rw-r--r--drivers/usb/host/ohci-s3c2410.c1
-rw-r--r--drivers/usb/host/ohci-sa1111.c1
-rw-r--r--drivers/usb/host/ohci-sh.c1
-rw-r--r--drivers/usb/host/ohci-sm501.c1
-rw-r--r--drivers/usb/host/ohci-ssb.c1
-rw-r--r--drivers/usb/host/u132-hcd.c11
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c1
-rw-r--r--drivers/usb/musb/Kconfig13
-rw-r--r--drivers/usb/musb/Makefile21
-rw-r--r--drivers/usb/musb/musb_core.c38
-rw-r--r--drivers/usb/musb/musb_core.h19
-rw-r--r--drivers/usb/musb/musb_debug.h4
-rw-r--r--drivers/usb/musb/musb_gadget_ep0.c2
-rw-r--r--drivers/usb/musb/musb_procfs.c830
-rw-r--r--drivers/usb/serial/option.c2
-rw-r--r--drivers/video/bf54x-lq043fb.c15
-rw-r--r--drivers/video/fb_defio.c19
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/pm2fb.c1
-rw-r--r--fs/binfmt_misc.c4
-rw-r--r--fs/cramfs/inode.c84
-rw-r--r--fs/ext4/balloc.c3
-rw-r--r--fs/ext4/dir.c20
-rw-r--r--fs/ext4/ext4.h4
-rw-r--r--fs/ext4/ext4_extents.h4
-rw-r--r--fs/ext4/ext4_jbd2.h8
-rw-r--r--fs/ext4/extents.c113
-rw-r--r--fs/ext4/ialloc.c2
-rw-r--r--fs/ext4/inode.c478
-rw-r--r--fs/ext4/mballoc.c53
-rw-r--r--fs/ext4/migrate.c3
-rw-r--r--fs/ext4/resize.c3
-rw-r--r--fs/ext4/super.c1
-rw-r--r--fs/ioprio.c8
-rw-r--r--fs/proc/nommu.c4
-rw-r--r--fs/proc/task_mmu.c4
-rw-r--r--include/asm-x86/genapic_32.h1
-rw-r--r--include/asm-x86/genapic_64.h1
-rw-r--r--include/asm-x86/irq_vectors.h1
-rw-r--r--include/asm-x86/uv/uv_bau.h5
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/libata.h24
-rw-r--r--include/linux/pid.h9
-rw-r--r--include/linux/rmap.h2
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/usb.h3
-rw-r--r--kernel/rcupdate.c1
-rw-r--r--kernel/sched_features.h2
-rw-r--r--kernel/sys.c8
-rw-r--r--kernel/time/tick-sched.c6
-rw-r--r--lib/kobject.c3
-rw-r--r--mm/bootmem.c35
-rw-r--r--mm/filemap_xip.c65
-rw-r--r--mm/mm_init.c2
-rw-r--r--mm/rmap.c39
-rw-r--r--mm/swap_state.c2
-rw-r--r--scripts/mod/file2alias.c16
-rw-r--r--sound/pci/hda/hda_intel.c9
-rw-r--r--sound/pci/hda/patch_realtek.c6
169 files changed, 2008 insertions, 1919 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
index 80e193d82e2..0d5394920a3 100644
--- a/Documentation/filesystems/ext4.txt
+++ b/Documentation/filesystems/ext4.txt
@@ -26,6 +26,12 @@ Mailing list: linux-ext4@vger.kernel.org
26 26
27 git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git 27 git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
28 28
29 - Note that it is highly important to install the mke2fs.conf file
30 that comes with the e2fsprogs 1.41.x sources in /etc/mke2fs.conf. If
31 you have edited the /etc/mke2fs.conf file installed on your system,
32 you will need to merge your changes with the version from e2fsprogs
33 1.41.x.
34
29 - Create a new filesystem using the ext4dev filesystem type: 35 - Create a new filesystem using the ext4dev filesystem type:
30 36
31 # mke2fs -t ext4dev /dev/hda1 37 # mke2fs -t ext4dev /dev/hda1
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO
index 488c77fa3aa..0775cf4798b 100644
--- a/Documentation/ja_JP/HOWTO
+++ b/Documentation/ja_JP/HOWTO
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates for this file, please try 11fork. So if you have any comments or updates for this file, please try
12to update the original English file first. 12to update the original English file first.
13 13
14Last Updated: 2007/11/16 14Last Updated: 2008/08/21
15================================== 15==================================
16ã“ã‚Œã¯ã€ 16ã“ã‚Œã¯ã€
17linux-2.6.24/Documentation/HOWTO 17linux-2.6.27/Documentation/HOWTO
18ã®å’Œè¨³ã§ã™ã€‚ 18ã®å’Œè¨³ã§ã™ã€‚
19 19
20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
21翻訳日: 2007/11/10 21翻訳日: 2008/8/5
22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> 23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com>
24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
@@ -287,13 +287,15 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ロセスã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚
287 ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–­ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚目標ã¯æ¯Žé€±æ–° 287 ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–­ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚目標ã¯æ¯Žé€±æ–°
288 ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ 288 ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚
289 289
290 - 以下㮠URL ã§å„ -rc リリースã«å­˜åœ¨ã™ã‚‹æ—¢çŸ¥ã®å¾Œæˆ»ã‚Šå•é¡Œã®ãƒªã‚¹ãƒˆ
291 ãŒè¿½è·¡ã•ã‚Œã¾ã™-
292 http://kernelnewbies.org/known_regressions
293
294 - ã“ã®ãƒ—ロセスã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ 290 - ã“ã®ãƒ—ロセスã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾
295 ã™ã€‚ã“ã®ãƒ—ロセスã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ 291 ã™ã€‚ã“ã®ãƒ—ロセスã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚
296 292
293 - å„リリースã§ã®æ—¢çŸ¥ã®å¾Œæˆ»ã‚Šå•é¡Œ(regression: ã“ã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸­ã§æ–°è¦
294 ã«ä½œã‚Šè¾¼ã¾ã‚ŒãŸå•é¡Œã‚’指ã™) ã¯ãã®éƒ½åº¦ Linux-kernel メーリングリスト
295 ã«æŠ•ç¨¿ã•ã‚Œã¾ã™ã€‚ゴールã¨ã—ã¦ã¯ã€ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨å®£è¨€
296 ã™ã‚‹å‰ã«ã“ã®ãƒªã‚¹ãƒˆã®é•·ã•ã‚’ゼロã«æ¸›ã‚‰ã™ã“ã¨ã§ã™ãŒã€ç¾å®Ÿã«ã¯ã€æ•°å€‹ã®
297 後戻りå•é¡ŒãŒãƒªãƒªãƒ¼ã‚¹æ™‚ã«ãŸã³ãŸã³æ®‹ã£ã¦ã—ã¾ã„ã¾ã™ã€‚
298
297Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ 299Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„
298ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚ã‚Šã¾ã™- 300ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚ã‚Šã¾ã™-
299 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã‚‹ã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“ã‚Œã¯ç¾ 301 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã‚‹ã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“ã‚Œã¯ç¾
@@ -303,18 +305,20 @@ Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã
3032.6.x.y -stable カーãƒãƒ«ãƒ„リー 3052.6.x.y -stable カーãƒãƒ«ãƒ„リー
304--------------------------- 306---------------------------
305 307
306ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«4ã¤ç›®ã®æ•°å­—ãŒã¤ã„ãŸã‚«ãƒ¼ãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ã“れ㫠308ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ4ã¤ã®æ•°å­—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚
307ã¯ã€2.6.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•é¡Œã‚„é‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ã™ã‚‹æ¯” 309ã“ã‚Œã«ã¯ã€2.6.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚­ãƒ¥ãƒªãƒ†ã‚£å•é¡Œã‚„é‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾
308較的å°ã•ã„é‡è¦ãªä¿®æ­£ãŒå«ã¾ã‚Œã¾ã™ã€‚ 310ã™ã‚‹æ¯”較的å°ã•ã„é‡è¦ãªä¿®æ­£ãŒå«ã¾ã‚Œã¾ã™ã€‚
309 311
310ã“ã‚Œã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ã〠312ã“ã‚Œã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ãã€
311最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ユーザã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ 313最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ユーザã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚
312 314
313ã‚‚ã—ã€2.6.x.y カーãƒãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 2.6.x 315ã‚‚ã—ã€2.6.x.y カーãƒãƒ«ãŒå­˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 2.6.x ãŒ
314ãŒæœ€æ–°ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ 316最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚
315 317
3162.6.x.y 㯠"stable" ãƒãƒ¼ãƒ  <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•ã‚Œã¦ãŠã‚Šã€ã  3182.6.x.y 㯠"stable" ãƒãƒ¼ãƒ  <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•ã‚Œã¦ãŠã‚Šã€å¿…
317ã„ãŸã„隔週ã§ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¦ã„ã¾ã™ã€‚ 319è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—è¿«ã£
320ãŸå•é¡ŒãŒãªã‘ã‚Œã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚ã‚Šã¾ã™ã€‚セキュリティ関連ã®å•é¡Œ
321ã®å ´åˆã¯ã“ã‚Œã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•ã‚Œã¾ã™ã€‚
318 322
319カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/stable_kernel_rules.txt ファ 323カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/stable_kernel_rules.txt ファ
320イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª 324イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª
@@ -341,7 +345,9 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ
341メインラインã¸å…¥ã‚Œã‚‹ã‚ˆã†ã« Linus ã«ãƒ—ッシュã—ã¾ã™ã€‚ 345メインラインã¸å…¥ã‚Œã‚‹ã‚ˆã†ã« Linus ã«ãƒ—ッシュã—ã¾ã™ã€‚
342 346
343メインカーãƒãƒ«ãƒ„リーã«å«ã‚ã‚‹ãŸã‚ã« Linus ã«é€ã‚‹å‰ã«ã€ã™ã¹ã¦ã®æ–°ã—ã„パッ 347メインカーãƒãƒ«ãƒ„リーã«å«ã‚ã‚‹ãŸã‚ã« Linus ã«é€ã‚‹å‰ã«ã€ã™ã¹ã¦ã®æ–°ã—ã„パッ
344ãƒãŒ -mm ツリーã§ãƒ†ã‚¹ãƒˆã•ã‚Œã‚‹ã“ã¨ãŒå¼·ã推奨ã•ã‚Œã¾ã™ã€‚ 348ãƒãŒ -mm ツリーã§ãƒ†ã‚¹ãƒˆã•ã‚Œã‚‹ã“ã¨ãŒå¼·ã推奨ã•ã‚Œã¦ã„ã¾ã™ã€‚マージウィン
349ドウãŒé–‹ãå‰ã« -mm ツリーã«ç¾ã‚Œãªã‹ã£ãŸãƒ‘ッãƒã¯ãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã«ãƒžãƒ¼ã‚¸ã•
350れるã“ã¨ã¯å›°é›£ã«ãªã‚Šã¾ã™ã€‚
345 351
346ã“れらã®ã‚«ãƒ¼ãƒãƒ«ã¯å®‰å®šã—ã¦å‹•ä½œã™ã¹ãシステムã¨ã—ã¦ä½¿ã†ã®ã«ã¯é©åˆ‡ã§ã¯ã‚ 352ã“れらã®ã‚«ãƒ¼ãƒãƒ«ã¯å®‰å®šã—ã¦å‹•ä½œã™ã¹ãシステムã¨ã—ã¦ä½¿ã†ã®ã«ã¯é©åˆ‡ã§ã¯ã‚
347ã‚Šã¾ã›ã‚“ã—ã€ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã®ä¸­ã§ã‚‚ã‚‚ã£ã¨ã‚‚動作ã«ãƒªã‚¹ã‚¯ãŒé«˜ã„ã‚‚ã®ã§ã™ã€‚ 353ã‚Šã¾ã›ã‚“ã—ã€ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã®ä¸­ã§ã‚‚ã‚‚ã£ã¨ã‚‚動作ã«ãƒªã‚¹ã‚¯ãŒé«˜ã„ã‚‚ã®ã§ã™ã€‚
@@ -395,13 +401,15 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ
395 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> 401 - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net>
396 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git 402 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
397 403
398 - SCSI, James Bottomley <James.Bottomley@SteelEye.com> 404 - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com>
399 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git 405 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
400 406
407 - x86, Ingo Molnar <mingo@elte.hu>
408 git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
409
401 quilt ツリー- 410 quilt ツリー-
402 - USB, PCI ドライãƒã‚³ã‚¢ã¨ I2C, Greg Kroah-Hartman <gregkh@suse.de> 411 - USB, ドライãƒã‚³ã‚¢ã¨ I2C, Greg Kroah-Hartman <gregkh@suse.de>
403 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 412 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
404 - x86-64 㨠i386 ã®ä»²é–“ Andi Kleen <ak@suse.de>
405 413
406 ãã®ä»–ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リー㯠http://git.kernel.org/ 㨠MAINTAINERS ファ 414 ãã®ä»–ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リー㯠http://git.kernel.org/ 㨠MAINTAINERS ファ
407 イルã«ä¸€è¦§è¡¨ãŒã‚ã‚Šã¾ã™ã€‚ 415 イルã«ä¸€è¦§è¡¨ãŒã‚ã‚Šã¾ã™ã€‚
@@ -412,13 +420,32 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ
412bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ 420bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹
413場所ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ 421場所ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚
414ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- 422ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„-
415 http://test.kernel.org/bugzilla/faq.html 423 http://bugzilla.kernel.org/page.cgi?id=faq.html
416
417メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル REPORTING-BUGS ã¯ã‚«ãƒ¼ãƒ 424メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル REPORTING-BUGS ã¯ã‚«ãƒ¼ãƒ
418ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚ã‚Šã€å• 425ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚ã‚Šã€å•
419é¡Œã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ 426é¡Œã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³
420ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ 427ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚
421 428
429ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç†
430-------------------
431
432ã‚ãªãŸã®ãƒãƒƒã‚­ãƒ³ã‚°ã®ã‚¹ã‚­ãƒ«ã‚’訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼
433トã—ãŸãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ãŒã‚ã‚Šã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹
434ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•é¡Œã‚’修正ã™ã‚‹ã“ã¨ã‚’
435å­¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚­ãƒ«ã‚‚強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å­˜åœ¨ã«æ°—ãŒã¤ã
436ã¾ã™ã€‚ãƒã‚°ã‚’修正ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸­ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善
437ã®é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ­£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好ã¾
438ãªã„ã‹ã‚‰ã§ã™ã€‚
439
440ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•ã‚ŒãŸãƒã‚°ã®ãŸã‚ã«ä»•äº‹ã‚’ã™ã‚‹ãŸã‚ã«ã¯ã€
441http://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã«
442ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚ã‚Œã°ã€bugme-new メーリングリスト(æ–°ã—
443ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•ã‚Œã‚‹) ã¾ãŸã¯ bugme-janitor メーリン
444グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•ã‚Œã‚‹)を購読ã§ãã¾ã™ã€‚
445
446 http://lists.linux-foundation.org/mailman/listinfo/bugme-new
447 http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors
448
422メーリングリスト 449メーリングリスト
423------------- 450-------------
424 451
diff --git a/Documentation/ja_JP/SubmitChecklist b/Documentation/ja_JP/SubmitChecklist
new file mode 100644
index 00000000000..6c42e071d72
--- /dev/null
+++ b/Documentation/ja_JP/SubmitChecklist
@@ -0,0 +1,111 @@
1NOTE:
2This is a version of Documentation/SubmitChecklist into Japanese.
3This document is maintained by Takenori Nagano <t-nagano@ah.jp.nec.com>
4and the JF Project team <http://www.linux.or.jp/JF/>.
5If you find any difference between this document and the original file
6or a problem with the translation,
7please contact the maintainer of this file or JF project.
8
9Please also note that the purpose of this file is to be easier to read
10for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates of this file, please try
12to update the original English file first.
13
14Last Updated: 2008/07/14
15==================================
16ã“ã‚Œã¯ã€
17linux-2.6.26/Documentation/SubmitChecklist ã®å’Œè¨³ã§ã™ã€‚
18
19翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
20翻訳日: 2008/07/14
21翻訳者: Takenori Nagano <t-nagano at ah dot jp dot nec dot com>
22校正者: Masanori Kobayashi ã•ã‚“ <zap03216 at nifty dot ne dot jp>
23==================================
24
25
26Linux カーãƒãƒ«ãƒ‘ッãƒæŠ•ç¨¿è€…å‘ã‘ãƒã‚§ãƒƒã‚¯ãƒªã‚¹ãƒˆ
27~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28
29本書ã§ã¯ã€ãƒ‘ッãƒã‚’より素早ãå–り込んã§ã‚‚らã„ãŸã„開発者ãŒå®Ÿè·µã™ã¹ã基本的ãªäº‹æŸ„
30ã‚’ã„ãã¤ã‹ç´¹ä»‹ã—ã¾ã™ã€‚ã“ã“ã«ã‚ã‚‹å…¨ã¦ã®äº‹æŸ„ã¯ã€Documentation/SubmittingPatches
31ãªã©ã®Linuxカーãƒãƒ«ãƒ‘ッãƒæŠ•ç¨¿ã«éš›ã—ã¦ã®å¿ƒå¾—を補足ã™ã‚‹ã‚‚ã®ã§ã™ã€‚
32
33 1: 妥当ãªCONFIGオプションや変更ã•ã‚ŒãŸCONFIGオプションã€ã¤ã¾ã‚Š =y, =m, =n
34 å…¨ã¦ã§æ­£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。ãã®éš›ã€gccåŠã³ãƒªãƒ³ã‚«ãŒ
35 warningã‚„errorを出ã—ã¦ã„ãªã„ã“ã¨ã‚‚確èªã—ã¦ãã ã•ã„。
36
37 2: allnoconfig, allmodconfig オプションを用ã„ã¦æ­£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’
38 確èªã—ã¦ãã ã•ã„。
39
40 3: 手許ã®ã‚¯ãƒ­ã‚¹ã‚³ãƒ³ãƒ‘イルツールやOSDLã®PLMã®ã‚ˆã†ãªã‚‚ã®ã‚’用ã„ã¦ã€è¤‡æ•°ã®
41 アーキテクãƒãƒ£ã«ãŠã„ã¦ã‚‚æ­£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。
42
43 4: 64bité•·ã®'unsigned long'を使用ã—ã¦ã„ã‚‹ppc64ã¯ã€ã‚¯ãƒ­ã‚¹ã‚³ãƒ³ãƒ‘イルã§ã®
44 ãƒã‚§ãƒƒã‚¯ã«é©å½“ãªã‚¢ãƒ¼ã‚­ãƒ†ã‚¯ãƒãƒ£ã§ã™ã€‚
45
46 5: カーãƒãƒ«ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã«æº–æ‹ ã—ã¦ã„ã‚‹ã‹ã©ã†ã‹ç¢ºèªã—ã¦ãã ã•ã„(!)
47
48 6: CONFIGオプションã®è¿½åŠ ãƒ»å¤‰æ›´ã‚’ã—ãŸå ´åˆã«ã¯ã€CONFIGメニューãŒå£Šã‚Œã¦ã„ãªã„
49 ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。
50
51 7: æ–°ã—ãKconfigã®ã‚ªãƒ—ションを追加ã™ã‚‹éš›ã«ã¯ã€å¿…ãšãã®helpも記述ã—ã¦ãã ã•ã„。
52
53 8: é©åˆ‡ãªKconfigã®ä¾å­˜é–¢ä¿‚を考ãˆãªãŒã‚‰æ…Žé‡ã«ãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„。
54 ãŸã ã—ã€ã“ã®ä½œæ¥­ã¯ãƒžã‚·ãƒ³ã‚’使ã£ãŸãƒ†ã‚¹ãƒˆã§ãã¡ã‚“ã¨è¡Œã†ã®ãŒã¨ã¦ã‚‚困難ã§ã™ã€‚
55 ã†ã¾ãã‚„ã‚‹ã«ã¯ã€è‡ªåˆ†ã®é ­ã§è€ƒãˆã‚‹ã“ã¨ã§ã™ã€‚
56
57 9: sparseを利用ã—ã¦ã¡ã‚ƒã‚“ã¨ã—ãŸã‚³ãƒ¼ãƒ‰ãƒã‚§ãƒƒã‚¯ã‚’ã—ã¦ãã ã•ã„。
58
5910: 'make checkstack' 㨠'make namespacecheck' を利用ã—ã€å•é¡ŒãŒç™ºè¦‹ã•ã‚ŒãŸã‚‰
60 修正ã—ã¦ãã ã•ã„。'make checkstack' ã¯æ˜Žç¤ºçš„ã«å•é¡Œã‚’示ã—ã¾ã›ã‚“ãŒã€ã©ã‚Œã‹
61 1ã¤ã®é–¢æ•°ãŒ512ãƒã‚¤ãƒˆã‚ˆã‚Šå¤§ãã„スタックを使ã£ã¦ã„ã‚Œã°ã€ä¿®æ­£ã™ã¹ã候補ã¨
62 ãªã‚Šã¾ã™ã€‚
63
6411: グローãƒãƒ«ãªkernel API を説明ã™ã‚‹ kernel-doc をソースã®ä¸­ã«å«ã‚ã¦ãã ã•ã„。
65 ( staticãªé–¢æ•°ã«ãŠã„ã¦ã¯å¿…é ˆã§ã¯ã‚ã‚Šã¾ã›ã‚“ãŒã€å«ã‚ã¦ã‚‚らã£ã¦ã‚‚çµæ§‹ã§ã™ )
66 ãã—ã¦ã€'make htmldocs' ã‚‚ã—ã㯠'make mandocs' を利用ã—ã¦è¿½è¨˜ã—ãŸ
67 ドキュメントã®ãƒã‚§ãƒƒã‚¯ã‚’è¡Œã„ã€å•é¡ŒãŒè¦‹ã¤ã‹ã£ãŸå ´åˆã«ã¯ä¿®æ­£ã‚’è¡Œã£ã¦ãã ã•ã„。
68
6912: CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB,
70 CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_SPINLOCK,
71 CONFIG_DEBUG_SPINLOCK_SLEEP ã“れら全ã¦ã‚’åŒæ™‚ã«æœ‰åŠ¹ã«ã—ã¦å‹•ä½œç¢ºèªã‚’
72 è¡Œã£ã¦ãã ã•ã„。
73
7413: CONFIG_SMP, CONFIG_PREEMPT を有効ã«ã—ãŸå ´åˆã¨ç„¡åŠ¹ã«ã—ãŸå ´åˆã®ä¸¡æ–¹ã§
75 ビルドã—ãŸä¸Šã€å‹•ä½œç¢ºèªã‚’è¡Œã£ã¦ãã ã•ã„。
76
7714: ã‚‚ã—パッãƒãŒãƒ‡ã‚£ã‚¹ã‚¯ã®I/O性能ãªã©ã«å½±éŸ¿ã‚’与ãˆã‚‹ã‚ˆã†ã§ã‚ã‚Œã°ã€
78 'CONFIG_LBD'オプションを有効ã«ã—ãŸå ´åˆã¨ç„¡åŠ¹ã«ã—ãŸå ´åˆã®ä¸¡æ–¹ã§
79 テストを実施ã—ã¦ã¿ã¦ãã ã•ã„。
80
8115: lockdepã®æ©Ÿèƒ½ã‚’å…¨ã¦æœ‰åŠ¹ã«ã—ãŸä¸Šã§ã€å…¨ã¦ã®ã‚³ãƒ¼ãƒ‰ãƒ‘スを評価ã—ã¦ãã ã•ã„。
82
8316: /proc ã«æ–°ã—ã„エントリを追加ã—ãŸå ´åˆã«ã¯ã€Documentation/ é…下ã«
84 å¿…ãšãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’追加ã—ã¦ãã ã•ã„。
85
8617: æ–°ã—ã„ブートパラメータを追加ã—ãŸå ´åˆã«ã¯ã€
87 å¿…ãšDocumentation/kernel-parameters.txt ã«èª¬æ˜Žã‚’追加ã—ã¦ãã ã•ã„。
88
8918: æ–°ã—ãmoduleã«ãƒ‘ラメータを追加ã—ãŸå ´åˆã«ã¯ã€MODULE_PARM_DESC()ã‚’
90 利用ã—ã¦å¿…ãšãã®èª¬æ˜Žã‚’記述ã—ã¦ãã ã•ã„。
91
9219: æ–°ã—ã„userspaceインタフェースを作æˆã—ãŸå ´åˆã«ã¯ã€Documentation/ABI/ ã«
93 Documentation/ABI/README ã‚’å‚考ã«ã—ã¦å¿…ãšãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’追加ã—ã¦ãã ã•ã„。
94
9520: 'make headers_check'を実行ã—ã¦å…¨ãå•é¡ŒãŒãªã„ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。
96
9721: å°‘ãªãã¨ã‚‚slabアロケーションã¨pageアロケーションã«å¤±æ•—ã—ãŸå ´åˆã®
98 挙動ã«ã¤ã„ã¦ã€fault-injectionを利用ã—ã¦ç¢ºèªã—ã¦ãã ã•ã„。
99 Documentation/fault-injection/ ã‚’å‚ç…§ã—ã¦ãã ã•ã„。
100
101 追加ã—ãŸã‚³ãƒ¼ãƒ‰ãŒã‹ãªã‚Šã®é‡ã§ã‚ã£ãŸãªã‚‰ã°ã€ã‚µãƒ–システム特有ã®
102 fault-injectionを追加ã—ãŸã»ã†ãŒè‰¯ã„ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“。
103
10422: æ–°ãŸã«è¿½åŠ ã—ãŸã‚³ãƒ¼ãƒ‰ã¯ã€`gcc -W'ã§ã‚³ãƒ³ãƒ‘イルã—ã¦ãã ã•ã„。
105 ã“ã®ã‚ªãƒ—ションã¯å¤§é‡ã®ä¸è¦ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’出力ã—ã¾ã™ãŒã€
106 "warning: comparison between signed and unsigned" ã®ã‚ˆã†ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¯ã€
107 ãƒã‚°ã‚’見ã¤ã‘ã‚‹ã®ã«å½¹ã«ç«‹ã¡ã¾ã™ã€‚
108
10923: 投稿ã—ãŸãƒ‘ッãƒãŒ -mm パッãƒã‚»ãƒƒãƒˆã«ãƒžãƒ¼ã‚¸ã•ã‚ŒãŸå¾Œã€å…¨ã¦ã®æ—¢å­˜ã®ãƒ‘ッãƒã‚„
110 VM, VFS ãŠã‚ˆã³ãã®ä»–ã®ã‚µãƒ–システムã«é–¢ã™ã‚‹æ§˜ã€…ãªå¤‰æ›´ã¨ã€ç¾æ™‚点ã§ã‚‚共存
111 ã§ãã‚‹ã“ã¨ã‚’確èªã™ã‚‹ãƒ†ã‚¹ãƒˆã‚’è¡Œã£ã¦ãã ã•ã„。
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e7bea3e8530..1150444a21a 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -365,6 +365,8 @@ and is between 256 and 4096 characters. It is defined in the file
365 no delay (0). 365 no delay (0).
366 Format: integer 366 Format: integer
367 367
368 bootmem_debug [KNL] Enable bootmem allocator debug messages.
369
368 bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) 370 bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards)
369 bttv.radio= Most important insmod options are available as 371 bttv.radio= Most important insmod options are available as
370 kernel args too. 372 kernel args too.
@@ -1072,6 +1074,9 @@ and is between 256 and 4096 characters. It is defined in the file
1072 1074
1073 * [no]ncq: Turn on or off NCQ. 1075 * [no]ncq: Turn on or off NCQ.
1074 1076
1077 * nohrst, nosrst, norst: suppress hard, soft
1078 and both resets.
1079
1075 If there are multiple matching configurations changing 1080 If there are multiple matching configurations changing
1076 the same attribute, the last one is used. 1081 the same attribute, the last one is used.
1077 1082
diff --git a/Makefile b/Makefile
index 53bf6ec1af9..2e15e0b4483 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 27 3SUBLEVEL = 27
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0a7b3267c8d..3c8383dbe9e 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -405,7 +405,7 @@ static int impd1_probe(struct lm_device *dev)
405 405
406 ret = amba_device_register(d, &dev->resource); 406 ret = amba_device_register(d, &dev->resource);
407 if (ret) { 407 if (ret) {
408 dev_err(&d->dev, "unable to register device: %d\n"); 408 dev_err(&d->dev, "unable to register device: %d\n", ret);
409 kfree(d); 409 kfree(d);
410 } 410 }
411 } 411 }
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 0db3a909ae6..501dfdcc39f 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -64,7 +64,7 @@ static struct platform_device fsg_i2c_gpio = {
64 64
65static struct i2c_board_info __initdata fsg_i2c_board_info [] = { 65static struct i2c_board_info __initdata fsg_i2c_board_info [] = {
66 { 66 {
67 I2C_BOARD_INFO("rtc-isl1208", 0x6f), 67 I2C_BOARD_INFO("isl1208", 0x6f),
68 }, 68 },
69}; 69};
70 70
@@ -179,7 +179,6 @@ static void __init fsg_init(void)
179{ 179{
180 DECLARE_MAC_BUF(mac_buf); 180 DECLARE_MAC_BUF(mac_buf);
181 uint8_t __iomem *f; 181 uint8_t __iomem *f;
182 int i;
183 182
184 ixp4xx_sys_init(); 183 ixp4xx_sys_init();
185 184
@@ -228,6 +227,7 @@ static void __init fsg_init(void)
228 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000); 227 f = ioremap(IXP4XX_EXP_BUS_BASE(0), 0x400000);
229 if (f) { 228 if (f) {
230#ifdef __ARMEB__ 229#ifdef __ARMEB__
230 int i;
231 for (i = 0; i < 6; i++) { 231 for (i = 0; i < 6; i++) {
232 fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i); 232 fsg_plat_eth[0].hwaddr[i] = readb(f + 0x3C0422 + i);
233 fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i); 233 fsg_plat_eth[1].hwaddr[i] = readb(f + 0x3C043B + i);
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c
index c01eea88f78..ca8e2053815 100644
--- a/arch/arm/mach-pxa/clock.c
+++ b/arch/arm/mach-pxa/clock.c
@@ -125,3 +125,28 @@ void clks_register(struct clk *clks, size_t num)
125 list_add(&clks[i].node, &clocks); 125 list_add(&clks[i].node, &clocks);
126 mutex_unlock(&clocks_mutex); 126 mutex_unlock(&clocks_mutex);
127} 127}
128
129int clk_add_alias(char *alias, struct device *alias_dev, char *id,
130 struct device *dev)
131{
132 struct clk *r = clk_lookup(dev, id);
133 struct clk *new;
134
135 if (!r)
136 return -ENODEV;
137
138 new = kzalloc(sizeof(struct clk), GFP_KERNEL);
139
140 if (!new)
141 return -ENOMEM;
142
143 new->name = alias;
144 new->dev = alias_dev;
145 new->other = r;
146
147 mutex_lock(&clocks_mutex);
148 list_add(&new->node, &clocks);
149 mutex_unlock(&clocks_mutex);
150
151 return 0;
152}
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h
index 1ec8f9178aa..73be795fe3b 100644
--- a/arch/arm/mach-pxa/clock.h
+++ b/arch/arm/mach-pxa/clock.h
@@ -1,3 +1,5 @@
1#include <linux/list.h>
2
1struct clk; 3struct clk;
2 4
3struct clkops { 5struct clkops {
@@ -86,3 +88,6 @@ extern void clk_pxa3xx_cken_disable(struct clk *);
86#endif 88#endif
87 89
88void clks_register(struct clk *clks, size_t num); 90void clks_register(struct clk *clks, size_t num);
91int clk_add_alias(char *alias, struct device *alias_dev, char *id,
92 struct device *dev);
93
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 03942450885..001a252bd51 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -10,18 +10,78 @@
10 * 10 *
11 */ 11 */
12 12
13#include <linux/kernel.h>
13#include <linux/init.h> 14#include <linux/init.h>
14 15
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
17#include <mach/hardware.h>
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19 19
20#include <mach/mfp-pxa25x.h>
21#include <mach/hardware.h>
22
20#include "generic.h" 23#include "generic.h"
21 24
25static unsigned long e740_pin_config[] __initdata = {
26 /* Chip selects */
27 GPIO15_nCS_1, /* CS1 - Flash */
28 GPIO79_nCS_3, /* CS3 - IMAGEON */
29 GPIO80_nCS_4, /* CS4 - TMIO */
30
31 /* Clocks */
32 GPIO12_32KHz,
33
34 /* BTUART */
35 GPIO42_BTUART_RXD,
36 GPIO43_BTUART_TXD,
37 GPIO44_BTUART_CTS,
38 GPIO45_GPIO, /* Used by TMIO for #SUSPEND */
39
40 /* PC Card */
41 GPIO8_GPIO, /* CD0 */
42 GPIO44_GPIO, /* CD1 */
43 GPIO11_GPIO, /* IRQ0 */
44 GPIO6_GPIO, /* IRQ1 */
45 GPIO27_GPIO, /* RST0 */
46 GPIO24_GPIO, /* RST1 */
47 GPIO20_GPIO, /* PWR0 */
48 GPIO23_GPIO, /* PWR1 */
49 GPIO48_nPOE,
50 GPIO49_nPWE,
51 GPIO50_nPIOR,
52 GPIO51_nPIOW,
53 GPIO52_nPCE_1,
54 GPIO53_nPCE_2,
55 GPIO54_nPSKTSEL,
56 GPIO55_nPREG,
57 GPIO56_nPWAIT,
58 GPIO57_nIOIS16,
59
60 /* wakeup */
61 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
62};
63
64static unsigned long e400_pin_config[] __initdata = {
65 /* Chip selects */
66 GPIO15_nCS_1, /* CS1 - Flash */
67 GPIO80_nCS_4, /* CS4 - TMIO */
68
69 /* Clocks */
70 GPIO12_32KHz,
71
72 /* BTUART */
73 GPIO42_BTUART_RXD,
74 GPIO43_BTUART_TXD,
75 GPIO44_BTUART_CTS,
76 GPIO45_GPIO, /* Used by TMIO for #SUSPEND */
77
78 /* wakeup */
79 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
80};
81
22/* Only e800 has 128MB RAM */ 82/* Only e800 has 128MB RAM */
23static void __init eseries_fixup(struct machine_desc *desc, 83static void __init eseries_fixup(struct machine_desc *desc,
24 struct tag *tags, char **cmdline, struct meminfo *mi) 84 struct tag *tags, char **cmdline, struct meminfo *mi)
25{ 85{
26 mi->nr_banks=1; 86 mi->nr_banks=1;
27 mi->bank[0].start = 0xa0000000; 87 mi->bank[0].start = 0xa0000000;
@@ -32,83 +92,95 @@ static void __init eseries_fixup(struct machine_desc *desc,
32 mi->bank[0].size = (64*1024*1024); 92 mi->bank[0].size = (64*1024*1024);
33} 93}
34 94
95static void __init e740_init(void)
96{
97 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
98}
99
100static void __init e400_init(void)
101{
102 pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
103}
104
35/* e-series machine definitions */ 105/* e-series machine definitions */
36 106
37#ifdef CONFIG_MACH_E330 107#ifdef CONFIG_MACH_E330
38MACHINE_START(E330, "Toshiba e330") 108MACHINE_START(E330, "Toshiba e330")
39 /* Maintainer: Ian Molton (spyro@f2s.com) */ 109 /* Maintainer: Ian Molton (spyro@f2s.com) */
40 .phys_io = 0x40000000, 110 .phys_io = 0x40000000,
41 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 111 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
42 .boot_params = 0xa0000100, 112 .boot_params = 0xa0000100,
43 .map_io = pxa_map_io, 113 .map_io = pxa_map_io,
44 .init_irq = pxa25x_init_irq, 114 .init_irq = pxa25x_init_irq,
45 .fixup = eseries_fixup, 115 .fixup = eseries_fixup,
46 .timer = &pxa_timer, 116 .timer = &pxa_timer,
47MACHINE_END 117MACHINE_END
48#endif 118#endif
49 119
50#ifdef CONFIG_MACH_E350 120#ifdef CONFIG_MACH_E350
51MACHINE_START(E350, "Toshiba e350") 121MACHINE_START(E350, "Toshiba e350")
52 /* Maintainer: Ian Molton (spyro@f2s.com) */ 122 /* Maintainer: Ian Molton (spyro@f2s.com) */
53 .phys_io = 0x40000000, 123 .phys_io = 0x40000000,
54 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 124 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
55 .boot_params = 0xa0000100, 125 .boot_params = 0xa0000100,
56 .map_io = pxa_map_io, 126 .map_io = pxa_map_io,
57 .init_irq = pxa25x_init_irq, 127 .init_irq = pxa25x_init_irq,
58 .fixup = eseries_fixup, 128 .fixup = eseries_fixup,
59 .timer = &pxa_timer, 129 .timer = &pxa_timer,
60MACHINE_END 130MACHINE_END
61#endif 131#endif
62 132
63#ifdef CONFIG_MACH_E740 133#ifdef CONFIG_MACH_E740
64MACHINE_START(E740, "Toshiba e740") 134MACHINE_START(E740, "Toshiba e740")
65 /* Maintainer: Ian Molton (spyro@f2s.com) */ 135 /* Maintainer: Ian Molton (spyro@f2s.com) */
66 .phys_io = 0x40000000, 136 .phys_io = 0x40000000,
67 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 137 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
68 .boot_params = 0xa0000100, 138 .boot_params = 0xa0000100,
69 .map_io = pxa_map_io, 139 .map_io = pxa_map_io,
70 .init_irq = pxa25x_init_irq, 140 .init_irq = pxa25x_init_irq,
71 .fixup = eseries_fixup, 141 .fixup = eseries_fixup,
72 .timer = &pxa_timer, 142 .init_machine = e740_init,
143 .timer = &pxa_timer,
73MACHINE_END 144MACHINE_END
74#endif 145#endif
75 146
76#ifdef CONFIG_MACH_E750 147#ifdef CONFIG_MACH_E750
77MACHINE_START(E750, "Toshiba e750") 148MACHINE_START(E750, "Toshiba e750")
78 /* Maintainer: Ian Molton (spyro@f2s.com) */ 149 /* Maintainer: Ian Molton (spyro@f2s.com) */
79 .phys_io = 0x40000000, 150 .phys_io = 0x40000000,
80 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 151 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
81 .boot_params = 0xa0000100, 152 .boot_params = 0xa0000100,
82 .map_io = pxa_map_io, 153 .map_io = pxa_map_io,
83 .init_irq = pxa25x_init_irq, 154 .init_irq = pxa25x_init_irq,
84 .fixup = eseries_fixup, 155 .fixup = eseries_fixup,
85 .timer = &pxa_timer, 156 .timer = &pxa_timer,
86MACHINE_END 157MACHINE_END
87#endif 158#endif
88 159
89#ifdef CONFIG_MACH_E400 160#ifdef CONFIG_MACH_E400
90MACHINE_START(E400, "Toshiba e400") 161MACHINE_START(E400, "Toshiba e400")
91 /* Maintainer: Ian Molton (spyro@f2s.com) */ 162 /* Maintainer: Ian Molton (spyro@f2s.com) */
92 .phys_io = 0x40000000, 163 .phys_io = 0x40000000,
93 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 164 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
94 .boot_params = 0xa0000100, 165 .boot_params = 0xa0000100,
95 .map_io = pxa_map_io, 166 .map_io = pxa_map_io,
96 .init_irq = pxa25x_init_irq, 167 .init_irq = pxa25x_init_irq,
97 .fixup = eseries_fixup, 168 .fixup = eseries_fixup,
98 .timer = &pxa_timer, 169 .init_machine = e400_init,
170 .timer = &pxa_timer,
99MACHINE_END 171MACHINE_END
100#endif 172#endif
101 173
102#ifdef CONFIG_MACH_E800 174#ifdef CONFIG_MACH_E800
103MACHINE_START(E800, "Toshiba e800") 175MACHINE_START(E800, "Toshiba e800")
104 /* Maintainer: Ian Molton (spyro@f2s.com) */ 176 /* Maintainer: Ian Molton (spyro@f2s.com) */
105 .phys_io = 0x40000000, 177 .phys_io = 0x40000000,
106 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 178 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
107 .boot_params = 0xa0000100, 179 .boot_params = 0xa0000100,
108 .map_io = pxa_map_io, 180 .map_io = pxa_map_io,
109 .init_irq = pxa25x_init_irq, 181 .init_irq = pxa25x_init_irq,
110 .fixup = eseries_fixup, 182 .fixup = eseries_fixup,
111 .timer = &pxa_timer, 183 .timer = &pxa_timer,
112MACHINE_END 184MACHINE_END
113#endif 185#endif
114 186
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 32772bc6925..108b5db9b2a 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -183,6 +183,7 @@
183 defined(CONFIG_MACH_TOSA) || \ 183 defined(CONFIG_MACH_TOSA) || \
184 defined(CONFIG_MACH_MAINSTONE) || \ 184 defined(CONFIG_MACH_MAINSTONE) || \
185 defined(CONFIG_MACH_PCM027) || \ 185 defined(CONFIG_MACH_PCM027) || \
186 defined(CONFIG_ARCH_PXA_ESERIES) || \
186 defined(CONFIG_MACH_MAGICIAN) 187 defined(CONFIG_MACH_MAGICIAN)
187#define NR_IRQS (IRQ_BOARD_END) 188#define NR_IRQS (IRQ_BOARD_END)
188#elif defined(CONFIG_MACH_ZYLONITE) 189#elif defined(CONFIG_MACH_ZYLONITE)
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index bb9e09208b9..4ffdff2d9ff 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -52,6 +52,7 @@
52#include <mach/mmc.h> 52#include <mach/mmc.h>
53 53
54#include "generic.h" 54#include "generic.h"
55#include "clock.h"
55#include "devices.h" 56#include "devices.h"
56 57
57static unsigned long lubbock_pin_config[] __initdata = { 58static unsigned long lubbock_pin_config[] __initdata = {
@@ -485,6 +486,7 @@ static void __init lubbock_init(void)
485 486
486 pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config)); 487 pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));
487 488
489 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
488 pxa_set_udc_info(&udc_info); 490 pxa_set_udc_info(&udc_info);
489 set_pxa_fb_info(&sharp_lm8v31); 491 set_pxa_fb_info(&sharp_lm8v31);
490 pxa_set_mci_info(&lubbock_mci_platform_data); 492 pxa_set_mci_info(&lubbock_mci_platform_data);
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 9e5d8a8c642..305452b56e9 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -166,8 +166,7 @@ static struct clk pxa25x_hwuart_clk =
166; 166;
167 167
168/* 168/*
169 * PXA 2xx clock declarations. Order is important (see aliases below) 169 * PXA 2xx clock declarations.
170 * Please be careful not to disrupt the ordering.
171 */ 170 */
172static struct clk pxa25x_clks[] = { 171static struct clk pxa25x_clks[] = {
173 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 172 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
@@ -194,11 +193,6 @@ static struct clk pxa25x_clks[] = {
194 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL), 193 INIT_CKEN("FICPCLK", FICP, 47923000, 0, NULL),
195}; 194};
196 195
197static struct clk pxa2xx_clk_aliases[] = {
198 INIT_CKOTHER("GPIO7_CLK", &pxa25x_clks[4], NULL),
199 INIT_CKOTHER("SA1111_CLK", &pxa25x_clks[5], NULL),
200};
201
202#ifdef CONFIG_PM 196#ifdef CONFIG_PM
203 197
204#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 198#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
@@ -375,8 +369,6 @@ static int __init pxa25x_init(void)
375 if (cpu_is_pxa255()) 369 if (cpu_is_pxa255())
376 ret = platform_device_register(&pxa_device_hwuart); 370 ret = platform_device_register(&pxa_device_hwuart);
377 371
378 clks_register(pxa2xx_clk_aliases, ARRAY_SIZE(pxa2xx_clk_aliases));
379
380 return ret; 372 return ret;
381} 373}
382 374
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 494fc1f032d..9adc7fc4618 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -90,7 +90,9 @@ static struct clk common_clks[] = {
90}; 90};
91 91
92static struct clk pxa310_clks[] = { 92static struct clk pxa310_clks[] = {
93#ifdef CONFIG_CPU_PXA310
93 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev), 94 PXA3xx_CKEN("MMCCLK", MMC3, 19500000, 0, &pxa3xx_device_mci3.dev),
95#endif
94}; 96};
95 97
96static int __init pxa300_init(void) 98static int __init pxa300_init(void)
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index c5cdb975d59..9b0bc2c9fba 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc4
4# Fri May 30 09:49:33 2008 4# Thu Aug 21 19:43:29 2008
5# 5#
6CONFIG_SCHED_MC=y 6CONFIG_SCHED_MC=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -68,7 +68,6 @@ CONFIG_INITRAMFS_SOURCE=""
68CONFIG_SYSCTL=y 68CONFIG_SYSCTL=y
69# CONFIG_EMBEDDED is not set 69# CONFIG_EMBEDDED is not set
70CONFIG_SYSCTL_SYSCALL=y 70CONFIG_SYSCTL_SYSCALL=y
71CONFIG_SYSCTL_SYSCALL_CHECK=y
72CONFIG_KALLSYMS=y 71CONFIG_KALLSYMS=y
73# CONFIG_KALLSYMS_ALL is not set 72# CONFIG_KALLSYMS_ALL is not set
74# CONFIG_KALLSYMS_EXTRA_PASS is not set 73# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -93,11 +92,17 @@ CONFIG_SLAB=y
93# CONFIG_MARKERS is not set 92# CONFIG_MARKERS is not set
94CONFIG_HAVE_OPROFILE=y 93CONFIG_HAVE_OPROFILE=y
95CONFIG_KPROBES=y 94CONFIG_KPROBES=y
95# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
96CONFIG_KRETPROBES=y 96CONFIG_KRETPROBES=y
97# CONFIG_HAVE_IOREMAP_PROT is not set
97CONFIG_HAVE_KPROBES=y 98CONFIG_HAVE_KPROBES=y
98CONFIG_HAVE_KRETPROBES=y 99CONFIG_HAVE_KRETPROBES=y
100# CONFIG_HAVE_ARCH_TRACEHOOK is not set
99# CONFIG_HAVE_DMA_ATTRS is not set 101# CONFIG_HAVE_DMA_ATTRS is not set
102# CONFIG_USE_GENERIC_SMP_HELPERS is not set
103# CONFIG_HAVE_CLK is not set
100CONFIG_PROC_PAGE_MONITOR=y 104CONFIG_PROC_PAGE_MONITOR=y
105# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
101CONFIG_SLABINFO=y 106CONFIG_SLABINFO=y
102CONFIG_RT_MUTEXES=y 107CONFIG_RT_MUTEXES=y
103# CONFIG_TINY_SHMEM is not set 108# CONFIG_TINY_SHMEM is not set
@@ -113,6 +118,7 @@ CONFIG_STOP_MACHINE=y
113CONFIG_BLOCK=y 118CONFIG_BLOCK=y
114# CONFIG_BLK_DEV_IO_TRACE is not set 119# CONFIG_BLK_DEV_IO_TRACE is not set
115CONFIG_BLK_DEV_BSG=y 120CONFIG_BLK_DEV_BSG=y
121# CONFIG_BLK_DEV_INTEGRITY is not set
116CONFIG_BLOCK_COMPAT=y 122CONFIG_BLOCK_COMPAT=y
117 123
118# 124#
@@ -175,6 +181,8 @@ CONFIG_PREEMPT=y
175CONFIG_ARCH_SPARSEMEM_ENABLE=y 181CONFIG_ARCH_SPARSEMEM_ENABLE=y
176CONFIG_ARCH_SPARSEMEM_DEFAULT=y 182CONFIG_ARCH_SPARSEMEM_DEFAULT=y
177CONFIG_ARCH_SELECT_MEMORY_MODEL=y 183CONFIG_ARCH_SELECT_MEMORY_MODEL=y
184CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
185CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
178CONFIG_SELECT_MEMORY_MODEL=y 186CONFIG_SELECT_MEMORY_MODEL=y
179# CONFIG_FLATMEM_MANUAL is not set 187# CONFIG_FLATMEM_MANUAL is not set
180# CONFIG_DISCONTIGMEM_MANUAL is not set 188# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -185,8 +193,12 @@ CONFIG_HAVE_MEMORY_PRESENT=y
185CONFIG_SPARSEMEM_EXTREME=y 193CONFIG_SPARSEMEM_EXTREME=y
186CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y 194CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
187CONFIG_SPARSEMEM_VMEMMAP=y 195CONFIG_SPARSEMEM_VMEMMAP=y
196CONFIG_MEMORY_HOTPLUG=y
197CONFIG_MEMORY_HOTPLUG_SPARSE=y
198CONFIG_MEMORY_HOTREMOVE=y
188CONFIG_PAGEFLAGS_EXTENDED=y 199CONFIG_PAGEFLAGS_EXTENDED=y
189CONFIG_SPLIT_PTLOCK_CPUS=4 200CONFIG_SPLIT_PTLOCK_CPUS=4
201CONFIG_MIGRATION=y
190CONFIG_RESOURCES_64BIT=y 202CONFIG_RESOURCES_64BIT=y
191CONFIG_ZONE_DMA_FLAG=1 203CONFIG_ZONE_DMA_FLAG=1
192CONFIG_BOUNCE=y 204CONFIG_BOUNCE=y
@@ -198,6 +210,7 @@ CONFIG_VIRT_TO_BUS=y
198CONFIG_MACHCHK_WARNING=y 210CONFIG_MACHCHK_WARNING=y
199CONFIG_QDIO=y 211CONFIG_QDIO=y
200# CONFIG_QDIO_DEBUG is not set 212# CONFIG_QDIO_DEBUG is not set
213CONFIG_CHSC_SCH=m
201 214
202# 215#
203# Misc 216# Misc
@@ -206,6 +219,7 @@ CONFIG_IPL=y
206# CONFIG_IPL_TAPE is not set 219# CONFIG_IPL_TAPE is not set
207CONFIG_IPL_VM=y 220CONFIG_IPL_VM=y
208CONFIG_BINFMT_ELF=y 221CONFIG_BINFMT_ELF=y
222CONFIG_COMPAT_BINFMT_ELF=y
209CONFIG_BINFMT_MISC=m 223CONFIG_BINFMT_MISC=m
210CONFIG_FORCE_MAX_ZONEORDER=9 224CONFIG_FORCE_MAX_ZONEORDER=9
211# CONFIG_PROCESS_DEBUG is not set 225# CONFIG_PROCESS_DEBUG is not set
@@ -226,10 +240,6 @@ CONFIG_S390_HYPFS_FS=y
226CONFIG_KEXEC=y 240CONFIG_KEXEC=y
227# CONFIG_ZFCPDUMP is not set 241# CONFIG_ZFCPDUMP is not set
228CONFIG_S390_GUEST=y 242CONFIG_S390_GUEST=y
229
230#
231# Networking
232#
233CONFIG_NET=y 243CONFIG_NET=y
234 244
235# 245#
@@ -364,7 +374,6 @@ CONFIG_NET_SCH_CBQ=m
364# CONFIG_NET_SCH_HTB is not set 374# CONFIG_NET_SCH_HTB is not set
365# CONFIG_NET_SCH_HFSC is not set 375# CONFIG_NET_SCH_HFSC is not set
366CONFIG_NET_SCH_PRIO=m 376CONFIG_NET_SCH_PRIO=m
367CONFIG_NET_SCH_RR=m
368CONFIG_NET_SCH_RED=m 377CONFIG_NET_SCH_RED=m
369CONFIG_NET_SCH_SFQ=m 378CONFIG_NET_SCH_SFQ=m
370CONFIG_NET_SCH_TEQL=m 379CONFIG_NET_SCH_TEQL=m
@@ -430,7 +439,9 @@ CONFIG_CCW=y
430CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 439CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
431CONFIG_STANDALONE=y 440CONFIG_STANDALONE=y
432CONFIG_PREVENT_FIRMWARE_BUILD=y 441CONFIG_PREVENT_FIRMWARE_BUILD=y
433# CONFIG_FW_LOADER is not set 442CONFIG_FW_LOADER=y
443# CONFIG_FIRMWARE_IN_KERNEL is not set
444CONFIG_EXTRA_FIRMWARE=""
434# CONFIG_DEBUG_DRIVER is not set 445# CONFIG_DEBUG_DRIVER is not set
435# CONFIG_DEBUG_DEVRES is not set 446# CONFIG_DEBUG_DEVRES is not set
436CONFIG_SYS_HYPERVISOR=y 447CONFIG_SYS_HYPERVISOR=y
@@ -507,6 +518,11 @@ CONFIG_SCSI_LOWLEVEL=y
507# CONFIG_ISCSI_TCP is not set 518# CONFIG_ISCSI_TCP is not set
508# CONFIG_SCSI_DEBUG is not set 519# CONFIG_SCSI_DEBUG is not set
509CONFIG_ZFCP=y 520CONFIG_ZFCP=y
521CONFIG_SCSI_DH=m
522CONFIG_SCSI_DH_RDAC=m
523CONFIG_SCSI_DH_HP_SW=m
524CONFIG_SCSI_DH_EMC=m
525CONFIG_SCSI_DH_ALUA=m
510CONFIG_MD=y 526CONFIG_MD=y
511CONFIG_BLK_DEV_MD=y 527CONFIG_BLK_DEV_MD=y
512CONFIG_MD_LINEAR=m 528CONFIG_MD_LINEAR=m
@@ -522,14 +538,10 @@ CONFIG_DM_CRYPT=y
522CONFIG_DM_SNAPSHOT=y 538CONFIG_DM_SNAPSHOT=y
523CONFIG_DM_MIRROR=y 539CONFIG_DM_MIRROR=y
524CONFIG_DM_ZERO=y 540CONFIG_DM_ZERO=y
525CONFIG_DM_MULTIPATH=y 541CONFIG_DM_MULTIPATH=m
526# CONFIG_DM_MULTIPATH_EMC is not set
527# CONFIG_DM_MULTIPATH_RDAC is not set
528# CONFIG_DM_MULTIPATH_HP is not set
529# CONFIG_DM_DELAY is not set 542# CONFIG_DM_DELAY is not set
530# CONFIG_DM_UEVENT is not set 543# CONFIG_DM_UEVENT is not set
531CONFIG_NETDEVICES=y 544CONFIG_NETDEVICES=y
532# CONFIG_NETDEVICES_MULTIQUEUE is not set
533# CONFIG_IFB is not set 545# CONFIG_IFB is not set
534CONFIG_DUMMY=m 546CONFIG_DUMMY=m
535CONFIG_BONDING=m 547CONFIG_BONDING=m
@@ -544,7 +556,6 @@ CONFIG_NET_ETHERNET=y
544# CONFIG_IBM_NEW_EMAC_TAH is not set 556# CONFIG_IBM_NEW_EMAC_TAH is not set
545# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 557# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
546CONFIG_NETDEV_1000=y 558CONFIG_NETDEV_1000=y
547# CONFIG_E1000E_ENABLED is not set
548CONFIG_NETDEV_10000=y 559CONFIG_NETDEV_10000=y
549# CONFIG_TR is not set 560# CONFIG_TR is not set
550# CONFIG_WAN is not set 561# CONFIG_WAN is not set
@@ -576,7 +587,10 @@ CONFIG_DEVKMEM=y
576CONFIG_UNIX98_PTYS=y 587CONFIG_UNIX98_PTYS=y
577CONFIG_LEGACY_PTYS=y 588CONFIG_LEGACY_PTYS=y
578CONFIG_LEGACY_PTY_COUNT=256 589CONFIG_LEGACY_PTY_COUNT=256
590CONFIG_HVC_DRIVER=y
591CONFIG_VIRTIO_CONSOLE=y
579CONFIG_HW_RANDOM=m 592CONFIG_HW_RANDOM=m
593CONFIG_HW_RANDOM_VIRTIO=m
580# CONFIG_R3964 is not set 594# CONFIG_R3964 is not set
581CONFIG_RAW_DRIVER=m 595CONFIG_RAW_DRIVER=m
582CONFIG_MAX_RAW_DEVS=256 596CONFIG_MAX_RAW_DEVS=256
@@ -616,6 +630,7 @@ CONFIG_MONWRITER=m
616CONFIG_S390_VMUR=m 630CONFIG_S390_VMUR=m
617# CONFIG_POWER_SUPPLY is not set 631# CONFIG_POWER_SUPPLY is not set
618# CONFIG_THERMAL is not set 632# CONFIG_THERMAL is not set
633# CONFIG_THERMAL_HWMON is not set
619# CONFIG_WATCHDOG is not set 634# CONFIG_WATCHDOG is not set
620 635
621# 636#
@@ -693,6 +708,7 @@ CONFIG_CONFIGFS_FS=m
693# CONFIG_CRAMFS is not set 708# CONFIG_CRAMFS is not set
694# CONFIG_VXFS_FS is not set 709# CONFIG_VXFS_FS is not set
695# CONFIG_MINIX_FS is not set 710# CONFIG_MINIX_FS is not set
711# CONFIG_OMFS_FS is not set
696# CONFIG_HPFS_FS is not set 712# CONFIG_HPFS_FS is not set
697# CONFIG_QNX4FS_FS is not set 713# CONFIG_QNX4FS_FS is not set
698# CONFIG_ROMFS_FS is not set 714# CONFIG_ROMFS_FS is not set
@@ -712,7 +728,6 @@ CONFIG_LOCKD_V4=y
712CONFIG_EXPORTFS=y 728CONFIG_EXPORTFS=y
713CONFIG_NFS_COMMON=y 729CONFIG_NFS_COMMON=y
714CONFIG_SUNRPC=y 730CONFIG_SUNRPC=y
715# CONFIG_SUNRPC_BIND34 is not set
716# CONFIG_RPCSEC_GSS_KRB5 is not set 731# CONFIG_RPCSEC_GSS_KRB5 is not set
717# CONFIG_RPCSEC_GSS_SPKM3 is not set 732# CONFIG_RPCSEC_GSS_SPKM3 is not set
718# CONFIG_SMB_FS is not set 733# CONFIG_SMB_FS is not set
@@ -780,6 +795,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
780# CONFIG_DEBUG_INFO is not set 795# CONFIG_DEBUG_INFO is not set
781# CONFIG_DEBUG_VM is not set 796# CONFIG_DEBUG_VM is not set
782# CONFIG_DEBUG_WRITECOUNT is not set 797# CONFIG_DEBUG_WRITECOUNT is not set
798CONFIG_DEBUG_MEMORY_INIT=y
783# CONFIG_DEBUG_LIST is not set 799# CONFIG_DEBUG_LIST is not set
784# CONFIG_DEBUG_SG is not set 800# CONFIG_DEBUG_SG is not set
785# CONFIG_FRAME_POINTER is not set 801# CONFIG_FRAME_POINTER is not set
@@ -789,6 +805,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
789# CONFIG_LKDTM is not set 805# CONFIG_LKDTM is not set
790# CONFIG_FAULT_INJECTION is not set 806# CONFIG_FAULT_INJECTION is not set
791# CONFIG_LATENCYTOP is not set 807# CONFIG_LATENCYTOP is not set
808CONFIG_SYSCTL_SYSCALL_CHECK=y
792CONFIG_SAMPLES=y 809CONFIG_SAMPLES=y
793# CONFIG_SAMPLE_KOBJECT is not set 810# CONFIG_SAMPLE_KOBJECT is not set
794# CONFIG_SAMPLE_KPROBES is not set 811# CONFIG_SAMPLE_KPROBES is not set
@@ -847,6 +864,10 @@ CONFIG_CRYPTO_HMAC=m
847# CONFIG_CRYPTO_MD4 is not set 864# CONFIG_CRYPTO_MD4 is not set
848CONFIG_CRYPTO_MD5=m 865CONFIG_CRYPTO_MD5=m
849# CONFIG_CRYPTO_MICHAEL_MIC is not set 866# CONFIG_CRYPTO_MICHAEL_MIC is not set
867CONFIG_CRYPTO_RMD128=m
868CONFIG_CRYPTO_RMD160=m
869CONFIG_CRYPTO_RMD256=m
870CONFIG_CRYPTO_RMD320=m
850CONFIG_CRYPTO_SHA1=m 871CONFIG_CRYPTO_SHA1=m
851# CONFIG_CRYPTO_SHA256 is not set 872# CONFIG_CRYPTO_SHA256 is not set
852# CONFIG_CRYPTO_SHA512 is not set 873# CONFIG_CRYPTO_SHA512 is not set
@@ -895,6 +916,7 @@ CONFIG_BITREVERSE=m
895# CONFIG_GENERIC_FIND_NEXT_BIT is not set 916# CONFIG_GENERIC_FIND_NEXT_BIT is not set
896# CONFIG_CRC_CCITT is not set 917# CONFIG_CRC_CCITT is not set
897# CONFIG_CRC16 is not set 918# CONFIG_CRC16 is not set
919CONFIG_CRC_T10DIF=y
898# CONFIG_CRC_ITU_T is not set 920# CONFIG_CRC_ITU_T is not set
899CONFIG_CRC32=m 921CONFIG_CRC32=m
900CONFIG_CRC7=m 922CONFIG_CRC7=m
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index b4eb24ab5af..8e9243ae0c1 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -709,7 +709,7 @@ static inline int find_next_zero_bit (const unsigned long * addr,
709 * __ffz_word returns __BITOPS_WORDSIZE 709 * __ffz_word returns __BITOPS_WORDSIZE
710 * if no zero bit is present in the word. 710 * if no zero bit is present in the word.
711 */ 711 */
712 set = __ffz_word(0, *p >> bit) + bit; 712 set = __ffz_word(bit, *p >> bit);
713 if (set >= size) 713 if (set >= size)
714 return size + offset; 714 return size + offset;
715 if (set < __BITOPS_WORDSIZE) 715 if (set < __BITOPS_WORDSIZE)
@@ -824,7 +824,7 @@ static inline int ext2_find_next_zero_bit(void *vaddr, unsigned long size,
824 * s390 version of ffz returns __BITOPS_WORDSIZE 824 * s390 version of ffz returns __BITOPS_WORDSIZE
825 * if no zero bit is present in the word. 825 * if no zero bit is present in the word.
826 */ 826 */
827 set = ffz(__load_ulong_le(p, 0) >> bit) + bit; 827 set = __ffz_word(bit, __load_ulong_le(p, 0) >> bit);
828 if (set >= size) 828 if (set >= size)
829 return size + offset; 829 return size + offset;
830 if (set < __BITOPS_WORDSIZE) 830 if (set < __BITOPS_WORDSIZE)
@@ -865,7 +865,7 @@ static inline int ext2_find_next_bit(void *vaddr, unsigned long size,
865 * s390 version of ffz returns __BITOPS_WORDSIZE 865 * s390 version of ffz returns __BITOPS_WORDSIZE
866 * if no zero bit is present in the word. 866 * if no zero bit is present in the word.
867 */ 867 */
868 set = ffs(__load_ulong_le(p, 0) >> bit) + bit; 868 set = __ffs_word(0, __load_ulong_le(p, 0) & (~0UL << bit));
869 if (set >= size) 869 if (set >= size)
870 return size + offset; 870 return size + offset;
871 if (set < __BITOPS_WORDSIZE) 871 if (set < __BITOPS_WORDSIZE)
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 9839767d084..3e2c05cb6a8 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -75,7 +75,9 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
75 return sf->gprs[8]; 75 return sf->gprs[8];
76} 76}
77 77
78DEFINE_PER_CPU(struct s390_idle_data, s390_idle); 78DEFINE_PER_CPU(struct s390_idle_data, s390_idle) = {
79 .lock = __SPIN_LOCK_UNLOCKED(s390_idle.lock)
80};
79 81
80static int s390_idle_enter(void) 82static int s390_idle_enter(void)
81{ 83{
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b795b3e24af..00b9b4dec5e 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -610,7 +610,6 @@ static void __init smp_create_idle(unsigned int cpu)
610 if (IS_ERR(p)) 610 if (IS_ERR(p))
611 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p)); 611 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
612 current_set[cpu] = p; 612 current_set[cpu] = p;
613 spin_lock_init(&(&per_cpu(s390_idle, cpu))->lock);
614} 613}
615 614
616static int __cpuinit smp_alloc_lowcore(int cpu) 615static int __cpuinit smp_alloc_lowcore(int cpu)
@@ -845,7 +844,6 @@ void __init smp_prepare_boot_cpu(void)
845 current_set[0] = current; 844 current_set[0] = current;
846 smp_cpu_state[0] = CPU_STATE_CONFIGURED; 845 smp_cpu_state[0] = CPU_STATE_CONFIGURED;
847 smp_cpu_polarization[0] = POLARIZATION_UNKNWN; 846 smp_cpu_polarization[0] = POLARIZATION_UNKNWN;
848 spin_lock_init(&(&__get_cpu_var(s390_idle))->lock);
849} 847}
850 848
851void __init smp_cpus_done(unsigned int max_cpus) 849void __init smp_cpus_done(unsigned int max_cpus)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index de39e1f2ede..69b4d060b21 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -65,7 +65,7 @@ static int __iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
65 u8 *target; 65 u8 *target;
66 66
67 tail = readl(iommu->mmio_base + MMIO_CMD_TAIL_OFFSET); 67 tail = readl(iommu->mmio_base + MMIO_CMD_TAIL_OFFSET);
68 target = (iommu->cmd_buf + tail); 68 target = iommu->cmd_buf + tail;
69 memcpy_toio(target, cmd, sizeof(*cmd)); 69 memcpy_toio(target, cmd, sizeof(*cmd));
70 tail = (tail + sizeof(*cmd)) % iommu->cmd_buf_size; 70 tail = (tail + sizeof(*cmd)) % iommu->cmd_buf_size;
71 head = readl(iommu->mmio_base + MMIO_CMD_HEAD_OFFSET); 71 head = readl(iommu->mmio_base + MMIO_CMD_HEAD_OFFSET);
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index 84a8220a607..a6ef672adbb 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -56,9 +56,22 @@ void __cpuinit validate_pat_support(struct cpuinfo_x86 *c)
56 56
57 switch (c->x86_vendor) { 57 switch (c->x86_vendor) {
58 case X86_VENDOR_INTEL: 58 case X86_VENDOR_INTEL:
59 if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15)) 59 /*
60 * There is a known erratum on Pentium III and Core Solo
61 * and Core Duo CPUs.
62 * " Page with PAT set to WC while associated MTRR is UC
63 * may consolidate to UC "
64 * Because of this erratum, it is better to stick with
65 * setting WC in MTRR rather than using PAT on these CPUs.
66 *
67 * Enable PAT WC only on P4, Core 2 or later CPUs.
68 */
69 if (c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 15))
60 return; 70 return;
61 break; 71
72 pat_disable("PAT WC disabled due to known CPU erratum.");
73 return;
74
62 case X86_VENDOR_AMD: 75 case X86_VENDOR_AMD:
63 case X86_VENDOR_CENTAUR: 76 case X86_VENDOR_CENTAUR:
64 case X86_VENDOR_TRANSMETA: 77 case X86_VENDOR_TRANSMETA:
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 3fd7a67bb06..e710a21bb6e 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -134,23 +134,6 @@ static void __cpuinit set_cx86_memwb(void)
134 setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14); 134 setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14);
135} 135}
136 136
137static void __cpuinit set_cx86_inc(void)
138{
139 unsigned char ccr3;
140
141 printk(KERN_INFO "Enable Incrementor on Cyrix/NSC processor.\n");
142
143 ccr3 = getCx86(CX86_CCR3);
144 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
145 /* PCR1 -- Performance Control */
146 /* Incrementor on, whatever that is */
147 setCx86(CX86_PCR1, getCx86(CX86_PCR1) | 0x02);
148 /* PCR0 -- Performance Control */
149 /* Incrementor Margin 10 */
150 setCx86(CX86_PCR0, getCx86(CX86_PCR0) | 0x04);
151 setCx86(CX86_CCR3, ccr3); /* disable MAPEN */
152}
153
154/* 137/*
155 * Configure later MediaGX and/or Geode processor. 138 * Configure later MediaGX and/or Geode processor.
156 */ 139 */
@@ -174,7 +157,6 @@ static void __cpuinit geode_configure(void)
174 157
175 set_cx86_memwb(); 158 set_cx86_memwb();
176 set_cx86_reorder(); 159 set_cx86_reorder();
177 set_cx86_inc();
178 160
179 local_irq_restore(flags); 161 local_irq_restore(flags);
180} 162}
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 509bd3d9eac..cb7d3b6a80e 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -379,6 +379,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
379 unsigned long *size, mtrr_type *type) 379 unsigned long *size, mtrr_type *type)
380{ 380{
381 unsigned int mask_lo, mask_hi, base_lo, base_hi; 381 unsigned int mask_lo, mask_hi, base_lo, base_hi;
382 unsigned int tmp, hi;
382 383
383 rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi); 384 rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);
384 if ((mask_lo & 0x800) == 0) { 385 if ((mask_lo & 0x800) == 0) {
@@ -392,8 +393,23 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
392 rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi); 393 rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi);
393 394
394 /* Work out the shifted address mask. */ 395 /* Work out the shifted address mask. */
395 mask_lo = size_or_mask | mask_hi << (32 - PAGE_SHIFT) 396 tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
396 | mask_lo >> PAGE_SHIFT; 397 mask_lo = size_or_mask | tmp;
398 /* Expand tmp with high bits to all 1s*/
399 hi = fls(tmp);
400 if (hi > 0) {
401 tmp |= ~((1<<(hi - 1)) - 1);
402
403 if (tmp != mask_lo) {
404 static int once = 1;
405
406 if (once) {
407 printk(KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
408 once = 0;
409 }
410 mask_lo = tmp;
411 }
412 }
397 413
398 /* This works correctly if size is a power of two, i.e. a 414 /* This works correctly if size is a power of two, i.e. a
399 contiguous range. */ 415 contiguous range. */
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 6f23969c8fa..b117d7f8a56 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -1496,11 +1496,8 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
1496 1496
1497 /* kvm/qemu doesn't have mtrr set right, don't trim them all */ 1497 /* kvm/qemu doesn't have mtrr set right, don't trim them all */
1498 if (!highest_pfn) { 1498 if (!highest_pfn) {
1499 if (!kvm_para_available()) { 1499 WARN(!kvm_para_available(), KERN_WARNING
1500 printk(KERN_WARNING
1501 "WARNING: strange, CPU MTRRs all blank?\n"); 1500 "WARNING: strange, CPU MTRRs all blank?\n");
1502 WARN_ON(1);
1503 }
1504 return 0; 1501 return 0;
1505 } 1502 }
1506 1503
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 2d7e307c777..bfa837cb16b 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -293,7 +293,9 @@ static __init void uv_rtc_init(void)
293 sn_rtc_cycles_per_second = ticks_per_sec; 293 sn_rtc_cycles_per_second = ticks_per_sec;
294} 294}
295 295
296static __init void uv_system_init(void) 296static bool uv_system_inited;
297
298void __init uv_system_init(void)
297{ 299{
298 union uvh_si_addr_map_config_u m_n_config; 300 union uvh_si_addr_map_config_u m_n_config;
299 union uvh_node_id_u node_id; 301 union uvh_node_id_u node_id;
@@ -383,6 +385,7 @@ static __init void uv_system_init(void)
383 map_mmr_high(max_pnode); 385 map_mmr_high(max_pnode);
384 map_config_high(max_pnode); 386 map_config_high(max_pnode);
385 map_mmioh_high(max_pnode); 387 map_mmioh_high(max_pnode);
388 uv_system_inited = true;
386} 389}
387 390
388/* 391/*
@@ -391,8 +394,7 @@ static __init void uv_system_init(void)
391 */ 394 */
392void __cpuinit uv_cpu_init(void) 395void __cpuinit uv_cpu_init(void)
393{ 396{
394 if (!uv_node_to_blade) 397 BUG_ON(!uv_system_inited);
395 uv_system_init();
396 398
397 uv_blade_info[uv_numa_blade_id()].nr_online_cpus++; 399 uv_blade_info[uv_numa_blade_id()].nr_online_cpus++;
398 400
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index b8c45610b20..eecc8c18f01 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -73,7 +73,7 @@ static void __init smp_dump_qct(void)
73} 73}
74 74
75 75
76void __init numaq_tsc_disable(void) 76void __cpuinit numaq_tsc_disable(void)
77{ 77{
78 if (!found_numaq) 78 if (!found_numaq)
79 return; 79 return;
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 94da4d52d79..300da17e61c 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -471,7 +471,7 @@ struct pv_lock_ops pv_lock_ops = {
471 .spin_unlock = __ticket_spin_unlock, 471 .spin_unlock = __ticket_spin_unlock,
472#endif 472#endif
473}; 473};
474EXPORT_SYMBOL_GPL(pv_lock_ops); 474EXPORT_SYMBOL(pv_lock_ops);
475 475
476EXPORT_SYMBOL_GPL(pv_time_ops); 476EXPORT_SYMBOL_GPL(pv_time_ops);
477EXPORT_SYMBOL (pv_cpu_ops); 477EXPORT_SYMBOL (pv_cpu_ops);
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 218d783ed7a..dcdac6c826e 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -343,9 +343,8 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
343 /* were we called with bad_dma_address? */ 343 /* were we called with bad_dma_address? */
344 badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE); 344 badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE);
345 if (unlikely((dma_addr >= bad_dma_address) && (dma_addr < badend))) { 345 if (unlikely((dma_addr >= bad_dma_address) && (dma_addr < badend))) {
346 printk(KERN_ERR "Calgary: driver tried unmapping bad DMA " 346 WARN(1, KERN_ERR "Calgary: driver tried unmapping bad DMA "
347 "address 0x%Lx\n", dma_addr); 347 "address 0x%Lx\n", dma_addr);
348 WARN_ON(1);
349 return; 348 return;
350 } 349 }
351 350
@@ -1269,13 +1268,15 @@ static inline int __init determine_tce_table_size(u64 ram)
1269static int __init build_detail_arrays(void) 1268static int __init build_detail_arrays(void)
1270{ 1269{
1271 unsigned long ptr; 1270 unsigned long ptr;
1272 int i, scal_detail_size, rio_detail_size; 1271 unsigned numnodes, i;
1272 int scal_detail_size, rio_detail_size;
1273 1273
1274 if (rio_table_hdr->num_scal_dev > MAX_NUMNODES){ 1274 numnodes = rio_table_hdr->num_scal_dev;
1275 if (numnodes > MAX_NUMNODES){
1275 printk(KERN_WARNING 1276 printk(KERN_WARNING
1276 "Calgary: MAX_NUMNODES too low! Defined as %d, " 1277 "Calgary: MAX_NUMNODES too low! Defined as %d, "
1277 "but system has %d nodes.\n", 1278 "but system has %d nodes.\n",
1278 MAX_NUMNODES, rio_table_hdr->num_scal_dev); 1279 MAX_NUMNODES, numnodes);
1279 return -ENODEV; 1280 return -ENODEV;
1280 } 1281 }
1281 1282
@@ -1296,8 +1297,7 @@ static int __init build_detail_arrays(void)
1296 } 1297 }
1297 1298
1298 ptr = ((unsigned long)rio_table_hdr) + 3; 1299 ptr = ((unsigned long)rio_table_hdr) + 3;
1299 for (i = 0; i < rio_table_hdr->num_scal_dev; 1300 for (i = 0; i < numnodes; i++, ptr += scal_detail_size)
1300 i++, ptr += scal_detail_size)
1301 scal_devs[i] = (struct scal_detail *)ptr; 1301 scal_devs[i] = (struct scal_detail *)ptr;
1302 1302
1303 for (i = 0; i < rio_table_hdr->num_rio_dev; 1303 for (i = 0; i < rio_table_hdr->num_rio_dev;
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index a4656adab53..362d4e7f2d3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -604,14 +604,6 @@ void __init setup_arch(char **cmdline_p)
604 early_cpu_init(); 604 early_cpu_init();
605 early_ioremap_init(); 605 early_ioremap_init();
606 606
607#if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
608 /*
609 * Must be before kernel pagetables are setup
610 * or fixmap area is touched.
611 */
612 vmi_init();
613#endif
614
615 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); 607 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
616 screen_info = boot_params.screen_info; 608 screen_info = boot_params.screen_info;
617 edid_info = boot_params.edid_info; 609 edid_info = boot_params.edid_info;
@@ -678,6 +670,14 @@ void __init setup_arch(char **cmdline_p)
678 670
679 parse_early_param(); 671 parse_early_param();
680 672
673#if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
674 /*
675 * Must be before kernel pagetables are setup
676 * or fixmap area is touched.
677 */
678 vmi_init();
679#endif
680
681 /* after early param, so could get panic from serial */ 681 /* after early param, so could get panic from serial */
682 reserve_early_setup_data(); 682 reserve_early_setup_data();
683 683
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index e139e617f42..7985c5b3f91 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1221,6 +1221,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1221 printk(KERN_INFO "CPU%d: ", 0); 1221 printk(KERN_INFO "CPU%d: ", 0);
1222 print_cpu_info(&cpu_data(0)); 1222 print_cpu_info(&cpu_data(0));
1223 setup_boot_clock(); 1223 setup_boot_clock();
1224
1225 if (is_uv_system())
1226 uv_system_init();
1224out: 1227out:
1225 preempt_enable(); 1228 preempt_enable();
1226} 1229}
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index d0fbb7712ab..8b8c0d6640f 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -17,6 +17,7 @@
17#include <asm/genapic.h> 17#include <asm/genapic.h>
18#include <asm/idle.h> 18#include <asm/idle.h>
19#include <asm/tsc.h> 19#include <asm/tsc.h>
20#include <asm/irq_vectors.h>
20 21
21#include <mach_apic.h> 22#include <mach_apic.h>
22 23
@@ -783,7 +784,7 @@ static int __init uv_bau_init(void)
783 uv_init_blade(blade, node, cur_cpu); 784 uv_init_blade(blade, node, cur_cpu);
784 cur_cpu += uv_blade_nr_possible_cpus(blade); 785 cur_cpu += uv_blade_nr_possible_cpus(blade);
785 } 786 }
786 set_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1); 787 alloc_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1);
787 uv_enable_timeouts(); 788 uv_enable_timeouts();
788 789
789 return 0; 790 return 0;
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 0577825cf89..9ffb01c31c4 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -88,11 +88,9 @@ static __cpuinit void check_tsc_warp(void)
88 __raw_spin_unlock(&sync_lock); 88 __raw_spin_unlock(&sync_lock);
89 } 89 }
90 } 90 }
91 if (!(now-start)) { 91 WARN(!(now-start),
92 printk("Warning: zero tsc calibration delta: %Ld [max: %Ld]\n", 92 "Warning: zero tsc calibration delta: %Ld [max: %Ld]\n",
93 now-start, end-start); 93 now-start, end-start);
94 WARN_ON(1);
95 }
96} 94}
97 95
98/* 96/*
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a87ea0e4b3d..d3746efb060 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -241,7 +241,7 @@ static unsigned long __initdata table_start;
241static unsigned long __meminitdata table_end; 241static unsigned long __meminitdata table_end;
242static unsigned long __meminitdata table_top; 242static unsigned long __meminitdata table_top;
243 243
244static __meminit void *alloc_low_page(unsigned long *phys) 244static __ref void *alloc_low_page(unsigned long *phys)
245{ 245{
246 unsigned long pfn = table_end++; 246 unsigned long pfn = table_end++;
247 void *adr; 247 void *adr;
@@ -262,7 +262,7 @@ static __meminit void *alloc_low_page(unsigned long *phys)
262 return adr; 262 return adr;
263} 263}
264 264
265static __meminit void unmap_low_page(void *adr) 265static __ref void unmap_low_page(void *adr)
266{ 266{
267 if (after_bootmem) 267 if (after_bootmem)
268 return; 268 return;
@@ -336,9 +336,12 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
336 } 336 }
337 337
338 if (pmd_val(*pmd)) { 338 if (pmd_val(*pmd)) {
339 if (!pmd_large(*pmd)) 339 if (!pmd_large(*pmd)) {
340 spin_lock(&init_mm.page_table_lock);
340 last_map_addr = phys_pte_update(pmd, address, 341 last_map_addr = phys_pte_update(pmd, address,
341 end); 342 end);
343 spin_unlock(&init_mm.page_table_lock);
344 }
342 /* Count entries we're using from level2_ident_pgt */ 345 /* Count entries we're using from level2_ident_pgt */
343 if (start == 0) 346 if (start == 0)
344 pages++; 347 pages++;
@@ -347,8 +350,10 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
347 350
348 if (page_size_mask & (1<<PG_LEVEL_2M)) { 351 if (page_size_mask & (1<<PG_LEVEL_2M)) {
349 pages++; 352 pages++;
353 spin_lock(&init_mm.page_table_lock);
350 set_pte((pte_t *)pmd, 354 set_pte((pte_t *)pmd,
351 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); 355 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
356 spin_unlock(&init_mm.page_table_lock);
352 last_map_addr = (address & PMD_MASK) + PMD_SIZE; 357 last_map_addr = (address & PMD_MASK) + PMD_SIZE;
353 continue; 358 continue;
354 } 359 }
@@ -357,7 +362,9 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
357 last_map_addr = phys_pte_init(pte, address, end); 362 last_map_addr = phys_pte_init(pte, address, end);
358 unmap_low_page(pte); 363 unmap_low_page(pte);
359 364
365 spin_lock(&init_mm.page_table_lock);
360 pmd_populate_kernel(&init_mm, pmd, __va(pte_phys)); 366 pmd_populate_kernel(&init_mm, pmd, __va(pte_phys));
367 spin_unlock(&init_mm.page_table_lock);
361 } 368 }
362 update_page_count(PG_LEVEL_2M, pages); 369 update_page_count(PG_LEVEL_2M, pages);
363 return last_map_addr; 370 return last_map_addr;
@@ -370,9 +377,7 @@ phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end,
370 pmd_t *pmd = pmd_offset(pud, 0); 377 pmd_t *pmd = pmd_offset(pud, 0);
371 unsigned long last_map_addr; 378 unsigned long last_map_addr;
372 379
373 spin_lock(&init_mm.page_table_lock);
374 last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask); 380 last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask);
375 spin_unlock(&init_mm.page_table_lock);
376 __flush_tlb_all(); 381 __flush_tlb_all();
377 return last_map_addr; 382 return last_map_addr;
378} 383}
@@ -408,20 +413,21 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
408 413
409 if (page_size_mask & (1<<PG_LEVEL_1G)) { 414 if (page_size_mask & (1<<PG_LEVEL_1G)) {
410 pages++; 415 pages++;
416 spin_lock(&init_mm.page_table_lock);
411 set_pte((pte_t *)pud, 417 set_pte((pte_t *)pud,
412 pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); 418 pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL_LARGE));
419 spin_unlock(&init_mm.page_table_lock);
413 last_map_addr = (addr & PUD_MASK) + PUD_SIZE; 420 last_map_addr = (addr & PUD_MASK) + PUD_SIZE;
414 continue; 421 continue;
415 } 422 }
416 423
417 pmd = alloc_low_page(&pmd_phys); 424 pmd = alloc_low_page(&pmd_phys);
418
419 spin_lock(&init_mm.page_table_lock);
420 last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask); 425 last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask);
421 unmap_low_page(pmd); 426 unmap_low_page(pmd);
427
428 spin_lock(&init_mm.page_table_lock);
422 pud_populate(&init_mm, pud, __va(pmd_phys)); 429 pud_populate(&init_mm, pud, __va(pmd_phys));
423 spin_unlock(&init_mm.page_table_lock); 430 spin_unlock(&init_mm.page_table_lock);
424
425 } 431 }
426 __flush_tlb_all(); 432 __flush_tlb_all();
427 update_page_count(PG_LEVEL_1G, pages); 433 update_page_count(PG_LEVEL_1G, pages);
@@ -513,16 +519,14 @@ static unsigned long __init kernel_physical_mapping_init(unsigned long start,
513 continue; 519 continue;
514 } 520 }
515 521
516 if (after_bootmem) 522 pud = alloc_low_page(&pud_phys);
517 pud = pud_offset(pgd, start & PGDIR_MASK);
518 else
519 pud = alloc_low_page(&pud_phys);
520
521 last_map_addr = phys_pud_init(pud, __pa(start), __pa(next), 523 last_map_addr = phys_pud_init(pud, __pa(start), __pa(next),
522 page_size_mask); 524 page_size_mask);
523 unmap_low_page(pud); 525 unmap_low_page(pud);
524 pgd_populate(&init_mm, pgd_offset_k(start), 526
525 __va(pud_phys)); 527 spin_lock(&init_mm.page_table_lock);
528 pgd_populate(&init_mm, pgd, __va(pud_phys));
529 spin_unlock(&init_mm.page_table_lock);
526 } 530 }
527 531
528 return last_map_addr; 532 return last_map_addr;
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 6ba6f889c79..d4b6e6a29ae 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -553,13 +553,11 @@ static int __init check_early_ioremap_leak(void)
553{ 553{
554 if (!early_ioremap_nested) 554 if (!early_ioremap_nested)
555 return 0; 555 return 0;
556 556 WARN(1, KERN_WARNING
557 printk(KERN_WARNING
558 "Debug warning: early ioremap leak of %d areas detected.\n", 557 "Debug warning: early ioremap leak of %d areas detected.\n",
559 early_ioremap_nested); 558 early_ioremap_nested);
560 printk(KERN_WARNING 559 printk(KERN_WARNING
561 "please boot with early_ioremap_debug and report the dmesg.\n"); 560 "please boot with early_ioremap_debug and report the dmesg.\n");
562 WARN_ON(1);
563 561
564 return 1; 562 return 1;
565} 563}
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index e7397e108be..635b50e8558 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -430,7 +430,9 @@ static void enter_uniprocessor(void)
430 "may miss events.\n"); 430 "may miss events.\n");
431} 431}
432 432
433static void leave_uniprocessor(void) 433/* __ref because leave_uniprocessor calls cpu_up which is __cpuinit,
434 but this whole function is ifdefed CONFIG_HOTPLUG_CPU */
435static void __ref leave_uniprocessor(void)
434{ 436{
435 int cpu; 437 int cpu;
436 int err; 438 int err;
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index f5f5154ea11..43e2f8483e4 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -849,7 +849,7 @@ int set_memory_uc(unsigned long addr, int numpages)
849 /* 849 /*
850 * for now UC MINUS. see comments in ioremap_nocache() 850 * for now UC MINUS. see comments in ioremap_nocache()
851 */ 851 */
852 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, 852 if (reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
853 _PAGE_CACHE_UC_MINUS, NULL)) 853 _PAGE_CACHE_UC_MINUS, NULL))
854 return -EINVAL; 854 return -EINVAL;
855 855
@@ -868,7 +868,7 @@ int set_memory_wc(unsigned long addr, int numpages)
868 if (!pat_enabled) 868 if (!pat_enabled)
869 return set_memory_uc(addr, numpages); 869 return set_memory_uc(addr, numpages);
870 870
871 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE, 871 if (reserve_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE,
872 _PAGE_CACHE_WC, NULL)) 872 _PAGE_CACHE_WC, NULL))
873 return -EINVAL; 873 return -EINVAL;
874 874
@@ -884,7 +884,7 @@ int _set_memory_wb(unsigned long addr, int numpages)
884 884
885int set_memory_wb(unsigned long addr, int numpages) 885int set_memory_wb(unsigned long addr, int numpages)
886{ 886{
887 free_memtype(addr, addr + numpages * PAGE_SIZE); 887 free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE);
888 888
889 return _set_memory_wb(addr, numpages); 889 return _set_memory_wb(addr, numpages);
890} 890}
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 2fe30916d4b..2a50e0fa64a 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -207,6 +207,9 @@ static int chk_conflict(struct memtype *new, struct memtype *entry,
207 return -EBUSY; 207 return -EBUSY;
208} 208}
209 209
210static struct memtype *cached_entry;
211static u64 cached_start;
212
210/* 213/*
211 * req_type typically has one of the: 214 * req_type typically has one of the:
212 * - _PAGE_CACHE_WB 215 * - _PAGE_CACHE_WB
@@ -280,11 +283,17 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
280 283
281 spin_lock(&memtype_lock); 284 spin_lock(&memtype_lock);
282 285
286 if (cached_entry && start >= cached_start)
287 entry = cached_entry;
288 else
289 entry = list_entry(&memtype_list, struct memtype, nd);
290
283 /* Search for existing mapping that overlaps the current range */ 291 /* Search for existing mapping that overlaps the current range */
284 where = NULL; 292 where = NULL;
285 list_for_each_entry(entry, &memtype_list, nd) { 293 list_for_each_entry_continue(entry, &memtype_list, nd) {
286 if (end <= entry->start) { 294 if (end <= entry->start) {
287 where = entry->nd.prev; 295 where = entry->nd.prev;
296 cached_entry = list_entry(where, struct memtype, nd);
288 break; 297 break;
289 } else if (start <= entry->start) { /* end > entry->start */ 298 } else if (start <= entry->start) { /* end > entry->start */
290 err = chk_conflict(new, entry, new_type); 299 err = chk_conflict(new, entry, new_type);
@@ -292,6 +301,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
292 dprintk("Overlap at 0x%Lx-0x%Lx\n", 301 dprintk("Overlap at 0x%Lx-0x%Lx\n",
293 entry->start, entry->end); 302 entry->start, entry->end);
294 where = entry->nd.prev; 303 where = entry->nd.prev;
304 cached_entry = list_entry(where,
305 struct memtype, nd);
295 } 306 }
296 break; 307 break;
297 } else if (start < entry->end) { /* start > entry->start */ 308 } else if (start < entry->end) { /* start > entry->start */
@@ -299,7 +310,20 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
299 if (!err) { 310 if (!err) {
300 dprintk("Overlap at 0x%Lx-0x%Lx\n", 311 dprintk("Overlap at 0x%Lx-0x%Lx\n",
301 entry->start, entry->end); 312 entry->start, entry->end);
302 where = &entry->nd; 313 cached_entry = list_entry(entry->nd.prev,
314 struct memtype, nd);
315
316 /*
317 * Move to right position in the linked
318 * list to add this new entry
319 */
320 list_for_each_entry_continue(entry,
321 &memtype_list, nd) {
322 if (start <= entry->start) {
323 where = entry->nd.prev;
324 break;
325 }
326 }
303 } 327 }
304 break; 328 break;
305 } 329 }
@@ -314,6 +338,8 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
314 return err; 338 return err;
315 } 339 }
316 340
341 cached_start = start;
342
317 if (where) 343 if (where)
318 list_add(&new->nd, where); 344 list_add(&new->nd, where);
319 else 345 else
@@ -343,6 +369,9 @@ int free_memtype(u64 start, u64 end)
343 spin_lock(&memtype_lock); 369 spin_lock(&memtype_lock);
344 list_for_each_entry(entry, &memtype_list, nd) { 370 list_for_each_entry(entry, &memtype_list, nd) {
345 if (entry->start == start && entry->end == end) { 371 if (entry->start == start && entry->end == end) {
372 if (cached_entry == entry || cached_start == start)
373 cached_entry = NULL;
374
346 list_del(&entry->nd); 375 list_del(&entry->nd);
347 kfree(entry); 376 kfree(entry);
348 err = 0; 377 err = 0;
@@ -361,14 +390,6 @@ int free_memtype(u64 start, u64 end)
361} 390}
362 391
363 392
364/*
365 * /dev/mem mmap interface. The memtype used for mapping varies:
366 * - Use UC for mappings with O_SYNC flag
367 * - Without O_SYNC flag, if there is any conflict in reserve_memtype,
368 * inherit the memtype from existing mapping.
369 * - Else use UC_MINUS memtype (for backward compatibility with existing
370 * X drivers.
371 */
372pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, 393pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
373 unsigned long size, pgprot_t vma_prot) 394 unsigned long size, pgprot_t vma_prot)
374{ 395{
@@ -406,14 +427,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
406 unsigned long size, pgprot_t *vma_prot) 427 unsigned long size, pgprot_t *vma_prot)
407{ 428{
408 u64 offset = ((u64) pfn) << PAGE_SHIFT; 429 u64 offset = ((u64) pfn) << PAGE_SHIFT;
409 unsigned long flags = _PAGE_CACHE_UC_MINUS; 430 unsigned long flags = -1;
410 int retval; 431 int retval;
411 432
412 if (!range_is_allowed(pfn, size)) 433 if (!range_is_allowed(pfn, size))
413 return 0; 434 return 0;
414 435
415 if (file->f_flags & O_SYNC) { 436 if (file->f_flags & O_SYNC) {
416 flags = _PAGE_CACHE_UC; 437 flags = _PAGE_CACHE_UC_MINUS;
417 } 438 }
418 439
419#ifdef CONFIG_X86_32 440#ifdef CONFIG_X86_32
@@ -436,13 +457,14 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
436#endif 457#endif
437 458
438 /* 459 /*
439 * With O_SYNC, we can only take UC mapping. Fail if we cannot. 460 * With O_SYNC, we can only take UC_MINUS mapping. Fail if we cannot.
461 *
440 * Without O_SYNC, we want to get 462 * Without O_SYNC, we want to get
441 * - WB for WB-able memory and no other conflicting mappings 463 * - WB for WB-able memory and no other conflicting mappings
442 * - UC_MINUS for non-WB-able memory with no other conflicting mappings 464 * - UC_MINUS for non-WB-able memory with no other conflicting mappings
443 * - Inherit from confliting mappings otherwise 465 * - Inherit from confliting mappings otherwise
444 */ 466 */
445 if (flags != _PAGE_CACHE_UC_MINUS) { 467 if (flags != -1) {
446 retval = reserve_memtype(offset, offset + size, flags, NULL); 468 retval = reserve_memtype(offset, offset + size, flags, NULL);
447 } else { 469 } else {
448 retval = reserve_memtype(offset, offset + size, -1, &flags); 470 retval = reserve_memtype(offset, offset + size, -1, &flags);
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 3f90289410e..0227694f7da 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -15,6 +15,7 @@
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/moduleparam.h> 16#include <linux/moduleparam.h>
17#include <linux/kdebug.h> 17#include <linux/kdebug.h>
18#include <linux/cpu.h>
18#include <asm/nmi.h> 19#include <asm/nmi.h>
19#include <asm/msr.h> 20#include <asm/msr.h>
20#include <asm/apic.h> 21#include <asm/apic.h>
@@ -28,23 +29,48 @@ static DEFINE_PER_CPU(unsigned long, saved_lvtpc);
28 29
29static int nmi_start(void); 30static int nmi_start(void);
30static void nmi_stop(void); 31static void nmi_stop(void);
32static void nmi_cpu_start(void *dummy);
33static void nmi_cpu_stop(void *dummy);
31 34
32/* 0 == registered but off, 1 == registered and on */ 35/* 0 == registered but off, 1 == registered and on */
33static int nmi_enabled = 0; 36static int nmi_enabled = 0;
34 37
38#ifdef CONFIG_SMP
39static int oprofile_cpu_notifier(struct notifier_block *b, unsigned long action,
40 void *data)
41{
42 int cpu = (unsigned long)data;
43 switch (action) {
44 case CPU_DOWN_FAILED:
45 case CPU_ONLINE:
46 smp_call_function_single(cpu, nmi_cpu_start, NULL, 0);
47 break;
48 case CPU_DOWN_PREPARE:
49 smp_call_function_single(cpu, nmi_cpu_stop, NULL, 1);
50 break;
51 }
52 return NOTIFY_DONE;
53}
54
55static struct notifier_block oprofile_cpu_nb = {
56 .notifier_call = oprofile_cpu_notifier
57};
58#endif
59
35#ifdef CONFIG_PM 60#ifdef CONFIG_PM
36 61
37static int nmi_suspend(struct sys_device *dev, pm_message_t state) 62static int nmi_suspend(struct sys_device *dev, pm_message_t state)
38{ 63{
64 /* Only one CPU left, just stop that one */
39 if (nmi_enabled == 1) 65 if (nmi_enabled == 1)
40 nmi_stop(); 66 nmi_cpu_stop(NULL);
41 return 0; 67 return 0;
42} 68}
43 69
44static int nmi_resume(struct sys_device *dev) 70static int nmi_resume(struct sys_device *dev)
45{ 71{
46 if (nmi_enabled == 1) 72 if (nmi_enabled == 1)
47 nmi_start(); 73 nmi_cpu_start(NULL);
48 return 0; 74 return 0;
49} 75}
50 76
@@ -463,6 +489,9 @@ int __init op_nmi_init(struct oprofile_operations *ops)
463 } 489 }
464 490
465 init_sysfs(); 491 init_sysfs();
492#ifdef CONFIG_SMP
493 register_cpu_notifier(&oprofile_cpu_nb);
494#endif
466 using_nmi = 1; 495 using_nmi = 1;
467 ops->create_files = nmi_create_files; 496 ops->create_files = nmi_create_files;
468 ops->setup = nmi_setup; 497 ops->setup = nmi_setup;
@@ -476,6 +505,10 @@ int __init op_nmi_init(struct oprofile_operations *ops)
476 505
477void op_nmi_exit(void) 506void op_nmi_exit(void)
478{ 507{
479 if (using_nmi) 508 if (using_nmi) {
480 exit_sysfs(); 509 exit_sysfs();
510#ifdef CONFIG_SMP
511 unregister_cpu_notifier(&oprofile_cpu_nb);
512#endif
513 }
481} 514}
diff --git a/block/genhd.c b/block/genhd.c
index c13cc77291a..656c2c7abf9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -293,27 +293,30 @@ void __init printk_all_partitions(void)
293/* iterator */ 293/* iterator */
294static int find_start(struct device *dev, void *data) 294static int find_start(struct device *dev, void *data)
295{ 295{
296 loff_t k = *(loff_t *)data; 296 loff_t *k = data;
297 297
298 if (dev->type != &disk_type) 298 if (dev->type != &disk_type)
299 return 0; 299 return 0;
300 if (!k--) 300 if (!*k)
301 return 1; 301 return 1;
302 (*k)--;
302 return 0; 303 return 0;
303} 304}
304 305
305static void *part_start(struct seq_file *part, loff_t *pos) 306static void *part_start(struct seq_file *part, loff_t *pos)
306{ 307{
307 struct device *dev; 308 struct device *dev;
308 loff_t n = *pos; 309 loff_t k = *pos;
309 310
310 if (!n) 311 if (!k)
311 seq_puts(part, "major minor #blocks name\n\n"); 312 seq_puts(part, "major minor #blocks name\n\n");
312 313
313 mutex_lock(&block_class_lock); 314 mutex_lock(&block_class_lock);
314 dev = class_find_device(&block_class, NULL, (void *)pos, find_start); 315 dev = class_find_device(&block_class, NULL, &k, find_start);
315 if (dev) 316 if (dev) {
317 put_device(dev);
316 return dev_to_disk(dev); 318 return dev_to_disk(dev);
319 }
317 return NULL; 320 return NULL;
318} 321}
319 322
@@ -330,8 +333,10 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos)
330 struct device *dev; 333 struct device *dev;
331 ++*pos; 334 ++*pos;
332 dev = class_find_device(&block_class, &gp->dev, NULL, find_next); 335 dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
333 if (dev) 336 if (dev) {
337 put_device(dev);
334 return dev_to_disk(dev); 338 return dev_to_disk(dev);
339 }
335 return NULL; 340 return NULL;
336} 341}
337 342
@@ -568,11 +573,14 @@ static struct device_type disk_type = {
568static void *diskstats_start(struct seq_file *part, loff_t *pos) 573static void *diskstats_start(struct seq_file *part, loff_t *pos)
569{ 574{
570 struct device *dev; 575 struct device *dev;
576 loff_t k = *pos;
571 577
572 mutex_lock(&block_class_lock); 578 mutex_lock(&block_class_lock);
573 dev = class_find_device(&block_class, NULL, (void *)pos, find_start); 579 dev = class_find_device(&block_class, NULL, &k, find_start);
574 if (dev) 580 if (dev) {
581 put_device(dev);
575 return dev_to_disk(dev); 582 return dev_to_disk(dev);
583 }
576 return NULL; 584 return NULL;
577} 585}
578 586
@@ -583,8 +591,10 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos)
583 591
584 ++*pos; 592 ++*pos;
585 dev = class_find_device(&block_class, &gp->dev, NULL, find_next); 593 dev = class_find_device(&block_class, &gp->dev, NULL, find_next);
586 if (dev) 594 if (dev) {
595 put_device(dev);
587 return dev_to_disk(dev); 596 return dev_to_disk(dev);
597 }
588 return NULL; 598 return NULL;
589} 599}
590 600
@@ -712,10 +722,12 @@ dev_t blk_lookup_devt(const char *name, int part)
712 mutex_lock(&block_class_lock); 722 mutex_lock(&block_class_lock);
713 find.name = name; 723 find.name = name;
714 find.part = part; 724 find.part = part;
715 dev = class_find_device(&block_class, NULL, (void *)&find, match_id); 725 dev = class_find_device(&block_class, NULL, &find, match_id);
716 if (dev) 726 if (dev) {
727 put_device(dev);
717 devt = MKDEV(MAJOR(dev->devt), 728 devt = MKDEV(MAJOR(dev->devt),
718 MINOR(dev->devt) + part); 729 MINOR(dev->devt) + part);
730 }
719 mutex_unlock(&block_class_lock); 731 mutex_unlock(&block_class_lock);
720 732
721 return devt; 733 return devt;
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index ef3e5522e1a..c729e6988bb 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -486,6 +486,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
486 { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */ 486 { PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */
487 { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */ 487 { PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */
488 { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */ 488 { PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */
489 { PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */
490 { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
489 491
490 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 492 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
491 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 493 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -575,9 +577,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
575 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */ 577 { PCI_VDEVICE(NVIDIA, 0x0bc7), board_ahci }, /* MCP7B */
576 578
577 /* SiS */ 579 /* SiS */
578 { PCI_VDEVICE(SI, 0x1184), board_ahci_nopmp }, /* SiS 966 */ 580 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
579 { PCI_VDEVICE(SI, 0x1185), board_ahci_nopmp }, /* SiS 968 */ 581 { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 968 */
580 { PCI_VDEVICE(SI, 0x0186), board_ahci_nopmp }, /* SiS 968 */ 582 { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */
581 583
582 /* Marvell */ 584 /* Marvell */
583 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */ 585 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index c294121fd69..b1d08a8f500 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -275,6 +275,14 @@ static const struct pci_device_id piix_pci_tbl[] = {
275 { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 275 { 0x8086, 0x3a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
276 /* SATA Controller IDE (ICH10) */ 276 /* SATA Controller IDE (ICH10) */
277 { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 277 { 0x8086, 0x3a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
278 /* SATA Controller IDE (PCH) */
279 { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
280 /* SATA Controller IDE (PCH) */
281 { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
282 /* SATA Controller IDE (PCH) */
283 { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
284 /* SATA Controller IDE (PCH) */
285 { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
278 286
279 { } /* terminate list */ 287 { } /* terminate list */
280}; 288};
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 5ba96c5052c..79e3a8e7a84 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -104,6 +104,7 @@ struct ata_force_param {
104 unsigned long xfer_mask; 104 unsigned long xfer_mask;
105 unsigned int horkage_on; 105 unsigned int horkage_on;
106 unsigned int horkage_off; 106 unsigned int horkage_off;
107 unsigned int lflags;
107}; 108};
108 109
109struct ata_force_ent { 110struct ata_force_ent {
@@ -196,22 +197,23 @@ void ata_force_cbl(struct ata_port *ap)
196} 197}
197 198
198/** 199/**
199 * ata_force_spd_limit - force SATA spd limit according to libata.force 200 * ata_force_link_limits - force link limits according to libata.force
200 * @link: ATA link of interest 201 * @link: ATA link of interest
201 * 202 *
202 * Force SATA spd limit according to libata.force and whine about 203 * Force link flags and SATA spd limit according to libata.force
203 * it. When only the port part is specified (e.g. 1:), the limit 204 * and whine about it. When only the port part is specified
204 * applies to all links connected to both the host link and all 205 * (e.g. 1:), the limit applies to all links connected to both
205 * fan-out ports connected via PMP. If the device part is 206 * the host link and all fan-out ports connected via PMP. If the
206 * specified as 0 (e.g. 1.00:), it specifies the first fan-out 207 * device part is specified as 0 (e.g. 1.00:), it specifies the
207 * link not the host link. Device number 15 always points to the 208 * first fan-out link not the host link. Device number 15 always
208 * host link whether PMP is attached or not. 209 * points to the host link whether PMP is attached or not.
209 * 210 *
210 * LOCKING: 211 * LOCKING:
211 * EH context. 212 * EH context.
212 */ 213 */
213static void ata_force_spd_limit(struct ata_link *link) 214static void ata_force_link_limits(struct ata_link *link)
214{ 215{
216 bool did_spd = false;
215 int linkno, i; 217 int linkno, i;
216 218
217 if (ata_is_host_link(link)) 219 if (ata_is_host_link(link))
@@ -228,13 +230,22 @@ static void ata_force_spd_limit(struct ata_link *link)
228 if (fe->device != -1 && fe->device != linkno) 230 if (fe->device != -1 && fe->device != linkno)
229 continue; 231 continue;
230 232
231 if (!fe->param.spd_limit) 233 /* only honor the first spd limit */
232 continue; 234 if (!did_spd && fe->param.spd_limit) {
235 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1;
236 ata_link_printk(link, KERN_NOTICE,
237 "FORCE: PHY spd limit set to %s\n",
238 fe->param.name);
239 did_spd = true;
240 }
233 241
234 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; 242 /* let lflags stack */
235 ata_link_printk(link, KERN_NOTICE, 243 if (fe->param.lflags) {
236 "FORCE: PHY spd limit set to %s\n", fe->param.name); 244 link->flags |= fe->param.lflags;
237 return; 245 ata_link_printk(link, KERN_NOTICE,
246 "FORCE: link flag 0x%x forced -> 0x%x\n",
247 fe->param.lflags, link->flags);
248 }
238 } 249 }
239} 250}
240 251
@@ -3277,7 +3288,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
3277 dev->dma_mode = ata_xfer_mask2mode(dma_mask); 3288 dev->dma_mode = ata_xfer_mask2mode(dma_mask);
3278 3289
3279 found = 1; 3290 found = 1;
3280 if (dev->dma_mode != 0xff) 3291 if (ata_dma_enabled(dev))
3281 used_dma = 1; 3292 used_dma = 1;
3282 } 3293 }
3283 if (!found) 3294 if (!found)
@@ -3302,7 +3313,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
3302 3313
3303 /* step 3: set host DMA timings */ 3314 /* step 3: set host DMA timings */
3304 ata_link_for_each_dev(dev, link) { 3315 ata_link_for_each_dev(dev, link) {
3305 if (!ata_dev_enabled(dev) || dev->dma_mode == 0xff) 3316 if (!ata_dev_enabled(dev) || !ata_dma_enabled(dev))
3306 continue; 3317 continue;
3307 3318
3308 dev->xfer_mode = dev->dma_mode; 3319 dev->xfer_mode = dev->dma_mode;
@@ -5188,19 +5199,18 @@ void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp)
5188 */ 5199 */
5189int sata_link_init_spd(struct ata_link *link) 5200int sata_link_init_spd(struct ata_link *link)
5190{ 5201{
5191 u32 scontrol;
5192 u8 spd; 5202 u8 spd;
5193 int rc; 5203 int rc;
5194 5204
5195 rc = sata_scr_read(link, SCR_CONTROL, &scontrol); 5205 rc = sata_scr_read(link, SCR_CONTROL, &link->saved_scontrol);
5196 if (rc) 5206 if (rc)
5197 return rc; 5207 return rc;
5198 5208
5199 spd = (scontrol >> 4) & 0xf; 5209 spd = (link->saved_scontrol >> 4) & 0xf;
5200 if (spd) 5210 if (spd)
5201 link->hw_sata_spd_limit &= (1 << spd) - 1; 5211 link->hw_sata_spd_limit &= (1 << spd) - 1;
5202 5212
5203 ata_force_spd_limit(link); 5213 ata_force_link_limits(link);
5204 5214
5205 link->sata_spd_limit = link->hw_sata_spd_limit; 5215 link->sata_spd_limit = link->hw_sata_spd_limit;
5206 5216
@@ -5783,9 +5793,10 @@ static void ata_port_detach(struct ata_port *ap)
5783 ata_port_wait_eh(ap); 5793 ata_port_wait_eh(ap);
5784 5794
5785 /* EH is now guaranteed to see UNLOADING - EH context belongs 5795 /* EH is now guaranteed to see UNLOADING - EH context belongs
5786 * to us. Disable all existing devices. 5796 * to us. Restore SControl and disable all existing devices.
5787 */ 5797 */
5788 ata_port_for_each_link(link, ap) { 5798 __ata_port_for_each_link(link, ap) {
5799 sata_scr_write(link, SCR_CONTROL, link->saved_scontrol);
5789 ata_link_for_each_dev(dev, link) 5800 ata_link_for_each_dev(dev, link)
5790 ata_dev_disable(dev); 5801 ata_dev_disable(dev);
5791 } 5802 }
@@ -5991,6 +6002,9 @@ static int __init ata_parse_force_one(char **cur,
5991 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 6002 { "udma133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
5992 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) }, 6003 { "udma/133", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 6) },
5993 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) }, 6004 { "udma7", .xfer_mask = 1 << (ATA_SHIFT_UDMA + 7) },
6005 { "nohrst", .lflags = ATA_LFLAG_NO_HRST },
6006 { "nosrst", .lflags = ATA_LFLAG_NO_SRST },
6007 { "norst", .lflags = ATA_LFLAG_NO_HRST | ATA_LFLAG_NO_SRST },
5994 }; 6008 };
5995 char *start = *cur, *p = *cur; 6009 char *start = *cur, *p = *cur;
5996 char *id, *val, *endp; 6010 char *id, *val, *endp;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 58bdc538d22..c1db2f234d2 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2040,7 +2040,7 @@ static void ata_eh_link_report(struct ata_link *link)
2040 } 2040 }
2041 2041
2042 if (ehc->i.serror) 2042 if (ehc->i.serror)
2043 ata_port_printk(ap, KERN_ERR, 2043 ata_link_printk(link, KERN_ERR,
2044 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", 2044 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n",
2045 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", 2045 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "",
2046 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", 2046 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "",
@@ -2171,18 +2171,12 @@ static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
2171} 2171}
2172 2172
2173static int ata_eh_followup_srst_needed(struct ata_link *link, 2173static int ata_eh_followup_srst_needed(struct ata_link *link,
2174 int rc, int classify, 2174 int rc, const unsigned int *classes)
2175 const unsigned int *classes)
2176{ 2175{
2177 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link)) 2176 if ((link->flags & ATA_LFLAG_NO_SRST) || ata_link_offline(link))
2178 return 0; 2177 return 0;
2179 if (rc == -EAGAIN) { 2178 if (rc == -EAGAIN)
2180 if (classify) 2179 return 1;
2181 return 1;
2182 rc = 0;
2183 }
2184 if (rc != 0)
2185 return 0;
2186 if (sata_pmp_supported(link->ap) && ata_is_host_link(link)) 2180 if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
2187 return 1; 2181 return 1;
2188 return 0; 2182 return 0;
@@ -2210,6 +2204,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
2210 */ 2204 */
2211 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX) 2205 while (ata_eh_reset_timeouts[max_tries] != ULONG_MAX)
2212 max_tries++; 2206 max_tries++;
2207 if (link->flags & ATA_LFLAG_NO_HRST)
2208 hardreset = NULL;
2209 if (link->flags & ATA_LFLAG_NO_SRST)
2210 softreset = NULL;
2213 2211
2214 now = jiffies; 2212 now = jiffies;
2215 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); 2213 deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN);
@@ -2247,10 +2245,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
2247 ehc->i.action &= ~ATA_EH_RESET; 2245 ehc->i.action &= ~ATA_EH_RESET;
2248 if (hardreset) { 2246 if (hardreset) {
2249 reset = hardreset; 2247 reset = hardreset;
2250 ehc->i.action = ATA_EH_HARDRESET; 2248 ehc->i.action |= ATA_EH_HARDRESET;
2251 } else if (softreset) { 2249 } else if (softreset) {
2252 reset = softreset; 2250 reset = softreset;
2253 ehc->i.action = ATA_EH_SOFTRESET; 2251 ehc->i.action |= ATA_EH_SOFTRESET;
2254 } 2252 }
2255 2253
2256 if (prereset) { 2254 if (prereset) {
@@ -2305,9 +2303,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2305 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 2303 ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
2306 2304
2307 rc = ata_do_reset(link, reset, classes, deadline); 2305 rc = ata_do_reset(link, reset, classes, deadline);
2306 if (rc && rc != -EAGAIN)
2307 goto fail;
2308 2308
2309 if (reset == hardreset && 2309 if (reset == hardreset &&
2310 ata_eh_followup_srst_needed(link, rc, classify, classes)) { 2310 ata_eh_followup_srst_needed(link, rc, classes)) {
2311 /* okay, let's do follow-up softreset */ 2311 /* okay, let's do follow-up softreset */
2312 reset = softreset; 2312 reset = softreset;
2313 2313
@@ -2322,10 +2322,6 @@ int ata_eh_reset(struct ata_link *link, int classify,
2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); 2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
2323 rc = ata_do_reset(link, reset, classes, deadline); 2323 rc = ata_do_reset(link, reset, classes, deadline);
2324 } 2324 }
2325
2326 /* -EAGAIN can happen if we skipped followup SRST */
2327 if (rc && rc != -EAGAIN)
2328 goto fail;
2329 } else { 2325 } else {
2330 if (verbose) 2326 if (verbose)
2331 ata_link_printk(link, KERN_INFO, "no reset method " 2327 ata_link_printk(link, KERN_INFO, "no reset method "
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index fbe60571155..eb919c16a03 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -181,7 +181,7 @@ static unsigned int pacpi_qc_issue(struct ata_queued_cmd *qc)
181 181
182 if (adev != acpi->last) { 182 if (adev != acpi->last) {
183 pacpi_set_piomode(ap, adev); 183 pacpi_set_piomode(ap, adev);
184 if (adev->dma_mode) 184 if (ata_dma_enabled(adev))
185 pacpi_set_dmamode(ap, adev); 185 pacpi_set_dmamode(ap, adev);
186 acpi->last = adev; 186 acpi->last = adev;
187 } 187 }
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index d7de7baf58a..e8a0d99d735 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -183,7 +183,7 @@ static void atiixp_bmdma_start(struct ata_queued_cmd *qc)
183 u16 tmp16; 183 u16 tmp16;
184 184
185 pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); 185 pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16);
186 if (adev->dma_mode >= XFER_UDMA_0) 186 if (ata_using_udma(adev))
187 tmp16 |= (1 << dn); 187 tmp16 |= (1 << dn);
188 else 188 else
189 tmp16 &= ~(1 << dn); 189 tmp16 &= ~(1 << dn);
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 744beebaaf4..0c4b271a9d5 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -149,10 +149,10 @@ static unsigned int cs5530_qc_issue(struct ata_queued_cmd *qc)
149 struct ata_device *prev = ap->private_data; 149 struct ata_device *prev = ap->private_data;
150 150
151 /* See if the DMA settings could be wrong */ 151 /* See if the DMA settings could be wrong */
152 if (adev->dma_mode != 0 && adev != prev && prev != NULL) { 152 if (ata_dma_enabled(adev) && adev != prev && prev != NULL) {
153 /* Maybe, but do the channels match MWDMA/UDMA ? */ 153 /* Maybe, but do the channels match MWDMA/UDMA ? */
154 if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || 154 if ((ata_using_udma(adev) && !ata_using_udma(prev)) ||
155 (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) 155 (ata_using_udma(prev) && !ata_using_udma(adev)))
156 /* Switch the mode bits */ 156 /* Switch the mode bits */
157 cs5530_set_dmamode(ap, adev); 157 cs5530_set_dmamode(ap, adev);
158 } 158 }
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 27843c70eb9..0221c9a4676 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -606,7 +606,7 @@ static void it821x_display_disk(int n, u8 *buf)
606{ 606{
607 unsigned char id[41]; 607 unsigned char id[41];
608 int mode = 0; 608 int mode = 0;
609 char *mtype; 609 char *mtype = "";
610 char mbuf[8]; 610 char mbuf[8];
611 char *cbl = "(40 wire cable)"; 611 char *cbl = "(40 wire cable)";
612 612
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index e678af383d1..df64f244300 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -198,7 +198,7 @@ static unsigned int oldpiix_qc_issue(struct ata_queued_cmd *qc)
198 198
199 if (adev != ap->private_data) { 199 if (adev != ap->private_data) {
200 oldpiix_set_piomode(ap, adev); 200 oldpiix_set_piomode(ap, adev);
201 if (adev->dma_mode) 201 if (ata_dma_enabled(adev))
202 oldpiix_set_dmamode(ap, adev); 202 oldpiix_set_dmamode(ap, adev);
203 } 203 }
204 return ata_sff_qc_issue(qc); 204 return ata_sff_qc_issue(qc);
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index cbab397e3db..0278fd2b8fb 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -167,10 +167,10 @@ static unsigned int sc1200_qc_issue(struct ata_queued_cmd *qc)
167 struct ata_device *prev = ap->private_data; 167 struct ata_device *prev = ap->private_data;
168 168
169 /* See if the DMA settings could be wrong */ 169 /* See if the DMA settings could be wrong */
170 if (adev->dma_mode != 0 && adev != prev && prev != NULL) { 170 if (ata_dma_enabled(adev) && adev != prev && prev != NULL) {
171 /* Maybe, but do the channels match MWDMA/UDMA ? */ 171 /* Maybe, but do the channels match MWDMA/UDMA ? */
172 if ((adev->dma_mode >= XFER_UDMA_0 && prev->dma_mode < XFER_UDMA_0) || 172 if ((ata_using_udma(adev) && !ata_using_udma(prev)) ||
173 (adev->dma_mode < XFER_UDMA_0 && prev->dma_mode >= XFER_UDMA_0)) 173 (ata_using_udma(prev) && !ata_using_udma(adev)))
174 /* Switch the mode bits */ 174 /* Switch the mode bits */
175 sc1200_set_dmamode(ap, adev); 175 sc1200_set_dmamode(ap, adev);
176 } 176 }
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 57d951b11f2..8fdb2ce7321 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -324,62 +324,26 @@ static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev)
324} 324}
325 325
326/** 326/**
327 * via_ata_sff_tf_load - send taskfile registers to host controller 327 * via_tf_load - send taskfile registers to host controller
328 * @ap: Port to which output is sent 328 * @ap: Port to which output is sent
329 * @tf: ATA taskfile register set 329 * @tf: ATA taskfile register set
330 * 330 *
331 * Outputs ATA taskfile to standard ATA host controller. 331 * Outputs ATA taskfile to standard ATA host controller.
332 * 332 *
333 * Note: This is to fix the internal bug of via chipsets, which 333 * Note: This is to fix the internal bug of via chipsets, which
334 * will reset the device register after changing the IEN bit on 334 * will reset the device register after changing the IEN bit on
335 * ctl register 335 * ctl register
336 */ 336 */
337static void via_ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) 337static void via_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
338{ 338{
339 struct ata_ioports *ioaddr = &ap->ioaddr; 339 struct ata_taskfile tmp_tf;
340 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
341
342 if (tf->ctl != ap->last_ctl) {
343 iowrite8(tf->ctl, ioaddr->ctl_addr);
344 iowrite8(tf->device, ioaddr->device_addr);
345 ap->last_ctl = tf->ctl;
346 ata_wait_idle(ap);
347 }
348
349 if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
350 iowrite8(tf->hob_feature, ioaddr->feature_addr);
351 iowrite8(tf->hob_nsect, ioaddr->nsect_addr);
352 iowrite8(tf->hob_lbal, ioaddr->lbal_addr);
353 iowrite8(tf->hob_lbam, ioaddr->lbam_addr);
354 iowrite8(tf->hob_lbah, ioaddr->lbah_addr);
355 VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
356 tf->hob_feature,
357 tf->hob_nsect,
358 tf->hob_lbal,
359 tf->hob_lbam,
360 tf->hob_lbah);
361 }
362 340
363 if (is_addr) { 341 if (ap->ctl != ap->last_ctl && !(tf->flags & ATA_TFLAG_DEVICE)) {
364 iowrite8(tf->feature, ioaddr->feature_addr); 342 tmp_tf = *tf;
365 iowrite8(tf->nsect, ioaddr->nsect_addr); 343 tmp_tf.flags |= ATA_TFLAG_DEVICE;
366 iowrite8(tf->lbal, ioaddr->lbal_addr); 344 tf = &tmp_tf;
367 iowrite8(tf->lbam, ioaddr->lbam_addr);
368 iowrite8(tf->lbah, ioaddr->lbah_addr);
369 VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
370 tf->feature,
371 tf->nsect,
372 tf->lbal,
373 tf->lbam,
374 tf->lbah);
375 } 345 }
376 346 ata_sff_tf_load(ap, tf);
377 if (tf->flags & ATA_TFLAG_DEVICE) {
378 iowrite8(tf->device, ioaddr->device_addr);
379 VPRINTK("device 0x%X\n", tf->device);
380 }
381
382 ata_wait_idle(ap);
383} 347}
384 348
385static struct scsi_host_template via_sht = { 349static struct scsi_host_template via_sht = {
@@ -392,13 +356,12 @@ static struct ata_port_operations via_port_ops = {
392 .set_piomode = via_set_piomode, 356 .set_piomode = via_set_piomode,
393 .set_dmamode = via_set_dmamode, 357 .set_dmamode = via_set_dmamode,
394 .prereset = via_pre_reset, 358 .prereset = via_pre_reset,
395 .sff_tf_load = via_ata_tf_load, 359 .sff_tf_load = via_tf_load,
396}; 360};
397 361
398static struct ata_port_operations via_port_ops_noirq = { 362static struct ata_port_operations via_port_ops_noirq = {
399 .inherits = &via_port_ops, 363 .inherits = &via_port_ops,
400 .sff_data_xfer = ata_sff_data_xfer_noirq, 364 .sff_data_xfer = ata_sff_data_xfer_noirq,
401 .sff_tf_load = via_ata_tf_load,
402}; 365};
403 366
404/** 367/**
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index ad169ffbc4c..13c1d2af18a 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1134,30 +1134,16 @@ static int mv_qc_defer(struct ata_queued_cmd *qc)
1134 if (ap->nr_active_links == 0) 1134 if (ap->nr_active_links == 0)
1135 return 0; 1135 return 0;
1136 1136
1137 if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) { 1137 /*
1138 /* 1138 * The port is operating in host queuing mode (EDMA) with NCQ
1139 * The port is operating in host queuing mode (EDMA). 1139 * enabled, allow multiple NCQ commands. EDMA also allows
1140 * It can accomodate a new qc if the qc protocol 1140 * queueing multiple DMA commands but libata core currently
1141 * is compatible with the current host queue mode. 1141 * doesn't allow it.
1142 */ 1142 */
1143 if (pp->pp_flags & MV_PP_FLAG_NCQ_EN) { 1143 if ((pp->pp_flags & MV_PP_FLAG_EDMA_EN) &&
1144 /* 1144 (pp->pp_flags & MV_PP_FLAG_NCQ_EN) && ata_is_ncq(qc->tf.protocol))
1145 * The host queue (EDMA) is in NCQ mode. 1145 return 0;
1146 * If the new qc is also an NCQ command, 1146
1147 * then allow the new qc.
1148 */
1149 if (qc->tf.protocol == ATA_PROT_NCQ)
1150 return 0;
1151 } else {
1152 /*
1153 * The host queue (EDMA) is in non-NCQ, DMA mode.
1154 * If the new qc is also a non-NCQ, DMA command,
1155 * then allow the new qc.
1156 */
1157 if (qc->tf.protocol == ATA_PROT_DMA)
1158 return 0;
1159 }
1160 }
1161 return ATA_DEFER_PORT; 1147 return ATA_DEFER_PORT;
1162} 1148}
1163 1149
@@ -3036,7 +3022,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3036 break; 3022 break;
3037 case chip_soc: 3023 case chip_soc:
3038 hpriv->ops = &mv_soc_ops; 3024 hpriv->ops = &mv_soc_ops;
3039 hp_flags |= MV_HP_FLAG_SOC | MV_HP_ERRATA_60X1C0; 3025 hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE |
3026 MV_HP_ERRATA_60X1C0;
3040 break; 3027 break;
3041 3028
3042 default: 3029 default:
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 5667c2f02c5..cc5e28c8885 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -295,6 +295,12 @@ int class_for_each_device(struct class *class, struct device *start,
295 295
296 if (!class) 296 if (!class)
297 return -EINVAL; 297 return -EINVAL;
298 if (!class->p) {
299 WARN(1, "%s called for class '%s' before it was initialized",
300 __func__, class->name);
301 return -EINVAL;
302 }
303
298 mutex_lock(&class->p->class_mutex); 304 mutex_lock(&class->p->class_mutex);
299 list_for_each_entry(dev, &class->p->class_devices, node) { 305 list_for_each_entry(dev, &class->p->class_devices, node) {
300 if (start) { 306 if (start) {
@@ -344,6 +350,11 @@ struct device *class_find_device(struct class *class, struct device *start,
344 350
345 if (!class) 351 if (!class)
346 return NULL; 352 return NULL;
353 if (!class->p) {
354 WARN(1, "%s called for class '%s' before it was initialized",
355 __func__, class->name);
356 return NULL;
357 }
347 358
348 mutex_lock(&class->p->class_mutex); 359 mutex_lock(&class->p->class_mutex);
349 list_for_each_entry(dev, &class->p->class_devices, node) { 360 list_for_each_entry(dev, &class->p->class_devices, node) {
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 068aa1c9538..d021c98605b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -53,7 +53,7 @@ static inline int device_is_not_partition(struct device *dev)
53 * it is attached to. If it is not attached to a bus either, an empty 53 * it is attached to. If it is not attached to a bus either, an empty
54 * string will be returned. 54 * string will be returned.
55 */ 55 */
56const char *dev_driver_string(struct device *dev) 56const char *dev_driver_string(const struct device *dev)
57{ 57{
58 return dev->driver ? dev->driver->name : 58 return dev->driver ? dev->driver->name :
59 (dev->bus ? dev->bus->name : 59 (dev->bus ? dev->bus->name :
@@ -541,6 +541,7 @@ void device_initialize(struct device *dev)
541 spin_lock_init(&dev->devres_lock); 541 spin_lock_init(&dev->devres_lock);
542 INIT_LIST_HEAD(&dev->devres_head); 542 INIT_LIST_HEAD(&dev->devres_head);
543 device_init_wakeup(dev, 0); 543 device_init_wakeup(dev, 0);
544 device_pm_init(dev);
544 set_dev_node(dev, -1); 545 set_dev_node(dev, -1);
545} 546}
546 547
@@ -843,13 +844,19 @@ int device_add(struct device *dev)
843{ 844{
844 struct device *parent = NULL; 845 struct device *parent = NULL;
845 struct class_interface *class_intf; 846 struct class_interface *class_intf;
846 int error; 847 int error = -EINVAL;
847 848
848 dev = get_device(dev); 849 dev = get_device(dev);
849 if (!dev || !strlen(dev->bus_id)) { 850 if (!dev)
850 error = -EINVAL; 851 goto done;
851 goto Done; 852
852 } 853 /* Temporarily support init_name if it is set.
854 * It will override bus_id for now */
855 if (dev->init_name)
856 dev_set_name(dev, "%s", dev->init_name);
857
858 if (!strlen(dev->bus_id))
859 goto done;
853 860
854 pr_debug("device: '%s': %s\n", dev->bus_id, __func__); 861 pr_debug("device: '%s': %s\n", dev->bus_id, __func__);
855 862
@@ -897,9 +904,10 @@ int device_add(struct device *dev)
897 error = bus_add_device(dev); 904 error = bus_add_device(dev);
898 if (error) 905 if (error)
899 goto BusError; 906 goto BusError;
900 error = device_pm_add(dev); 907 error = dpm_sysfs_add(dev);
901 if (error) 908 if (error)
902 goto PMError; 909 goto DPMError;
910 device_pm_add(dev);
903 kobject_uevent(&dev->kobj, KOBJ_ADD); 911 kobject_uevent(&dev->kobj, KOBJ_ADD);
904 bus_attach_device(dev); 912 bus_attach_device(dev);
905 if (parent) 913 if (parent)
@@ -917,10 +925,10 @@ int device_add(struct device *dev)
917 class_intf->add_dev(dev, class_intf); 925 class_intf->add_dev(dev, class_intf);
918 mutex_unlock(&dev->class->p->class_mutex); 926 mutex_unlock(&dev->class->p->class_mutex);
919 } 927 }
920 Done: 928done:
921 put_device(dev); 929 put_device(dev);
922 return error; 930 return error;
923 PMError: 931 DPMError:
924 bus_remove_device(dev); 932 bus_remove_device(dev);
925 BusError: 933 BusError:
926 if (dev->bus) 934 if (dev->bus)
@@ -944,7 +952,7 @@ int device_add(struct device *dev)
944 cleanup_device_parent(dev); 952 cleanup_device_parent(dev);
945 if (parent) 953 if (parent)
946 put_device(parent); 954 put_device(parent);
947 goto Done; 955 goto done;
948} 956}
949 957
950/** 958/**
@@ -1007,6 +1015,7 @@ void device_del(struct device *dev)
1007 struct class_interface *class_intf; 1015 struct class_interface *class_intf;
1008 1016
1009 device_pm_remove(dev); 1017 device_pm_remove(dev);
1018 dpm_sysfs_remove(dev);
1010 if (parent) 1019 if (parent)
1011 klist_del(&dev->knode_parent); 1020 klist_del(&dev->knode_parent);
1012 if (MAJOR(dev->devt)) { 1021 if (MAJOR(dev->devt)) {
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 2ef5acf4368..1e2bda780e4 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -16,9 +16,6 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include "base.h" 17#include "base.h"
18 18
19#define to_dev(node) container_of(node, struct device, driver_list)
20
21
22static struct device *next_device(struct klist_iter *i) 19static struct device *next_device(struct klist_iter *i)
23{ 20{
24 struct klist_node *n = klist_next(i); 21 struct klist_node *n = klist_next(i);
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 3250c5257b7..273a944d404 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -67,20 +67,16 @@ void device_pm_unlock(void)
67 * device_pm_add - add a device to the list of active devices 67 * device_pm_add - add a device to the list of active devices
68 * @dev: Device to be added to the list 68 * @dev: Device to be added to the list
69 */ 69 */
70int device_pm_add(struct device *dev) 70void device_pm_add(struct device *dev)
71{ 71{
72 int error;
73
74 pr_debug("PM: Adding info for %s:%s\n", 72 pr_debug("PM: Adding info for %s:%s\n",
75 dev->bus ? dev->bus->name : "No Bus", 73 dev->bus ? dev->bus->name : "No Bus",
76 kobject_name(&dev->kobj)); 74 kobject_name(&dev->kobj));
77 mutex_lock(&dpm_list_mtx); 75 mutex_lock(&dpm_list_mtx);
78 if (dev->parent) { 76 if (dev->parent) {
79 if (dev->parent->power.status >= DPM_SUSPENDING) { 77 if (dev->parent->power.status >= DPM_SUSPENDING)
80 dev_warn(dev, "parent %s is sleeping, will not add\n", 78 dev_warn(dev, "parent %s should not be sleeping\n",
81 dev->parent->bus_id); 79 dev->parent->bus_id);
82 WARN_ON(true);
83 }
84 } else if (transition_started) { 80 } else if (transition_started) {
85 /* 81 /*
86 * We refuse to register parentless devices while a PM 82 * We refuse to register parentless devices while a PM
@@ -89,13 +85,9 @@ int device_pm_add(struct device *dev)
89 */ 85 */
90 WARN_ON(true); 86 WARN_ON(true);
91 } 87 }
92 error = dpm_sysfs_add(dev); 88
93 if (!error) { 89 list_add_tail(&dev->power.entry, &dpm_list);
94 dev->power.status = DPM_ON;
95 list_add_tail(&dev->power.entry, &dpm_list);
96 }
97 mutex_unlock(&dpm_list_mtx); 90 mutex_unlock(&dpm_list_mtx);
98 return error;
99} 91}
100 92
101/** 93/**
@@ -110,7 +102,6 @@ void device_pm_remove(struct device *dev)
110 dev->bus ? dev->bus->name : "No Bus", 102 dev->bus ? dev->bus->name : "No Bus",
111 kobject_name(&dev->kobj)); 103 kobject_name(&dev->kobj));
112 mutex_lock(&dpm_list_mtx); 104 mutex_lock(&dpm_list_mtx);
113 dpm_sysfs_remove(dev);
114 list_del_init(&dev->power.entry); 105 list_del_init(&dev->power.entry);
115 mutex_unlock(&dpm_list_mtx); 106 mutex_unlock(&dpm_list_mtx);
116} 107}
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index a3252c0e288..41f51fae042 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -1,3 +1,8 @@
1static inline void device_pm_init(struct device *dev)
2{
3 dev->power.status = DPM_ON;
4}
5
1#ifdef CONFIG_PM_SLEEP 6#ifdef CONFIG_PM_SLEEP
2 7
3/* 8/*
@@ -11,12 +16,12 @@ static inline struct device *to_device(struct list_head *entry)
11 return container_of(entry, struct device, power.entry); 16 return container_of(entry, struct device, power.entry);
12} 17}
13 18
14extern int device_pm_add(struct device *); 19extern void device_pm_add(struct device *);
15extern void device_pm_remove(struct device *); 20extern void device_pm_remove(struct device *);
16 21
17#else /* CONFIG_PM_SLEEP */ 22#else /* CONFIG_PM_SLEEP */
18 23
19static inline int device_pm_add(struct device *dev) { return 0; } 24static inline void device_pm_add(struct device *dev) {}
20static inline void device_pm_remove(struct device *dev) {} 25static inline void device_pm_remove(struct device *dev) {}
21 26
22#endif 27#endif
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 24b97b0bef9..d070d492e38 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -571,8 +571,8 @@ out_free:
571 list_del(&brd->brd_list); 571 list_del(&brd->brd_list);
572 brd_free(brd); 572 brd_free(brd);
573 } 573 }
574 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
574 575
575 unregister_blkdev(RAMDISK_MAJOR, "brd");
576 return -ENOMEM; 576 return -ENOMEM;
577} 577}
578 578
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ad98dda6037..1778e4a2c67 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -707,15 +707,15 @@ static int __init nbd_init(void)
707 707
708 BUILD_BUG_ON(sizeof(struct nbd_request) != 28); 708 BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
709 709
710 nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
711 if (!nbd_dev)
712 return -ENOMEM;
713
714 if (max_part < 0) { 710 if (max_part < 0) {
715 printk(KERN_CRIT "nbd: max_part must be >= 0\n"); 711 printk(KERN_CRIT "nbd: max_part must be >= 0\n");
716 return -EINVAL; 712 return -EINVAL;
717 } 713 }
718 714
715 nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
716 if (!nbd_dev)
717 return -ENOMEM;
718
719 part_shift = 0; 719 part_shift = 0;
720 if (max_part > 0) 720 if (max_part > 0)
721 part_shift = fls(max_part); 721 part_shift = fls(max_part);
@@ -779,6 +779,7 @@ out:
779 blk_cleanup_queue(nbd_dev[i].disk->queue); 779 blk_cleanup_queue(nbd_dev[i].disk->queue);
780 put_disk(nbd_dev[i].disk); 780 put_disk(nbd_dev[i].disk);
781 } 781 }
782 kfree(nbd_dev);
782 return err; 783 return err;
783} 784}
784 785
@@ -795,6 +796,7 @@ static void __exit nbd_cleanup(void)
795 } 796 }
796 } 797 }
797 unregister_blkdev(NBD_MAJOR, "nbd"); 798 unregister_blkdev(NBD_MAJOR, "nbd");
799 kfree(nbd_dev);
798 printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); 800 printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR);
799} 801}
800 802
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index f52931e1c16..8e8afb6141f 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2695,15 +2695,13 @@ static __devinit void default_find_bmc(void)
2695 for (i = 0; ; i++) { 2695 for (i = 0; ; i++) {
2696 if (!ipmi_defaults[i].port) 2696 if (!ipmi_defaults[i].port)
2697 break; 2697 break;
2698
2699 info = kzalloc(sizeof(*info), GFP_KERNEL);
2700 if (!info)
2701 return;
2702
2703#ifdef CONFIG_PPC_MERGE 2698#ifdef CONFIG_PPC_MERGE
2704 if (check_legacy_ioport(ipmi_defaults[i].port)) 2699 if (check_legacy_ioport(ipmi_defaults[i].port))
2705 continue; 2700 continue;
2706#endif 2701#endif
2702 info = kzalloc(sizeof(*info), GFP_KERNEL);
2703 if (!info)
2704 return;
2707 2705
2708 info->addr_source = NULL; 2706 info->addr_source = NULL;
2709 2707
diff --git a/drivers/infiniband/hw/ipath/ipath_iba7220.c b/drivers/infiniband/hw/ipath/ipath_iba7220.c
index d90f5e9a54f..9839e20119b 100644
--- a/drivers/infiniband/hw/ipath/ipath_iba7220.c
+++ b/drivers/infiniband/hw/ipath/ipath_iba7220.c
@@ -1720,7 +1720,7 @@ static void ipath_7220_put_tid(struct ipath_devdata *dd, u64 __iomem *tidptr,
1720 "not 2KB aligned!\n", pa); 1720 "not 2KB aligned!\n", pa);
1721 return; 1721 return;
1722 } 1722 }
1723 if (pa >= (1UL << IBA7220_TID_SZ_SHIFT)) { 1723 if (chippa >= (1UL << IBA7220_TID_SZ_SHIFT)) {
1724 ipath_dev_err(dd, 1724 ipath_dev_err(dd,
1725 "BUG: Physical page address 0x%lx " 1725 "BUG: Physical page address 0x%lx "
1726 "larger than supported\n", pa); 1726 "larger than supported\n", pa);
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 36aa242c487..729446f56aa 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -267,6 +267,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
267 u16 lrh0; 267 u16 lrh0;
268 u16 lid; 268 u16 lid;
269 int ret = 0; 269 int ret = 0;
270 int next_cur;
270 271
271 spin_lock_irqsave(&qp->s_lock, flags); 272 spin_lock_irqsave(&qp->s_lock, flags);
272 273
@@ -290,8 +291,9 @@ int ipath_make_ud_req(struct ipath_qp *qp)
290 goto bail; 291 goto bail;
291 292
292 wqe = get_swqe_ptr(qp, qp->s_cur); 293 wqe = get_swqe_ptr(qp, qp->s_cur);
293 if (++qp->s_cur >= qp->s_size) 294 next_cur = qp->s_cur + 1;
294 qp->s_cur = 0; 295 if (next_cur >= qp->s_size)
296 next_cur = 0;
295 297
296 /* Construct the header. */ 298 /* Construct the header. */
297 ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr; 299 ah_attr = &to_iah(wqe->wr.wr.ud.ah)->attr;
@@ -315,6 +317,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
315 qp->s_flags |= IPATH_S_WAIT_DMA; 317 qp->s_flags |= IPATH_S_WAIT_DMA;
316 goto bail; 318 goto bail;
317 } 319 }
320 qp->s_cur = next_cur;
318 spin_unlock_irqrestore(&qp->s_lock, flags); 321 spin_unlock_irqrestore(&qp->s_lock, flags);
319 ipath_ud_loopback(qp, wqe); 322 ipath_ud_loopback(qp, wqe);
320 spin_lock_irqsave(&qp->s_lock, flags); 323 spin_lock_irqsave(&qp->s_lock, flags);
@@ -323,6 +326,7 @@ int ipath_make_ud_req(struct ipath_qp *qp)
323 } 326 }
324 } 327 }
325 328
329 qp->s_cur = next_cur;
326 extra_bytes = -wqe->length & 3; 330 extra_bytes = -wqe->length & 3;
327 nwords = (wqe->length + extra_bytes) >> 2; 331 nwords = (wqe->length + extra_bytes) >> 2;
328 332
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f51201b17bf..7e9e218738f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -156,14 +156,8 @@ static int ipoib_stop(struct net_device *dev)
156 156
157 netif_stop_queue(dev); 157 netif_stop_queue(dev);
158 158
159 /* 159 ipoib_ib_dev_down(dev, 0);
160 * Now flush workqueue to make sure a scheduled task doesn't 160 ipoib_ib_dev_stop(dev, 0);
161 * bring our internal state back up.
162 */
163 flush_workqueue(ipoib_workqueue);
164
165 ipoib_ib_dev_down(dev, 1);
166 ipoib_ib_dev_stop(dev, 1);
167 161
168 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { 162 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
169 struct ipoib_dev_priv *cpriv; 163 struct ipoib_dev_priv *cpriv;
@@ -1314,7 +1308,7 @@ sysfs_failed:
1314 1308
1315register_failed: 1309register_failed:
1316 ib_unregister_event_handler(&priv->event_handler); 1310 ib_unregister_event_handler(&priv->event_handler);
1317 flush_scheduled_work(); 1311 flush_workqueue(ipoib_workqueue);
1318 1312
1319event_failed: 1313event_failed:
1320 ipoib_dev_cleanup(priv->dev); 1314 ipoib_dev_cleanup(priv->dev);
@@ -1373,7 +1367,12 @@ static void ipoib_remove_one(struct ib_device *device)
1373 1367
1374 list_for_each_entry_safe(priv, tmp, dev_list, list) { 1368 list_for_each_entry_safe(priv, tmp, dev_list, list) {
1375 ib_unregister_event_handler(&priv->event_handler); 1369 ib_unregister_event_handler(&priv->event_handler);
1376 flush_scheduled_work(); 1370
1371 rtnl_lock();
1372 dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP);
1373 rtnl_unlock();
1374
1375 flush_workqueue(ipoib_workqueue);
1377 1376
1378 unregister_netdev(priv->dev); 1377 unregister_netdev(priv->dev);
1379 ipoib_dev_cleanup(priv->dev); 1378 ipoib_dev_cleanup(priv->dev);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 8950e9546f4..ac33c8f3ea8 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -392,8 +392,16 @@ static int ipoib_mcast_join_complete(int status,
392 &priv->mcast_task, 0); 392 &priv->mcast_task, 0);
393 mutex_unlock(&mcast_mutex); 393 mutex_unlock(&mcast_mutex);
394 394
395 if (mcast == priv->broadcast) 395 if (mcast == priv->broadcast) {
396 /*
397 * Take RTNL lock here to avoid racing with
398 * ipoib_stop() and turning the carrier back
399 * on while a device is being removed.
400 */
401 rtnl_lock();
396 netif_carrier_on(dev); 402 netif_carrier_on(dev);
403 rtnl_unlock();
404 }
397 405
398 return 0; 406 return 0;
399 } 407 }
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index 9e8d79e7e9f..facdb9893c8 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -553,9 +553,9 @@ static void eeepc_hwmon_exit(void)
553 hwmon = eeepc_hwmon_device; 553 hwmon = eeepc_hwmon_device;
554 if (!hwmon) 554 if (!hwmon)
555 return ; 555 return ;
556 hwmon_device_unregister(hwmon);
557 sysfs_remove_group(&hwmon->kobj, 556 sysfs_remove_group(&hwmon->kobj,
558 &hwmon_attribute_group); 557 &hwmon_attribute_group);
558 hwmon_device_unregister(hwmon);
559 eeepc_hwmon_device = NULL; 559 eeepc_hwmon_device = NULL;
560} 560}
561 561
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 90ab7382540..9a9755c92fa 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -561,7 +561,7 @@ config RTC_DRV_AT91SAM9_GPBR
561 561
562config RTC_DRV_BFIN 562config RTC_DRV_BFIN
563 tristate "Blackfin On-Chip RTC" 563 tristate "Blackfin On-Chip RTC"
564 depends on BLACKFIN 564 depends on BLACKFIN && !BF561
565 help 565 help
566 If you say yes here you will get support for the 566 If you say yes here you will get support for the
567 Blackfin On-Chip Real Time Clock. 567 Blackfin On-Chip Real Time Clock.
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index a1af4c27939..34439ce3967 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -218,26 +218,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
218 return IRQ_NONE; 218 return IRQ_NONE;
219} 219}
220 220
221static int bfin_rtc_open(struct device *dev)
222{
223 int ret;
224
225 dev_dbg_stamp(dev);
226
227 ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, to_platform_device(dev)->name, dev);
228 if (!ret)
229 bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
230
231 return ret;
232}
233
234static void bfin_rtc_release(struct device *dev)
235{
236 dev_dbg_stamp(dev);
237 bfin_rtc_reset(dev, 0);
238 free_irq(IRQ_RTC, dev);
239}
240
241static void bfin_rtc_int_set(u16 rtc_int) 221static void bfin_rtc_int_set(u16 rtc_int)
242{ 222{
243 bfin_write_RTC_ISTAT(rtc_int); 223 bfin_write_RTC_ISTAT(rtc_int);
@@ -370,8 +350,6 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
370} 350}
371 351
372static struct rtc_class_ops bfin_rtc_ops = { 352static struct rtc_class_ops bfin_rtc_ops = {
373 .open = bfin_rtc_open,
374 .release = bfin_rtc_release,
375 .ioctl = bfin_rtc_ioctl, 353 .ioctl = bfin_rtc_ioctl,
376 .read_time = bfin_rtc_read_time, 354 .read_time = bfin_rtc_read_time,
377 .set_time = bfin_rtc_set_time, 355 .set_time = bfin_rtc_set_time,
@@ -383,29 +361,44 @@ static struct rtc_class_ops bfin_rtc_ops = {
383static int __devinit bfin_rtc_probe(struct platform_device *pdev) 361static int __devinit bfin_rtc_probe(struct platform_device *pdev)
384{ 362{
385 struct bfin_rtc *rtc; 363 struct bfin_rtc *rtc;
364 struct device *dev = &pdev->dev;
386 int ret = 0; 365 int ret = 0;
366 unsigned long timeout;
387 367
388 dev_dbg_stamp(&pdev->dev); 368 dev_dbg_stamp(dev);
389 369
370 /* Allocate memory for our RTC struct */
390 rtc = kzalloc(sizeof(*rtc), GFP_KERNEL); 371 rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
391 if (unlikely(!rtc)) 372 if (unlikely(!rtc))
392 return -ENOMEM; 373 return -ENOMEM;
374 platform_set_drvdata(pdev, rtc);
375 device_init_wakeup(dev, 1);
393 376
394 rtc->rtc_dev = rtc_device_register(pdev->name, &pdev->dev, &bfin_rtc_ops, THIS_MODULE); 377 /* Grab the IRQ and init the hardware */
395 if (IS_ERR(rtc)) { 378 ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_SHARED, pdev->name, dev);
396 ret = PTR_ERR(rtc->rtc_dev); 379 if (unlikely(ret))
397 goto err; 380 goto err;
398 } 381 /* sometimes the bootloader touched things, but the write complete was not
399 382 * enabled, so let's just do a quick timeout here since the IRQ will not fire ...
400 /* see comment at top of file about stopwatch/PIE */ 383 */
384 timeout = jiffies + HZ;
385 while (bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING)
386 if (time_after(jiffies, timeout))
387 break;
388 bfin_rtc_reset(dev, RTC_ISTAT_WRITE_COMPLETE);
401 bfin_write_RTC_SWCNT(0); 389 bfin_write_RTC_SWCNT(0);
402 390
403 platform_set_drvdata(pdev, rtc); 391 /* Register our RTC with the RTC framework */
404 392 rtc->rtc_dev = rtc_device_register(pdev->name, dev, &bfin_rtc_ops, THIS_MODULE);
405 device_init_wakeup(&pdev->dev, 1); 393 if (unlikely(IS_ERR(rtc))) {
394 ret = PTR_ERR(rtc->rtc_dev);
395 goto err_irq;
396 }
406 397
407 return 0; 398 return 0;
408 399
400 err_irq:
401 free_irq(IRQ_RTC, dev);
409 err: 402 err:
410 kfree(rtc); 403 kfree(rtc);
411 return ret; 404 return ret;
@@ -414,7 +407,10 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
414static int __devexit bfin_rtc_remove(struct platform_device *pdev) 407static int __devexit bfin_rtc_remove(struct platform_device *pdev)
415{ 408{
416 struct bfin_rtc *rtc = platform_get_drvdata(pdev); 409 struct bfin_rtc *rtc = platform_get_drvdata(pdev);
410 struct device *dev = &pdev->dev;
417 411
412 bfin_rtc_reset(dev, 0);
413 free_irq(IRQ_RTC, dev);
418 rtc_device_unregister(rtc->rtc_dev); 414 rtc_device_unregister(rtc->rtc_dev);
419 platform_set_drvdata(pdev, NULL); 415 platform_set_drvdata(pdev, NULL);
420 kfree(rtc); 416 kfree(rtc);
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 35dcc06eb3e..f118252f3a9 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -403,11 +403,14 @@ static long rtc_dev_ioctl(struct file *file,
403 403
404#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 404#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
405 case RTC_UIE_OFF: 405 case RTC_UIE_OFF:
406 mutex_unlock(&rtc->ops_lock);
406 clear_uie(rtc); 407 clear_uie(rtc);
407 break; 408 return 0;
408 409
409 case RTC_UIE_ON: 410 case RTC_UIE_ON:
411 mutex_unlock(&rtc->ops_lock);
410 err = set_uie(rtc); 412 err = set_uie(rtc);
413 return err;
411#endif 414#endif
412 default: 415 default:
413 err = -ENOTTY; 416 err = -ENOTTY;
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 640acd20fdd..a150418fba7 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -173,7 +173,7 @@ static int ds1374_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
173 int cr, sr; 173 int cr, sr;
174 int ret = 0; 174 int ret = 0;
175 175
176 if (client->irq < 0) 176 if (client->irq <= 0)
177 return -EINVAL; 177 return -EINVAL;
178 178
179 mutex_lock(&ds1374->mutex); 179 mutex_lock(&ds1374->mutex);
@@ -212,7 +212,7 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
212 int cr; 212 int cr;
213 int ret = 0; 213 int ret = 0;
214 214
215 if (client->irq < 0) 215 if (client->irq <= 0)
216 return -EINVAL; 216 return -EINVAL;
217 217
218 ret = ds1374_read_time(dev, &now); 218 ret = ds1374_read_time(dev, &now);
@@ -381,7 +381,7 @@ static int ds1374_probe(struct i2c_client *client,
381 if (ret) 381 if (ret)
382 goto out_free; 382 goto out_free;
383 383
384 if (client->irq >= 0) { 384 if (client->irq > 0) {
385 ret = request_irq(client->irq, ds1374_irq, 0, 385 ret = request_irq(client->irq, ds1374_irq, 0,
386 "ds1374", client); 386 "ds1374", client);
387 if (ret) { 387 if (ret) {
@@ -401,7 +401,7 @@ static int ds1374_probe(struct i2c_client *client,
401 return 0; 401 return 0;
402 402
403out_irq: 403out_irq:
404 if (client->irq >= 0) 404 if (client->irq > 0)
405 free_irq(client->irq, client); 405 free_irq(client->irq, client);
406 406
407out_free: 407out_free:
@@ -414,7 +414,7 @@ static int __devexit ds1374_remove(struct i2c_client *client)
414{ 414{
415 struct ds1374 *ds1374 = i2c_get_clientdata(client); 415 struct ds1374 *ds1374 = i2c_get_clientdata(client);
416 416
417 if (client->irq >= 0) { 417 if (client->irq > 0) {
418 mutex_lock(&ds1374->mutex); 418 mutex_lock(&ds1374->mutex);
419 ds1374->exiting = 1; 419 ds1374->exiting = 1;
420 mutex_unlock(&ds1374->mutex); 420 mutex_unlock(&ds1374->mutex);
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 1b6c52ef733..acb78017e7d 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -2333,13 +2333,11 @@ int dasd_generic_notify(struct ccw_device *cdev, int event)
2333{ 2333{
2334 struct dasd_device *device; 2334 struct dasd_device *device;
2335 struct dasd_ccw_req *cqr; 2335 struct dasd_ccw_req *cqr;
2336 unsigned long flags;
2337 int ret; 2336 int ret;
2338 2337
2339 device = dasd_device_from_cdev(cdev); 2338 device = dasd_device_from_cdev_locked(cdev);
2340 if (IS_ERR(device)) 2339 if (IS_ERR(device))
2341 return 0; 2340 return 0;
2342 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
2343 ret = 0; 2341 ret = 0;
2344 switch (event) { 2342 switch (event) {
2345 case CIO_GONE: 2343 case CIO_GONE:
@@ -2369,7 +2367,6 @@ int dasd_generic_notify(struct ccw_device *cdev, int event)
2369 ret = 1; 2367 ret = 1;
2370 break; 2368 break;
2371 } 2369 }
2372 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
2373 dasd_put_device(device); 2370 dasd_put_device(device);
2374 return ret; 2371 return ret;
2375} 2372}
diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h
index 4bf0aa5112c..2476f87d21d 100644
--- a/drivers/s390/block/dasd_eckd.h
+++ b/drivers/s390/block/dasd_eckd.h
@@ -308,7 +308,7 @@ struct dasd_psf_prssd_data {
308 unsigned char flags; 308 unsigned char flags;
309 unsigned char reserved[4]; 309 unsigned char reserved[4];
310 unsigned char suborder; 310 unsigned char suborder;
311 unsigned char varies[9]; 311 unsigned char varies[5];
312} __attribute__ ((packed)); 312} __attribute__ ((packed));
313 313
314/* 314/*
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index 29da4413ad4..bf512ac75b9 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -16,6 +16,7 @@
16#include <linux/poll.h> 16#include <linux/poll.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
19#include <linux/err.h>
19 20
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include <asm/atomic.h> 22#include <asm/atomic.h>
@@ -457,7 +458,7 @@ int dasd_eer_enable(struct dasd_device *device)
457 458
458 cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */, 459 cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */,
459 SNSS_DATA_SIZE, device); 460 SNSS_DATA_SIZE, device);
460 if (!cqr) 461 if (IS_ERR(cqr))
461 return -ENOMEM; 462 return -ENOMEM;
462 463
463 cqr->startdev = device; 464 cqr->startdev = device;
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 01fcdd91b84..db85f1fb131 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -384,6 +384,10 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
384 * get minor, add to list 384 * get minor, add to list
385 */ 385 */
386 down_write(&dcssblk_devices_sem); 386 down_write(&dcssblk_devices_sem);
387 if (dcssblk_get_segment_by_name(local_buf)) {
388 rc = -EEXIST;
389 goto release_gd;
390 }
387 rc = dcssblk_assign_free_minor(dev_info); 391 rc = dcssblk_assign_free_minor(dev_info);
388 if (rc) { 392 if (rc) {
389 up_write(&dcssblk_devices_sem); 393 up_write(&dcssblk_devices_sem);
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
index 687720b552d..be0ce2215c8 100644
--- a/drivers/s390/char/tape_char.c
+++ b/drivers/s390/char/tape_char.c
@@ -109,7 +109,7 @@ tapechar_check_idalbuffer(struct tape_device *device, size_t block_size)
109 109
110 /* The current idal buffer is not correct. Allocate a new one. */ 110 /* The current idal buffer is not correct. Allocate a new one. */
111 new = idal_buffer_alloc(block_size, 0); 111 new = idal_buffer_alloc(block_size, 0);
112 if (new == NULL) 112 if (IS_ERR(new))
113 return -ENOMEM; 113 return -ENOMEM;
114 114
115 if (device->char_data.idal_buf != NULL) 115 if (device->char_data.idal_buf != NULL)
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 2a1af4e60be..cc8fd781ee2 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -248,7 +248,7 @@ tape_std_mtsetblk(struct tape_device *device, int count)
248 248
249 /* Allocate a new idal buffer. */ 249 /* Allocate a new idal buffer. */
250 new = idal_buffer_alloc(count, 0); 250 new = idal_buffer_alloc(count, 0);
251 if (new == NULL) 251 if (IS_ERR(new))
252 return -ENOMEM; 252 return -ENOMEM;
253 if (device->char_data.idal_buf != NULL) 253 if (device->char_data.idal_buf != NULL)
254 idal_buffer_free(device->char_data.idal_buf); 254 idal_buffer_free(device->char_data.idal_buf);
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 26a930e832b..e0ce65fca4e 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -112,8 +112,10 @@ ccwgroup_release (struct device *dev)
112 gdev = to_ccwgroupdev(dev); 112 gdev = to_ccwgroupdev(dev);
113 113
114 for (i = 0; i < gdev->count; i++) { 114 for (i = 0; i < gdev->count; i++) {
115 dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 115 if (gdev->cdev[i]) {
116 put_device(&gdev->cdev[i]->dev); 116 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
117 put_device(&gdev->cdev[i]->dev);
118 }
117 } 119 }
118 kfree(gdev); 120 kfree(gdev);
119} 121}
@@ -221,6 +223,13 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
221 atomic_set(&gdev->onoff, 0); 223 atomic_set(&gdev->onoff, 0);
222 mutex_init(&gdev->reg_mutex); 224 mutex_init(&gdev->reg_mutex);
223 mutex_lock(&gdev->reg_mutex); 225 mutex_lock(&gdev->reg_mutex);
226 gdev->creator_id = creator_id;
227 gdev->count = num_devices;
228 gdev->dev.bus = &ccwgroup_bus_type;
229 gdev->dev.parent = root;
230 gdev->dev.release = ccwgroup_release;
231 device_initialize(&gdev->dev);
232
224 curr_buf = buf; 233 curr_buf = buf;
225 for (i = 0; i < num_devices && curr_buf; i++) { 234 for (i = 0; i < num_devices && curr_buf; i++) {
226 rc = __get_next_bus_id(&curr_buf, tmp_bus_id); 235 rc = __get_next_bus_id(&curr_buf, tmp_bus_id);
@@ -258,16 +267,11 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id,
258 rc = -EINVAL; 267 rc = -EINVAL;
259 goto error; 268 goto error;
260 } 269 }
261 gdev->creator_id = creator_id;
262 gdev->count = num_devices;
263 gdev->dev.bus = &ccwgroup_bus_type;
264 gdev->dev.parent = root;
265 gdev->dev.release = ccwgroup_release;
266 270
267 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", 271 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s",
268 gdev->cdev[0]->dev.bus_id); 272 gdev->cdev[0]->dev.bus_id);
269 273
270 rc = device_register(&gdev->dev); 274 rc = device_add(&gdev->dev);
271 if (rc) 275 if (rc)
272 goto error; 276 goto error;
273 get_device(&gdev->dev); 277 get_device(&gdev->dev);
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 46c021d880d..51489eff6b0 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -477,7 +477,6 @@ void css_schedule_eval_all(void)
477 477
478void css_wait_for_slow_path(void) 478void css_wait_for_slow_path(void)
479{ 479{
480 flush_workqueue(ccw_device_notify_work);
481 flush_workqueue(slow_path_wq); 480 flush_workqueue(slow_path_wq);
482} 481}
483 482
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index e818d0c54c0..28221030b88 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -150,7 +150,6 @@ static struct css_driver io_subchannel_driver = {
150}; 150};
151 151
152struct workqueue_struct *ccw_device_work; 152struct workqueue_struct *ccw_device_work;
153struct workqueue_struct *ccw_device_notify_work;
154wait_queue_head_t ccw_device_init_wq; 153wait_queue_head_t ccw_device_init_wq;
155atomic_t ccw_device_init_count; 154atomic_t ccw_device_init_count;
156 155
@@ -168,11 +167,6 @@ init_ccw_bus_type (void)
168 ccw_device_work = create_singlethread_workqueue("cio"); 167 ccw_device_work = create_singlethread_workqueue("cio");
169 if (!ccw_device_work) 168 if (!ccw_device_work)
170 return -ENOMEM; /* FIXME: better errno ? */ 169 return -ENOMEM; /* FIXME: better errno ? */
171 ccw_device_notify_work = create_singlethread_workqueue("cio_notify");
172 if (!ccw_device_notify_work) {
173 ret = -ENOMEM; /* FIXME: better errno ? */
174 goto out_err;
175 }
176 slow_path_wq = create_singlethread_workqueue("kslowcrw"); 170 slow_path_wq = create_singlethread_workqueue("kslowcrw");
177 if (!slow_path_wq) { 171 if (!slow_path_wq) {
178 ret = -ENOMEM; /* FIXME: better errno ? */ 172 ret = -ENOMEM; /* FIXME: better errno ? */
@@ -192,8 +186,6 @@ init_ccw_bus_type (void)
192out_err: 186out_err:
193 if (ccw_device_work) 187 if (ccw_device_work)
194 destroy_workqueue(ccw_device_work); 188 destroy_workqueue(ccw_device_work);
195 if (ccw_device_notify_work)
196 destroy_workqueue(ccw_device_notify_work);
197 if (slow_path_wq) 189 if (slow_path_wq)
198 destroy_workqueue(slow_path_wq); 190 destroy_workqueue(slow_path_wq);
199 return ret; 191 return ret;
@@ -204,7 +196,6 @@ cleanup_ccw_bus_type (void)
204{ 196{
205 css_driver_unregister(&io_subchannel_driver); 197 css_driver_unregister(&io_subchannel_driver);
206 bus_unregister(&ccw_bus_type); 198 bus_unregister(&ccw_bus_type);
207 destroy_workqueue(ccw_device_notify_work);
208 destroy_workqueue(ccw_device_work); 199 destroy_workqueue(ccw_device_work);
209} 200}
210 201
@@ -1496,11 +1487,22 @@ static void device_set_disconnected(struct ccw_device *cdev)
1496 ccw_device_schedule_recovery(); 1487 ccw_device_schedule_recovery();
1497} 1488}
1498 1489
1490void ccw_device_set_notoper(struct ccw_device *cdev)
1491{
1492 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1493
1494 CIO_TRACE_EVENT(2, "notoper");
1495 CIO_TRACE_EVENT(2, sch->dev.bus_id);
1496 ccw_device_set_timeout(cdev, 0);
1497 cio_disable_subchannel(sch);
1498 cdev->private->state = DEV_STATE_NOT_OPER;
1499}
1500
1499static int io_subchannel_sch_event(struct subchannel *sch, int slow) 1501static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1500{ 1502{
1501 int event, ret, disc; 1503 int event, ret, disc;
1502 unsigned long flags; 1504 unsigned long flags;
1503 enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE } action; 1505 enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE, DISC } action;
1504 struct ccw_device *cdev; 1506 struct ccw_device *cdev;
1505 1507
1506 spin_lock_irqsave(sch->lock, flags); 1508 spin_lock_irqsave(sch->lock, flags);
@@ -1535,16 +1537,11 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1535 } 1537 }
1536 /* fall through */ 1538 /* fall through */
1537 case CIO_GONE: 1539 case CIO_GONE:
1538 /* Prevent unwanted effects when opening lock. */
1539 cio_disable_subchannel(sch);
1540 device_set_disconnected(cdev);
1541 /* Ask driver what to do with device. */ 1540 /* Ask driver what to do with device. */
1542 action = UNREGISTER; 1541 if (io_subchannel_notify(sch, event))
1543 spin_unlock_irqrestore(sch->lock, flags); 1542 action = DISC;
1544 ret = io_subchannel_notify(sch, event); 1543 else
1545 spin_lock_irqsave(sch->lock, flags); 1544 action = UNREGISTER;
1546 if (ret)
1547 action = NONE;
1548 break; 1545 break;
1549 case CIO_REVALIDATE: 1546 case CIO_REVALIDATE:
1550 /* Device will be removed, so no notify necessary. */ 1547 /* Device will be removed, so no notify necessary. */
@@ -1565,6 +1562,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1565 switch (action) { 1562 switch (action) {
1566 case UNREGISTER: 1563 case UNREGISTER:
1567 case UNREGISTER_PROBE: 1564 case UNREGISTER_PROBE:
1565 ccw_device_set_notoper(cdev);
1568 /* Unregister device (will use subchannel lock). */ 1566 /* Unregister device (will use subchannel lock). */
1569 spin_unlock_irqrestore(sch->lock, flags); 1567 spin_unlock_irqrestore(sch->lock, flags);
1570 css_sch_device_unregister(sch); 1568 css_sch_device_unregister(sch);
@@ -1577,6 +1575,9 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow)
1577 case REPROBE: 1575 case REPROBE:
1578 ccw_device_trigger_reprobe(cdev); 1576 ccw_device_trigger_reprobe(cdev);
1579 break; 1577 break;
1578 case DISC:
1579 device_set_disconnected(cdev);
1580 break;
1580 default: 1581 default:
1581 break; 1582 break;
1582 } 1583 }
@@ -1828,5 +1829,4 @@ EXPORT_SYMBOL(ccw_driver_unregister);
1828EXPORT_SYMBOL(get_ccwdev_by_busid); 1829EXPORT_SYMBOL(get_ccwdev_by_busid);
1829EXPORT_SYMBOL(ccw_bus_type); 1830EXPORT_SYMBOL(ccw_bus_type);
1830EXPORT_SYMBOL(ccw_device_work); 1831EXPORT_SYMBOL(ccw_device_work);
1831EXPORT_SYMBOL(ccw_device_notify_work);
1832EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id); 1832EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id);
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h
index 9800a8335a3..6f5c3f2b358 100644
--- a/drivers/s390/cio/device.h
+++ b/drivers/s390/cio/device.h
@@ -72,7 +72,6 @@ dev_fsm_final_state(struct ccw_device *cdev)
72} 72}
73 73
74extern struct workqueue_struct *ccw_device_work; 74extern struct workqueue_struct *ccw_device_work;
75extern struct workqueue_struct *ccw_device_notify_work;
76extern wait_queue_head_t ccw_device_init_wq; 75extern wait_queue_head_t ccw_device_init_wq;
77extern atomic_t ccw_device_init_count; 76extern atomic_t ccw_device_init_count;
78 77
@@ -120,6 +119,7 @@ int ccw_device_stlck(struct ccw_device *);
120void ccw_device_trigger_reprobe(struct ccw_device *); 119void ccw_device_trigger_reprobe(struct ccw_device *);
121void ccw_device_kill_io(struct ccw_device *); 120void ccw_device_kill_io(struct ccw_device *);
122int ccw_device_notify(struct ccw_device *, int); 121int ccw_device_notify(struct ccw_device *, int);
122void ccw_device_set_notoper(struct ccw_device *cdev);
123 123
124/* qdio needs this. */ 124/* qdio needs this. */
125void ccw_device_set_timeout(struct ccw_device *, int); 125void ccw_device_set_timeout(struct ccw_device *, int);
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 8b5fe57fb2f..550508df952 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -337,26 +337,34 @@ int ccw_device_notify(struct ccw_device *cdev, int event)
337 return 0; 337 return 0;
338 if (!cdev->online) 338 if (!cdev->online)
339 return 0; 339 return 0;
340 CIO_MSG_EVENT(2, "notify called for 0.%x.%04x, event=%d\n",
341 cdev->private->dev_id.ssid, cdev->private->dev_id.devno,
342 event);
340 return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0; 343 return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0;
341} 344}
342 345
343static void 346static void cmf_reenable_delayed(struct work_struct *work)
344ccw_device_oper_notify(struct work_struct *work)
345{ 347{
346 struct ccw_device_private *priv; 348 struct ccw_device_private *priv;
347 struct ccw_device *cdev; 349 struct ccw_device *cdev;
348 int ret;
349 350
350 priv = container_of(work, struct ccw_device_private, kick_work); 351 priv = container_of(work, struct ccw_device_private, kick_work);
351 cdev = priv->cdev; 352 cdev = priv->cdev;
352 ret = ccw_device_notify(cdev, CIO_OPER); 353 cmf_reenable(cdev);
353 if (ret) { 354}
355
356static void ccw_device_oper_notify(struct ccw_device *cdev)
357{
358 if (ccw_device_notify(cdev, CIO_OPER)) {
354 /* Reenable channel measurements, if needed. */ 359 /* Reenable channel measurements, if needed. */
355 cmf_reenable(cdev); 360 PREPARE_WORK(&cdev->private->kick_work, cmf_reenable_delayed);
356 wake_up(&cdev->private->wait_q); 361 queue_work(ccw_device_work, &cdev->private->kick_work);
357 } else 362 return;
358 /* Driver doesn't want device back. */ 363 }
359 ccw_device_do_unreg_rereg(work); 364 /* Driver doesn't want device back. */
365 ccw_device_set_notoper(cdev);
366 PREPARE_WORK(&cdev->private->kick_work, ccw_device_do_unreg_rereg);
367 queue_work(ccw_device_work, &cdev->private->kick_work);
360} 368}
361 369
362/* 370/*
@@ -386,8 +394,7 @@ ccw_device_done(struct ccw_device *cdev, int state)
386 394
387 if (cdev->private->flags.donotify) { 395 if (cdev->private->flags.donotify) {
388 cdev->private->flags.donotify = 0; 396 cdev->private->flags.donotify = 0;
389 PREPARE_WORK(&cdev->private->kick_work, ccw_device_oper_notify); 397 ccw_device_oper_notify(cdev);
390 queue_work(ccw_device_notify_work, &cdev->private->kick_work);
391 } 398 }
392 wake_up(&cdev->private->wait_q); 399 wake_up(&cdev->private->wait_q);
393 400
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h
index 8484b83698e..5a4d85b829a 100644
--- a/drivers/s390/cio/qdio_debug.h
+++ b/drivers/s390/cio/qdio_debug.h
@@ -61,18 +61,18 @@
61 61
62/* s390dbf views */ 62/* s390dbf views */
63#define QDIO_DBF_SETUP_LEN 8 63#define QDIO_DBF_SETUP_LEN 8
64#define QDIO_DBF_SETUP_PAGES 4 64#define QDIO_DBF_SETUP_PAGES 8
65#define QDIO_DBF_SETUP_NR_AREAS 1 65#define QDIO_DBF_SETUP_NR_AREAS 1
66 66
67#define QDIO_DBF_TRACE_LEN 8 67#define QDIO_DBF_TRACE_LEN 8
68#define QDIO_DBF_TRACE_NR_AREAS 2 68#define QDIO_DBF_TRACE_NR_AREAS 2
69 69
70#ifdef CONFIG_QDIO_DEBUG 70#ifdef CONFIG_QDIO_DEBUG
71#define QDIO_DBF_TRACE_PAGES 16 71#define QDIO_DBF_TRACE_PAGES 32
72#define QDIO_DBF_SETUP_LEVEL 6 72#define QDIO_DBF_SETUP_LEVEL 6
73#define QDIO_DBF_TRACE_LEVEL 4 73#define QDIO_DBF_TRACE_LEVEL 4
74#else /* !CONFIG_QDIO_DEBUG */ 74#else /* !CONFIG_QDIO_DEBUG */
75#define QDIO_DBF_TRACE_PAGES 4 75#define QDIO_DBF_TRACE_PAGES 8
76#define QDIO_DBF_SETUP_LEVEL 2 76#define QDIO_DBF_SETUP_LEVEL 2
77#define QDIO_DBF_TRACE_LEVEL 2 77#define QDIO_DBF_TRACE_LEVEL 2
78#endif /* CONFIG_QDIO_DEBUG */ 78#endif /* CONFIG_QDIO_DEBUG */
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index d15648514a0..e6eabc85342 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -330,6 +330,7 @@ static int qdio_siga_output(struct qdio_q *q)
330 int cc; 330 int cc;
331 u32 busy_bit; 331 u32 busy_bit;
332 u64 start_time = 0; 332 u64 start_time = 0;
333 char dbf_text[15];
333 334
334 QDIO_DBF_TEXT5(0, trace, "sigaout"); 335 QDIO_DBF_TEXT5(0, trace, "sigaout");
335 QDIO_DBF_HEX5(0, trace, &q, sizeof(void *)); 336 QDIO_DBF_HEX5(0, trace, &q, sizeof(void *));
@@ -338,6 +339,9 @@ static int qdio_siga_output(struct qdio_q *q)
338again: 339again:
339 cc = qdio_do_siga_output(q, &busy_bit); 340 cc = qdio_do_siga_output(q, &busy_bit);
340 if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) { 341 if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) {
342 sprintf(dbf_text, "bb%4x%2x", q->irq_ptr->schid.sch_no, q->nr);
343 QDIO_DBF_TEXT3(0, trace, dbf_text);
344
341 if (!start_time) 345 if (!start_time)
342 start_time = get_usecs(); 346 start_time = get_usecs();
343 else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE) 347 else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE)
@@ -748,16 +752,18 @@ static void qdio_kick_outbound_q(struct qdio_q *q)
748 rc = qdio_siga_output(q); 752 rc = qdio_siga_output(q);
749 switch (rc) { 753 switch (rc) {
750 case 0: 754 case 0:
751 /* went smooth this time, reset timestamp */
752 q->u.out.timestamp = 0;
753
754 /* TODO: improve error handling for CC=0 case */ 755 /* TODO: improve error handling for CC=0 case */
755#ifdef CONFIG_QDIO_DEBUG 756#ifdef CONFIG_QDIO_DEBUG
756 QDIO_DBF_TEXT3(0, trace, "cc2reslv"); 757 if (q->u.out.timestamp) {
757 sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no, q->nr, 758 QDIO_DBF_TEXT3(0, trace, "cc2reslv");
758 atomic_read(&q->u.out.busy_siga_counter)); 759 sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no,
759 QDIO_DBF_TEXT3(0, trace, dbf_text); 760 q->nr,
761 atomic_read(&q->u.out.busy_siga_counter));
762 QDIO_DBF_TEXT3(0, trace, dbf_text);
763 }
760#endif /* CONFIG_QDIO_DEBUG */ 764#endif /* CONFIG_QDIO_DEBUG */
765 /* went smooth this time, reset timestamp */
766 q->u.out.timestamp = 0;
761 break; 767 break;
762 /* cc=2 and busy bit */ 768 /* cc=2 and busy bit */
763 case (2 | QDIO_ERROR_SIGA_BUSY): 769 case (2 | QDIO_ERROR_SIGA_BUSY):
@@ -1066,14 +1072,12 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
1066 if (IS_ERR(irb)) { 1072 if (IS_ERR(irb)) {
1067 switch (PTR_ERR(irb)) { 1073 switch (PTR_ERR(irb)) {
1068 case -EIO: 1074 case -EIO:
1069 sprintf(dbf_text, "ierr%4x", 1075 sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no);
1070 cdev->private->schid.sch_no);
1071 QDIO_DBF_TEXT2(1, setup, dbf_text); 1076 QDIO_DBF_TEXT2(1, setup, dbf_text);
1072 qdio_int_error(cdev); 1077 qdio_int_error(cdev);
1073 return; 1078 return;
1074 case -ETIMEDOUT: 1079 case -ETIMEDOUT:
1075 sprintf(dbf_text, "qtoh%4x", 1080 sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no);
1076 cdev->private->schid.sch_no);
1077 QDIO_DBF_TEXT2(1, setup, dbf_text); 1081 QDIO_DBF_TEXT2(1, setup, dbf_text);
1078 qdio_int_error(cdev); 1082 qdio_int_error(cdev);
1079 return; 1083 return;
@@ -1124,8 +1128,10 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
1124struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev) 1128struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev)
1125{ 1129{
1126 struct qdio_irq *irq_ptr; 1130 struct qdio_irq *irq_ptr;
1131 char dbf_text[15];
1127 1132
1128 QDIO_DBF_TEXT0(0, setup, "getssqd"); 1133 sprintf(dbf_text, "qssq%4x", cdev->private->schid.sch_no);
1134 QDIO_DBF_TEXT0(0, setup, dbf_text);
1129 1135
1130 irq_ptr = cdev->private->qdio_data; 1136 irq_ptr = cdev->private->qdio_data;
1131 if (!irq_ptr) 1137 if (!irq_ptr)
@@ -1149,14 +1155,13 @@ int qdio_cleanup(struct ccw_device *cdev, int how)
1149 char dbf_text[15]; 1155 char dbf_text[15];
1150 int rc; 1156 int rc;
1151 1157
1158 sprintf(dbf_text, "qcln%4x", cdev->private->schid.sch_no);
1159 QDIO_DBF_TEXT0(0, setup, dbf_text);
1160
1152 irq_ptr = cdev->private->qdio_data; 1161 irq_ptr = cdev->private->qdio_data;
1153 if (!irq_ptr) 1162 if (!irq_ptr)
1154 return -ENODEV; 1163 return -ENODEV;
1155 1164
1156 sprintf(dbf_text, "qcln%4x", irq_ptr->schid.sch_no);
1157 QDIO_DBF_TEXT1(0, trace, dbf_text);
1158 QDIO_DBF_TEXT0(0, setup, dbf_text);
1159
1160 rc = qdio_shutdown(cdev, how); 1165 rc = qdio_shutdown(cdev, how);
1161 if (rc == 0) 1166 if (rc == 0)
1162 rc = qdio_free(cdev); 1167 rc = qdio_free(cdev);
@@ -1191,6 +1196,9 @@ int qdio_shutdown(struct ccw_device *cdev, int how)
1191 unsigned long flags; 1196 unsigned long flags;
1192 char dbf_text[15]; 1197 char dbf_text[15];
1193 1198
1199 sprintf(dbf_text, "qshu%4x", cdev->private->schid.sch_no);
1200 QDIO_DBF_TEXT0(0, setup, dbf_text);
1201
1194 irq_ptr = cdev->private->qdio_data; 1202 irq_ptr = cdev->private->qdio_data;
1195 if (!irq_ptr) 1203 if (!irq_ptr)
1196 return -ENODEV; 1204 return -ENODEV;
@@ -1205,10 +1213,6 @@ int qdio_shutdown(struct ccw_device *cdev, int how)
1205 return 0; 1213 return 0;
1206 } 1214 }
1207 1215
1208 sprintf(dbf_text, "qsqs%4x", irq_ptr->schid.sch_no);
1209 QDIO_DBF_TEXT1(0, trace, dbf_text);
1210 QDIO_DBF_TEXT0(0, setup, dbf_text);
1211
1212 tiqdio_remove_input_queues(irq_ptr); 1216 tiqdio_remove_input_queues(irq_ptr);
1213 qdio_shutdown_queues(cdev); 1217 qdio_shutdown_queues(cdev);
1214 qdio_shutdown_debug_entries(irq_ptr, cdev); 1218 qdio_shutdown_debug_entries(irq_ptr, cdev);
@@ -1247,7 +1251,6 @@ no_cleanup:
1247 1251
1248 qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); 1252 qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
1249 mutex_unlock(&irq_ptr->setup_mutex); 1253 mutex_unlock(&irq_ptr->setup_mutex);
1250 module_put(THIS_MODULE);
1251 if (rc) 1254 if (rc)
1252 return rc; 1255 return rc;
1253 return 0; 1256 return 0;
@@ -1263,16 +1266,14 @@ int qdio_free(struct ccw_device *cdev)
1263 struct qdio_irq *irq_ptr; 1266 struct qdio_irq *irq_ptr;
1264 char dbf_text[15]; 1267 char dbf_text[15];
1265 1268
1269 sprintf(dbf_text, "qfre%4x", cdev->private->schid.sch_no);
1270 QDIO_DBF_TEXT0(0, setup, dbf_text);
1271
1266 irq_ptr = cdev->private->qdio_data; 1272 irq_ptr = cdev->private->qdio_data;
1267 if (!irq_ptr) 1273 if (!irq_ptr)
1268 return -ENODEV; 1274 return -ENODEV;
1269 1275
1270 mutex_lock(&irq_ptr->setup_mutex); 1276 mutex_lock(&irq_ptr->setup_mutex);
1271
1272 sprintf(dbf_text, "qfqs%4x", irq_ptr->schid.sch_no);
1273 QDIO_DBF_TEXT1(0, trace, dbf_text);
1274 QDIO_DBF_TEXT0(0, setup, dbf_text);
1275
1276 cdev->private->qdio_data = NULL; 1277 cdev->private->qdio_data = NULL;
1277 mutex_unlock(&irq_ptr->setup_mutex); 1278 mutex_unlock(&irq_ptr->setup_mutex);
1278 1279
@@ -1295,7 +1296,6 @@ int qdio_initialize(struct qdio_initialize *init_data)
1295 1296
1296 sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no); 1297 sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no);
1297 QDIO_DBF_TEXT0(0, setup, dbf_text); 1298 QDIO_DBF_TEXT0(0, setup, dbf_text);
1298 QDIO_DBF_TEXT0(0, trace, dbf_text);
1299 1299
1300 rc = qdio_allocate(init_data); 1300 rc = qdio_allocate(init_data);
1301 if (rc) 1301 if (rc)
@@ -1319,7 +1319,6 @@ int qdio_allocate(struct qdio_initialize *init_data)
1319 1319
1320 sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no); 1320 sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no);
1321 QDIO_DBF_TEXT0(0, setup, dbf_text); 1321 QDIO_DBF_TEXT0(0, setup, dbf_text);
1322 QDIO_DBF_TEXT0(0, trace, dbf_text);
1323 1322
1324 if ((init_data->no_input_qs && !init_data->input_handler) || 1323 if ((init_data->no_input_qs && !init_data->input_handler) ||
1325 (init_data->no_output_qs && !init_data->output_handler)) 1324 (init_data->no_output_qs && !init_data->output_handler))
@@ -1389,6 +1388,9 @@ int qdio_establish(struct qdio_initialize *init_data)
1389 unsigned long saveflags; 1388 unsigned long saveflags;
1390 int rc; 1389 int rc;
1391 1390
1391 sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no);
1392 QDIO_DBF_TEXT0(0, setup, dbf_text);
1393
1392 irq_ptr = cdev->private->qdio_data; 1394 irq_ptr = cdev->private->qdio_data;
1393 if (!irq_ptr) 1395 if (!irq_ptr)
1394 return -ENODEV; 1396 return -ENODEV;
@@ -1396,13 +1398,6 @@ int qdio_establish(struct qdio_initialize *init_data)
1396 if (cdev->private->state != DEV_STATE_ONLINE) 1398 if (cdev->private->state != DEV_STATE_ONLINE)
1397 return -EINVAL; 1399 return -EINVAL;
1398 1400
1399 if (!try_module_get(THIS_MODULE))
1400 return -EINVAL;
1401
1402 sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no);
1403 QDIO_DBF_TEXT0(0, setup, dbf_text);
1404 QDIO_DBF_TEXT0(0, trace, dbf_text);
1405
1406 mutex_lock(&irq_ptr->setup_mutex); 1401 mutex_lock(&irq_ptr->setup_mutex);
1407 qdio_setup_irq(init_data); 1402 qdio_setup_irq(init_data);
1408 1403
@@ -1472,6 +1467,9 @@ int qdio_activate(struct ccw_device *cdev)
1472 unsigned long saveflags; 1467 unsigned long saveflags;
1473 char dbf_text[20]; 1468 char dbf_text[20];
1474 1469
1470 sprintf(dbf_text, "qact%4x", cdev->private->schid.sch_no);
1471 QDIO_DBF_TEXT0(0, setup, dbf_text);
1472
1475 irq_ptr = cdev->private->qdio_data; 1473 irq_ptr = cdev->private->qdio_data;
1476 if (!irq_ptr) 1474 if (!irq_ptr)
1477 return -ENODEV; 1475 return -ENODEV;
@@ -1485,10 +1483,6 @@ int qdio_activate(struct ccw_device *cdev)
1485 goto out; 1483 goto out;
1486 } 1484 }
1487 1485
1488 sprintf(dbf_text, "qact%4x", irq_ptr->schid.sch_no);
1489 QDIO_DBF_TEXT2(0, setup, dbf_text);
1490 QDIO_DBF_TEXT2(0, trace, dbf_text);
1491
1492 irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd; 1486 irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd;
1493 irq_ptr->ccw.flags = CCW_FLAG_SLI; 1487 irq_ptr->ccw.flags = CCW_FLAG_SLI;
1494 irq_ptr->ccw.count = irq_ptr->aqueue.count; 1488 irq_ptr->ccw.count = irq_ptr->aqueue.count;
@@ -1663,7 +1657,7 @@ int do_QDIO(struct ccw_device *cdev, unsigned int callflags,
1663#ifdef CONFIG_QDIO_DEBUG 1657#ifdef CONFIG_QDIO_DEBUG
1664 char dbf_text[20]; 1658 char dbf_text[20];
1665 1659
1666 sprintf(dbf_text, "doQD%04x", cdev->private->schid.sch_no); 1660 sprintf(dbf_text, "doQD%4x", cdev->private->schid.sch_no);
1667 QDIO_DBF_TEXT3(0, trace, dbf_text); 1661 QDIO_DBF_TEXT3(0, trace, dbf_text);
1668#endif /* CONFIG_QDIO_DEBUG */ 1662#endif /* CONFIG_QDIO_DEBUG */
1669 1663
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index 1bd2a208db2..1679e2f91c9 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -165,7 +165,7 @@ static void setup_queues(struct qdio_irq *irq_ptr,
165 void **output_sbal_array = qdio_init->output_sbal_addr_array; 165 void **output_sbal_array = qdio_init->output_sbal_addr_array;
166 int i; 166 int i;
167 167
168 sprintf(dbf_text, "qfqs%4x", qdio_init->cdev->private->schid.sch_no); 168 sprintf(dbf_text, "qset%4x", qdio_init->cdev->private->schid.sch_no);
169 QDIO_DBF_TEXT0(0, setup, dbf_text); 169 QDIO_DBF_TEXT0(0, setup, dbf_text);
170 170
171 for_each_input_queue(irq_ptr, q, i) { 171 for_each_input_queue(irq_ptr, q, i) {
@@ -285,7 +285,7 @@ void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr)
285 rc = __get_ssqd_info(irq_ptr); 285 rc = __get_ssqd_info(irq_ptr);
286 if (rc) { 286 if (rc) {
287 QDIO_DBF_TEXT2(0, setup, "ssqdasig"); 287 QDIO_DBF_TEXT2(0, setup, "ssqdasig");
288 sprintf(dbf_text, "schno%x", irq_ptr->schid.sch_no); 288 sprintf(dbf_text, "schn%4x", irq_ptr->schid.sch_no);
289 QDIO_DBF_TEXT2(0, setup, dbf_text); 289 QDIO_DBF_TEXT2(0, setup, dbf_text);
290 sprintf(dbf_text, "rc:%d", rc); 290 sprintf(dbf_text, "rc:%d", rc);
291 QDIO_DBF_TEXT2(0, setup, dbf_text); 291 QDIO_DBF_TEXT2(0, setup, dbf_text);
@@ -447,7 +447,7 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
447{ 447{
448 char s[80]; 448 char s[80];
449 449
450 sprintf(s, "%s ", cdev->dev.bus_id); 450 sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no);
451 451
452 switch (irq_ptr->qib.qfmt) { 452 switch (irq_ptr->qib.qfmt) {
453 case QDIO_QETH_QFMT: 453 case QDIO_QETH_QFMT:
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index 9291a771d81..ea7f6140026 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -113,7 +113,11 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr)
113 struct qdio_q *q; 113 struct qdio_q *q;
114 int i; 114 int i;
115 115
116 for_each_input_queue(irq_ptr, q, i) { 116 for (i = 0; i < irq_ptr->nr_input_qs; i++) {
117 q = irq_ptr->input_qs[i];
118 /* if establish triggered an error */
119 if (!q || !q->entry.prev || !q->entry.next)
120 continue;
117 list_del_rcu(&q->entry); 121 list_del_rcu(&q->entry);
118 synchronize_rcu(); 122 synchronize_rcu();
119 } 123 }
diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig
index 2e9079df26b..4190be64917 100644
--- a/drivers/uio/Kconfig
+++ b/drivers/uio/Kconfig
@@ -33,6 +33,19 @@ config UIO_PDRV
33 33
34 If you don't know what to do here, say N. 34 If you don't know what to do here, say N.
35 35
36config UIO_PDRV_GENIRQ
37 tristate "Userspace I/O platform driver with generic IRQ handling"
38 help
39 Platform driver for Userspace I/O devices, including generic
40 interrupt handling code. Shared interrupts are not supported.
41
42 This kernel driver requires that the matching userspace driver
43 handles interrupts in a special way. Userspace is responsible
44 for acknowledging the hardware device if needed, and re-enabling
45 interrupts in the interrupt controller using the write() syscall.
46
47 If you don't know what to do here, say N.
48
36config UIO_SMX 49config UIO_SMX
37 tristate "SMX cryptengine UIO interface" 50 tristate "SMX cryptengine UIO interface"
38 default n 51 default n
diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile
index e00ce0def1a..8667bbdef90 100644
--- a/drivers/uio/Makefile
+++ b/drivers/uio/Makefile
@@ -1,4 +1,5 @@
1obj-$(CONFIG_UIO) += uio.o 1obj-$(CONFIG_UIO) += uio.o
2obj-$(CONFIG_UIO_CIF) += uio_cif.o 2obj-$(CONFIG_UIO_CIF) += uio_cif.o
3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o 3obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o
4obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o
4obj-$(CONFIG_UIO_SMX) += uio_smx.o 5obj-$(CONFIG_UIO_SMX) += uio_smx.o
diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c
index 5d0d2e85d98..0b4ef39cd85 100644
--- a/drivers/uio/uio_pdrv.c
+++ b/drivers/uio/uio_pdrv.c
@@ -88,6 +88,8 @@ static int uio_pdrv_remove(struct platform_device *pdev)
88 88
89 uio_unregister_device(pdata->uioinfo); 89 uio_unregister_device(pdata->uioinfo);
90 90
91 kfree(pdata);
92
91 return 0; 93 return 0;
92} 94}
93 95
@@ -114,5 +116,5 @@ module_exit(uio_pdrv_exit);
114 116
115MODULE_AUTHOR("Uwe Kleine-Koenig"); 117MODULE_AUTHOR("Uwe Kleine-Koenig");
116MODULE_DESCRIPTION("Userspace I/O platform driver"); 118MODULE_DESCRIPTION("Userspace I/O platform driver");
117MODULE_LICENSE("GPL"); 119MODULE_LICENSE("GPL v2");
118MODULE_ALIAS("platform:" DRIVER_NAME); 120MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c
new file mode 100644
index 00000000000..1f82c83a92a
--- /dev/null
+++ b/drivers/uio/uio_pdrv_genirq.c
@@ -0,0 +1,188 @@
1/*
2 * drivers/uio/uio_pdrv_genirq.c
3 *
4 * Userspace I/O platform driver with generic IRQ handling code.
5 *
6 * Copyright (C) 2008 Magnus Damm
7 *
8 * Based on uio_pdrv.c by Uwe Kleine-Koenig,
9 * Copyright (C) 2008 by Digi International Inc.
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published by
14 * the Free Software Foundation.
15 */
16
17#include <linux/platform_device.h>
18#include <linux/uio_driver.h>
19#include <linux/spinlock.h>
20#include <linux/bitops.h>
21#include <linux/interrupt.h>
22#include <linux/stringify.h>
23
24#define DRIVER_NAME "uio_pdrv_genirq"
25
26struct uio_pdrv_genirq_platdata {
27 struct uio_info *uioinfo;
28 spinlock_t lock;
29 unsigned long flags;
30};
31
32static irqreturn_t uio_pdrv_genirq_handler(int irq, struct uio_info *dev_info)
33{
34 struct uio_pdrv_genirq_platdata *priv = dev_info->priv;
35
36 /* Just disable the interrupt in the interrupt controller, and
37 * remember the state so we can allow user space to enable it later.
38 */
39
40 if (!test_and_set_bit(0, &priv->flags))
41 disable_irq_nosync(irq);
42
43 return IRQ_HANDLED;
44}
45
46static int uio_pdrv_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on)
47{
48 struct uio_pdrv_genirq_platdata *priv = dev_info->priv;
49 unsigned long flags;
50
51 /* Allow user space to enable and disable the interrupt
52 * in the interrupt controller, but keep track of the
53 * state to prevent per-irq depth damage.
54 *
55 * Serialize this operation to support multiple tasks.
56 */
57
58 spin_lock_irqsave(&priv->lock, flags);
59 if (irq_on) {
60 if (test_and_clear_bit(0, &priv->flags))
61 enable_irq(dev_info->irq);
62 } else {
63 if (!test_and_set_bit(0, &priv->flags))
64 disable_irq(dev_info->irq);
65 }
66 spin_unlock_irqrestore(&priv->lock, flags);
67
68 return 0;
69}
70
71static int uio_pdrv_genirq_probe(struct platform_device *pdev)
72{
73 struct uio_info *uioinfo = pdev->dev.platform_data;
74 struct uio_pdrv_genirq_platdata *priv;
75 struct uio_mem *uiomem;
76 int ret = -EINVAL;
77 int i;
78
79 if (!uioinfo || !uioinfo->name || !uioinfo->version) {
80 dev_err(&pdev->dev, "missing platform_data\n");
81 goto bad0;
82 }
83
84 if (uioinfo->handler || uioinfo->irqcontrol || uioinfo->irq_flags) {
85 dev_err(&pdev->dev, "interrupt configuration error\n");
86 goto bad0;
87 }
88
89 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
90 if (!priv) {
91 ret = -ENOMEM;
92 dev_err(&pdev->dev, "unable to kmalloc\n");
93 goto bad0;
94 }
95
96 priv->uioinfo = uioinfo;
97 spin_lock_init(&priv->lock);
98 priv->flags = 0; /* interrupt is enabled to begin with */
99
100 uiomem = &uioinfo->mem[0];
101
102 for (i = 0; i < pdev->num_resources; ++i) {
103 struct resource *r = &pdev->resource[i];
104
105 if (r->flags != IORESOURCE_MEM)
106 continue;
107
108 if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) {
109 dev_warn(&pdev->dev, "device has more than "
110 __stringify(MAX_UIO_MAPS)
111 " I/O memory resources.\n");
112 break;
113 }
114
115 uiomem->memtype = UIO_MEM_PHYS;
116 uiomem->addr = r->start;
117 uiomem->size = r->end - r->start + 1;
118 ++uiomem;
119 }
120
121 while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) {
122 uiomem->size = 0;
123 ++uiomem;
124 }
125
126 /* This driver requires no hardware specific kernel code to handle
127 * interrupts. Instead, the interrupt handler simply disables the
128 * interrupt in the interrupt controller. User space is responsible
129 * for performing hardware specific acknowledge and re-enabling of
130 * the interrupt in the interrupt controller.
131 *
132 * Interrupt sharing is not supported.
133 */
134
135 uioinfo->irq_flags = IRQF_DISABLED;
136 uioinfo->handler = uio_pdrv_genirq_handler;
137 uioinfo->irqcontrol = uio_pdrv_genirq_irqcontrol;
138 uioinfo->priv = priv;
139
140 ret = uio_register_device(&pdev->dev, priv->uioinfo);
141 if (ret) {
142 dev_err(&pdev->dev, "unable to register uio device\n");
143 goto bad1;
144 }
145
146 platform_set_drvdata(pdev, priv);
147 return 0;
148 bad1:
149 kfree(priv);
150 bad0:
151 return ret;
152}
153
154static int uio_pdrv_genirq_remove(struct platform_device *pdev)
155{
156 struct uio_pdrv_genirq_platdata *priv = platform_get_drvdata(pdev);
157
158 uio_unregister_device(priv->uioinfo);
159 kfree(priv);
160 return 0;
161}
162
163static struct platform_driver uio_pdrv_genirq = {
164 .probe = uio_pdrv_genirq_probe,
165 .remove = uio_pdrv_genirq_remove,
166 .driver = {
167 .name = DRIVER_NAME,
168 .owner = THIS_MODULE,
169 },
170};
171
172static int __init uio_pdrv_genirq_init(void)
173{
174 return platform_driver_register(&uio_pdrv_genirq);
175}
176
177static void __exit uio_pdrv_genirq_exit(void)
178{
179 platform_driver_unregister(&uio_pdrv_genirq);
180}
181
182module_init(uio_pdrv_genirq_init);
183module_exit(uio_pdrv_genirq_exit);
184
185MODULE_AUTHOR("Magnus Damm");
186MODULE_DESCRIPTION("Userspace I/O platform driver with generic IRQ handling");
187MODULE_LICENSE("GPL v2");
188MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index efc4373eded..c257453fa9d 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -589,8 +589,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
589 tasklet_schedule(&acm->urb_task); 589 tasklet_schedule(&acm->urb_task);
590 590
591done: 591done:
592err_out:
593 mutex_unlock(&acm->mutex); 592 mutex_unlock(&acm->mutex);
593err_out:
594 mutex_unlock(&open_mutex); 594 mutex_unlock(&open_mutex);
595 return rv; 595 return rv;
596 596
@@ -1362,6 +1362,9 @@ static struct usb_device_id acm_ids[] = {
1362 { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ 1362 { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */
1363 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1363 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1364 }, 1364 },
1365 { USB_DEVICE(0x0572, 0x1321), /* Conexant USB MODEM CX93010 */
1366 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
1367 },
1365 1368
1366 /* control interfaces with various AT-command sets */ 1369 /* control interfaces with various AT-command sets */
1367 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 1370 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 2be37fe466f..5a7fa6f0995 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -230,6 +230,13 @@ static int usb_probe_interface(struct device *dev)
230 */ 230 */
231 intf->pm_usage_cnt = !(driver->supports_autosuspend); 231 intf->pm_usage_cnt = !(driver->supports_autosuspend);
232 232
233 /* Carry out a deferred switch to altsetting 0 */
234 if (intf->needs_altsetting0) {
235 usb_set_interface(udev, intf->altsetting[0].
236 desc.bInterfaceNumber, 0);
237 intf->needs_altsetting0 = 0;
238 }
239
233 error = driver->probe(intf, id); 240 error = driver->probe(intf, id);
234 if (error) { 241 if (error) {
235 mark_quiesced(intf); 242 mark_quiesced(intf);
@@ -266,8 +273,17 @@ static int usb_unbind_interface(struct device *dev)
266 273
267 driver->disconnect(intf); 274 driver->disconnect(intf);
268 275
269 /* reset other interface state */ 276 /* Reset other interface state.
270 usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); 277 * We cannot do a Set-Interface if the device is suspended or
278 * if it is prepared for a system sleep (since installing a new
279 * altsetting means creating new endpoint device entries).
280 * When either of these happens, defer the Set-Interface.
281 */
282 if (!error && intf->dev.power.status == DPM_ON)
283 usb_set_interface(udev, intf->altsetting[0].
284 desc.bInterfaceNumber, 0);
285 else
286 intf->needs_altsetting0 = 1;
271 usb_set_intfdata(intf, NULL); 287 usb_set_intfdata(intf, NULL);
272 288
273 intf->condition = USB_INTERFACE_UNBOUND; 289 intf->condition = USB_INTERFACE_UNBOUND;
@@ -798,7 +814,8 @@ void usb_forced_unbind_intf(struct usb_interface *intf)
798 * The caller must hold @intf's device's lock, but not its pm_mutex 814 * The caller must hold @intf's device's lock, but not its pm_mutex
799 * and not @intf->dev.sem. 815 * and not @intf->dev.sem.
800 * 816 *
801 * FIXME: The caller must block system sleep transitions. 817 * Note: Rebinds will be skipped if a system sleep transition is in
818 * progress and the PM "complete" callback hasn't occurred yet.
802 */ 819 */
803void usb_rebind_intf(struct usb_interface *intf) 820void usb_rebind_intf(struct usb_interface *intf)
804{ 821{
@@ -814,10 +831,12 @@ void usb_rebind_intf(struct usb_interface *intf)
814 } 831 }
815 832
816 /* Try to rebind the interface */ 833 /* Try to rebind the interface */
817 intf->needs_binding = 0; 834 if (intf->dev.power.status == DPM_ON) {
818 rc = device_attach(&intf->dev); 835 intf->needs_binding = 0;
819 if (rc < 0) 836 rc = device_attach(&intf->dev);
820 dev_warn(&intf->dev, "rebind failed: %d\n", rc); 837 if (rc < 0)
838 dev_warn(&intf->dev, "rebind failed: %d\n", rc);
839 }
821} 840}
822 841
823#ifdef CONFIG_PM 842#ifdef CONFIG_PM
@@ -829,7 +848,6 @@ void usb_rebind_intf(struct usb_interface *intf)
829 * or rebind interfaces that have been unbound, according to @action. 848 * or rebind interfaces that have been unbound, according to @action.
830 * 849 *
831 * The caller must hold @udev's device lock. 850 * The caller must hold @udev's device lock.
832 * FIXME: For rebinds, the caller must block system sleep transitions.
833 */ 851 */
834static void do_unbind_rebind(struct usb_device *udev, int action) 852static void do_unbind_rebind(struct usb_device *udev, int action)
835{ 853{
@@ -851,22 +869,8 @@ static void do_unbind_rebind(struct usb_device *udev, int action)
851 } 869 }
852 break; 870 break;
853 case DO_REBIND: 871 case DO_REBIND:
854 if (intf->needs_binding) { 872 if (intf->needs_binding)
855
856 /* FIXME: The next line is needed because we are going to probe
857 * the interface, but as far as the PM core is concerned the
858 * interface is still suspended. The problem wouldn't exist
859 * if we could rebind the interface during the interface's own
860 * resume() call, but at the time the usb_device isn't locked!
861 *
862 * The real solution will be to carry this out during the device's
863 * complete() callback. Until that is implemented, we have to
864 * use this hack.
865 */
866// intf->dev.power.sleeping = 0;
867
868 usb_rebind_intf(intf); 873 usb_rebind_intf(intf);
869 }
870 break; 874 break;
871 } 875 }
872 } 876 }
@@ -926,14 +930,14 @@ static int usb_resume_device(struct usb_device *udev)
926} 930}
927 931
928/* Caller has locked intf's usb_device's pm mutex */ 932/* Caller has locked intf's usb_device's pm mutex */
929static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) 933static int usb_suspend_interface(struct usb_device *udev,
934 struct usb_interface *intf, pm_message_t msg)
930{ 935{
931 struct usb_driver *driver; 936 struct usb_driver *driver;
932 int status = 0; 937 int status = 0;
933 938
934 /* with no hardware, USB interfaces only use FREEZE and ON states */ 939 /* with no hardware, USB interfaces only use FREEZE and ON states */
935 if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || 940 if (udev->state == USB_STATE_NOTATTACHED || !is_active(intf))
936 !is_active(intf))
937 goto done; 941 goto done;
938 942
939 if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */ 943 if (intf->condition == USB_INTERFACE_UNBOUND) /* This can't happen */
@@ -944,7 +948,7 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
944 status = driver->suspend(intf, msg); 948 status = driver->suspend(intf, msg);
945 if (status == 0) 949 if (status == 0)
946 mark_quiesced(intf); 950 mark_quiesced(intf);
947 else if (!interface_to_usbdev(intf)->auto_pm) 951 else if (!udev->auto_pm)
948 dev_err(&intf->dev, "%s error %d\n", 952 dev_err(&intf->dev, "%s error %d\n",
949 "suspend", status); 953 "suspend", status);
950 } else { 954 } else {
@@ -961,13 +965,13 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg)
961} 965}
962 966
963/* Caller has locked intf's usb_device's pm_mutex */ 967/* Caller has locked intf's usb_device's pm_mutex */
964static int usb_resume_interface(struct usb_interface *intf, int reset_resume) 968static int usb_resume_interface(struct usb_device *udev,
969 struct usb_interface *intf, int reset_resume)
965{ 970{
966 struct usb_driver *driver; 971 struct usb_driver *driver;
967 int status = 0; 972 int status = 0;
968 973
969 if (interface_to_usbdev(intf)->state == USB_STATE_NOTATTACHED || 974 if (udev->state == USB_STATE_NOTATTACHED || is_active(intf))
970 is_active(intf))
971 goto done; 975 goto done;
972 976
973 /* Don't let autoresume interfere with unbinding */ 977 /* Don't let autoresume interfere with unbinding */
@@ -975,8 +979,17 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume)
975 goto done; 979 goto done;
976 980
977 /* Can't resume it if it doesn't have a driver. */ 981 /* Can't resume it if it doesn't have a driver. */
978 if (intf->condition == USB_INTERFACE_UNBOUND) 982 if (intf->condition == USB_INTERFACE_UNBOUND) {
983
984 /* Carry out a deferred switch to altsetting 0 */
985 if (intf->needs_altsetting0 &&
986 intf->dev.power.status == DPM_ON) {
987 usb_set_interface(udev, intf->altsetting[0].
988 desc.bInterfaceNumber, 0);
989 intf->needs_altsetting0 = 0;
990 }
979 goto done; 991 goto done;
992 }
980 993
981 /* Don't resume if the interface is marked for rebinding */ 994 /* Don't resume if the interface is marked for rebinding */
982 if (intf->needs_binding) 995 if (intf->needs_binding)
@@ -1151,7 +1164,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1151 if (udev->actconfig) { 1164 if (udev->actconfig) {
1152 for (; i < udev->actconfig->desc.bNumInterfaces; i++) { 1165 for (; i < udev->actconfig->desc.bNumInterfaces; i++) {
1153 intf = udev->actconfig->interface[i]; 1166 intf = udev->actconfig->interface[i];
1154 status = usb_suspend_interface(intf, msg); 1167 status = usb_suspend_interface(udev, intf, msg);
1155 if (status != 0) 1168 if (status != 0)
1156 break; 1169 break;
1157 } 1170 }
@@ -1163,7 +1176,7 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
1163 if (status != 0) { 1176 if (status != 0) {
1164 while (--i >= 0) { 1177 while (--i >= 0) {
1165 intf = udev->actconfig->interface[i]; 1178 intf = udev->actconfig->interface[i];
1166 usb_resume_interface(intf, 0); 1179 usb_resume_interface(udev, intf, 0);
1167 } 1180 }
1168 1181
1169 /* Try another autosuspend when the interfaces aren't busy */ 1182 /* Try another autosuspend when the interfaces aren't busy */
@@ -1276,7 +1289,7 @@ static int usb_resume_both(struct usb_device *udev)
1276 if (status == 0 && udev->actconfig) { 1289 if (status == 0 && udev->actconfig) {
1277 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { 1290 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1278 intf = udev->actconfig->interface[i]; 1291 intf = udev->actconfig->interface[i];
1279 usb_resume_interface(intf, udev->reset_resume); 1292 usb_resume_interface(udev, intf, udev->reset_resume);
1280 } 1293 }
1281 } 1294 }
1282 1295
@@ -1605,12 +1618,10 @@ int usb_external_resume_device(struct usb_device *udev)
1605 return status; 1618 return status;
1606} 1619}
1607 1620
1608static int usb_suspend(struct device *dev, pm_message_t message) 1621int usb_suspend(struct device *dev, pm_message_t message)
1609{ 1622{
1610 struct usb_device *udev; 1623 struct usb_device *udev;
1611 1624
1612 if (!is_usb_device(dev)) /* Ignore PM for interfaces */
1613 return 0;
1614 udev = to_usb_device(dev); 1625 udev = to_usb_device(dev);
1615 1626
1616 /* If udev is already suspended, we can skip this suspend and 1627 /* If udev is already suspended, we can skip this suspend and
@@ -1629,12 +1640,10 @@ static int usb_suspend(struct device *dev, pm_message_t message)
1629 return usb_external_suspend_device(udev, message); 1640 return usb_external_suspend_device(udev, message);
1630} 1641}
1631 1642
1632static int usb_resume(struct device *dev) 1643int usb_resume(struct device *dev)
1633{ 1644{
1634 struct usb_device *udev; 1645 struct usb_device *udev;
1635 1646
1636 if (!is_usb_device(dev)) /* Ignore PM for interfaces */
1637 return 0;
1638 udev = to_usb_device(dev); 1647 udev = to_usb_device(dev);
1639 1648
1640 /* If udev->skip_sys_resume is set then udev was already suspended 1649 /* If udev->skip_sys_resume is set then udev was already suspended
@@ -1646,17 +1655,10 @@ static int usb_resume(struct device *dev)
1646 return usb_external_resume_device(udev); 1655 return usb_external_resume_device(udev);
1647} 1656}
1648 1657
1649#else
1650
1651#define usb_suspend NULL
1652#define usb_resume NULL
1653
1654#endif /* CONFIG_PM */ 1658#endif /* CONFIG_PM */
1655 1659
1656struct bus_type usb_bus_type = { 1660struct bus_type usb_bus_type = {
1657 .name = "usb", 1661 .name = "usb",
1658 .match = usb_device_match, 1662 .match = usb_device_match,
1659 .uevent = usb_uevent, 1663 .uevent = usb_uevent,
1660 .suspend = usb_suspend,
1661 .resume = usb_resume,
1662}; 1664};
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index f7bfd72ef11..8abd4e59bf4 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -924,15 +924,6 @@ static int register_root_hub(struct usb_hcd *hcd)
924 return retval; 924 return retval;
925} 925}
926 926
927void usb_enable_root_hub_irq (struct usb_bus *bus)
928{
929 struct usb_hcd *hcd;
930
931 hcd = container_of (bus, struct usb_hcd, self);
932 if (hcd->driver->hub_irq_enable && hcd->state != HC_STATE_HALT)
933 hcd->driver->hub_irq_enable (hcd);
934}
935
936 927
937/*-------------------------------------------------------------------------*/ 928/*-------------------------------------------------------------------------*/
938 929
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 5b0b59b0d89..e710ce04e22 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -212,8 +212,6 @@ struct hc_driver {
212 int (*bus_suspend)(struct usb_hcd *); 212 int (*bus_suspend)(struct usb_hcd *);
213 int (*bus_resume)(struct usb_hcd *); 213 int (*bus_resume)(struct usb_hcd *);
214 int (*start_port_reset)(struct usb_hcd *, unsigned port_num); 214 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
215 void (*hub_irq_enable)(struct usb_hcd *);
216 /* Needed only if port-change IRQs are level-triggered */
217 215
218 /* force handover of high-speed port to full-speed companion */ 216 /* force handover of high-speed port to full-speed companion */
219 void (*relinquish_port)(struct usb_hcd *, int); 217 void (*relinquish_port)(struct usb_hcd *, int);
@@ -379,8 +377,6 @@ extern struct list_head usb_bus_list;
379extern struct mutex usb_bus_list_lock; 377extern struct mutex usb_bus_list_lock;
380extern wait_queue_head_t usb_kill_urb_queue; 378extern wait_queue_head_t usb_kill_urb_queue;
381 379
382extern void usb_enable_root_hub_irq(struct usb_bus *bus);
383
384extern int usb_find_interface_driver(struct usb_device *dev, 380extern int usb_find_interface_driver(struct usb_device *dev,
385 struct usb_interface *interface); 381 struct usb_interface *interface);
386 382
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 107e1d25dde..6a5cb018383 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2102,8 +2102,6 @@ int usb_port_resume(struct usb_device *udev)
2102 } 2102 }
2103 2103
2104 clear_bit(port1, hub->busy_bits); 2104 clear_bit(port1, hub->busy_bits);
2105 if (!hub->hdev->parent && !hub->busy_bits[0])
2106 usb_enable_root_hub_irq(hub->hdev->bus);
2107 2105
2108 status = check_port_resume_type(udev, 2106 status = check_port_resume_type(udev,
2109 hub, port1, status, portchange, portstatus); 2107 hub, port1, status, portchange, portstatus);
@@ -3081,11 +3079,6 @@ static void hub_events(void)
3081 } 3079 }
3082 } 3080 }
3083 3081
3084 /* If this is a root hub, tell the HCD it's okay to
3085 * re-enable port-change interrupts now. */
3086 if (!hdev->parent && !hub->busy_bits[0])
3087 usb_enable_root_hub_irq(hdev->bus);
3088
3089loop_autopm: 3082loop_autopm:
3090 /* Allow autosuspend if we're not going to run again */ 3083 /* Allow autosuspend if we're not going to run again */
3091 if (list_empty(&hub->event_list)) 3084 if (list_empty(&hub->event_list))
@@ -3311,8 +3304,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
3311 break; 3304 break;
3312 } 3305 }
3313 clear_bit(port1, parent_hub->busy_bits); 3306 clear_bit(port1, parent_hub->busy_bits);
3314 if (!parent_hdev->parent && !parent_hub->busy_bits[0])
3315 usb_enable_root_hub_irq(parent_hdev->bus);
3316 3307
3317 if (ret < 0) 3308 if (ret < 0)
3318 goto re_enumerate; 3309 goto re_enumerate;
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c0b1ae25ae2..47111e88f79 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -601,15 +601,20 @@ EXPORT_SYMBOL_GPL(usb_kill_anchored_urbs);
601void usb_unlink_anchored_urbs(struct usb_anchor *anchor) 601void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
602{ 602{
603 struct urb *victim; 603 struct urb *victim;
604 unsigned long flags;
604 605
605 spin_lock_irq(&anchor->lock); 606 spin_lock_irqsave(&anchor->lock, flags);
606 while (!list_empty(&anchor->urb_list)) { 607 while (!list_empty(&anchor->urb_list)) {
607 victim = list_entry(anchor->urb_list.prev, struct urb, 608 victim = list_entry(anchor->urb_list.prev, struct urb,
608 anchor_list); 609 anchor_list);
610 usb_get_urb(victim);
611 spin_unlock_irqrestore(&anchor->lock, flags);
609 /* this will unanchor the URB */ 612 /* this will unanchor the URB */
610 usb_unlink_urb(victim); 613 usb_unlink_urb(victim);
614 usb_put_urb(victim);
615 spin_lock_irqsave(&anchor->lock, flags);
611 } 616 }
612 spin_unlock_irq(&anchor->lock); 617 spin_unlock_irqrestore(&anchor->lock, flags);
613} 618}
614EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs); 619EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs);
615 620
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 84fcaa6a21e..be1fa0723f2 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -219,12 +219,6 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
219} 219}
220#endif /* CONFIG_HOTPLUG */ 220#endif /* CONFIG_HOTPLUG */
221 221
222struct device_type usb_device_type = {
223 .name = "usb_device",
224 .release = usb_release_dev,
225 .uevent = usb_dev_uevent,
226};
227
228#ifdef CONFIG_PM 222#ifdef CONFIG_PM
229 223
230static int ksuspend_usb_init(void) 224static int ksuspend_usb_init(void)
@@ -244,13 +238,80 @@ static void ksuspend_usb_cleanup(void)
244 destroy_workqueue(ksuspend_usb_wq); 238 destroy_workqueue(ksuspend_usb_wq);
245} 239}
246 240
241/* USB device Power-Management thunks.
242 * There's no need to distinguish here between quiescing a USB device
243 * and powering it down; the generic_suspend() routine takes care of
244 * it by skipping the usb_port_suspend() call for a quiesce. And for
245 * USB interfaces there's no difference at all.
246 */
247
248static int usb_dev_prepare(struct device *dev)
249{
250 return 0; /* Implement eventually? */
251}
252
253static void usb_dev_complete(struct device *dev)
254{
255 /* Currently used only for rebinding interfaces */
256 usb_resume(dev); /* Implement eventually? */
257}
258
259static int usb_dev_suspend(struct device *dev)
260{
261 return usb_suspend(dev, PMSG_SUSPEND);
262}
263
264static int usb_dev_resume(struct device *dev)
265{
266 return usb_resume(dev);
267}
268
269static int usb_dev_freeze(struct device *dev)
270{
271 return usb_suspend(dev, PMSG_FREEZE);
272}
273
274static int usb_dev_thaw(struct device *dev)
275{
276 return usb_resume(dev);
277}
278
279static int usb_dev_poweroff(struct device *dev)
280{
281 return usb_suspend(dev, PMSG_HIBERNATE);
282}
283
284static int usb_dev_restore(struct device *dev)
285{
286 return usb_resume(dev);
287}
288
289static struct pm_ops usb_device_pm_ops = {
290 .prepare = usb_dev_prepare,
291 .complete = usb_dev_complete,
292 .suspend = usb_dev_suspend,
293 .resume = usb_dev_resume,
294 .freeze = usb_dev_freeze,
295 .thaw = usb_dev_thaw,
296 .poweroff = usb_dev_poweroff,
297 .restore = usb_dev_restore,
298};
299
247#else 300#else
248 301
249#define ksuspend_usb_init() 0 302#define ksuspend_usb_init() 0
250#define ksuspend_usb_cleanup() do {} while (0) 303#define ksuspend_usb_cleanup() do {} while (0)
304#define usb_device_pm_ops (*(struct pm_ops *)0)
251 305
252#endif /* CONFIG_PM */ 306#endif /* CONFIG_PM */
253 307
308struct device_type usb_device_type = {
309 .name = "usb_device",
310 .release = usb_release_dev,
311 .uevent = usb_dev_uevent,
312 .pm = &usb_device_pm_ops,
313};
314
254 315
255/* Returns 1 if @usb_bus is WUSB, 0 otherwise */ 316/* Returns 1 if @usb_bus is WUSB, 0 otherwise */
256static unsigned usb_bus_is_wusb(struct usb_bus *bus) 317static unsigned usb_bus_is_wusb(struct usb_bus *bus)
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
index d9a6e16dbf8..9a1a45ac3ad 100644
--- a/drivers/usb/core/usb.h
+++ b/drivers/usb/core/usb.h
@@ -41,6 +41,9 @@ extern void usb_host_cleanup(void);
41 41
42#ifdef CONFIG_PM 42#ifdef CONFIG_PM
43 43
44extern int usb_suspend(struct device *dev, pm_message_t msg);
45extern int usb_resume(struct device *dev);
46
44extern void usb_autosuspend_work(struct work_struct *work); 47extern void usb_autosuspend_work(struct work_struct *work);
45extern int usb_port_suspend(struct usb_device *dev); 48extern int usb_port_suspend(struct usb_device *dev);
46extern int usb_port_resume(struct usb_device *dev); 49extern int usb_port_resume(struct usb_device *dev);
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index a28513ecbe5..7cbc78a6853 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1622,7 +1622,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1622 struct pxa_udc *udc = the_controller; 1622 struct pxa_udc *udc = the_controller;
1623 int retval; 1623 int retval;
1624 1624
1625 if (!driver || driver->speed != USB_SPEED_FULL || !driver->bind 1625 if (!driver || driver->speed < USB_SPEED_FULL || !driver->bind
1626 || !driver->disconnect || !driver->setup) 1626 || !driver->disconnect || !driver->setup)
1627 return -EINVAL; 1627 return -EINVAL;
1628 if (!udc) 1628 if (!udc)
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index d22a84f86a3..8017f1cf78e 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -988,7 +988,7 @@ static void do_atl_int(struct usb_hcd *usb_hcd)
988 /* 988 /*
989 * write bank1 address twice to ensure the 90ns delay (time 989 * write bank1 address twice to ensure the 90ns delay (time
990 * between BANK0 write and the priv_read_copy() call is at 990 * between BANK0 write and the priv_read_copy() call is at
991 * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 92ns) 991 * least 3*t_WHWL + 2*t_w11 = 3*25ns + 2*17ns = 109ns)
992 */ 992 */
993 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs + 993 isp1760_writel(payload + ISP_BANK(1), usb_hcd->regs +
994 HC_MEMORY_REG); 994 HC_MEMORY_REG);
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 6db7a2889e6..4ed228a8994 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -260,7 +260,6 @@ static const struct hc_driver ohci_at91_hc_driver = {
260 */ 260 */
261 .hub_status_data = ohci_hub_status_data, 261 .hub_status_data = ohci_hub_status_data,
262 .hub_control = ohci_hub_control, 262 .hub_control = ohci_hub_control,
263 .hub_irq_enable = ohci_rhsc_enable,
264#ifdef CONFIG_PM 263#ifdef CONFIG_PM
265 .bus_suspend = ohci_bus_suspend, 264 .bus_suspend = ohci_bus_suspend,
266 .bus_resume = ohci_bus_resume, 265 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index c0948008fe3..2ac4e022a13 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -163,7 +163,6 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
163 */ 163 */
164 .hub_status_data = ohci_hub_status_data, 164 .hub_status_data = ohci_hub_status_data,
165 .hub_control = ohci_hub_control, 165 .hub_control = ohci_hub_control,
166 .hub_irq_enable = ohci_rhsc_enable,
167#ifdef CONFIG_PM 166#ifdef CONFIG_PM
168 .bus_suspend = ohci_bus_suspend, 167 .bus_suspend = ohci_bus_suspend,
169 .bus_resume = ohci_bus_resume, 168 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index cb0b506f825..fb3055f084b 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -134,7 +134,6 @@ static struct hc_driver ohci_ep93xx_hc_driver = {
134 .get_frame_number = ohci_get_frame, 134 .get_frame_number = ohci_get_frame,
135 .hub_status_data = ohci_hub_status_data, 135 .hub_status_data = ohci_hub_status_data,
136 .hub_control = ohci_hub_control, 136 .hub_control = ohci_hub_control,
137 .hub_irq_enable = ohci_rhsc_enable,
138#ifdef CONFIG_PM 137#ifdef CONFIG_PM
139 .bus_suspend = ohci_bus_suspend, 138 .bus_suspend = ohci_bus_suspend,
140 .bus_resume = ohci_bus_resume, 139 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 439beb784f3..7ea9a7b3115 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -36,18 +36,6 @@
36 36
37/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
38 38
39/* hcd->hub_irq_enable() */
40static void ohci_rhsc_enable (struct usb_hcd *hcd)
41{
42 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
43
44 spin_lock_irq(&ohci->lock);
45 if (!ohci->autostop)
46 del_timer(&hcd->rh_timer); /* Prevent next poll */
47 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
48 spin_unlock_irq(&ohci->lock);
49}
50
51#define OHCI_SCHED_ENABLES \ 39#define OHCI_SCHED_ENABLES \
52 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE) 40 (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
53 41
@@ -374,18 +362,28 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
374 int any_connected) 362 int any_connected)
375{ 363{
376 int poll_rh = 1; 364 int poll_rh = 1;
365 int rhsc;
377 366
367 rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC;
378 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 368 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
379 369
380 case OHCI_USB_OPER: 370 case OHCI_USB_OPER:
381 /* keep on polling until we know a device is connected 371 /* If no status changes are pending, enable status-change
382 * and RHSC is enabled */ 372 * interrupts.
373 */
374 if (!rhsc && !changed) {
375 rhsc = OHCI_INTR_RHSC;
376 ohci_writel(ohci, rhsc, &ohci->regs->intrenable);
377 }
378
379 /* Keep on polling until we know a device is connected
380 * and RHSC is enabled, or until we autostop.
381 */
383 if (!ohci->autostop) { 382 if (!ohci->autostop) {
384 if (any_connected || 383 if (any_connected ||
385 !device_may_wakeup(&ohci_to_hcd(ohci) 384 !device_may_wakeup(&ohci_to_hcd(ohci)
386 ->self.root_hub->dev)) { 385 ->self.root_hub->dev)) {
387 if (ohci_readl(ohci, &ohci->regs->intrenable) & 386 if (rhsc)
388 OHCI_INTR_RHSC)
389 poll_rh = 0; 387 poll_rh = 0;
390 } else { 388 } else {
391 ohci->autostop = 1; 389 ohci->autostop = 1;
@@ -398,12 +396,13 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
398 ohci->autostop = 0; 396 ohci->autostop = 0;
399 ohci->next_statechange = jiffies + 397 ohci->next_statechange = jiffies +
400 STATECHANGE_DELAY; 398 STATECHANGE_DELAY;
401 } else if (time_after_eq(jiffies, 399 } else if (rhsc && time_after_eq(jiffies,
402 ohci->next_statechange) 400 ohci->next_statechange)
403 && !ohci->ed_rm_list 401 && !ohci->ed_rm_list
404 && !(ohci->hc_control & 402 && !(ohci->hc_control &
405 OHCI_SCHED_ENABLES)) { 403 OHCI_SCHED_ENABLES)) {
406 ohci_rh_suspend(ohci, 1); 404 ohci_rh_suspend(ohci, 1);
405 poll_rh = 0;
407 } 406 }
408 } 407 }
409 break; 408 break;
@@ -417,6 +416,12 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
417 else 416 else
418 usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); 417 usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
419 } else { 418 } else {
419 if (!rhsc && (ohci->autostop ||
420 ohci_to_hcd(ohci)->self.root_hub->
421 do_remote_wakeup))
422 ohci_writel(ohci, OHCI_INTR_RHSC,
423 &ohci->regs->intrenable);
424
420 /* everything is idle, no need for polling */ 425 /* everything is idle, no need for polling */
421 poll_rh = 0; 426 poll_rh = 0;
422 } 427 }
@@ -438,12 +443,16 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci)
438static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, 443static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
439 int any_connected) 444 int any_connected)
440{ 445{
441 int poll_rh = 1; 446 /* If RHSC is enabled, don't poll */
442
443 /* keep on polling until RHSC is enabled */
444 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) 447 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
445 poll_rh = 0; 448 return 0;
446 return poll_rh; 449
450 /* If no status changes are pending, enable status-change interrupts */
451 if (!changed) {
452 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
453 return 0;
454 }
455 return 1;
447} 456}
448 457
449#endif /* CONFIG_PM */ 458#endif /* CONFIG_PM */
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 9e31d440d11..de42283149c 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -193,7 +193,6 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
193 */ 193 */
194 .hub_status_data = ohci_hub_status_data, 194 .hub_status_data = ohci_hub_status_data,
195 .hub_control = ohci_hub_control, 195 .hub_control = ohci_hub_control,
196 .hub_irq_enable = ohci_rhsc_enable,
197#ifdef CONFIG_PM 196#ifdef CONFIG_PM
198 .bus_suspend = ohci_bus_suspend, 197 .bus_suspend = ohci_bus_suspend,
199 .bus_resume = ohci_bus_resume, 198 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 3d532b70967..1eb64d08b60 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -470,7 +470,6 @@ static const struct hc_driver ohci_omap_hc_driver = {
470 */ 470 */
471 .hub_status_data = ohci_hub_status_data, 471 .hub_status_data = ohci_hub_status_data,
472 .hub_control = ohci_hub_control, 472 .hub_control = ohci_hub_control,
473 .hub_irq_enable = ohci_rhsc_enable,
474#ifdef CONFIG_PM 473#ifdef CONFIG_PM
475 .bus_suspend = ohci_bus_suspend, 474 .bus_suspend = ohci_bus_suspend,
476 .bus_resume = ohci_bus_resume, 475 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 083e8df0a81..a9c2ae36c7a 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -459,7 +459,6 @@ static const struct hc_driver ohci_pci_hc_driver = {
459 */ 459 */
460 .hub_status_data = ohci_hub_status_data, 460 .hub_status_data = ohci_hub_status_data,
461 .hub_control = ohci_hub_control, 461 .hub_control = ohci_hub_control,
462 .hub_irq_enable = ohci_rhsc_enable,
463#ifdef CONFIG_PM 462#ifdef CONFIG_PM
464 .bus_suspend = ohci_bus_suspend, 463 .bus_suspend = ohci_bus_suspend,
465 .bus_resume = ohci_bus_resume, 464 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index b02cd076197..658a2a978c3 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -277,7 +277,6 @@ static const struct hc_driver ohci_pnx4008_hc_driver = {
277 */ 277 */
278 .hub_status_data = ohci_hub_status_data, 278 .hub_status_data = ohci_hub_status_data,
279 .hub_control = ohci_hub_control, 279 .hub_control = ohci_hub_control,
280 .hub_irq_enable = ohci_rhsc_enable,
281#ifdef CONFIG_PM 280#ifdef CONFIG_PM
282 .bus_suspend = ohci_bus_suspend, 281 .bus_suspend = ohci_bus_suspend,
283 .bus_resume = ohci_bus_resume, 282 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
index 605d59cba28..28467e288a9 100644
--- a/drivers/usb/host/ohci-pnx8550.c
+++ b/drivers/usb/host/ohci-pnx8550.c
@@ -201,7 +201,6 @@ static const struct hc_driver ohci_pnx8550_hc_driver = {
201 */ 201 */
202 .hub_status_data = ohci_hub_status_data, 202 .hub_status_data = ohci_hub_status_data,
203 .hub_control = ohci_hub_control, 203 .hub_control = ohci_hub_control,
204 .hub_irq_enable = ohci_rhsc_enable,
205#ifdef CONFIG_PM 204#ifdef CONFIG_PM
206 .bus_suspend = ohci_bus_suspend, 205 .bus_suspend = ohci_bus_suspend,
207 .bus_resume = ohci_bus_resume, 206 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 91e6e101a4c..7ac53264ead 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -72,7 +72,6 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
72 */ 72 */
73 .hub_status_data = ohci_hub_status_data, 73 .hub_status_data = ohci_hub_status_data,
74 .hub_control = ohci_hub_control, 74 .hub_control = ohci_hub_control,
75 .hub_irq_enable = ohci_rhsc_enable,
76#ifdef CONFIG_PM 75#ifdef CONFIG_PM
77 .bus_suspend = ohci_bus_suspend, 76 .bus_suspend = ohci_bus_suspend,
78 .bus_resume = ohci_bus_resume, 77 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 523c3012557..cd3398b675b 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -172,7 +172,6 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
172 */ 172 */
173 .hub_status_data = ohci_hub_status_data, 173 .hub_status_data = ohci_hub_status_data,
174 .hub_control = ohci_hub_control, 174 .hub_control = ohci_hub_control,
175 .hub_irq_enable = ohci_rhsc_enable,
176#ifdef CONFIG_PM 175#ifdef CONFIG_PM
177 .bus_suspend = ohci_bus_suspend, 176 .bus_suspend = ohci_bus_suspend,
178 .bus_resume = ohci_bus_resume, 177 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c
index 55c95647f00..2089d8a46c4 100644
--- a/drivers/usb/host/ohci-ps3.c
+++ b/drivers/usb/host/ohci-ps3.c
@@ -68,7 +68,6 @@ static const struct hc_driver ps3_ohci_hc_driver = {
68 .get_frame_number = ohci_get_frame, 68 .get_frame_number = ohci_get_frame,
69 .hub_status_data = ohci_hub_status_data, 69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control, 70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72 .start_port_reset = ohci_start_port_reset, 71 .start_port_reset = ohci_start_port_reset,
73#if defined(CONFIG_PM) 72#if defined(CONFIG_PM)
74 .bus_suspend = ohci_bus_suspend, 73 .bus_suspend = ohci_bus_suspend,
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 8c9c4849db6..7f0f35c7818 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -298,7 +298,6 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
298 */ 298 */
299 .hub_status_data = ohci_hub_status_data, 299 .hub_status_data = ohci_hub_status_data,
300 .hub_control = ohci_hub_control, 300 .hub_control = ohci_hub_control,
301 .hub_irq_enable = ohci_rhsc_enable,
302#ifdef CONFIG_PM 301#ifdef CONFIG_PM
303 .bus_suspend = ohci_bus_suspend, 302 .bus_suspend = ohci_bus_suspend,
304 .bus_resume = ohci_bus_resume, 303 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 9e3dc4069e8..f46af7a718d 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -466,7 +466,6 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
466 */ 466 */
467 .hub_status_data = ohci_s3c2410_hub_status_data, 467 .hub_status_data = ohci_s3c2410_hub_status_data,
468 .hub_control = ohci_s3c2410_hub_control, 468 .hub_control = ohci_s3c2410_hub_control,
469 .hub_irq_enable = ohci_rhsc_enable,
470#ifdef CONFIG_PM 469#ifdef CONFIG_PM
471 .bus_suspend = ohci_bus_suspend, 470 .bus_suspend = ohci_bus_suspend,
472 .bus_resume = ohci_bus_resume, 471 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
index 4626b002e67..e4bbe8e188e 100644
--- a/drivers/usb/host/ohci-sa1111.c
+++ b/drivers/usb/host/ohci-sa1111.c
@@ -231,7 +231,6 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
231 */ 231 */
232 .hub_status_data = ohci_hub_status_data, 232 .hub_status_data = ohci_hub_status_data,
233 .hub_control = ohci_hub_control, 233 .hub_control = ohci_hub_control,
234 .hub_irq_enable = ohci_rhsc_enable,
235#ifdef CONFIG_PM 234#ifdef CONFIG_PM
236 .bus_suspend = ohci_bus_suspend, 235 .bus_suspend = ohci_bus_suspend,
237 .bus_resume = ohci_bus_resume, 236 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c
index e7ee607278f..60f03cc7ec4 100644
--- a/drivers/usb/host/ohci-sh.c
+++ b/drivers/usb/host/ohci-sh.c
@@ -68,7 +68,6 @@ static const struct hc_driver ohci_sh_hc_driver = {
68 */ 68 */
69 .hub_status_data = ohci_hub_status_data, 69 .hub_status_data = ohci_hub_status_data,
70 .hub_control = ohci_hub_control, 70 .hub_control = ohci_hub_control,
71 .hub_irq_enable = ohci_rhsc_enable,
72#ifdef CONFIG_PM 71#ifdef CONFIG_PM
73 .bus_suspend = ohci_bus_suspend, 72 .bus_suspend = ohci_bus_suspend,
74 .bus_resume = ohci_bus_resume, 73 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index 21b164e4abe..cff23637cfc 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -75,7 +75,6 @@ static const struct hc_driver ohci_sm501_hc_driver = {
75 */ 75 */
76 .hub_status_data = ohci_hub_status_data, 76 .hub_status_data = ohci_hub_status_data,
77 .hub_control = ohci_hub_control, 77 .hub_control = ohci_hub_control,
78 .hub_irq_enable = ohci_rhsc_enable,
79#ifdef CONFIG_PM 78#ifdef CONFIG_PM
80 .bus_suspend = ohci_bus_suspend, 79 .bus_suspend = ohci_bus_suspend,
81 .bus_resume = ohci_bus_resume, 80 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index 3660c83d80a..23fd6a886bd 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -81,7 +81,6 @@ static const struct hc_driver ssb_ohci_hc_driver = {
81 81
82 .hub_status_data = ohci_hub_status_data, 82 .hub_status_data = ohci_hub_status_data,
83 .hub_control = ohci_hub_control, 83 .hub_control = ohci_hub_control,
84 .hub_irq_enable = ohci_rhsc_enable,
85#ifdef CONFIG_PM 84#ifdef CONFIG_PM
86 .bus_suspend = ohci_bus_suspend, 85 .bus_suspend = ohci_bus_suspend,
87 .bus_resume = ohci_bus_resume, 86 .bus_resume = ohci_bus_resume,
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 20ad3c48fcb..228f2b070f2 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -2934,16 +2934,6 @@ static int u132_start_port_reset(struct usb_hcd *hcd, unsigned port_num)
2934 return 0; 2934 return 0;
2935} 2935}
2936 2936
2937static void u132_hub_irq_enable(struct usb_hcd *hcd)
2938{
2939 struct u132 *u132 = hcd_to_u132(hcd);
2940 if (u132->going > 1) {
2941 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
2942 , u132->going);
2943 } else if (u132->going > 0)
2944 dev_err(&u132->platform_dev->dev, "device is being removed\n");
2945}
2946
2947 2937
2948#ifdef CONFIG_PM 2938#ifdef CONFIG_PM
2949static int u132_bus_suspend(struct usb_hcd *hcd) 2939static int u132_bus_suspend(struct usb_hcd *hcd)
@@ -2995,7 +2985,6 @@ static struct hc_driver u132_hc_driver = {
2995 .bus_suspend = u132_bus_suspend, 2985 .bus_suspend = u132_bus_suspend,
2996 .bus_resume = u132_bus_resume, 2986 .bus_resume = u132_bus_resume,
2997 .start_port_reset = u132_start_port_reset, 2987 .start_port_reset = u132_start_port_reset,
2998 .hub_irq_enable = u132_hub_irq_enable,
2999}; 2988};
3000 2989
3001/* 2990/*
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index fbace41a7cb..69c34a58e20 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3270,6 +3270,7 @@ static struct usb_device_id sisusb_table [] = {
3270 { USB_DEVICE(0x0711, 0x0900) }, 3270 { USB_DEVICE(0x0711, 0x0900) },
3271 { USB_DEVICE(0x0711, 0x0901) }, 3271 { USB_DEVICE(0x0711, 0x0901) },
3272 { USB_DEVICE(0x0711, 0x0902) }, 3272 { USB_DEVICE(0x0711, 0x0902) },
3273 { USB_DEVICE(0x0711, 0x0918) },
3273 { USB_DEVICE(0x182d, 0x021c) }, 3274 { USB_DEVICE(0x182d, 0x021c) },
3274 { USB_DEVICE(0x182d, 0x0269) }, 3275 { USB_DEVICE(0x182d, 0x0269) },
3275 { } 3276 { }
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index faca4333f27..a0017486ad4 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -165,12 +165,11 @@ config USB_TUSB_OMAP_DMA
165 help 165 help
166 Enable DMA transfers on TUSB 6010 when OMAP DMA is available. 166 Enable DMA transfers on TUSB 6010 when OMAP DMA is available.
167 167
168config USB_MUSB_LOGLEVEL 168config USB_MUSB_DEBUG
169 depends on USB_MUSB_HDRC 169 depends on USB_MUSB_HDRC
170 int 'Logging Level (0 - none / 3 - annoying / ... )' 170 bool "Enable debugging messages"
171 default 0 171 default n
172 help 172 help
173 Set the logging level. 0 disables the debugging altogether, 173 This enables musb debugging. To set the logging level use the debug
174 although when USB_DEBUG is set the value is at least 1. 174 module parameter. Starting at level 3, per-transfer (urb, usb_request,
175 Starting at level 3, per-transfer (urb, usb_request, packet, 175 packet, or dma transfer) tracing may kick in.
176 or dma transfer) tracing may kick in.
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
index 88eb67de08a..b6af0d687a7 100644
--- a/drivers/usb/musb/Makefile
+++ b/drivers/usb/musb/Makefile
@@ -64,23 +64,6 @@ endif
64 64
65# Debugging 65# Debugging
66 66
67MUSB_DEBUG:=$(CONFIG_USB_MUSB_LOGLEVEL) 67ifeq ($(CONFIG_USB_MUSB_DEBUG),y)
68 68 EXTRA_CFLAGS += -DDEBUG
69ifeq ("$(strip $(MUSB_DEBUG))","")
70 ifdef CONFIG_USB_DEBUG
71 MUSB_DEBUG:=1
72 else
73 MUSB_DEBUG:=0
74 endif
75endif 69endif
76
77ifneq ($(MUSB_DEBUG),0)
78 EXTRA_CFLAGS += -DDEBUG
79
80 ifeq ($(CONFIG_PROC_FS),y)
81 musb_hdrc-objs += musb_procfs.o
82 endif
83
84endif
85
86EXTRA_CFLAGS += -DMUSB_DEBUG=$(MUSB_DEBUG)
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index d68ec6daf33..c5b8f0296fc 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -114,23 +114,14 @@
114 114
115 115
116 116
117#if MUSB_DEBUG > 0 117unsigned debug;
118unsigned debug = MUSB_DEBUG; 118module_param(debug, uint, S_IRUGO | S_IWUSR);
119module_param(debug, uint, 0); 119MODULE_PARM_DESC(debug, "Debug message level. Default = 0");
120MODULE_PARM_DESC(debug, "initial debug message level");
121
122#define MUSB_VERSION_SUFFIX "/dbg"
123#endif
124 120
125#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia" 121#define DRIVER_AUTHOR "Mentor Graphics, Texas Instruments, Nokia"
126#define DRIVER_DESC "Inventra Dual-Role USB Controller Driver" 122#define DRIVER_DESC "Inventra Dual-Role USB Controller Driver"
127 123
128#define MUSB_VERSION_BASE "6.0" 124#define MUSB_VERSION "6.0"
129
130#ifndef MUSB_VERSION_SUFFIX
131#define MUSB_VERSION_SUFFIX ""
132#endif
133#define MUSB_VERSION MUSB_VERSION_BASE MUSB_VERSION_SUFFIX
134 125
135#define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION 126#define DRIVER_INFO DRIVER_DESC ", v" MUSB_VERSION
136 127
@@ -2037,6 +2028,8 @@ bad_config:
2037 musb->xceiv.state = OTG_STATE_A_IDLE; 2028 musb->xceiv.state = OTG_STATE_A_IDLE;
2038 2029
2039 status = usb_add_hcd(musb_to_hcd(musb), -1, 0); 2030 status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
2031 if (status)
2032 goto fail;
2040 2033
2041 DBG(1, "%s mode, status %d, devctl %02x %c\n", 2034 DBG(1, "%s mode, status %d, devctl %02x %c\n",
2042 "HOST", status, 2035 "HOST", status,
@@ -2051,6 +2044,8 @@ bad_config:
2051 musb->xceiv.state = OTG_STATE_B_IDLE; 2044 musb->xceiv.state = OTG_STATE_B_IDLE;
2052 2045
2053 status = musb_gadget_setup(musb); 2046 status = musb_gadget_setup(musb);
2047 if (status)
2048 goto fail;
2054 2049
2055 DBG(1, "%s mode, status %d, dev%02x\n", 2050 DBG(1, "%s mode, status %d, dev%02x\n",
2056 is_otg_enabled(musb) ? "OTG" : "PERIPHERAL", 2051 is_otg_enabled(musb) ? "OTG" : "PERIPHERAL",
@@ -2059,16 +2054,14 @@ bad_config:
2059 2054
2060 } 2055 }
2061 2056
2062 if (status == 0) 2057 return 0;
2063 musb_debug_create("driver/musb_hdrc", musb); 2058
2064 else {
2065fail: 2059fail:
2066 if (musb->clock) 2060 if (musb->clock)
2067 clk_put(musb->clock); 2061 clk_put(musb->clock);
2068 device_init_wakeup(dev, 0); 2062 device_init_wakeup(dev, 0);
2069 musb_free(musb); 2063 musb_free(musb);
2070 return status; 2064 return status;
2071 }
2072 2065
2073#ifdef CONFIG_SYSFS 2066#ifdef CONFIG_SYSFS
2074 status = device_create_file(dev, &dev_attr_mode); 2067 status = device_create_file(dev, &dev_attr_mode);
@@ -2131,7 +2124,6 @@ static int __devexit musb_remove(struct platform_device *pdev)
2131 * - OTG mode: both roles are deactivated (or never-activated) 2124 * - OTG mode: both roles are deactivated (or never-activated)
2132 */ 2125 */
2133 musb_shutdown(pdev); 2126 musb_shutdown(pdev);
2134 musb_debug_delete("driver/musb_hdrc", musb);
2135#ifdef CONFIG_USB_MUSB_HDRC_HCD 2127#ifdef CONFIG_USB_MUSB_HDRC_HCD
2136 if (musb->board_mode == MUSB_HOST) 2128 if (musb->board_mode == MUSB_HOST)
2137 usb_remove_hcd(musb_to_hcd(musb)); 2129 usb_remove_hcd(musb_to_hcd(musb));
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index eade46d8170..82227251931 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -485,23 +485,4 @@ extern int musb_platform_get_vbus_status(struct musb *musb);
485extern int __init musb_platform_init(struct musb *musb); 485extern int __init musb_platform_init(struct musb *musb);
486extern int musb_platform_exit(struct musb *musb); 486extern int musb_platform_exit(struct musb *musb);
487 487
488/*-------------------------- ProcFS definitions ---------------------*/
489
490struct proc_dir_entry;
491
492#if (MUSB_DEBUG > 0) && defined(MUSB_CONFIG_PROC_FS)
493extern struct proc_dir_entry *musb_debug_create(char *name, struct musb *data);
494extern void musb_debug_delete(char *name, struct musb *data);
495
496#else
497static inline struct proc_dir_entry *
498musb_debug_create(char *name, struct musb *data)
499{
500 return NULL;
501}
502static inline void musb_debug_delete(char *name, struct musb *data)
503{
504}
505#endif
506
507#endif /* __MUSB_CORE_H__ */ 488#endif /* __MUSB_CORE_H__ */
diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h
index 3bdb311e820..4d2794441b1 100644
--- a/drivers/usb/musb/musb_debug.h
+++ b/drivers/usb/musb/musb_debug.h
@@ -48,11 +48,7 @@
48 __func__, __LINE__ , ## args); \ 48 __func__, __LINE__ , ## args); \
49 } } while (0) 49 } } while (0)
50 50
51#if MUSB_DEBUG > 0
52extern unsigned debug; 51extern unsigned debug;
53#else
54#define debug 0
55#endif
56 52
57static inline int _dbg_level(unsigned l) 53static inline int _dbg_level(unsigned l)
58{ 54{
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
index 48d7d3ccb24..a57652fff39 100644
--- a/drivers/usb/musb/musb_gadget_ep0.c
+++ b/drivers/usb/musb/musb_gadget_ep0.c
@@ -476,6 +476,7 @@ static void ep0_rxstate(struct musb *musb)
476 return; 476 return;
477 musb->ackpend = 0; 477 musb->ackpend = 0;
478 } 478 }
479 musb_ep_select(musb->mregs, 0);
479 musb_writew(regs, MUSB_CSR0, tmp); 480 musb_writew(regs, MUSB_CSR0, tmp);
480} 481}
481 482
@@ -528,6 +529,7 @@ static void ep0_txstate(struct musb *musb)
528 } 529 }
529 530
530 /* send it out, triggering a "txpktrdy cleared" irq */ 531 /* send it out, triggering a "txpktrdy cleared" irq */
532 musb_ep_select(musb->mregs, 0);
531 musb_writew(regs, MUSB_CSR0, csr); 533 musb_writew(regs, MUSB_CSR0, csr);
532} 534}
533 535
diff --git a/drivers/usb/musb/musb_procfs.c b/drivers/usb/musb/musb_procfs.c
deleted file mode 100644
index 55e6b78bdcc..00000000000
--- a/drivers/usb/musb/musb_procfs.c
+++ /dev/null
@@ -1,830 +0,0 @@
1/*
2 * MUSB OTG driver debug support
3 *
4 * Copyright 2005 Mentor Graphics Corporation
5 * Copyright (C) 2005-2006 by Texas Instruments
6 * Copyright (C) 2006-2007 Nokia Corporation
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
25 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 */
34
35#include <linux/kernel.h>
36#include <linux/proc_fs.h>
37#include <linux/seq_file.h>
38#include <linux/uaccess.h> /* FIXME remove procfs writes */
39#include <asm/arch/hardware.h>
40
41#include "musb_core.h"
42
43#include "davinci.h"
44
45#ifdef CONFIG_USB_MUSB_HDRC_HCD
46
47static int dump_qh(struct musb_qh *qh, char *buf, unsigned max)
48{
49 int count;
50 int tmp;
51 struct usb_host_endpoint *hep = qh->hep;
52 struct urb *urb;
53
54 count = snprintf(buf, max, " qh %p dev%d ep%d%s max%d\n",
55 qh, qh->dev->devnum, qh->epnum,
56 ({ char *s; switch (qh->type) {
57 case USB_ENDPOINT_XFER_BULK:
58 s = "-bulk"; break;
59 case USB_ENDPOINT_XFER_INT:
60 s = "-int"; break;
61 case USB_ENDPOINT_XFER_CONTROL:
62 s = ""; break;
63 default:
64 s = "iso"; break;
65 }; s; }),
66 qh->maxpacket);
67 if (count <= 0)
68 return 0;
69 buf += count;
70 max -= count;
71
72 list_for_each_entry(urb, &hep->urb_list, urb_list) {
73 tmp = snprintf(buf, max, "\t%s urb %p %d/%d\n",
74 usb_pipein(urb->pipe) ? "in" : "out",
75 urb, urb->actual_length,
76 urb->transfer_buffer_length);
77 if (tmp <= 0)
78 break;
79 tmp = min(tmp, (int)max);
80 count += tmp;
81 buf += tmp;
82 max -= tmp;
83 }
84 return count;
85}
86
87static int
88dump_queue(struct list_head *q, char *buf, unsigned max)
89{
90 int count = 0;
91 struct musb_qh *qh;
92
93 list_for_each_entry(qh, q, ring) {
94 int tmp;
95
96 tmp = dump_qh(qh, buf, max);
97 if (tmp <= 0)
98 break;
99 tmp = min(tmp, (int)max);
100 count += tmp;
101 buf += tmp;
102 max -= tmp;
103 }
104 return count;
105}
106
107#endif /* HCD */
108
109#ifdef CONFIG_USB_GADGET_MUSB_HDRC
110static int dump_ep(struct musb_ep *ep, char *buffer, unsigned max)
111{
112 char *buf = buffer;
113 int code = 0;
114 void __iomem *regs = ep->hw_ep->regs;
115 char *mode = "1buf";
116
117 if (ep->is_in) {
118 if (ep->hw_ep->tx_double_buffered)
119 mode = "2buf";
120 } else {
121 if (ep->hw_ep->rx_double_buffered)
122 mode = "2buf";
123 }
124
125 do {
126 struct usb_request *req;
127
128 code = snprintf(buf, max,
129 "\n%s (hw%d): %s%s, csr %04x maxp %04x\n",
130 ep->name, ep->current_epnum,
131 mode, ep->dma ? " dma" : "",
132 musb_readw(regs,
133 (ep->is_in || !ep->current_epnum)
134 ? MUSB_TXCSR
135 : MUSB_RXCSR),
136 musb_readw(regs, ep->is_in
137 ? MUSB_TXMAXP
138 : MUSB_RXMAXP)
139 );
140 if (code <= 0)
141 break;
142 code = min(code, (int) max);
143 buf += code;
144 max -= code;
145
146 if (is_cppi_enabled() && ep->current_epnum) {
147 unsigned cppi = ep->current_epnum - 1;
148 void __iomem *base = ep->musb->ctrl_base;
149 unsigned off1 = cppi << 2;
150 void __iomem *ram = base;
151 char tmp[16];
152
153 if (ep->is_in) {
154 ram += DAVINCI_TXCPPI_STATERAM_OFFSET(cppi);
155 tmp[0] = 0;
156 } else {
157 ram += DAVINCI_RXCPPI_STATERAM_OFFSET(cppi);
158 snprintf(tmp, sizeof tmp, "%d left, ",
159 musb_readl(base,
160 DAVINCI_RXCPPI_BUFCNT0_REG + off1));
161 }
162
163 code = snprintf(buf, max, "%cX DMA%d: %s"
164 "%08x %08x, %08x %08x; "
165 "%08x %08x %08x .. %08x\n",
166 ep->is_in ? 'T' : 'R',
167 ep->current_epnum - 1, tmp,
168 musb_readl(ram, 0 * 4),
169 musb_readl(ram, 1 * 4),
170 musb_readl(ram, 2 * 4),
171 musb_readl(ram, 3 * 4),
172 musb_readl(ram, 4 * 4),
173 musb_readl(ram, 5 * 4),
174 musb_readl(ram, 6 * 4),
175 musb_readl(ram, 7 * 4));
176 if (code <= 0)
177 break;
178 code = min(code, (int) max);
179 buf += code;
180 max -= code;
181 }
182
183 if (list_empty(&ep->req_list)) {
184 code = snprintf(buf, max, "\t(queue empty)\n");
185 if (code <= 0)
186 break;
187 code = min(code, (int) max);
188 buf += code;
189 max -= code;
190 break;
191 }
192 list_for_each_entry(req, &ep->req_list, list) {
193 code = snprintf(buf, max, "\treq %p, %s%s%d/%d\n",
194 req,
195 req->zero ? "zero, " : "",
196 req->short_not_ok ? "!short, " : "",
197 req->actual, req->length);
198 if (code <= 0)
199 break;
200 code = min(code, (int) max);
201 buf += code;
202 max -= code;
203 }
204 } while (0);
205 return buf - buffer;
206}
207#endif
208
209static int
210dump_end_info(struct musb *musb, u8 epnum, char *aBuffer, unsigned max)
211{
212 int code = 0;
213 char *buf = aBuffer;
214 struct musb_hw_ep *hw_ep = &musb->endpoints[epnum];
215
216 do {
217 musb_ep_select(musb->mregs, epnum);
218#ifdef CONFIG_USB_MUSB_HDRC_HCD
219 if (is_host_active(musb)) {
220 int dump_rx, dump_tx;
221 void __iomem *regs = hw_ep->regs;
222
223 /* TEMPORARY (!) until we have a real periodic
224 * schedule tree ...
225 */
226 if (!epnum) {
227 /* control is shared, uses RX queue
228 * but (mostly) shadowed tx registers
229 */
230 dump_tx = !list_empty(&musb->control);
231 dump_rx = 0;
232 } else if (hw_ep == musb->bulk_ep) {
233 dump_tx = !list_empty(&musb->out_bulk);
234 dump_rx = !list_empty(&musb->in_bulk);
235 } else if (musb->periodic[epnum]) {
236 struct usb_host_endpoint *hep;
237
238 hep = musb->periodic[epnum]->hep;
239 dump_rx = hep->desc.bEndpointAddress
240 & USB_ENDPOINT_DIR_MASK;
241 dump_tx = !dump_rx;
242 } else
243 break;
244 /* END TEMPORARY */
245
246
247 if (dump_rx) {
248 code = snprintf(buf, max,
249 "\nRX%d: %s rxcsr %04x interval %02x "
250 "max %04x type %02x; "
251 "dev %d hub %d port %d"
252 "\n",
253 epnum,
254 hw_ep->rx_double_buffered
255 ? "2buf" : "1buf",
256 musb_readw(regs, MUSB_RXCSR),
257 musb_readb(regs, MUSB_RXINTERVAL),
258 musb_readw(regs, MUSB_RXMAXP),
259 musb_readb(regs, MUSB_RXTYPE),
260 /* FIXME: assumes multipoint */
261 musb_readb(musb->mregs,
262 MUSB_BUSCTL_OFFSET(epnum,
263 MUSB_RXFUNCADDR)),
264 musb_readb(musb->mregs,
265 MUSB_BUSCTL_OFFSET(epnum,
266 MUSB_RXHUBADDR)),
267 musb_readb(musb->mregs,
268 MUSB_BUSCTL_OFFSET(epnum,
269 MUSB_RXHUBPORT))
270 );
271 if (code <= 0)
272 break;
273 code = min(code, (int) max);
274 buf += code;
275 max -= code;
276
277 if (is_cppi_enabled()
278 && epnum
279 && hw_ep->rx_channel) {
280 unsigned cppi = epnum - 1;
281 unsigned off1 = cppi << 2;
282 void __iomem *base;
283 void __iomem *ram;
284 char tmp[16];
285
286 base = musb->ctrl_base;
287 ram = DAVINCI_RXCPPI_STATERAM_OFFSET(
288 cppi) + base;
289 snprintf(tmp, sizeof tmp, "%d left, ",
290 musb_readl(base,
291 DAVINCI_RXCPPI_BUFCNT0_REG
292 + off1));
293
294 code = snprintf(buf, max,
295 " rx dma%d: %s"
296 "%08x %08x, %08x %08x; "
297 "%08x %08x %08x .. %08x\n",
298 cppi, tmp,
299 musb_readl(ram, 0 * 4),
300 musb_readl(ram, 1 * 4),
301 musb_readl(ram, 2 * 4),
302 musb_readl(ram, 3 * 4),
303 musb_readl(ram, 4 * 4),
304 musb_readl(ram, 5 * 4),
305 musb_readl(ram, 6 * 4),
306 musb_readl(ram, 7 * 4));
307 if (code <= 0)
308 break;
309 code = min(code, (int) max);
310 buf += code;
311 max -= code;
312 }
313
314 if (hw_ep == musb->bulk_ep
315 && !list_empty(
316 &musb->in_bulk)) {
317 code = dump_queue(&musb->in_bulk,
318 buf, max);
319 if (code <= 0)
320 break;
321 code = min(code, (int) max);
322 buf += code;
323 max -= code;
324 } else if (musb->periodic[epnum]) {
325 code = dump_qh(musb->periodic[epnum],
326 buf, max);
327 if (code <= 0)
328 break;
329 code = min(code, (int) max);
330 buf += code;
331 max -= code;
332 }
333 }
334
335 if (dump_tx) {
336 code = snprintf(buf, max,
337 "\nTX%d: %s txcsr %04x interval %02x "
338 "max %04x type %02x; "
339 "dev %d hub %d port %d"
340 "\n",
341 epnum,
342 hw_ep->tx_double_buffered
343 ? "2buf" : "1buf",
344 musb_readw(regs, MUSB_TXCSR),
345 musb_readb(regs, MUSB_TXINTERVAL),
346 musb_readw(regs, MUSB_TXMAXP),
347 musb_readb(regs, MUSB_TXTYPE),
348 /* FIXME: assumes multipoint */
349 musb_readb(musb->mregs,
350 MUSB_BUSCTL_OFFSET(epnum,
351 MUSB_TXFUNCADDR)),
352 musb_readb(musb->mregs,
353 MUSB_BUSCTL_OFFSET(epnum,
354 MUSB_TXHUBADDR)),
355 musb_readb(musb->mregs,
356 MUSB_BUSCTL_OFFSET(epnum,
357 MUSB_TXHUBPORT))
358 );
359 if (code <= 0)
360 break;
361 code = min(code, (int) max);
362 buf += code;
363 max -= code;
364
365 if (is_cppi_enabled()
366 && epnum
367 && hw_ep->tx_channel) {
368 unsigned cppi = epnum - 1;
369 void __iomem *base;
370 void __iomem *ram;
371
372 base = musb->ctrl_base;
373 ram = DAVINCI_RXCPPI_STATERAM_OFFSET(
374 cppi) + base;
375 code = snprintf(buf, max,
376 " tx dma%d: "
377 "%08x %08x, %08x %08x; "
378 "%08x %08x %08x .. %08x\n",
379 cppi,
380 musb_readl(ram, 0 * 4),
381 musb_readl(ram, 1 * 4),
382 musb_readl(ram, 2 * 4),
383 musb_readl(ram, 3 * 4),
384 musb_readl(ram, 4 * 4),
385 musb_readl(ram, 5 * 4),
386 musb_readl(ram, 6 * 4),
387 musb_readl(ram, 7 * 4));
388 if (code <= 0)
389 break;
390 code = min(code, (int) max);
391 buf += code;
392 max -= code;
393 }
394
395 if (hw_ep == musb->control_ep
396 && !list_empty(
397 &musb->control)) {
398 code = dump_queue(&musb->control,
399 buf, max);
400 if (code <= 0)
401 break;
402 code = min(code, (int) max);
403 buf += code;
404 max -= code;
405 } else if (hw_ep == musb->bulk_ep
406 && !list_empty(
407 &musb->out_bulk)) {
408 code = dump_queue(&musb->out_bulk,
409 buf, max);
410 if (code <= 0)
411 break;
412 code = min(code, (int) max);
413 buf += code;
414 max -= code;
415 } else if (musb->periodic[epnum]) {
416 code = dump_qh(musb->periodic[epnum],
417 buf, max);
418 if (code <= 0)
419 break;
420 code = min(code, (int) max);
421 buf += code;
422 max -= code;
423 }
424 }
425 }
426#endif
427#ifdef CONFIG_USB_GADGET_MUSB_HDRC
428 if (is_peripheral_active(musb)) {
429 code = 0;
430
431 if (hw_ep->ep_in.desc || !epnum) {
432 code = dump_ep(&hw_ep->ep_in, buf, max);
433 if (code <= 0)
434 break;
435 code = min(code, (int) max);
436 buf += code;
437 max -= code;
438 }
439 if (hw_ep->ep_out.desc) {
440 code = dump_ep(&hw_ep->ep_out, buf, max);
441 if (code <= 0)
442 break;
443 code = min(code, (int) max);
444 buf += code;
445 max -= code;
446 }
447 }
448#endif
449 } while (0);
450
451 return buf - aBuffer;
452}
453
454/* Dump the current status and compile options.
455 * @param musb the device driver instance
456 * @param buffer where to dump the status; it must be big enough to hold the
457 * result otherwise "BAD THINGS HAPPENS(TM)".
458 */
459static int dump_header_stats(struct musb *musb, char *buffer)
460{
461 int code, count = 0;
462 const void __iomem *mbase = musb->mregs;
463
464 *buffer = 0;
465 count = sprintf(buffer, "Status: %sHDRC, Mode=%s "
466 "(Power=%02x, DevCtl=%02x)\n",
467 (musb->is_multipoint ? "M" : ""), MUSB_MODE(musb),
468 musb_readb(mbase, MUSB_POWER),
469 musb_readb(mbase, MUSB_DEVCTL));
470 if (count <= 0)
471 return 0;
472 buffer += count;
473
474 code = sprintf(buffer, "OTG state: %s; %sactive\n",
475 otg_state_string(musb),
476 musb->is_active ? "" : "in");
477 if (code <= 0)
478 goto done;
479 buffer += code;
480 count += code;
481
482 code = sprintf(buffer,
483 "Options: "
484#ifdef CONFIG_MUSB_PIO_ONLY
485 "pio"
486#elif defined(CONFIG_USB_TI_CPPI_DMA)
487 "cppi-dma"
488#elif defined(CONFIG_USB_INVENTRA_DMA)
489 "musb-dma"
490#elif defined(CONFIG_USB_TUSB_OMAP_DMA)
491 "tusb-omap-dma"
492#else
493 "?dma?"
494#endif
495 ", "
496#ifdef CONFIG_USB_MUSB_OTG
497 "otg (peripheral+host)"
498#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
499 "peripheral"
500#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
501 "host"
502#endif
503 ", debug=%d [eps=%d]\n",
504 debug,
505 musb->nr_endpoints);
506 if (code <= 0)
507 goto done;
508 count += code;
509 buffer += code;
510
511#ifdef CONFIG_USB_GADGET_MUSB_HDRC
512 code = sprintf(buffer, "Peripheral address: %02x\n",
513 musb_readb(musb->ctrl_base, MUSB_FADDR));
514 if (code <= 0)
515 goto done;
516 buffer += code;
517 count += code;
518#endif
519
520#ifdef CONFIG_USB_MUSB_HDRC_HCD
521 code = sprintf(buffer, "Root port status: %08x\n",
522 musb->port1_status);
523 if (code <= 0)
524 goto done;
525 buffer += code;
526 count += code;
527#endif
528
529#ifdef CONFIG_ARCH_DAVINCI
530 code = sprintf(buffer,
531 "DaVinci: ctrl=%02x stat=%1x phy=%03x\n"
532 "\trndis=%05x auto=%04x intsrc=%08x intmsk=%08x"
533 "\n",
534 musb_readl(musb->ctrl_base, DAVINCI_USB_CTRL_REG),
535 musb_readl(musb->ctrl_base, DAVINCI_USB_STAT_REG),
536 __raw_readl((void __force __iomem *)
537 IO_ADDRESS(USBPHY_CTL_PADDR)),
538 musb_readl(musb->ctrl_base, DAVINCI_RNDIS_REG),
539 musb_readl(musb->ctrl_base, DAVINCI_AUTOREQ_REG),
540 musb_readl(musb->ctrl_base,
541 DAVINCI_USB_INT_SOURCE_REG),
542 musb_readl(musb->ctrl_base,
543 DAVINCI_USB_INT_MASK_REG));
544 if (code <= 0)
545 goto done;
546 count += code;
547 buffer += code;
548#endif /* DAVINCI */
549
550#ifdef CONFIG_USB_TUSB6010
551 code = sprintf(buffer,
552 "TUSB6010: devconf %08x, phy enable %08x drive %08x"
553 "\n\totg %03x timer %08x"
554 "\n\tprcm conf %08x mgmt %08x; int src %08x mask %08x"
555 "\n",
556 musb_readl(musb->ctrl_base, TUSB_DEV_CONF),
557 musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL_ENABLE),
558 musb_readl(musb->ctrl_base, TUSB_PHY_OTG_CTRL),
559 musb_readl(musb->ctrl_base, TUSB_DEV_OTG_STAT),
560 musb_readl(musb->ctrl_base, TUSB_DEV_OTG_TIMER),
561 musb_readl(musb->ctrl_base, TUSB_PRCM_CONF),
562 musb_readl(musb->ctrl_base, TUSB_PRCM_MNGMT),
563 musb_readl(musb->ctrl_base, TUSB_INT_SRC),
564 musb_readl(musb->ctrl_base, TUSB_INT_MASK));
565 if (code <= 0)
566 goto done;
567 count += code;
568 buffer += code;
569#endif /* DAVINCI */
570
571 if (is_cppi_enabled() && musb->dma_controller) {
572 code = sprintf(buffer,
573 "CPPI: txcr=%d txsrc=%01x txena=%01x; "
574 "rxcr=%d rxsrc=%01x rxena=%01x "
575 "\n",
576 musb_readl(musb->ctrl_base,
577 DAVINCI_TXCPPI_CTRL_REG),
578 musb_readl(musb->ctrl_base,
579 DAVINCI_TXCPPI_RAW_REG),
580 musb_readl(musb->ctrl_base,
581 DAVINCI_TXCPPI_INTENAB_REG),
582 musb_readl(musb->ctrl_base,
583 DAVINCI_RXCPPI_CTRL_REG),
584 musb_readl(musb->ctrl_base,
585 DAVINCI_RXCPPI_RAW_REG),
586 musb_readl(musb->ctrl_base,
587 DAVINCI_RXCPPI_INTENAB_REG));
588 if (code <= 0)
589 goto done;
590 count += code;
591 buffer += code;
592 }
593
594#ifdef CONFIG_USB_GADGET_MUSB_HDRC
595 if (is_peripheral_enabled(musb)) {
596 code = sprintf(buffer, "Gadget driver: %s\n",
597 musb->gadget_driver
598 ? musb->gadget_driver->driver.name
599 : "(none)");
600 if (code <= 0)
601 goto done;
602 count += code;
603 buffer += code;
604 }
605#endif
606
607done:
608 return count;
609}
610
611/* Write to ProcFS
612 *
613 * C soft-connect
614 * c soft-disconnect
615 * I enable HS
616 * i disable HS
617 * s stop session
618 * F force session (OTG-unfriendly)
619 * E rElinquish bus (OTG)
620 * H request host mode
621 * h cancel host request
622 * T start sending TEST_PACKET
623 * D<num> set/query the debug level
624 */
625static int musb_proc_write(struct file *file, const char __user *buffer,
626 unsigned long count, void *data)
627{
628 char cmd;
629 u8 reg;
630 struct musb *musb = (struct musb *)data;
631 void __iomem *mbase = musb->mregs;
632
633 /* MOD_INC_USE_COUNT; */
634
635 if (unlikely(copy_from_user(&cmd, buffer, 1)))
636 return -EFAULT;
637
638 switch (cmd) {
639 case 'C':
640 if (mbase) {
641 reg = musb_readb(mbase, MUSB_POWER)
642 | MUSB_POWER_SOFTCONN;
643 musb_writeb(mbase, MUSB_POWER, reg);
644 }
645 break;
646
647 case 'c':
648 if (mbase) {
649 reg = musb_readb(mbase, MUSB_POWER)
650 & ~MUSB_POWER_SOFTCONN;
651 musb_writeb(mbase, MUSB_POWER, reg);
652 }
653 break;
654
655 case 'I':
656 if (mbase) {
657 reg = musb_readb(mbase, MUSB_POWER)
658 | MUSB_POWER_HSENAB;
659 musb_writeb(mbase, MUSB_POWER, reg);
660 }
661 break;
662
663 case 'i':
664 if (mbase) {
665 reg = musb_readb(mbase, MUSB_POWER)
666 & ~MUSB_POWER_HSENAB;
667 musb_writeb(mbase, MUSB_POWER, reg);
668 }
669 break;
670
671 case 'F':
672 reg = musb_readb(mbase, MUSB_DEVCTL);
673 reg |= MUSB_DEVCTL_SESSION;
674 musb_writeb(mbase, MUSB_DEVCTL, reg);
675 break;
676
677 case 'H':
678 if (mbase) {
679 reg = musb_readb(mbase, MUSB_DEVCTL);
680 reg |= MUSB_DEVCTL_HR;
681 musb_writeb(mbase, MUSB_DEVCTL, reg);
682 /* MUSB_HST_MODE( ((struct musb*)data) ); */
683 /* WARNING("Host Mode\n"); */
684 }
685 break;
686
687 case 'h':
688 if (mbase) {
689 reg = musb_readb(mbase, MUSB_DEVCTL);
690 reg &= ~MUSB_DEVCTL_HR;
691 musb_writeb(mbase, MUSB_DEVCTL, reg);
692 }
693 break;
694
695 case 'T':
696 if (mbase) {
697 musb_load_testpacket(musb);
698 musb_writeb(mbase, MUSB_TESTMODE,
699 MUSB_TEST_PACKET);
700 }
701 break;
702
703#if (MUSB_DEBUG > 0)
704 /* set/read debug level */
705 case 'D':{
706 if (count > 1) {
707 char digits[8], *p = digits;
708 int i = 0, level = 0, sign = 1;
709 int len = min(count - 1, (unsigned long)8);
710
711 if (copy_from_user(&digits, &buffer[1], len))
712 return -EFAULT;
713
714 /* optional sign */
715 if (*p == '-') {
716 len -= 1;
717 sign = -sign;
718 p++;
719 }
720
721 /* read it */
722 while (i++ < len && *p > '0' && *p < '9') {
723 level = level * 10 + (*p - '0');
724 p++;
725 }
726
727 level *= sign;
728 DBG(1, "debug level %d\n", level);
729 debug = level;
730 }
731 }
732 break;
733
734
735 case '?':
736 INFO("?: you are seeing it\n");
737 INFO("C/c: soft connect enable/disable\n");
738 INFO("I/i: hispeed enable/disable\n");
739 INFO("F: force session start\n");
740 INFO("H: host mode\n");
741 INFO("T: start sending TEST_PACKET\n");
742 INFO("D: set/read dbug level\n");
743 break;
744#endif
745
746 default:
747 ERR("Command %c not implemented\n", cmd);
748 break;
749 }
750
751 musb_platform_try_idle(musb, 0);
752
753 return count;
754}
755
756static int musb_proc_read(char *page, char **start,
757 off_t off, int count, int *eof, void *data)
758{
759 char *buffer = page;
760 int code = 0;
761 unsigned long flags;
762 struct musb *musb = data;
763 unsigned epnum;
764
765 count -= off;
766 count -= 1; /* for NUL at end */
767 if (count <= 0)
768 return -EINVAL;
769
770 spin_lock_irqsave(&musb->lock, flags);
771
772 code = dump_header_stats(musb, buffer);
773 if (code > 0) {
774 buffer += code;
775 count -= code;
776 }
777
778 /* generate the report for the end points */
779 /* REVISIT ... not unless something's connected! */
780 for (epnum = 0; count >= 0 && epnum < musb->nr_endpoints;
781 epnum++) {
782 code = dump_end_info(musb, epnum, buffer, count);
783 if (code > 0) {
784 buffer += code;
785 count -= code;
786 }
787 }
788
789 musb_platform_try_idle(musb, 0);
790
791 spin_unlock_irqrestore(&musb->lock, flags);
792 *eof = 1;
793
794 return buffer - page;
795}
796
797void __devexit musb_debug_delete(char *name, struct musb *musb)
798{
799 if (musb->proc_entry)
800 remove_proc_entry(name, NULL);
801}
802
803struct proc_dir_entry *__init
804musb_debug_create(char *name, struct musb *data)
805{
806 struct proc_dir_entry *pde;
807
808 /* FIXME convert everything to seq_file; then later, debugfs */
809
810 if (!name)
811 return NULL;
812
813 pde = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, NULL);
814 data->proc_entry = pde;
815 if (pde) {
816 pde->data = data;
817 /* pde->owner = THIS_MODULE; */
818
819 pde->read_proc = musb_proc_read;
820 pde->write_proc = musb_proc_write;
821
822 pde->size = 0;
823
824 pr_debug("Registered /proc/%s\n", name);
825 } else {
826 pr_debug("Cannot create a valid proc file entry");
827 }
828
829 return pde;
830}
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e143198aeb0..9f9cd36455f 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -173,6 +173,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
173#define KYOCERA_PRODUCT_KPC680 0x180a 173#define KYOCERA_PRODUCT_KPC680 0x180a
174 174
175#define ANYDATA_VENDOR_ID 0x16d5 175#define ANYDATA_VENDOR_ID 0x16d5
176#define ANYDATA_PRODUCT_ADU_620UW 0x6202
176#define ANYDATA_PRODUCT_ADU_E100A 0x6501 177#define ANYDATA_PRODUCT_ADU_E100A 0x6501
177#define ANYDATA_PRODUCT_ADU_500A 0x6502 178#define ANYDATA_PRODUCT_ADU_500A 0x6502
178 179
@@ -318,6 +319,7 @@ static struct usb_device_id option_ids[] = {
318 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ 319 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
319 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 320 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
320 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 321 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
322 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
321 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, 323 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
322 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) }, 324 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_MSA501HS) },
323 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, 325 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) },
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index 940467aed13..6d5aa806777 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -733,7 +733,6 @@ static int bfin_bf54x_remove(struct platform_device *pdev)
733static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state) 733static int bfin_bf54x_suspend(struct platform_device *pdev, pm_message_t state)
734{ 734{
735 struct fb_info *fbinfo = platform_get_drvdata(pdev); 735 struct fb_info *fbinfo = platform_get_drvdata(pdev);
736 struct bfin_bf54xfb_info *info = fbinfo->par;
737 736
738 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN); 737 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() & ~EPPI_EN);
739 disable_dma(CH_EPPI0); 738 disable_dma(CH_EPPI0);
@@ -747,8 +746,18 @@ static int bfin_bf54x_resume(struct platform_device *pdev)
747 struct fb_info *fbinfo = platform_get_drvdata(pdev); 746 struct fb_info *fbinfo = platform_get_drvdata(pdev);
748 struct bfin_bf54xfb_info *info = fbinfo->par; 747 struct bfin_bf54xfb_info *info = fbinfo->par;
749 748
750 enable_dma(CH_EPPI0); 749 if (info->lq043_open_cnt) {
751 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() | EPPI_EN); 750
751 bfin_write_EPPI0_CONTROL(0);
752 SSYNC();
753
754 config_dma(info);
755 config_ppi(info);
756
757 /* start dma */
758 enable_dma(CH_EPPI0);
759 bfin_write_EPPI0_CONTROL(bfin_read_EPPI0_CONTROL() | EPPI_EN);
760 }
752 761
753 return 0; 762 return 0;
754} 763}
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 59df132cc37..4835bdc4e9f 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -114,6 +114,17 @@ static struct vm_operations_struct fb_deferred_io_vm_ops = {
114 .page_mkwrite = fb_deferred_io_mkwrite, 114 .page_mkwrite = fb_deferred_io_mkwrite,
115}; 115};
116 116
117static int fb_deferred_io_set_page_dirty(struct page *page)
118{
119 if (!PageDirty(page))
120 SetPageDirty(page);
121 return 0;
122}
123
124static const struct address_space_operations fb_deferred_io_aops = {
125 .set_page_dirty = fb_deferred_io_set_page_dirty,
126};
127
117static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma) 128static int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
118{ 129{
119 vma->vm_ops = &fb_deferred_io_vm_ops; 130 vma->vm_ops = &fb_deferred_io_vm_ops;
@@ -163,6 +174,14 @@ void fb_deferred_io_init(struct fb_info *info)
163} 174}
164EXPORT_SYMBOL_GPL(fb_deferred_io_init); 175EXPORT_SYMBOL_GPL(fb_deferred_io_init);
165 176
177void fb_deferred_io_open(struct fb_info *info,
178 struct inode *inode,
179 struct file *file)
180{
181 file->f_mapping->a_ops = &fb_deferred_io_aops;
182}
183EXPORT_SYMBOL_GPL(fb_deferred_io_open);
184
166void fb_deferred_io_cleanup(struct fb_info *info) 185void fb_deferred_io_cleanup(struct fb_info *info)
167{ 186{
168 void *screen_base = (void __force *) info->screen_base; 187 void *screen_base = (void __force *) info->screen_base;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 6b487801eea..98843c2ecf7 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1344,6 +1344,10 @@ fb_open(struct inode *inode, struct file *file)
1344 if (res) 1344 if (res)
1345 module_put(info->fbops->owner); 1345 module_put(info->fbops->owner);
1346 } 1346 }
1347#ifdef CONFIG_FB_DEFERRED_IO
1348 if (info->fbdefio)
1349 fb_deferred_io_open(info, inode, file);
1350#endif
1347out: 1351out:
1348 unlock_kernel(); 1352 unlock_kernel();
1349 return res; 1353 return res;
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 3f1ca2adda3..c6dd924976a 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -1746,6 +1746,7 @@ static void __devexit pm2fb_remove(struct pci_dev *pdev)
1746 release_mem_region(fix->mmio_start, fix->mmio_len); 1746 release_mem_region(fix->mmio_start, fix->mmio_len);
1747 1747
1748 pci_set_drvdata(pdev, NULL); 1748 pci_set_drvdata(pdev, NULL);
1749 fb_dealloc_cmap(&info->cmap);
1749 kfree(info->pixmap.addr); 1750 kfree(info->pixmap.addr);
1750 kfree(info); 1751 kfree(info);
1751} 1752}
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 756205314c2..8d7e88e02e0 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -120,8 +120,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
120 if (bprm->misc_bang) 120 if (bprm->misc_bang)
121 goto _ret; 121 goto _ret;
122 122
123 bprm->misc_bang = 1;
124
125 /* to keep locking time low, we copy the interpreter string */ 123 /* to keep locking time low, we copy the interpreter string */
126 read_lock(&entries_lock); 124 read_lock(&entries_lock);
127 fmt = check_file(bprm); 125 fmt = check_file(bprm);
@@ -199,6 +197,8 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
199 if (retval < 0) 197 if (retval < 0)
200 goto _error; 198 goto _error;
201 199
200 bprm->misc_bang = 1;
201
202 retval = search_binary_handler (bprm, regs); 202 retval = search_binary_handler (bprm, regs);
203 if (retval < 0) 203 if (retval < 0)
204 goto _error; 204 goto _error;
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 0c3b618c15b..f40423eb1a1 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -43,58 +43,13 @@ static DEFINE_MUTEX(read_mutex);
43static int cramfs_iget5_test(struct inode *inode, void *opaque) 43static int cramfs_iget5_test(struct inode *inode, void *opaque)
44{ 44{
45 struct cramfs_inode *cramfs_inode = opaque; 45 struct cramfs_inode *cramfs_inode = opaque;
46 46 return inode->i_ino == CRAMINO(cramfs_inode) && inode->i_ino != 1;
47 if (inode->i_ino != CRAMINO(cramfs_inode))
48 return 0; /* does not match */
49
50 if (inode->i_ino != 1)
51 return 1;
52
53 /* all empty directories, char, block, pipe, and sock, share inode #1 */
54
55 if ((inode->i_mode != cramfs_inode->mode) ||
56 (inode->i_gid != cramfs_inode->gid) ||
57 (inode->i_uid != cramfs_inode->uid))
58 return 0; /* does not match */
59
60 if ((S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) &&
61 (inode->i_rdev != old_decode_dev(cramfs_inode->size)))
62 return 0; /* does not match */
63
64 return 1; /* matches */
65} 47}
66 48
67static int cramfs_iget5_set(struct inode *inode, void *opaque) 49static int cramfs_iget5_set(struct inode *inode, void *opaque)
68{ 50{
69 static struct timespec zerotime;
70 struct cramfs_inode *cramfs_inode = opaque; 51 struct cramfs_inode *cramfs_inode = opaque;
71 inode->i_mode = cramfs_inode->mode;
72 inode->i_uid = cramfs_inode->uid;
73 inode->i_size = cramfs_inode->size;
74 inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
75 inode->i_gid = cramfs_inode->gid;
76 /* Struct copy intentional */
77 inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime;
78 inode->i_ino = CRAMINO(cramfs_inode); 52 inode->i_ino = CRAMINO(cramfs_inode);
79 /* inode->i_nlink is left 1 - arguably wrong for directories,
80 but it's the best we can do without reading the directory
81 contents. 1 yields the right result in GNU find, even
82 without -noleaf option. */
83 if (S_ISREG(inode->i_mode)) {
84 inode->i_fop = &generic_ro_fops;
85 inode->i_data.a_ops = &cramfs_aops;
86 } else if (S_ISDIR(inode->i_mode)) {
87 inode->i_op = &cramfs_dir_inode_operations;
88 inode->i_fop = &cramfs_directory_operations;
89 } else if (S_ISLNK(inode->i_mode)) {
90 inode->i_op = &page_symlink_inode_operations;
91 inode->i_data.a_ops = &cramfs_aops;
92 } else {
93 inode->i_size = 0;
94 inode->i_blocks = 0;
95 init_special_inode(inode, inode->i_mode,
96 old_decode_dev(cramfs_inode->size));
97 }
98 return 0; 53 return 0;
99} 54}
100 55
@@ -104,12 +59,48 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
104 struct inode *inode = iget5_locked(sb, CRAMINO(cramfs_inode), 59 struct inode *inode = iget5_locked(sb, CRAMINO(cramfs_inode),
105 cramfs_iget5_test, cramfs_iget5_set, 60 cramfs_iget5_test, cramfs_iget5_set,
106 cramfs_inode); 61 cramfs_inode);
62 static struct timespec zerotime;
63
107 if (inode && (inode->i_state & I_NEW)) { 64 if (inode && (inode->i_state & I_NEW)) {
65 inode->i_mode = cramfs_inode->mode;
66 inode->i_uid = cramfs_inode->uid;
67 inode->i_size = cramfs_inode->size;
68 inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1;
69 inode->i_gid = cramfs_inode->gid;
70 /* Struct copy intentional */
71 inode->i_mtime = inode->i_atime = inode->i_ctime = zerotime;
72 /* inode->i_nlink is left 1 - arguably wrong for directories,
73 but it's the best we can do without reading the directory
74 contents. 1 yields the right result in GNU find, even
75 without -noleaf option. */
76 if (S_ISREG(inode->i_mode)) {
77 inode->i_fop = &generic_ro_fops;
78 inode->i_data.a_ops = &cramfs_aops;
79 } else if (S_ISDIR(inode->i_mode)) {
80 inode->i_op = &cramfs_dir_inode_operations;
81 inode->i_fop = &cramfs_directory_operations;
82 } else if (S_ISLNK(inode->i_mode)) {
83 inode->i_op = &page_symlink_inode_operations;
84 inode->i_data.a_ops = &cramfs_aops;
85 } else {
86 inode->i_size = 0;
87 inode->i_blocks = 0;
88 init_special_inode(inode, inode->i_mode,
89 old_decode_dev(cramfs_inode->size));
90 }
108 unlock_new_inode(inode); 91 unlock_new_inode(inode);
109 } 92 }
110 return inode; 93 return inode;
111} 94}
112 95
96static void cramfs_drop_inode(struct inode *inode)
97{
98 if (inode->i_ino == 1)
99 generic_delete_inode(inode);
100 else
101 generic_drop_inode(inode);
102}
103
113/* 104/*
114 * We have our own block cache: don't fill up the buffer cache 105 * We have our own block cache: don't fill up the buffer cache
115 * with the rom-image, because the way the filesystem is set 106 * with the rom-image, because the way the filesystem is set
@@ -534,6 +525,7 @@ static const struct super_operations cramfs_ops = {
534 .put_super = cramfs_put_super, 525 .put_super = cramfs_put_super,
535 .remount_fs = cramfs_remount, 526 .remount_fs = cramfs_remount,
536 .statfs = cramfs_statfs, 527 .statfs = cramfs_statfs,
528 .drop_inode = cramfs_drop_inode,
537}; 529};
538 530
539static int cramfs_get_sb(struct file_system_type *fs_type, 531static int cramfs_get_sb(struct file_system_type *fs_type,
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 1ae5004e93f..e9fa960ba6d 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -1626,6 +1626,9 @@ ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi,
1626 free_blocks = 1626 free_blocks =
1627 percpu_counter_sum_and_set(&sbi->s_freeblocks_counter); 1627 percpu_counter_sum_and_set(&sbi->s_freeblocks_counter);
1628#endif 1628#endif
1629 if (free_blocks <= root_blocks)
1630 /* we don't have free space */
1631 return 0;
1629 if (free_blocks - root_blocks < nblocks) 1632 if (free_blocks - root_blocks < nblocks)
1630 return free_blocks - root_blocks; 1633 return free_blocks - root_blocks;
1631 return nblocks; 1634 return nblocks;
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index d3d23d73c08..ec8e33b4521 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -411,7 +411,7 @@ static int call_filldir(struct file * filp, void * dirent,
411 get_dtype(sb, fname->file_type)); 411 get_dtype(sb, fname->file_type));
412 if (error) { 412 if (error) {
413 filp->f_pos = curr_pos; 413 filp->f_pos = curr_pos;
414 info->extra_fname = fname->next; 414 info->extra_fname = fname;
415 return error; 415 return error;
416 } 416 }
417 fname = fname->next; 417 fname = fname->next;
@@ -450,11 +450,21 @@ static int ext4_dx_readdir(struct file * filp,
450 * If there are any leftover names on the hash collision 450 * If there are any leftover names on the hash collision
451 * chain, return them first. 451 * chain, return them first.
452 */ 452 */
453 if (info->extra_fname && 453 if (info->extra_fname) {
454 call_filldir(filp, dirent, filldir, info->extra_fname)) 454 if (call_filldir(filp, dirent, filldir, info->extra_fname))
455 goto finished; 455 goto finished;
456 456
457 if (!info->curr_node) 457 info->extra_fname = NULL;
458 info->curr_node = rb_next(info->curr_node);
459 if (!info->curr_node) {
460 if (info->next_hash == ~0) {
461 filp->f_pos = EXT4_HTREE_EOF;
462 goto finished;
463 }
464 info->curr_hash = info->next_hash;
465 info->curr_minor_hash = 0;
466 }
467 } else if (!info->curr_node)
458 info->curr_node = rb_first(&info->root); 468 info->curr_node = rb_first(&info->root);
459 469
460 while (1) { 470 while (1) {
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 6c7924d9e35..295003241d3 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1072,6 +1072,8 @@ extern void ext4_set_inode_flags(struct inode *);
1072extern void ext4_get_inode_flags(struct ext4_inode_info *); 1072extern void ext4_get_inode_flags(struct ext4_inode_info *);
1073extern void ext4_set_aops(struct inode *inode); 1073extern void ext4_set_aops(struct inode *inode);
1074extern int ext4_writepage_trans_blocks(struct inode *); 1074extern int ext4_writepage_trans_blocks(struct inode *);
1075extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks);
1076extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
1075extern int ext4_block_truncate_page(handle_t *handle, 1077extern int ext4_block_truncate_page(handle_t *handle,
1076 struct address_space *mapping, loff_t from); 1078 struct address_space *mapping, loff_t from);
1077extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page); 1079extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct page *page);
@@ -1227,6 +1229,8 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
1227/* extents.c */ 1229/* extents.c */
1228extern int ext4_ext_tree_init(handle_t *handle, struct inode *); 1230extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1229extern int ext4_ext_writepage_trans_blocks(struct inode *, int); 1231extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1232extern int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks,
1233 int chunk);
1230extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1234extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1231 ext4_lblk_t iblock, 1235 ext4_lblk_t iblock,
1232 unsigned long max_blocks, struct buffer_head *bh_result, 1236 unsigned long max_blocks, struct buffer_head *bh_result,
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h
index 6c166c0a54b..d33dc56d698 100644
--- a/fs/ext4/ext4_extents.h
+++ b/fs/ext4/ext4_extents.h
@@ -216,7 +216,9 @@ extern int ext4_ext_calc_metadata_amount(struct inode *inode, int blocks);
216extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *); 216extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
217extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t); 217extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
218extern int ext4_extent_tree_init(handle_t *, struct inode *); 218extern int ext4_extent_tree_init(handle_t *, struct inode *);
219extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 219extern int ext4_ext_calc_credits_for_single_extent(struct inode *inode,
220 int num,
221 struct ext4_ext_path *path);
220extern int ext4_ext_try_to_merge(struct inode *inode, 222extern int ext4_ext_try_to_merge(struct inode *inode,
221 struct ext4_ext_path *path, 223 struct ext4_ext_path *path,
222 struct ext4_extent *); 224 struct ext4_extent *);
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index eb8bc3afe6e..b455c685a98 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -51,6 +51,14 @@
51 EXT4_XATTR_TRANS_BLOCKS - 2 + \ 51 EXT4_XATTR_TRANS_BLOCKS - 2 + \
52 2*EXT4_QUOTA_TRANS_BLOCKS(sb)) 52 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
53 53
54/*
55 * Define the number of metadata blocks we need to account to modify data.
56 *
57 * This include super block, inode block, quota blocks and xattr blocks
58 */
59#define EXT4_META_TRANS_BLOCKS(sb) (EXT4_XATTR_TRANS_BLOCKS + \
60 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
61
54/* Delete operations potentially hit one directory's namespace plus an 62/* Delete operations potentially hit one directory's namespace plus an
55 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be 63 * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
56 * generous. We can grow the delete transaction later if necessary. */ 64 * generous. We can grow the delete transaction later if necessary. */
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 612c3d2c382..b24d3c53f20 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1747,54 +1747,61 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
1747} 1747}
1748 1748
1749/* 1749/*
1750 * ext4_ext_calc_credits_for_insert: 1750 * ext4_ext_calc_credits_for_single_extent:
1751 * This routine returns max. credits that the extent tree can consume. 1751 * This routine returns max. credits that needed to insert an extent
1752 * It should be OK for low-performance paths like ->writepage() 1752 * to the extent tree.
1753 * To allow many writing processes to fit into a single transaction, 1753 * When pass the actual path, the caller should calculate credits
1754 * the caller should calculate credits under i_data_sem and 1754 * under i_data_sem.
1755 * pass the actual path.
1756 */ 1755 */
1757int ext4_ext_calc_credits_for_insert(struct inode *inode, 1756int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks,
1758 struct ext4_ext_path *path) 1757 struct ext4_ext_path *path)
1759{ 1758{
1760 int depth, needed;
1761
1762 if (path) { 1759 if (path) {
1760 int depth = ext_depth(inode);
1761 int ret = 0;
1762
1763 /* probably there is space in leaf? */ 1763 /* probably there is space in leaf? */
1764 depth = ext_depth(inode);
1765 if (le16_to_cpu(path[depth].p_hdr->eh_entries) 1764 if (le16_to_cpu(path[depth].p_hdr->eh_entries)
1766 < le16_to_cpu(path[depth].p_hdr->eh_max)) 1765 < le16_to_cpu(path[depth].p_hdr->eh_max)) {
1767 return 1;
1768 }
1769 1766
1770 /* 1767 /*
1771 * given 32-bit logical block (4294967296 blocks), max. tree 1768 * There are some space in the leaf tree, no
1772 * can be 4 levels in depth -- 4 * 340^4 == 53453440000. 1769 * need to account for leaf block credit
1773 * Let's also add one more level for imbalance. 1770 *
1774 */ 1771 * bitmaps and block group descriptor blocks
1775 depth = 5; 1772 * and other metadat blocks still need to be
1776 1773 * accounted.
1777 /* allocation of new data block(s) */ 1774 */
1778 needed = 2; 1775 /* 1 bitmap, 1 block group descriptor */
1776 ret = 2 + EXT4_META_TRANS_BLOCKS(inode->i_sb);
1777 }
1778 }
1779 1779
1780 /* 1780 return ext4_chunk_trans_blocks(inode, nrblocks);
1781 * tree can be full, so it would need to grow in depth: 1781}
1782 * we need one credit to modify old root, credits for
1783 * new root will be added in split accounting
1784 */
1785 needed += 1;
1786 1782
1787 /* 1783/*
1788 * Index split can happen, we would need: 1784 * How many index/leaf blocks need to change/allocate to modify nrblocks?
1789 * allocate intermediate indexes (bitmap + group) 1785 *
1790 * + change two blocks at each level, but root (already included) 1786 * if nrblocks are fit in a single extent (chunk flag is 1), then
1791 */ 1787 * in the worse case, each tree level index/leaf need to be changed
1792 needed += (depth * 2) + (depth * 2); 1788 * if the tree split due to insert a new extent, then the old tree
1789 * index/leaf need to be updated too
1790 *
1791 * If the nrblocks are discontiguous, they could cause
1792 * the whole tree split more than once, but this is really rare.
1793 */
1794int ext4_ext_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
1795{
1796 int index;
1797 int depth = ext_depth(inode);
1793 1798
1794 /* any allocation modifies superblock */ 1799 if (chunk)
1795 needed += 1; 1800 index = depth * 2;
1801 else
1802 index = depth * 3;
1796 1803
1797 return needed; 1804 return index;
1798} 1805}
1799 1806
1800static int ext4_remove_blocks(handle_t *handle, struct inode *inode, 1807static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
@@ -1921,9 +1928,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
1921 correct_index = 1; 1928 correct_index = 1;
1922 credits += (ext_depth(inode)) + 1; 1929 credits += (ext_depth(inode)) + 1;
1923 } 1930 }
1924#ifdef CONFIG_QUOTA
1925 credits += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb); 1931 credits += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
1926#endif
1927 1932
1928 err = ext4_ext_journal_restart(handle, credits); 1933 err = ext4_ext_journal_restart(handle, credits);
1929 if (err) 1934 if (err)
@@ -2805,7 +2810,7 @@ void ext4_ext_truncate(struct inode *inode)
2805 /* 2810 /*
2806 * probably first extent we're gonna free will be last in block 2811 * probably first extent we're gonna free will be last in block
2807 */ 2812 */
2808 err = ext4_writepage_trans_blocks(inode) + 3; 2813 err = ext4_writepage_trans_blocks(inode);
2809 handle = ext4_journal_start(inode, err); 2814 handle = ext4_journal_start(inode, err);
2810 if (IS_ERR(handle)) 2815 if (IS_ERR(handle))
2811 return; 2816 return;
@@ -2819,7 +2824,7 @@ void ext4_ext_truncate(struct inode *inode)
2819 down_write(&EXT4_I(inode)->i_data_sem); 2824 down_write(&EXT4_I(inode)->i_data_sem);
2820 ext4_ext_invalidate_cache(inode); 2825 ext4_ext_invalidate_cache(inode);
2821 2826
2822 ext4_mb_discard_inode_preallocations(inode); 2827 ext4_discard_reservation(inode);
2823 2828
2824 /* 2829 /*
2825 * TODO: optimization is possible here. 2830 * TODO: optimization is possible here.
@@ -2858,27 +2863,6 @@ out_stop:
2858 ext4_journal_stop(handle); 2863 ext4_journal_stop(handle);
2859} 2864}
2860 2865
2861/*
2862 * ext4_ext_writepage_trans_blocks:
2863 * calculate max number of blocks we could modify
2864 * in order to allocate new block for an inode
2865 */
2866int ext4_ext_writepage_trans_blocks(struct inode *inode, int num)
2867{
2868 int needed;
2869
2870 needed = ext4_ext_calc_credits_for_insert(inode, NULL);
2871
2872 /* caller wants to allocate num blocks, but note it includes sb */
2873 needed = needed * num - (num - 1);
2874
2875#ifdef CONFIG_QUOTA
2876 needed += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
2877#endif
2878
2879 return needed;
2880}
2881
2882static void ext4_falloc_update_inode(struct inode *inode, 2866static void ext4_falloc_update_inode(struct inode *inode,
2883 int mode, loff_t new_size, int update_ctime) 2867 int mode, loff_t new_size, int update_ctime)
2884{ 2868{
@@ -2939,10 +2923,9 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len)
2939 max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) 2923 max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits)
2940 - block; 2924 - block;
2941 /* 2925 /*
2942 * credits to insert 1 extent into extent tree + buffers to be able to 2926 * credits to insert 1 extent into extent tree
2943 * modify 1 super block, 1 block bitmap and 1 group descriptor.
2944 */ 2927 */
2945 credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + 3; 2928 credits = ext4_chunk_trans_blocks(inode, max_blocks);
2946 mutex_lock(&inode->i_mutex); 2929 mutex_lock(&inode->i_mutex);
2947retry: 2930retry:
2948 while (ret >= 0 && ret < max_blocks) { 2931 while (ret >= 0 && ret < max_blocks) {
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 655e760212b..f344834bbf5 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -351,7 +351,7 @@ find_close_to_parent:
351 goto found_flexbg; 351 goto found_flexbg;
352 } 352 }
353 353
354 if (best_flex < 0 || 354 if (flex_group[best_flex].free_inodes == 0 ||
355 (flex_group[i].free_blocks > 355 (flex_group[i].free_blocks >
356 flex_group[best_flex].free_blocks && 356 flex_group[best_flex].free_blocks &&
357 flex_group[i].free_inodes)) 357 flex_group[i].free_inodes))
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 59fbbe899ac..7e91913e325 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -41,6 +41,8 @@
41#include "acl.h" 41#include "acl.h"
42#include "ext4_extents.h" 42#include "ext4_extents.h"
43 43
44#define MPAGE_DA_EXTENT_TAIL 0x01
45
44static inline int ext4_begin_ordered_truncate(struct inode *inode, 46static inline int ext4_begin_ordered_truncate(struct inode *inode,
45 loff_t new_size) 47 loff_t new_size)
46{ 48{
@@ -1005,6 +1007,9 @@ static int ext4_indirect_calc_metadata_amount(struct inode *inode, int blocks)
1005 */ 1007 */
1006static int ext4_calc_metadata_amount(struct inode *inode, int blocks) 1008static int ext4_calc_metadata_amount(struct inode *inode, int blocks)
1007{ 1009{
1010 if (!blocks)
1011 return 0;
1012
1008 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) 1013 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1009 return ext4_ext_calc_metadata_amount(inode, blocks); 1014 return ext4_ext_calc_metadata_amount(inode, blocks);
1010 1015
@@ -1041,18 +1046,6 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1041 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 1046 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1042} 1047}
1043 1048
1044/* Maximum number of blocks we map for direct IO at once. */
1045#define DIO_MAX_BLOCKS 4096
1046/*
1047 * Number of credits we need for writing DIO_MAX_BLOCKS:
1048 * We need sb + group descriptor + bitmap + inode -> 4
1049 * For B blocks with A block pointers per block we need:
1050 * 1 (triple ind.) + (B/A/A + 2) (doubly ind.) + (B/A + 2) (indirect).
1051 * If we plug in 4096 for B and 256 for A (for 1KB block size), we get 25.
1052 */
1053#define DIO_CREDITS 25
1054
1055
1056/* 1049/*
1057 * The ext4_get_blocks_wrap() function try to look up the requested blocks, 1050 * The ext4_get_blocks_wrap() function try to look up the requested blocks,
1058 * and returns if the blocks are already mapped. 1051 * and returns if the blocks are already mapped.
@@ -1164,19 +1157,23 @@ int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block,
1164 return retval; 1157 return retval;
1165} 1158}
1166 1159
1160/* Maximum number of blocks we map for direct IO at once. */
1161#define DIO_MAX_BLOCKS 4096
1162
1167static int ext4_get_block(struct inode *inode, sector_t iblock, 1163static int ext4_get_block(struct inode *inode, sector_t iblock,
1168 struct buffer_head *bh_result, int create) 1164 struct buffer_head *bh_result, int create)
1169{ 1165{
1170 handle_t *handle = ext4_journal_current_handle(); 1166 handle_t *handle = ext4_journal_current_handle();
1171 int ret = 0, started = 0; 1167 int ret = 0, started = 0;
1172 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; 1168 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
1169 int dio_credits;
1173 1170
1174 if (create && !handle) { 1171 if (create && !handle) {
1175 /* Direct IO write... */ 1172 /* Direct IO write... */
1176 if (max_blocks > DIO_MAX_BLOCKS) 1173 if (max_blocks > DIO_MAX_BLOCKS)
1177 max_blocks = DIO_MAX_BLOCKS; 1174 max_blocks = DIO_MAX_BLOCKS;
1178 handle = ext4_journal_start(inode, DIO_CREDITS + 1175 dio_credits = ext4_chunk_trans_blocks(inode, max_blocks);
1179 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb)); 1176 handle = ext4_journal_start(inode, dio_credits);
1180 if (IS_ERR(handle)) { 1177 if (IS_ERR(handle)) {
1181 ret = PTR_ERR(handle); 1178 ret = PTR_ERR(handle);
1182 goto out; 1179 goto out;
@@ -1559,7 +1556,25 @@ static void ext4_da_release_space(struct inode *inode, int to_free)
1559 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); 1556 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
1560 int total, mdb, mdb_free, release; 1557 int total, mdb, mdb_free, release;
1561 1558
1559 if (!to_free)
1560 return; /* Nothing to release, exit */
1561
1562 spin_lock(&EXT4_I(inode)->i_block_reservation_lock); 1562 spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
1563
1564 if (!EXT4_I(inode)->i_reserved_data_blocks) {
1565 /*
1566 * if there is no reserved blocks, but we try to free some
1567 * then the counter is messed up somewhere.
1568 * but since this function is called from invalidate
1569 * page, it's harmless to return without any action
1570 */
1571 printk(KERN_INFO "ext4 delalloc try to release %d reserved "
1572 "blocks for inode %lu, but there is no reserved "
1573 "data blocks\n", to_free, inode->i_ino);
1574 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
1575 return;
1576 }
1577
1563 /* recalculate the number of metablocks still need to be reserved */ 1578 /* recalculate the number of metablocks still need to be reserved */
1564 total = EXT4_I(inode)->i_reserved_data_blocks - to_free; 1579 total = EXT4_I(inode)->i_reserved_data_blocks - to_free;
1565 mdb = ext4_calc_metadata_amount(inode, total); 1580 mdb = ext4_calc_metadata_amount(inode, total);
@@ -1613,11 +1628,13 @@ struct mpage_da_data {
1613 unsigned long first_page, next_page; /* extent of pages */ 1628 unsigned long first_page, next_page; /* extent of pages */
1614 get_block_t *get_block; 1629 get_block_t *get_block;
1615 struct writeback_control *wbc; 1630 struct writeback_control *wbc;
1631 int io_done;
1632 long pages_written;
1616}; 1633};
1617 1634
1618/* 1635/*
1619 * mpage_da_submit_io - walks through extent of pages and try to write 1636 * mpage_da_submit_io - walks through extent of pages and try to write
1620 * them with __mpage_writepage() 1637 * them with writepage() call back
1621 * 1638 *
1622 * @mpd->inode: inode 1639 * @mpd->inode: inode
1623 * @mpd->first_page: first page of the extent 1640 * @mpd->first_page: first page of the extent
@@ -1632,18 +1649,11 @@ struct mpage_da_data {
1632static int mpage_da_submit_io(struct mpage_da_data *mpd) 1649static int mpage_da_submit_io(struct mpage_da_data *mpd)
1633{ 1650{
1634 struct address_space *mapping = mpd->inode->i_mapping; 1651 struct address_space *mapping = mpd->inode->i_mapping;
1635 struct mpage_data mpd_pp = {
1636 .bio = NULL,
1637 .last_block_in_bio = 0,
1638 .get_block = mpd->get_block,
1639 .use_writepage = 1,
1640 };
1641 int ret = 0, err, nr_pages, i; 1652 int ret = 0, err, nr_pages, i;
1642 unsigned long index, end; 1653 unsigned long index, end;
1643 struct pagevec pvec; 1654 struct pagevec pvec;
1644 1655
1645 BUG_ON(mpd->next_page <= mpd->first_page); 1656 BUG_ON(mpd->next_page <= mpd->first_page);
1646
1647 pagevec_init(&pvec, 0); 1657 pagevec_init(&pvec, 0);
1648 index = mpd->first_page; 1658 index = mpd->first_page;
1649 end = mpd->next_page - 1; 1659 end = mpd->next_page - 1;
@@ -1661,8 +1671,9 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
1661 break; 1671 break;
1662 index++; 1672 index++;
1663 1673
1664 err = __mpage_writepage(page, mpd->wbc, &mpd_pp); 1674 err = mapping->a_ops->writepage(page, mpd->wbc);
1665 1675 if (!err)
1676 mpd->pages_written++;
1666 /* 1677 /*
1667 * In error case, we have to continue because 1678 * In error case, we have to continue because
1668 * remaining pages are still locked 1679 * remaining pages are still locked
@@ -1673,9 +1684,6 @@ static int mpage_da_submit_io(struct mpage_da_data *mpd)
1673 } 1684 }
1674 pagevec_release(&pvec); 1685 pagevec_release(&pvec);
1675 } 1686 }
1676 if (mpd_pp.bio)
1677 mpage_bio_submit(WRITE, mpd_pp.bio);
1678
1679 return ret; 1687 return ret;
1680} 1688}
1681 1689
@@ -1698,7 +1706,7 @@ static void mpage_put_bnr_to_bhs(struct mpage_da_data *mpd, sector_t logical,
1698 int blocks = exbh->b_size >> inode->i_blkbits; 1706 int blocks = exbh->b_size >> inode->i_blkbits;
1699 sector_t pblock = exbh->b_blocknr, cur_logical; 1707 sector_t pblock = exbh->b_blocknr, cur_logical;
1700 struct buffer_head *head, *bh; 1708 struct buffer_head *head, *bh;
1701 unsigned long index, end; 1709 pgoff_t index, end;
1702 struct pagevec pvec; 1710 struct pagevec pvec;
1703 int nr_pages, i; 1711 int nr_pages, i;
1704 1712
@@ -1741,6 +1749,13 @@ static void mpage_put_bnr_to_bhs(struct mpage_da_data *mpd, sector_t logical,
1741 if (buffer_delay(bh)) { 1749 if (buffer_delay(bh)) {
1742 bh->b_blocknr = pblock; 1750 bh->b_blocknr = pblock;
1743 clear_buffer_delay(bh); 1751 clear_buffer_delay(bh);
1752 bh->b_bdev = inode->i_sb->s_bdev;
1753 } else if (buffer_unwritten(bh)) {
1754 bh->b_blocknr = pblock;
1755 clear_buffer_unwritten(bh);
1756 set_buffer_mapped(bh);
1757 set_buffer_new(bh);
1758 bh->b_bdev = inode->i_sb->s_bdev;
1744 } else if (buffer_mapped(bh)) 1759 } else if (buffer_mapped(bh))
1745 BUG_ON(bh->b_blocknr != pblock); 1760 BUG_ON(bh->b_blocknr != pblock);
1746 1761
@@ -1776,13 +1791,11 @@ static inline void __unmap_underlying_blocks(struct inode *inode,
1776 * 1791 *
1777 * The function skips space we know is already mapped to disk blocks. 1792 * The function skips space we know is already mapped to disk blocks.
1778 * 1793 *
1779 * The function ignores errors ->get_block() returns, thus real
1780 * error handling is postponed to __mpage_writepage()
1781 */ 1794 */
1782static void mpage_da_map_blocks(struct mpage_da_data *mpd) 1795static void mpage_da_map_blocks(struct mpage_da_data *mpd)
1783{ 1796{
1797 int err = 0;
1784 struct buffer_head *lbh = &mpd->lbh; 1798 struct buffer_head *lbh = &mpd->lbh;
1785 int err = 0, remain = lbh->b_size;
1786 sector_t next = lbh->b_blocknr; 1799 sector_t next = lbh->b_blocknr;
1787 struct buffer_head new; 1800 struct buffer_head new;
1788 1801
@@ -1792,38 +1805,36 @@ static void mpage_da_map_blocks(struct mpage_da_data *mpd)
1792 if (buffer_mapped(lbh) && !buffer_delay(lbh)) 1805 if (buffer_mapped(lbh) && !buffer_delay(lbh))
1793 return; 1806 return;
1794 1807
1795 while (remain) { 1808 new.b_state = lbh->b_state;
1796 new.b_state = lbh->b_state; 1809 new.b_blocknr = 0;
1797 new.b_blocknr = 0; 1810 new.b_size = lbh->b_size;
1798 new.b_size = remain;
1799 err = mpd->get_block(mpd->inode, next, &new, 1);
1800 if (err) {
1801 /*
1802 * Rather than implement own error handling
1803 * here, we just leave remaining blocks
1804 * unallocated and try again with ->writepage()
1805 */
1806 break;
1807 }
1808 BUG_ON(new.b_size == 0);
1809 1811
1810 if (buffer_new(&new)) 1812 /*
1811 __unmap_underlying_blocks(mpd->inode, &new); 1813 * If we didn't accumulate anything
1814 * to write simply return
1815 */
1816 if (!new.b_size)
1817 return;
1818 err = mpd->get_block(mpd->inode, next, &new, 1);
1819 if (err)
1820 return;
1821 BUG_ON(new.b_size == 0);
1812 1822
1813 /* 1823 if (buffer_new(&new))
1814 * If blocks are delayed marked, we need to 1824 __unmap_underlying_blocks(mpd->inode, &new);
1815 * put actual blocknr and drop delayed bit
1816 */
1817 if (buffer_delay(lbh))
1818 mpage_put_bnr_to_bhs(mpd, next, &new);
1819 1825
1820 /* go for the remaining blocks */ 1826 /*
1821 next += new.b_size >> mpd->inode->i_blkbits; 1827 * If blocks are delayed marked, we need to
1822 remain -= new.b_size; 1828 * put actual blocknr and drop delayed bit
1823 } 1829 */
1830 if (buffer_delay(lbh) || buffer_unwritten(lbh))
1831 mpage_put_bnr_to_bhs(mpd, next, &new);
1832
1833 return;
1824} 1834}
1825 1835
1826#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | (1 << BH_Delay)) 1836#define BH_FLAGS ((1 << BH_Uptodate) | (1 << BH_Mapped) | \
1837 (1 << BH_Delay) | (1 << BH_Unwritten))
1827 1838
1828/* 1839/*
1829 * mpage_add_bh_to_extent - try to add one more block to extent of blocks 1840 * mpage_add_bh_to_extent - try to add one more block to extent of blocks
@@ -1837,41 +1848,61 @@ static void mpage_da_map_blocks(struct mpage_da_data *mpd)
1837static void mpage_add_bh_to_extent(struct mpage_da_data *mpd, 1848static void mpage_add_bh_to_extent(struct mpage_da_data *mpd,
1838 sector_t logical, struct buffer_head *bh) 1849 sector_t logical, struct buffer_head *bh)
1839{ 1850{
1840 struct buffer_head *lbh = &mpd->lbh;
1841 sector_t next; 1851 sector_t next;
1852 size_t b_size = bh->b_size;
1853 struct buffer_head *lbh = &mpd->lbh;
1854 int nrblocks = lbh->b_size >> mpd->inode->i_blkbits;
1842 1855
1843 next = lbh->b_blocknr + (lbh->b_size >> mpd->inode->i_blkbits); 1856 /* check if thereserved journal credits might overflow */
1844 1857 if (!(EXT4_I(mpd->inode)->i_flags & EXT4_EXTENTS_FL)) {
1858 if (nrblocks >= EXT4_MAX_TRANS_DATA) {
1859 /*
1860 * With non-extent format we are limited by the journal
1861 * credit available. Total credit needed to insert
1862 * nrblocks contiguous blocks is dependent on the
1863 * nrblocks. So limit nrblocks.
1864 */
1865 goto flush_it;
1866 } else if ((nrblocks + (b_size >> mpd->inode->i_blkbits)) >
1867 EXT4_MAX_TRANS_DATA) {
1868 /*
1869 * Adding the new buffer_head would make it cross the
1870 * allowed limit for which we have journal credit
1871 * reserved. So limit the new bh->b_size
1872 */
1873 b_size = (EXT4_MAX_TRANS_DATA - nrblocks) <<
1874 mpd->inode->i_blkbits;
1875 /* we will do mpage_da_submit_io in the next loop */
1876 }
1877 }
1845 /* 1878 /*
1846 * First block in the extent 1879 * First block in the extent
1847 */ 1880 */
1848 if (lbh->b_size == 0) { 1881 if (lbh->b_size == 0) {
1849 lbh->b_blocknr = logical; 1882 lbh->b_blocknr = logical;
1850 lbh->b_size = bh->b_size; 1883 lbh->b_size = b_size;
1851 lbh->b_state = bh->b_state & BH_FLAGS; 1884 lbh->b_state = bh->b_state & BH_FLAGS;
1852 return; 1885 return;
1853 } 1886 }
1854 1887
1888 next = lbh->b_blocknr + nrblocks;
1855 /* 1889 /*
1856 * Can we merge the block to our big extent? 1890 * Can we merge the block to our big extent?
1857 */ 1891 */
1858 if (logical == next && (bh->b_state & BH_FLAGS) == lbh->b_state) { 1892 if (logical == next && (bh->b_state & BH_FLAGS) == lbh->b_state) {
1859 lbh->b_size += bh->b_size; 1893 lbh->b_size += b_size;
1860 return; 1894 return;
1861 } 1895 }
1862 1896
1897flush_it:
1863 /* 1898 /*
1864 * We couldn't merge the block to our extent, so we 1899 * We couldn't merge the block to our extent, so we
1865 * need to flush current extent and start new one 1900 * need to flush current extent and start new one
1866 */ 1901 */
1867 mpage_da_map_blocks(mpd); 1902 mpage_da_map_blocks(mpd);
1868 1903 mpage_da_submit_io(mpd);
1869 /* 1904 mpd->io_done = 1;
1870 * Now start a new extent 1905 return;
1871 */
1872 lbh->b_size = bh->b_size;
1873 lbh->b_state = bh->b_state & BH_FLAGS;
1874 lbh->b_blocknr = logical;
1875} 1906}
1876 1907
1877/* 1908/*
@@ -1891,17 +1922,35 @@ static int __mpage_da_writepage(struct page *page,
1891 struct buffer_head *bh, *head, fake; 1922 struct buffer_head *bh, *head, fake;
1892 sector_t logical; 1923 sector_t logical;
1893 1924
1925 if (mpd->io_done) {
1926 /*
1927 * Rest of the page in the page_vec
1928 * redirty then and skip then. We will
1929 * try to to write them again after
1930 * starting a new transaction
1931 */
1932 redirty_page_for_writepage(wbc, page);
1933 unlock_page(page);
1934 return MPAGE_DA_EXTENT_TAIL;
1935 }
1894 /* 1936 /*
1895 * Can we merge this page to current extent? 1937 * Can we merge this page to current extent?
1896 */ 1938 */
1897 if (mpd->next_page != page->index) { 1939 if (mpd->next_page != page->index) {
1898 /* 1940 /*
1899 * Nope, we can't. So, we map non-allocated blocks 1941 * Nope, we can't. So, we map non-allocated blocks
1900 * and start IO on them using __mpage_writepage() 1942 * and start IO on them using writepage()
1901 */ 1943 */
1902 if (mpd->next_page != mpd->first_page) { 1944 if (mpd->next_page != mpd->first_page) {
1903 mpage_da_map_blocks(mpd); 1945 mpage_da_map_blocks(mpd);
1904 mpage_da_submit_io(mpd); 1946 mpage_da_submit_io(mpd);
1947 /*
1948 * skip rest of the page in the page_vec
1949 */
1950 mpd->io_done = 1;
1951 redirty_page_for_writepage(wbc, page);
1952 unlock_page(page);
1953 return MPAGE_DA_EXTENT_TAIL;
1905 } 1954 }
1906 1955
1907 /* 1956 /*
@@ -1932,6 +1981,8 @@ static int __mpage_da_writepage(struct page *page,
1932 set_buffer_dirty(bh); 1981 set_buffer_dirty(bh);
1933 set_buffer_uptodate(bh); 1982 set_buffer_uptodate(bh);
1934 mpage_add_bh_to_extent(mpd, logical, bh); 1983 mpage_add_bh_to_extent(mpd, logical, bh);
1984 if (mpd->io_done)
1985 return MPAGE_DA_EXTENT_TAIL;
1935 } else { 1986 } else {
1936 /* 1987 /*
1937 * Page with regular buffer heads, just add all dirty ones 1988 * Page with regular buffer heads, just add all dirty ones
@@ -1940,8 +1991,12 @@ static int __mpage_da_writepage(struct page *page,
1940 bh = head; 1991 bh = head;
1941 do { 1992 do {
1942 BUG_ON(buffer_locked(bh)); 1993 BUG_ON(buffer_locked(bh));
1943 if (buffer_dirty(bh)) 1994 if (buffer_dirty(bh) &&
1995 (!buffer_mapped(bh) || buffer_delay(bh))) {
1944 mpage_add_bh_to_extent(mpd, logical, bh); 1996 mpage_add_bh_to_extent(mpd, logical, bh);
1997 if (mpd->io_done)
1998 return MPAGE_DA_EXTENT_TAIL;
1999 }
1945 logical++; 2000 logical++;
1946 } while ((bh = bh->b_this_page) != head); 2001 } while ((bh = bh->b_this_page) != head);
1947 } 2002 }
@@ -1960,22 +2015,13 @@ static int __mpage_da_writepage(struct page *page,
1960 * 2015 *
1961 * This is a library function, which implements the writepages() 2016 * This is a library function, which implements the writepages()
1962 * address_space_operation. 2017 * address_space_operation.
1963 *
1964 * In order to avoid duplication of logic that deals with partial pages,
1965 * multiple bio per page, etc, we find non-allocated blocks, allocate
1966 * them with minimal calls to ->get_block() and re-use __mpage_writepage()
1967 *
1968 * It's important that we call __mpage_writepage() only once for each
1969 * involved page, otherwise we'd have to implement more complicated logic
1970 * to deal with pages w/o PG_lock or w/ PG_writeback and so on.
1971 *
1972 * See comments to mpage_writepages()
1973 */ 2018 */
1974static int mpage_da_writepages(struct address_space *mapping, 2019static int mpage_da_writepages(struct address_space *mapping,
1975 struct writeback_control *wbc, 2020 struct writeback_control *wbc,
1976 get_block_t get_block) 2021 get_block_t get_block)
1977{ 2022{
1978 struct mpage_da_data mpd; 2023 struct mpage_da_data mpd;
2024 long to_write;
1979 int ret; 2025 int ret;
1980 2026
1981 if (!get_block) 2027 if (!get_block)
@@ -1989,17 +2035,22 @@ static int mpage_da_writepages(struct address_space *mapping,
1989 mpd.first_page = 0; 2035 mpd.first_page = 0;
1990 mpd.next_page = 0; 2036 mpd.next_page = 0;
1991 mpd.get_block = get_block; 2037 mpd.get_block = get_block;
2038 mpd.io_done = 0;
2039 mpd.pages_written = 0;
2040
2041 to_write = wbc->nr_to_write;
1992 2042
1993 ret = write_cache_pages(mapping, wbc, __mpage_da_writepage, &mpd); 2043 ret = write_cache_pages(mapping, wbc, __mpage_da_writepage, &mpd);
1994 2044
1995 /* 2045 /*
1996 * Handle last extent of pages 2046 * Handle last extent of pages
1997 */ 2047 */
1998 if (mpd.next_page != mpd.first_page) { 2048 if (!mpd.io_done && mpd.next_page != mpd.first_page) {
1999 mpage_da_map_blocks(&mpd); 2049 mpage_da_map_blocks(&mpd);
2000 mpage_da_submit_io(&mpd); 2050 mpage_da_submit_io(&mpd);
2001 } 2051 }
2002 2052
2053 wbc->nr_to_write = to_write - mpd.pages_written;
2003 return ret; 2054 return ret;
2004} 2055}
2005 2056
@@ -2204,63 +2255,95 @@ static int ext4_da_writepage(struct page *page,
2204} 2255}
2205 2256
2206/* 2257/*
2207 * For now just follow the DIO way to estimate the max credits 2258 * This is called via ext4_da_writepages() to
2208 * needed to write out EXT4_MAX_WRITEBACK_PAGES. 2259 * calulate the total number of credits to reserve to fit
2209 * todo: need to calculate the max credits need for 2260 * a single extent allocation into a single transaction,
2210 * extent based files, currently the DIO credits is based on 2261 * ext4_da_writpeages() will loop calling this before
2211 * indirect-blocks mapping way. 2262 * the block allocation.
2212 *
2213 * Probably should have a generic way to calculate credits
2214 * for DIO, writepages, and truncate
2215 */ 2263 */
2216#define EXT4_MAX_WRITEBACK_PAGES DIO_MAX_BLOCKS 2264
2217#define EXT4_MAX_WRITEBACK_CREDITS DIO_CREDITS 2265static int ext4_da_writepages_trans_blocks(struct inode *inode)
2266{
2267 int max_blocks = EXT4_I(inode)->i_reserved_data_blocks;
2268
2269 /*
2270 * With non-extent format the journal credit needed to
2271 * insert nrblocks contiguous block is dependent on
2272 * number of contiguous block. So we will limit
2273 * number of contiguous block to a sane value
2274 */
2275 if (!(inode->i_flags & EXT4_EXTENTS_FL) &&
2276 (max_blocks > EXT4_MAX_TRANS_DATA))
2277 max_blocks = EXT4_MAX_TRANS_DATA;
2278
2279 return ext4_chunk_trans_blocks(inode, max_blocks);
2280}
2218 2281
2219static int ext4_da_writepages(struct address_space *mapping, 2282static int ext4_da_writepages(struct address_space *mapping,
2220 struct writeback_control *wbc) 2283 struct writeback_control *wbc)
2221{ 2284{
2222 struct inode *inode = mapping->host;
2223 handle_t *handle = NULL; 2285 handle_t *handle = NULL;
2224 int needed_blocks;
2225 int ret = 0;
2226 long to_write;
2227 loff_t range_start = 0; 2286 loff_t range_start = 0;
2287 struct inode *inode = mapping->host;
2288 int needed_blocks, ret = 0, nr_to_writebump = 0;
2289 long to_write, pages_skipped = 0;
2290 struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
2228 2291
2229 /* 2292 /*
2230 * No pages to write? This is mainly a kludge to avoid starting 2293 * No pages to write? This is mainly a kludge to avoid starting
2231 * a transaction for special inodes like journal inode on last iput() 2294 * a transaction for special inodes like journal inode on last iput()
2232 * because that could violate lock ordering on umount 2295 * because that could violate lock ordering on umount
2233 */ 2296 */
2234 if (!mapping->nrpages) 2297 if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY))
2235 return 0; 2298 return 0;
2236
2237 /* 2299 /*
2238 * Estimate the worse case needed credits to write out 2300 * Make sure nr_to_write is >= sbi->s_mb_stream_request
2239 * EXT4_MAX_BUF_BLOCKS pages 2301 * This make sure small files blocks are allocated in
2302 * single attempt. This ensure that small files
2303 * get less fragmented.
2240 */ 2304 */
2241 needed_blocks = EXT4_MAX_WRITEBACK_CREDITS; 2305 if (wbc->nr_to_write < sbi->s_mb_stream_request) {
2306 nr_to_writebump = sbi->s_mb_stream_request - wbc->nr_to_write;
2307 wbc->nr_to_write = sbi->s_mb_stream_request;
2308 }
2242 2309
2243 to_write = wbc->nr_to_write; 2310 if (!wbc->range_cyclic)
2244 if (!wbc->range_cyclic) {
2245 /* 2311 /*
2246 * If range_cyclic is not set force range_cont 2312 * If range_cyclic is not set force range_cont
2247 * and save the old writeback_index 2313 * and save the old writeback_index
2248 */ 2314 */
2249 wbc->range_cont = 1; 2315 wbc->range_cont = 1;
2250 range_start = wbc->range_start;
2251 }
2252 2316
2253 while (!ret && to_write) { 2317 range_start = wbc->range_start;
2318 pages_skipped = wbc->pages_skipped;
2319
2320restart_loop:
2321 to_write = wbc->nr_to_write;
2322 while (!ret && to_write > 0) {
2323
2324 /*
2325 * we insert one extent at a time. So we need
2326 * credit needed for single extent allocation.
2327 * journalled mode is currently not supported
2328 * by delalloc
2329 */
2330 BUG_ON(ext4_should_journal_data(inode));
2331 needed_blocks = ext4_da_writepages_trans_blocks(inode);
2332
2254 /* start a new transaction*/ 2333 /* start a new transaction*/
2255 handle = ext4_journal_start(inode, needed_blocks); 2334 handle = ext4_journal_start(inode, needed_blocks);
2256 if (IS_ERR(handle)) { 2335 if (IS_ERR(handle)) {
2257 ret = PTR_ERR(handle); 2336 ret = PTR_ERR(handle);
2337 printk(KERN_EMERG "%s: jbd2_start: "
2338 "%ld pages, ino %lu; err %d\n", __func__,
2339 wbc->nr_to_write, inode->i_ino, ret);
2340 dump_stack();
2258 goto out_writepages; 2341 goto out_writepages;
2259 } 2342 }
2260 if (ext4_should_order_data(inode)) { 2343 if (ext4_should_order_data(inode)) {
2261 /* 2344 /*
2262 * With ordered mode we need to add 2345 * With ordered mode we need to add
2263 * the inode to the journal handle 2346 * the inode to the journal handl
2264 * when we do block allocation. 2347 * when we do block allocation.
2265 */ 2348 */
2266 ret = ext4_jbd2_file_inode(handle, inode); 2349 ret = ext4_jbd2_file_inode(handle, inode);
@@ -2268,20 +2351,20 @@ static int ext4_da_writepages(struct address_space *mapping,
2268 ext4_journal_stop(handle); 2351 ext4_journal_stop(handle);
2269 goto out_writepages; 2352 goto out_writepages;
2270 } 2353 }
2271
2272 } 2354 }
2273 /*
2274 * set the max dirty pages could be write at a time
2275 * to fit into the reserved transaction credits
2276 */
2277 if (wbc->nr_to_write > EXT4_MAX_WRITEBACK_PAGES)
2278 wbc->nr_to_write = EXT4_MAX_WRITEBACK_PAGES;
2279 2355
2280 to_write -= wbc->nr_to_write; 2356 to_write -= wbc->nr_to_write;
2281 ret = mpage_da_writepages(mapping, wbc, 2357 ret = mpage_da_writepages(mapping, wbc,
2282 ext4_da_get_block_write); 2358 ext4_da_get_block_write);
2283 ext4_journal_stop(handle); 2359 ext4_journal_stop(handle);
2284 if (wbc->nr_to_write) { 2360 if (ret == MPAGE_DA_EXTENT_TAIL) {
2361 /*
2362 * got one extent now try with
2363 * rest of the pages
2364 */
2365 to_write += wbc->nr_to_write;
2366 ret = 0;
2367 } else if (wbc->nr_to_write) {
2285 /* 2368 /*
2286 * There is no more writeout needed 2369 * There is no more writeout needed
2287 * or we requested for a noblocking writeout 2370 * or we requested for a noblocking writeout
@@ -2293,10 +2376,18 @@ static int ext4_da_writepages(struct address_space *mapping,
2293 wbc->nr_to_write = to_write; 2376 wbc->nr_to_write = to_write;
2294 } 2377 }
2295 2378
2296out_writepages: 2379 if (wbc->range_cont && (pages_skipped != wbc->pages_skipped)) {
2297 wbc->nr_to_write = to_write; 2380 /* We skipped pages in this loop */
2298 if (range_start)
2299 wbc->range_start = range_start; 2381 wbc->range_start = range_start;
2382 wbc->nr_to_write = to_write +
2383 wbc->pages_skipped - pages_skipped;
2384 wbc->pages_skipped = pages_skipped;
2385 goto restart_loop;
2386 }
2387
2388out_writepages:
2389 wbc->nr_to_write = to_write - nr_to_writebump;
2390 wbc->range_start = range_start;
2300 return ret; 2391 return ret;
2301} 2392}
2302 2393
@@ -3486,6 +3577,9 @@ void ext4_truncate(struct inode *inode)
3486 * modify the block allocation tree. 3577 * modify the block allocation tree.
3487 */ 3578 */
3488 down_write(&ei->i_data_sem); 3579 down_write(&ei->i_data_sem);
3580
3581 ext4_discard_reservation(inode);
3582
3489 /* 3583 /*
3490 * The orphan list entry will now protect us from any crash which 3584 * The orphan list entry will now protect us from any crash which
3491 * occurs before the truncate completes, so it is now safe to propagate 3585 * occurs before the truncate completes, so it is now safe to propagate
@@ -3555,8 +3649,6 @@ do_indirects:
3555 ; 3649 ;
3556 } 3650 }
3557 3651
3558 ext4_discard_reservation(inode);
3559
3560 up_write(&ei->i_data_sem); 3652 up_write(&ei->i_data_sem);
3561 inode->i_mtime = inode->i_ctime = ext4_current_time(inode); 3653 inode->i_mtime = inode->i_ctime = ext4_current_time(inode);
3562 ext4_mark_inode_dirty(handle, inode); 3654 ext4_mark_inode_dirty(handle, inode);
@@ -4324,57 +4416,129 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry,
4324 return 0; 4416 return 0;
4325} 4417}
4326 4418
4419static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks,
4420 int chunk)
4421{
4422 int indirects;
4423
4424 /* if nrblocks are contiguous */
4425 if (chunk) {
4426 /*
4427 * With N contiguous data blocks, it need at most
4428 * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) indirect blocks
4429 * 2 dindirect blocks
4430 * 1 tindirect block
4431 */
4432 indirects = nrblocks / EXT4_ADDR_PER_BLOCK(inode->i_sb);
4433 return indirects + 3;
4434 }
4435 /*
4436 * if nrblocks are not contiguous, worse case, each block touch
4437 * a indirect block, and each indirect block touch a double indirect
4438 * block, plus a triple indirect block
4439 */
4440 indirects = nrblocks * 2 + 1;
4441 return indirects;
4442}
4443
4444static int ext4_index_trans_blocks(struct inode *inode, int nrblocks, int chunk)
4445{
4446 if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL))
4447 return ext4_indirect_trans_blocks(inode, nrblocks, 0);
4448 return ext4_ext_index_trans_blocks(inode, nrblocks, 0);
4449}
4327/* 4450/*
4328 * How many blocks doth make a writepage()? 4451 * Account for index blocks, block groups bitmaps and block group
4329 * 4452 * descriptor blocks if modify datablocks and index blocks
4330 * With N blocks per page, it may be: 4453 * worse case, the indexs blocks spread over different block groups
4331 * N data blocks
4332 * 2 indirect block
4333 * 2 dindirect
4334 * 1 tindirect
4335 * N+5 bitmap blocks (from the above)
4336 * N+5 group descriptor summary blocks
4337 * 1 inode block
4338 * 1 superblock.
4339 * 2 * EXT4_SINGLEDATA_TRANS_BLOCKS for the quote files
4340 * 4454 *
4341 * 3 * (N + 5) + 2 + 2 * EXT4_SINGLEDATA_TRANS_BLOCKS 4455 * If datablocks are discontiguous, they are possible to spread over
4456 * different block groups too. If they are contiugous, with flexbg,
4457 * they could still across block group boundary.
4342 * 4458 *
4343 * With ordered or writeback data it's the same, less the N data blocks. 4459 * Also account for superblock, inode, quota and xattr blocks
4460 */
4461int ext4_meta_trans_blocks(struct inode *inode, int nrblocks, int chunk)
4462{
4463 int groups, gdpblocks;
4464 int idxblocks;
4465 int ret = 0;
4466
4467 /*
4468 * How many index blocks need to touch to modify nrblocks?
4469 * The "Chunk" flag indicating whether the nrblocks is
4470 * physically contiguous on disk
4471 *
4472 * For Direct IO and fallocate, they calls get_block to allocate
4473 * one single extent at a time, so they could set the "Chunk" flag
4474 */
4475 idxblocks = ext4_index_trans_blocks(inode, nrblocks, chunk);
4476
4477 ret = idxblocks;
4478
4479 /*
4480 * Now let's see how many group bitmaps and group descriptors need
4481 * to account
4482 */
4483 groups = idxblocks;
4484 if (chunk)
4485 groups += 1;
4486 else
4487 groups += nrblocks;
4488
4489 gdpblocks = groups;
4490 if (groups > EXT4_SB(inode->i_sb)->s_groups_count)
4491 groups = EXT4_SB(inode->i_sb)->s_groups_count;
4492 if (groups > EXT4_SB(inode->i_sb)->s_gdb_count)
4493 gdpblocks = EXT4_SB(inode->i_sb)->s_gdb_count;
4494
4495 /* bitmaps and block group descriptor blocks */
4496 ret += groups + gdpblocks;
4497
4498 /* Blocks for super block, inode, quota and xattr blocks */
4499 ret += EXT4_META_TRANS_BLOCKS(inode->i_sb);
4500
4501 return ret;
4502}
4503
4504/*
4505 * Calulate the total number of credits to reserve to fit
4506 * the modification of a single pages into a single transaction,
4507 * which may include multiple chunks of block allocations.
4344 * 4508 *
4345 * If the inode's direct blocks can hold an integral number of pages then a 4509 * This could be called via ext4_write_begin()
4346 * page cannot straddle two indirect blocks, and we can only touch one indirect
4347 * and dindirect block, and the "5" above becomes "3".
4348 * 4510 *
4349 * This still overestimates under most circumstances. If we were to pass the 4511 * We need to consider the worse case, when
4350 * start and end offsets in here as well we could do block_to_path() on each 4512 * one new block per extent.
4351 * block and work out the exact number of indirects which are touched. Pah.
4352 */ 4513 */
4353
4354int ext4_writepage_trans_blocks(struct inode *inode) 4514int ext4_writepage_trans_blocks(struct inode *inode)
4355{ 4515{
4356 int bpp = ext4_journal_blocks_per_page(inode); 4516 int bpp = ext4_journal_blocks_per_page(inode);
4357 int indirects = (EXT4_NDIR_BLOCKS % bpp) ? 5 : 3;
4358 int ret; 4517 int ret;
4359 4518
4360 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) 4519 ret = ext4_meta_trans_blocks(inode, bpp, 0);
4361 return ext4_ext_writepage_trans_blocks(inode, bpp);
4362 4520
4521 /* Account for data blocks for journalled mode */
4363 if (ext4_should_journal_data(inode)) 4522 if (ext4_should_journal_data(inode))
4364 ret = 3 * (bpp + indirects) + 2; 4523 ret += bpp;
4365 else
4366 ret = 2 * (bpp + indirects) + 2;
4367
4368#ifdef CONFIG_QUOTA
4369 /* We know that structure was already allocated during DQUOT_INIT so
4370 * we will be updating only the data blocks + inodes */
4371 ret += 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
4372#endif
4373
4374 return ret; 4524 return ret;
4375} 4525}
4376 4526
4377/* 4527/*
4528 * Calculate the journal credits for a chunk of data modification.
4529 *
4530 * This is called from DIO, fallocate or whoever calling
4531 * ext4_get_blocks_wrap() to map/allocate a chunk of contigous disk blocks.
4532 *
4533 * journal buffers for data blocks are not included here, as DIO
4534 * and fallocate do no need to journal data buffers.
4535 */
4536int ext4_chunk_trans_blocks(struct inode *inode, int nrblocks)
4537{
4538 return ext4_meta_trans_blocks(inode, nrblocks, 1);
4539}
4540
4541/*
4378 * The caller must have previously called ext4_reserve_inode_write(). 4542 * The caller must have previously called ext4_reserve_inode_write().
4379 * Give this, we know that the caller already has write access to iloc->bh. 4543 * Give this, we know that the caller already has write access to iloc->bh.
4380 */ 4544 */
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 865e9ddb44d..e0e3a5eb1dd 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3282,6 +3282,35 @@ static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac,
3282} 3282}
3283 3283
3284/* 3284/*
3285 * Return the prealloc space that have minimal distance
3286 * from the goal block. @cpa is the prealloc
3287 * space that is having currently known minimal distance
3288 * from the goal block.
3289 */
3290static struct ext4_prealloc_space *
3291ext4_mb_check_group_pa(ext4_fsblk_t goal_block,
3292 struct ext4_prealloc_space *pa,
3293 struct ext4_prealloc_space *cpa)
3294{
3295 ext4_fsblk_t cur_distance, new_distance;
3296
3297 if (cpa == NULL) {
3298 atomic_inc(&pa->pa_count);
3299 return pa;
3300 }
3301 cur_distance = abs(goal_block - cpa->pa_pstart);
3302 new_distance = abs(goal_block - pa->pa_pstart);
3303
3304 if (cur_distance < new_distance)
3305 return cpa;
3306
3307 /* drop the previous reference */
3308 atomic_dec(&cpa->pa_count);
3309 atomic_inc(&pa->pa_count);
3310 return pa;
3311}
3312
3313/*
3285 * search goal blocks in preallocated space 3314 * search goal blocks in preallocated space
3286 */ 3315 */
3287static noinline_for_stack int 3316static noinline_for_stack int
@@ -3290,7 +3319,8 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3290 int order, i; 3319 int order, i;
3291 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode); 3320 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);
3292 struct ext4_locality_group *lg; 3321 struct ext4_locality_group *lg;
3293 struct ext4_prealloc_space *pa; 3322 struct ext4_prealloc_space *pa, *cpa = NULL;
3323 ext4_fsblk_t goal_block;
3294 3324
3295 /* only data can be preallocated */ 3325 /* only data can be preallocated */
3296 if (!(ac->ac_flags & EXT4_MB_HINT_DATA)) 3326 if (!(ac->ac_flags & EXT4_MB_HINT_DATA))
@@ -3333,6 +3363,13 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3333 /* The max size of hash table is PREALLOC_TB_SIZE */ 3363 /* The max size of hash table is PREALLOC_TB_SIZE */
3334 order = PREALLOC_TB_SIZE - 1; 3364 order = PREALLOC_TB_SIZE - 1;
3335 3365
3366 goal_block = ac->ac_g_ex.fe_group * EXT4_BLOCKS_PER_GROUP(ac->ac_sb) +
3367 ac->ac_g_ex.fe_start +
3368 le32_to_cpu(EXT4_SB(ac->ac_sb)->s_es->s_first_data_block);
3369 /*
3370 * search for the prealloc space that is having
3371 * minimal distance from the goal block.
3372 */
3336 for (i = order; i < PREALLOC_TB_SIZE; i++) { 3373 for (i = order; i < PREALLOC_TB_SIZE; i++) {
3337 rcu_read_lock(); 3374 rcu_read_lock();
3338 list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[i], 3375 list_for_each_entry_rcu(pa, &lg->lg_prealloc_list[i],
@@ -3340,17 +3377,19 @@ ext4_mb_use_preallocated(struct ext4_allocation_context *ac)
3340 spin_lock(&pa->pa_lock); 3377 spin_lock(&pa->pa_lock);
3341 if (pa->pa_deleted == 0 && 3378 if (pa->pa_deleted == 0 &&
3342 pa->pa_free >= ac->ac_o_ex.fe_len) { 3379 pa->pa_free >= ac->ac_o_ex.fe_len) {
3343 atomic_inc(&pa->pa_count); 3380
3344 ext4_mb_use_group_pa(ac, pa); 3381 cpa = ext4_mb_check_group_pa(goal_block,
3345 spin_unlock(&pa->pa_lock); 3382 pa, cpa);
3346 ac->ac_criteria = 20;
3347 rcu_read_unlock();
3348 return 1;
3349 } 3383 }
3350 spin_unlock(&pa->pa_lock); 3384 spin_unlock(&pa->pa_lock);
3351 } 3385 }
3352 rcu_read_unlock(); 3386 rcu_read_unlock();
3353 } 3387 }
3388 if (cpa) {
3389 ext4_mb_use_group_pa(ac, cpa);
3390 ac->ac_criteria = 20;
3391 return 1;
3392 }
3354 return 0; 3393 return 0;
3355} 3394}
3356 3395
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
index b9e077ba07e..46fc0b5b12b 100644
--- a/fs/ext4/migrate.c
+++ b/fs/ext4/migrate.c
@@ -53,7 +53,8 @@ static int finish_range(handle_t *handle, struct inode *inode,
53 * credit. But below we try to not accumalate too much 53 * credit. But below we try to not accumalate too much
54 * of them by restarting the journal. 54 * of them by restarting the journal.
55 */ 55 */
56 needed = ext4_ext_calc_credits_for_insert(inode, path); 56 needed = ext4_ext_calc_credits_for_single_extent(inode,
57 lb->last_block - lb->first_block + 1, path);
57 58
58 /* 59 /*
59 * Make sure the credit we accumalated is not really high 60 * Make sure the credit we accumalated is not really high
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 0a926516426..b3d35604ea1 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -773,7 +773,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
773 773
774 if (reserved_gdb || gdb_off == 0) { 774 if (reserved_gdb || gdb_off == 0) {
775 if (!EXT4_HAS_COMPAT_FEATURE(sb, 775 if (!EXT4_HAS_COMPAT_FEATURE(sb,
776 EXT4_FEATURE_COMPAT_RESIZE_INODE)){ 776 EXT4_FEATURE_COMPAT_RESIZE_INODE)
777 || !le16_to_cpu(es->s_reserved_gdt_blocks)) {
777 ext4_warning(sb, __func__, 778 ext4_warning(sb, __func__,
778 "No reserved GDT blocks, can't resize"); 779 "No reserved GDT blocks, can't resize");
779 return -EPERM; 780 return -EPERM;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d5d77958b86..566344b926b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -568,6 +568,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
568#endif 568#endif
569 ei->i_block_alloc_info = NULL; 569 ei->i_block_alloc_info = NULL;
570 ei->vfs_inode.i_version = 1; 570 ei->vfs_inode.i_version = 1;
571 ei->vfs_inode.i_data.writeback_index = 0;
571 memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache)); 572 memset(&ei->i_cached_extent, 0, sizeof(struct ext4_ext_cache));
572 INIT_LIST_HEAD(&ei->i_prealloc_list); 573 INIT_LIST_HEAD(&ei->i_prealloc_list);
573 spin_lock_init(&ei->i_prealloc_lock); 574 spin_lock_init(&ei->i_prealloc_lock);
diff --git a/fs/ioprio.c b/fs/ioprio.c
index c4a1c3c65aa..da3cc460d4d 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -115,11 +115,11 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
115 pgrp = task_pgrp(current); 115 pgrp = task_pgrp(current);
116 else 116 else
117 pgrp = find_vpid(who); 117 pgrp = find_vpid(who);
118 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 118 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
119 ret = set_task_ioprio(p, ioprio); 119 ret = set_task_ioprio(p, ioprio);
120 if (ret) 120 if (ret)
121 break; 121 break;
122 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 122 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
123 break; 123 break;
124 case IOPRIO_WHO_USER: 124 case IOPRIO_WHO_USER:
125 if (!who) 125 if (!who)
@@ -204,7 +204,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
204 pgrp = task_pgrp(current); 204 pgrp = task_pgrp(current);
205 else 205 else
206 pgrp = find_vpid(who); 206 pgrp = find_vpid(who);
207 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 207 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
208 tmpio = get_task_ioprio(p); 208 tmpio = get_task_ioprio(p);
209 if (tmpio < 0) 209 if (tmpio < 0)
210 continue; 210 continue;
@@ -212,7 +212,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
212 ret = tmpio; 212 ret = tmpio;
213 else 213 else
214 ret = ioprio_best(ret, tmpio); 214 ret = ioprio_best(ret, tmpio);
215 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 215 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
216 break; 216 break;
217 case IOPRIO_WHO_USER: 217 case IOPRIO_WHO_USER:
218 if (!who) 218 if (!who)
diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c
index 79ecd281d2c..3f87d263294 100644
--- a/fs/proc/nommu.c
+++ b/fs/proc/nommu.c
@@ -52,14 +52,14 @@ int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma)
52 } 52 }
53 53
54 seq_printf(m, 54 seq_printf(m,
55 "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n", 55 "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
56 vma->vm_start, 56 vma->vm_start,
57 vma->vm_end, 57 vma->vm_end,
58 flags & VM_READ ? 'r' : '-', 58 flags & VM_READ ? 'r' : '-',
59 flags & VM_WRITE ? 'w' : '-', 59 flags & VM_WRITE ? 'w' : '-',
60 flags & VM_EXEC ? 'x' : '-', 60 flags & VM_EXEC ? 'x' : '-',
61 flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p', 61 flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
62 vma->vm_pgoff << PAGE_SHIFT, 62 ((loff_t)vma->vm_pgoff) << PAGE_SHIFT,
63 MAJOR(dev), MINOR(dev), ino, &len); 63 MAJOR(dev), MINOR(dev), ino, &len);
64 64
65 if (file) { 65 if (file) {
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 7546a918f79..73d1891ee62 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -219,14 +219,14 @@ static int show_map(struct seq_file *m, void *v)
219 ino = inode->i_ino; 219 ino = inode->i_ino;
220 } 220 }
221 221
222 seq_printf(m, "%08lx-%08lx %c%c%c%c %08lx %02x:%02x %lu %n", 222 seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
223 vma->vm_start, 223 vma->vm_start,
224 vma->vm_end, 224 vma->vm_end,
225 flags & VM_READ ? 'r' : '-', 225 flags & VM_READ ? 'r' : '-',
226 flags & VM_WRITE ? 'w' : '-', 226 flags & VM_WRITE ? 'w' : '-',
227 flags & VM_EXEC ? 'x' : '-', 227 flags & VM_EXEC ? 'x' : '-',
228 flags & VM_MAYSHARE ? 's' : 'p', 228 flags & VM_MAYSHARE ? 's' : 'p',
229 vma->vm_pgoff << PAGE_SHIFT, 229 ((loff_t)vma->vm_pgoff) << PAGE_SHIFT,
230 MAJOR(dev), MINOR(dev), ino, &len); 230 MAJOR(dev), MINOR(dev), ino, &len);
231 231
232 /* 232 /*
diff --git a/include/asm-x86/genapic_32.h b/include/asm-x86/genapic_32.h
index b02ea6e17de..754d635f90f 100644
--- a/include/asm-x86/genapic_32.h
+++ b/include/asm-x86/genapic_32.h
@@ -118,6 +118,7 @@ enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
118#define get_uv_system_type() UV_NONE 118#define get_uv_system_type() UV_NONE
119#define is_uv_system() 0 119#define is_uv_system() 0
120#define uv_wakeup_secondary(a, b) 1 120#define uv_wakeup_secondary(a, b) 1
121#define uv_system_init() do {} while (0)
121 122
122 123
123#endif 124#endif
diff --git a/include/asm-x86/genapic_64.h b/include/asm-x86/genapic_64.h
index 0f8504627c4..a47d6312913 100644
--- a/include/asm-x86/genapic_64.h
+++ b/include/asm-x86/genapic_64.h
@@ -42,6 +42,7 @@ extern int is_uv_system(void);
42extern struct genapic apic_x2apic_uv_x; 42extern struct genapic apic_x2apic_uv_x;
43DECLARE_PER_CPU(int, x2apic_extra_bits); 43DECLARE_PER_CPU(int, x2apic_extra_bits);
44extern void uv_cpu_init(void); 44extern void uv_cpu_init(void);
45extern void uv_system_init(void);
45extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); 46extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip);
46 47
47extern void setup_apic_routing(void); 48extern void setup_apic_routing(void);
diff --git a/include/asm-x86/irq_vectors.h b/include/asm-x86/irq_vectors.h
index b95d167b7fb..a48c7f2dbdc 100644
--- a/include/asm-x86/irq_vectors.h
+++ b/include/asm-x86/irq_vectors.h
@@ -76,6 +76,7 @@
76#define CALL_FUNCTION_SINGLE_VECTOR 0xfb 76#define CALL_FUNCTION_SINGLE_VECTOR 0xfb
77#define THERMAL_APIC_VECTOR 0xfa 77#define THERMAL_APIC_VECTOR 0xfa
78#define THRESHOLD_APIC_VECTOR 0xf9 78#define THRESHOLD_APIC_VECTOR 0xf9
79#define UV_BAU_MESSAGE 0xf8
79#define INVALIDATE_TLB_VECTOR_END 0xf7 80#define INVALIDATE_TLB_VECTOR_END 0xf7
80#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */ 81#define INVALIDATE_TLB_VECTOR_START 0xf0 /* f0-f7 used for TLB flush */
81 82
diff --git a/include/asm-x86/uv/uv_bau.h b/include/asm-x86/uv/uv_bau.h
index 91ac0dfb758..610b6b308e9 100644
--- a/include/asm-x86/uv/uv_bau.h
+++ b/include/asm-x86/uv/uv_bau.h
@@ -40,11 +40,6 @@
40#define UV_ACTIVATION_DESCRIPTOR_SIZE 32 40#define UV_ACTIVATION_DESCRIPTOR_SIZE 32
41#define UV_DISTRIBUTION_SIZE 256 41#define UV_DISTRIBUTION_SIZE 256
42#define UV_SW_ACK_NPENDING 8 42#define UV_SW_ACK_NPENDING 8
43#define UV_BAU_MESSAGE 200
44/*
45 * Messaging irq; see irq_64.h and include/asm-x86/hw_irq_64.h
46 * To be dynamically allocated in the future
47 */
48#define UV_NET_ENDPOINT_INTD 0x38 43#define UV_NET_ENDPOINT_INTD 0x38
49#define UV_DESC_BASE_PNODE_SHIFT 49 44#define UV_DESC_BASE_PNODE_SHIFT 49
50#define UV_PAYLOADQ_PNODE_SHIFT 49 45#define UV_PAYLOADQ_PNODE_SHIFT 49
diff --git a/include/linux/device.h b/include/linux/device.h
index d24a47f80f9..4d8372d135d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -358,6 +358,7 @@ struct device {
358 358
359 struct kobject kobj; 359 struct kobject kobj;
360 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 360 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
361 const char *init_name; /* initial name of the device */
361 struct device_type *type; 362 struct device_type *type;
362 unsigned uevent_suppress:1; 363 unsigned uevent_suppress:1;
363 364
@@ -406,7 +407,7 @@ struct device {
406/* Get the wakeup routines, which depend on struct device */ 407/* Get the wakeup routines, which depend on struct device */
407#include <linux/pm_wakeup.h> 408#include <linux/pm_wakeup.h>
408 409
409static inline const char *dev_name(struct device *dev) 410static inline const char *dev_name(const struct device *dev)
410{ 411{
411 /* will be changed into kobject_name(&dev->kobj) in the near future */ 412 /* will be changed into kobject_name(&dev->kobj) in the near future */
412 return dev->bus_id; 413 return dev->bus_id;
@@ -518,7 +519,7 @@ extern void device_shutdown(void);
518extern void sysdev_shutdown(void); 519extern void sysdev_shutdown(void);
519 520
520/* debugging and troubleshooting/diagnostic helpers. */ 521/* debugging and troubleshooting/diagnostic helpers. */
521extern const char *dev_driver_string(struct device *dev); 522extern const char *dev_driver_string(const struct device *dev);
522#define dev_printk(level, dev, format, arg...) \ 523#define dev_printk(level, dev, format, arg...) \
523 printk(level "%s %s: " format , dev_driver_string(dev) , \ 524 printk(level "%s %s: " format , dev_driver_string(dev) , \
524 dev_name(dev) , ## arg) 525 dev_name(dev) , ## arg)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 3b8870e32af..531ccd5f596 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -976,6 +976,9 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
976 976
977/* drivers/video/fb_defio.c */ 977/* drivers/video/fb_defio.c */
978extern void fb_deferred_io_init(struct fb_info *info); 978extern void fb_deferred_io_init(struct fb_info *info);
979extern void fb_deferred_io_open(struct fb_info *info,
980 struct inode *inode,
981 struct file *file);
979extern void fb_deferred_io_cleanup(struct fb_info *info); 982extern void fb_deferred_io_cleanup(struct fb_info *info);
980extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 983extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
981 int datasync); 984 int datasync);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 06b80337303..225bfc5bd9e 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -163,6 +163,7 @@ enum {
163 ATA_DEV_NONE = 9, /* no device */ 163 ATA_DEV_NONE = 9, /* no device */
164 164
165 /* struct ata_link flags */ 165 /* struct ata_link flags */
166 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */
166 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 167 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
167 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 168 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
168 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ 169 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
@@ -646,6 +647,7 @@ struct ata_link {
646 647
647 unsigned int flags; /* ATA_LFLAG_xxx */ 648 unsigned int flags; /* ATA_LFLAG_xxx */
648 649
650 u32 saved_scontrol; /* SControl on probe */
649 unsigned int hw_sata_spd_limit; 651 unsigned int hw_sata_spd_limit;
650 unsigned int sata_spd_limit; 652 unsigned int sata_spd_limit;
651 unsigned int sata_spd; /* current SATA PHY speed */ 653 unsigned int sata_spd; /* current SATA PHY speed */
@@ -1427,6 +1429,28 @@ static inline unsigned long ata_deadline(unsigned long from_jiffies,
1427 return from_jiffies + msecs_to_jiffies(timeout_msecs); 1429 return from_jiffies + msecs_to_jiffies(timeout_msecs);
1428} 1430}
1429 1431
1432/* Don't open code these in drivers as there are traps. Firstly the range may
1433 change in future hardware and specs, secondly 0xFF means 'no DMA' but is
1434 > UDMA_0. Dyma ddreigiau */
1435
1436static inline int ata_using_mwdma(struct ata_device *adev)
1437{
1438 if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4)
1439 return 1;
1440 return 0;
1441}
1442
1443static inline int ata_using_udma(struct ata_device *adev)
1444{
1445 if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7)
1446 return 1;
1447 return 0;
1448}
1449
1450static inline int ata_dma_enabled(struct ata_device *adev)
1451{
1452 return (adev->dma_mode == 0xFF ? 0 : 1);
1453}
1430 1454
1431/************************************************************************** 1455/**************************************************************************
1432 * PMP - drivers/ata/libata-pmp.c 1456 * PMP - drivers/ata/libata-pmp.c
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 22921ac4cfd..d7e98ff8021 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -161,4 +161,13 @@ pid_t pid_vnr(struct pid *pid);
161 } \ 161 } \
162 } while (0) 162 } while (0)
163 163
164#define do_each_pid_thread(pid, type, task) \
165 do_each_pid_task(pid, type, task) { \
166 struct task_struct *tg___ = task; \
167 do {
168
169#define while_each_pid_thread(pid, type, task) \
170 } while_each_thread(tg___, task); \
171 task = tg___; \
172 } while_each_pid_task(pid, type, task)
164#endif /* _LINUX_PID_H */ 173#endif /* _LINUX_PID_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 69407f85e10..fed6f5e0b41 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -102,7 +102,7 @@ int try_to_unmap(struct page *, int ignore_refs);
102 * Called from mm/filemap_xip.c to unmap empty zero page 102 * Called from mm/filemap_xip.c to unmap empty zero page
103 */ 103 */
104pte_t *page_check_address(struct page *, struct mm_struct *, 104pte_t *page_check_address(struct page *, struct mm_struct *,
105 unsigned long, spinlock_t **); 105 unsigned long, spinlock_t **, int);
106 106
107/* 107/*
108 * Used by swapoff to help locate where page is expected in vma. 108 * Used by swapoff to help locate where page is expected in vma.
diff --git a/include/linux/tick.h b/include/linux/tick.h
index d3c02695dc5..8cf8cfe2cc9 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -74,10 +74,13 @@ extern struct tick_device *tick_get_device(int cpu);
74extern int tick_init_highres(void); 74extern int tick_init_highres(void);
75extern int tick_program_event(ktime_t expires, int force); 75extern int tick_program_event(ktime_t expires, int force);
76extern void tick_setup_sched_timer(void); 76extern void tick_setup_sched_timer(void);
77# endif
78
79# if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
77extern void tick_cancel_sched_timer(int cpu); 80extern void tick_cancel_sched_timer(int cpu);
78# else 81# else
79static inline void tick_cancel_sched_timer(int cpu) { } 82static inline void tick_cancel_sched_timer(int cpu) { }
80# endif /* HIGHRES */ 83# endif
81 84
82# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
83extern struct tick_device *tick_get_broadcast_device(void); 86extern struct tick_device *tick_get_broadcast_device(void);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0924cd9c30f..94ac74aba6b 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -110,6 +110,8 @@ enum usb_interface_condition {
110 * @sysfs_files_created: sysfs attributes exist 110 * @sysfs_files_created: sysfs attributes exist
111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
112 * capability during autosuspend. 112 * capability during autosuspend.
113 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
114 * has been deferred.
113 * @needs_binding: flag set when the driver should be re-probed or unbound 115 * @needs_binding: flag set when the driver should be re-probed or unbound
114 * following a reset or suspend operation it doesn't support. 116 * following a reset or suspend operation it doesn't support.
115 * @dev: driver model's view of this device 117 * @dev: driver model's view of this device
@@ -162,6 +164,7 @@ struct usb_interface {
162 unsigned is_active:1; /* the interface is not suspended */ 164 unsigned is_active:1; /* the interface is not suspended */
163 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 165 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
164 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 166 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
167 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
165 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 168 unsigned needs_binding:1; /* needs delayed unbind/rebind */
166 169
167 struct device dev; /* interface specific device info */ 170 struct device dev; /* interface specific device info */
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index f14f372cf6f..467d5940f62 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -77,6 +77,7 @@ void wakeme_after_rcu(struct rcu_head *head)
77 * sections are delimited by rcu_read_lock() and rcu_read_unlock(), 77 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
78 * and may be nested. 78 * and may be nested.
79 */ 79 */
80void synchronize_rcu(void); /* Makes kernel-doc tools happy */
80synchronize_rcu_xxx(synchronize_rcu, call_rcu) 81synchronize_rcu_xxx(synchronize_rcu, call_rcu)
81EXPORT_SYMBOL_GPL(synchronize_rcu); 82EXPORT_SYMBOL_GPL(synchronize_rcu);
82 83
diff --git a/kernel/sched_features.h b/kernel/sched_features.h
index 862b06bd560..9353ca78154 100644
--- a/kernel/sched_features.h
+++ b/kernel/sched_features.h
@@ -8,6 +8,6 @@ SCHED_FEAT(SYNC_WAKEUPS, 1)
8SCHED_FEAT(HRTICK, 1) 8SCHED_FEAT(HRTICK, 1)
9SCHED_FEAT(DOUBLE_TICK, 0) 9SCHED_FEAT(DOUBLE_TICK, 0)
10SCHED_FEAT(ASYM_GRAN, 1) 10SCHED_FEAT(ASYM_GRAN, 1)
11SCHED_FEAT(LB_BIAS, 0) 11SCHED_FEAT(LB_BIAS, 1)
12SCHED_FEAT(LB_WAKEUP_UPDATE, 1) 12SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
13SCHED_FEAT(ASYM_EFF_LOAD, 1) 13SCHED_FEAT(ASYM_EFF_LOAD, 1)
diff --git a/kernel/sys.c b/kernel/sys.c
index 3dacb00a7f7..038a7bc0901 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -169,9 +169,9 @@ asmlinkage long sys_setpriority(int which, int who, int niceval)
169 pgrp = find_vpid(who); 169 pgrp = find_vpid(who);
170 else 170 else
171 pgrp = task_pgrp(current); 171 pgrp = task_pgrp(current);
172 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 172 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
173 error = set_one_prio(p, niceval, error); 173 error = set_one_prio(p, niceval, error);
174 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 174 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
175 break; 175 break;
176 case PRIO_USER: 176 case PRIO_USER:
177 user = current->user; 177 user = current->user;
@@ -229,11 +229,11 @@ asmlinkage long sys_getpriority(int which, int who)
229 pgrp = find_vpid(who); 229 pgrp = find_vpid(who);
230 else 230 else
231 pgrp = task_pgrp(current); 231 pgrp = task_pgrp(current);
232 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 232 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
233 niceval = 20 - task_nice(p); 233 niceval = 20 - task_nice(p);
234 if (niceval > retval) 234 if (niceval > retval)
235 retval = niceval; 235 retval = niceval;
236 } while_each_pid_task(pgrp, PIDTYPE_PGID, p); 236 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
237 break; 237 break;
238 case PRIO_USER: 238 case PRIO_USER:
239 user = current->user; 239 user = current->user;
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index f5da526424a..7a46bde78c6 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -643,17 +643,21 @@ void tick_setup_sched_timer(void)
643 ts->nohz_mode = NOHZ_MODE_HIGHRES; 643 ts->nohz_mode = NOHZ_MODE_HIGHRES;
644#endif 644#endif
645} 645}
646#endif /* HIGH_RES_TIMERS */
646 647
648#if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
647void tick_cancel_sched_timer(int cpu) 649void tick_cancel_sched_timer(int cpu)
648{ 650{
649 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu); 651 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
650 652
653# ifdef CONFIG_HIGH_RES_TIMERS
651 if (ts->sched_timer.base) 654 if (ts->sched_timer.base)
652 hrtimer_cancel(&ts->sched_timer); 655 hrtimer_cancel(&ts->sched_timer);
656# endif
653 657
654 ts->nohz_mode = NOHZ_MODE_INACTIVE; 658 ts->nohz_mode = NOHZ_MODE_INACTIVE;
655} 659}
656#endif /* HIGH_RES_TIMERS */ 660#endif
657 661
658/** 662/**
659 * Async notification about clocksource changes 663 * Async notification about clocksource changes
diff --git a/lib/kobject.c b/lib/kobject.c
index bd732ffebc8..fbf0ae28237 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -223,8 +223,7 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
223 return -ENOMEM; 223 return -ENOMEM;
224 224
225 /* ewww... some of these buggers have '/' in the name ... */ 225 /* ewww... some of these buggers have '/' in the name ... */
226 s = strchr(kobj->name, '/'); 226 while ((s = strchr(kobj->name, '/')))
227 if (s)
228 s[0] = '!'; 227 s[0] = '!';
229 228
230 kfree(old_name); 229 kfree(old_name);
diff --git a/mm/bootmem.c b/mm/bootmem.c
index e023c68b025..ad8eec6e44a 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -405,6 +405,29 @@ int __init reserve_bootmem(unsigned long addr, unsigned long size,
405} 405}
406#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ 406#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
407 407
408static unsigned long align_idx(struct bootmem_data *bdata, unsigned long idx,
409 unsigned long step)
410{
411 unsigned long base = bdata->node_min_pfn;
412
413 /*
414 * Align the index with respect to the node start so that the
415 * combination of both satisfies the requested alignment.
416 */
417
418 return ALIGN(base + idx, step) - base;
419}
420
421static unsigned long align_off(struct bootmem_data *bdata, unsigned long off,
422 unsigned long align)
423{
424 unsigned long base = PFN_PHYS(bdata->node_min_pfn);
425
426 /* Same as align_idx for byte offsets */
427
428 return ALIGN(base + off, align) - base;
429}
430
408static void * __init alloc_bootmem_core(struct bootmem_data *bdata, 431static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
409 unsigned long size, unsigned long align, 432 unsigned long size, unsigned long align,
410 unsigned long goal, unsigned long limit) 433 unsigned long goal, unsigned long limit)
@@ -441,7 +464,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
441 else 464 else
442 start = ALIGN(min, step); 465 start = ALIGN(min, step);
443 466
444 sidx = start - bdata->node_min_pfn;; 467 sidx = start - bdata->node_min_pfn;
445 midx = max - bdata->node_min_pfn; 468 midx = max - bdata->node_min_pfn;
446 469
447 if (bdata->hint_idx > sidx) { 470 if (bdata->hint_idx > sidx) {
@@ -450,7 +473,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
450 * catch the fallback below. 473 * catch the fallback below.
451 */ 474 */
452 fallback = sidx + 1; 475 fallback = sidx + 1;
453 sidx = ALIGN(bdata->hint_idx, step); 476 sidx = align_idx(bdata, bdata->hint_idx, step);
454 } 477 }
455 478
456 while (1) { 479 while (1) {
@@ -459,7 +482,7 @@ static void * __init alloc_bootmem_core(struct bootmem_data *bdata,
459 unsigned long eidx, i, start_off, end_off; 482 unsigned long eidx, i, start_off, end_off;
460find_block: 483find_block:
461 sidx = find_next_zero_bit(bdata->node_bootmem_map, midx, sidx); 484 sidx = find_next_zero_bit(bdata->node_bootmem_map, midx, sidx);
462 sidx = ALIGN(sidx, step); 485 sidx = align_idx(bdata, sidx, step);
463 eidx = sidx + PFN_UP(size); 486 eidx = sidx + PFN_UP(size);
464 487
465 if (sidx >= midx || eidx > midx) 488 if (sidx >= midx || eidx > midx)
@@ -467,7 +490,7 @@ find_block:
467 490
468 for (i = sidx; i < eidx; i++) 491 for (i = sidx; i < eidx; i++)
469 if (test_bit(i, bdata->node_bootmem_map)) { 492 if (test_bit(i, bdata->node_bootmem_map)) {
470 sidx = ALIGN(i, step); 493 sidx = align_idx(bdata, i, step);
471 if (sidx == i) 494 if (sidx == i)
472 sidx += step; 495 sidx += step;
473 goto find_block; 496 goto find_block;
@@ -475,7 +498,7 @@ find_block:
475 498
476 if (bdata->last_end_off & (PAGE_SIZE - 1) && 499 if (bdata->last_end_off & (PAGE_SIZE - 1) &&
477 PFN_DOWN(bdata->last_end_off) + 1 == sidx) 500 PFN_DOWN(bdata->last_end_off) + 1 == sidx)
478 start_off = ALIGN(bdata->last_end_off, align); 501 start_off = align_off(bdata, bdata->last_end_off, align);
479 else 502 else
480 start_off = PFN_PHYS(sidx); 503 start_off = PFN_PHYS(sidx);
481 504
@@ -499,7 +522,7 @@ find_block:
499 } 522 }
500 523
501 if (fallback) { 524 if (fallback) {
502 sidx = ALIGN(fallback - 1, step); 525 sidx = align_idx(bdata, fallback - 1, step);
503 fallback = 0; 526 fallback = 0;
504 goto find_block; 527 goto find_block;
505 } 528 }
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 380ab402d71..b5167dfb2f2 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -15,6 +15,8 @@
15#include <linux/rmap.h> 15#include <linux/rmap.h>
16#include <linux/mmu_notifier.h> 16#include <linux/mmu_notifier.h>
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/seqlock.h>
19#include <linux/mutex.h>
18#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
19#include <asm/io.h> 21#include <asm/io.h>
20 22
@@ -22,22 +24,18 @@
22 * We do use our own empty page to avoid interference with other users 24 * We do use our own empty page to avoid interference with other users
23 * of ZERO_PAGE(), such as /dev/zero 25 * of ZERO_PAGE(), such as /dev/zero
24 */ 26 */
27static DEFINE_MUTEX(xip_sparse_mutex);
28static seqcount_t xip_sparse_seq = SEQCNT_ZERO;
25static struct page *__xip_sparse_page; 29static struct page *__xip_sparse_page;
26 30
31/* called under xip_sparse_mutex */
27static struct page *xip_sparse_page(void) 32static struct page *xip_sparse_page(void)
28{ 33{
29 if (!__xip_sparse_page) { 34 if (!__xip_sparse_page) {
30 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO); 35 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
31 36
32 if (page) { 37 if (page)
33 static DEFINE_SPINLOCK(xip_alloc_lock); 38 __xip_sparse_page = page;
34 spin_lock(&xip_alloc_lock);
35 if (!__xip_sparse_page)
36 __xip_sparse_page = page;
37 else
38 __free_page(page);
39 spin_unlock(&xip_alloc_lock);
40 }
41 } 39 }
42 return __xip_sparse_page; 40 return __xip_sparse_page;
43} 41}
@@ -174,18 +172,23 @@ __xip_unmap (struct address_space * mapping,
174 pte_t pteval; 172 pte_t pteval;
175 spinlock_t *ptl; 173 spinlock_t *ptl;
176 struct page *page; 174 struct page *page;
175 unsigned count;
176 int locked = 0;
177
178 count = read_seqcount_begin(&xip_sparse_seq);
177 179
178 page = __xip_sparse_page; 180 page = __xip_sparse_page;
179 if (!page) 181 if (!page)
180 return; 182 return;
181 183
184retry:
182 spin_lock(&mapping->i_mmap_lock); 185 spin_lock(&mapping->i_mmap_lock);
183 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) { 186 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
184 mm = vma->vm_mm; 187 mm = vma->vm_mm;
185 address = vma->vm_start + 188 address = vma->vm_start +
186 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); 189 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
187 BUG_ON(address < vma->vm_start || address >= vma->vm_end); 190 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
188 pte = page_check_address(page, mm, address, &ptl); 191 pte = page_check_address(page, mm, address, &ptl, 1);
189 if (pte) { 192 if (pte) {
190 /* Nuke the page table entry. */ 193 /* Nuke the page table entry. */
191 flush_cache_page(vma, address, pte_pfn(*pte)); 194 flush_cache_page(vma, address, pte_pfn(*pte));
@@ -198,6 +201,14 @@ __xip_unmap (struct address_space * mapping,
198 } 201 }
199 } 202 }
200 spin_unlock(&mapping->i_mmap_lock); 203 spin_unlock(&mapping->i_mmap_lock);
204
205 if (locked) {
206 mutex_unlock(&xip_sparse_mutex);
207 } else if (read_seqcount_retry(&xip_sparse_seq, count)) {
208 mutex_lock(&xip_sparse_mutex);
209 locked = 1;
210 goto retry;
211 }
201} 212}
202 213
203/* 214/*
@@ -218,7 +229,7 @@ static int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
218 int error; 229 int error;
219 230
220 /* XXX: are VM_FAULT_ codes OK? */ 231 /* XXX: are VM_FAULT_ codes OK? */
221 232again:
222 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 233 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
223 if (vmf->pgoff >= size) 234 if (vmf->pgoff >= size)
224 return VM_FAULT_SIGBUS; 235 return VM_FAULT_SIGBUS;
@@ -237,8 +248,10 @@ static int xip_file_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
237 int err; 248 int err;
238 249
239 /* maybe shared writable, allocate new block */ 250 /* maybe shared writable, allocate new block */
251 mutex_lock(&xip_sparse_mutex);
240 error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 1, 252 error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 1,
241 &xip_mem, &xip_pfn); 253 &xip_mem, &xip_pfn);
254 mutex_unlock(&xip_sparse_mutex);
242 if (error) 255 if (error)
243 return VM_FAULT_SIGBUS; 256 return VM_FAULT_SIGBUS;
244 /* unmap sparse mappings at pgoff from all other vmas */ 257 /* unmap sparse mappings at pgoff from all other vmas */
@@ -252,14 +265,34 @@ found:
252 BUG_ON(err); 265 BUG_ON(err);
253 return VM_FAULT_NOPAGE; 266 return VM_FAULT_NOPAGE;
254 } else { 267 } else {
268 int err, ret = VM_FAULT_OOM;
269
270 mutex_lock(&xip_sparse_mutex);
271 write_seqcount_begin(&xip_sparse_seq);
272 error = mapping->a_ops->get_xip_mem(mapping, vmf->pgoff, 0,
273 &xip_mem, &xip_pfn);
274 if (unlikely(!error)) {
275 write_seqcount_end(&xip_sparse_seq);
276 mutex_unlock(&xip_sparse_mutex);
277 goto again;
278 }
279 if (error != -ENODATA)
280 goto out;
255 /* not shared and writable, use xip_sparse_page() */ 281 /* not shared and writable, use xip_sparse_page() */
256 page = xip_sparse_page(); 282 page = xip_sparse_page();
257 if (!page) 283 if (!page)
258 return VM_FAULT_OOM; 284 goto out;
285 err = vm_insert_page(vma, (unsigned long)vmf->virtual_address,
286 page);
287 if (err == -ENOMEM)
288 goto out;
259 289
260 page_cache_get(page); 290 ret = VM_FAULT_NOPAGE;
261 vmf->page = page; 291out:
262 return 0; 292 write_seqcount_end(&xip_sparse_seq);
293 mutex_unlock(&xip_sparse_mutex);
294
295 return ret;
263 } 296 }
264} 297}
265 298
@@ -308,8 +341,10 @@ __xip_file_write(struct file *filp, const char __user *buf,
308 &xip_mem, &xip_pfn); 341 &xip_mem, &xip_pfn);
309 if (status == -ENODATA) { 342 if (status == -ENODATA) {
310 /* we allocate a new page unmap it */ 343 /* we allocate a new page unmap it */
344 mutex_lock(&xip_sparse_mutex);
311 status = a_ops->get_xip_mem(mapping, index, 1, 345 status = a_ops->get_xip_mem(mapping, index, 1,
312 &xip_mem, &xip_pfn); 346 &xip_mem, &xip_pfn);
347 mutex_unlock(&xip_sparse_mutex);
313 if (!status) 348 if (!status)
314 /* unmap page at pgoff from all other vmas */ 349 /* unmap page at pgoff from all other vmas */
315 __xip_unmap(mapping, index); 350 __xip_unmap(mapping, index);
diff --git a/mm/mm_init.c b/mm/mm_init.c
index 936ef2efd89..4e0e26591df 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -12,7 +12,7 @@
12#include "internal.h" 12#include "internal.h"
13 13
14#ifdef CONFIG_DEBUG_MEMORY_INIT 14#ifdef CONFIG_DEBUG_MEMORY_INIT
15int __meminitdata mminit_loglevel; 15int mminit_loglevel;
16 16
17#ifndef SECTIONS_SHIFT 17#ifndef SECTIONS_SHIFT
18#define SECTIONS_SHIFT 0 18#define SECTIONS_SHIFT 0
diff --git a/mm/rmap.c b/mm/rmap.c
index 1ea4e6fcee7..0383acfcb06 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -224,10 +224,14 @@ unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
224/* 224/*
225 * Check that @page is mapped at @address into @mm. 225 * Check that @page is mapped at @address into @mm.
226 * 226 *
227 * If @sync is false, page_check_address may perform a racy check to avoid
228 * the page table lock when the pte is not present (helpful when reclaiming
229 * highly shared pages).
230 *
227 * On success returns with pte mapped and locked. 231 * On success returns with pte mapped and locked.
228 */ 232 */
229pte_t *page_check_address(struct page *page, struct mm_struct *mm, 233pte_t *page_check_address(struct page *page, struct mm_struct *mm,
230 unsigned long address, spinlock_t **ptlp) 234 unsigned long address, spinlock_t **ptlp, int sync)
231{ 235{
232 pgd_t *pgd; 236 pgd_t *pgd;
233 pud_t *pud; 237 pud_t *pud;
@@ -249,7 +253,7 @@ pte_t *page_check_address(struct page *page, struct mm_struct *mm,
249 253
250 pte = pte_offset_map(pmd, address); 254 pte = pte_offset_map(pmd, address);
251 /* Make a quick check before getting the lock */ 255 /* Make a quick check before getting the lock */
252 if (!pte_present(*pte)) { 256 if (!sync && !pte_present(*pte)) {
253 pte_unmap(pte); 257 pte_unmap(pte);
254 return NULL; 258 return NULL;
255 } 259 }
@@ -281,7 +285,7 @@ static int page_referenced_one(struct page *page,
281 if (address == -EFAULT) 285 if (address == -EFAULT)
282 goto out; 286 goto out;
283 287
284 pte = page_check_address(page, mm, address, &ptl); 288 pte = page_check_address(page, mm, address, &ptl, 0);
285 if (!pte) 289 if (!pte)
286 goto out; 290 goto out;
287 291
@@ -450,7 +454,7 @@ static int page_mkclean_one(struct page *page, struct vm_area_struct *vma)
450 if (address == -EFAULT) 454 if (address == -EFAULT)
451 goto out; 455 goto out;
452 456
453 pte = page_check_address(page, mm, address, &ptl); 457 pte = page_check_address(page, mm, address, &ptl, 1);
454 if (!pte) 458 if (!pte)
455 goto out; 459 goto out;
456 460
@@ -659,23 +663,30 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
659 } 663 }
660 664
661 /* 665 /*
662 * It would be tidy to reset the PageAnon mapping here, 666 * Now that the last pte has gone, s390 must transfer dirty
663 * but that might overwrite a racing page_add_anon_rmap 667 * flag from storage key to struct page. We can usually skip
664 * which increments mapcount after us but sets mapping 668 * this if the page is anon, so about to be freed; but perhaps
665 * before us: so leave the reset to free_hot_cold_page, 669 * not if it's in swapcache - there might be another pte slot
666 * and remember that it's only reliable while mapped. 670 * containing the swap entry, but page not yet written to swap.
667 * Leaving it set also helps swapoff to reinstate ptes
668 * faster for those pages still in swapcache.
669 */ 671 */
670 if ((!PageAnon(page) || PageSwapCache(page)) && 672 if ((!PageAnon(page) || PageSwapCache(page)) &&
671 page_test_dirty(page)) { 673 page_test_dirty(page)) {
672 page_clear_dirty(page); 674 page_clear_dirty(page);
673 set_page_dirty(page); 675 set_page_dirty(page);
674 } 676 }
675 mem_cgroup_uncharge_page(page);
676 677
678 mem_cgroup_uncharge_page(page);
677 __dec_zone_page_state(page, 679 __dec_zone_page_state(page,
678 PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED); 680 PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED);
681 /*
682 * It would be tidy to reset the PageAnon mapping here,
683 * but that might overwrite a racing page_add_anon_rmap
684 * which increments mapcount after us but sets mapping
685 * before us: so leave the reset to free_hot_cold_page,
686 * and remember that it's only reliable while mapped.
687 * Leaving it set also helps swapoff to reinstate ptes
688 * faster for those pages still in swapcache.
689 */
679 } 690 }
680} 691}
681 692
@@ -697,7 +708,7 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
697 if (address == -EFAULT) 708 if (address == -EFAULT)
698 goto out; 709 goto out;
699 710
700 pte = page_check_address(page, mm, address, &ptl); 711 pte = page_check_address(page, mm, address, &ptl, 0);
701 if (!pte) 712 if (!pte)
702 goto out; 713 goto out;
703 714
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 167cf2dc8a0..797c3831cbe 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -60,7 +60,7 @@ void show_swap_cache_info(void)
60 printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n", 60 printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n",
61 swap_cache_info.add_total, swap_cache_info.del_total, 61 swap_cache_info.add_total, swap_cache_info.del_total,
62 swap_cache_info.find_success, swap_cache_info.find_total); 62 swap_cache_info.find_success, swap_cache_info.find_total);
63 printk("Free swap = %lukB\n", nr_swap_pages << (PAGE_SHIFT - 10)); 63 printk("Free swap = %ldkB\n", nr_swap_pages << (PAGE_SHIFT - 10));
64 printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10)); 64 printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10));
65} 65}
66 66
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 4fa1f3ad251..4c9890ec252 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -344,14 +344,20 @@ static void do_pnp_device_entry(void *symval, unsigned long size,
344 struct module *mod) 344 struct module *mod)
345{ 345{
346 const unsigned long id_size = sizeof(struct pnp_device_id); 346 const unsigned long id_size = sizeof(struct pnp_device_id);
347 const struct pnp_device_id *id = symval; 347 const unsigned int count = (size / id_size)-1;
348 const struct pnp_device_id *devs = symval;
349 unsigned int i;
348 350
349 device_id_check(mod->name, "pnp", size, id_size, symval); 351 device_id_check(mod->name, "pnp", size, id_size, symval);
350 352
351 buf_printf(&mod->dev_table_buf, 353 for (i = 0; i < count; i++) {
352 "MODULE_ALIAS(\"pnp:d%s*\");\n", id->id); 354 const char *id = (char *)devs[i].id;
353 buf_printf(&mod->dev_table_buf, 355
354 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id->id); 356 buf_printf(&mod->dev_table_buf,
357 "MODULE_ALIAS(\"pnp:d%s*\");\n", id);
358 buf_printf(&mod->dev_table_buf,
359 "MODULE_ALIAS(\"acpi*:%s:*\");\n", id);
360 }
355} 361}
356 362
357/* looks like: "pnp:dD" for every device of the card */ 363/* looks like: "pnp:dD" for every device of the card */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index a73d6ca0a90..1c53e337ecb 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -278,6 +278,9 @@ enum {
278/* Defines for Nvidia HDA support */ 278/* Defines for Nvidia HDA support */
279#define NVIDIA_HDA_TRANSREG_ADDR 0x4e 279#define NVIDIA_HDA_TRANSREG_ADDR 0x4e
280#define NVIDIA_HDA_ENABLE_COHBITS 0x0f 280#define NVIDIA_HDA_ENABLE_COHBITS 0x0f
281#define NVIDIA_HDA_ISTRM_COH 0x4d
282#define NVIDIA_HDA_OSTRM_COH 0x4c
283#define NVIDIA_HDA_ENABLE_COHBIT 0x01
281 284
282/* Defines for Intel SCH HDA snoop control */ 285/* Defines for Intel SCH HDA snoop control */
283#define INTEL_SCH_HDA_DEVC 0x78 286#define INTEL_SCH_HDA_DEVC 0x78
@@ -900,6 +903,12 @@ static void azx_init_pci(struct azx *chip)
900 update_pci_byte(chip->pci, 903 update_pci_byte(chip->pci,
901 NVIDIA_HDA_TRANSREG_ADDR, 904 NVIDIA_HDA_TRANSREG_ADDR,
902 0x0f, NVIDIA_HDA_ENABLE_COHBITS); 905 0x0f, NVIDIA_HDA_ENABLE_COHBITS);
906 update_pci_byte(chip->pci,
907 NVIDIA_HDA_ISTRM_COH,
908 0x01, NVIDIA_HDA_ENABLE_COHBIT);
909 update_pci_byte(chip->pci,
910 NVIDIA_HDA_OSTRM_COH,
911 0x01, NVIDIA_HDA_ENABLE_COHBIT);
903 break; 912 break;
904 case AZX_DRIVER_SCH: 913 case AZX_DRIVER_SCH:
905 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop); 914 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b80e725432f..909f1c101c9 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -952,7 +952,7 @@ do_sku:
952 tmp | 0x2010); 952 tmp | 0x2010);
953 break; 953 break;
954 case 0x10ec0888: 954 case 0x10ec0888:
955 alc888_coef_init(codec); 955 /*alc888_coef_init(codec);*/ /* called in alc_init() */
956 break; 956 break;
957 case 0x10ec0267: 957 case 0x10ec0267:
958 case 0x10ec0268: 958 case 0x10ec0268:
@@ -2439,6 +2439,8 @@ static int alc_init(struct hda_codec *codec)
2439 unsigned int i; 2439 unsigned int i;
2440 2440
2441 alc_fix_pll(codec); 2441 alc_fix_pll(codec);
2442 if (codec->vendor_id == 0x10ec0888)
2443 alc888_coef_init(codec);
2442 2444
2443 for (i = 0; i < spec->num_init_verbs; i++) 2445 for (i = 0; i < spec->num_init_verbs; i++)
2444 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2446 snd_hda_sequence_write(codec, spec->init_verbs[i]);
@@ -8426,8 +8428,6 @@ static int patch_alc883(struct hda_codec *codec)
8426 codec->patch_ops = alc_patch_ops; 8428 codec->patch_ops = alc_patch_ops;
8427 if (board_config == ALC883_AUTO) 8429 if (board_config == ALC883_AUTO)
8428 spec->init_hook = alc883_auto_init; 8430 spec->init_hook = alc883_auto_init;
8429 else if (codec->vendor_id == 0x10ec0888)
8430 spec->init_hook = alc888_coef_init;
8431 8431
8432#ifdef CONFIG_SND_HDA_POWER_SAVE 8432#ifdef CONFIG_SND_HDA_POWER_SAVE
8433 if (!spec->loopback.amplist) 8433 if (!spec->loopback.amplist)