* [PATCH] ibm_rtl: remove unnecessary static in ibm_rtl_write()
@ 2017-07-18 22:01 Gustavo A. R. Silva
2017-07-19 18:12 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-07-18 22:01 UTC (permalink / raw)
To: Darren Hart, Andy Shevchenko
Cc: platform-driver-x86, linux-kernel, Gustavo A. R. Silva
Remove unnecessary static on local variable cmd_port_val. Such variable
is initialized before being used, on every execution path throughout
the function. The static has no benefit and, removing it reduces the
object file size.
This issue was detected using Coccinelle and the following semantic patch:
https://github.com/GustavoARSilva/coccinelle/blob/master/static/static_unused.cocci
In the following log you can see a difference in the object file size.
This log is the output of the size command, before and after the code
change:
before:
text data bss dec hex filename
3932 3440 512 7884 1ecc drivers/platform/x86/ibm_rtl.o
after:
text data bss dec hex filename
3887 3384 448 7719 1e27 drivers/platform/x86/ibm_rtl.o
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/platform/x86/ibm_rtl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index c62e5e1..610ac83 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -103,7 +103,7 @@ static void rtl_port_unmap(void __iomem *addr)
static int ibm_rtl_write(u8 value)
{
int ret = 0, count = 0;
- static u32 cmd_port_val;
+ u32 cmd_port_val;
RTL_DEBUG("%s(%d)\n", __func__, value);
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ibm_rtl: remove unnecessary static in ibm_rtl_write()
2017-07-18 22:01 [PATCH] ibm_rtl: remove unnecessary static in ibm_rtl_write() Gustavo A. R. Silva
@ 2017-07-19 18:12 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2017-07-19 18:12 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Darren Hart, Andy Shevchenko, Platform Driver,
linux-kernel@vger.kernel.org
On Wed, Jul 19, 2017 at 1:01 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> Remove unnecessary static on local variable cmd_port_val. Such variable
> is initialized before being used, on every execution path throughout
> the function. The static has no benefit and, removing it reduces the
> object file size.
>
> This issue was detected using Coccinelle and the following semantic patch:
> https://github.com/GustavoARSilva/coccinelle/blob/master/static/static_unused.cocci
>
> In the following log you can see a difference in the object file size.
> This log is the output of the size command, before and after the code
> change:
>
> before:
> text data bss dec hex filename
> 3932 3440 512 7884 1ecc drivers/platform/x86/ibm_rtl.o
>
> after:
> text data bss dec hex filename
> 3887 3384 448 7719 1e27 drivers/platform/x86/ibm_rtl.o
>
Pushed to testing, thanks,
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> drivers/platform/x86/ibm_rtl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
> index c62e5e1..610ac83 100644
> --- a/drivers/platform/x86/ibm_rtl.c
> +++ b/drivers/platform/x86/ibm_rtl.c
> @@ -103,7 +103,7 @@ static void rtl_port_unmap(void __iomem *addr)
> static int ibm_rtl_write(u8 value)
> {
> int ret = 0, count = 0;
> - static u32 cmd_port_val;
> + u32 cmd_port_val;
>
> RTL_DEBUG("%s(%d)\n", __func__, value);
>
> --
> 2.5.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-19 18:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18 22:01 [PATCH] ibm_rtl: remove unnecessary static in ibm_rtl_write() Gustavo A. R. Silva
2017-07-19 18:12 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox