summaryrefslogtreecommitdiff
path: root/linux_spi.c
diff options
context:
space:
mode:
authorstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2015-11-14 02:55:12 +0000
committerstefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2015-11-14 02:55:12 +0000
commitab3d79163f58616e14b6f3a0f7e95ac6fc689ba3 (patch)
tree191a9906cb0cc117bd682167bcfea520d9d19c44 /linux_spi.c
parentccce6a39e8ed7d17e0ebc0127138197a829a5db9 (diff)
downloadflashrom-ab3d79163f58616e14b6f3a0f7e95ac6fc689ba3.tar.gz
Add (implicit) support for musl libc.
This is mostly achieved by fixing or refining the inclusion of header files and replacing glibc-specific ifdefs with more generic ones. - <sys/io.h>: Contains iopl(2) and x86 I/O port access functions (inb, outb etc). Generally Linux-specific but also availble on debian/kFreeBSD. Provided by glibc as well as musl and uclibc. Include it if we are running Linux or if glibc is detected. - <sys/fcntl.h>: should be (and is) replaced by <fcntl.h> (without the "sys" prefix). - <linux/spi/spidev.h>: Does not include all necessary headers, namely _IOC_SIZEBITS that is used in the definition of SPI_MSGSIZE is not brought in via <linux/ioctl.h> but instead we relied so far on glibc's including it via <sys/ioctl.h>. Change that to explicitly including <linux/ioctl.h>. - <endian.h>: Would also be available in musl but there is no easy way to detect it so we do not try yet. The bug report and initial patches were Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1898 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'linux_spi.c')
-rw-r--r--linux_spi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/linux_spi.c b/linux_spi.c
index 26725e1..19b4965 100644
--- a/linux_spi.c
+++ b/linux_spi.c
@@ -22,13 +22,14 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <unistd.h>
+#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
-#include <sys/ioctl.h>
+#include <linux/ioctl.h>
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"