aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/power/clock_ops.c75
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c22
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h3
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c88
-rw-r--r--drivers/hwmon/coretemp.c193
-rw-r--r--drivers/hwmon/ds620.c2
-rw-r--r--drivers/hwmon/w83791d.c4
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c10
-rw-r--r--drivers/net/bnx2x/bnx2x_dcb.c1
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c16
-rw-r--r--drivers/net/bnx2x/bnx2x_reg.h12
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c23
-rw-r--r--drivers/net/cxgb3/l2t.c15
-rw-r--r--drivers/net/cxgb3/l2t.h16
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c10
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-core.c4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-hcmd.c2
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-tx.c4
-rw-r--r--drivers/net/wireless/iwlegacy/iwl3945-base.c8
-rw-r--r--drivers/net/wireless/iwlegacy/iwl4965-base.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c30
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c1
-rw-r--r--drivers/scsi/3w-9xxx.c2
-rw-r--r--drivers/scsi/Makefile2
-rw-r--r--drivers/scsi/aacraid/commsup.c2
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c2
-rw-r--r--drivers/scsi/libsas/sas_expander.c2
29 files changed, 250 insertions, 315 deletions
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 2c18d584066d..b97294e2d95b 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -42,6 +42,22 @@ static struct pm_clk_data *__to_pcd(struct device *dev)
42} 42}
43 43
44/** 44/**
45 * pm_clk_acquire - Acquire a device clock.
46 * @dev: Device whose clock is to be acquired.
47 * @ce: PM clock entry corresponding to the clock.
48 */
49static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
50{
51 ce->clk = clk_get(dev, ce->con_id);
52 if (IS_ERR(ce->clk)) {
53 ce->status = PCE_STATUS_ERROR;
54 } else {
55 ce->status = PCE_STATUS_ACQUIRED;
56 dev_dbg(dev, "Clock %s managed by runtime PM.\n", ce->con_id);
57 }
58}
59
60/**
45 * pm_clk_add - Start using a device clock for power management. 61 * pm_clk_add - Start using a device clock for power management.
46 * @dev: Device whose clock is going to be used for power management. 62 * @dev: Device whose clock is going to be used for power management.
47 * @con_id: Connection ID of the clock. 63 * @con_id: Connection ID of the clock.
@@ -73,6 +89,8 @@ int pm_clk_add(struct device *dev, const char *con_id)
73 } 89 }
74 } 90 }
75 91
92 pm_clk_acquire(dev, ce);
93
76 spin_lock_irq(&pcd->lock); 94 spin_lock_irq(&pcd->lock);
77 list_add_tail(&ce->node, &pcd->clock_list); 95 list_add_tail(&ce->node, &pcd->clock_list);
78 spin_unlock_irq(&pcd->lock); 96 spin_unlock_irq(&pcd->lock);
@@ -82,17 +100,12 @@ int pm_clk_add(struct device *dev, const char *con_id)
82/** 100/**
83 * __pm_clk_remove - Destroy PM clock entry. 101 * __pm_clk_remove - Destroy PM clock entry.
84 * @ce: PM clock entry to destroy. 102 * @ce: PM clock entry to destroy.
85 *
86 * This routine must be called under the spinlock protecting the PM list of
87 * clocks corresponding the the @ce's device.
88 */ 103 */
89static void __pm_clk_remove(struct pm_clock_entry *ce) 104static void __pm_clk_remove(struct pm_clock_entry *ce)
90{ 105{
91 if (!ce) 106 if (!ce)
92 return; 107 return;
93 108
94 list_del(&ce->node);
95
96 if (ce->status < PCE_STATUS_ERROR) { 109 if (ce->status < PCE_STATUS_ERROR) {
97 if (ce->status == PCE_STATUS_ENABLED) 110 if (ce->status == PCE_STATUS_ENABLED)
98 clk_disable(ce->clk); 111 clk_disable(ce->clk);
@@ -126,18 +139,22 @@ void pm_clk_remove(struct device *dev, const char *con_id)
126 spin_lock_irq(&pcd->lock); 139 spin_lock_irq(&pcd->lock);
127 140
128 list_for_each_entry(ce, &pcd->clock_list, node) { 141 list_for_each_entry(ce, &pcd->clock_list, node) {
129 if (!con_id && !ce->con_id) { 142 if (!con_id && !ce->con_id)
130 __pm_clk_remove(ce); 143 goto remove;
131 break; 144 else if (!con_id || !ce->con_id)
132 } else if (!con_id || !ce->con_id) {
133 continue; 145 continue;
134 } else if (!strcmp(con_id, ce->con_id)) { 146 else if (!strcmp(con_id, ce->con_id))
135 __pm_clk_remove(ce); 147 goto remove;
136 break;
137 }
138 } 148 }
139 149
140 spin_unlock_irq(&pcd->lock); 150 spin_unlock_irq(&pcd->lock);
151 return;
152
153 remove:
154 list_del(&ce->node);
155 spin_unlock_irq(&pcd->lock);
156
157 __pm_clk_remove(ce);
141} 158}
142 159
143/** 160/**
@@ -175,20 +192,27 @@ void pm_clk_destroy(struct device *dev)
175{ 192{
176 struct pm_clk_data *pcd = __to_pcd(dev); 193 struct pm_clk_data *pcd = __to_pcd(dev);
177 struct pm_clock_entry *ce, *c; 194 struct pm_clock_entry *ce, *c;
195 struct list_head list;
178 196
179 if (!pcd) 197 if (!pcd)
180 return; 198 return;
181 199
182 dev->power.subsys_data = NULL; 200 dev->power.subsys_data = NULL;
201 INIT_LIST_HEAD(&list);
183 202
184 spin_lock_irq(&pcd->lock); 203 spin_lock_irq(&pcd->lock);
185 204
186 list_for_each_entry_safe_reverse(ce, c, &pcd->clock_list, node) 205 list_for_each_entry_safe_reverse(ce, c, &pcd->clock_list, node)
187 __pm_clk_remove(ce); 206 list_move(&ce->node, &list);
188 207
189 spin_unlock_irq(&pcd->lock); 208 spin_unlock_irq(&pcd->lock);
190 209
191 kfree(pcd); 210 kfree(pcd);
211
212 list_for_each_entry_safe_reverse(ce, c, &list, node) {
213 list_del(&ce->node);
214 __pm_clk_remove(ce);
215 }
192} 216}
193 217
194#endif /* CONFIG_PM */ 218#endif /* CONFIG_PM */
@@ -196,23 +220,6 @@ void pm_clk_destroy(struct device *dev)
196#ifdef CONFIG_PM_RUNTIME 220#ifdef CONFIG_PM_RUNTIME
197 221
198/** 222/**
199 * pm_clk_acquire - Acquire a device clock.
200 * @dev: Device whose clock is to be acquired.
201 * @con_id: Connection ID of the clock.
202 */
203static void pm_clk_acquire(struct device *dev,
204 struct pm_clock_entry *ce)
205{
206 ce->clk = clk_get(dev, ce->con_id);
207 if (IS_ERR(ce->clk)) {
208 ce->status = PCE_STATUS_ERROR;
209 } else {
210 ce->status = PCE_STATUS_ACQUIRED;
211 dev_dbg(dev, "Clock %s managed by runtime PM.\n", ce->con_id);
212 }
213}
214
215/**
216 * pm_clk_suspend - Disable clocks in a device's PM clock list. 223 * pm_clk_suspend - Disable clocks in a device's PM clock list.
217 * @dev: Device to disable the clocks for. 224 * @dev: Device to disable the clocks for.
218 */ 225 */
@@ -230,9 +237,6 @@ int pm_clk_suspend(struct device *dev)
230 spin_lock_irqsave(&pcd->lock, flags); 237 spin_lock_irqsave(&pcd->lock, flags);
231 238
232 list_for_each_entry_reverse(ce, &pcd->clock_list, node) { 239 list_for_each_entry_reverse(ce, &pcd->clock_list, node) {
233 if (ce->status == PCE_STATUS_NONE)
234 pm_clk_acquire(dev, ce);
235
236 if (ce->status < PCE_STATUS_ERROR) { 240 if (ce->status < PCE_STATUS_ERROR) {
237 clk_disable(ce->clk); 241 clk_disable(ce->clk);
238 ce->status = PCE_STATUS_ACQUIRED; 242 ce->status = PCE_STATUS_ACQUIRED;
@@ -262,9 +266,6 @@ int pm_clk_resume(struct device *dev)
262 spin_lock_irqsave(&pcd->lock, flags); 266 spin_lock_irqsave(&pcd->lock, flags);
263 267
264 list_for_each_entry(ce, &pcd->clock_list, node) { 268 list_for_each_entry(ce, &pcd->clock_list, node) {
265 if (ce->status == PCE_STATUS_NONE)
266 pm_clk_acquire(dev, ce);
267
268 if (ce->status < PCE_STATUS_ERROR) { 269 if (ce->status < PCE_STATUS_ERROR) {
269 clk_enable(ce->clk); 270 clk_enable(ce->clk);
270 ce->status = PCE_STATUS_ENABLED; 271 ce->status = PCE_STATUS_ENABLED;
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index ce045a8cf82c..f07e4252b708 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -67,11 +67,11 @@ module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
67MODULE_PARM_DESC(i915_enable_rc6, 67MODULE_PARM_DESC(i915_enable_rc6,
68 "Enable power-saving render C-state 6 (default: true)"); 68 "Enable power-saving render C-state 6 (default: true)");
69 69
70unsigned int i915_enable_fbc __read_mostly = 1; 70unsigned int i915_enable_fbc __read_mostly = -1;
71module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); 71module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600);
72MODULE_PARM_DESC(i915_enable_fbc, 72MODULE_PARM_DESC(i915_enable_fbc,
73 "Enable frame buffer compression for power savings " 73 "Enable frame buffer compression for power savings "
74 "(default: false)"); 74 "(default: -1 (use per-chip default))");
75 75
76unsigned int i915_lvds_downclock __read_mostly = 0; 76unsigned int i915_lvds_downclock __read_mostly = 0;
77module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); 77module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 56a8554d9039..04411ad2e779 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1799,6 +1799,7 @@ static void intel_update_fbc(struct drm_device *dev)
1799 struct drm_framebuffer *fb; 1799 struct drm_framebuffer *fb;
1800 struct intel_framebuffer *intel_fb; 1800 struct intel_framebuffer *intel_fb;
1801 struct drm_i915_gem_object *obj; 1801 struct drm_i915_gem_object *obj;
1802 int enable_fbc;
1802 1803
1803 DRM_DEBUG_KMS("\n"); 1804 DRM_DEBUG_KMS("\n");
1804 1805
@@ -1839,8 +1840,15 @@ static void intel_update_fbc(struct drm_device *dev)
1839 intel_fb = to_intel_framebuffer(fb); 1840 intel_fb = to_intel_framebuffer(fb);
1840 obj = intel_fb->obj; 1841 obj = intel_fb->obj;
1841 1842
1842 if (!i915_enable_fbc) { 1843 enable_fbc = i915_enable_fbc;
1843 DRM_DEBUG_KMS("fbc disabled per module param (default off)\n"); 1844 if (enable_fbc < 0) {
1845 DRM_DEBUG_KMS("fbc set to per-chip default\n");
1846 enable_fbc = 1;
1847 if (INTEL_INFO(dev)->gen <= 5)
1848 enable_fbc = 0;
1849 }
1850 if (!enable_fbc) {
1851 DRM_DEBUG_KMS("fbc disabled per module param\n");
1844 dev_priv->no_fbc_reason = FBC_MODULE_PARAM; 1852 dev_priv->no_fbc_reason = FBC_MODULE_PARAM;
1845 goto out_disable; 1853 goto out_disable;
1846 } 1854 }
@@ -4687,13 +4695,13 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
4687 bpc = 6; /* min is 18bpp */ 4695 bpc = 6; /* min is 18bpp */
4688 break; 4696 break;
4689 case 24: 4697 case 24:
4690 bpc = min((unsigned int)8, display_bpc); 4698 bpc = 8;
4691 break; 4699 break;
4692 case 30: 4700 case 30:
4693 bpc = min((unsigned int)10, display_bpc); 4701 bpc = 10;
4694 break; 4702 break;
4695 case 48: 4703 case 48:
4696 bpc = min((unsigned int)12, display_bpc); 4704 bpc = 12;
4697 break; 4705 break;
4698 default: 4706 default:
4699 DRM_DEBUG("unsupported depth, assuming 24 bits\n"); 4707 DRM_DEBUG("unsupported depth, assuming 24 bits\n");
@@ -4701,10 +4709,12 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
4701 break; 4709 break;
4702 } 4710 }
4703 4711
4712 display_bpc = min(display_bpc, bpc);
4713
4704 DRM_DEBUG_DRIVER("setting pipe bpc to %d (max display bpc %d)\n", 4714 DRM_DEBUG_DRIVER("setting pipe bpc to %d (max display bpc %d)\n",
4705 bpc, display_bpc); 4715 bpc, display_bpc);
4706 4716
4707 *pipe_bpp = bpc * 3; 4717 *pipe_bpp = display_bpc * 3;
4708 4718
4709 return display_bpc != bpc; 4719 return display_bpc != bpc;
4710} 4720}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 0b2ee9d39980..fe1099d8817e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -337,9 +337,6 @@ extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,
337 struct drm_connector *connector, 337 struct drm_connector *connector,
338 struct intel_load_detect_pipe *old); 338 struct intel_load_detect_pipe *old);
339 339
340extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB);
341extern int intel_sdvo_supports_hotplug(struct drm_connector *connector);
342extern void intel_sdvo_set_hotplug(struct drm_connector *connector, int enable);
343extern void intelfb_restore(void); 340extern void intelfb_restore(void);
344extern void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 341extern void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
345 u16 blue, int regno); 342 u16 blue, int regno);
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 30fe554d8936..6348c499616f 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -92,6 +92,11 @@ struct intel_sdvo {
92 */ 92 */
93 uint16_t attached_output; 93 uint16_t attached_output;
94 94
95 /*
96 * Hotplug activation bits for this device
97 */
98 uint8_t hotplug_active[2];
99
95 /** 100 /**
96 * This is used to select the color range of RBG outputs in HDMI mode. 101 * This is used to select the color range of RBG outputs in HDMI mode.
97 * It is only valid when using TMDS encoding and 8 bit per color mode. 102 * It is only valid when using TMDS encoding and 8 bit per color mode.
@@ -1208,74 +1213,20 @@ static bool intel_sdvo_get_capabilities(struct intel_sdvo *intel_sdvo, struct in
1208 return true; 1213 return true;
1209} 1214}
1210 1215
1211/* No use! */ 1216static int intel_sdvo_supports_hotplug(struct intel_sdvo *intel_sdvo)
1212#if 0
1213struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB)
1214{
1215 struct drm_connector *connector = NULL;
1216 struct intel_sdvo *iout = NULL;
1217 struct intel_sdvo *sdvo;
1218
1219 /* find the sdvo connector */
1220 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
1221 iout = to_intel_sdvo(connector);
1222
1223 if (iout->type != INTEL_OUTPUT_SDVO)
1224 continue;
1225
1226 sdvo = iout->dev_priv;
1227
1228 if (sdvo->sdvo_reg == SDVOB && sdvoB)
1229 return connector;
1230
1231 if (sdvo->sdvo_reg == SDVOC && !sdvoB)
1232 return connector;
1233
1234 }
1235
1236 return NULL;
1237}
1238
1239int intel_sdvo_supports_hotplug(struct drm_connector *connector)
1240{ 1217{
1241 u8 response[2]; 1218 u8 response[2];
1242 u8 status;
1243 struct intel_sdvo *intel_sdvo;
1244 DRM_DEBUG_KMS("\n");
1245
1246 if (!connector)
1247 return 0;
1248
1249 intel_sdvo = to_intel_sdvo(connector);
1250 1219
1251 return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, 1220 return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT,
1252 &response, 2) && response[0]; 1221 &response, 2) && response[0];
1253} 1222}
1254 1223
1255void intel_sdvo_set_hotplug(struct drm_connector *connector, int on) 1224static void intel_sdvo_enable_hotplug(struct intel_encoder *encoder)
1256{ 1225{
1257 u8 response[2]; 1226 struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base);
1258 u8 status;
1259 struct intel_sdvo *intel_sdvo = to_intel_sdvo(connector);
1260
1261 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0);
1262 intel_sdvo_read_response(intel_sdvo, &response, 2);
1263
1264 if (on) {
1265 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, 0);
1266 status = intel_sdvo_read_response(intel_sdvo, &response, 2);
1267
1268 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, 2);
1269 } else {
1270 response[0] = 0;
1271 response[1] = 0;
1272 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, 2);
1273 }
1274 1227
1275 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0); 1228 intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &intel_sdvo->hotplug_active, 2);
1276 intel_sdvo_read_response(intel_sdvo, &response, 2);
1277} 1229}
1278#endif
1279 1230
1280static bool 1231static bool
1281intel_sdvo_multifunc_encoder(struct intel_sdvo *intel_sdvo) 1232intel_sdvo_multifunc_encoder(struct intel_sdvo *intel_sdvo)
@@ -2045,6 +1996,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2045{ 1996{
2046 struct drm_encoder *encoder = &intel_sdvo->base.base; 1997 struct drm_encoder *encoder = &intel_sdvo->base.base;
2047 struct drm_connector *connector; 1998 struct drm_connector *connector;
1999 struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
2048 struct intel_connector *intel_connector; 2000 struct intel_connector *intel_connector;
2049 struct intel_sdvo_connector *intel_sdvo_connector; 2001 struct intel_sdvo_connector *intel_sdvo_connector;
2050 2002
@@ -2062,7 +2014,17 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2062 2014
2063 intel_connector = &intel_sdvo_connector->base; 2015 intel_connector = &intel_sdvo_connector->base;
2064 connector = &intel_connector->base; 2016 connector = &intel_connector->base;
2065 connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; 2017 if (intel_sdvo_supports_hotplug(intel_sdvo) & (1 << device)) {
2018 connector->polled = DRM_CONNECTOR_POLL_HPD;
2019 intel_sdvo->hotplug_active[0] |= 1 << device;
2020 /* Some SDVO devices have one-shot hotplug interrupts.
2021 * Ensure that they get re-enabled when an interrupt happens.
2022 */
2023 intel_encoder->hot_plug = intel_sdvo_enable_hotplug;
2024 intel_sdvo_enable_hotplug(intel_encoder);
2025 }
2026 else
2027 connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
2066 encoder->encoder_type = DRM_MODE_ENCODER_TMDS; 2028 encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
2067 connector->connector_type = DRM_MODE_CONNECTOR_DVID; 2029 connector->connector_type = DRM_MODE_CONNECTOR_DVID;
2068 2030
@@ -2569,6 +2531,14 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2569 if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps)) 2531 if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps))
2570 goto err; 2532 goto err;
2571 2533
2534 /* Set up hotplug command - note paranoia about contents of reply.
2535 * We assume that the hardware is in a sane state, and only touch
2536 * the bits we think we understand.
2537 */
2538 intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ACTIVE_HOT_PLUG,
2539 &intel_sdvo->hotplug_active, 2);
2540 intel_sdvo->hotplug_active[0] &= ~0x3;
2541
2572 if (intel_sdvo_output_setup(intel_sdvo, 2542 if (intel_sdvo_output_setup(intel_sdvo,
2573 intel_sdvo->caps.output_flags) != true) { 2543 intel_sdvo->caps.output_flags) != true) {
2574 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", 2544 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n",
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 411257676133..44b23917d4cc 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -36,17 +36,25 @@
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/smp.h> 38#include <linux/smp.h>
39#include <linux/moduleparam.h>
39#include <asm/msr.h> 40#include <asm/msr.h>
40#include <asm/processor.h> 41#include <asm/processor.h>
41 42
42#define DRVNAME "coretemp" 43#define DRVNAME "coretemp"
43 44
45/*
46 * force_tjmax only matters when TjMax can't be read from the CPU itself.
47 * When set, it replaces the driver's suboptimal heuristic.
48 */
49static int force_tjmax;
50module_param_named(tjmax, force_tjmax, int, 0444);
51MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
52
44#define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ 53#define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */
45#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ 54#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */
46#define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ 55#define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */
47#define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ 56#define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */
48#define MAX_THRESH_ATTRS 3 /* Maximum no of Threshold attrs */ 57#define TOTAL_ATTRS (MAX_CORE_ATTRS + 1)
49#define TOTAL_ATTRS (MAX_CORE_ATTRS + MAX_THRESH_ATTRS)
50#define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) 58#define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO)
51 59
52#ifdef CONFIG_SMP 60#ifdef CONFIG_SMP
@@ -69,8 +77,6 @@
69 * This value is passed as "id" field to rdmsr/wrmsr functions. 77 * This value is passed as "id" field to rdmsr/wrmsr functions.
70 * @status_reg: One of IA32_THERM_STATUS or IA32_PACKAGE_THERM_STATUS, 78 * @status_reg: One of IA32_THERM_STATUS or IA32_PACKAGE_THERM_STATUS,
71 * from where the temperature values should be read. 79 * from where the temperature values should be read.
72 * @intrpt_reg: One of IA32_THERM_INTERRUPT or IA32_PACKAGE_THERM_INTERRUPT,
73 * from where the thresholds are read.
74 * @attr_size: Total number of pre-core attrs displayed in the sysfs. 80 * @attr_size: Total number of pre-core attrs displayed in the sysfs.
75 * @is_pkg_data: If this is 1, the temp_data holds pkgtemp data. 81 * @is_pkg_data: If this is 1, the temp_data holds pkgtemp data.
76 * Otherwise, temp_data holds coretemp data. 82 * Otherwise, temp_data holds coretemp data.
@@ -79,13 +85,11 @@
79struct temp_data { 85struct temp_data {
80 int temp; 86 int temp;
81 int ttarget; 87 int ttarget;
82 int tmin;
83 int tjmax; 88 int tjmax;
84 unsigned long last_updated; 89 unsigned long last_updated;
85 unsigned int cpu; 90 unsigned int cpu;
86 u32 cpu_core_id; 91 u32 cpu_core_id;
87 u32 status_reg; 92 u32 status_reg;
88 u32 intrpt_reg;
89 int attr_size; 93 int attr_size;
90 bool is_pkg_data; 94 bool is_pkg_data;
91 bool valid; 95 bool valid;
@@ -143,19 +147,6 @@ static ssize_t show_crit_alarm(struct device *dev,
143 return sprintf(buf, "%d\n", (eax >> 5) & 1); 147 return sprintf(buf, "%d\n", (eax >> 5) & 1);
144} 148}
145 149
146static ssize_t show_max_alarm(struct device *dev,
147 struct device_attribute *devattr, char *buf)
148{
149 u32 eax, edx;
150 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
151 struct platform_data *pdata = dev_get_drvdata(dev);
152 struct temp_data *tdata = pdata->core_data[attr->index];
153
154 rdmsr_on_cpu(tdata->cpu, tdata->status_reg, &eax, &edx);
155
156 return sprintf(buf, "%d\n", !!(eax & THERM_STATUS_THRESHOLD1));
157}
158
159static ssize_t show_tjmax(struct device *dev, 150static ssize_t show_tjmax(struct device *dev,
160 struct device_attribute *devattr, char *buf) 151 struct device_attribute *devattr, char *buf)
161{ 152{
@@ -174,83 +165,6 @@ static ssize_t show_ttarget(struct device *dev,
174 return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget); 165 return sprintf(buf, "%d\n", pdata->core_data[attr->index]->ttarget);
175} 166}
176 167
177static ssize_t store_ttarget(struct device *dev,
178 struct device_attribute *devattr,
179 const char *buf, size_t count)
180{
181 struct platform_data *pdata = dev_get_drvdata(dev);
182 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
183 struct temp_data *tdata = pdata->core_data[attr->index];
184 u32 eax, edx;
185 unsigned long val;
186 int diff;
187
188 if (strict_strtoul(buf, 10, &val))
189 return -EINVAL;
190
191 /*
192 * THERM_MASK_THRESHOLD1 is 7 bits wide. Values are entered in terms
193 * of milli degree celsius. Hence don't accept val > (127 * 1000)
194 */
195 if (val > tdata->tjmax || val > 127000)
196 return -EINVAL;
197
198 diff = (tdata->tjmax - val) / 1000;
199
200 mutex_lock(&tdata->update_lock);
201 rdmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, &eax, &edx);
202 eax = (eax & ~THERM_MASK_THRESHOLD1) |
203 (diff << THERM_SHIFT_THRESHOLD1);
204 wrmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, eax, edx);
205 tdata->ttarget = val;
206 mutex_unlock(&tdata->update_lock);
207
208 return count;
209}
210
211static ssize_t show_tmin(struct device *dev,
212 struct device_attribute *devattr, char *buf)
213{
214 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
215 struct platform_data *pdata = dev_get_drvdata(dev);
216
217 return sprintf(buf, "%d\n", pdata->core_data[attr->index]->tmin);
218}
219
220static ssize_t store_tmin(struct device *dev,
221 struct device_attribute *devattr,
222 const char *buf, size_t count)
223{
224 struct platform_data *pdata = dev_get_drvdata(dev);
225 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
226 struct temp_data *tdata = pdata->core_data[attr->index];
227 u32 eax, edx;
228 unsigned long val;
229 int diff;
230
231 if (strict_strtoul(buf, 10, &val))
232 return -EINVAL;
233
234 /*
235 * THERM_MASK_THRESHOLD0 is 7 bits wide. Values are entered in terms
236 * of milli degree celsius. Hence don't accept val > (127 * 1000)
237 */
238 if (val > tdata->tjmax || val > 127000)
239 return -EINVAL;
240
241 diff = (tdata->tjmax - val) / 1000;
242
243 mutex_lock(&tdata->update_lock);
244 rdmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, &eax, &edx);
245 eax = (eax & ~THERM_MASK_THRESHOLD0) |
246 (diff << THERM_SHIFT_THRESHOLD0);
247 wrmsr_on_cpu(tdata->cpu, tdata->intrpt_reg, eax, edx);
248 tdata->tmin = val;
249 mutex_unlock(&tdata->update_lock);
250
251 return count;
252}
253
254static ssize_t show_temp(struct device *dev, 168static ssize_t show_temp(struct device *dev,
255 struct device_attribute *devattr, char *buf) 169 struct device_attribute *devattr, char *buf)
256{ 170{
@@ -374,7 +288,6 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
374 288
375static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) 289static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
376{ 290{
377 /* The 100C is default for both mobile and non mobile CPUs */
378 int err; 291 int err;
379 u32 eax, edx; 292 u32 eax, edx;
380 u32 val; 293 u32 val;
@@ -385,7 +298,8 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
385 */ 298 */
386 err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); 299 err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
387 if (err) { 300 if (err) {
388 dev_warn(dev, "Unable to read TjMax from CPU.\n"); 301 if (c->x86_model > 0xe && c->x86_model != 0x1c)
302 dev_warn(dev, "Unable to read TjMax from CPU %u\n", id);
389 } else { 303 } else {
390 val = (eax >> 16) & 0xff; 304 val = (eax >> 16) & 0xff;
391 /* 305 /*
@@ -393,11 +307,17 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
393 * will be used 307 * will be used
394 */ 308 */
395 if (val) { 309 if (val) {
396 dev_info(dev, "TjMax is %d C.\n", val); 310 dev_dbg(dev, "TjMax is %d degrees C\n", val);
397 return val * 1000; 311 return val * 1000;
398 } 312 }
399 } 313 }
400 314
315 if (force_tjmax) {
316 dev_notice(dev, "TjMax forced to %d degrees C by user\n",
317 force_tjmax);
318 return force_tjmax * 1000;
319 }
320
401 /* 321 /*
402 * An assumption is made for early CPUs and unreadable MSR. 322 * An assumption is made for early CPUs and unreadable MSR.
403 * NOTE: the calculated value may not be correct. 323 * NOTE: the calculated value may not be correct.
@@ -414,21 +334,6 @@ static void __devinit get_ucode_rev_on_cpu(void *edx)
414 rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx); 334 rdmsr(MSR_IA32_UCODE_REV, eax, *(u32 *)edx);
415} 335}
416 336
417static int get_pkg_tjmax(unsigned int cpu, struct device *dev)
418{
419 int err;
420 u32 eax, edx, val;
421
422 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
423 if (!err) {
424 val = (eax >> 16) & 0xff;
425 if (val)
426 return val * 1000;
427 }
428 dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu);
429 return 100000; /* Default TjMax: 100 degree celsius */
430}
431
432static int create_name_attr(struct platform_data *pdata, struct device *dev) 337static int create_name_attr(struct platform_data *pdata, struct device *dev)
433{ 338{
434 sysfs_attr_init(&pdata->name_attr.attr); 339 sysfs_attr_init(&pdata->name_attr.attr);
@@ -442,19 +347,14 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev,
442 int attr_no) 347 int attr_no)
443{ 348{
444 int err, i; 349 int err, i;
445 static ssize_t (*rd_ptr[TOTAL_ATTRS]) (struct device *dev, 350 static ssize_t (*const rd_ptr[TOTAL_ATTRS]) (struct device *dev,
446 struct device_attribute *devattr, char *buf) = { 351 struct device_attribute *devattr, char *buf) = {
447 show_label, show_crit_alarm, show_temp, show_tjmax, 352 show_label, show_crit_alarm, show_temp, show_tjmax,
448 show_max_alarm, show_ttarget, show_tmin }; 353 show_ttarget };
449 static ssize_t (*rw_ptr[TOTAL_ATTRS]) (struct device *dev, 354 static const char *const names[TOTAL_ATTRS] = {
450 struct device_attribute *devattr, const char *buf,
451 size_t count) = { NULL, NULL, NULL, NULL, NULL,
452 store_ttarget, store_tmin };
453 static const char *names[TOTAL_ATTRS] = {
454 "temp%d_label", "temp%d_crit_alarm", 355 "temp%d_label", "temp%d_crit_alarm",
455 "temp%d_input", "temp%d_crit", 356 "temp%d_input", "temp%d_crit",
456 "temp%d_max_alarm", "temp%d_max", 357 "temp%d_max" };
457 "temp%d_max_hyst" };
458 358
459 for (i = 0; i < tdata->attr_size; i++) { 359 for (i = 0; i < tdata->attr_size; i++) {
460 snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i], 360 snprintf(tdata->attr_name[i], CORETEMP_NAME_LENGTH, names[i],
@@ -462,10 +362,6 @@ static int create_core_attrs(struct temp_data *tdata, struct device *dev,
462 sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr); 362 sysfs_attr_init(&tdata->sd_attrs[i].dev_attr.attr);
463 tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i]; 363 tdata->sd_attrs[i].dev_attr.attr.name = tdata->attr_name[i];
464 tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO; 364 tdata->sd_attrs[i].dev_attr.attr.mode = S_IRUGO;
465 if (rw_ptr[i]) {
466 tdata->sd_attrs[i].dev_attr.attr.mode |= S_IWUSR;
467 tdata->sd_attrs[i].dev_attr.store = rw_ptr[i];
468 }
469 tdata->sd_attrs[i].dev_attr.show = rd_ptr[i]; 365 tdata->sd_attrs[i].dev_attr.show = rd_ptr[i];
470 tdata->sd_attrs[i].index = attr_no; 366 tdata->sd_attrs[i].index = attr_no;
471 err = device_create_file(dev, &tdata->sd_attrs[i].dev_attr); 367 err = device_create_file(dev, &tdata->sd_attrs[i].dev_attr);
@@ -538,8 +434,6 @@ static struct temp_data *init_temp_data(unsigned int cpu, int pkg_flag)
538 434
539 tdata->status_reg = pkg_flag ? MSR_IA32_PACKAGE_THERM_STATUS : 435 tdata->status_reg = pkg_flag ? MSR_IA32_PACKAGE_THERM_STATUS :
540 MSR_IA32_THERM_STATUS; 436 MSR_IA32_THERM_STATUS;
541 tdata->intrpt_reg = pkg_flag ? MSR_IA32_PACKAGE_THERM_INTERRUPT :
542 MSR_IA32_THERM_INTERRUPT;
543 tdata->is_pkg_data = pkg_flag; 437 tdata->is_pkg_data = pkg_flag;
544 tdata->cpu = cpu; 438 tdata->cpu = cpu;
545 tdata->cpu_core_id = TO_CORE_ID(cpu); 439 tdata->cpu_core_id = TO_CORE_ID(cpu);
@@ -548,11 +442,11 @@ static struct temp_data *init_temp_data(unsigned int cpu, int pkg_flag)
548 return tdata; 442 return tdata;
549} 443}
550 444
551static int create_core_data(struct platform_data *pdata, 445static int create_core_data(struct platform_device *pdev,
552 struct platform_device *pdev,
553 unsigned int cpu, int pkg_flag) 446 unsigned int cpu, int pkg_flag)
554{ 447{
555 struct temp_data *tdata; 448 struct temp_data *tdata;
449 struct platform_data *pdata = platform_get_drvdata(pdev);
556 struct cpuinfo_x86 *c = &cpu_data(cpu); 450 struct cpuinfo_x86 *c = &cpu_data(cpu);
557 u32 eax, edx; 451 u32 eax, edx;
558 int err, attr_no; 452 int err, attr_no;
@@ -588,25 +482,21 @@ static int create_core_data(struct platform_data *pdata,
588 goto exit_free; 482 goto exit_free;
589 483
590 /* We can access status register. Get Critical Temperature */ 484 /* We can access status register. Get Critical Temperature */
591 if (pkg_flag) 485 tdata->tjmax = get_tjmax(c, cpu, &pdev->dev);
592 tdata->tjmax = get_pkg_tjmax(pdev->id, &pdev->dev);
593 else
594 tdata->tjmax = get_tjmax(c, cpu, &pdev->dev);
595 486
596 /* 487 /*
597 * Test if we can access the intrpt register. If so, increase the 488 * Read the still undocumented bits 8:15 of IA32_TEMPERATURE_TARGET.
598 * 'size' enough to have ttarget/tmin/max_alarm interfaces. 489 * The target temperature is available on older CPUs but not in this
599 * Initialize ttarget with bits 16:22 of MSR_IA32_THERM_INTERRUPT 490 * register. Atoms don't have the register at all.
600 */ 491 */
601 err = rdmsr_safe_on_cpu(cpu, tdata->intrpt_reg, &eax, &edx); 492 if (c->x86_model > 0xe && c->x86_model != 0x1c) {
602 if (!err) { 493 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET,
603 tdata->attr_size += MAX_THRESH_ATTRS; 494 &eax, &edx);
604 tdata->tmin = tdata->tjmax - 495 if (!err) {
605 ((eax & THERM_MASK_THRESHOLD0) >> 496 tdata->ttarget
606 THERM_SHIFT_THRESHOLD0) * 1000; 497 = tdata->tjmax - ((eax >> 8) & 0xff) * 1000;
607 tdata->ttarget = tdata->tjmax - 498 tdata->attr_size++;
608 ((eax & THERM_MASK_THRESHOLD1) >> 499 }
609 THERM_SHIFT_THRESHOLD1) * 1000;
610 } 500 }
611 501
612 pdata->core_data[attr_no] = tdata; 502 pdata->core_data[attr_no] = tdata;
@@ -624,16 +514,13 @@ exit_free:
624 514
625static void coretemp_add_core(unsigned int cpu, int pkg_flag) 515static void coretemp_add_core(unsigned int cpu, int pkg_flag)
626{ 516{
627 struct platform_data *pdata;
628 struct platform_device *pdev = coretemp_get_pdev(cpu); 517 struct platform_device *pdev = coretemp_get_pdev(cpu);
629 int err; 518 int err;
630 519
631 if (!pdev) 520 if (!pdev)
632 return; 521 return;
633 522
634 pdata = platform_get_drvdata(pdev); 523 err = create_core_data(pdev, cpu, pkg_flag);
635
636 err = create_core_data(pdata, pdev, cpu, pkg_flag);
637 if (err) 524 if (err)
638 dev_err(&pdev->dev, "Adding Core %u failed\n", cpu); 525 dev_err(&pdev->dev, "Adding Core %u failed\n", cpu);
639} 526}
@@ -671,7 +558,7 @@ static int __devinit coretemp_probe(struct platform_device *pdev)
671 if (err) 558 if (err)
672 goto exit_free; 559 goto exit_free;
673 560
674 pdata->phys_proc_id = TO_PHYS_ID(pdev->id); 561 pdata->phys_proc_id = pdev->id;
675 platform_set_drvdata(pdev, pdata); 562 platform_set_drvdata(pdev, pdata);
676 563
677 pdata->hwmon_dev = hwmon_device_register(&pdev->dev); 564 pdata->hwmon_dev = hwmon_device_register(&pdev->dev);
@@ -723,7 +610,7 @@ static int __cpuinit coretemp_device_add(unsigned int cpu)
723 610
724 mutex_lock(&pdev_list_mutex); 611 mutex_lock(&pdev_list_mutex);
725 612
726 pdev = platform_device_alloc(DRVNAME, cpu); 613 pdev = platform_device_alloc(DRVNAME, TO_PHYS_ID(cpu));
727 if (!pdev) { 614 if (!pdev) {
728 err = -ENOMEM; 615 err = -ENOMEM;
729 pr_err("Device allocation failed\n"); 616 pr_err("Device allocation failed\n");
diff --git a/drivers/hwmon/ds620.c b/drivers/hwmon/ds620.c
index 257957c69d92..4f7c3fc40a89 100644
--- a/drivers/hwmon/ds620.c
+++ b/drivers/hwmon/ds620.c
@@ -72,7 +72,7 @@ struct ds620_data {
72 char valid; /* !=0 if following fields are valid */ 72 char valid; /* !=0 if following fields are valid */
73 unsigned long last_updated; /* In jiffies */ 73 unsigned long last_updated; /* In jiffies */
74 74
75 u16 temp[3]; /* Register values, word */ 75 s16 temp[3]; /* Register values, word */
76}; 76};
77 77
78/* 78/*
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 17cf1ab95521..8c2844e5691c 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -329,8 +329,8 @@ static int w83791d_detect(struct i2c_client *client,
329 struct i2c_board_info *info); 329 struct i2c_board_info *info);
330static int w83791d_remove(struct i2c_client *client); 330static int w83791d_remove(struct i2c_client *client);
331 331
332static int w83791d_read(struct i2c_client *client, u8 register); 332static int w83791d_read(struct i2c_client *client, u8 reg);
333static int w83791d_write(struct i2c_client *client, u8 register, u8 value); 333static int w83791d_write(struct i2c_client *client, u8 reg, u8 value);
334static struct w83791d_data *w83791d_update_device(struct device *dev); 334static struct w83791d_data *w83791d_update_device(struct device *dev);
335 335
336#ifdef DEBUG 336#ifdef DEBUG
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index 17bf9d95463c..6cd642aaa4de 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -287,7 +287,7 @@ void __free_ep(struct kref *kref)
287 if (test_bit(RELEASE_RESOURCES, &ep->com.flags)) { 287 if (test_bit(RELEASE_RESOURCES, &ep->com.flags)) {
288 cxgb3_remove_tid(ep->com.tdev, (void *)ep, ep->hwtid); 288 cxgb3_remove_tid(ep->com.tdev, (void *)ep, ep->hwtid);
289 dst_release(ep->dst); 289 dst_release(ep->dst);
290 l2t_release(L2DATA(ep->com.tdev), ep->l2t); 290 l2t_release(ep->com.tdev, ep->l2t);
291 } 291 }
292 kfree(ep); 292 kfree(ep);
293} 293}
@@ -1178,7 +1178,7 @@ static int act_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1178 release_tid(ep->com.tdev, GET_TID(rpl), NULL); 1178 release_tid(ep->com.tdev, GET_TID(rpl), NULL);
1179 cxgb3_free_atid(ep->com.tdev, ep->atid); 1179 cxgb3_free_atid(ep->com.tdev, ep->atid);
1180 dst_release(ep->dst); 1180 dst_release(ep->dst);
1181 l2t_release(L2DATA(ep->com.tdev), ep->l2t); 1181 l2t_release(ep->com.tdev, ep->l2t);
1182 put_ep(&ep->com); 1182 put_ep(&ep->com);
1183 return CPL_RET_BUF_DONE; 1183 return CPL_RET_BUF_DONE;
1184} 1184}
@@ -1377,7 +1377,7 @@ static int pass_accept_req(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1377 if (!child_ep) { 1377 if (!child_ep) {
1378 printk(KERN_ERR MOD "%s - failed to allocate ep entry!\n", 1378 printk(KERN_ERR MOD "%s - failed to allocate ep entry!\n",
1379 __func__); 1379 __func__);
1380 l2t_release(L2DATA(tdev), l2t); 1380 l2t_release(tdev, l2t);
1381 dst_release(dst); 1381 dst_release(dst);
1382 goto reject; 1382 goto reject;
1383 } 1383 }
@@ -1956,7 +1956,7 @@ int iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
1956 if (!err) 1956 if (!err)
1957 goto out; 1957 goto out;
1958 1958
1959 l2t_release(L2DATA(h->rdev.t3cdev_p), ep->l2t); 1959 l2t_release(h->rdev.t3cdev_p, ep->l2t);
1960fail4: 1960fail4:
1961 dst_release(ep->dst); 1961 dst_release(ep->dst);
1962fail3: 1962fail3:
@@ -2127,7 +2127,7 @@ int iwch_ep_redirect(void *ctx, struct dst_entry *old, struct dst_entry *new,
2127 PDBG("%s ep %p redirect to dst %p l2t %p\n", __func__, ep, new, 2127 PDBG("%s ep %p redirect to dst %p l2t %p\n", __func__, ep, new,
2128 l2t); 2128 l2t);
2129 dst_hold(new); 2129 dst_hold(new);
2130 l2t_release(L2DATA(ep->com.tdev), ep->l2t); 2130 l2t_release(ep->com.tdev, ep->l2t);
2131 ep->l2t = l2t; 2131 ep->l2t = l2t;
2132 dst_release(old); 2132 dst_release(old);
2133 ep->dst = new; 2133 ep->dst = new;
diff --git a/drivers/net/bnx2x/bnx2x_dcb.c b/drivers/net/bnx2x/bnx2x_dcb.c
index a1e004a82f7a..0b4acf67e0c6 100644
--- a/drivers/net/bnx2x/bnx2x_dcb.c
+++ b/drivers/net/bnx2x/bnx2x_dcb.c
@@ -2120,6 +2120,7 @@ static u8 bnx2x_dcbnl_get_cap(struct net_device *netdev, int capid, u8 *cap)
2120 break; 2120 break;
2121 case DCB_CAP_ATTR_DCBX: 2121 case DCB_CAP_ATTR_DCBX:
2122 *cap = BNX2X_DCBX_CAPS; 2122 *cap = BNX2X_DCBX_CAPS;
2123 break;
2123 default: 2124 default:
2124 rval = -EINVAL; 2125 rval = -EINVAL;
2125 break; 2126 break;
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index c027e9341a1a..15f800085bb2 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -4943,7 +4943,7 @@ static void bnx2x_init_def_sb(struct bnx2x *bp)
4943 int igu_seg_id; 4943 int igu_seg_id;
4944 int port = BP_PORT(bp); 4944 int port = BP_PORT(bp);
4945 int func = BP_FUNC(bp); 4945 int func = BP_FUNC(bp);
4946 int reg_offset; 4946 int reg_offset, reg_offset_en5;
4947 u64 section; 4947 u64 section;
4948 int index; 4948 int index;
4949 struct hc_sp_status_block_data sp_sb_data; 4949 struct hc_sp_status_block_data sp_sb_data;
@@ -4966,6 +4966,8 @@ static void bnx2x_init_def_sb(struct bnx2x *bp)
4966 4966
4967 reg_offset = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : 4967 reg_offset = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 :
4968 MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0); 4968 MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0);
4969 reg_offset_en5 = (port ? MISC_REG_AEU_ENABLE5_FUNC_1_OUT_0 :
4970 MISC_REG_AEU_ENABLE5_FUNC_0_OUT_0);
4969 for (index = 0; index < MAX_DYNAMIC_ATTN_GRPS; index++) { 4971 for (index = 0; index < MAX_DYNAMIC_ATTN_GRPS; index++) {
4970 int sindex; 4972 int sindex;
4971 /* take care of sig[0]..sig[4] */ 4973 /* take care of sig[0]..sig[4] */
@@ -4980,7 +4982,7 @@ static void bnx2x_init_def_sb(struct bnx2x *bp)
4980 * and not 16 between the different groups 4982 * and not 16 between the different groups
4981 */ 4983 */
4982 bp->attn_group[index].sig[4] = REG_RD(bp, 4984 bp->attn_group[index].sig[4] = REG_RD(bp,
4983 reg_offset + 0x10 + 0x4*index); 4985 reg_offset_en5 + 0x4*index);
4984 else 4986 else
4985 bp->attn_group[index].sig[4] = 0; 4987 bp->attn_group[index].sig[4] = 0;
4986 } 4988 }
@@ -7625,8 +7627,11 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
7625 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 7627 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
7626 u8 *mac_addr = bp->dev->dev_addr; 7628 u8 *mac_addr = bp->dev->dev_addr;
7627 u32 val; 7629 u32 val;
7630 u16 pmc;
7631
7628 /* The mac address is written to entries 1-4 to 7632 /* The mac address is written to entries 1-4 to
7629 preserve entry 0 which is used by the PMF */ 7633 * preserve entry 0 which is used by the PMF
7634 */
7630 u8 entry = (BP_VN(bp) + 1)*8; 7635 u8 entry = (BP_VN(bp) + 1)*8;
7631 7636
7632 val = (mac_addr[0] << 8) | mac_addr[1]; 7637 val = (mac_addr[0] << 8) | mac_addr[1];
@@ -7636,6 +7641,11 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
7636 (mac_addr[4] << 8) | mac_addr[5]; 7641 (mac_addr[4] << 8) | mac_addr[5];
7637 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val); 7642 EMAC_WR(bp, EMAC_REG_EMAC_MAC_MATCH + entry + 4, val);
7638 7643
7644 /* Enable the PME and clear the status */
7645 pci_read_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, &pmc);
7646 pmc |= PCI_PM_CTRL_PME_ENABLE | PCI_PM_CTRL_PME_STATUS;
7647 pci_write_config_word(bp->pdev, bp->pm_cap + PCI_PM_CTRL, pmc);
7648
7639 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN; 7649 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_EN;
7640 7650
7641 } else 7651 } else
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h
index 750e8445dac4..fc7bd0f23c0b 100644
--- a/drivers/net/bnx2x/bnx2x_reg.h
+++ b/drivers/net/bnx2x/bnx2x_reg.h
@@ -1384,6 +1384,18 @@
1384 Latched ump_tx_parity; [31] MCP Latched scpad_parity; */ 1384 Latched ump_tx_parity; [31] MCP Latched scpad_parity; */
1385#define MISC_REG_AEU_ENABLE4_PXP_0 0xa108 1385#define MISC_REG_AEU_ENABLE4_PXP_0 0xa108
1386#define MISC_REG_AEU_ENABLE4_PXP_1 0xa1a8 1386#define MISC_REG_AEU_ENABLE4_PXP_1 0xa1a8
1387/* [RW 32] fifth 32b for enabling the output for function 0 output0. Mapped
1388 * as follows: [0] PGLUE config_space; [1] PGLUE misc_flr; [2] PGLUE B RBC
1389 * attention [3] PGLUE B RBC parity; [4] ATC attention; [5] ATC parity; [6]
1390 * mstat0 attention; [7] mstat0 parity; [8] mstat1 attention; [9] mstat1
1391 * parity; [31-10] Reserved; */
1392#define MISC_REG_AEU_ENABLE5_FUNC_0_OUT_0 0xa688
1393/* [RW 32] Fifth 32b for enabling the output for function 1 output0. Mapped
1394 * as follows: [0] PGLUE config_space; [1] PGLUE misc_flr; [2] PGLUE B RBC
1395 * attention [3] PGLUE B RBC parity; [4] ATC attention; [5] ATC parity; [6]
1396 * mstat0 attention; [7] mstat0 parity; [8] mstat1 attention; [9] mstat1
1397 * parity; [31-10] Reserved; */
1398#define MISC_REG_AEU_ENABLE5_FUNC_1_OUT_0 0xa6b0
1387/* [RW 1] set/clr general attention 0; this will set/clr bit 94 in the aeu 1399/* [RW 1] set/clr general attention 0; this will set/clr bit 94 in the aeu
1388 128 bit vector */ 1400 128 bit vector */
1389#define MISC_REG_AEU_GENERAL_ATTN_0 0xa000 1401#define MISC_REG_AEU_GENERAL_ATTN_0 0xa000
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index 805076c54f1b..da5a5d9b8aff 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -1146,12 +1146,14 @@ static void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
1146 if (te && te->ctx && te->client && te->client->redirect) { 1146 if (te && te->ctx && te->client && te->client->redirect) {
1147 update_tcb = te->client->redirect(te->ctx, old, new, e); 1147 update_tcb = te->client->redirect(te->ctx, old, new, e);
1148 if (update_tcb) { 1148 if (update_tcb) {
1149 rcu_read_lock();
1149 l2t_hold(L2DATA(tdev), e); 1150 l2t_hold(L2DATA(tdev), e);
1151 rcu_read_unlock();
1150 set_l2t_ix(tdev, tid, e); 1152 set_l2t_ix(tdev, tid, e);
1151 } 1153 }
1152 } 1154 }
1153 } 1155 }
1154 l2t_release(L2DATA(tdev), e); 1156 l2t_release(tdev, e);
1155} 1157}
1156 1158
1157/* 1159/*
@@ -1264,7 +1266,7 @@ int cxgb3_offload_activate(struct adapter *adapter)
1264 goto out_free; 1266 goto out_free;
1265 1267
1266 err = -ENOMEM; 1268 err = -ENOMEM;
1267 L2DATA(dev) = t3_init_l2t(l2t_capacity); 1269 RCU_INIT_POINTER(dev->l2opt, t3_init_l2t(l2t_capacity));
1268 if (!L2DATA(dev)) 1270 if (!L2DATA(dev))
1269 goto out_free; 1271 goto out_free;
1270 1272
@@ -1298,16 +1300,24 @@ int cxgb3_offload_activate(struct adapter *adapter)
1298 1300
1299out_free_l2t: 1301out_free_l2t:
1300 t3_free_l2t(L2DATA(dev)); 1302 t3_free_l2t(L2DATA(dev));
1301 L2DATA(dev) = NULL; 1303 rcu_assign_pointer(dev->l2opt, NULL);
1302out_free: 1304out_free:
1303 kfree(t); 1305 kfree(t);
1304 return err; 1306 return err;
1305} 1307}
1306 1308
1309static void clean_l2_data(struct rcu_head *head)
1310{
1311 struct l2t_data *d = container_of(head, struct l2t_data, rcu_head);
1312 t3_free_l2t(d);
1313}
1314
1315
1307void cxgb3_offload_deactivate(struct adapter *adapter) 1316void cxgb3_offload_deactivate(struct adapter *adapter)
1308{ 1317{
1309 struct t3cdev *tdev = &adapter->tdev; 1318 struct t3cdev *tdev = &adapter->tdev;
1310 struct t3c_data *t = T3C_DATA(tdev); 1319 struct t3c_data *t = T3C_DATA(tdev);
1320 struct l2t_data *d;
1311 1321
1312 remove_adapter(adapter); 1322 remove_adapter(adapter);
1313 if (list_empty(&adapter_list)) 1323 if (list_empty(&adapter_list))
@@ -1315,8 +1325,11 @@ void cxgb3_offload_deactivate(struct adapter *adapter)
1315 1325
1316 free_tid_maps(&t->tid_maps); 1326 free_tid_maps(&t->tid_maps);
1317 T3C_DATA(tdev) = NULL; 1327 T3C_DATA(tdev) = NULL;
1318 t3_free_l2t(L2DATA(tdev)); 1328 rcu_read_lock();
1319 L2DATA(tdev) = NULL; 1329 d = L2DATA(tdev);
1330 rcu_read_unlock();
1331 rcu_assign_pointer(tdev->l2opt, NULL);
1332 call_rcu(&d->rcu_head, clean_l2_data);
1320 if (t->nofail_skb) 1333 if (t->nofail_skb)
1321 kfree_skb(t->nofail_skb); 1334 kfree_skb(t->nofail_skb);
1322 kfree(t); 1335 kfree(t);
diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
index f452c4003253..41540978a173 100644
--- a/drivers/net/cxgb3/l2t.c
+++ b/drivers/net/cxgb3/l2t.c
@@ -300,14 +300,21 @@ static inline void reuse_entry(struct l2t_entry *e, struct neighbour *neigh)
300struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct neighbour *neigh, 300struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct neighbour *neigh,
301 struct net_device *dev) 301 struct net_device *dev)
302{ 302{
303 struct l2t_entry *e; 303 struct l2t_entry *e = NULL;
304 struct l2t_data *d = L2DATA(cdev); 304 struct l2t_data *d;
305 int hash;
305 u32 addr = *(u32 *) neigh->primary_key; 306 u32 addr = *(u32 *) neigh->primary_key;
306 int ifidx = neigh->dev->ifindex; 307 int ifidx = neigh->dev->ifindex;
307 int hash = arp_hash(addr, ifidx, d);
308 struct port_info *p = netdev_priv(dev); 308 struct port_info *p = netdev_priv(dev);
309 int smt_idx = p->port_id; 309 int smt_idx = p->port_id;
310 310
311 rcu_read_lock();
312 d = L2DATA(cdev);
313 if (!d)
314 goto done_rcu;
315
316 hash = arp_hash(addr, ifidx, d);
317
311 write_lock_bh(&d->lock); 318 write_lock_bh(&d->lock);
312 for (e = d->l2tab[hash].first; e; e = e->next) 319 for (e = d->l2tab[hash].first; e; e = e->next)
313 if (e->addr == addr && e->ifindex == ifidx && 320 if (e->addr == addr && e->ifindex == ifidx &&
@@ -338,6 +345,8 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct neighbour *neigh,
338 } 345 }
339done: 346done:
340 write_unlock_bh(&d->lock); 347 write_unlock_bh(&d->lock);
348done_rcu:
349 rcu_read_unlock();
341 return e; 350 return e;
342} 351}
343 352
diff --git a/drivers/net/cxgb3/l2t.h b/drivers/net/cxgb3/l2t.h
index 7a12d52ed4fc..c5f54796e2cb 100644
--- a/drivers/net/cxgb3/l2t.h
+++ b/drivers/net/cxgb3/l2t.h
@@ -76,6 +76,7 @@ struct l2t_data {
76 atomic_t nfree; /* number of free entries */ 76 atomic_t nfree; /* number of free entries */
77 rwlock_t lock; 77 rwlock_t lock;
78 struct l2t_entry l2tab[0]; 78 struct l2t_entry l2tab[0];
79 struct rcu_head rcu_head; /* to handle rcu cleanup */
79}; 80};
80 81
81typedef void (*arp_failure_handler_func)(struct t3cdev * dev, 82typedef void (*arp_failure_handler_func)(struct t3cdev * dev,
@@ -99,7 +100,7 @@ static inline void set_arp_failure_handler(struct sk_buff *skb,
99/* 100/*
100 * Getting to the L2 data from an offload device. 101 * Getting to the L2 data from an offload device.
101 */ 102 */
102#define L2DATA(dev) ((dev)->l2opt) 103#define L2DATA(cdev) (rcu_dereference((cdev)->l2opt))
103 104
104#define W_TCB_L2T_IX 0 105#define W_TCB_L2T_IX 0
105#define S_TCB_L2T_IX 7 106#define S_TCB_L2T_IX 7
@@ -126,15 +127,22 @@ static inline int l2t_send(struct t3cdev *dev, struct sk_buff *skb,
126 return t3_l2t_send_slow(dev, skb, e); 127 return t3_l2t_send_slow(dev, skb, e);
127} 128}
128 129
129static inline void l2t_release(struct l2t_data *d, struct l2t_entry *e) 130static inline void l2t_release(struct t3cdev *t, struct l2t_entry *e)
130{ 131{
131 if (atomic_dec_and_test(&e->refcnt)) 132 struct l2t_data *d;
133
134 rcu_read_lock();
135 d = L2DATA(t);
136
137 if (atomic_dec_and_test(&e->refcnt) && d)
132 t3_l2e_free(d, e); 138 t3_l2e_free(d, e);
139
140 rcu_read_unlock();
133} 141}
134 142
135static inline void l2t_hold(struct l2t_data *d, struct l2t_entry *e) 143static inline void l2t_hold(struct l2t_data *d, struct l2t_entry *e)
136{ 144{
137 if (atomic_add_return(1, &e->refcnt) == 1) /* 0 -> 1 transition */ 145 if (d && atomic_add_return(1, &e->refcnt) == 1) /* 0 -> 1 transition */
138 atomic_dec(&d->nfree); 146 atomic_dec(&d->nfree);
139} 147}
140 148
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index 2339728a7306..3e69c631ebb4 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -1514,7 +1514,7 @@ static const u32 ar9300_2p2_mac_core[][2] = {
1514 {0x00008258, 0x00000000}, 1514 {0x00008258, 0x00000000},
1515 {0x0000825c, 0x40000000}, 1515 {0x0000825c, 0x40000000},
1516 {0x00008260, 0x00080922}, 1516 {0x00008260, 0x00080922},
1517 {0x00008264, 0x9bc00010}, 1517 {0x00008264, 0x9d400010},
1518 {0x00008268, 0xffffffff}, 1518 {0x00008268, 0xffffffff},
1519 {0x0000826c, 0x0000ffff}, 1519 {0x0000826c, 0x0000ffff},
1520 {0x00008270, 0x00000000}, 1520 {0x00008270, 0x00000000},
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 9a4850154fb2..4c21f8cbdeb5 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -205,14 +205,22 @@ static void ath_rx_remove_buffer(struct ath_softc *sc,
205 205
206static void ath_rx_edma_cleanup(struct ath_softc *sc) 206static void ath_rx_edma_cleanup(struct ath_softc *sc)
207{ 207{
208 struct ath_hw *ah = sc->sc_ah;
209 struct ath_common *common = ath9k_hw_common(ah);
208 struct ath_buf *bf; 210 struct ath_buf *bf;
209 211
210 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); 212 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP);
211 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); 213 ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP);
212 214
213 list_for_each_entry(bf, &sc->rx.rxbuf, list) { 215 list_for_each_entry(bf, &sc->rx.rxbuf, list) {
214 if (bf->bf_mpdu) 216 if (bf->bf_mpdu) {
217 dma_unmap_single(sc->dev, bf->bf_buf_addr,
218 common->rx_bufsize,
219 DMA_BIDIRECTIONAL);
215 dev_kfree_skb_any(bf->bf_mpdu); 220 dev_kfree_skb_any(bf->bf_mpdu);
221 bf->bf_buf_addr = 0;
222 bf->bf_mpdu = NULL;
223 }
216 } 224 }
217 225
218 INIT_LIST_HEAD(&sc->rx.rxbuf); 226 INIT_LIST_HEAD(&sc->rx.rxbuf);
diff --git a/drivers/net/wireless/iwlegacy/iwl-core.c b/drivers/net/wireless/iwlegacy/iwl-core.c
index 35cd2537e7fd..e5971fe9d169 100644
--- a/drivers/net/wireless/iwlegacy/iwl-core.c
+++ b/drivers/net/wireless/iwlegacy/iwl-core.c
@@ -937,7 +937,7 @@ void iwl_legacy_irq_handle_error(struct iwl_priv *priv)
937 &priv->contexts[IWL_RXON_CTX_BSS]); 937 &priv->contexts[IWL_RXON_CTX_BSS]);
938#endif 938#endif
939 939
940 wake_up_interruptible(&priv->wait_command_queue); 940 wake_up(&priv->wait_command_queue);
941 941
942 /* Keep the restart process from trying to send host 942 /* Keep the restart process from trying to send host
943 * commands by clearing the INIT status bit */ 943 * commands by clearing the INIT status bit */
@@ -1746,7 +1746,7 @@ int iwl_legacy_force_reset(struct iwl_priv *priv, bool external)
1746 1746
1747 /* Set the FW error flag -- cleared on iwl_down */ 1747 /* Set the FW error flag -- cleared on iwl_down */
1748 set_bit(STATUS_FW_ERROR, &priv->status); 1748 set_bit(STATUS_FW_ERROR, &priv->status);
1749 wake_up_interruptible(&priv->wait_command_queue); 1749 wake_up(&priv->wait_command_queue);
1750 /* 1750 /*
1751 * Keep the restart process from trying to send host 1751 * Keep the restart process from trying to send host
1752 * commands by clearing the INIT status bit 1752 * commands by clearing the INIT status bit
diff --git a/drivers/net/wireless/iwlegacy/iwl-hcmd.c b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
index 62b4b09122cb..ce1fc9feb61f 100644
--- a/drivers/net/wireless/iwlegacy/iwl-hcmd.c
+++ b/drivers/net/wireless/iwlegacy/iwl-hcmd.c
@@ -167,7 +167,7 @@ int iwl_legacy_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
167 goto out; 167 goto out;
168 } 168 }
169 169
170 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 170 ret = wait_event_timeout(priv->wait_command_queue,
171 !test_bit(STATUS_HCMD_ACTIVE, &priv->status), 171 !test_bit(STATUS_HCMD_ACTIVE, &priv->status),
172 HOST_COMPLETE_TIMEOUT); 172 HOST_COMPLETE_TIMEOUT);
173 if (!ret) { 173 if (!ret) {
diff --git a/drivers/net/wireless/iwlegacy/iwl-tx.c b/drivers/net/wireless/iwlegacy/iwl-tx.c
index 4fff995c6f3e..ef9e268bf8a0 100644
--- a/drivers/net/wireless/iwlegacy/iwl-tx.c
+++ b/drivers/net/wireless/iwlegacy/iwl-tx.c
@@ -625,6 +625,8 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
625 cmd = txq->cmd[cmd_index]; 625 cmd = txq->cmd[cmd_index];
626 meta = &txq->meta[cmd_index]; 626 meta = &txq->meta[cmd_index];
627 627
628 txq->time_stamp = jiffies;
629
628 pci_unmap_single(priv->pci_dev, 630 pci_unmap_single(priv->pci_dev,
629 dma_unmap_addr(meta, mapping), 631 dma_unmap_addr(meta, mapping),
630 dma_unmap_len(meta, len), 632 dma_unmap_len(meta, len),
@@ -645,7 +647,7 @@ iwl_legacy_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
645 clear_bit(STATUS_HCMD_ACTIVE, &priv->status); 647 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
646 IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n", 648 IWL_DEBUG_INFO(priv, "Clearing HCMD_ACTIVE for command %s\n",
647 iwl_legacy_get_cmd_string(cmd->hdr.cmd)); 649 iwl_legacy_get_cmd_string(cmd->hdr.cmd));
648 wake_up_interruptible(&priv->wait_command_queue); 650 wake_up(&priv->wait_command_queue);
649 } 651 }
650 652
651 /* Mark as unmapped */ 653 /* Mark as unmapped */
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index 795826a014ed..66ee15629a76 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -841,7 +841,7 @@ static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
841 wiphy_rfkill_set_hw_state(priv->hw->wiphy, 841 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
842 test_bit(STATUS_RF_KILL_HW, &priv->status)); 842 test_bit(STATUS_RF_KILL_HW, &priv->status));
843 else 843 else
844 wake_up_interruptible(&priv->wait_command_queue); 844 wake_up(&priv->wait_command_queue);
845} 845}
846 846
847/** 847/**
@@ -2269,7 +2269,7 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2269 iwl3945_reg_txpower_periodic(priv); 2269 iwl3945_reg_txpower_periodic(priv);
2270 2270
2271 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); 2271 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
2272 wake_up_interruptible(&priv->wait_command_queue); 2272 wake_up(&priv->wait_command_queue);
2273 2273
2274 return; 2274 return;
2275 2275
@@ -2300,7 +2300,7 @@ static void __iwl3945_down(struct iwl_priv *priv)
2300 iwl_legacy_clear_driver_stations(priv); 2300 iwl_legacy_clear_driver_stations(priv);
2301 2301
2302 /* Unblock any waiting calls */ 2302 /* Unblock any waiting calls */
2303 wake_up_interruptible_all(&priv->wait_command_queue); 2303 wake_up_all(&priv->wait_command_queue);
2304 2304
2305 /* Wipe out the EXIT_PENDING status bit if we are not actually 2305 /* Wipe out the EXIT_PENDING status bit if we are not actually
2306 * exiting the module */ 2306 * exiting the module */
@@ -2853,7 +2853,7 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
2853 2853
2854 /* Wait for START_ALIVE from ucode. Otherwise callbacks from 2854 /* Wait for START_ALIVE from ucode. Otherwise callbacks from
2855 * mac80211 will not be run successfully. */ 2855 * mac80211 will not be run successfully. */
2856 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 2856 ret = wait_event_timeout(priv->wait_command_queue,
2857 test_bit(STATUS_READY, &priv->status), 2857 test_bit(STATUS_READY, &priv->status),
2858 UCODE_READY_TIMEOUT); 2858 UCODE_READY_TIMEOUT);
2859 if (!ret) { 2859 if (!ret) {
diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
index 14334668034e..aa0c2539761e 100644
--- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
@@ -576,7 +576,7 @@ static void iwl4965_rx_card_state_notif(struct iwl_priv *priv,
576 wiphy_rfkill_set_hw_state(priv->hw->wiphy, 576 wiphy_rfkill_set_hw_state(priv->hw->wiphy,
577 test_bit(STATUS_RF_KILL_HW, &priv->status)); 577 test_bit(STATUS_RF_KILL_HW, &priv->status));
578 else 578 else
579 wake_up_interruptible(&priv->wait_command_queue); 579 wake_up(&priv->wait_command_queue);
580} 580}
581 581
582/** 582/**
@@ -926,7 +926,7 @@ static void iwl4965_irq_tasklet(struct iwl_priv *priv)
926 handled |= CSR_INT_BIT_FH_TX; 926 handled |= CSR_INT_BIT_FH_TX;
927 /* Wake up uCode load routine, now that load is complete */ 927 /* Wake up uCode load routine, now that load is complete */
928 priv->ucode_write_complete = 1; 928 priv->ucode_write_complete = 1;
929 wake_up_interruptible(&priv->wait_command_queue); 929 wake_up(&priv->wait_command_queue);
930 } 930 }
931 931
932 if (inta & ~handled) { 932 if (inta & ~handled) {
@@ -1795,7 +1795,7 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
1795 iwl4965_rf_kill_ct_config(priv); 1795 iwl4965_rf_kill_ct_config(priv);
1796 1796
1797 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); 1797 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
1798 wake_up_interruptible(&priv->wait_command_queue); 1798 wake_up(&priv->wait_command_queue);
1799 1799
1800 iwl_legacy_power_update_mode(priv, true); 1800 iwl_legacy_power_update_mode(priv, true);
1801 IWL_DEBUG_INFO(priv, "Updated power mode\n"); 1801 IWL_DEBUG_INFO(priv, "Updated power mode\n");
@@ -1828,7 +1828,7 @@ static void __iwl4965_down(struct iwl_priv *priv)
1828 iwl_legacy_clear_driver_stations(priv); 1828 iwl_legacy_clear_driver_stations(priv);
1829 1829
1830 /* Unblock any waiting calls */ 1830 /* Unblock any waiting calls */
1831 wake_up_interruptible_all(&priv->wait_command_queue); 1831 wake_up_all(&priv->wait_command_queue);
1832 1832
1833 /* Wipe out the EXIT_PENDING status bit if we are not actually 1833 /* Wipe out the EXIT_PENDING status bit if we are not actually
1834 * exiting the module */ 1834 * exiting the module */
@@ -2266,7 +2266,7 @@ int iwl4965_mac_start(struct ieee80211_hw *hw)
2266 2266
2267 /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from 2267 /* Wait for START_ALIVE from Run Time ucode. Otherwise callbacks from
2268 * mac80211 will not be run successfully. */ 2268 * mac80211 will not be run successfully. */
2269 ret = wait_event_interruptible_timeout(priv->wait_command_queue, 2269 ret = wait_event_timeout(priv->wait_command_queue,
2270 test_bit(STATUS_READY, &priv->status), 2270 test_bit(STATUS_READY, &priv->status),
2271 UCODE_READY_TIMEOUT); 2271 UCODE_READY_TIMEOUT);
2272 if (!ret) { 2272 if (!ret) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index dd6937e97055..77e528f5db88 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -405,31 +405,33 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
405 405
406 mutex_lock(&priv->mutex); 406 mutex_lock(&priv->mutex);
407 407
408 if (test_bit(STATUS_SCANNING, &priv->status) &&
409 priv->scan_type != IWL_SCAN_NORMAL) {
410 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
411 ret = -EAGAIN;
412 goto out_unlock;
413 }
414
415 /* mac80211 will only ask for one band at a time */
416 priv->scan_request = req;
417 priv->scan_vif = vif;
418
419 /* 408 /*
420 * If an internal scan is in progress, just set 409 * If an internal scan is in progress, just set
421 * up the scan_request as per above. 410 * up the scan_request as per above.
422 */ 411 */
423 if (priv->scan_type != IWL_SCAN_NORMAL) { 412 if (priv->scan_type != IWL_SCAN_NORMAL) {
424 IWL_DEBUG_SCAN(priv, "SCAN request during internal scan\n"); 413 IWL_DEBUG_SCAN(priv,
414 "SCAN request during internal scan - defer\n");
415 priv->scan_request = req;
416 priv->scan_vif = vif;
425 ret = 0; 417 ret = 0;
426 } else 418 } else {
419 priv->scan_request = req;
420 priv->scan_vif = vif;
421 /*
422 * mac80211 will only ask for one band at a time
423 * so using channels[0] here is ok
424 */
427 ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL, 425 ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL,
428 req->channels[0]->band); 426 req->channels[0]->band);
427 if (ret) {
428 priv->scan_request = NULL;
429 priv->scan_vif = NULL;
430 }
431 }
429 432
430 IWL_DEBUG_MAC80211(priv, "leave\n"); 433 IWL_DEBUG_MAC80211(priv, "leave\n");
431 434
432out_unlock:
433 mutex_unlock(&priv->mutex); 435 mutex_unlock(&priv->mutex);
434 436
435 return ret; 437 return ret;
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 8b1cef0ffde6..4bf3cf457ef0 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -863,6 +863,7 @@ static void _rtl_usb_tx_preprocess(struct ieee80211_hw *hw, struct sk_buff *skb,
863 u8 tid = 0; 863 u8 tid = 0;
864 u16 seq_number = 0; 864 u16 seq_number = 0;
865 865
866 memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc));
866 if (ieee80211_is_auth(fc)) { 867 if (ieee80211_is_auth(fc)) {
867 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n")); 868 RT_TRACE(rtlpriv, COMP_SEND, DBG_DMESG, ("MAC80211_LINKING\n"));
868 rtl_ips_nic_on(hw); 869 rtl_ips_nic_on(hw);
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index b7bd5b0cc7aa..3868ab2397c6 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1800,10 +1800,12 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1800 switch (retval) { 1800 switch (retval) {
1801 case SCSI_MLQUEUE_HOST_BUSY: 1801 case SCSI_MLQUEUE_HOST_BUSY:
1802 twa_free_request_id(tw_dev, request_id); 1802 twa_free_request_id(tw_dev, request_id);
1803 twa_unmap_scsi_data(tw_dev, request_id);
1803 break; 1804 break;
1804 case 1: 1805 case 1:
1805 tw_dev->state[request_id] = TW_S_COMPLETED; 1806 tw_dev->state[request_id] = TW_S_COMPLETED;
1806 twa_free_request_id(tw_dev, request_id); 1807 twa_free_request_id(tw_dev, request_id);
1808 twa_unmap_scsi_data(tw_dev, request_id);
1807 SCpnt->result = (DID_ERROR << 16); 1809 SCpnt->result = (DID_ERROR << 16);
1808 done(SCpnt); 1810 done(SCpnt);
1809 retval = 0; 1811 retval = 0;
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 3c08f5352b2d..6153a66a8a31 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -88,7 +88,7 @@ obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o
88obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o 88obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o
89obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o 89obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
90obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/ 90obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/
91obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx/ 91obj-$(CONFIG_SCSI_QLA_ISCSI) += libiscsi.o qla4xxx/
92obj-$(CONFIG_SCSI_LPFC) += lpfc/ 92obj-$(CONFIG_SCSI_LPFC) += lpfc/
93obj-$(CONFIG_SCSI_BFA_FC) += bfa/ 93obj-$(CONFIG_SCSI_BFA_FC) += bfa/
94obj-$(CONFIG_SCSI_PAS16) += pas16.o 94obj-$(CONFIG_SCSI_PAS16) += pas16.o
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index e7d0d47b9185..e5f2d7d9002e 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1283,6 +1283,8 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced)
1283 kfree(aac->queues); 1283 kfree(aac->queues);
1284 aac->queues = NULL; 1284 aac->queues = NULL;
1285 free_irq(aac->pdev->irq, aac); 1285 free_irq(aac->pdev->irq, aac);
1286 if (aac->msi)
1287 pci_disable_msi(aac->pdev);
1286 kfree(aac->fsa_dev); 1288 kfree(aac->fsa_dev);
1287 aac->fsa_dev = NULL; 1289 aac->fsa_dev = NULL;
1288 quirks = aac_get_driver_ident(index)->quirks; 1290 quirks = aac_get_driver_ident(index)->quirks;
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index bd22041e2789..f58644850333 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -913,7 +913,7 @@ static void l2t_put(struct cxgbi_sock *csk)
913 struct t3cdev *t3dev = (struct t3cdev *)csk->cdev->lldev; 913 struct t3cdev *t3dev = (struct t3cdev *)csk->cdev->lldev;
914 914
915 if (csk->l2t) { 915 if (csk->l2t) {
916 l2t_release(L2DATA(t3dev), csk->l2t); 916 l2t_release(t3dev, csk->l2t);
917 csk->l2t = NULL; 917 csk->l2t = NULL;
918 cxgbi_sock_put(csk); 918 cxgbi_sock_put(csk);
919 } 919 }
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index f84084bba2f0..c9e3dc024bc3 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -1721,7 +1721,7 @@ static int sas_find_bcast_dev(struct domain_device *dev,
1721 list_for_each_entry(ch, &ex->children, siblings) { 1721 list_for_each_entry(ch, &ex->children, siblings) {
1722 if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) { 1722 if (ch->dev_type == EDGE_DEV || ch->dev_type == FANOUT_DEV) {
1723 res = sas_find_bcast_dev(ch, src_dev); 1723 res = sas_find_bcast_dev(ch, src_dev);
1724 if (src_dev) 1724 if (*src_dev)
1725 return res; 1725 return res;
1726 } 1726 }
1727 } 1727 }