aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/apei/erst.c2
-rw-r--r--drivers/char/agp/generic.c6
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c23
-rw-r--r--drivers/gpio/Kconfig2
-rw-r--r--drivers/gpio/Makefile6
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c19
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c2
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c2
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c35
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c4
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h3
-rw-r--r--drivers/gpu/drm/radeon/r100.c81
-rw-r--r--drivers/gpu/drm/radeon/r200.c5
-rw-r--r--drivers/gpu/drm/radeon/r300.c5
-rw-r--r--drivers/gpu/drm/radeon/r600.c17
-rw-r--r--drivers/gpu/drm/radeon/radeon.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c49
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c22
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c41
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/evergreen10
-rw-r--r--drivers/gpu/drm/radeon/rs690.c41
-rw-r--r--drivers/gpu/drm/radeon/rv770.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c2
-rw-r--r--drivers/rtc/rtc-ds1307.c4
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c143
-rw-r--r--drivers/staging/batman-adv/bat_sysfs.c24
-rw-r--r--drivers/staging/batman-adv/device.c2
-rw-r--r--drivers/staging/comedi/drivers/adl_pci9111.c9
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidda.c3
-rw-r--r--drivers/staging/hv/channel_mgmt.c41
-rw-r--r--drivers/staging/hv/hv_utils.c28
-rw-r--r--drivers/staging/hv/vmbus.h2
-rw-r--r--drivers/staging/hv/vmbus_drv.c3
-rw-r--r--drivers/staging/mrst-touchscreen/intel-mid-touch.c2
-rw-r--r--drivers/staging/rt2860/usb_main_dev.c1
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c2
-rw-r--r--drivers/staging/rtl8192su/r8192U_core.c43
-rw-r--r--drivers/staging/rtl8192u/r8192U_core.c2
-rw-r--r--drivers/staging/usbip/usbip_common.c46
-rw-r--r--drivers/staging/wlags49_h2/wl_enc.c1
-rw-r--r--drivers/staging/wlags49_h2/wl_sysfs.h4
-rw-r--r--drivers/usb/core/driver.c13
-rw-r--r--drivers/usb/core/message.c7
-rw-r--r--drivers/usb/gadget/f_eem.c3
-rw-r--r--drivers/usb/gadget/f_mass_storage.c194
-rw-r--r--drivers/usb/gadget/g_ffs.c11
-rw-r--r--drivers/usb/gadget/printer.c32
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c6
-rw-r--r--drivers/usb/gadget/u_serial.c16
-rw-r--r--drivers/usb/host/ehci-mxc.c13
-rw-r--r--drivers/usb/host/isp1362-hcd.c15
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/xhci-ring.c62
-rw-r--r--drivers/usb/musb/musb_core.c13
-rw-r--r--drivers/usb/musb/musb_core.h6
-rw-r--r--drivers/usb/musb/musbhsdma.c13
-rw-r--r--drivers/usb/otg/ulpi.c17
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h7
-rw-r--r--drivers/usb/serial/qcserial.c3
-rw-r--r--drivers/video/geode/gxfb_core.c20
-rw-r--r--drivers/video/geode/lxfb_core.c18
-rw-r--r--drivers/video/nuc900fb.c2
69 files changed, 738 insertions, 504 deletions
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c
index 2ebc39115507..864dd46c346f 100644
--- a/drivers/acpi/apei/erst.c
+++ b/drivers/acpi/apei/erst.c
@@ -781,7 +781,7 @@ static int __init erst_init(void)
781 status = acpi_get_table(ACPI_SIG_ERST, 0, 781 status = acpi_get_table(ACPI_SIG_ERST, 0,
782 (struct acpi_table_header **)&erst_tab); 782 (struct acpi_table_header **)&erst_tab);
783 if (status == AE_NOT_FOUND) { 783 if (status == AE_NOT_FOUND) {
784 pr_err(ERST_PFX "Table is not found!\n"); 784 pr_info(ERST_PFX "Table is not found!\n");
785 goto err; 785 goto err;
786 } else if (ACPI_FAILURE(status)) { 786 } else if (ACPI_FAILURE(status)) {
787 const char *msg = acpi_format_exception(status); 787 const char *msg = acpi_format_exception(status);
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 4b51982fd23a..d2abf5143983 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -97,20 +97,18 @@ EXPORT_SYMBOL(agp_flush_chipset);
97void agp_alloc_page_array(size_t size, struct agp_memory *mem) 97void agp_alloc_page_array(size_t size, struct agp_memory *mem)
98{ 98{
99 mem->pages = NULL; 99 mem->pages = NULL;
100 mem->vmalloc_flag = false;
101 100
102 if (size <= 2*PAGE_SIZE) 101 if (size <= 2*PAGE_SIZE)
103 mem->pages = kmalloc(size, GFP_KERNEL | __GFP_NORETRY); 102 mem->pages = kmalloc(size, GFP_KERNEL | __GFP_NOWARN);
104 if (mem->pages == NULL) { 103 if (mem->pages == NULL) {
105 mem->pages = vmalloc(size); 104 mem->pages = vmalloc(size);
106 mem->vmalloc_flag = true;
107 } 105 }
108} 106}
109EXPORT_SYMBOL(agp_alloc_page_array); 107EXPORT_SYMBOL(agp_alloc_page_array);
110 108
111void agp_free_page_array(struct agp_memory *mem) 109void agp_free_page_array(struct agp_memory *mem)
112{ 110{
113 if (mem->vmalloc_flag) { 111 if (is_vmalloc_addr(mem->pages)) {
114 vfree(mem->pages); 112 vfree(mem->pages);
115 } else { 113 } else {
116 kfree(mem->pages); 114 kfree(mem->pages);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 35603dd4e6c5..094bdc355b1f 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -302,6 +302,12 @@ struct smi_info {
302 302
303static int force_kipmid[SI_MAX_PARMS]; 303static int force_kipmid[SI_MAX_PARMS];
304static int num_force_kipmid; 304static int num_force_kipmid;
305#ifdef CONFIG_PCI
306static int pci_registered;
307#endif
308#ifdef CONFIG_PPC_OF
309static int of_registered;
310#endif
305 311
306static unsigned int kipmid_max_busy_us[SI_MAX_PARMS]; 312static unsigned int kipmid_max_busy_us[SI_MAX_PARMS];
307static int num_max_busy_us; 313static int num_max_busy_us;
@@ -1018,7 +1024,7 @@ static int ipmi_thread(void *data)
1018 else if (smi_result == SI_SM_IDLE) 1024 else if (smi_result == SI_SM_IDLE)
1019 schedule_timeout_interruptible(100); 1025 schedule_timeout_interruptible(100);
1020 else 1026 else
1021 schedule_timeout_interruptible(0); 1027 schedule_timeout_interruptible(1);
1022 } 1028 }
1023 return 0; 1029 return 0;
1024} 1030}
@@ -3314,6 +3320,8 @@ static __devinit int init_ipmi_si(void)
3314 rv = pci_register_driver(&ipmi_pci_driver); 3320 rv = pci_register_driver(&ipmi_pci_driver);
3315 if (rv) 3321 if (rv)
3316 printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv); 3322 printk(KERN_ERR PFX "Unable to register PCI driver: %d\n", rv);
3323 else
3324 pci_registered = 1;
3317#endif 3325#endif
3318 3326
3319#ifdef CONFIG_ACPI 3327#ifdef CONFIG_ACPI
@@ -3330,6 +3338,7 @@ static __devinit int init_ipmi_si(void)
3330 3338
3331#ifdef CONFIG_PPC_OF 3339#ifdef CONFIG_PPC_OF
3332 of_register_platform_driver(&ipmi_of_platform_driver); 3340 of_register_platform_driver(&ipmi_of_platform_driver);
3341 of_registered = 1;
3333#endif 3342#endif
3334 3343
3335 /* We prefer devices with interrupts, but in the case of a machine 3344 /* We prefer devices with interrupts, but in the case of a machine
@@ -3383,11 +3392,13 @@ static __devinit int init_ipmi_si(void)
3383 if (unload_when_empty && list_empty(&smi_infos)) { 3392 if (unload_when_empty && list_empty(&smi_infos)) {
3384 mutex_unlock(&smi_infos_lock); 3393 mutex_unlock(&smi_infos_lock);
3385#ifdef CONFIG_PCI 3394#ifdef CONFIG_PCI
3386 pci_unregister_driver(&ipmi_pci_driver); 3395 if (pci_registered)
3396 pci_unregister_driver(&ipmi_pci_driver);
3387#endif 3397#endif
3388 3398
3389#ifdef CONFIG_PPC_OF 3399#ifdef CONFIG_PPC_OF
3390 of_unregister_platform_driver(&ipmi_of_platform_driver); 3400 if (of_registered)
3401 of_unregister_platform_driver(&ipmi_of_platform_driver);
3391#endif 3402#endif
3392 driver_unregister(&ipmi_driver.driver); 3403 driver_unregister(&ipmi_driver.driver);
3393 printk(KERN_WARNING PFX 3404 printk(KERN_WARNING PFX
@@ -3478,14 +3489,16 @@ static __exit void cleanup_ipmi_si(void)
3478 return; 3489 return;
3479 3490
3480#ifdef CONFIG_PCI 3491#ifdef CONFIG_PCI
3481 pci_unregister_driver(&ipmi_pci_driver); 3492 if (pci_registered)
3493 pci_unregister_driver(&ipmi_pci_driver);
3482#endif 3494#endif
3483#ifdef CONFIG_ACPI 3495#ifdef CONFIG_ACPI
3484 pnp_unregister_driver(&ipmi_pnp_driver); 3496 pnp_unregister_driver(&ipmi_pnp_driver);
3485#endif 3497#endif
3486 3498
3487#ifdef CONFIG_PPC_OF 3499#ifdef CONFIG_PPC_OF
3488 of_unregister_platform_driver(&ipmi_of_platform_driver); 3500 if (of_registered)
3501 of_unregister_platform_driver(&ipmi_of_platform_driver);
3489#endif 3502#endif
3490 3503
3491 mutex_lock(&smi_infos_lock); 3504 mutex_lock(&smi_infos_lock);
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 724038dab4ca..7face915b963 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -1,5 +1,5 @@
1# 1#
2# GPIO infrastructure and expanders 2# platform-neutral GPIO infrastructure and expanders
3# 3#
4 4
5config ARCH_WANT_OPTIONAL_GPIOLIB 5config ARCH_WANT_OPTIONAL_GPIOLIB
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 51c3cdd41b5a..e53dcff49b4f 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -1,4 +1,8 @@
1# gpio support: dedicated expander chips, etc 1# generic gpio support: dedicated expander chips, etc
2#
3# NOTE: platform-specific GPIO drivers don't belong in the
4# drivers/gpio directory; put them with other platform setup
5# code, IRQ controllers, board init, etc.
2 6
3ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG 7ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG
4 8
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 08c4c926e65f..1f2cc6b09623 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -146,7 +146,7 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_fb_helper_conn
146 cvt = 1; 146 cvt = 1;
147 break; 147 break;
148 case 'R': 148 case 'R':
149 if (!cvt) 149 if (cvt)
150 rb = 1; 150 rb = 1;
151 break; 151 break;
152 case 'm': 152 case 'm':
@@ -1024,11 +1024,18 @@ static struct drm_display_mode *drm_pick_cmdline_mode(struct drm_fb_helper_conne
1024 } 1024 }
1025 1025
1026create_mode: 1026create_mode:
1027 mode = drm_cvt_mode(fb_helper_conn->connector->dev, cmdline_mode->xres, 1027 if (cmdline_mode->cvt)
1028 cmdline_mode->yres, 1028 mode = drm_cvt_mode(fb_helper_conn->connector->dev,
1029 cmdline_mode->refresh_specified ? cmdline_mode->refresh : 60, 1029 cmdline_mode->xres, cmdline_mode->yres,
1030 cmdline_mode->rb, cmdline_mode->interlace, 1030 cmdline_mode->refresh_specified ? cmdline_mode->refresh : 60,
1031 cmdline_mode->margins); 1031 cmdline_mode->rb, cmdline_mode->interlace,
1032 cmdline_mode->margins);
1033 else
1034 mode = drm_gtf_mode(fb_helper_conn->connector->dev,
1035 cmdline_mode->xres, cmdline_mode->yres,
1036 cmdline_mode->refresh_specified ? cmdline_mode->refresh : 60,
1037 cmdline_mode->interlace,
1038 cmdline_mode->margins);
1032 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); 1039 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
1033 list_add(&mode->head, &fb_helper_conn->connector->modes); 1040 list_add(&mode->head, &fb_helper_conn->connector->modes);
1034 return mode; 1041 return mode;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9ded3dae6c87..074385882ccf 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2239,7 +2239,7 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
2239 mapping = inode->i_mapping; 2239 mapping = inode->i_mapping;
2240 for (i = 0; i < page_count; i++) { 2240 for (i = 0; i < page_count; i++) {
2241 page = read_cache_page_gfp(mapping, i, 2241 page = read_cache_page_gfp(mapping, i,
2242 mapping_gfp_mask (mapping) | 2242 GFP_HIGHUSER |
2243 __GFP_COLD | 2243 __GFP_COLD |
2244 gfpmask); 2244 gfpmask);
2245 if (IS_ERR(page)) 2245 if (IS_ERR(page))
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index f3f2827017ef..8c2d6478a221 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -498,7 +498,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
498 if ((rdev->family == CHIP_RS600) || 498 if ((rdev->family == CHIP_RS600) ||
499 (rdev->family == CHIP_RS690) || 499 (rdev->family == CHIP_RS690) ||
500 (rdev->family == CHIP_RS740)) 500 (rdev->family == CHIP_RS740))
501 pll->flags |= (RADEON_PLL_USE_FRAC_FB_DIV | 501 pll->flags |= (/*RADEON_PLL_USE_FRAC_FB_DIV |*/
502 RADEON_PLL_PREFER_CLOSEST_LOWER); 502 RADEON_PLL_PREFER_CLOSEST_LOWER);
503 503
504 if (ASIC_IS_DCE32(rdev) && mode->clock > 200000) /* range limits??? */ 504 if (ASIC_IS_DCE32(rdev) && mode->clock > 200000) /* range limits??? */
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 4b6623df3b96..1caf625e472b 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -607,7 +607,7 @@ static void evergreen_mc_program(struct radeon_device *rdev)
607 WREG32(MC_VM_FB_LOCATION, tmp); 607 WREG32(MC_VM_FB_LOCATION, tmp);
608 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8)); 608 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8));
609 WREG32(HDP_NONSURFACE_INFO, (2 << 7)); 609 WREG32(HDP_NONSURFACE_INFO, (2 << 7));
610 WREG32(HDP_NONSURFACE_SIZE, (rdev->mc.mc_vram_size - 1) | 0x3FF); 610 WREG32(HDP_NONSURFACE_SIZE, 0x3FFFFFFF);
611 if (rdev->flags & RADEON_IS_AGP) { 611 if (rdev->flags & RADEON_IS_AGP) {
612 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16); 612 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16);
613 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 16); 613 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 16);
@@ -1222,11 +1222,11 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1222 ps_thread_count = 128; 1222 ps_thread_count = 128;
1223 1223
1224 sq_thread_resource_mgmt = NUM_PS_THREADS(ps_thread_count); 1224 sq_thread_resource_mgmt = NUM_PS_THREADS(ps_thread_count);
1225 sq_thread_resource_mgmt |= NUM_VS_THREADS(((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8; 1225 sq_thread_resource_mgmt |= NUM_VS_THREADS((((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8);
1226 sq_thread_resource_mgmt |= NUM_GS_THREADS(((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8; 1226 sq_thread_resource_mgmt |= NUM_GS_THREADS((((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8);
1227 sq_thread_resource_mgmt |= NUM_ES_THREADS(((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8; 1227 sq_thread_resource_mgmt |= NUM_ES_THREADS((((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8);
1228 sq_thread_resource_mgmt_2 = NUM_HS_THREADS(((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8; 1228 sq_thread_resource_mgmt_2 = NUM_HS_THREADS((((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8);
1229 sq_thread_resource_mgmt_2 |= NUM_LS_THREADS(((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8; 1229 sq_thread_resource_mgmt_2 |= NUM_LS_THREADS((((rdev->config.evergreen.max_threads - ps_thread_count) / 6) / 8) * 8);
1230 1230
1231 sq_stack_resource_mgmt_1 = NUM_PS_STACK_ENTRIES((rdev->config.evergreen.max_stack_entries * 1) / 6); 1231 sq_stack_resource_mgmt_1 = NUM_PS_STACK_ENTRIES((rdev->config.evergreen.max_stack_entries * 1) / 6);
1232 sq_stack_resource_mgmt_1 |= NUM_VS_STACK_ENTRIES((rdev->config.evergreen.max_stack_entries * 1) / 6); 1232 sq_stack_resource_mgmt_1 |= NUM_VS_STACK_ENTRIES((rdev->config.evergreen.max_stack_entries * 1) / 6);
@@ -1260,6 +1260,9 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1260 WREG32(VGT_GS_VERTEX_REUSE, 16); 1260 WREG32(VGT_GS_VERTEX_REUSE, 16);
1261 WREG32(PA_SC_LINE_STIPPLE_STATE, 0); 1261 WREG32(PA_SC_LINE_STIPPLE_STATE, 0);
1262 1262
1263 WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14);
1264 WREG32(VGT_OUT_DEALLOC_CNTL, 16);
1265
1263 WREG32(CB_PERF_CTR0_SEL_0, 0); 1266 WREG32(CB_PERF_CTR0_SEL_0, 0);
1264 WREG32(CB_PERF_CTR0_SEL_1, 0); 1267 WREG32(CB_PERF_CTR0_SEL_1, 0);
1265 WREG32(CB_PERF_CTR1_SEL_0, 0); 1268 WREG32(CB_PERF_CTR1_SEL_0, 0);
@@ -1269,6 +1272,26 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
1269 WREG32(CB_PERF_CTR3_SEL_0, 0); 1272 WREG32(CB_PERF_CTR3_SEL_0, 0);
1270 WREG32(CB_PERF_CTR3_SEL_1, 0); 1273 WREG32(CB_PERF_CTR3_SEL_1, 0);
1271 1274
1275 /* clear render buffer base addresses */
1276 WREG32(CB_COLOR0_BASE, 0);
1277 WREG32(CB_COLOR1_BASE, 0);
1278 WREG32(CB_COLOR2_BASE, 0);
1279 WREG32(CB_COLOR3_BASE, 0);
1280 WREG32(CB_COLOR4_BASE, 0);
1281 WREG32(CB_COLOR5_BASE, 0);
1282 WREG32(CB_COLOR6_BASE, 0);
1283 WREG32(CB_COLOR7_BASE, 0);
1284 WREG32(CB_COLOR8_BASE, 0);
1285 WREG32(CB_COLOR9_BASE, 0);
1286 WREG32(CB_COLOR10_BASE, 0);
1287 WREG32(CB_COLOR11_BASE, 0);
1288
1289 /* set the shader const cache sizes to 0 */
1290 for (i = SQ_ALU_CONST_BUFFER_SIZE_PS_0; i < 0x28200; i += 4)
1291 WREG32(i, 0);
1292 for (i = SQ_ALU_CONST_BUFFER_SIZE_HS_0; i < 0x29000; i += 4)
1293 WREG32(i, 0);
1294
1272 hdp_host_path_cntl = RREG32(HDP_HOST_PATH_CNTL); 1295 hdp_host_path_cntl = RREG32(HDP_HOST_PATH_CNTL);
1273 WREG32(HDP_HOST_PATH_CNTL, hdp_host_path_cntl); 1296 WREG32(HDP_HOST_PATH_CNTL, hdp_host_path_cntl);
1274 1297
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 64516b950891..010963d4570f 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -1197,7 +1197,7 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
1197 DRM_ERROR("bad SET_RESOURCE (tex)\n"); 1197 DRM_ERROR("bad SET_RESOURCE (tex)\n");
1198 return -EINVAL; 1198 return -EINVAL;
1199 } 1199 }
1200 ib[idx+1+(i*8)+3] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1200 ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1201 if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) 1201 if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO)
1202 ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1); 1202 ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1);
1203 else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) 1203 else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO)
@@ -1209,7 +1209,7 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
1209 DRM_ERROR("bad SET_RESOURCE (tex)\n"); 1209 DRM_ERROR("bad SET_RESOURCE (tex)\n");
1210 return -EINVAL; 1210 return -EINVAL;
1211 } 1211 }
1212 ib[idx+1+(i*8)+4] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); 1212 ib[idx+1+(i*8)+3] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff);
1213 mipmap = reloc->robj; 1213 mipmap = reloc->robj;
1214 r = evergreen_check_texture_resource(p, idx+1+(i*8), 1214 r = evergreen_check_texture_resource(p, idx+1+(i*8),
1215 texture, mipmap); 1215 texture, mipmap);
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index 79683f6b4452..a1cd621780e2 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -713,6 +713,9 @@
713#define SQ_GSVS_RING_OFFSET_2 0x28930 713#define SQ_GSVS_RING_OFFSET_2 0x28930
714#define SQ_GSVS_RING_OFFSET_3 0x28934 714#define SQ_GSVS_RING_OFFSET_3 0x28934
715 715
716#define SQ_ALU_CONST_BUFFER_SIZE_PS_0 0x28140
717#define SQ_ALU_CONST_BUFFER_SIZE_HS_0 0x28f80
718
716#define SQ_ALU_CONST_CACHE_PS_0 0x28940 719#define SQ_ALU_CONST_CACHE_PS_0 0x28940
717#define SQ_ALU_CONST_CACHE_PS_1 0x28944 720#define SQ_ALU_CONST_CACHE_PS_1 0x28944
718#define SQ_ALU_CONST_CACHE_PS_2 0x28948 721#define SQ_ALU_CONST_CACHE_PS_2 0x28948
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index cf89aa2eb28c..3970e62eaab8 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -1628,6 +1628,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1628 case RADEON_TXFORMAT_RGB332: 1628 case RADEON_TXFORMAT_RGB332:
1629 case RADEON_TXFORMAT_Y8: 1629 case RADEON_TXFORMAT_Y8:
1630 track->textures[i].cpp = 1; 1630 track->textures[i].cpp = 1;
1631 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
1631 break; 1632 break;
1632 case RADEON_TXFORMAT_AI88: 1633 case RADEON_TXFORMAT_AI88:
1633 case RADEON_TXFORMAT_ARGB1555: 1634 case RADEON_TXFORMAT_ARGB1555:
@@ -1639,12 +1640,14 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
1639 case RADEON_TXFORMAT_LDUDV655: 1640 case RADEON_TXFORMAT_LDUDV655:
1640 case RADEON_TXFORMAT_DUDV88: 1641 case RADEON_TXFORMAT_DUDV88:
1641 track->textures[i].cpp = 2; 1642 track->textures[i].cpp = 2;
1643 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
1642 break; 1644 break;
1643 case RADEON_TXFORMAT_ARGB8888: 1645 case RADEON_TXFORMAT_ARGB8888:
1644 case RADEON_TXFORMAT_RGBA8888: 1646 case RADEON_TXFORMAT_RGBA8888:
1645 case RADEON_TXFORMAT_SHADOW32: 1647 case RADEON_TXFORMAT_SHADOW32:
1646 case RADEON_TXFORMAT_LDUDUV8888: 1648 case RADEON_TXFORMAT_LDUDUV8888:
1647 track->textures[i].cpp = 4; 1649 track->textures[i].cpp = 4;
1650 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
1648 break; 1651 break;
1649 case RADEON_TXFORMAT_DXT1: 1652 case RADEON_TXFORMAT_DXT1:
1650 track->textures[i].cpp = 1; 1653 track->textures[i].cpp = 1;
@@ -2604,12 +2607,6 @@ int r100_set_surface_reg(struct radeon_device *rdev, int reg,
2604 int surf_index = reg * 16; 2607 int surf_index = reg * 16;
2605 int flags = 0; 2608 int flags = 0;
2606 2609
2607 /* r100/r200 divide by 16 */
2608 if (rdev->family < CHIP_R300)
2609 flags = pitch / 16;
2610 else
2611 flags = pitch / 8;
2612
2613 if (rdev->family <= CHIP_RS200) { 2610 if (rdev->family <= CHIP_RS200) {
2614 if ((tiling_flags & (RADEON_TILING_MACRO|RADEON_TILING_MICRO)) 2611 if ((tiling_flags & (RADEON_TILING_MACRO|RADEON_TILING_MICRO))
2615 == (RADEON_TILING_MACRO|RADEON_TILING_MICRO)) 2612 == (RADEON_TILING_MACRO|RADEON_TILING_MICRO))
@@ -2633,6 +2630,20 @@ int r100_set_surface_reg(struct radeon_device *rdev, int reg,
2633 if (tiling_flags & RADEON_TILING_SWAP_32BIT) 2630 if (tiling_flags & RADEON_TILING_SWAP_32BIT)
2634 flags |= RADEON_SURF_AP0_SWP_32BPP | RADEON_SURF_AP1_SWP_32BPP; 2631 flags |= RADEON_SURF_AP0_SWP_32BPP | RADEON_SURF_AP1_SWP_32BPP;
2635 2632
2633 /* when we aren't tiling the pitch seems to needs to be furtherdivided down. - tested on power5 + rn50 server */
2634 if (tiling_flags & (RADEON_TILING_SWAP_16BIT | RADEON_TILING_SWAP_32BIT)) {
2635 if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO)))
2636 if (ASIC_IS_RN50(rdev))
2637 pitch /= 16;
2638 }
2639
2640 /* r100/r200 divide by 16 */
2641 if (rdev->family < CHIP_R300)
2642 flags |= pitch / 16;
2643 else
2644 flags |= pitch / 8;
2645
2646
2636 DRM_DEBUG("writing surface %d %d %x %x\n", reg, flags, offset, offset+obj_size-1); 2647 DRM_DEBUG("writing surface %d %d %x %x\n", reg, flags, offset, offset+obj_size-1);
2637 WREG32(RADEON_SURFACE0_INFO + surf_index, flags); 2648 WREG32(RADEON_SURFACE0_INFO + surf_index, flags);
2638 WREG32(RADEON_SURFACE0_LOWER_BOUND + surf_index, offset); 2649 WREG32(RADEON_SURFACE0_LOWER_BOUND + surf_index, offset);
@@ -3147,33 +3158,6 @@ static inline void r100_cs_track_texture_print(struct r100_cs_track_texture *t)
3147 DRM_ERROR("compress format %d\n", t->compress_format); 3158 DRM_ERROR("compress format %d\n", t->compress_format);
3148} 3159}
3149 3160
3150static int r100_cs_track_cube(struct radeon_device *rdev,
3151 struct r100_cs_track *track, unsigned idx)
3152{
3153 unsigned face, w, h;
3154 struct radeon_bo *cube_robj;
3155 unsigned long size;
3156
3157 for (face = 0; face < 5; face++) {
3158 cube_robj = track->textures[idx].cube_info[face].robj;
3159 w = track->textures[idx].cube_info[face].width;
3160 h = track->textures[idx].cube_info[face].height;
3161
3162 size = w * h;
3163 size *= track->textures[idx].cpp;
3164
3165 size += track->textures[idx].cube_info[face].offset;
3166
3167 if (size > radeon_bo_size(cube_robj)) {
3168 DRM_ERROR("Cube texture offset greater than object size %lu %lu\n",
3169 size, radeon_bo_size(cube_robj));
3170 r100_cs_track_texture_print(&track->textures[idx]);
3171 return -1;
3172 }
3173 }
3174 return 0;
3175}
3176
3177static int r100_track_compress_size(int compress_format, int w, int h) 3161static int r100_track_compress_size(int compress_format, int w, int h)
3178{ 3162{
3179 int block_width, block_height, block_bytes; 3163 int block_width, block_height, block_bytes;
@@ -3204,6 +3188,37 @@ static int r100_track_compress_size(int compress_format, int w, int h)
3204 return sz; 3188 return sz;
3205} 3189}
3206 3190
3191static int r100_cs_track_cube(struct radeon_device *rdev,
3192 struct r100_cs_track *track, unsigned idx)
3193{
3194 unsigned face, w, h;
3195 struct radeon_bo *cube_robj;
3196 unsigned long size;
3197 unsigned compress_format = track->textures[idx].compress_format;
3198
3199 for (face = 0; face < 5; face++) {
3200 cube_robj = track->textures[idx].cube_info[face].robj;
3201 w = track->textures[idx].cube_info[face].width;
3202 h = track->textures[idx].cube_info[face].height;
3203
3204 if (compress_format) {
3205 size = r100_track_compress_size(compress_format, w, h);
3206 } else
3207 size = w * h;
3208 size *= track->textures[idx].cpp;
3209
3210 size += track->textures[idx].cube_info[face].offset;
3211
3212 if (size > radeon_bo_size(cube_robj)) {
3213 DRM_ERROR("Cube texture offset greater than object size %lu %lu\n",
3214 size, radeon_bo_size(cube_robj));
3215 r100_cs_track_texture_print(&track->textures[idx]);
3216 return -1;
3217 }
3218 }
3219 return 0;
3220}
3221
3207static int r100_cs_track_texture_check(struct radeon_device *rdev, 3222static int r100_cs_track_texture_check(struct radeon_device *rdev,
3208 struct r100_cs_track *track) 3223 struct r100_cs_track *track)
3209{ 3224{
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index 85617c311212..0266d72e0a4c 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -415,6 +415,8 @@ int r200_packet0_check(struct radeon_cs_parser *p,
415 /* 2D, 3D, CUBE */ 415 /* 2D, 3D, CUBE */
416 switch (tmp) { 416 switch (tmp) {
417 case 0: 417 case 0:
418 case 3:
419 case 4:
418 case 5: 420 case 5:
419 case 6: 421 case 6:
420 case 7: 422 case 7:
@@ -450,6 +452,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
450 case R200_TXFORMAT_RGB332: 452 case R200_TXFORMAT_RGB332:
451 case R200_TXFORMAT_Y8: 453 case R200_TXFORMAT_Y8:
452 track->textures[i].cpp = 1; 454 track->textures[i].cpp = 1;
455 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
453 break; 456 break;
454 case R200_TXFORMAT_AI88: 457 case R200_TXFORMAT_AI88:
455 case R200_TXFORMAT_ARGB1555: 458 case R200_TXFORMAT_ARGB1555:
@@ -461,6 +464,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
461 case R200_TXFORMAT_DVDU88: 464 case R200_TXFORMAT_DVDU88:
462 case R200_TXFORMAT_AVYU4444: 465 case R200_TXFORMAT_AVYU4444:
463 track->textures[i].cpp = 2; 466 track->textures[i].cpp = 2;
467 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
464 break; 468 break;
465 case R200_TXFORMAT_ARGB8888: 469 case R200_TXFORMAT_ARGB8888:
466 case R200_TXFORMAT_RGBA8888: 470 case R200_TXFORMAT_RGBA8888:
@@ -468,6 +472,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
468 case R200_TXFORMAT_BGR111110: 472 case R200_TXFORMAT_BGR111110:
469 case R200_TXFORMAT_LDVDU8888: 473 case R200_TXFORMAT_LDVDU8888:
470 track->textures[i].cpp = 4; 474 track->textures[i].cpp = 4;
475 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
471 break; 476 break;
472 case R200_TXFORMAT_DXT1: 477 case R200_TXFORMAT_DXT1:
473 track->textures[i].cpp = 1; 478 track->textures[i].cpp = 1;
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index b2f9efe2897c..7e81db5eb804 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -881,6 +881,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
881 case R300_TX_FORMAT_Y4X4: 881 case R300_TX_FORMAT_Y4X4:
882 case R300_TX_FORMAT_Z3Y3X2: 882 case R300_TX_FORMAT_Z3Y3X2:
883 track->textures[i].cpp = 1; 883 track->textures[i].cpp = 1;
884 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
884 break; 885 break;
885 case R300_TX_FORMAT_X16: 886 case R300_TX_FORMAT_X16:
886 case R300_TX_FORMAT_Y8X8: 887 case R300_TX_FORMAT_Y8X8:
@@ -892,6 +893,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
892 case R300_TX_FORMAT_B8G8_B8G8: 893 case R300_TX_FORMAT_B8G8_B8G8:
893 case R300_TX_FORMAT_G8R8_G8B8: 894 case R300_TX_FORMAT_G8R8_G8B8:
894 track->textures[i].cpp = 2; 895 track->textures[i].cpp = 2;
896 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
895 break; 897 break;
896 case R300_TX_FORMAT_Y16X16: 898 case R300_TX_FORMAT_Y16X16:
897 case R300_TX_FORMAT_Z11Y11X10: 899 case R300_TX_FORMAT_Z11Y11X10:
@@ -902,14 +904,17 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
902 case R300_TX_FORMAT_FL_I32: 904 case R300_TX_FORMAT_FL_I32:
903 case 0x1e: 905 case 0x1e:
904 track->textures[i].cpp = 4; 906 track->textures[i].cpp = 4;
907 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
905 break; 908 break;
906 case R300_TX_FORMAT_W16Z16Y16X16: 909 case R300_TX_FORMAT_W16Z16Y16X16:
907 case R300_TX_FORMAT_FL_R16G16B16A16: 910 case R300_TX_FORMAT_FL_R16G16B16A16:
908 case R300_TX_FORMAT_FL_I32A32: 911 case R300_TX_FORMAT_FL_I32A32:
909 track->textures[i].cpp = 8; 912 track->textures[i].cpp = 8;
913 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
910 break; 914 break;
911 case R300_TX_FORMAT_FL_R32G32B32A32: 915 case R300_TX_FORMAT_FL_R32G32B32A32:
912 track->textures[i].cpp = 16; 916 track->textures[i].cpp = 16;
917 track->textures[i].compress_format = R100_TRACK_COMP_NONE;
913 break; 918 break;
914 case R300_TX_FORMAT_DXT1: 919 case R300_TX_FORMAT_DXT1:
915 track->textures[i].cpp = 1; 920 track->textures[i].cpp = 1;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 0e91871f45be..3d6645ce2151 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -130,9 +130,14 @@ void r600_pm_get_dynpm_state(struct radeon_device *rdev)
130 break; 130 break;
131 } 131 }
132 } 132 }
133 } else 133 } else {
134 rdev->pm.requested_power_state_index = 134 if (rdev->pm.current_power_state_index == 0)
135 rdev->pm.current_power_state_index - 1; 135 rdev->pm.requested_power_state_index =
136 rdev->pm.num_power_states - 1;
137 else
138 rdev->pm.requested_power_state_index =
139 rdev->pm.current_power_state_index - 1;
140 }
136 } 141 }
137 rdev->pm.requested_clock_mode_index = 0; 142 rdev->pm.requested_clock_mode_index = 0;
138 /* don't use the power state if crtcs are active and no display flag is set */ 143 /* don't use the power state if crtcs are active and no display flag is set */
@@ -1097,7 +1102,7 @@ static void r600_mc_program(struct radeon_device *rdev)
1097 WREG32(MC_VM_FB_LOCATION, tmp); 1102 WREG32(MC_VM_FB_LOCATION, tmp);
1098 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8)); 1103 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8));
1099 WREG32(HDP_NONSURFACE_INFO, (2 << 7)); 1104 WREG32(HDP_NONSURFACE_INFO, (2 << 7));
1100 WREG32(HDP_NONSURFACE_SIZE, rdev->mc.mc_vram_size | 0x3FF); 1105 WREG32(HDP_NONSURFACE_SIZE, 0x3FFFFFFF);
1101 if (rdev->flags & RADEON_IS_AGP) { 1106 if (rdev->flags & RADEON_IS_AGP) {
1102 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 22); 1107 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 22);
1103 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 22); 1108 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 22);
@@ -1219,8 +1224,10 @@ int r600_mc_init(struct radeon_device *rdev)
1219 rdev->mc.visible_vram_size = rdev->mc.aper_size; 1224 rdev->mc.visible_vram_size = rdev->mc.aper_size;
1220 r600_vram_gtt_location(rdev, &rdev->mc); 1225 r600_vram_gtt_location(rdev, &rdev->mc);
1221 1226
1222 if (rdev->flags & RADEON_IS_IGP) 1227 if (rdev->flags & RADEON_IS_IGP) {
1228 rs690_pm_info(rdev);
1223 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 1229 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
1230 }
1224 radeon_update_bandwidth_info(rdev); 1231 radeon_update_bandwidth_info(rdev);
1225 return 0; 1232 return 0;
1226} 1233}
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 8e1d44ca26ec..ab61aaa887bb 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -177,6 +177,7 @@ void radeon_pm_resume(struct radeon_device *rdev);
177void radeon_combios_get_power_modes(struct radeon_device *rdev); 177void radeon_combios_get_power_modes(struct radeon_device *rdev);
178void radeon_atombios_get_power_modes(struct radeon_device *rdev); 178void radeon_atombios_get_power_modes(struct radeon_device *rdev);
179void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); 179void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level);
180void rs690_pm_info(struct radeon_device *rdev);
180 181
181/* 182/*
182 * Fences. 183 * Fences.
@@ -619,7 +620,8 @@ enum radeon_dynpm_state {
619 DYNPM_STATE_DISABLED, 620 DYNPM_STATE_DISABLED,
620 DYNPM_STATE_MINIMUM, 621 DYNPM_STATE_MINIMUM,
621 DYNPM_STATE_PAUSED, 622 DYNPM_STATE_PAUSED,
622 DYNPM_STATE_ACTIVE 623 DYNPM_STATE_ACTIVE,
624 DYNPM_STATE_SUSPENDED,
623}; 625};
624enum radeon_dynpm_action { 626enum radeon_dynpm_action {
625 DYNPM_ACTION_NONE, 627 DYNPM_ACTION_NONE,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 87f7e2cc52d4..646f96f97c77 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -780,6 +780,13 @@ int radeon_asic_init(struct radeon_device *rdev)
780 case CHIP_R423: 780 case CHIP_R423:
781 case CHIP_RV410: 781 case CHIP_RV410:
782 rdev->asic = &r420_asic; 782 rdev->asic = &r420_asic;
783 /* handle macs */
784 if (rdev->bios == NULL) {
785 rdev->asic->get_engine_clock = &radeon_legacy_get_engine_clock;
786 rdev->asic->set_engine_clock = &radeon_legacy_set_engine_clock;
787 rdev->asic->get_memory_clock = &radeon_legacy_get_memory_clock;
788 rdev->asic->set_memory_clock = NULL;
789 }
783 break; 790 break;
784 case CHIP_RS400: 791 case CHIP_RS400:
785 case CHIP_RS480: 792 case CHIP_RS480:
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index fbba938f8048..2c9213739999 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -48,6 +48,10 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
48 resource_size_t vram_base; 48 resource_size_t vram_base;
49 resource_size_t size = 256 * 1024; /* ??? */ 49 resource_size_t size = 256 * 1024; /* ??? */
50 50
51 if (!(rdev->flags & RADEON_IS_IGP))
52 if (!radeon_card_posted(rdev))
53 return false;
54
51 rdev->bios = NULL; 55 rdev->bios = NULL;
52 vram_base = drm_get_resource_start(rdev->ddev, 0); 56 vram_base = drm_get_resource_start(rdev->ddev, 0);
53 bios = ioremap(vram_base, size); 57 bios = ioremap(vram_base, size);
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 1bee2f9e24a5..d1c1d8dd93ce 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -1411,6 +1411,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1411 rdev->mode_info.connector_table = CT_IMAC_G5_ISIGHT; 1411 rdev->mode_info.connector_table = CT_IMAC_G5_ISIGHT;
1412 } else 1412 } else
1413#endif /* CONFIG_PPC_PMAC */ 1413#endif /* CONFIG_PPC_PMAC */
1414#ifdef CONFIG_PPC64
1415 if (ASIC_IS_RN50(rdev))
1416 rdev->mode_info.connector_table = CT_RN50_POWER;
1417 else
1418#endif
1414 rdev->mode_info.connector_table = CT_GENERIC; 1419 rdev->mode_info.connector_table = CT_GENERIC;
1415 } 1420 }
1416 1421
@@ -1853,6 +1858,33 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1853 CONNECTOR_OBJECT_ID_SVIDEO, 1858 CONNECTOR_OBJECT_ID_SVIDEO,
1854 &hpd); 1859 &hpd);
1855 break; 1860 break;
1861 case CT_RN50_POWER:
1862 DRM_INFO("Connector Table: %d (rn50-power)\n",
1863 rdev->mode_info.connector_table);
1864 /* VGA - primary dac */
1865 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1866 hpd.hpd = RADEON_HPD_NONE;
1867 radeon_add_legacy_encoder(dev,
1868 radeon_get_encoder_id(dev,
1869 ATOM_DEVICE_CRT1_SUPPORT,
1870 1),
1871 ATOM_DEVICE_CRT1_SUPPORT);
1872 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_CRT1_SUPPORT,
1873 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1874 CONNECTOR_OBJECT_ID_VGA,
1875 &hpd);
1876 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC);
1877 hpd.hpd = RADEON_HPD_NONE;
1878 radeon_add_legacy_encoder(dev,
1879 radeon_get_encoder_id(dev,
1880 ATOM_DEVICE_CRT2_SUPPORT,
1881 2),
1882 ATOM_DEVICE_CRT2_SUPPORT);
1883 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT,
1884 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1885 CONNECTOR_OBJECT_ID_VGA,
1886 &hpd);
1887 break;
1856 default: 1888 default:
1857 DRM_INFO("Connector table: %d (invalid)\n", 1889 DRM_INFO("Connector table: %d (invalid)\n",
1858 rdev->mode_info.connector_table); 1890 rdev->mode_info.connector_table);
@@ -1906,15 +1938,6 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev,
1906 return false; 1938 return false;
1907 } 1939 }
1908 1940
1909 /* Some RV100 cards with 2 VGA ports show up with DVI+VGA */
1910 if (dev->pdev->device == 0x5159 &&
1911 dev->pdev->subsystem_vendor == 0x1002 &&
1912 dev->pdev->subsystem_device == 0x013a) {
1913 if (*legacy_connector == CONNECTOR_DVI_I_LEGACY)
1914 *legacy_connector = CONNECTOR_CRT_LEGACY;
1915
1916 }
1917
1918 /* X300 card with extra non-existent DVI port */ 1941 /* X300 card with extra non-existent DVI port */
1919 if (dev->pdev->device == 0x5B60 && 1942 if (dev->pdev->device == 0x5B60 &&
1920 dev->pdev->subsystem_vendor == 0x17af && 1943 dev->pdev->subsystem_vendor == 0x17af &&
@@ -3019,6 +3042,14 @@ void radeon_combios_asic_init(struct drm_device *dev)
3019 combios_write_ram_size(dev); 3042 combios_write_ram_size(dev);
3020 } 3043 }
3021 3044
3045 /* quirk for rs4xx HP nx6125 laptop to make it resume
3046 * - it hangs on resume inside the dynclk 1 table.
3047 */
3048 if (rdev->family == CHIP_RS480 &&
3049 rdev->pdev->subsystem_vendor == 0x103c &&
3050 rdev->pdev->subsystem_device == 0x308b)
3051 return;
3052
3022 /* DYN CLK 1 */ 3053 /* DYN CLK 1 */
3023 table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); 3054 table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE);
3024 if (table) 3055 if (table)
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index b7023fff89eb..4eb67c0e0996 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -194,7 +194,7 @@ unpin:
194fail: 194fail:
195 drm_gem_object_unreference_unlocked(obj); 195 drm_gem_object_unreference_unlocked(obj);
196 196
197 return 0; 197 return ret;
198} 198}
199 199
200int radeon_crtc_cursor_move(struct drm_crtc *crtc, 200int radeon_crtc_cursor_move(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index f10faed21567..5f317317aba2 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -779,6 +779,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
779 779
780int radeon_resume_kms(struct drm_device *dev) 780int radeon_resume_kms(struct drm_device *dev)
781{ 781{
782 struct drm_connector *connector;
782 struct radeon_device *rdev = dev->dev_private; 783 struct radeon_device *rdev = dev->dev_private;
783 784
784 if (rdev->powered_down) 785 if (rdev->powered_down)
@@ -797,6 +798,12 @@ int radeon_resume_kms(struct drm_device *dev)
797 radeon_resume(rdev); 798 radeon_resume(rdev);
798 radeon_pm_resume(rdev); 799 radeon_pm_resume(rdev);
799 radeon_restore_bios_scratch_regs(rdev); 800 radeon_restore_bios_scratch_regs(rdev);
801
802 /* turn on display hw */
803 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
804 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
805 }
806
800 radeon_fbdev_set_suspend(rdev, 0); 807 radeon_fbdev_set_suspend(rdev, 0);
801 release_console_sem(); 808 release_console_sem();
802 809
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 1ebb100015b7..e0b30b264c28 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -1072,6 +1072,8 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
1072 if (is_dig) { 1072 if (is_dig) {
1073 switch (mode) { 1073 switch (mode) {
1074 case DRM_MODE_DPMS_ON: 1074 case DRM_MODE_DPMS_ON:
1075 if (!ASIC_IS_DCE4(rdev))
1076 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
1075 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) { 1077 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) {
1076 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); 1078 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
1077 1079
@@ -1079,8 +1081,6 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
1079 if (ASIC_IS_DCE4(rdev)) 1081 if (ASIC_IS_DCE4(rdev))
1080 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON); 1082 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON);
1081 } 1083 }
1082 if (!ASIC_IS_DCE4(rdev))
1083 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
1084 break; 1084 break;
1085 case DRM_MODE_DPMS_STANDBY: 1085 case DRM_MODE_DPMS_STANDBY:
1086 case DRM_MODE_DPMS_SUSPEND: 1086 case DRM_MODE_DPMS_SUSPEND:
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 5b07b8848e09..bad77f40a9da 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -928,16 +928,14 @@ static void radeon_legacy_tv_dac_mode_set(struct drm_encoder *encoder,
928 if (ASIC_IS_R300(rdev)) { 928 if (ASIC_IS_R300(rdev)) {
929 gpiopad_a = RREG32(RADEON_GPIOPAD_A) | 1; 929 gpiopad_a = RREG32(RADEON_GPIOPAD_A) | 1;
930 disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); 930 disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL);
931 } 931 } else if (rdev->family != CHIP_R200)
932
933 if (rdev->family == CHIP_R200 || ASIC_IS_R300(rdev))
934 disp_tv_out_cntl = RREG32(RADEON_DISP_TV_OUT_CNTL);
935 else
936 disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG); 932 disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG);
937 933 else if (rdev->family == CHIP_R200)
938 if (rdev->family == CHIP_R200)
939 fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); 934 fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
940 935
936 if (rdev->family >= CHIP_R200)
937 disp_tv_out_cntl = RREG32(RADEON_DISP_TV_OUT_CNTL);
938
941 if (is_tv) { 939 if (is_tv) {
942 uint32_t dac_cntl; 940 uint32_t dac_cntl;
943 941
@@ -1002,15 +1000,13 @@ static void radeon_legacy_tv_dac_mode_set(struct drm_encoder *encoder,
1002 if (ASIC_IS_R300(rdev)) { 1000 if (ASIC_IS_R300(rdev)) {
1003 WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); 1001 WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
1004 WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); 1002 WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
1005 } 1003 } else if (rdev->family != CHIP_R200)
1004 WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
1005 else if (rdev->family == CHIP_R200)
1006 WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
1006 1007
1007 if (rdev->family >= CHIP_R200) 1008 if (rdev->family >= CHIP_R200)
1008 WREG32(RADEON_DISP_TV_OUT_CNTL, disp_tv_out_cntl); 1009 WREG32(RADEON_DISP_TV_OUT_CNTL, disp_tv_out_cntl);
1009 else
1010 WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
1011
1012 if (rdev->family == CHIP_R200)
1013 WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
1014 1010
1015 if (is_tv) 1011 if (is_tv)
1016 radeon_legacy_tv_mode_set(encoder, mode, adjusted_mode); 1012 radeon_legacy_tv_mode_set(encoder, mode, adjusted_mode);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 67358baf28b2..95696aa57ac8 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -206,6 +206,7 @@ enum radeon_connector_table {
206 CT_MINI_INTERNAL, 206 CT_MINI_INTERNAL,
207 CT_IMAC_G5_ISIGHT, 207 CT_IMAC_G5_ISIGHT,
208 CT_EMAC, 208 CT_EMAC,
209 CT_RN50_POWER,
209}; 210};
210 211
211enum radeon_dvo_chip { 212enum radeon_dvo_chip {
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 63f679a04b25..115d26b762cc 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -397,13 +397,20 @@ static ssize_t radeon_set_pm_method(struct device *dev,
397 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT; 397 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
398 mutex_unlock(&rdev->pm.mutex); 398 mutex_unlock(&rdev->pm.mutex);
399 } else if (strncmp("profile", buf, strlen("profile")) == 0) { 399 } else if (strncmp("profile", buf, strlen("profile")) == 0) {
400 bool flush_wq = false;
401
400 mutex_lock(&rdev->pm.mutex); 402 mutex_lock(&rdev->pm.mutex);
401 rdev->pm.pm_method = PM_METHOD_PROFILE; 403 if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
404 cancel_delayed_work(&rdev->pm.dynpm_idle_work);
405 flush_wq = true;
406 }
402 /* disable dynpm */ 407 /* disable dynpm */
403 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; 408 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
404 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; 409 rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
405 cancel_delayed_work(&rdev->pm.dynpm_idle_work); 410 rdev->pm.pm_method = PM_METHOD_PROFILE;
406 mutex_unlock(&rdev->pm.mutex); 411 mutex_unlock(&rdev->pm.mutex);
412 if (flush_wq)
413 flush_workqueue(rdev->wq);
407 } else { 414 } else {
408 DRM_ERROR("invalid power method!\n"); 415 DRM_ERROR("invalid power method!\n");
409 goto fail; 416 goto fail;
@@ -418,9 +425,18 @@ static DEVICE_ATTR(power_method, S_IRUGO | S_IWUSR, radeon_get_pm_method, radeon
418 425
419void radeon_pm_suspend(struct radeon_device *rdev) 426void radeon_pm_suspend(struct radeon_device *rdev)
420{ 427{
428 bool flush_wq = false;
429
421 mutex_lock(&rdev->pm.mutex); 430 mutex_lock(&rdev->pm.mutex);
422 cancel_delayed_work(&rdev->pm.dynpm_idle_work); 431 if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
432 cancel_delayed_work(&rdev->pm.dynpm_idle_work);
433 if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE)
434 rdev->pm.dynpm_state = DYNPM_STATE_SUSPENDED;
435 flush_wq = true;
436 }
423 mutex_unlock(&rdev->pm.mutex); 437 mutex_unlock(&rdev->pm.mutex);
438 if (flush_wq)
439 flush_workqueue(rdev->wq);
424} 440}
425 441
426void radeon_pm_resume(struct radeon_device *rdev) 442void radeon_pm_resume(struct radeon_device *rdev)
@@ -432,6 +448,12 @@ void radeon_pm_resume(struct radeon_device *rdev)
432 rdev->pm.current_sclk = rdev->clock.default_sclk; 448 rdev->pm.current_sclk = rdev->clock.default_sclk;
433 rdev->pm.current_mclk = rdev->clock.default_mclk; 449 rdev->pm.current_mclk = rdev->clock.default_mclk;
434 rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; 450 rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
451 if (rdev->pm.pm_method == PM_METHOD_DYNPM
452 && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) {
453 rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
454 queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
455 msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
456 }
435 mutex_unlock(&rdev->pm.mutex); 457 mutex_unlock(&rdev->pm.mutex);
436 radeon_pm_compute_clocks(rdev); 458 radeon_pm_compute_clocks(rdev);
437} 459}
@@ -486,6 +508,8 @@ int radeon_pm_init(struct radeon_device *rdev)
486void radeon_pm_fini(struct radeon_device *rdev) 508void radeon_pm_fini(struct radeon_device *rdev)
487{ 509{
488 if (rdev->pm.num_power_states > 1) { 510 if (rdev->pm.num_power_states > 1) {
511 bool flush_wq = false;
512
489 mutex_lock(&rdev->pm.mutex); 513 mutex_lock(&rdev->pm.mutex);
490 if (rdev->pm.pm_method == PM_METHOD_PROFILE) { 514 if (rdev->pm.pm_method == PM_METHOD_PROFILE) {
491 rdev->pm.profile = PM_PROFILE_DEFAULT; 515 rdev->pm.profile = PM_PROFILE_DEFAULT;
@@ -493,13 +517,16 @@ void radeon_pm_fini(struct radeon_device *rdev)
493 radeon_pm_set_clocks(rdev); 517 radeon_pm_set_clocks(rdev);
494 } else if (rdev->pm.pm_method == PM_METHOD_DYNPM) { 518 } else if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
495 /* cancel work */ 519 /* cancel work */
496 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); 520 cancel_delayed_work(&rdev->pm.dynpm_idle_work);
521 flush_wq = true;
497 /* reset default clocks */ 522 /* reset default clocks */
498 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; 523 rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
499 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT; 524 rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
500 radeon_pm_set_clocks(rdev); 525 radeon_pm_set_clocks(rdev);
501 } 526 }
502 mutex_unlock(&rdev->pm.mutex); 527 mutex_unlock(&rdev->pm.mutex);
528 if (flush_wq)
529 flush_workqueue(rdev->wq);
503 530
504 device_remove_file(rdev->dev, &dev_attr_power_profile); 531 device_remove_file(rdev->dev, &dev_attr_power_profile);
505 device_remove_file(rdev->dev, &dev_attr_power_method); 532 device_remove_file(rdev->dev, &dev_attr_power_method);
@@ -720,12 +747,12 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
720 radeon_pm_get_dynpm_state(rdev); 747 radeon_pm_get_dynpm_state(rdev);
721 radeon_pm_set_clocks(rdev); 748 radeon_pm_set_clocks(rdev);
722 } 749 }
750
751 queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
752 msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
723 } 753 }
724 mutex_unlock(&rdev->pm.mutex); 754 mutex_unlock(&rdev->pm.mutex);
725 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); 755 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
726
727 queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
728 msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
729} 756}
730 757
731/* 758/*
diff --git a/drivers/gpu/drm/radeon/reg_srcs/evergreen b/drivers/gpu/drm/radeon/reg_srcs/evergreen
index b5c757f68d3c..f78fd592544d 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/evergreen
+++ b/drivers/gpu/drm/radeon/reg_srcs/evergreen
@@ -80,8 +80,8 @@ evergreen 0x9400
800x00028010 DB_RENDER_OVERRIDE2 800x00028010 DB_RENDER_OVERRIDE2
810x00028028 DB_STENCIL_CLEAR 810x00028028 DB_STENCIL_CLEAR
820x0002802C DB_DEPTH_CLEAR 820x0002802C DB_DEPTH_CLEAR
830x00028034 PA_SC_SCREEN_SCISSOR_BR
840x00028030 PA_SC_SCREEN_SCISSOR_TL 830x00028030 PA_SC_SCREEN_SCISSOR_TL
840x00028034 PA_SC_SCREEN_SCISSOR_BR
850x0002805C DB_DEPTH_SLICE 850x0002805C DB_DEPTH_SLICE
860x00028140 SQ_ALU_CONST_BUFFER_SIZE_PS_0 860x00028140 SQ_ALU_CONST_BUFFER_SIZE_PS_0
870x00028144 SQ_ALU_CONST_BUFFER_SIZE_PS_1 870x00028144 SQ_ALU_CONST_BUFFER_SIZE_PS_1
@@ -460,8 +460,8 @@ evergreen 0x9400
4600x00028844 SQ_PGM_RESOURCES_PS 4600x00028844 SQ_PGM_RESOURCES_PS
4610x00028848 SQ_PGM_RESOURCES_2_PS 4610x00028848 SQ_PGM_RESOURCES_2_PS
4620x0002884C SQ_PGM_EXPORTS_PS 4620x0002884C SQ_PGM_EXPORTS_PS
4630x0002885C SQ_PGM_RESOURCES_VS 4630x00028860 SQ_PGM_RESOURCES_VS
4640x00028860 SQ_PGM_RESOURCES_2_VS 4640x00028864 SQ_PGM_RESOURCES_2_VS
4650x00028878 SQ_PGM_RESOURCES_GS 4650x00028878 SQ_PGM_RESOURCES_GS
4660x0002887C SQ_PGM_RESOURCES_2_GS 4660x0002887C SQ_PGM_RESOURCES_2_GS
4670x00028890 SQ_PGM_RESOURCES_ES 4670x00028890 SQ_PGM_RESOURCES_ES
@@ -469,8 +469,8 @@ evergreen 0x9400
4690x000288A8 SQ_PGM_RESOURCES_FS 4690x000288A8 SQ_PGM_RESOURCES_FS
4700x000288BC SQ_PGM_RESOURCES_HS 4700x000288BC SQ_PGM_RESOURCES_HS
4710x000288C0 SQ_PGM_RESOURCES_2_HS 4710x000288C0 SQ_PGM_RESOURCES_2_HS
4720x000288D0 SQ_PGM_RESOURCES_LS 4720x000288D4 SQ_PGM_RESOURCES_LS
4730x000288D4 SQ_PGM_RESOURCES_2_LS 4730x000288D8 SQ_PGM_RESOURCES_2_LS
4740x000288E8 SQ_LDS_ALLOC 4740x000288E8 SQ_LDS_ALLOC
4750x000288EC SQ_LDS_ALLOC_PS 4750x000288EC SQ_LDS_ALLOC_PS
4760x000288F0 SQ_VTX_SEMANTIC_CLEAR 4760x000288F0 SQ_VTX_SEMANTIC_CLEAR
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index bcc33195ebc2..f4f0a61bcdce 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -79,7 +79,13 @@ void rs690_pm_info(struct radeon_device *rdev)
79 tmp.full = dfixed_const(100); 79 tmp.full = dfixed_const(100);
80 rdev->pm.igp_sideport_mclk.full = dfixed_const(info->info.ulBootUpMemoryClock); 80 rdev->pm.igp_sideport_mclk.full = dfixed_const(info->info.ulBootUpMemoryClock);
81 rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); 81 rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp);
82 rdev->pm.igp_system_mclk.full = dfixed_const(le16_to_cpu(info->info.usK8MemoryClock)); 82 if (info->info.usK8MemoryClock)
83 rdev->pm.igp_system_mclk.full = dfixed_const(le16_to_cpu(info->info.usK8MemoryClock));
84 else if (rdev->clock.default_mclk) {
85 rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk);
86 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp);
87 } else
88 rdev->pm.igp_system_mclk.full = dfixed_const(400);
83 rdev->pm.igp_ht_link_clk.full = dfixed_const(le16_to_cpu(info->info.usFSBClock)); 89 rdev->pm.igp_ht_link_clk.full = dfixed_const(le16_to_cpu(info->info.usFSBClock));
84 rdev->pm.igp_ht_link_width.full = dfixed_const(info->info.ucHTLinkWidth); 90 rdev->pm.igp_ht_link_width.full = dfixed_const(info->info.ucHTLinkWidth);
85 break; 91 break;
@@ -87,34 +93,31 @@ void rs690_pm_info(struct radeon_device *rdev)
87 tmp.full = dfixed_const(100); 93 tmp.full = dfixed_const(100);
88 rdev->pm.igp_sideport_mclk.full = dfixed_const(info->info_v2.ulBootUpSidePortClock); 94 rdev->pm.igp_sideport_mclk.full = dfixed_const(info->info_v2.ulBootUpSidePortClock);
89 rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp); 95 rdev->pm.igp_sideport_mclk.full = dfixed_div(rdev->pm.igp_sideport_mclk, tmp);
90 rdev->pm.igp_system_mclk.full = dfixed_const(info->info_v2.ulBootUpUMAClock); 96 if (info->info_v2.ulBootUpUMAClock)
97 rdev->pm.igp_system_mclk.full = dfixed_const(info->info_v2.ulBootUpUMAClock);
98 else if (rdev->clock.default_mclk)
99 rdev->pm.igp_system_mclk.full = dfixed_const(rdev->clock.default_mclk);
100 else
101 rdev->pm.igp_system_mclk.full = dfixed_const(66700);
91 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp); 102 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp);
92 rdev->pm.igp_ht_link_clk.full = dfixed_const(info->info_v2.ulHTLinkFreq); 103 rdev->pm.igp_ht_link_clk.full = dfixed_const(info->info_v2.ulHTLinkFreq);
93 rdev->pm.igp_ht_link_clk.full = dfixed_div(rdev->pm.igp_ht_link_clk, tmp); 104 rdev->pm.igp_ht_link_clk.full = dfixed_div(rdev->pm.igp_ht_link_clk, tmp);
94 rdev->pm.igp_ht_link_width.full = dfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth)); 105 rdev->pm.igp_ht_link_width.full = dfixed_const(le16_to_cpu(info->info_v2.usMinHTLinkWidth));
95 break; 106 break;
96 default: 107 default:
97 tmp.full = dfixed_const(100);
98 /* We assume the slower possible clock ie worst case */ 108 /* We assume the slower possible clock ie worst case */
99 /* DDR 333Mhz */ 109 rdev->pm.igp_sideport_mclk.full = dfixed_const(200);
100 rdev->pm.igp_sideport_mclk.full = dfixed_const(333); 110 rdev->pm.igp_system_mclk.full = dfixed_const(200);
101 /* FIXME: system clock ? */ 111 rdev->pm.igp_ht_link_clk.full = dfixed_const(1000);
102 rdev->pm.igp_system_mclk.full = dfixed_const(100);
103 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp);
104 rdev->pm.igp_ht_link_clk.full = dfixed_const(200);
105 rdev->pm.igp_ht_link_width.full = dfixed_const(8); 112 rdev->pm.igp_ht_link_width.full = dfixed_const(8);
106 DRM_ERROR("No integrated system info for your GPU, using safe default\n"); 113 DRM_ERROR("No integrated system info for your GPU, using safe default\n");
107 break; 114 break;
108 } 115 }
109 } else { 116 } else {
110 tmp.full = dfixed_const(100);
111 /* We assume the slower possible clock ie worst case */ 117 /* We assume the slower possible clock ie worst case */
112 /* DDR 333Mhz */ 118 rdev->pm.igp_sideport_mclk.full = dfixed_const(200);
113 rdev->pm.igp_sideport_mclk.full = dfixed_const(333); 119 rdev->pm.igp_system_mclk.full = dfixed_const(200);
114 /* FIXME: system clock ? */ 120 rdev->pm.igp_ht_link_clk.full = dfixed_const(1000);
115 rdev->pm.igp_system_mclk.full = dfixed_const(100);
116 rdev->pm.igp_system_mclk.full = dfixed_div(rdev->pm.igp_system_mclk, tmp);
117 rdev->pm.igp_ht_link_clk.full = dfixed_const(200);
118 rdev->pm.igp_ht_link_width.full = dfixed_const(8); 121 rdev->pm.igp_ht_link_width.full = dfixed_const(8);
119 DRM_ERROR("No integrated system info for your GPU, using safe default\n"); 122 DRM_ERROR("No integrated system info for your GPU, using safe default\n");
120 } 123 }
@@ -228,10 +231,6 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
228 fixed20_12 a, b, c; 231 fixed20_12 a, b, c;
229 fixed20_12 pclk, request_fifo_depth, tolerable_latency, estimated_width; 232 fixed20_12 pclk, request_fifo_depth, tolerable_latency, estimated_width;
230 fixed20_12 consumption_time, line_time, chunk_time, read_delay_latency; 233 fixed20_12 consumption_time, line_time, chunk_time, read_delay_latency;
231 /* FIXME: detect IGP with sideport memory, i don't think there is any
232 * such product available
233 */
234 bool sideport = false;
235 234
236 if (!crtc->base.enabled) { 235 if (!crtc->base.enabled) {
237 /* FIXME: wouldn't it better to set priority mark to maximum */ 236 /* FIXME: wouldn't it better to set priority mark to maximum */
@@ -300,7 +299,7 @@ void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
300 299
301 /* Maximun bandwidth is the minimun bandwidth of all component */ 300 /* Maximun bandwidth is the minimun bandwidth of all component */
302 rdev->pm.max_bandwidth = rdev->pm.core_bandwidth; 301 rdev->pm.max_bandwidth = rdev->pm.core_bandwidth;
303 if (sideport) { 302 if (rdev->mc.igp_sideport_enabled) {
304 if (rdev->pm.max_bandwidth.full > rdev->pm.sideport_bandwidth.full && 303 if (rdev->pm.max_bandwidth.full > rdev->pm.sideport_bandwidth.full &&
305 rdev->pm.sideport_bandwidth.full) 304 rdev->pm.sideport_bandwidth.full)
306 rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth; 305 rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth;
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index cec536c222c5..b7fd82064922 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -224,7 +224,7 @@ static void rv770_mc_program(struct radeon_device *rdev)
224 WREG32(MC_VM_FB_LOCATION, tmp); 224 WREG32(MC_VM_FB_LOCATION, tmp);
225 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8)); 225 WREG32(HDP_NONSURFACE_BASE, (rdev->mc.vram_start >> 8));
226 WREG32(HDP_NONSURFACE_INFO, (2 << 7)); 226 WREG32(HDP_NONSURFACE_INFO, (2 << 7));
227 WREG32(HDP_NONSURFACE_SIZE, (rdev->mc.mc_vram_size - 1) | 0x3FF); 227 WREG32(HDP_NONSURFACE_SIZE, 0x3FFFFFFF);
228 if (rdev->flags & RADEON_IS_AGP) { 228 if (rdev->flags & RADEON_IS_AGP) {
229 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16); 229 WREG32(MC_VM_AGP_TOP, rdev->mc.gtt_end >> 16);
230 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 16); 230 WREG32(MC_VM_AGP_BOT, rdev->mc.gtt_start >> 16);
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index ef910694bd63..2f047577b1e3 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -667,7 +667,7 @@ int ttm_get_pages(struct list_head *pages, int flags,
667{ 667{
668 struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); 668 struct ttm_page_pool *pool = ttm_get_pool(flags, cstate);
669 struct page *p = NULL; 669 struct page *p = NULL;
670 int gfp_flags = 0; 670 int gfp_flags = GFP_USER;
671 int r; 671 int r;
672 672
673 /* set zero flag for page allocation if required */ 673 /* set zero flag for page allocation if required */
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index de033b7ac21f..d827ce570a8c 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -777,7 +777,7 @@ static int __devinit ds1307_probe(struct i2c_client *client,
777 777
778read_rtc: 778read_rtc:
779 /* read RTC registers */ 779 /* read RTC registers */
780 tmp = ds1307->read_block_data(ds1307->client, 0, 8, buf); 780 tmp = ds1307->read_block_data(ds1307->client, ds1307->offset, 8, buf);
781 if (tmp != 8) { 781 if (tmp != 8) {
782 pr_debug("read error %d\n", tmp); 782 pr_debug("read error %d\n", tmp);
783 err = -EIO; 783 err = -EIO;
@@ -862,7 +862,7 @@ read_rtc:
862 if (ds1307->regs[DS1307_REG_HOUR] & DS1307_BIT_PM) 862 if (ds1307->regs[DS1307_REG_HOUR] & DS1307_BIT_PM)
863 tmp += 12; 863 tmp += 12;
864 i2c_smbus_write_byte_data(client, 864 i2c_smbus_write_byte_data(client,
865 DS1307_REG_HOUR, 865 ds1307->offset + DS1307_REG_HOUR,
866 bin2bcd(tmp)); 866 bin2bcd(tmp));
867 } 867 }
868 868
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 9eb62a256e9a..cd6cf575902e 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -930,6 +930,83 @@ static void cpm_uart_config_port(struct uart_port *port, int flags)
930 } 930 }
931} 931}
932 932
933#if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_CPM_CONSOLE)
934/*
935 * Write a string to the serial port
936 * Note that this is called with interrupts already disabled
937 */
938static void cpm_uart_early_write(struct uart_cpm_port *pinfo,
939 const char *string, u_int count)
940{
941 unsigned int i;
942 cbd_t __iomem *bdp, *bdbase;
943 unsigned char *cpm_outp_addr;
944
945 /* Get the address of the host memory buffer.
946 */
947 bdp = pinfo->tx_cur;
948 bdbase = pinfo->tx_bd_base;
949
950 /*
951 * Now, do each character. This is not as bad as it looks
952 * since this is a holding FIFO and not a transmitting FIFO.
953 * We could add the complexity of filling the entire transmit
954 * buffer, but we would just wait longer between accesses......
955 */
956 for (i = 0; i < count; i++, string++) {
957 /* Wait for transmitter fifo to empty.
958 * Ready indicates output is ready, and xmt is doing
959 * that, not that it is ready for us to send.
960 */
961 while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
962 ;
963
964 /* Send the character out.
965 * If the buffer address is in the CPM DPRAM, don't
966 * convert it.
967 */
968 cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr),
969 pinfo);
970 *cpm_outp_addr = *string;
971
972 out_be16(&bdp->cbd_datlen, 1);
973 setbits16(&bdp->cbd_sc, BD_SC_READY);
974
975 if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
976 bdp = bdbase;
977 else
978 bdp++;
979
980 /* if a LF, also do CR... */
981 if (*string == 10) {
982 while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
983 ;
984
985 cpm_outp_addr = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr),
986 pinfo);
987 *cpm_outp_addr = 13;
988
989 out_be16(&bdp->cbd_datlen, 1);
990 setbits16(&bdp->cbd_sc, BD_SC_READY);
991
992 if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
993 bdp = bdbase;
994 else
995 bdp++;
996 }
997 }
998
999 /*
1000 * Finally, Wait for transmitter & holding register to empty
1001 * and restore the IER
1002 */
1003 while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
1004 ;
1005
1006 pinfo->tx_cur = bdp;
1007}
1008#endif
1009
933#ifdef CONFIG_CONSOLE_POLL 1010#ifdef CONFIG_CONSOLE_POLL
934/* Serial polling routines for writing and reading from the uart while 1011/* Serial polling routines for writing and reading from the uart while
935 * in an interrupt or debug context. 1012 * in an interrupt or debug context.
@@ -999,7 +1076,7 @@ static void cpm_put_poll_char(struct uart_port *port,
999 static char ch[2]; 1076 static char ch[2];
1000 1077
1001 ch[0] = (char)c; 1078 ch[0] = (char)c;
1002 cpm_uart_early_write(pinfo->port.line, ch, 1); 1079 cpm_uart_early_write(pinfo, ch, 1);
1003} 1080}
1004#endif /* CONFIG_CONSOLE_POLL */ 1081#endif /* CONFIG_CONSOLE_POLL */
1005 1082
@@ -1130,9 +1207,6 @@ static void cpm_uart_console_write(struct console *co, const char *s,
1130 u_int count) 1207 u_int count)
1131{ 1208{
1132 struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index]; 1209 struct uart_cpm_port *pinfo = &cpm_uart_ports[co->index];
1133 unsigned int i;
1134 cbd_t __iomem *bdp, *bdbase;
1135 unsigned char *cp;
1136 unsigned long flags; 1210 unsigned long flags;
1137 int nolock = oops_in_progress; 1211 int nolock = oops_in_progress;
1138 1212
@@ -1142,66 +1216,7 @@ static void cpm_uart_console_write(struct console *co, const char *s,
1142 spin_lock_irqsave(&pinfo->port.lock, flags); 1216 spin_lock_irqsave(&pinfo->port.lock, flags);
1143 } 1217 }
1144 1218
1145 /* Get the address of the host memory buffer. 1219 cpm_uart_early_write(pinfo, s, count);
1146 */
1147 bdp = pinfo->tx_cur;
1148 bdbase = pinfo->tx_bd_base;
1149
1150 /*
1151 * Now, do each character. This is not as bad as it looks
1152 * since this is a holding FIFO and not a transmitting FIFO.
1153 * We could add the complexity of filling the entire transmit
1154 * buffer, but we would just wait longer between accesses......
1155 */
1156 for (i = 0; i < count; i++, s++) {
1157 /* Wait for transmitter fifo to empty.
1158 * Ready indicates output is ready, and xmt is doing
1159 * that, not that it is ready for us to send.
1160 */
1161 while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
1162 ;
1163
1164 /* Send the character out.
1165 * If the buffer address is in the CPM DPRAM, don't
1166 * convert it.
1167 */
1168 cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
1169 *cp = *s;
1170
1171 out_be16(&bdp->cbd_datlen, 1);
1172 setbits16(&bdp->cbd_sc, BD_SC_READY);
1173
1174 if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
1175 bdp = bdbase;
1176 else
1177 bdp++;
1178
1179 /* if a LF, also do CR... */
1180 if (*s == 10) {
1181 while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
1182 ;
1183
1184 cp = cpm2cpu_addr(in_be32(&bdp->cbd_bufaddr), pinfo);
1185 *cp = 13;
1186
1187 out_be16(&bdp->cbd_datlen, 1);
1188 setbits16(&bdp->cbd_sc, BD_SC_READY);
1189
1190 if (in_be16(&bdp->cbd_sc) & BD_SC_WRAP)
1191 bdp = bdbase;
1192 else
1193 bdp++;
1194 }
1195 }
1196
1197 /*
1198 * Finally, Wait for transmitter & holding register to empty
1199 * and restore the IER
1200 */
1201 while ((in_be16(&bdp->cbd_sc) & BD_SC_READY) != 0)
1202 ;
1203
1204 pinfo->tx_cur = bdp;
1205 1220
1206 if (unlikely(nolock)) { 1221 if (unlikely(nolock)) {
1207 local_irq_restore(flags); 1222 local_irq_restore(flags);
diff --git a/drivers/staging/batman-adv/bat_sysfs.c b/drivers/staging/batman-adv/bat_sysfs.c
index e2c000b80ca0..212bc21e6d68 100644
--- a/drivers/staging/batman-adv/bat_sysfs.c
+++ b/drivers/staging/batman-adv/bat_sysfs.c
@@ -225,9 +225,9 @@ static struct bat_attribute *mesh_attrs[] = {
225 NULL, 225 NULL,
226}; 226};
227 227
228static ssize_t transtable_local_read(struct kobject *kobj, 228static ssize_t transtable_local_read(struct file *filp, struct kobject *kobj,
229 struct bin_attribute *bin_attr, 229 struct bin_attribute *bin_attr,
230 char *buff, loff_t off, size_t count) 230 char *buff, loff_t off, size_t count)
231{ 231{
232 struct device *dev = to_dev(kobj->parent); 232 struct device *dev = to_dev(kobj->parent);
233 struct net_device *net_dev = to_net_dev(dev); 233 struct net_device *net_dev = to_net_dev(dev);
@@ -235,9 +235,9 @@ static ssize_t transtable_local_read(struct kobject *kobj,
235 return hna_local_fill_buffer_text(net_dev, buff, count, off); 235 return hna_local_fill_buffer_text(net_dev, buff, count, off);
236} 236}
237 237
238static ssize_t transtable_global_read(struct kobject *kobj, 238static ssize_t transtable_global_read(struct file *filp, struct kobject *kobj,
239 struct bin_attribute *bin_attr, 239 struct bin_attribute *bin_attr,
240 char *buff, loff_t off, size_t count) 240 char *buff, loff_t off, size_t count)
241{ 241{
242 struct device *dev = to_dev(kobj->parent); 242 struct device *dev = to_dev(kobj->parent);
243 struct net_device *net_dev = to_net_dev(dev); 243 struct net_device *net_dev = to_net_dev(dev);
@@ -245,9 +245,9 @@ static ssize_t transtable_global_read(struct kobject *kobj,
245 return hna_global_fill_buffer_text(net_dev, buff, count, off); 245 return hna_global_fill_buffer_text(net_dev, buff, count, off);
246} 246}
247 247
248static ssize_t originators_read(struct kobject *kobj, 248static ssize_t originators_read(struct file *filp, struct kobject *kobj,
249 struct bin_attribute *bin_attr, 249 struct bin_attribute *bin_attr,
250 char *buff, loff_t off, size_t count) 250 char *buff, loff_t off, size_t count)
251{ 251{
252 struct device *dev = to_dev(kobj->parent); 252 struct device *dev = to_dev(kobj->parent);
253 struct net_device *net_dev = to_net_dev(dev); 253 struct net_device *net_dev = to_net_dev(dev);
@@ -255,9 +255,9 @@ static ssize_t originators_read(struct kobject *kobj,
255 return orig_fill_buffer_text(net_dev, buff, count, off); 255 return orig_fill_buffer_text(net_dev, buff, count, off);
256} 256}
257 257
258static ssize_t vis_data_read(struct kobject *kobj, 258static ssize_t vis_data_read(struct file *filp, struct kobject *kobj,
259 struct bin_attribute *bin_attr, 259 struct bin_attribute *bin_attr,
260 char *buff, loff_t off, size_t count) 260 char *buff, loff_t off, size_t count)
261{ 261{
262 struct device *dev = to_dev(kobj->parent); 262 struct device *dev = to_dev(kobj->parent);
263 struct net_device *net_dev = to_net_dev(dev); 263 struct net_device *net_dev = to_net_dev(dev);
diff --git a/drivers/staging/batman-adv/device.c b/drivers/staging/batman-adv/device.c
index 7eb6559e0315..32204b5572d0 100644
--- a/drivers/staging/batman-adv/device.c
+++ b/drivers/staging/batman-adv/device.c
@@ -196,7 +196,7 @@ ssize_t bat_device_read(struct file *file, char __user *buf, size_t count,
196 kfree(device_packet); 196 kfree(device_packet);
197 197
198 if (error) 198 if (error)
199 return error; 199 return -EFAULT;
200 200
201 return sizeof(struct icmp_packet); 201 return sizeof(struct icmp_packet);
202} 202}
diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index 36a254cd4413..39d112b708e3 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -824,9 +824,12 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
824 plx9050_interrupt_control(dev_private->lcr_io_base, true, true, 824 plx9050_interrupt_control(dev_private->lcr_io_base, true, true,
825 false, true, true); 825 false, true, true);
826 826
827 dev_private->scan_delay = 827 if (async_cmd->scan_begin_src == TRIG_TIMER) {
828 (async_cmd->scan_begin_arg / (async_cmd->convert_arg * 828 dev_private->scan_delay =
829 async_cmd->chanlist_len)) - 1; 829 (async_cmd->scan_begin_arg /
830 (async_cmd->convert_arg *
831 async_cmd->chanlist_len)) - 1;
832 }
830 833
831 break; 834 break;
832 835
diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c
index 81829d6fd287..c374bee25068 100644
--- a/drivers/staging/comedi/drivers/cb_pcidda.c
+++ b/drivers/staging/comedi/drivers/cb_pcidda.c
@@ -52,7 +52,6 @@ Please report success/failure with other different cards to
52#include "8255.h" 52#include "8255.h"
53 53
54#define PCI_VENDOR_ID_CB 0x1307 /* PCI vendor number of ComputerBoards */ 54#define PCI_VENDOR_ID_CB 0x1307 /* PCI vendor number of ComputerBoards */
55#define N_BOARDS 10 /* Number of boards in cb_pcidda_boards */
56#define EEPROM_SIZE 128 /* number of entries in eeprom */ 55#define EEPROM_SIZE 128 /* number of entries in eeprom */
57#define MAX_AO_CHANNELS 8 /* maximum number of ao channels for supported boards */ 56#define MAX_AO_CHANNELS 8 /* maximum number of ao channels for supported boards */
58 57
@@ -307,7 +306,7 @@ static int cb_pcidda_attach(struct comedi_device *dev,
307 continue; 306 continue;
308 } 307 }
309 } 308 }
310 for (index = 0; index < N_BOARDS; index++) { 309 for (index = 0; index < ARRAY_SIZE(cb_pcidda_boards); index++) {
311 if (cb_pcidda_boards[index].device_id == 310 if (cb_pcidda_boards[index].device_id ==
312 pcidev->device) { 311 pcidev->device) {
313 goto found; 312 goto found;
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 3f53b4d1e4cf..12db555a3a5d 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -23,6 +23,7 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/completion.h>
26#include "osd.h" 27#include "osd.h"
27#include "logging.h" 28#include "logging.h"
28#include "vmbus_private.h" 29#include "vmbus_private.h"
@@ -293,6 +294,25 @@ void FreeVmbusChannel(struct vmbus_channel *Channel)
293 Channel); 294 Channel);
294} 295}
295 296
297
298DECLARE_COMPLETION(hv_channel_ready);
299
300/*
301 * Count initialized channels, and ensure all channels are ready when hv_vmbus
302 * module loading completes.
303 */
304static void count_hv_channel(void)
305{
306 static int counter;
307 unsigned long flags;
308
309 spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
310 if (++counter == MAX_MSG_TYPES)
311 complete(&hv_channel_ready);
312 spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
313}
314
315
296/* 316/*
297 * VmbusChannelProcessOffer - Process the offer by creating a channel/device 317 * VmbusChannelProcessOffer - Process the offer by creating a channel/device
298 * associated with this offer 318 * associated with this offer
@@ -373,22 +393,21 @@ static void VmbusChannelProcessOffer(void *context)
373 * can cleanup properly 393 * can cleanup properly
374 */ 394 */
375 newChannel->State = CHANNEL_OPEN_STATE; 395 newChannel->State = CHANNEL_OPEN_STATE;
376 cnt = 0;
377 396
378 while (cnt != MAX_MSG_TYPES) { 397 /* Open IC channels */
398 for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) {
379 if (memcmp(&newChannel->OfferMsg.Offer.InterfaceType, 399 if (memcmp(&newChannel->OfferMsg.Offer.InterfaceType,
380 &hv_cb_utils[cnt].data, 400 &hv_cb_utils[cnt].data,
381 sizeof(struct hv_guid)) == 0) { 401 sizeof(struct hv_guid)) == 0 &&
402 VmbusChannelOpen(newChannel, 2 * PAGE_SIZE,
403 2 * PAGE_SIZE, NULL, 0,
404 hv_cb_utils[cnt].callback,
405 newChannel) == 0) {
406 hv_cb_utils[cnt].channel = newChannel;
382 DPRINT_INFO(VMBUS, "%s", 407 DPRINT_INFO(VMBUS, "%s",
383 hv_cb_utils[cnt].log_msg); 408 hv_cb_utils[cnt].log_msg);
384 409 count_hv_channel();
385 if (VmbusChannelOpen(newChannel, 2 * PAGE_SIZE,
386 2 * PAGE_SIZE, NULL, 0,
387 hv_cb_utils[cnt].callback,
388 newChannel) == 0)
389 hv_cb_utils[cnt].channel = newChannel;
390 } 410 }
391 cnt++;
392 } 411 }
393 } 412 }
394 DPRINT_EXIT(VMBUS); 413 DPRINT_EXIT(VMBUS);
diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c
index 8a49aafea37a..2adc9b48ca9c 100644
--- a/drivers/staging/hv/hv_utils.c
+++ b/drivers/staging/hv/hv_utils.c
@@ -24,6 +24,8 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/sysctl.h> 25#include <linux/sysctl.h>
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/dmi.h>
28#include <linux/pci.h>
27 29
28#include "logging.h" 30#include "logging.h"
29#include "osd.h" 31#include "osd.h"
@@ -251,10 +253,36 @@ static void heartbeat_onchannelcallback(void *context)
251 DPRINT_EXIT(VMBUS); 253 DPRINT_EXIT(VMBUS);
252} 254}
253 255
256static const struct pci_device_id __initconst
257hv_utils_pci_table[] __maybe_unused = {
258 { PCI_DEVICE(0x1414, 0x5353) }, /* Hyper-V emulated VGA controller */
259 { 0 }
260};
261MODULE_DEVICE_TABLE(pci, hv_utils_pci_table);
262
263
264static const struct dmi_system_id __initconst
265hv_utils_dmi_table[] __maybe_unused = {
266 {
267 .ident = "Hyper-V",
268 .matches = {
269 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
270 DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
271 DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
272 },
273 },
274 { },
275};
276MODULE_DEVICE_TABLE(dmi, hv_utils_dmi_table);
277
278
254static int __init init_hyperv_utils(void) 279static int __init init_hyperv_utils(void)
255{ 280{
256 printk(KERN_INFO "Registering HyperV Utility Driver\n"); 281 printk(KERN_INFO "Registering HyperV Utility Driver\n");
257 282
283 if (!dmi_check_system(hv_utils_dmi_table))
284 return -ENODEV;
285
258 hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback = 286 hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback =
259 &shutdown_onchannelcallback; 287 &shutdown_onchannelcallback;
260 hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; 288 hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback;
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h
index 0c6ee0f487f3..3c14b2926e00 100644
--- a/drivers/staging/hv/vmbus.h
+++ b/drivers/staging/hv/vmbus.h
@@ -74,4 +74,6 @@ int vmbus_child_driver_register(struct driver_context *driver_ctx);
74void vmbus_child_driver_unregister(struct driver_context *driver_ctx); 74void vmbus_child_driver_unregister(struct driver_context *driver_ctx);
75void vmbus_get_interface(struct vmbus_channel_interface *interface); 75void vmbus_get_interface(struct vmbus_channel_interface *interface);
76 76
77extern struct completion hv_channel_ready;
78
77#endif /* _VMBUS_H_ */ 79#endif /* _VMBUS_H_ */
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index c21731a12ca7..22c80ece6388 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -27,6 +27,7 @@
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/dmi.h> 28#include <linux/dmi.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/completion.h>
30#include "version_info.h" 31#include "version_info.h"
31#include "osd.h" 32#include "osd.h"
32#include "logging.h" 33#include "logging.h"
@@ -356,6 +357,8 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
356 357
357 vmbus_drv_obj->GetChannelOffers(); 358 vmbus_drv_obj->GetChannelOffers();
358 359
360 wait_for_completion(&hv_channel_ready);
361
359cleanup: 362cleanup:
360 DPRINT_EXIT(VMBUS_DRV); 363 DPRINT_EXIT(VMBUS_DRV);
361 364
diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
index 1db00975a594..abba22f921be 100644
--- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c
+++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
@@ -817,9 +817,9 @@ static int mrstouch_remove(struct spi_device *spi)
817 free_irq(mrstouchdevp->irq, mrstouchdevp); 817 free_irq(mrstouchdevp->irq, mrstouchdevp);
818 input_unregister_device(mrstouchdevp->input); 818 input_unregister_device(mrstouchdevp->input);
819 input_free_device(mrstouchdevp->input); 819 input_free_device(mrstouchdevp->input);
820 kfree(mrstouchdevp);
821 if (mrstouchdevp->pendet_thrd) 820 if (mrstouchdevp->pendet_thrd)
822 kthread_stop(mrstouchdevp->pendet_thrd); 821 kthread_stop(mrstouchdevp->pendet_thrd);
822 kfree(mrstouchdevp);
823 return 0; 823 return 0;
824} 824}
825 825
diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c
index b740662d095a..674769d2b59b 100644
--- a/drivers/staging/rt2860/usb_main_dev.c
+++ b/drivers/staging/rt2860/usb_main_dev.c
@@ -77,6 +77,7 @@ struct usb_device_id rtusb_usb_id[] = {
77 {USB_DEVICE(0x083A, 0x7522)}, /* Arcadyan */ 77 {USB_DEVICE(0x083A, 0x7522)}, /* Arcadyan */
78 {USB_DEVICE(0x0CDE, 0x0022)}, /* ZCOM */ 78 {USB_DEVICE(0x0CDE, 0x0022)}, /* ZCOM */
79 {USB_DEVICE(0x0586, 0x3416)}, /* Zyxel */ 79 {USB_DEVICE(0x0586, 0x3416)}, /* Zyxel */
80 {USB_DEVICE(0x0586, 0x341a)}, /* Zyxel NWD-270N */
80 {USB_DEVICE(0x0CDE, 0x0025)}, /* Zyxel */ 81 {USB_DEVICE(0x0CDE, 0x0025)}, /* Zyxel */
81 {USB_DEVICE(0x1740, 0x9701)}, /* EnGenius */ 82 {USB_DEVICE(0x1740, 0x9701)}, /* EnGenius */
82 {USB_DEVICE(0x1740, 0x9702)}, /* EnGenius */ 83 {USB_DEVICE(0x1740, 0x9702)}, /* EnGenius */
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index dacefea78113..49ab9fa9ffa7 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -66,8 +66,6 @@ static int hwseqnum = 0;
66static int hwwep = 0; 66static int hwwep = 0;
67static int channels = 0x3fff; 67static int channels = 0x3fff;
68 68
69#define eqMacAddr(a, b) (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0)
70#define cpMacAddr(des, src) ((des)[0] = (src)[0], (des)[1] = (src)[1], (des)[2] = (src)[2], (des)[3] = (src)[3], (des)[4] = (src)[4], (des)[5] = (src)[5])
71MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
72MODULE_DEVICE_TABLE(pci, rtl8180_pci_id_tbl); 70MODULE_DEVICE_TABLE(pci, rtl8180_pci_id_tbl);
73MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>"); 71MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c
index 447d6474a70c..1b6890611fb6 100644
--- a/drivers/staging/rtl8192su/r8192U_core.c
+++ b/drivers/staging/rtl8192su/r8192U_core.c
@@ -112,28 +112,29 @@ u32 rt_global_debug_component = \
112#define CAM_CONTENT_COUNT 8 112#define CAM_CONTENT_COUNT 8
113 113
114static const struct usb_device_id rtl8192_usb_id_tbl[] = { 114static const struct usb_device_id rtl8192_usb_id_tbl[] = {
115 /* Realtek */ 115 {USB_DEVICE(0x0bda, 0x8171)}, /* Realtek */
116 {USB_DEVICE(0x0bda, 0x8171)},
117 {USB_DEVICE(0x0bda, 0x8192)},
118 {USB_DEVICE(0x0bda, 0x8709)},
119 /* Corega */
120 {USB_DEVICE(0x07aa, 0x0043)},
121 /* Belkin */
122 {USB_DEVICE(0x050d, 0x805E)},
123 {USB_DEVICE(0x050d, 0x815F)}, /* Belkin F5D8053 v6 */
124 /* Sitecom */
125 {USB_DEVICE(0x0df6, 0x0031)},
126 {USB_DEVICE(0x0df6, 0x004b)}, /* WL-349 */
127 /* EnGenius */
128 {USB_DEVICE(0x1740, 0x9201)},
129 /* Dlink */
130 {USB_DEVICE(0x2001, 0x3301)},
131 /* Zinwell */
132 {USB_DEVICE(0x5a57, 0x0290)},
133 /* Guillemot */
134 {USB_DEVICE(0x06f8, 0xe031)},
135 //92SU
136 {USB_DEVICE(0x0bda, 0x8172)}, 116 {USB_DEVICE(0x0bda, 0x8172)},
117 {USB_DEVICE(0x0bda, 0x8173)},
118 {USB_DEVICE(0x0bda, 0x8174)},
119 {USB_DEVICE(0x0bda, 0x8712)},
120 {USB_DEVICE(0x0bda, 0x8713)},
121 {USB_DEVICE(0x07aa, 0x0047)},
122 {USB_DEVICE(0x07d1, 0x3303)},
123 {USB_DEVICE(0x07d1, 0x3302)},
124 {USB_DEVICE(0x07d1, 0x3300)},
125 {USB_DEVICE(0x1740, 0x9603)},
126 {USB_DEVICE(0x1740, 0x9605)},
127 {USB_DEVICE(0x050d, 0x815F)},
128 {USB_DEVICE(0x06f8, 0xe031)},
129 {USB_DEVICE(0x7392, 0x7611)},
130 {USB_DEVICE(0x7392, 0x7612)},
131 {USB_DEVICE(0x7392, 0x7622)},
132 {USB_DEVICE(0x0DF6, 0x0045)},
133 {USB_DEVICE(0x0E66, 0x0015)},
134 {USB_DEVICE(0x0E66, 0x0016)},
135 {USB_DEVICE(0x0b05, 0x1786)},
136 /* these are not in the official list */
137 {USB_DEVICE(0x0df6, 0x004b)}, /* WL-349 */
137 {} 138 {}
138}; 139};
139 140
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 2bede271a2f0..f38472c2e75c 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -121,6 +121,8 @@ static const struct usb_device_id rtl8192_usb_id_tbl[] = {
121 {USB_DEVICE(0x2001, 0x3301)}, 121 {USB_DEVICE(0x2001, 0x3301)},
122 /* Zinwell */ 122 /* Zinwell */
123 {USB_DEVICE(0x5a57, 0x0290)}, 123 {USB_DEVICE(0x5a57, 0x0290)},
124 /* LG */
125 {USB_DEVICE(0x043e, 0x7a01)},
124 {} 126 {}
125}; 127};
126 128
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 52408164036f..6a499f0eb594 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -378,47 +378,67 @@ int usbip_thread(void *param)
378 complete_and_exit(&ut->thread_done, 0); 378 complete_and_exit(&ut->thread_done, 0);
379} 379}
380 380
381static void stop_rx_thread(struct usbip_device *ud)
382{
383 if (ud->tcp_rx.thread != NULL) {
384 send_sig(SIGKILL, ud->tcp_rx.thread, 1);
385 wait_for_completion(&ud->tcp_rx.thread_done);
386 usbip_udbg("rx_thread for ud %p has finished\n", ud);
387 }
388}
389
390static void stop_tx_thread(struct usbip_device *ud)
391{
392 if (ud->tcp_tx.thread != NULL) {
393 send_sig(SIGKILL, ud->tcp_tx.thread, 1);
394 wait_for_completion(&ud->tcp_tx.thread_done);
395 usbip_udbg("tx_thread for ud %p has finished\n", ud);
396 }
397}
398
381int usbip_start_threads(struct usbip_device *ud) 399int usbip_start_threads(struct usbip_device *ud)
382{ 400{
383 /* 401 /*
384 * threads are invoked per one device (per one connection). 402 * threads are invoked per one device (per one connection).
385 */ 403 */
386 struct task_struct *th; 404 struct task_struct *th;
405 int err = 0;
387 406
388 th = kthread_run(usbip_thread, (void *)&ud->tcp_rx, "usbip"); 407 th = kthread_run(usbip_thread, (void *)&ud->tcp_rx, "usbip");
389 if (IS_ERR(th)) { 408 if (IS_ERR(th)) {
390 printk(KERN_WARNING 409 printk(KERN_WARNING
391 "Unable to start control thread\n"); 410 "Unable to start control thread\n");
392 return PTR_ERR(th); 411 err = PTR_ERR(th);
412 goto ust_exit;
393 } 413 }
414
394 th = kthread_run(usbip_thread, (void *)&ud->tcp_tx, "usbip"); 415 th = kthread_run(usbip_thread, (void *)&ud->tcp_tx, "usbip");
395 if (IS_ERR(th)) { 416 if (IS_ERR(th)) {
396 printk(KERN_WARNING 417 printk(KERN_WARNING
397 "Unable to start control thread\n"); 418 "Unable to start control thread\n");
398 return PTR_ERR(th); 419 err = PTR_ERR(th);
420 goto tx_thread_err;
399 } 421 }
400 422
401 /* confirm threads are starting */ 423 /* confirm threads are starting */
402 wait_for_completion(&ud->tcp_rx.thread_done); 424 wait_for_completion(&ud->tcp_rx.thread_done);
403 wait_for_completion(&ud->tcp_tx.thread_done); 425 wait_for_completion(&ud->tcp_tx.thread_done);
426
404 return 0; 427 return 0;
428
429tx_thread_err:
430 stop_rx_thread(ud);
431
432ust_exit:
433 return err;
405} 434}
406EXPORT_SYMBOL_GPL(usbip_start_threads); 435EXPORT_SYMBOL_GPL(usbip_start_threads);
407 436
408void usbip_stop_threads(struct usbip_device *ud) 437void usbip_stop_threads(struct usbip_device *ud)
409{ 438{
410 /* kill threads related to this sdev, if v.c. exists */ 439 /* kill threads related to this sdev, if v.c. exists */
411 if (ud->tcp_rx.thread != NULL) { 440 stop_rx_thread(ud);
412 send_sig(SIGKILL, ud->tcp_rx.thread, 1); 441 stop_tx_thread(ud);
413 wait_for_completion(&ud->tcp_rx.thread_done);
414 usbip_udbg("rx_thread for ud %p has finished\n", ud);
415 }
416
417 if (ud->tcp_tx.thread != NULL) {
418 send_sig(SIGKILL, ud->tcp_tx.thread, 1);
419 wait_for_completion(&ud->tcp_tx.thread_done);
420 usbip_udbg("tx_thread for ud %p has finished\n", ud);
421 }
422} 442}
423EXPORT_SYMBOL_GPL(usbip_stop_threads); 443EXPORT_SYMBOL_GPL(usbip_stop_threads);
424 444
diff --git a/drivers/staging/wlags49_h2/wl_enc.c b/drivers/staging/wlags49_h2/wl_enc.c
index 48c44c8fdb28..26cf5486edd6 100644
--- a/drivers/staging/wlags49_h2/wl_enc.c
+++ b/drivers/staging/wlags49_h2/wl_enc.c
@@ -62,6 +62,7 @@
62/******************************************************************************* 62/*******************************************************************************
63 * include files 63 * include files
64 ******************************************************************************/ 64 ******************************************************************************/
65#include <linux/string.h>
65#include <wl_version.h> 66#include <wl_version.h>
66 67
67#include <debug.h> 68#include <debug.h>
diff --git a/drivers/staging/wlags49_h2/wl_sysfs.h b/drivers/staging/wlags49_h2/wl_sysfs.h
index 6d96d03cf490..fa658c38001e 100644
--- a/drivers/staging/wlags49_h2/wl_sysfs.h
+++ b/drivers/staging/wlags49_h2/wl_sysfs.h
@@ -2,6 +2,6 @@
2extern void register_wlags_sysfs(struct net_device *); 2extern void register_wlags_sysfs(struct net_device *);
3extern void unregister_wlags_sysfs(struct net_device *); 3extern void unregister_wlags_sysfs(struct net_device *);
4#else 4#else
5static void register_wlags_sysfs(struct net_device *) { return; }; 5static inline void register_wlags_sysfs(struct net_device *net) { }
6static void unregister_wlags_sysfs(struct net_device *) { return; }; 6static inline void unregister_wlags_sysfs(struct net_device *net) { }
7#endif 7#endif
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index de98a94d1853..a6bd53ace035 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1272,8 +1272,7 @@ static int usb_resume_both(struct usb_device *udev, pm_message_t msg)
1272 1272
1273static void choose_wakeup(struct usb_device *udev, pm_message_t msg) 1273static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
1274{ 1274{
1275 int w, i; 1275 int w;
1276 struct usb_interface *intf;
1277 1276
1278 /* Remote wakeup is needed only when we actually go to sleep. 1277 /* Remote wakeup is needed only when we actually go to sleep.
1279 * For things like FREEZE and QUIESCE, if the device is already 1278 * For things like FREEZE and QUIESCE, if the device is already
@@ -1285,16 +1284,10 @@ static void choose_wakeup(struct usb_device *udev, pm_message_t msg)
1285 return; 1284 return;
1286 } 1285 }
1287 1286
1288 /* If remote wakeup is permitted, see whether any interface drivers 1287 /* Enable remote wakeup if it is allowed, even if no interface drivers
1289 * actually want it. 1288 * actually want it.
1290 */ 1289 */
1291 w = 0; 1290 w = device_may_wakeup(&udev->dev);
1292 if (device_may_wakeup(&udev->dev) && udev->actconfig) {
1293 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) {
1294 intf = udev->actconfig->interface[i];
1295 w |= intf->needs_remote_wakeup;
1296 }
1297 }
1298 1291
1299 /* If the device is autosuspended with the wrong wakeup setting, 1292 /* If the device is autosuspended with the wrong wakeup setting,
1300 * autoresume now so the setting can be changed. 1293 * autoresume now so the setting can be changed.
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index a73e08fdab36..fd4c36ea5e46 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -416,8 +416,11 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev,
416 /* A length of zero means transfer the whole sg list */ 416 /* A length of zero means transfer the whole sg list */
417 len = length; 417 len = length;
418 if (len == 0) { 418 if (len == 0) {
419 for_each_sg(sg, sg, nents, i) 419 struct scatterlist *sg2;
420 len += sg->length; 420 int j;
421
422 for_each_sg(sg, sg2, nents, j)
423 len += sg2->length;
421 } 424 }
422 } else { 425 } else {
423 /* 426 /*
diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c
index 38226e9a371d..95dd4662d6a8 100644
--- a/drivers/usb/gadget/f_eem.c
+++ b/drivers/usb/gadget/f_eem.c
@@ -469,8 +469,7 @@ static int eem_unwrap(struct gether *port,
469 crc = get_unaligned_le32(skb->data + len 469 crc = get_unaligned_le32(skb->data + len
470 - ETH_FCS_LEN); 470 - ETH_FCS_LEN);
471 crc2 = ~crc32_le(~0, 471 crc2 = ~crc32_le(~0,
472 skb->data, 472 skb->data, len - ETH_FCS_LEN);
473 skb->len - ETH_FCS_LEN);
474 } else { 473 } else {
475 crc = get_unaligned_be32(skb->data + len 474 crc = get_unaligned_be32(skb->data + len
476 - ETH_FCS_LEN); 475 - ETH_FCS_LEN);
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 7d05a0be5c60..4ce899c9b165 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -321,8 +321,8 @@ struct fsg_dev;
321/* Data shared by all the FSG instances. */ 321/* Data shared by all the FSG instances. */
322struct fsg_common { 322struct fsg_common {
323 struct usb_gadget *gadget; 323 struct usb_gadget *gadget;
324 struct fsg_dev *fsg; 324 struct fsg_dev *fsg, *new_fsg;
325 struct fsg_dev *prev_fsg; 325 wait_queue_head_t fsg_wait;
326 326
327 /* filesem protects: backing files in use */ 327 /* filesem protects: backing files in use */
328 struct rw_semaphore filesem; 328 struct rw_semaphore filesem;
@@ -351,7 +351,6 @@ struct fsg_common {
351 enum fsg_state state; /* For exception handling */ 351 enum fsg_state state; /* For exception handling */
352 unsigned int exception_req_tag; 352 unsigned int exception_req_tag;
353 353
354 u8 config, new_config;
355 enum data_direction data_dir; 354 enum data_direction data_dir;
356 u32 data_size; 355 u32 data_size;
357 u32 data_size_from_cmnd; 356 u32 data_size_from_cmnd;
@@ -595,7 +594,7 @@ static int fsg_setup(struct usb_function *f,
595 u16 w_value = le16_to_cpu(ctrl->wValue); 594 u16 w_value = le16_to_cpu(ctrl->wValue);
596 u16 w_length = le16_to_cpu(ctrl->wLength); 595 u16 w_length = le16_to_cpu(ctrl->wLength);
597 596
598 if (!fsg->common->config) 597 if (!fsg_is_set(fsg->common))
599 return -EOPNOTSUPP; 598 return -EOPNOTSUPP;
600 599
601 switch (ctrl->bRequest) { 600 switch (ctrl->bRequest) {
@@ -2303,24 +2302,20 @@ static int alloc_request(struct fsg_common *common, struct usb_ep *ep,
2303 return -ENOMEM; 2302 return -ENOMEM;
2304} 2303}
2305 2304
2306/* 2305/* Reset interface setting and re-init endpoint state (toggle etc). */
2307 * Reset interface setting and re-init endpoint state (toggle etc). 2306static int do_set_interface(struct fsg_common *common, struct fsg_dev *new_fsg)
2308 * Call with altsetting < 0 to disable the interface. The only other
2309 * available altsetting is 0, which enables the interface.
2310 */
2311static int do_set_interface(struct fsg_common *common, int altsetting)
2312{ 2307{
2313 int rc = 0; 2308 const struct usb_endpoint_descriptor *d;
2314 int i; 2309 struct fsg_dev *fsg;
2315 const struct usb_endpoint_descriptor *d; 2310 int i, rc = 0;
2316 2311
2317 if (common->running) 2312 if (common->running)
2318 DBG(common, "reset interface\n"); 2313 DBG(common, "reset interface\n");
2319 2314
2320reset: 2315reset:
2321 /* Deallocate the requests */ 2316 /* Deallocate the requests */
2322 if (common->prev_fsg) { 2317 if (common->fsg) {
2323 struct fsg_dev *fsg = common->prev_fsg; 2318 fsg = common->fsg;
2324 2319
2325 for (i = 0; i < FSG_NUM_BUFFERS; ++i) { 2320 for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
2326 struct fsg_buffhd *bh = &common->buffhds[i]; 2321 struct fsg_buffhd *bh = &common->buffhds[i];
@@ -2345,88 +2340,53 @@ reset:
2345 fsg->bulk_out_enabled = 0; 2340 fsg->bulk_out_enabled = 0;
2346 } 2341 }
2347 2342
2348 common->prev_fsg = 0; 2343 common->fsg = NULL;
2344 wake_up(&common->fsg_wait);
2349 } 2345 }
2350 2346
2351 common->running = 0; 2347 common->running = 0;
2352 if (altsetting < 0 || rc != 0) 2348 if (!new_fsg || rc)
2353 return rc; 2349 return rc;
2354 2350
2355 DBG(common, "set interface %d\n", altsetting); 2351 common->fsg = new_fsg;
2352 fsg = common->fsg;
2356 2353
2357 if (fsg_is_set(common)) { 2354 /* Enable the endpoints */
2358 struct fsg_dev *fsg = common->fsg; 2355 d = fsg_ep_desc(common->gadget,
2359 common->prev_fsg = common->fsg; 2356 &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc);
2357 rc = enable_endpoint(common, fsg->bulk_in, d);
2358 if (rc)
2359 goto reset;
2360 fsg->bulk_in_enabled = 1;
2361
2362 d = fsg_ep_desc(common->gadget,
2363 &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc);
2364 rc = enable_endpoint(common, fsg->bulk_out, d);
2365 if (rc)
2366 goto reset;
2367 fsg->bulk_out_enabled = 1;
2368 common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize);
2369 clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags);
2360 2370
2361 /* Enable the endpoints */ 2371 /* Allocate the requests */
2362 d = fsg_ep_desc(common->gadget, 2372 for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
2363 &fsg_fs_bulk_in_desc, &fsg_hs_bulk_in_desc); 2373 struct fsg_buffhd *bh = &common->buffhds[i];
2364 rc = enable_endpoint(common, fsg->bulk_in, d); 2374
2375 rc = alloc_request(common, fsg->bulk_in, &bh->inreq);
2365 if (rc) 2376 if (rc)
2366 goto reset; 2377 goto reset;
2367 fsg->bulk_in_enabled = 1; 2378 rc = alloc_request(common, fsg->bulk_out, &bh->outreq);
2368
2369 d = fsg_ep_desc(common->gadget,
2370 &fsg_fs_bulk_out_desc, &fsg_hs_bulk_out_desc);
2371 rc = enable_endpoint(common, fsg->bulk_out, d);
2372 if (rc) 2379 if (rc)
2373 goto reset; 2380 goto reset;
2374 fsg->bulk_out_enabled = 1; 2381 bh->inreq->buf = bh->outreq->buf = bh->buf;
2375 common->bulk_out_maxpacket = le16_to_cpu(d->wMaxPacketSize); 2382 bh->inreq->context = bh->outreq->context = bh;
2376 clear_bit(IGNORE_BULK_OUT, &fsg->atomic_bitflags); 2383 bh->inreq->complete = bulk_in_complete;
2377 2384 bh->outreq->complete = bulk_out_complete;
2378 /* Allocate the requests */
2379 for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
2380 struct fsg_buffhd *bh = &common->buffhds[i];
2381
2382 rc = alloc_request(common, fsg->bulk_in, &bh->inreq);
2383 if (rc)
2384 goto reset;
2385 rc = alloc_request(common, fsg->bulk_out, &bh->outreq);
2386 if (rc)
2387 goto reset;
2388 bh->inreq->buf = bh->outreq->buf = bh->buf;
2389 bh->inreq->context = bh->outreq->context = bh;
2390 bh->inreq->complete = bulk_in_complete;
2391 bh->outreq->complete = bulk_out_complete;
2392 }
2393
2394 common->running = 1;
2395 for (i = 0; i < common->nluns; ++i)
2396 common->luns[i].unit_attention_data = SS_RESET_OCCURRED;
2397 return rc;
2398 } else {
2399 return -EIO;
2400 }
2401}
2402
2403
2404/*
2405 * Change our operational configuration. This code must agree with the code
2406 * that returns config descriptors, and with interface altsetting code.
2407 *
2408 * It's also responsible for power management interactions. Some
2409 * configurations might not work with our current power sources.
2410 * For now we just assume the gadget is always self-powered.
2411 */
2412static int do_set_config(struct fsg_common *common, u8 new_config)
2413{
2414 int rc = 0;
2415
2416 /* Disable the single interface */
2417 if (common->config != 0) {
2418 DBG(common, "reset config\n");
2419 common->config = 0;
2420 rc = do_set_interface(common, -1);
2421 } 2385 }
2422 2386
2423 /* Enable the interface */ 2387 common->running = 1;
2424 if (new_config != 0) { 2388 for (i = 0; i < common->nluns; ++i)
2425 common->config = new_config; 2389 common->luns[i].unit_attention_data = SS_RESET_OCCURRED;
2426 rc = do_set_interface(common, 0);
2427 if (rc != 0)
2428 common->config = 0; /* Reset on errors */
2429 }
2430 return rc; 2390 return rc;
2431} 2391}
2432 2392
@@ -2437,9 +2397,7 @@ static int do_set_config(struct fsg_common *common, u8 new_config)
2437static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt) 2397static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
2438{ 2398{
2439 struct fsg_dev *fsg = fsg_from_func(f); 2399 struct fsg_dev *fsg = fsg_from_func(f);
2440 fsg->common->prev_fsg = fsg->common->fsg; 2400 fsg->common->new_fsg = fsg;
2441 fsg->common->fsg = fsg;
2442 fsg->common->new_config = 1;
2443 raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); 2401 raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
2444 return 0; 2402 return 0;
2445} 2403}
@@ -2447,9 +2405,7 @@ static int fsg_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
2447static void fsg_disable(struct usb_function *f) 2405static void fsg_disable(struct usb_function *f)
2448{ 2406{
2449 struct fsg_dev *fsg = fsg_from_func(f); 2407 struct fsg_dev *fsg = fsg_from_func(f);
2450 fsg->common->prev_fsg = fsg->common->fsg; 2408 fsg->common->new_fsg = NULL;
2451 fsg->common->fsg = fsg;
2452 fsg->common->new_config = 0;
2453 raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE); 2409 raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
2454} 2410}
2455 2411
@@ -2459,19 +2415,17 @@ static void fsg_disable(struct usb_function *f)
2459static void handle_exception(struct fsg_common *common) 2415static void handle_exception(struct fsg_common *common)
2460{ 2416{
2461 siginfo_t info; 2417 siginfo_t info;
2462 int sig;
2463 int i; 2418 int i;
2464 struct fsg_buffhd *bh; 2419 struct fsg_buffhd *bh;
2465 enum fsg_state old_state; 2420 enum fsg_state old_state;
2466 u8 new_config;
2467 struct fsg_lun *curlun; 2421 struct fsg_lun *curlun;
2468 unsigned int exception_req_tag; 2422 unsigned int exception_req_tag;
2469 int rc;
2470 2423
2471 /* Clear the existing signals. Anything but SIGUSR1 is converted 2424 /* Clear the existing signals. Anything but SIGUSR1 is converted
2472 * into a high-priority EXIT exception. */ 2425 * into a high-priority EXIT exception. */
2473 for (;;) { 2426 for (;;) {
2474 sig = dequeue_signal_lock(current, &current->blocked, &info); 2427 int sig =
2428 dequeue_signal_lock(current, &current->blocked, &info);
2475 if (!sig) 2429 if (!sig)
2476 break; 2430 break;
2477 if (sig != SIGUSR1) { 2431 if (sig != SIGUSR1) {
@@ -2482,7 +2436,7 @@ static void handle_exception(struct fsg_common *common)
2482 } 2436 }
2483 2437
2484 /* Cancel all the pending transfers */ 2438 /* Cancel all the pending transfers */
2485 if (fsg_is_set(common)) { 2439 if (likely(common->fsg)) {
2486 for (i = 0; i < FSG_NUM_BUFFERS; ++i) { 2440 for (i = 0; i < FSG_NUM_BUFFERS; ++i) {
2487 bh = &common->buffhds[i]; 2441 bh = &common->buffhds[i];
2488 if (bh->inreq_busy) 2442 if (bh->inreq_busy)
@@ -2523,7 +2477,6 @@ static void handle_exception(struct fsg_common *common)
2523 common->next_buffhd_to_fill = &common->buffhds[0]; 2477 common->next_buffhd_to_fill = &common->buffhds[0];
2524 common->next_buffhd_to_drain = &common->buffhds[0]; 2478 common->next_buffhd_to_drain = &common->buffhds[0];
2525 exception_req_tag = common->exception_req_tag; 2479 exception_req_tag = common->exception_req_tag;
2526 new_config = common->new_config;
2527 old_state = common->state; 2480 old_state = common->state;
2528 2481
2529 if (old_state == FSG_STATE_ABORT_BULK_OUT) 2482 if (old_state == FSG_STATE_ABORT_BULK_OUT)
@@ -2573,12 +2526,12 @@ static void handle_exception(struct fsg_common *common)
2573 break; 2526 break;
2574 2527
2575 case FSG_STATE_CONFIG_CHANGE: 2528 case FSG_STATE_CONFIG_CHANGE:
2576 rc = do_set_config(common, new_config); 2529 do_set_interface(common, common->new_fsg);
2577 break; 2530 break;
2578 2531
2579 case FSG_STATE_EXIT: 2532 case FSG_STATE_EXIT:
2580 case FSG_STATE_TERMINATED: 2533 case FSG_STATE_TERMINATED:
2581 do_set_config(common, 0); /* Free resources */ 2534 do_set_interface(common, NULL); /* Free resources */
2582 spin_lock_irq(&common->lock); 2535 spin_lock_irq(&common->lock);
2583 common->state = FSG_STATE_TERMINATED; /* Stop the thread */ 2536 common->state = FSG_STATE_TERMINATED; /* Stop the thread */
2584 spin_unlock_irq(&common->lock); 2537 spin_unlock_irq(&common->lock);
@@ -2863,6 +2816,7 @@ buffhds_first_it:
2863 goto error_release; 2816 goto error_release;
2864 } 2817 }
2865 init_completion(&common->thread_notifier); 2818 init_completion(&common->thread_notifier);
2819 init_waitqueue_head(&common->fsg_wait);
2866#undef OR 2820#undef OR
2867 2821
2868 2822
@@ -2957,9 +2911,17 @@ static void fsg_common_release(struct kref *ref)
2957static void fsg_unbind(struct usb_configuration *c, struct usb_function *f) 2911static void fsg_unbind(struct usb_configuration *c, struct usb_function *f)
2958{ 2912{
2959 struct fsg_dev *fsg = fsg_from_func(f); 2913 struct fsg_dev *fsg = fsg_from_func(f);
2914 struct fsg_common *common = fsg->common;
2960 2915
2961 DBG(fsg, "unbind\n"); 2916 DBG(fsg, "unbind\n");
2962 fsg_common_put(fsg->common); 2917 if (fsg->common->fsg == fsg) {
2918 fsg->common->new_fsg = NULL;
2919 raise_exception(fsg->common, FSG_STATE_CONFIG_CHANGE);
2920 /* FIXME: make interruptible or killable somehow? */
2921 wait_event(common->fsg_wait, common->fsg != fsg);
2922 }
2923
2924 fsg_common_put(common);
2963 usb_free_descriptors(fsg->function.descriptors); 2925 usb_free_descriptors(fsg->function.descriptors);
2964 usb_free_descriptors(fsg->function.hs_descriptors); 2926 usb_free_descriptors(fsg->function.hs_descriptors);
2965 kfree(fsg); 2927 kfree(fsg);
@@ -2970,7 +2932,6 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
2970{ 2932{
2971 struct fsg_dev *fsg = fsg_from_func(f); 2933 struct fsg_dev *fsg = fsg_from_func(f);
2972 struct usb_gadget *gadget = c->cdev->gadget; 2934 struct usb_gadget *gadget = c->cdev->gadget;
2973 int rc;
2974 int i; 2935 int i;
2975 struct usb_ep *ep; 2936 struct usb_ep *ep;
2976 2937
@@ -2996,6 +2957,11 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
2996 ep->driver_data = fsg->common; /* claim the endpoint */ 2957 ep->driver_data = fsg->common; /* claim the endpoint */
2997 fsg->bulk_out = ep; 2958 fsg->bulk_out = ep;
2998 2959
2960 /* Copy descriptors */
2961 f->descriptors = usb_copy_descriptors(fsg_fs_function);
2962 if (unlikely(!f->descriptors))
2963 return -ENOMEM;
2964
2999 if (gadget_is_dualspeed(gadget)) { 2965 if (gadget_is_dualspeed(gadget)) {
3000 /* Assume endpoint addresses are the same for both speeds */ 2966 /* Assume endpoint addresses are the same for both speeds */
3001 fsg_hs_bulk_in_desc.bEndpointAddress = 2967 fsg_hs_bulk_in_desc.bEndpointAddress =
@@ -3003,16 +2969,17 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f)
3003 fsg_hs_bulk_out_desc.bEndpointAddress = 2969 fsg_hs_bulk_out_desc.bEndpointAddress =
3004 fsg_fs_bulk_out_desc.bEndpointAddress; 2970 fsg_fs_bulk_out_desc.bEndpointAddress;
3005 f->hs_descriptors = usb_copy_descriptors(fsg_hs_function); 2971 f->hs_descriptors = usb_copy_descriptors(fsg_hs_function);
3006 if (unlikely(!f->hs_descriptors)) 2972 if (unlikely(!f->hs_descriptors)) {
2973 usb_free_descriptors(f->descriptors);
3007 return -ENOMEM; 2974 return -ENOMEM;
2975 }
3008 } 2976 }
3009 2977
3010 return 0; 2978 return 0;
3011 2979
3012autoconf_fail: 2980autoconf_fail:
3013 ERROR(fsg, "unable to autoconfigure all endpoints\n"); 2981 ERROR(fsg, "unable to autoconfigure all endpoints\n");
3014 rc = -ENOTSUPP; 2982 return -ENOTSUPP;
3015 return rc;
3016} 2983}
3017 2984
3018 2985
@@ -3036,11 +3003,6 @@ static int fsg_add(struct usb_composite_dev *cdev,
3036 3003
3037 fsg->function.name = FSG_DRIVER_DESC; 3004 fsg->function.name = FSG_DRIVER_DESC;
3038 fsg->function.strings = fsg_strings_array; 3005 fsg->function.strings = fsg_strings_array;
3039 fsg->function.descriptors = usb_copy_descriptors(fsg_fs_function);
3040 if (unlikely(!fsg->function.descriptors)) {
3041 rc = -ENOMEM;
3042 goto error_free_fsg;
3043 }
3044 fsg->function.bind = fsg_bind; 3006 fsg->function.bind = fsg_bind;
3045 fsg->function.unbind = fsg_unbind; 3007 fsg->function.unbind = fsg_unbind;
3046 fsg->function.setup = fsg_setup; 3008 fsg->function.setup = fsg_setup;
@@ -3056,19 +3018,9 @@ static int fsg_add(struct usb_composite_dev *cdev,
3056 3018
3057 rc = usb_add_function(c, &fsg->function); 3019 rc = usb_add_function(c, &fsg->function);
3058 if (unlikely(rc)) 3020 if (unlikely(rc))
3059 goto error_free_all; 3021 kfree(fsg);
3060 3022 else
3061 fsg_common_get(fsg->common); 3023 fsg_common_get(fsg->common);
3062 return 0;
3063
3064error_free_all:
3065 usb_free_descriptors(fsg->function.descriptors);
3066 /* fsg_bind() might have copied those; or maybe not? who cares
3067 * -- free it just in case. */
3068 usb_free_descriptors(fsg->function.hs_descriptors);
3069error_free_fsg:
3070 kfree(fsg);
3071
3072 return rc; 3024 return rc;
3073} 3025}
3074 3026
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 4b0e4a040d6f..d1af253a9105 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -392,6 +392,17 @@ static int __gfs_do_config(struct usb_configuration *c,
392 if (unlikely(ret < 0)) 392 if (unlikely(ret < 0))
393 return ret; 393 return ret;
394 394
395 /* After previous do_configs there may be some invalid
396 * pointers in c->interface array. This happens every time
397 * a user space function with fewer interfaces than a user
398 * space function that was run before the new one is run. The
399 * compasit's set_config() assumes that if there is no more
400 * then MAX_CONFIG_INTERFACES interfaces in a configuration
401 * then there is a NULL pointer after the last interface in
402 * c->interface array. We need to make sure this is true. */
403 if (c->next_interface_id < ARRAY_SIZE(c->interface))
404 c->interface[c->next_interface_id] = NULL;
405
395 return 0; 406 return 0;
396} 407}
397 408
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 43abf55d8c60..4c3ac5c42237 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -82,7 +82,7 @@ static struct class *usb_gadget_class;
82struct printer_dev { 82struct printer_dev {
83 spinlock_t lock; /* lock this structure */ 83 spinlock_t lock; /* lock this structure */
84 /* lock buffer lists during read/write calls */ 84 /* lock buffer lists during read/write calls */
85 spinlock_t lock_printer_io; 85 struct mutex lock_printer_io;
86 struct usb_gadget *gadget; 86 struct usb_gadget *gadget;
87 struct usb_request *req; /* for control responses */ 87 struct usb_request *req; /* for control responses */
88 u8 config; 88 u8 config;
@@ -567,7 +567,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
567 567
568 DBG(dev, "printer_read trying to read %d bytes\n", (int)len); 568 DBG(dev, "printer_read trying to read %d bytes\n", (int)len);
569 569
570 spin_lock(&dev->lock_printer_io); 570 mutex_lock(&dev->lock_printer_io);
571 spin_lock_irqsave(&dev->lock, flags); 571 spin_lock_irqsave(&dev->lock, flags);
572 572
573 /* We will use this flag later to check if a printer reset happened 573 /* We will use this flag later to check if a printer reset happened
@@ -601,7 +601,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
601 * call or not. 601 * call or not.
602 */ 602 */
603 if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { 603 if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) {
604 spin_unlock(&dev->lock_printer_io); 604 mutex_unlock(&dev->lock_printer_io);
605 return -EAGAIN; 605 return -EAGAIN;
606 } 606 }
607 607
@@ -648,7 +648,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
648 if (dev->reset_printer) { 648 if (dev->reset_printer) {
649 list_add(&current_rx_req->list, &dev->rx_reqs); 649 list_add(&current_rx_req->list, &dev->rx_reqs);
650 spin_unlock_irqrestore(&dev->lock, flags); 650 spin_unlock_irqrestore(&dev->lock, flags);
651 spin_unlock(&dev->lock_printer_io); 651 mutex_unlock(&dev->lock_printer_io);
652 return -EAGAIN; 652 return -EAGAIN;
653 } 653 }
654 654
@@ -673,7 +673,7 @@ printer_read(struct file *fd, char __user *buf, size_t len, loff_t *ptr)
673 dev->current_rx_buf = current_rx_buf; 673 dev->current_rx_buf = current_rx_buf;
674 674
675 spin_unlock_irqrestore(&dev->lock, flags); 675 spin_unlock_irqrestore(&dev->lock, flags);
676 spin_unlock(&dev->lock_printer_io); 676 mutex_unlock(&dev->lock_printer_io);
677 677
678 DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied); 678 DBG(dev, "printer_read returned %d bytes\n", (int)bytes_copied);
679 679
@@ -697,7 +697,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
697 if (len == 0) 697 if (len == 0)
698 return -EINVAL; 698 return -EINVAL;
699 699
700 spin_lock(&dev->lock_printer_io); 700 mutex_lock(&dev->lock_printer_io);
701 spin_lock_irqsave(&dev->lock, flags); 701 spin_lock_irqsave(&dev->lock, flags);
702 702
703 /* Check if a printer reset happens while we have interrupts on */ 703 /* Check if a printer reset happens while we have interrupts on */
@@ -713,7 +713,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
713 * a NON-Blocking call or not. 713 * a NON-Blocking call or not.
714 */ 714 */
715 if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) { 715 if (fd->f_flags & (O_NONBLOCK|O_NDELAY)) {
716 spin_unlock(&dev->lock_printer_io); 716 mutex_unlock(&dev->lock_printer_io);
717 return -EAGAIN; 717 return -EAGAIN;
718 } 718 }
719 719
@@ -752,7 +752,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
752 752
753 if (copy_from_user(req->buf, buf, size)) { 753 if (copy_from_user(req->buf, buf, size)) {
754 list_add(&req->list, &dev->tx_reqs); 754 list_add(&req->list, &dev->tx_reqs);
755 spin_unlock(&dev->lock_printer_io); 755 mutex_unlock(&dev->lock_printer_io);
756 return bytes_copied; 756 return bytes_copied;
757 } 757 }
758 758
@@ -766,14 +766,14 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
766 if (dev->reset_printer) { 766 if (dev->reset_printer) {
767 list_add(&req->list, &dev->tx_reqs); 767 list_add(&req->list, &dev->tx_reqs);
768 spin_unlock_irqrestore(&dev->lock, flags); 768 spin_unlock_irqrestore(&dev->lock, flags);
769 spin_unlock(&dev->lock_printer_io); 769 mutex_unlock(&dev->lock_printer_io);
770 return -EAGAIN; 770 return -EAGAIN;
771 } 771 }
772 772
773 if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) { 773 if (usb_ep_queue(dev->in_ep, req, GFP_ATOMIC)) {
774 list_add(&req->list, &dev->tx_reqs); 774 list_add(&req->list, &dev->tx_reqs);
775 spin_unlock_irqrestore(&dev->lock, flags); 775 spin_unlock_irqrestore(&dev->lock, flags);
776 spin_unlock(&dev->lock_printer_io); 776 mutex_unlock(&dev->lock_printer_io);
777 return -EAGAIN; 777 return -EAGAIN;
778 } 778 }
779 779
@@ -782,7 +782,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
782 } 782 }
783 783
784 spin_unlock_irqrestore(&dev->lock, flags); 784 spin_unlock_irqrestore(&dev->lock, flags);
785 spin_unlock(&dev->lock_printer_io); 785 mutex_unlock(&dev->lock_printer_io);
786 786
787 DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied); 787 DBG(dev, "printer_write sent %d bytes\n", (int)bytes_copied);
788 788
@@ -820,11 +820,11 @@ printer_poll(struct file *fd, poll_table *wait)
820 unsigned long flags; 820 unsigned long flags;
821 int status = 0; 821 int status = 0;
822 822
823 spin_lock(&dev->lock_printer_io); 823 mutex_lock(&dev->lock_printer_io);
824 spin_lock_irqsave(&dev->lock, flags); 824 spin_lock_irqsave(&dev->lock, flags);
825 setup_rx_reqs(dev); 825 setup_rx_reqs(dev);
826 spin_unlock_irqrestore(&dev->lock, flags); 826 spin_unlock_irqrestore(&dev->lock, flags);
827 spin_unlock(&dev->lock_printer_io); 827 mutex_unlock(&dev->lock_printer_io);
828 828
829 poll_wait(fd, &dev->rx_wait, wait); 829 poll_wait(fd, &dev->rx_wait, wait);
830 poll_wait(fd, &dev->tx_wait, wait); 830 poll_wait(fd, &dev->tx_wait, wait);
@@ -1461,7 +1461,7 @@ autoconf_fail:
1461 } 1461 }
1462 1462
1463 spin_lock_init(&dev->lock); 1463 spin_lock_init(&dev->lock);
1464 spin_lock_init(&dev->lock_printer_io); 1464 mutex_init(&dev->lock_printer_io);
1465 INIT_LIST_HEAD(&dev->tx_reqs); 1465 INIT_LIST_HEAD(&dev->tx_reqs);
1466 INIT_LIST_HEAD(&dev->tx_reqs_active); 1466 INIT_LIST_HEAD(&dev->tx_reqs_active);
1467 INIT_LIST_HEAD(&dev->rx_reqs); 1467 INIT_LIST_HEAD(&dev->rx_reqs);
@@ -1594,7 +1594,7 @@ cleanup(void)
1594{ 1594{
1595 int status; 1595 int status;
1596 1596
1597 spin_lock(&usb_printer_gadget.lock_printer_io); 1597 mutex_lock(&usb_printer_gadget.lock_printer_io);
1598 class_destroy(usb_gadget_class); 1598 class_destroy(usb_gadget_class);
1599 unregister_chrdev_region(g_printer_devno, 2); 1599 unregister_chrdev_region(g_printer_devno, 2);
1600 1600
@@ -1602,6 +1602,6 @@ cleanup(void)
1602 if (status) 1602 if (status)
1603 ERROR(dev, "usb_gadget_unregister_driver %x\n", status); 1603 ERROR(dev, "usb_gadget_unregister_driver %x\n", status);
1604 1604
1605 spin_unlock(&usb_printer_gadget.lock_printer_io); 1605 mutex_unlock(&usb_printer_gadget.lock_printer_io);
1606} 1606}
1607module_exit(cleanup); 1607module_exit(cleanup);
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index d5f4c1d45c97..e724a051bfdd 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1700,9 +1700,13 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1700 if (!driver || driver != udc->driver || !driver->unbind) 1700 if (!driver || driver != udc->driver || !driver->unbind)
1701 return -EINVAL; 1701 return -EINVAL;
1702 1702
1703 dprintk(DEBUG_NORMAL,"usb_gadget_register_driver() '%s'\n", 1703 dprintk(DEBUG_NORMAL, "usb_gadget_unregister_driver() '%s'\n",
1704 driver->driver.name); 1704 driver->driver.name);
1705 1705
1706 /* report disconnect */
1707 if (driver->disconnect)
1708 driver->disconnect(&udc->gadget);
1709
1706 driver->unbind(&udc->gadget); 1710 driver->unbind(&udc->gadget);
1707 1711
1708 device_del(&udc->gadget.dev); 1712 device_del(&udc->gadget.dev);
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index 16bdf77f582a..3e8dcb5455e3 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -536,17 +536,11 @@ recycle:
536 list_move(&req->list, &port->read_pool); 536 list_move(&req->list, &port->read_pool);
537 } 537 }
538 538
539 /* Push from tty to ldisc; this is immediate with low_latency, and 539 /* Push from tty to ldisc; without low_latency set this is handled by
540 * may trigger callbacks to this driver ... so drop the spinlock. 540 * a workqueue, so we won't get callbacks and can hold port_lock
541 */ 541 */
542 if (tty && do_push) { 542 if (tty && do_push) {
543 spin_unlock_irq(&port->port_lock);
544 tty_flip_buffer_push(tty); 543 tty_flip_buffer_push(tty);
545 wake_up_interruptible(&tty->read_wait);
546 spin_lock_irq(&port->port_lock);
547
548 /* tty may have been closed */
549 tty = port->port_tty;
550 } 544 }
551 545
552 546
@@ -784,11 +778,6 @@ static int gs_open(struct tty_struct *tty, struct file *file)
784 port->open_count = 1; 778 port->open_count = 1;
785 port->openclose = false; 779 port->openclose = false;
786 780
787 /* low_latency means ldiscs work in tasklet context, without
788 * needing a workqueue schedule ... easier to keep up.
789 */
790 tty->low_latency = 1;
791
792 /* if connected, start the I/O stream */ 781 /* if connected, start the I/O stream */
793 if (port->port_usb) { 782 if (port->port_usb) {
794 struct gserial *gser = port->port_usb; 783 struct gserial *gser = port->port_usb;
@@ -1195,6 +1184,7 @@ void gserial_cleanup(void)
1195 n_ports = 0; 1184 n_ports = 0;
1196 1185
1197 tty_unregister_driver(gs_tty_driver); 1186 tty_unregister_driver(gs_tty_driver);
1187 put_tty_driver(gs_tty_driver);
1198 gs_tty_driver = NULL; 1188 gs_tty_driver = NULL;
1199 1189
1200 pr_debug("%s: cleaned up ttyGS* support\n", __func__); 1190 pr_debug("%s: cleaned up ttyGS* support\n", __func__);
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index 544ccfd7056e..bd4027745aa7 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -207,10 +207,17 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
207 /* Initialize the transceiver */ 207 /* Initialize the transceiver */
208 if (pdata->otg) { 208 if (pdata->otg) {
209 pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; 209 pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET;
210 if (otg_init(pdata->otg) != 0) 210 ret = otg_init(pdata->otg);
211 dev_err(dev, "unable to init transceiver\n"); 211 if (ret) {
212 else if (otg_set_vbus(pdata->otg, 1) != 0) 212 dev_err(dev, "unable to init transceiver, probably missing\n");
213 ret = -ENODEV;
214 goto err_add;
215 }
216 ret = otg_set_vbus(pdata->otg, 1);
217 if (ret) {
213 dev_err(dev, "unable to enable vbus on transceiver\n"); 218 dev_err(dev, "unable to enable vbus on transceiver\n");
219 goto err_add;
220 }
214 } 221 }
215 222
216 priv->hcd = hcd; 223 priv->hcd = hcd;
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 20a0dfe0fe36..0587ad4ce5c2 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -2224,12 +2224,9 @@ static void remove_debug_file(struct isp1362_hcd *isp1362_hcd)
2224 2224
2225/*-------------------------------------------------------------------------*/ 2225/*-------------------------------------------------------------------------*/
2226 2226
2227static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd) 2227static void __isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
2228{ 2228{
2229 int tmp = 20; 2229 int tmp = 20;
2230 unsigned long flags;
2231
2232 spin_lock_irqsave(&isp1362_hcd->lock, flags);
2233 2230
2234 isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC); 2231 isp1362_write_reg16(isp1362_hcd, HCSWRES, HCSWRES_MAGIC);
2235 isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR); 2232 isp1362_write_reg32(isp1362_hcd, HCCMDSTAT, OHCI_HCR);
@@ -2240,6 +2237,14 @@ static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
2240 } 2237 }
2241 if (!tmp) 2238 if (!tmp)
2242 pr_err("Software reset timeout\n"); 2239 pr_err("Software reset timeout\n");
2240}
2241
2242static void isp1362_sw_reset(struct isp1362_hcd *isp1362_hcd)
2243{
2244 unsigned long flags;
2245
2246 spin_lock_irqsave(&isp1362_hcd->lock, flags);
2247 __isp1362_sw_reset(isp1362_hcd);
2243 spin_unlock_irqrestore(&isp1362_hcd->lock, flags); 2248 spin_unlock_irqrestore(&isp1362_hcd->lock, flags);
2244} 2249}
2245 2250
@@ -2418,7 +2423,7 @@ static void isp1362_hc_stop(struct usb_hcd *hcd)
2418 if (isp1362_hcd->board && isp1362_hcd->board->reset) 2423 if (isp1362_hcd->board && isp1362_hcd->board->reset)
2419 isp1362_hcd->board->reset(hcd->self.controller, 1); 2424 isp1362_hcd->board->reset(hcd->self.controller, 1);
2420 else 2425 else
2421 isp1362_sw_reset(isp1362_hcd); 2426 __isp1362_sw_reset(isp1362_hcd);
2422 2427
2423 if (isp1362_hcd->board && isp1362_hcd->board->clock) 2428 if (isp1362_hcd->board && isp1362_hcd->board->clock)
2424 isp1362_hcd->board->clock(hcd->self.controller, 0); 2429 isp1362_hcd->board->clock(hcd->self.controller, 0);
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 1a2bb4ce638f..77be3c24a427 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -1065,7 +1065,7 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port)
1065 else if (speed == LSMODE) 1065 else if (speed == LSMODE)
1066 rh->port |= USB_PORT_STAT_LOW_SPEED; 1066 rh->port |= USB_PORT_STAT_LOW_SPEED;
1067 1067
1068 rh->port &= USB_PORT_STAT_RESET; 1068 rh->port &= ~USB_PORT_STAT_RESET;
1069 rh->port |= USB_PORT_STAT_ENABLE; 1069 rh->port |= USB_PORT_STAT_ENABLE;
1070} 1070}
1071 1071
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 9012098add6b..94e6934edb09 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -182,8 +182,12 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer
182 * set, but other sections talk about dealing with the chain bit set. This was 182 * set, but other sections talk about dealing with the chain bit set. This was
183 * fixed in the 0.96 specification errata, but we have to assume that all 0.95 183 * fixed in the 0.96 specification errata, but we have to assume that all 0.95
184 * xHCI hardware can't handle the chain bit being cleared on a link TRB. 184 * xHCI hardware can't handle the chain bit being cleared on a link TRB.
185 *
186 * @more_trbs_coming: Will you enqueue more TRBs before calling
187 * prepare_transfer()?
185 */ 188 */
186static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer) 189static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,
190 bool consumer, bool more_trbs_coming)
187{ 191{
188 u32 chain; 192 u32 chain;
189 union xhci_trb *next; 193 union xhci_trb *next;
@@ -199,15 +203,28 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer
199 while (last_trb(xhci, ring, ring->enq_seg, next)) { 203 while (last_trb(xhci, ring, ring->enq_seg, next)) {
200 if (!consumer) { 204 if (!consumer) {
201 if (ring != xhci->event_ring) { 205 if (ring != xhci->event_ring) {
202 if (chain) { 206 /*
203 next->link.control |= TRB_CHAIN; 207 * If the caller doesn't plan on enqueueing more
204 208 * TDs before ringing the doorbell, then we
205 /* Give this link TRB to the hardware */ 209 * don't want to give the link TRB to the
206 wmb(); 210 * hardware just yet. We'll give the link TRB
207 next->link.control ^= TRB_CYCLE; 211 * back in prepare_ring() just before we enqueue
208 } else { 212 * the TD at the top of the ring.
213 */
214 if (!chain && !more_trbs_coming)
209 break; 215 break;
216
217 /* If we're not dealing with 0.95 hardware,
218 * carry over the chain bit of the previous TRB
219 * (which may mean the chain bit is cleared).
220 */
221 if (!xhci_link_trb_quirk(xhci)) {
222 next->link.control &= ~TRB_CHAIN;
223 next->link.control |= chain;
210 } 224 }
225 /* Give this link TRB to the hardware */
226 wmb();
227 next->link.control ^= TRB_CYCLE;
211 } 228 }
212 /* Toggle the cycle bit after the last ring segment. */ 229 /* Toggle the cycle bit after the last ring segment. */
213 if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) { 230 if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
@@ -1707,9 +1724,12 @@ void xhci_handle_event(struct xhci_hcd *xhci)
1707/* 1724/*
1708 * Generic function for queueing a TRB on a ring. 1725 * Generic function for queueing a TRB on a ring.
1709 * The caller must have checked to make sure there's room on the ring. 1726 * The caller must have checked to make sure there's room on the ring.
1727 *
1728 * @more_trbs_coming: Will you enqueue more TRBs before calling
1729 * prepare_transfer()?
1710 */ 1730 */
1711static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, 1731static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
1712 bool consumer, 1732 bool consumer, bool more_trbs_coming,
1713 u32 field1, u32 field2, u32 field3, u32 field4) 1733 u32 field1, u32 field2, u32 field3, u32 field4)
1714{ 1734{
1715 struct xhci_generic_trb *trb; 1735 struct xhci_generic_trb *trb;
@@ -1719,7 +1739,7 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
1719 trb->field[1] = field2; 1739 trb->field[1] = field2;
1720 trb->field[2] = field3; 1740 trb->field[2] = field3;
1721 trb->field[3] = field4; 1741 trb->field[3] = field4;
1722 inc_enq(xhci, ring, consumer); 1742 inc_enq(xhci, ring, consumer, more_trbs_coming);
1723} 1743}
1724 1744
1725/* 1745/*
@@ -1988,6 +2008,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1988 int trb_buff_len, this_sg_len, running_total; 2008 int trb_buff_len, this_sg_len, running_total;
1989 bool first_trb; 2009 bool first_trb;
1990 u64 addr; 2010 u64 addr;
2011 bool more_trbs_coming;
1991 2012
1992 struct xhci_generic_trb *start_trb; 2013 struct xhci_generic_trb *start_trb;
1993 int start_cycle; 2014 int start_cycle;
@@ -2073,7 +2094,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2073 length_field = TRB_LEN(trb_buff_len) | 2094 length_field = TRB_LEN(trb_buff_len) |
2074 remainder | 2095 remainder |
2075 TRB_INTR_TARGET(0); 2096 TRB_INTR_TARGET(0);
2076 queue_trb(xhci, ep_ring, false, 2097 if (num_trbs > 1)
2098 more_trbs_coming = true;
2099 else
2100 more_trbs_coming = false;
2101 queue_trb(xhci, ep_ring, false, more_trbs_coming,
2077 lower_32_bits(addr), 2102 lower_32_bits(addr),
2078 upper_32_bits(addr), 2103 upper_32_bits(addr),
2079 length_field, 2104 length_field,
@@ -2124,6 +2149,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2124 int num_trbs; 2149 int num_trbs;
2125 struct xhci_generic_trb *start_trb; 2150 struct xhci_generic_trb *start_trb;
2126 bool first_trb; 2151 bool first_trb;
2152 bool more_trbs_coming;
2127 int start_cycle; 2153 int start_cycle;
2128 u32 field, length_field; 2154 u32 field, length_field;
2129 2155
@@ -2212,7 +2238,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2212 length_field = TRB_LEN(trb_buff_len) | 2238 length_field = TRB_LEN(trb_buff_len) |
2213 remainder | 2239 remainder |
2214 TRB_INTR_TARGET(0); 2240 TRB_INTR_TARGET(0);
2215 queue_trb(xhci, ep_ring, false, 2241 if (num_trbs > 1)
2242 more_trbs_coming = true;
2243 else
2244 more_trbs_coming = false;
2245 queue_trb(xhci, ep_ring, false, more_trbs_coming,
2216 lower_32_bits(addr), 2246 lower_32_bits(addr),
2217 upper_32_bits(addr), 2247 upper_32_bits(addr),
2218 length_field, 2248 length_field,
@@ -2291,7 +2321,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2291 /* Queue setup TRB - see section 6.4.1.2.1 */ 2321 /* Queue setup TRB - see section 6.4.1.2.1 */
2292 /* FIXME better way to translate setup_packet into two u32 fields? */ 2322 /* FIXME better way to translate setup_packet into two u32 fields? */
2293 setup = (struct usb_ctrlrequest *) urb->setup_packet; 2323 setup = (struct usb_ctrlrequest *) urb->setup_packet;
2294 queue_trb(xhci, ep_ring, false, 2324 queue_trb(xhci, ep_ring, false, true,
2295 /* FIXME endianness is probably going to bite my ass here. */ 2325 /* FIXME endianness is probably going to bite my ass here. */
2296 setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16, 2326 setup->bRequestType | setup->bRequest << 8 | setup->wValue << 16,
2297 setup->wIndex | setup->wLength << 16, 2327 setup->wIndex | setup->wLength << 16,
@@ -2307,7 +2337,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2307 if (urb->transfer_buffer_length > 0) { 2337 if (urb->transfer_buffer_length > 0) {
2308 if (setup->bRequestType & USB_DIR_IN) 2338 if (setup->bRequestType & USB_DIR_IN)
2309 field |= TRB_DIR_IN; 2339 field |= TRB_DIR_IN;
2310 queue_trb(xhci, ep_ring, false, 2340 queue_trb(xhci, ep_ring, false, true,
2311 lower_32_bits(urb->transfer_dma), 2341 lower_32_bits(urb->transfer_dma),
2312 upper_32_bits(urb->transfer_dma), 2342 upper_32_bits(urb->transfer_dma),
2313 length_field, 2343 length_field,
@@ -2324,7 +2354,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
2324 field = 0; 2354 field = 0;
2325 else 2355 else
2326 field = TRB_DIR_IN; 2356 field = TRB_DIR_IN;
2327 queue_trb(xhci, ep_ring, false, 2357 queue_trb(xhci, ep_ring, false, false,
2328 0, 2358 0,
2329 0, 2359 0,
2330 TRB_INTR_TARGET(0), 2360 TRB_INTR_TARGET(0),
@@ -2361,7 +2391,7 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2,
2361 "unfailable commands failed.\n"); 2391 "unfailable commands failed.\n");
2362 return -ENOMEM; 2392 return -ENOMEM;
2363 } 2393 }
2364 queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, 2394 queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3,
2365 field4 | xhci->cmd_ring->cycle_state); 2395 field4 | xhci->cmd_ring->cycle_state);
2366 return 0; 2396 return 0;
2367} 2397}
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index fad70bc83555..3b795c56221f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -219,8 +219,8 @@ static int musb_ulpi_write(struct otg_transceiver *otg,
219 return 0; 219 return 0;
220} 220}
221#else 221#else
222#define musb_ulpi_read(a, b) NULL 222#define musb_ulpi_read NULL
223#define musb_ulpi_write(a, b, c) NULL 223#define musb_ulpi_write NULL
224#endif 224#endif
225 225
226static struct otg_io_access_ops musb_ulpi_access = { 226static struct otg_io_access_ops musb_ulpi_access = {
@@ -451,10 +451,6 @@ void musb_hnp_stop(struct musb *musb)
451 * @param power 451 * @param power
452 */ 452 */
453 453
454#define STAGE0_MASK (MUSB_INTR_RESUME | MUSB_INTR_SESSREQ \
455 | MUSB_INTR_VBUSERROR | MUSB_INTR_CONNECT \
456 | MUSB_INTR_RESET)
457
458static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, 454static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
459 u8 devctl, u8 power) 455 u8 devctl, u8 power)
460{ 456{
@@ -642,7 +638,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
642 handled = IRQ_HANDLED; 638 handled = IRQ_HANDLED;
643 } 639 }
644 640
645 641#endif
646 if (int_usb & MUSB_INTR_SUSPEND) { 642 if (int_usb & MUSB_INTR_SUSPEND) {
647 DBG(1, "SUSPEND (%s) devctl %02x power %02x\n", 643 DBG(1, "SUSPEND (%s) devctl %02x power %02x\n",
648 otg_state_string(musb), devctl, power); 644 otg_state_string(musb), devctl, power);
@@ -705,6 +701,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
705 } 701 }
706 } 702 }
707 703
704#ifdef CONFIG_USB_MUSB_HDRC_HCD
708 if (int_usb & MUSB_INTR_CONNECT) { 705 if (int_usb & MUSB_INTR_CONNECT) {
709 struct usb_hcd *hcd = musb_to_hcd(musb); 706 struct usb_hcd *hcd = musb_to_hcd(musb);
710 void __iomem *mbase = musb->mregs; 707 void __iomem *mbase = musb->mregs;
@@ -1597,7 +1594,7 @@ irqreturn_t musb_interrupt(struct musb *musb)
1597 /* the core can interrupt us for multiple reasons; docs have 1594 /* the core can interrupt us for multiple reasons; docs have
1598 * a generic interrupt flowchart to follow 1595 * a generic interrupt flowchart to follow
1599 */ 1596 */
1600 if (musb->int_usb & STAGE0_MASK) 1597 if (musb->int_usb)
1601 retval |= musb_stage0_irq(musb, musb->int_usb, 1598 retval |= musb_stage0_irq(musb, musb->int_usb,
1602 devctl, power); 1599 devctl, power);
1603 1600
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index b22d02dea7d3..91d67794e350 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -470,7 +470,8 @@ struct musb_csr_regs {
470 470
471struct musb_context_registers { 471struct musb_context_registers {
472 472
473#ifdef CONFIG_PM 473#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
474 defined(CONFIG_ARCH_OMAP4)
474 u32 otg_sysconfig, otg_forcestandby; 475 u32 otg_sysconfig, otg_forcestandby;
475#endif 476#endif
476 u8 power; 477 u8 power;
@@ -484,7 +485,8 @@ struct musb_context_registers {
484 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS]; 485 struct musb_csr_regs index_regs[MUSB_C_NUM_EPS];
485}; 486};
486 487
487#ifdef CONFIG_PM 488#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
489 defined(CONFIG_ARCH_OMAP4)
488extern void musb_platform_save_context(struct musb *musb, 490extern void musb_platform_save_context(struct musb *musb,
489 struct musb_context_registers *musb_context); 491 struct musb_context_registers *musb_context);
490extern void musb_platform_restore_context(struct musb *musb, 492extern void musb_platform_restore_context(struct musb *musb,
diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
index 1008044a3bbc..dc66e4376d49 100644
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -132,18 +132,9 @@ static void configure_channel(struct dma_channel *channel,
132 if (mode) { 132 if (mode) {
133 csr |= 1 << MUSB_HSDMA_MODE1_SHIFT; 133 csr |= 1 << MUSB_HSDMA_MODE1_SHIFT;
134 BUG_ON(len < packet_sz); 134 BUG_ON(len < packet_sz);
135
136 if (packet_sz >= 64) {
137 csr |= MUSB_HSDMA_BURSTMODE_INCR16
138 << MUSB_HSDMA_BURSTMODE_SHIFT;
139 } else if (packet_sz >= 32) {
140 csr |= MUSB_HSDMA_BURSTMODE_INCR8
141 << MUSB_HSDMA_BURSTMODE_SHIFT;
142 } else if (packet_sz >= 16) {
143 csr |= MUSB_HSDMA_BURSTMODE_INCR4
144 << MUSB_HSDMA_BURSTMODE_SHIFT;
145 }
146 } 135 }
136 csr |= MUSB_HSDMA_BURSTMODE_INCR16
137 << MUSB_HSDMA_BURSTMODE_SHIFT;
147 138
148 csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT) 139 csr |= (musb_channel->epnum << MUSB_HSDMA_ENDPOINT_SHIFT)
149 | (1 << MUSB_HSDMA_ENABLE_SHIFT) 140 | (1 << MUSB_HSDMA_ENABLE_SHIFT)
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index b1b346932946..d331b222ad21 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -59,12 +59,17 @@ static int ulpi_set_flags(struct otg_transceiver *otg)
59 59
60static int ulpi_init(struct otg_transceiver *otg) 60static int ulpi_init(struct otg_transceiver *otg)
61{ 61{
62 int i, vid, pid; 62 int i, vid, pid, ret;
63 63 u32 ulpi_id = 0;
64 vid = (otg_io_read(otg, ULPI_VENDOR_ID_HIGH) << 8) | 64
65 otg_io_read(otg, ULPI_VENDOR_ID_LOW); 65 for (i = 0; i < 4; i++) {
66 pid = (otg_io_read(otg, ULPI_PRODUCT_ID_HIGH) << 8) | 66 ret = otg_io_read(otg, ULPI_PRODUCT_ID_HIGH - i);
67 otg_io_read(otg, ULPI_PRODUCT_ID_LOW); 67 if (ret < 0)
68 return ret;
69 ulpi_id = (ulpi_id << 8) | ret;
70 }
71 vid = ulpi_id & 0xffff;
72 pid = ulpi_id >> 16;
68 73
69 pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid); 74 pr_info("ULPI transceiver vendor/product ID 0x%04x/0x%04x\n", vid, pid);
70 75
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 79dd1ae195e5..da7e334b0407 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -653,7 +653,6 @@ static struct usb_device_id id_table_combined [] = {
653 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 653 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
654 { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) }, 654 { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) },
655 { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) }, 655 { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) },
656 { USB_DEVICE(CONTEC_VID, CONTEC_COM1USBH_PID) },
657 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 656 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
658 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 657 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
659 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, 658 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 94d86c3febcb..bbc159a1df45 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -501,13 +501,6 @@
501#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */ 501#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */
502 502
503/* 503/*
504 * Contec products (http://www.contec.com)
505 * Submitted by Daniel Sangorrin
506 */
507#define CONTEC_VID 0x06CE /* Vendor ID */
508#define CONTEC_COM1USBH_PID 0x8311 /* COM-1(USB)H */
509
510/*
511 * Definitions for B&B Electronics products. 504 * Definitions for B&B Electronics products.
512 */ 505 */
513#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */ 506#define BANDB_VID 0x0856 /* B&B Electronics Vendor ID */
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 04bb759536bb..93d72eb8cafc 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -139,6 +139,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
139 "Could not set interface, error %d\n", 139 "Could not set interface, error %d\n",
140 retval); 140 retval);
141 retval = -ENODEV; 141 retval = -ENODEV;
142 kfree(data);
142 } 143 }
143 return retval; 144 return retval;
144 } 145 }
@@ -155,6 +156,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
155 "Could not set interface, error %d\n", 156 "Could not set interface, error %d\n",
156 retval); 157 retval);
157 retval = -ENODEV; 158 retval = -ENODEV;
159 kfree(data);
158 } 160 }
159 return retval; 161 return retval;
160 } 162 }
@@ -163,6 +165,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
163 default: 165 default:
164 dev_err(&serial->dev->dev, 166 dev_err(&serial->dev->dev,
165 "unknown number of interfaces: %d\n", nintf); 167 "unknown number of interfaces: %d\n", nintf);
168 kfree(data);
166 return -ENODEV; 169 return -ENODEV;
167 } 170 }
168 171
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 76e7dac6f259..70b1d9d51c96 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -40,7 +40,7 @@ static int vram;
40static int vt_switch; 40static int vt_switch;
41 41
42/* Modes relevant to the GX (taken from modedb.c) */ 42/* Modes relevant to the GX (taken from modedb.c) */
43static struct fb_videomode gx_modedb[] __initdata = { 43static struct fb_videomode gx_modedb[] __devinitdata = {
44 /* 640x480-60 VESA */ 44 /* 640x480-60 VESA */
45 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, 45 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
46 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, 46 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
@@ -110,14 +110,15 @@ static struct fb_videomode gx_modedb[] __initdata = {
110#ifdef CONFIG_OLPC 110#ifdef CONFIG_OLPC
111#include <asm/olpc.h> 111#include <asm/olpc.h>
112 112
113static struct fb_videomode gx_dcon_modedb[] __initdata = { 113static struct fb_videomode gx_dcon_modedb[] __devinitdata = {
114 /* The only mode the DCON has is 1200x900 */ 114 /* The only mode the DCON has is 1200x900 */
115 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, 115 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
116 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 116 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
117 FB_VMODE_NONINTERLACED, 0 } 117 FB_VMODE_NONINTERLACED, 0 }
118}; 118};
119 119
120static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) 120static void __devinit get_modedb(struct fb_videomode **modedb,
121 unsigned int *size)
121{ 122{
122 if (olpc_has_dcon()) { 123 if (olpc_has_dcon()) {
123 *modedb = (struct fb_videomode *) gx_dcon_modedb; 124 *modedb = (struct fb_videomode *) gx_dcon_modedb;
@@ -129,7 +130,8 @@ static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
129} 130}
130 131
131#else 132#else
132static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) 133static void __devinit get_modedb(struct fb_videomode **modedb,
134 unsigned int *size)
133{ 135{
134 *modedb = (struct fb_videomode *) gx_modedb; 136 *modedb = (struct fb_videomode *) gx_modedb;
135 *size = ARRAY_SIZE(gx_modedb); 137 *size = ARRAY_SIZE(gx_modedb);
@@ -226,7 +228,8 @@ static int gxfb_blank(int blank_mode, struct fb_info *info)
226 return gx_blank_display(info, blank_mode); 228 return gx_blank_display(info, blank_mode);
227} 229}
228 230
229static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev) 231static int __devinit gxfb_map_video_memory(struct fb_info *info,
232 struct pci_dev *dev)
230{ 233{
231 struct gxfb_par *par = info->par; 234 struct gxfb_par *par = info->par;
232 int ret; 235 int ret;
@@ -290,7 +293,7 @@ static struct fb_ops gxfb_ops = {
290 .fb_imageblit = cfb_imageblit, 293 .fb_imageblit = cfb_imageblit,
291}; 294};
292 295
293static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) 296static struct fb_info *__devinit gxfb_init_fbinfo(struct device *dev)
294{ 297{
295 struct gxfb_par *par; 298 struct gxfb_par *par;
296 struct fb_info *info; 299 struct fb_info *info;
@@ -371,7 +374,8 @@ static int gxfb_resume(struct pci_dev *pdev)
371} 374}
372#endif 375#endif
373 376
374static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) 377static int __devinit gxfb_probe(struct pci_dev *pdev,
378 const struct pci_device_id *id)
375{ 379{
376 struct gxfb_par *par; 380 struct gxfb_par *par;
377 struct fb_info *info; 381 struct fb_info *info;
@@ -451,7 +455,7 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
451 return ret; 455 return ret;
452} 456}
453 457
454static void gxfb_remove(struct pci_dev *pdev) 458static void __devexit gxfb_remove(struct pci_dev *pdev)
455{ 459{
456 struct fb_info *info = pci_get_drvdata(pdev); 460 struct fb_info *info = pci_get_drvdata(pdev);
457 struct gxfb_par *par = info->par; 461 struct gxfb_par *par = info->par;
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
index 1a18da86d3fa..39bdbedf43b4 100644
--- a/drivers/video/geode/lxfb_core.c
+++ b/drivers/video/geode/lxfb_core.c
@@ -35,7 +35,7 @@ static int vt_switch;
35 * we try to make it something sane - 640x480-60 is sane 35 * we try to make it something sane - 640x480-60 is sane
36 */ 36 */
37 37
38static struct fb_videomode geode_modedb[] __initdata = { 38static struct fb_videomode geode_modedb[] __devinitdata = {
39 /* 640x480-60 */ 39 /* 640x480-60 */
40 { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, 40 { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2,
41 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 41 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
@@ -219,14 +219,15 @@ static struct fb_videomode geode_modedb[] __initdata = {
219#ifdef CONFIG_OLPC 219#ifdef CONFIG_OLPC
220#include <asm/olpc.h> 220#include <asm/olpc.h>
221 221
222static struct fb_videomode olpc_dcon_modedb[] __initdata = { 222static struct fb_videomode olpc_dcon_modedb[] __devinitdata = {
223 /* The only mode the DCON has is 1200x900 */ 223 /* The only mode the DCON has is 1200x900 */
224 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, 224 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
225 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 225 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
226 FB_VMODE_NONINTERLACED, 0 } 226 FB_VMODE_NONINTERLACED, 0 }
227}; 227};
228 228
229static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) 229static void __devinit get_modedb(struct fb_videomode **modedb,
230 unsigned int *size)
230{ 231{
231 if (olpc_has_dcon()) { 232 if (olpc_has_dcon()) {
232 *modedb = (struct fb_videomode *) olpc_dcon_modedb; 233 *modedb = (struct fb_videomode *) olpc_dcon_modedb;
@@ -238,7 +239,8 @@ static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size)
238} 239}
239 240
240#else 241#else
241static void __init get_modedb(struct fb_videomode **modedb, unsigned int *size) 242static void __devinit get_modedb(struct fb_videomode **modedb,
243 unsigned int *size)
242{ 244{
243 *modedb = (struct fb_videomode *) geode_modedb; 245 *modedb = (struct fb_videomode *) geode_modedb;
244 *size = ARRAY_SIZE(geode_modedb); 246 *size = ARRAY_SIZE(geode_modedb);
@@ -334,7 +336,7 @@ static int lxfb_blank(int blank_mode, struct fb_info *info)
334} 336}
335 337
336 338
337static int __init lxfb_map_video_memory(struct fb_info *info, 339static int __devinit lxfb_map_video_memory(struct fb_info *info,
338 struct pci_dev *dev) 340 struct pci_dev *dev)
339{ 341{
340 struct lxfb_par *par = info->par; 342 struct lxfb_par *par = info->par;
@@ -412,7 +414,7 @@ static struct fb_ops lxfb_ops = {
412 .fb_imageblit = cfb_imageblit, 414 .fb_imageblit = cfb_imageblit,
413}; 415};
414 416
415static struct fb_info * __init lxfb_init_fbinfo(struct device *dev) 417static struct fb_info * __devinit lxfb_init_fbinfo(struct device *dev)
416{ 418{
417 struct lxfb_par *par; 419 struct lxfb_par *par;
418 struct fb_info *info; 420 struct fb_info *info;
@@ -496,7 +498,7 @@ static int lxfb_resume(struct pci_dev *pdev)
496#define lxfb_resume NULL 498#define lxfb_resume NULL
497#endif 499#endif
498 500
499static int __init lxfb_probe(struct pci_dev *pdev, 501static int __devinit lxfb_probe(struct pci_dev *pdev,
500 const struct pci_device_id *id) 502 const struct pci_device_id *id)
501{ 503{
502 struct lxfb_par *par; 504 struct lxfb_par *par;
@@ -588,7 +590,7 @@ err:
588 return ret; 590 return ret;
589} 591}
590 592
591static void lxfb_remove(struct pci_dev *pdev) 593static void __devexit lxfb_remove(struct pci_dev *pdev)
592{ 594{
593 struct fb_info *info = pci_get_drvdata(pdev); 595 struct fb_info *info = pci_get_drvdata(pdev);
594 struct lxfb_par *par = info->par; 596 struct lxfb_par *par = info->par;
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c
index d4cde79ea15e..81687ed26ba9 100644
--- a/drivers/video/nuc900fb.c
+++ b/drivers/video/nuc900fb.c
@@ -596,8 +596,6 @@ static int __devinit nuc900fb_probe(struct platform_device *pdev)
596 goto release_regs; 596 goto release_regs;
597 } 597 }
598 598
599 nuc900_driver_clksrc_div(&pdev->dev, "ext", 0x2);
600
601 fbi->clk = clk_get(&pdev->dev, NULL); 599 fbi->clk = clk_get(&pdev->dev, NULL);
602 if (!fbi->clk || IS_ERR(fbi->clk)) { 600 if (!fbi->clk || IS_ERR(fbi->clk)) {
603 printk(KERN_ERR "nuc900-lcd:failed to get lcd clock source\n"); 601 printk(KERN_ERR "nuc900-lcd:failed to get lcd clock source\n");