Re: [PATCH v2 2/4] samples: move timers example code from Documentation

2016-09-21 Thread Clemens Ladisch
Shuah Khan wrote:
> Move timers examples to samples and remove it from Documentation
> Makefile. Create a new Makefile to build timers. It can be built
> from top level directory or from timers directory:
>
> Run make -C samples/timers or cd samples/timers; make
>
> Acked-by: Jonathan Corbet 
> Signed-off-by: Shuah Khan 

Acked-by: Clemens Ladisch 


Re: [PATCH v2 2/4] samples: move timers example code from Documentation

2016-09-21 Thread Clemens Ladisch
Shuah Khan wrote:
> Move timers examples to samples and remove it from Documentation
> Makefile. Create a new Makefile to build timers. It can be built
> from top level directory or from timers directory:
>
> Run make -C samples/timers or cd samples/timers; make
>
> Acked-by: Jonathan Corbet 
> Signed-off-by: Shuah Khan 

Acked-by: Clemens Ladisch 


[PATCH v2 2/4] samples: move timers example code from Documentation

2016-09-21 Thread Shuah Khan
Move timers examples to samples and remove it from Documentation
Makefile. Create a new Makefile to build timers. It can be built
from top level directory or from timers directory:

Run make -C samples/timers or cd samples/timers; make

Acked-by: Jonathan Corbet 
Signed-off-by: Shuah Khan 
---
 Documentation/Makefile  |   2 +-
 Documentation/timers/.gitignore |   1 -
 Documentation/timers/Makefile   |   5 -
 Documentation/timers/hpet.txt   |   2 +-
 Documentation/timers/hpet_example.c | 294 
 samples/timers/.gitignore   |   1 +
 samples/timers/Makefile |  15 ++
 samples/timers/hpet_example.c   | 294 
 8 files changed, 312 insertions(+), 302 deletions(-)
 delete mode 100644 Documentation/timers/.gitignore
 delete mode 100644 Documentation/timers/Makefile
 delete mode 100644 Documentation/timers/hpet_example.c
 create mode 100644 samples/timers/.gitignore
 create mode 100644 samples/timers/Makefile
 create mode 100644 samples/timers/hpet_example.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 3c2a207..fc386b7 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1,2 @@
 subdir-y := accounting auxdisplay blackfin \
-   laptops pcmcia timers watchdog
+   laptops pcmcia watchdog
diff --git a/Documentation/timers/.gitignore b/Documentation/timers/.gitignore
deleted file mode 100644
index c5c45d7..000
--- a/Documentation/timers/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-hpet_example
diff --git a/Documentation/timers/Makefile b/Documentation/timers/Makefile
deleted file mode 100644
index 6c09ee6..000
--- a/Documentation/timers/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-$(CONFIG_X86) := hpet_example
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
diff --git a/Documentation/timers/hpet.txt b/Documentation/timers/hpet.txt
index a484d2c..895345e 100644
--- a/Documentation/timers/hpet.txt
+++ b/Documentation/timers/hpet.txt
@@ -25,4 +25,4 @@ arch/x86/kernel/hpet.c.
 
 The driver provides a userspace API which resembles the API found in the
 RTC driver framework.  An example user space program is provided in
-file:Documentation/timers/hpet_example.c
+file:samples/timers/hpet_example.c
diff --git a/Documentation/timers/hpet_example.c 
b/Documentation/timers/hpet_example.c
deleted file mode 100644
index 3ab4993..000
--- a/Documentation/timers/hpet_example.c
+++ /dev/null
@@ -1,294 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-
-extern void hpet_open_close(int, const char **);
-extern void hpet_info(int, const char **);
-extern void hpet_poll(int, const char **);
-extern void hpet_fasync(int, const char **);
-extern void hpet_read(int, const char **);
-
-#include 
-#include 
-
-struct hpet_command {
-   char*command;
-   void(*func)(int argc, const char ** argv);
-} hpet_command[] = {
-   {
-   "open-close",
-   hpet_open_close
-   },
-   {
-   "info",
-   hpet_info
-   },
-   {
-   "poll",
-   hpet_poll
-   },
-   {
-   "fasync",
-   hpet_fasync
-   },
-};
-
-int
-main(int argc, const char ** argv)
-{
-   unsigned inti;
-
-   argc--;
-   argv++;
-
-   if (!argc) {
-   fprintf(stderr, "-hpet: requires command\n");
-   return -1;
-   }
-
-
-   for (i = 0; i < (sizeof (hpet_command) / sizeof (hpet_command[0])); i++)
-   if (!strcmp(argv[0], hpet_command[i].command)) {
-   argc--;
-   argv++;
-   fprintf(stderr, "-hpet: executing %s\n",
-   hpet_command[i].command);
-   hpet_command[i].func(argc, argv);
-   return 0;
-   }
-
-   fprintf(stderr, "do_hpet: command %s not implemented\n", argv[0]);
-
-   return -1;
-}
-
-void
-hpet_open_close(int argc, const char **argv)
-{
-   int fd;
-
-   if (argc != 1) {
-   fprintf(stderr, "hpet_open_close: device-name\n");
-   return;
-   }
-
-   fd = open(argv[0], O_RDONLY);
-   if (fd < 0)
-   fprintf(stderr, "hpet_open_close: open failed\n");
-   else
-   close(fd);
-
-   return;
-}
-
-void
-hpet_info(int argc, const char **argv)
-{
-   struct hpet_infoinfo;
-   int fd;
-
-   if (argc != 1) {
-   fprintf(stderr, "hpet_info: device-name\n");
-   return;
-   }
-
-   fd = open(argv[0], O_RDONLY);
-   if (fd < 0) {
-   fprintf(stderr, "hpet_info: open of %s 

[PATCH v2 2/4] samples: move timers example code from Documentation

2016-09-21 Thread Shuah Khan
Move timers examples to samples and remove it from Documentation
Makefile. Create a new Makefile to build timers. It can be built
from top level directory or from timers directory:

Run make -C samples/timers or cd samples/timers; make

Acked-by: Jonathan Corbet 
Signed-off-by: Shuah Khan 
---
 Documentation/Makefile  |   2 +-
 Documentation/timers/.gitignore |   1 -
 Documentation/timers/Makefile   |   5 -
 Documentation/timers/hpet.txt   |   2 +-
 Documentation/timers/hpet_example.c | 294 
 samples/timers/.gitignore   |   1 +
 samples/timers/Makefile |  15 ++
 samples/timers/hpet_example.c   | 294 
 8 files changed, 312 insertions(+), 302 deletions(-)
 delete mode 100644 Documentation/timers/.gitignore
 delete mode 100644 Documentation/timers/Makefile
 delete mode 100644 Documentation/timers/hpet_example.c
 create mode 100644 samples/timers/.gitignore
 create mode 100644 samples/timers/Makefile
 create mode 100644 samples/timers/hpet_example.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 3c2a207..fc386b7 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1,2 @@
 subdir-y := accounting auxdisplay blackfin \
-   laptops pcmcia timers watchdog
+   laptops pcmcia watchdog
diff --git a/Documentation/timers/.gitignore b/Documentation/timers/.gitignore
deleted file mode 100644
index c5c45d7..000
--- a/Documentation/timers/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-hpet_example
diff --git a/Documentation/timers/Makefile b/Documentation/timers/Makefile
deleted file mode 100644
index 6c09ee6..000
--- a/Documentation/timers/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-$(CONFIG_X86) := hpet_example
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
diff --git a/Documentation/timers/hpet.txt b/Documentation/timers/hpet.txt
index a484d2c..895345e 100644
--- a/Documentation/timers/hpet.txt
+++ b/Documentation/timers/hpet.txt
@@ -25,4 +25,4 @@ arch/x86/kernel/hpet.c.
 
 The driver provides a userspace API which resembles the API found in the
 RTC driver framework.  An example user space program is provided in
-file:Documentation/timers/hpet_example.c
+file:samples/timers/hpet_example.c
diff --git a/Documentation/timers/hpet_example.c 
b/Documentation/timers/hpet_example.c
deleted file mode 100644
index 3ab4993..000
--- a/Documentation/timers/hpet_example.c
+++ /dev/null
@@ -1,294 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-
-extern void hpet_open_close(int, const char **);
-extern void hpet_info(int, const char **);
-extern void hpet_poll(int, const char **);
-extern void hpet_fasync(int, const char **);
-extern void hpet_read(int, const char **);
-
-#include 
-#include 
-
-struct hpet_command {
-   char*command;
-   void(*func)(int argc, const char ** argv);
-} hpet_command[] = {
-   {
-   "open-close",
-   hpet_open_close
-   },
-   {
-   "info",
-   hpet_info
-   },
-   {
-   "poll",
-   hpet_poll
-   },
-   {
-   "fasync",
-   hpet_fasync
-   },
-};
-
-int
-main(int argc, const char ** argv)
-{
-   unsigned inti;
-
-   argc--;
-   argv++;
-
-   if (!argc) {
-   fprintf(stderr, "-hpet: requires command\n");
-   return -1;
-   }
-
-
-   for (i = 0; i < (sizeof (hpet_command) / sizeof (hpet_command[0])); i++)
-   if (!strcmp(argv[0], hpet_command[i].command)) {
-   argc--;
-   argv++;
-   fprintf(stderr, "-hpet: executing %s\n",
-   hpet_command[i].command);
-   hpet_command[i].func(argc, argv);
-   return 0;
-   }
-
-   fprintf(stderr, "do_hpet: command %s not implemented\n", argv[0]);
-
-   return -1;
-}
-
-void
-hpet_open_close(int argc, const char **argv)
-{
-   int fd;
-
-   if (argc != 1) {
-   fprintf(stderr, "hpet_open_close: device-name\n");
-   return;
-   }
-
-   fd = open(argv[0], O_RDONLY);
-   if (fd < 0)
-   fprintf(stderr, "hpet_open_close: open failed\n");
-   else
-   close(fd);
-
-   return;
-}
-
-void
-hpet_info(int argc, const char **argv)
-{
-   struct hpet_infoinfo;
-   int fd;
-
-   if (argc != 1) {
-   fprintf(stderr, "hpet_info: device-name\n");
-   return;
-   }
-
-   fd = open(argv[0], O_RDONLY);
-   if (fd < 0) {
-   fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]);
-