From 0bad7f814afc152e6fbd303eee6f48c23e4c78eb Mon Sep 17 00:00:00 2001 From: chenrun1 Date: Wed, 16 Oct 2024 14:42:25 +0800 Subject: [PATCH] rammtd:add rammtd_uninitialize Summary: Added rammtd_uninitialize to manage rammtd Signed-off-by: chenrun1 --- drivers/mtd/rammtd.c | 18 ++++++++++++++++++ include/nuttx/mtd/mtd.h | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/mtd/rammtd.c b/drivers/mtd/rammtd.c index 4c7503fe4ca91..0bcc0af0a380e 100644 --- a/drivers/mtd/rammtd.c +++ b/drivers/mtd/rammtd.c @@ -520,3 +520,21 @@ FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size) return &priv->mtd; } + +/**************************************************************************** + * Name: rammtd_uninitialize + * + * Description: + * Free the resources associated with a RAM MTD device instance. + * + * Input Parameters: + * dev - Pointer to the MTD device instance to be uninitialized. + * + ****************************************************************************/ + +void rammtd_uninitialize(FAR struct mtd_dev_s *dev) +{ + FAR struct ram_dev_s *priv = (FAR struct ram_dev_s *)dev; + + kmm_free(priv); +} diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index 9b8622b837ca0..c528db4e8e9c4 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -490,6 +490,19 @@ FAR struct mtd_dev_s *mx35_initialize(FAR struct spi_dev_s *dev); FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size); +/**************************************************************************** + * Name: rammtd_uninitialize + * + * Description: + * Free the resources associated with a RAM MTD device instance. + * + * Input Parameters: + * dev - Pointer to the MTD device instance to be uninitialized. + * + ****************************************************************************/ + +void rammtd_uninitialize(FAR struct mtd_dev_s *dev); + /**************************************************************************** * Name: ramtron_initialize *