* [PATCH] drm/cirrus: add drm_driver.release callback.
@ 2020-02-07 12:13 Gerd Hoffmann
2020-02-07 13:16 ` Thomas Zimmermann
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2020-02-07 12:13 UTC (permalink / raw)
To: dri-devel
Cc: Gerd Hoffmann, Dave Airlie, David Airlie, Daniel Vetter,
open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE, open list
Move final cleanups from cirrus_pci_remove() to the new callback.
Add drm_atomic_helper_shutdown() call to cirrus_pci_remove().
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/cirrus/cirrus.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c
index a91fb0d7282c..39a9e964aac9 100644
--- a/drivers/gpu/drm/cirrus/cirrus.c
+++ b/drivers/gpu/drm/cirrus/cirrus.c
@@ -502,6 +502,16 @@ static void cirrus_mode_config_init(struct cirrus_device *cirrus)
/* ------------------------------------------------------------------ */
+static void cirrus_release(struct drm_device *dev)
+{
+ struct cirrus_device *cirrus = dev->dev_private;
+
+ drm_mode_config_cleanup(dev);
+ iounmap(cirrus->mmio);
+ iounmap(cirrus->vram);
+ kfree(cirrus);
+}
+
DEFINE_DRM_GEM_FOPS(cirrus_fops);
static struct drm_driver cirrus_driver = {
@@ -515,6 +525,7 @@ 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,
@@ -596,14 +607,10 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
static void cirrus_pci_remove(struct pci_dev *pdev)
{
struct drm_device *dev = pci_get_drvdata(pdev);
- struct cirrus_device *cirrus = dev->dev_private;
drm_dev_unregister(dev);
- drm_mode_config_cleanup(dev);
- iounmap(cirrus->mmio);
- iounmap(cirrus->vram);
+ drm_atomic_helper_shutdown(dev);
drm_dev_put(dev);
- kfree(cirrus);
pci_release_regions(pdev);
}
--
2.18.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/cirrus: add drm_driver.release callback.
2020-02-07 12:13 [PATCH] drm/cirrus: add drm_driver.release callback Gerd Hoffmann
@ 2020-02-07 13:16 ` Thomas Zimmermann
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2020-02-07 13:16 UTC (permalink / raw)
To: Gerd Hoffmann, dri-devel
Cc: David Airlie, open list,
open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE, Dave Airlie
[-- Attachment #1.1: Type: text/plain, Size: 2068 bytes --]
Am 07.02.20 um 13:13 schrieb Gerd Hoffmann:
> Move final cleanups from cirrus_pci_remove() to the new callback.
> Add drm_atomic_helper_shutdown() call to cirrus_pci_remove().
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/cirrus/cirrus.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c
> index a91fb0d7282c..39a9e964aac9 100644
> --- a/drivers/gpu/drm/cirrus/cirrus.c
> +++ b/drivers/gpu/drm/cirrus/cirrus.c
> @@ -502,6 +502,16 @@ static void cirrus_mode_config_init(struct cirrus_device *cirrus)
>
> /* ------------------------------------------------------------------ */
>
> +static void cirrus_release(struct drm_device *dev)
> +{
> + struct cirrus_device *cirrus = dev->dev_private;
> +
> + drm_mode_config_cleanup(dev);
> + iounmap(cirrus->mmio);
> + iounmap(cirrus->vram);
> + kfree(cirrus);
> +}
> +
> DEFINE_DRM_GEM_FOPS(cirrus_fops);
>
> static struct drm_driver cirrus_driver = {
> @@ -515,6 +525,7 @@ 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,
> @@ -596,14 +607,10 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
> static void cirrus_pci_remove(struct pci_dev *pdev)
> {
> struct drm_device *dev = pci_get_drvdata(pdev);
> - struct cirrus_device *cirrus = dev->dev_private;
>
> drm_dev_unregister(dev);
> - drm_mode_config_cleanup(dev);
> - iounmap(cirrus->mmio);
> - iounmap(cirrus->vram);
> + drm_atomic_helper_shutdown(dev);
> drm_dev_put(dev);
> - kfree(cirrus);
> pci_release_regions(pdev);
> }
>
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-07 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07 12:13 [PATCH] drm/cirrus: add drm_driver.release callback Gerd Hoffmann
2020-02-07 13:16 ` Thomas Zimmermann
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).