Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1182448ybb; Fri, 10 Apr 2020 19:51:31 -0700 (PDT) X-Google-Smtp-Source: APiQypLkzd0Zw0XKoY+GhjqvCSJze+semye8zRG5vg+IrwOFOwJdkBKpor7FzTYGZWnFEMMvBG2c X-Received: by 2002:ac8:7b8b:: with SMTP id p11mr2049398qtu.131.1586573491242; Fri, 10 Apr 2020 19:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586573491; cv=none; d=google.com; s=arc-20160816; b=WAcxrOxHwK9BqVz4udKDoPRiRLWhsyw5vdQo1SKvta5J5TPQy9IftXFo/DImXC+K3Q qN8hiQpsub+MCzJi0pp67wBRXpMQyUWklXJSiPj+/0WvB2wvGKsZHpQGZZIuhhCx+XFY 6OvhGW8/H5H9fPmQHV6sNtB+07BSHioYECd1XpSNMSUkBJeX6+Cq3DRNBO5NjJ3ZWC7k ONdD7SjBTiEdHZtruXUwU3UEZBwp19kUEWPKTLEOv8Eyo2rqm7G8rknZQuo3PjZajxi4 Z/KftS1CzmWh4Q87afYgOY77k80Z/p9Vbh0weQmAOC9afQgSoZlAZv4KZlDcxBosvY9o Lwww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=6moAAA6uAbpSH3/9Q8ZtNq5LFOzuqWXAUQDv5+c8jOY=; b=f+d7mRx1KTQIL6bik3tUL1wWBVpPSNOKkUcf5ldHm4lAxTIr3YGSculyc2SLFdYC1o r2UqJe1wLTMy65E5lUhrt2o/ZT9GqYwl5cHDgVkkqg8wK+B5CLx6/J4EdqTMO2yfusgR R8BH6BhgpWtPrrVTtm6iAYTtBGhcsyu55xMaufQJyDCceb0MPLOgAfDmh5kbQcVLrcYD RzP2aw/16boI7XH+9Bl5wMGGVEZr1qfEBOfRIx0HPJiPSZtSJmzaTzEnLt8xcw7X8CO/ d/qQ/2cxBEvT9Xiiv0Syed99GYcA0m/xJhV5FGLhJSf+bwznMYOuTb9CDl0Zt7FHkYOd GkyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e10si2839540qtw.131.2020.04.10.19.51.14; Fri, 10 Apr 2020 19:51:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726679AbgDKCu2 (ORCPT + 99 others); Fri, 10 Apr 2020 22:50:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13150 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726650AbgDKCu2 (ORCPT ); Fri, 10 Apr 2020 22:50:28 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2D05D414D6D0EC0728D2; Sat, 11 Apr 2020 10:50:25 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Sat, 11 Apr 2020 10:50:17 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH] drm/hisilicon: Add the shutdown for hibmc_pci_driver Date: Sat, 11 Apr 2020 10:49:30 +0800 Message-ID: <1586573370-41945-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org add the shutdown function to release the resource. Signed-off-by: Tian Tao --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index a6fd0c2..126d4f4 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -232,6 +232,21 @@ static int hibmc_hw_map(struct hibmc_drm_private *priv) return 0; } +static void hibmc_hw_unmap(struct hibmc_drm_private *priv) +{ + struct drm_device *dev = priv->dev; + + if (priv->mmio) { + devm_iounmap(dev->dev, priv->mmio); + priv->mmio = NULL; + } + + if (priv->fb_map) { + devm_iounmap(dev->dev, priv->fb_map); + priv->fb_map = NULL; + } +} + static int hibmc_hw_init(struct hibmc_drm_private *priv) { int ret; @@ -258,6 +273,7 @@ static int hibmc_unload(struct drm_device *dev) hibmc_kms_fini(priv); hibmc_mm_fini(priv); + hibmc_hw_unmap(priv); dev->dev_private = NULL; return 0; } @@ -374,6 +390,12 @@ static void hibmc_pci_remove(struct pci_dev *pdev) drm_dev_unregister(dev); hibmc_unload(dev); drm_dev_put(dev); + pci_disable_device(pdev); +} + +static void hibmc_pci_shutdown(struct pci_dev *pdev) +{ + hibmc_pci_remove(pdev); } static struct pci_device_id hibmc_pci_table[] = { @@ -386,6 +408,7 @@ static struct pci_driver hibmc_pci_driver = { .id_table = hibmc_pci_table, .probe = hibmc_pci_probe, .remove = hibmc_pci_remove, + .shutdown = hibmc_pci_shutdown, .driver.pm = &hibmc_pm_ops, }; -- 2.7.4