drm/atomic: Constify a bunch of functions pointer structs
Subsystems (11)
PATCH 1/1 drm/atomic: Constify a bunch of functions pointer structs
From: Ville Syrjälä <[email protected]>
Make the helper function pointer structs const to make it clear they should not be modified.
--- drivers/gpu/drm/drm_atomic_helper.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +17 -17
@@ -151,7 +151,7 @@ steal_encoder(struct drm_atomic_state *state,static int update_connector_routing (struct drm_atomic_state *state,int conn_idx) { -struct drm_connector_helper_funcs *funcs; +const struct drm_connector_helper_funcs *funcs;struct drm_encoder *new_encoder;struct drm_crtc *encoder_crtc;struct drm_connector *connector;
@@ -264,7 +264,7 @@ mode_fixup(struct drm_atomic_state *state) }for (i =0 ; i < state->num_connector; i++) { -struct drm_encoder_helper_funcs *funcs; +const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder; conn_state = state->connector_states[i];
@@ -317,7 +317,7 @@ mode_fixup(struct drm_atomic_state *state) }for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc; crtc_state = state->crtc_states[i];
@@ -481,7 +481,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev,int i, ret =0 ;for (i =0 ; i < nplanes; i++) { -struct drm_plane_helper_funcs *funcs; +const struct drm_plane_helper_funcs *funcs;struct drm_plane *plane = state->planes[i];struct drm_plane_state *plane_state = state->plane_states[i];
@@ -504,7 +504,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev, }for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc = state->crtcs[i];if (!crtc)
@@ -571,9 +571,9 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)int i;for (i =0 ; i < old_state->num_connector; i++) { +const struct drm_encoder_helper_funcs *funcs;struct drm_connector_state *old_conn_state;struct drm_connector *connector; -struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;struct drm_crtc_state *old_crtc_state;
@@ -623,7 +623,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) }for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;
@@ -713,7 +713,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)int i;for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc; crtc = old_state->crtcs[i];
@@ -732,9 +732,9 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) }for (i =0 ; i < old_state->num_connector; i++) { +const struct drm_encoder_helper_funcs *funcs;struct drm_connector *connector;struct drm_crtc_state *new_crtc_state; -struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;struct drm_display_mode *mode, *adjusted_mode;
@@ -812,7 +812,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,int i;for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc; crtc = old_state->crtcs[i];
@@ -838,8 +838,8 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, }for (i =0 ; i < old_state->num_connector; i++) { +const struct drm_encoder_helper_funcs *funcs;struct drm_connector *connector; -struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder; connector = old_state->connectors[i];
@@ -1114,7 +1114,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev,int ret, i;for (i =0 ; i < nplanes; i++) { -struct drm_plane_helper_funcs *funcs; +const struct drm_plane_helper_funcs *funcs;struct drm_plane *plane = state->planes[i];struct drm_plane_state *plane_state = state->plane_states[i];struct drm_framebuffer *fb;
@@ -1137,7 +1137,7 @@ int drm_atomic_helper_prepare_planes(struct drm_device *dev, fail:for (i--; i >=0 ; i--) { -struct drm_plane_helper_funcs *funcs; +const struct drm_plane_helper_funcs *funcs;struct drm_plane *plane = state->planes[i];struct drm_plane_state *plane_state = state->plane_states[i];struct drm_framebuffer *fb;
@@ -1179,7 +1179,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,int i;for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc = old_state->crtcs[i];if (!crtc)
@@ -1194,7 +1194,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, }for (i =0 ; i < nplanes; i++) { -struct drm_plane_helper_funcs *funcs; +const struct drm_plane_helper_funcs *funcs;struct drm_plane *plane = old_state->planes[i];struct drm_plane_state *old_plane_state;
@@ -1219,7 +1219,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, }for (i =0 ; i < ncrtcs; i++) { -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc = old_state->crtcs[i];if (!crtc)
@@ -1254,7 +1254,7 @@ void drm_atomic_helper_cleanup_planes(struct drm_device *dev,int i;for (i =0 ; i < nplanes; i++) { -struct drm_plane_helper_funcs *funcs; +const struct drm_plane_helper_funcs *funcs;struct drm_plane *plane = old_state->planes[i];struct drm_plane_state *plane_state = old_state->plane_states[i];struct drm_framebuffer *old_fb;
Signature · 6 lines
2.0.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
cover drm: constify all helper_private/func pointers
Quoted 2 lines · On Tue, 10 Mar 2015, [email protected] wrote:
Make the helper function pointer structs const to make it clear they should not be modified.
So why not fix this once and for all? See the following patches.
This was quick cocci, can be split by driver too if so desired.
BR,
Jani.
Jani Nikula (4):
drm: constify all struct drm_encoder_helper_funcs pointers
drm: constify all struct drm_connector_helper_funcs pointers
drm: constify all struct drm_crtc_helper_funcs pointers
drm: make encoder/connector/crtc helper_private a const pointer
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++-- drivers/gpu/drm/drm_atomic_helper.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_fb_helper.c | 8 ++++---- drivers/gpu/drm/drm_plane_helper.c | 2 +- drivers/gpu/drm/drm_probe_helper.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 10 +++++----- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 2 +- drivers/gpu/drm/gma500/mdfld_intel_display.c | 2 +- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +- drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/dac.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/dfp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++-- drivers/gpu/drm/qxl/qxl_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_connectors.c | 16 ++++++++-------- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 2 +- include/drm/drm_crtc.h | 6 +++--- include/drm/drm_crtc_helper.h | 6 +++--- 30 files changed, 81 insertions(+), 81 deletions(-)
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/4 drm: constify all struct drm_encoder_helper_funcs pointers
They are not to be modified.
--- drivers/gpu/drm/drm_atomic_helper.c | 8 ++++---- drivers/gpu/drm/drm_crtc_helper.c | 8 ++++---- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 4 ++-- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/dac.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/dfp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- drivers/gpu/drm/radeon/radeon_connectors.c | 8 ++++---- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 2 +- 15 files changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -4
@@ -264,7 +264,7 @@ mode_fixup(struct drm_atomic_state *state) }for (i =0 ; i < state->num_connector; i++) { -const struct drm_encoder_helper_funcs *funcs; +const const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder; conn_state = state->connector_states[i];
@@ -571,7 +571,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)int i;for (i =0 ; i < old_state->num_connector; i++) { -const struct drm_encoder_helper_funcs *funcs; +const const struct drm_encoder_helper_funcs *funcs;struct drm_connector_state *old_conn_state;struct drm_connector *connector;struct drm_encoder *encoder;
@@ -732,7 +732,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) }for (i =0 ; i < old_state->num_connector; i++) { -const struct drm_encoder_helper_funcs *funcs; +const const struct drm_encoder_helper_funcs *funcs;struct drm_connector *connector;struct drm_crtc_state *new_crtc_state;struct drm_encoder *encoder;
@@ -838,7 +838,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, }for (i =0 ; i < old_state->num_connector; i++) { -const struct drm_encoder_helper_funcs *funcs; +const const struct drm_encoder_helper_funcs *funcs;struct drm_connector *connector;struct drm_encoder *encoder;
drivers/gpu/drm/drm_crtc_helper.c +4 -4
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(drm_helper_crtc_in_use);static void drm_encoder_disable (struct drm_encoder *encoder) { -struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; +const struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;if (encoder->bridge) encoder->bridge->funcs->disable (encoder->bridge);
@@ -229,7 +229,7 @@ EXPORT_SYMBOL(drm_helper_disable_unused_functions);static void drm_crtc_prepare_encoders (struct drm_device *dev) { -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs;struct drm_encoder *encoder;list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) {
@@ -272,7 +272,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_display_mode *adjusted_mode, saved_mode;struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs;int saved_x, saved_y;bool saved_enabled;struct drm_encoder *encoder;
@@ -732,7 +732,7 @@ static int drm_helper_choose_encoder_dpms(struct drm_encoder *encoder)static void drm_helper_encoder_dpms (struct drm_encoder *encoder,int mode) {struct drm_bridge *bridge = encoder->bridge; -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs;if (bridge) {if (mode ==DRM_MODE_DPMS_ON )
drivers/gpu/drm/gma500/cdv_intel_hdmi.c +1 -1
@@ -195,7 +195,7 @@ static int cdv_hdmi_set_property(struct drm_connector *connector, encoder->crtc->x, encoder->crtc->y, encoder->crtc->primary->fb))return -1 ; }else { -struct drm_encoder_helper_funcs *helpers +const struct drm_encoder_helper_funcs *helpers = encoder->helper_private; helpers->mode_set (encoder, &crtc->saved_mode, &crtc->saved_adjusted_mode);
drivers/gpu/drm/gma500/cdv_intel_lvds.c +1 -1
@@ -505,7 +505,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector,else gma_backlight_set (encoder->dev, value); }else if (!strcmp (property->name,"DPMS" ) && encoder) { -struct drm_encoder_helper_funcs *helpers = +const struct drm_encoder_helper_funcs *helpers = encoder->helper_private; helpers->dpms (encoder, value); }
drivers/gpu/drm/gma500/gma_display.c +2 -2
@@ -656,7 +656,7 @@ void gma_crtc_restore(struct drm_crtc *crtc)void gma_encoder_prepare (struct drm_encoder *encoder) { -struct drm_encoder_helper_funcs *encoder_funcs = +const struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;/* lvds has its own version of prepare see psb_intel_lvds_prepare */ encoder_funcs->dpms (encoder,DRM_MODE_DPMS_OFF );
@@ -664,7 +664,7 @@ void gma_encoder_prepare(struct drm_encoder *encoder)void gma_encoder_commit (struct drm_encoder *encoder) { -struct drm_encoder_helper_funcs *encoder_funcs = +const struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;/* lvds has its own version of commit see psb_intel_lvds_commit */ encoder_funcs->dpms (encoder,DRM_MODE_DPMS_ON );
drivers/gpu/drm/gma500/mdfld_dsi_output.c +1 -1
@@ -290,7 +290,7 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector, encoder->crtc->primary->fb)) goto set_prop_error; }else { -struct drm_encoder_helper_funcs *funcs = +const struct drm_encoder_helper_funcs *funcs = encoder->helper_private; funcs->mode_set(encoder, &gma_crtc->saved_mode,
drivers/gpu/drm/gma500/psb_intel_lvds.c +1 -1
@@ -625,7 +625,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,else gma_backlight_set (encoder->dev, value); }else if (!strcmp (property->name,"DPMS" )) { -struct drm_encoder_helper_funcs *hfuncs +const struct drm_encoder_helper_funcs *hfuncs = encoder->helper_private; hfuncs->dpms (encoder, value); }
drivers/gpu/drm/nouveau/dispnv04/dac.c +3 -3
@@ -358,7 +358,7 @@ static bool nv04_dac_mode_fixup(struct drm_encoder *encoder,static void nv04_dac_prepare (struct drm_encoder *encoder) { -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private;struct drm_device *dev = encoder->dev;int head =nouveau_crtc (encoder->crtc)->index;
@@ -409,7 +409,7 @@ static void nv04_dac_commit(struct drm_encoder *encoder)struct nouveau_encoder *nv_encoder =nouveau_encoder (encoder);struct nouveau_drm *drm =nouveau_drm (encoder->dev);struct nouveau_crtc *nv_crtc =nouveau_crtc (encoder->crtc); -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private; helper->dpms (encoder,DRM_MODE_DPMS_ON );
@@ -526,7 +526,7 @@ static const struct drm_encoder_funcs nv04_dac_funcs = {int nv04_dac_create (struct drm_connector *connector,struct dcb_output *entry) { -const struct drm_encoder_helper_funcs *helper; +const const struct drm_encoder_helper_funcs *helper;struct nouveau_encoder *nv_encoder =NULL ;struct drm_device *dev = connector->dev;struct drm_encoder *encoder;
drivers/gpu/drm/nouveau/dispnv04/dfp.c +3 -3
@@ -244,7 +244,7 @@ static void nv04_dfp_prepare_sel_clk(struct drm_device *dev,static void nv04_dfp_prepare (struct drm_encoder *encoder) {struct nouveau_encoder *nv_encoder =nouveau_encoder (encoder); -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private;struct drm_device *dev = encoder->dev;int head =nouveau_crtc (encoder->crtc)->index;struct nv04_crtc_reg *crtcstate =nv04_display (dev)->mode_reg.crtc_reg;
@@ -445,7 +445,7 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;struct nouveau_drm *drm =nouveau_drm (dev); -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private;struct nouveau_crtc *nv_crtc =nouveau_crtc (encoder->crtc);struct nouveau_encoder *nv_encoder =nouveau_encoder (encoder);struct dcb_output *dcbe = nv_encoder->dcb;
@@ -680,7 +680,7 @@ static const struct drm_encoder_funcs nv04_dfp_funcs = {int nv04_dfp_create (struct drm_connector *connector,struct dcb_output *entry) { -const struct drm_encoder_helper_funcs *helper; +const const struct drm_encoder_helper_funcs *helper;struct nouveau_encoder *nv_encoder =NULL ;struct drm_encoder *encoder;int type;
drivers/gpu/drm/nouveau/dispnv04/disp.c +3 -3
@@ -109,7 +109,7 @@ nv04_display_create(struct drm_device *dev) crtc->funcs->save (crtc);list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) { -struct drm_encoder_helper_funcs *func = encoder->helper_private; +const struct drm_encoder_helper_funcs *func = encoder->helper_private; func->save (encoder); }
@@ -138,7 +138,7 @@ nv04_display_destroy(struct drm_device *dev)/* Restore state */ list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) { -struct drm_encoder_helper_funcs *func = encoder->helper_private; +const struct drm_encoder_helper_funcs *func = encoder->helper_private; func->restore (encoder); }
@@ -169,7 +169,7 @@ nv04_display_init(struct drm_device *dev)* on suspend too. */ list_for_each_entry (encoder, &dev->mode_config.encoder_list, head) { -struct drm_encoder_helper_funcs *func = encoder->helper_private; +const struct drm_encoder_helper_funcs *func = encoder->helper_private; func->restore (encoder); }
drivers/gpu/drm/nouveau/dispnv04/tvnv04.c +2 -2
@@ -122,7 +122,7 @@ static void nv04_tv_prepare(struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;int head =nouveau_crtc (encoder->crtc)->index; -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private; helper->dpms (encoder,DRM_MODE_DPMS_OFF );
@@ -164,7 +164,7 @@ static void nv04_tv_commit(struct drm_encoder *encoder)struct drm_device *dev = encoder->dev;struct nouveau_drm *drm =nouveau_drm (dev);struct nouveau_crtc *nv_crtc =nouveau_crtc (encoder->crtc); -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private; helper->dpms (encoder,DRM_MODE_DPMS_ON );
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +2 -2
@@ -405,7 +405,7 @@ static void nv17_tv_prepare(struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;struct nouveau_drm *drm =nouveau_drm (dev); -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private;struct nv17_tv_norm_params *tv_norm =get_tv_norm (encoder);int head =nouveau_crtc (encoder->crtc)->index; uint8_t *cr_lcd = &nv04_display(dev)->mode_reg.crtc_reg[head].CRTC[
@@ -583,7 +583,7 @@ static void nv17_tv_commit(struct drm_encoder *encoder)struct nouveau_drm *drm =nouveau_drm (dev);struct nouveau_crtc *nv_crtc =nouveau_crtc (encoder->crtc);struct nouveau_encoder *nv_encoder =nouveau_encoder (encoder); -struct drm_encoder_helper_funcs *helper = encoder->helper_private; +const struct drm_encoder_helper_funcs *helper = encoder->helper_private;if (get_tv_norm (encoder)->kind ==TV_ENC_MODE ) {nv17_tv_update_rescaler (encoder);
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
@@ -309,7 +309,7 @@ detect_analog: nv_encoder =find_encoder (connector,DCB_OUTPUT_TV );if (nv_encoder && force) {struct drm_encoder *encoder =to_drm_encoder (nv_encoder); -struct drm_encoder_helper_funcs *helper = +const struct drm_encoder_helper_funcs *helper = encoder->helper_private; if (helper->detect(encoder, connector) ==
drivers/gpu/drm/radeon/radeon_connectors.c +4 -4
@@ -964,7 +964,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force)struct radeon_device *rdev = dev->dev_private;struct radeon_connector *radeon_connector =to_radeon_connector (connector);struct drm_encoder *encoder; -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs;bool dret = false;enum drm_connector_status ret = connector_status_disconnected;int r;
@@ -1094,7 +1094,7 @@ static enum drm_connector_status radeon_tv_detect(struct drm_connector *connector, bool force) {struct drm_encoder *encoder; -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs;struct radeon_connector *radeon_connector =to_radeon_connector (connector);enum drm_connector_status ret = connector_status_disconnected;int r;
@@ -1174,7 +1174,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)struct radeon_device *rdev = dev->dev_private;struct radeon_connector *radeon_connector =to_radeon_connector (connector);struct drm_encoder *encoder =NULL ; -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs;int i, r;enum drm_connector_status ret = connector_status_disconnected;bool dret = false, broken_edid = false;
@@ -1635,7 +1635,7 @@ radeon_dp_detect(struct drm_connector *connector, bool force)if (radeon_ddc_probe (radeon_connector, true))/* try DDC */ ret = connector_status_connected;else if (radeon_connector->dac_load_detect) {/* try load detection */ -struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; +const struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; ret = encoder_funcs->detect (encoder, connector); } }
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +1 -1
@@ -36,7 +36,7 @@static void radeon_legacy_encoder_disable (struct drm_encoder *encoder) {struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder); -struct drm_encoder_helper_funcs *encoder_funcs; +const struct drm_encoder_helper_funcs *encoder_funcs; encoder_funcs = encoder->helper_private; encoder_funcs->dpms (encoder,DRM_MODE_DPMS_OFF );
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/4] drm: constify all struct drm_encoder_helper_funcs pointers
Review
Quoted 2 lines · Jani Nikula
(quoted diff) +1
-1- const struct drm_encoder_helper_funcs *funcs; + const const struct drm_encoder_helper_funcs *funcs;
Obviously too quick cocci all around for double consting, but this was to get feedback anyway. I also missed the helper_private in drm_plane.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/4 drm: constify all struct drm_connector_helper_funcs pointers
In reply to Jani NikulaThey are not to be modified.
--- drivers/gpu/drm/drm_atomic_helper.c | 2 +- drivers/gpu/drm/drm_crtc_helper.c | 2 +- drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/gpu/drm/drm_probe_helper.c | 2 +- drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +- drivers/gpu/drm/radeon/radeon_connectors.c | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +1 -1
@@ -151,7 +151,7 @@ steal_encoder(struct drm_atomic_state *state,static int update_connector_routing (struct drm_atomic_state *state,int conn_idx) { -const struct drm_connector_helper_funcs *funcs; +const const struct drm_connector_helper_funcs *funcs;struct drm_encoder *new_encoder;struct drm_crtc *encoder_crtc;struct drm_connector *connector;
drivers/gpu/drm/drm_crtc_helper.c +1 -1
@@ -572,7 +572,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)/* a) traverse passed in connector list and get encoders for them */ count =0 ;list_for_each_entry (connector, &dev->mode_config.connector_list, head) { -struct drm_connector_helper_funcs *connector_funcs = +const struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; new_encoder = connector->encoder;for (ro =0 ; ro < set->num_connectors; ro++) {
drivers/gpu/drm/drm_fb_helper.c +1 -1
@@ -1529,7 +1529,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,int c, o;struct drm_device *dev = fb_helper->dev;struct drm_connector *connector; -struct drm_connector_helper_funcs *connector_funcs; +const struct drm_connector_helper_funcs *connector_funcs;struct drm_encoder *encoder;int my_score, best_score, score;struct drm_fb_helper_crtc **crtcs, *crtc;
drivers/gpu/drm/drm_probe_helper.c +1 -1
@@ -98,7 +98,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect {struct drm_device *dev = connector->dev;struct drm_display_mode *mode; -struct drm_connector_helper_funcs *connector_funcs = +const struct drm_connector_helper_funcs *connector_funcs = connector->helper_private;int count =0 ;int mode_flags =0 ;
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
@@ -592,7 +592,7 @@ nouveau_connector_set_property(struct drm_connector *connector,static struct drm_display_mode *nouveau_connector_native_mode (struct drm_connector *connector) { -struct drm_connector_helper_funcs *helper = connector->helper_private; +const struct drm_connector_helper_funcs *helper = connector->helper_private;struct nouveau_drm *drm =nouveau_drm (connector->dev);struct nouveau_connector *nv_connector =nouveau_connector (connector);struct drm_device *dev = connector->dev;
drivers/gpu/drm/radeon/radeon_connectors.c +4 -4
@@ -135,7 +135,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)if (connector->display_info.bpc) bpc = connector->display_info.bpc;else if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) { -struct drm_connector_helper_funcs *connector_funcs = +const struct drm_connector_helper_funcs *connector_funcs = connector->helper_private;struct drm_encoder *encoder = connector_funcs->best_encoder (connector);struct radeon_encoder *radeon_encoder =to_radeon_encoder (encoder);
@@ -225,7 +225,7 @@ radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_cstruct radeon_device *rdev = dev->dev_private;struct drm_encoder *best_encoder =NULL ;struct drm_encoder *encoder =NULL ; -struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; +const struct drm_connector_helper_funcs *connector_funcs = connector->helper_private;bool connected;int i;
@@ -702,7 +702,7 @@ static int radeon_connector_set_property(struct drm_connector *connector, structif (connector->encoder) radeon_encoder =to_radeon_encoder (connector->encoder);else { -struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; +const struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; radeon_encoder =to_radeon_encoder (connector_funcs->best_encoder (connector)); }
@@ -896,7 +896,7 @@ static int radeon_lvds_set_property(struct drm_connector *connector,if (connector->encoder) radeon_encoder =to_radeon_encoder (connector->encoder);else { -struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; +const struct drm_connector_helper_funcs *connector_funcs = connector->helper_private; radeon_encoder =to_radeon_encoder (connector_funcs->best_encoder (connector)); }
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/4 drm: constify all struct drm_crtc_helper_funcs pointers
In reply to Jani NikulaThey are not to be modified.
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++-- drivers/gpu/drm/drm_atomic_helper.c | 14 +++++++------- drivers/gpu/drm/drm_crtc_helper.c | 14 +++++++------- drivers/gpu/drm/drm_fb_helper.c | 6 +++--- drivers/gpu/drm/drm_plane_helper.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 6 +++--- drivers/gpu/drm/gma500/mdfld_intel_display.c | 2 +- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +- drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++-- drivers/gpu/drm/qxl/qxl_drv.c | 2 +- 15 files changed, 33 insertions(+), 33 deletions(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +2 -2
@@ -570,7 +570,7 @@ static int atmel_hlcdc_dc_drm_suspend(struct device *dev)drm_modeset_lock_all (drm_dev);list_for_each_entry (crtc, &drm_dev->mode_config.crtc_list, head) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;if (crtc->enabled) { crtc_funcs->disable (crtc);/* save enable state for resume */
@@ -591,7 +591,7 @@ static int atmel_hlcdc_dc_drm_resume(struct device *dev)drm_modeset_lock_all (drm_dev);list_for_each_entry (crtc, &drm_dev->mode_config.crtc_list, head) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;if (crtc->enabled) { crtc->enabled = false; crtc_funcs->enable (crtc);
drivers/gpu/drm/drm_atomic_helper.c +7 -7
@@ -317,7 +317,7 @@ mode_fixup(struct drm_atomic_state *state) }for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc; crtc_state = state->crtc_states[i];
@@ -504,7 +504,7 @@ drm_atomic_helper_check_planes(struct drm_device *dev, }for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc = state->crtcs[i];if (!crtc)
@@ -623,7 +623,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) }for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;
@@ -713,7 +713,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)int i;for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc; crtc = old_state->crtcs[i];
@@ -812,7 +812,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,int i;for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc; crtc = old_state->crtcs[i];
@@ -1179,7 +1179,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,int i;for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc = old_state->crtcs[i];if (!crtc)
@@ -1219,7 +1219,7 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, }for (i =0 ; i < ncrtcs; i++) { -const struct drm_crtc_helper_funcs *funcs; +const const struct drm_crtc_helper_funcs *funcs;struct drm_crtc *crtc = old_state->crtcs[i];if (!crtc)
drivers/gpu/drm/drm_crtc_helper.c +7 -7
@@ -191,7 +191,7 @@ static void __drm_helper_disable_unused_functions(struct drm_device *dev) }list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc->enabled =drm_helper_crtc_in_use (crtc);if (!crtc->enabled) {if (crtc_funcs->disable)
@@ -271,7 +271,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, {struct drm_device *dev = crtc->dev;struct drm_display_mode *adjusted_mode, saved_mode; -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;const struct drm_encoder_helper_funcs *encoder_funcs;int saved_x, saved_y;bool saved_enabled;
@@ -472,7 +472,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)bool fb_changed = false;/* if true and !mode_changed just do a flip */ struct drm_connector *save_connectors, *connector;int count =0 , ro, fail =0 ; -struct drm_crtc_helper_funcs *crtc_funcs; +const struct drm_crtc_helper_funcs *crtc_funcs;struct drm_mode_set save_set;int ret;int i;
@@ -794,7 +794,7 @@ void drm_helper_connector_dpms(struct drm_connector *connector, int mode)/* from off to on, do crtc then encoder */ if (mode < old_dpms) {if (crtc) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;if (crtc_funcs->dpms) (*crtc_funcs->dpms) (crtc,drm_helper_choose_crtc_dpms (crtc));
@@ -808,7 +808,7 @@ void drm_helper_connector_dpms(struct drm_connector *connector, int mode)if (encoder)drm_helper_encoder_dpms (encoder, encoder_dpms);if (crtc) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;if (crtc_funcs->dpms) (*crtc_funcs->dpms) (crtc,drm_helper_choose_crtc_dpms (crtc));
@@ -870,7 +870,7 @@ void drm_helper_resume_force_mode(struct drm_device *dev) {struct drm_crtc *crtc;struct drm_encoder *encoder; -struct drm_crtc_helper_funcs *crtc_funcs; +const struct drm_crtc_helper_funcs *crtc_funcs;int encoder_dpms;bool ret;
@@ -935,7 +935,7 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mod struct drm_framebuffer *old_fb) {struct drm_crtc_state *crtc_state; -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;int ret;if (crtc->funcs->atomic_duplicate_state)
drivers/gpu/drm/drm_fb_helper.c +3 -3
@@ -238,7 +238,7 @@ static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)int drm_fb_helper_debug_enter (struct fb_info *info) {struct drm_fb_helper *helper = info->par; -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;int i;list_for_each_entry (helper, &kernel_fb_helper_list, kernel_fb_list) {
@@ -285,7 +285,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info) {struct drm_fb_helper *helper = info->par;struct drm_crtc *crtc; -struct drm_crtc_helper_funcs *funcs; +const struct drm_crtc_helper_funcs *funcs;struct drm_framebuffer *fb;int i;
@@ -765,7 +765,7 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) {struct drm_fb_helper *fb_helper = info->par;struct drm_device *dev = fb_helper->dev; -struct drm_crtc_helper_funcs *crtc_funcs; +const struct drm_crtc_helper_funcs *crtc_funcs;u16 *red, *green, *blue, *transp;struct drm_crtc *crtc;int i, j, rc =0 ;
drivers/gpu/drm/drm_plane_helper.c +1 -1
@@ -402,7 +402,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, {struct drm_plane_helper_funcs *plane_funcs;struct drm_crtc *crtc[2 ]; -struct drm_crtc_helper_funcs *crtc_funcs[2 ]; +const struct drm_crtc_helper_funcs *crtc_funcs[2 ];int i, ret =0 ; plane_funcs = plane->helper_private;
drivers/gpu/drm/exynos/exynos_hdmi.c +1 -1
@@ -2101,7 +2101,7 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)struct hdmi_context *hdata =display_to_hdmi (display);struct drm_encoder *encoder = hdata->encoder;struct drm_crtc *crtc = encoder->crtc; -struct drm_crtc_helper_funcs *funcs =NULL ; +const struct drm_crtc_helper_funcs *funcs =NULL ;DRM_DEBUG_KMS ("mode %d\n" , mode);
drivers/gpu/drm/gma500/cdv_intel_display.c +1 -1
@@ -823,7 +823,7 @@ static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc,/* Flush the plane changes */ { -struct drm_crtc_helper_funcs *crtc_funcs = +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->mode_set_base (crtc, x, y, old_fb); }
drivers/gpu/drm/gma500/gma_display.c +3 -3
@@ -501,20 +501,20 @@ bool gma_crtc_mode_fixup(struct drm_crtc *crtc,void gma_crtc_prepare (struct drm_crtc *crtc) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->dpms (crtc,DRM_MODE_DPMS_OFF ); }void gma_crtc_commit (struct drm_crtc *crtc) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->dpms (crtc,DRM_MODE_DPMS_ON ); }void gma_crtc_disable (struct drm_crtc *crtc) {struct gtt_range *gt; -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->dpms (crtc,DRM_MODE_DPMS_OFF );
drivers/gpu/drm/gma500/mdfld_intel_display.c +1 -1
@@ -849,7 +849,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,/* Flush the plane changes */ { -struct drm_crtc_helper_funcs *crtc_funcs = +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->mode_set_base (crtc, x, y, old_fb); }
drivers/gpu/drm/gma500/oaktrail_crtc.c +1 -1
@@ -483,7 +483,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,/* Flush the plane changes */ { -struct drm_crtc_helper_funcs *crtc_funcs = +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->mode_set_base (crtc, x, y, old_fb); }
drivers/gpu/drm/gma500/oaktrail_hdmi.c +1 -1
@@ -347,7 +347,7 @@ int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,/* Flush the plane changes */ { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; crtc_funcs->mode_set_base (crtc, x, y, old_fb); }
drivers/gpu/drm/gma500/psb_intel_display.c +1 -1
@@ -108,7 +108,7 @@ static int psb_intel_crtc_mode_set(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_psb_private *dev_priv = dev->dev_private;struct gma_crtc *gma_crtc =to_gma_crtc (crtc); -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;int pipe = gma_crtc->pipe;const struct psb_offset *map = &dev_priv->regmap[pipe];int refclk;
drivers/gpu/drm/mgag200/mgag200_mode.c +1 -1
@@ -1222,7 +1222,7 @@ static void mga_crtc_commit(struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;struct mga_device *mdev = dev->dev_private; -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;u8 tmp;if (mdev->type ==G200_WB )
drivers/gpu/drm/nouveau/dispnv04/crtc.c +2 -2
@@ -703,7 +703,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc)struct drm_device *dev = crtc->dev;struct nouveau_drm *drm =nouveau_drm (dev);struct nouveau_crtc *nv_crtc =nouveau_crtc (crtc); -struct drm_crtc_helper_funcs *funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *funcs = crtc->helper_private;if (nv_two_heads (dev))NVSetOwner (dev, nv_crtc->index);
@@ -724,7 +724,7 @@ static void nv_crtc_prepare(struct drm_crtc *crtc)static void nv_crtc_commit (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; -struct drm_crtc_helper_funcs *funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *funcs = crtc->helper_private;struct nouveau_crtc *nv_crtc =nouveau_crtc (crtc);nouveau_hw_load_state (dev, nv_crtc->index, &nv04_display (dev)->mode_reg);
drivers/gpu/drm/qxl/qxl_drv.c +1 -1
@@ -102,7 +102,7 @@ static int qxl_drm_freeze(struct drm_device *dev)/* unpin the front buffers */ list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { -struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; +const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;if (crtc->enabled) (*crtc_funcs->disable)(crtc); }
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/4 drm: make encoder/connector/crtc helper_private a const pointer
In reply to Jani NikulaThey're only used to store const pointers anyway. This helps to keep Ville and the compiler happy.
--- include/drm/drm_crtc.h | 6 +++--- include/drm/drm_crtc_helper.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
include/drm/drm_crtc.h +3 -3
@@ -467,7 +467,7 @@ struct drm_crtc {int framedur_ns, linedur_ns, pixeldur_ns;/* if you are using the helper */ -void *helper_private; +const void *helper_private;struct drm_object_properties properties;
@@ -597,7 +597,7 @@ struct drm_encoder {struct drm_crtc *crtc;struct drm_bridge *bridge;const struct drm_encoder_funcs *funcs; -void *helper_private; +const void *helper_private; };/* should we poll this connector for connects and disconnects */
@@ -701,7 +701,7 @@ struct drm_connector {/* requested DPMS state */ int dpms; -void *helper_private; +const void *helper_private;/* forced on connector */ struct drm_cmdline_mode cmdline_mode;
include/drm/drm_crtc_helper.h +3 -3
@@ -197,19 +197,19 @@ extern void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,static inline void drm_crtc_helper_add (struct drm_crtc *crtc,const struct drm_crtc_helper_funcs *funcs) { - crtc->helper_private = (void *)funcs; + crtc->helper_private = funcs; }static inline void drm_encoder_helper_add (struct drm_encoder *encoder,const struct drm_encoder_helper_funcs *funcs) { - encoder->helper_private = (void *)funcs; + encoder->helper_private = funcs; }static inline void drm_connector_helper_add (struct drm_connector *connector,const struct drm_connector_helper_funcs *funcs) { - connector->helper_private = (void *)funcs; + connector->helper_private = funcs; }extern void drm_helper_resume_force_mode (struct drm_device *dev);
Signature · 6 lines
2.1.4 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 0/4] drm: constify all helper_private/func pointers
In reply to Jani NikulaQuoted 5 lines · Jani Nikula
Quoted 2 lines · On Tue, 10 Mar 2015, [email protected] wrote:
Make the helper function pointer structs const to make it clear they should not be modified.
So why not fix this once and for all? See the following patches.
Why not indeed. I was being lazy and only hit the ones that caught my eye while crawling through the atomic helper stuff.
Quoted 47 lines
This was quick cocci, can be split by driver too if so desired.
BR,
Jani.Jani Nikula (4):
drm: constify all structdrm_encoder_helper_funcspointers
drm: constify all structdrm_connector_helper_funcspointers
drm: constify all structdrm_crtc_helper_funcspointers
drm: make encoder/connector/crtchelper_privatea const pointerdrivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++-- drivers/gpu/drm/drm_atomic_helper.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_fb_helper.c | 8 ++++---- drivers/gpu/drm/drm_plane_helper.c | 2 +- drivers/gpu/drm/drm_probe_helper.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 10 +++++----- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 2 +- drivers/gpu/drm/gma500/mdfld_intel_display.c | 2 +- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +- drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/dac.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/dfp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++-- drivers/gpu/drm/qxl/qxl_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_connectors.c | 16 ++++++++-------- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 2 +- include/drm/drm_crtc.h | 6 +++--- include/drm/drm_crtc_helper.h | 6 +++--- 30 files changed, 81 insertions(+), 81 deletions(-)Signature · 1 line
2.1.4
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 0/4] drm: constify all helper_private/func pointers
Quoted 9 lines · Ville Syrjälä
Quoted 5 lines · Jani Nikula
Quoted 2 lines · On Tue, 10 Mar 2015, [email protected] wrote:
Make the helper function pointer structs const to make it clear they should not be modified.
So why not fix this once and for all? See the following patches.
Why not indeed. I was being lazy and only hit the ones that caught my eye while crawling through the atomic helper stuff.
Well I pulled in your patch to drm-misc. Sounds like Jani still needs to fine-tune his cocci.
-Daniel
Quoted 56 lines
Quoted 48 lines
This was quick cocci, can be split by driver too if so desired.
BR,
Jani.Jani Nikula (4):
drm: constify all structdrm_encoder_helper_funcspointers
drm: constify all structdrm_connector_helper_funcspointers
drm: constify all structdrm_crtc_helper_funcspointers
drm: make encoder/connector/crtchelper_privatea const pointerdrivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++-- drivers/gpu/drm/drm_atomic_helper.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_crtc_helper.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_fb_helper.c | 8 ++++---- drivers/gpu/drm/drm_plane_helper.c | 2 +- drivers/gpu/drm/drm_probe_helper.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_display.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 2 +- drivers/gpu/drm/gma500/cdv_intel_lvds.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 10 +++++----- drivers/gpu/drm/gma500/mdfld_dsi_output.c | 2 +- drivers/gpu/drm/gma500/mdfld_intel_display.c | 2 +- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 +- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +- drivers/gpu/drm/gma500/psb_intel_display.c | 2 +- drivers/gpu/drm/gma500/psb_intel_lvds.c | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/dac.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/dfp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/disp.c | 6 +++--- drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | 4 ++-- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 ++-- drivers/gpu/drm/nouveau/nouveau_connector.c | 4 ++-- drivers/gpu/drm/qxl/qxl_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_connectors.c | 16 ++++++++-------- drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 2 +- include/drm/drm_crtc.h | 6 +++--- include/drm/drm_crtc_helper.h | 6 +++--- 30 files changed, 81 insertions(+), 81 deletions(-)Signature · 1 line
2.1.4Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel