Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6395774pxu; Thu, 24 Dec 2020 00:49:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxf6xe3s0H6hdLut2EYWrS52V9BL056UsjsxIcipEuaJCOqTcJsi9QHWyapOU7wjlwJuaJO X-Received: by 2002:a17:906:b1c8:: with SMTP id bv8mr27731852ejb.208.1608799784916; Thu, 24 Dec 2020 00:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608799784; cv=none; d=google.com; s=arc-20160816; b=LHuqnA0Dn1HtPpTTmkTkDBf0gm2SQ8v0HjfccWIKfe9utEBORoHXunNo7JWjN6aw3b FriH/x7NLNAUtUt2lDgq48HW9WRa6vAc2OKEYtH9U+isTy0GO7Cmni3OtVfiu0yY0ll7 z4L+Tufq6nW41CgVUDCyujJZ44RIlNnw/eEsHmljfscZoYPUPzVMA4QCeVtz+d9sCSpq gBv3ckgyQQFlm1+ixccOiercnkM7aYTs1nGg1AwcPk7R+ug6cA0FBOpeTIa/ibu97wNv SHGU/6Pr4mual3r4RHqaTGap5VtZeh0M86JdsFeCDFziQC8JKWHzYBpIZosKhMO1SrDM 13gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from; bh=9u2Gq6ot+5G0+fEuByUxvStBAUpLzGHnbgpVzYb1FCc=; b=CWrBtL/YMNnKqQaESKtx5HJDozRQQS2frnHU/CzmQyAakwZEJs/PGo4uv5QcIOT/3+ ewEA5P3C0nvBODdyME2B9IIA8xljOZ6KCLO9a9t0DNifg5e0+fTXEVisVmJmndosrJTg /+DVT22FdQcw9YIKwUykneJtNdwUo2Iuix4Zesf/pzztE+RRcjtkWGbax9HcF7zEpoq+ 3nb9azNUKt6KWzTj7zuul/hmM/4i0IiOgW+IlAc77mH9XVJHYuxMH3V41nNpi/ynofGn 9ZQqlOucctTPM8jHIb+W4PdpBSaOb5vDAG7qT88p6eVVvUrVyVkLEORDNyTD06hsp4za XbFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t5si13595680ejy.497.2020.12.24.00.49.22; Thu, 24 Dec 2020 00:49:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726931AbgLXIqj (ORCPT + 99 others); Thu, 24 Dec 2020 03:46:39 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9987 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbgLXIqj (ORCPT ); Thu, 24 Dec 2020 03:46:39 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4D1kD865WDzhxCC; Thu, 24 Dec 2020 16:45:12 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Thu, 24 Dec 2020 16:45:53 +0800 From: Tian Tao To: , , , , , , , , Subject: [PATCH v2] drm/hisilicon: Add load and unload callback functions Date: Thu, 24 Dec 2020 16:45:58 +0800 Message-ID: <1608799558-29564-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the callback functions of drm_driver structure member functions load and unload, no need to call load in the hibmc_pci_probe function and unload in the hibmc_pci_remove function. v2: remove the hibmc_unload called from hibmc_pic_remove. Signed-off-by: Tian Tao --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 0d4e902..10042cf 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -27,6 +27,9 @@ DEFINE_DRM_GEM_FOPS(hibmc_fops); +static int hibmc_load(struct drm_device *dev, unsigned long flags); +static void hibmc_unload(struct drm_device *dev); + static irqreturn_t hibmc_drm_interrupt(int irq, void *arg) { struct drm_device *dev = (struct drm_device *)arg; @@ -63,6 +66,8 @@ static const struct drm_driver hibmc_driver = { .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, .gem_prime_mmap = drm_gem_prime_mmap, .irq_handler = hibmc_drm_interrupt, + .load = hibmc_load, + .unload = hibmc_unload, }; static int __maybe_unused hibmc_pm_suspend(struct device *dev) @@ -248,7 +253,7 @@ static int hibmc_hw_init(struct hibmc_drm_private *priv) return 0; } -static int hibmc_unload(struct drm_device *dev) +static void hibmc_unload(struct drm_device *dev) { drm_atomic_helper_shutdown(dev); @@ -256,11 +261,9 @@ static int hibmc_unload(struct drm_device *dev) drm_irq_uninstall(dev); pci_disable_msi(dev->pdev); - - return 0; } -static int hibmc_load(struct drm_device *dev) +static int hibmc_load(struct drm_device *dev, unsigned long flags) { struct hibmc_drm_private *priv = to_hibmc_drm_private(dev); int ret; @@ -335,12 +338,6 @@ static int hibmc_pci_probe(struct pci_dev *pdev, goto err_return; } - ret = hibmc_load(dev); - if (ret) { - drm_err(dev, "failed to load hibmc: %d\n", ret); - goto err_return; - } - ret = drm_dev_register(dev, 0); if (ret) { drm_err(dev, "failed to register drv for userspace access: %d\n", @@ -363,7 +360,6 @@ static void hibmc_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); drm_dev_unregister(dev); - hibmc_unload(dev); } static const struct pci_device_id hibmc_pci_table[] = { -- 2.7.4