From patchwork Fri Jan 26 18:29:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "StDenis, Tom" X-Patchwork-Id: 10186717 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 ADAA160383 for ; Fri, 26 Jan 2018 18:30:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E9A7297F7 for ; Fri, 26 Jan 2018 18:30:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 937D829C0C; Fri, 26 Jan 2018 18:30:00 +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=BAD_ENC_HEADER,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 13642297F7 for ; Fri, 26 Jan 2018 18:30:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F9606E73B; Fri, 26 Jan 2018 18:29:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0081.outbound.protection.outlook.com [104.47.34.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 67EF76E66B; Fri, 26 Jan 2018 18:29: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=twjGROzxVzQyShurs1/QiN990Ax4gYP3rI1+8XBwhQA=; b=ho/lp9yYmEPUZy8OGFpKPttqE/cC+mITEQOpJIM+SUyGSMYRg/GxsOMwqonddtbWydMu1mN+SdlJdH8b0sh/RSlaHwjYf/ypuH0xmzvedgU761ro9jw0THvcUoNkei+h/p05HdiUM3AoKuQ2UVc6vl7pFH3lKqMhyXY5od4LcFY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tom.StDenis@amd.com; Received: from fx8.amd.com (165.204.55.251) by DM5PR1201MB0076.namprd12.prod.outlook.com (10.174.106.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 26 Jan 2018 18:29:30 +0000 From: Tom St Denis To: amd-gfx@lists.freedesktop.org Subject: [PATCH 07/12] drm/ttm: Simplify ttm_dma_find_pool() Date: Fri, 26 Jan 2018 13:29:06 -0500 Message-Id: <20180126182911.20761-8-tom.stdenis@amd.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180126182911.20761-1-tom.stdenis@amd.com> References: <20180126182911.20761-1-tom.stdenis@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: MWHPR03CA0027.namprd03.prod.outlook.com (10.174.173.144) To DM5PR1201MB0076.namprd12.prod.outlook.com (10.174.106.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 71a43709-a222-44cd-026b-08d564eabdbd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:DM5PR1201MB0076; X-Microsoft-Exchange-Diagnostics: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fu6Juoa0uwGIjfzzIZ7h2cE9cxhTNd5KwtNNvR8w+rS6QU/GfWhc23eF5B7Jw6H3ZhxARaifWGMGO8c2IqqFF0Gvw5xqGFxJhN92oPAALHtIouTAMnpnx+g1UDGkoeHbS178Vbssilb1KP/bbcb0bnK74eap9li6loPqEfyQ3BEof8tji6H9uDzlvw4H0kw1eelUSXEwodLSO0qFZ1BsA1v1Q01KK+2LiVilbXF55HNlMh+33Re8taiNNW0o6A/5Ql1TGMkrh1XFTI0Fv11uwIBgCOS6N0eYstGKX5r8zVk85izwJeNs5W46KCVMl8Zy2EXnw/thW2OD+STPalu3qaqC/nV/YDsUWLbylhk7Mvyux; 4:Hlonp8AFuEq6X295Pq00tjFWu3bovufK31Mw2xsTd0xUBkbxkvLFrDx1uctY2kxPAzFUJxLqcBRpRYIbxtRwMm6BTvkveIs2up3k8sp3/Ta4UkhWs3t2XJip7hGmBisda55drLWOfnt0/NuFrmf8rRB1S/ZQcUQNYkpVqYweMe745ybtTDoQdbBGNPQnXB3OPcc1cCgwp6cIoNZM5G90TP28OGsUtu96pDIBbLBw2WTRCMB8k0JIt+ZLnb2AgNeTEqzuT9g5VDlOPAsCpsJP3qjpvXHyMI8ZcG+7Y7Hd/8HWwzPVgoGXgT0g50s+Z6jx 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)(3231075)(2400081)(944501161)(93006095)(93001095)(6055026)(6041288)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DM5PR1201MB0076; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0076; X-Forefront-PRVS: 05641FD966 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(376002)(396003)(39380400002)(346002)(199004)(189003)(6916009)(2950100002)(6666003)(7736002)(305945005)(5660300001)(1076002)(6486002)(6116002)(3846002)(53936002)(86362001)(51416003)(16526019)(81156014)(7696005)(52116002)(186003)(26005)(8676002)(97736004)(386003)(50226002)(53416004)(76176011)(8936002)(81166006)(25786009)(36756003)(316002)(478600001)(72206003)(47776003)(50466002)(68736007)(16586007)(48376002)(450100002)(66066001)(4326008)(2361001)(106356001)(105586002)(2906002)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0076; H:fx8.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0076; 23:gVk4aSE8J1H7P+dDiPd+J/GH5QjUcNX2Hywd5hc?= =?us-ascii?Q?ATyFJQlwFYmBF1u7zgUHOgxXB0LzBQte7zZgAQaqTHtH1cZMKzjmiBk5n9Cr?= =?us-ascii?Q?BzMtxHEmH6gscsxUOmlBQLn0qG7eLJGlqwtyf/jc0M/muhTTjo1ueBb3P6+x?= =?us-ascii?Q?ZfHzaPaIZ6KxLiPrDVxZZJM89scjJBQ7vnDqJJqsX4zjGiFuil7EpIZcCNKM?= =?us-ascii?Q?52UPbp+KHJTkra+dK1R8AqCJ57BAncbKYp2dgxQsPmBGj8yuuJ/h+v8GdwLI?= =?us-ascii?Q?sZZ6QLHvjxW6NdnpqbO0OeS3315e5MorPJb6xqFBuaZUbseCCEK8dNhSufLy?= =?us-ascii?Q?lnmv2U04Vo5LGqKXGaLI8pDurLxyZcZk6caZaaGISyoJyPk88VTuhI5SHMQc?= =?us-ascii?Q?KQps5FhNw84p0/lf3u6Q6i5RCi/e8x0ml5d11sV5pT7N+KS/fQQH+WDOhXNq?= =?us-ascii?Q?G9Y+Kt66w4cKbItiocia7Yp4WPlZQxM3XC/rX6rJZ+mnWtc4AW1PnL4fbQqz?= =?us-ascii?Q?W9LAMz9HPn+8abX0+lvffRvOlSgP3K2bZOvMKOSkNmcS2OhOuF4wEi80xKRR?= =?us-ascii?Q?JbS+GhjII79Vul4XfzIFCm/gvg5UIf8R/wLVaqmIzPXNnIQd+KGesI2LdLQG?= =?us-ascii?Q?z/PtdSywQWWXXQH5YPMe+HPoEdtpumcR24l2c+jD91Mo/DcRK3yaWy3zqSjv?= =?us-ascii?Q?UdQNrYBukxwmof5h28qvP6CN0IANNlm2hzUj51TczbvqE+Q8Llw3knUAa52O?= =?us-ascii?Q?Oy8oMOlOz9pnyH7FssI//S0xTfdf2CYK2pXyELc2oasOK1KT1XcRq2laKhTG?= =?us-ascii?Q?Lz9auwOCs63ZkI7b578EtrC4qhyBSyi3Ckf0MYvGxRC3x5Gf0xvKYAsJPXr3?= =?us-ascii?Q?4HPlNTf+UfWvq8rde98k7hrMF/hmywQMErR1jGSgNlWp47WvQIWgNACMivB6?= =?us-ascii?Q?aGHiuLNtSSpXFTMGwnz9qed1vA19AHmSwl4sADkE71IPNKkuBWAI5s050kms?= =?us-ascii?Q?wKbRVG/iGLLT3dM3VW62ldk3PU9BDHXpC/y5LcxhoOyvVr37fncs02iYO9au?= =?us-ascii?Q?7RTdwkwdnM0xrBlFj1thnXum1s6zq8vMjn2Z42IDbps0w5PlR+9+qgG9gHgD?= =?us-ascii?Q?bGe+g2EUrYbSGC9tj6W563zAMUAkO2/R+LW73B84Fo+KVF78WN7+XTdlmeqE?= =?us-ascii?Q?PtifGoqzVZUjb2eL2i8ziEzqvJrbNnzzUlwBC?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0076; 6:9yMjJ2ZOvwWIiYyatOfDO49k15vNYqRO55cDeu/jXO/o47426RaI9D0tDL8ijnyHKfqj5lVj2f4pkUBRjrZWa+dpDKwLE7PUoXKwKcyOSjOI8A+5Xg0tFeoFVBR1gIDFiqrqMaRGe4VGtyDlRsOlQ2YT5GC2vg6bbFd3q8Cyt5XsBhK1pQ8J27ProEHptr+q4gWyCzHNUCP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enant-OriginalArrivalTime: 26 Jan 2018 18:29:30.5105 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71a43709-a222-44cd-026b-08d564eabdbd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0076 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 Signed-off-by: Tom St Denis --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index 962838cfb1a3..579c4aedc17e 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -680,10 +680,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 @@ -697,12 +697,10 @@ static struct dma_pool *ttm_dma_find_pool(struct device *dev, * 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; + if (pool->type == type) + return pool; } - return found; + return NULL; } /*