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
6ed50f88
Commit
6ed50f88
authored
Jun 15, 2020
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge existing fixes from regmap/for-5.8
parents
b3a9e3b9
e680a409
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
56 deletions
+49
-56
drivers/base/regmap/regmap.c
drivers/base/regmap/regmap.c
+49
-56
No files found.
drivers/base/regmap/regmap.c
View file @
6ed50f88
...
...
@@ -17,6 +17,7 @@
#include <linux/delay.h>
#include <linux/log2.h>
#include <linux/hwspinlock.h>
#include <asm/unaligned.h>
#define CREATE_TRACE_POINTS
#include "trace.h"
...
...
@@ -249,22 +250,20 @@ static void regmap_format_8(void *buf, unsigned int val, unsigned int shift)
static
void
regmap_format_16_be
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
__be16
*
b
=
buf
;
b
[
0
]
=
cpu_to_be16
(
val
<<
shift
);
put_unaligned_be16
(
val
<<
shift
,
buf
);
}
static
void
regmap_format_16_le
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
__le16
*
b
=
buf
;
b
[
0
]
=
cpu_to_le16
(
val
<<
shift
);
put_unaligned_le16
(
val
<<
shift
,
buf
);
}
static
void
regmap_format_16_native
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
*
(
u16
*
)
buf
=
val
<<
shift
;
u16
v
=
val
<<
shift
;
memcpy
(
buf
,
&
v
,
sizeof
(
v
));
}
static
void
regmap_format_24
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
...
...
@@ -280,43 +279,39 @@ static void regmap_format_24(void *buf, unsigned int val, unsigned int shift)
static
void
regmap_format_32_be
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
__be32
*
b
=
buf
;
b
[
0
]
=
cpu_to_be32
(
val
<<
shift
);
put_unaligned_be32
(
val
<<
shift
,
buf
);
}
static
void
regmap_format_32_le
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
__le32
*
b
=
buf
;
b
[
0
]
=
cpu_to_le32
(
val
<<
shift
);
put_unaligned_le32
(
val
<<
shift
,
buf
);
}
static
void
regmap_format_32_native
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
*
(
u32
*
)
buf
=
val
<<
shift
;
u32
v
=
val
<<
shift
;
memcpy
(
buf
,
&
v
,
sizeof
(
v
));
}
#ifdef CONFIG_64BIT
static
void
regmap_format_64_be
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
__be64
*
b
=
buf
;
b
[
0
]
=
cpu_to_be64
((
u64
)
val
<<
shift
);
put_unaligned_be64
((
u64
)
val
<<
shift
,
buf
);
}
static
void
regmap_format_64_le
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
__le64
*
b
=
buf
;
b
[
0
]
=
cpu_to_le64
((
u64
)
val
<<
shift
);
put_unaligned_le64
((
u64
)
val
<<
shift
,
buf
);
}
static
void
regmap_format_64_native
(
void
*
buf
,
unsigned
int
val
,
unsigned
int
shift
)
{
*
(
u64
*
)
buf
=
(
u64
)
val
<<
shift
;
u64
v
=
(
u64
)
val
<<
shift
;
memcpy
(
buf
,
&
v
,
sizeof
(
v
));
}
#endif
...
...
@@ -333,35 +328,34 @@ static unsigned int regmap_parse_8(const void *buf)
static
unsigned
int
regmap_parse_16_be
(
const
void
*
buf
)
{
const
__be16
*
b
=
buf
;
return
be16_to_cpu
(
b
[
0
]);
return
get_unaligned_be16
(
buf
);
}
static
unsigned
int
regmap_parse_16_le
(
const
void
*
buf
)
{
const
__le16
*
b
=
buf
;
return
le16_to_cpu
(
b
[
0
]);
return
get_unaligned_le16
(
buf
);
}
static
void
regmap_parse_16_be_inplace
(
void
*
buf
)
{
__be16
*
b
=
buf
;
u16
v
=
get_unaligned_be16
(
buf
)
;
b
[
0
]
=
be16_to_cpu
(
b
[
0
]
);
memcpy
(
buf
,
&
v
,
sizeof
(
v
)
);
}
static
void
regmap_parse_16_le_inplace
(
void
*
buf
)
{
__le16
*
b
=
buf
;
u16
v
=
get_unaligned_le16
(
buf
)
;
b
[
0
]
=
le16_to_cpu
(
b
[
0
]
);
memcpy
(
buf
,
&
v
,
sizeof
(
v
)
);
}
static
unsigned
int
regmap_parse_16_native
(
const
void
*
buf
)
{
return
*
(
u16
*
)
buf
;
u16
v
;
memcpy
(
&
v
,
buf
,
sizeof
(
v
));
return
v
;
}
static
unsigned
int
regmap_parse_24
(
const
void
*
buf
)
...
...
@@ -376,69 +370,67 @@ static unsigned int regmap_parse_24(const void *buf)
static
unsigned
int
regmap_parse_32_be
(
const
void
*
buf
)
{
const
__be32
*
b
=
buf
;
return
be32_to_cpu
(
b
[
0
]);
return
get_unaligned_be32
(
buf
);
}
static
unsigned
int
regmap_parse_32_le
(
const
void
*
buf
)
{
const
__le32
*
b
=
buf
;
return
le32_to_cpu
(
b
[
0
]);
return
get_unaligned_le32
(
buf
);
}
static
void
regmap_parse_32_be_inplace
(
void
*
buf
)
{
__be32
*
b
=
buf
;
u32
v
=
get_unaligned_be32
(
buf
)
;
b
[
0
]
=
be32_to_cpu
(
b
[
0
]
);
memcpy
(
buf
,
&
v
,
sizeof
(
v
)
);
}
static
void
regmap_parse_32_le_inplace
(
void
*
buf
)
{
__le32
*
b
=
buf
;
u32
v
=
get_unaligned_le32
(
buf
)
;
b
[
0
]
=
le32_to_cpu
(
b
[
0
]
);
memcpy
(
buf
,
&
v
,
sizeof
(
v
)
);
}
static
unsigned
int
regmap_parse_32_native
(
const
void
*
buf
)
{
return
*
(
u32
*
)
buf
;
u32
v
;
memcpy
(
&
v
,
buf
,
sizeof
(
v
));
return
v
;
}
#ifdef CONFIG_64BIT
static
unsigned
int
regmap_parse_64_be
(
const
void
*
buf
)
{
const
__be64
*
b
=
buf
;
return
be64_to_cpu
(
b
[
0
]);
return
get_unaligned_be64
(
buf
);
}
static
unsigned
int
regmap_parse_64_le
(
const
void
*
buf
)
{
const
__le64
*
b
=
buf
;
return
le64_to_cpu
(
b
[
0
]);
return
get_unaligned_le64
(
buf
);
}
static
void
regmap_parse_64_be_inplace
(
void
*
buf
)
{
__be64
*
b
=
buf
;
u64
v
=
get_unaligned_be64
(
buf
)
;
b
[
0
]
=
be64_to_cpu
(
b
[
0
]
);
memcpy
(
buf
,
&
v
,
sizeof
(
v
)
);
}
static
void
regmap_parse_64_le_inplace
(
void
*
buf
)
{
__le64
*
b
=
buf
;
u64
v
=
get_unaligned_le64
(
buf
)
;
b
[
0
]
=
le64_to_cpu
(
b
[
0
]
);
memcpy
(
buf
,
&
v
,
sizeof
(
v
)
);
}
static
unsigned
int
regmap_parse_64_native
(
const
void
*
buf
)
{
return
*
(
u64
*
)
buf
;
u64
v
;
memcpy
(
&
v
,
buf
,
sizeof
(
v
));
return
v
;
}
#endif
...
...
@@ -2944,8 +2936,9 @@ EXPORT_SYMBOL_GPL(regmap_update_bits_base);
* @reg: Register to read from
* @bits: Bits to test
*
* Returns -1 if the underlying regmap_read() fails, 0 if at least one of the
* tested bits is not set and 1 if all tested bits are set.
* Returns 0 if at least one of the tested bits is not set, 1 if all tested
* bits are set and a negative error number if the underlying regmap_read()
* fails.
*/
int
regmap_test_bits
(
struct
regmap
*
map
,
unsigned
int
reg
,
unsigned
int
bits
)
{
...
...
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