diff options
author | Mike Fiore <mfiore@multitech.com> | 2014-10-08 10:38:26 -0500 |
---|---|---|
committer | Mike Fiore <mfiore@multitech.com> | 2014-10-08 10:38:26 -0500 |
commit | 72412963e66f4a2448fd87f455b33f3a5115f4bd (patch) | |
tree | b4d91a4a929356571fda47baafc600c11f842348 /io-module/mtac_gpiob.c | |
parent | b4e12fd5092d6de675da8c6a3629a23dcb5a34f2 (diff) | |
download | mts-io-72412963e66f4a2448fd87f455b33f3a5115f4bd.tar.gz mts-io-72412963e66f4a2448fd87f455b33f3a5115f4bd.tar.bz2 mts-io-72412963e66f4a2448fd87f455b33f3a5115f4bd.zip |
mts-io: remove all unused spi and adc code from mtcdp
remote board-temperature attribute
Diffstat (limited to 'io-module/mtac_gpiob.c')
-rw-r--r-- | io-module/mtac_gpiob.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/io-module/mtac_gpiob.c b/io-module/mtac_gpiob.c index 3f9631d..0485494 100644 --- a/io-module/mtac_gpiob.c +++ b/io-module/mtac_gpiob.c @@ -30,6 +30,43 @@ static bool gpiob_get_dev_info_from_modalias(const char* modalias, int* port, ch return true; } +/* Generic SPI functions */ +static inline int spi_writen(struct spi_device *spi, const u8 *buf, size_t len) +{ + int tmp; + u8 *tx; + + tx = kmalloc(len, GFP_KERNEL); + if (!tx) { + return -ENOMEM; + } + + memcpy(tx, buf, len); + tmp = spi_write(spi, tx, len); + + kfree(tx); + + return tmp; +} + +static inline int spi_readn(struct spi_device *spi, u8 *buf, size_t len) +{ + int tmp; + u8 *rx; + + rx = kmalloc(len, GFP_KERNEL); + if (!rx) { + return -ENOMEM; + } + + tmp = spi_read(spi, rx, len); + memcpy(buf, rx, len); + + kfree(rx); + + return tmp; +} + static int mts_spi_ap_probe(struct spi_device *spi) { int tmp; |