From patchwork Fri Dec 20 11:59:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 11305253 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18C9D109A for ; Fri, 20 Dec 2019 11:59:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB53420684 for ; Fri, 20 Dec 2019 11:59:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OJoVZWIc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB53420684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E91846EC13; Fri, 20 Dec 2019 11:59:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 871646EC14 for ; Fri, 20 Dec 2019 11:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576843182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=EimEcwtT13iZd2BQPB2j/TIU/TkI66KaW5WQSgBY8gg=; b=OJoVZWIczmRY13vzDkktQbKnVFIA1/Y0v4r4OlXk0A9nMOT7mjIqhNBWffOmgHD5+lU5v+ ZIV9+m8csHHes4Nfn4DePj960LmHTk62QgmEqifDbxGhvjtjexIyvTuQKFir50wHN1B3NP BWHokEmxMw+cEsr9tn2F4y1UdfPRpEg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-41aUINrDOjGjBE6Dq_5GEQ-1; Fri, 20 Dec 2019 06:59:40 -0500 X-MC-Unique: 41aUINrDOjGjBE6Dq_5GEQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 117C5800053; Fri, 20 Dec 2019 11:59:39 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F0166046B; Fri, 20 Dec 2019 11:59:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 917633F13E; Fri, 20 Dec 2019 12:59:35 +0100 (CET) From: Gerd Hoffmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/4] drm/cirrus: add drm_driver.release callback. Date: Fri, 20 Dec 2019 12:59:33 +0100 Message-Id: <20191220115935.15152-3-kraxel@redhat.com> In-Reply-To: <20191220115935.15152-1-kraxel@redhat.com> References: <20191220115935.15152-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , open list , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" , Gerd Hoffmann , Dave Airlie MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 248c9f765c45..a4ca66f9a423 100644 --- a/drivers/gpu/drm/cirrus/cirrus.c +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -510,6 +510,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 = { @@ -523,6 +533,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, @@ -604,14 +615,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); }