[PATCH] isdn/hisax: Deinline writeCMDR and waitforCEC functions

From: Denys Vlasenko
Date: Mon Sep 28 2015 - 15:05:48 EST


MemwaitforCEC(), waitforCEC(), MemwaitforXFW() and waitforXFW()
functions have the following form:

while ((read_reg(...) & BIT) && --cnt)
udelay(1);
if (cnt == 0)
printk(KERN_WARNING...);

Thus, there is no reason for them to be inlined. They are not
bound by CPU performance.
(They have one callsite each, and probably were labeled inline
in the days when gcc wasn't clever enough to auto-inline statics.)

MemWriteHSCXCMDR(), WriteHSCXCMDR() and WriteJADECMDR()
each call one of waitforCEC()-style functions,
then write a register.

These functions do have multiple callers - each has six.

Since they incorporate busy-wait loop as shown above,
there is no reason for them to be inlined either.

After deinlining, MemWriteHSCXCMDR compiles to 117 bytes,
WriteJADECMDR to 284 bytes.

This patch decreases vmlinux by 7.5 kbytes:

text data bss dec hex filename
91432614 19941016 36421632 147795262 8cf2d3e vmlinux.before
91425062 19941112 36421632 147787806 8cf101e vmlinux

Signed-off-by: Denys Vlasenko <dvlasenk@xxxxxxxxxx>
CC: linux-kernel@xxxxxxxxxxxxxxx
---
drivers/isdn/hisax/diva.c | 6 +++---
drivers/isdn/hisax/hscx_irq.c | 6 +++---
drivers/isdn/hisax/jade_irq.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 4fc90de..5c42a74 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -363,7 +363,7 @@ Start_IPACISA:
return IRQ_HANDLED;
}

-static inline void
+static void
MemwaitforCEC(struct IsdnCardState *cs, int hscx)
{
int to = 50;
@@ -377,7 +377,7 @@ MemwaitforCEC(struct IsdnCardState *cs, int hscx)
}


-static inline void
+static void
MemwaitforXFW(struct IsdnCardState *cs, int hscx)
{
int to = 50;
@@ -390,7 +390,7 @@ MemwaitforXFW(struct IsdnCardState *cs, int hscx)
printk(KERN_WARNING "HiSax: waitforXFW timeout\n");
}

-static inline void
+static void
MemWriteHSCXCMDR(struct IsdnCardState *cs, int hscx, u_char data)
{
MemwaitforCEC(cs, hscx);
diff --git a/drivers/isdn/hisax/hscx_irq.c b/drivers/isdn/hisax/hscx_irq.c
index a8d6188..4b10af1 100644
--- a/drivers/isdn/hisax/hscx_irq.c
+++ b/drivers/isdn/hisax/hscx_irq.c
@@ -13,7 +13,7 @@
*/


-static inline void
+static void
waitforCEC(struct IsdnCardState *cs, int hscx)
{
int to = 50;
@@ -27,7 +27,7 @@ waitforCEC(struct IsdnCardState *cs, int hscx)
}


-static inline void
+static void
waitforXFW(struct IsdnCardState *cs, int hscx)
{
int to = 50;
@@ -40,7 +40,7 @@ waitforXFW(struct IsdnCardState *cs, int hscx)
printk(KERN_WARNING "HiSax: waitforXFW timeout\n");
}

-static inline void
+static void
WriteHSCXCMDR(struct IsdnCardState *cs, int hscx, u_char data)
{
waitforCEC(cs, hscx);
diff --git a/drivers/isdn/hisax/jade_irq.c b/drivers/isdn/hisax/jade_irq.c
index b930da9..3d39723 100644
--- a/drivers/isdn/hisax/jade_irq.c
+++ b/drivers/isdn/hisax/jade_irq.c
@@ -10,7 +10,7 @@
*
*/

-static inline void
+static void
waitforCEC(struct IsdnCardState *cs, int jade, int reg)
{
int to = 50;
@@ -30,7 +30,7 @@ waitforXFW(struct IsdnCardState *cs, int jade)
/* Does not work on older jade versions, don't care */
}

-static inline void
+static void
WriteJADECMDR(struct IsdnCardState *cs, int jade, int reg, u_char data)
{
waitforCEC(cs, jade, reg);
--
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/