This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 7913b249ca drivers/regmap: add exit function interface.
7913b249ca is described below
commit 7913b249ca21b5cb6ef0cc3b37708ec68820b1b6
Author: likun17 <[email protected]>
AuthorDate: Sun Oct 8 14:12:03 2023 +0800
drivers/regmap: add exit function interface.
Signed-off-by: likun17 <[email protected]>
---
drivers/regmap/regmap.c | 5 +++++
include/nuttx/regmap/regmap.h | 5 +++++
2 files changed, 10 insertions(+)
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.