@@ -38,7 +38,7 @@ type Result<T> = std::result::Result<T, Error>;
38
38
39
39
#[ derive( Copy , Clone , Debug , Eq , PartialEq , ThisError ) ]
40
40
/// Errors related to vhost-device-spi daemon.
41
- pub ( crate ) enum Error {
41
+ pub enum Error {
42
42
#[ error( "TX length {0} and RX length {1} don't match" ) ]
43
43
TxRxTrnasLenNotEqual ( u32 , u32 ) ,
44
44
#[ error( "TX length and RX length are both zero" ) ]
@@ -65,7 +65,7 @@ pub(crate) enum Error {
65
65
66
66
impl From < Error > for io:: Error {
67
67
fn from ( e : Error ) -> Self {
68
- io :: Error :: new ( io:: ErrorKind :: Other , e)
68
+ Self :: new ( io:: ErrorKind :: Other , e)
69
69
}
70
70
}
71
71
@@ -113,9 +113,9 @@ struct VirtioSpiTransferResult {
113
113
unsafe impl ByteValued for VirtioSpiTransferResult { }
114
114
115
115
/// Virtio SPI Configuration
116
- #[ derive( Copy , Clone , Debug , Default , PartialEq ) ]
116
+ #[ derive( Copy , Clone , Debug , Default , PartialEq , Eq ) ]
117
117
#[ repr( C ) ]
118
- pub ( crate ) struct VirtioSpiConfig {
118
+ pub struct VirtioSpiConfig {
119
119
pub ( crate ) cs_max_number : u8 ,
120
120
pub ( crate ) cs_change_supported : u8 ,
121
121
pub ( crate ) tx_nbits_supported : u8 ,
@@ -133,7 +133,7 @@ pub(crate) struct VirtioSpiConfig {
133
133
// reading its content from byte array.
134
134
unsafe impl ByteValued for VirtioSpiConfig { }
135
135
136
- pub ( crate ) struct VhostUserSpiBackend < D : SpiDevice > {
136
+ pub struct VhostUserSpiBackend < D : SpiDevice > {
137
137
spi_ctrl : Arc < SpiController < D > > ,
138
138
event_idx : bool ,
139
139
pub exit_event : EventFd ,
@@ -144,7 +144,7 @@ type SpiDescriptorChain = DescriptorChain<GuestMemoryLoadGuard<GuestMemoryMmap<(
144
144
145
145
impl < D : SpiDevice > VhostUserSpiBackend < D > {
146
146
pub fn new ( spi_ctrl : Arc < SpiController < D > > ) -> Result < Self > {
147
- Ok ( VhostUserSpiBackend {
147
+ Ok ( Self {
148
148
spi_ctrl,
149
149
event_idx : false ,
150
150
exit_event : EventFd :: new ( EFD_NONBLOCK ) . map_err ( |_| Error :: EventFdFailed ) ?,
@@ -352,7 +352,7 @@ impl<D: SpiDevice> VhostUserSpiBackend<D> {
352
352
status : ResponseStatus :: TransErr as u8 ,
353
353
} ;
354
354
355
- for desc_chain in requests. clone ( ) {
355
+ for desc_chain in requests {
356
356
let len = size_of :: < VirtioSpiTransferResult > ( ) as u32 ;
357
357
let mem = atomic_mem. memory ( ) ;
358
358
0 commit comments