-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path이름 없는 문서
72 lines (63 loc) · 2.56 KB
/
이름 없는 문서
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From aa4225b7015d513e6e688781fd7aadbf04659139 Mon Sep 17 00:00:00 2001
From: Wei Wang <[email protected]>
Date: Tue, 6 Sep 2016 15:40:55 -0700
Subject: [PATCH] sps: add spinlock protection for pipes_q being tainted
Bug: 31119496
Change-Id: I7d71f58e37d5ea85f15625078ab0d6cfa0362bff
---
drivers/platform/msm/sps/sps_bam.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/platform/msm/sps/sps_bam.c b/drivers/platform/msm/sps/sps_bam.c
index 11fd94a3572..c207a7fe4c5 100644
--- a/drivers/platform/msm/sps/sps_bam.c
+++ b/drivers/platform/msm/sps/sps_bam.c
@@ -715,6 +715,7 @@ int sps_bam_pipe_connect(struct sps_pipe *bam_pipe,
void *desc_buf = NULL;
u32 pipe_index;
int result;
+ unsigned long flags;
/* Clear the client pipe state and hw init struct */
pipe_clear(bam_pipe);
@@ -908,8 +909,10 @@ int sps_bam_pipe_connect(struct sps_pipe *bam_pipe,
/* Indicate initialization is complete */
dev->pipes[pipe_index] = bam_pipe;
+ spin_lock_irqsave(&dev->isr_lock, flags);
dev->pipe_active_mask |= 1UL << pipe_index;
list_add_tail(&bam_pipe->list, &dev->pipes_q);
+ spin_unlock_irqrestore(&dev->isr_lock, flags);
bam_pipe->state |= BAM_STATE_INIT;
result = 0;
@@ -938,6 +941,7 @@ int sps_bam_pipe_disconnect(struct sps_bam *dev, u32 pipe_index)
{
struct sps_pipe *pipe;
int result;
+ unsigned long flags;
if (pipe_index >= dev->props.num_pipes) {
SPS_ERR("sps:Invalid BAM %pa pipe: %d\n", BAM_ID(dev),
@@ -949,8 +953,10 @@ int sps_bam_pipe_disconnect(struct sps_bam *dev, u32 pipe_index)
pipe = dev->pipes[pipe_index];
if (BAM_PIPE_IS_ASSIGNED(pipe)) {
if ((dev->pipe_active_mask & (1UL << pipe_index))) {
+ spin_lock_irqsave(&dev->isr_lock, flags);
list_del(&pipe->list);
dev->pipe_active_mask &= ~(1UL << pipe_index);
+ spin_unlock_irqrestore(&dev->isr_lock, flags);
}
dev->pipe_remote_mask &= ~(1UL << pipe_index);
if (pipe->connect.options & SPS_O_NO_DISABLE)
@@ -2018,6 +2024,7 @@ int sps_bam_get_free_count(struct sps_bam *dev, u32 pipe_index,
int sps_bam_set_satellite(struct sps_bam *dev, u32 pipe_index)
{
struct sps_pipe *pipe = dev->pipes[pipe_index];
+ unsigned long flags;
/*
* Switch to satellite control is only supported on processor
@@ -2059,8 +2066,10 @@ int sps_bam_set_satellite(struct sps_bam *dev, u32 pipe_index)
}
/* Indicate satellite control */
+ spin_lock_irqsave(&dev->isr_lock, flags);
list_del(&pipe->list);
dev->pipe_active_mask &= ~(1UL << pipe_index);
+ spin_unlock_irqrestore(&dev->isr_lock, flags);
dev->pipe_remote_mask |= pipe->pipe_index_mask;
pipe->state |= BAM_STATE_REMOTE;