From patchwork Mon Jan 29 13:55:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 10189749 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 714406020C for ; Mon, 29 Jan 2018 13:55:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F13D209CE for ; Mon, 29 Jan 2018 13:55:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 525E122299; Mon, 29 Jan 2018 13:55:59 +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 DA9CD209CE for ; Mon, 29 Jan 2018 13:55:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE95E6E4C4; Mon, 29 Jan 2018 13:55:33 +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-bl2nam02on0079.outbound.protection.outlook.com [104.47.38.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25ACC6E4C1; Mon, 29 Jan 2018 13:55:32 +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=eOdvVopM0hk5UKgPWWv/j/utn/4MXInXtmtas5alRxM=; b=3uSlwdr97gTaV+VTr+bO9WflcPLpkUakdCEdZOmaySXQpv3F2FBbEaU/hREaXHXR2hTwG2xIuTrdsJ14wo2C4yJ+gfr/d9MavwJ7ro42NjE7GHkNI2BGFxEzDKamNJOjz8JYk0r2/NWeAOwoIJPnASOwfSpbyoRy6Dy3+knWEDo= 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:30 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 06/12] drm/ttm: Simplify ttm_dma_find_pool() (v2) Date: Mon, 29 Jan 2018 08:55:07 -0500 Message-Id: <20180129135513.22538-7-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: 7b5d6765-0255-4f6b-110c-08d5671ff61e 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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aWtvm8CJBbQg2XIUR0wNrwSF0xFi7kBvO3+gnbtmJlMHGH9qWj2/epmDzXhru66ryJIYmiBhFOgdyri3yAQ7OXZSnI7Xo3OfFnLyxx/cKe6x5mPae3rKsQHmwNoyz/VHZv189NCR15YmenQpiCXvow41WtUkqc1nUFyF1utgtizogbcbo2tNgaMnQVHqtAkNdjdrlnX2BGOpHl4+FWygQExg5q+ow9RlCMGolId0UWp8u/yz2xzCNSLgyHDKnXa9ZBp+7W83unYkSM+9RfOyZO/UKHJPAsAvT5nVYUAFpABSZ1SUIqD0Jnn0OOiTnAH8aY46B25UEuEp//zVcmARm/JLaH1bfKz53sU6GIy9ryH; 4:EszScjZexOWyJE+uFYtVUtCXFoEQnZVbNnR2HuAMyo+MaZxyrDTtbXJgfVtdJ05gaNGjL/3UAN8LvBEZWr1HHRfTPpR902bYofIyhsKGUwtc7HsCMT7lSE88TyBr2fjgvksDNGdYRkaJEKAZYfs8sXsxL8kwtUZQd0AVLjhwXqrVVs8tknSoNbiTP71C3Dd4ZvEwzHzADUiiOcMUg9SPGcbDSL/kgmY1Fse6xYVceCG0NccywruJkRK7wkrawkK0qyiMJU1n7jELkng5XgdyB07jTkfHAgm17GKVItSewCShUxwZD551biHtF0R2eQ74 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)(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?MTtETTVQUjEyMDFNQjAwNzU7MjM6WjZNYUI5SzJYYnpxTUoyMGUxd3Q4cm9o?= =?utf-8?B?Y1JrZ05mNlh0OExNS1Q4OFdsSkUvWlN5ZnpDUXBENU4wSGk1Wk1pdm04OFB5?= =?utf-8?B?b0hXQ3NzcHhja0puaWVBeVFFU1NkTXpsVjVNTFZXcU81YkdtL0ZzSEU0VmFl?= =?utf-8?B?Y29YVVlVRE04Ymx2Q0pMVEVjbTRVbWRZbzlUcVhCdGY0NFQySmtINnYveUVp?= =?utf-8?B?Y2FsTnhqR2gzQ20yc3JNcXE3ZW1FZGZDQ3htWHFaSG5LSWVBQTFFM3dYNXps?= =?utf-8?B?c1E4dkRrbFA2N2V3VU1sNS9Dc2U1YWw3alZTR25ndWtrZ2JhdUVZYTJVeElN?= =?utf-8?B?a0xGdW1uVXVjRWcyZnlKczhQMVpmQU1rK0MzWmtzVzF5WGpSTEd6MERWSVZh?= =?utf-8?B?L0U1Z3ptaVZBOSt4emxqYjNyY0NZcVFNVG1KSjQrdFY3OXE5d2RobDhnTTl3?= =?utf-8?B?dGV5Mzh0aTdOVkF4QklyU1U3TllIRDB5ZG02eUZ2R2NWd014VzNZVzFkcXRH?= =?utf-8?B?bmw0dEh5Rm9obE5COGh6K2xleGRDMkJRaGRRdVlXR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0yJ+4hGRmP8Jk9gpJB4EYJiOm7eRnnx5MxB1fL1G42F6He5ifCQXC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0075; 20:32TrsNpOPLF0x0P5XTvBR2Z7YDQlfwy3R0zPQdMIdSAwOxAGJekLmrUcUKd/D7IRRY02OrJMamkBdnhbVJ3Gr7q6c02Ev/k69W5cC/QhXGmxyyTtASoxtjSXmv7APro1TIAq/cACmBo/XQaodD6P80Qu09LW4K6H55hxcG6oBUwNSh8ckN0Esyk/7DPQMLyZsnA0cAknRNCARfRrXnq/KzSme0+rtKnuXwTEEf+vXQ3mOsQiLbCOglu6KkhQ0tVA X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 13:55:30.7043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b5d6765-0255-4f6b-110c-08d5671ff61e 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 Flip the logic of the comparison and remove the redudant variable for the pool address. Signed-off-by: Tom St Denis Reviewed-by: Christian König (v2): Remove {} bracing. --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 647eb5f40ab9..469e68e06be6 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -682,10 +682,10 @@ static struct dma_pool *ttm_dma_pool_init(struct device *dev, gfp_t flags, static struct dma_pool *ttm_dma_find_pool(struct device *dev, enum pool_type type) { - struct dma_pool *pool, *tmp, *found = NULL; + struct dma_pool *pool, *tmp; if (type == IS_UNDEFINED) - return found; + return NULL; /* NB: We iterate on the 'struct dev' which has no spinlock, but * it does have a kref which we have taken. The kref is taken during @@ -698,13 +698,10 @@ static struct dma_pool *ttm_dma_find_pool(struct device *dev, * thing is at that point of time there are no pages associated with the * driver so this function will not be called. */ - list_for_each_entry_safe(pool, tmp, &dev->dma_pools, pools) { - if (pool->type != type) - continue; - found = pool; - break; - } - return found; + list_for_each_entry_safe(pool, tmp, &dev->dma_pools, pools) + if (pool->type == type) + return pool; + return NULL; } /*