Skip to content

Commit a7d3943

Browse files
committed
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
1 parent df2ce45 commit a7d3943

4 files changed

Lines changed: 4 additions & 55 deletions

File tree

drivers/gpu/drm/drm_drv.c

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -573,43 +573,9 @@ static void drm_dev_init_release(struct drm_device *dev, void *res)
573573
drm_legacy_destroy_members(dev);
574574
}
575575

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)
613579
{
614580
int ret;
615581

@@ -689,7 +655,6 @@ int drm_dev_init(struct drm_device *dev,
689655

690656
return ret;
691657
}
692-
EXPORT_SYMBOL(drm_dev_init);
693658

694659
static void devm_drm_dev_init_release(void *data)
695660
{

drivers/gpu/drm/drm_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void drm_minor_release(struct drm_minor *minor);
9595

9696
/* drm_managed.c */
9797
void drm_managed_release(struct drm_device *dev);
98+
void drmm_add_final_kfree(struct drm_device *dev, void *container);
9899

99100
/* drm_vblank.c */
100101
static inline bool drm_vblank_passed(u64 seq, u64 ref)

drivers/gpu/drm/drm_managed.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,26 +125,13 @@ static void add_dr(struct drm_device *dev, struct drmres *dr)
125125
dr, dr->node.name, (unsigned long) dr->node.size);
126126
}
127127

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-
*/
140128
void drmm_add_final_kfree(struct drm_device *dev, void *container)
141129
{
142130
WARN_ON(dev->managed.final_kfree);
143131
WARN_ON(dev < (struct drm_device *) container);
144132
WARN_ON(dev + 1 > (struct drm_device *) (container + ksize(container)));
145133
dev->managed.final_kfree = container;
146134
}
147-
EXPORT_SYMBOL(drmm_add_final_kfree);
148135

149136
int __drmm_add_action(struct drm_device *dev,
150137
drmres_release_t action,

include/drm/drm_drv.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,6 @@ struct drm_driver {
588588
int dev_priv_size;
589589
};
590590

591-
int drm_dev_init(struct drm_device *dev,
592-
struct drm_driver *driver,
593-
struct device *parent);
594-
595591
void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver *driver,
596592
size_t size, size_t offset);
597593

0 commit comments

Comments
 (0)