drivers/regmap: add exit function interface.

Signed-off-by: likun17 <likun17@xiaomi.com>
This commit is contained in:
likun17 2023-10-08 14:12:03 +08:00 committed by Xiang Xiao
parent 1661a66843
commit 7913b249ca
2 changed files with 10 additions and 0 deletions

View File

@ -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);
}

View File

@ -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.