From patchwork Mon Jan 29 13:55:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 10189751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 564A66020C for ; Mon, 29 Jan 2018 13:56:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4563F28739 for ; Mon, 29 Jan 2018 13:56:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39F5E28778; Mon, 29 Jan 2018 13:56:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D050428741 for ; Mon, 29 Jan 2018 13:56:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E2766E4C6; Mon, 29 Jan 2018 13:55:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0059.outbound.protection.outlook.com [104.47.38.59]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1EFA56E4C6; Mon, 29 Jan 2018 13:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hQwZ4YH46YiVMZYRXh1F3rkAO6A3iFAd3kDStgfCjmQ=; b=5SmAFojolHLuxsYHU4xeKI+fB/mDfzq5ERbouo4k1n2CY5ILR/U9L2S0UTSbVfU/alw5TMLnT5hEQD8yJM0sGjOhsp3qBkjG4IE1rgtV/NFltBwHvL23KuxYZhVrbYT+emiAivRZopSjcRqDe00l5sekE2WwTmy7V99BTK5dBI8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tom.StDenis@amd.com; Received: from fx8.amd.com (165.204.55.251) by DM5PR1201MB0075.namprd12.prod.outlook.com (10.174.106.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 13:55:32 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 08/12] drm/ttm: Remove unncessary retval from ttm_bo_vm_fault() Date: Mon, 29 Jan 2018 08:55:09 -0500 Message-Id: <20180129135513.22538-9-tom.stdenis@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180129135513.22538-1-tom.stdenis@amd.com> References: <20180129135513.22538-1-tom.stdenis@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: CY4PR14CA0027.namprd14.prod.outlook.com (10.172.162.141) To DM5PR1201MB0075.namprd12.prod.outlook.com (10.174.106.17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f0f57da1-7546-4b7f-c793-08d5671ff758 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR1201MB0075; X-Microsoft-Exchange-Diagnostics: 1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NKQEjS2+DYH46P2MWZO+KV+Shf0kBes4lg9P8n9kqvNeFMi3vNqxGpkScBf+26ahaAv364GKIuuXwbYQM/Xs9ZW/+Qx9NGozApSuJsH+NDrgANnbTPSFqG78xzNLHH1nKFoMAiCfU/O7Opi80HBASG7QbLwPWtTusW55uMvfHawXmOL0HsMYLb8yCqDxyYqnpTEtlY5UkbUUpb6guREnO6bHH/qwRUQgZx+2mY2EOMDk04Php3ZewJaPZCHZ2Lt/VqJEEpv9bwzlzNbOefVPWX1MVQc9LcBd/IDXLTpoNTJMaWtehUjc/m136ez7upOtLU4BkZWjwJ8jWHVTy1o6Q6wZaVScdC1QpGNwVy2IE0g4eYEpxOsZsjQs7ee; 4:qqr0Rotsrr/GtWSv/tfkYZ01e4co4mEcsgogH4HaK72EqhQbxWZ4bgkJ+dwbsNO+zIoqiD+gHvlOccIZYdFTIb+6Ff0/4EnG8cShxbZozYOzLlwIxg0rZl/xig6QJQXZikmbe5Z8/LqEt0OW0ufieBigWWVUrtW26hdY+vGI5Veddd4MbG02DhqIWW2jpKXzGmstwsd+trqpAmXbImo18Cnbpc5N9lXGl4U2BC8CFz2V6jQq0fTRJJ22AX2FKmsQ1vWX9y+MyUzOHhF9KhYVNePVJQZF+TJiKa2ZDmVgy1PmLWkHH422j9cBnBbMK6VM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231101)(944501161)(93006095)(93001095)(6055026)(6041288)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:DM5PR1201MB0075; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0075; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(39380400002)(396003)(39860400002)(346002)(366004)(189003)(199004)(59450400001)(76176011)(478600001)(7696005)(450100002)(7736002)(52116002)(6486002)(23676004)(86362001)(305945005)(2870700001)(53936002)(66066001)(5660300001)(72206003)(47776003)(4326008)(386003)(81166006)(97736004)(2361001)(25786009)(2351001)(106356001)(316002)(6666003)(8936002)(2950100002)(16526019)(2906002)(81156014)(68736007)(6916009)(186003)(36756003)(105586002)(8676002)(53416004)(50226002)(1076002)(3846002)(6116002)(50466002)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0075; H:fx8.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyMDFNQjAwNzU7MjM6VG0wVlRaMHR2emJLT2s4RjdtNDFLR3l4?= =?utf-8?B?c0Q5ejRoOGxka1VTTitTZm9zNS9NOFNPWGQzQ3IvNTQra05MVmVFZFFSZ0cv?= =?utf-8?B?a09TeGVlVlA4VmxLRk9oOHZZWDZDSkFxMmJIUHJVemg3M2hkV3h1SjlNNVhz?= =?utf-8?B?c0EyeGlqclAzc3V4OG1VOGs2R24yaHZOQjFQSFROQ3p1ZERhVjB3S25PMkNG?= =?utf-8?B?M2FteW53NXd2YjhtODI3UVgvUi8wZnUyM1Y0QWdlV0xhR3grYXUrRWtaVlhZ?= =?utf-8?B?RG9qOWJRZTZ2MUt4OHN2TDVKa0V1VmNSbkNGUFEvYWU0V1BKMkFGVUVNOE1q?= =?utf-8?B?aDBFd1NXNWUzNVJWWDVRWjFkQ1l5ZnBjWkpHMWdvVGtnVFVEL0pYS2M5QlNZ?= =?utf-8?B?SmVFeU45UmVDS1Bqci9pUzdqUDVreUt0MkNSTjN4blZ6eldTZVd3KzViTmJ0?= =?utf-8?B?UnlsS2ZNNjNnbmtYaThiMWdLdnZjVlpJR3pSaXp0cVU4T01SeXdESnNDN2Qr?= =?utf-8?B?K0paWlpj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MkQFITNvaTZACSeJ/ompcLBE6KuU13x+7Ri11eOwpEv1NuIknVDSWSuKpKMr4B3i54/HdcXOWH4G01PhgNyzYYiAxuPIZPzLTaCXSgPNDYzXNzkmqrqgHlP3QtFSu811+esnUXkbjhJSx SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0075; 20:McPOeKJwTHcnil8MweWQRLTmbLXFkvq+9MOrywdpsDlaQeqHsT1ZiewkXgUIzqfR45Hgk37keELy5ny0t5Bv3MshveP+a10zTEh17dCUI7dk8aBJ3biHDNjf8Ch+7oBMzmKjI7ShbN8ZUFO6aKCNDo8ov/mqg6Q0QEmZ9JsHfNcIUsPTVF63omLEmyFrGvYI01jB97gBv6wjdiRny9YjyQz3T8h2CZW5DsRptZb1wRFEiHpgHicegx9m/lRVhC/l X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 13:55:32.7512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f0f57da1-7546-4b7f-c793-08d5671ff758 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0075 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tom St Denis , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The dual ret/retval was more complex than need be. Now we drop the retval variable and assign the appropriate VM codes to ret instead. Signed-off-by: Tom St Denis Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_bo_vm.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 60fcef1593dd..716e724ac710 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c @@ -118,7 +118,6 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) int ret; int i; unsigned long address = vmf->address; - int retval = VM_FAULT_NOPAGE; struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; struct vm_area_struct cvma; @@ -158,7 +157,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) * (if at all) by redirecting mmap to the exporter. */ if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) { - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_unlock; } @@ -169,10 +168,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) break; case -EBUSY: case -ERESTARTSYS: - retval = VM_FAULT_NOPAGE; + ret = VM_FAULT_NOPAGE; goto out_unlock; default: - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_unlock; } } @@ -183,12 +182,10 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) */ ret = ttm_bo_vm_fault_idle(bo, vmf); if (unlikely(ret != 0)) { - retval = ret; - - if (retval == VM_FAULT_RETRY && + if (ret == VM_FAULT_RETRY && !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) { /* The BO has already been unreserved. */ - return retval; + return ret; } goto out_unlock; @@ -196,12 +193,12 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) ret = ttm_mem_io_lock(man, true); if (unlikely(ret != 0)) { - retval = VM_FAULT_NOPAGE; + ret = VM_FAULT_NOPAGE; goto out_unlock; } ret = ttm_mem_io_reserve_vm(bo); if (unlikely(ret != 0)) { - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_io_unlock; } @@ -211,7 +208,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) drm_vma_node_start(&bo->vma_node); if (unlikely(page_offset >= bo->num_pages)) { - retval = VM_FAULT_SIGBUS; + ret = VM_FAULT_SIGBUS; goto out_io_unlock; } @@ -238,7 +235,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) /* Allocate all page at once, most common usage */ if (ttm->bdev->driver->ttm_tt_populate(ttm, &ctx)) { - retval = VM_FAULT_OOM; + ret = VM_FAULT_OOM; goto out_io_unlock; } } @@ -255,7 +252,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) } else { page = ttm->pages[page_offset]; if (unlikely(!page && i == 0)) { - retval = VM_FAULT_OOM; + ret = VM_FAULT_OOM; goto out_io_unlock; } else if (unlikely(!page)) { break; @@ -280,7 +277,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) if (unlikely((ret == -EBUSY) || (ret != 0 && i > 0))) break; else if (unlikely(ret != 0)) { - retval = + ret = (ret == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS; goto out_io_unlock; } @@ -289,11 +286,12 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf) if (unlikely(++page_offset >= page_last)) break; } + ret = VM_FAULT_NOPAGE; out_io_unlock: ttm_mem_io_unlock(man); out_unlock: ttm_bo_unreserve(bo); - return retval; + return ret; } static void ttm_bo_vm_open(struct vm_area_struct *vma)