virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
	m.felsch@pengutronix.de,
	"DRI Development" <dri-devel@lists.freedesktop.org>,
	virtualization@lists.linux-foundation.org,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Dave Airlie" <airlied@redhat.com>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	l.stach@pengutronix.de
Subject: Re: [PATCH 29/51] drm/cirrus: Drop explicit drm_mode_config_cleanup call
Date: Fri, 28 Feb 2020 21:32:35 +0100	[thread overview]
Message-ID: <20200228203235.GC22966@ravnborg.org> (raw)
In-Reply-To: <20200227181522.2711142-30-daniel.vetter@ffwll.ch>

On Thu, Feb 27, 2020 at 07:15:00PM +0100, Daniel Vetter wrote:
> We can even delete the drm_driver.release hook now!
> 
> This is made possible by a preceeding patch which added a drmm_
> cleanup action to drm_mode_config_init(), hence all we need to do to
> ensure that drm_mode_config_cleanup() is run on final drm_device
> cleanup is check the new error code for _init().
> 
> v2: Explain why this cleanup is possible (Laurent).
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: virtualization@lists.linux-foundation.org

Acked-by: Sam Ravnborg <sam@ravnborg.org>

But as stated in other post - using drmm_mode_config_init()
would make this more readable.

	Sam

> ---
>  drivers/gpu/drm/cirrus/cirrus.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c
> index a9d789a56536..6ac0286810ec 100644
> --- a/drivers/gpu/drm/cirrus/cirrus.c
> +++ b/drivers/gpu/drm/cirrus/cirrus.c
> @@ -510,11 +510,15 @@ static const struct drm_mode_config_funcs cirrus_mode_config_funcs = {
>  	.atomic_commit = drm_atomic_helper_commit,
>  };
>  
> -static void cirrus_mode_config_init(struct cirrus_device *cirrus)
> +static int cirrus_mode_config_init(struct cirrus_device *cirrus)
>  {
>  	struct drm_device *dev = &cirrus->dev;
> +	int ret;
> +
> +	ret = drm_mode_config_init(dev);
> +	if (ret)
> +		return ret;
>  
> -	drm_mode_config_init(dev);
>  	dev->mode_config.min_width = 0;
>  	dev->mode_config.min_height = 0;
>  	dev->mode_config.max_width = CIRRUS_MAX_PITCH / 2;
> @@ -522,15 +526,12 @@ static void cirrus_mode_config_init(struct cirrus_device *cirrus)
>  	dev->mode_config.preferred_depth = 16;
>  	dev->mode_config.prefer_shadow = 0;
>  	dev->mode_config.funcs = &cirrus_mode_config_funcs;
> +
> +	return 0;
>  }
>  
>  /* ------------------------------------------------------------------ */
>  
> -static void cirrus_release(struct drm_device *dev)
> -{
> -	drm_mode_config_cleanup(dev);
> -}
> -
>  DEFINE_DRM_GEM_FOPS(cirrus_fops);
>  
>  static struct drm_driver cirrus_driver = {
> @@ -544,7 +545,6 @@ static struct drm_driver cirrus_driver = {
>  
>  	.fops		 = &cirrus_fops,
>  	DRM_GEM_SHMEM_DRIVER_OPS,
> -	.release         = cirrus_release,
>  };
>  
>  static int cirrus_pci_probe(struct pci_dev *pdev,
> @@ -591,7 +591,9 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
>  	if (cirrus->mmio == NULL)
>  		goto err_unmap_vram;
>  
> -	cirrus_mode_config_init(cirrus);
> +	ret = cirrus_mode_config_init(cirrus);
> +	if (ret)
> +		goto err_cleanup;
>  
>  	ret = cirrus_conn_init(cirrus);
>  	if (ret < 0)
> @@ -613,7 +615,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
>  	return 0;
>  
>  err_cleanup:
> -	drm_mode_config_cleanup(dev);
>  	iounmap(cirrus->mmio);
>  err_unmap_vram:
>  	iounmap(cirrus->vram);
> -- 
> 2.24.1

  reply	other threads:[~2020-02-28 20:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200227181522.2711142-1-daniel.vetter@ffwll.ch>
2020-02-27 18:14 ` [PATCH 07/51] drm/qxl: Use drmm_add_final_kfree Daniel Vetter
2020-02-27 18:14 ` [PATCH 09/51] drm/cirrus: " Daniel Vetter
2020-02-27 21:01   ` Sam Ravnborg
2020-02-27 18:14 ` [PATCH 28/51] drm/bochs: Drop explicit drm_mode_config_cleanup Daniel Vetter
2020-02-27 18:15 ` [PATCH 29/51] drm/cirrus: Drop explicit drm_mode_config_cleanup call Daniel Vetter
2020-02-28 20:32   ` Sam Ravnborg [this message]
2020-02-27 18:15 ` [PATCH 30/51] drm/cirrus: Fully embrace devm_ Daniel Vetter
     [not found] <20200323144950.3018436-1-daniel.vetter@ffwll.ch>
2020-03-23 14:49 ` [PATCH 29/51] drm/cirrus: Drop explicit drm_mode_config_cleanup call Daniel Vetter
     [not found] <20200302222631.3861340-1-daniel.vetter@ffwll.ch>
2020-03-02 22:26 ` Daniel Vetter
2020-03-03  7:51   ` Gerd Hoffmann
     [not found] <20200221210319.2245170-1-daniel.vetter@ffwll.ch>
2020-02-21 21:02 ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200228203235.GC22966@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=airlied@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=m.felsch@pengutronix.de \
    --cc=noralf@tronnes.org \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).