diff options
Diffstat (limited to 'drivers/gpu/drm/tilcdc/tilcdc_tfp410.c')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c index c38b56b268ac..354c47ca6374 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | |||
@@ -167,6 +167,7 @@ struct tfp410_connector { | |||
167 | static void tfp410_connector_destroy(struct drm_connector *connector) | 167 | static void tfp410_connector_destroy(struct drm_connector *connector) |
168 | { | 168 | { |
169 | struct tfp410_connector *tfp410_connector = to_tfp410_connector(connector); | 169 | struct tfp410_connector *tfp410_connector = to_tfp410_connector(connector); |
170 | drm_connector_unregister(connector); | ||
170 | drm_connector_cleanup(connector); | 171 | drm_connector_cleanup(connector); |
171 | kfree(tfp410_connector); | 172 | kfree(tfp410_connector); |
172 | } | 173 | } |
@@ -261,7 +262,7 @@ static struct drm_connector *tfp410_connector_create(struct drm_device *dev, | |||
261 | if (ret) | 262 | if (ret) |
262 | goto fail; | 263 | goto fail; |
263 | 264 | ||
264 | drm_sysfs_connector_add(connector); | 265 | drm_connector_register(connector); |
265 | 266 | ||
266 | return connector; | 267 | return connector; |
267 | 268 | ||
@@ -295,23 +296,8 @@ static int tfp410_modeset_init(struct tilcdc_module *mod, struct drm_device *dev | |||
295 | return 0; | 296 | return 0; |
296 | } | 297 | } |
297 | 298 | ||
298 | static void tfp410_destroy(struct tilcdc_module *mod) | ||
299 | { | ||
300 | struct tfp410_module *tfp410_mod = to_tfp410_module(mod); | ||
301 | |||
302 | if (tfp410_mod->i2c) | ||
303 | i2c_put_adapter(tfp410_mod->i2c); | ||
304 | |||
305 | if (!IS_ERR_VALUE(tfp410_mod->gpio)) | ||
306 | gpio_free(tfp410_mod->gpio); | ||
307 | |||
308 | tilcdc_module_cleanup(mod); | ||
309 | kfree(tfp410_mod); | ||
310 | } | ||
311 | |||
312 | static const struct tilcdc_module_ops tfp410_module_ops = { | 299 | static const struct tilcdc_module_ops tfp410_module_ops = { |
313 | .modeset_init = tfp410_modeset_init, | 300 | .modeset_init = tfp410_modeset_init, |
314 | .destroy = tfp410_destroy, | ||
315 | }; | 301 | }; |
316 | 302 | ||
317 | /* | 303 | /* |
@@ -341,6 +327,7 @@ static int tfp410_probe(struct platform_device *pdev) | |||
341 | return -ENOMEM; | 327 | return -ENOMEM; |
342 | 328 | ||
343 | mod = &tfp410_mod->base; | 329 | mod = &tfp410_mod->base; |
330 | pdev->dev.platform_data = mod; | ||
344 | 331 | ||
345 | tilcdc_module_init(mod, "tfp410", &tfp410_module_ops); | 332 | tilcdc_module_init(mod, "tfp410", &tfp410_module_ops); |
346 | 333 | ||
@@ -364,6 +351,7 @@ static int tfp410_probe(struct platform_device *pdev) | |||
364 | tfp410_mod->i2c = of_find_i2c_adapter_by_node(i2c_node); | 351 | tfp410_mod->i2c = of_find_i2c_adapter_by_node(i2c_node); |
365 | if (!tfp410_mod->i2c) { | 352 | if (!tfp410_mod->i2c) { |
366 | dev_err(&pdev->dev, "could not get i2c\n"); | 353 | dev_err(&pdev->dev, "could not get i2c\n"); |
354 | of_node_put(i2c_node); | ||
367 | goto fail; | 355 | goto fail; |
368 | } | 356 | } |
369 | 357 | ||
@@ -377,19 +365,32 @@ static int tfp410_probe(struct platform_device *pdev) | |||
377 | ret = gpio_request(tfp410_mod->gpio, "DVI_PDn"); | 365 | ret = gpio_request(tfp410_mod->gpio, "DVI_PDn"); |
378 | if (ret) { | 366 | if (ret) { |
379 | dev_err(&pdev->dev, "could not get DVI_PDn gpio\n"); | 367 | dev_err(&pdev->dev, "could not get DVI_PDn gpio\n"); |
380 | goto fail; | 368 | goto fail_adapter; |
381 | } | 369 | } |
382 | } | 370 | } |
383 | 371 | ||
384 | return 0; | 372 | return 0; |
385 | 373 | ||
374 | fail_adapter: | ||
375 | i2c_put_adapter(tfp410_mod->i2c); | ||
376 | |||
386 | fail: | 377 | fail: |
387 | tfp410_destroy(mod); | 378 | kfree(tfp410_mod); |
379 | tilcdc_module_cleanup(mod); | ||
388 | return ret; | 380 | return ret; |
389 | } | 381 | } |
390 | 382 | ||
391 | static int tfp410_remove(struct platform_device *pdev) | 383 | static int tfp410_remove(struct platform_device *pdev) |
392 | { | 384 | { |
385 | struct tilcdc_module *mod = dev_get_platdata(&pdev->dev); | ||
386 | struct tfp410_module *tfp410_mod = to_tfp410_module(mod); | ||
387 | |||
388 | i2c_put_adapter(tfp410_mod->i2c); | ||
389 | gpio_free(tfp410_mod->gpio); | ||
390 | |||
391 | tilcdc_module_cleanup(mod); | ||
392 | kfree(tfp410_mod); | ||
393 | |||
393 | return 0; | 394 | return 0; |
394 | } | 395 | } |
395 | 396 | ||