drivers: PS/2: npcx: Replace device_get_binding with DEVICE_DT_GET
Replace device_get_binding() with DEVICE_DT_GET to obtain the PS/2 controller and clock control device objects. It helps to improve the efficiency for driver initialization as DEVICE_DT_GET is processed at the link time rather than run time. Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
This commit is contained in:
parent
9d5da14a33
commit
55f21ab846
2 changed files with 19 additions and 37 deletions
|
@ -329,9 +329,14 @@ 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);
|
||||
struct ps2_reg *const inst = HAL_PS2_INSTANCE(dev);
|
||||
const struct device *clk_dev = device_get_binding(NPCX_CLK_CTRL_NAME);
|
||||
const struct device *clk_dev = DEVICE_DT_GET(NPCX_CLK_CTRL_NODE);
|
||||
int ret;
|
||||
|
||||
if (!device_is_ready(clk_dev)) {
|
||||
LOG_ERR("%s device not ready", clk_dev->name);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Turn on PS/2 controller device clock */
|
||||
ret = clock_control_on(clk_dev,
|
||||
(clock_control_subsys_t *)&config->clk_cfg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue