2017-07-02 07:41:17

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] drm: ttm: virtio-gpu: dma-buf: Constify ttm_place structures.

ttm_place are not supposed to change at runtime. All functions
working with ttm_place provided by <drm/ttm/ttm_placement.h> work
with const ttm_place. So mark the non-const structs as const.

File size before:
text data bss dec hex filename
2315 184 0 2499 9c3 drivers/gpu/drm/virtio/virtgpu_ttm.o

File size After adding 'const':
text data bss dec hex filename
2347 152 0 2499 9c3 drivers/gpu/drm/virtio/virtgpu_ttm.o

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/gpu/drm/virtio/virtgpu_ttm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ttm.c b/drivers/gpu/drm/virtio/virtgpu_ttm.c
index 4e8e27d..012d5bc 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ttm.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ttm.c
@@ -234,7 +234,7 @@ static int virtio_gpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
static void virtio_gpu_evict_flags(struct ttm_buffer_object *bo,
struct ttm_placement *placement)
{
- static struct ttm_place placements = {
+ static const struct ttm_place placements = {
.fpfn = 0,
.lpfn = 0,
.flags = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM,
--
2.7.4


2017-07-03 09:48:10

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [PATCH] drm: ttm: virtio-gpu: dma-buf: Constify ttm_place structures.

On Sun, 2017-07-02 at 13:11 +0530, Arvind Yadav wrote:
> ttm_place are not supposed to change at runtime. All functions
> working with ttm_place provided by <drm/ttm/ttm_placement.h> work
> with const ttm_place. So mark the non-const structs as const.
>
> File size before:
>    text    data     bss     dec     hex
> filename
>    2315     184       0    2499     9c3
> drivers/gpu/drm/virtio/virtgpu_ttm.o
>
> File size After adding 'const':
>    text    data     bss     dec     hex
> filename
>    2347     152       0    2499     9c3
> drivers/gpu/drm/virtio/virtgpu_ttm.o
>
> Signed-off-by: Arvind Yadav <[email protected]>

pushed to drm-misc-next (qxl patch too).

cheers,
Gerd