Move laptops examples to samples and remove it from Documentation
Makefile. Create a new Makefile to build laptops. It can be built
from top level directory or from laptops directory:
Run make -C samples/laptops or cd samples/laptops; make
Signed-off-by: Shuah Khan
---
Documentation/Makefile | 2 +-
Documentation/laptops/.gitignore | 1 -
Documentation/laptops/Makefile | 5 --
Documentation/laptops/dslm.c | 166 ---
samples/laptops/.gitignore | 1 +
samples/laptops/Makefile | 9 +++
samples/laptops/dslm.c | 166 +++
7 files changed, 177 insertions(+), 173 deletions(-)
delete mode 100644 Documentation/laptops/.gitignore
delete mode 100644 Documentation/laptops/Makefile
delete mode 100644 Documentation/laptops/dslm.c
create mode 100644 samples/laptops/.gitignore
create mode 100644 samples/laptops/Makefile
create mode 100644 samples/laptops/dslm.c
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 60ec0dc..539120b 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1 +1 @@
-subdir-y := blackfin laptops mic misc-devices pcmcia timers watchdog
+subdir-y := blackfin mic misc-devices pcmcia timers watchdog
diff --git a/Documentation/laptops/.gitignore b/Documentation/laptops/.gitignore
deleted file mode 100644
index 9fc984e..000
--- a/Documentation/laptops/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dslm
diff --git a/Documentation/laptops/Makefile b/Documentation/laptops/Makefile
deleted file mode 100644
index 0abe44f..000
--- a/Documentation/laptops/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-y := dslm
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
diff --git a/Documentation/laptops/dslm.c b/Documentation/laptops/dslm.c
deleted file mode 100644
index d5dd2d4..000
--- a/Documentation/laptops/dslm.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * dslm.c
- * Simple Disk Sleep Monitor
- * by Bartek Kania
- * Licensed under the GPL
- */
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#ifdef DEBUG
-#define D(x) x
-#else
-#define D(x)
-#endif
-
-int endit = 0;
-
-/* Check if the disk is in powersave-mode
- * Most of the code is stolen from hdparm.
- * 1 = active, 0 = standby/sleep, -1 = unknown */
-static int check_powermode(int fd)
-{
-unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0};
-int state;
-
-if (ioctl(fd, HDIO_DRIVE_CMD, )
- && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */
- && ioctl(fd, HDIO_DRIVE_CMD, )) {
- if (errno != EIO || args[0] != 0 || args[1] != 0) {
- state = -1; /* "unknown"; */
- } else
- state = 0; /* "sleeping"; */
-} else {
- state = (args[2] == 255) ? 1 : 0;
-}
-D(printf(" drive state is: %d\n", state));
-
-return state;
-}
-
-static char *state_name(int i)
-{
-if (i == -1) return "unknown";
-if (i == 0) return "sleeping";
-if (i == 1) return "active";
-
-return "internal error";
-}
-
-static char *myctime(time_t time)
-{
-char *ts = ctime();
-ts[strlen(ts) - 1] = 0;
-
-return ts;
-}
-
-static void measure(int fd)
-{
-time_t start_time;
-int last_state;
-time_t last_time;
-int curr_state;
-time_t curr_time = 0;
-time_t time_diff;
-time_t active_time = 0;
-time_t sleep_time = 0;
-time_t unknown_time = 0;
-time_t total_time = 0;
-int changes = 0;
-float tmp;
-
-printf("Starting measurements\n");
-
-last_state = check_powermode(fd);
-start_time = last_time = time(0);
-printf(" System is in state %s\n\n", state_name(last_state));
-
-while(!endit) {
- sleep(1);
- curr_state = check_powermode(fd);
-
- if (curr_state != last_state || endit) {
- changes++;
- curr_time = time(0);
- time_diff = curr_time - last_time;
-
- if (last_state == 1) active_time += time_diff;
- else if (last_state == 0) sleep_time += time_diff;
- else unknown_time += time_diff;
-
- last_state = curr_state;
- last_time = curr_time;
-
- printf("%s: State-change to %s\n", myctime(curr_time),
- state_name(curr_state));
- }
-}
-changes--; /* Compensate for SIGINT */
-
-total_time = time(0) - start_time;
-printf("\nTotal running time: %lus\n", curr_time - start_time);
-printf(" State changed %d times\n", changes);
-
-tmp = (float)sleep_time / (float)total_time * 100;
-printf(" Time in sleep state: %lus (%.2f%%)\n", sleep_time, tmp);
-tmp = (float)active_time / (float)total_time * 100;
-printf(" Time in active state: %lus (%.2f%%)\n", active_time, tmp);
-tmp = (float)unknown_time / (float)total_time * 100;
-printf(" Time in unknown state: %lus (%.2f%%)\n",