[lwn:docs-next 175/183] htmldocs: include/linux/jbd2.h:1047: warning: No description found for parameter 'j_chkpt_bhs'

2017-04-02 Thread kbuild test robot
tree:   git://git.lwn.net/linux-2.6 docs-next
head:   0e056eb5530da802c07f080d6bbd43c50e799efd
commit: f9b5c5304ce212b72c5c997b298ab96002e1634f [175/183] scripts/kernel-doc: 
fix handling of parameters with parenthesis
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   fs/inode.c:1666: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:442: warning: No description found for parameter 
'i_transaction'
   include/linux/jbd2.h:442: warning: No description found for parameter 
'i_next_transaction'
   include/linux/jbd2.h:442: warning: No description found for parameter 
'i_list'
   include/linux/jbd2.h:442: warning: No description found for parameter 
'i_vfs_inode'
   include/linux/jbd2.h:442: warning: No description found for parameter 
'i_flags'
   include/linux/jbd2.h:494: warning: No description found for parameter 
'h_rsv_handle'
   include/linux/jbd2.h:494: warning: No description found for parameter 
'h_reserved'
   include/linux/jbd2.h:494: warning: No description found for parameter 
'h_type'
   include/linux/jbd2.h:494: warning: No description found for parameter 
'h_line_no'
   include/linux/jbd2.h:494: warning: No description found for parameter 
'h_start_jiffies'
   include/linux/jbd2.h:494: warning: No description found for parameter 
'h_requested_credits'
>> include/linux/jbd2.h:1047: warning: No description found for parameter 
>> 'j_chkpt_bhs'
>> include/linux/jbd2.h:1047: warning: No description found for parameter 
>> 'j_devname'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_average_commit_time'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_min_batch_time'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_max_batch_time'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_commit_callback'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_failed_commit'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_chksum_driver'
   include/linux/jbd2.h:1047: warning: No description found for parameter 
'j_csum_seed'
   fs/jbd2/transaction.c:428: warning: No description found for parameter 
'rsv_blocks'
   fs/jbd2/transaction.c:428: warning: No description found for parameter 
'gfp_mask'
   fs/jbd2/transaction.c:428: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:428: warning: No description found for parameter 
'line_no'
   fs/jbd2/transaction.c:504: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:504: warning: No description found for parameter 
'line_no'
   fs/jbd2/transaction.c:634: warning: No description found for parameter 
'gfp_mask'

vim +/j_chkpt_bhs +1047 include/linux/jbd2.h

01b5adce Darrick J. Wong 2012-05-27  1031   struct crypto_shash 
*j_chksum_driver;
4fd5ea43 Darrick J. Wong 2012-05-27  1032  
4fd5ea43 Darrick J. Wong 2012-05-27  1033   /* Precomputed journal UUID 
checksum for seeding other checksums */
4fd5ea43 Darrick J. Wong 2012-05-27  1034   __u32 j_csum_seed;
ab714aff Jan Kara2016-06-30  1035  
ab714aff Jan Kara2016-06-30  1036  #ifdef CONFIG_DEBUG_LOCK_ALLOC
ab714aff Jan Kara2016-06-30  1037   /*
ab714aff Jan Kara2016-06-30  1038* Lockdep entity to track 
transaction commit dependencies. Handles
ab714aff Jan Kara2016-06-30  1039* hold this "lock" for read, 
when we wait for commit, we acquire the
ab714aff Jan Kara2016-06-30  1040* "lock" for writing. This 
matches the properties of jbd2 journalling
ab714aff Jan Kara2016-06-30  1041* where the running 
transaction has to wait for all handles to be
ab714aff Jan Kara2016-06-30  1042* dropped to commit that 
transaction and also acquiring a handle may
ab714aff Jan Kara2016-06-30  1043* require transaction commit 
to finish.
ab714aff Jan Kara2016-06-30  1044*/
ab714aff Jan Kara2016-06-30  1045   struct lockdep_map  
j_trans_commit_map;
ab714aff Jan Kara2016-06-30  1046  #endif
470decc6 Dave Kleikamp   2006-10-11 @1047  };
470decc6 Dave Kleikamp   2006-10-11  1048  
1eaa566d Jan Kara2016-06-30  1049  #define 
jbd2_might_wait_for_commit(j) \
1eaa566d Jan Kara2016-06-30  1050   do { \
1eaa566d Jan Kara2016-06-30  1051   
rwsem_acquire(>j_trans_commit_map, 0, 0, _THIS_IP_); \
1eaa566d Jan Kara2016-06-30  1052   
rwsem_release(>j_trans_commit_map, 1, _THIS_IP_); \
1eaa566d Jan Kara2016-06-30  1053   } while (0)
1eaa566d Jan Kara2016-06-30  1054  
56316a0d Darrick J. Wong 2015-10-17  1055  /* journal feature predicate 
functions */

:: The code at line 1047 was first introduced by commit
:: 470decc613ab2048b619a01028072d932d9086ee [PATCH] jbd2: initial copy of 
files from jbd

:: TO: Dave Kleikamp 

Re: [PATCH 11/33] docs: input/event-codes: convert it to ReST format

2017-04-02 Thread Peter Hutterer
On Sat, Apr 01, 2017 at 11:42:05PM -0300, Mauro Carvalho Chehab wrote:
> Em Sun, 2 Apr 2017 11:16:35 +1000
> Peter Hutterer  escreveu:
> 
> > On Sat, Apr 01, 2017 at 03:15:54PM -0300, Mauro Carvalho Chehab wrote:
> > > This file require minimum adjustments to be a valid ReST file.
> > > Do it, in order to be able to parse it with Sphinx.
> > > 
> > > Signed-off-by: Mauro Carvalho Chehab   
> > 
> > there's a  conflict markerleft in this file, see below
> 
> 
> Gah! Sorry for that. The correct patch is enclosed.
> 
> I also updated the html for it:
>   http://www.infradead.org/~mchehab/kernel_docs/input/event-codes.html
> 
> Thanks,
> Mauro
> 
> [PATCH] docs: input/event-codes: convert it to ReST format
> 
> This file require minimum adjustments to be a valid ReST file.
> Do it, in order to be able to parse it with Sphinx.
> 
> Signed-off-by: Mauro Carvalho Chehab 

Appears to do what it should, now :) Thanks for the update

Reviewed-by: Peter Hutterer 

Cheers,
   Peter

> 
> diff --git a/Documentation/input/event-codes.txt 
> b/Documentation/input/event-codes.txt
> index 36ea940e5bb9..92db50954169 100644
> --- a/Documentation/input/event-codes.txt
> +++ b/Documentation/input/event-codes.txt
> @@ -1,3 +1,8 @@
> +=
> +Input event codes
> +=
> +
> +
>  The input protocol uses a map of types and codes to express input device 
> values
>  to userspace. This document describes the types and codes and how and when 
> they
>  may be used.
> @@ -17,82 +22,102 @@ reports supported by a device are also provided by sysfs 
> in
>  class/input/event*/device/capabilities/, and the properties of a device are
>  provided in class/input/event*/device/properties.
>  
> -Event types:
> +Event types
>  ===
> +
>  Event types are groupings of codes under a logical input construct. Each
>  type has a set of applicable codes to be used in generating events. See the
>  Codes section for details on valid codes for each type.
>  
>  * EV_SYN:
> +
>- Used as markers to separate events. Events may be separated in time or in
>  space, such as with the multitouch protocol.
>  
>  * EV_KEY:
> +
>- Used to describe state changes of keyboards, buttons, or other key-like
>  devices.
>  
>  * EV_REL:
> +
>- Used to describe relative axis value changes, e.g. moving the mouse 5 
> units
>  to the left.
>  
>  * EV_ABS:
> +
>- Used to describe absolute axis value changes, e.g. describing the
>  coordinates of a touch on a touchscreen.
>  
>  * EV_MSC:
> +
>- Used to describe miscellaneous input data that do not fit into other 
> types.
>  
>  * EV_SW:
> +
>- Used to describe binary state input switches.
>  
>  * EV_LED:
> +
>- Used to turn LEDs on devices on and off.
>  
>  * EV_SND:
> +
>- Used to output sound to devices.
>  
>  * EV_REP:
> +
>- Used for autorepeating devices.
>  
>  * EV_FF:
> +
>- Used to send force feedback commands to an input device.
>  
>  * EV_PWR:
> +
>- A special type for power button and switch input.
>  
>  * EV_FF_STATUS:
> +
>- Used to receive force feedback device status.
>  
> -Event codes:
> +Event codes
>  ===
> +
>  Event codes define the precise type of event.
>  
> -EV_SYN:
> ---
> +EV_SYN
> +--
> +
>  EV_SYN event values are undefined. Their usage is defined only by when they 
> are
>  sent in the evdev event stream.
>  
>  * SYN_REPORT:
> +
>- Used to synchronize and separate events into packets of input data 
> changes
>  occurring at the same moment in time. For example, motion of a mouse may 
> set
>  the REL_X and REL_Y values for one motion, then emit a SYN_REPORT. The 
> next
>  motion will emit more REL_X and REL_Y values and send another SYN_REPORT.
>  
>  * SYN_CONFIG:
> +
>- TBD
>  
>  * SYN_MT_REPORT:
> +
>- Used to synchronize and separate touch events. See the
>  multi-touch-protocol.txt document for more information.
>  
>  * SYN_DROPPED:
> +
>- Used to indicate buffer overrun in the evdev client's event queue.
>  Client should ignore all events up to and including next SYN_REPORT
>  event and query the device (using EVIOCG* ioctls) to obtain its
>  current state.
>  
> -EV_KEY:
> ---
> +EV_KEY
> +--
> +
>  EV_KEY events take the form KEY_ or BTN_. For example, KEY_A is 
> used
>  to represent the 'A' key on a keyboard. When a key is depressed, an event 
> with
>  the key's code is emitted with value 1. When the key is released, an event is
> @@ -103,6 +128,7 @@ BTN_ is used for other types of momentary switch 
> events.
>  A few EV_KEY codes have special meanings:
>  
>  * BTN_TOOL_:
> +
>- These codes are used in conjunction with input trackpads, tablets, and
>  touchscreens. These devices may be used with fingers, pens, or other 
> tools.
>  When an event occurs and a tool is used, the 

Re: [PATCH v2 01/22] tmplcvt: make the tool more robust

2017-04-02 Thread Jonathan Corbet
On Thu, 30 Mar 2017 07:45:35 -0300
Mauro Carvalho Chehab  wrote:

> Currently, the script just assumes to be called at
> Documentation/sphinx/. Change it to work on any directory,
> and make it abort if something gets wrong.
> 
> Also, be sure that both parameters are specified.
> 
> That should avoid troubles like this:
> 
> $ Documentation/sphinx/tmplcvt Documentation/DocBook/writing_usb_driver.tmpl
> sed: couldn't open file convert_template.sed: No such file or directory

What's the status of this patch set?  I saw that Jani had one comment
that, I think, hasn't been addressed?

Thanks,

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


[PATCH 0/2] Create an initial user-space API manual

2017-04-02 Thread Jonathan Corbet
For a bit we have talked about adding another manual for user-space API
documentation.  This is that manual.  I've started by populating it with
an ancient document that nobody probably cares about, but it shows the
direction I'm thinking of going.

Jonathan Corbet (2):
  docs: Create a user-space API guide
  docs: Convert unshare.txt to RST and add to the user-space API manual

 Documentation/index.rst|  12 ++
 Documentation/userspace-api/conf.py|  10 ++
 Documentation/userspace-api/index.rst  |  26 +++
 .../{unshare.txt => userspace-api/unshare.rst} | 195 -
 4 files changed, 164 insertions(+), 79 deletions(-)
 create mode 100644 Documentation/userspace-api/conf.py
 create mode 100644 Documentation/userspace-api/index.rst
 rename Documentation/{unshare.txt => userspace-api/unshare.rst} (67%)

-- 
2.9.3

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


[PATCH 2/2] docs: Convert unshare.txt to RST and add to the user-space API manual

2017-04-02 Thread Jonathan Corbet
This is a straightforward conversion, without any real textual changes.
Since this document has seen no substantive changes since its addition in
2006, some such changes are probably warranted.

Signed-off-by: Jonathan Corbet 
---
 Documentation/userspace-api/index.rst  |   2 +
 .../{unshare.txt => userspace-api/unshare.rst} | 195 -
 2 files changed, 118 insertions(+), 79 deletions(-)
 rename Documentation/{unshare.txt => userspace-api/unshare.rst} (67%)

diff --git a/Documentation/userspace-api/index.rst 
b/Documentation/userspace-api/index.rst
index 6d98ea6c0d2d..a9d01b44a659 100644
--- a/Documentation/userspace-api/index.rst
+++ b/Documentation/userspace-api/index.rst
@@ -16,6 +16,8 @@ place where this information is gathered.
 .. toctree::
:maxdepth: 2
 
+   unshare
+
 .. only::  subproject and html
 
Indices
diff --git a/Documentation/unshare.txt b/Documentation/userspace-api/unshare.rst
similarity index 67%
rename from Documentation/unshare.txt
rename to Documentation/userspace-api/unshare.rst
index a8643513a5f6..737c192cf4e7 100644
--- a/Documentation/unshare.txt
+++ b/Documentation/userspace-api/unshare.rst
@@ -1,17 +1,17 @@
+unshare system call
+===
 
-unshare system call:
-
-This document describes the new system call, unshare. The document
+This document describes the new system call, unshare(). The document
 provides an overview of the feature, why it is needed, how it can
 be used, its interface specification, design, implementation and
 how it can be tested.
 
-Change Log:

+Change Log
+--
 version 0.1  Initial document, Janak Desai (ja...@us.ibm.com), Jan 11, 2006
 
-Contents:
--
+Contents
+
1) Overview
2) Benefits
3) Cost
@@ -24,6 +24,7 @@ Contents:
 
 1) Overview
 ---
+
 Most legacy operating system kernels support an abstraction of threads
 as multiple execution contexts within a process. These kernels provide
 special resources and mechanisms to maintain these "threads". The Linux
@@ -38,33 +39,35 @@ threads. On Linux, at the time of thread creation using the 
clone system
 call, applications can selectively choose which resources to share
 between threads.
 
-unshare system call adds a primitive to the Linux thread model that
+unshare() system call adds a primitive to the Linux thread model that
 allows threads to selectively 'unshare' any resources that were being
-shared at the time of their creation. unshare was conceptualized by
+shared at the time of their creation. unshare() was conceptualized by
 Al Viro in the August of 2000, on the Linux-Kernel mailing list, as part
-of the discussion on POSIX threads on Linux.  unshare augments the
+of the discussion on POSIX threads on Linux.  unshare() augments the
 usefulness of Linux threads for applications that would like to control
-shared resources without creating a new process. unshare is a natural
+shared resources without creating a new process. unshare() is a natural
 addition to the set of available primitives on Linux that implement
 the concept of process/thread as a virtual machine.
 
 2) Benefits
 ---
-unshare would be useful to large application frameworks such as PAM
+
+unshare() would be useful to large application frameworks such as PAM
 where creating a new process to control sharing/unsharing of process
 resources is not possible. Since namespaces are shared by default
-when creating a new process using fork or clone, unshare can benefit
+when creating a new process using fork or clone, unshare() can benefit
 even non-threaded applications if they have a need to disassociate
 from default shared namespace. The following lists two use-cases
-where unshare can be used.
+where unshare() can be used.
 
 2.1 Per-security context namespaces

-unshare can be used to implement polyinstantiated directories using
+~~~
+
+unshare() can be used to implement polyinstantiated directories using
 the kernel's per-process namespace mechanism. Polyinstantiated directories,
 such as per-user and/or per-security context instance of /tmp, /var/tmp or
 per-security context instance of a user's home directory, isolate user
-processes when working with these directories. Using unshare, a PAM
+processes when working with these directories. Using unshare(), a PAM
 module can easily setup a private namespace for a user at login.
 Polyinstantiated directories are required for Common Criteria certification
 with Labeled System Protection Profile, however, with the availability
@@ -74,33 +77,36 @@ polyinstantiating /tmp, /var/tmp and other directories 
deemed
 appropriate by system administrators.
 
 2.2 unsharing of virtual memory and/or open files
--
+~
+
 Consider a client/server application where the server is 

[PATCH 1/2] docs: Create a user-space API guide

2017-04-02 Thread Jonathan Corbet
This is meant to be the place for documentation relevant to application
developers.  It's empty for the moment, but at least we have a place now!

Signed-off-by: Jonathan Corbet 
---
 Documentation/index.rst   | 12 
 Documentation/userspace-api/conf.py   | 10 ++
 Documentation/userspace-api/index.rst | 24 
 3 files changed, 46 insertions(+)
 create mode 100644 Documentation/userspace-api/conf.py
 create mode 100644 Documentation/userspace-api/index.rst

diff --git a/Documentation/index.rst b/Documentation/index.rst
index f6e641a54bbc..12550cc1e2a3 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -24,6 +24,18 @@ trying to get it to work optimally on a given system.
 
admin-guide/index
 
+Application-developer documentation
+---
+
+The user-space API manual gathers together documents describing aspects of
+the kernel interface as seen by application developers.
+
+.. toctree::
+   :maxdepth: 2
+
+   userspace-api/index   
+
+
 Introduction to kernel development
 --
 
diff --git a/Documentation/userspace-api/conf.py 
b/Documentation/userspace-api/conf.py
new file mode 100644
index ..2eaf59f844e5
--- /dev/null
+++ b/Documentation/userspace-api/conf.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8; mode: python -*-
+
+project = "The Linux kernel user-space API guide"
+
+tags.add("subproject")
+
+latex_documents = [
+('index', 'userspace-api.tex', project,
+ 'The kernel development community', 'manual'),
+]
diff --git a/Documentation/userspace-api/index.rst 
b/Documentation/userspace-api/index.rst
new file mode 100644
index ..6d98ea6c0d2d
--- /dev/null
+++ b/Documentation/userspace-api/index.rst
@@ -0,0 +1,24 @@
+=
+The Linux kernel user-space API guide
+=
+
+.. _man-pages: https://www.kernel.org/doc/man-pages/
+
+While much of the kernel's user-space API is documented elsewhere
+(particularly in the man-pages_ project), some user-space information can
+also be found in the kernel tree itself.  This manual is intended to be the
+place where this information is gathered.
+
+.. class:: toc-title
+
+  Table of contents
+
+.. toctree::
+   :maxdepth: 2
+
+.. only::  subproject and html
+
+   Indices
+   ===
+
+   * :ref:`genindex`
-- 
2.9.3

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


Re: [PATCH 0/9] convert genericirq.tmpl and kernel-api.tmpl to DocBook

2017-04-02 Thread Jonathan Corbet
On Thu, 30 Mar 2017 17:11:27 -0300
Mauro Carvalho Chehab  wrote:

> This series converts just two documents, adding them to the
> core-api.rst book. It addresses the errors/warnings that popup
> after the conversion.
> 
> I had to add two fixes to scripts/kernel-doc, in order to solve
> some of the issues.

I've applied the set, including the add-on to move some stuff to
driver-api - thanks.

For whatever reason, I had a hard time applying a few of these; "git am"
would tell me this:

> Applying: docs-rst: core_api: move driver-specific stuff to drivers_api
> fatal: sha1 information is lacking or useless 
> (Documentation/driver-api/index.rst).
> Patch failed at 0001 docs-rst: core_api: move driver-specific stuff to 
> drivers_api
> The copy of the patch that failed is found in: .git/rebase-apply/patch

I was able to get around this, but it took some hand work.  How are you
generating these?

Thanks,

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


Re: [PATCH linux v9 2/5] hwmon: occ: Add sysfs interface

2017-04-02 Thread Guenter Roeck

On 03/14/2017 01:55 PM, Eddie James wrote:

From: "Edward A. James" 

Add a generic mechanism to expose the sensors provided by the OCC in
sysfs.

Signed-off-by: Edward A. James 
Signed-off-by: Andrew Jeffery 
---
 Documentation/hwmon/occ   |  62 +++
 drivers/hwmon/occ/Makefile|   2 +-
 drivers/hwmon/occ/occ_sysfs.c | 253 ++
 drivers/hwmon/occ/occ_sysfs.h |  25 +
 4 files changed, 341 insertions(+), 1 deletion(-)
 create mode 100644 drivers/hwmon/occ/occ_sysfs.c
 create mode 100644 drivers/hwmon/occ/occ_sysfs.h

diff --git a/Documentation/hwmon/occ b/Documentation/hwmon/occ
index d1c863b..580af26 100644
--- a/Documentation/hwmon/occ
+++ b/Documentation/hwmon/occ
@@ -27,6 +27,68 @@ Currently, all versions of the OCC support four types of 
sensor data: power,
 temperature, frequency, and "caps," which indicate limits and thresholds used
 internally on the OCC.

+sysfs Entries
+-
+
+The OCC driver uses the hwmon sysfs framework to provide data to userspace.
+
+The driver exports a number of sysfs files for each type of sensor. The
+sensor-specific files vary depending on the processor type, though many of the
+attributes are common for both the POWER8 and POWER9.
+
+The hwmon interface cannot define every type of sensor that may be used.
+Therefore, the frequency sensor on the OCC uses the "input" type sensor defined
+by the hwmon interface, rather than defining a new type of custom sensor.
+
+Below are detailed the names and meaning of each sensor file for both types of
+processors. All sensors are read-only unless otherwise specified.  indicates
+the hwmon index. sensor id indicates the unique internal OCC identifer. Please
+see the POWER OCC specification for details on all these sensor values.
+
+frequency:
+   all processors:
+   in_input - frequency value
+   in_label - sensor id
+temperature:
+   POWER8:
+   temp_input - temperature value
+   temp_label - sensor id
+   POWER9 (in addition to above):
+   temp_type - FRU type
+
+power:
+   POWER8:
+   power_input - power value
+   power_label - sensor id
+   power_average - accumulator
+   power_average_interval - update tag (number of samples in
+   accumulator)
+   POWER9:
+   power_input - power value
+   power_label - sensor id
+   power_average_min - accumulator[0]
+   power_average_max - accumulator[1] (64 bits total)
+   power_average_interval - update tag
+   power_reset_history - (function_id | (apss_channel << 8)
+
+caps:
+   POWER8:
+   power_cap - current powercap
+   power_cap_max - max powercap
+   power_cap_min - min powercap
+   power_max - normal powercap
+   power_alarm - user powercap, r/w
+   POWER9:
+   power_cap_alarm - user powercap source
+
+The driver also provides two sysfs entries through hwmon to better
+control the driver and monitor the master OCC. Though there may be multiple
+OCCs present on the system, these two files are only present for the "master"
+OCC.
+   name - read the name of the driver
+   update_interval - read or write the minimum interval for polling the
+   OCC.
+
 BMC - Host Communications
 -

diff --git a/drivers/hwmon/occ/Makefile b/drivers/hwmon/occ/Makefile
index 3ed79a5..67b5367 100644
--- a/drivers/hwmon/occ/Makefile
+++ b/drivers/hwmon/occ/Makefile
@@ -1 +1 @@
-obj-$(CONFIG_SENSORS_IBM_OCC) += occ.o
+obj-$(CONFIG_SENSORS_IBM_OCC) += occ.o occ_sysfs.o
diff --git a/drivers/hwmon/occ/occ_sysfs.c b/drivers/hwmon/occ/occ_sysfs.c
new file mode 100644
index 000..50b20e2
--- /dev/null
+++ b/drivers/hwmon/occ/occ_sysfs.c
@@ -0,0 +1,253 @@
+/*
+ * occ_sysfs.c - OCC sysfs interface
+ *
+ * This file contains the methods and data structures for implementing the OCC
+ * hwmon sysfs entries.
+ *
+ * Copyright 2017 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "occ.h"
+#include "occ_sysfs.h"
+
+#define OCC_HWMON_NAME_LENGTH  32
+
+struct occ_sysfs {
+   struct device *dev;
+   struct occ *occ;
+
+   char label_buffer[OCC_HWMON_NAME_LENGTH + 1];
+   char hwmon_name[OCC_HWMON_NAME_LENGTH + 1];
+   const u32 *sensor_hwmon_configs;
+   struct hwmon_channel_info **occ_sensors;
+   struct hwmon_chip_info occ_info;
+   u16 user_powercap;
+};
+
+static int