mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
UPSTREAM: drm/rockchip: Drop drm_driver.load/unload callbacks
They are deprecated and by moving their implementations to bind/unbind
we can call drm_connector_register_all instead of open-coding it.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465557253-10670-1-git-send-email-tomeu.vizoso@collabora.com
(cherry picked from commit f706974a69)
Change-Id: I9e97e25f1bf84609ba1dd7040478dee0686e665b
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
This commit is contained in:
@@ -50,6 +50,7 @@ static bool is_support_iommu = true;
|
||||
|
||||
static LIST_HEAD(rockchip_drm_subdrv_list);
|
||||
static DEFINE_MUTEX(subdrv_list_mutex);
|
||||
static struct drm_driver rockchip_drm_driver;
|
||||
|
||||
struct rockchip_drm_mode_set {
|
||||
struct list_head head;
|
||||
@@ -770,17 +771,29 @@ static void rockchip_iommu_cleanup(struct drm_device *drm_dev)
|
||||
iommu_domain_free(private->domain);
|
||||
}
|
||||
|
||||
static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
|
||||
static int rockchip_drm_bind(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm_dev;
|
||||
struct rockchip_drm_private *private;
|
||||
struct device *dev = drm_dev->dev;
|
||||
struct drm_connector *connector;
|
||||
int ret;
|
||||
|
||||
private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL);
|
||||
if (!private)
|
||||
drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev);
|
||||
if (!drm_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = drm_dev_register(drm_dev, 0);
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
dev_set_drvdata(dev, drm_dev);
|
||||
|
||||
private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL);
|
||||
if (!private) {
|
||||
ret = -ENOMEM;
|
||||
goto err_unregister;
|
||||
}
|
||||
|
||||
mutex_init(&private->commit.lock);
|
||||
INIT_WORK(&private->commit.work, rockchip_drm_atomic_work);
|
||||
|
||||
@@ -804,21 +817,10 @@ static int rockchip_drm_load(struct drm_device *drm_dev, unsigned long flags)
|
||||
if (ret)
|
||||
goto err_iommu_cleanup;
|
||||
|
||||
/*
|
||||
* All components are now added, we can publish the connector sysfs
|
||||
* entries to userspace. This will generate hotplug events and so
|
||||
* userspace will expect to be able to access DRM at this point.
|
||||
*/
|
||||
list_for_each_entry(connector, &drm_dev->mode_config.connector_list,
|
||||
head) {
|
||||
ret = drm_connector_register(connector);
|
||||
if (ret) {
|
||||
dev_err(drm_dev->dev,
|
||||
"[CONNECTOR:%d:%s] drm_connector_register failed: %d\n",
|
||||
connector->base.id,
|
||||
connector->name, ret);
|
||||
goto err_unbind;
|
||||
}
|
||||
ret = drm_connector_register_all(drm_dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to register connectors\n");
|
||||
goto err_unbind;
|
||||
}
|
||||
|
||||
/* init kms poll for handling hpd */
|
||||
@@ -863,12 +865,17 @@ err_iommu_cleanup:
|
||||
err_config_cleanup:
|
||||
drm_mode_config_cleanup(drm_dev);
|
||||
drm_dev->dev_private = NULL;
|
||||
err_unregister:
|
||||
drm_dev_unregister(drm_dev);
|
||||
err_free:
|
||||
drm_dev_unref(drm_dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rockchip_drm_unload(struct drm_device *drm_dev)
|
||||
static void rockchip_drm_unbind(struct device *dev)
|
||||
{
|
||||
struct device *dev = drm_dev->dev;
|
||||
struct drm_device *drm_dev = dev_get_drvdata(dev);
|
||||
struct rockchip_drm_private *private = drm_dev->dev_private;
|
||||
|
||||
rockchip_drm_fbdev_fini(drm_dev);
|
||||
drm_vblank_cleanup(drm_dev);
|
||||
@@ -877,8 +884,9 @@ static int rockchip_drm_unload(struct drm_device *drm_dev)
|
||||
rockchip_iommu_cleanup(drm_dev);
|
||||
drm_mode_config_cleanup(drm_dev);
|
||||
drm_dev->dev_private = NULL;
|
||||
|
||||
return 0;
|
||||
drm_dev_unregister(drm_dev);
|
||||
drm_dev_unref(drm_dev);
|
||||
dev_set_drvdata(dev, NULL);
|
||||
}
|
||||
|
||||
static void rockchip_drm_crtc_cancel_pending_vblank(struct drm_crtc *crtc,
|
||||
@@ -1040,8 +1048,6 @@ static struct drm_driver rockchip_drm_driver = {
|
||||
.driver_features = DRIVER_MODESET | DRIVER_GEM |
|
||||
DRIVER_PRIME | DRIVER_ATOMIC |
|
||||
DRIVER_RENDER,
|
||||
.load = rockchip_drm_load,
|
||||
.unload = rockchip_drm_unload,
|
||||
.preclose = rockchip_drm_preclose,
|
||||
.lastclose = rockchip_drm_lastclose,
|
||||
.get_vblank_counter = drm_vblank_no_hw_counter,
|
||||
@@ -1158,41 +1164,6 @@ static void rockchip_add_endpoints(struct device *dev,
|
||||
}
|
||||
}
|
||||
|
||||
static int rockchip_drm_bind(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm;
|
||||
int ret;
|
||||
|
||||
drm = drm_dev_alloc(&rockchip_drm_driver, dev);
|
||||
if (!drm)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = drm_dev_set_unique(drm, "%s", dev_name(dev));
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
ret = drm_dev_register(drm, 0);
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
dev_set_drvdata(dev, drm);
|
||||
|
||||
return 0;
|
||||
|
||||
err_free:
|
||||
drm_dev_unref(drm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rockchip_drm_unbind(struct device *dev)
|
||||
{
|
||||
struct drm_device *drm = dev_get_drvdata(dev);
|
||||
|
||||
drm_dev_unregister(drm);
|
||||
drm_dev_unref(drm);
|
||||
dev_set_drvdata(dev, NULL);
|
||||
}
|
||||
|
||||
static const struct component_master_ops rockchip_drm_ops = {
|
||||
.bind = rockchip_drm_bind,
|
||||
.unbind = rockchip_drm_unbind,
|
||||
|
||||
Reference in New Issue
Block a user