Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Simple PCIe FMC carrier SPEC
Commits
049dbff2
Commit
049dbff2
authored
Jul 16, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: group dbg creation in one function
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
d8eca4c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
42 deletions
+54
-42
spec-core-fpga.c
software/kernel/spec-core-fpga.c
+54
-42
No files found.
software/kernel/spec-core-fpga.c
View file @
049dbff2
...
...
@@ -147,7 +147,58 @@ static const struct file_operations spec_fpga_dbg_bld_info_ops = {
.
release
=
single_release
,
};
static
int
spec_fpga_dbg_init
(
struct
spec_fpga
*
spec_fpga
)
{
struct
pci_dev
*
pdev
=
to_pci_dev
(
spec_fpga
->
dev
.
parent
);
struct
spec_gn412x
*
spec_gn412x
=
pci_get_drvdata
(
pdev
);
int
err
;
spec_fpga
->
dbg_dir_fpga
=
debugfs_create_dir
(
dev_name
(
&
spec_fpga
->
dev
),
spec_gn412x
->
dbg_dir
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_dir_fpga
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_dir_fpga
);
dev_err
(
&
spec_fpga
->
dev
,
"Cannot create debugfs directory
\"
%s
\"
(%d)
\n
"
,
dev_name
(
&
spec_fpga
->
dev
),
err
);
return
err
;
}
spec_fpga
->
dbg_csr_reg
.
regs
=
spec_fpga_debugfs_reg32
;
spec_fpga
->
dbg_csr_reg
.
nregs
=
ARRAY_SIZE
(
spec_fpga_debugfs_reg32
);
spec_fpga
->
dbg_csr_reg
.
base
=
spec_fpga
->
fpga
;
spec_fpga
->
dbg_csr
=
debugfs_create_regset32
(
SPEC_DBG_CSR_NAME
,
0200
,
spec_fpga
->
dbg_dir_fpga
,
&
spec_fpga
->
dbg_csr_reg
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_csr
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_csr
);
dev_warn
(
&
spec_fpga
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
SPEC_DBG_CSR_NAME
,
err
);
goto
err
;
}
spec_fpga
->
dbg_bld_info
=
debugfs_create_file
(
SPEC_DBG_BLD_INFO_NAME
,
0444
,
spec_fpga
->
dbg_dir_fpga
,
spec_fpga
,
&
spec_fpga_dbg_bld_info_ops
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_bld_info
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_bld_info
);
dev_err
(
&
spec_fpga
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
SPEC_DBG_BLD_INFO_NAME
,
err
);
goto
err
;
}
return
0
;
err:
debugfs_remove_recursive
(
spec_fpga
->
dbg_dir_fpga
);
return
err
;
}
static
void
spec_fpga_dbg_exit
(
struct
spec_fpga
*
spec_fpga
)
{
debugfs_remove_recursive
(
spec_fpga
->
dbg_dir_fpga
);
}
static
inline
uint32_t
spec_fpga_csr_app_offset
(
struct
spec_fpga
*
spec_fpga
)
{
...
...
@@ -724,50 +775,10 @@ int spec_fpga_init(struct spec_gn412x *spec_gn412x)
err
=
spec_fpga_app_init
(
spec_fpga
);
if
(
err
)
goto
err_app
;
spec_fpga
->
dbg_dir_fpga
=
debugfs_create_dir
(
dev_name
(
&
spec_fpga
->
dev
),
spec_gn412x
->
dbg_dir
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_dir_fpga
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_dir_fpga
);
dev_err
(
&
spec_fpga
->
dev
,
"Cannot create debugfs directory
\"
%s
\"
(%d)
\n
"
,
dev_name
(
&
spec_fpga
->
dev
),
err
);
goto
err_dbg_dir
;
}
spec_fpga
->
dbg_csr_reg
.
regs
=
spec_fpga_debugfs_reg32
;
spec_fpga
->
dbg_csr_reg
.
nregs
=
ARRAY_SIZE
(
spec_fpga_debugfs_reg32
);
spec_fpga
->
dbg_csr_reg
.
base
=
spec_fpga
->
fpga
;
spec_fpga
->
dbg_csr
=
debugfs_create_regset32
(
SPEC_DBG_CSR_NAME
,
0200
,
spec_fpga
->
dbg_dir_fpga
,
&
spec_fpga
->
dbg_csr_reg
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_csr
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_csr
);
dev_warn
(
&
spec_fpga
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
SPEC_DBG_CSR_NAME
,
err
);
goto
err_dbg_csr
;
}
spec_fpga
->
dbg_bld_info
=
debugfs_create_file
(
SPEC_DBG_BLD_INFO_NAME
,
0444
,
spec_fpga
->
dbg_dir_fpga
,
spec_fpga
,
&
spec_fpga_dbg_bld_info_ops
);
if
(
IS_ERR_OR_NULL
(
spec_fpga
->
dbg_bld_info
))
{
err
=
PTR_ERR
(
spec_fpga
->
dbg_bld_info
);
dev_err
(
&
spec_fpga
->
dev
,
"Cannot create debugfs file
\"
%s
\"
(%d)
\n
"
,
SPEC_DBG_BLD_INFO_NAME
,
err
);
goto
err_dbg_bld
;
}
spec_fpga_dbg_init
(
spec_fpga
);
return
0
;
err_dbg_bld:
err_dbg_csr:
debugfs_remove_recursive
(
spec_fpga
->
dbg_dir_fpga
);
err_dbg_dir:
spec_fpga_app_exit
(
spec_fpga
);
err_app:
spec_fmc_exit
(
spec_fpga
);
err_fmc:
...
...
@@ -792,11 +803,12 @@ int spec_fpga_exit(struct spec_gn412x *spec_gn412x)
if
(
!
spec_fpga_is_valid
(
spec_gn412x
,
spec_fpga
->
meta
))
return
0
;
debugfs_remove_recursive
(
spec_fpga
->
dbg_dir
_fpga
);
spec_fpga_dbg_exit
(
spec
_fpga
);
spec_fpga_app_exit
(
spec_fpga
);
spec_fmc_exit
(
spec_fpga
);
spec_fpga_devices_exit
(
spec_fpga
);
spec_fpga_vic_exit
(
spec_fpga
);
device_unregister
(
&
spec_fpga
->
dev
);
iounmap
(
spec_fpga
->
fpga
);
kfree
(
spec_fpga
);
...
...
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