drivers: npcx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config instead. Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
This commit is contained in:
parent
3565f71a72
commit
6d6c5e1155
15 changed files with 146 additions and 180 deletions
|
@ -65,11 +65,8 @@ struct ps2_npcx_ctrl_data {
|
|||
};
|
||||
|
||||
/* Driver convenience defines */
|
||||
#define DRV_CONFIG(dev) ((const struct ps2_npcx_ctrl_config *)(dev)->config)
|
||||
|
||||
#define DRV_DATA(dev) ((struct ps2_npcx_ctrl_data *)(dev)->data)
|
||||
|
||||
#define HAL_PS2_INSTANCE(dev) ((struct ps2_reg *)DRV_CONFIG(dev)->base)
|
||||
#define HAL_PS2_INSTANCE(dev) \
|
||||
((struct ps2_reg *)((const struct ps2_npcx_ctrl_config *)(dev)->config)->base)
|
||||
|
||||
static uint8_t ps2_npcx_ctrl_get_ch_clk_mask(uint8_t channel_id)
|
||||
{
|
||||
|
@ -79,7 +76,7 @@ static uint8_t ps2_npcx_ctrl_get_ch_clk_mask(uint8_t channel_id)
|
|||
int ps2_npcx_ctrl_configure(const struct device *dev, uint8_t channel_id,
|
||||
ps2_callback_t callback_isr)
|
||||
{
|
||||
struct ps2_npcx_ctrl_data *const data = DRV_DATA(dev);
|
||||
struct ps2_npcx_ctrl_data *const data = dev->data;
|
||||
|
||||
if (channel_id >= NPCX_PS2_CH_COUNT) {
|
||||
LOG_ERR("unexpected channel ID: %d", channel_id);
|
||||
|
@ -100,7 +97,7 @@ int ps2_npcx_ctrl_configure(const struct device *dev, uint8_t channel_id,
|
|||
int ps2_npcx_ctrl_enable_interface(const struct device *dev, uint8_t channel_id,
|
||||
bool enable)
|
||||
{
|
||||
struct ps2_npcx_ctrl_data *const data = DRV_DATA(dev);
|
||||
struct ps2_npcx_ctrl_data *const data = dev->data;
|
||||
struct ps2_reg *const inst = HAL_PS2_INSTANCE(dev);
|
||||
uint8_t ch_clk_mask;
|
||||
|
||||
|
@ -155,7 +152,7 @@ static int ps2_npcx_ctrl_bus_busy(const struct device *dev)
|
|||
int ps2_npcx_ctrl_write(const struct device *dev, uint8_t channel_id,
|
||||
uint8_t value)
|
||||
{
|
||||
struct ps2_npcx_ctrl_data *const data = DRV_DATA(dev);
|
||||
struct ps2_npcx_ctrl_data *const data = dev->data;
|
||||
struct ps2_reg *const inst = HAL_PS2_INSTANCE(dev);
|
||||
int i = 0;
|
||||
|
||||
|
@ -242,7 +239,7 @@ static void ps2_npcx_ctrl_isr(const struct device *dev)
|
|||
{
|
||||
uint8_t active_ch, mask;
|
||||
struct ps2_reg *const inst = HAL_PS2_INSTANCE(dev);
|
||||
struct ps2_npcx_ctrl_data *const data = DRV_DATA(dev);
|
||||
struct ps2_npcx_ctrl_data *const data = dev->data;
|
||||
|
||||
/*
|
||||
* ACH = 1 : Channel 0
|
||||
|
@ -326,8 +323,8 @@ DEVICE_DT_INST_DEFINE(0, &ps2_npcx_ctrl_init, NULL, &ps2_npcx_ctrl_data_0,
|
|||
|
||||
static int ps2_npcx_ctrl_init(const struct device *dev)
|
||||
{
|
||||
const struct ps2_npcx_ctrl_config *const config = DRV_CONFIG(dev);
|
||||
struct ps2_npcx_ctrl_data *const data = DRV_DATA(dev);
|
||||
const struct ps2_npcx_ctrl_config *const config = dev->config;
|
||||
struct ps2_npcx_ctrl_data *const data = dev->data;
|
||||
struct ps2_reg *const inst = HAL_PS2_INSTANCE(dev);
|
||||
const struct device *clk_dev = DEVICE_DT_GET(NPCX_CLK_CTRL_NODE);
|
||||
int ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue