drivers: entropy: 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:
Gerard Marull-Paretas 2022-01-19 14:10:37 +01:00 committed by Carles Cufí
commit 3dc5c01aee

View file

@ -38,12 +38,6 @@ struct entropy_cc13xx_cc26xx_data {
#endif #endif
}; };
static inline struct entropy_cc13xx_cc26xx_data *
get_dev_data(const struct device *dev)
{
return dev->data;
}
static void start_trng(struct entropy_cc13xx_cc26xx_data *data) static void start_trng(struct entropy_cc13xx_cc26xx_data *data)
{ {
/* Initialization as described in TRM section 18.6.1.2 */ /* Initialization as described in TRM section 18.6.1.2 */
@ -100,7 +94,7 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev,
uint8_t *buf, uint8_t *buf,
uint16_t len) uint16_t len)
{ {
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); struct entropy_cc13xx_cc26xx_data *data = dev->data;
uint32_t cnt; uint32_t cnt;
#ifdef CONFIG_PM #ifdef CONFIG_PM
@ -133,7 +127,8 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev,
static void entropy_cc13xx_cc26xx_isr(const void *arg) static void entropy_cc13xx_cc26xx_isr(const void *arg)
{ {
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(arg); const struct device *dev = arg;
struct entropy_cc13xx_cc26xx_data *data = dev->data;
uint32_t src = 0; uint32_t src = 0;
uint32_t cnt; uint32_t cnt;
uint32_t num[2]; uint32_t num[2];
@ -175,7 +170,7 @@ static int entropy_cc13xx_cc26xx_get_entropy_isr(const struct device *dev,
uint8_t *buf, uint16_t len, uint8_t *buf, uint16_t len,
uint32_t flags) uint32_t flags)
{ {
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); struct entropy_cc13xx_cc26xx_data *data = dev->data;
uint16_t cnt; uint16_t cnt;
uint16_t read = len; uint16_t read = len;
uint32_t src; uint32_t src;
@ -255,7 +250,7 @@ static int post_notify_fxn(unsigned int eventType, uintptr_t eventArg,
if (Power_getDependencyCount(res_id) != 0) { if (Power_getDependencyCount(res_id) != 0) {
/* Reconfigure and enable TRNG only if powered */ /* Reconfigure and enable TRNG only if powered */
start_trng(get_dev_data(dev)); start_trng(dev->data);
} }
} }
@ -267,7 +262,7 @@ static int post_notify_fxn(unsigned int eventType, uintptr_t eventArg,
static int entropy_cc13xx_cc26xx_pm_action(const struct device *dev, static int entropy_cc13xx_cc26xx_pm_action(const struct device *dev,
enum pm_device_action action) enum pm_device_action action)
{ {
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); struct entropy_cc13xx_cc26xx_data *data = dev->data;
switch (action) { switch (action) {
case PM_DEVICE_ACTION_RESUME: case PM_DEVICE_ACTION_RESUME:
@ -288,7 +283,7 @@ static int entropy_cc13xx_cc26xx_pm_action(const struct device *dev,
static int entropy_cc13xx_cc26xx_init(const struct device *dev) static int entropy_cc13xx_cc26xx_init(const struct device *dev)
{ {
struct entropy_cc13xx_cc26xx_data *data = get_dev_data(dev); struct entropy_cc13xx_cc26xx_data *data = dev->data;
/* Initialize driver data */ /* Initialize driver data */
ring_buf_init(&data->pool, sizeof(data->data), data->data); ring_buf_init(&data->pool, sizeof(data->data), data->data);