Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC Bus
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
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
FMC Bus
Commits
2c6089d1
Commit
2c6089d1
authored
Sep 06, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmc-sdb: fixed find_device
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
e8bbbf6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
fmc-sdb.c
kernel/fmc-sdb.c
+9
-3
fmc-sdb.h
kernel/include/linux/fmc-sdb.h
+2
-2
No files found.
kernel/fmc-sdb.c
View file @
2c6089d1
...
...
@@ -190,13 +190,14 @@ void fmc_show_sdb_tree(struct fmc_device *fmc)
EXPORT_SYMBOL
(
fmc_show_sdb_tree
);
signed
long
fmc_find_sdb_device
(
struct
sdb_array
*
tree
,
uint64_t
vid
,
uint32_t
did
)
uint64_t
vid
,
uint32_t
did
,
unsigned
long
*
sz
)
{
signed
long
res
=
-
ENODEV
;
union
sdb_record
*
r
;
struct
sdb_product
*
p
;
struct
sdb_component
*
c
;
int
i
,
n
=
tree
->
len
;
uint64_t
last
,
first
;
/* FIXME: what if the first interconnect is not at zero? */
for
(
i
=
0
;
i
<
n
;
i
++
)
{
...
...
@@ -205,7 +206,8 @@ signed long fmc_find_sdb_device(struct sdb_array *tree,
p
=
&
c
->
product
;
if
(
!
IS_ERR
(
tree
->
subtree
[
i
]))
res
=
fmc_find_sdb_device
(
tree
->
subtree
[
i
],
vid
,
did
);
res
=
fmc_find_sdb_device
(
tree
->
subtree
[
i
],
vid
,
did
,
sz
);
if
(
res
>
0
)
return
res
+
tree
->
baseaddr
;
if
(
r
->
empty
.
record_type
!=
sdb_type_device
)
...
...
@@ -214,7 +216,11 @@ signed long fmc_find_sdb_device(struct sdb_array *tree,
continue
;
if
(
__be32_to_cpu
(
p
->
device_id
)
!=
did
)
continue
;
return
__be64_to_cpu
(
c
->
addr_first
);
/* found */
last
=
__be64_to_cpu
(
c
->
addr_last
);
first
=
__be64_to_cpu
(
c
->
addr_first
);
if
(
sz
)
*
sz
=
(
typeof
(
*
sz
))(
last
+
1
-
first
);
return
first
+
tree
->
baseaddr
;
}
return
res
;
}
...
...
kernel/include/linux/fmc-sdb.h
View file @
2c6089d1
...
...
@@ -31,6 +31,6 @@ struct sdb_array {
extern
int
fmc_scan_sdb_tree
(
struct
fmc_device
*
fmc
,
unsigned
long
address
);
extern
void
fmc_show_sdb_tree
(
struct
fmc_device
*
fmc
);
extern
signed
long
fmc_find_sdb_device
(
struct
sdb_array
*
tree
,
uint
64_t
vendor
,
uint32_t
device
);
extern
signed
long
fmc_find_sdb_device
(
struct
sdb_array
*
tree
,
uint64_t
vendor
,
uint
32_t
device
,
unsigned
long
*
sz
);
extern
int
fmc_free_sdb_tree
(
struct
fmc_device
*
fmc
);
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