Contents of /trunk/kernel-alx/patches-4.4/0148-4.4.49-all-fixes.patch
Parent Directory | Revision Log
Revision 2884 -
(show annotations)
(download)
Mon Mar 27 13:49:22 2017 UTC (7 years, 6 months ago) by niro
File size: 17541 byte(s)
Mon Mar 27 13:49:22 2017 UTC (7 years, 6 months ago) by niro
File size: 17541 byte(s)
linux-4.4.49
1 | diff --git a/Makefile b/Makefile |
2 | index 0793cd412656..5fab6d4068b5 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,6 +1,6 @@ |
6 | VERSION = 4 |
7 | PATCHLEVEL = 4 |
8 | -SUBLEVEL = 48 |
9 | +SUBLEVEL = 49 |
10 | EXTRAVERSION = |
11 | NAME = Blurry Fish Butt |
12 | |
13 | diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c |
14 | index 91ebe382147f..5f69c3bd59bb 100644 |
15 | --- a/arch/arc/kernel/unaligned.c |
16 | +++ b/arch/arc/kernel/unaligned.c |
17 | @@ -243,7 +243,7 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs, |
18 | |
19 | /* clear any remanants of delay slot */ |
20 | if (delay_mode(regs)) { |
21 | - regs->ret = regs->bta ~1U; |
22 | + regs->ret = regs->bta & ~1U; |
23 | regs->status32 &= ~STATUS_DE_MASK; |
24 | } else { |
25 | regs->ret += state.instr_len; |
26 | diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c |
27 | index 4d9375814b53..d54c53b7ab63 100644 |
28 | --- a/arch/arm/kernel/ptrace.c |
29 | +++ b/arch/arm/kernel/ptrace.c |
30 | @@ -600,7 +600,7 @@ static int gpr_set(struct task_struct *target, |
31 | const void *kbuf, const void __user *ubuf) |
32 | { |
33 | int ret; |
34 | - struct pt_regs newregs; |
35 | + struct pt_regs newregs = *task_pt_regs(target); |
36 | |
37 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
38 | &newregs, |
39 | diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c |
40 | index daafcf121ce0..c095455d496e 100644 |
41 | --- a/arch/arm/mm/fault.c |
42 | +++ b/arch/arm/mm/fault.c |
43 | @@ -610,9 +610,9 @@ static int __init early_abort_handler(unsigned long addr, unsigned int fsr, |
44 | |
45 | void __init early_abt_enable(void) |
46 | { |
47 | - fsr_info[22].fn = early_abort_handler; |
48 | + fsr_info[FSR_FS_AEA].fn = early_abort_handler; |
49 | local_abt_enable(); |
50 | - fsr_info[22].fn = do_bad; |
51 | + fsr_info[FSR_FS_AEA].fn = do_bad; |
52 | } |
53 | |
54 | #ifndef CONFIG_ARM_LPAE |
55 | diff --git a/arch/arm/mm/fault.h b/arch/arm/mm/fault.h |
56 | index 05ec5e0df32d..78830657cab3 100644 |
57 | --- a/arch/arm/mm/fault.h |
58 | +++ b/arch/arm/mm/fault.h |
59 | @@ -11,11 +11,15 @@ |
60 | #define FSR_FS5_0 (0x3f) |
61 | |
62 | #ifdef CONFIG_ARM_LPAE |
63 | +#define FSR_FS_AEA 17 |
64 | + |
65 | static inline int fsr_fs(unsigned int fsr) |
66 | { |
67 | return fsr & FSR_FS5_0; |
68 | } |
69 | #else |
70 | +#define FSR_FS_AEA 22 |
71 | + |
72 | static inline int fsr_fs(unsigned int fsr) |
73 | { |
74 | return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6; |
75 | diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
76 | index 1e5d2f07416b..8ca533b8c606 100644 |
77 | --- a/arch/x86/kernel/apic/io_apic.c |
78 | +++ b/arch/x86/kernel/apic/io_apic.c |
79 | @@ -1875,7 +1875,6 @@ static struct irq_chip ioapic_chip __read_mostly = { |
80 | .irq_ack = irq_chip_ack_parent, |
81 | .irq_eoi = ioapic_ack_level, |
82 | .irq_set_affinity = ioapic_set_affinity, |
83 | - .irq_retrigger = irq_chip_retrigger_hierarchy, |
84 | .flags = IRQCHIP_SKIP_SET_WAKE, |
85 | }; |
86 | |
87 | @@ -1887,7 +1886,6 @@ static struct irq_chip ioapic_ir_chip __read_mostly = { |
88 | .irq_ack = irq_chip_ack_parent, |
89 | .irq_eoi = ioapic_ir_ack_level, |
90 | .irq_set_affinity = ioapic_set_affinity, |
91 | - .irq_retrigger = irq_chip_retrigger_hierarchy, |
92 | .flags = IRQCHIP_SKIP_SET_WAKE, |
93 | }; |
94 | |
95 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
96 | index 909d1d71d130..4f5d07bb3511 100644 |
97 | --- a/drivers/gpu/drm/i915/intel_display.c |
98 | +++ b/drivers/gpu/drm/i915/intel_display.c |
99 | @@ -3948,10 +3948,10 @@ static void page_flip_completed(struct intel_crtc *intel_crtc) |
100 | drm_crtc_vblank_put(&intel_crtc->base); |
101 | |
102 | wake_up_all(&dev_priv->pending_flip_queue); |
103 | - queue_work(dev_priv->wq, &work->work); |
104 | - |
105 | trace_i915_flip_complete(intel_crtc->plane, |
106 | work->pending_flip_obj); |
107 | + |
108 | + queue_work(dev_priv->wq, &work->work); |
109 | } |
110 | |
111 | void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) |
112 | diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |
113 | index bdbd80423b17..9ff2881f933d 100644 |
114 | --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |
115 | +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |
116 | @@ -900,9 +900,7 @@ |
117 | |
118 | static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) |
119 | { |
120 | - u8 __iomem *reg_addr = ACCESS_ONCE(base); |
121 | - |
122 | - writel(value, reg_addr + reg); |
123 | + writel(value, base + reg); |
124 | } |
125 | |
126 | #define dsaf_write_dev(a, reg, value) \ |
127 | @@ -910,9 +908,7 @@ static inline void dsaf_write_reg(void __iomem *base, u32 reg, u32 value) |
128 | |
129 | static inline u32 dsaf_read_reg(u8 __iomem *base, u32 reg) |
130 | { |
131 | - u8 __iomem *reg_addr = ACCESS_ONCE(base); |
132 | - |
133 | - return readl(reg_addr + reg); |
134 | + return readl(base + reg); |
135 | } |
136 | |
137 | #define dsaf_read_dev(a, reg) \ |
138 | diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c |
139 | index 7a601d8c615e..e8a09ff9e724 100644 |
140 | --- a/drivers/net/hyperv/netvsc_drv.c |
141 | +++ b/drivers/net/hyperv/netvsc_drv.c |
142 | @@ -854,7 +854,6 @@ static int netvsc_set_channels(struct net_device *net, |
143 | } |
144 | goto recover; |
145 | } |
146 | - netif_set_gso_max_size(net, NETVSC_GSO_MAX_SIZE); |
147 | |
148 | out: |
149 | netvsc_open(net); |
150 | @@ -1142,6 +1141,7 @@ static int netvsc_probe(struct hv_device *dev, |
151 | nvdev = hv_get_drvdata(dev); |
152 | netif_set_real_num_tx_queues(net, nvdev->num_chn); |
153 | netif_set_real_num_rx_queues(net, nvdev->num_chn); |
154 | + netif_set_gso_max_size(net, NETVSC_GSO_MAX_SIZE); |
155 | |
156 | ret = register_netdev(net); |
157 | if (ret != 0) { |
158 | diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c |
159 | index d6abf191122a..1f445f357da1 100644 |
160 | --- a/drivers/net/xen-netfront.c |
161 | +++ b/drivers/net/xen-netfront.c |
162 | @@ -1391,6 +1391,8 @@ static void xennet_disconnect_backend(struct netfront_info *info) |
163 | for (i = 0; i < num_queues && info->queues; ++i) { |
164 | struct netfront_queue *queue = &info->queues[i]; |
165 | |
166 | + del_timer_sync(&queue->rx_refill_timer); |
167 | + |
168 | if (queue->tx_irq && (queue->tx_irq == queue->rx_irq)) |
169 | unbind_from_irqhandler(queue->tx_irq, queue); |
170 | if (queue->tx_irq && (queue->tx_irq != queue->rx_irq)) { |
171 | @@ -1745,7 +1747,6 @@ static void xennet_destroy_queues(struct netfront_info *info) |
172 | |
173 | if (netif_running(info->netdev)) |
174 | napi_disable(&queue->napi); |
175 | - del_timer_sync(&queue->rx_refill_timer); |
176 | netif_napi_del(&queue->napi); |
177 | } |
178 | |
179 | diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c |
180 | index 75f820ca17b7..27ff38f839fc 100644 |
181 | --- a/drivers/s390/scsi/zfcp_fsf.c |
182 | +++ b/drivers/s390/scsi/zfcp_fsf.c |
183 | @@ -1583,7 +1583,7 @@ out: |
184 | int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) |
185 | { |
186 | struct zfcp_qdio *qdio = wka_port->adapter->qdio; |
187 | - struct zfcp_fsf_req *req = NULL; |
188 | + struct zfcp_fsf_req *req; |
189 | int retval = -EIO; |
190 | |
191 | spin_lock_irq(&qdio->req_q_lock); |
192 | @@ -1612,7 +1612,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) |
193 | zfcp_fsf_req_free(req); |
194 | out: |
195 | spin_unlock_irq(&qdio->req_q_lock); |
196 | - if (req && !IS_ERR(req)) |
197 | + if (!retval) |
198 | zfcp_dbf_rec_run_wka("fsowp_1", wka_port, req->req_id); |
199 | return retval; |
200 | } |
201 | @@ -1638,7 +1638,7 @@ static void zfcp_fsf_close_wka_port_handler(struct zfcp_fsf_req *req) |
202 | int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) |
203 | { |
204 | struct zfcp_qdio *qdio = wka_port->adapter->qdio; |
205 | - struct zfcp_fsf_req *req = NULL; |
206 | + struct zfcp_fsf_req *req; |
207 | int retval = -EIO; |
208 | |
209 | spin_lock_irq(&qdio->req_q_lock); |
210 | @@ -1667,7 +1667,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) |
211 | zfcp_fsf_req_free(req); |
212 | out: |
213 | spin_unlock_irq(&qdio->req_q_lock); |
214 | - if (req && !IS_ERR(req)) |
215 | + if (!retval) |
216 | zfcp_dbf_rec_run_wka("fscwp_1", wka_port, req->req_id); |
217 | return retval; |
218 | } |
219 | diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c |
220 | index 0d351cd3191b..26d38b1a45ab 100644 |
221 | --- a/drivers/scsi/aacraid/comminit.c |
222 | +++ b/drivers/scsi/aacraid/comminit.c |
223 | @@ -50,9 +50,13 @@ struct aac_common aac_config = { |
224 | |
225 | static inline int aac_is_msix_mode(struct aac_dev *dev) |
226 | { |
227 | - u32 status; |
228 | + u32 status = 0; |
229 | |
230 | - status = src_readl(dev, MUnit.OMR); |
231 | + if (dev->pdev->device == PMC_DEVICE_S6 || |
232 | + dev->pdev->device == PMC_DEVICE_S7 || |
233 | + dev->pdev->device == PMC_DEVICE_S8) { |
234 | + status = src_readl(dev, MUnit.OMR); |
235 | + } |
236 | return (status & AAC_INT_MODE_MSIX); |
237 | } |
238 | |
239 | diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
240 | index 8cead04f26d6..f6a8e9958e75 100644 |
241 | --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
242 | +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c |
243 | @@ -51,6 +51,7 @@ |
244 | #include <linux/workqueue.h> |
245 | #include <linux/delay.h> |
246 | #include <linux/pci.h> |
247 | +#include <linux/pci-aspm.h> |
248 | #include <linux/interrupt.h> |
249 | #include <linux/aer.h> |
250 | #include <linux/raid_class.h> |
251 | @@ -8483,6 +8484,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
252 | |
253 | switch (hba_mpi_version) { |
254 | case MPI2_VERSION: |
255 | + pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | |
256 | + PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM); |
257 | /* Use mpt2sas driver host template for SAS 2.0 HBA's */ |
258 | shost = scsi_host_alloc(&mpt2sas_driver_template, |
259 | sizeof(struct MPT3SAS_ADAPTER)); |
260 | diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c |
261 | index dcd5ed26eb18..356c80fbb304 100644 |
262 | --- a/drivers/target/target_core_device.c |
263 | +++ b/drivers/target/target_core_device.c |
264 | @@ -362,7 +362,15 @@ int core_enable_device_list_for_node( |
265 | kfree(new); |
266 | return -EINVAL; |
267 | } |
268 | - BUG_ON(orig->se_lun_acl != NULL); |
269 | + if (orig->se_lun_acl != NULL) { |
270 | + pr_warn_ratelimited("Detected existing explicit" |
271 | + " se_lun_acl->se_lun_group reference for %s" |
272 | + " mapped_lun: %llu, failing\n", |
273 | + nacl->initiatorname, mapped_lun); |
274 | + mutex_unlock(&nacl->lun_entry_mutex); |
275 | + kfree(new); |
276 | + return -EINVAL; |
277 | + } |
278 | |
279 | rcu_assign_pointer(new->se_lun, lun); |
280 | rcu_assign_pointer(new->se_lun_acl, lun_acl); |
281 | diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c |
282 | index c220bb8dfa9d..2e27b1034ede 100644 |
283 | --- a/drivers/target/target_core_sbc.c |
284 | +++ b/drivers/target/target_core_sbc.c |
285 | @@ -442,6 +442,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success, |
286 | int *post_ret) |
287 | { |
288 | struct se_device *dev = cmd->se_dev; |
289 | + sense_reason_t ret = TCM_NO_SENSE; |
290 | |
291 | /* |
292 | * Only set SCF_COMPARE_AND_WRITE_POST to force a response fall-through |
293 | @@ -449,9 +450,12 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success, |
294 | * sent to the backend driver. |
295 | */ |
296 | spin_lock_irq(&cmd->t_state_lock); |
297 | - if ((cmd->transport_state & CMD_T_SENT) && !cmd->scsi_status) { |
298 | + if (cmd->transport_state & CMD_T_SENT) { |
299 | cmd->se_cmd_flags |= SCF_COMPARE_AND_WRITE_POST; |
300 | *post_ret = 1; |
301 | + |
302 | + if (cmd->scsi_status == SAM_STAT_CHECK_CONDITION) |
303 | + ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
304 | } |
305 | spin_unlock_irq(&cmd->t_state_lock); |
306 | |
307 | @@ -461,7 +465,7 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success, |
308 | */ |
309 | up(&dev->caw_sem); |
310 | |
311 | - return TCM_NO_SENSE; |
312 | + return ret; |
313 | } |
314 | |
315 | static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success, |
316 | diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c |
317 | index 2a67af4e2e13..aa517c4fadb9 100644 |
318 | --- a/drivers/target/target_core_transport.c |
319 | +++ b/drivers/target/target_core_transport.c |
320 | @@ -3058,7 +3058,6 @@ static void target_tmr_work(struct work_struct *work) |
321 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
322 | goto check_stop; |
323 | } |
324 | - cmd->t_state = TRANSPORT_ISTATE_PROCESSING; |
325 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
326 | |
327 | cmd->se_tfo->queue_tm_rsp(cmd); |
328 | @@ -3071,11 +3070,25 @@ int transport_generic_handle_tmr( |
329 | struct se_cmd *cmd) |
330 | { |
331 | unsigned long flags; |
332 | + bool aborted = false; |
333 | |
334 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
335 | - cmd->transport_state |= CMD_T_ACTIVE; |
336 | + if (cmd->transport_state & CMD_T_ABORTED) { |
337 | + aborted = true; |
338 | + } else { |
339 | + cmd->t_state = TRANSPORT_ISTATE_PROCESSING; |
340 | + cmd->transport_state |= CMD_T_ACTIVE; |
341 | + } |
342 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
343 | |
344 | + if (aborted) { |
345 | + pr_warn_ratelimited("handle_tmr caught CMD_T_ABORTED TMR %d" |
346 | + "ref_tag: %llu tag: %llu\n", cmd->se_tmr_req->function, |
347 | + cmd->se_tmr_req->ref_task_tag, cmd->tag); |
348 | + transport_cmd_check_stop_to_fabric(cmd); |
349 | + return 0; |
350 | + } |
351 | + |
352 | INIT_WORK(&cmd->work, target_tmr_work); |
353 | queue_work(cmd->se_dev->tmr_wq, &cmd->work); |
354 | return 0; |
355 | diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c |
356 | index 153a6f255b6d..6415e9b09a52 100644 |
357 | --- a/drivers/target/target_core_xcopy.c |
358 | +++ b/drivers/target/target_core_xcopy.c |
359 | @@ -836,7 +836,7 @@ out: |
360 | " CHECK_CONDITION -> sending response\n", rc); |
361 | ec_cmd->scsi_status = SAM_STAT_CHECK_CONDITION; |
362 | } |
363 | - target_complete_cmd(ec_cmd, SAM_STAT_CHECK_CONDITION); |
364 | + target_complete_cmd(ec_cmd, ec_cmd->scsi_status); |
365 | } |
366 | |
367 | sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) |
368 | diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h |
369 | index 59915ea5373c..a91b3b75da0f 100644 |
370 | --- a/include/linux/cpumask.h |
371 | +++ b/include/linux/cpumask.h |
372 | @@ -556,7 +556,7 @@ static inline void cpumask_copy(struct cpumask *dstp, |
373 | static inline int cpumask_parse_user(const char __user *buf, int len, |
374 | struct cpumask *dstp) |
375 | { |
376 | - return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpu_ids); |
377 | + return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits); |
378 | } |
379 | |
380 | /** |
381 | @@ -571,7 +571,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len, |
382 | struct cpumask *dstp) |
383 | { |
384 | return bitmap_parselist_user(buf, len, cpumask_bits(dstp), |
385 | - nr_cpu_ids); |
386 | + nr_cpumask_bits); |
387 | } |
388 | |
389 | /** |
390 | @@ -586,7 +586,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp) |
391 | char *nl = strchr(buf, '\n'); |
392 | unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf); |
393 | |
394 | - return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpu_ids); |
395 | + return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); |
396 | } |
397 | |
398 | /** |
399 | @@ -598,7 +598,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp) |
400 | */ |
401 | static inline int cpulist_parse(const char *buf, struct cpumask *dstp) |
402 | { |
403 | - return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpu_ids); |
404 | + return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits); |
405 | } |
406 | |
407 | /** |
408 | diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c |
409 | index f7bb6829b415..9063e8e736ad 100644 |
410 | --- a/net/mac80211/mesh.c |
411 | +++ b/net/mac80211/mesh.c |
412 | @@ -355,7 +355,7 @@ int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata, |
413 | /* fast-forward to vendor IEs */ |
414 | offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0); |
415 | |
416 | - if (offset) { |
417 | + if (offset < ifmsh->ie_len) { |
418 | len = ifmsh->ie_len - offset; |
419 | data = ifmsh->ie + offset; |
420 | if (skb_tailroom(skb) < len) |
421 | diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c |
422 | index d0cfaa9f19d0..4b56c3b6c25f 100644 |
423 | --- a/security/selinux/hooks.c |
424 | +++ b/security/selinux/hooks.c |
425 | @@ -5640,7 +5640,7 @@ static int selinux_setprocattr(struct task_struct *p, |
426 | return error; |
427 | |
428 | /* Obtain a SID for the context, if one was specified. */ |
429 | - if (size && str[1] && str[1] != '\n') { |
430 | + if (size && str[0] && str[0] != '\n') { |
431 | if (str[size-1] == '\n') { |
432 | str[size-1] = 0; |
433 | size--; |
434 | diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c |
435 | index c850345c43b5..dfa5156f3585 100644 |
436 | --- a/sound/core/seq/seq_memory.c |
437 | +++ b/sound/core/seq/seq_memory.c |
438 | @@ -419,7 +419,6 @@ int snd_seq_pool_done(struct snd_seq_pool *pool) |
439 | { |
440 | unsigned long flags; |
441 | struct snd_seq_event_cell *ptr; |
442 | - int max_count = 5 * HZ; |
443 | |
444 | if (snd_BUG_ON(!pool)) |
445 | return -EINVAL; |
446 | @@ -432,14 +431,8 @@ int snd_seq_pool_done(struct snd_seq_pool *pool) |
447 | if (waitqueue_active(&pool->output_sleep)) |
448 | wake_up(&pool->output_sleep); |
449 | |
450 | - while (atomic_read(&pool->counter) > 0) { |
451 | - if (max_count == 0) { |
452 | - pr_warn("ALSA: snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); |
453 | - break; |
454 | - } |
455 | + while (atomic_read(&pool->counter) > 0) |
456 | schedule_timeout_uninterruptible(1); |
457 | - max_count--; |
458 | - } |
459 | |
460 | /* release all resources */ |
461 | spin_lock_irqsave(&pool->lock, flags); |
462 | diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c |
463 | index 0bec02e89d51..450c5187eecb 100644 |
464 | --- a/sound/core/seq/seq_queue.c |
465 | +++ b/sound/core/seq/seq_queue.c |
466 | @@ -181,6 +181,8 @@ void __exit snd_seq_queues_delete(void) |
467 | } |
468 | } |
469 | |
470 | +static void queue_use(struct snd_seq_queue *queue, int client, int use); |
471 | + |
472 | /* allocate a new queue - |
473 | * return queue index value or negative value for error |
474 | */ |
475 | @@ -192,11 +194,11 @@ int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) |
476 | if (q == NULL) |
477 | return -ENOMEM; |
478 | q->info_flags = info_flags; |
479 | + queue_use(q, client, 1); |
480 | if (queue_list_add(q) < 0) { |
481 | queue_delete(q); |
482 | return -ENOMEM; |
483 | } |
484 | - snd_seq_queue_use(q->queue, client, 1); /* use this queue */ |
485 | return q->queue; |
486 | } |
487 | |
488 | @@ -502,19 +504,9 @@ int snd_seq_queue_timer_set_tempo(int queueid, int client, |
489 | return result; |
490 | } |
491 | |
492 | - |
493 | -/* use or unuse this queue - |
494 | - * if it is the first client, starts the timer. |
495 | - * if it is not longer used by any clients, stop the timer. |
496 | - */ |
497 | -int snd_seq_queue_use(int queueid, int client, int use) |
498 | +/* use or unuse this queue */ |
499 | +static void queue_use(struct snd_seq_queue *queue, int client, int use) |
500 | { |
501 | - struct snd_seq_queue *queue; |
502 | - |
503 | - queue = queueptr(queueid); |
504 | - if (queue == NULL) |
505 | - return -EINVAL; |
506 | - mutex_lock(&queue->timer_mutex); |
507 | if (use) { |
508 | if (!test_and_set_bit(client, queue->clients_bitmap)) |
509 | queue->clients++; |
510 | @@ -529,6 +521,21 @@ int snd_seq_queue_use(int queueid, int client, int use) |
511 | } else { |
512 | snd_seq_timer_close(queue); |
513 | } |
514 | +} |
515 | + |
516 | +/* use or unuse this queue - |
517 | + * if it is the first client, starts the timer. |
518 | + * if it is not longer used by any clients, stop the timer. |
519 | + */ |
520 | +int snd_seq_queue_use(int queueid, int client, int use) |
521 | +{ |
522 | + struct snd_seq_queue *queue; |
523 | + |
524 | + queue = queueptr(queueid); |
525 | + if (queue == NULL) |
526 | + return -EINVAL; |
527 | + mutex_lock(&queue->timer_mutex); |
528 | + queue_use(queue, client, use); |
529 | mutex_unlock(&queue->timer_mutex); |
530 | queuefree(queue); |
531 | return 0; |