Skip to contentSkip to conversation

staging: android: ashmem: Declared file operation with 'const' keyword

PATCH In review Hriday Hegde 3 participants 9 messages May 19, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: ashmem: Declared file operation with 'const' keyword

Fixing following warnings found by checkpatch.pl
WARNING: struct file_operations should normally be const 380: FILE: drivers/staging/android/ashmem.c:380:
+ static struct file_operations vmfile_fops;

---
 drivers/staging/android/ashmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ashmem.c +1 -1
index 8ee4320a5dc6..8ff2794b08e3 100644
@@ -377,7 +377,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
 
 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
 {
-	static struct file_operations vmfile_fops;
+	static const struct file_operations vmfile_fops;
 	struct ashmem_area *asma = file->private_data;
 	int ret = 0;
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 27 lines · Hriday Hegde

Fixing following warnings found by checkpatch.pl
WARNING: struct file_operations should normally be const 380: FILE: drivers/staging/android/ashmem.c:380:

(quoted diff) +1 -0
+	static struct file_operations vmfile_fops;
---
 drivers/staging/android/ashmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ashmem.c +1 -1
index 8ee4320a5dc6..8ff2794b08e3 100644
@@ -377,7 +377,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
 
 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
 {
-	static struct file_operations vmfile_fops;
+	static const struct file_operations vmfile_fops;
 	struct ashmem_area *asma = file->private_data;
 	int ret = 0;
 
Signature · 1 line
2.25.1

Any reason why you didn't build your change before submitting this patch?

thanks,

greg k-h

#2 lore raw

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

Quoted 34 lines · Greg Kroah-Hartman
Quoted 27 lines · Hriday Hegde

Fixing following warnings found by checkpatch.pl
WARNING: struct file_operations should normally be const 380: FILE: drivers/staging/android/ashmem.c:380:

(quoted diff) +1 -0
+	static struct file_operations vmfile_fops;
---
 drivers/staging/android/ashmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ashmem.c +1 -1
index 8ee4320a5dc6..8ff2794b08e3 100644
@@ -377,7 +377,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
 
 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
 {
-	static struct file_operations vmfile_fops;
+	static const struct file_operations vmfile_fops;
 	struct ashmem_area *asma = file->private_data;
 	int ret = 0;
 
Signature · 1 line
2.25.1

Any reason why you didn't build your change before submitting this patch?

thanks,

greg k-h

#3 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · Hriday Hegde

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

That does not build the code you changed, right?

I'm sure whatever course you took, it did reference the fact that you need to ensure that your change actually works properly by the very least being able to be compiled correctly. Please go over those instructions again.

good luck!

greg k-h

#4 lore raw
Quoted 13 lines · Greg Kroah-Hartman

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · Hriday Hegde

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

That does not build the code you changed, right?

Quoted 8 lines

I'm sure whatever course you took, it did reference the fact that you need to ensure that your change actually works properly by the very least being able to be compiled correctly. Please go over those instructions again.

good luck!

greg k-h

I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.

#5 lore raw

Hi Hriday,

Quoted 19 lines · Hriday Hegde
Quoted 18 lines · Greg Kroah-Hartman

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · Hriday Hegde

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

That does not build the code you changed, right?

I'm sure whatever course you took, it did reference the fact that you need to ensure that your change actually works properly by the very least being able to be compiled correctly. Please go over those instructions again.

Quoted 7 lines
Quoted 3 lines

good luck!

greg k-h

I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.

try following this tutorial from scratch:

https://kernelnewbies.org/FirstKernelPatch

it's simply complete and helps a lot, from gathering all tools needed to contribute to the community to sending whole patchsets.

In your emails don't go over 80-100 character per line, when you ask things or your mails will be difficult to read.

thank you,

fabio

#6 lore raw
Quoted 36 lines · Fabio Aiuto

Hi Hriday,

Quoted 19 lines · Hriday Hegde
Quoted 18 lines · Greg Kroah-Hartman

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · Hriday Hegde

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

That does not build the code you changed, right?

I'm sure whatever course you took, it did reference the fact that you need to ensure that your change actually works properly by the very least being able to be compiled correctly. Please go over those instructions again.

Quoted 6 lines
Quoted 3 lines

good luck!

greg k-h

I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.

try following this tutorial from scratch:

https://kernelnewbies.org/FirstKernelPatch

it's simply complete and helps a lot, from gathering all tools needed to contribute to the community to sending whole patchsets.

Quoted 7 lines

In your emails don't go over 80-100 character per line, when you ask things or your mails will be difficult to read.

thank you,

fabio

Thank you for the guidance,  and will keep the char limit in mind.

#7 lore raw
In reply to Hriday Hegde
Quoted 19 lines · Hriday Hegde
Quoted 18 lines · Greg Kroah-Hartman

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · Hriday Hegde

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

That does not build the code you changed, right?

I'm sure whatever course you took, it did reference the fact that you need to ensure that your change actually works properly by the very least being able to be compiled correctly. Please go over those instructions again.

Quoted 7 lines
Quoted 3 lines

good luck!

greg k-h

I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.

That is correct, when compiling (i.e. building), the compiler shows that this is not a correct change.

thanks,

greg k-h

#8 lore raw
Quoted 26 lines · Greg Kroah-Hartman
Quoted 19 lines · Hriday Hegde
Quoted 18 lines · Greg Kroah-Hartman

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · Hriday Hegde

I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?

That does not build the code you changed, right?

I'm sure whatever course you took, it did reference the fact that you need to ensure that your change actually works properly by the very least being able to be compiled correctly. Please go over those instructions again.

Quoted 6 lines
Quoted 3 lines

good luck!

greg k-h

I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.

Quoted 6 lines

That is correct, when compiling (i.e. building), the compiler shows that this is not a correct change.

thanks,

greg k-h

Oh ok will work with something else.

Thanks.