device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all the other attributes, it is possible to switch all device driver instance to be constant. A coccinelle rule is used for this: @r_const_dev_1 disable optional_qualifier @ @@ -struct device * +const struct device * @r_const_dev_2 disable optional_qualifier @ @@ -struct device * const +const struct device * Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
c8906fef79
commit
e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions
|
@ -7,35 +7,37 @@
|
|||
#include <syscall_handler.h>
|
||||
#include <drivers/flash.h>
|
||||
|
||||
static inline int z_vrfy_flash_read(struct device *dev, off_t offset,
|
||||
static inline int z_vrfy_flash_read(const struct device *dev, off_t offset,
|
||||
void *data, size_t len)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, read));
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(data, len));
|
||||
return z_impl_flash_read((struct device *)dev, offset, (void *)data,
|
||||
len);
|
||||
return z_impl_flash_read((const struct device *)dev, offset,
|
||||
(void *)data,
|
||||
len);
|
||||
}
|
||||
#include <syscalls/flash_read_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_flash_write(struct device *dev, off_t offset,
|
||||
const void *data, size_t len)
|
||||
static inline int z_vrfy_flash_write(const struct device *dev, off_t offset,
|
||||
const void *data, size_t len)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, write));
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_READ(data, len));
|
||||
return z_impl_flash_write((struct device *)dev, offset,
|
||||
(const void *)data, len);
|
||||
return z_impl_flash_write((const struct device *)dev, offset,
|
||||
(const void *)data, len);
|
||||
}
|
||||
#include <syscalls/flash_write_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_flash_write_protection_set(struct device *dev,
|
||||
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((struct device *)dev, enable);
|
||||
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(struct device *dev)
|
||||
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));
|
||||
return z_impl_flash_get_write_block_size(dev);
|
||||
|
@ -43,32 +45,34 @@ static inline size_t z_vrfy_flash_get_write_block_size(struct device *dev)
|
|||
#include <syscalls/flash_get_write_block_size_mrsh.c>
|
||||
|
||||
#ifdef CONFIG_FLASH_PAGE_LAYOUT
|
||||
static inline int z_vrfy_flash_get_page_info_by_offs(struct device *dev,
|
||||
off_t offs,
|
||||
struct flash_pages_info *info)
|
||||
static inline int z_vrfy_flash_get_page_info_by_offs(const struct device *dev,
|
||||
off_t offs,
|
||||
struct flash_pages_info *info)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout));
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(info, sizeof(struct flash_pages_info)));
|
||||
return z_impl_flash_get_page_info_by_offs((struct device *)dev, offs,
|
||||
(struct flash_pages_info *)info);
|
||||
return z_impl_flash_get_page_info_by_offs((const struct device *)dev,
|
||||
offs,
|
||||
(struct flash_pages_info *)info);
|
||||
}
|
||||
#include <syscalls/flash_get_page_info_by_offs_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_flash_get_page_info_by_idx(struct device *dev,
|
||||
uint32_t idx,
|
||||
struct flash_pages_info *info)
|
||||
static inline int z_vrfy_flash_get_page_info_by_idx(const struct device *dev,
|
||||
uint32_t idx,
|
||||
struct flash_pages_info *info)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout));
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(info, sizeof(struct flash_pages_info)));
|
||||
return z_impl_flash_get_page_info_by_idx((struct device *)dev, idx,
|
||||
(struct flash_pages_info *)info);
|
||||
return z_impl_flash_get_page_info_by_idx((const struct device *)dev,
|
||||
idx,
|
||||
(struct flash_pages_info *)info);
|
||||
}
|
||||
#include <syscalls/flash_get_page_info_by_idx_mrsh.c>
|
||||
|
||||
static inline size_t z_vrfy_flash_get_page_count(struct device *dev)
|
||||
static inline size_t z_vrfy_flash_get_page_count(const struct device *dev)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, page_layout));
|
||||
return z_impl_flash_get_page_count((struct device *)dev);
|
||||
return z_impl_flash_get_page_count((const struct device *)dev);
|
||||
}
|
||||
#include <syscalls/flash_get_page_count_mrsh.c>
|
||||
|
||||
|
@ -76,7 +80,8 @@ static inline size_t z_vrfy_flash_get_page_count(struct device *dev)
|
|||
|
||||
#ifdef CONFIG_FLASH_JESD216_API
|
||||
|
||||
static inline int z_vrfy_flash_sfdp_read(struct device *dev, off_t offset,
|
||||
static inline int z_vrfy_flash_sfdp_read(const struct device *dev,
|
||||
off_t offset,
|
||||
void *data, size_t len)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, sfdp_read));
|
||||
|
@ -85,7 +90,7 @@ static inline int z_vrfy_flash_sfdp_read(struct device *dev, off_t offset,
|
|||
}
|
||||
#include <syscalls/flash_sfdp_read.c>
|
||||
|
||||
static inline int z_vrfy_flash_read_jedec_id(struct device *dev,
|
||||
static inline int z_vrfy_flash_read_jedec_id(const struct device *dev,
|
||||
uint8_t *id)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_FLASH(dev, read_jedec_id));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue