@@ -20,7 +20,7 @@ int i2c_nrfx_twim_recover_bus(const struct device *dev)
2020 enum pm_device_state state ;
2121 uint32_t scl_pin ;
2222 uint32_t sda_pin ;
23- nrfx_err_t err ;
23+ int err ;
2424
2525 scl_pin = nrf_twim_scl_pin_get (config -> twim -> p_twim );
2626 sda_pin = nrf_twim_sda_pin_get (config -> twim -> p_twim );
@@ -39,7 +39,7 @@ int i2c_nrfx_twim_recover_bus(const struct device *dev)
3939 nrfx_twim_enable (config -> twim );
4040 }
4141
42- return ( err == NRFX_SUCCESS ? 0 : - EBUSY ) ;
42+ return err ;
4343}
4444
4545int i2c_nrfx_twim_configure (const struct device * dev , uint32_t i2c_config )
@@ -80,8 +80,6 @@ int i2c_nrfx_twim_msg_transfer(const struct device *dev, uint8_t flags, uint8_t
8080 .p_primary_buf = buf ,
8181 .primary_length = buf_len ,
8282 };
83- nrfx_err_t res ;
84- int ret = 0 ;
8583
8684 if (buf_len > config -> max_transfer_size ) {
8785 LOG_ERR ("Trying to transfer more than the maximum size "
@@ -90,16 +88,8 @@ int i2c_nrfx_twim_msg_transfer(const struct device *dev, uint8_t flags, uint8_t
9088 return - ENOSPC ;
9189 }
9290
93- res = nrfx_twim_xfer (config -> twim , & cur_xfer ,
94- (flags & I2C_MSG_STOP ) ? 0 : NRFX_TWIM_FLAG_TX_NO_STOP );
95- if (res != NRFX_SUCCESS ) {
96- if (res == NRFX_ERROR_BUSY ) {
97- ret = - EBUSY ;
98- } else {
99- ret = - EIO ;
100- }
101- }
102- return ret ;
91+ return nrfx_twim_xfer (config -> twim , & cur_xfer ,
92+ (flags & I2C_MSG_STOP ) ? 0 : NRFX_TWIM_FLAG_TX_NO_STOP );
10393}
10494
10595void twim_nrfx_pm_resume (const struct device * dev )
@@ -142,8 +132,8 @@ int i2c_nrfx_twim_common_init(const struct device *dev)
142132
143133 (void )pinctrl_apply_state (config -> pcfg , PINCTRL_STATE_SLEEP );
144134
145- if (nrfx_twim_init (config -> twim , & config -> twim_config , config -> event_handler ,
146- ( void * ) dev ) != NRFX_SUCCESS ) {
135+ if (nrfx_twim_init (config -> twim , & config -> twim_config , config -> event_handler , ( void * ) dev ) <
136+ 0 ) {
147137 LOG_ERR ("Failed to initialize device: %s" , dev -> name );
148138 return - EIO ;
149139 }
0 commit comments