spi: fsl-(e)spi: Support compile as module
PATCH v2 1/1 spi: fsl-(e)spi: Support compile as module
From: Esben Haabendal <[email protected]>
Signed-off-by Esben Haabendal <[email protected]>
---
Changes in v2:
- Use IS_ENABLED() in spi-fsl-lib.h
drivers/spi/Kconfig | 4 ++--
drivers/spi/spi-fsl-cpm.c | 9 +++++++++ drivers/spi/spi-fsl-lib.c | 14 ++++++++++++-- drivers/spi/spi-fsl-lib.h | 4 ++-- 4 files changed, 25 insertions(+), 6 deletions(-)
drivers/spi/Kconfig +2 -2
@@ -279,7 +279,7 @@ config SPI_FSL_CPM depends on FSL_SOC config SPI_FSL_SPI - bool "Freescale SPI controller and Aeroflex Gaisler GRLIB SPI controller" + tristate "Freescale SPI controller and Aeroflex Gaisler GRLIB SPI controller" depends on OF select SPI_FSL_LIB select SPI_FSL_CPM if FSL_SOC
@@ -300,7 +300,7 @@ config SPI_FSL_DSPI mode. VF610 platform uses the controller. config SPI_FSL_ESPI - bool "Freescale eSPI controller" + tristate "Freescale eSPI controller" depends on FSL_SOC select SPI_FSL_LIB help
drivers/spi/spi-fsl-cpm.c +9 -0
@@ -20,6 +20,7 @@#include <linux/dma-mapping.h> #include <linux/fsl_devices.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/of_address.h> #include <linux/spi/spi.h> #include <linux/types.h>
@@ -68,6 +69,7 @@ void fsl_spi_cpm_reinit_txrx(struct mpc8xxx_spi *mspi) } } } +EXPORT_SYMBOL_GPL (fsl_spi_cpm_reinit_txrx);static void fsl_spi_cpm_bufs_start (struct mpc8xxx_spi *mspi) {
@@ -162,6 +164,7 @@ err_rx_dma:dma_unmap_single (dev, mspi->tx_dma, t->len,DMA_TO_DEVICE );return -ENOMEM ; } +EXPORT_SYMBOL_GPL (fsl_spi_cpm_bufs);void fsl_spi_cpm_bufs_complete (struct mpc8xxx_spi *mspi) {
@@ -174,6 +177,7 @@ void fsl_spi_cpm_bufs_complete(struct mpc8xxx_spi *mspi)dma_unmap_single (dev, mspi->rx_dma, t->len,DMA_FROM_DEVICE ); mspi->xfer_in_progress =NULL ; } +EXPORT_SYMBOL_GPL (fsl_spi_cpm_bufs_complete);void fsl_spi_cpm_irq (struct mpc8xxx_spi *mspi,u32 events) {
@@ -198,6 +202,7 @@ void fsl_spi_cpm_irq(struct mpc8xxx_spi *mspi, u32 events)else complete (&mspi->done); } +EXPORT_SYMBOL_GPL (fsl_spi_cpm_irq);static void *fsl_spi_alloc_dummy_rx (void ) {
@@ -375,6 +380,7 @@ err_pram:fsl_spi_free_dummy_rx ();return -ENOMEM ; } +EXPORT_SYMBOL_GPL (fsl_spi_cpm_init);void fsl_spi_cpm_free (struct mpc8xxx_spi *mspi) {
@@ -389,3 +395,6 @@ void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi)cpm_muram_free (cpm_muram_offset (mspi->pram));fsl_spi_free_dummy_rx (); } +EXPORT_SYMBOL_GPL (fsl_spi_cpm_free); + +MODULE_LICENSE ("GPL" );
drivers/spi/spi-fsl-lib.c +12 -2
@@ -21,6 +21,7 @@#include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/module.h> #include <linux/of_platform.h> #include <linux/spi/spi.h> #ifdef CONFIG_FSL_SOC
@@ -35,7 +36,8 @@ void mpc8xxx_spi_rx_buf_##type(u32 data, struct mpc8xxx_spi *mpc8xxx_spi) \type *rx = mpc8xxx_spi->rx; \ *rx++ = (type)(data >> mpc8xxx_spi->rx_shift); \ mpc8xxx_spi->rx = rx; \ -} +} \ +EXPORT_SYMBOL_GPL(mpc8xxx_spi_rx_buf_##type);#define MPC8XXX_SPI_TX_BUF (type) \ u32 mpc8xxx_spi_tx_buf_##type(struct mpc8xxx_spi *mpc8xxx_spi) \
@@ -47,7 +49,8 @@ u32 mpc8xxx_spi_tx_buf_##type(struct mpc8xxx_spi *mpc8xxx_spi) \ data = *tx++ << mpc8xxx_spi->tx_shift; \ mpc8xxx_spi->tx = tx; \return data; \ -} +} \ +EXPORT_SYMBOL_GPL(mpc8xxx_spi_tx_buf_##type);MPC8XXX_SPI_RX_BUF (u8)MPC8XXX_SPI_RX_BUF (u16)
@@ -60,6 +63,7 @@ struct mpc8xxx_spi_probe_info *to_of_pinfo(struct fsl_spi_platform_data *pdata) { return container_of(pdata, struct mpc8xxx_spi_probe_info, pdata); } +EXPORT_SYMBOL_GPL (to_of_pinfo);const char *mpc8xxx_spi_strmode (unsigned int flags) {
@@ -75,6 +79,7 @@ const char *mpc8xxx_spi_strmode(unsigned int flags) }return "CPU" ; } +EXPORT_SYMBOL_GPL (mpc8xxx_spi_strmode);void mpc8xxx_spi_probe (struct device *dev,struct resource *mem,unsigned int irq)
@@ -107,6 +112,7 @@ void mpc8xxx_spi_probe(struct device *dev, struct resource *mem,init_completion (&mpc8xxx_spi->done); } +EXPORT_SYMBOL_GPL (mpc8xxx_spi_probe);int mpc8xxx_spi_remove (struct device *dev) {
@@ -125,6 +131,7 @@ int mpc8xxx_spi_remove(struct device *dev)return 0 ; } +EXPORT_SYMBOL_GPL (mpc8xxx_spi_remove);int of_mpc8xxx_spi_probe (struct platform_device *ofdev) {
@@ -171,3 +178,6 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)return 0 ; } +EXPORT_SYMBOL_GPL (of_mpc8xxx_spi_probe); + +MODULE_LICENSE ("GPL" );
drivers/spi/spi-fsl-lib.h +2 -2
@@ -28,7 +28,7 @@ struct mpc8xxx_spi {/* rx & tx bufs from the spi_transfer */ const void *tx;void *rx; -#ifdef CONFIG_SPI_FSL_ESPI +#if IS_ENABLED (CONFIG_SPI_FSL_ESPI )int len;#endif
@@ -68,7 +68,7 @@ struct mpc8xxx_spi {unsigned int flags; -#ifdef CONFIG_SPI_FSL_SPI +#if IS_ENABLED (CONFIG_SPI_FSL_SPI )int type;int native_chipselects;u8 max_bits_per_word;
Signature · 1 line
2.1.4
Quoted 3 lines · On Tue, Jan 06, 2015 at 02:07:34PM +0100, [email protected] wrote:
From: Esben Haabendal <[email protected]>
Signed-off-by Esben Haabendal <[email protected]>
Applied, thanks.