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
|
@ -136,7 +136,8 @@ static const struct flash_parameters flash_mcux_parameters = {
|
|||
*
|
||||
*/
|
||||
|
||||
static int flash_mcux_erase(struct device *dev, off_t offset, size_t len)
|
||||
static int flash_mcux_erase(const struct device *dev, off_t offset,
|
||||
size_t len)
|
||||
{
|
||||
struct flash_priv *priv = dev->data;
|
||||
uint32_t addr;
|
||||
|
@ -169,7 +170,7 @@ static int flash_mcux_erase(struct device *dev, off_t offset, size_t len)
|
|||
* @return 0 on success,
|
||||
* -EIO for erroneous area
|
||||
*/
|
||||
static int flash_mcux_read(struct device *dev, off_t offset,
|
||||
static int flash_mcux_read(const struct device *dev, off_t offset,
|
||||
void *data, size_t len)
|
||||
{
|
||||
struct flash_priv *priv = dev->data;
|
||||
|
@ -200,7 +201,7 @@ static int flash_mcux_read(struct device *dev, off_t offset,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int flash_mcux_write(struct device *dev, off_t offset,
|
||||
static int flash_mcux_write(const struct device *dev, off_t offset,
|
||||
const void *data, size_t len)
|
||||
{
|
||||
struct flash_priv *priv = dev->data;
|
||||
|
@ -223,7 +224,7 @@ static int flash_mcux_write(struct device *dev, off_t offset,
|
|||
return (rc == kStatus_Success) ? 0 : -EINVAL;
|
||||
}
|
||||
|
||||
static int flash_mcux_write_protection(struct device *dev, bool enable)
|
||||
static int flash_mcux_write_protection(const struct device *dev, bool enable)
|
||||
{
|
||||
struct flash_priv *priv = dev->data;
|
||||
int rc = 0;
|
||||
|
@ -244,7 +245,7 @@ static const struct flash_pages_layout dev_layout = {
|
|||
.pages_size = DT_PROP(SOC_NV_FLASH_NODE, erase_block_size),
|
||||
};
|
||||
|
||||
static void flash_mcux_pages_layout(struct device *dev,
|
||||
static void flash_mcux_pages_layout(const struct device *dev,
|
||||
const struct flash_pages_layout **layout,
|
||||
size_t *layout_size)
|
||||
{
|
||||
|
@ -274,7 +275,7 @@ static const struct flash_driver_api flash_mcux_api = {
|
|||
#endif
|
||||
};
|
||||
|
||||
static int flash_mcux_init(struct device *dev)
|
||||
static int flash_mcux_init(const struct device *dev)
|
||||
{
|
||||
struct flash_priv *priv = dev->data;
|
||||
uint32_t pflash_block_base;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue