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

Configure Feed

Select the types of activity you want to include in your feed.

drm/atmel-hlcdc: use drmm_crtc_alloc_with_planes()

Use drmm_crtc_alloc_with_planes() to simplify the code. As we no longer
have to take care about cleanup, we can get rid of
atmel_hlcdc_crtc_destroy().

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Link: https://patch.msgid.link/20251218-lcd_cleanup_mainline-v2-6-df837aba878f@microchip.com
Signed-off-by: Manikandan Muralidharan <manikandan.m@microchip.com>

authored by

Ludovic Desroches and committed by
Manikandan Muralidharan
d8a29980 a1018063

+6 -26
+6 -26
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
··· 509 509 .atomic_disable = atmel_hlcdc_crtc_atomic_disable, 510 510 }; 511 511 512 - static void atmel_hlcdc_crtc_destroy(struct drm_crtc *c) 513 - { 514 - struct atmel_hlcdc_crtc *crtc = drm_crtc_to_atmel_hlcdc_crtc(c); 515 - 516 - drm_crtc_cleanup(c); 517 - kfree(crtc); 518 - } 519 - 520 512 static void atmel_hlcdc_crtc_finish_page_flip(struct atmel_hlcdc_crtc *crtc) 521 513 { 522 514 struct drm_device *dev = crtc->base.dev; ··· 599 607 static const struct drm_crtc_funcs atmel_hlcdc_crtc_funcs = { 600 608 .page_flip = drm_atomic_helper_page_flip, 601 609 .set_config = drm_atomic_helper_set_config, 602 - .destroy = atmel_hlcdc_crtc_destroy, 603 610 .reset = atmel_hlcdc_crtc_reset, 604 611 .atomic_duplicate_state = atmel_hlcdc_crtc_duplicate_state, 605 612 .atomic_destroy_state = atmel_hlcdc_crtc_destroy_state, ··· 611 620 struct atmel_hlcdc_plane *primary = NULL, *cursor = NULL; 612 621 struct atmel_hlcdc_dc *dc = dev->dev_private; 613 622 struct atmel_hlcdc_crtc *crtc; 614 - int ret; 615 623 int i; 616 - 617 - crtc = kzalloc(sizeof(*crtc), GFP_KERNEL); 618 - if (!crtc) 619 - return -ENOMEM; 620 - 621 - crtc->dc = dc; 622 624 623 625 for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) { 624 626 if (!dc->layers[i]) ··· 630 646 break; 631 647 } 632 648 } 649 + crtc = drmm_crtc_alloc_with_planes(dev, struct atmel_hlcdc_crtc, base, 650 + &primary->base, &cursor->base, &atmel_hlcdc_crtc_funcs, 651 + NULL); 652 + if (IS_ERR(crtc)) 653 + return PTR_ERR(crtc); 633 654 634 - ret = drm_crtc_init_with_planes(dev, &crtc->base, &primary->base, 635 - &cursor->base, &atmel_hlcdc_crtc_funcs, 636 - NULL); 637 - if (ret < 0) 638 - goto fail; 639 - 655 + crtc->dc = dc; 640 656 crtc->id = drm_crtc_index(&crtc->base); 641 657 642 658 for (i = 0; i < ATMEL_HLCDC_MAX_LAYERS; i++) { ··· 658 674 dc->crtc = &crtc->base; 659 675 660 676 return 0; 661 - 662 - fail: 663 - atmel_hlcdc_crtc_destroy(&crtc->base); 664 - return ret; 665 677 }