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:
Tomasz Bursztyka 2020-04-30 20:33:38 +02:00 committed by Carles Cufí
commit e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions

View file

@ -88,7 +88,7 @@ struct cfb_font {
*
* @return 0 on success, negative value otherwise
*/
int cfb_print(struct device *dev, char *str, uint16_t x, uint16_t y);
int cfb_print(const struct device *dev, char *str, uint16_t x, uint16_t y);
/**
* @brief Clear framebuffer.
@ -98,7 +98,7 @@ int cfb_print(struct device *dev, char *str, uint16_t x, uint16_t y);
*
* @return 0 on success, negative value otherwise
*/
int cfb_framebuffer_clear(struct device *dev, bool clear_display);
int cfb_framebuffer_clear(const struct device *dev, bool clear_display);
/**
* @brief Invert Pixels.
@ -107,7 +107,7 @@ int cfb_framebuffer_clear(struct device *dev, bool clear_display);
*
* @return 0 on success, negative value otherwise
*/
int cfb_framebuffer_invert(struct device *dev);
int cfb_framebuffer_invert(const struct device *dev);
/**
* @brief Finalize framebuffer and write it to display RAM,
@ -117,7 +117,7 @@ int cfb_framebuffer_invert(struct device *dev);
*
* @return 0 on success, negative value otherwise
*/
int cfb_framebuffer_finalize(struct device *dev);
int cfb_framebuffer_finalize(const struct device *dev);
/**
* @brief Get display parameter.
@ -127,7 +127,8 @@ int cfb_framebuffer_finalize(struct device *dev);
*
* @return Display parameter value
*/
int cfb_get_display_parameter(struct device *dev, enum cfb_display_param);
int cfb_get_display_parameter(const struct device *dev,
enum cfb_display_param);
/**
* @brief Set font.
@ -137,7 +138,7 @@ int cfb_get_display_parameter(struct device *dev, enum cfb_display_param);
*
* @return 0 on success, negative value otherwise
*/
int cfb_framebuffer_set_font(struct device *dev, uint8_t idx);
int cfb_framebuffer_set_font(const struct device *dev, uint8_t idx);
/**
* @brief Get font size.
@ -149,7 +150,8 @@ int cfb_framebuffer_set_font(struct device *dev, uint8_t idx);
*
* @return 0 on success, negative value otherwise
*/
int cfb_get_font_size(struct device *dev, uint8_t idx, uint8_t *width, uint8_t *height);
int cfb_get_font_size(const struct device *dev, uint8_t idx, uint8_t *width,
uint8_t *height);
/**
* @brief Get number of fonts.
@ -158,7 +160,7 @@ int cfb_get_font_size(struct device *dev, uint8_t idx, uint8_t *width, uint8_t *
*
* @return number of fonts
*/
int cfb_get_numof_fonts(struct device *dev);
int cfb_get_numof_fonts(const struct device *dev);
/**
* @brief Initialize Character Framebuffer.
@ -167,7 +169,7 @@ int cfb_get_numof_fonts(struct device *dev);
*
* @return 0 on success, negative value otherwise
*/
int cfb_framebuffer_init(struct device *dev);
int cfb_framebuffer_init(const struct device *dev);
#ifdef __cplusplus
}

View file

@ -34,7 +34,7 @@ extern "C" {
* @param data the ASCII text to display
* @param size the length of the text in bytes
*/
void glcd_print(struct device *port, char *data, uint32_t size);
void glcd_print(const struct device *port, char *data, uint32_t size);
/**
@ -44,14 +44,14 @@ void glcd_print(struct device *port, char *data, uint32_t size);
* @param col the column for the cursor to be moved to (0-15)
* @param row the row it should be moved to (0 or 1)
*/
void glcd_cursor_pos_set(struct device *port, uint8_t col, uint8_t row);
void glcd_cursor_pos_set(const struct device *port, uint8_t col, uint8_t row);
/**
* @brief Clear the current display
*
* @param port Pointer to device structure for driver instance.
*/
void glcd_clear(struct device *port);
void glcd_clear(const struct device *port);
/* Defines for the GLCD_CMD_DISPLAY_SWITCH options */
#define GLCD_DS_DISPLAY_ON (1 << 2)
@ -71,7 +71,7 @@ void glcd_clear(struct device *port);
* @param opt An 8bit bitmask of GLCD_DS_* options.
*
*/
void glcd_display_state_set(struct device *port, uint8_t opt);
void glcd_display_state_set(const struct device *port, uint8_t opt);
/**
* @brief return the display feature set associated with the device
@ -80,7 +80,7 @@ void glcd_display_state_set(struct device *port, uint8_t opt);
*
* @return the display feature set associated with the device.
*/
uint8_t glcd_display_state_get(struct device *port);
uint8_t glcd_display_state_get(const struct device *port);
/* Defines for the GLCD_CMD_INPUT_SET to change text direction */
#define GLCD_IS_SHIFT_INCREMENT (1 << 1)
@ -97,7 +97,7 @@ uint8_t glcd_display_state_get(struct device *port);
* @param opt A bitmask of GLCD_IS_* options
*
*/
void glcd_input_state_set(struct device *port, uint8_t opt);
void glcd_input_state_set(const struct device *port, uint8_t opt);
/**
* @brief return the input set associated with the device
@ -106,7 +106,7 @@ void glcd_input_state_set(struct device *port, uint8_t opt);
*
* @return the input set associated with the device.
*/
uint8_t glcd_input_state_get(struct device *port);
uint8_t glcd_input_state_get(const struct device *port);
/* Defines for the LCD_FUNCTION_SET */
#define GLCD_FS_8BIT_MODE (1 << 4)
@ -125,7 +125,7 @@ uint8_t glcd_input_state_get(struct device *port);
* of the display as per needed. Controlling things like the number of rows,
* dot size, and text display quality.
*/
void glcd_function_set(struct device *port, uint8_t opt);
void glcd_function_set(const struct device *port, uint8_t opt);
/**
* @brief return the function set associated with the device
@ -134,7 +134,7 @@ void glcd_function_set(struct device *port, uint8_t opt);
*
* @return the function features set associated with the device.
*/
uint8_t glcd_function_get(struct device *port);
uint8_t glcd_function_get(const struct device *port);
/* Available color selections */
@ -147,7 +147,7 @@ uint8_t glcd_function_get(struct device *port);
* @param port Pointer to device structure for driver instance.
* @param color One of the predefined color options
*/
void glcd_color_select(struct device *port, uint8_t color);
void glcd_color_select(const struct device *port, uint8_t color);
/**
@ -158,7 +158,8 @@ void glcd_color_select(struct device *port, uint8_t color);
* @param g A numeric value for the green color (max is 255)
* @param b A numeric value for the blue color (max is 255)
*/
void glcd_color_set(struct device *port, uint8_t r, uint8_t g, uint8_t b);
void glcd_color_set(const struct device *port, uint8_t r, uint8_t g,
uint8_t b);
/**
@ -168,7 +169,7 @@ void glcd_color_set(struct device *port, uint8_t r, uint8_t g, uint8_t b);
*
* @return Returns 0 if all passes
*/
int glcd_initialize(struct device *port);
int glcd_initialize(const struct device *port);
/**