From patchwork Mon Jan 29 13:55:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 10189757 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 98C7D6020C for ; Mon, 29 Jan 2018 13:56:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 856CD28741 for ; Mon, 29 Jan 2018 13:56:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76B4828797; Mon, 29 Jan 2018 13:56:18 +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 268E028741 for ; Mon, 29 Jan 2018 13:56:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8997C6E4D2; Mon, 29 Jan 2018 13:55:38 +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-bl2nam02on0077.outbound.protection.outlook.com [104.47.38.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id C2C566E4CC; Mon, 29 Jan 2018 13:55:35 +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=SNqQV4OzVmOp+ZoNAUv9oNyWwUA28HSbmK2ENdMmZ88=; b=44eN+vGKgwi8j4iPUM/eEaSZYpRXfqfdEsbKpor0XtIIEE7bXpJZebYYZYgq/91P3ykpHS+ZMpi7nwl6lok2aoPof25pRRYlTIp3BaZNMaqkGpDgQMx7rC1B7RFJ2v9l1rF6vNbLPVrXmLxbqTkU/F6xnmEO8osOFoWxfzwysg4= 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:33 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 09/12] drm/ttm: Simplify ttm_eu_reserve_buffers() Date: Mon, 29 Jan 2018 08:55:10 -0500 Message-Id: <20180129135513.22538-10-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: 1195d5e4-61fe-4cb9-ac3d-08d5671ff7ff 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-Diag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8w6fJBpB4srRECvmksi/P3UfTkgiMbiUEDvwLLXkPdfaGHcwAp6LWa8mFRUAz5E08hx/7HSPD0ZpmkwyNguB7RR+aWTz9RDw8QE7JKQMzJXFWr8CTtUZo3IEyvd66FipladhZ7sN5sv9nAXUFhs7ILuzNzh1AYUgEsfeDcuBhR2PaT3FUhSCAefSsC2IB6Wg1gA9fSX1z74KFYcGi4kW66mc1GyELBQxbvOSaPp3psMYIi6Re2MNc5Wfc7/KJ3tuEliniN7++4TesSP12MSuzzNYDgNmyT2RUTyuIpiMbV2J6lDbS0Q8SXJpjK1WuuK+UKBaz1H521mEeYRgxVrGw0DY+mY2vBIo/Xlh0eTXVHGO7LXYDxuc77gguMyMC; 4:md4WykdEcRUqUIvilSGkXzf62Eqrq9d2b95Mu4tRJN8knVq7PMuaCk3Vl2Y12M2/eCXlHV3yGrAhkVBYiDsz2xVOC1/hskXdH+SYT0He230kdaTZJutEO3yctNuS6do1zKjDvC+WktUYz3GvVkMo3rIDyQ2eXtbc4a8Yo4VKpf7qN/U8qo2E+Z0xeiZ5H9bb5pjQ12N91+klsF42fV4i4OVblnT4aFRCYG68VKpvoLK+9XQzPXg2DNUlKQvKQ8POpMMCkvrG4NiaSBRTe54O0RGXgGXaJuHfujRwL5M/RSWBdj2dEyFpc1TmgdHNfite 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)(575784001)(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?MTtETTVQUjEyMDFNQjAwNzU7MjM6SGFOZkVPcmgyWHYvd2JoWkJ0V0IvVHMy?= =?utf-8?B?QUJZWDA0R1BxRG1NVGdLa0pBWE9pRFRYRlhZTitrbDF5aldSQ1pJdGk4Nkh4?= =?utf-8?B?MVpiaEozaEdFa2hnZUgwNG1ReVlHQk1LTnBmS1NMM0dhU0tJRkpkN1hYNU0y?= =?utf-8?B?WEZLUVlLSVF5aEpXZkFlUjlnL2lXTU1nWWtDL2tOYzlxRW43OTFQc2hQS0tQ?= =?utf-8?B?aThuY2luNGlFUUhLdFlIeXJFbURlWHpjZHByREJSWnZPQ1I1U0RjUDRySEc2?= =?utf-8?B?aHVURFRiMjMwY1NpSGZUblA0d00raEpSS3dKRWpvVVN3c3lMLzkzb2lZNW9p?= =?utf-8?B?TzE1Z24yRWkvYkJwL2t6Y1lheGVHYTZ3QXRObjE4QzkzZDJGQ1J2UTRON0kv?= =?utf-8?B?MVk3YjN0M2hucXRDQjZNZmlYdENoTUo3NmFMVlNvSWdpVitRUkRKbnZDNVRt?= =?utf-8?B?TDFaU3MzRGw2MVNQSjZJSm9lNmUwL204VnU3SU9sRnhTU0pqTmNacFRVaDN4?= =?utf-8?B?YWlEdkd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7sl94ZOe0n3HVwcQfvLIxnmjw9JdaTKyC4EpTElXXF5tR0689m7cMdtcABzViAcpPeB8yaJYR97VpjPFih5TJZy5gtK2v3Be233VbQjZNxuAugaMwU10LZXc1T/G8vnLHt7cfC4mNSp2CT1D798SpZvIUmL5WgJkFLMBEJsc/+Qmg4qRlypeVgUrLWHy2ttiBP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0075; 20:fecu06JyaJ6Dv3G/CpsXGFIQ9Q7sO0mlQC4oYYCGtHPcAuZNT77r42QhVE9E/QW9Gsnr2dTz2ZTPy3H7PlagOanK0zM6RPRcQww0bcRK/GHQOrVfn9Gln1KzpHGOkYaWY4QQRR3XKVdDwzQC0PBM+iykwGEKkQ4folKdZ5JPXA72OfqHbm7XQlNSq2VTsWPer+Q0bvFCoVSMC8wCd3sWyuEl5dc0cgviBXmHFIi5fqUHCXHmm0FVMBNrxwuPrS7x X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 13:55:33.8605 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1195d5e4-61fe-4cb9-ac3d-08d5671ff7ff 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 Hoist the comparison of the ret to -EDEADLK above the two code paths to simplify the function. Signed-off-by: Tom St Denis Reviewed-by: Christian König --- drivers/gpu/drm/ttm/ttm_execbuf_util.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_execbuf_util.c b/drivers/gpu/drm/ttm/ttm_execbuf_util.c index 373ced0b2fc2..fa44f7b15285 100644 --- a/drivers/gpu/drm/ttm/ttm_execbuf_util.c +++ b/drivers/gpu/drm/ttm/ttm_execbuf_util.c @@ -139,12 +139,14 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket, */ ttm_eu_backoff_reservation_reverse(list, entry); - if (ret == -EDEADLK && intr) { - ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, - ticket); - } else if (ret == -EDEADLK) { - ww_mutex_lock_slow(&bo->resv->lock, ticket); - ret = 0; + if (ret == -EDEADLK) { + if (intr) { + ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, + ticket); + } else { + ww_mutex_lock_slow(&bo->resv->lock, ticket); + ret = 0; + } } if (!ret && entry->shared)