PCI: dwc: dra7xx: Help compiler to remove unused code
authorNiklas Cassel <niklas.cassel@axis.com>
Tue, 19 Dec 2017 23:29:30 +0000 (00:29 +0100)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 21 Dec 2017 11:10:30 +0000 (11:10 +0000)
commitf1aba0a0de55c72cded9a8951ef30680e7f46389
tree54f0bed605787961300a20f4a320a5b1d0700eed
parent71890ea0a0b5632c31be8d81c6c94b6541a898ff
PCI: dwc: dra7xx: Help compiler to remove unused code

The dra7xx driver supports both host and ep mode.
When enabling support for only one of the modes, help the compiler
to remove code for the mode that we have not enabled in the driver.

By adding if (!IS_ENABLED(CONFIG_PCI_DRA7XX_HOST)) return -ENODEV;
anything after that statement will get silently dropped by the compiler,
including static functions and structures that are referenced indirectly
from there.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
drivers/pci/dwc/pci-dra7xx.c