Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Simple VME FMC Carrier SVEC
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Projects
Simple VME FMC Carrier SVEC
Commits
cf6b2894
Commit
cf6b2894
authored
5 years ago
by
Federico Vaga
Browse files
Options
Downloads
Patches
Plain Diff
sw:drv: fix I2C filter function
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
84ff1837
Branches
Branches containing commit
Tags
v1.4.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
software/kernel/svec-core-fpga.c
+17
-5
17 additions, 5 deletions
software/kernel/svec-core-fpga.c
with
17 additions
and
5 deletions
software/kernel/svec-core-fpga.c
+
17
−
5
View file @
cf6b2894
...
...
@@ -516,9 +516,15 @@ static const struct fmc_carrier_operations svec_fmc_ops = {
.
is_present
=
svec_fmc_is_present
,
};
struct
svec_i2c_filter
{
struct
svec_fpga
*
svec_fpga
;
unsigned
int
slot_nr
;
};
static
int
svec_i2c_find_adapter
(
struct
device
*
dev
,
void
*
data
)
{
struct
svec_fpga
*
svec_fpga
=
data
;
struct
svec_i2c_filter
*
flt
=
data
;
struct
svec_fpga
*
svec_fpga
=
flt
->
svec_fpga
;
struct
i2c_adapter
*
adap
,
*
adap_parent
;
if
(
dev
->
type
!=
&
i2c_adapter_type
)
...
...
@@ -533,7 +539,11 @@ static int svec_i2c_find_adapter(struct device *dev, void *data)
if
(
&
svec_fpga
->
dev
!=
adap_parent
->
dev
.
parent
->
parent
)
return
0
;
/* Found! Return the bus ID */
if
(
flt
->
slot_nr
>
0
)
{
/* We want the following one */
flt
->
slot_nr
--
;
return
0
;
}
return
i2c_adapter_id
(
adap
);
}
...
...
@@ -544,9 +554,9 @@ static int svec_i2c_find_adapter(struct device *dev, void *data)
*
* Return: the I2C bus to be used
*/
static
int
svec_i2c_get_bus
(
struct
svec_
fpga
*
svec_fpga
)
static
int
svec_i2c_get_bus
(
struct
svec_
i2c_filter
*
flt
)
{
return
i2c_for_each_dev
(
svec_fpga
,
svec_i2c_find_adapter
);
return
i2c_for_each_dev
(
flt
,
svec_i2c_find_adapter
);
}
/**
...
...
@@ -557,7 +567,9 @@ static int svec_fmc_init(struct svec_fpga *svec_fpga)
int
err
,
i
;
for
(
i
=
0
;
i
<
SVEC_FMC_SLOTS
;
++
i
)
{
svec_fpga
->
slot_info
[
i
].
i2c_bus_nr
=
svec_i2c_get_bus
(
svec_fpga
);
struct
svec_i2c_filter
flt
=
{
svec_fpga
,
i
};
svec_fpga
->
slot_info
[
i
].
i2c_bus_nr
=
svec_i2c_get_bus
(
&
flt
);
if
(
svec_fpga
->
slot_info
[
i
].
i2c_bus_nr
<=
0
)
return
-
ENODEV
;
svec_fpga
->
slot_info
[
i
].
ga
=
i
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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