drivers/flash: remove flash_write_protection API

This API was designed to be removed in Zephyr 2.8

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This commit is contained in:
Andrzej Puzdrowski
2022-01-28 10:43:10 +01:00
committed by Carles Cufí
parent f3a61dfecc
commit 23b6e51e73
2 changed files with 0 additions and 74 deletions

View File

@@ -28,15 +28,6 @@ static inline int z_vrfy_flash_write(const struct device *dev, off_t offset,
}
#include <syscalls/flash_write_mrsh.c>
static inline int z_vrfy_flash_write_protection_set(const struct device *dev,
bool enable)
{
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, write_protection));
return z_impl_flash_write_protection_set((const struct device *)dev,
enable);
}
#include <syscalls/flash_write_protection_set_mrsh.c>
static inline size_t z_vrfy_flash_get_write_block_size(const struct device *dev)
{
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_FLASH));

View File

@@ -91,9 +91,6 @@ typedef int (*flash_api_write)(const struct device *dev, off_t offset,
typedef int (*flash_api_erase)(const struct device *dev, off_t offset,
size_t size);
/* This API is deprecated and will be removed in Zephyr 2.8. */
typedef int (*flash_api_write_protection)(const struct device *dev,
bool enable);
typedef const struct flash_parameters* (*flash_api_get_parameters)(const struct device *dev);
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
@@ -131,7 +128,6 @@ __subsystem struct flash_driver_api {
flash_api_read read;
flash_api_write write;
flash_api_erase erase;
flash_api_write_protection write_protection;
flash_api_get_parameters get_parameters;
#if defined(CONFIG_FLASH_PAGE_LAYOUT)
flash_api_pages_layout page_layout;
@@ -206,24 +202,8 @@ static inline int z_impl_flash_write(const struct device *dev, off_t offset,
(const struct flash_driver_api *)dev->api;
int rc;
/* write protection management in this function exists for keeping
* compatibility with out-of-tree drivers which are not aligned jet
* with write-protection API depreciation.
* This will be removed with flash_api_write_protection handler type.
*/
if (api->write_protection != NULL) {
rc = api->write_protection(dev, false);
if (rc) {
return rc;
}
}
rc = api->write(dev, offset, data, len);
if (api->write_protection != NULL) {
(void) api->write_protection(dev, true);
}
return rc;
}
@@ -257,56 +237,11 @@ static inline int z_impl_flash_erase(const struct device *dev, off_t offset,
(const struct flash_driver_api *)dev->api;
int rc;
/* write protection management in this function exists for keeping
* compatibility with out-of-tree drivers which are not aligned jet
* with write-protection API depreciation.
* This will be removed with flash_api_write_protection handler type.
*/
if (api->write_protection != NULL) {
rc = api->write_protection(dev, false);
if (rc) {
return rc;
}
}
rc = api->erase(dev, offset, size);
if (api->write_protection != NULL) {
(void) api->write_protection(dev, true);
}
return rc;
}
/**
* @brief Enable or disable write protection for a flash memory
*
* This API is deprecated and will be removed in Zephyr 2.8.
* It will be keep as No-Operation until removal.
* Flash write/erase protection management has been moved to write and erase
* operations implementations in flash driver shims. For Out-of-tree drivers
* which are not updated yet flash write/erase protection management is done
* in flash_erase() and flash_write() using deprecated <p>write_protection</p>
* shim handler.
*
* @param dev : flash device
* @param enable : enable or disable flash write protection
*
* @return 0 on success, negative errno code on fail.
*/
__deprecated
__syscall int flash_write_protection_set(const struct device *dev,
bool enable);
static inline int z_impl_flash_write_protection_set(const struct device *dev,
bool enable)
{
ARG_UNUSED(dev);
ARG_UNUSED(enable);
return 0;
}
struct flash_pages_info {
off_t start_offset; /* offset from the base of flash address */
size_t size;