[PATCH 6/6] samples: use uapiprogs support for uhid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



uhid was not included in the regular builds as it was not wired
up in samples/Makefile.

Fix build on sparc32 by defining __USE_GNU to get visibility to O_CLOEXEC.

Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Cc: David Herrmann <dh.herrmann@xxxxxxxxx>
Cc: Jiri Kosina <jkosina@xxxxxxx>
---
 samples/Makefile            |  1 +
 samples/uhid/Makefile       | 11 +----------
 samples/uhid/uhid-example.c |  5 ++++-
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/samples/Makefile b/samples/Makefile
index 8fc6c45..29a09bd 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_SAMPLES) += kdb/
 # user space programs
 subdir-$(CONFIG_SAMPLES) += seccomp
 subdir-$(CONFIG_SAMPLES) += hidraw
+subdir-$(CONFIG_SAMPLES) += uhid
diff --git a/samples/uhid/Makefile b/samples/uhid/Makefile
index c95a696..75ff2bb 100644
--- a/samples/uhid/Makefile
+++ b/samples/uhid/Makefile
@@ -1,10 +1 @@
-# kbuild trick to avoid linker error. Can be omitted if a module is built.
-obj- := dummy.o
-
-# List of programs to build
-hostprogs-y := uhid-example
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
-
-HOSTCFLAGS_uhid-example.o += -I$(objtree)/usr/include
+uapiprogs-y := uhid-example
diff --git a/samples/uhid/uhid-example.c b/samples/uhid/uhid-example.c
index f25a5ef..e4379c8 100644
--- a/samples/uhid/uhid-example.c
+++ b/samples/uhid/uhid-example.c
@@ -37,7 +37,6 @@
  */
 
 #include <errno.h>
-#include <fcntl.h>
 #include <poll.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -45,6 +44,10 @@
 #include <string.h>
 #include <termios.h>
 #include <unistd.h>
+
+#define __USE_GNU
+#include <fcntl.h>
+
 #include <linux/uhid.h>
 
 /*
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux