drivers: ieee802154: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with dev->data and dev->config. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
c5b596a0bf
commit
9b92dfeca8
2 changed files with 23 additions and 45 deletions
|
@ -132,19 +132,12 @@ static inline bool is_subghz(uint16_t channel)
|
|||
return (channel <= IEEE802154_SUB_GHZ_CHANNEL_MAX);
|
||||
}
|
||||
|
||||
static inline struct ieee802154_cc13xx_cc26xx_subg_data *
|
||||
get_dev_data(const struct device *dev)
|
||||
{
|
||||
return dev->data;
|
||||
}
|
||||
|
||||
static void cmd_prop_tx_adv_callback(RF_Handle h, RF_CmdHandle ch,
|
||||
RF_EventMask e)
|
||||
{
|
||||
const struct device *dev =
|
||||
&DEVICE_NAME_GET(ieee802154_cc13xx_cc26xx_subg);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_Op *op = RF_getCmdOp(h, ch);
|
||||
|
||||
LOG_DBG("ch: %u cmd: %04x cs st: %04x tx st: %04x e: 0x%" PRIx64, ch,
|
||||
|
@ -156,8 +149,7 @@ static void cmd_prop_rx_adv_callback(RF_Handle h, RF_CmdHandle ch,
|
|||
{
|
||||
const struct device *dev =
|
||||
&DEVICE_NAME_GET(ieee802154_cc13xx_cc26xx_subg);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_Op *op = RF_getCmdOp(h, ch);
|
||||
|
||||
LOG_DBG("ch: %u cmd: %04x st: %04x e: 0x%" PRIx64, ch,
|
||||
|
@ -201,8 +193,7 @@ ieee802154_cc13xx_cc26xx_subg_get_capabilities(const struct device *dev)
|
|||
|
||||
static int ieee802154_cc13xx_cc26xx_subg_cca(const struct device *dev)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_Stat status;
|
||||
|
||||
drv_data->cmd_prop_cs.status = IDLE;
|
||||
|
@ -228,8 +219,7 @@ static int ieee802154_cc13xx_cc26xx_subg_cca(const struct device *dev)
|
|||
|
||||
static int ieee802154_cc13xx_cc26xx_subg_rx(const struct device *dev)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_CmdHandle cmd_handle;
|
||||
|
||||
/* Set all RX entries to empty */
|
||||
|
@ -250,8 +240,7 @@ static int ieee802154_cc13xx_cc26xx_subg_rx(const struct device *dev)
|
|||
static int ieee802154_cc13xx_cc26xx_subg_set_channel(
|
||||
const struct device *dev, uint16_t channel)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_EventMask reason;
|
||||
uint16_t freq, fract;
|
||||
int r;
|
||||
|
@ -309,7 +298,7 @@ ieee802154_cc13xx_cc26xx_subg_filter(const struct device *dev, bool set,
|
|||
static int ieee802154_cc13xx_cc26xx_subg_set_txpower(
|
||||
const struct device *dev, int16_t dbm)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_Stat status;
|
||||
|
||||
RF_TxPowerTable_Value power_table_value = RF_TxPowerTable_findValue(
|
||||
|
@ -335,8 +324,7 @@ static int ieee802154_cc13xx_cc26xx_subg_tx(const struct device *dev,
|
|||
struct net_pkt *pkt,
|
||||
struct net_buf *frag)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
int retry = CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ_RADIO_TX_RETRIES;
|
||||
RF_EventMask reason;
|
||||
int r;
|
||||
|
@ -511,8 +499,7 @@ static int ieee802154_cc13xx_cc26xx_subg_start(const struct device *dev)
|
|||
*/
|
||||
static int ieee802154_cc13xx_cc26xx_subg_stop(const struct device *dev)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
RF_Stat status;
|
||||
|
||||
status = RF_flushCmd(drv_data->rf_handle, RF_CMDHANDLE_FLUSH_ALL, 0);
|
||||
|
@ -533,8 +520,7 @@ static int ieee802154_cc13xx_cc26xx_subg_stop(const struct device *dev)
|
|||
*/
|
||||
static int ieee802154_cc13xx_cc26xx_subg_stop_if(const struct device *dev)
|
||||
{
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
int ret;
|
||||
|
||||
ret = ieee802154_cc13xx_cc26xx_subg_stop(dev);
|
||||
|
@ -612,8 +598,7 @@ static void ieee802154_cc13xx_cc26xx_subg_data_init(
|
|||
static void ieee802154_cc13xx_cc26xx_subg_iface_init(struct net_if *iface)
|
||||
{
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
|
||||
net_if_set_link_addr(iface, drv_data->mac, sizeof(drv_data->mac),
|
||||
NET_LINK_IEEE802154);
|
||||
|
@ -644,8 +629,7 @@ static int ieee802154_cc13xx_cc26xx_subg_init(const struct device *dev)
|
|||
{
|
||||
RF_Params rf_params;
|
||||
RF_EventMask reason;
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data =
|
||||
get_dev_data(dev);
|
||||
struct ieee802154_cc13xx_cc26xx_subg_data *drv_data = dev->data;
|
||||
|
||||
/* Initialize driver data */
|
||||
ieee802154_cc13xx_cc26xx_subg_data_init(drv_data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue