Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbdLXFuX (ORCPT ); Sun, 24 Dec 2017 00:50:23 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:49654 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750957AbdLXFuO (ORCPT ); Sun, 24 Dec 2017 00:50:14 -0500 From: Tan Xiaojun To: , , , , , , , , , , , , , CC: , , , Subject: [PATCH 01/12] drm/ttm: Use ttm_bo_default_io_mem_pfn if io_mem_pfn is NULL Date: Sun, 24 Dec 2017 14:14:17 +0800 Message-ID: <1514096068-80414-2-git-send-email-tanxiaojun@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514096068-80414-1-git-send-email-tanxiaojun@huawei.com> References: <1514096068-80414-1-git-send-email-tanxiaojun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.38] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1106 Lines: 30 From: Michal Srb The io_mem_pfn field was added in commit ea642c3216cb2a60d1c0e760ae47ee85c9c16447 and is called unconditionally. However, not all drivers were updated to set it. Use the ttm_bo_default_io_mem_pfn function if a driver did not set its own. Signed-off-by: Michal Srb --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index c8ebb75..e25a99b 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -234,7 +234,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) if (bo->mem.bus.is_iomem) { /* Iomem should not be marked encrypted */ cvma.vm_page_prot = pgprot_decrypted(cvma.vm_page_prot); - pfn = bdev->driver->io_mem_pfn(bo, page_offset); + if (bdev->driver->io_mem_pfn) + pfn = bdev->driver->io_mem_pfn(bo, page_offset); + else + pfn = ttm_bo_default_io_mem_pfn(bo, page_offset); } else { page = ttm->pages[page_offset]; if (unlikely(!page && i == 0)) { -- 2.7.4