Skip to contentSkip to conversation

drivers: base: Add prototype declaration in memory.c

PATCH In review Rashika Kheria 3 participants 11 messages Dec 18, 2013 – Dec 20, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: base: Add prototype declaration in memory.c

Add the prototype declaration of function memory_block_size_bytes() in memory.c.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---
 drivers/base/memory.c |    1 +
 1 file changed, 1 insertion(+)
drivers/base/memory.c +1 -0
index bece691..cfa03de 100644
@@ -83,6 +83,7 @@ static void memory_block_release(struct device *dev)
 	kfree(mem);
 }
 
+unsigned long __weak memory_block_size_bytes(void);
 unsigned long __weak memory_block_size_bytes(void)
 {
 	return MIN_MEMORY_BLOCK_SIZE;
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 17 lines · Rashika Kheria

Add the prototype declaration of function memory_block_size_bytes() in memory.c.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---
 drivers/base/memory.c |    1 +
 1 file changed, 1 insertion(+)
drivers/base/memory.c +0 -0
index bece691..cfa03de 100644

drivers/base/memory.c static void memory_block_release(struct device *dev) · line 87

Quoted 5 lines
drivers/base/memory.c +1 -0
@@ -83,6 +83,7 @@ static void memory_block_release(struct device *dev)
 	kfree(mem);
 }
 
+unsigned long __weak memory_block_size_bytes(void);
 unsigned long __weak memory_block_size_bytes(void)

If this patch is the "solution" then something else is really wrong here, please use your judgement to realize this...

greg k-h

#2 lore raw
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Rashika Kheria

Add the prototype declaration of function memory_block_size_bytes() in memory.c.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---
 drivers/base/memory.c |    1 +
 1 file changed, 1 insertion(+)
drivers/base/memory.c +0 -0
index bece691..cfa03de 100644
@@ -83,6 +83,7 @@ static void memory_block_release(struct device *dev)
 	kfree(mem);
 }
 
Quoted 5 lines

drivers/base/memory.c static void memory_block_release(struct device *dev) · line 87

Quoted 2 lines
drivers/base/memory.c +1 -0
+unsigned long __weak memory_block_size_bytes(void);
 unsigned long __weak memory_block_size_bytes(void)

If this patch is the "solution" then something else is really wrong here, please use your judgement to realize this...

It's a weak symbol provided and consumed within the same file, and then overridden on a few random architectures. It isn't currently prototyped in any header file. The other potential solution would be to add it to an appropriate existing header or create a new one. Any suggestions for an appropriate existing header to prototype it in instead?

- Josh Triplett

#3 lore raw
Quoted 28 lines · On Wed, Dec 18, 2013 at 11:01:08AM -0800, [email protected] wrote:
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Rashika Kheria

Add the prototype declaration of function memory_block_size_bytes() in memory.c.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---
 drivers/base/memory.c |    1 +
 1 file changed, 1 insertion(+)
drivers/base/memory.c +0 -0
index bece691..cfa03de 100644
@@ -83,6 +83,7 @@ static void memory_block_release(struct device *dev)
 	kfree(mem);
 }
 
Quoted 5 lines

drivers/base/memory.c static void memory_block_release(struct device *dev) · line 87

Quoted 2 lines
drivers/base/memory.c +1 -0
+unsigned long __weak memory_block_size_bytes(void);
 unsigned long __weak memory_block_size_bytes(void)

If this patch is the "solution" then something else is really wrong here, please use your judgement to realize this...

Quoted 5 lines

It's a weak symbol provided and consumed within the same file, and then overridden on a few random architectures. It isn't currently prototyped in any header file. The other potential solution would be to add it to an appropriate existing header or create a new one. Any suggestions for an appropriate existing header to prototype it in instead?

device.h?

#4 lore raw
Quoted 29 lines · Greg Kroah-Hartman
Quoted 28 lines · On Wed, Dec 18, 2013 at 11:01:08AM -0800, [email protected] wrote:
Quoted 26 lines · Greg Kroah-Hartman
Quoted 17 lines · Rashika Kheria

Add the prototype declaration of function memory_block_size_bytes() in memory.c.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---
 drivers/base/memory.c |    1 +
 1 file changed, 1 insertion(+)
drivers/base/memory.c +0 -0
index bece691..cfa03de 100644

drivers/base/memory.c static void memory_block_release(struct device *dev) · line 87

Quoted 5 lines
drivers/base/memory.c +1 -0
@@ -83,6 +83,7 @@ static void memory_block_release(struct device *dev)
 	kfree(mem);
 }
 
+unsigned long __weak memory_block_size_bytes(void);
 unsigned long __weak memory_block_size_bytes(void)

If this patch is the "solution" then something else is really wrong here, please use your judgement to realize this...

Quoted 7 lines
Quoted 5 lines

It's a weak symbol provided and consumed within the same file, and then overridden on a few random architectures. It isn't currently prototyped in any header file. The other potential solution would be to add it to an appropriate existing header or create a new one. Any suggestions for an appropriate existing header to prototype it in instead?

device.h?

include/linux/device.h? That would work, though it seems slightly out of place there.

Would include/linux/memory.h work?

- Josh Triplett

#5 lore raw
Quoted 36 lines · On Wed, Dec 18, 2013 at 11:10:24AM -0800, [email protected] wrote:
Quoted 35 lines · Greg Kroah-Hartman
Quoted 33 lines · On Wed, Dec 18, 2013 at 11:01:08AM -0800, [email protected] wrote:
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Rashika Kheria

Add the prototype declaration of function memory_block_size_bytes() in memory.c.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---
 drivers/base/memory.c |    1 +
 1 file changed, 1 insertion(+)
drivers/base/memory.c +0 -0
index bece691..cfa03de 100644
@@ -83,6 +83,7 @@ static void memory_block_release(struct device *dev)
 	kfree(mem);
 }
 
Quoted 5 lines

drivers/base/memory.c static void memory_block_release(struct device *dev) · line 87

Quoted 2 lines
drivers/base/memory.c +1 -0
+unsigned long __weak memory_block_size_bytes(void);
 unsigned long __weak memory_block_size_bytes(void)

If this patch is the "solution" then something else is really wrong here, please use your judgement to realize this...

It's a weak symbol provided and consumed within the same file, and then overridden on a few random architectures. It isn't currently prototyped in any header file. The other potential solution would be to add it to an appropriate existing header or create a new one. Any suggestions for an appropriate existing header to prototype it in instead?

Quoted 6 lines
Quoted 1 line

device.h?

include/linux/device.h? That would work, though it seems slightly out of place there.

Would include/linux/memory.h work?

Sure, that's fine, I don't really care...

#6 lore raw

PATCH v2 1/1 drivers: base: Add prototype declaration to the header file

In reply to Rashika Kheria

Add prototype declaration of function memory_block_size_bytes() to the header file include/linux/memory.h.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---

Changes since v1:
Incorrect Fix

 include/linux/memory.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/memory.h +1 -0
index 9a6bbf7..8c8f51c 100644
@@ -35,6 +35,7 @@ struct memory_block {
 };
 
 int arch_get_memory_phys_device(unsigned long start_pfn);
+unsigned long __weak memory_block_size_bytes(void);	
 
 /* These states are exposed to userspace as text strings in sysfs */
 #define	MEM_ONLINE		(1<<0) /* exposed to userspace */
Signature · 1 line
1.7.9.5
Reviewed-by on v2 1/1
#7 lore raw

Re: [PATCH v2] drivers: base: Add prototype declaration to the header file

Quoted 7 lines · Rashika Kheria

Add prototype declaration of function memory_block_size_bytes() to the header file include/linux/memory.h.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

Quoted 18 lines
 include/linux/memory.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/memory.h +1 -0
index 9a6bbf7..8c8f51c 100644
@@ -35,6 +35,7 @@ struct memory_block {
 };
 
 int arch_get_memory_phys_device(unsigned long start_pfn);
+unsigned long __weak memory_block_size_bytes(void);	
 
 /* These states are exposed to userspace as text strings in sysfs */
 #define	MEM_ONLINE		(1<<0) /* exposed to userspace */
Signature · 1 line
1.7.9.5
#8 lore raw

Re: [PATCH v2] drivers: base: Add prototype declaration to the header file

In reply to Rashika Kheria
Quoted 8 lines · Rashika Kheria

Add prototype declaration of function memory_block_size_bytes() to the header file include/linux/memory.h.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

Please ALWAYS run your patches through checkpatch.pl so a maintainer doesn't have to write you an email like this reminding you to do that...

Josh, come on, you should have caught this as well, fix up your email client to flag stuff like this easier...

greg k-h

#9 lore raw

Re: [PATCH v2] drivers: base: Add prototype declaration to the header file

Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Rashika Kheria

Add prototype declaration of function memory_block_size_bytes() to the header file include/linux/memory.h.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

Quoted 8 lines
Quoted 2 lines

Please ALWAYS run your patches through checkpatch.pl so a maintainer doesn't have to write you an email like this reminding you to do that...

Josh, come on, you should have caught this as well, fix up your email client to flag stuff like this easier...

If you're referring to the trailing whitespace on the line that was added, I did indeed miss that. Sorry about that.

I don't see any option in mutt that would make trailing whitespace visible; if you know of one, I'd love to hear about it. I do have vim configured to highlight trailing whitespace, but I normally review patches in mutt and then hit reply and use vim to provide a Reviewed-by or line-by-line feedback if needed. I should get in the habit of reviewing patches in vim instead; if I had, I'd have caught this.

- Josh Triplett

#10 lore raw

PATCH v3 1/1 drivers: base: Add prototype declaration to the header file

In reply to Rashika Kheria

Add prototype declaration of function memory_block_size_bytes() to the header file include/linux/memory.h.

This eliminates the following warning in memory.c:
drivers/base/memory.c:87:1: warning: no previous prototype for ‘memory_block_size_bytes’ [-Wmissing-prototypes]

---

Changes since v2:
Checkpatch error

 include/linux/memory.h |    1 +
 1 file changed, 1 insertion(+)
include/linux/memory.h +1 -0
index 9a6bbf7..bb7384e 100644
@@ -35,6 +35,7 @@ struct memory_block {
 };
 
 int arch_get_memory_phys_device(unsigned long start_pfn);
+unsigned long __weak memory_block_size_bytes(void);
 
 /* These states are exposed to userspace as text strings in sysfs */
 #define	MEM_ONLINE		(1<<0) /* exposed to userspace */
Signature · 1 line
1.7.9.5