Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmytro Levit
Software
Commits
ac6ebd1d
Commit
ac6ebd1d
authored
6 years ago
by
Patrick Robbe
Browse files
Options
Downloads
Patches
Plain Diff
Add driver files
parent
587c4954
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Driver/pcie40_driver/common.c
+33
-0
33 additions, 0 deletions
Driver/pcie40_driver/common.c
with
33 additions
and
0 deletions
Driver/pcie40_driver/common.c
0 → 100644
+
33
−
0
View file @
ac6ebd1d
#define P40_FMT "P40:%s(): "
#include
"common.h"
int
pcie40_setup_cdev
(
struct
class
*
cls
,
struct
cdev
*
cdev
,
dev_t
dev_num
,
int
minor
,
int
bar
,
const
char
*
dev_name
,
int
dev_id
,
struct
file_operations
*
fops
)
{
int
rc
=
0
;
char
dev_name_full
[
16
]
=
{
0
};
snprintf
(
dev_name_full
,
sizeof
(
dev_name_full
),
"pcie40_%d_%s"
,
dev_id
,
dev_name
);
printk
(
P40_DIAG
"device_create /dev/%s BAR=%d MAJ=%d, MIN=%d
\n
"
,
P40_PARM
,
dev_name_full
,
bar
,
MAJOR
(
dev_num
),
MINOR
(
dev_num
)
+
minor
);
if
(
device_create
(
cls
,
NULL
,
MKDEV
(
MAJOR
(
dev_num
),
MINOR
(
dev_num
)
+
minor
),
NULL
,
dev_name_full
)
==
NULL
){
rc
=
-
1
;
printk
(
P40_DIAG
"device_create()
\n
"
,
P40_PARM
);
goto
err_device_create
;
}
cdev_init
(
cdev
,
fops
);
rc
=
cdev_add
(
cdev
,
MKDEV
(
MAJOR
(
dev_num
),
MINOR
(
dev_num
)
+
minor
),
1
);
if
(
rc
<
0
){
printk
(
P40_DIAG
"cdev_add()
\n
"
,
P40_PARM
);
goto
err_cdev_add
;
}
return
0
;
err_cdev_add:
device_destroy
(
cls
,
MKDEV
(
MAJOR
(
dev_num
),
MINOR
(
dev_num
)
+
minor
));
err_device_create:
//err_no_bar:
return
rc
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment