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

drm/dev: Remove drm_dev_init

We can now also delete drm_dev_init, now that vkms, vgem and i915
selftests are resolved.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200918132505.2316382-5-daniel.vetter@ffwll.ch

+4 -55
+3 -38
drivers/gpu/drm/drm_drv.c
··· 573 573 drm_legacy_destroy_members(dev); 574 574 } 575 575 576 - /** 577 - * drm_dev_init - Initialise new DRM device 578 - * @dev: DRM device 579 - * @driver: DRM driver 580 - * @parent: Parent device object 581 - * 582 - * Initialize a new DRM device. No device registration is done. 583 - * Call drm_dev_register() to advertice the device to user space and register it 584 - * with other core subsystems. This should be done last in the device 585 - * initialization sequence to make sure userspace can't access an inconsistent 586 - * state. 587 - * 588 - * The initial ref-count of the object is 1. Use drm_dev_get() and 589 - * drm_dev_put() to take and drop further ref-counts. 590 - * 591 - * It is recommended that drivers embed &struct drm_device into their own device 592 - * structure. 593 - * 594 - * Drivers that do not want to allocate their own device struct 595 - * embedding &struct drm_device can call drm_dev_alloc() instead. For drivers 596 - * that do embed &struct drm_device it must be placed first in the overall 597 - * structure, and the overall structure must be allocated using kmalloc(): The 598 - * drm core's release function unconditionally calls kfree() on the @dev pointer 599 - * when the final reference is released. To override this behaviour, and so 600 - * allow embedding of the drm_device inside the driver's device struct at an 601 - * arbitrary offset, you must supply a &drm_driver.release callback and control 602 - * the finalization explicitly. 603 - * 604 - * Note that drivers must call drmm_add_final_kfree() after this function has 605 - * completed successfully. 606 - * 607 - * RETURNS: 608 - * 0 on success, or error code on failure. 609 - */ 610 - int drm_dev_init(struct drm_device *dev, 611 - struct drm_driver *driver, 612 - struct device *parent) 576 + static int drm_dev_init(struct drm_device *dev, 577 + struct drm_driver *driver, 578 + struct device *parent) 613 579 { 614 580 int ret; 615 581 ··· 655 689 656 690 return ret; 657 691 } 658 - EXPORT_SYMBOL(drm_dev_init); 659 692 660 693 static void devm_drm_dev_init_release(void *data) 661 694 {
+1
drivers/gpu/drm/drm_internal.h
··· 95 95 96 96 /* drm_managed.c */ 97 97 void drm_managed_release(struct drm_device *dev); 98 + void drmm_add_final_kfree(struct drm_device *dev, void *container); 98 99 99 100 /* drm_vblank.c */ 100 101 static inline bool drm_vblank_passed(u64 seq, u64 ref)
-13
drivers/gpu/drm/drm_managed.c
··· 125 125 dr, dr->node.name, (unsigned long) dr->node.size); 126 126 } 127 127 128 - /** 129 - * drmm_add_final_kfree - add release action for the final kfree() 130 - * @dev: DRM device 131 - * @container: pointer to the kmalloc allocation containing @dev 132 - * 133 - * Since the allocation containing the struct &drm_device must be allocated 134 - * before it can be initialized with drm_dev_init() there's no way to allocate 135 - * that memory with drmm_kmalloc(). To side-step this chicken-egg problem the 136 - * pointer for this final kfree() must be specified by calling this function. It 137 - * will be released in the final drm_dev_put() for @dev, after all other release 138 - * actions installed through drmm_add_action() have been processed. 139 - */ 140 128 void drmm_add_final_kfree(struct drm_device *dev, void *container) 141 129 { 142 130 WARN_ON(dev->managed.final_kfree); ··· 132 144 WARN_ON(dev + 1 > (struct drm_device *) (container + ksize(container))); 133 145 dev->managed.final_kfree = container; 134 146 } 135 - EXPORT_SYMBOL(drmm_add_final_kfree); 136 147 137 148 int __drmm_add_action(struct drm_device *dev, 138 149 drmres_release_t action,
-4
include/drm/drm_drv.h
··· 588 588 int dev_priv_size; 589 589 }; 590 590 591 - int drm_dev_init(struct drm_device *dev, 592 - struct drm_driver *driver, 593 - struct device *parent); 594 - 595 591 void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver *driver, 596 592 size_t size, size_t offset); 597 593