Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp_qoriq: don't pass a large struct by value but instead pass it by reference

Passing the struct ptp_clock_info caps by parameter is passing over 130 bytes
of data by value on the stack. Optimize this by passing it by reference instead.
Also shinks the object code size:

Before:
text data bss dec hex filename
12596 2160 64 14820 39e4 drivers/ptp/ptp_qoriq.o

After:
text data bss dec hex filename
12567 2160 64 14791 39c7 drivers/ptp/ptp_qoriq.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Colin Ian King and committed by
David S. Miller
58066ac9 d2cf821f

+5 -5
+1 -1
drivers/net/ethernet/freescale/enetc/enetc_ptp.c
··· 92 92 93 93 ptp_qoriq->dev = &pdev->dev; 94 94 95 - err = ptp_qoriq_init(ptp_qoriq, base, enetc_ptp_caps); 95 + err = ptp_qoriq_init(ptp_qoriq, base, &enetc_ptp_caps); 96 96 if (err) 97 97 goto err_no_clock; 98 98
+3 -3
drivers/ptp/ptp_qoriq.c
··· 459 459 } 460 460 461 461 int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, 462 - const struct ptp_clock_info caps) 462 + const struct ptp_clock_info *caps) 463 463 { 464 464 struct device_node *node = ptp_qoriq->dev->of_node; 465 465 struct ptp_qoriq_registers *regs; ··· 468 468 u32 tmr_ctrl; 469 469 470 470 ptp_qoriq->base = base; 471 - ptp_qoriq->caps = caps; 471 + ptp_qoriq->caps = *caps; 472 472 473 473 if (of_property_read_u32(node, "fsl,cksel", &ptp_qoriq->cksel)) 474 474 ptp_qoriq->cksel = DEFAULT_CKSEL; ··· 605 605 goto no_ioremap; 606 606 } 607 607 608 - err = ptp_qoriq_init(ptp_qoriq, base, ptp_qoriq_caps); 608 + err = ptp_qoriq_init(ptp_qoriq, base, &ptp_qoriq_caps); 609 609 if (err) 610 610 goto no_clock; 611 611
+1 -1
include/linux/fsl/ptp_qoriq.h
··· 183 183 184 184 irqreturn_t ptp_qoriq_isr(int irq, void *priv); 185 185 int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base, 186 - const struct ptp_clock_info caps); 186 + const struct ptp_clock_info *caps); 187 187 void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq); 188 188 int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm); 189 189 int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);