From patchwork Fri Dec 11 13:37:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 7830061 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F042E9F1C2 for ; Fri, 11 Dec 2015 13:50:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0A0A20499 for ; Fri, 11 Dec 2015 13:50:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 568AE205BE for ; Fri, 11 Dec 2015 13:50:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 055FD6F04B; Fri, 11 Dec 2015 05:50:30 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2A0A6F044 for ; Fri, 11 Dec 2015 05:50:28 -0800 (PST) X-IronPort-AV: E=Sophos;i="5.20,413,1444687200"; d="scan'208";a="191573466" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 11 Dec 2015 14:50:02 +0100 From: Julia Lawall To: Subject: [PATCH] ttm/drm: constify ttm_backend_func structures Date: Fri, 11 Dec 2015 14:37:47 +0100 Message-Id: <1449841067-3718-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ttm_backend_func structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- drivers/gpu/drm/ast/ast_ttm.c | 2 +- drivers/gpu/drm/bochs/bochs_mm.c | 2 +- drivers/gpu/drm/cirrus/cirrus_ttm.c | 2 +- drivers/gpu/drm/mgag200/mgag200_ttm.c | 2 +- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 4 ++-- drivers/gpu/drm/qxl/qxl_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/ttm/ttm_agp_backend.c | 2 +- drivers/gpu/drm/virtio/virtgpu_ttm.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 2 +- include/drm/ttm/ttm_bo_driver.h | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c index 9fd924c..a323422 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ttm.c +++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c @@ -319,7 +319,7 @@ static void virtio_gpu_ttm_backend_destroy(struct ttm_tt *ttm) kfree(gtt); } -static struct ttm_backend_func virtio_gpu_backend_func = { +static const struct ttm_backend_func virtio_gpu_backend_func = { .bind = &virtio_gpu_ttm_backend_bind, .unbind = &virtio_gpu_ttm_backend_unbind, .destroy = &virtio_gpu_ttm_backend_destroy, diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index e343074..9fa758c 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -666,7 +666,7 @@ static void radeon_ttm_backend_destroy(struct ttm_tt *ttm) kfree(gtt); } -static struct ttm_backend_func radeon_backend_func = { +static const struct ttm_backend_func radeon_backend_func = { .bind = &radeon_ttm_backend_bind, .unbind = &radeon_ttm_backend_unbind, .destroy = &radeon_ttm_backend_destroy, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index d4bac5f..befa9c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -634,7 +634,7 @@ static void amdgpu_ttm_backend_destroy(struct ttm_tt *ttm) kfree(gtt); } -static struct ttm_backend_func amdgpu_backend_func = { +static const struct ttm_backend_func amdgpu_backend_func = { .bind = &amdgpu_ttm_backend_bind, .unbind = &amdgpu_ttm_backend_unbind, .destroy = &amdgpu_ttm_backend_destroy, diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index 08f82ea..5840785 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c @@ -203,7 +203,7 @@ static void ast_ttm_backend_destroy(struct ttm_tt *tt) kfree(tt); } -static struct ttm_backend_func ast_tt_backend_func = { +static const struct ttm_backend_func ast_tt_backend_func = { .destroy = &ast_ttm_backend_destroy, }; diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c index d812ad0..b5b782d 100644 --- a/drivers/gpu/drm/bochs/bochs_mm.c +++ b/drivers/gpu/drm/bochs/bochs_mm.c @@ -180,7 +180,7 @@ static void bochs_ttm_backend_destroy(struct ttm_tt *tt) kfree(tt); } -static struct ttm_backend_func bochs_tt_backend_func = { +static const struct ttm_backend_func bochs_tt_backend_func = { .destroy = &bochs_ttm_backend_destroy, }; diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index dfffd52..da88541 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c @@ -203,7 +203,7 @@ static void cirrus_ttm_backend_destroy(struct ttm_tt *tt) kfree(tt); } -static struct ttm_backend_func cirrus_tt_backend_func = { +static const struct ttm_backend_func cirrus_tt_backend_func = { .destroy = &cirrus_ttm_backend_destroy, }; diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 05108b5..e368562 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c @@ -203,7 +203,7 @@ static void mgag200_ttm_backend_destroy(struct ttm_tt *tt) kfree(tt); } -static struct ttm_backend_func mgag200_tt_backend_func = { +static const struct ttm_backend_func mgag200_tt_backend_func = { .destroy = &mgag200_ttm_backend_destroy, }; diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 8c3053a..3b8f556 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c @@ -51,7 +51,7 @@ nv04_sgdma_unbind(struct ttm_tt *ttm) return 0; } -static struct ttm_backend_func nv04_sgdma_backend = { +static const struct ttm_backend_func nv04_sgdma_backend = { .bind = nv04_sgdma_bind, .unbind = nv04_sgdma_unbind, .destroy = nouveau_sgdma_destroy @@ -82,7 +82,7 @@ nv50_sgdma_unbind(struct ttm_tt *ttm) return 0; } -static struct ttm_backend_func nv50_sgdma_backend = { +static const struct ttm_backend_func nv50_sgdma_backend = { .bind = nv50_sgdma_bind, .unbind = nv50_sgdma_unbind, .destroy = nouveau_sgdma_destroy diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 0cbc4c9..93dc45d 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -288,7 +288,7 @@ static void qxl_ttm_backend_destroy(struct ttm_tt *ttm) kfree(gtt); } -static struct ttm_backend_func qxl_backend_func = { +static const struct ttm_backend_func qxl_backend_func = { .bind = &qxl_ttm_backend_bind, .unbind = &qxl_ttm_backend_unbind, .destroy = &qxl_ttm_backend_destroy, diff --git a/drivers/gpu/drm/ttm/ttm_agp_backend.c b/drivers/gpu/drm/ttm/ttm_agp_backend.c index 764be36..5fdaba5 100644 --- a/drivers/gpu/drm/ttm/ttm_agp_backend.c +++ b/drivers/gpu/drm/ttm/ttm_agp_backend.c @@ -104,7 +104,7 @@ static void ttm_agp_destroy(struct ttm_tt *ttm) kfree(agp_be); } -static struct ttm_backend_func ttm_agp_func = { +static const struct ttm_backend_func ttm_agp_func = { .bind = ttm_agp_bind, .unbind = ttm_agp_unbind, .destroy = ttm_agp_destroy, diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c index 3329f62..d59572a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c @@ -683,7 +683,7 @@ static void vmw_ttm_unpopulate(struct ttm_tt *ttm) ttm_pool_unpopulate(ttm); } -static struct ttm_backend_func vmw_ttm_func = { +static const struct ttm_backend_func vmw_ttm_func = { .bind = vmw_ttm_bind, .unbind = vmw_ttm_unbind, .destroy = vmw_ttm_destroy, diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 813042c..c43efa4 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -113,7 +113,7 @@ enum ttm_caching_state { struct ttm_tt { struct ttm_bo_device *bdev; - struct ttm_backend_func *func; + const struct ttm_backend_func *func; struct page *dummy_read_page; struct page **pages; uint32_t page_flags;