Skip to contentSkip to conversation

FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was not

PATCH In review Sagar Padhye 2 participants 4 messages Oct 2, 2013 – Oct 4, 2013

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

PATCH 1/1 FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was not

---
This is the first patch I am sending out, hope this is ok. I checked that cpuidle_devices is only being used in cpuidle.c - hence thought that it can be made static and be removed from header.

 drivers/cpuidle/cpuidle.c | 4 ++--
 include/linux/cpuidle.h   | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/cpuidle/cpuidle.c +2 -2
index d75040d..4826506 100644
@@ -23,8 +23,8 @@
 
 #include "cpuidle.h"
 
-DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
-DEFINE_PER_CPU(struct cpuidle_device, cpuidle_dev);
+static DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
+static DEFINE_PER_CPU(struct cpuidle_device, cpuidle_dev);
 
 DEFINE_MUTEX(cpuidle_lock);
 LIST_HEAD(cpuidle_detected_devices);
include/linux/cpuidle.h +0 -1
index 781addc..96c8ed8 100644
@@ -83,7 +83,6 @@ struct cpuidle_device {
 #endif
 };
 
-DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
 
 /**
  * cpuidle_get_last_residency - retrieves the last state's residency time
Signature · 1 line
1.8.1.2
#1 lore raw

Re: [PATCH] FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was

Quoted 2 lines · Sagar Padhye

---
This is the first patch I am sending out, hope this is ok.

Hi hi,

Kernel Janitors is a newbie friendly list so that's fine.

Quoted 2 lines

I checked that cpuidle_devices is only being used in cpuidle.c - hence thought that it can be made static and be removed from header.

"cpuidle_devices" is actually used in drivers/cpuidle/coupled.c as well so this breaks the build.

Even for "cpuidle_dev" the patch isn't right. It doesn't fix the warning, for me. The DEFINE_PER_CPU() macro defines several variables actually. Per CPU variables are a bit complicated and they have to have globally unique names. So just ignore the Sparse warning for per CPU variables.

There are several other "process" problems with the patch submission.

1) Incorrect subject. It should be:
[PATCH] cpuidle: make a variable static

This is based on git log --oneline drivers/cpuidle/cpuidle.c output.

2) No blank line between subject and body of commit message.
3) Line wrap the body of the email at 72 characters.
4) No Signed-off-by line.

Anyway, don't feel bad that your first patch had problems, we all started as beginners.

regards,
dan carpenter

#2 lore raw

Re: [PATCH] FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was

Quoted 5 lines
Quoted 2 lines

I checked that cpuidle_devices is only being used in cpuidle.c - hence thought that it can be made static and be removed from header.

"cpuidle_devices" is actually used in drivers/cpuidle/coupled.c as well so this breaks the build.

Darn! I forgot 'clean build' part. sorry.

Quoted 6 lines

Even for "cpuidle_dev" the patch isn't right. It doesn't fix the warning, for me. The DEFINE_PER_CPU() macro defines several variables actually. Per CPU variables are a bit complicated and they have to have globally unique names. So just ignore the Sparse warning for per CPU variables.

Ok, let me look at my sparse log once again, will pick some other problem (any suggestions?)

Quoted 5 lines

There are several other "process" problems with the patch submission.

1) Incorrect subject. It should be:
[PATCH] cpuidle: make a variable static

Quoted 7 lines

This is based on git log --oneline drivers/cpuidle/cpuidle.c output.

2) No blank line between subject and body of commit message.
3) Line wrap the body of the email at 72 characters.
4) No Signed-off-by line.

Ok, will keep this in mind

Thanks and Regards,
Sagar

#3 lore raw

Re: [PATCH] FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was

In reply to Sagar Padhye
Quoted 15 lines · Sagar Padhye
Quoted 5 lines
Quoted 2 lines

I checked that cpuidle_devices is only being used in cpuidle.c - hence thought that it can be made static and be removed from header.

"cpuidle_devices" is actually used in drivers/cpuidle/coupled.c as well so this breaks the build.

Darn! I forgot 'clean build' part. sorry.

Quoted 6 lines

Even for "cpuidle_dev" the patch isn't right. It doesn't fix the warning, for me. The DEFINE_PER_CPU() macro defines several variables actually. Per CPU variables are a bit complicated and they have to have globally unique names. So just ignore the Sparse warning for per CPU variables.

Quoted 2 lines

Ok, let me look at my sparse log once again, will pick some other problem (any suggestions?)

You're on the right track. Just the details are wrong.

regards,
dan carpenter