Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
43280026
Commit
43280026
authored
Feb 14, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'regmap/topic/debugfs' into regmap-next
parents
3689cf7f
4dd7c553
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
drivers/base/regmap/internal.h
drivers/base/regmap/internal.h
+1
-0
drivers/base/regmap/regmap-debugfs.c
drivers/base/regmap/regmap-debugfs.c
+32
-18
No files found.
drivers/base/regmap/internal.h
View file @
43280026
...
...
@@ -26,6 +26,7 @@ struct regmap_debugfs_off_cache {
off_t
min
;
off_t
max
;
unsigned
int
base_reg
;
unsigned
int
max_reg
;
};
struct
regmap_format
{
...
...
drivers/base/regmap/regmap-debugfs.c
View file @
43280026
...
...
@@ -81,6 +81,8 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
struct
regmap_debugfs_off_cache
*
c
=
NULL
;
loff_t
p
=
0
;
unsigned
int
i
,
ret
;
unsigned
int
fpos_offset
;
unsigned
int
reg_offset
;
/*
* If we don't have a cache build one so we don't have to do a
...
...
@@ -93,6 +95,9 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
regmap_precious
(
map
,
i
))
{
if
(
c
)
{
c
->
max
=
p
-
1
;
fpos_offset
=
c
->
max
-
c
->
min
;
reg_offset
=
fpos_offset
/
map
->
debugfs_tot_len
;
c
->
max_reg
=
c
->
base_reg
+
reg_offset
;
list_add_tail
(
&
c
->
list
,
&
map
->
debugfs_off_cache
);
c
=
NULL
;
...
...
@@ -119,6 +124,9 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
/* Close the last entry off if we didn't scan beyond it */
if
(
c
)
{
c
->
max
=
p
-
1
;
fpos_offset
=
c
->
max
-
c
->
min
;
reg_offset
=
fpos_offset
/
map
->
debugfs_tot_len
;
c
->
max_reg
=
c
->
base_reg
+
reg_offset
;
list_add_tail
(
&
c
->
list
,
&
map
->
debugfs_off_cache
);
}
...
...
@@ -128,25 +136,38 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
* allocate and we should never be in this code if there are
* no registers at all.
*/
if
(
list_empty
(
&
map
->
debugfs_off_cache
))
{
WARN_ON
(
list_empty
(
&
map
->
debugfs_off_cache
));
return
base
;
}
WARN_ON
(
list_empty
(
&
map
->
debugfs_off_cache
));
ret
=
base
;
/* Find the relevant block */
/* Find the relevant block
:offset
*/
list_for_each_entry
(
c
,
&
map
->
debugfs_off_cache
,
list
)
{
if
(
from
>=
c
->
min
&&
from
<=
c
->
max
)
{
*
pos
=
c
->
min
;
return
c
->
base_reg
;
fpos_offset
=
from
-
c
->
min
;
reg_offset
=
fpos_offset
/
map
->
debugfs_tot_len
;
*
pos
=
c
->
min
+
(
reg_offset
*
map
->
debugfs_tot_len
);
return
c
->
base_reg
+
reg_offset
;
}
*
pos
=
c
->
m
in
;
ret
=
c
->
base
_reg
;
*
pos
=
c
->
m
ax
;
ret
=
c
->
max
_reg
;
}
return
ret
;
}
static
inline
void
regmap_calc_tot_len
(
struct
regmap
*
map
,
void
*
buf
,
size_t
count
)
{
/* Calculate the length of a fixed format */
if
(
!
map
->
debugfs_tot_len
)
{
map
->
debugfs_reg_len
=
regmap_calc_reg_len
(
map
->
max_register
,
buf
,
count
);
map
->
debugfs_val_len
=
2
*
map
->
format
.
val_bytes
;
map
->
debugfs_tot_len
=
map
->
debugfs_reg_len
+
map
->
debugfs_val_len
+
3
;
/* : \n */
}
}
static
ssize_t
regmap_read_debugfs
(
struct
regmap
*
map
,
unsigned
int
from
,
unsigned
int
to
,
char
__user
*
user_buf
,
size_t
count
,
loff_t
*
ppos
)
...
...
@@ -165,14 +186,7 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
if
(
!
buf
)
return
-
ENOMEM
;
/* Calculate the length of a fixed format */
if
(
!
map
->
debugfs_tot_len
)
{
map
->
debugfs_reg_len
=
regmap_calc_reg_len
(
map
->
max_register
,
buf
,
count
);
map
->
debugfs_val_len
=
2
*
map
->
format
.
val_bytes
;
map
->
debugfs_tot_len
=
map
->
debugfs_reg_len
+
map
->
debugfs_val_len
+
3
;
/* : \n */
}
regmap_calc_tot_len
(
map
,
buf
,
count
);
/* Work out which register we're starting at */
start_reg
=
regmap_debugfs_get_dump_start
(
map
,
from
,
*
ppos
,
&
p
);
...
...
@@ -187,7 +201,7 @@ static ssize_t regmap_read_debugfs(struct regmap *map, unsigned int from,
/* If we're in the region the user is trying to read */
if
(
p
>=
*
ppos
)
{
/* ...but not beyond it */
if
(
buf_pos
+
1
+
map
->
debugfs_tot_len
>=
count
)
if
(
buf_pos
+
map
->
debugfs_tot_len
>
count
)
break
;
/* Format the register */
...
...
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