Input: spear-keyboard - Add CONFIG_PM_SLEEP to suspend/resume functions
Subsystems (2)
PATCH 1/1 Input: spear-keyboard - Add CONFIG_PM_SLEEP to suspend/resume functions
Add CONFIG_PM_SLEEP to suspend/resume functions
Add CONFIG_PM_SLEEP to suspend/resume functions instead of CONFIG_PM to fix the following build warning when CONFIG_PM_SLEEP is not selected and CONFIG_PM is selected. This is because sleep PM callbacks defined by SIMPLE_DEV_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled.
drivers/input/keyboard/spear-keyboard.c:292:12: warning: 'spear_kbd_suspend' defined but not used [-Wunused-function] drivers/input/keyboard/spear-keyboard.c:345:12: warning: 'spear_kbd_resume' defined but not used [-Wunused-function]
--- drivers/input/keyboard/spear-keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/spear-keyboard.c +1 -1
@@ -288,7 +288,7 @@ static int spear_kbd_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int spear_kbd_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);
Signature · 1 line
1.7.9.5
'Dmitry Torokhov'
maintainerHi Jingoo,
Quoted 7 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning whenCONFIG_PM_SLEEPis not selected andCONFIG_PMis selected. This is because sleep PM callbacks defined bySIMPLE_DEV_PM_OPSare only used when theCONFIG_PM_SLEEPis enabled.
Recently I've become a fan of __maybe_unused markings as they insulate us from various CONFIG changes in unrelated subsystems, I'll transform this patch to use them instead.
Thanks.
Quoted 26 lines
drivers/input/keyboard/spear-keyboard.c:292:12: warning: 'spear_kbd_suspend' defined but not used [-Wunused-function]drivers/input/keyboard/spear-keyboard.c:345:12: warning: 'spear_kbd_resume' defined but not used [-Wunused-function]Signed-off-by Jingoo Han <[email protected]>--- drivers/input/keyboard/spear-keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/keyboard/spear-keyboard.c +1
-1@@ -288,7 +288,7 @@ static int spear_kbd_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int spear_kbd_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);Signature · 1 line
1.7.9.5
Signature · 1 line
Dmitry
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning whenCONFIG_PM_SLEEPis not selected andCONFIG_PMis selected. This is because sleep PM callbacks defined bySIMPLE_DEV_PM_OPSare only used when theCONFIG_PM_SLEEPis enabled.
Quoted 3 lines
Recently I've become a fan of
__maybe_unusedmarkings as they insulate us from various CONFIG changes in unrelated subsystems, I'll transform this patch to use them instead.
OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to __maybe_unused annotation? Personally, I prefer to increase build coverage than using #ifdef guards. Someone, however, argued that #ifdef guards should be used in this case because the size of binary can be reduced. How about your opinion?
Thank you.
Best regards,
Jingoo Han
Quoted 34 lines
Thanks.
Quoted 2 lines
drivers/input/keyboard/spear-keyboard.c:292:12: warning: 'spear_kbd_suspend' defined but not used [-Wunused-function]
Quoted 1 line
drivers/input/keyboard/spear-keyboard.c:345:12: warning: 'spear_kbd_resume' defined but not used [-Wunused-function]
Quoted 20 lines
Signed-off-by Jingoo Han <[email protected]>--- drivers/input/keyboard/spear-keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/input/keyboard/spear-keyboard.c +1
-2@@ -288,7 +288,7 @@ static int spear_kbd_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int spear_kbd_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev); --Quoted 3 lines
1.7.9.5
--
Dmitry
'Dmitry Torokhov'
maintainerQuoted 14 lines · Jingoo Han
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning whenCONFIG_PM_SLEEPis not selected andCONFIG_PMis selected. This is because sleep PM callbacks defined bySIMPLE_DEV_PM_OPSare only used when theCONFIG_PM_SLEEPis enabled.Quoted 3 lines
Recently I've become a fan of
__maybe_unusedmarkings as they insulate us from various CONFIG changes in unrelated subsystems, I'll transform this patch to use them instead.
Quoted 6 lines
OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? Personally, I prefer to increase build coverage than using #ifdef guards. Someone, however, argued that #ifdef guards should be used in this case because the size of binary can be reduced. How about your opinion?
The optimizer is supposed to drop functions marked as '__maybe_unused' if they are indeed unused so size of the binary should not change.
Thanks.
Signature · 1 line
Dmitry
Quoted 22 lines · Dmitry Torokhov
Quoted 14 lines · Jingoo Han
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning whenCONFIG_PM_SLEEPis not selected andCONFIG_PMis selected. This is because sleep PM callbacks defined bySIMPLE_DEV_PM_OPSare only used when theCONFIG_PM_SLEEPis enabled.Quoted 3 lines
Recently I've become a fan of
__maybe_unusedmarkings as they insulate us from various CONFIG changes in unrelated subsystems, I'll transform this patch to use them instead.Quoted 6 lines
OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? Personally, I prefer to increase build coverage than using #ifdef guards. Someone, however, argued that #ifdef guards should be used in this case because the size of binary can be reduced. How about your opinion?
Quoted 2 lines
The optimizer is supposed to drop functions marked as '
__maybe_unused' if they are indeed unused so size of the binary should not change.
Oh, I really appreciate your reply. :-)
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to __maybe_unused annotation? If you don't have any objection, I will send one single patch for this.
Best regards,
Jingoo Han
Quoted 5 lines
Thanks.
--
Dmitry
Dmitry Torokhov
maintainerQuoted 23 lines · Jingoo Han
Quoted 22 lines · Dmitry Torokhov
Quoted 20 lines · Jingoo Han
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning whenCONFIG_PM_SLEEPis not selected andCONFIG_PMis selected. This is because sleep PM callbacks defined bySIMPLE_DEV_PM_OPSare only used when theCONFIG_PM_SLEEPis enabled.Quoted 3 lines
Recently I've become a fan of
__maybe_unusedmarkings as they insulate us from various CONFIG changes in unrelated subsystems, I'll transform this patch to use them instead.OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? Personally, I prefer to increase build coverage than using #ifdef guards. Someone, however, argued that #ifdef guards should be used in this case because the size of binary can be reduced. How about your opinion?
Quoted 7 lines
Quoted 2 lines
The optimizer is supposed to drop functions marked as '
__maybe_unused' if they are indeed unused so size of the binary should not change.Oh, I really appreciate your reply. :-)
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? If you don't have any objection, I will send one single patch for this.
That will work.
Thanks.
Signature · 1 line
Dmitry
Quoted 22 lines · Dmitry Torokhov
Quoted 14 lines · Jingoo Han
Quoted 9 lines · Dmitry Torokhov
Quoted 7 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning whenCONFIG_PM_SLEEPis not selected andCONFIG_PMis selected. This is because sleep PM callbacks defined bySIMPLE_DEV_PM_OPSare only used when theCONFIG_PM_SLEEPis enabled.Quoted 3 lines
Recently I've become a fan of
__maybe_unusedmarkings as they insulate us from various CONFIG changes in unrelated subsystems, I'll transform this patch to use them instead.Quoted 6 lines
OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? Personally, I prefer to increase build coverage than using #ifdef guards. Someone, however, argued that #ifdef guards should be used in this case because the size of binary can be reduced. How about your opinion?
Quoted 2 lines
The optimizer is supposed to drop functions marked as '
__maybe_unused' if they are indeed unused so size of the binary should not change.
Sorry for annoying you.
I built 'spear-keyboard' and got the binaries as below.
spear-keyboard.o 89500 bytes, <-- CONFIG_PM_SLEEP=n spear-keyboard.o 92352 bytes, <-- CONFIG_PM_SLEEP=y spear-keyboard.o 92352 bytes, <-- Marked as __maybe_unused
As presented above, when CONFIG_PM_SLEEP is used instead of __maybe_unused, the size of binary is reduced. So, someone complained me to use #ifdef guards. But, I agree with your opinion. Personally, I DON'T want to use #ifdef guards, because I prefer to increase build coverage.
Thank you.
Quoted 5 lines
Thanks.
--
Dmitry
Dmitry Torokhov
maintainerQuoted 42 lines · Jingoo Han
Quoted 7 lines · Dmitry Torokhov
Quoted 6 lines · Jingoo Han
Quoted 5 lines · Dmitry Torokhov
Quoted 4 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning when
CONFIG_PM_SLEEPQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
is not selected and
CONFIG_PMis selected. This is becausesleep
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
PM callbacks defined by
SIMPLE_DEV_PM_OPSare only used whenthe
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
CONFIG_PM_SLEEPis enabled.Recently I've become a fan of
__maybe_unusedmarkings as theyinsulate
Quoted 1 line
Quoted 1 line
Quoted 1 line
us from various CONFIG changes in unrelated subsystems, I'll
transform
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
this patch to use them instead.
OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? Personally, I prefer to increasebuild
Quoted 1 line
Quoted 1 line
coverage than using #ifdef guards. Someone, however, argued that
#ifdef
Quoted 1 line
Quoted 1 line
guards should be used in this case because the size of binary can
be
Quoted 3 lines
Quoted 1 line
reduced. How about your opinion?
The optimizer is supposed to drop functions marked as
'
__maybe_unused'Quoted 1 line
if they are indeed unused so size of the binary should not change.
Sorry for annoying you.
I built 'spear-keyboard' and got the binaries as below.spear-keyboard.o 89500 bytes, <--
CONFIG_PM_SLEEP=nspear-keyboard.o 92352 bytes, <--CONFIG_PM_SLEEP=yspear-keyboard.o 92352 bytes, <-- Marked as__maybe_unused
Quoted 5 lines
As presented above, when
CONFIG_PM_SLEEPis used instead of__maybe_unused, the size of binary is reduced. So, someone complained me to use #ifdef guards. But, I agree with your opinion. Personally, I DON'T want to use #ifdef guards, because I prefer to increase build coverage.
What about the final kernel image size/kernel module size?
Thanks.
Signature · 1 line
Dmitry
Quoted 52 lines
-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: Tuesday, October 28, 2014 10:09 AM
To: Jingoo Han
Cc: [email protected]; 'Viresh Kumar'; 'Jingoo Han'
Subject: Re: [PATCH] Input: spear-keyboard - AddCONFIG_PM_SLEEPto suspend/resume functionsQuoted 42 lines · Jingoo Han
Quoted 7 lines · Dmitry Torokhov
Quoted 6 lines · Jingoo Han
Quoted 5 lines · Dmitry Torokhov
Quoted 4 lines · Jingoo Han
Add
CONFIG_PM_SLEEPto suspend/resume functionsAdd
CONFIG_PM_SLEEPto suspend/resume functions instead ofCONFIG_PMto fix the following build warning when
CONFIG_PM_SLEEPQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
is not selected and
CONFIG_PMis selected. This is becausesleep
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
PM callbacks defined by
SIMPLE_DEV_PM_OPSare only used whenthe
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
CONFIG_PM_SLEEPis enabled.Recently I've become a fan of
__maybe_unusedmarkings as theyinsulate
Quoted 1 line
Quoted 1 line
Quoted 1 line
us from various CONFIG changes in unrelated subsystems, I'll
transform
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
this patch to use them instead.
OK, I see. I have no objection.
Then, how about changing other usages of CONFIG_PM_SLEEP/CONFIG_PM to__maybe_unusedannotation? Personally, I prefer to increasebuild
Quoted 1 line
Quoted 1 line
coverage than using #ifdef guards. Someone, however, argued that
#ifdef
Quoted 1 line
Quoted 1 line
guards should be used in this case because the size of binary can
be
Quoted 3 lines
Quoted 1 line
reduced. How about your opinion?
The optimizer is supposed to drop functions marked as
'
__maybe_unused'Quoted 1 line
if they are indeed unused so size of the binary should not change.
Sorry for annoying you.
I built 'spear-keyboard' and got the binaries as below.spear-keyboard.o 89500 bytes, <--
CONFIG_PM_SLEEP=nspear-keyboard.o 92352 bytes, <--CONFIG_PM_SLEEP=yspear-keyboard.o 92352 bytes, <-- Marked as__maybe_unused
Quoted 7 lines
Quoted 5 lines
As presented above, when
CONFIG_PM_SLEEPis used instead of__maybe_unused, the size of binary is reduced. So, someone complained me to use #ifdef guards. But, I agree with your opinion. Personally, I DON'T want to use #ifdef guards, because I prefer to increase build coverage.What about the final kernel image size/kernel module size?
I used 'spear13xx_defconfig' with linux-next(20141027). Then, I changed '#ifdef CONFIG_PM' into '#ifdef CONFIG_PM_SLEEP' as below.
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
static int spear_kbd_suspend(struct device *dev)
{
Then, I got the following kernel images.
1. CONFIG_PM_SLEEP=y
zImage 2891128 bytes
spear-keyboard.o 88528 bytes
2. CONFIG_PM_SLEEP=n
zImage 2842656 bytes
spear-keyboard.o 85980 bytes
3. Marked as '__maybe_unused' for 'spear_kbd_suspend()/spear_kbd_resume()' instead of using '#ifdef CONFIG_PM_SLEEP',
and CONFIG_PM_SLEEP=y
zImage 2891160 bytes
spear-keyboard.o 88528 bytes
4. Marked as '__maybe_unused' for 'spear_kbd_suspend()/spear_kbd_resume()' instead of using '#ifdef CONFIG_PM_SLEEP',
and CONFIG_PM_SLEEP=n
zImage 2842712 bytes
spear-keyboard.o 85980 bytes
Oh, sorry! Your comment is right.
As you mentioned, the total sizes of the kernel and spear-keyboard.o are reduced, when '__maybe_unused' annotation is used. Thank you!
Best regards,
Jingoo Han
Quoted 6 lines
Thanks.
--
Dmitry