diff options
Diffstat (limited to 'drivers/gpu/drm/arm/hdlcd_drv.c')
| -rw-r--r-- | drivers/gpu/drm/arm/hdlcd_drv.c | 43 | 
1 files changed, 22 insertions, 21 deletions
| diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index a032003c340c..7043d1c9ed8f 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -26,7 +26,7 @@  #include <drm/drm_crtc.h>  #include <drm/drm_debugfs.h>  #include <drm/drm_drv.h> -#include <drm/drm_fb_helper.h> +#include <drm/drm_fbdev_generic.h>  #include <drm/drm_gem_dma_helper.h>  #include <drm/drm_gem_framebuffer_helper.h>  #include <drm/drm_modeset_helper.h> @@ -98,7 +98,7 @@ static void hdlcd_irq_uninstall(struct hdlcd_drm_private *hdlcd)  static int hdlcd_load(struct drm_device *drm, unsigned long flags)  { -	struct hdlcd_drm_private *hdlcd = drm->dev_private; +	struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);  	struct platform_device *pdev = to_platform_device(drm->dev);  	struct resource *res;  	u32 version; @@ -175,14 +175,21 @@ static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = {  	.atomic_commit = drm_atomic_helper_commit,  }; -static void hdlcd_setup_mode_config(struct drm_device *drm) +static int hdlcd_setup_mode_config(struct drm_device *drm)  { -	drm_mode_config_init(drm); +	int ret; + +	ret = drmm_mode_config_init(drm); +	if (ret) +		return ret; +  	drm->mode_config.min_width = 0;  	drm->mode_config.min_height = 0;  	drm->mode_config.max_width = HDLCD_MAX_XRES;  	drm->mode_config.max_height = HDLCD_MAX_YRES;  	drm->mode_config.funcs = &hdlcd_mode_config_funcs; + +	return 0;  }  #ifdef CONFIG_DEBUG_FS @@ -190,7 +197,7 @@ static int hdlcd_show_underrun_count(struct seq_file *m, void *arg)  {  	struct drm_info_node *node = (struct drm_info_node *)m->private;  	struct drm_device *drm = node->minor->dev; -	struct hdlcd_drm_private *hdlcd = drm->dev_private; +	struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);  	seq_printf(m, "underrun : %d\n", atomic_read(&hdlcd->buffer_underrun_count));  	seq_printf(m, "dma_end  : %d\n", atomic_read(&hdlcd->dma_end_count)); @@ -203,7 +210,7 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg)  {  	struct drm_info_node *node = (struct drm_info_node *)m->private;  	struct drm_device *drm = node->minor->dev; -	struct hdlcd_drm_private *hdlcd = drm->dev_private; +	struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);  	unsigned long clkrate = clk_get_rate(hdlcd->clk);  	unsigned long mode_clock = hdlcd->crtc.mode.crtc_clock * 1000; @@ -247,18 +254,18 @@ static int hdlcd_drm_bind(struct device *dev)  	struct hdlcd_drm_private *hdlcd;  	int ret; -	hdlcd = devm_kzalloc(dev, sizeof(*hdlcd), GFP_KERNEL); -	if (!hdlcd) -		return -ENOMEM; +	hdlcd = devm_drm_dev_alloc(dev, &hdlcd_driver, typeof(*hdlcd), base); +	if (IS_ERR(hdlcd)) +		return PTR_ERR(hdlcd); -	drm = drm_dev_alloc(&hdlcd_driver, dev); -	if (IS_ERR(drm)) -		return PTR_ERR(drm); +	drm = &hdlcd->base; -	drm->dev_private = hdlcd;  	dev_set_drvdata(dev, drm); -	hdlcd_setup_mode_config(drm); +	ret = hdlcd_setup_mode_config(drm); +	if (ret) +		goto err_free; +  	ret = hdlcd_load(drm, 0);  	if (ret)  		goto err_free; @@ -317,17 +324,14 @@ err_unload:  	hdlcd_irq_uninstall(hdlcd);  	of_reserved_mem_device_release(drm->dev);  err_free: -	drm_mode_config_cleanup(drm);  	dev_set_drvdata(dev, NULL); -	drm_dev_put(drm); -  	return ret;  }  static void hdlcd_drm_unbind(struct device *dev)  {  	struct drm_device *drm = dev_get_drvdata(dev); -	struct hdlcd_drm_private *hdlcd = drm->dev_private; +	struct hdlcd_drm_private *hdlcd = drm_to_hdlcd_priv(drm);  	drm_dev_unregister(drm);  	drm_kms_helper_poll_fini(drm); @@ -341,10 +345,7 @@ static void hdlcd_drm_unbind(struct device *dev)  	if (pm_runtime_enabled(dev))  		pm_runtime_disable(dev);  	of_reserved_mem_device_release(dev); -	drm_mode_config_cleanup(drm); -	drm->dev_private = NULL;  	dev_set_drvdata(dev, NULL); -	drm_dev_put(drm);  }  static const struct component_master_ops hdlcd_master_ops = { |