1414#include <hal/nrf_clock.h>
1515#include <string.h>
1616
17- #define LOG_DOMAIN "spi_nrfx_spim"
18- #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL
1917#include <logging/log.h>
20- LOG_MODULE_REGISTER (spi_nrfx_spim );
18+ LOG_MODULE_REGISTER (spi_nrfx_spim , CONFIG_SPI_LOG_LEVEL );
2119
2220#include "spi_context.h"
2321
@@ -247,26 +245,26 @@ static void anomaly_58_workaround_clear(struct spi_nrfx_data *dev_data)
247245
248246static int anomaly_58_workaround_init (const struct device * dev )
249247{
250- struct spi_nrfx_data * data = dev -> data ;
251- const struct spi_nrfx_config * config = dev -> config ;
248+ struct spi_nrfx_data * dev_data = dev -> data ;
249+ const struct spi_nrfx_config * dev_config = dev -> config ;
252250 nrfx_err_t err_code ;
253251
254- data -> anomaly_58_workaround_active = false;
252+ dev_data -> anomaly_58_workaround_active = false;
255253
256- if (config -> anomaly_58_workaround ) {
257- err_code = nrfx_ppi_channel_alloc (& data -> ppi_ch );
254+ if (dev_config -> anomaly_58_workaround ) {
255+ err_code = nrfx_ppi_channel_alloc (& dev_data -> ppi_ch );
258256 if (err_code != NRFX_SUCCESS ) {
259257 LOG_ERR ("Failed to allocate PPI channel" );
260258 return - ENODEV ;
261259 }
262260
263- err_code = nrfx_gpiote_channel_alloc (& data -> gpiote_ch );
261+ err_code = nrfx_gpiote_channel_alloc (& dev_data -> gpiote_ch );
264262 if (err_code != NRFX_SUCCESS ) {
265263 LOG_ERR ("Failed to allocate GPIOTE channel" );
266264 return - ENODEV ;
267265 }
268266 LOG_DBG ("PAN 58 workaround enabled for %s: ppi %u, gpiote %u" ,
269- dev -> name , data -> ppi_ch , data -> gpiote_ch );
267+ dev -> name , dev_data -> ppi_ch , dev_data -> gpiote_ch );
270268 }
271269
272270 return 0 ;
@@ -432,8 +430,8 @@ static int spim_nrfx_pm_action(const struct device *dev,
432430 enum pm_device_action action )
433431{
434432 int ret = 0 ;
435- struct spi_nrfx_data * data = dev -> data ;
436- const struct spi_nrfx_config * config = dev -> config ;
433+ struct spi_nrfx_data * dev_data = dev -> data ;
434+ const struct spi_nrfx_config * dev_config = dev -> config ;
437435
438436 switch (action ) {
439437 case PM_DEVICE_ACTION_RESUME :
@@ -443,9 +441,9 @@ static int spim_nrfx_pm_action(const struct device *dev,
443441 break ;
444442
445443 case PM_DEVICE_ACTION_SUSPEND :
446- if (data -> initialized ) {
447- nrfx_spim_uninit (& config -> spim );
448- data -> initialized = false;
444+ if (dev_data -> initialized ) {
445+ nrfx_spim_uninit (& dev_config -> spim );
446+ dev_data -> initialized = false;
449447 }
450448 break ;
451449
@@ -492,16 +490,16 @@ static int spim_nrfx_pm_action(const struct device *dev,
492490 ": cannot enable both pull-up and pull-down on MISO line"); \
493491 static int spi_##idx##_init(const struct device *dev) \
494492 { \
495- struct spi_nrfx_data *data = dev->data; \
496- int err; \
493+ struct spi_nrfx_data *dev_data = dev->data; \
494+ int err; \
497495 IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIM##idx), \
498496 DT_IRQ(SPIM(idx), priority), \
499497 nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \
500- err = spi_context_cs_configure_all(&data ->ctx); \
501- if (err < 0) { \
502- return err; \
503- } \
504- spi_context_unlock_unconditionally(&data ->ctx); \
498+ err = spi_context_cs_configure_all(&dev_data ->ctx); \
499+ if (err < 0) { \
500+ return err; \
501+ } \
502+ spi_context_unlock_unconditionally(&dev_data ->ctx); \
505503 COND_CODE_1(CONFIG_SOC_NRF52832_ALLOW_SPIM_DESPITE_PAN_58, \
506504 (return anomaly_58_workaround_init(dev);), \
507505 (return 0;)) \
0 commit comments