Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4cd46d0c
Commit
4cd46d0c
authored
Nov 14, 2017
by
Vinod Koul
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/pl330' into for-linus
parents
9427702d
e5887103
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
drivers/dma/pl330.c
drivers/dma/pl330.c
+20
-19
No files found.
drivers/dma/pl330.c
View file @
4cd46d0c
...
@@ -2390,7 +2390,8 @@ static inline void _init_desc(struct dma_pl330_desc *desc)
...
@@ -2390,7 +2390,8 @@ static inline void _init_desc(struct dma_pl330_desc *desc)
}
}
/* Returns the number of descriptors added to the DMAC pool */
/* Returns the number of descriptors added to the DMAC pool */
static
int
add_desc
(
struct
pl330_dmac
*
pl330
,
gfp_t
flg
,
int
count
)
static
int
add_desc
(
struct
list_head
*
pool
,
spinlock_t
*
lock
,
gfp_t
flg
,
int
count
)
{
{
struct
dma_pl330_desc
*
desc
;
struct
dma_pl330_desc
*
desc
;
unsigned
long
flags
;
unsigned
long
flags
;
...
@@ -2400,27 +2401,28 @@ static int add_desc(struct pl330_dmac *pl330, gfp_t flg, int count)
...
@@ -2400,27 +2401,28 @@ static int add_desc(struct pl330_dmac *pl330, gfp_t flg, int count)
if
(
!
desc
)
if
(
!
desc
)
return
0
;
return
0
;
spin_lock_irqsave
(
&
pl330
->
pool_
lock
,
flags
);
spin_lock_irqsave
(
lock
,
flags
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
_init_desc
(
&
desc
[
i
]);
_init_desc
(
&
desc
[
i
]);
list_add_tail
(
&
desc
[
i
].
node
,
&
pl330
->
desc_
pool
);
list_add_tail
(
&
desc
[
i
].
node
,
pool
);
}
}
spin_unlock_irqrestore
(
&
pl330
->
pool_
lock
,
flags
);
spin_unlock_irqrestore
(
lock
,
flags
);
return
count
;
return
count
;
}
}
static
struct
dma_pl330_desc
*
pluck_desc
(
struct
pl330_dmac
*
pl330
)
static
struct
dma_pl330_desc
*
pluck_desc
(
struct
list_head
*
pool
,
spinlock_t
*
lock
)
{
{
struct
dma_pl330_desc
*
desc
=
NULL
;
struct
dma_pl330_desc
*
desc
=
NULL
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
pl330
->
pool_
lock
,
flags
);
spin_lock_irqsave
(
lock
,
flags
);
if
(
!
list_empty
(
&
pl330
->
desc_
pool
))
{
if
(
!
list_empty
(
pool
))
{
desc
=
list_entry
(
p
l330
->
desc_pool
.
next
,
desc
=
list_entry
(
p
ool
->
next
,
struct
dma_pl330_desc
,
node
);
struct
dma_pl330_desc
,
node
);
list_del_init
(
&
desc
->
node
);
list_del_init
(
&
desc
->
node
);
...
@@ -2429,7 +2431,7 @@ static struct dma_pl330_desc *pluck_desc(struct pl330_dmac *pl330)
...
@@ -2429,7 +2431,7 @@ static struct dma_pl330_desc *pluck_desc(struct pl330_dmac *pl330)
desc
->
txd
.
callback
=
NULL
;
desc
->
txd
.
callback
=
NULL
;
}
}
spin_unlock_irqrestore
(
&
pl330
->
pool_
lock
,
flags
);
spin_unlock_irqrestore
(
lock
,
flags
);
return
desc
;
return
desc
;
}
}
...
@@ -2441,20 +2443,18 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch)
...
@@ -2441,20 +2443,18 @@ static struct dma_pl330_desc *pl330_get_desc(struct dma_pl330_chan *pch)
struct
dma_pl330_desc
*
desc
;
struct
dma_pl330_desc
*
desc
;
/* Pluck one desc from the pool of DMAC */
/* Pluck one desc from the pool of DMAC */
desc
=
pluck_desc
(
pl330
);
desc
=
pluck_desc
(
&
pl330
->
desc_pool
,
&
pl330
->
pool_lock
);
/* If the DMAC pool is empty, alloc new */
/* If the DMAC pool is empty, alloc new */
if
(
!
desc
)
{
if
(
!
desc
)
{
if
(
!
add_desc
(
pl330
,
GFP_ATOMIC
,
1
))
DEFINE_SPINLOCK
(
lock
);
return
NULL
;
LIST_HEAD
(
pool
)
;
/* Try again */
if
(
!
add_desc
(
&
pool
,
&
lock
,
GFP_ATOMIC
,
1
))
desc
=
pluck_desc
(
pl330
);
if
(
!
desc
)
{
dev_err
(
pch
->
dmac
->
ddma
.
dev
,
"%s:%d ALERT!
\n
"
,
__func__
,
__LINE__
);
return
NULL
;
return
NULL
;
}
desc
=
pluck_desc
(
&
pool
,
&
lock
);
WARN_ON
(
!
desc
||
!
list_empty
(
&
pool
));
}
}
/* Initialize the descriptor */
/* Initialize the descriptor */
...
@@ -2868,7 +2868,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
...
@@ -2868,7 +2868,8 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
spin_lock_init
(
&
pl330
->
pool_lock
);
spin_lock_init
(
&
pl330
->
pool_lock
);
/* Create a descriptor pool of default size */
/* Create a descriptor pool of default size */
if
(
!
add_desc
(
pl330
,
GFP_KERNEL
,
NR_DEFAULT_DESC
))
if
(
!
add_desc
(
&
pl330
->
desc_pool
,
&
pl330
->
pool_lock
,
GFP_KERNEL
,
NR_DEFAULT_DESC
))
dev_warn
(
&
adev
->
dev
,
"unable to allocate desc
\n
"
);
dev_warn
(
&
adev
->
dev
,
"unable to allocate desc
\n
"
);
INIT_LIST_HEAD
(
&
pd
->
channels
);
INIT_LIST_HEAD
(
&
pd
->
channels
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment