Staging: android: ion: constify dma_buf_ops structure
authorBhumika Goyal <bhumirks@gmail.com>
Sat, 15 Oct 2016 06:13:48 +0000 (11:43 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Oct 2016 07:46:58 +0000 (09:46 +0200)
The dma_buf_ops structure is stored in the ops field of a
dma_buf_export_info structure and also used as a condition inside the
if() statement. The if condition does not modify its value and the
ops field is of type const struct *dma_buf_ops, so dma_buf_ops
structures having this property can be declared as const.

File size before:
   text    data     bss     dec     hex filename
  14471     819     224   15514    3c9a
drivers/staging/android/ion/ion.o

File size after:
   text    data     bss     dec     hex filename
  14599     707     224   15530    3caa
drivers/staging/android/ion/ion.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion.c

index 396ded52ab70242b8b3c069c52cc7fed2c44624d..45eceea449e4a6bf9da4a207438610d8f2bbfc68 100644 (file)
@@ -1013,7 +1013,7 @@ static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
        return 0;
 }
 
-static struct dma_buf_ops dma_buf_ops = {
+static const struct dma_buf_ops dma_buf_ops = {
        .map_dma_buf = ion_map_dma_buf,
        .unmap_dma_buf = ion_unmap_dma_buf,
        .mmap = ion_mmap,