diff --git a/drivers/regmap/regmap.c b/drivers/regmap/regmap.c index 4aa85e9e8f..0652382741 100644 --- a/drivers/regmap/regmap.c +++ b/drivers/regmap/regmap.c @@ -377,6 +377,11 @@ void regmap_exit(FAR struct regmap_s *map) nxmutex_destroy(&map->mutex[0]); } + if (map->bus->exit != NULL) + { + map->bus->exit(map->bus); + } + kmm_free(map->bus); kmm_free(map); } diff --git a/include/nuttx/regmap/regmap.h b/include/nuttx/regmap/regmap.h index f3b3f02823..b56ec3f9ce 100644 --- a/include/nuttx/regmap/regmap.h +++ b/include/nuttx/regmap/regmap.h @@ -57,6 +57,10 @@ typedef CODE int (*write_t)(FAR struct regmap_bus_s *bus, FAR const void *data, unsigned int count); +/* Resources destroyed. */ + +typedef CODE void (*exit_t)(FAR struct regmap_bus_s *bus); + /* Description of a hardware bus for the register map infrastructure. */ struct regmap_bus_s @@ -65,6 +69,7 @@ struct regmap_bus_s reg_write_t reg_write; read_t read; write_t write; + exit_t exit; }; /* Configuration for the register map of a device.