44 * SPDX-License-Identifier: Apache-2.0
55 */
66
7+ #define DT_DRV_COMPAT zephyr_gsm_ppp
8+
79#include <logging/log.h>
810LOG_MODULE_REGISTER (modem_gsm , CONFIG_MODEM_LOG_LEVEL );
911
@@ -24,6 +26,7 @@ LOG_MODULE_REGISTER(modem_gsm, CONFIG_MODEM_LOG_LEVEL);
2426
2527#include <stdio.h>
2628
29+ #define GSM_UART_NODE DT_INST_BUS(0)
2730#define GSM_CMD_READ_BUF 128
2831#define GSM_CMD_AT_TIMEOUT K_SECONDS(2)
2932#define GSM_CMD_SETUP_TIMEOUT K_SECONDS(6)
@@ -522,8 +525,7 @@ static struct net_if *ppp_net_if(void)
522525static void set_ppp_carrier_on (struct gsm_modem * gsm )
523526{
524527 static const struct ppp_api * api ;
525- const struct device * ppp_dev =
526- device_get_binding (CONFIG_NET_PPP_DRV_NAME );
528+ const struct device * ppp_dev = DEVICE_DT_GET (DT_INST (0 , zephyr_gsm_ppp ));
527529 struct net_if * iface = gsm -> iface ;
528530 int ret ;
529531
@@ -821,7 +823,7 @@ static void mux_setup(struct k_work *work)
821823{
822824 struct gsm_modem * gsm = CONTAINER_OF (work , struct gsm_modem ,
823825 gsm_configure_work );
824- const struct device * uart = device_get_binding ( CONFIG_MODEM_GSM_UART_NAME );
826+ const struct device * uart = DEVICE_DT_GET ( GSM_UART_NODE );
825827 int ret ;
826828
827829 /* We need to call this to reactivate mux ISR. Note: This is only called
@@ -980,7 +982,7 @@ void gsm_ppp_start(const struct device *dev)
980982
981983 /* Re-init underlying UART comms */
982984 int r = modem_iface_uart_init_dev (& gsm -> context .iface ,
983- device_get_binding ( CONFIG_MODEM_GSM_UART_NAME ));
985+ DEVICE_DT_GET ( GSM_UART_NODE ));
984986 if (r ) {
985987 LOG_ERR ("modem_iface_uart_init returned %d" , r );
986988 return ;
@@ -1057,7 +1059,7 @@ static int gsm_init(const struct device *dev)
10571059 gsm -> gsm_data .rx_rb_buf_len = sizeof (gsm -> gsm_rx_rb_buf );
10581060
10591061 r = modem_iface_uart_init (& gsm -> context .iface , & gsm -> gsm_data ,
1060- device_get_binding ( CONFIG_MODEM_GSM_UART_NAME ));
1062+ DEVICE_DT_GET ( GSM_UART_NODE ));
10611063 if (r < 0 ) {
10621064 LOG_DBG ("iface uart error %d" , r );
10631065 return r ;
@@ -1091,5 +1093,5 @@ static int gsm_init(const struct device *dev)
10911093 return 0 ;
10921094}
10931095
1094- DEVICE_DEFINE ( gsm_ppp , GSM_MODEM_DEVICE_NAME , gsm_init , NULL , & gsm , NULL ,
1095- POST_KERNEL , CONFIG_MODEM_GSM_INIT_PRIORITY , NULL );
1096+ DEVICE_DT_DEFINE ( DT_INST ( 0 , zephyr_gsm_ppp ) , gsm_init , NULL , & gsm , NULL ,
1097+ POST_KERNEL , CONFIG_MODEM_GSM_INIT_PRIORITY , NULL );
0 commit comments