Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau: use i2c encoder helper wrappers

Signed-off-by: Rob Clark <robdclark@gmail.com>

Rob Clark b3d3de80 a7c47d6d

+13 -26
+13 -26
drivers/gpu/drm/nouveau/nv04_tv.c
··· 184 184 .destroy = nv04_tv_destroy, 185 185 }; 186 186 187 + static const struct drm_encoder_helper_funcs nv04_tv_helper_funcs = { 188 + .dpms = nv04_tv_dpms, 189 + .save = drm_i2c_encoder_save, 190 + .restore = drm_i2c_encoder_restore, 191 + .mode_fixup = drm_i2c_encoder_mode_fixup, 192 + .prepare = nv04_tv_prepare, 193 + .commit = nv04_tv_commit, 194 + .mode_set = nv04_tv_mode_set, 195 + .detect = drm_i2c_encoder_detect, 196 + }; 197 + 187 198 int 188 199 nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) 189 200 { 190 201 struct nouveau_encoder *nv_encoder; 191 202 struct drm_encoder *encoder; 192 203 struct drm_device *dev = connector->dev; 193 - struct drm_encoder_helper_funcs *hfuncs; 194 - struct drm_encoder_slave_funcs *sfuncs; 195 204 struct nouveau_drm *drm = nouveau_drm(dev); 196 205 struct nouveau_i2c *i2c = nouveau_i2c(drm->device); 197 206 struct nouveau_i2c_port *port = i2c->find(i2c, entry->i2c_index); ··· 216 207 if (!nv_encoder) 217 208 return -ENOMEM; 218 209 219 - hfuncs = kzalloc(sizeof(*hfuncs), GFP_KERNEL); 220 - if (!hfuncs) { 221 - ret = -ENOMEM; 222 - goto fail_free; 223 - } 224 - 225 210 /* Initialize the common members */ 226 211 encoder = to_drm_encoder(nv_encoder); 227 212 228 213 drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC); 229 - drm_encoder_helper_add(encoder, hfuncs); 214 + drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs); 230 215 231 216 encoder->possible_crtcs = entry->heads; 232 217 encoder->possible_clones = 0; ··· 233 230 if (ret < 0) 234 231 goto fail_cleanup; 235 232 236 - /* Fill the function pointers */ 237 - sfuncs = get_slave_funcs(encoder); 238 - 239 - *hfuncs = (struct drm_encoder_helper_funcs) { 240 - .dpms = nv04_tv_dpms, 241 - .save = sfuncs->save, 242 - .restore = sfuncs->restore, 243 - .mode_fixup = sfuncs->mode_fixup, 244 - .prepare = nv04_tv_prepare, 245 - .commit = nv04_tv_commit, 246 - .mode_set = nv04_tv_mode_set, 247 - .detect = sfuncs->detect, 248 - }; 249 - 250 233 /* Attach it to the specified connector. */ 251 - sfuncs->create_resources(encoder, connector); 234 + get_slave_funcs(encoder)->create_resources(encoder, connector); 252 235 drm_mode_connector_attach_encoder(connector, encoder); 253 236 254 237 return 0; 255 238 256 239 fail_cleanup: 257 240 drm_encoder_cleanup(encoder); 258 - kfree(hfuncs); 259 - fail_free: 260 241 kfree(nv_encoder); 261 242 return ret; 262 243 }