Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC TDC 1ns 5cha
Commits
76cd6f81
Commit
76cd6f81
authored
Nov 23, 2023
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drv: fix indentation
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
17c9672c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
+33
-33
ft-buf.c
software/kernel/ft-buf.c
+33
-33
No files found.
software/kernel/ft-buf.c
View file @
76cd6f81
...
...
@@ -289,44 +289,44 @@ static int sg_alloc_table_from_block(struct device *dev,
struct
sg_table
*
sgt
,
struct
zio_block
*
block
)
{
struct
page
**
pages
;
unsigned
int
nr_pages
;
size_t
max_segment_size
;
void
*
data
;
int
i
;
int
err
=
0
;
struct
page
**
pages
;
unsigned
int
nr_pages
;
size_t
max_segment_size
;
void
*
data
;
int
i
;
int
err
=
0
;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)
struct
scatterlist
*
sg
;
struct
scatterlist
*
sg
;
#endif
if
(
!
block
)
return
-
EINVAL
;
nr_pages
=
ft_zio_block_nr_pages
(
block
);
pages
=
kcalloc
(
nr_pages
,
sizeof
(
struct
page
*
),
GFP_KERNEL
);
if
(
!
pages
)
return
-
ENOMEM
;
data
=
(
void
*
)
block
->
data
;
if
(
is_vmalloc_addr
(
data
))
{
for
(
i
=
0
;
i
<
nr_pages
;
++
i
)
{
pages
[
i
]
=
vmalloc_to_page
(
data
+
PAGE_SIZE
*
i
);
}
}
else
{
for
(
i
=
0
;
i
<
nr_pages
;
++
i
)
pages
[
i
]
=
virt_to_page
(
data
+
PAGE_SIZE
*
i
);
}
max_segment_size
=
dma_get_max_seg_size
(
dev
);
max_segment_size
&=
PAGE_MASK
;
/* to make alloc_table happy */
if
(
!
block
)
return
-
EINVAL
;
nr_pages
=
ft_zio_block_nr_pages
(
block
);
pages
=
kcalloc
(
nr_pages
,
sizeof
(
struct
page
*
),
GFP_KERNEL
);
if
(
!
pages
)
return
-
ENOMEM
;
data
=
(
void
*
)
block
->
data
;
if
(
is_vmalloc_addr
(
data
))
{
for
(
i
=
0
;
i
<
nr_pages
;
++
i
)
{
pages
[
i
]
=
vmalloc_to_page
(
data
+
PAGE_SIZE
*
i
);
}
}
else
{
for
(
i
=
0
;
i
<
nr_pages
;
++
i
)
pages
[
i
]
=
virt_to_page
(
data
+
PAGE_SIZE
*
i
);
}
max_segment_size
=
dma_get_max_seg_size
(
dev
);
max_segment_size
&=
PAGE_MASK
;
/* to make alloc_table happy */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0)
err
=
__sg_alloc_table_from_pages
(
sgt
,
pages
,
nr_pages
,
err
=
__sg_alloc_table_from_pages
(
sgt
,
pages
,
nr_pages
,
offset_in_page
(
data
),
block
->
datalen
,
max_segment_size
,
GFP_KERNEL
);
#else
sg
=
__sg_alloc_table_from_pages
(
sgt
,
pages
,
nr_pages
,
sg
=
__sg_alloc_table_from_pages
(
sgt
,
pages
,
nr_pages
,
offset_in_page
(
data
),
block
->
datalen
,
max_segment_size
,
...
...
@@ -334,13 +334,13 @@ static int sg_alloc_table_from_block(struct device *dev,
0
,
GFP_KERNEL
);
if
(
IS_ERR
(
sg
))
err
=
PTR_ERR
(
sg
);
err
=
PTR_ERR
(
sg
);
#endif
if
(
err
)
sg_free_table
(
sgt
);
sg_free_table
(
sgt
);
kfree
(
pages
);
return
err
;
kfree
(
pages
);
return
err
;
}
static
int
ft_zio_block_dma_map_sg
(
struct
fmctdc_dev
*
ft
,
unsigned
int
ch
,
...
...
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