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
nexedi
linux
Commits
82f85cf9
Commit
82f85cf9
authored
Oct 25, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/wr' into spi-next
parents
344a8511
23590742
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
12 deletions
+31
-12
drivers/hwmon/adt7310.c
drivers/hwmon/adt7310.c
+1
-6
drivers/staging/iio/meter/ade7753.c
drivers/staging/iio/meter/ade7753.c
+1
-2
drivers/staging/iio/meter/ade7754.c
drivers/staging/iio/meter/ade7754.c
+1
-2
drivers/staging/iio/meter/ade7759.c
drivers/staging/iio/meter/ade7759.c
+1
-2
include/linux/spi/spi.h
include/linux/spi/spi.h
+27
-0
No files found.
drivers/hwmon/adt7310.c
View file @
82f85cf9
...
...
@@ -42,13 +42,8 @@ static const u8 adt7310_reg_table[] = {
static
int
adt7310_spi_read_word
(
struct
device
*
dev
,
u8
reg
)
{
struct
spi_device
*
spi
=
to_spi_device
(
dev
);
int
ret
;
ret
=
spi_w8r16
(
spi
,
AD7310_COMMAND
(
reg
)
|
ADT7310_CMD_READ
);
if
(
ret
<
0
)
return
ret
;
return
be16_to_cpu
((
__force
__be16
)
ret
);
return
spi_w8r16be
(
spi
,
AD7310_COMMAND
(
reg
)
|
ADT7310_CMD_READ
);
}
static
int
adt7310_spi_write_word
(
struct
device
*
dev
,
u8
reg
,
u16
data
)
...
...
drivers/staging/iio/meter/ade7753.c
View file @
82f85cf9
...
...
@@ -86,7 +86,7 @@ static int ade7753_spi_read_reg_16(struct device *dev,
struct
ade7753_state
*
st
=
iio_priv
(
indio_dev
);
ssize_t
ret
;
ret
=
spi_w8r16
(
st
->
us
,
ADE7753_READ_REG
(
reg_address
));
ret
=
spi_w8r16
be
(
st
->
us
,
ADE7753_READ_REG
(
reg_address
));
if
(
ret
<
0
)
{
dev_err
(
&
st
->
us
->
dev
,
"problem when reading 16 bit register 0x%02X"
,
reg_address
);
...
...
@@ -94,7 +94,6 @@ static int ade7753_spi_read_reg_16(struct device *dev,
}
*
val
=
ret
;
*
val
=
be16_to_cpup
(
val
);
return
0
;
}
...
...
drivers/staging/iio/meter/ade7754.c
View file @
82f85cf9
...
...
@@ -86,7 +86,7 @@ static int ade7754_spi_read_reg_16(struct device *dev,
struct
ade7754_state
*
st
=
iio_priv
(
indio_dev
);
int
ret
;
ret
=
spi_w8r16
(
st
->
us
,
ADE7754_READ_REG
(
reg_address
));
ret
=
spi_w8r16
be
(
st
->
us
,
ADE7754_READ_REG
(
reg_address
));
if
(
ret
<
0
)
{
dev_err
(
&
st
->
us
->
dev
,
"problem when reading 16 bit register 0x%02X"
,
reg_address
);
...
...
@@ -94,7 +94,6 @@ static int ade7754_spi_read_reg_16(struct device *dev,
}
*
val
=
ret
;
*
val
=
be16_to_cpup
(
val
);
return
0
;
}
...
...
drivers/staging/iio/meter/ade7759.c
View file @
82f85cf9
...
...
@@ -86,7 +86,7 @@ static int ade7759_spi_read_reg_16(struct device *dev,
struct
ade7759_state
*
st
=
iio_priv
(
indio_dev
);
int
ret
;
ret
=
spi_w8r16
(
st
->
us
,
ADE7759_READ_REG
(
reg_address
));
ret
=
spi_w8r16
be
(
st
->
us
,
ADE7759_READ_REG
(
reg_address
));
if
(
ret
<
0
)
{
dev_err
(
&
st
->
us
->
dev
,
"problem when reading 16 bit register 0x%02X"
,
reg_address
);
...
...
@@ -94,7 +94,6 @@ static int ade7759_spi_read_reg_16(struct device *dev,
}
*
val
=
ret
;
*
val
=
be16_to_cpup
(
val
);
return
0
;
}
...
...
include/linux/spi/spi.h
View file @
82f85cf9
...
...
@@ -853,6 +853,33 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
return
(
status
<
0
)
?
status
:
result
;
}
/**
* spi_w8r16be - SPI synchronous 8 bit write followed by 16 bit big-endian read
* @spi: device with which data will be exchanged
* @cmd: command to be written before data is read back
* Context: can sleep
*
* This returns the (unsigned) sixteen bit number returned by the device in cpu
* endianness, or else a negative error code. Callable only from contexts that
* can sleep.
*
* This function is similar to spi_w8r16, with the exception that it will
* convert the read 16 bit data word from big-endian to native endianness.
*
*/
static
inline
ssize_t
spi_w8r16be
(
struct
spi_device
*
spi
,
u8
cmd
)
{
ssize_t
status
;
__be16
result
;
status
=
spi_write_then_read
(
spi
,
&
cmd
,
1
,
&
result
,
2
);
if
(
status
<
0
)
return
status
;
return
be16_to_cpu
(
result
);
}
/*---------------------------------------------------------------------------*/
/*
...
...
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