Message ID | 20180129135513.22538-4-tom.stdenis@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> 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 DB72A6020C for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 29 Jan 2018 13:55:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9AFC209CE for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 29 Jan 2018 13:55:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE0AD22299; Mon, 29 Jan 2018 13:55:39 +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 625EA209CE for <patchwork-dri-devel@patchwork.kernel.org>; Mon, 29 Jan 2018 13:55:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 505CA6E4BB; Mon, 29 Jan 2018 13:55:31 +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-bl2nam02on0044.outbound.protection.outlook.com [104.47.38.44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 936166E4AA; Mon, 29 Jan 2018 13:55:29 +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=UgMxmjBFLjxhRa5Y6i3EADCScoCaDVdiIp3Z7K0qEwI=; b=ZnZlkYac/cx+9am/uhjWqqf3VWmRApcS0hMSAFNEkz0j7ucaSc1JQ9mALygCRwUcG3ek+W1xnZwJmPMEbJhKVLWjzTg6NbXfT5yG0OBPf6IaNekq8bl6laN3pKPoqbP3KIqYpvC1effGR4k82gYKXV0NYVh9Xoa3tluMIOfeM5k= 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:27 +0000 From: Tom St Denis <tom.stdenis@amd.com> To: amd-gfx@lists.freedesktop.org Subject: [PATCH 03/12] drm/ttm: Add a default BO destructor to simplify code (v2) Date: Mon, 29 Jan 2018 08:55:04 -0500 Message-Id: <20180129135513.22538-4-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: a7fee157-340b-422a-ff32-08d5671ff445 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; DM5PR1201MB0075; 3:MmW0nTJWORy/BOYFGBhXvBjcDZ03noRaI6yQuTOdHPSsfuIH3BFvocUI8DVCokCJVgC+lqDm171sM3rTSLsx9entajFhRH6HwsapGqDEZ2F4uRfAy1nzfj0UGUiwLOsa6PU57Bdk+W3mewrdve5PqXEwM06MZH8tLMrhHj6IYH9vZm6m2FxV3Fu/VpxHkHwlUFQXcS+HFB+HqdQCoc4edSUr9H9gryl5jKpMDJNIh/fTgDSnsf8igDTuRDMI5tWC; 25:IsQagKS/4wm5fzzOns5DJKOMGhGKDXyypVdq5wWZIf//O4ZwE0weHFPWi1PYfEeNjH7NTd676vDvlsCZpkmewJBxCicxDMYD6XPXaK12gQzeyZPUa+nOFRNo37+5ldAOWgR2AeLkgNro43XZ9QUQRv/fC4jRFnvP3FTOkJEruGuIXMDynfFI+t4wVXkQMlLIlecUeNrw5hDG8XScPXO3AphVpTxM33B0CZxT+HirG5bkJ8lJ9zMUnt8yGRndiuWfqzWsS2GCV2i7Hk+NRlOwOEaVwx1MKDaksplJm9vp9BII/FupJJtzvd3/srGdgjUQxdiUrrL+vCPrblq8KqVDzQ==; 31:nkv5puvPotSVKpF0MZFjabFnSWleMWTrIjkg9S1uw9jUqloToCO4zHDZhRdo03Q5Jqn0uiVJ+0TBwOa/flTsepswT3LZnWRdHVTCBLCPdZ/fcTO9SKGEfNjquYOWoXaEJ79hhedNtYcIMaMGC1ncqBmr1Cy3LPDCsvVILzAr+bH3Or3oM1uyPm3QKN9cNNaBn7LZcsC+uj6oTqfprfxrFlxzeYz9XKzy2dCD1VJ2zpo= X-MS-TrafficTypeDiagnostic: DM5PR1201MB0075: X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0075; 20:0LCzL+t+nqR84//g+uNA4/0iwWBDJdnaIfY3/2SAyYV1nvG31AVbCQPLkqAPb9YRzG7uyYO4g4/kymmnsjLS0J58sa6Q77sZFqt1jKyxJUrmJ5X/rqywo9a1nIg8fBo0EP+4V6XeukwCS1xHNQ/zohpeV4y4EIRkhc9U0aO8EhIycxUxBFbLhrYH3wLqzECPogtdwqQpwoArbr7o4wdTDGa2Ey9+5WKJSqk/124zD9lzy1myDr62xgve5W8vIT1KKM90PtV7MbSth0R4iwpLM66yOr83JPFf9gH/4THlSzE/Rz0tcwO+GXdVN9QjHrOKUZ5Tvw9TilRvqlZDonuC99ZUwtvkvG+yDTu/e8oG1BBywgoPWzt/nhU+IyPtEjsorSr+2pfUzr5KtokV24xxyKYfU8VRb4P399swogmQqRGtbu+ZQ68kS2EZnLTMpjOFhxCYdf342pki9sbOuRY+XxjgQaBeEprmcfVPzTC+wf4eah1AMO88FPhjmI8eyhbi; 4:BXwGqzGVbVLUhxBmN8APvgRzpQhY3u852SZH7iK/oKRNdWYo5eHDX7u1oGnVpupxCdva3hRaWBv5Nv8v2D5V07PRFaQ1eaA8i+I3EDTjliJyN7aEBqXGKJd86HNlJWuRaYY7dGHd9Nm4e5w1J+AirrMtkdsouWT87ozCP+fduaDGQuDqaMN9O1rcWQbYaSK0lEB9jTqKgQburDQUphechLDoVsc6aHQdRFXmcrwZuQWRWZywcylOcFicVnwmlNrQiVparO56SWB/QSgiv1+Tx6iIbr6cevs2w9f+YW83f5U0psM+VFZmJ+qT2liUgbqw X-Microsoft-Antispam-PRVS: <DM5PR1201MB007507720E91A809EBEE832CF7E50@DM5PR1201MB0075.namprd12.prod.outlook.com> 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?MTtETTVQUjEyMDFNQjAwNzU7MjM6dVdIajBUcGFSeXZiSTJyR0NCVXdBaVZq?= =?utf-8?B?V1BQVkVObGxYVjZpZGR2dmJvMDJ5K1RTblBFa1VXQnFFdERBSEtxWXBVdXps?= =?utf-8?B?eXJkUmo0Nk5YUUE4NlFSbWZvZndMdmJHbGdyS3BGeTFpMGhYS1FuT3Nra0xY?= =?utf-8?B?Z00yaUM1NVlCNXFuTjAyMm5QZTdtMU96S1JHY2wzRjJ2VDRaSWl4NmJhclZv?= =?utf-8?B?Ti9wcXhSQVdKcjNqVmkyZ2FDWWhaOEJVa0tjNWJPRERmeFJYVU1jRUxwVmxV?= =?utf-8?B?VHVFNjlsdlhSYitMS0pzeUNvZnNTT21LR05WcEFyNEJ6dXFjWDBkUW9NdVJK?= =?utf-8?B?a2tubnZ6d3VVMTIybWVheHByNVRmdzhTVEc3WVh1c2dwYVJSNmtBMWQ4dVN6?= =?utf-8?B?Y1ZGK2o5ZnZKT1ZyQnE0a1E2akJsZENvSmZUaGFRWXNWdDFxaEtkbnNpS0xD?= =?utf-8?B?VGJxT2N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/iqX6TfqOGIw6jFplyRGJPqGy6KipZENSIy/sfK4uHtTzjQbFuI0vjXPVHUQo2MaTkJoXCaDAxZg4sXOggqVsT2s0izZW5I/E5imdmANVQNqJpJlHhbqlM+8gGy6XIrFhlZgW9BEieb0DT69wIyqTWx0TTYaZSmEaxHnkQRsTgYXy+Um+UhREKurju+OG/imvJSzkVGt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0075; 20:bCuIrfGG4Dkja5acyZjYyOwH0q0tcFYXhSdZdkLHfsHiY47p3Y4e2K/meXjscuO4vJsUrd3QGYl059ns79wq39PDsi5dRrL+vxRtaDMAOi8YUqRcSVcJp5hMT9veZnI0ntRBlpvm9qnxILW/dW73ZNagxtc5ktN1q03eJYx1MLXa2rjEk7Vnt+iiDq6BICZaZhvPJliiY6tgNq0CRtfH2wEcEho0njt128LHyZBQdoqOZpjFzWxxViiK+WThiYAh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 13:55:27.5949 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7fee157-340b-422a-ff32-08d5671ff445 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 <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: Tom St Denis <tom.stdenis@amd.com>, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 8cf89da7030d..d90b1cf10b27 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -49,6 +49,12 @@ static struct attribute ttm_bo_count = { .mode = S_IRUGO }; +/* default destructor */ +static void ttm_bo_default_destroy(struct ttm_buffer_object *bo) +{ + kfree(bo); +} + static inline int ttm_mem_type_from_place(const struct ttm_place *place, uint32_t *mem_type) { @@ -147,10 +153,7 @@ static void ttm_bo_release_list(struct kref *list_kref) dma_fence_put(bo->moving); reservation_object_fini(&bo->ttm_resv); mutex_destroy(&bo->wu_mutex); - if (bo->destroy) - bo->destroy(bo); - else - kfree(bo); + bo->destroy(bo); ttm_mem_global_free(bdev->glob->mem_glob, acc_size); } @@ -1176,7 +1179,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, ttm_mem_global_free(mem_glob, acc_size); return -EINVAL; } - bo->destroy = destroy; + bo->destroy = destroy ? destroy : ttm_bo_default_destroy; kref_init(&bo->kref); kref_init(&bo->list_kref);