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
Kirill Smelkov
linux
Commits
c5aee51b
Commit
c5aee51b
authored
Sep 30, 2016
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/dma' into spi-next
parents
1a8dabf8
b1b8153c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
drivers/spi/spi.c
drivers/spi/spi.c
+14
-3
No files found.
drivers/spi/spi.c
View file @
c5aee51b
...
...
@@ -37,6 +37,7 @@
#include <linux/kthread.h>
#include <linux/ioport.h>
#include <linux/acpi.h>
#include <linux/highmem.h>
#define CREATE_TRACE_POINTS
#include <trace/events/spi.h>
...
...
@@ -709,6 +710,13 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
{
const
bool
vmalloced_buf
=
is_vmalloc_addr
(
buf
);
unsigned
int
max_seg_size
=
dma_get_max_seg_size
(
dev
);
#ifdef CONFIG_HIGHMEM
const
bool
kmap_buf
=
((
unsigned
long
)
buf
>=
PKMAP_BASE
&&
(
unsigned
long
)
buf
<
(
PKMAP_BASE
+
(
LAST_PKMAP
*
PAGE_SIZE
)));
#else
const
bool
kmap_buf
=
false
;
#endif
int
desc_len
;
int
sgs
;
struct
page
*
vm_page
;
...
...
@@ -716,7 +724,7 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
size_t
min
;
int
i
,
ret
;
if
(
vmalloced_buf
)
{
if
(
vmalloced_buf
||
kmap_buf
)
{
desc_len
=
min_t
(
int
,
max_seg_size
,
PAGE_SIZE
);
sgs
=
DIV_ROUND_UP
(
len
+
offset_in_page
(
buf
),
desc_len
);
}
else
if
(
virt_addr_valid
(
buf
))
{
...
...
@@ -732,10 +740,13 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
for
(
i
=
0
;
i
<
sgs
;
i
++
)
{
if
(
vmalloced_buf
)
{
if
(
vmalloced_buf
||
kmap_buf
)
{
min
=
min_t
(
size_t
,
len
,
desc_len
-
offset_in_page
(
buf
));
vm_page
=
vmalloc_to_page
(
buf
);
if
(
vmalloced_buf
)
vm_page
=
vmalloc_to_page
(
buf
);
else
vm_page
=
kmap_to_page
(
buf
);
if
(
!
vm_page
)
{
sg_free_table
(
sgt
);
return
-
ENOMEM
;
...
...
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