aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/nilfs2.txt1
-rw-r--r--Documentation/networking/ip-sysctl.txt2
-rw-r--r--arch/arm/mach-davinci/irq.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c10
-rw-r--r--arch/arm/mach-mmp/pxa168.c2
-rw-r--r--arch/arm/mach-mmp/pxa910.c2
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c4
-rw-r--r--arch/arm/mach-pxa/raumfeld.c36
-rw-r--r--arch/arm/mach-s3c64xx/dma.c14
-rw-r--r--arch/arm/plat-orion/gpio.c2
-rw-r--r--arch/arm/plat-pxa/gpio.c10
-rw-r--r--arch/arm/plat-s3c24xx/dma.c12
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c2
-rw-r--r--arch/arm/plat-samsung/dma.c6
-rw-r--r--arch/arm/plat-samsung/include/plat/dma.h21
-rw-r--r--arch/arm/plat-samsung/irq-uart.c9
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c7
-rw-r--r--arch/mips/kernel/i8259.c22
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c30
-rw-r--r--arch/sparc/include/asm/irqflags_32.h8
-rw-r--r--arch/sparc/include/asm/irqflags_64.h14
-rw-r--r--arch/sparc/kernel/entry.S2
-rw-r--r--arch/sparc/mm/leon_mm.c2
-rw-r--r--arch/x86/mm/init_64.c3
-rw-r--r--drivers/acpi/apei/hest.c12
-rw-r--r--drivers/acpi/osl.c17
-rw-r--r--drivers/base/memory.c1
-rw-r--r--drivers/char/agp/intel-agp.h7
-rw-r--r--drivers/gpio/wm831x-gpio.c1
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c14
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c3
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c118
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h2
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c2
-rw-r--r--drivers/gpu/drm/radeon/evergreen_blit_kms.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c21
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h2
-rw-r--r--drivers/gpu/drm/radeon/rs600.c6
-rw-r--r--drivers/hwmon/adm1275.c10
-rw-r--r--drivers/hwmon/asus_atk0110.c1
-rw-r--r--drivers/hwmon/it87.c2
-rw-r--r--drivers/hwmon/max1111.c11
-rw-r--r--drivers/hwmon/pmbus_core.c20
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c8
-rw-r--r--drivers/media/radio/Kconfig4
-rw-r--r--drivers/media/radio/si4713-i2c.c4
-rw-r--r--drivers/media/rc/mceusb.c9
-rw-r--r--drivers/media/rc/nuvoton-cir.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c9
-rw-r--r--drivers/media/video/tuner-core.c16
-rw-r--r--drivers/mmc/core/mmc.c77
-rw-r--r--drivers/net/bonding/bond_main.c6
-rw-r--r--drivers/net/gianfar.c24
-rw-r--r--drivers/net/gianfar.h3
-rw-r--r--drivers/net/natsemi.c6
-rw-r--r--drivers/net/pppoe.c3
-rw-r--r--drivers/net/r6040.c8
-rw-r--r--drivers/net/slip.c2
-rw-r--r--drivers/net/tulip/dmfe.c4
-rw-r--r--drivers/net/usb/hso.c7
-rw-r--r--drivers/net/wireless/ath/ath5k/pci.c7
-rw-r--r--drivers/net/wireless/ath/ath5k/sysfs.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c3
-rw-r--r--drivers/net/wireless/ath/carl9170/usb.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c1
-rw-r--r--drivers/pcmcia/pxa2xx_vpac270.c4
-rw-r--r--drivers/ssb/driver_pcicore.c18
-rw-r--r--drivers/watchdog/Kconfig3
-rw-r--r--fs/ceph/mds_client.c19
-rw-r--r--fs/cifs/cifsfs.c100
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/cifs/dir.c13
-rw-r--r--fs/cifs/sess.c10
-rw-r--r--fs/cramfs/inode.c22
-rw-r--r--fs/dcache.c51
-rw-r--r--fs/exofs/super.c2
-rw-r--r--fs/gfs2/aops.c3
-rw-r--r--fs/gfs2/glops.c8
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/log.c1
-rw-r--r--fs/gfs2/ops_fstype.c3
-rw-r--r--fs/gfs2/super.c36
-rw-r--r--fs/gfs2/sys.c7
-rw-r--r--fs/hppfs/hppfs.c31
-rw-r--r--fs/libfs.c2
-rw-r--r--fs/namei.c9
-rw-r--r--fs/nfs/nfs4filelayout.c1
-rw-r--r--fs/nfs/nfs4xdr.c2
-rw-r--r--fs/nfs/write.c2
-rw-r--r--fs/ufs/namei.c12
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/platform/aclinux.h18
-rw-r--r--include/drm/drm_pciids.h2
-rw-r--r--include/linux/irq.h3
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/mmc/card.h13
-rw-r--r--include/linux/netdevice.h6
-rw-r--r--include/linux/sdla.h6
-rw-r--r--include/net/sctp/command.h1
-rw-r--r--include/net/sctp/ulpevent.h2
-rw-r--r--kernel/irq/generic-chip.c18
-rw-r--r--kernel/rcutree.c26
-rw-r--r--kernel/rcutree_plugin.h15
-rw-r--r--kernel/sched.c3
-rw-r--r--mm/vmscan.c3
-rw-r--r--net/8021q/vlan_dev.c6
-rw-r--r--net/bluetooth/hci_conn.c3
-rw-r--r--net/bluetooth/hidp/core.c18
-rw-r--r--net/bluetooth/hidp/hidp.h1
-rw-r--r--net/bluetooth/l2cap_core.c10
-rw-r--r--net/mac80211/scan.c3
-rw-r--r--net/mac80211/wpa.c16
-rw-r--r--net/sctp/output.c19
-rw-r--r--net/sctp/outqueue.c20
-rw-r--r--net/sctp/sm_sideeffect.c20
-rw-r--r--net/sctp/sm_statefuns.c32
-rw-r--r--net/sctp/sm_statetable.c2
-rw-r--r--net/sctp/socket.c13
-rw-r--r--net/sctp/ulpevent.c16
-rw-r--r--net/sunrpc/rpcb_clnt.c2
-rw-r--r--net/sunrpc/sched.c27
-rw-r--r--net/wireless/core.c12
-rw-r--r--net/wireless/core.h2
-rw-r--r--net/wireless/nl80211.c24
-rw-r--r--net/wireless/scan.c10
-rw-r--r--net/xfrm/xfrm_state.c2
-rwxr-xr-xscripts/depmod.sh10
-rw-r--r--sound/soc/codecs/wm8994.c9
-rw-r--r--sound/soc/sh/fsi-ak4642.c16
-rw-r--r--sound/soc/sh/fsi-da7210.c2
-rw-r--r--sound/soc/sh/fsi-hdmi.c4
134 files changed, 941 insertions, 548 deletions
diff --git a/Documentation/filesystems/nilfs2.txt b/Documentation/filesystems/nilfs2.txt
index d5c0cef38a71..873a2ab2e9f8 100644
--- a/Documentation/filesystems/nilfs2.txt
+++ b/Documentation/filesystems/nilfs2.txt
@@ -40,7 +40,6 @@ Features which NILFS2 does not support yet:
40 - POSIX ACLs 40 - POSIX ACLs
41 - quotas 41 - quotas
42 - fsck 42 - fsck
43 - resize
44 - defragmentation 43 - defragmentation
45 44
46Mount options 45Mount options
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index d3d653a5f9b9..bfe924217f24 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -346,7 +346,7 @@ tcp_orphan_retries - INTEGER
346 when RTO retransmissions remain unacknowledged. 346 when RTO retransmissions remain unacknowledged.
347 See tcp_retries2 for more details. 347 See tcp_retries2 for more details.
348 348
349 The default value is 7. 349 The default value is 8.
350 If your machine is a loaded WEB server, 350 If your machine is a loaded WEB server,
351 you should think about lowering this value, such sockets 351 you should think about lowering this value, such sockets
352 may consume significant resources. Cf. tcp_max_orphans. 352 may consume significant resources. Cf. tcp_max_orphans.
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index 85e77fd9d56a..952dc126c390 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -59,7 +59,7 @@ davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
59 } 59 }
60 60
61 ct = gc->chip_types; 61 ct = gc->chip_types;
62 ct->chip.irq_ack = irq_gc_ack; 62 ct->chip.irq_ack = irq_gc_ack_set_bit;
63 ct->chip.irq_mask = irq_gc_mask_clr_bit; 63 ct->chip.irq_mask = irq_gc_mask_clr_bit;
64 ct->chip.irq_unmask = irq_gc_mask_set_bit; 64 ct->chip.irq_unmask = irq_gc_mask_set_bit;
65 65
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 74ed81a3cb1a..07772575d7ab 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -419,14 +419,20 @@ static void notrace ixp4xx_update_sched_clock(void)
419/* 419/*
420 * clocksource 420 * clocksource
421 */ 421 */
422
423static cycle_t ixp4xx_clocksource_read(struct clocksource *c)
424{
425 return *IXP4XX_OSTS;
426}
427
422unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ; 428unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
423EXPORT_SYMBOL(ixp4xx_timer_freq); 429EXPORT_SYMBOL(ixp4xx_timer_freq);
424static void __init ixp4xx_clocksource_init(void) 430static void __init ixp4xx_clocksource_init(void)
425{ 431{
426 init_sched_clock(&cd, ixp4xx_update_sched_clock, 32, ixp4xx_timer_freq); 432 init_sched_clock(&cd, ixp4xx_update_sched_clock, 32, ixp4xx_timer_freq);
427 433
428 clocksource_mmio_init(&IXP4XX_OSTS, "OSTS", ixp4xx_timer_freq, 200, 32, 434 clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32,
429 clocksource_mmio_readl_up); 435 ixp4xx_clocksource_read);
430} 436}
431 437
432/* 438/*
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 72b4e7631583..ab9f999106c7 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -79,7 +79,7 @@ static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
79static APBC_CLK(ssp5, PXA168_SSP5, 4, 0); 79static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
80static APBC_CLK(keypad, PXA168_KPC, 0, 32000); 80static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
81 81
82static APMU_CLK(nand, NAND, 0x01db, 208000000); 82static APMU_CLK(nand, NAND, 0x19b, 156000000);
83static APMU_CLK(lcd, LCD, 0x7f, 312000000); 83static APMU_CLK(lcd, LCD, 0x7f, 312000000);
84 84
85/* device and clock bindings */ 85/* device and clock bindings */
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 8f92ccd26edf..1464607aa60d 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -110,7 +110,7 @@ static APBC_CLK(pwm2, PXA910_PWM2, 1, 13000000);
110static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000); 110static APBC_CLK(pwm3, PXA910_PWM3, 1, 13000000);
111static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000); 111static APBC_CLK(pwm4, PXA910_PWM4, 1, 13000000);
112 112
113static APMU_CLK(nand, NAND, 0x01db, 208000000); 113static APMU_CLK(nand, NAND, 0x19b, 156000000);
114static APMU_CLK(u2o, USB, 0x1b, 480000000); 114static APMU_CLK(u2o, USB, 0x1b, 480000000);
115 115
116/* device and clock bindings */ 116/* device and clock bindings */
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 87ae3129f4f7..b27544bcafcb 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -347,9 +347,9 @@ static int pxa2xx_mfp_suspend(void)
347 if ((gpio_desc[i].config & MFP_LPM_KEEP_OUTPUT) && 347 if ((gpio_desc[i].config & MFP_LPM_KEEP_OUTPUT) &&
348 (GPDR(i) & GPIO_bit(i))) { 348 (GPDR(i) & GPIO_bit(i))) {
349 if (GPLR(i) & GPIO_bit(i)) 349 if (GPLR(i) & GPIO_bit(i))
350 PGSR(i) |= GPIO_bit(i); 350 PGSR(gpio_to_bank(i)) |= GPIO_bit(i);
351 else 351 else
352 PGSR(i) &= ~GPIO_bit(i); 352 PGSR(gpio_to_bank(i)) &= ~GPIO_bit(i);
353 } 353 }
354 } 354 }
355 355
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index d130f77b6d11..2f37d43f51b6 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -573,10 +573,10 @@ static struct pxafb_mode_info sharp_lq043t3dx02_mode = {
573 .xres = 480, 573 .xres = 480,
574 .yres = 272, 574 .yres = 272,
575 .bpp = 16, 575 .bpp = 16,
576 .hsync_len = 4, 576 .hsync_len = 41,
577 .left_margin = 2, 577 .left_margin = 2,
578 .right_margin = 1, 578 .right_margin = 1,
579 .vsync_len = 1, 579 .vsync_len = 10,
580 .upper_margin = 3, 580 .upper_margin = 3,
581 .lower_margin = 1, 581 .lower_margin = 1,
582 .sync = 0, 582 .sync = 0,
@@ -596,29 +596,31 @@ static void __init raumfeld_lcd_init(void)
596{ 596{
597 int ret; 597 int ret;
598 598
599 pxa_set_fb_info(NULL, &raumfeld_sharp_lcd_info);
600
601 /* Earlier devices had the backlight regulator controlled
602 * via PWM, later versions use another controller for that */
603 if ((system_rev & 0xff) < 2) {
604 mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT;
605 pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1);
606 platform_device_register(&raumfeld_pwm_backlight_device);
607 } else
608 platform_device_register(&raumfeld_lt3593_device);
609
610 ret = gpio_request(GPIO_TFT_VA_EN, "display VA enable"); 599 ret = gpio_request(GPIO_TFT_VA_EN, "display VA enable");
611 if (ret < 0) 600 if (ret < 0)
612 pr_warning("Unable to request GPIO_TFT_VA_EN\n"); 601 pr_warning("Unable to request GPIO_TFT_VA_EN\n");
613 else 602 else
614 gpio_direction_output(GPIO_TFT_VA_EN, 1); 603 gpio_direction_output(GPIO_TFT_VA_EN, 1);
615 604
605 msleep(100);
606
616 ret = gpio_request(GPIO_DISPLAY_ENABLE, "display enable"); 607 ret = gpio_request(GPIO_DISPLAY_ENABLE, "display enable");
617 if (ret < 0) 608 if (ret < 0)
618 pr_warning("Unable to request GPIO_DISPLAY_ENABLE\n"); 609 pr_warning("Unable to request GPIO_DISPLAY_ENABLE\n");
619 else 610 else
620 gpio_direction_output(GPIO_DISPLAY_ENABLE, 1); 611 gpio_direction_output(GPIO_DISPLAY_ENABLE, 1);
621 612
613 /* Hardware revision 2 has the backlight regulator controlled
614 * by an LT3593, earlier and later devices use PWM for that. */
615 if ((system_rev & 0xff) == 2) {
616 platform_device_register(&raumfeld_lt3593_device);
617 } else {
618 mfp_cfg_t raumfeld_pwm_pin_config = GPIO17_PWM0_OUT;
619 pxa3xx_mfp_config(&raumfeld_pwm_pin_config, 1);
620 platform_device_register(&raumfeld_pwm_backlight_device);
621 }
622
623 pxa_set_fb_info(NULL, &raumfeld_sharp_lcd_info);
622 platform_device_register(&pxa3xx_device_gcu); 624 platform_device_register(&pxa3xx_device_gcu);
623} 625}
624 626
@@ -657,10 +659,10 @@ static struct lis3lv02d_platform_data lis3_pdata = {
657 659
658#define SPI_AK4104 \ 660#define SPI_AK4104 \
659{ \ 661{ \
660 .modalias = "ak4104", \ 662 .modalias = "ak4104-codec", \
661 .max_speed_hz = 10000, \ 663 .max_speed_hz = 10000, \
662 .bus_num = 0, \ 664 .bus_num = 0, \
663 .chip_select = 0, \ 665 .chip_select = 0, \
664 .controller_data = (void *) GPIO_SPDIF_CS, \ 666 .controller_data = (void *) GPIO_SPDIF_CS, \
665} 667}
666 668
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index b197171e7d03..204bfafe4bfc 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -113,7 +113,7 @@ found:
113 return chan; 113 return chan;
114} 114}
115 115
116int s3c2410_dma_config(unsigned int channel, int xferunit) 116int s3c2410_dma_config(enum dma_ch channel, int xferunit)
117{ 117{
118 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 118 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
119 119
@@ -297,7 +297,7 @@ static int s3c64xx_dma_flush(struct s3c2410_dma_chan *chan)
297 return 0; 297 return 0;
298} 298}
299 299
300int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op) 300int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op)
301{ 301{
302 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 302 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
303 303
@@ -331,7 +331,7 @@ EXPORT_SYMBOL(s3c2410_dma_ctrl);
331 * 331 *
332 */ 332 */
333 333
334int s3c2410_dma_enqueue(unsigned int channel, void *id, 334int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
335 dma_addr_t data, int size) 335 dma_addr_t data, int size)
336{ 336{
337 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 337 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
@@ -415,7 +415,7 @@ err_buff:
415EXPORT_SYMBOL(s3c2410_dma_enqueue); 415EXPORT_SYMBOL(s3c2410_dma_enqueue);
416 416
417 417
418int s3c2410_dma_devconfig(unsigned int channel, 418int s3c2410_dma_devconfig(enum dma_ch channel,
419 enum s3c2410_dmasrc source, 419 enum s3c2410_dmasrc source,
420 unsigned long devaddr) 420 unsigned long devaddr)
421{ 421{
@@ -463,7 +463,7 @@ int s3c2410_dma_devconfig(unsigned int channel,
463EXPORT_SYMBOL(s3c2410_dma_devconfig); 463EXPORT_SYMBOL(s3c2410_dma_devconfig);
464 464
465 465
466int s3c2410_dma_getposition(unsigned int channel, 466int s3c2410_dma_getposition(enum dma_ch channel,
467 dma_addr_t *src, dma_addr_t *dst) 467 dma_addr_t *src, dma_addr_t *dst)
468{ 468{
469 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 469 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
@@ -487,7 +487,7 @@ EXPORT_SYMBOL(s3c2410_dma_getposition);
487 * get control of an dma channel 487 * get control of an dma channel
488*/ 488*/
489 489
490int s3c2410_dma_request(unsigned int channel, 490int s3c2410_dma_request(enum dma_ch channel,
491 struct s3c2410_dma_client *client, 491 struct s3c2410_dma_client *client,
492 void *dev) 492 void *dev)
493{ 493{
@@ -533,7 +533,7 @@ EXPORT_SYMBOL(s3c2410_dma_request);
533 * allowed to go through. 533 * allowed to go through.
534*/ 534*/
535 535
536int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *client) 536int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *client)
537{ 537{
538 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 538 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
539 unsigned long flags; 539 unsigned long flags;
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index 5b4fffab1eb4..41ab97ebe4cf 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -432,7 +432,7 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
432 ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF; 432 ct->regs.mask = ochip->mask_offset + GPIO_EDGE_MASK_OFF;
433 ct->regs.ack = GPIO_EDGE_CAUSE_OFF; 433 ct->regs.ack = GPIO_EDGE_CAUSE_OFF;
434 ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; 434 ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
435 ct->chip.irq_ack = irq_gc_ack; 435 ct->chip.irq_ack = irq_gc_ack_clr_bit;
436 ct->chip.irq_mask = irq_gc_mask_clr_bit; 436 ct->chip.irq_mask = irq_gc_mask_clr_bit;
437 ct->chip.irq_unmask = irq_gc_mask_set_bit; 437 ct->chip.irq_unmask = irq_gc_mask_set_bit;
438 ct->chip.irq_set_type = gpio_irq_set_type; 438 ct->chip.irq_set_type = gpio_irq_set_type;
diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
index 48ebb9479b61..a11dc3670505 100644
--- a/arch/arm/plat-pxa/gpio.c
+++ b/arch/arm/plat-pxa/gpio.c
@@ -50,7 +50,7 @@ static inline void __iomem *gpio_chip_base(struct gpio_chip *c)
50 return container_of(c, struct pxa_gpio_chip, chip)->regbase; 50 return container_of(c, struct pxa_gpio_chip, chip)->regbase;
51} 51}
52 52
53static inline struct pxa_gpio_chip *gpio_to_chip(unsigned gpio) 53static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
54{ 54{
55 return &pxa_gpio_chips[gpio_to_bank(gpio)]; 55 return &pxa_gpio_chips[gpio_to_bank(gpio)];
56} 56}
@@ -161,7 +161,7 @@ static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
161 int gpio = irq_to_gpio(d->irq); 161 int gpio = irq_to_gpio(d->irq);
162 unsigned long gpdr, mask = GPIO_bit(gpio); 162 unsigned long gpdr, mask = GPIO_bit(gpio);
163 163
164 c = gpio_to_chip(gpio); 164 c = gpio_to_pxachip(gpio);
165 165
166 if (type == IRQ_TYPE_PROBE) { 166 if (type == IRQ_TYPE_PROBE) {
167 /* Don't mess with enabled GPIOs using preconfigured edges or 167 /* Don't mess with enabled GPIOs using preconfigured edges or
@@ -230,7 +230,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
230static void pxa_ack_muxed_gpio(struct irq_data *d) 230static void pxa_ack_muxed_gpio(struct irq_data *d)
231{ 231{
232 int gpio = irq_to_gpio(d->irq); 232 int gpio = irq_to_gpio(d->irq);
233 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 233 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
234 234
235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET); 235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
236} 236}
@@ -238,7 +238,7 @@ static void pxa_ack_muxed_gpio(struct irq_data *d)
238static void pxa_mask_muxed_gpio(struct irq_data *d) 238static void pxa_mask_muxed_gpio(struct irq_data *d)
239{ 239{
240 int gpio = irq_to_gpio(d->irq); 240 int gpio = irq_to_gpio(d->irq);
241 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 241 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
242 uint32_t grer, gfer; 242 uint32_t grer, gfer;
243 243
244 c->irq_mask &= ~GPIO_bit(gpio); 244 c->irq_mask &= ~GPIO_bit(gpio);
@@ -252,7 +252,7 @@ static void pxa_mask_muxed_gpio(struct irq_data *d)
252static void pxa_unmask_muxed_gpio(struct irq_data *d) 252static void pxa_unmask_muxed_gpio(struct irq_data *d)
253{ 253{
254 int gpio = irq_to_gpio(d->irq); 254 int gpio = irq_to_gpio(d->irq);
255 struct pxa_gpio_chip *c = gpio_to_chip(gpio); 255 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
256 256
257 c->irq_mask |= GPIO_bit(gpio); 257 c->irq_mask |= GPIO_bit(gpio);
258 update_edge_detect(c); 258 update_edge_detect(c);
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index a79a8ccd25f6..539bd0e3defd 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -712,7 +712,7 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel);
712 * get control of an dma channel 712 * get control of an dma channel
713*/ 713*/
714 714
715int s3c2410_dma_request(unsigned int channel, 715int s3c2410_dma_request(enum dma_ch channel,
716 struct s3c2410_dma_client *client, 716 struct s3c2410_dma_client *client,
717 void *dev) 717 void *dev)
718{ 718{
@@ -783,7 +783,7 @@ EXPORT_SYMBOL(s3c2410_dma_request);
783 * allowed to go through. 783 * allowed to go through.
784*/ 784*/
785 785
786int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *client) 786int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *client)
787{ 787{
788 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 788 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
789 unsigned long flags; 789 unsigned long flags;
@@ -974,7 +974,7 @@ static int s3c2410_dma_started(struct s3c2410_dma_chan *chan)
974} 974}
975 975
976int 976int
977s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op) 977s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op)
978{ 978{
979 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 979 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
980 980
@@ -1021,7 +1021,7 @@ EXPORT_SYMBOL(s3c2410_dma_ctrl);
1021 * xfersize: size of unit in bytes (1,2,4) 1021 * xfersize: size of unit in bytes (1,2,4)
1022*/ 1022*/
1023 1023
1024int s3c2410_dma_config(unsigned int channel, 1024int s3c2410_dma_config(enum dma_ch channel,
1025 int xferunit) 1025 int xferunit)
1026{ 1026{
1027 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 1027 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
@@ -1100,7 +1100,7 @@ EXPORT_SYMBOL(s3c2410_dma_config);
1100 * devaddr: physical address of the source 1100 * devaddr: physical address of the source
1101*/ 1101*/
1102 1102
1103int s3c2410_dma_devconfig(unsigned int channel, 1103int s3c2410_dma_devconfig(enum dma_ch channel,
1104 enum s3c2410_dmasrc source, 1104 enum s3c2410_dmasrc source,
1105 unsigned long devaddr) 1105 unsigned long devaddr)
1106{ 1106{
@@ -1173,7 +1173,7 @@ EXPORT_SYMBOL(s3c2410_dma_devconfig);
1173 * returns the current transfer points for the dma source and destination 1173 * returns the current transfer points for the dma source and destination
1174*/ 1174*/
1175 1175
1176int s3c2410_dma_getposition(unsigned int channel, dma_addr_t *src, dma_addr_t *dst) 1176int s3c2410_dma_getposition(enum dma_ch channel, dma_addr_t *src, dma_addr_t *dst)
1177{ 1177{
1178 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 1178 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
1179 1179
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index 135abda31c9a..327ab9f662e8 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -152,7 +152,7 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
152 if (!gc) 152 if (!gc)
153 return -ENOMEM; 153 return -ENOMEM;
154 ct = gc->chip_types; 154 ct = gc->chip_types;
155 ct->chip.irq_ack = irq_gc_ack; 155 ct->chip.irq_ack = irq_gc_ack_set_bit;
156 ct->chip.irq_mask = irq_gc_mask_set_bit; 156 ct->chip.irq_mask = irq_gc_mask_set_bit;
157 ct->chip.irq_unmask = irq_gc_mask_clr_bit; 157 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
158 ct->chip.irq_set_type = s5p_gpioint_set_type, 158 ct->chip.irq_set_type = s5p_gpioint_set_type,
diff --git a/arch/arm/plat-samsung/dma.c b/arch/arm/plat-samsung/dma.c
index cb459dd95459..6143aa147688 100644
--- a/arch/arm/plat-samsung/dma.c
+++ b/arch/arm/plat-samsung/dma.c
@@ -41,7 +41,7 @@ struct s3c2410_dma_chan *s3c_dma_lookup_channel(unsigned int channel)
41 * irq? 41 * irq?
42*/ 42*/
43 43
44int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn) 44int s3c2410_dma_set_opfn(enum dma_ch channel, s3c2410_dma_opfn_t rtn)
45{ 45{
46 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 46 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
47 47
@@ -56,7 +56,7 @@ int s3c2410_dma_set_opfn(unsigned int channel, s3c2410_dma_opfn_t rtn)
56} 56}
57EXPORT_SYMBOL(s3c2410_dma_set_opfn); 57EXPORT_SYMBOL(s3c2410_dma_set_opfn);
58 58
59int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn) 59int s3c2410_dma_set_buffdone_fn(enum dma_ch channel, s3c2410_dma_cbfn_t rtn)
60{ 60{
61 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 61 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
62 62
@@ -71,7 +71,7 @@ int s3c2410_dma_set_buffdone_fn(unsigned int channel, s3c2410_dma_cbfn_t rtn)
71} 71}
72EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn); 72EXPORT_SYMBOL(s3c2410_dma_set_buffdone_fn);
73 73
74int s3c2410_dma_setflags(unsigned int channel, unsigned int flags) 74int s3c2410_dma_setflags(enum dma_ch channel, unsigned int flags)
75{ 75{
76 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel); 76 struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
77 77
diff --git a/arch/arm/plat-samsung/include/plat/dma.h b/arch/arm/plat-samsung/include/plat/dma.h
index 2e8f8c6560d7..8c273b7a6f56 100644
--- a/arch/arm/plat-samsung/include/plat/dma.h
+++ b/arch/arm/plat-samsung/include/plat/dma.h
@@ -42,6 +42,7 @@ struct s3c2410_dma_client {
42}; 42};
43 43
44struct s3c2410_dma_chan; 44struct s3c2410_dma_chan;
45enum dma_ch;
45 46
46/* s3c2410_dma_cbfn_t 47/* s3c2410_dma_cbfn_t
47 * 48 *
@@ -62,7 +63,7 @@ typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
62 * request a dma channel exclusivley 63 * request a dma channel exclusivley
63*/ 64*/
64 65
65extern int s3c2410_dma_request(unsigned int channel, 66extern int s3c2410_dma_request(enum dma_ch channel,
66 struct s3c2410_dma_client *, void *dev); 67 struct s3c2410_dma_client *, void *dev);
67 68
68 69
@@ -71,14 +72,14 @@ extern int s3c2410_dma_request(unsigned int channel,
71 * change the state of the dma channel 72 * change the state of the dma channel
72*/ 73*/
73 74
74extern int s3c2410_dma_ctrl(unsigned int channel, enum s3c2410_chan_op op); 75extern int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op);
75 76
76/* s3c2410_dma_setflags 77/* s3c2410_dma_setflags
77 * 78 *
78 * set the channel's flags to a given state 79 * set the channel's flags to a given state
79*/ 80*/
80 81
81extern int s3c2410_dma_setflags(unsigned int channel, 82extern int s3c2410_dma_setflags(enum dma_ch channel,
82 unsigned int flags); 83 unsigned int flags);
83 84
84/* s3c2410_dma_free 85/* s3c2410_dma_free
@@ -86,7 +87,7 @@ extern int s3c2410_dma_setflags(unsigned int channel,
86 * free the dma channel (will also abort any outstanding operations) 87 * free the dma channel (will also abort any outstanding operations)
87*/ 88*/
88 89
89extern int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *); 90extern int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *);
90 91
91/* s3c2410_dma_enqueue 92/* s3c2410_dma_enqueue
92 * 93 *
@@ -95,7 +96,7 @@ extern int s3c2410_dma_free(unsigned int channel, struct s3c2410_dma_client *);
95 * drained before the buffer is given to the DMA system. 96 * drained before the buffer is given to the DMA system.
96*/ 97*/
97 98
98extern int s3c2410_dma_enqueue(unsigned int channel, void *id, 99extern int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
99 dma_addr_t data, int size); 100 dma_addr_t data, int size);
100 101
101/* s3c2410_dma_config 102/* s3c2410_dma_config
@@ -103,14 +104,14 @@ extern int s3c2410_dma_enqueue(unsigned int channel, void *id,
103 * configure the dma channel 104 * configure the dma channel
104*/ 105*/
105 106
106extern int s3c2410_dma_config(unsigned int channel, int xferunit); 107extern int s3c2410_dma_config(enum dma_ch channel, int xferunit);
107 108
108/* s3c2410_dma_devconfig 109/* s3c2410_dma_devconfig
109 * 110 *
110 * configure the device we're talking to 111 * configure the device we're talking to
111*/ 112*/
112 113
113extern int s3c2410_dma_devconfig(unsigned int channel, 114extern int s3c2410_dma_devconfig(enum dma_ch channel,
114 enum s3c2410_dmasrc source, unsigned long devaddr); 115 enum s3c2410_dmasrc source, unsigned long devaddr);
115 116
116/* s3c2410_dma_getposition 117/* s3c2410_dma_getposition
@@ -118,10 +119,10 @@ extern int s3c2410_dma_devconfig(unsigned int channel,
118 * get the position that the dma transfer is currently at 119 * get the position that the dma transfer is currently at
119*/ 120*/
120 121
121extern int s3c2410_dma_getposition(unsigned int channel, 122extern int s3c2410_dma_getposition(enum dma_ch channel,
122 dma_addr_t *src, dma_addr_t *dest); 123 dma_addr_t *src, dma_addr_t *dest);
123 124
124extern int s3c2410_dma_set_opfn(unsigned int, s3c2410_dma_opfn_t rtn); 125extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn);
125extern int s3c2410_dma_set_buffdone_fn(unsigned int, s3c2410_dma_cbfn_t rtn); 126extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn);
126 127
127 128
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
index 32582c0958e3..657405c481d0 100644
--- a/arch/arm/plat-samsung/irq-uart.c
+++ b/arch/arm/plat-samsung/irq-uart.c
@@ -54,8 +54,15 @@ static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
54 54
55 gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base, 55 gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base,
56 handle_level_irq); 56 handle_level_irq);
57
58 if (!gc) {
59 pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n",
60 __func__, uirq->base_irq);
61 return;
62 }
63
57 ct = gc->chip_types; 64 ct = gc->chip_types;
58 ct->chip.irq_ack = irq_gc_ack; 65 ct->chip.irq_ack = irq_gc_ack_set_bit;
59 ct->chip.irq_mask = irq_gc_mask_set_bit; 66 ct->chip.irq_mask = irq_gc_mask_set_bit;
60 ct->chip.irq_unmask = irq_gc_mask_clr_bit; 67 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
61 ct->regs.ack = S3C64XX_UINTP; 68 ct->regs.ack = S3C64XX_UINTP;
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index a607546ddbd0..f714d060370d 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -54,6 +54,13 @@ void __init s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq)
54 54
55 s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq, 55 s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq,
56 S3C64XX_TINT_CSTAT, handle_level_irq); 56 S3C64XX_TINT_CSTAT, handle_level_irq);
57
58 if (!s3c_tgc) {
59 pr_err("%s: irq_alloc_generic_chip for IRQ %d failed\n",
60 __func__, timer_irq);
61 return;
62 }
63
57 ct = s3c_tgc->chip_types; 64 ct = s3c_tgc->chip_types;
58 ct->chip.irq_mask = irq_gc_mask_clr_bit; 65 ct->chip.irq_mask = irq_gc_mask_clr_bit;
59 ct->chip.irq_unmask = irq_gc_mask_set_bit; 66 ct->chip.irq_unmask = irq_gc_mask_set_bit;
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index c018696765d4..5c74eb797f08 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -14,7 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/sysdev.h> 17#include <linux/syscore_ops.h>
18#include <linux/irq.h> 18#include <linux/irq.h>
19 19
20#include <asm/i8259.h> 20#include <asm/i8259.h>
@@ -215,14 +215,13 @@ spurious_8259A_irq:
215 } 215 }
216} 216}
217 217
218static int i8259A_resume(struct sys_device *dev) 218static void i8259A_resume(void)
219{ 219{
220 if (i8259A_auto_eoi >= 0) 220 if (i8259A_auto_eoi >= 0)
221 init_8259A(i8259A_auto_eoi); 221 init_8259A(i8259A_auto_eoi);
222 return 0;
223} 222}
224 223
225static int i8259A_shutdown(struct sys_device *dev) 224static void i8259A_shutdown(void)
226{ 225{
227 /* Put the i8259A into a quiescent state that 226 /* Put the i8259A into a quiescent state that
228 * the kernel initialization code can get it 227 * the kernel initialization code can get it
@@ -232,26 +231,17 @@ static int i8259A_shutdown(struct sys_device *dev)
232 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ 231 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
233 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-1 */ 232 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-1 */
234 } 233 }
235 return 0;
236} 234}
237 235
238static struct sysdev_class i8259_sysdev_class = { 236static struct syscore_ops i8259_syscore_ops = {
239 .name = "i8259",
240 .resume = i8259A_resume, 237 .resume = i8259A_resume,
241 .shutdown = i8259A_shutdown, 238 .shutdown = i8259A_shutdown,
242}; 239};
243 240
244static struct sys_device device_i8259A = {
245 .id = 0,
246 .cls = &i8259_sysdev_class,
247};
248
249static int __init i8259A_init_sysfs(void) 241static int __init i8259A_init_sysfs(void)
250{ 242{
251 int error = sysdev_class_register(&i8259_sysdev_class); 243 register_syscore_ops(&i8259_syscore_ops);
252 if (!error) 244 return 0;
253 error = sysdev_register(&device_i8259A);
254 return error;
255} 245}
256 246
257device_initcall(i8259A_init_sysfs); 247device_initcall(i8259A_init_sysfs);
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 33867ec4a234..9d6a8effeda2 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -12,6 +12,8 @@
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/memblock.h> 13#include <linux/memblock.h>
14#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
15#include <linux/memory.h>
16
15#include <asm/firmware.h> 17#include <asm/firmware.h>
16#include <asm/machdep.h> 18#include <asm/machdep.h>
17#include <asm/pSeries_reconfig.h> 19#include <asm/pSeries_reconfig.h>
@@ -20,24 +22,25 @@
20static unsigned long get_memblock_size(void) 22static unsigned long get_memblock_size(void)
21{ 23{
22 struct device_node *np; 24 struct device_node *np;
23 unsigned int memblock_size = 0; 25 unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE;
26 struct resource r;
24 27
25 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 28 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
26 if (np) { 29 if (np) {
27 const unsigned long *size; 30 const __be64 *size;
28 31
29 size = of_get_property(np, "ibm,lmb-size", NULL); 32 size = of_get_property(np, "ibm,lmb-size", NULL);
30 memblock_size = size ? *size : 0; 33 if (size)
31 34 memblock_size = be64_to_cpup(size);
32 of_node_put(np); 35 of_node_put(np);
33 } else { 36 } else if (machine_is(pseries)) {
37 /* This fallback really only applies to pseries */
34 unsigned int memzero_size = 0; 38 unsigned int memzero_size = 0;
35 const unsigned int *regs;
36 39
37 np = of_find_node_by_path("/memory@0"); 40 np = of_find_node_by_path("/memory@0");
38 if (np) { 41 if (np) {
39 regs = of_get_property(np, "reg", NULL); 42 if (!of_address_to_resource(np, 0, &r))
40 memzero_size = regs ? regs[3] : 0; 43 memzero_size = resource_size(&r);
41 of_node_put(np); 44 of_node_put(np);
42 } 45 }
43 46
@@ -50,16 +53,21 @@ static unsigned long get_memblock_size(void)
50 sprintf(buf, "/memory@%x", memzero_size); 53 sprintf(buf, "/memory@%x", memzero_size);
51 np = of_find_node_by_path(buf); 54 np = of_find_node_by_path(buf);
52 if (np) { 55 if (np) {
53 regs = of_get_property(np, "reg", NULL); 56 if (!of_address_to_resource(np, 0, &r))
54 memblock_size = regs ? regs[3] : 0; 57 memblock_size = resource_size(&r);
55 of_node_put(np); 58 of_node_put(np);
56 } 59 }
57 } 60 }
58 } 61 }
59
60 return memblock_size; 62 return memblock_size;
61} 63}
62 64
65/* WARNING: This is going to override the generic definition whenever
66 * pseries is built-in regardless of what platform is active at boot
67 * time. This is fine for now as this is the only "option" and it
68 * should work everywhere. If not, we'll have to turn this into a
69 * ppc_md. callback
70 */
63unsigned long memory_block_size_bytes(void) 71unsigned long memory_block_size_bytes(void)
64{ 72{
65 return get_memblock_size(); 73 return get_memblock_size();
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h
index d4d0711de0f9..14848909e0de 100644
--- a/arch/sparc/include/asm/irqflags_32.h
+++ b/arch/sparc/include/asm/irqflags_32.h
@@ -18,7 +18,7 @@ extern void arch_local_irq_restore(unsigned long);
18extern unsigned long arch_local_irq_save(void); 18extern unsigned long arch_local_irq_save(void);
19extern void arch_local_irq_enable(void); 19extern void arch_local_irq_enable(void);
20 20
21static inline unsigned long arch_local_save_flags(void) 21static inline notrace unsigned long arch_local_save_flags(void)
22{ 22{
23 unsigned long flags; 23 unsigned long flags;
24 24
@@ -26,17 +26,17 @@ static inline unsigned long arch_local_save_flags(void)
26 return flags; 26 return flags;
27} 27}
28 28
29static inline void arch_local_irq_disable(void) 29static inline notrace void arch_local_irq_disable(void)
30{ 30{
31 arch_local_irq_save(); 31 arch_local_irq_save();
32} 32}
33 33
34static inline bool arch_irqs_disabled_flags(unsigned long flags) 34static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
35{ 35{
36 return (flags & PSR_PIL) != 0; 36 return (flags & PSR_PIL) != 0;
37} 37}
38 38
39static inline bool arch_irqs_disabled(void) 39static inline notrace bool arch_irqs_disabled(void)
40{ 40{
41 return arch_irqs_disabled_flags(arch_local_save_flags()); 41 return arch_irqs_disabled_flags(arch_local_save_flags());
42} 42}
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index aab969c82c2b..23cd27f6beb4 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -14,7 +14,7 @@
14 14
15#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
16 16
17static inline unsigned long arch_local_save_flags(void) 17static inline notrace unsigned long arch_local_save_flags(void)
18{ 18{
19 unsigned long flags; 19 unsigned long flags;
20 20
@@ -26,7 +26,7 @@ static inline unsigned long arch_local_save_flags(void)
26 return flags; 26 return flags;
27} 27}
28 28
29static inline void arch_local_irq_restore(unsigned long flags) 29static inline notrace void arch_local_irq_restore(unsigned long flags)
30{ 30{
31 __asm__ __volatile__( 31 __asm__ __volatile__(
32 "wrpr %0, %%pil" 32 "wrpr %0, %%pil"
@@ -36,7 +36,7 @@ static inline void arch_local_irq_restore(unsigned long flags)
36 ); 36 );
37} 37}
38 38
39static inline void arch_local_irq_disable(void) 39static inline notrace void arch_local_irq_disable(void)
40{ 40{
41 __asm__ __volatile__( 41 __asm__ __volatile__(
42 "wrpr %0, %%pil" 42 "wrpr %0, %%pil"
@@ -46,7 +46,7 @@ static inline void arch_local_irq_disable(void)
46 ); 46 );
47} 47}
48 48
49static inline void arch_local_irq_enable(void) 49static inline notrace void arch_local_irq_enable(void)
50{ 50{
51 __asm__ __volatile__( 51 __asm__ __volatile__(
52 "wrpr 0, %%pil" 52 "wrpr 0, %%pil"
@@ -56,17 +56,17 @@ static inline void arch_local_irq_enable(void)
56 ); 56 );
57} 57}
58 58
59static inline int arch_irqs_disabled_flags(unsigned long flags) 59static inline notrace int arch_irqs_disabled_flags(unsigned long flags)
60{ 60{
61 return (flags > 0); 61 return (flags > 0);
62} 62}
63 63
64static inline int arch_irqs_disabled(void) 64static inline notrace int arch_irqs_disabled(void)
65{ 65{
66 return arch_irqs_disabled_flags(arch_local_save_flags()); 66 return arch_irqs_disabled_flags(arch_local_save_flags());
67} 67}
68 68
69static inline unsigned long arch_local_irq_save(void) 69static inline notrace unsigned long arch_local_irq_save(void)
70{ 70{
71 unsigned long flags, tmp; 71 unsigned long flags, tmp;
72 72
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 9fe08a1ea6c6..f445e98463e6 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -293,7 +293,7 @@ maybe_smp4m_msg:
293 WRITE_PAUSE 293 WRITE_PAUSE
294 wr %l4, PSR_ET, %psr 294 wr %l4, PSR_ET, %psr
295 WRITE_PAUSE 295 WRITE_PAUSE
296 sll %o3, 28, %o2 ! shift for simpler checks below 296 srl %o3, 28, %o2 ! shift for simpler checks below
297maybe_smp4m_msg_check_single: 297maybe_smp4m_msg_check_single:
298 andcc %o2, 0x1, %g0 298 andcc %o2, 0x1, %g0
299 beq,a maybe_smp4m_msg_check_mask 299 beq,a maybe_smp4m_msg_check_mask
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index c0e01297e64e..e485a6804998 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -226,7 +226,7 @@ void leon3_getCacheRegs(struct leon3_cacheregs *regs)
226 * Leon2 and Leon3 differ in their way of telling cache information 226 * Leon2 and Leon3 differ in their way of telling cache information
227 * 227 *
228 */ 228 */
229int leon_flush_needed(void) 229int __init leon_flush_needed(void)
230{ 230{
231 int flush_needed = -1; 231 int flush_needed = -1;
232 unsigned int ssize, sets; 232 unsigned int ssize, sets;
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index d865c4aeec55..bbaaa005bf0e 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -28,6 +28,7 @@
28#include <linux/poison.h> 28#include <linux/poison.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/memory.h>
31#include <linux/memory_hotplug.h> 32#include <linux/memory_hotplug.h>
32#include <linux/nmi.h> 33#include <linux/nmi.h>
33#include <linux/gfp.h> 34#include <linux/gfp.h>
@@ -895,8 +896,6 @@ const char *arch_vma_name(struct vm_area_struct *vma)
895} 896}
896 897
897#ifdef CONFIG_X86_UV 898#ifdef CONFIG_X86_UV
898#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
899
900unsigned long memory_block_size_bytes(void) 899unsigned long memory_block_size_bytes(void)
901{ 900{
902 if (is_uv_system()) { 901 if (is_uv_system()) {
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c
index abda3786a5d7..181bc2f7bb74 100644
--- a/drivers/acpi/apei/hest.c
+++ b/drivers/acpi/apei/hest.c
@@ -139,13 +139,23 @@ static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
139{ 139{
140 struct platform_device *ghes_dev; 140 struct platform_device *ghes_dev;
141 struct ghes_arr *ghes_arr = data; 141 struct ghes_arr *ghes_arr = data;
142 int rc; 142 int rc, i;
143 143
144 if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) 144 if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
145 return 0; 145 return 0;
146 146
147 if (!((struct acpi_hest_generic *)hest_hdr)->enabled) 147 if (!((struct acpi_hest_generic *)hest_hdr)->enabled)
148 return 0; 148 return 0;
149 for (i = 0; i < ghes_arr->count; i++) {
150 struct acpi_hest_header *hdr;
151 ghes_dev = ghes_arr->ghes_devs[i];
152 hdr = *(struct acpi_hest_header **)ghes_dev->dev.platform_data;
153 if (hdr->source_id == hest_hdr->source_id) {
154 pr_warning(FW_WARN HEST_PFX "Duplicated hardware error source ID: %d.\n",
155 hdr->source_id);
156 return -EIO;
157 }
158 }
149 ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); 159 ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id);
150 if (!ghes_dev) 160 if (!ghes_dev)
151 return -ENOMEM; 161 return -ENOMEM;
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 52ca9649d769..372f9b70f7f4 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1333,23 +1333,6 @@ int acpi_resources_are_enforced(void)
1333EXPORT_SYMBOL(acpi_resources_are_enforced); 1333EXPORT_SYMBOL(acpi_resources_are_enforced);
1334 1334
1335/* 1335/*
1336 * Create and initialize a spinlock.
1337 */
1338acpi_status
1339acpi_os_create_lock(acpi_spinlock *out_handle)
1340{
1341 spinlock_t *lock;
1342
1343 lock = ACPI_ALLOCATE(sizeof(spinlock_t));
1344 if (!lock)
1345 return AE_NO_MEMORY;
1346 spin_lock_init(lock);
1347 *out_handle = lock;
1348
1349 return AE_OK;
1350}
1351
1352/*
1353 * Deallocate the memory for a spinlock. 1336 * Deallocate the memory for a spinlock.
1354 */ 1337 */
1355void acpi_os_delete_lock(acpi_spinlock handle) 1338void acpi_os_delete_lock(acpi_spinlock handle)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 9f9b2359f718..45d7c8fc73bd 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -30,7 +30,6 @@
30static DEFINE_MUTEX(mem_sysfs_mutex); 30static DEFINE_MUTEX(mem_sysfs_mutex);
31 31
32#define MEMORY_CLASS_NAME "memory" 32#define MEMORY_CLASS_NAME "memory"
33#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
34 33
35static int sections_per_block; 34static int sections_per_block;
36 35
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h
index 999803ce10dc..5da67f165afa 100644
--- a/drivers/char/agp/intel-agp.h
+++ b/drivers/char/agp/intel-agp.h
@@ -90,9 +90,10 @@
90#define G4x_GMCH_SIZE_MASK (0xf << 8) 90#define G4x_GMCH_SIZE_MASK (0xf << 8)
91#define G4x_GMCH_SIZE_1M (0x1 << 8) 91#define G4x_GMCH_SIZE_1M (0x1 << 8)
92#define G4x_GMCH_SIZE_2M (0x3 << 8) 92#define G4x_GMCH_SIZE_2M (0x3 << 8)
93#define G4x_GMCH_SIZE_VT_1M (0x9 << 8) 93#define G4x_GMCH_SIZE_VT_EN (0x8 << 8)
94#define G4x_GMCH_SIZE_VT_1_5M (0xa << 8) 94#define G4x_GMCH_SIZE_VT_1M (G4x_GMCH_SIZE_1M | G4x_GMCH_SIZE_VT_EN)
95#define G4x_GMCH_SIZE_VT_2M (0xc << 8) 95#define G4x_GMCH_SIZE_VT_1_5M ((0x2 << 8) | G4x_GMCH_SIZE_VT_EN)
96#define G4x_GMCH_SIZE_VT_2M (G4x_GMCH_SIZE_2M | G4x_GMCH_SIZE_VT_EN)
96 97
97#define GFX_FLSH_CNTL 0x2170 /* 915+ */ 98#define GFX_FLSH_CNTL 0x2170 /* 915+ */
98 99
diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c
index 309644cf4d9b..2bcfb0be09ff 100644
--- a/drivers/gpio/wm831x-gpio.c
+++ b/drivers/gpio/wm831x-gpio.c
@@ -180,6 +180,7 @@ static void wm831x_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
180 break; 180 break;
181 case WM831X_GPIO_PULL_UP: 181 case WM831X_GPIO_PULL_UP:
182 pull = "pullup"; 182 pull = "pullup";
183 break;
183 default: 184 default:
184 pull = "INVALID PULL"; 185 pull = "INVALID PULL";
185 break; 186 break;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e1787022d6c8..296fbd66f0e1 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1943,7 +1943,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1943 if (!dev_priv->mm.gtt) { 1943 if (!dev_priv->mm.gtt) {
1944 DRM_ERROR("Failed to initialize GTT\n"); 1944 DRM_ERROR("Failed to initialize GTT\n");
1945 ret = -ENODEV; 1945 ret = -ENODEV;
1946 goto out_iomapfree; 1946 goto out_rmmap;
1947 } 1947 }
1948 1948
1949 agp_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; 1949 agp_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
@@ -1987,7 +1987,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1987 if (dev_priv->wq == NULL) { 1987 if (dev_priv->wq == NULL) {
1988 DRM_ERROR("Failed to create our workqueue.\n"); 1988 DRM_ERROR("Failed to create our workqueue.\n");
1989 ret = -ENOMEM; 1989 ret = -ENOMEM;
1990 goto out_iomapfree; 1990 goto out_mtrrfree;
1991 } 1991 }
1992 1992
1993 /* enable GEM by default */ 1993 /* enable GEM by default */
@@ -2074,13 +2074,21 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2074 return 0; 2074 return 0;
2075 2075
2076out_gem_unload: 2076out_gem_unload:
2077 if (dev_priv->mm.inactive_shrinker.shrink)
2078 unregister_shrinker(&dev_priv->mm.inactive_shrinker);
2079
2077 if (dev->pdev->msi_enabled) 2080 if (dev->pdev->msi_enabled)
2078 pci_disable_msi(dev->pdev); 2081 pci_disable_msi(dev->pdev);
2079 2082
2080 intel_teardown_gmbus(dev); 2083 intel_teardown_gmbus(dev);
2081 intel_teardown_mchbar(dev); 2084 intel_teardown_mchbar(dev);
2082 destroy_workqueue(dev_priv->wq); 2085 destroy_workqueue(dev_priv->wq);
2083out_iomapfree: 2086out_mtrrfree:
2087 if (dev_priv->mm.gtt_mtrr >= 0) {
2088 mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base,
2089 dev->agp->agp_info.aper_size * 1024 * 1024);
2090 dev_priv->mm.gtt_mtrr = -1;
2091 }
2084 io_mapping_free(dev_priv->mm.gtt_mapping); 2092 io_mapping_free(dev_priv->mm.gtt_mapping);
2085out_rmmap: 2093out_rmmap:
2086 pci_iounmap(dev->pdev, dev_priv->regs); 2094 pci_iounmap(dev->pdev, dev_priv->regs);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 013d304455b9..eb91e2dd7914 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -52,7 +52,7 @@ module_param_named(powersave, i915_powersave, int, 0600);
52unsigned int i915_semaphores = 0; 52unsigned int i915_semaphores = 0;
53module_param_named(semaphores, i915_semaphores, int, 0600); 53module_param_named(semaphores, i915_semaphores, int, 0600);
54 54
55unsigned int i915_enable_rc6 = 1; 55unsigned int i915_enable_rc6 = 0;
56module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); 56module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
57 57
58unsigned int i915_enable_fbc = 0; 58unsigned int i915_enable_fbc = 0;
@@ -577,6 +577,7 @@ int i915_reset(struct drm_device *dev, u8 flags)
577 if (get_seconds() - dev_priv->last_gpu_reset < 5) { 577 if (get_seconds() - dev_priv->last_gpu_reset < 5) {
578 DRM_ERROR("GPU hanging too fast, declaring wedged!\n"); 578 DRM_ERROR("GPU hanging too fast, declaring wedged!\n");
579 } else switch (INTEL_INFO(dev)->gen) { 579 } else switch (INTEL_INFO(dev)->gen) {
580 case 7:
580 case 6: 581 case 6:
581 ret = gen6_do_reset(dev, flags); 582 ret = gen6_do_reset(dev, flags);
582 /* If reset with a user forcewake, try to restore */ 583 /* If reset with a user forcewake, try to restore */
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 391b55f1cc74..e2aced6eec4c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -50,7 +50,6 @@ struct intel_dp {
50 bool has_audio; 50 bool has_audio;
51 int force_audio; 51 int force_audio;
52 uint32_t color_range; 52 uint32_t color_range;
53 int dpms_mode;
54 uint8_t link_bw; 53 uint8_t link_bw;
55 uint8_t lane_count; 54 uint8_t lane_count;
56 uint8_t dpcd[4]; 55 uint8_t dpcd[4];
@@ -138,8 +137,8 @@ intel_dp_max_lane_count(struct intel_dp *intel_dp)
138{ 137{
139 int max_lane_count = 4; 138 int max_lane_count = 4;
140 139
141 if (intel_dp->dpcd[0] >= 0x11) { 140 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11) {
142 max_lane_count = intel_dp->dpcd[2] & 0x1f; 141 max_lane_count = intel_dp->dpcd[DP_MAX_LANE_COUNT] & 0x1f;
143 switch (max_lane_count) { 142 switch (max_lane_count) {
144 case 1: case 2: case 4: 143 case 1: case 2: case 4:
145 break; 144 break;
@@ -153,7 +152,7 @@ intel_dp_max_lane_count(struct intel_dp *intel_dp)
153static int 152static int
154intel_dp_max_link_bw(struct intel_dp *intel_dp) 153intel_dp_max_link_bw(struct intel_dp *intel_dp)
155{ 154{
156 int max_link_bw = intel_dp->dpcd[1]; 155 int max_link_bw = intel_dp->dpcd[DP_MAX_LINK_RATE];
157 156
158 switch (max_link_bw) { 157 switch (max_link_bw) {
159 case DP_LINK_BW_1_62: 158 case DP_LINK_BW_1_62:
@@ -774,7 +773,8 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
774 /* 773 /*
775 * Check for DPCD version > 1.1 and enhanced framing support 774 * Check for DPCD version > 1.1 and enhanced framing support
776 */ 775 */
777 if (intel_dp->dpcd[0] >= 0x11 && (intel_dp->dpcd[2] & DP_ENHANCED_FRAME_CAP)) { 776 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
777 (intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP)) {
778 intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; 778 intel_dp->link_configuration[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;
779 intel_dp->DP |= DP_ENHANCED_FRAMING; 779 intel_dp->DP |= DP_ENHANCED_FRAMING;
780 } 780 }
@@ -942,11 +942,44 @@ static void ironlake_edp_pll_off(struct drm_encoder *encoder)
942 udelay(200); 942 udelay(200);
943} 943}
944 944
945/* If the sink supports it, try to set the power state appropriately */
946static void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode)
947{
948 int ret, i;
949
950 /* Should have a valid DPCD by this point */
951 if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
952 return;
953
954 if (mode != DRM_MODE_DPMS_ON) {
955 ret = intel_dp_aux_native_write_1(intel_dp, DP_SET_POWER,
956 DP_SET_POWER_D3);
957 if (ret != 1)
958 DRM_DEBUG_DRIVER("failed to write sink power state\n");
959 } else {
960 /*
961 * When turning on, we need to retry for 1ms to give the sink
962 * time to wake up.
963 */
964 for (i = 0; i < 3; i++) {
965 ret = intel_dp_aux_native_write_1(intel_dp,
966 DP_SET_POWER,
967 DP_SET_POWER_D0);
968 if (ret == 1)
969 break;
970 msleep(1);
971 }
972 }
973}
974
945static void intel_dp_prepare(struct drm_encoder *encoder) 975static void intel_dp_prepare(struct drm_encoder *encoder)
946{ 976{
947 struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 977 struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
948 struct drm_device *dev = encoder->dev; 978 struct drm_device *dev = encoder->dev;
949 979
980 /* Wake up the sink first */
981 intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
982
950 if (is_edp(intel_dp)) { 983 if (is_edp(intel_dp)) {
951 ironlake_edp_backlight_off(dev); 984 ironlake_edp_backlight_off(dev);
952 ironlake_edp_panel_off(dev); 985 ironlake_edp_panel_off(dev);
@@ -990,6 +1023,7 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
990 if (mode != DRM_MODE_DPMS_ON) { 1023 if (mode != DRM_MODE_DPMS_ON) {
991 if (is_edp(intel_dp)) 1024 if (is_edp(intel_dp))
992 ironlake_edp_backlight_off(dev); 1025 ironlake_edp_backlight_off(dev);
1026 intel_dp_sink_dpms(intel_dp, mode);
993 intel_dp_link_down(intel_dp); 1027 intel_dp_link_down(intel_dp);
994 if (is_edp(intel_dp)) 1028 if (is_edp(intel_dp))
995 ironlake_edp_panel_off(dev); 1029 ironlake_edp_panel_off(dev);
@@ -998,6 +1032,7 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
998 } else { 1032 } else {
999 if (is_edp(intel_dp)) 1033 if (is_edp(intel_dp))
1000 ironlake_edp_panel_vdd_on(intel_dp); 1034 ironlake_edp_panel_vdd_on(intel_dp);
1035 intel_dp_sink_dpms(intel_dp, mode);
1001 if (!(dp_reg & DP_PORT_EN)) { 1036 if (!(dp_reg & DP_PORT_EN)) {
1002 intel_dp_start_link_train(intel_dp); 1037 intel_dp_start_link_train(intel_dp);
1003 if (is_edp(intel_dp)) { 1038 if (is_edp(intel_dp)) {
@@ -1009,7 +1044,31 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
1009 if (is_edp(intel_dp)) 1044 if (is_edp(intel_dp))
1010 ironlake_edp_backlight_on(dev); 1045 ironlake_edp_backlight_on(dev);
1011 } 1046 }
1012 intel_dp->dpms_mode = mode; 1047}
1048
1049/*
1050 * Native read with retry for link status and receiver capability reads for
1051 * cases where the sink may still be asleep.
1052 */
1053static bool
1054intel_dp_aux_native_read_retry(struct intel_dp *intel_dp, uint16_t address,
1055 uint8_t *recv, int recv_bytes)
1056{
1057 int ret, i;
1058
1059 /*
1060 * Sinks are *supposed* to come up within 1ms from an off state,
1061 * but we're also supposed to retry 3 times per the spec.
1062 */
1063 for (i = 0; i < 3; i++) {
1064 ret = intel_dp_aux_native_read(intel_dp, address, recv,
1065 recv_bytes);
1066 if (ret == recv_bytes)
1067 return true;
1068 msleep(1);
1069 }
1070
1071 return false;
1013} 1072}
1014 1073
1015/* 1074/*
@@ -1019,14 +1078,10 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
1019static bool 1078static bool
1020intel_dp_get_link_status(struct intel_dp *intel_dp) 1079intel_dp_get_link_status(struct intel_dp *intel_dp)
1021{ 1080{
1022 int ret; 1081 return intel_dp_aux_native_read_retry(intel_dp,
1023 1082 DP_LANE0_1_STATUS,
1024 ret = intel_dp_aux_native_read(intel_dp, 1083 intel_dp->link_status,
1025 DP_LANE0_1_STATUS, 1084 DP_LINK_STATUS_SIZE);
1026 intel_dp->link_status, DP_LINK_STATUS_SIZE);
1027 if (ret != DP_LINK_STATUS_SIZE)
1028 return false;
1029 return true;
1030} 1085}
1031 1086
1032static uint8_t 1087static uint8_t
@@ -1515,6 +1570,8 @@ intel_dp_link_down(struct intel_dp *intel_dp)
1515static void 1570static void
1516intel_dp_check_link_status(struct intel_dp *intel_dp) 1571intel_dp_check_link_status(struct intel_dp *intel_dp)
1517{ 1572{
1573 int ret;
1574
1518 if (!intel_dp->base.base.crtc) 1575 if (!intel_dp->base.base.crtc)
1519 return; 1576 return;
1520 1577
@@ -1523,6 +1580,15 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
1523 return; 1580 return;
1524 } 1581 }
1525 1582
1583 /* Try to read receiver status if the link appears to be up */
1584 ret = intel_dp_aux_native_read(intel_dp,
1585 0x000, intel_dp->dpcd,
1586 sizeof (intel_dp->dpcd));
1587 if (ret != sizeof(intel_dp->dpcd)) {
1588 intel_dp_link_down(intel_dp);
1589 return;
1590 }
1591
1526 if (!intel_channel_eq_ok(intel_dp)) { 1592 if (!intel_channel_eq_ok(intel_dp)) {
1527 intel_dp_start_link_train(intel_dp); 1593 intel_dp_start_link_train(intel_dp);
1528 intel_dp_complete_link_train(intel_dp); 1594 intel_dp_complete_link_train(intel_dp);
@@ -1533,6 +1599,7 @@ static enum drm_connector_status
1533ironlake_dp_detect(struct intel_dp *intel_dp) 1599ironlake_dp_detect(struct intel_dp *intel_dp)
1534{ 1600{
1535 enum drm_connector_status status; 1601 enum drm_connector_status status;
1602 bool ret;
1536 1603
1537 /* Can't disconnect eDP, but you can close the lid... */ 1604 /* Can't disconnect eDP, but you can close the lid... */
1538 if (is_edp(intel_dp)) { 1605 if (is_edp(intel_dp)) {
@@ -1543,13 +1610,11 @@ ironlake_dp_detect(struct intel_dp *intel_dp)
1543 } 1610 }
1544 1611
1545 status = connector_status_disconnected; 1612 status = connector_status_disconnected;
1546 if (intel_dp_aux_native_read(intel_dp, 1613 ret = intel_dp_aux_native_read_retry(intel_dp,
1547 0x000, intel_dp->dpcd, 1614 0x000, intel_dp->dpcd,
1548 sizeof (intel_dp->dpcd)) 1615 sizeof (intel_dp->dpcd));
1549 == sizeof(intel_dp->dpcd)) { 1616 if (ret && intel_dp->dpcd[DP_DPCD_REV] != 0)
1550 if (intel_dp->dpcd[0] != 0) 1617 status = connector_status_connected;
1551 status = connector_status_connected;
1552 }
1553 DRM_DEBUG_KMS("DPCD: %hx%hx%hx%hx\n", intel_dp->dpcd[0], 1618 DRM_DEBUG_KMS("DPCD: %hx%hx%hx%hx\n", intel_dp->dpcd[0],
1554 intel_dp->dpcd[1], intel_dp->dpcd[2], intel_dp->dpcd[3]); 1619 intel_dp->dpcd[1], intel_dp->dpcd[2], intel_dp->dpcd[3]);
1555 return status; 1620 return status;
@@ -1586,7 +1651,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
1586 if (intel_dp_aux_native_read(intel_dp, 0x000, intel_dp->dpcd, 1651 if (intel_dp_aux_native_read(intel_dp, 0x000, intel_dp->dpcd,
1587 sizeof (intel_dp->dpcd)) == sizeof (intel_dp->dpcd)) 1652 sizeof (intel_dp->dpcd)) == sizeof (intel_dp->dpcd))
1588 { 1653 {
1589 if (intel_dp->dpcd[0] != 0) 1654 if (intel_dp->dpcd[DP_DPCD_REV] != 0)
1590 status = connector_status_connected; 1655 status = connector_status_connected;
1591 } 1656 }
1592 1657
@@ -1790,8 +1855,7 @@ intel_dp_hot_plug(struct intel_encoder *intel_encoder)
1790{ 1855{
1791 struct intel_dp *intel_dp = container_of(intel_encoder, struct intel_dp, base); 1856 struct intel_dp *intel_dp = container_of(intel_encoder, struct intel_dp, base);
1792 1857
1793 if (intel_dp->dpms_mode == DRM_MODE_DPMS_ON) 1858 intel_dp_check_link_status(intel_dp);
1794 intel_dp_check_link_status(intel_dp);
1795} 1859}
1796 1860
1797/* Return which DP Port should be selected for Transcoder DP control */ 1861/* Return which DP Port should be selected for Transcoder DP control */
@@ -1859,7 +1923,6 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1859 return; 1923 return;
1860 1924
1861 intel_dp->output_reg = output_reg; 1925 intel_dp->output_reg = output_reg;
1862 intel_dp->dpms_mode = -1;
1863 1926
1864 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); 1927 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
1865 if (!intel_connector) { 1928 if (!intel_connector) {
@@ -1954,8 +2017,9 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1954 sizeof(intel_dp->dpcd)); 2017 sizeof(intel_dp->dpcd));
1955 ironlake_edp_panel_vdd_off(intel_dp); 2018 ironlake_edp_panel_vdd_off(intel_dp);
1956 if (ret == sizeof(intel_dp->dpcd)) { 2019 if (ret == sizeof(intel_dp->dpcd)) {
1957 if (intel_dp->dpcd[0] >= 0x11) 2020 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11)
1958 dev_priv->no_aux_handshake = intel_dp->dpcd[3] & 2021 dev_priv->no_aux_handshake =
2022 intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
1959 DP_NO_AUX_HANDSHAKE_LINK_TRAINING; 2023 DP_NO_AUX_HANDSHAKE_LINK_TRAINING;
1960 } else { 2024 } else {
1961 /* if this fails, presume the device is a ghost */ 2025 /* if this fails, presume the device is a ghost */
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index c0e0ee63fbf4..39ac2b634ae5 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -165,7 +165,7 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring);
165int __must_check intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n); 165int __must_check intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n);
166static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring) 166static inline int intel_wait_ring_idle(struct intel_ring_buffer *ring)
167{ 167{
168 return intel_wait_ring_buffer(ring, ring->space - 8); 168 return intel_wait_ring_buffer(ring, ring->size - 8);
169} 169}
170 170
171int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n); 171int __must_check intel_ring_begin(struct intel_ring_buffer *ring, int n);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 660f96401a05..15bd0477a3e8 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2000,7 +2000,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
2000 gb_backend_map = 0x66442200; 2000 gb_backend_map = 0x66442200;
2001 break; 2001 break;
2002 case CHIP_JUNIPER: 2002 case CHIP_JUNIPER:
2003 gb_backend_map = 0x00006420; 2003 gb_backend_map = 0x00002200;
2004 break; 2004 break;
2005 default: 2005 default:
2006 gb_backend_map = 2006 gb_backend_map =
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c
index 57f3bc17b87e..2eb251858e72 100644
--- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c
+++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c
@@ -252,7 +252,7 @@ draw_auto(struct radeon_device *rdev)
252 252
253} 253}
254 254
255/* emits 36 */ 255/* emits 39 */
256static void 256static void
257set_default_state(struct radeon_device *rdev) 257set_default_state(struct radeon_device *rdev)
258{ 258{
@@ -531,6 +531,11 @@ set_default_state(struct radeon_device *rdev)
531 radeon_ring_write(rdev, (SQ_DYN_GPR_CNTL_PS_FLUSH_REQ - PACKET3_SET_CONFIG_REG_START) >> 2); 531 radeon_ring_write(rdev, (SQ_DYN_GPR_CNTL_PS_FLUSH_REQ - PACKET3_SET_CONFIG_REG_START) >> 2);
532 radeon_ring_write(rdev, 0); 532 radeon_ring_write(rdev, 0);
533 533
534 /* setup LDS */
535 radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1));
536 radeon_ring_write(rdev, (SQ_LDS_RESOURCE_MGMT - PACKET3_SET_CONFIG_REG_START) >> 2);
537 radeon_ring_write(rdev, 0x10001000);
538
534 /* SQ config */ 539 /* SQ config */
535 radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 11)); 540 radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 11));
536 radeon_ring_write(rdev, (SQ_CONFIG - PACKET3_SET_CONFIG_REG_START) >> 2); 541 radeon_ring_write(rdev, (SQ_CONFIG - PACKET3_SET_CONFIG_REG_START) >> 2);
@@ -773,7 +778,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes)
773 /* calculate number of loops correctly */ 778 /* calculate number of loops correctly */
774 ring_size = num_loops * dwords_per_loop; 779 ring_size = num_loops * dwords_per_loop;
775 /* set default + shaders */ 780 /* set default + shaders */
776 ring_size += 52; /* shaders + def state */ 781 ring_size += 55; /* shaders + def state */
777 ring_size += 10; /* fence emit for VB IB */ 782 ring_size += 10; /* fence emit for VB IB */
778 ring_size += 5; /* done copy */ 783 ring_size += 5; /* done copy */
779 ring_size += 10; /* fence emit for done copy */ 784 ring_size += 10; /* fence emit for done copy */
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 3fc5fa1aefd0..229a20f10e2b 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -331,7 +331,7 @@ static bool avivo_read_disabled_bios(struct radeon_device *rdev)
331 331
332 seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1); 332 seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1);
333 viph_control = RREG32(RADEON_VIPH_CONTROL); 333 viph_control = RREG32(RADEON_VIPH_CONTROL);
334 bus_cntl = RREG32(RADEON_BUS_CNTL); 334 bus_cntl = RREG32(RV370_BUS_CNTL);
335 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 335 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
336 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 336 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
337 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 337 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -350,7 +350,7 @@ static bool avivo_read_disabled_bios(struct radeon_device *rdev)
350 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 350 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
351 351
352 /* enable the rom */ 352 /* enable the rom */
353 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 353 WREG32(RV370_BUS_CNTL, (bus_cntl & ~RV370_BUS_BIOS_DIS_ROM));
354 354
355 /* Disable VGA mode */ 355 /* Disable VGA mode */
356 WREG32(AVIVO_D1VGA_CONTROL, 356 WREG32(AVIVO_D1VGA_CONTROL,
@@ -367,7 +367,7 @@ static bool avivo_read_disabled_bios(struct radeon_device *rdev)
367 /* restore regs */ 367 /* restore regs */
368 WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1); 368 WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1);
369 WREG32(RADEON_VIPH_CONTROL, viph_control); 369 WREG32(RADEON_VIPH_CONTROL, viph_control);
370 WREG32(RADEON_BUS_CNTL, bus_cntl); 370 WREG32(RV370_BUS_CNTL, bus_cntl);
371 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 371 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
372 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 372 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
373 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 373 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
@@ -390,7 +390,10 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev)
390 390
391 seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1); 391 seprom_cntl1 = RREG32(RADEON_SEPROM_CNTL1);
392 viph_control = RREG32(RADEON_VIPH_CONTROL); 392 viph_control = RREG32(RADEON_VIPH_CONTROL);
393 bus_cntl = RREG32(RADEON_BUS_CNTL); 393 if (rdev->flags & RADEON_IS_PCIE)
394 bus_cntl = RREG32(RV370_BUS_CNTL);
395 else
396 bus_cntl = RREG32(RADEON_BUS_CNTL);
394 crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL); 397 crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL);
395 crtc2_gen_cntl = 0; 398 crtc2_gen_cntl = 0;
396 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); 399 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
@@ -412,7 +415,10 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev)
412 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 415 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
413 416
414 /* enable the rom */ 417 /* enable the rom */
415 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 418 if (rdev->flags & RADEON_IS_PCIE)
419 WREG32(RV370_BUS_CNTL, (bus_cntl & ~RV370_BUS_BIOS_DIS_ROM));
420 else
421 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM));
416 422
417 /* Turn off mem requests and CRTC for both controllers */ 423 /* Turn off mem requests and CRTC for both controllers */
418 WREG32(RADEON_CRTC_GEN_CNTL, 424 WREG32(RADEON_CRTC_GEN_CNTL,
@@ -439,7 +445,10 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev)
439 /* restore regs */ 445 /* restore regs */
440 WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1); 446 WREG32(RADEON_SEPROM_CNTL1, seprom_cntl1);
441 WREG32(RADEON_VIPH_CONTROL, viph_control); 447 WREG32(RADEON_VIPH_CONTROL, viph_control);
442 WREG32(RADEON_BUS_CNTL, bus_cntl); 448 if (rdev->flags & RADEON_IS_PCIE)
449 WREG32(RV370_BUS_CNTL, bus_cntl);
450 else
451 WREG32(RADEON_BUS_CNTL, bus_cntl);
443 WREG32(RADEON_CRTC_GEN_CNTL, crtc_gen_cntl); 452 WREG32(RADEON_CRTC_GEN_CNTL, crtc_gen_cntl);
444 if (!(rdev->flags & RADEON_SINGLE_CRTC)) { 453 if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
445 WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); 454 WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index cbfca3a24fdf..9792d4ffdc86 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -52,6 +52,12 @@ void radeon_connector_hotplug(struct drm_connector *connector)
52 struct radeon_device *rdev = dev->dev_private; 52 struct radeon_device *rdev = dev->dev_private;
53 struct radeon_connector *radeon_connector = to_radeon_connector(connector); 53 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
54 54
55 /* bail if the connector does not have hpd pin, e.g.,
56 * VGA, TV, etc.
57 */
58 if (radeon_connector->hpd.hpd == RADEON_HPD_NONE)
59 return;
60
55 radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); 61 radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
56 62
57 /* powering up/down the eDP panel generates hpd events which 63 /* powering up/down the eDP panel generates hpd events which
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index ec93a75369e6..bc44a3d35ec6 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -300,6 +300,8 @@
300# define RADEON_BUS_READ_BURST (1 << 30) 300# define RADEON_BUS_READ_BURST (1 << 30)
301#define RADEON_BUS_CNTL1 0x0034 301#define RADEON_BUS_CNTL1 0x0034
302# define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4) 302# define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4)
303#define RV370_BUS_CNTL 0x004c
304# define RV370_BUS_BIOS_DIS_ROM (1 << 2)
303/* rv370/rv380, rv410, r423/r430/r480, r5xx */ 305/* rv370/rv380, rv410, r423/r430/r480, r5xx */
304#define RADEON_MSI_REARM_EN 0x0160 306#define RADEON_MSI_REARM_EN 0x0160
305# define RV370_MSI_REARM_EN (1 << 0) 307# define RV370_MSI_REARM_EN (1 << 0)
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 6e3b11e5abbe..1f5850e473cc 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -426,7 +426,7 @@ int rs600_gart_init(struct radeon_device *rdev)
426 return radeon_gart_table_vram_alloc(rdev); 426 return radeon_gart_table_vram_alloc(rdev);
427} 427}
428 428
429int rs600_gart_enable(struct radeon_device *rdev) 429static int rs600_gart_enable(struct radeon_device *rdev)
430{ 430{
431 u32 tmp; 431 u32 tmp;
432 int r, i; 432 int r, i;
@@ -440,8 +440,8 @@ int rs600_gart_enable(struct radeon_device *rdev)
440 return r; 440 return r;
441 radeon_gart_restore(rdev); 441 radeon_gart_restore(rdev);
442 /* Enable bus master */ 442 /* Enable bus master */
443 tmp = RREG32(R_00004C_BUS_CNTL) & C_00004C_BUS_MASTER_DIS; 443 tmp = RREG32(RADEON_BUS_CNTL) & ~RS600_BUS_MASTER_DIS;
444 WREG32(R_00004C_BUS_CNTL, tmp); 444 WREG32(RADEON_BUS_CNTL, tmp);
445 /* FIXME: setup default page */ 445 /* FIXME: setup default page */
446 WREG32_MC(R_000100_MC_PT0_CNTL, 446 WREG32_MC(R_000100_MC_PT0_CNTL,
447 (S_000100_EFFECTIVE_L2_CACHE_SIZE(6) | 447 (S_000100_EFFECTIVE_L2_CACHE_SIZE(6) |
diff --git a/drivers/hwmon/adm1275.c b/drivers/hwmon/adm1275.c
index b9b7caf4a1d2..8bc1bd663721 100644
--- a/drivers/hwmon/adm1275.c
+++ b/drivers/hwmon/adm1275.c
@@ -53,23 +53,23 @@ static int adm1275_probe(struct i2c_client *client,
53 info->direct[PSC_VOLTAGE_IN] = true; 53 info->direct[PSC_VOLTAGE_IN] = true;
54 info->direct[PSC_VOLTAGE_OUT] = true; 54 info->direct[PSC_VOLTAGE_OUT] = true;
55 info->direct[PSC_CURRENT_OUT] = true; 55 info->direct[PSC_CURRENT_OUT] = true;
56 info->m[PSC_CURRENT_OUT] = 800; 56 info->m[PSC_CURRENT_OUT] = 807;
57 info->b[PSC_CURRENT_OUT] = 20475; 57 info->b[PSC_CURRENT_OUT] = 20475;
58 info->R[PSC_CURRENT_OUT] = -1; 58 info->R[PSC_CURRENT_OUT] = -1;
59 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT; 59 info->func[0] = PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT;
60 60
61 if (config & ADM1275_VRANGE) { 61 if (config & ADM1275_VRANGE) {
62 info->m[PSC_VOLTAGE_IN] = 19045; 62 info->m[PSC_VOLTAGE_IN] = 19199;
63 info->b[PSC_VOLTAGE_IN] = 0; 63 info->b[PSC_VOLTAGE_IN] = 0;
64 info->R[PSC_VOLTAGE_IN] = -2; 64 info->R[PSC_VOLTAGE_IN] = -2;
65 info->m[PSC_VOLTAGE_OUT] = 19045; 65 info->m[PSC_VOLTAGE_OUT] = 19199;
66 info->b[PSC_VOLTAGE_OUT] = 0; 66 info->b[PSC_VOLTAGE_OUT] = 0;
67 info->R[PSC_VOLTAGE_OUT] = -2; 67 info->R[PSC_VOLTAGE_OUT] = -2;
68 } else { 68 } else {
69 info->m[PSC_VOLTAGE_IN] = 6666; 69 info->m[PSC_VOLTAGE_IN] = 6720;
70 info->b[PSC_VOLTAGE_IN] = 0; 70 info->b[PSC_VOLTAGE_IN] = 0;
71 info->R[PSC_VOLTAGE_IN] = -1; 71 info->R[PSC_VOLTAGE_IN] = -1;
72 info->m[PSC_VOLTAGE_OUT] = 6666; 72 info->m[PSC_VOLTAGE_OUT] = 6720;
73 info->b[PSC_VOLTAGE_OUT] = 0; 73 info->b[PSC_VOLTAGE_OUT] = 0;
74 info->R[PSC_VOLTAGE_OUT] = -1; 74 info->R[PSC_VOLTAGE_OUT] = -1;
75 } 75 }
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index dcb78a7a8047..00e98517f94c 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -674,6 +674,7 @@ static int atk_debugfs_gitm_get(void *p, u64 *val)
674 else 674 else
675 err = -EIO; 675 err = -EIO;
676 676
677 ACPI_FREE(ret);
677 return err; 678 return err;
678} 679}
679 680
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index bb6405b92007..5f5247750430 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -1538,7 +1538,7 @@ static struct attribute *it87_attributes_label[] = {
1538}; 1538};
1539 1539
1540static const struct attribute_group it87_group_label = { 1540static const struct attribute_group it87_group_label = {
1541 .attrs = it87_attributes_vid, 1541 .attrs = it87_attributes_label,
1542}; 1542};
1543 1543
1544/* SuperIO detection - will change isa_address if a chip is found */ 1544/* SuperIO detection - will change isa_address if a chip is found */
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 12a54aa29776..14335bbc9bdc 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -40,6 +40,8 @@ struct max1111_data {
40 struct spi_transfer xfer[2]; 40 struct spi_transfer xfer[2];
41 uint8_t *tx_buf; 41 uint8_t *tx_buf;
42 uint8_t *rx_buf; 42 uint8_t *rx_buf;
43 struct mutex drvdata_lock;
44 /* protect msg, xfer and buffers from multiple access */
43}; 45};
44 46
45static int max1111_read(struct device *dev, int channel) 47static int max1111_read(struct device *dev, int channel)
@@ -48,6 +50,9 @@ static int max1111_read(struct device *dev, int channel)
48 uint8_t v1, v2; 50 uint8_t v1, v2;
49 int err; 51 int err;
50 52
53 /* writing to drvdata struct is not thread safe, wait on mutex */
54 mutex_lock(&data->drvdata_lock);
55
51 data->tx_buf[0] = (channel << MAX1111_CTRL_SEL_SH) | 56 data->tx_buf[0] = (channel << MAX1111_CTRL_SEL_SH) |
52 MAX1111_CTRL_PD0 | MAX1111_CTRL_PD1 | 57 MAX1111_CTRL_PD0 | MAX1111_CTRL_PD1 |
53 MAX1111_CTRL_SGL | MAX1111_CTRL_UNI | MAX1111_CTRL_STR; 58 MAX1111_CTRL_SGL | MAX1111_CTRL_UNI | MAX1111_CTRL_STR;
@@ -55,12 +60,15 @@ static int max1111_read(struct device *dev, int channel)
55 err = spi_sync(data->spi, &data->msg); 60 err = spi_sync(data->spi, &data->msg);
56 if (err < 0) { 61 if (err < 0) {
57 dev_err(dev, "spi_sync failed with %d\n", err); 62 dev_err(dev, "spi_sync failed with %d\n", err);
63 mutex_unlock(&data->drvdata_lock);
58 return err; 64 return err;
59 } 65 }
60 66
61 v1 = data->rx_buf[0]; 67 v1 = data->rx_buf[0];
62 v2 = data->rx_buf[1]; 68 v2 = data->rx_buf[1];
63 69
70 mutex_unlock(&data->drvdata_lock);
71
64 if ((v1 & 0xc0) || (v2 & 0x3f)) 72 if ((v1 & 0xc0) || (v2 & 0x3f))
65 return -EINVAL; 73 return -EINVAL;
66 74
@@ -176,6 +184,8 @@ static int __devinit max1111_probe(struct spi_device *spi)
176 if (err) 184 if (err)
177 goto err_free_data; 185 goto err_free_data;
178 186
187 mutex_init(&data->drvdata_lock);
188
179 data->spi = spi; 189 data->spi = spi;
180 spi_set_drvdata(spi, data); 190 spi_set_drvdata(spi, data);
181 191
@@ -213,6 +223,7 @@ static int __devexit max1111_remove(struct spi_device *spi)
213 223
214 hwmon_device_unregister(data->hwmon_dev); 224 hwmon_device_unregister(data->hwmon_dev);
215 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); 225 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
226 mutex_destroy(&data->drvdata_lock);
216 kfree(data->rx_buf); 227 kfree(data->rx_buf);
217 kfree(data->tx_buf); 228 kfree(data->tx_buf);
218 kfree(data); 229 kfree(data);
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c
index 744672c1f26d..8e31a8e2c746 100644
--- a/drivers/hwmon/pmbus_core.c
+++ b/drivers/hwmon/pmbus_core.c
@@ -362,8 +362,8 @@ static struct pmbus_data *pmbus_update_device(struct device *dev)
362 * Convert linear sensor values to milli- or micro-units 362 * Convert linear sensor values to milli- or micro-units
363 * depending on sensor type. 363 * depending on sensor type.
364 */ 364 */
365static int pmbus_reg2data_linear(struct pmbus_data *data, 365static long pmbus_reg2data_linear(struct pmbus_data *data,
366 struct pmbus_sensor *sensor) 366 struct pmbus_sensor *sensor)
367{ 367{
368 s16 exponent; 368 s16 exponent;
369 s32 mantissa; 369 s32 mantissa;
@@ -397,15 +397,15 @@ static int pmbus_reg2data_linear(struct pmbus_data *data,
397 else 397 else
398 val >>= -exponent; 398 val >>= -exponent;
399 399
400 return (int)val; 400 return val;
401} 401}
402 402
403/* 403/*
404 * Convert direct sensor values to milli- or micro-units 404 * Convert direct sensor values to milli- or micro-units
405 * depending on sensor type. 405 * depending on sensor type.
406 */ 406 */
407static int pmbus_reg2data_direct(struct pmbus_data *data, 407static long pmbus_reg2data_direct(struct pmbus_data *data,
408 struct pmbus_sensor *sensor) 408 struct pmbus_sensor *sensor)
409{ 409{
410 long val = (s16) sensor->data; 410 long val = (s16) sensor->data;
411 long m, b, R; 411 long m, b, R;
@@ -440,12 +440,12 @@ static int pmbus_reg2data_direct(struct pmbus_data *data,
440 R++; 440 R++;
441 } 441 }
442 442
443 return (int)((val - b) / m); 443 return (val - b) / m;
444} 444}
445 445
446static int pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) 446static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor)
447{ 447{
448 int val; 448 long val;
449 449
450 if (data->info->direct[sensor->class]) 450 if (data->info->direct[sensor->class])
451 val = pmbus_reg2data_direct(data, sensor); 451 val = pmbus_reg2data_direct(data, sensor);
@@ -619,7 +619,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val)
619 if (!s1 && !s2) 619 if (!s1 && !s2)
620 *val = !!regval; 620 *val = !!regval;
621 else { 621 else {
622 int v1, v2; 622 long v1, v2;
623 struct pmbus_sensor *sensor1, *sensor2; 623 struct pmbus_sensor *sensor1, *sensor2;
624 624
625 sensor1 = &data->sensors[s1]; 625 sensor1 = &data->sensors[s1];
@@ -661,7 +661,7 @@ static ssize_t pmbus_show_sensor(struct device *dev,
661 if (sensor->data < 0) 661 if (sensor->data < 0)
662 return sensor->data; 662 return sensor->data;
663 663
664 return snprintf(buf, PAGE_SIZE, "%d\n", pmbus_reg2data(data, sensor)); 664 return snprintf(buf, PAGE_SIZE, "%ld\n", pmbus_reg2data(data, sensor));
665} 665}
666 666
667static ssize_t pmbus_set_sensor(struct device *dev, 667static ssize_t pmbus_set_sensor(struct device *dev,
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 98278041d75f..5b6b451d4694 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1988,6 +1988,14 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
1988 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { 1988 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) {
1989 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) 1989 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0)
1990 goto err0; 1990 goto err0;
1991
1992 /* If we took control of the bus, we need to force
1993 reinitialization. This is because many ts_bus_ctrl()
1994 functions strobe the RESET pin on the demod, and if the
1995 frontend thread already exists then the dvb_init() routine
1996 won't get called (which is what usually does initial
1997 register configuration). */
1998 fepriv->reinitialise = 1;
1991 } 1999 }
1992 2000
1993 if ((ret = dvb_generic_open (inode, file)) < 0) 2001 if ((ret = dvb_generic_open (inode, file)) < 0)
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index e4c97fd6f05a..52798a111e16 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -168,7 +168,7 @@ config RADIO_MAXIRADIO
168 168
169config RADIO_MIROPCM20 169config RADIO_MIROPCM20
170 tristate "miroSOUND PCM20 radio" 170 tristate "miroSOUND PCM20 radio"
171 depends on ISA && VIDEO_V4L2 && SND 171 depends on ISA && ISA_DMA_API && VIDEO_V4L2 && SND
172 select SND_ISA 172 select SND_ISA
173 select SND_MIRO 173 select SND_MIRO
174 ---help--- 174 ---help---
@@ -201,7 +201,7 @@ config RADIO_SF16FMI
201 201
202config RADIO_SF16FMR2 202config RADIO_SF16FMR2
203 tristate "SF16FMR2 Radio" 203 tristate "SF16FMR2 Radio"
204 depends on ISA && VIDEO_V4L2 204 depends on ISA && VIDEO_V4L2 && SND
205 ---help--- 205 ---help---
206 Choose Y here if you have one of these FM radio cards. 206 Choose Y here if you have one of these FM radio cards.
207 207
diff --git a/drivers/media/radio/si4713-i2c.c b/drivers/media/radio/si4713-i2c.c
index deca2e06ff22..c9f4a8e65dc4 100644
--- a/drivers/media/radio/si4713-i2c.c
+++ b/drivers/media/radio/si4713-i2c.c
@@ -1033,7 +1033,7 @@ static int si4713_write_econtrol_string(struct si4713_device *sdev,
1033 char ps_name[MAX_RDS_PS_NAME + 1]; 1033 char ps_name[MAX_RDS_PS_NAME + 1];
1034 1034
1035 len = control->size - 1; 1035 len = control->size - 1;
1036 if (len > MAX_RDS_PS_NAME) { 1036 if (len < 0 || len > MAX_RDS_PS_NAME) {
1037 rval = -ERANGE; 1037 rval = -ERANGE;
1038 goto exit; 1038 goto exit;
1039 } 1039 }
@@ -1057,7 +1057,7 @@ static int si4713_write_econtrol_string(struct si4713_device *sdev,
1057 char radio_text[MAX_RDS_RADIO_TEXT + 1]; 1057 char radio_text[MAX_RDS_RADIO_TEXT + 1];
1058 1058
1059 len = control->size - 1; 1059 len = control->size - 1;
1060 if (len > MAX_RDS_RADIO_TEXT) { 1060 if (len < 0 || len > MAX_RDS_RADIO_TEXT) {
1061 rval = -ERANGE; 1061 rval = -ERANGE;
1062 goto exit; 1062 goto exit;
1063 } 1063 }
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 06dfe0957b5e..ec972dc25790 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -558,9 +558,10 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
558 inout, data1); 558 inout, data1);
559 break; 559 break;
560 case MCE_CMD_S_TIMEOUT: 560 case MCE_CMD_S_TIMEOUT:
561 /* value is in units of 50us, so x*50/100 or x/2 ms */ 561 /* value is in units of 50us, so x*50/1000 ms */
562 dev_info(dev, "%s receive timeout of %d ms\n", 562 dev_info(dev, "%s receive timeout of %d ms\n",
563 inout, ((data1 << 8) | data2) / 2); 563 inout,
564 ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000);
564 break; 565 break;
565 case MCE_CMD_G_TIMEOUT: 566 case MCE_CMD_G_TIMEOUT:
566 dev_info(dev, "Get receive timeout\n"); 567 dev_info(dev, "Get receive timeout\n");
@@ -847,7 +848,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index)
847 switch (ir->buf_in[index]) { 848 switch (ir->buf_in[index]) {
848 /* 2-byte return value commands */ 849 /* 2-byte return value commands */
849 case MCE_CMD_S_TIMEOUT: 850 case MCE_CMD_S_TIMEOUT:
850 ir->rc->timeout = US_TO_NS((hi << 8 | lo) / 2); 851 ir->rc->timeout = US_TO_NS((hi << 8 | lo) * MCE_TIME_UNIT);
851 break; 852 break;
852 853
853 /* 1-byte return value commands */ 854 /* 1-byte return value commands */
@@ -1078,7 +1079,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1078 rc->priv = ir; 1079 rc->priv = ir;
1079 rc->driver_type = RC_DRIVER_IR_RAW; 1080 rc->driver_type = RC_DRIVER_IR_RAW;
1080 rc->allowed_protos = RC_TYPE_ALL; 1081 rc->allowed_protos = RC_TYPE_ALL;
1081 rc->timeout = US_TO_NS(1000); 1082 rc->timeout = MS_TO_NS(100);
1082 if (!ir->flags.no_tx) { 1083 if (!ir->flags.no_tx) {
1083 rc->s_tx_mask = mceusb_set_tx_mask; 1084 rc->s_tx_mask = mceusb_set_tx_mask;
1084 rc->s_tx_carrier = mceusb_set_tx_carrier; 1085 rc->s_tx_carrier = mceusb_set_tx_carrier;
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 565f24c20d77..ce595f9ab4c7 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -1110,7 +1110,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1110 rdev->dev.parent = &pdev->dev; 1110 rdev->dev.parent = &pdev->dev;
1111 rdev->driver_name = NVT_DRIVER_NAME; 1111 rdev->driver_name = NVT_DRIVER_NAME;
1112 rdev->map_name = RC_MAP_RC6_MCE; 1112 rdev->map_name = RC_MAP_RC6_MCE;
1113 rdev->timeout = US_TO_NS(1000); 1113 rdev->timeout = MS_TO_NS(100);
1114 /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */ 1114 /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */
1115 rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD); 1115 rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD);
1116#if 0 1116#if 0
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 64d9b2136ff6..419777a832ee 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -2060,12 +2060,8 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev,
2060 goto fail_irq; 2060 goto fail_irq;
2061 } 2061 }
2062 2062
2063 if (!pci_enable_msi(pci_dev)) 2063 err = request_irq(pci_dev->irq, cx23885_irq,
2064 err = request_irq(pci_dev->irq, cx23885_irq, 2064 IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
2065 IRQF_DISABLED, dev->name, dev);
2066 else
2067 err = request_irq(pci_dev->irq, cx23885_irq,
2068 IRQF_SHARED | IRQF_DISABLED, dev->name, dev);
2069 if (err < 0) { 2065 if (err < 0) {
2070 printk(KERN_ERR "%s: can't get IRQ %d\n", 2066 printk(KERN_ERR "%s: can't get IRQ %d\n",
2071 dev->name, pci_dev->irq); 2067 dev->name, pci_dev->irq);
@@ -2114,7 +2110,6 @@ static void __devexit cx23885_finidev(struct pci_dev *pci_dev)
2114 2110
2115 /* unregister stuff */ 2111 /* unregister stuff */
2116 free_irq(pci_dev->irq, dev); 2112 free_irq(pci_dev->irq, dev);
2117 pci_disable_msi(pci_dev);
2118 2113
2119 cx23885_dev_unregister(dev); 2114 cx23885_dev_unregister(dev);
2120 v4l2_device_unregister(v4l2_dev); 2115 v4l2_device_unregister(v4l2_dev);
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index cfa9f7efe93d..a03945ab9f08 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -714,10 +714,19 @@ static int tuner_remove(struct i2c_client *client)
714 * returns 0. 714 * returns 0.
715 * This function is needed for boards that have a separate tuner for 715 * This function is needed for boards that have a separate tuner for
716 * radio (like devices with tea5767). 716 * radio (like devices with tea5767).
717 * NOTE: mt20xx uses V4L2_TUNER_DIGITAL_TV and calls set_tv_freq to
718 * select a TV frequency. So, t_mode = T_ANALOG_TV could actually
719 * be used to represent a Digital TV too.
717 */ 720 */
718static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode) 721static inline int check_mode(struct tuner *t, enum v4l2_tuner_type mode)
719{ 722{
720 if ((1 << mode & t->mode_mask) == 0) 723 int t_mode;
724 if (mode == V4L2_TUNER_RADIO)
725 t_mode = T_RADIO;
726 else
727 t_mode = T_ANALOG_TV;
728
729 if ((t_mode & t->mode_mask) == 0)
721 return -EINVAL; 730 return -EINVAL;
722 731
723 return 0; 732 return 0;
@@ -984,7 +993,7 @@ static void tuner_status(struct dvb_frontend *fe)
984 case V4L2_TUNER_RADIO: 993 case V4L2_TUNER_RADIO:
985 p = "radio"; 994 p = "radio";
986 break; 995 break;
987 case V4L2_TUNER_DIGITAL_TV: 996 case V4L2_TUNER_DIGITAL_TV: /* Used by mt20xx */
988 p = "digital TV"; 997 p = "digital TV";
989 break; 998 break;
990 case V4L2_TUNER_ANALOG_TV: 999 case V4L2_TUNER_ANALOG_TV:
@@ -1135,9 +1144,8 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
1135 return 0; 1144 return 0;
1136 if (vt->type == t->mode && analog_ops->get_afc) 1145 if (vt->type == t->mode && analog_ops->get_afc)
1137 vt->afc = analog_ops->get_afc(&t->fe); 1146 vt->afc = analog_ops->get_afc(&t->fe);
1138 if (vt->type == V4L2_TUNER_ANALOG_TV) 1147 if (t->mode != V4L2_TUNER_RADIO) {
1139 vt->capability |= V4L2_TUNER_CAP_NORM; 1148 vt->capability |= V4L2_TUNER_CAP_NORM;
1140 if (vt->type != V4L2_TUNER_RADIO) {
1141 vt->rangelow = tv_range[0] * 16; 1149 vt->rangelow = tv_range[0] * 16;
1142 vt->rangehigh = tv_range[1] * 16; 1150 vt->rangehigh = tv_range[1] * 16;
1143 return 0; 1151 return 0;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 2a7e43bc796d..aa7d1d79b8c5 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -247,12 +247,12 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
247 return 0; 247 return 0;
248 248
249 /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */ 249 /* Version is coded in the CSD_STRUCTURE byte in the EXT_CSD register */
250 card->ext_csd.raw_ext_csd_structure = ext_csd[EXT_CSD_STRUCTURE];
250 if (card->csd.structure == 3) { 251 if (card->csd.structure == 3) {
251 int ext_csd_struct = ext_csd[EXT_CSD_STRUCTURE]; 252 if (card->ext_csd.raw_ext_csd_structure > 2) {
252 if (ext_csd_struct > 2) {
253 printk(KERN_ERR "%s: unrecognised EXT_CSD structure " 253 printk(KERN_ERR "%s: unrecognised EXT_CSD structure "
254 "version %d\n", mmc_hostname(card->host), 254 "version %d\n", mmc_hostname(card->host),
255 ext_csd_struct); 255 card->ext_csd.raw_ext_csd_structure);
256 err = -EINVAL; 256 err = -EINVAL;
257 goto out; 257 goto out;
258 } 258 }
@@ -266,6 +266,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
266 goto out; 266 goto out;
267 } 267 }
268 268
269 card->ext_csd.raw_sectors[0] = ext_csd[EXT_CSD_SEC_CNT + 0];
270 card->ext_csd.raw_sectors[1] = ext_csd[EXT_CSD_SEC_CNT + 1];
271 card->ext_csd.raw_sectors[2] = ext_csd[EXT_CSD_SEC_CNT + 2];
272 card->ext_csd.raw_sectors[3] = ext_csd[EXT_CSD_SEC_CNT + 3];
269 if (card->ext_csd.rev >= 2) { 273 if (card->ext_csd.rev >= 2) {
270 card->ext_csd.sectors = 274 card->ext_csd.sectors =
271 ext_csd[EXT_CSD_SEC_CNT + 0] << 0 | 275 ext_csd[EXT_CSD_SEC_CNT + 0] << 0 |
@@ -277,7 +281,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
277 if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512) 281 if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512)
278 mmc_card_set_blockaddr(card); 282 mmc_card_set_blockaddr(card);
279 } 283 }
280 284 card->ext_csd.raw_card_type = ext_csd[EXT_CSD_CARD_TYPE];
281 switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) { 285 switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {
282 case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 | 286 case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 |
283 EXT_CSD_CARD_TYPE_26: 287 EXT_CSD_CARD_TYPE_26:
@@ -307,6 +311,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
307 mmc_hostname(card->host)); 311 mmc_hostname(card->host));
308 } 312 }
309 313
314 card->ext_csd.raw_s_a_timeout = ext_csd[EXT_CSD_S_A_TIMEOUT];
315 card->ext_csd.raw_erase_timeout_mult =
316 ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT];
317 card->ext_csd.raw_hc_erase_grp_size =
318 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
310 if (card->ext_csd.rev >= 3) { 319 if (card->ext_csd.rev >= 3) {
311 u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT]; 320 u8 sa_shift = ext_csd[EXT_CSD_S_A_TIMEOUT];
312 card->ext_csd.part_config = ext_csd[EXT_CSD_PART_CONFIG]; 321 card->ext_csd.part_config = ext_csd[EXT_CSD_PART_CONFIG];
@@ -334,6 +343,16 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
334 card->ext_csd.boot_size = ext_csd[EXT_CSD_BOOT_MULT] << 17; 343 card->ext_csd.boot_size = ext_csd[EXT_CSD_BOOT_MULT] << 17;
335 } 344 }
336 345
346 card->ext_csd.raw_hc_erase_gap_size =
347 ext_csd[EXT_CSD_PARTITION_ATTRIBUTE];
348 card->ext_csd.raw_sec_trim_mult =
349 ext_csd[EXT_CSD_SEC_TRIM_MULT];
350 card->ext_csd.raw_sec_erase_mult =
351 ext_csd[EXT_CSD_SEC_ERASE_MULT];
352 card->ext_csd.raw_sec_feature_support =
353 ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
354 card->ext_csd.raw_trim_mult =
355 ext_csd[EXT_CSD_TRIM_MULT];
337 if (card->ext_csd.rev >= 4) { 356 if (card->ext_csd.rev >= 4) {
338 /* 357 /*
339 * Enhanced area feature support -- check whether the eMMC 358 * Enhanced area feature support -- check whether the eMMC
@@ -341,7 +360,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
341 * area offset and size to user by adding sysfs interface. 360 * area offset and size to user by adding sysfs interface.
342 */ 361 */
343 if ((ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x2) && 362 if ((ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x2) &&
344 (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE] & 0x1)) { 363 (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE] & 0x1)) {
345 u8 hc_erase_grp_sz = 364 u8 hc_erase_grp_sz =
346 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]; 365 ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
347 u8 hc_wp_grp_sz = 366 u8 hc_wp_grp_sz =
@@ -401,17 +420,17 @@ static inline void mmc_free_ext_csd(u8 *ext_csd)
401} 420}
402 421
403 422
404static int mmc_compare_ext_csds(struct mmc_card *card, u8 *ext_csd, 423static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width)
405 unsigned bus_width)
406{ 424{
407 u8 *bw_ext_csd; 425 u8 *bw_ext_csd;
408 int err; 426 int err;
409 427
428 if (bus_width == MMC_BUS_WIDTH_1)
429 return 0;
430
410 err = mmc_get_ext_csd(card, &bw_ext_csd); 431 err = mmc_get_ext_csd(card, &bw_ext_csd);
411 if (err)
412 return err;
413 432
414 if ((ext_csd == NULL || bw_ext_csd == NULL)) { 433 if (err || bw_ext_csd == NULL) {
415 if (bus_width != MMC_BUS_WIDTH_1) 434 if (bus_width != MMC_BUS_WIDTH_1)
416 err = -EINVAL; 435 err = -EINVAL;
417 goto out; 436 goto out;
@@ -421,35 +440,40 @@ static int mmc_compare_ext_csds(struct mmc_card *card, u8 *ext_csd,
421 goto out; 440 goto out;
422 441
423 /* only compare read only fields */ 442 /* only compare read only fields */
424 err = (!(ext_csd[EXT_CSD_PARTITION_SUPPORT] == 443 err = (!(card->ext_csd.raw_partition_support ==
425 bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) && 444 bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) &&
426 (ext_csd[EXT_CSD_ERASED_MEM_CONT] == 445 (card->ext_csd.raw_erased_mem_count ==
427 bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) && 446 bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) &&
428 (ext_csd[EXT_CSD_REV] == 447 (card->ext_csd.rev ==
429 bw_ext_csd[EXT_CSD_REV]) && 448 bw_ext_csd[EXT_CSD_REV]) &&
430 (ext_csd[EXT_CSD_STRUCTURE] == 449 (card->ext_csd.raw_ext_csd_structure ==
431 bw_ext_csd[EXT_CSD_STRUCTURE]) && 450 bw_ext_csd[EXT_CSD_STRUCTURE]) &&
432 (ext_csd[EXT_CSD_CARD_TYPE] == 451 (card->ext_csd.raw_card_type ==
433 bw_ext_csd[EXT_CSD_CARD_TYPE]) && 452 bw_ext_csd[EXT_CSD_CARD_TYPE]) &&
434 (ext_csd[EXT_CSD_S_A_TIMEOUT] == 453 (card->ext_csd.raw_s_a_timeout ==
435 bw_ext_csd[EXT_CSD_S_A_TIMEOUT]) && 454 bw_ext_csd[EXT_CSD_S_A_TIMEOUT]) &&
436 (ext_csd[EXT_CSD_HC_WP_GRP_SIZE] == 455 (card->ext_csd.raw_hc_erase_gap_size ==
437 bw_ext_csd[EXT_CSD_HC_WP_GRP_SIZE]) && 456 bw_ext_csd[EXT_CSD_HC_WP_GRP_SIZE]) &&
438 (ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT] == 457 (card->ext_csd.raw_erase_timeout_mult ==
439 bw_ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT]) && 458 bw_ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT]) &&
440 (ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] == 459 (card->ext_csd.raw_hc_erase_grp_size ==
441 bw_ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]) && 460 bw_ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE]) &&
442 (ext_csd[EXT_CSD_SEC_TRIM_MULT] == 461 (card->ext_csd.raw_sec_trim_mult ==
443 bw_ext_csd[EXT_CSD_SEC_TRIM_MULT]) && 462 bw_ext_csd[EXT_CSD_SEC_TRIM_MULT]) &&
444 (ext_csd[EXT_CSD_SEC_ERASE_MULT] == 463 (card->ext_csd.raw_sec_erase_mult ==
445 bw_ext_csd[EXT_CSD_SEC_ERASE_MULT]) && 464 bw_ext_csd[EXT_CSD_SEC_ERASE_MULT]) &&
446 (ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT] == 465 (card->ext_csd.raw_sec_feature_support ==
447 bw_ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]) && 466 bw_ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]) &&
448 (ext_csd[EXT_CSD_TRIM_MULT] == 467 (card->ext_csd.raw_trim_mult ==
449 bw_ext_csd[EXT_CSD_TRIM_MULT]) && 468 bw_ext_csd[EXT_CSD_TRIM_MULT]) &&
450 memcmp(&ext_csd[EXT_CSD_SEC_CNT], 469 (card->ext_csd.raw_sectors[0] ==
451 &bw_ext_csd[EXT_CSD_SEC_CNT], 470 bw_ext_csd[EXT_CSD_SEC_CNT + 0]) &&
452 4) != 0); 471 (card->ext_csd.raw_sectors[1] ==
472 bw_ext_csd[EXT_CSD_SEC_CNT + 1]) &&
473 (card->ext_csd.raw_sectors[2] ==
474 bw_ext_csd[EXT_CSD_SEC_CNT + 2]) &&
475 (card->ext_csd.raw_sectors[3] ==
476 bw_ext_csd[EXT_CSD_SEC_CNT + 3]));
453 if (err) 477 if (err)
454 err = -EINVAL; 478 err = -EINVAL;
455 479
@@ -770,7 +794,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
770 */ 794 */
771 if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST)) 795 if (!(host->caps & MMC_CAP_BUS_WIDTH_TEST))
772 err = mmc_compare_ext_csds(card, 796 err = mmc_compare_ext_csds(card,
773 ext_csd,
774 bus_width); 797 bus_width);
775 else 798 else
776 err = mmc_bus_test(card, bus_width); 799 err = mmc_bus_test(card, bus_width);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index eafe44a528ac..63c22b0bb5ad 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1428,9 +1428,9 @@ out:
1428 return features; 1428 return features;
1429} 1429}
1430 1430
1431#define BOND_VLAN_FEATURES (NETIF_F_ALL_TX_OFFLOADS | \ 1431#define BOND_VLAN_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1432 NETIF_F_SOFT_FEATURES | \ 1432 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1433 NETIF_F_LRO) 1433 NETIF_F_HIGHDMA | NETIF_F_LRO)
1434 1434
1435static void bond_compute_features(struct bonding *bond) 1435static void bond_compute_features(struct bonding *bond)
1436{ 1436{
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 2dfcc8047847..dfa55f94ba7f 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2289,6 +2289,23 @@ static int gfar_set_mac_address(struct net_device *dev)
2289 return 0; 2289 return 0;
2290} 2290}
2291 2291
2292/* Check if rx parser should be activated */
2293void gfar_check_rx_parser_mode(struct gfar_private *priv)
2294{
2295 struct gfar __iomem *regs;
2296 u32 tempval;
2297
2298 regs = priv->gfargrp[0].regs;
2299
2300 tempval = gfar_read(&regs->rctrl);
2301 /* If parse is no longer required, then disable parser */
2302 if (tempval & RCTRL_REQ_PARSER)
2303 tempval |= RCTRL_PRSDEP_INIT;
2304 else
2305 tempval &= ~RCTRL_PRSDEP_INIT;
2306 gfar_write(&regs->rctrl, tempval);
2307}
2308
2292 2309
2293/* Enables and disables VLAN insertion/extraction */ 2310/* Enables and disables VLAN insertion/extraction */
2294static void gfar_vlan_rx_register(struct net_device *dev, 2311static void gfar_vlan_rx_register(struct net_device *dev,
@@ -2325,12 +2342,9 @@ static void gfar_vlan_rx_register(struct net_device *dev,
2325 /* Disable VLAN tag extraction */ 2342 /* Disable VLAN tag extraction */
2326 tempval = gfar_read(&regs->rctrl); 2343 tempval = gfar_read(&regs->rctrl);
2327 tempval &= ~RCTRL_VLEX; 2344 tempval &= ~RCTRL_VLEX;
2328 /* If parse is no longer required, then disable parser */
2329 if (tempval & RCTRL_REQ_PARSER)
2330 tempval |= RCTRL_PRSDEP_INIT;
2331 else
2332 tempval &= ~RCTRL_PRSDEP_INIT;
2333 gfar_write(&regs->rctrl, tempval); 2345 gfar_write(&regs->rctrl, tempval);
2346
2347 gfar_check_rx_parser_mode(priv);
2334 } 2348 }
2335 2349
2336 gfar_change_mtu(dev, dev->mtu); 2350 gfar_change_mtu(dev, dev->mtu);
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index ba36dc7a3435..440e69d8beff 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -274,7 +274,7 @@ extern const char gfar_driver_version[];
274#define RCTRL_PROM 0x00000008 274#define RCTRL_PROM 0x00000008
275#define RCTRL_EMEN 0x00000002 275#define RCTRL_EMEN 0x00000002
276#define RCTRL_REQ_PARSER (RCTRL_VLEX | RCTRL_IPCSEN | \ 276#define RCTRL_REQ_PARSER (RCTRL_VLEX | RCTRL_IPCSEN | \
277 RCTRL_TUCSEN) 277 RCTRL_TUCSEN | RCTRL_FILREN)
278#define RCTRL_CHECKSUMMING (RCTRL_IPCSEN | RCTRL_TUCSEN | \ 278#define RCTRL_CHECKSUMMING (RCTRL_IPCSEN | RCTRL_TUCSEN | \
279 RCTRL_PRSDEP_INIT) 279 RCTRL_PRSDEP_INIT)
280#define RCTRL_EXTHASH (RCTRL_GHTX) 280#define RCTRL_EXTHASH (RCTRL_GHTX)
@@ -1156,6 +1156,7 @@ extern void gfar_configure_coalescing(struct gfar_private *priv,
1156 unsigned long tx_mask, unsigned long rx_mask); 1156 unsigned long tx_mask, unsigned long rx_mask);
1157void gfar_init_sysfs(struct net_device *dev); 1157void gfar_init_sysfs(struct net_device *dev);
1158int gfar_set_features(struct net_device *dev, u32 features); 1158int gfar_set_features(struct net_device *dev, u32 features);
1159extern void gfar_check_rx_parser_mode(struct gfar_private *priv);
1159 1160
1160extern const struct ethtool_ops gfar_ethtool_ops; 1161extern const struct ethtool_ops gfar_ethtool_ops;
1161 1162
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 8f8b65af9ed5..60f46bc2bf64 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -140,7 +140,7 @@ MODULE_LICENSE("GPL");
140module_param(mtu, int, 0); 140module_param(mtu, int, 0);
141module_param(debug, int, 0); 141module_param(debug, int, 0);
142module_param(rx_copybreak, int, 0); 142module_param(rx_copybreak, int, 0);
143module_param(dspcfg_workaround, int, 1); 143module_param(dspcfg_workaround, int, 0);
144module_param_array(options, int, NULL, 0); 144module_param_array(options, int, NULL, 0);
145module_param_array(full_duplex, int, NULL, 0); 145module_param_array(full_duplex, int, NULL, 0);
146MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)"); 146MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
@@ -2028,8 +2028,8 @@ static void drain_rx(struct net_device *dev)
2028 np->rx_ring[i].cmd_status = 0; 2028 np->rx_ring[i].cmd_status = 0;
2029 np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ 2029 np->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
2030 if (np->rx_skbuff[i]) { 2030 if (np->rx_skbuff[i]) {
2031 pci_unmap_single(np->pci_dev, 2031 pci_unmap_single(np->pci_dev, np->rx_dma[i],
2032 np->rx_dma[i], buflen, 2032 buflen + NATSEMI_PADDING,
2033 PCI_DMA_FROMDEVICE); 2033 PCI_DMA_FROMDEVICE);
2034 dev_kfree_skb(np->rx_skbuff[i]); 2034 dev_kfree_skb(np->rx_skbuff[i]);
2035 } 2035 }
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 718879b35b7d..bc9a4bb31980 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -348,8 +348,9 @@ static int pppoe_device_event(struct notifier_block *this,
348 348
349 /* Only look at sockets that are using this specific device. */ 349 /* Only look at sockets that are using this specific device. */
350 switch (event) { 350 switch (event) {
351 case NETDEV_CHANGEADDR:
351 case NETDEV_CHANGEMTU: 352 case NETDEV_CHANGEMTU:
352 /* A change in mtu is a bad thing, requiring 353 /* A change in mtu or address is a bad thing, requiring
353 * LCP re-negotiation. 354 * LCP re-negotiation.
354 */ 355 */
355 356
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 200a363c3bf5..0ffec4608441 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -677,9 +677,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
677 if (status & RX_FIFO_FULL) 677 if (status & RX_FIFO_FULL)
678 dev->stats.rx_fifo_errors++; 678 dev->stats.rx_fifo_errors++;
679 679
680 /* Mask off RX interrupt */ 680 if (likely(napi_schedule_prep(&lp->napi))) {
681 misr &= ~RX_INTS; 681 /* Mask off RX interrupt */
682 napi_schedule(&lp->napi); 682 misr &= ~RX_INTS;
683 __napi_schedule(&lp->napi);
684 }
683 } 685 }
684 686
685 /* TX interrupt request */ 687 /* TX interrupt request */
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 8ec1a9a0bb9a..2f110fb30daa 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -182,11 +182,11 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
182#ifdef SL_INCLUDE_CSLIP 182#ifdef SL_INCLUDE_CSLIP
183 cbuff = xchg(&sl->cbuff, cbuff); 183 cbuff = xchg(&sl->cbuff, cbuff);
184 slcomp = xchg(&sl->slcomp, slcomp); 184 slcomp = xchg(&sl->slcomp, slcomp);
185#endif
185#ifdef CONFIG_SLIP_MODE_SLIP6 186#ifdef CONFIG_SLIP_MODE_SLIP6
186 sl->xdata = 0; 187 sl->xdata = 0;
187 sl->xbits = 0; 188 sl->xbits = 0;
188#endif 189#endif
189#endif
190 spin_unlock_bh(&sl->lock); 190 spin_unlock_bh(&sl->lock);
191 err = 0; 191 err = 0;
192 192
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 468512731966..9a21ca3873fc 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -879,7 +879,6 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
879 txptr = db->tx_remove_ptr; 879 txptr = db->tx_remove_ptr;
880 while(db->tx_packet_cnt) { 880 while(db->tx_packet_cnt) {
881 tdes0 = le32_to_cpu(txptr->tdes0); 881 tdes0 = le32_to_cpu(txptr->tdes0);
882 pr_debug("tdes0=%x\n", tdes0);
883 if (tdes0 & 0x80000000) 882 if (tdes0 & 0x80000000)
884 break; 883 break;
885 884
@@ -889,7 +888,6 @@ static void dmfe_free_tx_pkt(struct DEVICE *dev, struct dmfe_board_info * db)
889 888
890 /* Transmit statistic counter */ 889 /* Transmit statistic counter */
891 if ( tdes0 != 0x7fffffff ) { 890 if ( tdes0 != 0x7fffffff ) {
892 pr_debug("tdes0=%x\n", tdes0);
893 dev->stats.collisions += (tdes0 >> 3) & 0xf; 891 dev->stats.collisions += (tdes0 >> 3) & 0xf;
894 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff; 892 dev->stats.tx_bytes += le32_to_cpu(txptr->tdes1) & 0x7ff;
895 if (tdes0 & TDES0_ERR_MASK) { 893 if (tdes0 & TDES0_ERR_MASK) {
@@ -986,7 +984,6 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
986 /* error summary bit check */ 984 /* error summary bit check */
987 if (rdes0 & 0x8000) { 985 if (rdes0 & 0x8000) {
988 /* This is a error packet */ 986 /* This is a error packet */
989 pr_debug("rdes0: %x\n", rdes0);
990 dev->stats.rx_errors++; 987 dev->stats.rx_errors++;
991 if (rdes0 & 1) 988 if (rdes0 & 1)
992 dev->stats.rx_fifo_errors++; 989 dev->stats.rx_fifo_errors++;
@@ -1638,7 +1635,6 @@ static u8 dmfe_sense_speed(struct dmfe_board_info * db)
1638 else /* DM9102/DM9102A */ 1635 else /* DM9102/DM9102A */
1639 phy_mode = phy_read(db->ioaddr, 1636 phy_mode = phy_read(db->ioaddr,
1640 db->phy_addr, 17, db->chip_id) & 0xf000; 1637 db->phy_addr, 17, db->chip_id) & 0xf000;
1641 pr_debug("Phy_mode %x\n", phy_mode);
1642 switch (phy_mode) { 1638 switch (phy_mode) {
1643 case 0x1000: db->op_mode = DMFE_10MHF; break; 1639 case 0x1000: db->op_mode = DMFE_10MHF; break;
1644 case 0x2000: db->op_mode = DMFE_10MFD; break; 1640 case 0x2000: db->op_mode = DMFE_10MFD; break;
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 387ca43f26f4..304fe78ff60e 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2421,10 +2421,8 @@ static void hso_free_net_device(struct hso_device *hso_dev)
2421 2421
2422 remove_net_device(hso_net->parent); 2422 remove_net_device(hso_net->parent);
2423 2423
2424 if (hso_net->net) { 2424 if (hso_net->net)
2425 unregister_netdev(hso_net->net); 2425 unregister_netdev(hso_net->net);
2426 free_netdev(hso_net->net);
2427 }
2428 2426
2429 /* start freeing */ 2427 /* start freeing */
2430 for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) { 2428 for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
@@ -2436,6 +2434,9 @@ static void hso_free_net_device(struct hso_device *hso_dev)
2436 kfree(hso_net->mux_bulk_tx_buf); 2434 kfree(hso_net->mux_bulk_tx_buf);
2437 hso_net->mux_bulk_tx_buf = NULL; 2435 hso_net->mux_bulk_tx_buf = NULL;
2438 2436
2437 if (hso_net->net)
2438 free_netdev(hso_net->net);
2439
2439 kfree(hso_dev); 2440 kfree(hso_dev);
2440} 2441}
2441 2442
diff --git a/drivers/net/wireless/ath/ath5k/pci.c b/drivers/net/wireless/ath/ath5k/pci.c
index 296c316a8341..f2c0c236392f 100644
--- a/drivers/net/wireless/ath/ath5k/pci.c
+++ b/drivers/net/wireless/ath/ath5k/pci.c
@@ -297,7 +297,9 @@ ath5k_pci_remove(struct pci_dev *pdev)
297#ifdef CONFIG_PM_SLEEP 297#ifdef CONFIG_PM_SLEEP
298static int ath5k_pci_suspend(struct device *dev) 298static int ath5k_pci_suspend(struct device *dev)
299{ 299{
300 struct ath5k_softc *sc = pci_get_drvdata(to_pci_dev(dev)); 300 struct pci_dev *pdev = to_pci_dev(dev);
301 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
302 struct ath5k_softc *sc = hw->priv;
301 303
302 ath5k_led_off(sc); 304 ath5k_led_off(sc);
303 return 0; 305 return 0;
@@ -306,7 +308,8 @@ static int ath5k_pci_suspend(struct device *dev)
306static int ath5k_pci_resume(struct device *dev) 308static int ath5k_pci_resume(struct device *dev)
307{ 309{
308 struct pci_dev *pdev = to_pci_dev(dev); 310 struct pci_dev *pdev = to_pci_dev(dev);
309 struct ath5k_softc *sc = pci_get_drvdata(pdev); 311 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
312 struct ath5k_softc *sc = hw->priv;
310 313
311 /* 314 /*
312 * Suspend/Resume resets the PCI configuration space, so we have to 315 * Suspend/Resume resets the PCI configuration space, so we have to
diff --git a/drivers/net/wireless/ath/ath5k/sysfs.c b/drivers/net/wireless/ath/ath5k/sysfs.c
index 929c68cdf8ab..a073cdce1f15 100644
--- a/drivers/net/wireless/ath/ath5k/sysfs.c
+++ b/drivers/net/wireless/ath/ath5k/sysfs.c
@@ -10,7 +10,8 @@ static ssize_t ath5k_attr_show_##name(struct device *dev, \
10 struct device_attribute *attr, \ 10 struct device_attribute *attr, \
11 char *buf) \ 11 char *buf) \
12{ \ 12{ \
13 struct ath5k_softc *sc = dev_get_drvdata(dev); \ 13 struct ieee80211_hw *hw = dev_get_drvdata(dev); \
14 struct ath5k_softc *sc = hw->priv; \
14 return snprintf(buf, PAGE_SIZE, "%d\n", get); \ 15 return snprintf(buf, PAGE_SIZE, "%d\n", get); \
15} \ 16} \
16 \ 17 \
@@ -18,7 +19,8 @@ static ssize_t ath5k_attr_store_##name(struct device *dev, \
18 struct device_attribute *attr, \ 19 struct device_attribute *attr, \
19 const char *buf, size_t count) \ 20 const char *buf, size_t count) \
20{ \ 21{ \
21 struct ath5k_softc *sc = dev_get_drvdata(dev); \ 22 struct ieee80211_hw *hw = dev_get_drvdata(dev); \
23 struct ath5k_softc *sc = hw->priv; \
22 int val; \ 24 int val; \
23 \ 25 \
24 val = (int)simple_strtoul(buf, NULL, 10); \ 26 val = (int)simple_strtoul(buf, NULL, 10); \
@@ -33,7 +35,8 @@ static ssize_t ath5k_attr_show_##name(struct device *dev, \
33 struct device_attribute *attr, \ 35 struct device_attribute *attr, \
34 char *buf) \ 36 char *buf) \
35{ \ 37{ \
36 struct ath5k_softc *sc = dev_get_drvdata(dev); \ 38 struct ieee80211_hw *hw = dev_get_drvdata(dev); \
39 struct ath5k_softc *sc = hw->priv; \
37 return snprintf(buf, PAGE_SIZE, "%d\n", get); \ 40 return snprintf(buf, PAGE_SIZE, "%d\n", get); \
38} \ 41} \
39static DEVICE_ATTR(name, S_IRUGO, ath5k_attr_show_##name, NULL) 42static DEVICE_ATTR(name, S_IRUGO, ath5k_attr_show_##name, NULL)
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 3779b8977d47..33443bcaa8d9 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -671,7 +671,8 @@ static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,
671 * TODO - this could be improved to be dependent on the rate. 671 * TODO - this could be improved to be dependent on the rate.
672 * The hardware can keep up at lower rates, but not higher rates 672 * The hardware can keep up at lower rates, but not higher rates
673 */ 673 */
674 if (fi->keyix != ATH9K_TXKEYIX_INVALID) 674 if ((fi->keyix != ATH9K_TXKEYIX_INVALID) &&
675 !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA))
675 ndelim += ATH_AGGR_ENCRYPTDELIM; 676 ndelim += ATH_AGGR_ENCRYPTDELIM;
676 677
677 /* 678 /*
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c
index 2fb53d067512..333b69ef2ae2 100644
--- a/drivers/net/wireless/ath/carl9170/usb.c
+++ b/drivers/net/wireless/ath/carl9170/usb.c
@@ -112,6 +112,8 @@ static struct usb_device_id carl9170_usb_ids[] = {
112 { USB_DEVICE(0x04bb, 0x093f) }, 112 { USB_DEVICE(0x04bb, 0x093f) },
113 /* NEC WL300NU-G */ 113 /* NEC WL300NU-G */
114 { USB_DEVICE(0x0409, 0x0249) }, 114 { USB_DEVICE(0x0409, 0x0249) },
115 /* NEC WL300NU-AG */
116 { USB_DEVICE(0x0409, 0x02b4) },
115 /* AVM FRITZ!WLAN USB Stick N */ 117 /* AVM FRITZ!WLAN USB Stick N */
116 { USB_DEVICE(0x057c, 0x8401) }, 118 { USB_DEVICE(0x057c, 0x8401) },
117 /* AVM FRITZ!WLAN USB Stick N 2.4 */ 119 /* AVM FRITZ!WLAN USB Stick N 2.4 */
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 092e342c19df..942f7a3969a7 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -298,6 +298,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
298 {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/ 298 {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/
299 {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ 299 {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
300 {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ 300 {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
301 {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
301 {RTL_USB_DEVICE(0x0Df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ 302 {RTL_USB_DEVICE(0x0Df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
302 {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ 303 {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/
303 /* HP - Lite-On ,8188CUS Slim Combo */ 304 /* HP - Lite-On ,8188CUS Slim Combo */
diff --git a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
index 712baab3c83d..e956f659089a 100644
--- a/drivers/pcmcia/pxa2xx_vpac270.c
+++ b/drivers/pcmcia/pxa2xx_vpac270.c
@@ -76,10 +76,10 @@ static int vpac270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
76static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 76static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
77{ 77{
78 if (skt->nr == 0) 78 if (skt->nr == 0)
79 gpio_request_array(vpac270_pcmcia_gpios, 79 gpio_free_array(vpac270_pcmcia_gpios,
80 ARRAY_SIZE(vpac270_pcmcia_gpios)); 80 ARRAY_SIZE(vpac270_pcmcia_gpios));
81 else 81 else
82 gpio_request_array(vpac270_cf_gpios, 82 gpio_free_array(vpac270_cf_gpios,
83 ARRAY_SIZE(vpac270_cf_gpios)); 83 ARRAY_SIZE(vpac270_cf_gpios));
84} 84}
85 85
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 2a20dabec76d..d6620ad309ce 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -516,8 +516,17 @@ static void ssb_pcicore_pcie_setup_workarounds(struct ssb_pcicore *pc)
516 516
517static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc) 517static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
518{ 518{
519 ssb_pcicore_fix_sprom_core_index(pc);
520
519 /* Disable PCI interrupts. */ 521 /* Disable PCI interrupts. */
520 ssb_write32(pc->dev, SSB_INTVEC, 0); 522 ssb_write32(pc->dev, SSB_INTVEC, 0);
523
524 /* Additional PCIe always once-executed workarounds */
525 if (pc->dev->id.coreid == SSB_DEV_PCIE) {
526 ssb_pcicore_serdes_workaround(pc);
527 /* TODO: ASPM */
528 /* TODO: Clock Request Update */
529 }
521} 530}
522 531
523void ssb_pcicore_init(struct ssb_pcicore *pc) 532void ssb_pcicore_init(struct ssb_pcicore *pc)
@@ -529,8 +538,6 @@ void ssb_pcicore_init(struct ssb_pcicore *pc)
529 if (!ssb_device_is_enabled(dev)) 538 if (!ssb_device_is_enabled(dev))
530 ssb_device_enable(dev, 0); 539 ssb_device_enable(dev, 0);
531 540
532 ssb_pcicore_fix_sprom_core_index(pc);
533
534#ifdef CONFIG_SSB_PCICORE_HOSTMODE 541#ifdef CONFIG_SSB_PCICORE_HOSTMODE
535 pc->hostmode = pcicore_is_in_hostmode(pc); 542 pc->hostmode = pcicore_is_in_hostmode(pc);
536 if (pc->hostmode) 543 if (pc->hostmode)
@@ -538,13 +545,6 @@ void ssb_pcicore_init(struct ssb_pcicore *pc)
538#endif /* CONFIG_SSB_PCICORE_HOSTMODE */ 545#endif /* CONFIG_SSB_PCICORE_HOSTMODE */
539 if (!pc->hostmode) 546 if (!pc->hostmode)
540 ssb_pcicore_init_clientmode(pc); 547 ssb_pcicore_init_clientmode(pc);
541
542 /* Additional PCIe always once-executed workarounds */
543 if (dev->id.coreid == SSB_DEV_PCIE) {
544 ssb_pcicore_serdes_workaround(pc);
545 /* TODO: ASPM */
546 /* TODO: Clock Request Update */
547 }
548} 548}
549 549
550static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address) 550static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address)
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 9536d386bb38..21d816e9dfa5 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -599,8 +599,7 @@ config IT87_WDT
599 599
600config HP_WATCHDOG 600config HP_WATCHDOG
601 tristate "HP ProLiant iLO2+ Hardware Watchdog Timer" 601 tristate "HP ProLiant iLO2+ Hardware Watchdog Timer"
602 depends on X86 602 depends on X86 && PCI
603 default m
604 help 603 help
605 A software monitoring watchdog and NMI sourcing driver. This driver 604 A software monitoring watchdog and NMI sourcing driver. This driver
606 will detect lockups and provide a stack trace. This is a driver that 605 will detect lockups and provide a stack trace. This is a driver that
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 79743d146be6..0c1d91756528 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1438,12 +1438,15 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *base,
1438 struct dentry *temp; 1438 struct dentry *temp;
1439 char *path; 1439 char *path;
1440 int len, pos; 1440 int len, pos;
1441 unsigned seq;
1441 1442
1442 if (dentry == NULL) 1443 if (dentry == NULL)
1443 return ERR_PTR(-EINVAL); 1444 return ERR_PTR(-EINVAL);
1444 1445
1445retry: 1446retry:
1446 len = 0; 1447 len = 0;
1448 seq = read_seqbegin(&rename_lock);
1449 rcu_read_lock();
1447 for (temp = dentry; !IS_ROOT(temp);) { 1450 for (temp = dentry; !IS_ROOT(temp);) {
1448 struct inode *inode = temp->d_inode; 1451 struct inode *inode = temp->d_inode;
1449 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) 1452 if (inode && ceph_snap(inode) == CEPH_SNAPDIR)
@@ -1455,10 +1458,12 @@ retry:
1455 len += 1 + temp->d_name.len; 1458 len += 1 + temp->d_name.len;
1456 temp = temp->d_parent; 1459 temp = temp->d_parent;
1457 if (temp == NULL) { 1460 if (temp == NULL) {
1461 rcu_read_unlock();
1458 pr_err("build_path corrupt dentry %p\n", dentry); 1462 pr_err("build_path corrupt dentry %p\n", dentry);
1459 return ERR_PTR(-EINVAL); 1463 return ERR_PTR(-EINVAL);
1460 } 1464 }
1461 } 1465 }
1466 rcu_read_unlock();
1462 if (len) 1467 if (len)
1463 len--; /* no leading '/' */ 1468 len--; /* no leading '/' */
1464 1469
@@ -1467,9 +1472,12 @@ retry:
1467 return ERR_PTR(-ENOMEM); 1472 return ERR_PTR(-ENOMEM);
1468 pos = len; 1473 pos = len;
1469 path[pos] = 0; /* trailing null */ 1474 path[pos] = 0; /* trailing null */
1475 rcu_read_lock();
1470 for (temp = dentry; !IS_ROOT(temp) && pos != 0; ) { 1476 for (temp = dentry; !IS_ROOT(temp) && pos != 0; ) {
1471 struct inode *inode = temp->d_inode; 1477 struct inode *inode;
1472 1478
1479 spin_lock(&temp->d_lock);
1480 inode = temp->d_inode;
1473 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { 1481 if (inode && ceph_snap(inode) == CEPH_SNAPDIR) {
1474 dout("build_path path+%d: %p SNAPDIR\n", 1482 dout("build_path path+%d: %p SNAPDIR\n",
1475 pos, temp); 1483 pos, temp);
@@ -1478,21 +1486,26 @@ retry:
1478 break; 1486 break;
1479 } else { 1487 } else {
1480 pos -= temp->d_name.len; 1488 pos -= temp->d_name.len;
1481 if (pos < 0) 1489 if (pos < 0) {
1490 spin_unlock(&temp->d_lock);
1482 break; 1491 break;
1492 }
1483 strncpy(path + pos, temp->d_name.name, 1493 strncpy(path + pos, temp->d_name.name,
1484 temp->d_name.len); 1494 temp->d_name.len);
1485 } 1495 }
1496 spin_unlock(&temp->d_lock);
1486 if (pos) 1497 if (pos)
1487 path[--pos] = '/'; 1498 path[--pos] = '/';
1488 temp = temp->d_parent; 1499 temp = temp->d_parent;
1489 if (temp == NULL) { 1500 if (temp == NULL) {
1501 rcu_read_unlock();
1490 pr_err("build_path corrupt dentry\n"); 1502 pr_err("build_path corrupt dentry\n");
1491 kfree(path); 1503 kfree(path);
1492 return ERR_PTR(-EINVAL); 1504 return ERR_PTR(-EINVAL);
1493 } 1505 }
1494 } 1506 }
1495 if (pos != 0) { 1507 rcu_read_unlock();
1508 if (pos != 0 || read_seqretry(&rename_lock, seq)) {
1496 pr_err("build_path did not end path lookup where " 1509 pr_err("build_path did not end path lookup where "
1497 "expected, namelen is %d, pos is %d\n", len, pos); 1510 "expected, namelen is %d, pos is %d\n", len, pos);
1498 /* presumably this is only possible if racing with a 1511 /* presumably this is only possible if racing with a
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 3e2989976297..bc4b12ca537b 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -35,6 +35,7 @@
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/kthread.h> 36#include <linux/kthread.h>
37#include <linux/freezer.h> 37#include <linux/freezer.h>
38#include <linux/namei.h>
38#include <net/ipv6.h> 39#include <net/ipv6.h>
39#include "cifsfs.h" 40#include "cifsfs.h"
40#include "cifspdu.h" 41#include "cifspdu.h"
@@ -542,14 +543,12 @@ static const struct super_operations cifs_super_ops = {
542static struct dentry * 543static struct dentry *
543cifs_get_root(struct smb_vol *vol, struct super_block *sb) 544cifs_get_root(struct smb_vol *vol, struct super_block *sb)
544{ 545{
545 int xid, rc; 546 struct dentry *dentry;
546 struct inode *inode;
547 struct qstr name;
548 struct dentry *dparent = NULL, *dchild = NULL, *alias;
549 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 547 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
550 unsigned int i, full_len, len; 548 char *full_path = NULL;
551 char *full_path = NULL, *pstart; 549 char *s, *p;
552 char sep; 550 char sep;
551 int xid;
553 552
554 full_path = cifs_build_path_to_root(vol, cifs_sb, 553 full_path = cifs_build_path_to_root(vol, cifs_sb,
555 cifs_sb_master_tcon(cifs_sb)); 554 cifs_sb_master_tcon(cifs_sb));
@@ -560,73 +559,32 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
560 559
561 xid = GetXid(); 560 xid = GetXid();
562 sep = CIFS_DIR_SEP(cifs_sb); 561 sep = CIFS_DIR_SEP(cifs_sb);
563 dparent = dget(sb->s_root); 562 dentry = dget(sb->s_root);
564 full_len = strlen(full_path); 563 p = s = full_path;
565 full_path[full_len] = sep; 564
566 pstart = full_path + 1; 565 do {
567 566 struct inode *dir = dentry->d_inode;
568 for (i = 1, len = 0; i <= full_len; i++) { 567 struct dentry *child;
569 if (full_path[i] != sep || !len) { 568
570 len++; 569 /* skip separators */
571 continue; 570 while (*s == sep)
572 } 571 s++;
573 572 if (!*s)
574 full_path[i] = 0; 573 break;
575 cFYI(1, "get dentry for %s", pstart); 574 p = s++;
576 575 /* next separator */
577 name.name = pstart; 576 while (*s && *s != sep)
578 name.len = len; 577 s++;
579 name.hash = full_name_hash(pstart, len); 578
580 dchild = d_lookup(dparent, &name); 579 mutex_lock(&dir->i_mutex);
581 if (dchild == NULL) { 580 child = lookup_one_len(p, dentry, s - p);
582 cFYI(1, "not exists"); 581 mutex_unlock(&dir->i_mutex);
583 dchild = d_alloc(dparent, &name); 582 dput(dentry);
584 if (dchild == NULL) { 583 dentry = child;
585 dput(dparent); 584 } while (!IS_ERR(dentry));
586 dparent = ERR_PTR(-ENOMEM);
587 goto out;
588 }
589 }
590
591 cFYI(1, "get inode");
592 if (dchild->d_inode == NULL) {
593 cFYI(1, "not exists");
594 inode = NULL;
595 if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
596 rc = cifs_get_inode_info_unix(&inode, full_path,
597 sb, xid);
598 else
599 rc = cifs_get_inode_info(&inode, full_path,
600 NULL, sb, xid, NULL);
601 if (rc) {
602 dput(dchild);
603 dput(dparent);
604 dparent = ERR_PTR(rc);
605 goto out;
606 }
607 alias = d_materialise_unique(dchild, inode);
608 if (alias != NULL) {
609 dput(dchild);
610 if (IS_ERR(alias)) {
611 dput(dparent);
612 dparent = ERR_PTR(-EINVAL); /* XXX */
613 goto out;
614 }
615 dchild = alias;
616 }
617 }
618 cFYI(1, "parent %p, child %p", dparent, dchild);
619
620 dput(dparent);
621 dparent = dchild;
622 len = 0;
623 pstart = full_path + i + 1;
624 full_path[i] = sep;
625 }
626out:
627 _FreeXid(xid); 585 _FreeXid(xid);
628 kfree(full_path); 586 kfree(full_path);
629 return dparent; 587 return dentry;
630} 588}
631 589
632static int cifs_set_super(struct super_block *sb, void *data) 590static int cifs_set_super(struct super_block *sb, void *data)
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 0900e1658c96..036ca83e5f46 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -129,5 +129,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
129extern const struct export_operations cifs_export_ops; 129extern const struct export_operations cifs_export_ops;
130#endif /* CIFS_NFSD_EXPORT */ 130#endif /* CIFS_NFSD_EXPORT */
131 131
132#define CIFS_VERSION "1.73" 132#define CIFS_VERSION "1.74"
133#endif /* _CIFSFS_H */ 133#endif /* _CIFSFS_H */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index dbd669cc5bc7..ccc1afa0bf3b 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3485,7 +3485,7 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, uid_t fsuid)
3485 goto out; 3485 goto out;
3486 } 3486 }
3487 3487
3488 snprintf(username, MAX_USERNAME_SIZE, "krb50x%x", fsuid); 3488 snprintf(username, sizeof(username), "krb50x%x", fsuid);
3489 vol_info->username = username; 3489 vol_info->username = username;
3490 vol_info->local_nls = cifs_sb->local_nls; 3490 vol_info->local_nls = cifs_sb->local_nls;
3491 vol_info->linux_uid = fsuid; 3491 vol_info->linux_uid = fsuid;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 81914df47ef1..fa8c21d913bc 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -55,6 +55,7 @@ build_path_from_dentry(struct dentry *direntry)
55 char dirsep; 55 char dirsep;
56 struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); 56 struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
57 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); 57 struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
58 unsigned seq;
58 59
59 if (direntry == NULL) 60 if (direntry == NULL)
60 return NULL; /* not much we can do if dentry is freed and 61 return NULL; /* not much we can do if dentry is freed and
@@ -68,22 +69,29 @@ build_path_from_dentry(struct dentry *direntry)
68 dfsplen = 0; 69 dfsplen = 0;
69cifs_bp_rename_retry: 70cifs_bp_rename_retry:
70 namelen = dfsplen; 71 namelen = dfsplen;
72 seq = read_seqbegin(&rename_lock);
73 rcu_read_lock();
71 for (temp = direntry; !IS_ROOT(temp);) { 74 for (temp = direntry; !IS_ROOT(temp);) {
72 namelen += (1 + temp->d_name.len); 75 namelen += (1 + temp->d_name.len);
73 temp = temp->d_parent; 76 temp = temp->d_parent;
74 if (temp == NULL) { 77 if (temp == NULL) {
75 cERROR(1, "corrupt dentry"); 78 cERROR(1, "corrupt dentry");
79 rcu_read_unlock();
76 return NULL; 80 return NULL;
77 } 81 }
78 } 82 }
83 rcu_read_unlock();
79 84
80 full_path = kmalloc(namelen+1, GFP_KERNEL); 85 full_path = kmalloc(namelen+1, GFP_KERNEL);
81 if (full_path == NULL) 86 if (full_path == NULL)
82 return full_path; 87 return full_path;
83 full_path[namelen] = 0; /* trailing null */ 88 full_path[namelen] = 0; /* trailing null */
89 rcu_read_lock();
84 for (temp = direntry; !IS_ROOT(temp);) { 90 for (temp = direntry; !IS_ROOT(temp);) {
91 spin_lock(&temp->d_lock);
85 namelen -= 1 + temp->d_name.len; 92 namelen -= 1 + temp->d_name.len;
86 if (namelen < 0) { 93 if (namelen < 0) {
94 spin_unlock(&temp->d_lock);
87 break; 95 break;
88 } else { 96 } else {
89 full_path[namelen] = dirsep; 97 full_path[namelen] = dirsep;
@@ -91,14 +99,17 @@ cifs_bp_rename_retry:
91 temp->d_name.len); 99 temp->d_name.len);
92 cFYI(0, "name: %s", full_path + namelen); 100 cFYI(0, "name: %s", full_path + namelen);
93 } 101 }
102 spin_unlock(&temp->d_lock);
94 temp = temp->d_parent; 103 temp = temp->d_parent;
95 if (temp == NULL) { 104 if (temp == NULL) {
96 cERROR(1, "corrupt dentry"); 105 cERROR(1, "corrupt dentry");
106 rcu_read_unlock();
97 kfree(full_path); 107 kfree(full_path);
98 return NULL; 108 return NULL;
99 } 109 }
100 } 110 }
101 if (namelen != dfsplen) { 111 rcu_read_unlock();
112 if (namelen != dfsplen || read_seqretry(&rename_lock, seq)) {
102 cERROR(1, "did not end path lookup where expected namelen is %d", 113 cERROR(1, "did not end path lookup where expected namelen is %d",
103 namelen); 114 namelen);
104 /* presumably this is only possible if racing with a rename 115 /* presumably this is only possible if racing with a rename
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 3892ab817a36..d3e619692ee0 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -428,8 +428,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
428 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { 428 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) {
429 flags |= NTLMSSP_NEGOTIATE_SIGN; 429 flags |= NTLMSSP_NEGOTIATE_SIGN;
430 if (!ses->server->session_estab) 430 if (!ses->server->session_estab)
431 flags |= NTLMSSP_NEGOTIATE_KEY_XCH | 431 flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
432 NTLMSSP_NEGOTIATE_EXTENDED_SEC;
433 } 432 }
434 433
435 sec_blob->NegotiateFlags = cpu_to_le32(flags); 434 sec_blob->NegotiateFlags = cpu_to_le32(flags);
@@ -465,10 +464,11 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
465 NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | 464 NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
466 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC; 465 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
467 if (ses->server->sec_mode & 466 if (ses->server->sec_mode &
468 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) 467 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) {
469 flags |= NTLMSSP_NEGOTIATE_SIGN; 468 flags |= NTLMSSP_NEGOTIATE_SIGN;
470 if (ses->server->sec_mode & SECMODE_SIGN_REQUIRED) 469 if (!ses->server->session_estab)
471 flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN; 470 flags |= NTLMSSP_NEGOTIATE_KEY_XCH;
471 }
472 472
473 tmp = pbuffer + sizeof(AUTHENTICATE_MESSAGE); 473 tmp = pbuffer + sizeof(AUTHENTICATE_MESSAGE);
474 sec_blob->NegotiateFlags = cpu_to_le32(flags); 474 sec_blob->NegotiateFlags = cpu_to_le32(flags);
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index e141939080f0..739fb59bcdc2 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -37,7 +37,7 @@ static DEFINE_MUTEX(read_mutex);
37/* These macros may change in future, to provide better st_ino semantics. */ 37/* These macros may change in future, to provide better st_ino semantics. */
38#define OFFSET(x) ((x)->i_ino) 38#define OFFSET(x) ((x)->i_ino)
39 39
40static unsigned long cramino(struct cramfs_inode *cino, unsigned int offset) 40static unsigned long cramino(const struct cramfs_inode *cino, unsigned int offset)
41{ 41{
42 if (!cino->offset) 42 if (!cino->offset)
43 return offset + 1; 43 return offset + 1;
@@ -61,7 +61,7 @@ static unsigned long cramino(struct cramfs_inode *cino, unsigned int offset)
61} 61}
62 62
63static struct inode *get_cramfs_inode(struct super_block *sb, 63static struct inode *get_cramfs_inode(struct super_block *sb,
64 struct cramfs_inode *cramfs_inode, unsigned int offset) 64 const struct cramfs_inode *cramfs_inode, unsigned int offset)
65{ 65{
66 struct inode *inode; 66 struct inode *inode;
67 static struct timespec zerotime; 67 static struct timespec zerotime;
@@ -317,7 +317,7 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
317 /* Set it all up.. */ 317 /* Set it all up.. */
318 sb->s_op = &cramfs_ops; 318 sb->s_op = &cramfs_ops;
319 root = get_cramfs_inode(sb, &super.root, 0); 319 root = get_cramfs_inode(sb, &super.root, 0);
320 if (!root) 320 if (IS_ERR(root))
321 goto out; 321 goto out;
322 sb->s_root = d_alloc_root(root); 322 sb->s_root = d_alloc_root(root);
323 if (!sb->s_root) { 323 if (!sb->s_root) {
@@ -423,6 +423,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
423static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 423static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
424{ 424{
425 unsigned int offset = 0; 425 unsigned int offset = 0;
426 struct inode *inode = NULL;
426 int sorted; 427 int sorted;
427 428
428 mutex_lock(&read_mutex); 429 mutex_lock(&read_mutex);
@@ -449,8 +450,8 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s
449 450
450 for (;;) { 451 for (;;) {
451 if (!namelen) { 452 if (!namelen) {
452 mutex_unlock(&read_mutex); 453 inode = ERR_PTR(-EIO);
453 return ERR_PTR(-EIO); 454 goto out;
454 } 455 }
455 if (name[namelen-1]) 456 if (name[namelen-1])
456 break; 457 break;
@@ -462,17 +463,18 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s
462 if (retval > 0) 463 if (retval > 0)
463 continue; 464 continue;
464 if (!retval) { 465 if (!retval) {
465 struct cramfs_inode entry = *de; 466 inode = get_cramfs_inode(dir->i_sb, de, dir_off);
466 mutex_unlock(&read_mutex); 467 break;
467 d_add(dentry, get_cramfs_inode(dir->i_sb, &entry, dir_off));
468 return NULL;
469 } 468 }
470 /* else (retval < 0) */ 469 /* else (retval < 0) */
471 if (sorted) 470 if (sorted)
472 break; 471 break;
473 } 472 }
473out:
474 mutex_unlock(&read_mutex); 474 mutex_unlock(&read_mutex);
475 d_add(dentry, NULL); 475 if (IS_ERR(inode))
476 return ERR_CAST(inode);
477 d_add(dentry, inode);
476 return NULL; 478 return NULL;
477} 479}
478 480
diff --git a/fs/dcache.c b/fs/dcache.c
index 37f72ee5bf7c..6e4ea6d87774 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2213,14 +2213,15 @@ static void dentry_unlock_parents_for_move(struct dentry *dentry,
2213 * The hash value has to match the hash queue that the dentry is on.. 2213 * The hash value has to match the hash queue that the dentry is on..
2214 */ 2214 */
2215/* 2215/*
2216 * d_move - move a dentry 2216 * __d_move - move a dentry
2217 * @dentry: entry to move 2217 * @dentry: entry to move
2218 * @target: new dentry 2218 * @target: new dentry
2219 * 2219 *
2220 * Update the dcache to reflect the move of a file name. Negative 2220 * Update the dcache to reflect the move of a file name. Negative
2221 * dcache entries should not be moved in this way. 2221 * dcache entries should not be moved in this way. Caller hold
2222 * rename_lock.
2222 */ 2223 */
2223void d_move(struct dentry * dentry, struct dentry * target) 2224static void __d_move(struct dentry * dentry, struct dentry * target)
2224{ 2225{
2225 if (!dentry->d_inode) 2226 if (!dentry->d_inode)
2226 printk(KERN_WARNING "VFS: moving negative dcache entry\n"); 2227 printk(KERN_WARNING "VFS: moving negative dcache entry\n");
@@ -2228,8 +2229,6 @@ void d_move(struct dentry * dentry, struct dentry * target)
2228 BUG_ON(d_ancestor(dentry, target)); 2229 BUG_ON(d_ancestor(dentry, target));
2229 BUG_ON(d_ancestor(target, dentry)); 2230 BUG_ON(d_ancestor(target, dentry));
2230 2231
2231 write_seqlock(&rename_lock);
2232
2233 dentry_lock_for_move(dentry, target); 2232 dentry_lock_for_move(dentry, target);
2234 2233
2235 write_seqcount_begin(&dentry->d_seq); 2234 write_seqcount_begin(&dentry->d_seq);
@@ -2275,6 +2274,20 @@ void d_move(struct dentry * dentry, struct dentry * target)
2275 spin_unlock(&target->d_lock); 2274 spin_unlock(&target->d_lock);
2276 fsnotify_d_move(dentry); 2275 fsnotify_d_move(dentry);
2277 spin_unlock(&dentry->d_lock); 2276 spin_unlock(&dentry->d_lock);
2277}
2278
2279/*
2280 * d_move - move a dentry
2281 * @dentry: entry to move
2282 * @target: new dentry
2283 *
2284 * Update the dcache to reflect the move of a file name. Negative
2285 * dcache entries should not be moved in this way.
2286 */
2287void d_move(struct dentry *dentry, struct dentry *target)
2288{
2289 write_seqlock(&rename_lock);
2290 __d_move(dentry, target);
2278 write_sequnlock(&rename_lock); 2291 write_sequnlock(&rename_lock);
2279} 2292}
2280EXPORT_SYMBOL(d_move); 2293EXPORT_SYMBOL(d_move);
@@ -2302,7 +2315,7 @@ struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2)
2302 * This helper attempts to cope with remotely renamed directories 2315 * This helper attempts to cope with remotely renamed directories
2303 * 2316 *
2304 * It assumes that the caller is already holding 2317 * It assumes that the caller is already holding
2305 * dentry->d_parent->d_inode->i_mutex and the inode->i_lock 2318 * dentry->d_parent->d_inode->i_mutex, inode->i_lock and rename_lock
2306 * 2319 *
2307 * Note: If ever the locking in lock_rename() changes, then please 2320 * Note: If ever the locking in lock_rename() changes, then please
2308 * remember to update this too... 2321 * remember to update this too...
@@ -2317,11 +2330,6 @@ static struct dentry *__d_unalias(struct inode *inode,
2317 if (alias->d_parent == dentry->d_parent) 2330 if (alias->d_parent == dentry->d_parent)
2318 goto out_unalias; 2331 goto out_unalias;
2319 2332
2320 /* Check for loops */
2321 ret = ERR_PTR(-ELOOP);
2322 if (d_ancestor(alias, dentry))
2323 goto out_err;
2324
2325 /* See lock_rename() */ 2333 /* See lock_rename() */
2326 ret = ERR_PTR(-EBUSY); 2334 ret = ERR_PTR(-EBUSY);
2327 if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) 2335 if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex))
@@ -2331,7 +2339,7 @@ static struct dentry *__d_unalias(struct inode *inode,
2331 goto out_err; 2339 goto out_err;
2332 m2 = &alias->d_parent->d_inode->i_mutex; 2340 m2 = &alias->d_parent->d_inode->i_mutex;
2333out_unalias: 2341out_unalias:
2334 d_move(alias, dentry); 2342 __d_move(alias, dentry);
2335 ret = alias; 2343 ret = alias;
2336out_err: 2344out_err:
2337 spin_unlock(&inode->i_lock); 2345 spin_unlock(&inode->i_lock);
@@ -2416,15 +2424,24 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode)
2416 alias = __d_find_alias(inode, 0); 2424 alias = __d_find_alias(inode, 0);
2417 if (alias) { 2425 if (alias) {
2418 actual = alias; 2426 actual = alias;
2419 /* Is this an anonymous mountpoint that we could splice 2427 write_seqlock(&rename_lock);
2420 * into our tree? */ 2428
2421 if (IS_ROOT(alias)) { 2429 if (d_ancestor(alias, dentry)) {
2430 /* Check for loops */
2431 actual = ERR_PTR(-ELOOP);
2432 } else if (IS_ROOT(alias)) {
2433 /* Is this an anonymous mountpoint that we
2434 * could splice into our tree? */
2422 __d_materialise_dentry(dentry, alias); 2435 __d_materialise_dentry(dentry, alias);
2436 write_sequnlock(&rename_lock);
2423 __d_drop(alias); 2437 __d_drop(alias);
2424 goto found; 2438 goto found;
2439 } else {
2440 /* Nope, but we must(!) avoid directory
2441 * aliasing */
2442 actual = __d_unalias(inode, dentry, alias);
2425 } 2443 }
2426 /* Nope, but we must(!) avoid directory aliasing */ 2444 write_sequnlock(&rename_lock);
2427 actual = __d_unalias(inode, dentry, alias);
2428 if (IS_ERR(actual)) 2445 if (IS_ERR(actual))
2429 dput(alias); 2446 dput(alias);
2430 goto out_nolock; 2447 goto out_nolock;
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 06065bd37fc3..c57beddcc217 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -913,7 +913,7 @@ struct dentry *exofs_get_parent(struct dentry *child)
913 unsigned long ino = exofs_parent_ino(child); 913 unsigned long ino = exofs_parent_ino(child);
914 914
915 if (!ino) 915 if (!ino)
916 return NULL; 916 return ERR_PTR(-ESTALE);
917 917
918 return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino)); 918 return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino));
919} 919}
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 802ac5eeba28..f9fbbe96c222 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1069,6 +1069,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
1069 return 0; 1069 return 0;
1070 1070
1071 gfs2_log_lock(sdp); 1071 gfs2_log_lock(sdp);
1072 spin_lock(&sdp->sd_ail_lock);
1072 head = bh = page_buffers(page); 1073 head = bh = page_buffers(page);
1073 do { 1074 do {
1074 if (atomic_read(&bh->b_count)) 1075 if (atomic_read(&bh->b_count))
@@ -1080,6 +1081,7 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
1080 goto not_possible; 1081 goto not_possible;
1081 bh = bh->b_this_page; 1082 bh = bh->b_this_page;
1082 } while(bh != head); 1083 } while(bh != head);
1084 spin_unlock(&sdp->sd_ail_lock);
1083 gfs2_log_unlock(sdp); 1085 gfs2_log_unlock(sdp);
1084 1086
1085 head = bh = page_buffers(page); 1087 head = bh = page_buffers(page);
@@ -1112,6 +1114,7 @@ not_possible: /* Should never happen */
1112 WARN_ON(buffer_dirty(bh)); 1114 WARN_ON(buffer_dirty(bh));
1113 WARN_ON(buffer_pinned(bh)); 1115 WARN_ON(buffer_pinned(bh));
1114cannot_release: 1116cannot_release:
1117 spin_unlock(&sdp->sd_ail_lock);
1115 gfs2_log_unlock(sdp); 1118 gfs2_log_unlock(sdp);
1116 return 0; 1119 return 0;
1117} 1120}
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 8ef70f464731..2cca29316bd6 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -47,10 +47,10 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl)
47 bd_ail_gl_list); 47 bd_ail_gl_list);
48 bh = bd->bd_bh; 48 bh = bd->bd_bh;
49 gfs2_remove_from_ail(bd); 49 gfs2_remove_from_ail(bd);
50 spin_unlock(&sdp->sd_ail_lock);
51
52 bd->bd_bh = NULL; 50 bd->bd_bh = NULL;
53 bh->b_private = NULL; 51 bh->b_private = NULL;
52 spin_unlock(&sdp->sd_ail_lock);
53
54 bd->bd_blkno = bh->b_blocknr; 54 bd->bd_blkno = bh->b_blocknr;
55 gfs2_log_lock(sdp); 55 gfs2_log_lock(sdp);
56 gfs2_assert_withdraw(sdp, !buffer_busy(bh)); 56 gfs2_assert_withdraw(sdp, !buffer_busy(bh));
@@ -221,8 +221,10 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
221 } 221 }
222 } 222 }
223 223
224 if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) 224 if (ip == GFS2_I(gl->gl_sbd->sd_rindex)) {
225 gfs2_log_flush(gl->gl_sbd, NULL);
225 gl->gl_sbd->sd_rindex_uptodate = 0; 226 gl->gl_sbd->sd_rindex_uptodate = 0;
227 }
226 if (ip && S_ISREG(ip->i_inode.i_mode)) 228 if (ip && S_ISREG(ip->i_inode.i_mode))
227 truncate_inode_pages(ip->i_inode.i_mapping, 0); 229 truncate_inode_pages(ip->i_inode.i_mapping, 0);
228} 230}
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 0a064e91ac70..81206e70cbf6 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -17,6 +17,7 @@
17#include <linux/buffer_head.h> 17#include <linux/buffer_head.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19#include <linux/rculist_bl.h> 19#include <linux/rculist_bl.h>
20#include <linux/completion.h>
20 21
21#define DIO_WAIT 0x00000010 22#define DIO_WAIT 0x00000010
22#define DIO_METADATA 0x00000020 23#define DIO_METADATA 0x00000020
@@ -546,6 +547,7 @@ struct gfs2_sbd {
546 struct gfs2_glock *sd_trans_gl; 547 struct gfs2_glock *sd_trans_gl;
547 wait_queue_head_t sd_glock_wait; 548 wait_queue_head_t sd_glock_wait;
548 atomic_t sd_glock_disposal; 549 atomic_t sd_glock_disposal;
550 struct completion sd_locking_init;
549 551
550 /* Inode Stuff */ 552 /* Inode Stuff */
551 553
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 903115f2bb34..85c62923ee29 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -903,6 +903,7 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
903 if (gfs2_ail1_empty(sdp)) 903 if (gfs2_ail1_empty(sdp))
904 break; 904 break;
905 } 905 }
906 gfs2_log_flush(sdp, NULL);
906} 907}
907 908
908static inline int gfs2_jrnl_flush_reqd(struct gfs2_sbd *sdp) 909static inline int gfs2_jrnl_flush_reqd(struct gfs2_sbd *sdp)
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 8ac9ae189b53..2a77071fb7b6 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -72,6 +72,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
72 72
73 init_waitqueue_head(&sdp->sd_glock_wait); 73 init_waitqueue_head(&sdp->sd_glock_wait);
74 atomic_set(&sdp->sd_glock_disposal, 0); 74 atomic_set(&sdp->sd_glock_disposal, 0);
75 init_completion(&sdp->sd_locking_init);
75 spin_lock_init(&sdp->sd_statfs_spin); 76 spin_lock_init(&sdp->sd_statfs_spin);
76 77
77 spin_lock_init(&sdp->sd_rindex_spin); 78 spin_lock_init(&sdp->sd_rindex_spin);
@@ -1017,11 +1018,13 @@ hostdata_error:
1017 fsname++; 1018 fsname++;
1018 if (lm->lm_mount == NULL) { 1019 if (lm->lm_mount == NULL) {
1019 fs_info(sdp, "Now mounting FS...\n"); 1020 fs_info(sdp, "Now mounting FS...\n");
1021 complete(&sdp->sd_locking_init);
1020 return 0; 1022 return 0;
1021 } 1023 }
1022 ret = lm->lm_mount(sdp, fsname); 1024 ret = lm->lm_mount(sdp, fsname);
1023 if (ret == 0) 1025 if (ret == 0)
1024 fs_info(sdp, "Joined cluster. Now mounting FS...\n"); 1026 fs_info(sdp, "Joined cluster. Now mounting FS...\n");
1027 complete(&sdp->sd_locking_init);
1025 return ret; 1028 return ret;
1026} 1029}
1027 1030
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index ed540e7018be..fb0edf735483 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -757,13 +757,17 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
757 struct timespec atime; 757 struct timespec atime;
758 struct gfs2_dinode *di; 758 struct gfs2_dinode *di;
759 int ret = -EAGAIN; 759 int ret = -EAGAIN;
760 int unlock_required = 0;
760 761
761 /* Skip timestamp update, if this is from a memalloc */ 762 /* Skip timestamp update, if this is from a memalloc */
762 if (current->flags & PF_MEMALLOC) 763 if (current->flags & PF_MEMALLOC)
763 goto do_flush; 764 goto do_flush;
764 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 765 if (!gfs2_glock_is_locked_by_me(ip->i_gl)) {
765 if (ret) 766 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
766 goto do_flush; 767 if (ret)
768 goto do_flush;
769 unlock_required = 1;
770 }
767 ret = gfs2_trans_begin(sdp, RES_DINODE, 0); 771 ret = gfs2_trans_begin(sdp, RES_DINODE, 0);
768 if (ret) 772 if (ret)
769 goto do_unlock; 773 goto do_unlock;
@@ -780,7 +784,8 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
780 } 784 }
781 gfs2_trans_end(sdp); 785 gfs2_trans_end(sdp);
782do_unlock: 786do_unlock:
783 gfs2_glock_dq_uninit(&gh); 787 if (unlock_required)
788 gfs2_glock_dq_uninit(&gh);
784do_flush: 789do_flush:
785 if (wbc->sync_mode == WB_SYNC_ALL) 790 if (wbc->sync_mode == WB_SYNC_ALL)
786 gfs2_log_flush(GFS2_SB(inode), ip->i_gl); 791 gfs2_log_flush(GFS2_SB(inode), ip->i_gl);
@@ -1427,7 +1432,20 @@ out:
1427 return error; 1432 return error;
1428} 1433}
1429 1434
1430/* 1435/**
1436 * gfs2_evict_inode - Remove an inode from cache
1437 * @inode: The inode to evict
1438 *
1439 * There are three cases to consider:
1440 * 1. i_nlink == 0, we are final opener (and must deallocate)
1441 * 2. i_nlink == 0, we are not the final opener (and cannot deallocate)
1442 * 3. i_nlink > 0
1443 *
1444 * If the fs is read only, then we have to treat all cases as per #3
1445 * since we are unable to do any deallocation. The inode will be
1446 * deallocated by the next read/write node to attempt an allocation
1447 * in the same resource group
1448 *
1431 * We have to (at the moment) hold the inodes main lock to cover 1449 * We have to (at the moment) hold the inodes main lock to cover
1432 * the gap between unlocking the shared lock on the iopen lock and 1450 * the gap between unlocking the shared lock on the iopen lock and
1433 * taking the exclusive lock. I'd rather do a shared -> exclusive 1451 * taking the exclusive lock. I'd rather do a shared -> exclusive
@@ -1470,6 +1488,8 @@ static void gfs2_evict_inode(struct inode *inode)
1470 if (error) 1488 if (error)
1471 goto out_truncate; 1489 goto out_truncate;
1472 1490
1491 /* Case 1 starts here */
1492
1473 if (S_ISDIR(inode->i_mode) && 1493 if (S_ISDIR(inode->i_mode) &&
1474 (ip->i_diskflags & GFS2_DIF_EXHASH)) { 1494 (ip->i_diskflags & GFS2_DIF_EXHASH)) {
1475 error = gfs2_dir_exhash_dealloc(ip); 1495 error = gfs2_dir_exhash_dealloc(ip);
@@ -1493,13 +1513,16 @@ static void gfs2_evict_inode(struct inode *inode)
1493 goto out_unlock; 1513 goto out_unlock;
1494 1514
1495out_truncate: 1515out_truncate:
1516 /* Case 2 starts here */
1496 error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); 1517 error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks);
1497 if (error) 1518 if (error)
1498 goto out_unlock; 1519 goto out_unlock;
1499 gfs2_final_release_pages(ip); 1520 /* Needs to be done before glock release & also in a transaction */
1521 truncate_inode_pages(&inode->i_data, 0);
1500 gfs2_trans_end(sdp); 1522 gfs2_trans_end(sdp);
1501 1523
1502out_unlock: 1524out_unlock:
1525 /* Error path for case 1 */
1503 if (test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags)) 1526 if (test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags))
1504 gfs2_glock_dq(&ip->i_iopen_gh); 1527 gfs2_glock_dq(&ip->i_iopen_gh);
1505 gfs2_holder_uninit(&ip->i_iopen_gh); 1528 gfs2_holder_uninit(&ip->i_iopen_gh);
@@ -1507,6 +1530,7 @@ out_unlock:
1507 if (error && error != GLR_TRYFAILED && error != -EROFS) 1530 if (error && error != GLR_TRYFAILED && error != -EROFS)
1508 fs_warn(sdp, "gfs2_evict_inode: %d\n", error); 1531 fs_warn(sdp, "gfs2_evict_inode: %d\n", error);
1509out: 1532out:
1533 /* Case 3 starts here */
1510 truncate_inode_pages(&inode->i_data, 0); 1534 truncate_inode_pages(&inode->i_data, 0);
1511 end_writeback(inode); 1535 end_writeback(inode);
1512 1536
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index e20eab37bc80..443cabcfcd23 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -338,6 +338,9 @@ static ssize_t lkfirst_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
338 rv = sscanf(buf, "%u", &first); 338 rv = sscanf(buf, "%u", &first);
339 if (rv != 1 || first > 1) 339 if (rv != 1 || first > 1)
340 return -EINVAL; 340 return -EINVAL;
341 rv = wait_for_completion_killable(&sdp->sd_locking_init);
342 if (rv)
343 return rv;
341 spin_lock(&sdp->sd_jindex_spin); 344 spin_lock(&sdp->sd_jindex_spin);
342 rv = -EBUSY; 345 rv = -EBUSY;
343 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0) 346 if (test_bit(SDF_NOJOURNALID, &sdp->sd_flags) == 0)
@@ -414,7 +417,9 @@ static ssize_t jid_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
414 rv = sscanf(buf, "%d", &jid); 417 rv = sscanf(buf, "%d", &jid);
415 if (rv != 1) 418 if (rv != 1)
416 return -EINVAL; 419 return -EINVAL;
417 420 rv = wait_for_completion_killable(&sdp->sd_locking_init);
421 if (rv)
422 return rv;
418 spin_lock(&sdp->sd_jindex_spin); 423 spin_lock(&sdp->sd_jindex_spin);
419 rv = -EINVAL; 424 rv = -EINVAL;
420 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL) 425 if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL)
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index 87ed48e0343d..85c098a499f3 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -139,7 +139,8 @@ static int file_removed(struct dentry *dentry, const char *file)
139static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, 139static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
140 struct nameidata *nd) 140 struct nameidata *nd)
141{ 141{
142 struct dentry *proc_dentry, *new, *parent; 142 struct dentry *proc_dentry, *parent;
143 struct qstr *name = &dentry->d_name;
143 struct inode *inode; 144 struct inode *inode;
144 int err, deleted; 145 int err, deleted;
145 146
@@ -149,23 +150,9 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
149 else if (deleted) 150 else if (deleted)
150 return ERR_PTR(-ENOENT); 151 return ERR_PTR(-ENOENT);
151 152
152 err = -ENOMEM;
153 parent = HPPFS_I(ino)->proc_dentry; 153 parent = HPPFS_I(ino)->proc_dentry;
154 mutex_lock(&parent->d_inode->i_mutex); 154 mutex_lock(&parent->d_inode->i_mutex);
155 proc_dentry = d_lookup(parent, &dentry->d_name); 155 proc_dentry = lookup_one_len(name->name, parent, name->len);
156 if (proc_dentry == NULL) {
157 proc_dentry = d_alloc(parent, &dentry->d_name);
158 if (proc_dentry == NULL) {
159 mutex_unlock(&parent->d_inode->i_mutex);
160 goto out;
161 }
162 new = (*parent->d_inode->i_op->lookup)(parent->d_inode,
163 proc_dentry, NULL);
164 if (new) {
165 dput(proc_dentry);
166 proc_dentry = new;
167 }
168 }
169 mutex_unlock(&parent->d_inode->i_mutex); 156 mutex_unlock(&parent->d_inode->i_mutex);
170 157
171 if (IS_ERR(proc_dentry)) 158 if (IS_ERR(proc_dentry))
@@ -174,13 +161,11 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
174 err = -ENOMEM; 161 err = -ENOMEM;
175 inode = get_inode(ino->i_sb, proc_dentry); 162 inode = get_inode(ino->i_sb, proc_dentry);
176 if (!inode) 163 if (!inode)
177 goto out_dput; 164 goto out;
178 165
179 d_add(dentry, inode); 166 d_add(dentry, inode);
180 return NULL; 167 return NULL;
181 168
182 out_dput:
183 dput(proc_dentry);
184 out: 169 out:
185 return ERR_PTR(err); 170 return ERR_PTR(err);
186} 171}
@@ -690,8 +675,10 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
690 struct inode *proc_ino = dentry->d_inode; 675 struct inode *proc_ino = dentry->d_inode;
691 struct inode *inode = new_inode(sb); 676 struct inode *inode = new_inode(sb);
692 677
693 if (!inode) 678 if (!inode) {
679 dput(dentry);
694 return ERR_PTR(-ENOMEM); 680 return ERR_PTR(-ENOMEM);
681 }
695 682
696 if (S_ISDIR(dentry->d_inode->i_mode)) { 683 if (S_ISDIR(dentry->d_inode->i_mode)) {
697 inode->i_op = &hppfs_dir_iops; 684 inode->i_op = &hppfs_dir_iops;
@@ -704,7 +691,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
704 inode->i_fop = &hppfs_file_fops; 691 inode->i_fop = &hppfs_file_fops;
705 } 692 }
706 693
707 HPPFS_I(inode)->proc_dentry = dget(dentry); 694 HPPFS_I(inode)->proc_dentry = dentry;
708 695
709 inode->i_uid = proc_ino->i_uid; 696 inode->i_uid = proc_ino->i_uid;
710 inode->i_gid = proc_ino->i_gid; 697 inode->i_gid = proc_ino->i_gid;
@@ -737,7 +724,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
737 sb->s_fs_info = proc_mnt; 724 sb->s_fs_info = proc_mnt;
738 725
739 err = -ENOMEM; 726 err = -ENOMEM;
740 root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root); 727 root_inode = get_inode(sb, dget(proc_mnt->mnt_sb->s_root));
741 if (!root_inode) 728 if (!root_inode)
742 goto out_mntput; 729 goto out_mntput;
743 730
diff --git a/fs/libfs.c b/fs/libfs.c
index c88eab55aec9..275ca4749a2e 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -822,7 +822,7 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
822 goto out; 822 goto out;
823 823
824 attr->set_buf[size] = '\0'; 824 attr->set_buf[size] = '\0';
825 val = simple_strtol(attr->set_buf, NULL, 0); 825 val = simple_strtoll(attr->set_buf, NULL, 0);
826 ret = attr->set(attr->data, val); 826 ret = attr->set(attr->data, val);
827 if (ret == 0) 827 if (ret == 0)
828 ret = len; /* on success, claim we got the whole input */ 828 ret = len; /* on success, claim we got the whole input */
diff --git a/fs/namei.c b/fs/namei.c
index 0223c41fb114..14ab8d3f2f0c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -433,6 +433,8 @@ static int unlazy_walk(struct nameidata *nd, struct dentry *dentry)
433 goto err_parent; 433 goto err_parent;
434 BUG_ON(nd->inode != parent->d_inode); 434 BUG_ON(nd->inode != parent->d_inode);
435 } else { 435 } else {
436 if (dentry->d_parent != parent)
437 goto err_parent;
436 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); 438 spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
437 if (!__d_rcu_to_refcount(dentry, nd->seq)) 439 if (!__d_rcu_to_refcount(dentry, nd->seq))
438 goto err_child; 440 goto err_child;
@@ -940,7 +942,6 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
940 * Don't forget we might have a non-mountpoint managed dentry 942 * Don't forget we might have a non-mountpoint managed dentry
941 * that wants to block transit. 943 * that wants to block transit.
942 */ 944 */
943 *inode = path->dentry->d_inode;
944 if (unlikely(managed_dentry_might_block(path->dentry))) 945 if (unlikely(managed_dentry_might_block(path->dentry)))
945 return false; 946 return false;
946 947
@@ -953,6 +954,12 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path,
953 path->mnt = mounted; 954 path->mnt = mounted;
954 path->dentry = mounted->mnt_root; 955 path->dentry = mounted->mnt_root;
955 nd->seq = read_seqcount_begin(&path->dentry->d_seq); 956 nd->seq = read_seqcount_begin(&path->dentry->d_seq);
957 /*
958 * Update the inode too. We don't need to re-check the
959 * dentry sequence number here after this d_inode read,
960 * because a mount-point is always pinned.
961 */
962 *inode = path->dentry->d_inode;
956 } 963 }
957 return true; 964 return true;
958} 965}
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 0bafcc91c27f..f9d03abcd04c 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -398,7 +398,6 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)
398 * this offset and save the original offset. 398 * this offset and save the original offset.
399 */ 399 */
400 data->args.offset = filelayout_get_dserver_offset(lseg, offset); 400 data->args.offset = filelayout_get_dserver_offset(lseg, offset);
401 data->mds_offset = offset;
402 401
403 /* Perform an asynchronous write */ 402 /* Perform an asynchronous write */
404 status = nfs_initiate_write(data, ds->ds_clp->cl_rpcclient, 403 status = nfs_initiate_write(data, ds->ds_clp->cl_rpcclient,
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 6870bc61ceec..e6e8f3b9a1de 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -91,7 +91,7 @@ static int nfs4_stat_to_errno(int);
91#define encode_getfh_maxsz (op_encode_hdr_maxsz) 91#define encode_getfh_maxsz (op_encode_hdr_maxsz)
92#define decode_getfh_maxsz (op_decode_hdr_maxsz + 1 + \ 92#define decode_getfh_maxsz (op_decode_hdr_maxsz + 1 + \
93 ((3+NFS4_FHSIZE) >> 2)) 93 ((3+NFS4_FHSIZE) >> 2))
94#define nfs4_fattr_bitmap_maxsz 3 94#define nfs4_fattr_bitmap_maxsz 4
95#define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz) 95#define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz)
96#define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2)) 96#define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2))
97#define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) 97#define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2))
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index e268e3b23497..727168059684 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -864,6 +864,8 @@ static int nfs_write_rpcsetup(struct nfs_page *req,
864 864
865 data->args.fh = NFS_FH(inode); 865 data->args.fh = NFS_FH(inode);
866 data->args.offset = req_offset(req) + offset; 866 data->args.offset = req_offset(req) + offset;
867 /* pnfs_set_layoutcommit needs this */
868 data->mds_offset = data->args.offset;
867 data->args.pgbase = req->wb_pgbase + offset; 869 data->args.pgbase = req->wb_pgbase + offset;
868 data->args.pages = data->pagevec; 870 data->args.pages = data->pagevec;
869 data->args.count = count; 871 data->args.count = count;
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index 29309e25417f..b57aab9a1184 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -56,16 +56,12 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru
56 56
57 lock_ufs(dir->i_sb); 57 lock_ufs(dir->i_sb);
58 ino = ufs_inode_by_name(dir, &dentry->d_name); 58 ino = ufs_inode_by_name(dir, &dentry->d_name);
59 if (ino) { 59 if (ino)
60 inode = ufs_iget(dir->i_sb, ino); 60 inode = ufs_iget(dir->i_sb, ino);
61 if (IS_ERR(inode)) {
62 unlock_ufs(dir->i_sb);
63 return ERR_CAST(inode);
64 }
65 }
66 unlock_ufs(dir->i_sb); 61 unlock_ufs(dir->i_sb);
67 d_add(dentry, inode); 62 if (IS_ERR(inode))
68 return NULL; 63 return ERR_CAST(inode);
64 return d_splice_alias(inode, dentry);
69} 65}
70 66
71/* 67/*
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 3a10ef5914eb..6cd5b6403a7b 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -210,7 +210,7 @@ struct acpi_device_power_state {
210struct acpi_device_power { 210struct acpi_device_power {
211 int state; /* Current state */ 211 int state; /* Current state */
212 struct acpi_device_power_flags flags; 212 struct acpi_device_power_flags flags;
213 struct acpi_device_power_state states[4]; /* Power states (D0-D3) */ 213 struct acpi_device_power_state states[ACPI_D_STATE_COUNT]; /* Power states (D0-D3Cold) */
214}; 214};
215 215
216/* Performance Management */ 216/* Performance Management */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index a756bc8d866d..4543b6f75867 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -98,8 +98,11 @@ acpi_os_table_override(struct acpi_table_header *existing_table,
98/* 98/*
99 * Spinlock primitives 99 * Spinlock primitives
100 */ 100 */
101
102#ifndef acpi_os_create_lock
101acpi_status 103acpi_status
102acpi_os_create_lock(acpi_spinlock *out_handle); 104acpi_os_create_lock(acpi_spinlock *out_handle);
105#endif
103 106
104void acpi_os_delete_lock(acpi_spinlock handle); 107void acpi_os_delete_lock(acpi_spinlock handle);
105 108
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 5d2a5e9544d9..2ce1be9f6291 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -159,6 +159,24 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
159 } while (0) 159 } while (0)
160#endif 160#endif
161 161
162/*
163 * When lockdep is enabled, the spin_lock_init() macro stringifies it's
164 * argument and uses that as a name for the lock in debugging.
165 * By executing spin_lock_init() in a macro the key changes from "lock" for
166 * all locks to the name of the argument of acpi_os_create_lock(), which
167 * prevents lockdep from reporting false positives for ACPICA locks.
168 */
169#define acpi_os_create_lock(__handle) \
170({ \
171 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
172 \
173 if (lock) { \
174 *(__handle) = lock; \
175 spin_lock_init(*(__handle)); \
176 } \
177 lock ? AE_OK : AE_NO_MEMORY; \
178})
179
162#endif /* __KERNEL__ */ 180#endif /* __KERNEL__ */
163 181
164#endif /* __ACLINUX_H__ */ 182#endif /* __ACLINUX_H__ */
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index e08f344c6cff..3d53efd25ab9 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -182,6 +182,7 @@
182 {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 182 {0x1002, 0x6750, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
183 {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 183 {0x1002, 0x6758, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
184 {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ 184 {0x1002, 0x6759, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
185 {0x1002, 0x675F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \
185 {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 186 {0x1002, 0x6760, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
186 {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 187 {0x1002, 0x6761, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
187 {0x1002, 0x6762, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 188 {0x1002, 0x6762, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
@@ -192,6 +193,7 @@
192 {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 193 {0x1002, 0x6767, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
193 {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 194 {0x1002, 0x6768, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
194 {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 195 {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
196 {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
195 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ 197 {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \
196 {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 198 {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
197 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ 199 {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 8b4538446636..baa397eb9c33 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -676,7 +676,8 @@ void irq_gc_mask_disable_reg(struct irq_data *d);
676void irq_gc_mask_set_bit(struct irq_data *d); 676void irq_gc_mask_set_bit(struct irq_data *d);
677void irq_gc_mask_clr_bit(struct irq_data *d); 677void irq_gc_mask_clr_bit(struct irq_data *d);
678void irq_gc_unmask_enable_reg(struct irq_data *d); 678void irq_gc_unmask_enable_reg(struct irq_data *d);
679void irq_gc_ack(struct irq_data *d); 679void irq_gc_ack_set_bit(struct irq_data *d);
680void irq_gc_ack_clr_bit(struct irq_data *d);
680void irq_gc_mask_disable_reg_and_ack(struct irq_data *d); 681void irq_gc_mask_disable_reg_and_ack(struct irq_data *d);
681void irq_gc_eoi(struct irq_data *d); 682void irq_gc_eoi(struct irq_data *d);
682int irq_gc_set_wake(struct irq_data *d, unsigned int on); 683int irq_gc_set_wake(struct irq_data *d, unsigned int on);
diff --git a/include/linux/memory.h b/include/linux/memory.h
index e1e3b2b84f85..935699b30b7c 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -20,6 +20,8 @@
20#include <linux/compiler.h> 20#include <linux/compiler.h>
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22 22
23#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
24
23struct memory_block { 25struct memory_block {
24 unsigned long start_section_nr; 26 unsigned long start_section_nr;
25 unsigned long end_section_nr; 27 unsigned long end_section_nr;
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index c6927a4d157f..6ad43554ac05 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -64,6 +64,19 @@ struct mmc_ext_csd {
64 unsigned long long enhanced_area_offset; /* Units: Byte */ 64 unsigned long long enhanced_area_offset; /* Units: Byte */
65 unsigned int enhanced_area_size; /* Units: KB */ 65 unsigned int enhanced_area_size; /* Units: KB */
66 unsigned int boot_size; /* in bytes */ 66 unsigned int boot_size; /* in bytes */
67 u8 raw_partition_support; /* 160 */
68 u8 raw_erased_mem_count; /* 181 */
69 u8 raw_ext_csd_structure; /* 194 */
70 u8 raw_card_type; /* 196 */
71 u8 raw_s_a_timeout; /* 217 */
72 u8 raw_hc_erase_gap_size; /* 221 */
73 u8 raw_erase_timeout_mult; /* 223 */
74 u8 raw_hc_erase_grp_size; /* 224 */
75 u8 raw_sec_trim_mult; /* 229 */
76 u8 raw_sec_erase_mult; /* 230 */
77 u8 raw_sec_feature_support;/* 231 */
78 u8 raw_trim_mult; /* 232 */
79 u8 raw_sectors[4]; /* 212 - 4 bytes */
67}; 80};
68 81
69struct sd_scr { 82struct sd_scr {
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 54b8b4d7b68f..9e19477991ad 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1097,12 +1097,6 @@ struct net_device {
1097#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \ 1097#define NETIF_F_ALL_FCOE (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
1098 NETIF_F_FSO) 1098 NETIF_F_FSO)
1099 1099
1100#define NETIF_F_ALL_TX_OFFLOADS (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1101 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1102 NETIF_F_HIGHDMA | \
1103 NETIF_F_SCTP_CSUM | \
1104 NETIF_F_ALL_FCOE)
1105
1106 /* 1100 /*
1107 * If one device supports one of these features, then enable them 1101 * If one device supports one of these features, then enable them
1108 * for all in netdev_increment_features. 1102 * for all in netdev_increment_features.
diff --git a/include/linux/sdla.h b/include/linux/sdla.h
index 564acd3a71c1..9995c7fc3f60 100644
--- a/include/linux/sdla.h
+++ b/include/linux/sdla.h
@@ -112,11 +112,7 @@ struct sdla_dlci_conf {
112 short Tb_max; 112 short Tb_max;
113}; 113};
114 114
115#ifndef __KERNEL__ 115#ifdef __KERNEL__
116
117void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
118
119#else
120 116
121/* important Z80 window addresses */ 117/* important Z80 window addresses */
122#define SDLA_CONTROL_WND 0xE000 118#define SDLA_CONTROL_WND 0xE000
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index dd6847e5d6e4..6506458ccd33 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -63,6 +63,7 @@ typedef enum {
63 SCTP_CMD_ECN_ECNE, /* Do delayed ECNE processing. */ 63 SCTP_CMD_ECN_ECNE, /* Do delayed ECNE processing. */
64 SCTP_CMD_ECN_CWR, /* Do delayed CWR processing. */ 64 SCTP_CMD_ECN_CWR, /* Do delayed CWR processing. */
65 SCTP_CMD_TIMER_START, /* Start a timer. */ 65 SCTP_CMD_TIMER_START, /* Start a timer. */
66 SCTP_CMD_TIMER_START_ONCE, /* Start a timer once */
66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ 67 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */
67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */ 68 SCTP_CMD_TIMER_STOP, /* Stop a timer. */
68 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */ 69 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 99b027b2adce..ca4693b4e09e 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -80,7 +80,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
80 80
81void sctp_ulpevent_free(struct sctp_ulpevent *); 81void sctp_ulpevent_free(struct sctp_ulpevent *);
82int sctp_ulpevent_is_notification(const struct sctp_ulpevent *); 82int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
83void sctp_queue_purge_ulpevents(struct sk_buff_head *list); 83unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list);
84 84
85struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( 85struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
86 const struct sctp_association *asoc, 86 const struct sctp_association *asoc,
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index 31a9db711906..3a2cab407b93 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -101,10 +101,10 @@ void irq_gc_unmask_enable_reg(struct irq_data *d)
101} 101}
102 102
103/** 103/**
104 * irq_gc_ack - Ack pending interrupt 104 * irq_gc_ack_set_bit - Ack pending interrupt via setting bit
105 * @d: irq_data 105 * @d: irq_data
106 */ 106 */
107void irq_gc_ack(struct irq_data *d) 107void irq_gc_ack_set_bit(struct irq_data *d)
108{ 108{
109 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 109 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
110 u32 mask = 1 << (d->irq - gc->irq_base); 110 u32 mask = 1 << (d->irq - gc->irq_base);
@@ -115,6 +115,20 @@ void irq_gc_ack(struct irq_data *d)
115} 115}
116 116
117/** 117/**
118 * irq_gc_ack_clr_bit - Ack pending interrupt via clearing bit
119 * @d: irq_data
120 */
121void irq_gc_ack_clr_bit(struct irq_data *d)
122{
123 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
124 u32 mask = ~(1 << (d->irq - gc->irq_base));
125
126 irq_gc_lock(gc);
127 irq_reg_writel(mask, gc->reg_base + cur_regs(d)->ack);
128 irq_gc_unlock(gc);
129}
130
131/**
118 * irq_gc_mask_disable_reg_and_ack- Mask and ack pending interrupt 132 * irq_gc_mask_disable_reg_and_ack- Mask and ack pending interrupt
119 * @d: irq_data 133 * @d: irq_data
120 */ 134 */
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 7e59ffb3d0ba..ba06207b1dd3 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -84,9 +84,32 @@ DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
84 84
85static struct rcu_state *rcu_state; 85static struct rcu_state *rcu_state;
86 86
87/*
88 * The rcu_scheduler_active variable transitions from zero to one just
89 * before the first task is spawned. So when this variable is zero, RCU
90 * can assume that there is but one task, allowing RCU to (for example)
91 * optimized synchronize_sched() to a simple barrier(). When this variable
92 * is one, RCU must actually do all the hard work required to detect real
93 * grace periods. This variable is also used to suppress boot-time false
94 * positives from lockdep-RCU error checking.
95 */
87int rcu_scheduler_active __read_mostly; 96int rcu_scheduler_active __read_mostly;
88EXPORT_SYMBOL_GPL(rcu_scheduler_active); 97EXPORT_SYMBOL_GPL(rcu_scheduler_active);
89 98
99/*
100 * The rcu_scheduler_fully_active variable transitions from zero to one
101 * during the early_initcall() processing, which is after the scheduler
102 * is capable of creating new tasks. So RCU processing (for example,
103 * creating tasks for RCU priority boosting) must be delayed until after
104 * rcu_scheduler_fully_active transitions from zero to one. We also
105 * currently delay invocation of any RCU callbacks until after this point.
106 *
107 * It might later prove better for people registering RCU callbacks during
108 * early boot to take responsibility for these callbacks, but one step at
109 * a time.
110 */
111static int rcu_scheduler_fully_active __read_mostly;
112
90#ifdef CONFIG_RCU_BOOST 113#ifdef CONFIG_RCU_BOOST
91 114
92/* 115/*
@@ -98,7 +121,6 @@ DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_status);
98DEFINE_PER_CPU(int, rcu_cpu_kthread_cpu); 121DEFINE_PER_CPU(int, rcu_cpu_kthread_cpu);
99DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops); 122DEFINE_PER_CPU(unsigned int, rcu_cpu_kthread_loops);
100DEFINE_PER_CPU(char, rcu_cpu_has_work); 123DEFINE_PER_CPU(char, rcu_cpu_has_work);
101static char rcu_kthreads_spawnable;
102 124
103#endif /* #ifdef CONFIG_RCU_BOOST */ 125#endif /* #ifdef CONFIG_RCU_BOOST */
104 126
@@ -1467,6 +1489,8 @@ static void rcu_process_callbacks(struct softirq_action *unused)
1467 */ 1489 */
1468static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp) 1490static void invoke_rcu_callbacks(struct rcu_state *rsp, struct rcu_data *rdp)
1469{ 1491{
1492 if (unlikely(!ACCESS_ONCE(rcu_scheduler_fully_active)))
1493 return;
1470 if (likely(!rsp->boost)) { 1494 if (likely(!rsp->boost)) {
1471 rcu_do_batch(rsp, rdp); 1495 rcu_do_batch(rsp, rdp);
1472 return; 1496 return;
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 14dc7dd00902..75113cb7c4fb 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -1532,7 +1532,7 @@ static int __cpuinit rcu_spawn_one_cpu_kthread(int cpu)
1532 struct sched_param sp; 1532 struct sched_param sp;
1533 struct task_struct *t; 1533 struct task_struct *t;
1534 1534
1535 if (!rcu_kthreads_spawnable || 1535 if (!rcu_scheduler_fully_active ||
1536 per_cpu(rcu_cpu_kthread_task, cpu) != NULL) 1536 per_cpu(rcu_cpu_kthread_task, cpu) != NULL)
1537 return 0; 1537 return 0;
1538 t = kthread_create(rcu_cpu_kthread, (void *)(long)cpu, "rcuc%d", cpu); 1538 t = kthread_create(rcu_cpu_kthread, (void *)(long)cpu, "rcuc%d", cpu);
@@ -1639,7 +1639,7 @@ static int __cpuinit rcu_spawn_one_node_kthread(struct rcu_state *rsp,
1639 struct sched_param sp; 1639 struct sched_param sp;
1640 struct task_struct *t; 1640 struct task_struct *t;
1641 1641
1642 if (!rcu_kthreads_spawnable || 1642 if (!rcu_scheduler_fully_active ||
1643 rnp->qsmaskinit == 0) 1643 rnp->qsmaskinit == 0)
1644 return 0; 1644 return 0;
1645 if (rnp->node_kthread_task == NULL) { 1645 if (rnp->node_kthread_task == NULL) {
@@ -1665,7 +1665,7 @@ static int __init rcu_spawn_kthreads(void)
1665 int cpu; 1665 int cpu;
1666 struct rcu_node *rnp; 1666 struct rcu_node *rnp;
1667 1667
1668 rcu_kthreads_spawnable = 1; 1668 rcu_scheduler_fully_active = 1;
1669 for_each_possible_cpu(cpu) { 1669 for_each_possible_cpu(cpu) {
1670 per_cpu(rcu_cpu_has_work, cpu) = 0; 1670 per_cpu(rcu_cpu_has_work, cpu) = 0;
1671 if (cpu_online(cpu)) 1671 if (cpu_online(cpu))
@@ -1687,7 +1687,7 @@ static void __cpuinit rcu_prepare_kthreads(int cpu)
1687 struct rcu_node *rnp = rdp->mynode; 1687 struct rcu_node *rnp = rdp->mynode;
1688 1688
1689 /* Fire up the incoming CPU's kthread and leaf rcu_node kthread. */ 1689 /* Fire up the incoming CPU's kthread and leaf rcu_node kthread. */
1690 if (rcu_kthreads_spawnable) { 1690 if (rcu_scheduler_fully_active) {
1691 (void)rcu_spawn_one_cpu_kthread(cpu); 1691 (void)rcu_spawn_one_cpu_kthread(cpu);
1692 if (rnp->node_kthread_task == NULL) 1692 if (rnp->node_kthread_task == NULL)
1693 (void)rcu_spawn_one_node_kthread(rcu_state, rnp); 1693 (void)rcu_spawn_one_node_kthread(rcu_state, rnp);
@@ -1726,6 +1726,13 @@ static void rcu_cpu_kthread_setrt(int cpu, int to_rt)
1726{ 1726{
1727} 1727}
1728 1728
1729static int __init rcu_scheduler_really_started(void)
1730{
1731 rcu_scheduler_fully_active = 1;
1732 return 0;
1733}
1734early_initcall(rcu_scheduler_really_started);
1735
1729static void __cpuinit rcu_prepare_kthreads(int cpu) 1736static void __cpuinit rcu_prepare_kthreads(int cpu)
1730{ 1737{
1731} 1738}
diff --git a/kernel/sched.c b/kernel/sched.c
index 9769c756ad66..3dc716f6d8ad 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7757,6 +7757,9 @@ static void init_cfs_rq(struct cfs_rq *cfs_rq, struct rq *rq)
7757#endif 7757#endif
7758#endif 7758#endif
7759 cfs_rq->min_vruntime = (u64)(-(1LL << 20)); 7759 cfs_rq->min_vruntime = (u64)(-(1LL << 20));
7760#ifndef CONFIG_64BIT
7761 cfs_rq->min_vruntime_copy = cfs_rq->min_vruntime;
7762#endif
7760} 7763}
7761 7764
7762static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq) 7765static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5ed24b94c5e6..d036e59d302b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2310,7 +2310,8 @@ static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages,
2310 for (i = 0; i <= classzone_idx; i++) 2310 for (i = 0; i <= classzone_idx; i++)
2311 present_pages += pgdat->node_zones[i].present_pages; 2311 present_pages += pgdat->node_zones[i].present_pages;
2312 2312
2313 return balanced_pages > (present_pages >> 2); 2313 /* A special case here: if zone has no page, we think it's balanced */
2314 return balanced_pages >= (present_pages >> 2);
2314} 2315}
2315 2316
2316/* is kswapd sleeping prematurely? */ 2317/* is kswapd sleeping prematurely? */
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 86bff9b1ac47..6e82148edfc8 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -528,7 +528,11 @@ static int vlan_dev_init(struct net_device *dev)
528 (1<<__LINK_STATE_DORMANT))) | 528 (1<<__LINK_STATE_DORMANT))) |
529 (1<<__LINK_STATE_PRESENT); 529 (1<<__LINK_STATE_PRESENT);
530 530
531 dev->hw_features = NETIF_F_ALL_TX_OFFLOADS; 531 dev->hw_features = NETIF_F_ALL_CSUM | NETIF_F_SG |
532 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO |
533 NETIF_F_HIGHDMA | NETIF_F_SCTP_CSUM |
534 NETIF_F_ALL_FCOE;
535
532 dev->features |= real_dev->vlan_features | NETIF_F_LLTX; 536 dev->features |= real_dev->vlan_features | NETIF_F_LLTX;
533 dev->gso_max_size = real_dev->gso_max_size; 537 dev->gso_max_size = real_dev->gso_max_size;
534 538
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index d3a05b9ade7a..bcd158f40bb9 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -393,6 +393,9 @@ int hci_conn_del(struct hci_conn *conn)
393 393
394 hci_dev_put(hdev); 394 hci_dev_put(hdev);
395 395
396 if (conn->handle == 0)
397 kfree(conn);
398
396 return 0; 399 return 0;
397} 400}
398 401
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index c405a954a603..43b4c2deb7cc 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -464,7 +464,8 @@ static void hidp_idle_timeout(unsigned long arg)
464{ 464{
465 struct hidp_session *session = (struct hidp_session *) arg; 465 struct hidp_session *session = (struct hidp_session *) arg;
466 466
467 kthread_stop(session->task); 467 atomic_inc(&session->terminate);
468 wake_up_process(session->task);
468} 469}
469 470
470static void hidp_set_timer(struct hidp_session *session) 471static void hidp_set_timer(struct hidp_session *session)
@@ -535,7 +536,8 @@ static void hidp_process_hid_control(struct hidp_session *session,
535 skb_queue_purge(&session->ctrl_transmit); 536 skb_queue_purge(&session->ctrl_transmit);
536 skb_queue_purge(&session->intr_transmit); 537 skb_queue_purge(&session->intr_transmit);
537 538
538 kthread_stop(session->task); 539 atomic_inc(&session->terminate);
540 wake_up_process(current);
539 } 541 }
540} 542}
541 543
@@ -706,9 +708,8 @@ static int hidp_session(void *arg)
706 add_wait_queue(sk_sleep(intr_sk), &intr_wait); 708 add_wait_queue(sk_sleep(intr_sk), &intr_wait);
707 session->waiting_for_startup = 0; 709 session->waiting_for_startup = 0;
708 wake_up_interruptible(&session->startup_queue); 710 wake_up_interruptible(&session->startup_queue);
709 while (!kthread_should_stop()) { 711 set_current_state(TASK_INTERRUPTIBLE);
710 set_current_state(TASK_INTERRUPTIBLE); 712 while (!atomic_read(&session->terminate)) {
711
712 if (ctrl_sk->sk_state != BT_CONNECTED || 713 if (ctrl_sk->sk_state != BT_CONNECTED ||
713 intr_sk->sk_state != BT_CONNECTED) 714 intr_sk->sk_state != BT_CONNECTED)
714 break; 715 break;
@@ -726,6 +727,7 @@ static int hidp_session(void *arg)
726 hidp_process_transmit(session); 727 hidp_process_transmit(session);
727 728
728 schedule(); 729 schedule();
730 set_current_state(TASK_INTERRUPTIBLE);
729 } 731 }
730 set_current_state(TASK_RUNNING); 732 set_current_state(TASK_RUNNING);
731 remove_wait_queue(sk_sleep(intr_sk), &intr_wait); 733 remove_wait_queue(sk_sleep(intr_sk), &intr_wait);
@@ -1060,7 +1062,8 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
1060err_add_device: 1062err_add_device:
1061 hid_destroy_device(session->hid); 1063 hid_destroy_device(session->hid);
1062 session->hid = NULL; 1064 session->hid = NULL;
1063 kthread_stop(session->task); 1065 atomic_inc(&session->terminate);
1066 wake_up_process(session->task);
1064 1067
1065unlink: 1068unlink:
1066 hidp_del_timer(session); 1069 hidp_del_timer(session);
@@ -1111,7 +1114,8 @@ int hidp_del_connection(struct hidp_conndel_req *req)
1111 skb_queue_purge(&session->ctrl_transmit); 1114 skb_queue_purge(&session->ctrl_transmit);
1112 skb_queue_purge(&session->intr_transmit); 1115 skb_queue_purge(&session->intr_transmit);
1113 1116
1114 kthread_stop(session->task); 1117 atomic_inc(&session->terminate);
1118 wake_up_process(session->task);
1115 } 1119 }
1116 } else 1120 } else
1117 err = -ENOENT; 1121 err = -ENOENT;
diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h
index 19e95004b286..af1bcc823f26 100644
--- a/net/bluetooth/hidp/hidp.h
+++ b/net/bluetooth/hidp/hidp.h
@@ -142,6 +142,7 @@ struct hidp_session {
142 uint ctrl_mtu; 142 uint ctrl_mtu;
143 uint intr_mtu; 143 uint intr_mtu;
144 144
145 atomic_t terminate;
145 struct task_struct *task; 146 struct task_struct *task;
146 147
147 unsigned char keys[8]; 148 unsigned char keys[8];
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 56fdd9162da9..7705e26e699f 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -620,7 +620,8 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
620 struct sock *parent = bt_sk(sk)->parent; 620 struct sock *parent = bt_sk(sk)->parent;
621 rsp.result = cpu_to_le16(L2CAP_CR_PEND); 621 rsp.result = cpu_to_le16(L2CAP_CR_PEND);
622 rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND); 622 rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND);
623 parent->sk_data_ready(parent, 0); 623 if (parent)
624 parent->sk_data_ready(parent, 0);
624 625
625 } else { 626 } else {
626 sk->sk_state = BT_CONFIG; 627 sk->sk_state = BT_CONFIG;
@@ -2323,7 +2324,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
2323 2324
2324 sk = chan->sk; 2325 sk = chan->sk;
2325 2326
2326 if (sk->sk_state != BT_CONFIG) { 2327 if (sk->sk_state != BT_CONFIG && sk->sk_state != BT_CONNECT2) {
2327 struct l2cap_cmd_rej rej; 2328 struct l2cap_cmd_rej rej;
2328 2329
2329 rej.reason = cpu_to_le16(0x0002); 2330 rej.reason = cpu_to_le16(0x0002);
@@ -2334,7 +2335,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
2334 2335
2335 /* Reject if config buffer is too small. */ 2336 /* Reject if config buffer is too small. */
2336 len = cmd_len - sizeof(*req); 2337 len = cmd_len - sizeof(*req);
2337 if (chan->conf_len + len > sizeof(chan->conf_req)) { 2338 if (len < 0 || chan->conf_len + len > sizeof(chan->conf_req)) {
2338 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, 2339 l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
2339 l2cap_build_conf_rsp(chan, rsp, 2340 l2cap_build_conf_rsp(chan, rsp,
2340 L2CAP_CONF_REJECT, flags), rsp); 2341 L2CAP_CONF_REJECT, flags), rsp);
@@ -4009,7 +4010,8 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4009 struct sock *parent = bt_sk(sk)->parent; 4010 struct sock *parent = bt_sk(sk)->parent;
4010 res = L2CAP_CR_PEND; 4011 res = L2CAP_CR_PEND;
4011 stat = L2CAP_CS_AUTHOR_PEND; 4012 stat = L2CAP_CS_AUTHOR_PEND;
4012 parent->sk_data_ready(parent, 0); 4013 if (parent)
4014 parent->sk_data_ready(parent, 0);
4013 } else { 4015 } else {
4014 sk->sk_state = BT_CONFIG; 4016 sk->sk_state = BT_CONFIG;
4015 res = L2CAP_CR_SUCCESS; 4017 res = L2CAP_CR_SUCCESS;
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 58ffa7d069c7..669d2e32efb6 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -877,7 +877,8 @@ int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
877 for (i = 0; i < IEEE80211_NUM_BANDS; i++) { 877 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
878 local->sched_scan_ies.ie[i] = kzalloc(2 + 878 local->sched_scan_ies.ie[i] = kzalloc(2 +
879 IEEE80211_MAX_SSID_LEN + 879 IEEE80211_MAX_SSID_LEN +
880 local->scan_ies_len, 880 local->scan_ies_len +
881 req->ie_len,
881 GFP_KERNEL); 882 GFP_KERNEL);
882 if (!local->sched_scan_ies.ie[i]) { 883 if (!local->sched_scan_ies.ie[i]) {
883 ret = -ENOMEM; 884 ret = -ENOMEM;
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index d91c1a26630d..8f6a302d2ac3 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -86,6 +86,11 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
86 struct sk_buff *skb = rx->skb; 86 struct sk_buff *skb = rx->skb;
87 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 87 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
88 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 88 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
89 int queue = rx->queue;
90
91 /* otherwise, TKIP is vulnerable to TID 0 vs. non-QoS replays */
92 if (rx->queue == NUM_RX_DATA_QUEUES - 1)
93 queue = 0;
89 94
90 /* 95 /*
91 * it makes no sense to check for MIC errors on anything other 96 * it makes no sense to check for MIC errors on anything other
@@ -148,8 +153,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
148 153
149update_iv: 154update_iv:
150 /* update IV in key information to be able to detect replays */ 155 /* update IV in key information to be able to detect replays */
151 rx->key->u.tkip.rx[rx->queue].iv32 = rx->tkip_iv32; 156 rx->key->u.tkip.rx[queue].iv32 = rx->tkip_iv32;
152 rx->key->u.tkip.rx[rx->queue].iv16 = rx->tkip_iv16; 157 rx->key->u.tkip.rx[queue].iv16 = rx->tkip_iv16;
153 158
154 return RX_CONTINUE; 159 return RX_CONTINUE;
155 160
@@ -241,6 +246,11 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
241 struct ieee80211_key *key = rx->key; 246 struct ieee80211_key *key = rx->key;
242 struct sk_buff *skb = rx->skb; 247 struct sk_buff *skb = rx->skb;
243 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 248 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
249 int queue = rx->queue;
250
251 /* otherwise, TKIP is vulnerable to TID 0 vs. non-QoS replays */
252 if (rx->queue == NUM_RX_DATA_QUEUES - 1)
253 queue = 0;
244 254
245 hdrlen = ieee80211_hdrlen(hdr->frame_control); 255 hdrlen = ieee80211_hdrlen(hdr->frame_control);
246 256
@@ -261,7 +271,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
261 res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm, 271 res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm,
262 key, skb->data + hdrlen, 272 key, skb->data + hdrlen,
263 skb->len - hdrlen, rx->sta->sta.addr, 273 skb->len - hdrlen, rx->sta->sta.addr,
264 hdr->addr1, hwaccel, rx->queue, 274 hdr->addr1, hwaccel, queue,
265 &rx->tkip_iv32, 275 &rx->tkip_iv32,
266 &rx->tkip_iv16); 276 &rx->tkip_iv16);
267 if (res != TKIP_DECRYPT_OK) 277 if (res != TKIP_DECRYPT_OK)
diff --git a/net/sctp/output.c b/net/sctp/output.c
index b4f3cf06d8da..08b3cead6503 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -500,23 +500,20 @@ int sctp_packet_transmit(struct sctp_packet *packet)
500 * Note: Adler-32 is no longer applicable, as has been replaced 500 * Note: Adler-32 is no longer applicable, as has been replaced
501 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>. 501 * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
502 */ 502 */
503 if (!sctp_checksum_disable && 503 if (!sctp_checksum_disable) {
504 !(dst->dev->features & (NETIF_F_NO_CSUM | NETIF_F_SCTP_CSUM))) { 504 if (!(dst->dev->features & NETIF_F_SCTP_CSUM)) {
505 __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 505 __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
506 506
507 /* 3) Put the resultant value into the checksum field in the 507 /* 3) Put the resultant value into the checksum field in the
508 * common header, and leave the rest of the bits unchanged. 508 * common header, and leave the rest of the bits unchanged.
509 */ 509 */
510 sh->checksum = sctp_end_cksum(crc32); 510 sh->checksum = sctp_end_cksum(crc32);
511 } else { 511 } else {
512 if (dst->dev->features & NETIF_F_SCTP_CSUM) {
513 /* no need to seed pseudo checksum for SCTP */ 512 /* no need to seed pseudo checksum for SCTP */
514 nskb->ip_summed = CHECKSUM_PARTIAL; 513 nskb->ip_summed = CHECKSUM_PARTIAL;
515 nskb->csum_start = (skb_transport_header(nskb) - 514 nskb->csum_start = (skb_transport_header(nskb) -
516 nskb->head); 515 nskb->head);
517 nskb->csum_offset = offsetof(struct sctphdr, checksum); 516 nskb->csum_offset = offsetof(struct sctphdr, checksum);
518 } else {
519 nskb->ip_summed = CHECKSUM_UNNECESSARY;
520 } 517 }
521 } 518 }
522 519
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 1c88c8911dc5..d03682109b7a 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -1582,6 +1582,8 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1582#endif /* SCTP_DEBUG */ 1582#endif /* SCTP_DEBUG */
1583 if (transport) { 1583 if (transport) {
1584 if (bytes_acked) { 1584 if (bytes_acked) {
1585 struct sctp_association *asoc = transport->asoc;
1586
1585 /* We may have counted DATA that was migrated 1587 /* We may have counted DATA that was migrated
1586 * to this transport due to DEL-IP operation. 1588 * to this transport due to DEL-IP operation.
1587 * Subtract those bytes, since the were never 1589 * Subtract those bytes, since the were never
@@ -1600,6 +1602,17 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1600 transport->error_count = 0; 1602 transport->error_count = 0;
1601 transport->asoc->overall_error_count = 0; 1603 transport->asoc->overall_error_count = 0;
1602 1604
1605 /*
1606 * While in SHUTDOWN PENDING, we may have started
1607 * the T5 shutdown guard timer after reaching the
1608 * retransmission limit. Stop that timer as soon
1609 * as the receiver acknowledged any data.
1610 */
1611 if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING &&
1612 del_timer(&asoc->timers
1613 [SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD]))
1614 sctp_association_put(asoc);
1615
1603 /* Mark the destination transport address as 1616 /* Mark the destination transport address as
1604 * active if it is not so marked. 1617 * active if it is not so marked.
1605 */ 1618 */
@@ -1629,10 +1642,15 @@ static void sctp_check_transmitted(struct sctp_outq *q,
1629 * A sender is doing zero window probing when the 1642 * A sender is doing zero window probing when the
1630 * receiver's advertised window is zero, and there is 1643 * receiver's advertised window is zero, and there is
1631 * only one data chunk in flight to the receiver. 1644 * only one data chunk in flight to the receiver.
1645 *
1646 * Allow the association to timeout while in SHUTDOWN
1647 * PENDING or SHUTDOWN RECEIVED in case the receiver
1648 * stays in zero window mode forever.
1632 */ 1649 */
1633 if (!q->asoc->peer.rwnd && 1650 if (!q->asoc->peer.rwnd &&
1634 !list_empty(&tlist) && 1651 !list_empty(&tlist) &&
1635 (sack_ctsn+2 == q->asoc->next_tsn)) { 1652 (sack_ctsn+2 == q->asoc->next_tsn) &&
1653 q->asoc->state < SCTP_STATE_SHUTDOWN_PENDING) {
1636 SCTP_DEBUG_PRINTK("%s: SACK received for zero " 1654 SCTP_DEBUG_PRINTK("%s: SACK received for zero "
1637 "window probe: %u\n", 1655 "window probe: %u\n",
1638 __func__, sack_ctsn); 1656 __func__, sack_ctsn);
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 534c2e5feb05..6e0f88295aaf 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -670,10 +670,19 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
670 /* 8.3 Upon the receipt of the HEARTBEAT ACK, the sender of the 670 /* 8.3 Upon the receipt of the HEARTBEAT ACK, the sender of the
671 * HEARTBEAT should clear the error counter of the destination 671 * HEARTBEAT should clear the error counter of the destination
672 * transport address to which the HEARTBEAT was sent. 672 * transport address to which the HEARTBEAT was sent.
673 * The association's overall error count is also cleared.
674 */ 673 */
675 t->error_count = 0; 674 t->error_count = 0;
676 t->asoc->overall_error_count = 0; 675
676 /*
677 * Although RFC4960 specifies that the overall error count must
678 * be cleared when a HEARTBEAT ACK is received, we make an
679 * exception while in SHUTDOWN PENDING. If the peer keeps its
680 * window shut forever, we may never be able to transmit our
681 * outstanding data and rely on the retransmission limit be reached
682 * to shutdown the association.
683 */
684 if (t->asoc->state != SCTP_STATE_SHUTDOWN_PENDING)
685 t->asoc->overall_error_count = 0;
677 686
678 /* Clear the hb_sent flag to signal that we had a good 687 /* Clear the hb_sent flag to signal that we had a good
679 * acknowledgement. 688 * acknowledgement.
@@ -1437,6 +1446,13 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
1437 sctp_cmd_setup_t2(commands, asoc, cmd->obj.ptr); 1446 sctp_cmd_setup_t2(commands, asoc, cmd->obj.ptr);
1438 break; 1447 break;
1439 1448
1449 case SCTP_CMD_TIMER_START_ONCE:
1450 timer = &asoc->timers[cmd->obj.to];
1451
1452 if (timer_pending(timer))
1453 break;
1454 /* fall through */
1455
1440 case SCTP_CMD_TIMER_START: 1456 case SCTP_CMD_TIMER_START:
1441 timer = &asoc->timers[cmd->obj.to]; 1457 timer = &asoc->timers[cmd->obj.to];
1442 timeout = asoc->timeouts[cmd->obj.to]; 1458 timeout = asoc->timeouts[cmd->obj.to];
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index a297283154d5..246117142b5c 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -5154,7 +5154,7 @@ sctp_disposition_t sctp_sf_do_9_2_start_shutdown(
5154 * The sender of the SHUTDOWN MAY also start an overall guard timer 5154 * The sender of the SHUTDOWN MAY also start an overall guard timer
5155 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence. 5155 * 'T5-shutdown-guard' to bound the overall time for shutdown sequence.
5156 */ 5156 */
5157 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START, 5157 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
5158 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD)); 5158 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
5159 5159
5160 if (asoc->autoclose) 5160 if (asoc->autoclose)
@@ -5299,14 +5299,28 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const struct sctp_endpoint *ep,
5299 SCTP_INC_STATS(SCTP_MIB_T3_RTX_EXPIREDS); 5299 SCTP_INC_STATS(SCTP_MIB_T3_RTX_EXPIREDS);
5300 5300
5301 if (asoc->overall_error_count >= asoc->max_retrans) { 5301 if (asoc->overall_error_count >= asoc->max_retrans) {
5302 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, 5302 if (asoc->state == SCTP_STATE_SHUTDOWN_PENDING) {
5303 SCTP_ERROR(ETIMEDOUT)); 5303 /*
5304 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */ 5304 * We are here likely because the receiver had its rwnd
5305 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, 5305 * closed for a while and we have not been able to
5306 SCTP_PERR(SCTP_ERROR_NO_ERROR)); 5306 * transmit the locally queued data within the maximum
5307 SCTP_INC_STATS(SCTP_MIB_ABORTEDS); 5307 * retransmission attempts limit. Start the T5
5308 SCTP_DEC_STATS(SCTP_MIB_CURRESTAB); 5308 * shutdown guard timer to give the receiver one last
5309 return SCTP_DISPOSITION_DELETE_TCB; 5309 * chance and some additional time to recover before
5310 * aborting.
5311 */
5312 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START_ONCE,
5313 SCTP_TO(SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD));
5314 } else {
5315 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
5316 SCTP_ERROR(ETIMEDOUT));
5317 /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
5318 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
5319 SCTP_PERR(SCTP_ERROR_NO_ERROR));
5320 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
5321 SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
5322 return SCTP_DISPOSITION_DELETE_TCB;
5323 }
5310 } 5324 }
5311 5325
5312 /* E1) For the destination address for which the timer 5326 /* E1) For the destination address for which the timer
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 0338dc6fdc9d..7c211a7f90f4 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -827,7 +827,7 @@ static const sctp_sm_table_entry_t other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_
827 /* SCTP_STATE_ESTABLISHED */ \ 827 /* SCTP_STATE_ESTABLISHED */ \
828 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \ 828 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \
829 /* SCTP_STATE_SHUTDOWN_PENDING */ \ 829 /* SCTP_STATE_SHUTDOWN_PENDING */ \
830 TYPE_SCTP_FUNC(sctp_sf_timer_ignore), \ 830 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
831 /* SCTP_STATE_SHUTDOWN_SENT */ \ 831 /* SCTP_STATE_SHUTDOWN_SENT */ \
832 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \ 832 TYPE_SCTP_FUNC(sctp_sf_t5_timer_expire), \
833 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \ 833 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 08c6238802de..d3ccf7973c59 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1384,6 +1384,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
1384 struct sctp_endpoint *ep; 1384 struct sctp_endpoint *ep;
1385 struct sctp_association *asoc; 1385 struct sctp_association *asoc;
1386 struct list_head *pos, *temp; 1386 struct list_head *pos, *temp;
1387 unsigned int data_was_unread;
1387 1388
1388 SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout); 1389 SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout);
1389 1390
@@ -1393,6 +1394,10 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
1393 1394
1394 ep = sctp_sk(sk)->ep; 1395 ep = sctp_sk(sk)->ep;
1395 1396
1397 /* Clean up any skbs sitting on the receive queue. */
1398 data_was_unread = sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
1399 data_was_unread += sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
1400
1396 /* Walk all associations on an endpoint. */ 1401 /* Walk all associations on an endpoint. */
1397 list_for_each_safe(pos, temp, &ep->asocs) { 1402 list_for_each_safe(pos, temp, &ep->asocs) {
1398 asoc = list_entry(pos, struct sctp_association, asocs); 1403 asoc = list_entry(pos, struct sctp_association, asocs);
@@ -1410,7 +1415,9 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
1410 } 1415 }
1411 } 1416 }
1412 1417
1413 if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) { 1418 if (data_was_unread || !skb_queue_empty(&asoc->ulpq.lobby) ||
1419 !skb_queue_empty(&asoc->ulpq.reasm) ||
1420 (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime)) {
1414 struct sctp_chunk *chunk; 1421 struct sctp_chunk *chunk;
1415 1422
1416 chunk = sctp_make_abort_user(asoc, NULL, 0); 1423 chunk = sctp_make_abort_user(asoc, NULL, 0);
@@ -1420,10 +1427,6 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
1420 sctp_primitive_SHUTDOWN(asoc, NULL); 1427 sctp_primitive_SHUTDOWN(asoc, NULL);
1421 } 1428 }
1422 1429
1423 /* Clean up any skbs sitting on the receive queue. */
1424 sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
1425 sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
1426
1427 /* On a TCP-style socket, block for at most linger_time if set. */ 1430 /* On a TCP-style socket, block for at most linger_time if set. */
1428 if (sctp_style(sk, TCP) && timeout) 1431 if (sctp_style(sk, TCP) && timeout)
1429 sctp_wait_for_close(sk, timeout); 1432 sctp_wait_for_close(sk, timeout);
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index e70e5fc87890..8a84017834c2 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -1081,9 +1081,19 @@ void sctp_ulpevent_free(struct sctp_ulpevent *event)
1081} 1081}
1082 1082
1083/* Purge the skb lists holding ulpevents. */ 1083/* Purge the skb lists holding ulpevents. */
1084void sctp_queue_purge_ulpevents(struct sk_buff_head *list) 1084unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list)
1085{ 1085{
1086 struct sk_buff *skb; 1086 struct sk_buff *skb;
1087 while ((skb = skb_dequeue(list)) != NULL) 1087 unsigned int data_unread = 0;
1088 sctp_ulpevent_free(sctp_skb2event(skb)); 1088
1089 while ((skb = skb_dequeue(list)) != NULL) {
1090 struct sctp_ulpevent *event = sctp_skb2event(skb);
1091
1092 if (!sctp_ulpevent_is_notification(event))
1093 data_unread += skb->len;
1094
1095 sctp_ulpevent_free(event);
1096 }
1097
1098 return data_unread;
1089} 1099}
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 9a80a922c527..e45d2fbbe5a8 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -597,7 +597,7 @@ void rpcb_getport_async(struct rpc_task *task)
597 u32 bind_version; 597 u32 bind_version;
598 struct rpc_xprt *xprt; 598 struct rpc_xprt *xprt;
599 struct rpc_clnt *rpcb_clnt; 599 struct rpc_clnt *rpcb_clnt;
600 static struct rpcbind_args *map; 600 struct rpcbind_args *map;
601 struct rpc_task *child; 601 struct rpc_task *child;
602 struct sockaddr_storage addr; 602 struct sockaddr_storage addr;
603 struct sockaddr *sap = (struct sockaddr *)&addr; 603 struct sockaddr *sap = (struct sockaddr *)&addr;
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index a27406b1654f..4814e246a874 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -616,30 +616,25 @@ static void __rpc_execute(struct rpc_task *task)
616 BUG_ON(RPC_IS_QUEUED(task)); 616 BUG_ON(RPC_IS_QUEUED(task));
617 617
618 for (;;) { 618 for (;;) {
619 void (*do_action)(struct rpc_task *);
619 620
620 /* 621 /*
621 * Execute any pending callback. 622 * Execute any pending callback first.
622 */ 623 */
623 if (task->tk_callback) { 624 do_action = task->tk_callback;
624 void (*save_callback)(struct rpc_task *); 625 task->tk_callback = NULL;
625 626 if (do_action == NULL) {
626 /*
627 * We set tk_callback to NULL before calling it,
628 * in case it sets the tk_callback field itself:
629 */
630 save_callback = task->tk_callback;
631 task->tk_callback = NULL;
632 save_callback(task);
633 } else {
634 /* 627 /*
635 * Perform the next FSM step. 628 * Perform the next FSM step.
636 * tk_action may be NULL when the task has been killed 629 * tk_action may be NULL if the task has been killed.
637 * by someone else. 630 * In particular, note that rpc_killall_tasks may
631 * do this at any time, so beware when dereferencing.
638 */ 632 */
639 if (task->tk_action == NULL) 633 do_action = task->tk_action;
634 if (do_action == NULL)
640 break; 635 break;
641 task->tk_action(task);
642 } 636 }
637 do_action(task);
643 638
644 /* 639 /*
645 * Lockless check for whether task is sleeping or not. 640 * Lockless check for whether task is sleeping or not.
diff --git a/net/wireless/core.c b/net/wireless/core.c
index c22ef3492ee6..880dbe2e6f94 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -366,6 +366,7 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
366 366
367 mutex_init(&rdev->mtx); 367 mutex_init(&rdev->mtx);
368 mutex_init(&rdev->devlist_mtx); 368 mutex_init(&rdev->devlist_mtx);
369 mutex_init(&rdev->sched_scan_mtx);
369 INIT_LIST_HEAD(&rdev->netdev_list); 370 INIT_LIST_HEAD(&rdev->netdev_list);
370 spin_lock_init(&rdev->bss_lock); 371 spin_lock_init(&rdev->bss_lock);
371 INIT_LIST_HEAD(&rdev->bss_list); 372 INIT_LIST_HEAD(&rdev->bss_list);
@@ -701,6 +702,7 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)
701 rfkill_destroy(rdev->rfkill); 702 rfkill_destroy(rdev->rfkill);
702 mutex_destroy(&rdev->mtx); 703 mutex_destroy(&rdev->mtx);
703 mutex_destroy(&rdev->devlist_mtx); 704 mutex_destroy(&rdev->devlist_mtx);
705 mutex_destroy(&rdev->sched_scan_mtx);
704 list_for_each_entry_safe(scan, tmp, &rdev->bss_list, list) 706 list_for_each_entry_safe(scan, tmp, &rdev->bss_list, list)
705 cfg80211_put_bss(&scan->pub); 707 cfg80211_put_bss(&scan->pub);
706 cfg80211_rdev_free_wowlan(rdev); 708 cfg80211_rdev_free_wowlan(rdev);
@@ -737,12 +739,16 @@ static void wdev_cleanup_work(struct work_struct *work)
737 ___cfg80211_scan_done(rdev, true); 739 ___cfg80211_scan_done(rdev, true);
738 } 740 }
739 741
742 cfg80211_unlock_rdev(rdev);
743
744 mutex_lock(&rdev->sched_scan_mtx);
745
740 if (WARN_ON(rdev->sched_scan_req && 746 if (WARN_ON(rdev->sched_scan_req &&
741 rdev->sched_scan_req->dev == wdev->netdev)) { 747 rdev->sched_scan_req->dev == wdev->netdev)) {
742 __cfg80211_stop_sched_scan(rdev, false); 748 __cfg80211_stop_sched_scan(rdev, false);
743 } 749 }
744 750
745 cfg80211_unlock_rdev(rdev); 751 mutex_unlock(&rdev->sched_scan_mtx);
746 752
747 mutex_lock(&rdev->devlist_mtx); 753 mutex_lock(&rdev->devlist_mtx);
748 rdev->opencount--; 754 rdev->opencount--;
@@ -830,9 +836,9 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
830 break; 836 break;
831 case NL80211_IFTYPE_P2P_CLIENT: 837 case NL80211_IFTYPE_P2P_CLIENT:
832 case NL80211_IFTYPE_STATION: 838 case NL80211_IFTYPE_STATION:
833 cfg80211_lock_rdev(rdev); 839 mutex_lock(&rdev->sched_scan_mtx);
834 __cfg80211_stop_sched_scan(rdev, false); 840 __cfg80211_stop_sched_scan(rdev, false);
835 cfg80211_unlock_rdev(rdev); 841 mutex_unlock(&rdev->sched_scan_mtx);
836 842
837 wdev_lock(wdev); 843 wdev_lock(wdev);
838#ifdef CONFIG_CFG80211_WEXT 844#ifdef CONFIG_CFG80211_WEXT
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 3dce1f167eba..a570ff9214ec 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -65,6 +65,8 @@ struct cfg80211_registered_device {
65 struct work_struct scan_done_wk; 65 struct work_struct scan_done_wk;
66 struct work_struct sched_scan_results_wk; 66 struct work_struct sched_scan_results_wk;
67 67
68 struct mutex sched_scan_mtx;
69
68#ifdef CONFIG_NL80211_TESTMODE 70#ifdef CONFIG_NL80211_TESTMODE
69 struct genl_info *testmode_info; 71 struct genl_info *testmode_info;
70#endif 72#endif
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f07602d7bf68..cea338150d05 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3461,9 +3461,6 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
3461 if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) 3461 if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
3462 return -EINVAL; 3462 return -EINVAL;
3463 3463
3464 if (rdev->sched_scan_req)
3465 return -EINPROGRESS;
3466
3467 if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) 3464 if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL])
3468 return -EINVAL; 3465 return -EINVAL;
3469 3466
@@ -3502,12 +3499,21 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
3502 if (ie_len > wiphy->max_scan_ie_len) 3499 if (ie_len > wiphy->max_scan_ie_len)
3503 return -EINVAL; 3500 return -EINVAL;
3504 3501
3502 mutex_lock(&rdev->sched_scan_mtx);
3503
3504 if (rdev->sched_scan_req) {
3505 err = -EINPROGRESS;
3506 goto out;
3507 }
3508
3505 request = kzalloc(sizeof(*request) 3509 request = kzalloc(sizeof(*request)
3506 + sizeof(*request->ssids) * n_ssids 3510 + sizeof(*request->ssids) * n_ssids
3507 + sizeof(*request->channels) * n_channels 3511 + sizeof(*request->channels) * n_channels
3508 + ie_len, GFP_KERNEL); 3512 + ie_len, GFP_KERNEL);
3509 if (!request) 3513 if (!request) {
3510 return -ENOMEM; 3514 err = -ENOMEM;
3515 goto out;
3516 }
3511 3517
3512 if (n_ssids) 3518 if (n_ssids)
3513 request->ssids = (void *)&request->channels[n_channels]; 3519 request->ssids = (void *)&request->channels[n_channels];
@@ -3605,6 +3611,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
3605out_free: 3611out_free:
3606 kfree(request); 3612 kfree(request);
3607out: 3613out:
3614 mutex_unlock(&rdev->sched_scan_mtx);
3608 return err; 3615 return err;
3609} 3616}
3610 3617
@@ -3612,12 +3619,17 @@ static int nl80211_stop_sched_scan(struct sk_buff *skb,
3612 struct genl_info *info) 3619 struct genl_info *info)
3613{ 3620{
3614 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 3621 struct cfg80211_registered_device *rdev = info->user_ptr[0];
3622 int err;
3615 3623
3616 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) || 3624 if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) ||
3617 !rdev->ops->sched_scan_stop) 3625 !rdev->ops->sched_scan_stop)
3618 return -EOPNOTSUPP; 3626 return -EOPNOTSUPP;
3619 3627
3620 return __cfg80211_stop_sched_scan(rdev, false); 3628 mutex_lock(&rdev->sched_scan_mtx);
3629 err = __cfg80211_stop_sched_scan(rdev, false);
3630 mutex_unlock(&rdev->sched_scan_mtx);
3631
3632 return err;
3621} 3633}
3622 3634
3623static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags, 3635static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags,
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 7a6c67667d70..ae0c2256ba3b 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -100,14 +100,14 @@ void __cfg80211_sched_scan_results(struct work_struct *wk)
100 rdev = container_of(wk, struct cfg80211_registered_device, 100 rdev = container_of(wk, struct cfg80211_registered_device,
101 sched_scan_results_wk); 101 sched_scan_results_wk);
102 102
103 cfg80211_lock_rdev(rdev); 103 mutex_lock(&rdev->sched_scan_mtx);
104 104
105 /* we don't have sched_scan_req anymore if the scan is stopping */ 105 /* we don't have sched_scan_req anymore if the scan is stopping */
106 if (rdev->sched_scan_req) 106 if (rdev->sched_scan_req)
107 nl80211_send_sched_scan_results(rdev, 107 nl80211_send_sched_scan_results(rdev,
108 rdev->sched_scan_req->dev); 108 rdev->sched_scan_req->dev);
109 109
110 cfg80211_unlock_rdev(rdev); 110 mutex_unlock(&rdev->sched_scan_mtx);
111} 111}
112 112
113void cfg80211_sched_scan_results(struct wiphy *wiphy) 113void cfg80211_sched_scan_results(struct wiphy *wiphy)
@@ -123,9 +123,9 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy)
123{ 123{
124 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 124 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
125 125
126 cfg80211_lock_rdev(rdev); 126 mutex_lock(&rdev->sched_scan_mtx);
127 __cfg80211_stop_sched_scan(rdev, true); 127 __cfg80211_stop_sched_scan(rdev, true);
128 cfg80211_unlock_rdev(rdev); 128 mutex_unlock(&rdev->sched_scan_mtx);
129} 129}
130EXPORT_SYMBOL(cfg80211_sched_scan_stopped); 130EXPORT_SYMBOL(cfg80211_sched_scan_stopped);
131 131
@@ -135,7 +135,7 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
135 int err; 135 int err;
136 struct net_device *dev; 136 struct net_device *dev;
137 137
138 ASSERT_RDEV_LOCK(rdev); 138 lockdep_assert_held(&rdev->sched_scan_mtx);
139 139
140 if (!rdev->sched_scan_req) 140 if (!rdev->sched_scan_req)
141 return 0; 141 return 0;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index d70f85eb7864..9414b9c5b1e4 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1345,6 +1345,8 @@ out:
1345 xfrm_state_check_expire(x1); 1345 xfrm_state_check_expire(x1);
1346 1346
1347 err = 0; 1347 err = 0;
1348 x->km.state = XFRM_STATE_DEAD;
1349 __xfrm_state_put(x);
1348 } 1350 }
1349 spin_unlock_bh(&x1->lock); 1351 spin_unlock_bh(&x1->lock);
1350 1352
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 3b029cba2baf..a27235685949 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -21,13 +21,15 @@ fi
21# older versions of depmod require the version string to start with three 21# older versions of depmod require the version string to start with three
22# numbers, so we cheat with a symlink here 22# numbers, so we cheat with a symlink here
23depmod_hack_needed=true 23depmod_hack_needed=true
24mkdir -p .tmp_depmod/lib/modules/$KERNELRELEASE 24tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
25if "$DEPMOD" -b .tmp_depmod $KERNELRELEASE 2>/dev/null; then 25mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
26 if test -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep -o \ 26if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
27 -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep.bin; then 27 if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
28 -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
28 depmod_hack_needed=false 29 depmod_hack_needed=false
29 fi 30 fi
30fi 31fi
32rm -rf "$tmp_dir"
31if $depmod_hack_needed; then 33if $depmod_hack_needed; then
32 symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE" 34 symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
33 ln -s "$KERNELRELEASE" "$symlink" 35 ln -s "$KERNELRELEASE" "$symlink"
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index c2fc0356c2a4..83014a7c2e14 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1190,7 +1190,6 @@ SND_SOC_DAPM_INPUT("DMIC1DAT"),
1190SND_SOC_DAPM_INPUT("DMIC2DAT"), 1190SND_SOC_DAPM_INPUT("DMIC2DAT"),
1191SND_SOC_DAPM_INPUT("Clock"), 1191SND_SOC_DAPM_INPUT("Clock"),
1192 1192
1193SND_SOC_DAPM_MICBIAS("MICBIAS", WM8994_MICBIAS, 2, 0),
1194SND_SOC_DAPM_SUPPLY_S("MICBIAS Supply", 1, SND_SOC_NOPM, 0, 0, micbias_ev, 1193SND_SOC_DAPM_SUPPLY_S("MICBIAS Supply", 1, SND_SOC_NOPM, 0, 0, micbias_ev,
1195 SND_SOC_DAPM_PRE_PMU), 1194 SND_SOC_DAPM_PRE_PMU),
1196 1195
@@ -1509,8 +1508,10 @@ static const struct snd_soc_dapm_route wm8994_revd_intercon[] = {
1509 { "AIF2DACDAT", NULL, "AIF1DACDAT" }, 1508 { "AIF2DACDAT", NULL, "AIF1DACDAT" },
1510 { "AIF1ADCDAT", NULL, "AIF2ADCDAT" }, 1509 { "AIF1ADCDAT", NULL, "AIF2ADCDAT" },
1511 { "AIF2ADCDAT", NULL, "AIF1ADCDAT" }, 1510 { "AIF2ADCDAT", NULL, "AIF1ADCDAT" },
1512 { "MICBIAS", NULL, "CLK_SYS" }, 1511 { "MICBIAS1", NULL, "CLK_SYS" },
1513 { "MICBIAS", NULL, "MICBIAS Supply" }, 1512 { "MICBIAS1", NULL, "MICBIAS Supply" },
1513 { "MICBIAS2", NULL, "CLK_SYS" },
1514 { "MICBIAS2", NULL, "MICBIAS Supply" },
1514}; 1515};
1515 1516
1516static const struct snd_soc_dapm_route wm8994_intercon[] = { 1517static const struct snd_soc_dapm_route wm8994_intercon[] = {
@@ -2763,7 +2764,7 @@ static void wm8958_default_micdet(u16 status, void *data)
2763 report = SND_JACK_MICROPHONE; 2764 report = SND_JACK_MICROPHONE;
2764 2765
2765 /* Everything else is buttons; just assign slots */ 2766 /* Everything else is buttons; just assign slots */
2766 if (status & 0x1c0) 2767 if (status & 0x1c)
2767 report |= SND_JACK_BTN_0; 2768 report |= SND_JACK_BTN_0;
2768 2769
2769done: 2770done:
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index d6f4703b3c07..770a71a15366 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -97,7 +97,7 @@ static int fsi_ak4642_remove(struct platform_device *pdev)
97 97
98static struct fsi_ak4642_data fsi_a_ak4642 = { 98static struct fsi_ak4642_data fsi_a_ak4642 = {
99 .name = "AK4642", 99 .name = "AK4642",
100 .card = "FSIA (AK4642)", 100 .card = "FSIA-AK4642",
101 .cpu_dai = "fsia-dai", 101 .cpu_dai = "fsia-dai",
102 .codec = "ak4642-codec.0-0012", 102 .codec = "ak4642-codec.0-0012",
103 .platform = "sh_fsi.0", 103 .platform = "sh_fsi.0",
@@ -106,7 +106,7 @@ static struct fsi_ak4642_data fsi_a_ak4642 = {
106 106
107static struct fsi_ak4642_data fsi_b_ak4642 = { 107static struct fsi_ak4642_data fsi_b_ak4642 = {
108 .name = "AK4642", 108 .name = "AK4642",
109 .card = "FSIB (AK4642)", 109 .card = "FSIB-AK4642",
110 .cpu_dai = "fsib-dai", 110 .cpu_dai = "fsib-dai",
111 .codec = "ak4642-codec.0-0012", 111 .codec = "ak4642-codec.0-0012",
112 .platform = "sh_fsi.0", 112 .platform = "sh_fsi.0",
@@ -115,7 +115,7 @@ static struct fsi_ak4642_data fsi_b_ak4642 = {
115 115
116static struct fsi_ak4642_data fsi_a_ak4643 = { 116static struct fsi_ak4642_data fsi_a_ak4643 = {
117 .name = "AK4643", 117 .name = "AK4643",
118 .card = "FSIA (AK4643)", 118 .card = "FSIA-AK4643",
119 .cpu_dai = "fsia-dai", 119 .cpu_dai = "fsia-dai",
120 .codec = "ak4642-codec.0-0013", 120 .codec = "ak4642-codec.0-0013",
121 .platform = "sh_fsi.0", 121 .platform = "sh_fsi.0",
@@ -124,7 +124,7 @@ static struct fsi_ak4642_data fsi_a_ak4643 = {
124 124
125static struct fsi_ak4642_data fsi_b_ak4643 = { 125static struct fsi_ak4642_data fsi_b_ak4643 = {
126 .name = "AK4643", 126 .name = "AK4643",
127 .card = "FSIB (AK4643)", 127 .card = "FSIB-AK4643",
128 .cpu_dai = "fsib-dai", 128 .cpu_dai = "fsib-dai",
129 .codec = "ak4642-codec.0-0013", 129 .codec = "ak4642-codec.0-0013",
130 .platform = "sh_fsi.0", 130 .platform = "sh_fsi.0",
@@ -133,7 +133,7 @@ static struct fsi_ak4642_data fsi_b_ak4643 = {
133 133
134static struct fsi_ak4642_data fsi2_a_ak4642 = { 134static struct fsi_ak4642_data fsi2_a_ak4642 = {
135 .name = "AK4642", 135 .name = "AK4642",
136 .card = "FSI2A (AK4642)", 136 .card = "FSI2A-AK4642",
137 .cpu_dai = "fsia-dai", 137 .cpu_dai = "fsia-dai",
138 .codec = "ak4642-codec.0-0012", 138 .codec = "ak4642-codec.0-0012",
139 .platform = "sh_fsi2", 139 .platform = "sh_fsi2",
@@ -142,7 +142,7 @@ static struct fsi_ak4642_data fsi2_a_ak4642 = {
142 142
143static struct fsi_ak4642_data fsi2_b_ak4642 = { 143static struct fsi_ak4642_data fsi2_b_ak4642 = {
144 .name = "AK4642", 144 .name = "AK4642",
145 .card = "FSI2B (AK4642)", 145 .card = "FSI2B-AK4642",
146 .cpu_dai = "fsib-dai", 146 .cpu_dai = "fsib-dai",
147 .codec = "ak4642-codec.0-0012", 147 .codec = "ak4642-codec.0-0012",
148 .platform = "sh_fsi2", 148 .platform = "sh_fsi2",
@@ -151,7 +151,7 @@ static struct fsi_ak4642_data fsi2_b_ak4642 = {
151 151
152static struct fsi_ak4642_data fsi2_a_ak4643 = { 152static struct fsi_ak4642_data fsi2_a_ak4643 = {
153 .name = "AK4643", 153 .name = "AK4643",
154 .card = "FSI2A (AK4643)", 154 .card = "FSI2A-AK4643",
155 .cpu_dai = "fsia-dai", 155 .cpu_dai = "fsia-dai",
156 .codec = "ak4642-codec.0-0013", 156 .codec = "ak4642-codec.0-0013",
157 .platform = "sh_fsi2", 157 .platform = "sh_fsi2",
@@ -160,7 +160,7 @@ static struct fsi_ak4642_data fsi2_a_ak4643 = {
160 160
161static struct fsi_ak4642_data fsi2_b_ak4643 = { 161static struct fsi_ak4642_data fsi2_b_ak4643 = {
162 .name = "AK4643", 162 .name = "AK4643",
163 .card = "FSI2B (AK4643)", 163 .card = "FSI2B-AK4643",
164 .cpu_dai = "fsib-dai", 164 .cpu_dai = "fsib-dai",
165 .codec = "ak4642-codec.0-0013", 165 .codec = "ak4642-codec.0-0013",
166 .platform = "sh_fsi2", 166 .platform = "sh_fsi2",
diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c
index dbafd7ac5590..59553fd8c2fb 100644
--- a/sound/soc/sh/fsi-da7210.c
+++ b/sound/soc/sh/fsi-da7210.c
@@ -42,7 +42,7 @@ static struct snd_soc_dai_link fsi_da7210_dai = {
42}; 42};
43 43
44static struct snd_soc_card fsi_soc_card = { 44static struct snd_soc_card fsi_soc_card = {
45 .name = "FSI (DA7210)", 45 .name = "FSI-DA7210",
46 .dai_link = &fsi_da7210_dai, 46 .dai_link = &fsi_da7210_dai,
47 .num_links = 1, 47 .num_links = 1,
48}; 48};
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c
index 9719985eb82d..d3d9fd880680 100644
--- a/sound/soc/sh/fsi-hdmi.c
+++ b/sound/soc/sh/fsi-hdmi.c
@@ -83,13 +83,13 @@ static int fsi_hdmi_remove(struct platform_device *pdev)
83 83
84static struct fsi_hdmi_data fsi2_a_hdmi = { 84static struct fsi_hdmi_data fsi2_a_hdmi = {
85 .cpu_dai = "fsia-dai", 85 .cpu_dai = "fsia-dai",
86 .card = "FSI2A (SH MOBILE HDMI)", 86 .card = "FSI2A-HDMI",
87 .id = FSI_PORT_A, 87 .id = FSI_PORT_A,
88}; 88};
89 89
90static struct fsi_hdmi_data fsi2_b_hdmi = { 90static struct fsi_hdmi_data fsi2_b_hdmi = {
91 .cpu_dai = "fsib-dai", 91 .cpu_dai = "fsib-dai",
92 .card = "FSI2B (SH MOBILE HDMI)", 92 .card = "FSI2B-HDMI",
93 .id = FSI_PORT_B, 93 .id = FSI_PORT_B,
94}; 94};
95 95