Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1501217ybv; Thu, 20 Feb 2020 21:57:17 -0800 (PST) X-Google-Smtp-Source: APXvYqy4MBsT5tmyroYVe4VFDftqIv7dkB8NnyggNld77kOMTAHkVPWR9lCeuh/esqEhAnFdKWi6 X-Received: by 2002:a9d:67d7:: with SMTP id c23mr26853140otn.262.1582264636880; Thu, 20 Feb 2020 21:57:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582264636; cv=none; d=google.com; s=arc-20160816; b=c4vpUcRbIP/F4Tsk2KbBWLtKW1PoPy3wo9+HnlzBR+k9wq8lnVKZAm5l0yGEWRavlY LWXKSrSr5UUHVi5tZ9CTIYCgWMfddm9uHfXbYNM7Cfv6U2Y47xTeOd22D+9xSe1PaTvK K37FI/e12QQv2P3KhsuLNFe/NkGYQLUe4tA9+sNQ9zr6MSXOFcPFUszNebM5nCF0U5ep mIy3l2Sd0B0sfqvhnqbFwyIbyciqJ95oOoHB/3mq00dtLjlIC3uI3tE9bJ1v5Fv9dSWD qDvJPBhXGHgQ0lT5qFGHk11wiiN0Ye8fG3xgDHmP70S0/MMH7rcxfijgeUxF8kx7VCcy AN3w== 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=I/K31cgGPko+DuQrTmcLPffzMRf0sOEQHmDPjYsTKsg=; b=TjGpzT43LI+Ta0lBVM6fHX1HwD6fQ2KbETNOjlwD8zyl57JCwkIAeUFT7Gf3gPXHrI 5+74gfb+Hggfl2SjRqUB4cgtfSARpRd/RLMnxPVO7OdmSch9Yg34S3L30MmqhdumVgtH dY53UorORmB0uh++cJyGV/LHy9P11/wy11KUgI0vcOXF9AWXrz7XQQIrrrpr/K/9MzAF aKdflcUm5er5BiEnkeB/LJ3k1B0ug2tVqwfJ1EC1irA/fL4gygZ1zwYqjasvVC2lvkoi I3K4yT5cvrmgmhyNwyIlyImoZ1w+aE2RoShZYOLtsTQzDTp5vK2ahfgU5lZp7iJ5KEMS 3dCQ== 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 j25si325789oij.242.2020.02.20.21.57.03; Thu, 20 Feb 2020 21:57:16 -0800 (PST) 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 S1726561AbgBUFzx (ORCPT + 99 others); Fri, 21 Feb 2020 00:55:53 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10230 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725800AbgBUFzx (ORCPT ); Fri, 21 Feb 2020 00:55:53 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id F3B5E120A2489A8B1745; Fri, 21 Feb 2020 13:55:48 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Fri, 21 Feb 2020 13:55:43 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH] drm/hisilicon: Fixed pcie resource conflict using the general API Date: Fri, 21 Feb 2020 13:55:23 +0800 Message-ID: <1582264523-61170-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 the kernel provide the drm_fb_helper_remove_conflicting_pci_framebuffer to remvoe the pcie resource conflict,there is no need to driver it again. Signed-off-by: Tian Tao --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c index 7ebe831..0f7dba7 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -47,22 +47,6 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void *arg) return IRQ_HANDLED; } -static void hibmc_remove_framebuffers(struct pci_dev *pdev) -{ - struct apertures_struct *ap; - - ap = alloc_apertures(1); - if (!ap) - return; - - ap->ranges[0].base = pci_resource_start(pdev, 0); - ap->ranges[0].size = pci_resource_len(pdev, 0); - - drm_fb_helper_remove_conflicting_framebuffers(ap, "hibmcdrmfb", false); - - kfree(ap); -} - static struct drm_driver hibmc_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .fops = &hibmc_fops, @@ -343,7 +327,11 @@ static int hibmc_pci_probe(struct pci_dev *pdev, struct drm_device *dev; int ret; - hibmc_remove_framebuffers(pdev); + ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, + "hibmcdrmfb"); + if (ret) + return ret; + dev = drm_dev_alloc(&hibmc_driver, &pdev->dev); if (IS_ERR(dev)) { -- 2.7.4