aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpica/Makefile27
-rw-r--r--drivers/acpi/acpica/aclocal.h7
-rw-r--r--drivers/acpi/bus.c2
-rw-r--r--drivers/acpi/processor_idle.c42
-rw-r--r--drivers/acpi/processor_throttling.c25
-rw-r--r--drivers/acpi/video.c38
-rw-r--r--drivers/ata/ata_piix.c18
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-eh.c34
-rw-r--r--drivers/ata/libata-scsi.c38
-rw-r--r--drivers/ata/pata_pdc202xx_old.c6
-rw-r--r--drivers/ata/sata_fsl.c15
-rw-r--r--drivers/ata/sata_mv.c69
-rw-r--r--drivers/ata/sata_sx4.c180
-rw-r--r--drivers/base/platform.c22
-rw-r--r--drivers/block/xen-blkfront.c10
-rw-r--r--drivers/cdrom/viocd.c2
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/sysrq.c4
-rw-r--r--drivers/crypto/ixp4xx_crypto.c33
-rw-r--r--drivers/crypto/padlock-aes.c2
-rw-r--r--drivers/dma/dmaengine.c17
-rw-r--r--drivers/dma/dmatest.c4
-rw-r--r--drivers/dma/ioat_dma.c45
-rw-r--r--drivers/dma/ipu/ipu_idmac.c7
-rw-r--r--drivers/gpu/drm/Kconfig7
-rw-r--r--drivers/gpu/drm/drm_bufs.c8
-rw-r--r--drivers/gpu/drm/drm_drv.c2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c13
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h11
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c9
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h1
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c24
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c31
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h4
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c17
-rw-r--r--drivers/gpu/drm/i915/intel_i2c.c17
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c54
-rw-r--r--drivers/gpu/drm/i915/intel_modes.c6
-rw-r--r--drivers/hid/hid-ids.h5
-rw-r--r--drivers/hid/usbhid/hid-core.c2
-rw-r--r--drivers/hid/usbhid/hid-quirks.c3
-rw-r--r--drivers/hwmon/asus_atk0110.c2
-rw-r--r--drivers/hwmon/w83781d.c3
-rw-r--r--drivers/i2c/busses/Kconfig2
-rw-r--r--drivers/i2c/busses/i2c-cpm.c16
-rw-r--r--drivers/i2c/busses/i2c-mpc.c34
-rw-r--r--drivers/i2c/busses/i2c-pxa.c6
-rw-r--r--drivers/ide/icside.c2
-rw-r--r--drivers/ide/ide-tape.c6
-rw-r--r--drivers/ide/piix.c1
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c2
-rw-r--r--drivers/infiniband/hw/mlx4/mlx4_ib.h1
-rw-r--r--drivers/infiniband/hw/mlx4/mr.c10
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c2
-rw-r--r--drivers/input/ff-memless.c2
-rw-r--r--drivers/input/joydev.c8
-rw-r--r--drivers/input/keyboard/atkbd.c16
-rw-r--r--drivers/input/serio/ambakmi.c2
-rw-r--r--drivers/input/touchscreen/tsc2007.c5
-rw-r--r--drivers/isdn/capi/capifs.c11
-rw-r--r--drivers/media/radio/radio-sf16fmi.c2
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c2
-rw-r--r--drivers/media/video/cafe_ccic.c1
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c9
-rw-r--r--drivers/media/video/ivtv/ivtv-gpio.c4
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c5
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-yuv.c3
-rw-r--r--drivers/media/video/ivtv/ivtvfb.c3
-rw-r--r--drivers/media/video/uvc/uvc_driver.c9
-rw-r--r--drivers/media/video/uvc/uvc_video.c2
-rw-r--r--drivers/media/video/v4l2-ioctl.c45
-rw-r--r--drivers/media/video/zoran/zoran_driver.c28
-rw-r--r--drivers/mfd/pcf50633-core.c2
-rw-r--r--drivers/mfd/wm8350-core.c8
-rw-r--r--drivers/mmc/host/mmci.c2
-rw-r--r--drivers/mtd/devices/m25p80.c26
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c2
-rw-r--r--drivers/mtd/mtdcore.c18
-rw-r--r--drivers/mtd/mtdsuper.c3
-rw-r--r--drivers/net/arm/ixp4xx_eth.c31
-rw-r--r--drivers/net/benet/be.h14
-rw-r--r--drivers/net/benet/be_main.c10
-rw-r--r--drivers/net/bnx2.c6
-rw-r--r--drivers/net/bonding/bond_3ad.c11
-rw-r--r--drivers/net/bonding/bond_main.c8
-rw-r--r--drivers/net/igb/igb_main.c12
-rw-r--r--drivers/net/meth.c27
-rw-r--r--drivers/net/mlx4/en_cq.c4
-rw-r--r--drivers/net/mlx4/en_rx.c1
-rw-r--r--drivers/net/mv643xx_eth.c41
-rw-r--r--drivers/net/vxge/vxge-traffic.c2
-rw-r--r--drivers/net/wan/ixp4xx_hss.c4
-rw-r--r--drivers/net/wimax/i2400m/rx.c5
-rw-r--r--drivers/net/wireless/airo.c10
-rw-r--r--drivers/net/wireless/ath5k/base.c22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187.h57
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c13
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_rtl8225.c8
-rw-r--r--drivers/pci/intel-iommu.c13
-rw-r--r--drivers/pci/msi.c8
-rw-r--r--drivers/pci/pcie/aer/aerdrv.h3
-rw-r--r--drivers/pci/pcie/portdrv_pci.c2
-rw-r--r--drivers/platform/x86/asus-laptop.c6
-rw-r--r--drivers/platform/x86/eeepc-laptop.c47
-rw-r--r--drivers/pnp/pnpacpi/core.c8
-rw-r--r--drivers/regulator/da903x.c2
-rw-r--r--drivers/rtc/rtc-pl030.c2
-rw-r--r--drivers/rtc/rtc-pl031.c2
-rw-r--r--drivers/rtc/rtc-twl4030.c4
-rw-r--r--drivers/scsi/osd/osd_uld.c20
-rw-r--r--drivers/serial/amba-pl010.c2
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/serial/nwpserial.c4
-rw-r--r--drivers/spi/pxa2xx_spi.c3
-rw-r--r--drivers/staging/comedi/TODO1
-rw-r--r--drivers/staging/rt2870/rt2870.h1
-rw-r--r--drivers/staging/rtl8187se/r8180.h2
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c46
-rw-r--r--drivers/staging/winbond/wbusb.c9
-rw-r--r--drivers/thermal/thermal_sys.c8
-rw-r--r--drivers/usb/Makefile2
-rw-r--r--drivers/usb/atm/cxacru.c10
-rw-r--r--drivers/usb/gadget/usbstring.c6
-rw-r--r--drivers/usb/serial/ftdi_sio.c27
-rw-r--r--drivers/usb/serial/ftdi_sio.h6
-rw-r--r--drivers/usb/storage/unusual_devs.h5
-rw-r--r--drivers/video/Kconfig23
-rw-r--r--drivers/video/amba-clcd.c2
-rw-r--r--drivers/video/gbefb.c14
-rw-r--r--drivers/video/omap/dispc.c14
-rw-r--r--drivers/video/omap/rfbi.c8
-rw-r--r--drivers/video/via/viafbdev.c6
142 files changed, 1248 insertions, 571 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index 17e50824a6f1..72ac28da14e3 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -5,40 +5,43 @@
5ccflags-y := -Os 5ccflags-y := -Os
6ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT 6ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT
7 7
8obj-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ 8# use acpi.o to put all files here into acpi.o modparam namespace
9obj-y += acpi.o
10
11acpi-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \
9 dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ 12 dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \
10 dsinit.o 13 dsinit.o
11 14
12obj-y += evevent.o evregion.o evsci.o evxfevnt.o \ 15acpi-y += evevent.o evregion.o evsci.o evxfevnt.o \
13 evmisc.o evrgnini.o evxface.o evxfregn.o \ 16 evmisc.o evrgnini.o evxface.o evxfregn.o \
14 evgpe.o evgpeblk.o 17 evgpe.o evgpeblk.o
15 18
16obj-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\ 19acpi-y += exconfig.o exfield.o exnames.o exoparg6.o exresolv.o exstorob.o\
17 exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\ 20 exconvrt.o exfldio.o exoparg1.o exprep.o exresop.o exsystem.o\
18 excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \ 21 excreate.o exmisc.o exoparg2.o exregion.o exstore.o exutils.o \
19 exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o 22 exdump.o exmutex.o exoparg3.o exresnte.o exstoren.o
20 23
21obj-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o 24acpi-y += hwacpi.o hwgpe.o hwregs.o hwsleep.o hwxface.o hwvalid.o
22 25
23obj-$(ACPI_FUTURE_USAGE) += hwtimer.o 26acpi-$(ACPI_FUTURE_USAGE) += hwtimer.o
24 27
25obj-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \ 28acpi-y += nsaccess.o nsload.o nssearch.o nsxfeval.o \
26 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \ 29 nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
27 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \ 30 nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
28 nsparse.o nspredef.o 31 nsparse.o nspredef.o
29 32
30obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o 33acpi-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
31 34
32obj-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \ 35acpi-y += psargs.o psparse.o psloop.o pstree.o pswalk.o \
33 psopcode.o psscope.o psutils.o psxface.o 36 psopcode.o psscope.o psutils.o psxface.o
34 37
35obj-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \ 38acpi-y += rsaddr.o rscreate.o rsinfo.o rsio.o rslist.o rsmisc.o rsxface.o \
36 rscalc.o rsirq.o rsmemory.o rsutils.o 39 rscalc.o rsirq.o rsmemory.o rsutils.o
37 40
38obj-$(ACPI_FUTURE_USAGE) += rsdump.o 41acpi-$(ACPI_FUTURE_USAGE) += rsdump.o
39 42
40obj-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o 43acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o
41 44
42obj-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ 45acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \
43 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ 46 utcopy.o utdelete.o utglobal.o utmath.o utobject.o \
44 utstate.o utmutex.o utobject.o utresrc.o utlock.o 47 utstate.o utmutex.o utobject.o utresrc.o utlock.o
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 772ee5c4ccca..2ec394a328e9 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -787,7 +787,12 @@ struct acpi_bit_register_info {
787 787
788/* For control registers, both ignored and reserved bits must be preserved */ 788/* For control registers, both ignored and reserved bits must be preserved */
789 789
790#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0201 /* Bits 9, 0(SCI_EN) */ 790/*
791 * The ACPI spec says to ignore PM1_CTL.SCI_EN (bit 0)
792 * but we need to be able to write ACPI_BITREG_SCI_ENABLE directly
793 * as a BIOS workaround on some machines.
794 */
795#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bits 9 */
791#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ 796#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
792#define ACPI_PM1_CONTROL_PRESERVED_BITS \ 797#define ACPI_PM1_CONTROL_PRESERVED_BITS \
793 (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) 798 (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index e8f7b64e92da..ae862f1798dc 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -312,7 +312,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
312 end: 312 end:
313 if (result) 313 if (result)
314 printk(KERN_WARNING PREFIX 314 printk(KERN_WARNING PREFIX
315 "Transitioning device [%s] to D%d\n", 315 "Device [%s] failed to transition to D%d\n",
316 device->pnp.bus_id, state); 316 device->pnp.bus_id, state);
317 else { 317 else {
318 device->power.state = state; 318 device->power.state = state;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f7ca8c55956b..72069ba5f1ed 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -202,21 +202,44 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
202 * Suspend / resume control 202 * Suspend / resume control
203 */ 203 */
204static int acpi_idle_suspend; 204static int acpi_idle_suspend;
205static u32 saved_bm_rld;
206
207static void acpi_idle_bm_rld_save(void)
208{
209 acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld);
210}
211static void acpi_idle_bm_rld_restore(void)
212{
213 u32 resumed_bm_rld;
214
215 acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);
216
217 if (resumed_bm_rld != saved_bm_rld)
218 acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
219}
205 220
206int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) 221int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
207{ 222{
223 if (acpi_idle_suspend == 1)
224 return 0;
225
226 acpi_idle_bm_rld_save();
208 acpi_idle_suspend = 1; 227 acpi_idle_suspend = 1;
209 return 0; 228 return 0;
210} 229}
211 230
212int acpi_processor_resume(struct acpi_device * device) 231int acpi_processor_resume(struct acpi_device * device)
213{ 232{
233 if (acpi_idle_suspend == 0)
234 return 0;
235
236 acpi_idle_bm_rld_restore();
214 acpi_idle_suspend = 0; 237 acpi_idle_suspend = 0;
215 return 0; 238 return 0;
216} 239}
217 240
218#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) 241#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
219static int tsc_halts_in_c(int state) 242static void tsc_check_state(int state)
220{ 243{
221 switch (boot_cpu_data.x86_vendor) { 244 switch (boot_cpu_data.x86_vendor) {
222 case X86_VENDOR_AMD: 245 case X86_VENDOR_AMD:
@@ -226,13 +249,17 @@ static int tsc_halts_in_c(int state)
226 * C/P/S0/S1 states when this bit is set. 249 * C/P/S0/S1 states when this bit is set.
227 */ 250 */
228 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 251 if (boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
229 return 0; 252 return;
230 253
231 /*FALL THROUGH*/ 254 /*FALL THROUGH*/
232 default: 255 default:
233 return state > ACPI_STATE_C1; 256 /* TSC could halt in idle, so notify users */
257 if (state > ACPI_STATE_C1)
258 mark_tsc_unstable("TSC halts in idle");
234 } 259 }
235} 260}
261#else
262static void tsc_check_state(int state) { return; }
236#endif 263#endif
237 264
238static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 265static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
@@ -578,14 +605,9 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
578 605
579 pr->power.timer_broadcast_on_state = INT_MAX; 606 pr->power.timer_broadcast_on_state = INT_MAX;
580 607
581 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { 608 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
582 struct acpi_processor_cx *cx = &pr->power.states[i]; 609 struct acpi_processor_cx *cx = &pr->power.states[i];
583 610
584#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
585 /* TSC could halt in idle, so notify users */
586 if (tsc_halts_in_c(cx->type))
587 mark_tsc_unstable("TSC halts in idle");;
588#endif
589 switch (cx->type) { 611 switch (cx->type) {
590 case ACPI_STATE_C1: 612 case ACPI_STATE_C1:
591 cx->valid = 1; 613 cx->valid = 1;
@@ -603,6 +625,8 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
603 acpi_timer_check_state(i, pr, cx); 625 acpi_timer_check_state(i, pr, cx);
604 break; 626 break;
605 } 627 }
628 if (cx->valid)
629 tsc_check_state(cx->type);
606 630
607 if (cx->valid) 631 if (cx->valid)
608 working++; 632 working++;
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index d0d1f4d50434..7f16f5f8e7d3 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -45,6 +45,14 @@
45#define _COMPONENT ACPI_PROCESSOR_COMPONENT 45#define _COMPONENT ACPI_PROCESSOR_COMPONENT
46ACPI_MODULE_NAME("processor_throttling"); 46ACPI_MODULE_NAME("processor_throttling");
47 47
48/* ignore_tpc:
49 * 0 -> acpi processor driver doesn't ignore _TPC values
50 * 1 -> acpi processor driver ignores _TPC values
51 */
52static int ignore_tpc;
53module_param(ignore_tpc, int, 0644);
54MODULE_PARM_DESC(ignore_tpc, "Disable broken BIOS _TPC throttling support");
55
48struct throttling_tstate { 56struct throttling_tstate {
49 unsigned int cpu; /* cpu nr */ 57 unsigned int cpu; /* cpu nr */
50 int target_state; /* target T-state */ 58 int target_state; /* target T-state */
@@ -283,6 +291,10 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
283 291
284 if (!pr) 292 if (!pr)
285 return -EINVAL; 293 return -EINVAL;
294
295 if (ignore_tpc)
296 goto end;
297
286 status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); 298 status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc);
287 if (ACPI_FAILURE(status)) { 299 if (ACPI_FAILURE(status)) {
288 if (status != AE_NOT_FOUND) { 300 if (status != AE_NOT_FOUND) {
@@ -290,6 +302,8 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr)
290 } 302 }
291 return -ENODEV; 303 return -ENODEV;
292 } 304 }
305
306end:
293 pr->throttling_platform_limit = (int)tpc; 307 pr->throttling_platform_limit = (int)tpc;
294 return 0; 308 return 0;
295} 309}
@@ -302,6 +316,9 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
302 struct acpi_processor_limit *limit; 316 struct acpi_processor_limit *limit;
303 int target_state; 317 int target_state;
304 318
319 if (ignore_tpc)
320 return 0;
321
305 result = acpi_processor_get_platform_limit(pr); 322 result = acpi_processor_get_platform_limit(pr);
306 if (result) { 323 if (result) {
307 /* Throttling Limit is unsupported */ 324 /* Throttling Limit is unsupported */
@@ -821,6 +838,14 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
821 ret = acpi_read_throttling_status(pr, &value); 838 ret = acpi_read_throttling_status(pr, &value);
822 if (ret >= 0) { 839 if (ret >= 0) {
823 state = acpi_get_throttling_state(pr, value); 840 state = acpi_get_throttling_state(pr, value);
841 if (state == -1) {
842 ACPI_WARNING((AE_INFO,
843 "Invalid throttling state, reset\n"));
844 state = 0;
845 ret = acpi_processor_set_throttling(pr, state);
846 if (ret)
847 return ret;
848 }
824 pr->throttling.state = state; 849 pr->throttling.state = state;
825 } 850 }
826 851
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d7ff61c0d571..810cca90ca7f 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -538,6 +538,41 @@ acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
538 return -EINVAL; 538 return -EINVAL;
539} 539}
540 540
541/*
542 * For some buggy _BQC methods, we need to add a constant value to
543 * the _BQC return value to get the actual current brightness level
544 */
545
546static int bqc_offset_aml_bug_workaround;
547static int __init video_set_bqc_offset(const struct dmi_system_id *d)
548{
549 bqc_offset_aml_bug_workaround = 9;
550 return 0;
551}
552
553static struct dmi_system_id video_dmi_table[] __initdata = {
554 /*
555 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
556 */
557 {
558 .callback = video_set_bqc_offset,
559 .ident = "Acer Aspire 5720",
560 .matches = {
561 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
562 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
563 },
564 },
565 {
566 .callback = video_set_bqc_offset,
567 .ident = "Acer Aspire 5710Z",
568 .matches = {
569 DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
570 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710Z"),
571 },
572 },
573 {}
574};
575
541static int 576static int
542acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, 577acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
543 unsigned long long *level) 578 unsigned long long *level)
@@ -557,6 +592,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
557 *level = device->brightness->levels[*level + 2]; 592 *level = device->brightness->levels[*level + 2];
558 593
559 } 594 }
595 *level += bqc_offset_aml_bug_workaround;
560 device->brightness->curr = *level; 596 device->brightness->curr = *level;
561 return 0; 597 return 0;
562 } else { 598 } else {
@@ -2290,6 +2326,8 @@ EXPORT_SYMBOL(acpi_video_register);
2290 2326
2291static int __init acpi_video_init(void) 2327static int __init acpi_video_init(void)
2292{ 2328{
2329 dmi_check_system(video_dmi_table);
2330
2293 if (intel_opregion_present()) 2331 if (intel_opregion_present())
2294 return 0; 2332 return 0;
2295 2333
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 942d14ac8792..d51a17c0f59b 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -72,6 +72,7 @@
72 * ICH2 spec c #20 - IDE PRD must not cross a 64K boundary 72 * ICH2 spec c #20 - IDE PRD must not cross a 64K boundary
73 * and must be dword aligned 73 * and must be dword aligned
74 * ICH2 spec c #24 - UDMA mode 4,5 t85/86 should be 6ns not 3.3 74 * ICH2 spec c #24 - UDMA mode 4,5 t85/86 should be 6ns not 3.3
75 * ICH7 errata #16 - MWDMA1 timings are incorrect
75 * 76 *
76 * Should have been BIOS fixed: 77 * Should have been BIOS fixed:
77 * 450NX: errata #19 - DMA hangs on old 450NX 78 * 450NX: errata #19 - DMA hangs on old 450NX
@@ -94,7 +95,7 @@
94#include <linux/dmi.h> 95#include <linux/dmi.h>
95 96
96#define DRV_NAME "ata_piix" 97#define DRV_NAME "ata_piix"
97#define DRV_VERSION "2.12" 98#define DRV_VERSION "2.13"
98 99
99enum { 100enum {
100 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 101 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
@@ -136,6 +137,7 @@ enum piix_controller_ids {
136 ich_pata_33, /* ICH up to UDMA 33 only */ 137 ich_pata_33, /* ICH up to UDMA 33 only */
137 ich_pata_66, /* ICH up to 66 Mhz */ 138 ich_pata_66, /* ICH up to 66 Mhz */
138 ich_pata_100, /* ICH up to UDMA 100 */ 139 ich_pata_100, /* ICH up to UDMA 100 */
140 ich_pata_100_nomwdma1, /* ICH up to UDMA 100 but with no MWDMA1*/
139 ich5_sata, 141 ich5_sata,
140 ich6_sata, 142 ich6_sata,
141 ich6m_sata, 143 ich6m_sata,
@@ -216,8 +218,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
216 /* ICH6 (and 6) (i915) UDMA 100 */ 218 /* ICH6 (and 6) (i915) UDMA 100 */
217 { 0x8086, 0x266F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, 219 { 0x8086, 0x266F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
218 /* ICH7/7-R (i945, i975) UDMA 100*/ 220 /* ICH7/7-R (i945, i975) UDMA 100*/
219 { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, 221 { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100_nomwdma1 },
220 { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, 222 { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100_nomwdma1 },
221 /* ICH8 Mobile PATA Controller */ 223 /* ICH8 Mobile PATA Controller */
222 { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, 224 { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
223 225
@@ -487,6 +489,15 @@ static struct ata_port_info piix_port_info[] = {
487 .port_ops = &ich_pata_ops, 489 .port_ops = &ich_pata_ops,
488 }, 490 },
489 491
492 [ich_pata_100_nomwdma1] =
493 {
494 .flags = PIIX_PATA_FLAGS | PIIX_FLAG_CHECKINTR,
495 .pio_mask = ATA_PIO4,
496 .mwdma_mask = ATA_MWDMA2_ONLY,
497 .udma_mask = ATA_UDMA5,
498 .port_ops = &ich_pata_ops,
499 },
500
490 [ich5_sata] = 501 [ich5_sata] =
491 { 502 {
492 .flags = PIIX_SATA_FLAGS, 503 .flags = PIIX_SATA_FLAGS,
@@ -594,6 +605,7 @@ static const struct ich_laptop ich_laptop[] = {
594 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */ 605 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */
595 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */ 606 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */
596 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ 607 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */
608 { 0x27df, 0x104d, 0x900e }, /* ICH7 on Sony TZ-90 */
597 /* end marker */ 609 /* end marker */
598 { 0, } 610 { 0, }
599}; 611};
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 17c5d48a75d2..c9242301cfa1 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4091,7 +4091,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
4091 4091
4092 /* fail early if !ATA && !ATAPI to avoid issuing [P]IDENTIFY to PMP */ 4092 /* fail early if !ATA && !ATAPI to avoid issuing [P]IDENTIFY to PMP */
4093 if (ata_class_enabled(new_class) && 4093 if (ata_class_enabled(new_class) &&
4094 new_class != ATA_DEV_ATA && new_class != ATA_DEV_ATAPI) { 4094 new_class != ATA_DEV_ATA &&
4095 new_class != ATA_DEV_ATAPI &&
4096 new_class != ATA_DEV_SEMB) {
4095 ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n", 4097 ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n",
4096 dev->class, new_class); 4098 dev->class, new_class);
4097 rc = -ENODEV; 4099 rc = -ENODEV;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 01831312c360..94919ad03df1 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2783,6 +2783,12 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2783 } else if (dev->class == ATA_DEV_UNKNOWN && 2783 } else if (dev->class == ATA_DEV_UNKNOWN &&
2784 ehc->tries[dev->devno] && 2784 ehc->tries[dev->devno] &&
2785 ata_class_enabled(ehc->classes[dev->devno])) { 2785 ata_class_enabled(ehc->classes[dev->devno])) {
2786 /* Temporarily set dev->class, it will be
2787 * permanently set once all configurations are
2788 * complete. This is necessary because new
2789 * device configuration is done in two
2790 * separate loops.
2791 */
2786 dev->class = ehc->classes[dev->devno]; 2792 dev->class = ehc->classes[dev->devno];
2787 2793
2788 if (dev->class == ATA_DEV_PMP) 2794 if (dev->class == ATA_DEV_PMP)
@@ -2790,6 +2796,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2790 else 2796 else
2791 rc = ata_dev_read_id(dev, &dev->class, 2797 rc = ata_dev_read_id(dev, &dev->class,
2792 readid_flags, dev->id); 2798 readid_flags, dev->id);
2799
2800 /* read_id might have changed class, store and reset */
2801 ehc->classes[dev->devno] = dev->class;
2802 dev->class = ATA_DEV_UNKNOWN;
2803
2793 switch (rc) { 2804 switch (rc) {
2794 case 0: 2805 case 0:
2795 /* clear error info accumulated during probe */ 2806 /* clear error info accumulated during probe */
@@ -2799,13 +2810,11 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2799 case -ENOENT: 2810 case -ENOENT:
2800 /* IDENTIFY was issued to non-existent 2811 /* IDENTIFY was issued to non-existent
2801 * device. No need to reset. Just 2812 * device. No need to reset. Just
2802 * thaw and kill the device. 2813 * thaw and ignore the device.
2803 */ 2814 */
2804 ata_eh_thaw_port(ap); 2815 ata_eh_thaw_port(ap);
2805 dev->class = ATA_DEV_UNKNOWN;
2806 break; 2816 break;
2807 default: 2817 default:
2808 dev->class = ATA_DEV_UNKNOWN;
2809 goto err; 2818 goto err;
2810 } 2819 }
2811 } 2820 }
@@ -2826,11 +2835,15 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2826 dev->class == ATA_DEV_PMP) 2835 dev->class == ATA_DEV_PMP)
2827 continue; 2836 continue;
2828 2837
2838 dev->class = ehc->classes[dev->devno];
2839
2829 ehc->i.flags |= ATA_EHI_PRINTINFO; 2840 ehc->i.flags |= ATA_EHI_PRINTINFO;
2830 rc = ata_dev_configure(dev); 2841 rc = ata_dev_configure(dev);
2831 ehc->i.flags &= ~ATA_EHI_PRINTINFO; 2842 ehc->i.flags &= ~ATA_EHI_PRINTINFO;
2832 if (rc) 2843 if (rc) {
2844 dev->class = ATA_DEV_UNKNOWN;
2833 goto err; 2845 goto err;
2846 }
2834 2847
2835 spin_lock_irqsave(ap->lock, flags); 2848 spin_lock_irqsave(ap->lock, flags);
2836 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; 2849 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
@@ -3494,6 +3507,8 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
3494 */ 3507 */
3495static void ata_eh_handle_port_resume(struct ata_port *ap) 3508static void ata_eh_handle_port_resume(struct ata_port *ap)
3496{ 3509{
3510 struct ata_link *link;
3511 struct ata_device *dev;
3497 unsigned long flags; 3512 unsigned long flags;
3498 int rc = 0; 3513 int rc = 0;
3499 3514
@@ -3508,6 +3523,17 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
3508 3523
3509 WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED)); 3524 WARN_ON(!(ap->pflags & ATA_PFLAG_SUSPENDED));
3510 3525
3526 /*
3527 * Error timestamps are in jiffies which doesn't run while
3528 * suspended and PHY events during resume isn't too uncommon.
3529 * When the two are combined, it can lead to unnecessary speed
3530 * downs if the machine is suspended and resumed repeatedly.
3531 * Clear error history.
3532 */
3533 ata_for_each_link(link, ap, HOST_FIRST)
3534 ata_for_each_dev(dev, link, ALL)
3535 ata_ering_clear(&dev->ering);
3536
3511 ata_acpi_set_state(ap, PMSG_ON); 3537 ata_acpi_set_state(ap, PMSG_ON);
3512 3538
3513 if (ap->ops->port_resume) 3539 if (ap->ops->port_resume)
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 2733b0c90b75..342316064e9f 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -313,7 +313,7 @@ ata_scsi_em_message_show(struct device *dev, struct device_attribute *attr,
313 return ap->ops->em_show(ap, buf); 313 return ap->ops->em_show(ap, buf);
314 return -EINVAL; 314 return -EINVAL;
315} 315}
316DEVICE_ATTR(em_message, S_IRUGO | S_IWUGO, 316DEVICE_ATTR(em_message, S_IRUGO | S_IWUSR,
317 ata_scsi_em_message_show, ata_scsi_em_message_store); 317 ata_scsi_em_message_show, ata_scsi_em_message_store);
318EXPORT_SYMBOL_GPL(dev_attr_em_message); 318EXPORT_SYMBOL_GPL(dev_attr_em_message);
319 319
@@ -366,7 +366,7 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr,
366 } 366 }
367 return -EINVAL; 367 return -EINVAL;
368} 368}
369DEVICE_ATTR(sw_activity, S_IWUGO | S_IRUGO, ata_scsi_activity_show, 369DEVICE_ATTR(sw_activity, S_IWUSR | S_IRUGO, ata_scsi_activity_show,
370 ata_scsi_activity_store); 370 ata_scsi_activity_store);
371EXPORT_SYMBOL_GPL(dev_attr_sw_activity); 371EXPORT_SYMBOL_GPL(dev_attr_sw_activity);
372 372
@@ -2142,13 +2142,14 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
2142 2142
2143static unsigned int ata_scsiop_inq_b1(struct ata_scsi_args *args, u8 *rbuf) 2143static unsigned int ata_scsiop_inq_b1(struct ata_scsi_args *args, u8 *rbuf)
2144{ 2144{
2145 int form_factor = ata_id_form_factor(args->id);
2146 int media_rotation_rate = ata_id_rotation_rate(args->id);
2147
2145 rbuf[1] = 0xb1; 2148 rbuf[1] = 0xb1;
2146 rbuf[3] = 0x3c; 2149 rbuf[3] = 0x3c;
2147 if (ata_id_major_version(args->id) > 7) { 2150 rbuf[4] = media_rotation_rate >> 8;
2148 rbuf[4] = args->id[217] >> 8; 2151 rbuf[5] = media_rotation_rate;
2149 rbuf[5] = args->id[217]; 2152 rbuf[7] = form_factor;
2150 rbuf[7] = args->id[168] & 0xf;
2151 }
2152 2153
2153 return 0; 2154 return 0;
2154} 2155}
@@ -2376,7 +2377,23 @@ saving_not_supp:
2376 */ 2377 */
2377static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) 2378static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
2378{ 2379{
2379 u64 last_lba = args->dev->n_sectors - 1; /* LBA of the last block */ 2380 struct ata_device *dev = args->dev;
2381 u64 last_lba = dev->n_sectors - 1; /* LBA of the last block */
2382 u8 log_per_phys = 0;
2383 u16 lowest_aligned = 0;
2384 u16 word_106 = dev->id[106];
2385 u16 word_209 = dev->id[209];
2386
2387 if ((word_106 & 0xc000) == 0x4000) {
2388 /* Number and offset of logical sectors per physical sector */
2389 if (word_106 & (1 << 13))
2390 log_per_phys = word_106 & 0xf;
2391 if ((word_209 & 0xc000) == 0x4000) {
2392 u16 first = dev->id[209] & 0x3fff;
2393 if (first > 0)
2394 lowest_aligned = (1 << log_per_phys) - first;
2395 }
2396 }
2380 2397
2381 VPRINTK("ENTER\n"); 2398 VPRINTK("ENTER\n");
2382 2399
@@ -2407,6 +2424,11 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
2407 /* sector size */ 2424 /* sector size */
2408 rbuf[10] = ATA_SECT_SIZE >> 8; 2425 rbuf[10] = ATA_SECT_SIZE >> 8;
2409 rbuf[11] = ATA_SECT_SIZE & 0xff; 2426 rbuf[11] = ATA_SECT_SIZE & 0xff;
2427
2428 rbuf[12] = 0;
2429 rbuf[13] = log_per_phys;
2430 rbuf[14] = (lowest_aligned >> 8) & 0x3f;
2431 rbuf[15] = lowest_aligned;
2410 } 2432 }
2411 2433
2412 return 0; 2434 return 0;
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index 5fedb3d4032b..2f3c9bed63d9 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -2,7 +2,7 @@
2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer 2 * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer
3 * (C) 2005 Red Hat Inc 3 * (C) 2005 Red Hat Inc
4 * Alan Cox <alan@lxorguk.ukuu.org.uk> 4 * Alan Cox <alan@lxorguk.ukuu.org.uk>
5 * (C) 2007 Bartlomiej Zolnierkiewicz 5 * (C) 2007,2009 Bartlomiej Zolnierkiewicz
6 * 6 *
7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c 7 * Based in part on linux/drivers/ide/pci/pdc202xx_old.c
8 * 8 *
@@ -158,7 +158,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
158 u32 len; 158 u32 len;
159 159
160 /* Check we keep host level locking here */ 160 /* Check we keep host level locking here */
161 if (adev->dma_mode >= XFER_UDMA_2) 161 if (adev->dma_mode > XFER_UDMA_2)
162 iowrite8(ioread8(clock) | sel66, clock); 162 iowrite8(ioread8(clock) | sel66, clock);
163 else 163 else
164 iowrite8(ioread8(clock) & ~sel66, clock); 164 iowrite8(ioread8(clock) & ~sel66, clock);
@@ -212,7 +212,7 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
212 iowrite8(ioread8(clock) & ~sel66, clock); 212 iowrite8(ioread8(clock) & ~sel66, clock);
213 } 213 }
214 /* Flip back to 33Mhz for PIO */ 214 /* Flip back to 33Mhz for PIO */
215 if (adev->dma_mode >= XFER_UDMA_2) 215 if (adev->dma_mode > XFER_UDMA_2)
216 iowrite8(ioread8(clock) & ~sel66, clock); 216 iowrite8(ioread8(clock) & ~sel66, clock);
217 ata_bmdma_stop(qc); 217 ata_bmdma_stop(qc);
218 pdc202xx_set_piomode(ap, adev); 218 pdc202xx_set_piomode(ap, adev);
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index c2e90e1fece0..36b8629203be 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -205,6 +205,7 @@ struct cmdhdr_tbl_entry {
205 * Description information bitdefs 205 * Description information bitdefs
206 */ 206 */
207enum { 207enum {
208 CMD_DESC_RES = (1 << 11),
208 VENDOR_SPECIFIC_BIST = (1 << 10), 209 VENDOR_SPECIFIC_BIST = (1 << 10),
209 CMD_DESC_SNOOP_ENABLE = (1 << 9), 210 CMD_DESC_SNOOP_ENABLE = (1 << 9),
210 FPDMA_QUEUED_CMD = (1 << 8), 211 FPDMA_QUEUED_CMD = (1 << 8),
@@ -332,13 +333,14 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
332 dma_addr_t sg_addr = sg_dma_address(sg); 333 dma_addr_t sg_addr = sg_dma_address(sg);
333 u32 sg_len = sg_dma_len(sg); 334 u32 sg_len = sg_dma_len(sg);
334 335
335 VPRINTK("SATA FSL : fill_sg, sg_addr = 0x%x, sg_len = %d\n", 336 VPRINTK("SATA FSL : fill_sg, sg_addr = 0x%llx, sg_len = %d\n",
336 sg_addr, sg_len); 337 (unsigned long long)sg_addr, sg_len);
337 338
338 /* warn if each s/g element is not dword aligned */ 339 /* warn if each s/g element is not dword aligned */
339 if (sg_addr & 0x03) 340 if (sg_addr & 0x03)
340 ata_port_printk(qc->ap, KERN_ERR, 341 ata_port_printk(qc->ap, KERN_ERR,
341 "s/g addr unaligned : 0x%x\n", sg_addr); 342 "s/g addr unaligned : 0x%llx\n",
343 (unsigned long long)sg_addr);
342 if (sg_len & 0x03) 344 if (sg_len & 0x03)
343 ata_port_printk(qc->ap, KERN_ERR, 345 ata_port_printk(qc->ap, KERN_ERR,
344 "s/g len unaligned : 0x%x\n", sg_len); 346 "s/g len unaligned : 0x%x\n", sg_len);
@@ -387,7 +389,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
387 void __iomem *hcr_base = host_priv->hcr_base; 389 void __iomem *hcr_base = host_priv->hcr_base;
388 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base); 390 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
389 struct command_desc *cd; 391 struct command_desc *cd;
390 u32 desc_info = CMD_DESC_SNOOP_ENABLE; 392 u32 desc_info = CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE;
391 u32 num_prde = 0; 393 u32 num_prde = 0;
392 u32 ttl_dwords = 0; 394 u32 ttl_dwords = 0;
393 dma_addr_t cd_paddr; 395 dma_addr_t cd_paddr;
@@ -840,7 +842,7 @@ issue_srst:
840 842
841 /* device reset/SRST is a control register update FIS, uses tag0 */ 843 /* device reset/SRST is a control register update FIS, uses tag0 */
842 sata_fsl_setup_cmd_hdr_entry(pp, 0, 844 sata_fsl_setup_cmd_hdr_entry(pp, 0,
843 SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5); 845 SRST_CMD | CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
844 846
845 tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */ 847 tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */
846 ata_tf_to_fis(&tf, pmp, 0, cfis); 848 ata_tf_to_fis(&tf, pmp, 0, cfis);
@@ -886,7 +888,8 @@ issue_srst:
886 * using ATA signature D2H register FIS to the host controller. 888 * using ATA signature D2H register FIS to the host controller.
887 */ 889 */
888 890
889 sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5); 891 sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE,
892 0, 0, 5);
890 893
891 tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */ 894 tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */
892 ata_tf_to_fis(&tf, pmp, 0, cfis); 895 ata_tf_to_fis(&tf, pmp, 0, cfis);
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 870dcfd82357..23714aefb825 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -293,6 +293,10 @@ enum {
293 FISCFG_WAIT_DEV_ERR = (1 << 8), /* wait for host on DevErr */ 293 FISCFG_WAIT_DEV_ERR = (1 << 8), /* wait for host on DevErr */
294 FISCFG_SINGLE_SYNC = (1 << 16), /* SYNC on DMA activation */ 294 FISCFG_SINGLE_SYNC = (1 << 16), /* SYNC on DMA activation */
295 295
296 PHY_MODE9_GEN2 = 0x398,
297 PHY_MODE9_GEN1 = 0x39c,
298 PHYCFG_OFS = 0x3a0, /* only in 65n devices */
299
296 MV5_PHY_MODE = 0x74, 300 MV5_PHY_MODE = 0x74,
297 MV5_LTMODE = 0x30, 301 MV5_LTMODE = 0x30,
298 MV5_PHY_CTL = 0x0C, 302 MV5_PHY_CTL = 0x0C,
@@ -609,6 +613,8 @@ static int mv_soc_reset_hc(struct mv_host_priv *hpriv,
609static void mv_soc_reset_flash(struct mv_host_priv *hpriv, 613static void mv_soc_reset_flash(struct mv_host_priv *hpriv,
610 void __iomem *mmio); 614 void __iomem *mmio);
611static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio); 615static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio);
616static void mv_soc_65n_phy_errata(struct mv_host_priv *hpriv,
617 void __iomem *mmio, unsigned int port);
612static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio); 618static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio);
613static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio, 619static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio,
614 unsigned int port_no); 620 unsigned int port_no);
@@ -807,6 +813,14 @@ static const struct mv_hw_ops mv_soc_ops = {
807 .reset_bus = mv_soc_reset_bus, 813 .reset_bus = mv_soc_reset_bus,
808}; 814};
809 815
816static const struct mv_hw_ops mv_soc_65n_ops = {
817 .phy_errata = mv_soc_65n_phy_errata,
818 .enable_leds = mv_soc_enable_leds,
819 .reset_hc = mv_soc_reset_hc,
820 .reset_flash = mv_soc_reset_flash,
821 .reset_bus = mv_soc_reset_bus,
822};
823
810/* 824/*
811 * Functions 825 * Functions
812 */ 826 */
@@ -3397,6 +3411,53 @@ static void mv_soc_reset_bus(struct ata_host *host, void __iomem *mmio)
3397 return; 3411 return;
3398} 3412}
3399 3413
3414static void mv_soc_65n_phy_errata(struct mv_host_priv *hpriv,
3415 void __iomem *mmio, unsigned int port)
3416{
3417 void __iomem *port_mmio = mv_port_base(mmio, port);
3418 u32 reg;
3419
3420 reg = readl(port_mmio + PHY_MODE3);
3421 reg &= ~(0x3 << 27); /* SELMUPF (bits 28:27) to 1 */
3422 reg |= (0x1 << 27);
3423 reg &= ~(0x3 << 29); /* SELMUPI (bits 30:29) to 1 */
3424 reg |= (0x1 << 29);
3425 writel(reg, port_mmio + PHY_MODE3);
3426
3427 reg = readl(port_mmio + PHY_MODE4);
3428 reg &= ~0x1; /* SATU_OD8 (bit 0) to 0, reserved bit 16 must be set */
3429 reg |= (0x1 << 16);
3430 writel(reg, port_mmio + PHY_MODE4);
3431
3432 reg = readl(port_mmio + PHY_MODE9_GEN2);
3433 reg &= ~0xf; /* TXAMP[3:0] (bits 3:0) to 8 */
3434 reg |= 0x8;
3435 reg &= ~(0x1 << 14); /* TXAMP[4] (bit 14) to 0 */
3436 writel(reg, port_mmio + PHY_MODE9_GEN2);
3437
3438 reg = readl(port_mmio + PHY_MODE9_GEN1);
3439 reg &= ~0xf; /* TXAMP[3:0] (bits 3:0) to 8 */
3440 reg |= 0x8;
3441 reg &= ~(0x1 << 14); /* TXAMP[4] (bit 14) to 0 */
3442 writel(reg, port_mmio + PHY_MODE9_GEN1);
3443}
3444
3445/**
3446 * soc_is_65 - check if the soc is 65 nano device
3447 *
3448 * Detect the type of the SoC, this is done by reading the PHYCFG_OFS
3449 * register, this register should contain non-zero value and it exists only
3450 * in the 65 nano devices, when reading it from older devices we get 0.
3451 */
3452static bool soc_is_65n(struct mv_host_priv *hpriv)
3453{
3454 void __iomem *port0_mmio = mv_port_base(hpriv->base, 0);
3455
3456 if (readl(port0_mmio + PHYCFG_OFS))
3457 return true;
3458 return false;
3459}
3460
3400static void mv_setup_ifcfg(void __iomem *port_mmio, int want_gen2i) 3461static void mv_setup_ifcfg(void __iomem *port_mmio, int want_gen2i)
3401{ 3462{
3402 u32 ifcfg = readl(port_mmio + SATA_IFCFG); 3463 u32 ifcfg = readl(port_mmio + SATA_IFCFG);
@@ -3737,7 +3798,10 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3737 } 3798 }
3738 break; 3799 break;
3739 case chip_soc: 3800 case chip_soc:
3740 hpriv->ops = &mv_soc_ops; 3801 if (soc_is_65n(hpriv))
3802 hpriv->ops = &mv_soc_65n_ops;
3803 else
3804 hpriv->ops = &mv_soc_ops;
3741 hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE | 3805 hp_flags |= MV_HP_FLAG_SOC | MV_HP_GEN_IIE |
3742 MV_HP_ERRATA_60X1C0; 3806 MV_HP_ERRATA_60X1C0;
3743 break; 3807 break;
@@ -3800,7 +3864,8 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
3800 n_hc = mv_get_hc_count(host->ports[0]->flags); 3864 n_hc = mv_get_hc_count(host->ports[0]->flags);
3801 3865
3802 for (port = 0; port < host->n_ports; port++) 3866 for (port = 0; port < host->n_ports; port++)
3803 hpriv->ops->read_preamp(hpriv, port, mmio); 3867 if (hpriv->ops->read_preamp)
3868 hpriv->ops->read_preamp(hpriv, port, mmio);
3804 3869
3805 rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc); 3870 rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc);
3806 if (rc) 3871 if (rc)
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index dce3dccced3f..eb05a3c82a9e 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -213,8 +213,9 @@ struct pdc_host_priv {
213 213
214 214
215static int pdc_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 215static int pdc_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
216static void pdc_eng_timeout(struct ata_port *ap); 216static void pdc_error_handler(struct ata_port *ap);
217static void pdc_20621_phy_reset(struct ata_port *ap); 217static void pdc_freeze(struct ata_port *ap);
218static void pdc_thaw(struct ata_port *ap);
218static int pdc_port_start(struct ata_port *ap); 219static int pdc_port_start(struct ata_port *ap);
219static void pdc20621_qc_prep(struct ata_queued_cmd *qc); 220static void pdc20621_qc_prep(struct ata_queued_cmd *qc);
220static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 221static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
@@ -233,6 +234,10 @@ static void pdc20621_put_to_dimm(struct ata_host *host,
233 void *psource, u32 offset, u32 size); 234 void *psource, u32 offset, u32 size);
234static void pdc20621_irq_clear(struct ata_port *ap); 235static void pdc20621_irq_clear(struct ata_port *ap);
235static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc); 236static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc);
237static int pdc_softreset(struct ata_link *link, unsigned int *class,
238 unsigned long deadline);
239static void pdc_post_internal_cmd(struct ata_queued_cmd *qc);
240static int pdc_check_atapi_dma(struct ata_queued_cmd *qc);
236 241
237 242
238static struct scsi_host_template pdc_sata_sht = { 243static struct scsi_host_template pdc_sata_sht = {
@@ -243,20 +248,24 @@ static struct scsi_host_template pdc_sata_sht = {
243 248
244/* TODO: inherit from base port_ops after converting to new EH */ 249/* TODO: inherit from base port_ops after converting to new EH */
245static struct ata_port_operations pdc_20621_ops = { 250static struct ata_port_operations pdc_20621_ops = {
246 .sff_tf_load = pdc_tf_load_mmio, 251 .inherits = &ata_sff_port_ops,
247 .sff_tf_read = ata_sff_tf_read, 252
248 .sff_check_status = ata_sff_check_status, 253 .check_atapi_dma = pdc_check_atapi_dma,
249 .sff_exec_command = pdc_exec_command_mmio,
250 .sff_dev_select = ata_sff_dev_select,
251 .phy_reset = pdc_20621_phy_reset,
252 .qc_prep = pdc20621_qc_prep, 254 .qc_prep = pdc20621_qc_prep,
253 .qc_issue = pdc20621_qc_issue, 255 .qc_issue = pdc20621_qc_issue,
254 .qc_fill_rtf = ata_sff_qc_fill_rtf, 256
255 .sff_data_xfer = ata_sff_data_xfer, 257 .freeze = pdc_freeze,
256 .eng_timeout = pdc_eng_timeout, 258 .thaw = pdc_thaw,
257 .sff_irq_clear = pdc20621_irq_clear, 259 .softreset = pdc_softreset,
258 .sff_irq_on = ata_sff_irq_on, 260 .error_handler = pdc_error_handler,
261 .lost_interrupt = ATA_OP_NULL,
262 .post_internal_cmd = pdc_post_internal_cmd,
263
259 .port_start = pdc_port_start, 264 .port_start = pdc_port_start,
265
266 .sff_tf_load = pdc_tf_load_mmio,
267 .sff_exec_command = pdc_exec_command_mmio,
268 .sff_irq_clear = pdc20621_irq_clear,
260}; 269};
261 270
262static const struct ata_port_info pdc_port_info[] = { 271static const struct ata_port_info pdc_port_info[] = {
@@ -310,14 +319,6 @@ static int pdc_port_start(struct ata_port *ap)
310 return 0; 319 return 0;
311} 320}
312 321
313static void pdc_20621_phy_reset(struct ata_port *ap)
314{
315 VPRINTK("ENTER\n");
316 ap->cbl = ATA_CBL_SATA;
317 ata_port_probe(ap);
318 ata_bus_reset(ap);
319}
320
321static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf, 322static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
322 unsigned int portno, 323 unsigned int portno,
323 unsigned int total_len) 324 unsigned int total_len)
@@ -686,8 +687,11 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
686static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc) 687static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc)
687{ 688{
688 switch (qc->tf.protocol) { 689 switch (qc->tf.protocol) {
689 case ATA_PROT_DMA:
690 case ATA_PROT_NODATA: 690 case ATA_PROT_NODATA:
691 if (qc->tf.flags & ATA_TFLAG_POLLING)
692 break;
693 /*FALLTHROUGH*/
694 case ATA_PROT_DMA:
691 pdc20621_packet_start(qc); 695 pdc20621_packet_start(qc);
692 return 0; 696 return 0;
693 697
@@ -786,12 +790,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
786 790
787static void pdc20621_irq_clear(struct ata_port *ap) 791static void pdc20621_irq_clear(struct ata_port *ap)
788{ 792{
789 struct ata_host *host = ap->host; 793 ioread8(ap->ioaddr.status_addr);
790 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
791
792 mmio += PDC_CHIP0_OFS;
793
794 readl(mmio + PDC_20621_SEQMASK);
795} 794}
796 795
797static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance) 796static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
@@ -859,46 +858,119 @@ static irqreturn_t pdc20621_interrupt(int irq, void *dev_instance)
859 return IRQ_RETVAL(handled); 858 return IRQ_RETVAL(handled);
860} 859}
861 860
862static void pdc_eng_timeout(struct ata_port *ap) 861static void pdc_freeze(struct ata_port *ap)
863{ 862{
864 u8 drv_stat; 863 void __iomem *mmio = ap->ioaddr.cmd_addr;
865 struct ata_host *host = ap->host; 864 u32 tmp;
866 struct ata_queued_cmd *qc;
867 unsigned long flags;
868 865
869 DPRINTK("ENTER\n"); 866 /* FIXME: if all 4 ATA engines are stopped, also stop HDMA engine */
870 867
871 spin_lock_irqsave(&host->lock, flags); 868 tmp = readl(mmio + PDC_CTLSTAT);
869 tmp |= PDC_MASK_INT;
870 tmp &= ~PDC_DMA_ENABLE;
871 writel(tmp, mmio + PDC_CTLSTAT);
872 readl(mmio + PDC_CTLSTAT); /* flush */
873}
872 874
873 qc = ata_qc_from_tag(ap, ap->link.active_tag); 875static void pdc_thaw(struct ata_port *ap)
876{
877 void __iomem *mmio = ap->ioaddr.cmd_addr;
878 u32 tmp;
874 879
875 switch (qc->tf.protocol) { 880 /* FIXME: start HDMA engine, if zero ATA engines running */
876 case ATA_PROT_DMA:
877 case ATA_PROT_NODATA:
878 ata_port_printk(ap, KERN_ERR, "command timeout\n");
879 qc->err_mask |= __ac_err_mask(ata_wait_idle(ap));
880 break;
881 881
882 default: 882 /* clear IRQ */
883 drv_stat = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 883 ioread8(ap->ioaddr.status_addr);
884 884
885 ata_port_printk(ap, KERN_ERR, 885 /* turn IRQ back on */
886 "unknown timeout, cmd 0x%x stat 0x%x\n", 886 tmp = readl(mmio + PDC_CTLSTAT);
887 qc->tf.command, drv_stat); 887 tmp &= ~PDC_MASK_INT;
888 writel(tmp, mmio + PDC_CTLSTAT);
889 readl(mmio + PDC_CTLSTAT); /* flush */
890}
888 891
889 qc->err_mask |= ac_err_mask(drv_stat); 892static void pdc_reset_port(struct ata_port *ap)
890 break; 893{
894 void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT;
895 unsigned int i;
896 u32 tmp;
897
898 /* FIXME: handle HDMA copy engine */
899
900 for (i = 11; i > 0; i--) {
901 tmp = readl(mmio);
902 if (tmp & PDC_RESET)
903 break;
904
905 udelay(100);
906
907 tmp |= PDC_RESET;
908 writel(tmp, mmio);
891 } 909 }
892 910
893 spin_unlock_irqrestore(&host->lock, flags); 911 tmp &= ~PDC_RESET;
894 ata_eh_qc_complete(qc); 912 writel(tmp, mmio);
895 DPRINTK("EXIT\n"); 913 readl(mmio); /* flush */
914}
915
916static int pdc_softreset(struct ata_link *link, unsigned int *class,
917 unsigned long deadline)
918{
919 pdc_reset_port(link->ap);
920 return ata_sff_softreset(link, class, deadline);
921}
922
923static void pdc_error_handler(struct ata_port *ap)
924{
925 if (!(ap->pflags & ATA_PFLAG_FROZEN))
926 pdc_reset_port(ap);
927
928 ata_std_error_handler(ap);
929}
930
931static void pdc_post_internal_cmd(struct ata_queued_cmd *qc)
932{
933 struct ata_port *ap = qc->ap;
934
935 /* make DMA engine forget about the failed command */
936 if (qc->flags & ATA_QCFLAG_FAILED)
937 pdc_reset_port(ap);
938}
939
940static int pdc_check_atapi_dma(struct ata_queued_cmd *qc)
941{
942 u8 *scsicmd = qc->scsicmd->cmnd;
943 int pio = 1; /* atapi dma off by default */
944
945 /* Whitelist commands that may use DMA. */
946 switch (scsicmd[0]) {
947 case WRITE_12:
948 case WRITE_10:
949 case WRITE_6:
950 case READ_12:
951 case READ_10:
952 case READ_6:
953 case 0xad: /* READ_DVD_STRUCTURE */
954 case 0xbe: /* READ_CD */
955 pio = 0;
956 }
957 /* -45150 (FFFF4FA2) to -1 (FFFFFFFF) shall use PIO mode */
958 if (scsicmd[0] == WRITE_10) {
959 unsigned int lba =
960 (scsicmd[2] << 24) |
961 (scsicmd[3] << 16) |
962 (scsicmd[4] << 8) |
963 scsicmd[5];
964 if (lba >= 0xFFFF4FA2)
965 pio = 1;
966 }
967 return pio;
896} 968}
897 969
898static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 970static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
899{ 971{
900 WARN_ON(tf->protocol == ATA_PROT_DMA || 972 WARN_ON(tf->protocol == ATA_PROT_DMA ||
901 tf->protocol == ATA_PROT_NODATA); 973 tf->protocol == ATAPI_PROT_DMA);
902 ata_sff_tf_load(ap, tf); 974 ata_sff_tf_load(ap, tf);
903} 975}
904 976
@@ -906,7 +978,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
906static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 978static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
907{ 979{
908 WARN_ON(tf->protocol == ATA_PROT_DMA || 980 WARN_ON(tf->protocol == ATA_PROT_DMA ||
909 tf->protocol == ATA_PROT_NODATA); 981 tf->protocol == ATAPI_PROT_DMA);
910 ata_sff_exec_command(ap, tf); 982 ata_sff_exec_command(ap, tf);
911} 983}
912 984
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index b5b6c973a2e0..8b4708e06244 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -217,7 +217,6 @@ int platform_device_add_data(struct platform_device *pdev, const void *data,
217 if (d) { 217 if (d) {
218 memcpy(d, data, size); 218 memcpy(d, data, size);
219 pdev->dev.platform_data = d; 219 pdev->dev.platform_data = d;
220 pdev->platform_data = d;
221 } 220 }
222 return d ? 0 : -ENOMEM; 221 return d ? 0 : -ENOMEM;
223} 222}
@@ -247,21 +246,6 @@ int platform_device_add(struct platform_device *pdev)
247 else 246 else
248 dev_set_name(&pdev->dev, pdev->name); 247 dev_set_name(&pdev->dev, pdev->name);
249 248
250 /* We will remove platform_data field from struct device
251 * if all platform devices pass its platform specific data
252 * from platform_device. The conversion is going to be a
253 * long time, so we allow the two cases coexist to make
254 * this kind of fix more easily*/
255 if (pdev->platform_data && pdev->dev.platform_data) {
256 printk(KERN_ERR
257 "%s: use which platform_data?\n",
258 dev_name(&pdev->dev));
259 } else if (pdev->platform_data) {
260 pdev->dev.platform_data = pdev->platform_data;
261 } else if (pdev->dev.platform_data) {
262 pdev->platform_data = pdev->dev.platform_data;
263 }
264
265 for (i = 0; i < pdev->num_resources; i++) { 249 for (i = 0; i < pdev->num_resources; i++) {
266 struct resource *p, *r = &pdev->resource[i]; 250 struct resource *p, *r = &pdev->resource[i];
267 251
@@ -1028,7 +1012,7 @@ static __initdata LIST_HEAD(early_platform_device_list);
1028 1012
1029/** 1013/**
1030 * early_platform_driver_register 1014 * early_platform_driver_register
1031 * @edrv: early_platform driver structure 1015 * @epdrv: early_platform driver structure
1032 * @buf: string passed from early_param() 1016 * @buf: string passed from early_param()
1033 */ 1017 */
1034int __init early_platform_driver_register(struct early_platform_driver *epdrv, 1018int __init early_platform_driver_register(struct early_platform_driver *epdrv,
@@ -1112,7 +1096,7 @@ void __init early_platform_driver_register_all(char *class_str)
1112 1096
1113/** 1097/**
1114 * early_platform_match 1098 * early_platform_match
1115 * @edrv: early platform driver structure 1099 * @epdrv: early platform driver structure
1116 * @id: id to match against 1100 * @id: id to match against
1117 */ 1101 */
1118static __init struct platform_device * 1102static __init struct platform_device *
@@ -1130,7 +1114,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id)
1130 1114
1131/** 1115/**
1132 * early_platform_left 1116 * early_platform_left
1133 * @edrv: early platform driver structure 1117 * @epdrv: early platform driver structure
1134 * @id: return true if id or above exists 1118 * @id: return true if id or above exists
1135 */ 1119 */
1136static __init int early_platform_left(struct early_platform_driver *epdrv, 1120static __init int early_platform_left(struct early_platform_driver *epdrv,
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 8f905089b72b..a6cbf7b808e6 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -934,8 +934,6 @@ static void blkfront_closing(struct xenbus_device *dev)
934 934
935 spin_lock_irqsave(&blkif_io_lock, flags); 935 spin_lock_irqsave(&blkif_io_lock, flags);
936 936
937 del_gendisk(info->gd);
938
939 /* No more blkif_request(). */ 937 /* No more blkif_request(). */
940 blk_stop_queue(info->rq); 938 blk_stop_queue(info->rq);
941 939
@@ -949,6 +947,8 @@ static void blkfront_closing(struct xenbus_device *dev)
949 blk_cleanup_queue(info->rq); 947 blk_cleanup_queue(info->rq);
950 info->rq = NULL; 948 info->rq = NULL;
951 949
950 del_gendisk(info->gd);
951
952 out: 952 out:
953 xenbus_frontend_closed(dev); 953 xenbus_frontend_closed(dev);
954} 954}
@@ -977,8 +977,10 @@ static void backend_changed(struct xenbus_device *dev,
977 break; 977 break;
978 978
979 case XenbusStateClosing: 979 case XenbusStateClosing:
980 if (info->gd == NULL) 980 if (info->gd == NULL) {
981 xenbus_dev_fatal(dev, -ENODEV, "gd is NULL"); 981 xenbus_frontend_closed(dev);
982 break;
983 }
982 bd = bdget_disk(info->gd, 0); 984 bd = bdget_disk(info->gd, 0);
983 if (bd == NULL) 985 if (bd == NULL)
984 xenbus_dev_fatal(dev, -ENODEV, "bdget failed"); 986 xenbus_dev_fatal(dev, -ENODEV, "bdget failed");
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index 13929356135c..9b1624e0ddeb 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -587,7 +587,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
587 struct device_node *node = vdev->dev.archdata.of_node; 587 struct device_node *node = vdev->dev.archdata.of_node;
588 588
589 deviceno = vdev->unit_address; 589 deviceno = vdev->unit_address;
590 if (deviceno > VIOCD_MAX_CD) 590 if (deviceno >= VIOCD_MAX_CD)
591 return -ENODEV; 591 return -ENODEV;
592 if (!node) 592 if (!node)
593 return -ENODEV; 593 return -ENODEV;
diff --git a/drivers/char/random.c b/drivers/char/random.c
index b2ced39d76b2..8c7444857a4b 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1673,7 +1673,7 @@ unsigned int get_random_int(void)
1673 int ret; 1673 int ret;
1674 1674
1675 keyptr = get_keyptr(); 1675 keyptr = get_keyptr();
1676 hash[0] += current->pid + jiffies + get_cycles() + (int)(long)&ret; 1676 hash[0] += current->pid + jiffies + get_cycles();
1677 1677
1678 ret = half_md4_transform(hash, keyptr->secret); 1678 ret = half_md4_transform(hash, keyptr->secret);
1679 put_cpu_var(get_random_int_hash); 1679 put_cpu_var(get_random_int_hash);
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index b0a6a3e51924..d6a807f4077d 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -406,7 +406,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
406 &sysrq_showlocks_op, /* d */ 406 &sysrq_showlocks_op, /* d */
407 &sysrq_term_op, /* e */ 407 &sysrq_term_op, /* e */
408 &sysrq_moom_op, /* f */ 408 &sysrq_moom_op, /* f */
409 /* g: May be registered by ppc for kgdb */ 409 /* g: May be registered for the kernel debugger */
410 NULL, /* g */ 410 NULL, /* g */
411 NULL, /* h - reserved for help */ 411 NULL, /* h - reserved for help */
412 &sysrq_kill_op, /* i */ 412 &sysrq_kill_op, /* i */
@@ -431,7 +431,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
431 &sysrq_sync_op, /* s */ 431 &sysrq_sync_op, /* s */
432 &sysrq_showstate_op, /* t */ 432 &sysrq_showstate_op, /* t */
433 &sysrq_mountro_op, /* u */ 433 &sysrq_mountro_op, /* u */
434 /* v: May be registered at init time by SMP VOYAGER */ 434 /* v: May be registered for frame buffer console restore */
435 NULL, /* v */ 435 NULL, /* v */
436 &sysrq_showstate_blocked_op, /* w */ 436 &sysrq_showstate_blocked_op, /* w */
437 /* x: May be registered on ppc/powerpc for xmon */ 437 /* x: May be registered on ppc/powerpc for xmon */
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index f9f05d7a707d..6c6656d3b1e2 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -415,6 +415,7 @@ static void crypto_done_action(unsigned long arg)
415static int init_ixp_crypto(void) 415static int init_ixp_crypto(void)
416{ 416{
417 int ret = -ENODEV; 417 int ret = -ENODEV;
418 u32 msg[2] = { 0, 0 };
418 419
419 if (! ( ~(*IXP4XX_EXP_CFG2) & (IXP4XX_FEATURE_HASH | 420 if (! ( ~(*IXP4XX_EXP_CFG2) & (IXP4XX_FEATURE_HASH |
420 IXP4XX_FEATURE_AES | IXP4XX_FEATURE_DES))) { 421 IXP4XX_FEATURE_AES | IXP4XX_FEATURE_DES))) {
@@ -426,9 +427,35 @@ static int init_ixp_crypto(void)
426 return ret; 427 return ret;
427 428
428 if (!npe_running(npe_c)) { 429 if (!npe_running(npe_c)) {
429 npe_load_firmware(npe_c, npe_name(npe_c), dev); 430 ret = npe_load_firmware(npe_c, npe_name(npe_c), dev);
431 if (ret) {
432 return ret;
433 }
434 if (npe_recv_message(npe_c, msg, "STATUS_MSG"))
435 goto npe_error;
436 } else {
437 if (npe_send_message(npe_c, msg, "STATUS_MSG"))
438 goto npe_error;
439
440 if (npe_recv_message(npe_c, msg, "STATUS_MSG"))
441 goto npe_error;
430 } 442 }
431 443
444 switch ((msg[1]>>16) & 0xff) {
445 case 3:
446 printk(KERN_WARNING "Firmware of %s lacks AES support\n",
447 npe_name(npe_c));
448 support_aes = 0;
449 break;
450 case 4:
451 case 5:
452 support_aes = 1;
453 break;
454 default:
455 printk(KERN_ERR "Firmware of %s lacks crypto support\n",
456 npe_name(npe_c));
457 return -ENODEV;
458 }
432 /* buffer_pool will also be used to sometimes store the hmac, 459 /* buffer_pool will also be used to sometimes store the hmac,
433 * so assure it is large enough 460 * so assure it is large enough
434 */ 461 */
@@ -459,6 +486,10 @@ static int init_ixp_crypto(void)
459 486
460 qmgr_enable_irq(RECV_QID); 487 qmgr_enable_irq(RECV_QID);
461 return 0; 488 return 0;
489
490npe_error:
491 printk(KERN_ERR "%s not responding\n", npe_name(npe_c));
492 ret = -EIO;
462err: 493err:
463 if (ctx_pool) 494 if (ctx_pool)
464 dma_pool_destroy(ctx_pool); 495 dma_pool_destroy(ctx_pool);
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 3f0fdd18255d..856b3cc25583 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -489,4 +489,4 @@ MODULE_DESCRIPTION("VIA PadLock AES algorithm support");
489MODULE_LICENSE("GPL"); 489MODULE_LICENSE("GPL");
490MODULE_AUTHOR("Michal Ludvig"); 490MODULE_AUTHOR("Michal Ludvig");
491 491
492MODULE_ALIAS("aes-all"); 492MODULE_ALIAS("aes");
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 92438e9dacc3..5a87384ea4ff 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -804,11 +804,14 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest,
804 dma_addr_t dma_dest, dma_src; 804 dma_addr_t dma_dest, dma_src;
805 dma_cookie_t cookie; 805 dma_cookie_t cookie;
806 int cpu; 806 int cpu;
807 unsigned long flags;
807 808
808 dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); 809 dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE);
809 dma_dest = dma_map_single(dev->dev, dest, len, DMA_FROM_DEVICE); 810 dma_dest = dma_map_single(dev->dev, dest, len, DMA_FROM_DEVICE);
810 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, 811 flags = DMA_CTRL_ACK |
811 DMA_CTRL_ACK); 812 DMA_COMPL_SRC_UNMAP_SINGLE |
813 DMA_COMPL_DEST_UNMAP_SINGLE;
814 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
812 815
813 if (!tx) { 816 if (!tx) {
814 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE); 817 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
@@ -850,11 +853,12 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page,
850 dma_addr_t dma_dest, dma_src; 853 dma_addr_t dma_dest, dma_src;
851 dma_cookie_t cookie; 854 dma_cookie_t cookie;
852 int cpu; 855 int cpu;
856 unsigned long flags;
853 857
854 dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); 858 dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE);
855 dma_dest = dma_map_page(dev->dev, page, offset, len, DMA_FROM_DEVICE); 859 dma_dest = dma_map_page(dev->dev, page, offset, len, DMA_FROM_DEVICE);
856 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, 860 flags = DMA_CTRL_ACK | DMA_COMPL_SRC_UNMAP_SINGLE;
857 DMA_CTRL_ACK); 861 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
858 862
859 if (!tx) { 863 if (!tx) {
860 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE); 864 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
@@ -898,12 +902,13 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg,
898 dma_addr_t dma_dest, dma_src; 902 dma_addr_t dma_dest, dma_src;
899 dma_cookie_t cookie; 903 dma_cookie_t cookie;
900 int cpu; 904 int cpu;
905 unsigned long flags;
901 906
902 dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); 907 dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE);
903 dma_dest = dma_map_page(dev->dev, dest_pg, dest_off, len, 908 dma_dest = dma_map_page(dev->dev, dest_pg, dest_off, len,
904 DMA_FROM_DEVICE); 909 DMA_FROM_DEVICE);
905 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, 910 flags = DMA_CTRL_ACK;
906 DMA_CTRL_ACK); 911 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
907 912
908 if (!tx) { 913 if (!tx) {
909 dma_unmap_page(dev->dev, dma_src, len, DMA_TO_DEVICE); 914 dma_unmap_page(dev->dev, dma_src, len, DMA_TO_DEVICE);
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index a27c0fb1bc11..fb7da5141e96 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -531,9 +531,7 @@ static int __init dmatest_init(void)
531 chan = dma_request_channel(mask, filter, NULL); 531 chan = dma_request_channel(mask, filter, NULL);
532 if (chan) { 532 if (chan) {
533 err = dmatest_add_channel(chan); 533 err = dmatest_add_channel(chan);
534 if (err == 0) 534 if (err) {
535 continue;
536 else {
537 dma_release_channel(chan); 535 dma_release_channel(chan);
538 break; /* add_channel failed, punt */ 536 break; /* add_channel failed, punt */
539 } 537 }
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index e4fc33c1c32f..1955ee8d6d20 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -1063,22 +1063,31 @@ static void ioat_dma_cleanup_tasklet(unsigned long data)
1063static void 1063static void
1064ioat_dma_unmap(struct ioat_dma_chan *ioat_chan, struct ioat_desc_sw *desc) 1064ioat_dma_unmap(struct ioat_dma_chan *ioat_chan, struct ioat_desc_sw *desc)
1065{ 1065{
1066 /* 1066 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
1067 * yes we are unmapping both _page and _single 1067 if (desc->async_tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
1068 * alloc'd regions with unmap_page. Is this 1068 pci_unmap_single(ioat_chan->device->pdev,
1069 * *really* that bad? 1069 pci_unmap_addr(desc, dst),
1070 */ 1070 pci_unmap_len(desc, len),
1071 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) 1071 PCI_DMA_FROMDEVICE);
1072 pci_unmap_page(ioat_chan->device->pdev, 1072 else
1073 pci_unmap_addr(desc, dst), 1073 pci_unmap_page(ioat_chan->device->pdev,
1074 pci_unmap_len(desc, len), 1074 pci_unmap_addr(desc, dst),
1075 PCI_DMA_FROMDEVICE); 1075 pci_unmap_len(desc, len),
1076 1076 PCI_DMA_FROMDEVICE);
1077 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) 1077 }
1078 pci_unmap_page(ioat_chan->device->pdev, 1078
1079 pci_unmap_addr(desc, src), 1079 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
1080 pci_unmap_len(desc, len), 1080 if (desc->async_tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
1081 PCI_DMA_TODEVICE); 1081 pci_unmap_single(ioat_chan->device->pdev,
1082 pci_unmap_addr(desc, src),
1083 pci_unmap_len(desc, len),
1084 PCI_DMA_TODEVICE);
1085 else
1086 pci_unmap_page(ioat_chan->device->pdev,
1087 pci_unmap_addr(desc, src),
1088 pci_unmap_len(desc, len),
1089 PCI_DMA_TODEVICE);
1090 }
1082} 1091}
1083 1092
1084/** 1093/**
@@ -1363,6 +1372,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1363 int err = 0; 1372 int err = 0;
1364 struct completion cmp; 1373 struct completion cmp;
1365 unsigned long tmo; 1374 unsigned long tmo;
1375 unsigned long flags;
1366 1376
1367 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); 1377 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
1368 if (!src) 1378 if (!src)
@@ -1392,8 +1402,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1392 DMA_TO_DEVICE); 1402 DMA_TO_DEVICE);
1393 dma_dest = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, 1403 dma_dest = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE,
1394 DMA_FROM_DEVICE); 1404 DMA_FROM_DEVICE);
1405 flags = DMA_COMPL_SRC_UNMAP_SINGLE | DMA_COMPL_DEST_UNMAP_SINGLE;
1395 tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src, 1406 tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src,
1396 IOAT_TEST_SIZE, 0); 1407 IOAT_TEST_SIZE, flags);
1397 if (!tx) { 1408 if (!tx) {
1398 dev_err(&device->pdev->dev, 1409 dev_err(&device->pdev->dev,
1399 "Self-test prep failed, disabling\n"); 1410 "Self-test prep failed, disabling\n");
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index e202a6ce5573..9a5bc1a7389e 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -1272,7 +1272,8 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
1272 /* Other interrupts do not interfere with this channel */ 1272 /* Other interrupts do not interfere with this channel */
1273 spin_lock(&ichan->lock); 1273 spin_lock(&ichan->lock);
1274 if (unlikely(chan_id != IDMAC_SDC_0 && chan_id != IDMAC_SDC_1 && 1274 if (unlikely(chan_id != IDMAC_SDC_0 && chan_id != IDMAC_SDC_1 &&
1275 ((curbuf >> chan_id) & 1) == ichan->active_buffer)) { 1275 ((curbuf >> chan_id) & 1) == ichan->active_buffer &&
1276 !list_is_last(ichan->queue.next, &ichan->queue))) {
1276 int i = 100; 1277 int i = 100;
1277 1278
1278 /* This doesn't help. See comment in ipu_disable_channel() */ 1279 /* This doesn't help. See comment in ipu_disable_channel() */
@@ -1547,7 +1548,7 @@ static irqreturn_t ic_sof_irq(int irq, void *dev_id)
1547 struct idmac_channel *ichan = dev_id; 1548 struct idmac_channel *ichan = dev_id;
1548 printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n", 1549 printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n",
1549 irq, ichan->dma_chan.chan_id); 1550 irq, ichan->dma_chan.chan_id);
1550 disable_irq(irq); 1551 disable_irq_nosync(irq);
1551 return IRQ_HANDLED; 1552 return IRQ_HANDLED;
1552} 1553}
1553 1554
@@ -1556,7 +1557,7 @@ static irqreturn_t ic_eof_irq(int irq, void *dev_id)
1556 struct idmac_channel *ichan = dev_id; 1557 struct idmac_channel *ichan = dev_id;
1557 printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n", 1558 printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n",
1558 irq, ichan->dma_chan.chan_id); 1559 irq, ichan->dma_chan.chan_id);
1559 disable_irq(irq); 1560 disable_irq_nosync(irq);
1560 return IRQ_HANDLED; 1561 return IRQ_HANDLED;
1561} 1562}
1562 1563
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 3a22eb9be378..4cd35d8fd799 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -71,6 +71,7 @@ config DRM_I915
71 select FB_CFB_COPYAREA 71 select FB_CFB_COPYAREA
72 select FB_CFB_IMAGEBLIT 72 select FB_CFB_IMAGEBLIT
73 select FB 73 select FB
74 select FRAMEBUFFER_CONSOLE if !EMBEDDED
74 tristate "i915 driver" 75 tristate "i915 driver"
75 help 76 help
76 Choose this option if you have a system that has Intel 830M, 845G, 77 Choose this option if you have a system that has Intel 830M, 845G,
@@ -83,6 +84,12 @@ config DRM_I915
83config DRM_I915_KMS 84config DRM_I915_KMS
84 bool "Enable modesetting on intel by default" 85 bool "Enable modesetting on intel by default"
85 depends on DRM_I915 86 depends on DRM_I915
87 # i915 KMS depends on ACPI_VIDEO when ACPI is enabled
88 # but for select to work, need to select ACPI_VIDEO's dependencies, ick
89 select VIDEO_OUTPUT_CONTROL if ACPI
90 select BACKLIGHT_CLASS_DEVICE if ACPI
91 select INPUT if ACPI
92 select ACPI_VIDEO if ACPI
86 help 93 help
87 Choose this option if you want kernel modesetting enabled by default, 94 Choose this option if you want kernel modesetting enabled by default,
88 and you have a new enough userspace to support this. Running old 95 and you have a new enough userspace to support this. Running old
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 6d80d17f1e96..0411d912d82a 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -170,6 +170,14 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
170 } 170 }
171 DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", 171 DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
172 (unsigned long long)map->offset, map->size, map->type); 172 (unsigned long long)map->offset, map->size, map->type);
173
174 /* page-align _DRM_SHM maps. They are allocated here so there is no security
175 * hole created by that and it works around various broken drivers that use
176 * a non-aligned quantity to map the SAREA. --BenH
177 */
178 if (map->type == _DRM_SHM)
179 map->size = PAGE_ALIGN(map->size);
180
173 if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) { 181 if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
174 drm_free(map, sizeof(*map), DRM_MEM_MAPS); 182 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
175 return -EINVAL; 183 return -EINVAL;
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index f01def16a669..019b7c578236 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -481,7 +481,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
481 } 481 }
482 retcode = func(dev, kdata, file_priv); 482 retcode = func(dev, kdata, file_priv);
483 483
484 if ((retcode == 0) && (cmd & IOC_OUT)) { 484 if (cmd & IOC_OUT) {
485 if (copy_to_user((void __user *)arg, kdata, 485 if (copy_to_user((void __user *)arg, kdata,
486 _IOC_SIZE(cmd)) != 0) 486 _IOC_SIZE(cmd)) != 0)
487 retcode = -EFAULT; 487 retcode = -EFAULT;
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 051134c56aef..53d544552625 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1011,8 +1011,16 @@ static int i915_load_modeset_init(struct drm_device *dev)
1011 /* Basic memrange allocator for stolen space (aka vram) */ 1011 /* Basic memrange allocator for stolen space (aka vram) */
1012 drm_mm_init(&dev_priv->vram, 0, prealloc_size); 1012 drm_mm_init(&dev_priv->vram, 0, prealloc_size);
1013 1013
1014 /* Let GEM Manage from end of prealloc space to end of aperture */ 1014 /* Let GEM Manage from end of prealloc space to end of aperture.
1015 i915_gem_do_init(dev, prealloc_size, agp_size); 1015 *
1016 * However, leave one page at the end still bound to the scratch page.
1017 * There are a number of places where the hardware apparently
1018 * prefetches past the end of the object, and we've seen multiple
1019 * hangs with the GPU head pointer stuck in a batchbuffer bound
1020 * at the last page of the aperture. One page should be enough to
1021 * keep any prefetching inside of the aperture.
1022 */
1023 i915_gem_do_init(dev, prealloc_size, agp_size - 4096);
1016 1024
1017 ret = i915_gem_init_ringbuffer(dev); 1025 ret = i915_gem_init_ringbuffer(dev);
1018 if (ret) 1026 if (ret)
@@ -1350,6 +1358,7 @@ struct drm_ioctl_desc i915_ioctls[] = {
1350 DRM_IOCTL_DEF(DRM_I915_GEM_SET_TILING, i915_gem_set_tiling, 0), 1358 DRM_IOCTL_DEF(DRM_I915_GEM_SET_TILING, i915_gem_set_tiling, 0),
1351 DRM_IOCTL_DEF(DRM_I915_GEM_GET_TILING, i915_gem_get_tiling, 0), 1359 DRM_IOCTL_DEF(DRM_I915_GEM_GET_TILING, i915_gem_get_tiling, 0),
1352 DRM_IOCTL_DEF(DRM_I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, 0), 1360 DRM_IOCTL_DEF(DRM_I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, 0),
1361 DRM_IOCTL_DEF(DRM_I915_GET_PIPE_FROM_CRTC_ID, intel_get_pipe_from_crtc_id, 0),
1353}; 1362};
1354 1363
1355int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); 1364int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 25065923b8a8..9b149fe824c3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -283,6 +283,7 @@ typedef struct drm_i915_private {
283 u8 saveAR[21]; 283 u8 saveAR[21];
284 u8 saveDACMASK; 284 u8 saveDACMASK;
285 u8 saveCR[37]; 285 u8 saveCR[37];
286 uint64_t saveFENCE[16];
286 287
287 struct { 288 struct {
288 struct drm_mm gtt_space; 289 struct drm_mm gtt_space;
@@ -705,13 +706,8 @@ extern void intel_modeset_cleanup(struct drm_device *dev);
705#define I915_WRITE16(reg, val) writel(val, dev_priv->regs + (reg)) 706#define I915_WRITE16(reg, val) writel(val, dev_priv->regs + (reg))
706#define I915_READ8(reg) readb(dev_priv->regs + (reg)) 707#define I915_READ8(reg) readb(dev_priv->regs + (reg))
707#define I915_WRITE8(reg, val) writeb(val, dev_priv->regs + (reg)) 708#define I915_WRITE8(reg, val) writeb(val, dev_priv->regs + (reg))
708#ifdef writeq
709#define I915_WRITE64(reg, val) writeq(val, dev_priv->regs + (reg)) 709#define I915_WRITE64(reg, val) writeq(val, dev_priv->regs + (reg))
710#else 710#define I915_READ64(reg) readq(dev_priv->regs + (reg))
711#define I915_WRITE64(reg, val) (writel(val, dev_priv->regs + (reg)), \
712 writel(upper_32_bits(val), dev_priv->regs + \
713 (reg) + 4))
714#endif
715#define POSTING_READ(reg) (void)I915_READ(reg) 711#define POSTING_READ(reg) (void)I915_READ(reg)
716 712
717#define I915_VERBOSE 0 713#define I915_VERBOSE 0
@@ -790,7 +786,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
790 (dev)->pci_device == 0x2E22 || \ 786 (dev)->pci_device == 0x2E22 || \
791 (dev)->pci_device == 0x2E32) 787 (dev)->pci_device == 0x2E32)
792 788
793#define IS_I965GM(dev) ((dev)->pci_device == 0x2A02) 789#define IS_I965GM(dev) ((dev)->pci_device == 0x2A02 || \
790 (dev)->pci_device == 0x2A12)
794 791
795#define IS_GM45(dev) ((dev)->pci_device == 0x2A42) 792#define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
796 793
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ee896d91c5bc..b189b49c7602 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1691,11 +1691,20 @@ static int
1691i915_wait_request(struct drm_device *dev, uint32_t seqno) 1691i915_wait_request(struct drm_device *dev, uint32_t seqno)
1692{ 1692{
1693 drm_i915_private_t *dev_priv = dev->dev_private; 1693 drm_i915_private_t *dev_priv = dev->dev_private;
1694 u32 ier;
1694 int ret = 0; 1695 int ret = 0;
1695 1696
1696 BUG_ON(seqno == 0); 1697 BUG_ON(seqno == 0);
1697 1698
1698 if (!i915_seqno_passed(i915_get_gem_seqno(dev), seqno)) { 1699 if (!i915_seqno_passed(i915_get_gem_seqno(dev), seqno)) {
1700 ier = I915_READ(IER);
1701 if (!ier) {
1702 DRM_ERROR("something (likely vbetool) disabled "
1703 "interrupts, re-enabling\n");
1704 i915_driver_irq_preinstall(dev);
1705 i915_driver_irq_postinstall(dev);
1706 }
1707
1699 dev_priv->mm.waiting_gem_seqno = seqno; 1708 dev_priv->mm.waiting_gem_seqno = seqno;
1700 i915_user_irq_get(dev); 1709 i915_user_irq_get(dev);
1701 ret = wait_event_interruptible(dev_priv->irq_queue, 1710 ret = wait_event_interruptible(dev_priv->irq_queue,
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 521194732266..15da44cf21b1 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -526,6 +526,7 @@
526#define DPLLA_INPUT_BUFFER_ENABLE (1 << 0) 526#define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
527#define D_STATE 0x6104 527#define D_STATE 0x6104
528#define CG_2D_DIS 0x6200 528#define CG_2D_DIS 0x6200
529#define DPCUNIT_CLOCK_GATE_DISABLE (1 << 24)
529#define CG_3D_DIS 0x6204 530#define CG_3D_DIS 0x6204
530 531
531/* 532/*
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index d669cc2b42c0..ce8a21344a71 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -349,6 +349,18 @@ int i915_save_state(struct drm_device *dev)
349 for (i = 0; i < 3; i++) 349 for (i = 0; i < 3; i++)
350 dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); 350 dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2));
351 351
352 /* Fences */
353 if (IS_I965G(dev)) {
354 for (i = 0; i < 16; i++)
355 dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8));
356 } else {
357 for (i = 0; i < 8; i++)
358 dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4));
359
360 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
361 for (i = 0; i < 8; i++)
362 dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4));
363 }
352 i915_save_vga(dev); 364 i915_save_vga(dev);
353 365
354 return 0; 366 return 0;
@@ -371,6 +383,18 @@ int i915_restore_state(struct drm_device *dev)
371 /* Display arbitration */ 383 /* Display arbitration */
372 I915_WRITE(DSPARB, dev_priv->saveDSPARB); 384 I915_WRITE(DSPARB, dev_priv->saveDSPARB);
373 385
386 /* Fences */
387 if (IS_I965G(dev)) {
388 for (i = 0; i < 16; i++)
389 I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]);
390 } else {
391 for (i = 0; i < 8; i++)
392 I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]);
393 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
394 for (i = 0; i < 8; i++)
395 I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]);
396 }
397
374 /* Pipe & plane A info */ 398 /* Pipe & plane A info */
375 /* Prime the clock */ 399 /* Prime the clock */
376 if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { 400 if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) {
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 9bdd959260a5..19148c3df637 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -161,7 +161,7 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
161 hotplug_en &= CRT_FORCE_HOTPLUG_MASK; 161 hotplug_en &= CRT_FORCE_HOTPLUG_MASK;
162 hotplug_en |= CRT_HOTPLUG_FORCE_DETECT; 162 hotplug_en |= CRT_HOTPLUG_FORCE_DETECT;
163 163
164 if (IS_GM45(dev)) 164 if (IS_G4X(dev))
165 hotplug_en |= CRT_HOTPLUG_ACTIVATION_PERIOD_64; 165 hotplug_en |= CRT_HOTPLUG_ACTIVATION_PERIOD_64;
166 166
167 hotplug_en |= CRT_HOTPLUG_VOLTAGE_COMPARE_50; 167 hotplug_en |= CRT_HOTPLUG_VOLTAGE_COMPARE_50;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bdcda36953b0..3387cf32f385 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1804,6 +1804,37 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
1804 } 1804 }
1805} 1805}
1806 1806
1807int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
1808 struct drm_file *file_priv)
1809{
1810 drm_i915_private_t *dev_priv = dev->dev_private;
1811 struct drm_i915_get_pipe_from_crtc_id *pipe_from_crtc_id = data;
1812 struct drm_crtc *crtc = NULL;
1813 int pipe = -1;
1814
1815 if (!dev_priv) {
1816 DRM_ERROR("called with no initialization\n");
1817 return -EINVAL;
1818 }
1819
1820 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1821 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1822 if (crtc->base.id == pipe_from_crtc_id->crtc_id) {
1823 pipe = intel_crtc->pipe;
1824 break;
1825 }
1826 }
1827
1828 if (pipe == -1) {
1829 DRM_ERROR("no such CRTC id\n");
1830 return -EINVAL;
1831 }
1832
1833 pipe_from_crtc_id->pipe = pipe;
1834
1835 return 0;
1836}
1837
1807struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe) 1838struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe)
1808{ 1839{
1809 struct drm_crtc *crtc = NULL; 1840 struct drm_crtc *crtc = NULL;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 957daef8edff..cd4b9c5f715e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -109,7 +109,7 @@ struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
109void intel_i2c_destroy(struct intel_i2c_chan *chan); 109void intel_i2c_destroy(struct intel_i2c_chan *chan);
110int intel_ddc_get_modes(struct intel_output *intel_output); 110int intel_ddc_get_modes(struct intel_output *intel_output);
111extern bool intel_ddc_probe(struct intel_output *intel_output); 111extern bool intel_ddc_probe(struct intel_output *intel_output);
112 112void intel_i2c_quirk_set(struct drm_device *dev, bool enable);
113extern void intel_crt_init(struct drm_device *dev); 113extern void intel_crt_init(struct drm_device *dev);
114extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg); 114extern void intel_hdmi_init(struct drm_device *dev, int sdvox_reg);
115extern bool intel_sdvo_init(struct drm_device *dev, int output_device); 115extern bool intel_sdvo_init(struct drm_device *dev, int output_device);
@@ -125,6 +125,8 @@ extern struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
125 125
126extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, 126extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
127 struct drm_crtc *crtc); 127 struct drm_crtc *crtc);
128int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
129 struct drm_file *file_priv);
128extern void intel_wait_for_vblank(struct drm_device *dev); 130extern void intel_wait_for_vblank(struct drm_device *dev);
129extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); 131extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
130extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, 132extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 3e094beecb99..e4652dcdd9bb 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -864,7 +864,7 @@ static void intelfb_sysrq(int dummy1, struct tty_struct *dummy3)
864 864
865static struct sysrq_key_op sysrq_intelfb_restore_op = { 865static struct sysrq_key_op sysrq_intelfb_restore_op = {
866 .handler = intelfb_sysrq, 866 .handler = intelfb_sysrq,
867 .help_msg = "force-fb(G)", 867 .help_msg = "force-fb(V)",
868 .action_msg = "Restore framebuffer console", 868 .action_msg = "Restore framebuffer console",
869}; 869};
870 870
@@ -898,7 +898,7 @@ int intelfb_probe(struct drm_device *dev)
898 ret = intelfb_single_fb_probe(dev); 898 ret = intelfb_single_fb_probe(dev);
899 } 899 }
900 900
901 register_sysrq_key('g', &sysrq_intelfb_restore_op); 901 register_sysrq_key('v', &sysrq_intelfb_restore_op);
902 902
903 return ret; 903 return ret;
904} 904}
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 550374225388..d0983bb93a18 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -155,11 +155,18 @@ intel_hdmi_detect(struct drm_connector *connector)
155 155
156 temp = I915_READ(PORT_HOTPLUG_EN); 156 temp = I915_READ(PORT_HOTPLUG_EN);
157 157
158 I915_WRITE(PORT_HOTPLUG_EN, 158 switch (hdmi_priv->sdvox_reg) {
159 temp | 159 case SDVOB:
160 HDMIB_HOTPLUG_INT_EN | 160 temp |= HDMIB_HOTPLUG_INT_EN;
161 HDMIC_HOTPLUG_INT_EN | 161 break;
162 HDMID_HOTPLUG_INT_EN); 162 case SDVOC:
163 temp |= HDMIC_HOTPLUG_INT_EN;
164 break;
165 default:
166 return connector_status_unknown;
167 }
168
169 I915_WRITE(PORT_HOTPLUG_EN, temp);
163 170
164 POSTING_READ(PORT_HOTPLUG_EN); 171 POSTING_READ(PORT_HOTPLUG_EN);
165 172
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 5ee9d4c25753..f7061f68d050 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -34,6 +34,21 @@
34#include "i915_drm.h" 34#include "i915_drm.h"
35#include "i915_drv.h" 35#include "i915_drv.h"
36 36
37void intel_i2c_quirk_set(struct drm_device *dev, bool enable)
38{
39 struct drm_i915_private *dev_priv = dev->dev_private;
40
41 /* When using bit bashing for I2C, this bit needs to be set to 1 */
42 if (!IS_IGD(dev))
43 return;
44 if (enable)
45 I915_WRITE(CG_2D_DIS,
46 I915_READ(CG_2D_DIS) | DPCUNIT_CLOCK_GATE_DISABLE);
47 else
48 I915_WRITE(CG_2D_DIS,
49 I915_READ(CG_2D_DIS) & (~DPCUNIT_CLOCK_GATE_DISABLE));
50}
51
37/* 52/*
38 * Intel GPIO access functions 53 * Intel GPIO access functions
39 */ 54 */
@@ -153,8 +168,10 @@ struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
153 goto out_free; 168 goto out_free;
154 169
155 /* JJJ: raise SCL and SDA? */ 170 /* JJJ: raise SCL and SDA? */
171 intel_i2c_quirk_set(dev, true);
156 set_data(chan, 1); 172 set_data(chan, 1);
157 set_clock(chan, 1); 173 set_clock(chan, 1);
174 intel_i2c_quirk_set(dev, false);
158 udelay(20); 175 udelay(20);
159 176
160 return chan; 177 return chan;
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 6619f26e46a5..439a86514993 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -384,7 +384,51 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
384 .destroy = intel_lvds_enc_destroy, 384 .destroy = intel_lvds_enc_destroy,
385}; 385};
386 386
387static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id)
388{
389 DRM_DEBUG("Skipping LVDS initialization for %s\n", id->ident);
390 return 1;
391}
387 392
393/* These systems claim to have LVDS, but really don't */
394static const struct dmi_system_id __initdata intel_no_lvds[] = {
395 {
396 .callback = intel_no_lvds_dmi_callback,
397 .ident = "Apple Mac Mini (Core series)",
398 .matches = {
399 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
400 DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
401 },
402 },
403 {
404 .callback = intel_no_lvds_dmi_callback,
405 .ident = "Apple Mac Mini (Core 2 series)",
406 .matches = {
407 DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
408 DMI_MATCH(DMI_PRODUCT_NAME, "Macmini2,1"),
409 },
410 },
411 {
412 .callback = intel_no_lvds_dmi_callback,
413 .ident = "MSI IM-945GSE-A",
414 .matches = {
415 DMI_MATCH(DMI_SYS_VENDOR, "MSI"),
416 DMI_MATCH(DMI_PRODUCT_NAME, "A9830IMS"),
417 },
418 },
419 {
420 .callback = intel_no_lvds_dmi_callback,
421 .ident = "Dell Studio Hybrid",
422 .matches = {
423 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
424 DMI_MATCH(DMI_PRODUCT_NAME, "Studio Hybrid 140g"),
425 },
426 },
427
428 /* FIXME: add a check for the Aopen Mini PC */
429
430 { } /* terminating entry */
431};
388 432
389/** 433/**
390 * intel_lvds_init - setup LVDS connectors on this device 434 * intel_lvds_init - setup LVDS connectors on this device
@@ -404,15 +448,9 @@ void intel_lvds_init(struct drm_device *dev)
404 u32 lvds; 448 u32 lvds;
405 int pipe; 449 int pipe;
406 450
407 /* Blacklist machines that we know falsely report LVDS. */ 451 /* Skip init on machines we know falsely report LVDS */
408 /* FIXME: add a check for the Aopen Mini PC */ 452 if (dmi_check_system(intel_no_lvds))
409
410 /* Apple Mac Mini Core Duo and Mac Mini Core 2 Duo */
411 if(dmi_match(DMI_PRODUCT_NAME, "Macmini1,1") ||
412 dmi_match(DMI_PRODUCT_NAME, "Macmini2,1")) {
413 DRM_DEBUG("Skipping LVDS initialization for Apple Mac Mini\n");
414 return; 453 return;
415 }
416 454
417 intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); 455 intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
418 if (!intel_output) { 456 if (!intel_output) {
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 07d7ec976168..e0910fefce87 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -27,6 +27,7 @@
27#include <linux/fb.h> 27#include <linux/fb.h>
28#include "drmP.h" 28#include "drmP.h"
29#include "intel_drv.h" 29#include "intel_drv.h"
30#include "i915_drv.h"
30 31
31/** 32/**
32 * intel_ddc_probe 33 * intel_ddc_probe
@@ -52,7 +53,10 @@ bool intel_ddc_probe(struct intel_output *intel_output)
52 } 53 }
53 }; 54 };
54 55
56 intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, true);
55 ret = i2c_transfer(&intel_output->ddc_bus->adapter, msgs, 2); 57 ret = i2c_transfer(&intel_output->ddc_bus->adapter, msgs, 2);
58 intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, false);
59
56 if (ret == 2) 60 if (ret == 2)
57 return true; 61 return true;
58 62
@@ -70,8 +74,10 @@ int intel_ddc_get_modes(struct intel_output *intel_output)
70 struct edid *edid; 74 struct edid *edid;
71 int ret = 0; 75 int ret = 0;
72 76
77 intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, true);
73 edid = drm_get_edid(&intel_output->base, 78 edid = drm_get_edid(&intel_output->base,
74 &intel_output->ddc_bus->adapter); 79 &intel_output->ddc_bus->adapter);
80 intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, false);
75 if (edid) { 81 if (edid) {
76 drm_mode_connector_update_edid_property(&intel_output->base, 82 drm_mode_connector_update_edid_property(&intel_output->base,
77 edid); 83 edid);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index aa1b995dd033..4d5ee2bbc62b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -113,6 +113,11 @@
113#define USB_VENDOR_ID_BERKSHIRE 0x0c98 113#define USB_VENDOR_ID_BERKSHIRE 0x0c98
114#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 114#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140
115 115
116#define USB_VENDOR_ID_CH 0x068e
117#define USB_DEVICE_ID_CH_PRO_PEDALS 0x00f2
118#define USB_DEVICE_ID_CH_COMBATSTICK 0x00f4
119#define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff
120
116#define USB_VENDOR_ID_CHERRY 0x046a 121#define USB_VENDOR_ID_CHERRY 0x046a
117#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 122#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
118 123
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 900ce18dd549..ac8049b5f1e9 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -898,7 +898,7 @@ static int usbhid_parse(struct hid_device *hid)
898 goto err; 898 goto err;
899 } 899 }
900 900
901 hid->quirks = quirks; 901 hid->quirks |= quirks;
902 902
903 return 0; 903 return 0;
904err: 904err:
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 4391717d2519..d8f7423f363e 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -50,6 +50,9 @@ static const struct hid_blacklist {
50 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, 50 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
51 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, 51 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
52 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, 52 { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET },
53 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET },
54 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET },
55 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET },
53 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 56 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
54 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 57 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
55 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, 58 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
diff --git a/drivers/hwmon/asus_atk0110.c b/drivers/hwmon/asus_atk0110.c
index 0897edef2574..bff0103610c1 100644
--- a/drivers/hwmon/asus_atk0110.c
+++ b/drivers/hwmon/asus_atk0110.c
@@ -348,6 +348,7 @@ static int validate_hwmon_pack(struct atk_data *data, union acpi_object *obj)
348 return 0; 348 return 0;
349} 349}
350 350
351#ifdef DEBUG
351static char const *atk_sensor_type(union acpi_object *flags) 352static char const *atk_sensor_type(union acpi_object *flags)
352{ 353{
353 u64 type = flags->integer.value & ATK_TYPE_MASK; 354 u64 type = flags->integer.value & ATK_TYPE_MASK;
@@ -370,6 +371,7 @@ static char const *atk_sensor_type(union acpi_object *flags)
370 371
371 return what; 372 return what;
372} 373}
374#endif
373 375
374static void atk_print_sensor(struct atk_data *data, union acpi_object *obj) 376static void atk_print_sensor(struct atk_data *data, union acpi_object *obj)
375{ 377{
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index dbfb30c588d8..0bdab959b736 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -1462,7 +1462,8 @@ static struct w83781d_data *w83781d_update_device(struct device *dev)
1462 data->pwm[i] = 1462 data->pwm[i] =
1463 w83781d_read_value(data, 1463 w83781d_read_value(data,
1464 W83781D_REG_PWM[i]); 1464 W83781D_REG_PWM[i]);
1465 if ((data->type != w83782d || !client->driver) 1465 /* Only W83782D on SMBus has PWM3 and PWM4 */
1466 if ((data->type != w83782d || !client)
1466 && i == 1) 1467 && i == 1)
1467 break; 1468 break;
1468 } 1469 }
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index a48c8aee0218..f1c6ca7e2852 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -467,7 +467,7 @@ config I2C_PXA_SLAVE
467 467
468config I2C_S3C2410 468config I2C_S3C2410
469 tristate "S3C2410 I2C Driver" 469 tristate "S3C2410 I2C Driver"
470 depends on ARCH_S3C2410 470 depends on ARCH_S3C2410 || ARCH_S3C64XX
471 help 471 help
472 Say Y here to include support for I2C controller in the 472 Say Y here to include support for I2C controller in the
473 Samsung S3C2410 based System-on-Chip devices. 473 Samsung S3C2410 based System-on-Chip devices.
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 3fcf78e906db..b5db8b883615 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -531,16 +531,16 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
531 rbdf = cpm->rbase; 531 rbdf = cpm->rbase;
532 532
533 for (i = 0; i < CPM_MAXBD; i++) { 533 for (i = 0; i < CPM_MAXBD; i++) {
534 cpm->rxbuf[i] = dma_alloc_coherent( 534 cpm->rxbuf[i] = dma_alloc_coherent(&cpm->ofdev->dev,
535 NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL); 535 CPM_MAX_READ + 1,
536 &cpm->rxdma[i], GFP_KERNEL);
536 if (!cpm->rxbuf[i]) { 537 if (!cpm->rxbuf[i]) {
537 ret = -ENOMEM; 538 ret = -ENOMEM;
538 goto out_muram; 539 goto out_muram;
539 } 540 }
540 out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1)); 541 out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1));
541 542
542 cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent( 543 cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
543 NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
544 if (!cpm->txbuf[i]) { 544 if (!cpm->txbuf[i]) {
545 ret = -ENOMEM; 545 ret = -ENOMEM;
546 goto out_muram; 546 goto out_muram;
@@ -585,10 +585,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm)
585out_muram: 585out_muram:
586 for (i = 0; i < CPM_MAXBD; i++) { 586 for (i = 0; i < CPM_MAXBD; i++) {
587 if (cpm->rxbuf[i]) 587 if (cpm->rxbuf[i])
588 dma_free_coherent(NULL, CPM_MAX_READ + 1, 588 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
589 cpm->rxbuf[i], cpm->rxdma[i]); 589 cpm->rxbuf[i], cpm->rxdma[i]);
590 if (cpm->txbuf[i]) 590 if (cpm->txbuf[i])
591 dma_free_coherent(NULL, CPM_MAX_READ + 1, 591 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
592 cpm->txbuf[i], cpm->txdma[i]); 592 cpm->txbuf[i], cpm->txdma[i]);
593 } 593 }
594 cpm_muram_free(cpm->dp_addr); 594 cpm_muram_free(cpm->dp_addr);
@@ -619,9 +619,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
619 619
620 /* Free all memory */ 620 /* Free all memory */
621 for (i = 0; i < CPM_MAXBD; i++) { 621 for (i = 0; i < CPM_MAXBD; i++) {
622 dma_free_coherent(NULL, CPM_MAX_READ + 1, 622 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
623 cpm->rxbuf[i], cpm->rxdma[i]); 623 cpm->rxbuf[i], cpm->rxdma[i]);
624 dma_free_coherent(NULL, CPM_MAX_READ + 1, 624 dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1,
625 cpm->txbuf[i], cpm->txdma[i]); 625 cpm->txbuf[i], cpm->txdma[i]);
626 } 626 }
627 627
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 4af5c09f0e8f..dd778d7ae047 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -164,7 +164,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
164 return 0; 164 return 0;
165} 165}
166 166
167#ifdef CONFIG_PPC_52xx 167#ifdef CONFIG_PPC_MPC52xx
168static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { 168static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
169 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, 169 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
170 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, 170 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02},
@@ -188,7 +188,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
188 188
189int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) 189int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler)
190{ 190{
191 const struct mpc52xx_i2c_divider *div = NULL; 191 const struct mpc_i2c_divider *div = NULL;
192 unsigned int pvr = mfspr(SPRN_PVR); 192 unsigned int pvr = mfspr(SPRN_PVR);
193 u32 divider; 193 u32 divider;
194 int i; 194 int i;
@@ -203,7 +203,7 @@ int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler)
203 * We want to choose an FDR/DFSR that generates an I2C bus speed that 203 * We want to choose an FDR/DFSR that generates an I2C bus speed that
204 * is equal to or lower than the requested speed. 204 * is equal to or lower than the requested speed.
205 */ 205 */
206 for (i = 0; i < ARRAY_SIZE(mpc52xx_i2c_dividers); i++) { 206 for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) {
207 div = &mpc_i2c_dividers_52xx[i]; 207 div = &mpc_i2c_dividers_52xx[i];
208 /* Old MPC5200 rev A CPUs do not support the high bits */ 208 /* Old MPC5200 rev A CPUs do not support the high bits */
209 if (div->fdr & 0xc0 && pvr == 0x80822011) 209 if (div->fdr & 0xc0 && pvr == 0x80822011)
@@ -219,20 +219,23 @@ static void mpc_i2c_setclock_52xx(struct device_node *node,
219 struct mpc_i2c *i2c, 219 struct mpc_i2c *i2c,
220 u32 clock, u32 prescaler) 220 u32 clock, u32 prescaler)
221{ 221{
222 int fdr = mpc52xx_i2c_get_fdr(node, clock, prescaler); 222 int ret, fdr;
223
224 ret = mpc_i2c_get_fdr_52xx(node, clock, prescaler);
225 fdr = (ret >= 0) ? ret : 0x3f; /* backward compatibility */
223 226
224 if (fdr < 0)
225 fdr = 0x3f; /* backward compatibility */
226 writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); 227 writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
227 dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr); 228
229 if (ret >= 0)
230 dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr);
228} 231}
229#else /* !CONFIG_PPC_52xx */ 232#else /* !CONFIG_PPC_MPC52xx */
230static void mpc_i2c_setclock_52xx(struct device_node *node, 233static void mpc_i2c_setclock_52xx(struct device_node *node,
231 struct mpc_i2c *i2c, 234 struct mpc_i2c *i2c,
232 u32 clock, u32 prescaler) 235 u32 clock, u32 prescaler)
233{ 236{
234} 237}
235#endif /* CONFIG_PPC_52xx*/ 238#endif /* CONFIG_PPC_MPC52xx*/
236 239
237#ifdef CONFIG_FSL_SOC 240#ifdef CONFIG_FSL_SOC
238static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = { 241static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {
@@ -321,14 +324,17 @@ static void mpc_i2c_setclock_8xxx(struct device_node *node,
321 struct mpc_i2c *i2c, 324 struct mpc_i2c *i2c,
322 u32 clock, u32 prescaler) 325 u32 clock, u32 prescaler)
323{ 326{
324 int fdr = mpc_i2c_get_fdr_8xxx(node, clock, prescaler); 327 int ret, fdr;
328
329 ret = mpc_i2c_get_fdr_8xxx(node, clock, prescaler);
330 fdr = (ret >= 0) ? ret : 0x1031; /* backward compatibility */
325 331
326 if (fdr < 0)
327 fdr = 0x1031; /* backward compatibility */
328 writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); 332 writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR);
329 writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR); 333 writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR);
330 dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n", 334
331 clock, fdr >> 8, fdr & 0xff); 335 if (ret >= 0)
336 dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n",
337 clock, fdr >> 8, fdr & 0xff);
332} 338}
333 339
334#else /* !CONFIG_FSL_SOC */ 340#else /* !CONFIG_FSL_SOC */
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index c1405c8f6ba5..acc7143d9655 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -265,10 +265,10 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
265 show_state(i2c); 265 show_state(i2c);
266 } 266 }
267 267
268 if (timeout <= 0) 268 if (timeout < 0)
269 show_state(i2c); 269 show_state(i2c);
270 270
271 return timeout <= 0 ? I2C_RETRY : 0; 271 return timeout < 0 ? I2C_RETRY : 0;
272} 272}
273 273
274static int i2c_pxa_wait_master(struct pxa_i2c *i2c) 274static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
@@ -612,7 +612,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
612 show_state(i2c); 612 show_state(i2c);
613 } 613 }
614 614
615 if (timeout <= 0) { 615 if (timeout < 0) {
616 show_state(i2c); 616 show_state(i2c);
617 dev_err(&i2c->adap.dev, 617 dev_err(&i2c->adap.dev,
618 "i2c_pxa: timeout waiting for bus free\n"); 618 "i2c_pxa: timeout waiting for bus free\n");
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index 4e16ce68b063..36da913cc553 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -466,7 +466,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
466 struct ide_host *host; 466 struct ide_host *host;
467 unsigned int sel = 0; 467 unsigned int sel = 0;
468 int ret; 468 int ret;
469 hw_regs_t hw[2], *hws[] = { &hw[0], NULL, NULL, NULL }; 469 hw_regs_t hw[2], *hws[] = { &hw[0], &hw[1], NULL, NULL };
470 struct ide_port_info d = icside_v6_port_info; 470 struct ide_port_info d = icside_v6_port_info;
471 471
472 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 472 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index cb942a9b580f..3a53e0834cf7 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -614,12 +614,6 @@ static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive,
614{ 614{
615 idetape_tape_t *tape = drive->driver_data; 615 idetape_tape_t *tape = drive->driver_data;
616 616
617 if (drive->pc->c[0] == REQUEST_SENSE &&
618 pc->c[0] == REQUEST_SENSE) {
619 printk(KERN_ERR "ide-tape: possible ide-tape.c bug - "
620 "Two request sense in serial were issued\n");
621 }
622
623 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) 617 if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
624 drive->failed_pc = pc; 618 drive->failed_pc = pc;
625 619
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c
index 2aa699933064..69860dea3820 100644
--- a/drivers/ide/piix.c
+++ b/drivers/ide/piix.c
@@ -263,6 +263,7 @@ static const struct ich_laptop ich_laptop[] = {
263 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */ 263 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */
264 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */ 264 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */
265 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */ 265 { 0x2653, 0x1043, 0x82D8 }, /* ICH6M on Asus Eee 701 */
266 { 0x27df, 0x104d, 0x900e }, /* ICH7 on Sony TZ-90 */
266 /* end marker */ 267 /* end marker */
267 { 0, } 268 { 0, }
268}; 269};
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 8d71086f5a1c..62f9cf2f94ec 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -410,6 +410,7 @@ int cxio_flush_sq(struct t3_wq *wq, struct t3_cq *cq, int count)
410 ptr = wq->sq_rptr + count; 410 ptr = wq->sq_rptr + count;
411 sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2); 411 sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2);
412 while (ptr != wq->sq_wptr) { 412 while (ptr != wq->sq_wptr) {
413 sqp->signaled = 0;
413 insert_sq_cqe(wq, cq, sqp); 414 insert_sq_cqe(wq, cq, sqp);
414 ptr++; 415 ptr++;
415 sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2); 416 sqp = wq->sq + Q_PTR2IDX(ptr, wq->sq_size_log2);
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 8dc2bb781605..b3684060465e 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -347,7 +347,7 @@ static int ipathfs_fill_super(struct super_block *sb, void *data,
347 spin_unlock_irqrestore(&ipath_devs_lock, flags); 347 spin_unlock_irqrestore(&ipath_devs_lock, flags);
348 ret = create_device_files(sb, dd); 348 ret = create_device_files(sb, dd);
349 if (ret) { 349 if (ret) {
350 deactivate_super(sb); 350 deactivate_locked_super(sb);
351 goto bail; 351 goto bail;
352 } 352 }
353 spin_lock_irqsave(&ipath_devs_lock, flags); 353 spin_lock_irqsave(&ipath_devs_lock, flags);
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index 9974e886b8de..8a7dd6795fa0 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -86,6 +86,7 @@ struct mlx4_ib_mr {
86 86
87struct mlx4_ib_fast_reg_page_list { 87struct mlx4_ib_fast_reg_page_list {
88 struct ib_fast_reg_page_list ibfrpl; 88 struct ib_fast_reg_page_list ibfrpl;
89 __be64 *mapped_page_list;
89 dma_addr_t map; 90 dma_addr_t map;
90}; 91};
91 92
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 8e4d26d56a95..8f3666b20ea4 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -231,7 +231,11 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device
231 if (!mfrpl) 231 if (!mfrpl)
232 return ERR_PTR(-ENOMEM); 232 return ERR_PTR(-ENOMEM);
233 233
234 mfrpl->ibfrpl.page_list = dma_alloc_coherent(&dev->dev->pdev->dev, 234 mfrpl->ibfrpl.page_list = kmalloc(size, GFP_KERNEL);
235 if (!mfrpl->ibfrpl.page_list)
236 goto err_free;
237
238 mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->pdev->dev,
235 size, &mfrpl->map, 239 size, &mfrpl->map,
236 GFP_KERNEL); 240 GFP_KERNEL);
237 if (!mfrpl->ibfrpl.page_list) 241 if (!mfrpl->ibfrpl.page_list)
@@ -242,6 +246,7 @@ struct ib_fast_reg_page_list *mlx4_ib_alloc_fast_reg_page_list(struct ib_device
242 return &mfrpl->ibfrpl; 246 return &mfrpl->ibfrpl;
243 247
244err_free: 248err_free:
249 kfree(mfrpl->ibfrpl.page_list);
245 kfree(mfrpl); 250 kfree(mfrpl);
246 return ERR_PTR(-ENOMEM); 251 return ERR_PTR(-ENOMEM);
247} 252}
@@ -252,8 +257,9 @@ void mlx4_ib_free_fast_reg_page_list(struct ib_fast_reg_page_list *page_list)
252 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list); 257 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list);
253 int size = page_list->max_page_list_len * sizeof (u64); 258 int size = page_list->max_page_list_len * sizeof (u64);
254 259
255 dma_free_coherent(&dev->dev->pdev->dev, size, page_list->page_list, 260 dma_free_coherent(&dev->dev->pdev->dev, size, mfrpl->mapped_page_list,
256 mfrpl->map); 261 mfrpl->map);
262 kfree(mfrpl->ibfrpl.page_list);
257 kfree(mfrpl); 263 kfree(mfrpl);
258} 264}
259 265
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index f385a24d31d2..20724aee76f4 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1365,7 +1365,7 @@ static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr)
1365 int i; 1365 int i;
1366 1366
1367 for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i) 1367 for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i)
1368 wr->wr.fast_reg.page_list->page_list[i] = 1368 mfrpl->mapped_page_list[i] =
1369 cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] | 1369 cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] |
1370 MLX4_MTT_FLAG_PRESENT); 1370 MLX4_MTT_FLAG_PRESENT);
1371 1371
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index bc4e40f3ede7..2d1415e16834 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -226,7 +226,7 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
226 */ 226 */
227static void ml_combine_effects(struct ff_effect *effect, 227static void ml_combine_effects(struct ff_effect *effect,
228 struct ml_effect_state *state, 228 struct ml_effect_state *state,
229 int gain) 229 unsigned int gain)
230{ 230{
231 struct ff_effect *new = state->effect; 231 struct ff_effect *new = state->effect;
232 unsigned int strong, weak, i; 232 unsigned int strong, weak, i;
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 4224f0112849..012a5e753991 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -843,7 +843,13 @@ static const struct input_device_id joydev_blacklist[] = {
843 INPUT_DEVICE_ID_MATCH_KEYBIT, 843 INPUT_DEVICE_ID_MATCH_KEYBIT,
844 .evbit = { BIT_MASK(EV_KEY) }, 844 .evbit = { BIT_MASK(EV_KEY) },
845 .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) }, 845 .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
846 }, /* Avoid itouchpads, touchscreens and tablets */ 846 }, /* Avoid itouchpads and touchscreens */
847 {
848 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
849 INPUT_DEVICE_ID_MATCH_KEYBIT,
850 .evbit = { BIT_MASK(EV_KEY) },
851 .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) },
852 }, /* Avoid tablets, digitisers and similar devices */
847 { } /* Terminating entry */ 853 { } /* Terminating entry */
848}; 854};
849 855
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 444dec07e5d8..df3f8aa68115 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -895,6 +895,13 @@ static unsigned int atkbd_amilo_pa1510_forced_release_keys[] = {
895}; 895};
896 896
897/* 897/*
898 * Amilo Xi 3650 key release for light touch bar not working
899 */
900static unsigned int atkbd_amilo_xi3650_forced_release_keys[] = {
901 0x67, 0xed, 0x90, 0xa2, 0x99, 0xa4, 0xae, 0xb0, -1U
902};
903
904/*
898 * atkbd_set_keycode_table() initializes keyboard's keycode table 905 * atkbd_set_keycode_table() initializes keyboard's keycode table
899 * according to the selected scancode set 906 * according to the selected scancode set
900 */ 907 */
@@ -1560,6 +1567,15 @@ static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
1560 .callback = atkbd_setup_forced_release, 1567 .callback = atkbd_setup_forced_release,
1561 .driver_data = atkbd_amilo_pa1510_forced_release_keys, 1568 .driver_data = atkbd_amilo_pa1510_forced_release_keys,
1562 }, 1569 },
1570 {
1571 .ident = "Fujitsu Amilo Xi 3650",
1572 .matches = {
1573 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
1574 DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Xi 3650"),
1575 },
1576 .callback = atkbd_setup_forced_release,
1577 .driver_data = atkbd_amilo_xi3650_forced_release_keys,
1578 },
1563 { } 1579 { }
1564}; 1580};
1565 1581
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c
index e29cdc13a199..a28c06d686e1 100644
--- a/drivers/input/serio/ambakmi.c
+++ b/drivers/input/serio/ambakmi.c
@@ -107,7 +107,7 @@ static void amba_kmi_close(struct serio *io)
107 clk_disable(kmi->clk); 107 clk_disable(kmi->clk);
108} 108}
109 109
110static int amba_kmi_probe(struct amba_device *dev, void *id) 110static int amba_kmi_probe(struct amba_device *dev, struct amba_id *id)
111{ 111{
112 struct amba_kmi_port *kmi; 112 struct amba_kmi_port *kmi;
113 struct serio *io; 113 struct serio *io;
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 536668fbda22..948e167557f1 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -200,8 +200,9 @@ static int tsc2007_read_values(struct tsc2007 *tsc)
200static enum hrtimer_restart tsc2007_timer(struct hrtimer *handle) 200static enum hrtimer_restart tsc2007_timer(struct hrtimer *handle)
201{ 201{
202 struct tsc2007 *ts = container_of(handle, struct tsc2007, timer); 202 struct tsc2007 *ts = container_of(handle, struct tsc2007, timer);
203 unsigned long flags;
203 204
204 spin_lock_irq(&ts->lock); 205 spin_lock_irqsave(&ts->lock, flags);
205 206
206 if (unlikely(!ts->get_pendown_state() && ts->pendown)) { 207 if (unlikely(!ts->get_pendown_state() && ts->pendown)) {
207 struct input_dev *input = ts->input; 208 struct input_dev *input = ts->input;
@@ -222,7 +223,7 @@ static enum hrtimer_restart tsc2007_timer(struct hrtimer *handle)
222 tsc2007_send_event(ts); 223 tsc2007_send_event(ts);
223 } 224 }
224 225
225 spin_unlock_irq(&ts->lock); 226 spin_unlock_irqrestore(&ts->lock, flags);
226 227
227 return HRTIMER_NORESTART; 228 return HRTIMER_NORESTART;
228} 229}
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index b129409925af..bff72d81f263 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -75,15 +75,17 @@ static int capifs_remount(struct super_block *s, int *flags, char *data)
75 } 75 }
76 } 76 }
77 77
78 kfree(s->s_options); 78 mutex_lock(&s->s_root->d_inode->i_mutex);
79 s->s_options = new_opt;
80 79
80 replace_mount_options(s, new_opt);
81 config.setuid = setuid; 81 config.setuid = setuid;
82 config.setgid = setgid; 82 config.setgid = setgid;
83 config.uid = uid; 83 config.uid = uid;
84 config.gid = gid; 84 config.gid = gid;
85 config.mode = mode; 85 config.mode = mode;
86 86
87 mutex_unlock(&s->s_root->d_inode->i_mutex);
88
87 return 0; 89 return 0;
88} 90}
89 91
@@ -154,13 +156,16 @@ void capifs_new_ncci(unsigned int number, dev_t device)
154 if (!inode) 156 if (!inode)
155 return; 157 return;
156 inode->i_ino = number+2; 158 inode->i_ino = number+2;
159
160 dentry = get_node(number);
161
162 /* config contents is protected by root's i_mutex */
157 inode->i_uid = config.setuid ? config.uid : current_fsuid(); 163 inode->i_uid = config.setuid ? config.uid : current_fsuid();
158 inode->i_gid = config.setgid ? config.gid : current_fsgid(); 164 inode->i_gid = config.setgid ? config.gid : current_fsgid();
159 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 165 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
160 init_special_inode(inode, S_IFCHR|config.mode, device); 166 init_special_inode(inode, S_IFCHR|config.mode, device);
161 //inode->i_op = &capifs_file_inode_operations; 167 //inode->i_op = &capifs_file_inode_operations;
162 168
163 dentry = get_node(number);
164 if (!IS_ERR(dentry) && !dentry->d_inode) 169 if (!IS_ERR(dentry) && !dentry->d_inode)
165 d_instantiate(dentry, inode); 170 d_instantiate(dentry, inode);
166 mutex_unlock(&capifs_root->d_inode->i_mutex); 171 mutex_unlock(&capifs_root->d_inode->i_mutex);
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 1dba8f0832a0..5cf6c45b91fe 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -153,7 +153,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
153 mult = (fmi->flags & V4L2_TUNER_CAP_LOW) ? 1 : 1000; 153 mult = (fmi->flags & V4L2_TUNER_CAP_LOW) ? 1 : 1000;
154 v->rangelow = RSF16_MINFREQ / mult; 154 v->rangelow = RSF16_MINFREQ / mult;
155 v->rangehigh = RSF16_MAXFREQ / mult; 155 v->rangehigh = RSF16_MAXFREQ / mult;
156 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_MODE_STEREO; 156 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
157 v->capability = fmi->flags & V4L2_TUNER_CAP_LOW; 157 v->capability = fmi->flags & V4L2_TUNER_CAP_LOW;
158 v->audmode = V4L2_TUNER_MODE_STEREO; 158 v->audmode = V4L2_TUNER_MODE_STEREO;
159 v->signal = fmi_getsigstr(fmi); 159 v->signal = fmi_getsigstr(fmi);
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index c09ca8600ea1..935ff9bcdfcc 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -233,7 +233,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
233 mult = (fmr2->flags & V4L2_TUNER_CAP_LOW) ? 1 : 1000; 233 mult = (fmr2->flags & V4L2_TUNER_CAP_LOW) ? 1 : 1000;
234 v->rangelow = RSF16_MINFREQ / mult; 234 v->rangelow = RSF16_MINFREQ / mult;
235 v->rangehigh = RSF16_MAXFREQ / mult; 235 v->rangehigh = RSF16_MAXFREQ / mult;
236 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_MODE_STEREO; 236 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
237 v->capability = fmr2->flags&V4L2_TUNER_CAP_LOW; 237 v->capability = fmr2->flags&V4L2_TUNER_CAP_LOW;
238 v->audmode = fmr2->stereo ? V4L2_TUNER_MODE_STEREO: 238 v->audmode = fmr2->stereo ? V4L2_TUNER_MODE_STEREO:
239 V4L2_TUNER_MODE_MONO; 239 V4L2_TUNER_MODE_MONO;
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 5f582726985d..c4d181dde1ca 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -774,6 +774,7 @@ static int cafe_cam_init(struct cafe_camera *cam)
774 ret = __cafe_cam_reset(cam); 774 ret = __cafe_cam_reset(cam);
775 if (ret) 775 if (ret)
776 goto out; 776 goto out;
777 chip.ident = V4L2_IDENT_NONE;
777 chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; 778 chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
778 chip.match.addr = cam->sensor_addr; 779 chip.match.addr = cam->sensor_addr;
779 ret = sensor_call(cam, core, g_chip_ident, &chip); 780 ret = sensor_call(cam, core, g_chip_ident, &chip);
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 0c49a98213c4..1dc070da8652 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -472,7 +472,7 @@ static int dvb_register(struct cx23885_tsport *port)
472 static struct xc2028_ctrl ctl = { 472 static struct xc2028_ctrl ctl = {
473 .fname = XC2028_DEFAULT_FIRMWARE, 473 .fname = XC2028_DEFAULT_FIRMWARE,
474 .max_len = 64, 474 .max_len = 64,
475 .scode_table = XC3028_FE_OREN538, 475 .demod = XC3028_FE_OREN538,
476 }; 476 };
477 477
478 fe = dvb_attach(xc2028_attach, 478 fe = dvb_attach(xc2028_attach,
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index b0195e8ee4d1..db2ac9a99acd 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -305,14 +305,17 @@ int ivtv_waitq(wait_queue_head_t *waitq)
305/* Generic utility functions */ 305/* Generic utility functions */
306int ivtv_msleep_timeout(unsigned int msecs, int intr) 306int ivtv_msleep_timeout(unsigned int msecs, int intr)
307{ 307{
308 int ret;
309 int timeout = msecs_to_jiffies(msecs); 308 int timeout = msecs_to_jiffies(msecs);
310 309
311 do { 310 do {
312 set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); 311 set_current_state(intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
313 timeout = schedule_timeout(timeout); 312 timeout = schedule_timeout(timeout);
314 if (intr && (ret = signal_pending(current))) 313 if (intr) {
315 return ret; 314 int ret = signal_pending(current);
315
316 if (ret)
317 return ret;
318 }
316 } while (timeout); 319 } while (timeout);
317 return 0; 320 return 0;
318} 321}
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c
index ceb05bdcaf62..85ac707228e7 100644
--- a/drivers/media/video/ivtv/ivtv-gpio.c
+++ b/drivers/media/video/ivtv/ivtv-gpio.c
@@ -190,8 +190,8 @@ static int subdev_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
190 190
191 mask = itv->card->gpio_audio_detect.mask; 191 mask = itv->card->gpio_audio_detect.mask;
192 if (mask == 0 || (read_reg(IVTV_REG_GPIO_IN) & mask)) 192 if (mask == 0 || (read_reg(IVTV_REG_GPIO_IN) & mask))
193 vt->rxsubchans = V4L2_TUNER_MODE_STEREO | 193 vt->rxsubchans = V4L2_TUNER_SUB_STEREO |
194 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2; 194 V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
195 else 195 else
196 vt->rxsubchans = V4L2_TUNER_SUB_MONO; 196 vt->rxsubchans = V4L2_TUNER_SUB_MONO;
197 return 0; 197 return 0;
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 4a2d464f055e..c342a9fe983e 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -180,7 +180,7 @@ int ivtv_set_speed(struct ivtv *itv, int speed)
180 180
181 /* Wait for any DMA to finish */ 181 /* Wait for any DMA to finish */
182 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); 182 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE);
183 while (itv->i_flags & IVTV_F_I_DMA) { 183 while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) {
184 got_sig = signal_pending(current); 184 got_sig = signal_pending(current);
185 if (got_sig) 185 if (got_sig)
186 break; 186 break;
@@ -1710,7 +1710,8 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg)
1710 we are waiting unlock first and later lock again. */ 1710 we are waiting unlock first and later lock again. */
1711 mutex_unlock(&itv->serialize_lock); 1711 mutex_unlock(&itv->serialize_lock);
1712 prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE); 1712 prepare_to_wait(&itv->event_waitq, &wait, TASK_INTERRUPTIBLE);
1713 if ((itv->i_flags & (IVTV_F_I_EV_DEC_STOPPED|IVTV_F_I_EV_VSYNC)) == 0) 1713 if (!test_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags) &&
1714 !test_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags))
1714 schedule(); 1715 schedule();
1715 finish_wait(&itv->event_waitq, &wait); 1716 finish_wait(&itv->event_waitq, &wait);
1716 mutex_lock(&itv->serialize_lock); 1717 mutex_lock(&itv->serialize_lock);
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c
index 01c14d2b381a..cd9db0bf33bf 100644
--- a/drivers/media/video/ivtv/ivtv-irq.c
+++ b/drivers/media/video/ivtv/ivtv-irq.c
@@ -196,7 +196,7 @@ static int stream_enc_dma_append(struct ivtv_stream *s, u32 data[CX2341X_MBOX_MA
196 bytes_needed, s->name); 196 bytes_needed, s->name);
197 return -1; 197 return -1;
198 } 198 }
199 if (rc && !s->buffers_stolen && (s->s_flags & IVTV_F_S_APPL_IO)) { 199 if (rc && !s->buffers_stolen && test_bit(IVTV_F_S_APPL_IO, &s->s_flags)) {
200 IVTV_WARN("All %s stream buffers are full. Dropping data.\n", s->name); 200 IVTV_WARN("All %s stream buffers are full. Dropping data.\n", s->name);
201 IVTV_WARN("Cause: the application is not reading fast enough.\n"); 201 IVTV_WARN("Cause: the application is not reading fast enough.\n");
202 } 202 }
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c
index 7912ed6b72ee..c0875378acc2 100644
--- a/drivers/media/video/ivtv/ivtv-yuv.c
+++ b/drivers/media/video/ivtv/ivtv-yuv.c
@@ -1063,7 +1063,8 @@ static int ivtv_yuv_udma_frame(struct ivtv *itv, struct ivtv_dma_frame *args)
1063 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); 1063 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE);
1064 /* if no UDMA is pending and no UDMA is in progress, then the DMA 1064 /* if no UDMA is pending and no UDMA is in progress, then the DMA
1065 is finished */ 1065 is finished */
1066 while (itv->i_flags & (IVTV_F_I_UDMA_PENDING | IVTV_F_I_UDMA)) { 1066 while (test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags) ||
1067 test_bit(IVTV_F_I_UDMA, &itv->i_flags)) {
1067 /* don't interrupt if the DMA is in progress but break off 1068 /* don't interrupt if the DMA is in progress but break off
1068 a still pending DMA. */ 1069 a still pending DMA. */
1069 got_sig = signal_pending(current); 1070 got_sig = signal_pending(current);
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index 66e6eb513076..fa6bb85cb4b0 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -298,7 +298,8 @@ static int ivtvfb_prep_dec_dma_to_device(struct ivtv *itv,
298 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); 298 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE);
299 /* if no UDMA is pending and no UDMA is in progress, then the DMA 299 /* if no UDMA is pending and no UDMA is in progress, then the DMA
300 is finished */ 300 is finished */
301 while (itv->i_flags & (IVTV_F_I_UDMA_PENDING | IVTV_F_I_UDMA)) { 301 while (test_bit(IVTV_F_I_UDMA_PENDING, &itv->i_flags) ||
302 test_bit(IVTV_F_I_UDMA, &itv->i_flags)) {
302 /* don't interrupt if the DMA is in progress but break off 303 /* don't interrupt if the DMA is in progress but break off
303 a still pending DMA. */ 304 a still pending DMA. */
304 got_sig = signal_pending(current); 305 got_sig = signal_pending(current);
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index 399412d7f020..507dc85646b2 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1726,14 +1726,17 @@ static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
1726static int __uvc_resume(struct usb_interface *intf, int reset) 1726static int __uvc_resume(struct usb_interface *intf, int reset)
1727{ 1727{
1728 struct uvc_device *dev = usb_get_intfdata(intf); 1728 struct uvc_device *dev = usb_get_intfdata(intf);
1729 int ret;
1730 1729
1731 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", 1730 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n",
1732 intf->cur_altsetting->desc.bInterfaceNumber); 1731 intf->cur_altsetting->desc.bInterfaceNumber);
1733 1732
1734 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) { 1733 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) {
1735 if (reset && (ret = uvc_ctrl_resume_device(dev)) < 0) 1734 if (reset) {
1736 return ret; 1735 int ret = uvc_ctrl_resume_device(dev);
1736
1737 if (ret < 0)
1738 return ret;
1739 }
1737 1740
1738 return uvc_status_resume(dev); 1741 return uvc_status_resume(dev);
1739 } 1742 }
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index a95e17329c5b..6ce974d7362f 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -742,7 +742,7 @@ static int uvc_alloc_urb_buffers(struct uvc_video_device *video,
742 742
743 /* Buffers are already allocated, bail out. */ 743 /* Buffers are already allocated, bail out. */
744 if (video->urb_size) 744 if (video->urb_size)
745 return 0; 745 return video->urb_size / psize;
746 746
747 /* Compute the number of packets. Bulk endpoints might transfer UVC 747 /* Compute the number of packets. Bulk endpoints might transfer UVC
748 * payloads accross multiple URBs. 748 * payloads accross multiple URBs.
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 88f10d6cbc92..be64a502ea27 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -42,6 +42,12 @@
42 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\ 42 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\
43 } while (0) 43 } while (0)
44 44
45/* Zero out the end of the struct pointed to by p. Everthing after, but
46 * not including, the specified field is cleared. */
47#define CLEAR_AFTER_FIELD(p, field) \
48 memset((u8 *)(p) + offsetof(typeof(*(p)), field) + sizeof((p)->field), \
49 0, sizeof(*(p)) - offsetof(typeof(*(p)), field) - sizeof((p)->field))
50
45struct std_descr { 51struct std_descr {
46 v4l2_std_id std; 52 v4l2_std_id std;
47 const char *descr; 53 const char *descr;
@@ -544,39 +550,39 @@ static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type)
544 550
545 switch (type) { 551 switch (type) {
546 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 552 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
547 if (ops->vidioc_try_fmt_vid_cap) 553 if (ops->vidioc_g_fmt_vid_cap)
548 return 0; 554 return 0;
549 break; 555 break;
550 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 556 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
551 if (ops->vidioc_try_fmt_vid_overlay) 557 if (ops->vidioc_g_fmt_vid_overlay)
552 return 0; 558 return 0;
553 break; 559 break;
554 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 560 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
555 if (ops->vidioc_try_fmt_vid_out) 561 if (ops->vidioc_g_fmt_vid_out)
556 return 0; 562 return 0;
557 break; 563 break;
558 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 564 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
559 if (ops->vidioc_try_fmt_vid_out_overlay) 565 if (ops->vidioc_g_fmt_vid_out_overlay)
560 return 0; 566 return 0;
561 break; 567 break;
562 case V4L2_BUF_TYPE_VBI_CAPTURE: 568 case V4L2_BUF_TYPE_VBI_CAPTURE:
563 if (ops->vidioc_try_fmt_vbi_cap) 569 if (ops->vidioc_g_fmt_vbi_cap)
564 return 0; 570 return 0;
565 break; 571 break;
566 case V4L2_BUF_TYPE_VBI_OUTPUT: 572 case V4L2_BUF_TYPE_VBI_OUTPUT:
567 if (ops->vidioc_try_fmt_vbi_out) 573 if (ops->vidioc_g_fmt_vbi_out)
568 return 0; 574 return 0;
569 break; 575 break;
570 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 576 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
571 if (ops->vidioc_try_fmt_sliced_vbi_cap) 577 if (ops->vidioc_g_fmt_sliced_vbi_cap)
572 return 0; 578 return 0;
573 break; 579 break;
574 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 580 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
575 if (ops->vidioc_try_fmt_sliced_vbi_out) 581 if (ops->vidioc_g_fmt_sliced_vbi_out)
576 return 0; 582 return 0;
577 break; 583 break;
578 case V4L2_BUF_TYPE_PRIVATE: 584 case V4L2_BUF_TYPE_PRIVATE:
579 if (ops->vidioc_try_fmt_type_private) 585 if (ops->vidioc_g_fmt_type_private)
580 return 0; 586 return 0;
581 break; 587 break;
582 } 588 }
@@ -782,44 +788,53 @@ static long __video_do_ioctl(struct file *file,
782 788
783 switch (f->type) { 789 switch (f->type) {
784 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 790 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
791 CLEAR_AFTER_FIELD(f, fmt.pix);
785 v4l_print_pix_fmt(vfd, &f->fmt.pix); 792 v4l_print_pix_fmt(vfd, &f->fmt.pix);
786 if (ops->vidioc_s_fmt_vid_cap) 793 if (ops->vidioc_s_fmt_vid_cap)
787 ret = ops->vidioc_s_fmt_vid_cap(file, fh, f); 794 ret = ops->vidioc_s_fmt_vid_cap(file, fh, f);
788 break; 795 break;
789 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 796 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
797 CLEAR_AFTER_FIELD(f, fmt.win);
790 if (ops->vidioc_s_fmt_vid_overlay) 798 if (ops->vidioc_s_fmt_vid_overlay)
791 ret = ops->vidioc_s_fmt_vid_overlay(file, 799 ret = ops->vidioc_s_fmt_vid_overlay(file,
792 fh, f); 800 fh, f);
793 break; 801 break;
794 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 802 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
803 CLEAR_AFTER_FIELD(f, fmt.pix);
795 v4l_print_pix_fmt(vfd, &f->fmt.pix); 804 v4l_print_pix_fmt(vfd, &f->fmt.pix);
796 if (ops->vidioc_s_fmt_vid_out) 805 if (ops->vidioc_s_fmt_vid_out)
797 ret = ops->vidioc_s_fmt_vid_out(file, fh, f); 806 ret = ops->vidioc_s_fmt_vid_out(file, fh, f);
798 break; 807 break;
799 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 808 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
809 CLEAR_AFTER_FIELD(f, fmt.win);
800 if (ops->vidioc_s_fmt_vid_out_overlay) 810 if (ops->vidioc_s_fmt_vid_out_overlay)
801 ret = ops->vidioc_s_fmt_vid_out_overlay(file, 811 ret = ops->vidioc_s_fmt_vid_out_overlay(file,
802 fh, f); 812 fh, f);
803 break; 813 break;
804 case V4L2_BUF_TYPE_VBI_CAPTURE: 814 case V4L2_BUF_TYPE_VBI_CAPTURE:
815 CLEAR_AFTER_FIELD(f, fmt.vbi);
805 if (ops->vidioc_s_fmt_vbi_cap) 816 if (ops->vidioc_s_fmt_vbi_cap)
806 ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f); 817 ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f);
807 break; 818 break;
808 case V4L2_BUF_TYPE_VBI_OUTPUT: 819 case V4L2_BUF_TYPE_VBI_OUTPUT:
820 CLEAR_AFTER_FIELD(f, fmt.vbi);
809 if (ops->vidioc_s_fmt_vbi_out) 821 if (ops->vidioc_s_fmt_vbi_out)
810 ret = ops->vidioc_s_fmt_vbi_out(file, fh, f); 822 ret = ops->vidioc_s_fmt_vbi_out(file, fh, f);
811 break; 823 break;
812 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 824 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
825 CLEAR_AFTER_FIELD(f, fmt.sliced);
813 if (ops->vidioc_s_fmt_sliced_vbi_cap) 826 if (ops->vidioc_s_fmt_sliced_vbi_cap)
814 ret = ops->vidioc_s_fmt_sliced_vbi_cap(file, 827 ret = ops->vidioc_s_fmt_sliced_vbi_cap(file,
815 fh, f); 828 fh, f);
816 break; 829 break;
817 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 830 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
831 CLEAR_AFTER_FIELD(f, fmt.sliced);
818 if (ops->vidioc_s_fmt_sliced_vbi_out) 832 if (ops->vidioc_s_fmt_sliced_vbi_out)
819 ret = ops->vidioc_s_fmt_sliced_vbi_out(file, 833 ret = ops->vidioc_s_fmt_sliced_vbi_out(file,
820 fh, f); 834 fh, f);
821 break; 835 break;
822 case V4L2_BUF_TYPE_PRIVATE: 836 case V4L2_BUF_TYPE_PRIVATE:
837 /* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */
823 if (ops->vidioc_s_fmt_type_private) 838 if (ops->vidioc_s_fmt_type_private)
824 ret = ops->vidioc_s_fmt_type_private(file, 839 ret = ops->vidioc_s_fmt_type_private(file,
825 fh, f); 840 fh, f);
@@ -836,46 +851,55 @@ static long __video_do_ioctl(struct file *file,
836 v4l2_type_names)); 851 v4l2_type_names));
837 switch (f->type) { 852 switch (f->type) {
838 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 853 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
854 CLEAR_AFTER_FIELD(f, fmt.pix);
839 if (ops->vidioc_try_fmt_vid_cap) 855 if (ops->vidioc_try_fmt_vid_cap)
840 ret = ops->vidioc_try_fmt_vid_cap(file, fh, f); 856 ret = ops->vidioc_try_fmt_vid_cap(file, fh, f);
841 if (!ret) 857 if (!ret)
842 v4l_print_pix_fmt(vfd, &f->fmt.pix); 858 v4l_print_pix_fmt(vfd, &f->fmt.pix);
843 break; 859 break;
844 case V4L2_BUF_TYPE_VIDEO_OVERLAY: 860 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
861 CLEAR_AFTER_FIELD(f, fmt.win);
845 if (ops->vidioc_try_fmt_vid_overlay) 862 if (ops->vidioc_try_fmt_vid_overlay)
846 ret = ops->vidioc_try_fmt_vid_overlay(file, 863 ret = ops->vidioc_try_fmt_vid_overlay(file,
847 fh, f); 864 fh, f);
848 break; 865 break;
849 case V4L2_BUF_TYPE_VIDEO_OUTPUT: 866 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
867 CLEAR_AFTER_FIELD(f, fmt.pix);
850 if (ops->vidioc_try_fmt_vid_out) 868 if (ops->vidioc_try_fmt_vid_out)
851 ret = ops->vidioc_try_fmt_vid_out(file, fh, f); 869 ret = ops->vidioc_try_fmt_vid_out(file, fh, f);
852 if (!ret) 870 if (!ret)
853 v4l_print_pix_fmt(vfd, &f->fmt.pix); 871 v4l_print_pix_fmt(vfd, &f->fmt.pix);
854 break; 872 break;
855 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: 873 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
874 CLEAR_AFTER_FIELD(f, fmt.win);
856 if (ops->vidioc_try_fmt_vid_out_overlay) 875 if (ops->vidioc_try_fmt_vid_out_overlay)
857 ret = ops->vidioc_try_fmt_vid_out_overlay(file, 876 ret = ops->vidioc_try_fmt_vid_out_overlay(file,
858 fh, f); 877 fh, f);
859 break; 878 break;
860 case V4L2_BUF_TYPE_VBI_CAPTURE: 879 case V4L2_BUF_TYPE_VBI_CAPTURE:
880 CLEAR_AFTER_FIELD(f, fmt.vbi);
861 if (ops->vidioc_try_fmt_vbi_cap) 881 if (ops->vidioc_try_fmt_vbi_cap)
862 ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f); 882 ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f);
863 break; 883 break;
864 case V4L2_BUF_TYPE_VBI_OUTPUT: 884 case V4L2_BUF_TYPE_VBI_OUTPUT:
885 CLEAR_AFTER_FIELD(f, fmt.vbi);
865 if (ops->vidioc_try_fmt_vbi_out) 886 if (ops->vidioc_try_fmt_vbi_out)
866 ret = ops->vidioc_try_fmt_vbi_out(file, fh, f); 887 ret = ops->vidioc_try_fmt_vbi_out(file, fh, f);
867 break; 888 break;
868 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 889 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
890 CLEAR_AFTER_FIELD(f, fmt.sliced);
869 if (ops->vidioc_try_fmt_sliced_vbi_cap) 891 if (ops->vidioc_try_fmt_sliced_vbi_cap)
870 ret = ops->vidioc_try_fmt_sliced_vbi_cap(file, 892 ret = ops->vidioc_try_fmt_sliced_vbi_cap(file,
871 fh, f); 893 fh, f);
872 break; 894 break;
873 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: 895 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
896 CLEAR_AFTER_FIELD(f, fmt.sliced);
874 if (ops->vidioc_try_fmt_sliced_vbi_out) 897 if (ops->vidioc_try_fmt_sliced_vbi_out)
875 ret = ops->vidioc_try_fmt_sliced_vbi_out(file, 898 ret = ops->vidioc_try_fmt_sliced_vbi_out(file,
876 fh, f); 899 fh, f);
877 break; 900 break;
878 case V4L2_BUF_TYPE_PRIVATE: 901 case V4L2_BUF_TYPE_PRIVATE:
902 /* CLEAR_AFTER_FIELD(f, fmt.raw_data); <- does nothing */
879 if (ops->vidioc_try_fmt_type_private) 903 if (ops->vidioc_try_fmt_type_private)
880 ret = ops->vidioc_try_fmt_type_private(file, 904 ret = ops->vidioc_try_fmt_type_private(file,
881 fh, f); 905 fh, f);
@@ -898,6 +922,9 @@ static long __video_do_ioctl(struct file *file,
898 if (ret) 922 if (ret)
899 break; 923 break;
900 924
925 if (p->type < V4L2_BUF_TYPE_PRIVATE)
926 CLEAR_AFTER_FIELD(p, memory);
927
901 ret = ops->vidioc_reqbufs(file, fh, p); 928 ret = ops->vidioc_reqbufs(file, fh, p);
902 dbgarg(cmd, "count=%d, type=%s, memory=%s\n", 929 dbgarg(cmd, "count=%d, type=%s, memory=%s\n",
903 p->count, 930 p->count,
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index 092333b1c34f..643cccaa1aab 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -1863,22 +1863,20 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability
1863 1863
1864static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag) 1864static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
1865{ 1865{
1866 int num = -1, i; 1866 unsigned int num, i;
1867 1867
1868 for (i = 0; i < NUM_FORMATS; i++) { 1868 for (num = i = 0; i < NUM_FORMATS; i++) {
1869 if (zoran_formats[i].flags & flag) 1869 if (zoran_formats[i].flags & flag && num++ == fmt->index) {
1870 num++; 1870 strncpy(fmt->description, zoran_formats[i].name,
1871 if (num == fmt->index) 1871 sizeof(fmt->description) - 1);
1872 break; 1872 /* fmt struct pre-zeroed, so adding '\0' not neeed */
1873 fmt->pixelformat = zoran_formats[i].fourcc;
1874 if (zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)
1875 fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
1876 return 0;
1877 }
1873 } 1878 }
1874 if (fmt->index < 0 /* late, but not too late */ || i == NUM_FORMATS) 1879 return -EINVAL;
1875 return -EINVAL;
1876
1877 strncpy(fmt->description, zoran_formats[i].name, sizeof(fmt->description)-1);
1878 fmt->pixelformat = zoran_formats[i].fourcc;
1879 if (zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)
1880 fmt->flags |= V4L2_FMT_FLAG_COMPRESSED;
1881 return 0;
1882} 1880}
1883 1881
1884static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, 1882static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh,
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 7793932a513b..11a6248cc1c1 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -443,7 +443,7 @@ static irqreturn_t pcf50633_irq(int irq, void *data)
443 dev_dbg(pcf->dev, "pcf50633_irq\n"); 443 dev_dbg(pcf->dev, "pcf50633_irq\n");
444 444
445 get_device(pcf->dev); 445 get_device(pcf->dev);
446 disable_irq(pcf->irq); 446 disable_irq_nosync(pcf->irq);
447 schedule_work(&pcf->irq_work); 447 schedule_work(&pcf->irq_work);
448 448
449 return IRQ_HANDLED; 449 return IRQ_HANDLED;
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index c2be3088e2e1..fe24079387c5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -79,10 +79,6 @@ static int wm8350_phys_read(struct wm8350 *wm8350, u8 reg, int num_regs,
79 /* Cache is CPU endian */ 79 /* Cache is CPU endian */
80 dest[i - reg] = be16_to_cpu(dest[i - reg]); 80 dest[i - reg] = be16_to_cpu(dest[i - reg]);
81 81
82 /* Satisfy non-volatile bits from cache */
83 dest[i - reg] &= wm8350_reg_io_map[i].vol;
84 dest[i - reg] |= wm8350->reg_cache[i];
85
86 /* Mask out non-readable bits */ 82 /* Mask out non-readable bits */
87 dest[i - reg] &= wm8350_reg_io_map[i].readable; 83 dest[i - reg] &= wm8350_reg_io_map[i].readable;
88 } 84 }
@@ -182,9 +178,6 @@ static int wm8350_write(struct wm8350 *wm8350, u8 reg, int num_regs, u16 *src)
182 (wm8350->reg_cache[i] & ~wm8350_reg_io_map[i].writable) 178 (wm8350->reg_cache[i] & ~wm8350_reg_io_map[i].writable)
183 | src[i - reg]; 179 | src[i - reg];
184 180
185 /* Don't store volatile bits */
186 wm8350->reg_cache[i] &= ~wm8350_reg_io_map[i].vol;
187
188 src[i - reg] = cpu_to_be16(src[i - reg]); 181 src[i - reg] = cpu_to_be16(src[i - reg]);
189 } 182 }
190 183
@@ -1261,7 +1254,6 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode)
1261 (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) { 1254 (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) {
1262 value = be16_to_cpu(wm8350->reg_cache[i]); 1255 value = be16_to_cpu(wm8350->reg_cache[i]);
1263 value &= wm8350_reg_io_map[i].readable; 1256 value &= wm8350_reg_io_map[i].readable;
1264 value &= ~wm8350_reg_io_map[i].vol;
1265 wm8350->reg_cache[i] = value; 1257 wm8350->reg_cache[i] = value;
1266 } else 1258 } else
1267 wm8350->reg_cache[i] = reg_map[i]; 1259 wm8350->reg_cache[i] = reg_map[i];
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 36875dcfa492..7d4febdab286 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -490,7 +490,7 @@ static void mmci_check_status(unsigned long data)
490 mod_timer(&host->timer, jiffies + HZ); 490 mod_timer(&host->timer, jiffies + HZ);
491} 491}
492 492
493static int __devinit mmci_probe(struct amba_device *dev, void *id) 493static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
494{ 494{
495 struct mmc_platform_data *plat = dev->dev.platform_data; 495 struct mmc_platform_data *plat = dev->dev.platform_data;
496 struct mmci_host *host; 496 struct mmci_host *host;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 8185b1f3e5e6..cc6369ea67dd 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -54,7 +54,7 @@
54#define SR_SRWD 0x80 /* SR write protect */ 54#define SR_SRWD 0x80 /* SR write protect */
55 55
56/* Define max times to check status register before we give up. */ 56/* Define max times to check status register before we give up. */
57#define MAX_READY_WAIT_COUNT 100000 57#define MAX_READY_WAIT_JIFFIES (10 * HZ) /* eg. M25P128 specs 6s max sector erase */
58#define CMD_SIZE 4 58#define CMD_SIZE 4
59 59
60#ifdef CONFIG_M25PXX_USE_FAST_READ 60#ifdef CONFIG_M25PXX_USE_FAST_READ
@@ -139,20 +139,20 @@ static inline int write_enable(struct m25p *flash)
139 */ 139 */
140static int wait_till_ready(struct m25p *flash) 140static int wait_till_ready(struct m25p *flash)
141{ 141{
142 int count; 142 unsigned long deadline;
143 int sr; 143 int sr;
144 144
145 /* one chip guarantees max 5 msec wait here after page writes, 145 deadline = jiffies + MAX_READY_WAIT_JIFFIES;
146 * but potentially three seconds (!) after page erase. 146
147 */ 147 do {
148 for (count = 0; count < MAX_READY_WAIT_COUNT; count++) {
149 if ((sr = read_sr(flash)) < 0) 148 if ((sr = read_sr(flash)) < 0)
150 break; 149 break;
151 else if (!(sr & SR_WIP)) 150 else if (!(sr & SR_WIP))
152 return 0; 151 return 0;
153 152
154 /* REVISIT sometimes sleeping would be best */ 153 cond_resched();
155 } 154
155 } while (!time_after_eq(jiffies, deadline));
156 156
157 return 1; 157 return 1;
158} 158}
@@ -246,10 +246,12 @@ static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
246 mutex_lock(&flash->lock); 246 mutex_lock(&flash->lock);
247 247
248 /* whole-chip erase? */ 248 /* whole-chip erase? */
249 if (len == flash->mtd.size && erase_chip(flash)) { 249 if (len == flash->mtd.size) {
250 instr->state = MTD_ERASE_FAILED; 250 if (erase_chip(flash)) {
251 mutex_unlock(&flash->lock); 251 instr->state = MTD_ERASE_FAILED;
252 return -EIO; 252 mutex_unlock(&flash->lock);
253 return -EIO;
254 }
253 255
254 /* REVISIT in some cases we could speed up erasing large regions 256 /* REVISIT in some cases we could speed up erasing large regions
255 * by using OPCODE_SE instead of OPCODE_BE_4K. We may have set up 257 * by using OPCODE_SE instead of OPCODE_BE_4K. We may have set up
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 62dee54af0a5..43976aa4dbb1 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
178 /* Calculate flash page address; use block erase (for speed) if 178 /* Calculate flash page address; use block erase (for speed) if
179 * we're at a block boundary and need to erase the whole block. 179 * we're at a block boundary and need to erase the whole block.
180 */ 180 */
181 pageaddr = div_u64(instr->len, priv->page_size); 181 pageaddr = div_u64(instr->addr, priv->page_size);
182 do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize; 182 do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize;
183 pageaddr = pageaddr << priv->page_offset; 183 pageaddr = pageaddr << priv->page_offset;
184 184
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index fdd6ae859397..bccb4b1ffc46 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -48,11 +48,11 @@ static LIST_HEAD(mtd_notifiers);
48 */ 48 */
49static void mtd_release(struct device *dev) 49static void mtd_release(struct device *dev)
50{ 50{
51 struct mtd_info *mtd = dev_to_mtd(dev); 51 dev_t index = MTD_DEVT(dev_to_mtd(dev)->index);
52 52
53 /* remove /dev/mtdXro node if needed */ 53 /* remove /dev/mtdXro node if needed */
54 if (MTD_DEVT(mtd->index)) 54 if (index)
55 device_destroy(mtd_class, MTD_DEVT(mtd->index) + 1); 55 device_destroy(mtd_class, index + 1);
56} 56}
57 57
58static ssize_t mtd_type_show(struct device *dev, 58static ssize_t mtd_type_show(struct device *dev,
@@ -132,6 +132,17 @@ static ssize_t mtd_writesize_show(struct device *dev,
132} 132}
133static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL); 133static DEVICE_ATTR(writesize, S_IRUGO, mtd_writesize_show, NULL);
134 134
135static ssize_t mtd_subpagesize_show(struct device *dev,
136 struct device_attribute *attr, char *buf)
137{
138 struct mtd_info *mtd = dev_to_mtd(dev);
139 unsigned int subpagesize = mtd->writesize >> mtd->subpage_sft;
140
141 return snprintf(buf, PAGE_SIZE, "%u\n", subpagesize);
142
143}
144static DEVICE_ATTR(subpagesize, S_IRUGO, mtd_subpagesize_show, NULL);
145
135static ssize_t mtd_oobsize_show(struct device *dev, 146static ssize_t mtd_oobsize_show(struct device *dev,
136 struct device_attribute *attr, char *buf) 147 struct device_attribute *attr, char *buf)
137{ 148{
@@ -169,6 +180,7 @@ static struct attribute *mtd_attrs[] = {
169 &dev_attr_size.attr, 180 &dev_attr_size.attr,
170 &dev_attr_erasesize.attr, 181 &dev_attr_erasesize.attr,
171 &dev_attr_writesize.attr, 182 &dev_attr_writesize.attr,
183 &dev_attr_subpagesize.attr,
172 &dev_attr_oobsize.attr, 184 &dev_attr_oobsize.attr,
173 &dev_attr_numeraseregions.attr, 185 &dev_attr_numeraseregions.attr,
174 &dev_attr_name.attr, 186 &dev_attr_name.attr,
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 92285d0089c2..af8b42e0a55b 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -74,8 +74,7 @@ static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,
74 74
75 ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 75 ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
76 if (ret < 0) { 76 if (ret < 0) {
77 up_write(&sb->s_umount); 77 deactivate_locked_super(sb);
78 deactivate_super(sb);
79 return ret; 78 return ret;
80 } 79 }
81 80
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 448487e22fa3..a740053d3af3 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -338,12 +338,12 @@ static int ixp4xx_mdio_register(void)
338 if (cpu_is_ixp43x()) { 338 if (cpu_is_ixp43x()) {
339 /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */ 339 /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */
340 if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEC_ETH)) 340 if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEC_ETH))
341 return -ENOSYS; 341 return -ENODEV;
342 mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; 342 mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT;
343 } else { 343 } else {
344 /* All MII PHY accesses use NPE-B Ethernet registers */ 344 /* All MII PHY accesses use NPE-B Ethernet registers */
345 if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) 345 if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0))
346 return -ENOSYS; 346 return -ENODEV;
347 mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; 347 mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT;
348 } 348 }
349 349
@@ -1174,7 +1174,7 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1174 regs_phys = IXP4XX_EthC_BASE_PHYS; 1174 regs_phys = IXP4XX_EthC_BASE_PHYS;
1175 break; 1175 break;
1176 default: 1176 default:
1177 err = -ENOSYS; 1177 err = -ENODEV;
1178 goto err_free; 1178 goto err_free;
1179 } 1179 }
1180 1180
@@ -1189,15 +1189,10 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1189 goto err_free; 1189 goto err_free;
1190 } 1190 }
1191 1191
1192 if (register_netdev(dev)) {
1193 err = -EIO;
1194 goto err_npe_rel;
1195 }
1196
1197 port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); 1192 port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name);
1198 if (!port->mem_res) { 1193 if (!port->mem_res) {
1199 err = -EBUSY; 1194 err = -EBUSY;
1200 goto err_unreg; 1195 goto err_npe_rel;
1201 } 1196 }
1202 1197
1203 port->plat = plat; 1198 port->plat = plat;
@@ -1215,20 +1210,25 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1215 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy); 1210 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy);
1216 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, 1211 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
1217 PHY_INTERFACE_MODE_MII); 1212 PHY_INTERFACE_MODE_MII);
1218 if (IS_ERR(port->phydev)) { 1213 if ((err = IS_ERR(port->phydev)))
1219 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 1214 goto err_free_mem;
1220 return PTR_ERR(port->phydev);
1221 }
1222 1215
1223 port->phydev->irq = PHY_POLL; 1216 port->phydev->irq = PHY_POLL;
1224 1217
1218 if ((err = register_netdev(dev)))
1219 goto err_phy_dis;
1220
1225 printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, 1221 printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
1226 npe_name(port->npe)); 1222 npe_name(port->npe));
1227 1223
1228 return 0; 1224 return 0;
1229 1225
1230err_unreg: 1226err_phy_dis:
1231 unregister_netdev(dev); 1227 phy_disconnect(port->phydev);
1228err_free_mem:
1229 npe_port_tab[NPE_ID(port->id)] = NULL;
1230 platform_set_drvdata(pdev, NULL);
1231 release_resource(port->mem_res);
1232err_npe_rel: 1232err_npe_rel:
1233 npe_release(port->npe); 1233 npe_release(port->npe);
1234err_free: 1234err_free:
@@ -1242,6 +1242,7 @@ static int __devexit eth_remove_one(struct platform_device *pdev)
1242 struct port *port = netdev_priv(dev); 1242 struct port *port = netdev_priv(dev);
1243 1243
1244 unregister_netdev(dev); 1244 unregister_netdev(dev);
1245 phy_disconnect(port->phydev);
1245 npe_port_tab[NPE_ID(port->id)] = NULL; 1246 npe_port_tab[NPE_ID(port->id)] = NULL;
1246 platform_set_drvdata(pdev, NULL); 1247 platform_set_drvdata(pdev, NULL);
1247 npe_release(port->npe); 1248 npe_release(port->npe);
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index c49ddd08b2aa..b4bb06fdf307 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -35,8 +35,22 @@
35#define DRV_VER "2.0.348" 35#define DRV_VER "2.0.348"
36#define DRV_NAME "be2net" 36#define DRV_NAME "be2net"
37#define BE_NAME "ServerEngines BladeEngine2 10Gbps NIC" 37#define BE_NAME "ServerEngines BladeEngine2 10Gbps NIC"
38#define OC_NAME "Emulex OneConnect 10Gbps NIC"
38#define DRV_DESC BE_NAME "Driver" 39#define DRV_DESC BE_NAME "Driver"
39 40
41#define BE_VENDOR_ID 0x19a2
42#define BE_DEVICE_ID1 0x211
43#define OC_DEVICE_ID1 0x700
44#define OC_DEVICE_ID2 0x701
45
46static inline char *nic_name(struct pci_dev *pdev)
47{
48 if (pdev->device == OC_DEVICE_ID1 || pdev->device == OC_DEVICE_ID2)
49 return OC_NAME;
50 else
51 return BE_NAME;
52}
53
40/* Number of bytes of an RX frame that are copied to skb->data */ 54/* Number of bytes of an RX frame that are copied to skb->data */
41#define BE_HDR_LEN 64 55#define BE_HDR_LEN 64
42#define BE_MAX_JUMBO_FRAME_SIZE 9018 56#define BE_MAX_JUMBO_FRAME_SIZE 9018
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 30d0c81c989e..5c378b5e8e41 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -28,10 +28,10 @@ static unsigned int rx_frag_size = 2048;
28module_param(rx_frag_size, uint, S_IRUGO); 28module_param(rx_frag_size, uint, S_IRUGO);
29MODULE_PARM_DESC(rx_frag_size, "Size of a fragment that holds rcvd data."); 29MODULE_PARM_DESC(rx_frag_size, "Size of a fragment that holds rcvd data.");
30 30
31#define BE_VENDOR_ID 0x19a2
32#define BE2_DEVICE_ID_1 0x0211
33static DEFINE_PCI_DEVICE_TABLE(be_dev_ids) = { 31static DEFINE_PCI_DEVICE_TABLE(be_dev_ids) = {
34 { PCI_DEVICE(BE_VENDOR_ID, BE2_DEVICE_ID_1) }, 32 { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) },
33 { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) },
34 { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) },
35 { 0 } 35 { 0 }
36}; 36};
37MODULE_DEVICE_TABLE(pci, be_dev_ids); 37MODULE_DEVICE_TABLE(pci, be_dev_ids);
@@ -1859,7 +1859,7 @@ static int __devinit be_probe(struct pci_dev *pdev,
1859 if (status != 0) 1859 if (status != 0)
1860 goto stats_clean; 1860 goto stats_clean;
1861 1861
1862 dev_info(&pdev->dev, BE_NAME " port %d\n", adapter->port_num); 1862 dev_info(&pdev->dev, "%s port %d\n", nic_name(pdev), adapter->port_num);
1863 return 0; 1863 return 0;
1864 1864
1865stats_clean: 1865stats_clean:
@@ -1873,7 +1873,7 @@ rel_reg:
1873disable_dev: 1873disable_dev:
1874 pci_disable_device(pdev); 1874 pci_disable_device(pdev);
1875do_none: 1875do_none:
1876 dev_warn(&pdev->dev, BE_NAME " initialization failed\n"); 1876 dev_err(&pdev->dev, "%s initialization failed\n", nic_name(pdev));
1877 return status; 1877 return status;
1878} 1878}
1879 1879
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d47839184a06..b0cb29d4cc01 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "2.0.0" 57#define DRV_MODULE_VERSION "2.0.1"
58#define DRV_MODULE_RELDATE "April 2, 2009" 58#define DRV_MODULE_RELDATE "May 6, 2009"
59#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw" 59#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-4.6.16.fw"
60#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw" 60#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-4.6.16.fw"
61#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw" 61#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-4.6.17.fw"
@@ -2600,6 +2600,7 @@ bnx2_get_hw_tx_cons(struct bnx2_napi *bnapi)
2600 /* Tell compiler that status block fields can change. */ 2600 /* Tell compiler that status block fields can change. */
2601 barrier(); 2601 barrier();
2602 cons = *bnapi->hw_tx_cons_ptr; 2602 cons = *bnapi->hw_tx_cons_ptr;
2603 barrier();
2603 if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT)) 2604 if (unlikely((cons & MAX_TX_DESC_CNT) == MAX_TX_DESC_CNT))
2604 cons++; 2605 cons++;
2605 return cons; 2606 return cons;
@@ -2879,6 +2880,7 @@ bnx2_get_hw_rx_cons(struct bnx2_napi *bnapi)
2879 /* Tell compiler that status block fields can change. */ 2880 /* Tell compiler that status block fields can change. */
2880 barrier(); 2881 barrier();
2881 cons = *bnapi->hw_rx_cons_ptr; 2882 cons = *bnapi->hw_rx_cons_ptr;
2883 barrier();
2882 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)) 2884 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
2883 cons++; 2885 cons++;
2884 return cons; 2886 return cons;
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 8c2e5ab51f08..faf094abef7f 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1465,6 +1465,12 @@ static struct aggregator *ad_agg_selection_test(struct aggregator *best,
1465 return best; 1465 return best;
1466} 1466}
1467 1467
1468static int agg_device_up(const struct aggregator *agg)
1469{
1470 return (netif_running(agg->slave->dev) &&
1471 netif_carrier_ok(agg->slave->dev));
1472}
1473
1468/** 1474/**
1469 * ad_agg_selection_logic - select an aggregation group for a team 1475 * ad_agg_selection_logic - select an aggregation group for a team
1470 * @aggregator: the aggregator we're looking at 1476 * @aggregator: the aggregator we're looking at
@@ -1496,14 +1502,13 @@ static void ad_agg_selection_logic(struct aggregator *agg)
1496 struct port *port; 1502 struct port *port;
1497 1503
1498 origin = agg; 1504 origin = agg;
1499
1500 active = __get_active_agg(agg); 1505 active = __get_active_agg(agg);
1501 best = active; 1506 best = (active && agg_device_up(active)) ? active : NULL;
1502 1507
1503 do { 1508 do {
1504 agg->is_active = 0; 1509 agg->is_active = 0;
1505 1510
1506 if (agg->num_of_ports) 1511 if (agg->num_of_ports && agg_device_up(agg))
1507 best = ad_agg_selection_test(best, agg); 1512 best = ad_agg_selection_test(best, agg);
1508 1513
1509 } while ((agg = __get_next_agg(agg))); 1514 } while ((agg = __get_next_agg(agg)));
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 2188a96fc090..74824028f85c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5181,7 +5181,6 @@ static int __init bonding_init(void)
5181{ 5181{
5182 int i; 5182 int i;
5183 int res; 5183 int res;
5184 struct bonding *bond;
5185 5184
5186 printk(KERN_INFO "%s", version); 5185 printk(KERN_INFO "%s", version);
5187 5186
@@ -5212,13 +5211,6 @@ static int __init bonding_init(void)
5212 5211
5213 goto out; 5212 goto out;
5214err: 5213err:
5215 list_for_each_entry(bond, &bond_dev_list, bond_list) {
5216 bond_work_cancel_all(bond);
5217 destroy_workqueue(bond->wq);
5218 }
5219
5220 bond_destroy_sysfs();
5221
5222 rtnl_lock(); 5214 rtnl_lock();
5223 bond_free_all(); 5215 bond_free_all();
5224 rtnl_unlock(); 5216 rtnl_unlock();
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 08c801490c72..e25343588fc7 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -2006,7 +2006,7 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2006 struct e1000_hw *hw = &adapter->hw; 2006 struct e1000_hw *hw = &adapter->hw;
2007 u32 rctl; 2007 u32 rctl;
2008 u32 srrctl = 0; 2008 u32 srrctl = 0;
2009 int i, j; 2009 int i;
2010 2010
2011 rctl = rd32(E1000_RCTL); 2011 rctl = rd32(E1000_RCTL);
2012 2012
@@ -2071,8 +2071,6 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2071 if (adapter->vfs_allocated_count) { 2071 if (adapter->vfs_allocated_count) {
2072 u32 vmolr; 2072 u32 vmolr;
2073 2073
2074 j = adapter->rx_ring[0].reg_idx;
2075
2076 /* set all queue drop enable bits */ 2074 /* set all queue drop enable bits */
2077 wr32(E1000_QDE, ALL_QUEUES); 2075 wr32(E1000_QDE, ALL_QUEUES);
2078 srrctl |= E1000_SRRCTL_DROP_EN; 2076 srrctl |= E1000_SRRCTL_DROP_EN;
@@ -2080,16 +2078,16 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
2080 /* disable queue 0 to prevent tail write w/o re-config */ 2078 /* disable queue 0 to prevent tail write w/o re-config */
2081 wr32(E1000_RXDCTL(0), 0); 2079 wr32(E1000_RXDCTL(0), 0);
2082 2080
2083 vmolr = rd32(E1000_VMOLR(j)); 2081 vmolr = rd32(E1000_VMOLR(adapter->vfs_allocated_count));
2084 if (rctl & E1000_RCTL_LPE) 2082 if (rctl & E1000_RCTL_LPE)
2085 vmolr |= E1000_VMOLR_LPE; 2083 vmolr |= E1000_VMOLR_LPE;
2086 if (adapter->num_rx_queues > 0) 2084 if (adapter->num_rx_queues > 1)
2087 vmolr |= E1000_VMOLR_RSSE; 2085 vmolr |= E1000_VMOLR_RSSE;
2088 wr32(E1000_VMOLR(j), vmolr); 2086 wr32(E1000_VMOLR(adapter->vfs_allocated_count), vmolr);
2089 } 2087 }
2090 2088
2091 for (i = 0; i < adapter->num_rx_queues; i++) { 2089 for (i = 0; i < adapter->num_rx_queues; i++) {
2092 j = adapter->rx_ring[i].reg_idx; 2090 int j = adapter->rx_ring[i].reg_idx;
2093 wr32(E1000_SRRCTL(j), srrctl); 2091 wr32(E1000_SRRCTL(j), srrctl);
2094 } 2092 }
2095 2093
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index aa08987f6e81..dbd3436912b8 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -127,11 +127,11 @@ static unsigned long mdio_read(struct meth_private *priv, unsigned long phyreg)
127static int mdio_probe(struct meth_private *priv) 127static int mdio_probe(struct meth_private *priv)
128{ 128{
129 int i; 129 int i;
130 unsigned long p2, p3; 130 unsigned long p2, p3, flags;
131 /* check if phy is detected already */ 131 /* check if phy is detected already */
132 if(priv->phy_addr>=0&&priv->phy_addr<32) 132 if(priv->phy_addr>=0&&priv->phy_addr<32)
133 return 0; 133 return 0;
134 spin_lock(&priv->meth_lock); 134 spin_lock_irqsave(&priv->meth_lock, flags);
135 for (i=0;i<32;++i){ 135 for (i=0;i<32;++i){
136 priv->phy_addr=i; 136 priv->phy_addr=i;
137 p2=mdio_read(priv,2); 137 p2=mdio_read(priv,2);
@@ -157,7 +157,7 @@ static int mdio_probe(struct meth_private *priv)
157 break; 157 break;
158 } 158 }
159 } 159 }
160 spin_unlock(&priv->meth_lock); 160 spin_unlock_irqrestore(&priv->meth_lock, flags);
161 if(priv->phy_addr<32) { 161 if(priv->phy_addr<32) {
162 return 0; 162 return 0;
163 } 163 }
@@ -373,14 +373,14 @@ static int meth_release(struct net_device *dev)
373static void meth_rx(struct net_device* dev, unsigned long int_status) 373static void meth_rx(struct net_device* dev, unsigned long int_status)
374{ 374{
375 struct sk_buff *skb; 375 struct sk_buff *skb;
376 unsigned long status; 376 unsigned long status, flags;
377 struct meth_private *priv = netdev_priv(dev); 377 struct meth_private *priv = netdev_priv(dev);
378 unsigned long fifo_rptr = (int_status & METH_INT_RX_RPTR_MASK) >> 8; 378 unsigned long fifo_rptr = (int_status & METH_INT_RX_RPTR_MASK) >> 8;
379 379
380 spin_lock(&priv->meth_lock); 380 spin_lock_irqsave(&priv->meth_lock, flags);
381 priv->dma_ctrl &= ~METH_DMA_RX_INT_EN; 381 priv->dma_ctrl &= ~METH_DMA_RX_INT_EN;
382 mace->eth.dma_ctrl = priv->dma_ctrl; 382 mace->eth.dma_ctrl = priv->dma_ctrl;
383 spin_unlock(&priv->meth_lock); 383 spin_unlock_irqrestore(&priv->meth_lock, flags);
384 384
385 if (int_status & METH_INT_RX_UNDERFLOW) { 385 if (int_status & METH_INT_RX_UNDERFLOW) {
386 fifo_rptr = (fifo_rptr - 1) & 0x0f; 386 fifo_rptr = (fifo_rptr - 1) & 0x0f;
@@ -452,12 +452,12 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
452 mace->eth.rx_fifo = priv->rx_ring_dmas[priv->rx_write]; 452 mace->eth.rx_fifo = priv->rx_ring_dmas[priv->rx_write];
453 ADVANCE_RX_PTR(priv->rx_write); 453 ADVANCE_RX_PTR(priv->rx_write);
454 } 454 }
455 spin_lock(&priv->meth_lock); 455 spin_lock_irqsave(&priv->meth_lock, flags);
456 /* In case there was underflow, and Rx DMA was disabled */ 456 /* In case there was underflow, and Rx DMA was disabled */
457 priv->dma_ctrl |= METH_DMA_RX_INT_EN | METH_DMA_RX_EN; 457 priv->dma_ctrl |= METH_DMA_RX_INT_EN | METH_DMA_RX_EN;
458 mace->eth.dma_ctrl = priv->dma_ctrl; 458 mace->eth.dma_ctrl = priv->dma_ctrl;
459 mace->eth.int_stat = METH_INT_RX_THRESHOLD; 459 mace->eth.int_stat = METH_INT_RX_THRESHOLD;
460 spin_unlock(&priv->meth_lock); 460 spin_unlock_irqrestore(&priv->meth_lock, flags);
461} 461}
462 462
463static int meth_tx_full(struct net_device *dev) 463static int meth_tx_full(struct net_device *dev)
@@ -470,11 +470,11 @@ static int meth_tx_full(struct net_device *dev)
470static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status) 470static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
471{ 471{
472 struct meth_private *priv = netdev_priv(dev); 472 struct meth_private *priv = netdev_priv(dev);
473 unsigned long status; 473 unsigned long status, flags;
474 struct sk_buff *skb; 474 struct sk_buff *skb;
475 unsigned long rptr = (int_status&TX_INFO_RPTR) >> 16; 475 unsigned long rptr = (int_status&TX_INFO_RPTR) >> 16;
476 476
477 spin_lock(&priv->meth_lock); 477 spin_lock_irqsave(&priv->meth_lock, flags);
478 478
479 /* Stop DMA notification */ 479 /* Stop DMA notification */
480 priv->dma_ctrl &= ~(METH_DMA_TX_INT_EN); 480 priv->dma_ctrl &= ~(METH_DMA_TX_INT_EN);
@@ -527,12 +527,13 @@ static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
527 } 527 }
528 528
529 mace->eth.int_stat = METH_INT_TX_EMPTY | METH_INT_TX_PKT; 529 mace->eth.int_stat = METH_INT_TX_EMPTY | METH_INT_TX_PKT;
530 spin_unlock(&priv->meth_lock); 530 spin_unlock_irqrestore(&priv->meth_lock, flags);
531} 531}
532 532
533static void meth_error(struct net_device* dev, unsigned status) 533static void meth_error(struct net_device* dev, unsigned status)
534{ 534{
535 struct meth_private *priv = netdev_priv(dev); 535 struct meth_private *priv = netdev_priv(dev);
536 unsigned long flags;
536 537
537 printk(KERN_WARNING "meth: error status: 0x%08x\n",status); 538 printk(KERN_WARNING "meth: error status: 0x%08x\n",status);
538 /* check for errors too... */ 539 /* check for errors too... */
@@ -547,7 +548,7 @@ static void meth_error(struct net_device* dev, unsigned status)
547 printk(KERN_WARNING "meth: Rx overflow\n"); 548 printk(KERN_WARNING "meth: Rx overflow\n");
548 if (status & (METH_INT_RX_UNDERFLOW)) { 549 if (status & (METH_INT_RX_UNDERFLOW)) {
549 printk(KERN_WARNING "meth: Rx underflow\n"); 550 printk(KERN_WARNING "meth: Rx underflow\n");
550 spin_lock(&priv->meth_lock); 551 spin_lock_irqsave(&priv->meth_lock, flags);
551 mace->eth.int_stat = METH_INT_RX_UNDERFLOW; 552 mace->eth.int_stat = METH_INT_RX_UNDERFLOW;
552 /* more underflow interrupts will be delivered, 553 /* more underflow interrupts will be delivered,
553 * effectively throwing us into an infinite loop. 554 * effectively throwing us into an infinite loop.
@@ -555,7 +556,7 @@ static void meth_error(struct net_device* dev, unsigned status)
555 priv->dma_ctrl &= ~METH_DMA_RX_EN; 556 priv->dma_ctrl &= ~METH_DMA_RX_EN;
556 mace->eth.dma_ctrl = priv->dma_ctrl; 557 mace->eth.dma_ctrl = priv->dma_ctrl;
557 DPRINTK("Disabled meth Rx DMA temporarily\n"); 558 DPRINTK("Disabled meth Rx DMA temporarily\n");
558 spin_unlock(&priv->meth_lock); 559 spin_unlock_irqrestore(&priv->meth_lock, flags);
559 } 560 }
560 mace->eth.int_stat = METH_INT_ERROR; 561 mace->eth.int_stat = METH_INT_ERROR;
561} 562}
diff --git a/drivers/net/mlx4/en_cq.c b/drivers/net/mlx4/en_cq.c
index 91f50de84be9..a276125b709b 100644
--- a/drivers/net/mlx4/en_cq.c
+++ b/drivers/net/mlx4/en_cq.c
@@ -125,8 +125,10 @@ void mlx4_en_deactivate_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq)
125 125
126 if (cq->is_tx) 126 if (cq->is_tx)
127 del_timer(&cq->timer); 127 del_timer(&cq->timer);
128 else 128 else {
129 napi_disable(&cq->napi); 129 napi_disable(&cq->napi);
130 netif_napi_del(&cq->napi);
131 }
130 132
131 mlx4_cq_free(mdev->dev, &cq->mcq); 133 mlx4_cq_free(mdev->dev, &cq->mcq);
132} 134}
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 7942c4d3cd88..9ee873e872b3 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -951,7 +951,6 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv,
951 if (err) { 951 if (err) {
952 mlx4_err(mdev, "Failed to allocate qp #%d\n", qpn); 952 mlx4_err(mdev, "Failed to allocate qp #%d\n", qpn);
953 goto out; 953 goto out;
954 return err;
955 } 954 }
956 qp->event = mlx4_en_sqp_event; 955 qp->event = mlx4_en_sqp_event;
957 956
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index a400d7115f78..6bb5af35eda6 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -569,7 +569,7 @@ static int rxq_process(struct rx_queue *rxq, int budget)
569 if (rxq->rx_curr_desc == rxq->rx_ring_size) 569 if (rxq->rx_curr_desc == rxq->rx_ring_size)
570 rxq->rx_curr_desc = 0; 570 rxq->rx_curr_desc = 0;
571 571
572 dma_unmap_single(NULL, rx_desc->buf_ptr, 572 dma_unmap_single(mp->dev->dev.parent, rx_desc->buf_ptr,
573 rx_desc->buf_size, DMA_FROM_DEVICE); 573 rx_desc->buf_size, DMA_FROM_DEVICE);
574 rxq->rx_desc_count--; 574 rxq->rx_desc_count--;
575 rx++; 575 rx++;
@@ -678,8 +678,9 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
678 678
679 rx_desc = rxq->rx_desc_area + rx; 679 rx_desc = rxq->rx_desc_area + rx;
680 680
681 rx_desc->buf_ptr = dma_map_single(NULL, skb->data, 681 rx_desc->buf_ptr = dma_map_single(mp->dev->dev.parent,
682 mp->skb_size, DMA_FROM_DEVICE); 682 skb->data, mp->skb_size,
683 DMA_FROM_DEVICE);
683 rx_desc->buf_size = mp->skb_size; 684 rx_desc->buf_size = mp->skb_size;
684 rxq->rx_skb[rx] = skb; 685 rxq->rx_skb[rx] = skb;
685 wmb(); 686 wmb();
@@ -718,6 +719,7 @@ static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
718 719
719static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb) 720static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb)
720{ 721{
722 struct mv643xx_eth_private *mp = txq_to_mp(txq);
721 int nr_frags = skb_shinfo(skb)->nr_frags; 723 int nr_frags = skb_shinfo(skb)->nr_frags;
722 int frag; 724 int frag;
723 725
@@ -746,10 +748,10 @@ static void txq_submit_frag_skb(struct tx_queue *txq, struct sk_buff *skb)
746 748
747 desc->l4i_chk = 0; 749 desc->l4i_chk = 0;
748 desc->byte_cnt = this_frag->size; 750 desc->byte_cnt = this_frag->size;
749 desc->buf_ptr = dma_map_page(NULL, this_frag->page, 751 desc->buf_ptr = dma_map_page(mp->dev->dev.parent,
750 this_frag->page_offset, 752 this_frag->page,
751 this_frag->size, 753 this_frag->page_offset,
752 DMA_TO_DEVICE); 754 this_frag->size, DMA_TO_DEVICE);
753 } 755 }
754} 756}
755 757
@@ -826,7 +828,8 @@ no_csum:
826 828
827 desc->l4i_chk = l4i_chk; 829 desc->l4i_chk = l4i_chk;
828 desc->byte_cnt = length; 830 desc->byte_cnt = length;
829 desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE); 831 desc->buf_ptr = dma_map_single(mp->dev->dev.parent, skb->data,
832 length, DMA_TO_DEVICE);
830 833
831 __skb_queue_tail(&txq->tx_skb, skb); 834 __skb_queue_tail(&txq->tx_skb, skb);
832 835
@@ -956,10 +959,10 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
956 } 959 }
957 960
958 if (cmd_sts & TX_FIRST_DESC) { 961 if (cmd_sts & TX_FIRST_DESC) {
959 dma_unmap_single(NULL, desc->buf_ptr, 962 dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr,
960 desc->byte_cnt, DMA_TO_DEVICE); 963 desc->byte_cnt, DMA_TO_DEVICE);
961 } else { 964 } else {
962 dma_unmap_page(NULL, desc->buf_ptr, 965 dma_unmap_page(mp->dev->dev.parent, desc->buf_ptr,
963 desc->byte_cnt, DMA_TO_DEVICE); 966 desc->byte_cnt, DMA_TO_DEVICE);
964 } 967 }
965 968
@@ -1894,9 +1897,9 @@ static int rxq_init(struct mv643xx_eth_private *mp, int index)
1894 mp->rx_desc_sram_size); 1897 mp->rx_desc_sram_size);
1895 rxq->rx_desc_dma = mp->rx_desc_sram_addr; 1898 rxq->rx_desc_dma = mp->rx_desc_sram_addr;
1896 } else { 1899 } else {
1897 rxq->rx_desc_area = dma_alloc_coherent(NULL, size, 1900 rxq->rx_desc_area = dma_alloc_coherent(mp->dev->dev.parent,
1898 &rxq->rx_desc_dma, 1901 size, &rxq->rx_desc_dma,
1899 GFP_KERNEL); 1902 GFP_KERNEL);
1900 } 1903 }
1901 1904
1902 if (rxq->rx_desc_area == NULL) { 1905 if (rxq->rx_desc_area == NULL) {
@@ -1947,7 +1950,7 @@ out_free:
1947 if (index == 0 && size <= mp->rx_desc_sram_size) 1950 if (index == 0 && size <= mp->rx_desc_sram_size)
1948 iounmap(rxq->rx_desc_area); 1951 iounmap(rxq->rx_desc_area);
1949 else 1952 else
1950 dma_free_coherent(NULL, size, 1953 dma_free_coherent(mp->dev->dev.parent, size,
1951 rxq->rx_desc_area, 1954 rxq->rx_desc_area,
1952 rxq->rx_desc_dma); 1955 rxq->rx_desc_dma);
1953 1956
@@ -1979,7 +1982,7 @@ static void rxq_deinit(struct rx_queue *rxq)
1979 rxq->rx_desc_area_size <= mp->rx_desc_sram_size) 1982 rxq->rx_desc_area_size <= mp->rx_desc_sram_size)
1980 iounmap(rxq->rx_desc_area); 1983 iounmap(rxq->rx_desc_area);
1981 else 1984 else
1982 dma_free_coherent(NULL, rxq->rx_desc_area_size, 1985 dma_free_coherent(mp->dev->dev.parent, rxq->rx_desc_area_size,
1983 rxq->rx_desc_area, rxq->rx_desc_dma); 1986 rxq->rx_desc_area, rxq->rx_desc_dma);
1984 1987
1985 kfree(rxq->rx_skb); 1988 kfree(rxq->rx_skb);
@@ -2007,9 +2010,9 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
2007 mp->tx_desc_sram_size); 2010 mp->tx_desc_sram_size);
2008 txq->tx_desc_dma = mp->tx_desc_sram_addr; 2011 txq->tx_desc_dma = mp->tx_desc_sram_addr;
2009 } else { 2012 } else {
2010 txq->tx_desc_area = dma_alloc_coherent(NULL, size, 2013 txq->tx_desc_area = dma_alloc_coherent(mp->dev->dev.parent,
2011 &txq->tx_desc_dma, 2014 size, &txq->tx_desc_dma,
2012 GFP_KERNEL); 2015 GFP_KERNEL);
2013 } 2016 }
2014 2017
2015 if (txq->tx_desc_area == NULL) { 2018 if (txq->tx_desc_area == NULL) {
@@ -2053,7 +2056,7 @@ static void txq_deinit(struct tx_queue *txq)
2053 txq->tx_desc_area_size <= mp->tx_desc_sram_size) 2056 txq->tx_desc_area_size <= mp->tx_desc_sram_size)
2054 iounmap(txq->tx_desc_area); 2057 iounmap(txq->tx_desc_area);
2055 else 2058 else
2056 dma_free_coherent(NULL, txq->tx_desc_area_size, 2059 dma_free_coherent(mp->dev->dev.parent, txq->tx_desc_area_size,
2057 txq->tx_desc_area, txq->tx_desc_dma); 2060 txq->tx_desc_area, txq->tx_desc_dma);
2058} 2061}
2059 2062
diff --git a/drivers/net/vxge/vxge-traffic.c b/drivers/net/vxge/vxge-traffic.c
index 7be0ae10d69b..c2eeac4125f3 100644
--- a/drivers/net/vxge/vxge-traffic.c
+++ b/drivers/net/vxge/vxge-traffic.c
@@ -115,7 +115,7 @@ enum vxge_hw_status vxge_hw_vpath_intr_enable(struct __vxge_hw_vpath_handle *vp)
115 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO1_POISON| 115 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO1_POISON|
116 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO2_POISON| 116 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO2_POISON|
117 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO1_DMA_ERR| 117 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO1_DMA_ERR|
118 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO1_DMA_ERR), 0, 32), 118 VXGE_HW_KDFCCTL_ERRORS_REG_KDFCCTL_FIFO2_DMA_ERR), 0, 32),
119 &vp_reg->kdfcctl_errors_mask); 119 &vp_reg->kdfcctl_errors_mask);
120 120
121 __vxge_hw_pio_mem_write32_upper(0, &vp_reg->vpath_ppif_int_mask); 121 __vxge_hw_pio_mem_write32_upper(0, &vp_reg->vpath_ppif_int_mask);
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 3bf7d3f447db..765a7f5d6aa4 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -1249,7 +1249,7 @@ static int __devinit hss_init_one(struct platform_device *pdev)
1249 return -ENOMEM; 1249 return -ENOMEM;
1250 1250
1251 if ((port->npe = npe_request(0)) == NULL) { 1251 if ((port->npe = npe_request(0)) == NULL) {
1252 err = -ENOSYS; 1252 err = -ENODEV;
1253 goto err_free; 1253 goto err_free;
1254 } 1254 }
1255 1255
@@ -1311,7 +1311,7 @@ static int __init hss_init_module(void)
1311 if ((ixp4xx_read_feature_bits() & 1311 if ((ixp4xx_read_feature_bits() &
1312 (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) != 1312 (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) !=
1313 (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) 1313 (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS))
1314 return -ENOSYS; 1314 return -ENODEV;
1315 1315
1316 spin_lock_init(&npe_lock); 1316 spin_lock_init(&npe_lock);
1317 1317
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index 02419bfd64b5..f9fc38902322 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -819,10 +819,9 @@ void i2400m_roq_queue_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
819 roq_data = (struct i2400m_roq_data *) &skb->cb; 819 roq_data = (struct i2400m_roq_data *) &skb->cb;
820 i2400m_net_erx(i2400m, skb, roq_data->cs); 820 i2400m_net_erx(i2400m, skb, roq_data->cs);
821 } 821 }
822 else { 822 else
823 __i2400m_roq_queue(i2400m, roq, skb, sn, nsn); 823 __i2400m_roq_queue(i2400m, roq, skb, sn, nsn);
824 __i2400m_roq_update_ws(i2400m, roq, sn + 1); 824 __i2400m_roq_update_ws(i2400m, roq, sn + 1);
825 }
826 i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_PACKET_WS, 825 i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_PACKET_WS,
827 old_ws, len, sn, nsn, roq->ws); 826 old_ws, len, sn, nsn, roq->ws);
828 } 827 }
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index c36d3a3d655f..d73475739127 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -6501,7 +6501,10 @@ static int airo_get_encode(struct net_device *dev,
6501 6501
6502 /* Copy the key to the user buffer */ 6502 /* Copy the key to the user buffer */
6503 dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf)); 6503 dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf));
6504 memcpy(extra, buf, dwrq->length); 6504 if (dwrq->length != -1)
6505 memcpy(extra, buf, dwrq->length);
6506 else
6507 dwrq->length = 0;
6505 6508
6506 return 0; 6509 return 0;
6507} 6510}
@@ -6659,7 +6662,10 @@ static int airo_get_encodeext(struct net_device *dev,
6659 6662
6660 /* Copy the key to the user buffer */ 6663 /* Copy the key to the user buffer */
6661 ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); 6664 ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf));
6662 memcpy(extra, buf, ext->key_len); 6665 if (ext->key_len != -1)
6666 memcpy(extra, buf, ext->key_len);
6667 else
6668 ext->key_len = 0;
6663 6669
6664 return 0; 6670 return 0;
6665} 6671}
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index a08bc8a4fb69..32df27a9c7a2 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -214,7 +214,7 @@ static struct pci_driver ath5k_pci_driver = {
214 * Prototypes - MAC 802.11 stack related functions 214 * Prototypes - MAC 802.11 stack related functions
215 */ 215 */
216static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 216static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb);
217static int ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel); 217static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan);
218static int ath5k_reset_wake(struct ath5k_softc *sc); 218static int ath5k_reset_wake(struct ath5k_softc *sc);
219static int ath5k_start(struct ieee80211_hw *hw); 219static int ath5k_start(struct ieee80211_hw *hw);
220static void ath5k_stop(struct ieee80211_hw *hw); 220static void ath5k_stop(struct ieee80211_hw *hw);
@@ -1038,16 +1038,13 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)
1038 if (chan->center_freq != sc->curchan->center_freq || 1038 if (chan->center_freq != sc->curchan->center_freq ||
1039 chan->hw_value != sc->curchan->hw_value) { 1039 chan->hw_value != sc->curchan->hw_value) {
1040 1040
1041 sc->curchan = chan;
1042 sc->curband = &sc->sbands[chan->band];
1043
1044 /* 1041 /*
1045 * To switch channels clear any pending DMA operations; 1042 * To switch channels clear any pending DMA operations;
1046 * wait long enough for the RX fifo to drain, reset the 1043 * wait long enough for the RX fifo to drain, reset the
1047 * hardware at the new frequency, and then re-enable 1044 * hardware at the new frequency, and then re-enable
1048 * the relevant bits of the h/w. 1045 * the relevant bits of the h/w.
1049 */ 1046 */
1050 return ath5k_reset(sc, true, true); 1047 return ath5k_reset(sc, chan);
1051 } 1048 }
1052 1049
1053 return 0; 1050 return 0;
@@ -2314,7 +2311,7 @@ ath5k_init(struct ath5k_softc *sc)
2314 sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL | 2311 sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL |
2315 AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL | 2312 AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL |
2316 AR5K_INT_FATAL | AR5K_INT_GLOBAL; 2313 AR5K_INT_FATAL | AR5K_INT_GLOBAL;
2317 ret = ath5k_reset(sc, false, false); 2314 ret = ath5k_reset(sc, NULL);
2318 if (ret) 2315 if (ret)
2319 goto done; 2316 goto done;
2320 2317
@@ -2599,18 +2596,25 @@ drop_packet:
2599 return NETDEV_TX_OK; 2596 return NETDEV_TX_OK;
2600} 2597}
2601 2598
2599/*
2600 * Reset the hardware. If chan is not NULL, then also pause rx/tx
2601 * and change to the given channel.
2602 */
2602static int 2603static int
2603ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel) 2604ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan)
2604{ 2605{
2605 struct ath5k_hw *ah = sc->ah; 2606 struct ath5k_hw *ah = sc->ah;
2606 int ret; 2607 int ret;
2607 2608
2608 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); 2609 ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n");
2609 2610
2610 if (stop) { 2611 if (chan) {
2611 ath5k_hw_set_imr(ah, 0); 2612 ath5k_hw_set_imr(ah, 0);
2612 ath5k_txq_cleanup(sc); 2613 ath5k_txq_cleanup(sc);
2613 ath5k_rx_stop(sc); 2614 ath5k_rx_stop(sc);
2615
2616 sc->curchan = chan;
2617 sc->curband = &sc->sbands[chan->band];
2614 } 2618 }
2615 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, true); 2619 ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, true);
2616 if (ret) { 2620 if (ret) {
@@ -2648,7 +2652,7 @@ ath5k_reset_wake(struct ath5k_softc *sc)
2648{ 2652{
2649 int ret; 2653 int ret;
2650 2654
2651 ret = ath5k_reset(sc, true, true); 2655 ret = ath5k_reset(sc, sc->curchan);
2652 if (!ret) 2656 if (!ret)
2653 ieee80211_wake_queues(sc->hw); 2657 ieee80211_wake_queues(sc->hw);
2654 2658
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index edfa5e149f71..bd438d8acf55 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -101,8 +101,8 @@ struct iwl_cfg iwl6000_2agn_cfg = {
101 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 101 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
102 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 102 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
103 .mod_params = &iwl50_mod_params, 103 .mod_params = &iwl50_mod_params,
104 .valid_tx_ant = ANT_BC, 104 .valid_tx_ant = ANT_AB,
105 .valid_rx_ant = ANT_BC, 105 .valid_rx_ant = ANT_AB,
106 .need_pll_cfg = false, 106 .need_pll_cfg = false,
107}; 107};
108 108
@@ -117,8 +117,8 @@ struct iwl_cfg iwl6050_2agn_cfg = {
117 .eeprom_ver = EEPROM_5000_EEPROM_VERSION, 117 .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
118 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 118 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
119 .mod_params = &iwl50_mod_params, 119 .mod_params = &iwl50_mod_params,
120 .valid_tx_ant = ANT_BC, 120 .valid_tx_ant = ANT_AB,
121 .valid_rx_ant = ANT_BC, 121 .valid_rx_ant = ANT_AB,
122 .need_pll_cfg = false, 122 .need_pll_cfg = false,
123}; 123};
124 124
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 1ef4192207a5..3bb28db4a40f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3636,7 +3636,9 @@ static struct pci_device_id iwl_hw_card_ids[] = {
3636 {IWL_PCI_DEVICE(0x0085, 0x1112, iwl6000_2ag_cfg)}, 3636 {IWL_PCI_DEVICE(0x0085, 0x1112, iwl6000_2ag_cfg)},
3637 {IWL_PCI_DEVICE(0x0082, 0x1122, iwl6000_2ag_cfg)}, 3637 {IWL_PCI_DEVICE(0x0082, 0x1122, iwl6000_2ag_cfg)},
3638 {IWL_PCI_DEVICE(0x422B, PCI_ANY_ID, iwl6000_3agn_cfg)}, 3638 {IWL_PCI_DEVICE(0x422B, PCI_ANY_ID, iwl6000_3agn_cfg)},
3639 {IWL_PCI_DEVICE(0x422C, PCI_ANY_ID, iwl6000_2agn_cfg)},
3639 {IWL_PCI_DEVICE(0x4238, PCI_ANY_ID, iwl6000_3agn_cfg)}, 3640 {IWL_PCI_DEVICE(0x4238, PCI_ANY_ID, iwl6000_3agn_cfg)},
3641 {IWL_PCI_DEVICE(0x4239, PCI_ANY_ID, iwl6000_2agn_cfg)},
3640 {IWL_PCI_DEVICE(0x0082, PCI_ANY_ID, iwl6000_2agn_cfg)}, 3642 {IWL_PCI_DEVICE(0x0082, PCI_ANY_ID, iwl6000_2agn_cfg)},
3641 {IWL_PCI_DEVICE(0x0085, PCI_ANY_ID, iwl6000_3agn_cfg)}, 3643 {IWL_PCI_DEVICE(0x0085, PCI_ANY_ID, iwl6000_3agn_cfg)},
3642 {IWL_PCI_DEVICE(0x0086, PCI_ANY_ID, iwl6050_3agn_cfg)}, 3644 {IWL_PCI_DEVICE(0x0086, PCI_ANY_ID, iwl6050_3agn_cfg)},
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 5798fe49c771..44ab03a12e40 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -719,6 +719,14 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
719{ 719{
720 unsigned long flags; 720 unsigned long flags;
721 int ret = 0; 721 int ret = 0;
722 __le16 key_flags = 0;
723
724 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
725 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
726 key_flags &= ~STA_KEY_FLG_INVALID;
727
728 if (sta_id == priv->hw_params.bcast_sta_id)
729 key_flags |= STA_KEY_MULTICAST_MSK;
722 730
723 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 731 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
724 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 732 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
@@ -738,6 +746,9 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
738 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, 746 WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
739 "no space for a new key"); 747 "no space for a new key");
740 748
749 priv->stations[sta_id].sta.key.key_flags = key_flags;
750
751
741 /* This copy is acutally not needed: we get the key with each TX */ 752 /* This copy is acutally not needed: we get the key with each TX */
742 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16); 753 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);
743 754
@@ -754,9 +765,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
754{ 765{
755 u8 sta_id = IWL_INVALID_STATION; 766 u8 sta_id = IWL_INVALID_STATION;
756 unsigned long flags; 767 unsigned long flags;
757 __le16 key_flags = 0;
758 int i; 768 int i;
759 DECLARE_MAC_BUF(mac);
760 769
761 sta_id = iwl_find_station(priv, addr); 770 sta_id = iwl_find_station(priv, addr);
762 if (sta_id == IWL_INVALID_STATION) { 771 if (sta_id == IWL_INVALID_STATION) {
@@ -771,16 +780,8 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
771 return; 780 return;
772 } 781 }
773 782
774 key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
775 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
776 key_flags &= ~STA_KEY_FLG_INVALID;
777
778 if (sta_id == priv->hw_params.bcast_sta_id)
779 key_flags |= STA_KEY_MULTICAST_MSK;
780
781 spin_lock_irqsave(&priv->sta_lock, flags); 783 spin_lock_irqsave(&priv->sta_lock, flags);
782 784
783 priv->stations[sta_id].sta.key.key_flags = key_flags;
784 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; 785 priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32;
785 786
786 for (i = 0; i < 5; i++) 787 for (i = 0; i < 5; i++)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 70a00c8ee42e..4cce66133500 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1744,7 +1744,6 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
1744 rxq->bd = NULL; 1744 rxq->bd = NULL;
1745 rxq->rb_stts = NULL; 1745 rxq->rb_stts = NULL;
1746} 1746}
1747EXPORT_SYMBOL(iwl3945_rx_queue_free);
1748 1747
1749 1748
1750/* Convert linear signal-to-noise ratio into dB */ 1749/* Convert linear signal-to-noise ratio into dB */
diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187.h
index 9718f61809cf..edeff82a4d06 100644
--- a/drivers/net/wireless/rtl818x/rtl8187.h
+++ b/drivers/net/wireless/rtl818x/rtl8187.h
@@ -120,6 +120,12 @@ struct rtl8187_priv {
120 __le64 buf; 120 __le64 buf;
121 struct sk_buff_head queue; 121 struct sk_buff_head queue;
122 } b_tx_status; /* This queue is used by both -b and non-b devices */ 122 } b_tx_status; /* This queue is used by both -b and non-b devices */
123 struct mutex io_mutex;
124 union {
125 u8 bits8;
126 __le16 bits16;
127 __le32 bits32;
128 } *io_dmabuf;
123}; 129};
124 130
125void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); 131void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
@@ -129,10 +135,14 @@ static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
129{ 135{
130 u8 val; 136 u8 val;
131 137
138 mutex_lock(&priv->io_mutex);
132 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), 139 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
133 RTL8187_REQ_GET_REG, RTL8187_REQT_READ, 140 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
134 (unsigned long)addr, idx & 0x03, &val, 141 (unsigned long)addr, idx & 0x03,
135 sizeof(val), HZ / 2); 142 &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
143
144 val = priv->io_dmabuf->bits8;
145 mutex_unlock(&priv->io_mutex);
136 146
137 return val; 147 return val;
138} 148}
@@ -147,10 +157,14 @@ static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
147{ 157{
148 __le16 val; 158 __le16 val;
149 159
160 mutex_lock(&priv->io_mutex);
150 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), 161 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
151 RTL8187_REQ_GET_REG, RTL8187_REQT_READ, 162 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
152 (unsigned long)addr, idx & 0x03, &val, 163 (unsigned long)addr, idx & 0x03,
153 sizeof(val), HZ / 2); 164 &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
165
166 val = priv->io_dmabuf->bits16;
167 mutex_unlock(&priv->io_mutex);
154 168
155 return le16_to_cpu(val); 169 return le16_to_cpu(val);
156} 170}
@@ -165,10 +179,14 @@ static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
165{ 179{
166 __le32 val; 180 __le32 val;
167 181
182 mutex_lock(&priv->io_mutex);
168 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), 183 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
169 RTL8187_REQ_GET_REG, RTL8187_REQT_READ, 184 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
170 (unsigned long)addr, idx & 0x03, &val, 185 (unsigned long)addr, idx & 0x03,
171 sizeof(val), HZ / 2); 186 &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
187
188 val = priv->io_dmabuf->bits32;
189 mutex_unlock(&priv->io_mutex);
172 190
173 return le32_to_cpu(val); 191 return le32_to_cpu(val);
174} 192}
@@ -181,10 +199,15 @@ static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
181static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv, 199static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
182 u8 *addr, u8 val, u8 idx) 200 u8 *addr, u8 val, u8 idx)
183{ 201{
202 mutex_lock(&priv->io_mutex);
203
204 priv->io_dmabuf->bits8 = val;
184 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 205 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
185 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 206 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
186 (unsigned long)addr, idx & 0x03, &val, 207 (unsigned long)addr, idx & 0x03,
187 sizeof(val), HZ / 2); 208 &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
209
210 mutex_unlock(&priv->io_mutex);
188} 211}
189 212
190static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val) 213static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
@@ -195,12 +218,15 @@ static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
195static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv, 218static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
196 __le16 *addr, u16 val, u8 idx) 219 __le16 *addr, u16 val, u8 idx)
197{ 220{
198 __le16 buf = cpu_to_le16(val); 221 mutex_lock(&priv->io_mutex);
199 222
223 priv->io_dmabuf->bits16 = cpu_to_le16(val);
200 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 224 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
201 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 225 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
202 (unsigned long)addr, idx & 0x03, &buf, sizeof(buf), 226 (unsigned long)addr, idx & 0x03,
203 HZ / 2); 227 &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
228
229 mutex_unlock(&priv->io_mutex);
204} 230}
205 231
206static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr, 232static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
@@ -212,12 +238,15 @@ static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
212static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv, 238static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
213 __le32 *addr, u32 val, u8 idx) 239 __le32 *addr, u32 val, u8 idx)
214{ 240{
215 __le32 buf = cpu_to_le32(val); 241 mutex_lock(&priv->io_mutex);
216 242
243 priv->io_dmabuf->bits32 = cpu_to_le32(val);
217 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 244 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
218 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 245 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
219 (unsigned long)addr, idx & 0x03, &buf, sizeof(buf), 246 (unsigned long)addr, idx & 0x03,
220 HZ / 2); 247 &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
248
249 mutex_unlock(&priv->io_mutex);
221} 250}
222 251
223static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr, 252static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr,
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index fd81884b9c7d..bac6cfba6abd 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -1329,6 +1329,14 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1329 priv = dev->priv; 1329 priv = dev->priv;
1330 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B); 1330 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
1331 1331
1332 /* allocate "DMA aware" buffer for register accesses */
1333 priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
1334 if (!priv->io_dmabuf) {
1335 err = -ENOMEM;
1336 goto err_free_dev;
1337 }
1338 mutex_init(&priv->io_mutex);
1339
1332 SET_IEEE80211_DEV(dev, &intf->dev); 1340 SET_IEEE80211_DEV(dev, &intf->dev);
1333 usb_set_intfdata(intf, dev); 1341 usb_set_intfdata(intf, dev);
1334 priv->udev = udev; 1342 priv->udev = udev;
@@ -1495,7 +1503,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1495 err = ieee80211_register_hw(dev); 1503 err = ieee80211_register_hw(dev);
1496 if (err) { 1504 if (err) {
1497 printk(KERN_ERR "rtl8187: Cannot register device\n"); 1505 printk(KERN_ERR "rtl8187: Cannot register device\n");
1498 goto err_free_dev; 1506 goto err_free_dmabuf;
1499 } 1507 }
1500 mutex_init(&priv->conf_mutex); 1508 mutex_init(&priv->conf_mutex);
1501 skb_queue_head_init(&priv->b_tx_status.queue); 1509 skb_queue_head_init(&priv->b_tx_status.queue);
@@ -1506,6 +1514,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1506 1514
1507 return 0; 1515 return 0;
1508 1516
1517 err_free_dmabuf:
1518 kfree(priv->io_dmabuf);
1509 err_free_dev: 1519 err_free_dev:
1510 ieee80211_free_hw(dev); 1520 ieee80211_free_hw(dev);
1511 usb_set_intfdata(intf, NULL); 1521 usb_set_intfdata(intf, NULL);
@@ -1526,6 +1536,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf)
1526 priv = dev->priv; 1536 priv = dev->priv;
1527 usb_reset_device(priv->udev); 1537 usb_reset_device(priv->udev);
1528 usb_put_dev(interface_to_usbdev(intf)); 1538 usb_put_dev(interface_to_usbdev(intf));
1539 kfree(priv->io_dmabuf);
1529 ieee80211_free_hw(dev); 1540 ieee80211_free_hw(dev);
1530} 1541}
1531 1542
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
index 78df281b297a..a09819386a1e 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -88,9 +88,15 @@ static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
88 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); 88 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
89 udelay(10); 89 udelay(10);
90 90
91 mutex_lock(&priv->io_mutex);
92
93 priv->io_dmabuf->bits16 = data;
91 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 94 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
92 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 95 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
93 addr, 0x8225, &data, sizeof(data), HZ / 2); 96 addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data),
97 HZ / 2);
98
99 mutex_unlock(&priv->io_mutex);
94 100
95 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); 101 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
96 udelay(10); 102 udelay(10);
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 001b328adf80..a563fbe559d0 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -59,6 +59,10 @@
59#define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32)) 59#define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32))
60#define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) 60#define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64))
61 61
62#ifndef PHYSICAL_PAGE_MASK
63#define PHYSICAL_PAGE_MASK PAGE_MASK
64#endif
65
62/* global iommu list, set NULL for ignored DMAR units */ 66/* global iommu list, set NULL for ignored DMAR units */
63static struct intel_iommu **g_iommus; 67static struct intel_iommu **g_iommus;
64 68
@@ -1216,7 +1220,7 @@ static void dmar_init_reserved_ranges(void)
1216 if (!r->flags || !(r->flags & IORESOURCE_MEM)) 1220 if (!r->flags || !(r->flags & IORESOURCE_MEM))
1217 continue; 1221 continue;
1218 addr = r->start; 1222 addr = r->start;
1219 addr &= PAGE_MASK; 1223 addr &= PHYSICAL_PAGE_MASK;
1220 size = r->end - addr; 1224 size = r->end - addr;
1221 size = PAGE_ALIGN(size); 1225 size = PAGE_ALIGN(size);
1222 iova = reserve_iova(&reserved_iova_list, IOVA_PFN(addr), 1226 iova = reserve_iova(&reserved_iova_list, IOVA_PFN(addr),
@@ -2173,7 +2177,8 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr,
2173 * is not a big problem 2177 * is not a big problem
2174 */ 2178 */
2175 ret = domain_page_mapping(domain, start_paddr, 2179 ret = domain_page_mapping(domain, start_paddr,
2176 ((u64)paddr) & PAGE_MASK, size, prot); 2180 ((u64)paddr) & PHYSICAL_PAGE_MASK,
2181 size, prot);
2177 if (ret) 2182 if (ret)
2178 goto error; 2183 goto error;
2179 2184
@@ -2463,8 +2468,8 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne
2463 addr = page_to_phys(sg_page(sg)) + sg->offset; 2468 addr = page_to_phys(sg_page(sg)) + sg->offset;
2464 size = aligned_size((u64)addr, sg->length); 2469 size = aligned_size((u64)addr, sg->length);
2465 ret = domain_page_mapping(domain, start_addr + offset, 2470 ret = domain_page_mapping(domain, start_addr + offset,
2466 ((u64)addr) & PAGE_MASK, 2471 ((u64)addr) & PHYSICAL_PAGE_MASK,
2467 size, prot); 2472 size, prot);
2468 if (ret) { 2473 if (ret) {
2469 /* clear the page */ 2474 /* clear the page */
2470 dma_pte_clear_range(domain, start_addr, 2475 dma_pte_clear_range(domain, start_addr,
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 6f2e6295e773..362773247fbf 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -455,8 +455,6 @@ static int msix_capability_init(struct pci_dev *dev,
455 entry->msi_attrib.default_irq = dev->irq; 455 entry->msi_attrib.default_irq = dev->irq;
456 entry->msi_attrib.pos = pos; 456 entry->msi_attrib.pos = pos;
457 entry->mask_base = base; 457 entry->mask_base = base;
458 entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE +
459 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
460 msix_mask_irq(entry, 1); 458 msix_mask_irq(entry, 1);
461 459
462 list_add_tail(&entry->list, &dev->msi_list); 460 list_add_tail(&entry->list, &dev->msi_list);
@@ -493,6 +491,12 @@ static int msix_capability_init(struct pci_dev *dev,
493 msix_set_enable(dev, 1); 491 msix_set_enable(dev, 1);
494 dev->msix_enabled = 1; 492 dev->msix_enabled = 1;
495 493
494 list_for_each_entry(entry, &dev->msi_list, list) {
495 int vector = entry->msi_attrib.entry_nr;
496 entry->masked = readl(base + vector * PCI_MSIX_ENTRY_SIZE +
497 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
498 }
499
496 return 0; 500 return 0;
497} 501}
498 502
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
index c7ad68b6c6d6..aa14482a4779 100644
--- a/drivers/pci/pcie/aer/aerdrv.h
+++ b/drivers/pci/pcie/aer/aerdrv.h
@@ -95,6 +95,9 @@ struct aer_broadcast_data {
95static inline pci_ers_result_t merge_result(enum pci_ers_result orig, 95static inline pci_ers_result_t merge_result(enum pci_ers_result orig,
96 enum pci_ers_result new) 96 enum pci_ers_result new)
97{ 97{
98 if (new == PCI_ERS_RESULT_NONE)
99 return orig;
100
98 switch (orig) { 101 switch (orig) {
99 case PCI_ERS_RESULT_CAN_RECOVER: 102 case PCI_ERS_RESULT_CAN_RECOVER:
100 case PCI_ERS_RESULT_RECOVERED: 103 case PCI_ERS_RESULT_RECOVERED:
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index b924e2463f85..091ce70051e0 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -200,7 +200,7 @@ static int slot_reset_iter(struct device *device, void *data)
200 200
201static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) 201static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev)
202{ 202{
203 pci_ers_result_t status = PCI_ERS_RESULT_NONE; 203 pci_ers_result_t status = PCI_ERS_RESULT_RECOVERED;
204 int retval; 204 int retval;
205 205
206 /* If fatal, restore cfg space for possible link reset at upstream */ 206 /* If fatal, restore cfg space for possible link reset at upstream */
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index eeafc6c0160d..bfc1a8892a32 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -269,16 +269,16 @@ static struct key_entry asus_keymap[] = {
269 {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE}, 269 {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE},
270 {KE_KEY, 0x40, KEY_PREVIOUSSONG}, 270 {KE_KEY, 0x40, KEY_PREVIOUSSONG},
271 {KE_KEY, 0x41, KEY_NEXTSONG}, 271 {KE_KEY, 0x41, KEY_NEXTSONG},
272 {KE_KEY, 0x43, KEY_STOP}, 272 {KE_KEY, 0x43, KEY_STOPCD},
273 {KE_KEY, 0x45, KEY_PLAYPAUSE}, 273 {KE_KEY, 0x45, KEY_PLAYPAUSE},
274 {KE_KEY, 0x50, KEY_EMAIL}, 274 {KE_KEY, 0x50, KEY_EMAIL},
275 {KE_KEY, 0x51, KEY_WWW}, 275 {KE_KEY, 0x51, KEY_WWW},
276 {KE_KEY, 0x5C, BTN_EXTRA}, /* Performance */ 276 {KE_KEY, 0x5C, KEY_SCREENLOCK}, /* Screenlock */
277 {KE_KEY, 0x5D, KEY_WLAN}, 277 {KE_KEY, 0x5D, KEY_WLAN},
278 {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE}, 278 {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE},
279 {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */ 279 {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */
280 {KE_KEY, 0x82, KEY_CAMERA}, 280 {KE_KEY, 0x82, KEY_CAMERA},
281 {KE_KEY, 0x8A, KEY_TV}, 281 {KE_KEY, 0x8A, KEY_PROG1},
282 {KE_KEY, 0x95, KEY_MEDIA}, 282 {KE_KEY, 0x95, KEY_MEDIA},
283 {KE_KEY, 0x99, KEY_PHONE}, 283 {KE_KEY, 0x99, KEY_PHONE},
284 {KE_END, 0}, 284 {KE_END, 0},
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 6f54fd1757cd..353a898c3693 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -158,6 +158,7 @@ enum { KE_KEY, KE_END };
158static struct key_entry eeepc_keymap[] = { 158static struct key_entry eeepc_keymap[] = {
159 /* Sleep already handled via generic ACPI code */ 159 /* Sleep already handled via generic ACPI code */
160 {KE_KEY, 0x10, KEY_WLAN }, 160 {KE_KEY, 0x10, KEY_WLAN },
161 {KE_KEY, 0x11, KEY_WLAN },
161 {KE_KEY, 0x12, KEY_PROG1 }, 162 {KE_KEY, 0x12, KEY_PROG1 },
162 {KE_KEY, 0x13, KEY_MUTE }, 163 {KE_KEY, 0x13, KEY_MUTE },
163 {KE_KEY, 0x14, KEY_VOLUMEDOWN }, 164 {KE_KEY, 0x14, KEY_VOLUMEDOWN },
@@ -166,6 +167,8 @@ static struct key_entry eeepc_keymap[] = {
166 {KE_KEY, 0x1b, KEY_ZOOM }, 167 {KE_KEY, 0x1b, KEY_ZOOM },
167 {KE_KEY, 0x1c, KEY_PROG2 }, 168 {KE_KEY, 0x1c, KEY_PROG2 },
168 {KE_KEY, 0x1d, KEY_PROG3 }, 169 {KE_KEY, 0x1d, KEY_PROG3 },
170 {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN },
171 {KE_KEY, NOTIFY_BRN_MIN + 2, KEY_BRIGHTNESSUP },
169 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, 172 {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
170 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, 173 {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
171 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, 174 {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
@@ -381,11 +384,13 @@ static ssize_t show_sys_acpi(int cm, char *buf)
381EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); 384EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA);
382EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); 385EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER);
383EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); 386EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH);
387EEEPC_CREATE_DEVICE_ATTR(cpufv, CM_ASL_CPUFV);
384 388
385static struct attribute *platform_attributes[] = { 389static struct attribute *platform_attributes[] = {
386 &dev_attr_camera.attr, 390 &dev_attr_camera.attr,
387 &dev_attr_cardr.attr, 391 &dev_attr_cardr.attr,
388 &dev_attr_disp.attr, 392 &dev_attr_disp.attr,
393 &dev_attr_cpufv.attr,
389 NULL 394 NULL
390}; 395};
391 396
@@ -512,15 +517,21 @@ static int eeepc_hotk_check(void)
512 return 0; 517 return 0;
513} 518}
514 519
515static void notify_brn(void) 520static int notify_brn(void)
516{ 521{
522 /* returns the *previous* brightness, or -1 */
517 struct backlight_device *bd = eeepc_backlight_device; 523 struct backlight_device *bd = eeepc_backlight_device;
518 if (bd) 524 if (bd) {
525 int old = bd->props.brightness;
519 bd->props.brightness = read_brightness(bd); 526 bd->props.brightness = read_brightness(bd);
527 return old;
528 }
529 return -1;
520} 530}
521 531
522static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 532static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
523{ 533{
534 enum rfkill_state state;
524 struct pci_dev *dev; 535 struct pci_dev *dev;
525 struct pci_bus *bus = pci_find_bus(0, 1); 536 struct pci_bus *bus = pci_find_bus(0, 1);
526 537
@@ -532,7 +543,9 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
532 return; 543 return;
533 } 544 }
534 545
535 if (get_acpi(CM_ASL_WLAN) == 1) { 546 eeepc_wlan_rfkill_state(ehotk->eeepc_wlan_rfkill, &state);
547
548 if (state == RFKILL_STATE_UNBLOCKED) {
536 dev = pci_get_slot(bus, 0); 549 dev = pci_get_slot(bus, 0);
537 if (dev) { 550 if (dev) {
538 /* Device already present */ 551 /* Device already present */
@@ -552,23 +565,41 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
552 pci_dev_put(dev); 565 pci_dev_put(dev);
553 } 566 }
554 } 567 }
568
569 rfkill_force_state(ehotk->eeepc_wlan_rfkill, state);
555} 570}
556 571
557static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) 572static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
558{ 573{
559 static struct key_entry *key; 574 static struct key_entry *key;
560 u16 count; 575 u16 count;
576 int brn = -ENODEV;
561 577
562 if (!ehotk) 578 if (!ehotk)
563 return; 579 return;
564 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) 580 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
565 notify_brn(); 581 brn = notify_brn();
566 count = ehotk->event_count[event % 128]++; 582 count = ehotk->event_count[event % 128]++;
567 acpi_bus_generate_proc_event(ehotk->device, event, count); 583 acpi_bus_generate_proc_event(ehotk->device, event, count);
568 acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class, 584 acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class,
569 dev_name(&ehotk->device->dev), event, 585 dev_name(&ehotk->device->dev), event,
570 count); 586 count);
571 if (ehotk->inputdev) { 587 if (ehotk->inputdev) {
588 if (brn != -ENODEV) {
589 /* brightness-change events need special
590 * handling for conversion to key events
591 */
592 if (brn < 0)
593 brn = event;
594 else
595 brn += NOTIFY_BRN_MIN;
596 if (event < brn)
597 event = NOTIFY_BRN_MIN; /* brightness down */
598 else if (event > brn)
599 event = NOTIFY_BRN_MIN + 2; /* ... up */
600 else
601 event = NOTIFY_BRN_MIN + 1; /* ... unchanged */
602 }
572 key = eepc_get_entry_by_scancode(event); 603 key = eepc_get_entry_by_scancode(event);
573 if (key) { 604 if (key) {
574 switch (key->type) { 605 switch (key->type) {
@@ -649,6 +680,9 @@ static int eeepc_hotk_add(struct acpi_device *device)
649 if (ACPI_FAILURE(status)) 680 if (ACPI_FAILURE(status))
650 printk(EEEPC_ERR "Error installing notify handler\n"); 681 printk(EEEPC_ERR "Error installing notify handler\n");
651 682
683 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
684 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
685
652 if (get_acpi(CM_ASL_WLAN) != -1) { 686 if (get_acpi(CM_ASL_WLAN) != -1) {
653 ehotk->eeepc_wlan_rfkill = rfkill_allocate(&device->dev, 687 ehotk->eeepc_wlan_rfkill = rfkill_allocate(&device->dev,
654 RFKILL_TYPE_WLAN); 688 RFKILL_TYPE_WLAN);
@@ -704,9 +738,6 @@ static int eeepc_hotk_add(struct acpi_device *device)
704 goto bluetooth_fail; 738 goto bluetooth_fail;
705 } 739 }
706 740
707 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
708 eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
709
710 return 0; 741 return 0;
711 742
712 bluetooth_fail: 743 bluetooth_fail:
@@ -717,6 +748,8 @@ static int eeepc_hotk_add(struct acpi_device *device)
717 wlan_fail: 748 wlan_fail:
718 if (ehotk->eeepc_wlan_rfkill) 749 if (ehotk->eeepc_wlan_rfkill)
719 rfkill_free(ehotk->eeepc_wlan_rfkill); 750 rfkill_free(ehotk->eeepc_wlan_rfkill);
751 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
752 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
720 ehotk_fail: 753 ehotk_fail:
721 kfree(ehotk); 754 kfree(ehotk);
722 ehotk = NULL; 755 ehotk = NULL;
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 9a3a682c6981..9496494f340e 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -110,11 +110,9 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
110 110
111 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ 111 /* acpi_unregister_gsi(pnp_irq(dev, 0)); */
112 ret = 0; 112 ret = 0;
113 if (acpi_bus_power_manageable(handle)) { 113 if (acpi_bus_power_manageable(handle))
114 ret = acpi_bus_set_power(handle, ACPI_STATE_D3); 114 acpi_bus_set_power(handle, ACPI_STATE_D3);
115 if (ret) 115 /* continue even if acpi_bus_set_power() fails */
116 return ret;
117 }
118 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL))) 116 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL)))
119 ret = -ENODEV; 117 ret = -ENODEV;
120 return ret; 118 return ret;
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 72b15495183c..c6628f5a0af7 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -497,7 +497,7 @@ static struct platform_driver da903x_regulator_driver = {
497 .owner = THIS_MODULE, 497 .owner = THIS_MODULE,
498 }, 498 },
499 .probe = da903x_regulator_probe, 499 .probe = da903x_regulator_probe,
500 .remove = da903x_regulator_remove, 500 .remove = __devexit_p(da903x_regulator_remove),
501}; 501};
502 502
503static int __init da903x_regulator_init(void) 503static int __init da903x_regulator_init(void)
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c
index 826153552157..aaf1f75fa293 100644
--- a/drivers/rtc/rtc-pl030.c
+++ b/drivers/rtc/rtc-pl030.c
@@ -102,7 +102,7 @@ static const struct rtc_class_ops pl030_ops = {
102 .set_alarm = pl030_set_alarm, 102 .set_alarm = pl030_set_alarm,
103}; 103};
104 104
105static int pl030_probe(struct amba_device *dev, void *id) 105static int pl030_probe(struct amba_device *dev, struct amba_id *id)
106{ 106{
107 struct pl030_rtc *rtc; 107 struct pl030_rtc *rtc;
108 int ret; 108 int ret;
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 333eec689d2f..451fc13784d1 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -127,7 +127,7 @@ static int pl031_remove(struct amba_device *adev)
127 return 0; 127 return 0;
128} 128}
129 129
130static int pl031_probe(struct amba_device *adev, void *id) 130static int pl031_probe(struct amba_device *adev, struct amba_id *id)
131{ 131{
132 int ret; 132 int ret;
133 struct pl031_local *ldata; 133 struct pl031_local *ldata;
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index a6341e4f9a0f..9c8c70c497dc 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -495,9 +495,7 @@ static int twl4030_rtc_suspend(struct platform_device *pdev, pm_message_t state)
495{ 495{
496 irqstat = rtc_irq_bits; 496 irqstat = rtc_irq_bits;
497 497
498 /* REVISIT alarm may need to wake us from sleep */ 498 mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M);
499 mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_TIMER_M |
500 BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
501 return 0; 499 return 0;
502} 500}
503 501
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index f644c9571eab..22b59e13ba83 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -173,26 +173,26 @@ static const struct file_operations osd_fops = {
173 .unlocked_ioctl = osd_uld_ioctl, 173 .unlocked_ioctl = osd_uld_ioctl,
174}; 174};
175 175
176struct osd_dev *osduld_path_lookup(const char *path) 176struct osd_dev *osduld_path_lookup(const char *name)
177{ 177{
178 struct nameidata nd; 178 struct path path;
179 struct inode *inode; 179 struct inode *inode;
180 struct cdev *cdev; 180 struct cdev *cdev;
181 struct osd_uld_device *uninitialized_var(oud); 181 struct osd_uld_device *uninitialized_var(oud);
182 int error; 182 int error;
183 183
184 if (!path || !*path) { 184 if (!name || !*name) {
185 OSD_ERR("Mount with !path || !*path\n"); 185 OSD_ERR("Mount with !path || !*path\n");
186 return ERR_PTR(-EINVAL); 186 return ERR_PTR(-EINVAL);
187 } 187 }
188 188
189 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 189 error = kern_path(name, LOOKUP_FOLLOW, &path);
190 if (error) { 190 if (error) {
191 OSD_ERR("path_lookup of %s faild=>%d\n", path, error); 191 OSD_ERR("path_lookup of %s failed=>%d\n", name, error);
192 return ERR_PTR(error); 192 return ERR_PTR(error);
193 } 193 }
194 194
195 inode = nd.path.dentry->d_inode; 195 inode = path.dentry->d_inode;
196 error = -EINVAL; /* Not the right device e.g osd_uld_device */ 196 error = -EINVAL; /* Not the right device e.g osd_uld_device */
197 if (!S_ISCHR(inode->i_mode)) { 197 if (!S_ISCHR(inode->i_mode)) {
198 OSD_DEBUG("!S_ISCHR()\n"); 198 OSD_DEBUG("!S_ISCHR()\n");
@@ -202,15 +202,15 @@ struct osd_dev *osduld_path_lookup(const char *path)
202 cdev = inode->i_cdev; 202 cdev = inode->i_cdev;
203 if (!cdev) { 203 if (!cdev) {
204 OSD_ERR("Before mounting an OSD Based filesystem\n"); 204 OSD_ERR("Before mounting an OSD Based filesystem\n");
205 OSD_ERR(" user-mode must open+close the %s device\n", path); 205 OSD_ERR(" user-mode must open+close the %s device\n", name);
206 OSD_ERR(" Example: bash: echo < %s\n", path); 206 OSD_ERR(" Example: bash: echo < %s\n", name);
207 goto out; 207 goto out;
208 } 208 }
209 209
210 /* The Magic wand. Is it our char-dev */ 210 /* The Magic wand. Is it our char-dev */
211 /* TODO: Support sg devices */ 211 /* TODO: Support sg devices */
212 if (cdev->owner != THIS_MODULE) { 212 if (cdev->owner != THIS_MODULE) {
213 OSD_ERR("Error mounting %s - is not an OSD device\n", path); 213 OSD_ERR("Error mounting %s - is not an OSD device\n", name);
214 goto out; 214 goto out;
215 } 215 }
216 216
@@ -220,7 +220,7 @@ struct osd_dev *osduld_path_lookup(const char *path)
220 error = 0; 220 error = 0;
221 221
222out: 222out:
223 path_put(&nd.path); 223 path_put(&path);
224 return error ? ERR_PTR(error) : &oud->od; 224 return error ? ERR_PTR(error) : &oud->od;
225} 225}
226EXPORT_SYMBOL(osduld_path_lookup); 226EXPORT_SYMBOL(osduld_path_lookup);
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index e3a5ad5ef1d6..cdc049d4350f 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -665,7 +665,7 @@ static struct uart_driver amba_reg = {
665 .cons = AMBA_CONSOLE, 665 .cons = AMBA_CONSOLE,
666}; 666};
667 667
668static int pl010_probe(struct amba_device *dev, void *id) 668static int pl010_probe(struct amba_device *dev, struct amba_id *id)
669{ 669{
670 struct uart_amba_port *uap; 670 struct uart_amba_port *uap;
671 void __iomem *base; 671 void __iomem *base;
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 8b2b9700f3e4..88fdac51b6c5 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -729,7 +729,7 @@ static struct uart_driver amba_reg = {
729 .cons = AMBA_CONSOLE, 729 .cons = AMBA_CONSOLE,
730}; 730};
731 731
732static int pl011_probe(struct amba_device *dev, void *id) 732static int pl011_probe(struct amba_device *dev, struct amba_id *id)
733{ 733{
734 struct uart_amba_port *uap; 734 struct uart_amba_port *uap;
735 void __iomem *base; 735 void __iomem *base;
diff --git a/drivers/serial/nwpserial.c b/drivers/serial/nwpserial.c
index 32f3eaf0d262..9e150b19d726 100644
--- a/drivers/serial/nwpserial.c
+++ b/drivers/serial/nwpserial.c
@@ -145,11 +145,13 @@ static irqreturn_t nwpserial_interrupt(int irq, void *dev_id)
145 ch = dcr_read(up->dcr_host, UART_RX); 145 ch = dcr_read(up->dcr_host, UART_RX);
146 if (up->port.ignore_status_mask != NWPSERIAL_STATUS_RXVALID) 146 if (up->port.ignore_status_mask != NWPSERIAL_STATUS_RXVALID)
147 tty_insert_flip_char(tty, ch, TTY_NORMAL); 147 tty_insert_flip_char(tty, ch, TTY_NORMAL);
148 } while (dcr_read(up->dcr_host, UART_RX) & UART_LSR_DR); 148 } while (dcr_read(up->dcr_host, UART_LSR) & UART_LSR_DR);
149 149
150 tty_flip_buffer_push(tty); 150 tty_flip_buffer_push(tty);
151 ret = IRQ_HANDLED; 151 ret = IRQ_HANDLED;
152 152
153 /* clear interrupt */
154 dcr_write(up->dcr_host, UART_IIR, 1);
153out: 155out:
154 spin_unlock(&up->port.lock); 156 spin_unlock(&up->port.lock);
155 return ret; 157 return ret;
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 885194a07418..3f3c08c6ba4e 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1373,6 +1373,9 @@ static void cleanup(struct spi_device *spi)
1373{ 1373{
1374 struct chip_data *chip = spi_get_ctldata(spi); 1374 struct chip_data *chip = spi_get_ctldata(spi);
1375 1375
1376 if (!chip)
1377 return;
1378
1376 if (gpio_is_valid(chip->gpio_cs)) 1379 if (gpio_is_valid(chip->gpio_cs))
1377 gpio_free(chip->gpio_cs); 1380 gpio_free(chip->gpio_cs);
1378 1381
diff --git a/drivers/staging/comedi/TODO b/drivers/staging/comedi/TODO
index 557812958464..15c9348fb938 100644
--- a/drivers/staging/comedi/TODO
+++ b/drivers/staging/comedi/TODO
@@ -11,4 +11,3 @@ Please send patches to Greg Kroah-Hartman <greg@kroah.com> and
11copy: 11copy:
12 Ian Abbott <abbotti@mev.co.uk> 12 Ian Abbott <abbotti@mev.co.uk>
13 Frank Mori Hess <fmhess@users.sourceforge.net> 13 Frank Mori Hess <fmhess@users.sourceforge.net>
14 David Schleef <ds@schleef.org>
diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h
index a42caa370808..a69cf338e498 100644
--- a/drivers/staging/rt2870/rt2870.h
+++ b/drivers/staging/rt2870/rt2870.h
@@ -145,6 +145,7 @@
145 {USB_DEVICE(0x0789,0x0162)}, /* Logitec */ \ 145 {USB_DEVICE(0x0789,0x0162)}, /* Logitec */ \
146 {USB_DEVICE(0x0789,0x0163)}, /* Logitec */ \ 146 {USB_DEVICE(0x0789,0x0163)}, /* Logitec */ \
147 {USB_DEVICE(0x0789,0x0164)}, /* Logitec */ \ 147 {USB_DEVICE(0x0789,0x0164)}, /* Logitec */ \
148 {USB_DEVICE(0x7392,0x7717)}, /* Edimax */ \
148 { }/* Terminating entry */ \ 149 { }/* Terminating entry */ \
149} 150}
150 151
diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h
index 12215fc61ddc..db446b7e2e08 100644
--- a/drivers/staging/rtl8187se/r8180.h
+++ b/drivers/staging/rtl8187se/r8180.h
@@ -19,7 +19,7 @@
19#define R8180H 19#define R8180H
20 20
21 21
22#define RTL8180_MODULE_NAME "rtl8180" 22#define RTL8180_MODULE_NAME "r8180"
23#define DMESG(x,a...) printk(KERN_INFO RTL8180_MODULE_NAME ": " x "\n", ## a) 23#define DMESG(x,a...) printk(KERN_INFO RTL8180_MODULE_NAME ": " x "\n", ## a)
24#define DMESGW(x,a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": WW:" x "\n", ## a) 24#define DMESGW(x,a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": WW:" x "\n", ## a)
25#define DMESGE(x,a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": EE:" x "\n", ## a) 25#define DMESGE(x,a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": EE:" x "\n", ## a)
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 6ecd12de4296..e10413cee0df 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -640,11 +640,9 @@ void rtl8180_proc_init_one(struct net_device *dev)
640{ 640{
641 struct proc_dir_entry *e; 641 struct proc_dir_entry *e;
642 struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); 642 struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
643 priv->dir_dev = create_proc_entry(dev->name, 643 priv->dir_dev = rtl8180_proc;
644 S_IFDIR | S_IRUGO | S_IXUGO,
645 rtl8180_proc);
646 if (!priv->dir_dev) { 644 if (!priv->dir_dev) {
647 DMESGE("Unable to initialize /proc/net/rtl8180/%s\n", 645 DMESGE("Unable to initialize /proc/net/r8180/%s\n",
648 dev->name); 646 dev->name);
649 return; 647 return;
650 } 648 }
@@ -654,7 +652,7 @@ void rtl8180_proc_init_one(struct net_device *dev)
654 652
655 if (!e) { 653 if (!e) {
656 DMESGE("Unable to initialize " 654 DMESGE("Unable to initialize "
657 "/proc/net/rtl8180/%s/stats-hw\n", 655 "/proc/net/r8180/%s/stats-hw\n",
658 dev->name); 656 dev->name);
659 } 657 }
660 658
@@ -663,7 +661,7 @@ void rtl8180_proc_init_one(struct net_device *dev)
663 661
664 if (!e) { 662 if (!e) {
665 DMESGE("Unable to initialize " 663 DMESGE("Unable to initialize "
666 "/proc/net/rtl8180/%s/stats-rx\n", 664 "/proc/net/r8180/%s/stats-rx\n",
667 dev->name); 665 dev->name);
668 } 666 }
669 667
@@ -673,7 +671,7 @@ void rtl8180_proc_init_one(struct net_device *dev)
673 671
674 if (!e) { 672 if (!e) {
675 DMESGE("Unable to initialize " 673 DMESGE("Unable to initialize "
676 "/proc/net/rtl8180/%s/stats-tx\n", 674 "/proc/net/r8180/%s/stats-tx\n",
677 dev->name); 675 dev->name);
678 } 676 }
679 #if 0 677 #if 0
@@ -702,7 +700,7 @@ void rtl8180_proc_init_one(struct net_device *dev)
702 700
703 if (!e) { 701 if (!e) {
704 DMESGE("Unable to initialize " 702 DMESGE("Unable to initialize "
705 "/proc/net/rtl8180/%s/registers\n", 703 "/proc/net/r8180/%s/registers\n",
706 dev->name); 704 dev->name);
707 } 705 }
708} 706}
@@ -977,13 +975,6 @@ void check_tx_ring(struct net_device *dev, int pri)
977 *tmp & (1<<15)? "ok": "err", *(tmp+4)); 975 *tmp & (1<<15)? "ok": "err", *(tmp+4));
978 } 976 }
979 977
980 DMESG("nic at %d",
981 (nic-nicbegin) / 8 /4);
982 DMESG("tail at %d", ((int)tail - (int)begin) /8 /4);
983 DMESG("head at %d", ((int)head - (int)begin) /8 /4);
984 DMESG("check free desc returns %d", check_nic_enought_desc(dev,pri));
985 DMESG("free desc is %d\n", get_curr_tx_free_desc(dev,pri));
986 //rtl8180_reset(dev);
987 return; 978 return;
988} 979}
989 980
@@ -1736,17 +1727,7 @@ short alloc_tx_desc_ring(struct net_device *dev, int bufsize, int count,
1736 * descriptor's buffer must be 256 byte aligned 1727 * descriptor's buffer must be 256 byte aligned
1737 * we shouldn't be here, since we set DMA mask ! 1728 * we shouldn't be here, since we set DMA mask !
1738 */ 1729 */
1739 DMESGW("Fixing TX alignment"); 1730 WARN(1, "DMA buffer is not aligned\n");
1740 desc = (u32*)((u8*)desc + 256);
1741#if (defined(CONFIG_HIGHMEM64G) || defined(CONFIG_64BIT_PHYS_ADDR))
1742 desc = (u32*)((u64)desc &~ 0xff);
1743 dma_desc = (dma_addr_t)((u8*)dma_desc + 256);
1744 dma_desc = (dma_addr_t)((u64)dma_desc &~ 0xff);
1745#else
1746 desc = (u32*)((u32)desc &~ 0xff);
1747 dma_desc = (dma_addr_t)((u8*)dma_desc + 256);
1748 dma_desc = (dma_addr_t)((u32)dma_desc &~ 0xff);
1749#endif
1750 } 1731 }
1751 tmp=desc; 1732 tmp=desc;
1752 for (i=0;i<count;i++) 1733 for (i=0;i<count;i++)
@@ -1984,18 +1965,7 @@ short alloc_rx_desc_ring(struct net_device *dev, u16 bufsize, int count)
1984 * descriptor's buffer must be 256 byte aligned 1965 * descriptor's buffer must be 256 byte aligned
1985 * should never happen since we specify the DMA mask 1966 * should never happen since we specify the DMA mask
1986 */ 1967 */
1987 1968 WARN(1, "DMA buffer is not aligned\n");
1988 DMESGW("Fixing RX alignment");
1989 desc = (u32*)((u8*)desc + 256);
1990#if (defined(CONFIG_HIGHMEM64G) || defined(CONFIG_64BIT_PHYS_ADDR))
1991 desc = (u32*)((u64)desc &~ 0xff);
1992 dma_desc = (dma_addr_t)((u8*)dma_desc + 256);
1993 dma_desc = (dma_addr_t)((u64)dma_desc &~ 0xff);
1994#else
1995 desc = (u32*)((u32)desc &~ 0xff);
1996 dma_desc = (dma_addr_t)((u8*)dma_desc + 256);
1997 dma_desc = (dma_addr_t)((u32)dma_desc &~ 0xff);
1998#endif
1999 } 1969 }
2000 1970
2001 priv->rxring=desc; 1971 priv->rxring=desc;
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index 9c3f9439f35e..3b2d52819b4c 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -386,7 +386,7 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
386 if (err) 386 if (err)
387 goto error_free_hw; 387 goto error_free_hw;
388 388
389 usb_set_intfdata(intf, priv); 389 usb_set_intfdata(intf, dev);
390 390
391 return 0; 391 return 0;
392 392
@@ -415,10 +415,15 @@ static void wb35_hw_halt(struct wbsoft_priv *adapter)
415 415
416static void wb35_disconnect(struct usb_interface *intf) 416static void wb35_disconnect(struct usb_interface *intf)
417{ 417{
418 struct wbsoft_priv *priv = usb_get_intfdata(intf); 418 struct ieee80211_hw *hw = usb_get_intfdata(intf);
419 struct wbsoft_priv *priv = hw->priv;
419 420
420 wb35_hw_halt(priv); 421 wb35_hw_halt(priv);
421 422
423 ieee80211_stop_queues(hw);
424 ieee80211_unregister_hw(hw);
425 ieee80211_free_hw(hw);
426
422 usb_set_intfdata(intf, NULL); 427 usb_set_intfdata(intf, NULL);
423 usb_put_dev(interface_to_usbdev(intf)); 428 usb_put_dev(interface_to_usbdev(intf));
424} 429}
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index d0b093b66adc..5e38ba10a3a9 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -961,7 +961,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
961 961
962 switch (trip_type) { 962 switch (trip_type) {
963 case THERMAL_TRIP_CRITICAL: 963 case THERMAL_TRIP_CRITICAL:
964 if (temp > trip_temp) { 964 if (temp >= trip_temp) {
965 if (tz->ops->notify) 965 if (tz->ops->notify)
966 ret = tz->ops->notify(tz, count, 966 ret = tz->ops->notify(tz, count,
967 trip_type); 967 trip_type);
@@ -974,7 +974,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
974 } 974 }
975 break; 975 break;
976 case THERMAL_TRIP_HOT: 976 case THERMAL_TRIP_HOT:
977 if (temp > trip_temp) 977 if (temp >= trip_temp)
978 if (tz->ops->notify) 978 if (tz->ops->notify)
979 tz->ops->notify(tz, count, trip_type); 979 tz->ops->notify(tz, count, trip_type);
980 break; 980 break;
@@ -986,14 +986,14 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
986 986
987 cdev = instance->cdev; 987 cdev = instance->cdev;
988 988
989 if (temp > trip_temp) 989 if (temp >= trip_temp)
990 cdev->ops->set_cur_state(cdev, 1); 990 cdev->ops->set_cur_state(cdev, 1);
991 else 991 else
992 cdev->ops->set_cur_state(cdev, 0); 992 cdev->ops->set_cur_state(cdev, 0);
993 } 993 }
994 break; 994 break;
995 case THERMAL_TRIP_PASSIVE: 995 case THERMAL_TRIP_PASSIVE:
996 if (temp > trip_temp || tz->passive) 996 if (temp >= trip_temp || tz->passive)
997 thermal_zone_device_passive(tz, temp, 997 thermal_zone_device_passive(tz, temp,
998 trip_temp, count); 998 trip_temp, count);
999 break; 999 break;
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 89299a5ce168..0716cdb44cd8 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -27,6 +27,8 @@ obj-$(CONFIG_USB_WUSB) += wusbcore/
27 27
28obj-$(CONFIG_USB_ACM) += class/ 28obj-$(CONFIG_USB_ACM) += class/
29obj-$(CONFIG_USB_PRINTER) += class/ 29obj-$(CONFIG_USB_PRINTER) += class/
30obj-$(CONFIG_USB_WDM) += class/
31obj-$(CONFIG_USB_TMC) += class/
30 32
31obj-$(CONFIG_USB_STORAGE) += storage/ 33obj-$(CONFIG_USB_STORAGE) += storage/
32obj-$(CONFIG_USB) += storage/ 34obj-$(CONFIG_USB) += storage/
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 6789089e2461..56802d2e994b 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -227,8 +227,14 @@ static ssize_t cxacru_sysfs_showattr_s8(s8 value, char *buf)
227 227
228static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf) 228static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
229{ 229{
230 return snprintf(buf, PAGE_SIZE, "%d.%02u\n", 230 if (likely(value >= 0)) {
231 value / 100, abs(value) % 100); 231 return snprintf(buf, PAGE_SIZE, "%u.%02u\n",
232 value / 100, value % 100);
233 } else {
234 value = -value;
235 return snprintf(buf, PAGE_SIZE, "-%u.%02u\n",
236 value / 100, value % 100);
237 }
232} 238}
233 239
234static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf) 240static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf)
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
index 4154be375c7a..58c4d37d312a 100644
--- a/drivers/usb/gadget/usbstring.c
+++ b/drivers/usb/gadget/usbstring.c
@@ -38,7 +38,7 @@ static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len)
38 uchar = (c & 0x1f) << 6; 38 uchar = (c & 0x1f) << 6;
39 39
40 c = (u8) *s++; 40 c = (u8) *s++;
41 if ((c & 0xc0) != 0xc0) 41 if ((c & 0xc0) != 0x80)
42 goto fail; 42 goto fail;
43 c &= 0x3f; 43 c &= 0x3f;
44 uchar |= c; 44 uchar |= c;
@@ -49,13 +49,13 @@ static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len)
49 uchar = (c & 0x0f) << 12; 49 uchar = (c & 0x0f) << 12;
50 50
51 c = (u8) *s++; 51 c = (u8) *s++;
52 if ((c & 0xc0) != 0xc0) 52 if ((c & 0xc0) != 0x80)
53 goto fail; 53 goto fail;
54 c &= 0x3f; 54 c &= 0x3f;
55 uchar |= c << 6; 55 uchar |= c << 6;
56 56
57 c = (u8) *s++; 57 c = (u8) *s++;
58 if ((c & 0xc0) != 0xc0) 58 if ((c & 0xc0) != 0x80)
59 goto fail; 59 goto fail;
60 c &= 0x3f; 60 c &= 0x3f;
61 uchar |= c; 61 uchar |= c;
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8100f1d25904..d9fcdaedf389 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -56,6 +56,7 @@ static __u16 vendor = FTDI_VID;
56static __u16 product; 56static __u16 product;
57 57
58struct ftdi_private { 58struct ftdi_private {
59 struct kref kref;
59 ftdi_chip_type_t chip_type; 60 ftdi_chip_type_t chip_type;
60 /* type of device, either SIO or FT8U232AM */ 61 /* type of device, either SIO or FT8U232AM */
61 int baud_base; /* baud base clock for divisor setting */ 62 int baud_base; /* baud base clock for divisor setting */
@@ -669,6 +670,8 @@ static struct usb_device_id id_table_combined [] = {
669 { USB_DEVICE(ADI_VID, ADI_GNICE_PID), 670 { USB_DEVICE(ADI_VID, ADI_GNICE_PID),
670 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 671 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
671 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, 672 { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
673 { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
674 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
672 { }, /* Optional parameter entry */ 675 { }, /* Optional parameter entry */
673 { } /* Terminating entry */ 676 { } /* Terminating entry */
674}; 677};
@@ -1352,6 +1355,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1352 return -ENOMEM; 1355 return -ENOMEM;
1353 } 1356 }
1354 1357
1358 kref_init(&priv->kref);
1355 spin_lock_init(&priv->rx_lock); 1359 spin_lock_init(&priv->rx_lock);
1356 spin_lock_init(&priv->tx_lock); 1360 spin_lock_init(&priv->tx_lock);
1357 init_waitqueue_head(&priv->delta_msr_wait); 1361 init_waitqueue_head(&priv->delta_msr_wait);
@@ -1468,6 +1472,13 @@ static void ftdi_shutdown(struct usb_serial *serial)
1468 dbg("%s", __func__); 1472 dbg("%s", __func__);
1469} 1473}
1470 1474
1475static void ftdi_sio_priv_release(struct kref *k)
1476{
1477 struct ftdi_private *priv = container_of(k, struct ftdi_private, kref);
1478
1479 kfree(priv);
1480}
1481
1471static int ftdi_sio_port_remove(struct usb_serial_port *port) 1482static int ftdi_sio_port_remove(struct usb_serial_port *port)
1472{ 1483{
1473 struct ftdi_private *priv = usb_get_serial_port_data(port); 1484 struct ftdi_private *priv = usb_get_serial_port_data(port);
@@ -1476,14 +1487,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
1476 1487
1477 remove_sysfs_attrs(port); 1488 remove_sysfs_attrs(port);
1478 1489
1479 /* all open ports are closed at this point 1490 kref_put(&priv->kref, ftdi_sio_priv_release);
1480 * (by usbserial.c:__serial_close, which calls ftdi_close)
1481 */
1482
1483 if (priv) {
1484 usb_set_serial_port_data(port, NULL);
1485 kfree(priv);
1486 }
1487 1491
1488 return 0; 1492 return 0;
1489} 1493}
@@ -1547,7 +1551,8 @@ static int ftdi_open(struct tty_struct *tty,
1547 dev_err(&port->dev, 1551 dev_err(&port->dev,
1548 "%s - failed submitting read urb, error %d\n", 1552 "%s - failed submitting read urb, error %d\n",
1549 __func__, result); 1553 __func__, result);
1550 1554 else
1555 kref_get(&priv->kref);
1551 1556
1552 return result; 1557 return result;
1553} /* ftdi_open */ 1558} /* ftdi_open */
@@ -1589,11 +1594,11 @@ static void ftdi_close(struct tty_struct *tty,
1589 mutex_unlock(&port->serial->disc_mutex); 1594 mutex_unlock(&port->serial->disc_mutex);
1590 1595
1591 /* cancel any scheduled reading */ 1596 /* cancel any scheduled reading */
1592 cancel_delayed_work(&priv->rx_work); 1597 cancel_delayed_work_sync(&priv->rx_work);
1593 flush_scheduled_work();
1594 1598
1595 /* shutdown our bulk read */ 1599 /* shutdown our bulk read */
1596 usb_kill_urb(port->read_urb); 1600 usb_kill_urb(port->read_urb);
1601 kref_put(&priv->kref, ftdi_sio_priv_release);
1597} /* ftdi_close */ 1602} /* ftdi_close */
1598 1603
1599 1604
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index c09f658a448b..12330fa1c095 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -920,6 +920,12 @@
920#define JETI_SPC1201_PID 0x04b2 920#define JETI_SPC1201_PID 0x04b2
921 921
922/* 922/*
923 * Marvell SheevaPlug
924 */
925#define MARVELL_VID 0x9e88
926#define MARVELL_SHEEVAPLUG_PID 0x9e8f
927
928/*
923 * BmRequestType: 1100 0000b 929 * BmRequestType: 1100 0000b
924 * bRequest: FTDI_E2_READ 930 * bRequest: FTDI_E2_READ
925 * wValue: 0 931 * wValue: 0
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index fa65a3b08601..4b8b69045fe6 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -160,8 +160,9 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100,
160 US_SC_DEVICE, US_PR_DEVICE, NULL, 160 US_SC_DEVICE, US_PR_DEVICE, NULL,
161 US_FL_IGNORE_RESIDUE ), 161 US_FL_IGNORE_RESIDUE ),
162 162
163/* Reported by Andrew Nayenko <relan@bk.ru> */ 163/* Reported by Andrew Nayenko <relan@bk.ru>
164UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592, 164 * Updated for new firmware by Phillip Potter <phillipinda@hotmail.com> */
165UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0610,
165 "Nokia", 166 "Nokia",
166 "Nokia 6288", 167 "Nokia 6288",
167 US_SC_DEVICE, US_PR_DEVICE, NULL, 168 US_SC_DEVICE, US_PR_DEVICE, NULL,
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7826bdce4bbe..0048f1185a60 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1128,13 +1128,6 @@ config FB_INTEL
1128 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. 1128 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets.
1129 Say Y if you have and plan to use such a board. 1129 Say Y if you have and plan to use such a board.
1130 1130
1131 If you say Y here and want DDC/I2C support you must first say Y to
1132 "I2C support" and "I2C bit-banging support" in the character devices
1133 section.
1134
1135 If you say M here then "I2C support" and "I2C bit-banging support"
1136 can be build either as modules or built-in.
1137
1138 To compile this driver as a module, choose M here: the 1131 To compile this driver as a module, choose M here: the
1139 module will be called intelfb. 1132 module will be called intelfb.
1140 1133
@@ -1207,11 +1200,10 @@ config FB_MATROX_G
1207 pixel and 32 bpp packed pixel. You can also use font widths 1200 pixel and 32 bpp packed pixel. You can also use font widths
1208 different from 8. 1201 different from 8.
1209 1202
1210 If you need support for G400 secondary head, you must first say Y to 1203 If you need support for G400 secondary head, you must say Y to
1211 "I2C support" in the character devices section, and then to 1204 "Matrox I2C support" and "G400 second head support" right below.
1212 "Matrox I2C support" and "G400 second head support" here in the 1205 G450/G550 secondary head and digital output are supported without
1213 framebuffer section. G450/G550 secondary head and digital output 1206 additional modules.
1214 are supported without additional modules.
1215 1207
1216 The driver starts in monitor mode. You must use the matroxset tool 1208 The driver starts in monitor mode. You must use the matroxset tool
1217 (available at <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to 1209 (available at <ftp://platan.vc.cvut.cz/pub/linux/matrox-latest/>) to
@@ -1310,13 +1302,6 @@ config FB_RADEON
1310 a framebuffer device. There are both PCI and AGP versions. You 1302 a framebuffer device. There are both PCI and AGP versions. You
1311 don't need to choose this to run the Radeon in plain VGA mode. 1303 don't need to choose this to run the Radeon in plain VGA mode.
1312 1304
1313 If you say Y here and want DDC/I2C support you must first say Y to
1314 "I2C support" and "I2C bit-banging support" in the character devices
1315 section.
1316
1317 If you say M here then "I2C support" and "I2C bit-banging support"
1318 can be build either as modules or built-in.
1319
1320 There is a product page at 1305 There is a product page at
1321 http://apps.ati.com/ATIcompare/ 1306 http://apps.ati.com/ATIcompare/
1322 1307
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index 61050ab14128..d1f80bac54f0 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -437,7 +437,7 @@ static int clcdfb_register(struct clcd_fb *fb)
437 return ret; 437 return ret;
438} 438}
439 439
440static int clcdfb_probe(struct amba_device *dev, void *id) 440static int clcdfb_probe(struct amba_device *dev, struct amba_id *id)
441{ 441{
442 struct clcd_board *board = dev->dev.platform_data; 442 struct clcd_board *board = dev->dev.platform_data;
443 struct clcd_fb *fb; 443 struct clcd_fb *fb;
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index fe5b519860b1..1a83709f9611 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -75,7 +75,7 @@ struct gbefb_par {
75static unsigned int gbe_mem_size = CONFIG_FB_GBE_MEM * 1024*1024; 75static unsigned int gbe_mem_size = CONFIG_FB_GBE_MEM * 1024*1024;
76static void *gbe_mem; 76static void *gbe_mem;
77static dma_addr_t gbe_dma_addr; 77static dma_addr_t gbe_dma_addr;
78unsigned long gbe_mem_phys; 78static unsigned long gbe_mem_phys;
79 79
80static struct { 80static struct {
81 uint16_t *cpu; 81 uint16_t *cpu;
@@ -185,8 +185,8 @@ static struct fb_videomode default_mode_LCD __initdata = {
185 .vmode = FB_VMODE_NONINTERLACED, 185 .vmode = FB_VMODE_NONINTERLACED,
186}; 186};
187 187
188struct fb_videomode *default_mode __initdata = &default_mode_CRT; 188static struct fb_videomode *default_mode __initdata = &default_mode_CRT;
189struct fb_var_screeninfo *default_var __initdata = &default_var_CRT; 189static struct fb_var_screeninfo *default_var __initdata = &default_var_CRT;
190 190
191static int flat_panel_enabled = 0; 191static int flat_panel_enabled = 0;
192 192
@@ -205,7 +205,7 @@ static void gbe_reset(void)
205 * console. 205 * console.
206 */ 206 */
207 207
208void gbe_turn_off(void) 208static void gbe_turn_off(void)
209{ 209{
210 int i; 210 int i;
211 unsigned int val, x, y, vpixen_off; 211 unsigned int val, x, y, vpixen_off;
@@ -1097,7 +1097,7 @@ static void gbefb_create_sysfs(struct device *dev)
1097 * Initialization 1097 * Initialization
1098 */ 1098 */
1099 1099
1100int __init gbefb_setup(char *options) 1100static int __init gbefb_setup(char *options)
1101{ 1101{
1102 char *this_opt; 1102 char *this_opt;
1103 1103
@@ -1283,7 +1283,7 @@ static struct platform_driver gbefb_driver = {
1283 1283
1284static struct platform_device *gbefb_device; 1284static struct platform_device *gbefb_device;
1285 1285
1286int __init gbefb_init(void) 1286static int __init gbefb_init(void)
1287{ 1287{
1288 int ret = platform_driver_register(&gbefb_driver); 1288 int ret = platform_driver_register(&gbefb_driver);
1289 if (!ret) { 1289 if (!ret) {
@@ -1301,7 +1301,7 @@ int __init gbefb_init(void)
1301 return ret; 1301 return ret;
1302} 1302}
1303 1303
1304void __exit gbefb_exit(void) 1304static void __exit gbefb_exit(void)
1305{ 1305{
1306 platform_device_unregister(gbefb_device); 1306 platform_device_unregister(gbefb_device);
1307 platform_driver_unregister(&gbefb_driver); 1307 platform_driver_unregister(&gbefb_driver);
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index dfb72f5e4c96..148cbcc39602 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -880,20 +880,22 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *dev)
880 880
881static int get_dss_clocks(void) 881static int get_dss_clocks(void)
882{ 882{
883 if (IS_ERR((dispc.dss_ick = clk_get(dispc.fbdev->dev, "dss_ick")))) { 883 dispc.dss_ick = clk_get(dispc.fbdev->dev, "ick");
884 dev_err(dispc.fbdev->dev, "can't get dss_ick\n"); 884 if (IS_ERR(dispc.dss_ick)) {
885 dev_err(dispc.fbdev->dev, "can't get ick\n");
885 return PTR_ERR(dispc.dss_ick); 886 return PTR_ERR(dispc.dss_ick);
886 } 887 }
887 888
888 if (IS_ERR((dispc.dss1_fck = clk_get(dispc.fbdev->dev, "dss1_fck")))) { 889 dispc.dss1_fck = clk_get(dispc.fbdev->dev, "dss1_fck");
890 if (IS_ERR(dispc.dss1_fck)) {
889 dev_err(dispc.fbdev->dev, "can't get dss1_fck\n"); 891 dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
890 clk_put(dispc.dss_ick); 892 clk_put(dispc.dss_ick);
891 return PTR_ERR(dispc.dss1_fck); 893 return PTR_ERR(dispc.dss1_fck);
892 } 894 }
893 895
894 if (IS_ERR((dispc.dss_54m_fck = 896 dispc.dss_54m_fck = clk_get(dispc.fbdev->dev, "tv_fck");
895 clk_get(dispc.fbdev->dev, "dss_54m_fck")))) { 897 if (IS_ERR(dispc.dss_54m_fck)) {
896 dev_err(dispc.fbdev->dev, "can't get dss_54m_fck\n"); 898 dev_err(dispc.fbdev->dev, "can't get tv_fck\n");
897 clk_put(dispc.dss_ick); 899 clk_put(dispc.dss_ick);
898 clk_put(dispc.dss1_fck); 900 clk_put(dispc.dss1_fck);
899 return PTR_ERR(dispc.dss_54m_fck); 901 return PTR_ERR(dispc.dss_54m_fck);
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index a13c8dcad2a8..9332d6ca6456 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -83,12 +83,14 @@ static inline u32 rfbi_read_reg(int idx)
83 83
84static int rfbi_get_clocks(void) 84static int rfbi_get_clocks(void)
85{ 85{
86 if (IS_ERR((rfbi.dss_ick = clk_get(rfbi.fbdev->dev, "dss_ick")))) { 86 rfbi.dss_ick = clk_get(rfbi.fbdev->dev, "ick");
87 dev_err(rfbi.fbdev->dev, "can't get dss_ick\n"); 87 if (IS_ERR(rfbi.dss_ick)) {
88 dev_err(rfbi.fbdev->dev, "can't get ick\n");
88 return PTR_ERR(rfbi.dss_ick); 89 return PTR_ERR(rfbi.dss_ick);
89 } 90 }
90 91
91 if (IS_ERR((rfbi.dss1_fck = clk_get(rfbi.fbdev->dev, "dss1_fck")))) { 92 rfbi.dss1_fck = clk_get(rfbi.fbdev->dev, "dss1_fck");
93 if (IS_ERR(rfbi.dss1_fck)) {
92 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n"); 94 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
93 clk_put(rfbi.dss_ick); 95 clk_put(rfbi.dss_ick);
94 return PTR_ERR(rfbi.dss1_fck); 96 return PTR_ERR(rfbi.dss1_fck);
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index e327b84820d2..a0fec298216e 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2103,7 +2103,7 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
2103 2103
2104static int __devinit via_pci_probe(void) 2104static int __devinit via_pci_probe(void)
2105{ 2105{
2106 unsigned int default_xres, default_yres; 2106 unsigned long default_xres, default_yres;
2107 char *tmpc, *tmpm; 2107 char *tmpc, *tmpm;
2108 char *tmpc_sec, *tmpm_sec; 2108 char *tmpc_sec, *tmpm_sec;
2109 int vmode_index; 2109 int vmode_index;
@@ -2196,8 +2196,8 @@ static int __devinit via_pci_probe(void)
2196 viafb_FB_MM = viaparinfo->fbmem_virt; 2196 viafb_FB_MM = viaparinfo->fbmem_virt;
2197 tmpm = viafb_mode; 2197 tmpm = viafb_mode;
2198 tmpc = strsep(&tmpm, "x"); 2198 tmpc = strsep(&tmpm, "x");
2199 strict_strtoul(tmpc, 0, (unsigned long *)&default_xres); 2199 strict_strtoul(tmpc, 0, &default_xres);
2200 strict_strtoul(tmpm, 0, (unsigned long *)&default_yres); 2200 strict_strtoul(tmpm, 0, &default_yres);
2201 2201
2202 vmode_index = viafb_get_mode_index(default_xres, default_yres, 0); 2202 vmode_index = viafb_get_mode_index(default_xres, default_yres, 0);
2203 DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index); 2203 DEBUG_MSG(KERN_INFO "0->index=%d\n", vmode_index);