Commit 2081bd89 authored by Maxime Ripard's avatar Maxime Ripard

drm/atomic: Constify the old/new state accessors

The drm_atomic_get_(old|new)_*_state don't modify the passed
drm_atomic_state, so we can make it const.
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20221123-rpi-kunit-tests-v1-9-051a0bb60a16@cerno.tech
parent 7783cc67
...@@ -880,7 +880,7 @@ EXPORT_SYMBOL(drm_atomic_get_private_obj_state); ...@@ -880,7 +880,7 @@ EXPORT_SYMBOL(drm_atomic_get_private_obj_state);
* or NULL if the private_obj is not part of the global atomic state. * or NULL if the private_obj is not part of the global atomic state.
*/ */
struct drm_private_state * struct drm_private_state *
drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, drm_atomic_get_old_private_obj_state(const struct drm_atomic_state *state,
struct drm_private_obj *obj) struct drm_private_obj *obj)
{ {
int i; int i;
...@@ -902,7 +902,7 @@ EXPORT_SYMBOL(drm_atomic_get_old_private_obj_state); ...@@ -902,7 +902,7 @@ EXPORT_SYMBOL(drm_atomic_get_old_private_obj_state);
* or NULL if the private_obj is not part of the global atomic state. * or NULL if the private_obj is not part of the global atomic state.
*/ */
struct drm_private_state * struct drm_private_state *
drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, drm_atomic_get_new_private_obj_state(const struct drm_atomic_state *state,
struct drm_private_obj *obj) struct drm_private_obj *obj)
{ {
int i; int i;
...@@ -934,7 +934,7 @@ EXPORT_SYMBOL(drm_atomic_get_new_private_obj_state); ...@@ -934,7 +934,7 @@ EXPORT_SYMBOL(drm_atomic_get_new_private_obj_state);
* not connected. * not connected.
*/ */
struct drm_connector * struct drm_connector *
drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, drm_atomic_get_old_connector_for_encoder(const struct drm_atomic_state *state,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct drm_connector_state *conn_state; struct drm_connector_state *conn_state;
...@@ -968,7 +968,7 @@ EXPORT_SYMBOL(drm_atomic_get_old_connector_for_encoder); ...@@ -968,7 +968,7 @@ EXPORT_SYMBOL(drm_atomic_get_old_connector_for_encoder);
* not connected. * not connected.
*/ */
struct drm_connector * struct drm_connector *
drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, drm_atomic_get_new_connector_for_encoder(const struct drm_atomic_state *state,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct drm_connector_state *conn_state; struct drm_connector_state *conn_state;
...@@ -1117,7 +1117,7 @@ EXPORT_SYMBOL(drm_atomic_get_bridge_state); ...@@ -1117,7 +1117,7 @@ EXPORT_SYMBOL(drm_atomic_get_bridge_state);
* the bridge is not part of the global atomic state. * the bridge is not part of the global atomic state.
*/ */
struct drm_bridge_state * struct drm_bridge_state *
drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, drm_atomic_get_old_bridge_state(const struct drm_atomic_state *state,
struct drm_bridge *bridge) struct drm_bridge *bridge)
{ {
struct drm_private_state *obj_state; struct drm_private_state *obj_state;
...@@ -1139,7 +1139,7 @@ EXPORT_SYMBOL(drm_atomic_get_old_bridge_state); ...@@ -1139,7 +1139,7 @@ EXPORT_SYMBOL(drm_atomic_get_old_bridge_state);
* the bridge is not part of the global atomic state. * the bridge is not part of the global atomic state.
*/ */
struct drm_bridge_state * struct drm_bridge_state *
drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, drm_atomic_get_new_bridge_state(const struct drm_atomic_state *state,
struct drm_bridge *bridge) struct drm_bridge *bridge)
{ {
struct drm_private_state *obj_state; struct drm_private_state *obj_state;
......
...@@ -515,17 +515,17 @@ struct drm_private_state * __must_check ...@@ -515,17 +515,17 @@ struct drm_private_state * __must_check
drm_atomic_get_private_obj_state(struct drm_atomic_state *state, drm_atomic_get_private_obj_state(struct drm_atomic_state *state,
struct drm_private_obj *obj); struct drm_private_obj *obj);
struct drm_private_state * struct drm_private_state *
drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, drm_atomic_get_old_private_obj_state(const struct drm_atomic_state *state,
struct drm_private_obj *obj); struct drm_private_obj *obj);
struct drm_private_state * struct drm_private_state *
drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, drm_atomic_get_new_private_obj_state(const struct drm_atomic_state *state,
struct drm_private_obj *obj); struct drm_private_obj *obj);
struct drm_connector * struct drm_connector *
drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, drm_atomic_get_old_connector_for_encoder(const struct drm_atomic_state *state,
struct drm_encoder *encoder); struct drm_encoder *encoder);
struct drm_connector * struct drm_connector *
drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, drm_atomic_get_new_connector_for_encoder(const struct drm_atomic_state *state,
struct drm_encoder *encoder); struct drm_encoder *encoder);
/** /**
...@@ -540,7 +540,7 @@ drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, ...@@ -540,7 +540,7 @@ drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state,
* @drm_atomic_get_new_crtc_state should be used instead. * @drm_atomic_get_new_crtc_state should be used instead.
*/ */
static inline struct drm_crtc_state * static inline struct drm_crtc_state *
drm_atomic_get_existing_crtc_state(struct drm_atomic_state *state, drm_atomic_get_existing_crtc_state(const struct drm_atomic_state *state,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
return state->crtcs[drm_crtc_index(crtc)].state; return state->crtcs[drm_crtc_index(crtc)].state;
...@@ -555,7 +555,7 @@ drm_atomic_get_existing_crtc_state(struct drm_atomic_state *state, ...@@ -555,7 +555,7 @@ drm_atomic_get_existing_crtc_state(struct drm_atomic_state *state,
* NULL if the CRTC is not part of the global atomic state. * NULL if the CRTC is not part of the global atomic state.
*/ */
static inline struct drm_crtc_state * static inline struct drm_crtc_state *
drm_atomic_get_old_crtc_state(struct drm_atomic_state *state, drm_atomic_get_old_crtc_state(const struct drm_atomic_state *state,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
return state->crtcs[drm_crtc_index(crtc)].old_state; return state->crtcs[drm_crtc_index(crtc)].old_state;
...@@ -569,7 +569,7 @@ drm_atomic_get_old_crtc_state(struct drm_atomic_state *state, ...@@ -569,7 +569,7 @@ drm_atomic_get_old_crtc_state(struct drm_atomic_state *state,
* NULL if the CRTC is not part of the global atomic state. * NULL if the CRTC is not part of the global atomic state.
*/ */
static inline struct drm_crtc_state * static inline struct drm_crtc_state *
drm_atomic_get_new_crtc_state(struct drm_atomic_state *state, drm_atomic_get_new_crtc_state(const struct drm_atomic_state *state,
struct drm_crtc *crtc) struct drm_crtc *crtc)
{ {
return state->crtcs[drm_crtc_index(crtc)].new_state; return state->crtcs[drm_crtc_index(crtc)].new_state;
...@@ -587,7 +587,7 @@ drm_atomic_get_new_crtc_state(struct drm_atomic_state *state, ...@@ -587,7 +587,7 @@ drm_atomic_get_new_crtc_state(struct drm_atomic_state *state,
* @drm_atomic_get_new_plane_state should be used instead. * @drm_atomic_get_new_plane_state should be used instead.
*/ */
static inline struct drm_plane_state * static inline struct drm_plane_state *
drm_atomic_get_existing_plane_state(struct drm_atomic_state *state, drm_atomic_get_existing_plane_state(const struct drm_atomic_state *state,
struct drm_plane *plane) struct drm_plane *plane)
{ {
return state->planes[drm_plane_index(plane)].state; return state->planes[drm_plane_index(plane)].state;
...@@ -602,7 +602,7 @@ drm_atomic_get_existing_plane_state(struct drm_atomic_state *state, ...@@ -602,7 +602,7 @@ drm_atomic_get_existing_plane_state(struct drm_atomic_state *state,
* NULL if the plane is not part of the global atomic state. * NULL if the plane is not part of the global atomic state.
*/ */
static inline struct drm_plane_state * static inline struct drm_plane_state *
drm_atomic_get_old_plane_state(struct drm_atomic_state *state, drm_atomic_get_old_plane_state(const struct drm_atomic_state *state,
struct drm_plane *plane) struct drm_plane *plane)
{ {
return state->planes[drm_plane_index(plane)].old_state; return state->planes[drm_plane_index(plane)].old_state;
...@@ -617,7 +617,7 @@ drm_atomic_get_old_plane_state(struct drm_atomic_state *state, ...@@ -617,7 +617,7 @@ drm_atomic_get_old_plane_state(struct drm_atomic_state *state,
* NULL if the plane is not part of the global atomic state. * NULL if the plane is not part of the global atomic state.
*/ */
static inline struct drm_plane_state * static inline struct drm_plane_state *
drm_atomic_get_new_plane_state(struct drm_atomic_state *state, drm_atomic_get_new_plane_state(const struct drm_atomic_state *state,
struct drm_plane *plane) struct drm_plane *plane)
{ {
return state->planes[drm_plane_index(plane)].new_state; return state->planes[drm_plane_index(plane)].new_state;
...@@ -635,7 +635,7 @@ drm_atomic_get_new_plane_state(struct drm_atomic_state *state, ...@@ -635,7 +635,7 @@ drm_atomic_get_new_plane_state(struct drm_atomic_state *state,
* @drm_atomic_get_new_connector_state should be used instead. * @drm_atomic_get_new_connector_state should be used instead.
*/ */
static inline struct drm_connector_state * static inline struct drm_connector_state *
drm_atomic_get_existing_connector_state(struct drm_atomic_state *state, drm_atomic_get_existing_connector_state(const struct drm_atomic_state *state,
struct drm_connector *connector) struct drm_connector *connector)
{ {
int index = drm_connector_index(connector); int index = drm_connector_index(connector);
...@@ -655,7 +655,7 @@ drm_atomic_get_existing_connector_state(struct drm_atomic_state *state, ...@@ -655,7 +655,7 @@ drm_atomic_get_existing_connector_state(struct drm_atomic_state *state,
* or NULL if the connector is not part of the global atomic state. * or NULL if the connector is not part of the global atomic state.
*/ */
static inline struct drm_connector_state * static inline struct drm_connector_state *
drm_atomic_get_old_connector_state(struct drm_atomic_state *state, drm_atomic_get_old_connector_state(const struct drm_atomic_state *state,
struct drm_connector *connector) struct drm_connector *connector)
{ {
int index = drm_connector_index(connector); int index = drm_connector_index(connector);
...@@ -675,7 +675,7 @@ drm_atomic_get_old_connector_state(struct drm_atomic_state *state, ...@@ -675,7 +675,7 @@ drm_atomic_get_old_connector_state(struct drm_atomic_state *state,
* or NULL if the connector is not part of the global atomic state. * or NULL if the connector is not part of the global atomic state.
*/ */
static inline struct drm_connector_state * static inline struct drm_connector_state *
drm_atomic_get_new_connector_state(struct drm_atomic_state *state, drm_atomic_get_new_connector_state(const struct drm_atomic_state *state,
struct drm_connector *connector) struct drm_connector *connector)
{ {
int index = drm_connector_index(connector); int index = drm_connector_index(connector);
...@@ -713,7 +713,7 @@ drm_atomic_get_new_connector_state(struct drm_atomic_state *state, ...@@ -713,7 +713,7 @@ drm_atomic_get_new_connector_state(struct drm_atomic_state *state,
* Read-only pointer to the current plane state. * Read-only pointer to the current plane state.
*/ */
static inline const struct drm_plane_state * static inline const struct drm_plane_state *
__drm_atomic_get_current_plane_state(struct drm_atomic_state *state, __drm_atomic_get_current_plane_state(const struct drm_atomic_state *state,
struct drm_plane *plane) struct drm_plane *plane)
{ {
if (state->planes[drm_plane_index(plane)].state) if (state->planes[drm_plane_index(plane)].state)
...@@ -1134,10 +1134,10 @@ struct drm_bridge_state * ...@@ -1134,10 +1134,10 @@ struct drm_bridge_state *
drm_atomic_get_bridge_state(struct drm_atomic_state *state, drm_atomic_get_bridge_state(struct drm_atomic_state *state,
struct drm_bridge *bridge); struct drm_bridge *bridge);
struct drm_bridge_state * struct drm_bridge_state *
drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, drm_atomic_get_old_bridge_state(const struct drm_atomic_state *state,
struct drm_bridge *bridge); struct drm_bridge *bridge);
struct drm_bridge_state * struct drm_bridge_state *
drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, drm_atomic_get_new_bridge_state(const struct drm_atomic_state *state,
struct drm_bridge *bridge); struct drm_bridge *bridge);
#endif /* DRM_ATOMIC_H_ */ #endif /* DRM_ATOMIC_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment