drivers: wifi: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and dev->config instead. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
b00150339a
commit
ba8f7a2dd8
1 changed files with 7 additions and 7 deletions
|
@ -22,9 +22,6 @@ LOG_MODULE_REGISTER(esp32_wifi, CONFIG_WIFI_LOG_LEVEL);
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_wpa.h"
|
#include "esp_wpa.h"
|
||||||
|
|
||||||
#define DEV_DATA(dev) \
|
|
||||||
((struct esp32_wifi_runtime *)(dev)->data)
|
|
||||||
|
|
||||||
/* use global iface pointer to support any ethernet driver */
|
/* use global iface pointer to support any ethernet driver */
|
||||||
/* necessary for wifi callback functions */
|
/* necessary for wifi callback functions */
|
||||||
static struct net_if *esp32_wifi_iface;
|
static struct net_if *esp32_wifi_iface;
|
||||||
|
@ -71,15 +68,16 @@ esp_err_t esp_event_send_internal(esp_event_base_t event_base,
|
||||||
|
|
||||||
static int eth_esp32_send(const struct device *dev, struct net_pkt *pkt)
|
static int eth_esp32_send(const struct device *dev, struct net_pkt *pkt)
|
||||||
{
|
{
|
||||||
|
struct esp32_wifi_runtime *data = dev->data;
|
||||||
const int pkt_len = net_pkt_get_len(pkt);
|
const int pkt_len = net_pkt_get_len(pkt);
|
||||||
|
|
||||||
/* Read the packet payload */
|
/* Read the packet payload */
|
||||||
if (net_pkt_read(pkt, DEV_DATA(dev)->frame_buf, pkt_len) < 0) {
|
if (net_pkt_read(pkt, data->frame_buf, pkt_len) < 0) {
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enqueue packet for transmission */
|
/* Enqueue packet for transmission */
|
||||||
esp_wifi_internal_tx(ESP_IF_WIFI_STA, (void *)DEV_DATA(dev)->frame_buf, pkt_len);
|
esp_wifi_internal_tx(ESP_IF_WIFI_STA, (void *)data->frame_buf, pkt_len);
|
||||||
|
|
||||||
LOG_DBG("pkt sent %p len %d", pkt, pkt_len);
|
LOG_DBG("pkt sent %p len %d", pkt, pkt_len);
|
||||||
|
|
||||||
|
@ -157,7 +155,7 @@ static void esp_wifi_event_task(void)
|
||||||
static void eth_esp32_init(struct net_if *iface)
|
static void eth_esp32_init(struct net_if *iface)
|
||||||
{
|
{
|
||||||
const struct device *dev = net_if_get_device(iface);
|
const struct device *dev = net_if_get_device(iface);
|
||||||
struct esp32_wifi_runtime *dev_data = DEV_DATA(dev);
|
struct esp32_wifi_runtime *dev_data = dev->data;
|
||||||
|
|
||||||
dev_data->iface = iface;
|
dev_data->iface = iface;
|
||||||
esp32_wifi_iface = iface;
|
esp32_wifi_iface = iface;
|
||||||
|
@ -178,7 +176,9 @@ static void eth_esp32_init(struct net_if *iface)
|
||||||
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
|
#if defined(CONFIG_NET_STATISTICS_ETHERNET)
|
||||||
static struct net_stats_eth *eth_esp32_stats(const struct device *dev)
|
static struct net_stats_eth *eth_esp32_stats(const struct device *dev)
|
||||||
{
|
{
|
||||||
return &(DEV_DATA(dev)->stats);
|
struct esp32_wifi_runtime *data = dev->data;
|
||||||
|
|
||||||
|
return &(data->stats);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue