Skip to contentSkip to conversation

Staging: android: ion: constify dma_buf_ops structure

PATCH In review Bhumika Goyal 2 participants 2 messages Oct 15, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: android: ion: constify dma_buf_ops structure

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

---
 drivers/staging/android/ion/ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion.c +1 -1
index 396ded5..45eceea 100644
@@ -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,
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Bhumika Goyal

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

Quoted 6 lines

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

Quoted 27 lines
---
 drivers/staging/android/ion/ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/ion.c +1 -2
index 396ded5..45eceea 100644
@@ -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,
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1476512028-2583-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.