diff --git a/drivers/power/battery_charger.c b/drivers/power/battery_charger.c index 5467f49093..70f707aa7b 100644 --- a/drivers/power/battery_charger.c +++ b/drivers/power/battery_charger.c @@ -285,6 +285,10 @@ int battery_charger_register(FAR const char *devpath, { int ret; + /* Initialize the semaphore */ + + nxsem_init(&dev->batsem, 0, 1); + /* Register the character driver */ ret = register_driver(devpath, &g_batteryops, 0555, dev); diff --git a/drivers/power/battery_gauge.c b/drivers/power/battery_gauge.c index 9936147be1..63b59092a9 100644 --- a/drivers/power/battery_gauge.c +++ b/drivers/power/battery_gauge.c @@ -248,6 +248,10 @@ int battery_gauge_register(FAR const char *devpath, { int ret; + /* Initialize the semaphore */ + + nxsem_init(&dev->batsem, 0, 1); + /* Register the character driver */ ret = register_driver(devpath, &g_batteryops, 0555, dev);