Re: [PATCH v2 0/3] Move runnable tools from Documentation to tools

2016-09-23 Thread Shuah Khan
On 09/22/2016 08:57 AM, Jonathan Corbet wrote:
> On Wed, 21 Sep 2016 18:51:10 -0600
> Shuah Khan <shua...@osg.samsung.com> wrote:
> 
>> Move runnable tools from Documentation to tools. I moved just the
>> tools code, and left documentation files as is.
>>
>> Based on the v1 series feedback, This v2 series moves accounting,
>> laptops/dslm, and pcmcia to tools.
>>
>> If v2 patches look good, and if I get an okay, I will try to get
>> these into 4.9-rc1
> 
> Acked-by: Jonathan Corbet <cor...@lwn.net>
> 
> Though I still wonder if we really need to keep some of those tools...
> 
> jon
> 

I am a bit skeptical about laptop/dslm and pcmcia whether or not
we still need them. I am afraid as soon we delete somebody will
miss it.

How about we go ahead and move it under tools and make a call in
a couple of releases? I have to make a note of that and delete
them.

thanks,
-- Shuah


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH v2 1/3] tools: move accounting tool from Documentation

2016-09-21 Thread Shuah Khan
Move accounting tool to tools and remove it from Documentation
Makefile. Update location information for this tool. Create a
new Makefile to build accounting. It can be built from top level
directory or from accounting directory:

Run make -C tools/accounting or cd tools/accounting; make

Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
---
 Documentation/Makefile|   2 +-
 Documentation/accounting/.gitignore   |   1 -
 Documentation/accounting/Makefile |   7 -
 Documentation/accounting/delay-accounting.txt |   6 +-
 Documentation/accounting/getdelays.c  | 550 --
 tools/accounting/.gitignore   |   1 +
 tools/accounting/Makefile |   9 +
 tools/accounting/getdelays.c  | 550 ++
 8 files changed, 564 insertions(+), 562 deletions(-)
 delete mode 100644 Documentation/accounting/.gitignore
 delete mode 100644 Documentation/accounting/Makefile
 delete mode 100644 Documentation/accounting/getdelays.c
 create mode 100644 tools/accounting/.gitignore
 create mode 100644 tools/accounting/Makefile
 create mode 100644 tools/accounting/getdelays.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0b8cd50..e4dd5e4 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1,2 @@
-subdir-y := accounting blackfin \
+subdir-y := blackfin \
laptops pcmcia
diff --git a/Documentation/accounting/.gitignore 
b/Documentation/accounting/.gitignore
deleted file mode 100644
index 8648520..000
--- a/Documentation/accounting/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-getdelays
diff --git a/Documentation/accounting/Makefile 
b/Documentation/accounting/Makefile
deleted file mode 100644
index 7e232cb..000
--- a/Documentation/accounting/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# List of programs to build
-hostprogs-y := getdelays
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
-
-HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include
diff --git a/Documentation/accounting/delay-accounting.txt 
b/Documentation/accounting/delay-accounting.txt
index 8a12f07..042ea59 100644
--- a/Documentation/accounting/delay-accounting.txt
+++ b/Documentation/accounting/delay-accounting.txt
@@ -54,9 +54,9 @@ are sent to userspace without requiring a command. If it is 
the last exiting
 task of a thread group, the per-tgid statistics are also sent. More details
 are given in the taskstats interface description.
 
-The getdelays.c userspace utility in this directory allows simple commands to
-be run and the corresponding delay statistics to be displayed. It also serves
-as an example of using the taskstats interface.
+The getdelays.c userspace utility in tools/accounting directory allows simple
+commands to be run and the corresponding delay statistics to be displayed. It
+also serves as an example of using the taskstats interface.
 
 Usage
 -
diff --git a/Documentation/accounting/getdelays.c 
b/Documentation/accounting/getdelays.c
deleted file mode 100644
index b5ca536..000
--- a/Documentation/accounting/getdelays.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* getdelays.c
- *
- * Utility to get per-pid and per-tgid delay accounting statistics
- * Also illustrates usage of the taskstats interface
- *
- * Copyright (C) Shailabh Nagar, IBM Corp. 2005
- * Copyright (C) Balbir Singh, IBM Corp. 2006
- * Copyright (c) Jay Lan, SGI. 2006
- *
- * Compile with
- * gcc -I/usr/src/linux/include getdelays.c -o getdelays
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-/*
- * Generic macros for dealing with netlink sockets. Might be duplicated
- * elsewhere. It is recommended that commercial grade applications use
- * libnl or libnetlink and use the interfaces provided by the library
- */
-#define GENLMSG_DATA(glh)  ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
-#define GENLMSG_PAYLOAD(glh)   (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
-#define NLA_DATA(na)   ((void *)((char*)(na) + NLA_HDRLEN))
-#define NLA_PAYLOAD(len)   (len - NLA_HDRLEN)
-
-#define err(code, fmt, arg...) \
-   do {\
-   fprintf(stderr, fmt, ##arg);\
-   exit(code); \
-   } while (0)
-
-int done;
-int rcvbufsz;
-char name[100];
-int dbg;
-int print_delays;
-int print_io_accounting;
-int print_task_context_switch_counts;
-
-#define PRINTF(fmt, arg...) {  \
-   if (dbg) {  \
-   printf(fmt, ##arg); \
-   }   \
-   }
-
-/* Maximum size of response requested or message sent */
-#define MAX_MSG_SIZE   1024
-/* Maximum number of cpus expected to be specified in a cpumask */
-#define MAX_CPUS   32
-
-struct msgtemplate {
-   

Re: [PATCH 3/8] samples: move laptops example code from Documentation

2016-09-20 Thread Shuah Khan
On 09/19/2016 10:10 AM, Jonathan Corbet wrote:
> On Mon, 19 Sep 2016 08:47:34 -0600
> Shuah Khan <shua...@osg.samsung.com> wrote:
> 
>> 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:
> 
> This one might be better called a "tool" rather than a "sample" - assuming
> it actually still works, of course.  It hasn't seen a real update in the
> Git era, which is a bit disconcerting.  Is it possible that this is dead
> code that we might want to just get rid of?

I can send a removal patch and see if anybody objects. :)

> 
> If it stays, Documentation/laptops/laptop-mode.txt needs an update.

Right. Looks like I missed Documentation updates for these moves. I get
that done in v2.

thanks,
-- Shuah

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


Re: [PATCH 1/8] samples: move accounting example code from Documentation

2016-09-20 Thread Shuah Khan
On 09/19/2016 10:02 AM, Jonathan Corbet wrote:
> On Mon, 19 Sep 2016 08:47:32 -0600
> Shuah Khan <shua...@osg.samsung.com> wrote:
> 
>> Move accounting examples to samples and remove it from Documentation
>> Makefile. Create a new Makefile to build accounting. It can be built
>> from top level directory or from accounting directory:
> 
> So I like the basic idea of these patches; it's the direction we've been
> trying to push things for a little bit.  I have a couple of specific
> comments for this one that may well apply to the others as well.
> 
> 1) Is samples the right destination for these utilities?  Some of them
>might well be better placed under tools/ instead.  I'm not sure we've
>ever formally stated the purpose of those two subtrees; I see samples/
>as demonstrations of how to use something, while tools/ are utilities
>you might actually want to use for some purpose.  Something like
>getdelays might well fall into the latter group.  But maybe others
>disagree?

getdelays stumped me a bit. My first choice was tools and then I noticed
that the documentation says it is a tool and an example usage of taskstruct.
I am not set on tools or samples as location for this. I can move it to
tools instead.

> 
> 2) Tools like getdelays are referenced in the documents that have been
>left behind; see accounting/delay-accounting.txt, for example.  Those
>documents should be updated so that readers know where to find the
>referenced programs, wherever they end up.  Converting them to Sphinx
>while you're at it is an extra-credit exercise :)

Right. Documents need updates and also the 00-Index files. I agree with
you that converting to Sphinx makes sense. There will be some learning
curve on my part. I can take this one once the move happens and do the
Documentation and 00-Index file updates.

thanks,
-- Shuah

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 1/8] samples: move accounting example code from Documentation

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

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

Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
---
 Documentation/Makefile   |   2 +-
 Documentation/accounting/.gitignore  |   1 -
 Documentation/accounting/Makefile|   7 -
 Documentation/accounting/getdelays.c | 550 ---
 samples/accounting/.gitignore|   1 +
 samples/accounting/Makefile  |   9 +
 samples/accounting/getdelays.c   | 550 +++
 7 files changed, 561 insertions(+), 559 deletions(-)
 delete mode 100644 Documentation/accounting/.gitignore
 delete mode 100644 Documentation/accounting/Makefile
 delete mode 100644 Documentation/accounting/getdelays.c
 create mode 100644 samples/accounting/.gitignore
 create mode 100644 samples/accounting/Makefile
 create mode 100644 samples/accounting/getdelays.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index f530c29..58c6629 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,2 +1,2 @@
-subdir-y := accounting auxdisplay blackfin \
+subdir-y := auxdisplay blackfin \
laptops mic misc-devices pcmcia timers watchdog
diff --git a/Documentation/accounting/.gitignore 
b/Documentation/accounting/.gitignore
deleted file mode 100644
index 8648520..000
--- a/Documentation/accounting/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-getdelays
diff --git a/Documentation/accounting/Makefile 
b/Documentation/accounting/Makefile
deleted file mode 100644
index 7e232cb..000
--- a/Documentation/accounting/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# List of programs to build
-hostprogs-y := getdelays
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
-
-HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include
diff --git a/Documentation/accounting/getdelays.c 
b/Documentation/accounting/getdelays.c
deleted file mode 100644
index b5ca536..000
--- a/Documentation/accounting/getdelays.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* getdelays.c
- *
- * Utility to get per-pid and per-tgid delay accounting statistics
- * Also illustrates usage of the taskstats interface
- *
- * Copyright (C) Shailabh Nagar, IBM Corp. 2005
- * Copyright (C) Balbir Singh, IBM Corp. 2006
- * Copyright (c) Jay Lan, SGI. 2006
- *
- * Compile with
- * gcc -I/usr/src/linux/include getdelays.c -o getdelays
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
-/*
- * Generic macros for dealing with netlink sockets. Might be duplicated
- * elsewhere. It is recommended that commercial grade applications use
- * libnl or libnetlink and use the interfaces provided by the library
- */
-#define GENLMSG_DATA(glh)  ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
-#define GENLMSG_PAYLOAD(glh)   (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
-#define NLA_DATA(na)   ((void *)((char*)(na) + NLA_HDRLEN))
-#define NLA_PAYLOAD(len)   (len - NLA_HDRLEN)
-
-#define err(code, fmt, arg...) \
-   do {\
-   fprintf(stderr, fmt, ##arg);\
-   exit(code); \
-   } while (0)
-
-int done;
-int rcvbufsz;
-char name[100];
-int dbg;
-int print_delays;
-int print_io_accounting;
-int print_task_context_switch_counts;
-
-#define PRINTF(fmt, arg...) {  \
-   if (dbg) {  \
-   printf(fmt, ##arg); \
-   }   \
-   }
-
-/* Maximum size of response requested or message sent */
-#define MAX_MSG_SIZE   1024
-/* Maximum number of cpus expected to be specified in a cpumask */
-#define MAX_CPUS   32
-
-struct msgtemplate {
-   struct nlmsghdr n;
-   struct genlmsghdr g;
-   char buf[MAX_MSG_SIZE];
-};
-
-char cpumask[100+6*MAX_CPUS];
-
-static void usage(void)
-{
-   fprintf(stderr, "getdelays [-dilv] [-w logfile] [-r bufsize] "
-   "[-m cpumask] [-t tgid] [-p pid]\n");
-   fprintf(stderr, "  -d: print delayacct stats\n");
-   fprintf(stderr, "  -i: print IO accounting (works only with -p)\n");
-   fprintf(stderr, "  -l: listen forever\n");
-   fprintf(stderr, "  -v: debug on\n");
-   fprintf(stderr, "  -C: container path\n");
-}
-
-/*
- * Create a raw netlink socket and bind
- */
-static int create_nl_socket(int protocol)
-{
-   int fd;
-   struct sockaddr_nl local;
-
-   fd = socket(AF_NETLINK, SOCK_RAW, protocol);
-   if (fd < 0)
-   return -1;
-
-   if (rcvbufsz)
-   if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF,
-  

[PATCH 5/8] samples: move misc-devices/mei example code from Documentation

2016-09-19 Thread Shuah Khan
Move misc-devices/mei examples to samples/mei and remove it from
Documentation Makefile. Delete misc-devices/Makefile.

Create a new Makefile to build samples/mei. It can be built from top
level directory or from mei directory:

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

Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
---
 Documentation/Makefile   |   2 +-
 Documentation/misc-devices/Makefile  |   1 -
 Documentation/misc-devices/mei/.gitignore|   1 -
 Documentation/misc-devices/mei/Makefile  |   5 -
 Documentation/misc-devices/mei/TODO  |   2 -
 Documentation/misc-devices/mei/mei-amt-version.c | 479 ---
 samples/mei/.gitignore   |   1 +
 samples/mei/Makefile |   9 +
 samples/mei/TODO |   2 +
 samples/mei/mei-amt-version.c| 479 +++
 10 files changed, 492 insertions(+), 489 deletions(-)
 delete mode 100644 Documentation/misc-devices/Makefile
 delete mode 100644 Documentation/misc-devices/mei/.gitignore
 delete mode 100644 Documentation/misc-devices/mei/Makefile
 delete mode 100644 Documentation/misc-devices/mei/TODO
 delete mode 100644 Documentation/misc-devices/mei/mei-amt-version.c
 create mode 100644 samples/mei/.gitignore
 create mode 100644 samples/mei/Makefile
 create mode 100644 samples/mei/TODO
 create mode 100644 samples/mei/mei-amt-version.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 90271bc..ac7d68f 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1 +1 @@
-subdir-y := blackfin misc-devices pcmcia timers watchdog
+subdir-y := blackfin pcmcia timers watchdog
diff --git a/Documentation/misc-devices/Makefile 
b/Documentation/misc-devices/Makefile
deleted file mode 100644
index e2b7aa4..000
--- a/Documentation/misc-devices/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-subdir-y := mei
diff --git a/Documentation/misc-devices/mei/.gitignore 
b/Documentation/misc-devices/mei/.gitignore
deleted file mode 100644
index f356b81..000
--- a/Documentation/misc-devices/mei/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-mei-amt-version
diff --git a/Documentation/misc-devices/mei/Makefile 
b/Documentation/misc-devices/mei/Makefile
deleted file mode 100644
index d758047..000
--- a/Documentation/misc-devices/mei/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-y := mei-amt-version
-HOSTCFLAGS_mei-amt-version.o += -I$(objtree)/usr/include
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
diff --git a/Documentation/misc-devices/mei/TODO 
b/Documentation/misc-devices/mei/TODO
deleted file mode 100644
index 6b3625d..000
--- a/Documentation/misc-devices/mei/TODO
+++ /dev/null
@@ -1,2 +0,0 @@
-TODO:
-   - Cleanup and split the timer function
diff --git a/Documentation/misc-devices/mei/mei-amt-version.c 
b/Documentation/misc-devices/mei/mei-amt-version.c
deleted file mode 100644
index 57d0d87..000
--- a/Documentation/misc-devices/mei/mei-amt-version.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/**
- * Intel Management Engine Interface (Intel MEI) Linux driver
- * Intel MEI Interface Header
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2012 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- * Intel Corporation.
- * linux-...@linux.intel.com
- * http://www.intel.com
- *
- * BSD LICENSE
- *
- * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  * Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *notice, this list of cond

[PATCH 7/8] samples: move timers example code from Documentation

2016-09-19 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

Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
---
 Documentation/Makefile  |   2 +-
 Documentation/timers/.gitignore |   1 -
 Documentation/timers/Makefile   |   5 -
 Documentation/timers/hpet_example.c | 294 
 samples/timers/.gitignore   |   1 +
 samples/timers/Makefile |  15 ++
 samples/timers/hpet_example.c   | 294 
 7 files changed, 311 insertions(+), 301 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 bd5f115..9c3fe11 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1 +1 @@
-subdir-y := blackfin timers watchdog
+subdir-y := blackfin 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_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]);
-   return;
-   }
-
-   if (ioctl(fd, HPET_INFO, ) < 0) {
-   fprintf(stderr, "hpet_info: failed to get info\n");
-   goto out;
-   }
-
-   fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ",
-   info.hi_ireqfreq, info.hi_flags);
-   fprintf(stderr, "hi_hpet %d hi_timer %d\n",
-   info.hi_hpet, info

[PATCH 8/8] samples: move watchdog example code from Documentation

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

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

Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
---
 Documentation/Makefile   |  2 +-
 Documentation/watchdog/Makefile  |  1 -
 Documentation/watchdog/src/.gitignore|  1 -
 Documentation/watchdog/src/Makefile  |  5 -
 Documentation/watchdog/src/watchdog-simple.c | 24 
 samples/watchdog/.gitignore  |  1 +
 samples/watchdog/Makefile|  8 
 samples/watchdog/watchdog-simple.c   | 24 
 8 files changed, 34 insertions(+), 32 deletions(-)
 delete mode 100644 Documentation/watchdog/Makefile
 delete mode 100644 Documentation/watchdog/src/.gitignore
 delete mode 100644 Documentation/watchdog/src/Makefile
 delete mode 100644 Documentation/watchdog/src/watchdog-simple.c
 create mode 100644 samples/watchdog/.gitignore
 create mode 100644 samples/watchdog/Makefile
 create mode 100644 samples/watchdog/watchdog-simple.c

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 9c3fe11..8435965 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1 +1 @@
-subdir-y := blackfin watchdog
+subdir-y := blackfin
diff --git a/Documentation/watchdog/Makefile b/Documentation/watchdog/Makefile
deleted file mode 100644
index 6018f45..000
--- a/Documentation/watchdog/Makefile
+++ /dev/null
@@ -1 +0,0 @@
-subdir-y := src
diff --git a/Documentation/watchdog/src/.gitignore 
b/Documentation/watchdog/src/.gitignore
deleted file mode 100644
index ff0ebb5..000
--- a/Documentation/watchdog/src/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-watchdog-simple
diff --git a/Documentation/watchdog/src/Makefile 
b/Documentation/watchdog/src/Makefile
deleted file mode 100644
index 47be791..000
--- a/Documentation/watchdog/src/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# List of programs to build
-hostprogs-y := watchdog-simple
-
-# Tell kbuild to always build the programs
-always := $(hostprogs-y)
diff --git a/Documentation/watchdog/src/watchdog-simple.c 
b/Documentation/watchdog/src/watchdog-simple.c
deleted file mode 100644
index ba45803..000
--- a/Documentation/watchdog/src/watchdog-simple.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-int main(void)
-{
-   int fd = open("/dev/watchdog", O_WRONLY);
-   int ret = 0;
-   if (fd == -1) {
-   perror("watchdog");
-   exit(EXIT_FAILURE);
-   }
-   while (1) {
-   ret = write(fd, "\0", 1);
-   if (ret != 1) {
-   ret = -1;
-   break;
-   }
-   sleep(10);
-   }
-   close(fd);
-   return ret;
-}
diff --git a/samples/watchdog/.gitignore b/samples/watchdog/.gitignore
new file mode 100644
index 000..ff0ebb5
--- /dev/null
+++ b/samples/watchdog/.gitignore
@@ -0,0 +1 @@
+watchdog-simple
diff --git a/samples/watchdog/Makefile b/samples/watchdog/Makefile
new file mode 100644
index 000..9b53d89
--- /dev/null
+++ b/samples/watchdog/Makefile
@@ -0,0 +1,8 @@
+CC := $(CROSS_COMPILE)gcc
+PROGS := watchdog-simple
+
+all: $(PROGS)
+
+clean:
+   rm -fr $(PROGS)
+
diff --git a/samples/watchdog/watchdog-simple.c 
b/samples/watchdog/watchdog-simple.c
new file mode 100644
index 000..ba45803
--- /dev/null
+++ b/samples/watchdog/watchdog-simple.c
@@ -0,0 +1,24 @@
+#include 
+#include 
+#include 
+#include 
+
+int main(void)
+{
+   int fd = open("/dev/watchdog", O_WRONLY);
+   int ret = 0;
+   if (fd == -1) {
+   perror("watchdog");
+   exit(EXIT_FAILURE);
+   }
+   while (1) {
+   ret = write(fd, "\0", 1);
+   if (ret != 1) {
+   ret = -1;
+   break;
+   }
+   sleep(10);
+   }
+   close(fd);
+   return ret;
+}
-- 
2.7.4


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[PATCH 0/8] Move runnable examples code from Documentation to samples

2016-09-19 Thread Shuah Khan
Move runnable examples code from Documentation to samples. I moved
just the example code, and left documentation files as is.

blackfin gptimers example code needs a bit of special handling since
it is a module. I will address it in a separate patch. 00-Index files
need to be updated due to this move which will be done another patch.

Shuah Khan (8):
  samples: move accounting example code from Documentation
  samples: move auxdisplay example code from Documentation
  samples: move laptops example code from Documentation
  samples: move mic/mpssd example code from Documentation
  samples: move misc-devices/mei example code from Documentation
  samples: move pcmcia example code from Documentation
  samples: move timers example code from Documentation
  samples: move watchdog example code from Documentation

 Documentation/Makefile   |3 +-
 Documentation/accounting/.gitignore  |1 -
 Documentation/accounting/Makefile|7 -
 Documentation/accounting/getdelays.c |  550 ---
 Documentation/auxdisplay/.gitignore  |1 -
 Documentation/auxdisplay/Makefile|7 -
 Documentation/auxdisplay/cfag12864b-example.c|  281 
 Documentation/laptops/.gitignore |1 -
 Documentation/laptops/Makefile   |5 -
 Documentation/laptops/dslm.c |  166 --
 Documentation/mic/Makefile   |1 -
 Documentation/mic/mpssd/.gitignore   |1 -
 Documentation/mic/mpssd/Makefile |   21 -
 Documentation/mic/mpssd/micctrl  |  173 --
 Documentation/mic/mpssd/mpss |  200 ---
 Documentation/mic/mpssd/mpssd.c  | 1826 --
 Documentation/mic/mpssd/mpssd.h  |  103 --
 Documentation/mic/mpssd/sysfs.c  |  102 --
 Documentation/misc-devices/Makefile  |1 -
 Documentation/misc-devices/mei/.gitignore|1 -
 Documentation/misc-devices/mei/Makefile  |5 -
 Documentation/misc-devices/mei/TODO  |2 -
 Documentation/misc-devices/mei/mei-amt-version.c |  479 --
 Documentation/pcmcia/.gitignore  |1 -
 Documentation/pcmcia/Makefile|7 -
 Documentation/pcmcia/crc32hash.c |   32 -
 Documentation/timers/.gitignore  |1 -
 Documentation/timers/Makefile|5 -
 Documentation/timers/hpet_example.c  |  294 
 Documentation/watchdog/Makefile  |1 -
 Documentation/watchdog/src/.gitignore|1 -
 Documentation/watchdog/src/Makefile  |5 -
 Documentation/watchdog/src/watchdog-simple.c |   24 -
 samples/accounting/.gitignore|1 +
 samples/accounting/Makefile  |9 +
 samples/accounting/getdelays.c   |  550 +++
 samples/auxdisplay/.gitignore|1 +
 samples/auxdisplay/Makefile  |9 +
 samples/auxdisplay/cfag12864b-example.c  |  281 
 samples/laptops/.gitignore   |1 +
 samples/laptops/Makefile |9 +
 samples/laptops/dslm.c   |  166 ++
 samples/mei/.gitignore   |1 +
 samples/mei/Makefile |9 +
 samples/mei/TODO |2 +
 samples/mei/mei-amt-version.c|  479 ++
 samples/mic/mpssd/.gitignore |1 +
 samples/mic/mpssd/Makefile   |   27 +
 samples/mic/mpssd/micctrl|  173 ++
 samples/mic/mpssd/mpss   |  200 +++
 samples/mic/mpssd/mpssd.c| 1826 ++
 samples/mic/mpssd/mpssd.h|  103 ++
 samples/mic/mpssd/sysfs.c|  102 ++
 samples/pcmcia/.gitignore|1 +
 samples/pcmcia/Makefile  |9 +
 samples/pcmcia/crc32hash.c   |   32 +
 samples/timers/.gitignore|1 +
 samples/timers/Makefile  |   15 +
 samples/timers/hpet_example.c|  294 
 samples/watchdog/.gitignore  |1 +
 samples/watchdog/Makefile|8 +
 samples/watchdog/watchdog-simple.c   |   24 +
 62 files changed, 4336 insertions(+), 4307 deletions(-)
 delete mode 100644 Documentation/accounting/.gitignore
 delete mode 100644 Documentation/accounting/Makefile
 delete mode 100644 Documentation/accounting/getdelays.c
 delete mode 100644 Documentation/auxdisplay/.gitignore
 delete mode 100644 Documentation/auxdisplay/Makefile
 delete mode 100644 Documentation/auxdisplay/cfag12864b-example.c
 delete mode 100644 Documentation

[PATCH 3/8] samples: move laptops example code from Documentation

2016-09-19 Thread Shuah Khan
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 <shua...@osg.samsung.com>
---
 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 activ

[RFT][PATCH 00/12] change drivers power management to use dev_pm_ops

2014-02-10 Thread Shuah Khan
Change drivers to register pm ops using dev_pm_ops instead of legacy pm_ops.
.pm hooks call existing legacy suspend and resume interfaces by passing in
the right pm state. Bus drivers suspend and resume routines call .pm driver
hooks if found.

Shuah Khan (12):
  arm: change locomo platform and bus power management to use
dev_pm_ops
  arm: change sa platform and bus power management to use
dev_pm_ops
  arm: change scoop platform power management to use dev_pm_ops
  drivers/macintosh/adb: change platform power managemnet to use
dev_pm_ops
  mmc: change au1xmmc platform power management to use dev_pm_ops
  mmc: change bfin_sdh platform power management to use dev_pm_ops
  isa: change isa bus power managemnet to use dev_pm_ops
  mmc: change cb710-mmc platform power management to use dev_pm_ops
  mmc: change msm_sdcc platform power management to use dev_pm_ops
  mmc: change tmio_mmc platform power management to use dev_pm_ops
  drivers/pcmcia: change ds driver power management to use dev_pm_ops
  drivers/s390/crypto: change ap_bus driver power management to use
dev_pm_ops

 arch/arm/common/locomo.c |   93 +++---
 arch/arm/common/sa.c |   88 +++
 arch/arm/common/scoop.c  |   44 
 drivers/base/isa.c   |   30 --
 drivers/macintosh/adb.c  |   41 ---
 drivers/mmc/host/au1xmmc.c   |   43 +++
 drivers/mmc/host/bfin_sdh.c  |   40 +++---
 drivers/mmc/host/cb710-mmc.c |   37 +++--
 drivers/mmc/host/msm_sdcc.c  |   42 +++
 drivers/mmc/host/tmio_mmc.c  |   42 +++
 drivers/pcmcia/ds.c  |   36 +---
 drivers/s390/crypto/ap_bus.c |   30 --
 12 files changed, 481 insertions(+), 85 deletions(-)

-- 
1.7.10.4


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


[RFT][PATCH 11/12] drivers/pcmcia: change ds driver power management to use dev_pm_ops

2014-02-10 Thread Shuah Khan
Change ds driver to register pm ops using dev_pm_ops instead of legacy
pm_ops. .pm hooks call existing legacy suspend and resume interfaces
by passing in the right pm state.

Signed-off-by: Shuah Khan shuah...@samsung.com
---
 drivers/pcmcia/ds.c |   36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 757119b..2979323 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -962,7 +962,10 @@ static int pcmcia_bus_uevent(struct device *dev, struct 
kobj_uevent_env *env)
 
 / runtime PM support ***/
 
-static int pcmcia_dev_suspend(struct device *dev, pm_message_t state);
+static int __pcmcia_dev_suspend(struct device *dev, pm_message_t state);
+static int pcmcia_dev_suspend(struct device *dev);
+static int pcmcia_dev_poweroff(struct device *dev);
+static int pcmcia_dev_freeze(struct device *dev);
 static int pcmcia_dev_resume(struct device *dev);
 
 static int runtime_suspend(struct device *dev)
@@ -970,7 +973,7 @@ static int runtime_suspend(struct device *dev)
int rc;
 
device_lock(dev);
-   rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND);
+   rc = __pcmcia_dev_suspend(dev, PMSG_SUSPEND);
device_unlock(dev);
return rc;
 }
@@ -1120,7 +1123,22 @@ ATTRIBUTE_GROUPS(pcmcia_dev);
 
 /* PM support, also needed for reset */
 
-static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
+static int pcmcia_dev_suspend(struct device *dev)
+{
+   return __pcmcia_dev_suspend(dev, PMSG_SUSPEND);
+}
+
+static int pcmcia_dev_poweroff(struct device *dev)
+{
+   return __pcmcia_dev_suspend(dev, PMSG_HIBERNATE);
+}
+
+static int pcmcia_dev_freeze(struct device *dev)
+{
+   return __pcmcia_dev_suspend(dev, PMSG_FREEZE);
+}
+
+static int __pcmcia_dev_suspend(struct device *dev, pm_message_t state)
 {
struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
struct pcmcia_driver *p_drv = NULL;
@@ -1397,6 +1415,15 @@ static struct class_interface pcmcia_bus_interface 
__refdata = {
.remove_dev = pcmcia_bus_remove_socket,
 };
 
+static const struct dev_pm_ops pcmcia_bus_dev_pm_ops = {
+   .suspend = pcmcia_dev_suspend,
+   .resume = pcmcia_dev_resume,
+   /* Hibernate callbacks */
+   .freeze = pcmcia_dev_freeze,
+   .thaw = pcmcia_dev_resume,
+   .poweroff = pcmcia_dev_poweroff,
+   .restore = pcmcia_dev_resume,
+};
 
 struct bus_type pcmcia_bus_type = {
.name = pcmcia,
@@ -1405,8 +1432,7 @@ struct bus_type pcmcia_bus_type = {
.dev_groups = pcmcia_dev_groups,
.probe = pcmcia_device_probe,
.remove = pcmcia_device_remove,
-   .suspend = pcmcia_dev_suspend,
-   .resume = pcmcia_dev_resume,
+   .pm = pcmcia_bus_dev_pm_ops,
 };
 
 
-- 
1.7.10.4


___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia